From 3d48c2a2b94018e77b8184c74f990d9e56e33113 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 5 Dec 2010 16:47:37 +0100 Subject: [PATCH] entities.def -> entities.ent convereter script beginning --- scripts/entities.def2ent | 107 ++++++++++++++++++++++++++++++++++++++- scripts/turrets.def | 8 ++- 2 files changed, 109 insertions(+), 6 deletions(-) diff --git a/scripts/entities.def2ent b/scripts/entities.def2ent index 9de5aa2c..d7e11f2e 100644 --- a/scripts/entities.def2ent +++ b/scripts/entities.def2ent @@ -3,6 +3,105 @@ use strict; use warnings; +my %types; +my %types_override; + +open my $fh, '<', '../../xonotic-data.pk3dir/qcsrc/server/qc.asm' + or die "must have qc.asm in server qc"; +while(<$fh>) +{ + chomp; + if(/^\.(\w+) (\w+);$/) + { + if($1 eq "float") + { + $types{$2} = "real"; + } + elsif($1 eq "string") + { + $types{$2} = "string"; + } + elsif($1 eq "vector") + { + $types{$2} = "real3"; + } + } +} + +# specialization +$types{angle} = "angle"; +$types{angles} = "angles"; +$types{_color} = "color"; +$types{colormod} = "color"; +$types{killtarget} = "target"; +$types{model2} = "model"; +$types{model} = "model"; +$types{noise} = "sound"; +$types{noise1} = "sound"; +$types{noise2} = "sound"; +$types{noise3} = "sound"; +$types{target2} = "target"; +$types{target3} = "target"; +$types{target4} = "target"; +$types{targetname} = "targetname"; +$types{target} = "target"; + +# missing definition in QC, q3map2 only +$types{_ambient} = "real"; +$types{_anglescale} = "real"; +$types{author} = "string"; +$types{_blocksize} = "integer3"; +$types{_castshadows} = "boolean"; +$types{_celshader} = "texture"; +$types{_clonename} = "targetname"; +$types{_clone} = "target"; +$types{_description} = "string"; +$types{_deviance} = "real"; +$types{fade} = "real"; +$types{_farplanedist} = "real"; +$types{_filterradius} = "real"; +$types{_floodlight} = "string"; +$types{_frame} = "real"; +$types{gridsize} = "integer3"; +$types{_ignoreleaks} = "boolean"; +$types{_indexmap} = "texture"; +$types{key1} = "string"; +$types{key2} = "string"; +$types{_layers} = "integer"; +$types{_lightmapscale} = "real"; +$types{light} = "real"; +$types{max} = "real3"; +$types{_mingridlight} = "real"; +$types{_minlight} = "real"; +$types{min} = "real3"; +$types{modelscale_vec} = "real3"; +$types{_noshadersun} = "boolean"; +$types{_offsets} = "string"; +$types{_receiveshadows} = "boolean"; +$types{_remap} = "array"; +$types{_samples} = "integer"; +$types{_scale} = "real"; +$types{_shader} = "texture"; +$types{_sun} = "boolean"; + +# XML types: +# angle specialisation of real - Yaw angle +# angles specialisation of real3 - Pitch Yaw Roll +# array an array of strings - value is a semi-colon-delimited string +# boolean an integer - shows as a checkbox - true = non-zero +# color specialisation of real3 - RGB floating-point colour +# direction specialisation of real - Yaw angle, -1 = down, -2 = up +# integer2 two integer values +# integer3 three integer values +# integer an integer value +# model the VFS path to a model file +# skin the VFS path to a skin file +# sound the VFS path to a sound file +# target a string that uniquely identifies an entity or group of entities +# targetname a string that uniquely identifies an entity or group of entities +# texture the VFS path to a texture file or a shader name + + print < @@ -10,6 +109,7 @@ EOF my $closetag; my @spawnflags; +my $class; while() { chomp; @@ -19,12 +119,14 @@ while() s/"/"/g; if(/^\/\*QUAKED (\S+) \((\S+ \S+ \S+)\) \((\S+ \S+ \S+)\) \((\S+ \S+ \S+)\) ?(.*)/) { + $class = $1; print "\n"; $closetag = ""; @spawnflags = split / /, $5; } elsif(/^\/\*QUAKED (\S+) \((\S+ \S+ \S+)\) \? ?(.*)/) { + $class = $1; print "\n"; $closetag = ""; @spawnflags = split / /, $3; @@ -35,7 +137,10 @@ while() } elsif(/^([0-9a-z_]*): +(.*)/) { - print "$2\n"; + my $type = $types_override{$class}{$1} || $types{$1}; + warn "No type for $1" + if not defined $type; + print "<$type key=\"$1\" name=\"$1\">$2\n"; } elsif(/^([0-9A-Z_]*): +(.*)/) { diff --git a/scripts/turrets.def b/scripts/turrets.def index dbc3a355..6ed2e286 100644 --- a/scripts/turrets.def +++ b/scripts/turrets.def @@ -184,8 +184,7 @@ turret_scale_refire: 2 = doubble refire (SLOWER!), 0.5 = half (FASTER!) turret_scale_ammo: 2 = doubble ammo carry & regen, 0.5 = half ammo carry & regen turret_scale_aim: 2 = aim twice as fast, 0,5 = aim at half speed turret_scale_health: 2 = double health, 0.5 = half - -team : 5=red, 14=blue +team: 5=red, 14=blue -----------SPAWNFLAGS----------- ---------NOTES---------- @@ -204,8 +203,7 @@ turret_scale_refire: 2 = doubble refire (SLOWER!), 0.5 = half (FASTER!) turret_scale_ammo: 2 = doubble ammo carry & regen, 0.5 = half ammo carry & regen turret_scale_aim: 2 = aim twice as fast, 0,5 = aim at half speed turret_scale_health: 2 = double health, 0.5 = half - -team : 5=red, 14=blue +team: 5=red, 14=blue -----------SPAWNFLAGS----------- ---------NOTES---------- @@ -225,4 +223,4 @@ wait: Pause at this point # seconds. ---------NOTES---------- If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly. If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached. -*/ \ No newline at end of file +*/ -- 2.39.2