vmap: Allow non underscore versions of light key/value pairs

This commit is contained in:
Marco Cawthorne 2021-06-29 21:11:40 +02:00
parent bcadd67229
commit 223182aac5
3 changed files with 58 additions and 11 deletions

View file

@ -490,6 +490,26 @@ private:
dupecheck = 1; dupecheck = 1;
else if (!strcmp(key, "message")) else if (!strcmp(key, "message"))
dupecheck = 1; dupecheck = 1;
else if (!strcmp(key, "fade")) /* light keys */
dupecheck = 1;
else if (!strcmp(key, "anglescale"))
dupecheck = 1;
else if (!strcmp(key, "style"))
dupecheck = 1;
else if (!strcmp(key, "light"))
dupecheck = 1;
else if (!strcmp(key, "deviance"))
dupecheck = 1;
else if (!strcmp(key, "samples"))
dupecheck = 1;
else if (!strcmp(key, "filter"))
dupecheck = 1;
else if (!strcmp(key, "color"))
dupecheck = 1;
else if (!strcmp(key, "color255"))
dupecheck = 1;
else if (!strcmp(key, "extradist"))
dupecheck = 1;
KeyValues::iterator i = m_keyValues.find( key ); KeyValues::iterator i = m_keyValues.find( key );

View file

@ -319,17 +319,16 @@ void HelpImport()
void HelpCommon() void HelpCommon()
{ {
struct HelpOption common[] = { struct HelpOption common[] = {
{"-game <gamename>", "Sets a different game directory name (can be used more than once)"},
{"-connect <address>", "Talk to a WorldSpawn instance using a specific XML based protocol"}, {"-connect <address>", "Talk to a WorldSpawn instance using a specific XML based protocol"},
{"-force", "Allow reading some broken/unsupported BSP files e.g. when decompiling, may also crash"}, {"-force", "Allow reading some broken/unsupported BSP files e.g. when decompiling, may also crash"},
{"-fs_basepath <path>", "Sets the given path as main directory of the game (can be used more than once to look in multiple paths)"}, {"-fs_basepath <path>", "Sets the given path as main directory of the game (can be used more than once to look in multiple paths)"},
{"-fs_game <gamename>", "Sets a different game directory name (default for Q3A: baseq3, can be used more than once)"},
{"-fs_homebase <dir>", "Specifies where the user home directory name is on Linux (default for Q3A: .q3a)"}, {"-fs_homebase <dir>", "Specifies where the user home directory name is on Linux (default for Q3A: .q3a)"},
{"-fs_homepath <path>", "Sets the given path as home directory name"}, {"-fs_homepath <path>", "Sets the given path as home directory name"},
{"-fs_nobasepath", "Do not load base paths in VFS, imply -fs_nomagicpath"}, {"-fs_nobasepath", "Do not load base paths in VFS, imply -fs_nomagicpath"},
{"-fs_nomagicpath", "Do not try to guess base path magically"}, {"-fs_nomagicpath", "Do not try to guess base path magically"},
{"-fs_nohomepath", "Do not load home path in VFS"}, {"-fs_nohomepath", "Do not load home path in VFS"},
{"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"}, {"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"},
{"-game <gamename>", "Load settings for the given game (default: quake3)"},
{"-subdivisions <F>", "multiplier for patch subdivisions quality"}, {"-subdivisions <F>", "multiplier for patch subdivisions quality"},
{"-threads <N>", "number of threads to use"}, {"-threads <N>", "number of threads to use"},
{"-v", "Verbose mode"} {"-v", "Verbose mode"}
@ -341,8 +340,8 @@ void HelpCommon()
void HelpMain(const char* arg) void HelpMain(const char* arg)
{ {
printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n"); printf("Usage: vmap [stage] [common options...] [stage options...] [stage source file]\n");
printf(" q3map2 -help [stage]\n\n"); printf(" vmap -help [stage]\n\n");
HelpCommon(); HelpCommon();

View file

@ -411,7 +411,11 @@ void CreateEntityLights( void ){
} }
/* ydnar: set angle scaling (from vlight) */ /* ydnar: set angle scaling (from vlight) */
light->angleScale = FloatForKey( e, "anglescale" );
if ( light->angleScale != 0.0f ) {
light->angleScale = FloatForKey( e, "_anglescale" ); light->angleScale = FloatForKey( e, "_anglescale" );
}
if ( light->angleScale != 0.0f ) { if ( light->angleScale != 0.0f ) {
light->flags |= LIGHT_ATTEN_ANGLE; light->flags |= LIGHT_ATTEN_ANGLE;
} }
@ -447,14 +451,22 @@ void CreateEntityLights( void ){
intensity *= scale; intensity *= scale;
/* ydnar: get deviance and samples */ /* ydnar: get deviance and samples */
deviance = FloatForKey( e, "deviance" );
if ( deviance == 0.0f ) {
deviance = FloatForKey( e, "_deviance" ); deviance = FloatForKey( e, "_deviance" );
}
if ( deviance == 0.0f ) { if ( deviance == 0.0f ) {
deviance = FloatForKey( e, "_deviation" ); deviance = FloatForKey( e, "_deviation" );
} }
if ( deviance == 0.0f ) { if ( deviance == 0.0f ) {
deviance = FloatForKey( e, "_jitter" ); deviance = FloatForKey( e, "_jitter" );
} }
numSamples = IntForKey( e, "samples" );
if ( numSamples < 1 ) {
numSamples = IntForKey( e, "_samples" ); numSamples = IntForKey( e, "_samples" );
}
if ( deviance < 0.0f || numSamples < 1 ) { if ( deviance < 0.0f || numSamples < 1 ) {
deviance = 0.0f; deviance = 0.0f;
numSamples = 1; numSamples = 1;
@ -462,7 +474,10 @@ void CreateEntityLights( void ){
intensity /= numSamples; intensity /= numSamples;
/* ydnar: get filter radius */ /* ydnar: get filter radius */
filterRadius = FloatForKey( e, "filter" );
if ( filterRadius == 0.0f ) {
filterRadius = FloatForKey( e, "_filterradius" ); filterRadius = FloatForKey( e, "_filterradius" );
}
if ( filterRadius == 0.0f ) { if ( filterRadius == 0.0f ) {
filterRadius = FloatForKey( e, "_filteradius" ); filterRadius = FloatForKey( e, "_filteradius" );
} }
@ -475,7 +490,11 @@ void CreateEntityLights( void ){
light->filterRadius = filterRadius; light->filterRadius = filterRadius;
/* set light color */ /* set light color */
_color = ValueForKey( e, "color" );
if ( !(_color && _color[ 0 ]) ) {
_color = ValueForKey( e, "_color" ); _color = ValueForKey( e, "_color" );
}
if ( _color && _color[ 0 ] ) { if ( _color && _color[ 0 ] ) {
sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] ); sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] );
if ( colorsRGB ) { if ( colorsRGB ) {
@ -488,7 +507,12 @@ void CreateEntityLights( void ){
}*/ }*/
} else { } else {
/* alternative: read color in RGB8 values -eukara */ /* alternative: read color in RGB8 values -eukara */
_color = ValueForKey( e, "color255" );
if ( !(_color && _color[ 0 ]) ) {
_color = ValueForKey( e, "_color255" ); _color = ValueForKey( e, "_color255" );
}
if ( _color && _color[ 0 ] ) { if ( _color && _color[ 0 ] ) {
sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] ); sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] );
light->color[0] /= 255; light->color[0] /= 255;
@ -505,7 +529,11 @@ void CreateEntityLights( void ){
} }
} }
light->extraDist = FloatForKey( e, "extradist" );
if ( light->extraDist == 0.0f ) {
light->extraDist = FloatForKey( e, "_extradist" ); light->extraDist = FloatForKey( e, "_extradist" );
}
if ( light->extraDist == 0.0f ) { if ( light->extraDist == 0.0f ) {
light->extraDist = extraDist; light->extraDist = extraDist;
} }