X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=scripts%2Fentities.def2ent;h=f709af2a8a096a80715af687db184a6ac63ca48c;hb=e8ad846bfb58ce88176766d032b2fe2bf7e59551;hp=9de5aa2c6cb5379cb63831a792ec64b8acfb5342;hpb=96fbd27e83b6dfe14a6e3e5b76bcd9b380c608c1;p=xonotic%2Fxonotic-maps.pk3dir.git diff --git a/scripts/entities.def2ent b/scripts/entities.def2ent old mode 100644 new mode 100755 index 9de5aa2c..f709af2a --- a/scripts/entities.def2ent +++ b/scripts/entities.def2ent @@ -3,6 +3,106 @@ 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} = "direction"; +$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"; +$types{team} = "integer"; + +# 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 +110,7 @@ EOF my $closetag; my @spawnflags; +my $class; while() { chomp; @@ -19,12 +120,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 +138,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_]*): +(.*)/) {