From dbeb2d07184fbcd25130adb03ac927c2ec4ada11 Mon Sep 17 00:00:00 2001 From: Garux Date: Mon, 13 Sep 2021 18:49:09 +0300 Subject: [PATCH] rename game -> g_game --- tools/quake3/q3map2/autopk3.cpp | 14 ++++----- tools/quake3/q3map2/bsp.cpp | 14 ++++----- tools/quake3/q3map2/bspfile_abstract.cpp | 16 +++++------ tools/quake3/q3map2/bspfile_ibsp.cpp | 22 +++++++-------- tools/quake3/q3map2/bspfile_rbsp.cpp | 12 ++++---- tools/quake3/q3map2/convert_bsp.cpp | 2 +- tools/quake3/q3map2/convert_obj.cpp | 4 +-- tools/quake3/q3map2/games.cpp | 2 +- tools/quake3/q3map2/games.h | 2 +- tools/quake3/q3map2/light.cpp | 36 ++++++++++++------------ tools/quake3/q3map2/lightmaps_ydnar.cpp | 26 ++++++++--------- tools/quake3/q3map2/main.cpp | 2 +- tools/quake3/q3map2/map.cpp | 2 +- tools/quake3/q3map2/minimap.cpp | 12 ++++---- tools/quake3/q3map2/path_init.cpp | 16 +++++------ tools/quake3/q3map2/shaders.cpp | 12 ++++---- tools/quake3/q3map2/surface.cpp | 2 +- tools/quake3/q3map2/writebsp.cpp | 2 +- 18 files changed, 99 insertions(+), 99 deletions(-) diff --git a/tools/quake3/q3map2/autopk3.cpp b/tools/quake3/q3map2/autopk3.cpp index fa08a83e..21c71834 100644 --- a/tools/quake3/q3map2/autopk3.cpp +++ b/tools/quake3/q3map2/autopk3.cpp @@ -320,7 +320,7 @@ int pk3BSPMain( int argc, char **argv ){ } } - pk3Shaderfiles = vfsListShaderFiles( game->shaderPath ); + pk3Shaderfiles = vfsListShaderFiles( g_game->shaderPath ); if( dbg ){ Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() ); @@ -342,7 +342,7 @@ int pk3BSPMain( int argc, char **argv ){ char* ExReasonShaderFile[4096] = { NULL }; { - parseEXfile( stream( game->arg, ".exclude" ), ExTextures, ExShaders, ExShaderfiles, ExSounds, ExVideos ); + parseEXfile( stream( g_game->arg, ".exclude" ), ExTextures, ExShaders, ExShaderfiles, ExSounds, ExVideos ); for ( i = 0; i < ExTextures->n; ++i ){ if( !StrList_find( ExShaders, ExTextures->s[i] ) ) @@ -389,7 +389,7 @@ int pk3BSPMain( int argc, char **argv ){ /* load the shader */ char scriptFile[128]; - sprintf( scriptFile, "%s/%s", game->shaderPath, file.c_str() ); + sprintf( scriptFile, "%s/%s", g_game->shaderPath, file.c_str() ); SilentLoadScriptFile( scriptFile, 0 ); if( dbg ) Sys_Printf( "\n\tentering %s\n", file.c_str() ); @@ -682,7 +682,7 @@ int pk3BSPMain( int argc, char **argv ){ for ( CopiedString& file : pk3Shaderfiles ){ if ( !file.empty() ){ - stream( game->shaderPath, "/", file.c_str() ); + stream( g_game->shaderPath, "/", file.c_str() ); if ( !packResource( stream, packname, compLevel ) ){ Sys_FPrintf( SYS_WRN, " !FAIL! %s\n", pk3Shaders->s[i] ); packFAIL = true; @@ -784,7 +784,7 @@ int repackBSPMain( int argc, char **argv ){ StrList* ExPureTextures = StrList_allocate( 4096 ); { - parseEXfile( stream( game->arg, ".exclude" ), ExTextures, ExShaders, ExShaderfiles, ExSounds, ExVideos ); + parseEXfile( stream( g_game->arg, ".exclude" ), ExTextures, ExShaders, ExShaderfiles, ExSounds, ExVideos ); for ( i = 0; i < ExTextures->n; ++i ){ if( !StrList_find( ExShaders, ExTextures->s[i] ) ) @@ -1105,7 +1105,7 @@ int repackBSPMain( int argc, char **argv ){ - pk3Shaderfiles = vfsListShaderFiles( game->shaderPath ); + pk3Shaderfiles = vfsListShaderFiles( g_game->shaderPath ); if( dbg ){ Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() ); @@ -1140,7 +1140,7 @@ int repackBSPMain( int argc, char **argv ){ /* load the shader */ char scriptFile[128]; - sprintf( scriptFile, "%s/%s", game->shaderPath, file.c_str() ); + sprintf( scriptFile, "%s/%s", g_game->shaderPath, file.c_str() ); if ( dbg ) Sys_Printf( "\n\tentering %s\n", file.c_str() ); SilentLoadScriptFile( scriptFile, 0 ); diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index 17d14f37..c2776302 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -683,13 +683,13 @@ int BSPMain( int argc, char **argv ){ strClear( tempSource ); /* set standard game flags */ - maxLMSurfaceVerts = game->maxLMSurfaceVerts; - maxSurfaceVerts = game->maxSurfaceVerts; - maxSurfaceIndexes = game->maxSurfaceIndexes; - emitFlares = game->emitFlares; - texturesRGB = game->texturesRGB; - colorsRGB = game->colorsRGB; - keepLights = game->keepLights; + maxLMSurfaceVerts = g_game->maxLMSurfaceVerts; + maxSurfaceVerts = g_game->maxSurfaceVerts; + maxSurfaceIndexes = g_game->maxSurfaceIndexes; + emitFlares = g_game->emitFlares; + texturesRGB = g_game->texturesRGB; + colorsRGB = g_game->colorsRGB; + keepLights = g_game->keepLights; /* process arguments */ for ( i = 1; i < ( argc - 1 ); i++ ) diff --git a/tools/quake3/q3map2/bspfile_abstract.cpp b/tools/quake3/q3map2/bspfile_abstract.cpp index 819f71f1..09ad234f 100644 --- a/tools/quake3/q3map2/bspfile_abstract.cpp +++ b/tools/quake3/q3map2/bspfile_abstract.cpp @@ -349,12 +349,12 @@ void AddLump( FILE *file, bspHeader_t *header, int lumpNum, const void *data, in void LoadBSPFile( const char *filename ){ /* dummy check */ - if ( game == NULL || game->load == NULL ) { + if ( g_game == NULL || g_game->load == NULL ) { Error( "LoadBSPFile: unsupported BSP file format" ); } /* load it, then byte swap the in-memory version */ - game->load( filename ); + g_game->load( filename ); SwapBSPFile(); } @@ -366,12 +366,12 @@ void LoadBSPFile( const char *filename ){ void PartialLoadBSPFile( const char *filename ){ /* dummy check */ - if ( game == NULL || game->load == NULL ) { + if ( g_game == NULL || g_game->load == NULL ) { Error( "LoadBSPFile: unsupported BSP file format" ); } /* load it, then byte swap the in-memory version */ - //game->load( filename ); + //g_game->load( filename ); PartialLoadIBSPFile( filename ); /* PartialSwapBSPFile() */ @@ -407,7 +407,7 @@ void WriteBSPFile( const char *filename ){ /* dummy check */ - if ( game == NULL || game->write == NULL ) { + if ( g_game == NULL || g_game->write == NULL ) { Error( "WriteBSPFile: unsupported BSP file format" ); } @@ -417,7 +417,7 @@ void WriteBSPFile( const char *filename ){ /* byteswap, write the bsp, then swap back so it can be manipulated further */ SwapBSPFile(); - game->write( tempname ); + g_game->write( tempname ); SwapBSPFile(); /* replace existing bsp file */ @@ -491,7 +491,7 @@ void PrintBSPFileSizes( void ){ Sys_Printf( "\n" ); Sys_Printf( "%9d lightmaps %9d\n", - numBSPLightBytes / ( game->lightmapSize * game->lightmapSize * 3 ), numBSPLightBytes ); + numBSPLightBytes / ( g_game->lightmapSize * g_game->lightmapSize * 3 ), numBSPLightBytes ); Sys_Printf( "%9d lightgrid %9d *\n", numBSPGridPoints, (int) ( numBSPGridPoints * sizeof( *bspGridPoints ) ) ); Sys_Printf( " visibility %9d\n", @@ -839,7 +839,7 @@ void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castS } /* vortex: game-specific default entity keys */ - if ( striEqual( game->magic, "dq" ) || striEqual( game->magic, "prophecy" ) ) { + if ( striEqual( g_game->magic, "dq" ) || striEqual( g_game->magic, "prophecy" ) ) { /* vortex: deluxe quake default shadow flags */ if ( ent->classname_is( "func_wall" ) ) { if ( recvShadows != NULL ) { diff --git a/tools/quake3/q3map2/bspfile_ibsp.cpp b/tools/quake3/q3map2/bspfile_ibsp.cpp index ede59d1a..0ab77cee 100644 --- a/tools/quake3/q3map2/bspfile_ibsp.cpp +++ b/tools/quake3/q3map2/bspfile_ibsp.cpp @@ -424,11 +424,11 @@ void LoadIBSPFile( const char *filename ){ SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); /* make sure it matches the format we're trying to load */ - if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { - Error( "%s is not a %s file", filename, game->bspIdent ); + if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) { + Error( "%s is not a %s file", filename, g_game->bspIdent ); } - if ( !force && header->version != game->bspVersion ) { - Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); + if ( !force && header->version != g_game->bspVersion ) { + Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion ); } /* load/convert lumps */ @@ -469,7 +469,7 @@ void LoadIBSPFile( const char *filename ){ CopyLightGridLumps( header ); /* advertisements */ - if ( header->version == 47 && strEqual( game->arg, "quakelive" ) ) { // quake live's bsp version minus wolf, et, etut + if ( header->version == 47 && strEqual( g_game->arg, "quakelive" ) ) { // quake live's bsp version minus wolf, et, etut numBSPAds = CopyLump( (bspHeader_t*) header, LUMP_ADVERTISEMENTS, bspAds, sizeof( bspAdvertisement_t ) ); } else{ @@ -496,11 +496,11 @@ void PartialLoadIBSPFile( const char *filename ){ SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); /* make sure it matches the format we're trying to load */ - if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { - Error( "%s is not a %s file", filename, game->bspIdent ); + if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) { + Error( "%s is not a %s file", filename, g_game->bspIdent ); } - if ( !force && header->version != game->bspVersion ) { - Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); + if ( !force && header->version != g_game->bspVersion ) { + Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion ); } /* load/convert lumps */ @@ -536,8 +536,8 @@ void WriteIBSPFile( const char *filename ){ //% Swapfile(); /* set up header */ - *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) game->bspIdent ); - header->version = LittleLong( game->bspVersion ); + *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) g_game->bspIdent ); + header->version = LittleLong( g_game->bspVersion ); /* write initial header */ file = SafeOpenWrite( filename ); diff --git a/tools/quake3/q3map2/bspfile_rbsp.cpp b/tools/quake3/q3map2/bspfile_rbsp.cpp index d2e32c61..866c795c 100644 --- a/tools/quake3/q3map2/bspfile_rbsp.cpp +++ b/tools/quake3/q3map2/bspfile_rbsp.cpp @@ -215,11 +215,11 @@ void LoadRBSPFile( const char *filename ){ SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); /* make sure it matches the format we're trying to load */ - if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { - Error( "%s is not a %s file", filename, game->bspIdent ); + if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) { + Error( "%s is not a %s file", filename, g_game->bspIdent ); } - if ( !force && header->version != game->bspVersion ) { - Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); + if ( !force && header->version != g_game->bspVersion ) { + Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion ); } /* load/convert lumps */ @@ -289,8 +289,8 @@ void WriteRBSPFile( const char *filename ){ //% Swapfile(); /* set up header */ - *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) game->bspIdent ); - header->version = LittleLong( game->bspVersion ); + *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) g_game->bspIdent ); + header->version = LittleLong( g_game->bspVersion ); /* write initial header */ file = SafeOpenWrite( filename ); diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index cce78ed9..f8791227 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -925,7 +925,7 @@ int ConvertBSPMain( int argc, char **argv ){ /* bsp format convert? */ if ( convertGame != NULL ) { /* set global game */ - game = convertGame; + g_game = convertGame; /* write bsp */ path_set_extension( source, "_c.bsp" ); diff --git a/tools/quake3/q3map2/convert_obj.cpp b/tools/quake3/q3map2/convert_obj.cpp index e5d87dd5..14255473 100644 --- a/tools/quake3/q3map2/convert_obj.cpp +++ b/tools/quake3/q3map2/convert_obj.cpp @@ -205,7 +205,7 @@ static void ConvertLightmapToMTL( FILE *f, const char *base, int lightmapNum ){ int Convert_CountLightmaps( const char* dirname ){ int lightmapCount; - //FIXME numBSPLightmaps is 0, must be bspLightBytes / ( game->lightmapSize * game->lightmapSize * 3 ) + //FIXME numBSPLightmaps is 0, must be bspLightBytes / ( g_game->lightmapSize * g_game->lightmapSize * 3 ) for ( lightmapCount = 0; lightmapCount < numBSPLightmaps; lightmapCount++ ) ; for ( ; ; lightmapCount++ ) @@ -226,7 +226,7 @@ void Convert_ReferenceLightmaps( const char* base, int* lmIndices ){ lmIndices[i] = -1; char shaderfile[256]; - sprintf( shaderfile, "%s/q3map2_%s.shader", game->shaderPath, base ); + sprintf( shaderfile, "%s/q3map2_%s.shader", g_game->shaderPath, base ); LoadScriptFile( shaderfile, 0 ); /* tokenize it */ while ( 1 ) diff --git a/tools/quake3/q3map2/games.cpp b/tools/quake3/q3map2/games.cpp index 189584bb..b72efae8 100644 --- a/tools/quake3/q3map2/games.cpp +++ b/tools/quake3/q3map2/games.cpp @@ -941,4 +941,4 @@ const std::vector g_games = { game_quake3(), game_jk2(), game_ja(), }; -const game_t *game = &g_games[0]; +const game_t *g_game = &g_games[0]; diff --git a/tools/quake3/q3map2/games.h b/tools/quake3/q3map2/games.h index 26795a0e..1941d99b 100644 --- a/tools/quake3/q3map2/games.h +++ b/tools/quake3/q3map2/games.h @@ -117,4 +117,4 @@ struct game_t }; extern const std::vector g_games; -extern const game_t *game; +extern const game_t *g_game; diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index 869c5bd5..37603c74 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -1928,7 +1928,7 @@ int LightMain( int argc, char **argv ){ Sys_Printf( "--- ProcessGameSpecific ---\n" ); /* set standard game flags */ - wolfLight = game->wolfLight; + wolfLight = g_game->wolfLight; if ( wolfLight ) { Sys_Printf( " lightning model: wolf\n" ); } @@ -1936,13 +1936,13 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " lightning model: quake3\n" ); } - lmCustomSizeW = lmCustomSizeH = game->lightmapSize; + lmCustomSizeW = lmCustomSizeH = g_game->lightmapSize; Sys_Printf( " lightmap size: %d x %d pixels\n", lmCustomSizeW, lmCustomSizeH ); - lightmapGamma = game->lightmapGamma; + lightmapGamma = g_game->lightmapGamma; Sys_Printf( " lightning gamma: %f\n", lightmapGamma ); - lightmapsRGB = game->lightmapsRGB; + lightmapsRGB = g_game->lightmapsRGB; if ( lightmapsRGB ) { Sys_Printf( " lightmap colorspace: sRGB\n" ); } @@ -1950,7 +1950,7 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " lightmap colorspace: linear\n" ); } - texturesRGB = game->texturesRGB; + texturesRGB = g_game->texturesRGB; if ( texturesRGB ) { Sys_Printf( " texture colorspace: sRGB\n" ); } @@ -1958,7 +1958,7 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " texture colorspace: linear\n" ); } - colorsRGB = game->colorsRGB; + colorsRGB = g_game->colorsRGB; if ( colorsRGB ) { Sys_Printf( " _color colorspace: sRGB\n" ); } @@ -1966,24 +1966,24 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " _color colorspace: linear\n" ); } - lightmapCompensate = game->lightmapCompensate; + lightmapCompensate = g_game->lightmapCompensate; Sys_Printf( " lightning compensation: %f\n", lightmapCompensate ); - lightmapExposure = game->lightmapExposure; + lightmapExposure = g_game->lightmapExposure; Sys_Printf( " lightning exposure: %f\n", lightmapExposure ); - gridScale = game->gridScale; + gridScale = g_game->gridScale; Sys_Printf( " lightgrid scale: %f\n", gridScale ); - gridAmbientScale = game->gridAmbientScale; + gridAmbientScale = g_game->gridAmbientScale; Sys_Printf( " lightgrid ambient scale: %f\n", gridAmbientScale ); - lightAngleHL = game->lightAngleHL; + lightAngleHL = g_game->lightAngleHL; if ( lightAngleHL ) { Sys_Printf( " half lambert light angle attenuation enabled \n" ); } - noStyles = game->noStyles; + noStyles = g_game->noStyles; if ( noStyles ) { Sys_Printf( " shader lightstyles hack: disabled\n" ); } @@ -1991,7 +1991,7 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " shader lightstyles hack: enabled\n" ); } - patchShadows = game->patchShadows; + patchShadows = g_game->patchShadows; if ( patchShadows ) { Sys_Printf( " patch shadows: enabled\n" ); } @@ -1999,8 +1999,8 @@ int LightMain( int argc, char **argv ){ Sys_Printf( " patch shadows: disabled\n" ); } - deluxemap = game->deluxeMap; - deluxemode = game->deluxeMode; + deluxemap = g_game->deluxeMap; + deluxemode = g_game->deluxeMode; if ( deluxemap ) { if ( deluxemode ) { Sys_Printf( " deluxemapping: enabled with tangentspace deluxemaps\n" ); @@ -2339,12 +2339,12 @@ int LightMain( int argc, char **argv ){ if ( ( ( lmCustomSizeW - 1 ) & lmCustomSizeW ) || lmCustomSizeW < 2 || ( ( lmCustomSizeH - 1 ) & lmCustomSizeH ) || lmCustomSizeH < 2 ) { Sys_Warning( "Lightmap size must be a power of 2, greater or equal to 2 pixels.\n" ); - lmCustomSizeW = lmCustomSizeH = game->lightmapSize; + lmCustomSizeW = lmCustomSizeH = g_game->lightmapSize; } Sys_Printf( "Default lightmap size set to %d x %d pixels\n", lmCustomSizeW, lmCustomSizeH ); /* enable external lightmaps */ - if ( lmCustomSizeW != game->lightmapSize || lmCustomSizeH != game->lightmapSize ) { + if ( lmCustomSizeW != g_game->lightmapSize || lmCustomSizeH != g_game->lightmapSize ) { /* -lightmapsize might just require -external for native external lms, but it has already been used in existing batches alone, so brand new switch here for external lms, referenced by shaders hack/behavior */ externalLightmaps = !extlmhack; @@ -2412,7 +2412,7 @@ int LightMain( int argc, char **argv ){ } else if ( striEqual( argv[ i ], "-lightmapsearchpower" ) ) { - lightmapMergeSize = ( game->lightmapSize << atoi( argv[i + 1] ) ); + lightmapMergeSize = ( g_game->lightmapSize << atoi( argv[i + 1] ) ); ++i; Sys_Printf( "Restricted lightmap searching enabled - optimize for lightmap merge power %d (size %d)\n", atoi( argv[i] ), lightmapMergeSize ); } diff --git a/tools/quake3/q3map2/lightmaps_ydnar.cpp b/tools/quake3/q3map2/lightmaps_ydnar.cpp index dba1b5a2..b08965de 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.cpp +++ b/tools/quake3/q3map2/lightmaps_ydnar.cpp @@ -129,12 +129,12 @@ void ExportLightmaps( void ){ Q_mkdir( dirname ); /* iterate through the lightmaps */ - for ( i = 0, lightmap = bspLightBytes; lightmap < ( bspLightBytes + numBSPLightBytes ); i++, lightmap += ( game->lightmapSize * game->lightmapSize * 3 ) ) + for ( i = 0, lightmap = bspLightBytes; lightmap < ( bspLightBytes + numBSPLightBytes ); i++, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) { /* write a tga image out */ sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); Sys_Printf( "Writing %s\n", filename ); - WriteTGA24( filename, lightmap, game->lightmapSize, game->lightmapSize, false ); + WriteTGA24( filename, lightmap, g_game->lightmapSize, g_game->lightmapSize, false ); } } @@ -210,7 +210,7 @@ int ImportLightmapsMain( int argc, char **argv ){ Q_mkdir( dirname ); /* iterate through the lightmaps */ - for ( i = 0, lightmap = bspLightBytes; lightmap < ( bspLightBytes + numBSPLightBytes ); i++, lightmap += ( game->lightmapSize * game->lightmapSize * 3 ) ) + for ( i = 0, lightmap = bspLightBytes; lightmap < ( bspLightBytes + numBSPLightBytes ); i++, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) { /* read a tga image */ sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); @@ -232,17 +232,17 @@ int ImportLightmapsMain( int argc, char **argv ){ Sys_Warning( "Unable to load image %s\n", filename ); continue; } - if ( width != game->lightmapSize || height != game->lightmapSize ) { + if ( width != g_game->lightmapSize || height != g_game->lightmapSize ) { Sys_Warning( "Image %s is not the right size (%d, %d) != (%d, %d)\n", - filename, width, height, game->lightmapSize, game->lightmapSize ); + filename, width, height, g_game->lightmapSize, g_game->lightmapSize ); } /* copy the pixels */ in = pixels; - for ( y = 1; y <= game->lightmapSize; y++ ) + for ( y = 1; y <= g_game->lightmapSize; y++ ) { - out = lightmap + ( ( game->lightmapSize - y ) * game->lightmapSize * 3 ); - for ( x = 0; x < game->lightmapSize; x++, in += 4, out += 3 ) + out = lightmap + ( ( g_game->lightmapSize - y ) * g_game->lightmapSize * 3 ); + for ( x = 0; x < g_game->lightmapSize; x++, in += 4, out += 3 ) VectorCopy( in, out ); } @@ -1826,7 +1826,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){ } /* is this a "normal" bsp-stored lightmap? */ - if ( ( lm->customWidth == game->lightmapSize && lm->customHeight == game->lightmapSize ) || externalLightmaps ) { + if ( ( lm->customWidth == g_game->lightmapSize && lm->customHeight == g_game->lightmapSize ) || externalLightmaps ) { olm->lightmapNum = numBSPLightmaps; numBSPLightmaps++; @@ -2071,7 +2071,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ } /* if this is a style-using lightmap, it must be exported */ - if ( lightmapNum > 0 && game->load != LoadRBSPFile ) { + if ( lightmapNum > 0 && g_game->load != LoadRBSPFile ) { olm->extLightmapNum = 0; } @@ -2976,7 +2976,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){ /* count the bsp lightmaps and allocate space */ free( bspLightBytes ); - const size_t gameLmSize = game->lightmapSize * game->lightmapSize * sizeof( Vector3b ); + const size_t gameLmSize = g_game->lightmapSize * g_game->lightmapSize * sizeof( Vector3b ); if ( numBSPLightmaps == 0 || externalLightmaps ) { numBSPLightBytes = 0; bspLightBytes = NULL; @@ -3200,7 +3200,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){ } /* surfaces with styled lightmaps and a style marker get a custom generated shader (fixme: make this work with external lightmaps) */ - if ( olm != NULL && lm != NULL && lm->styles[ 1 ] != LS_NONE && game->load != LoadRBSPFile ) { //% info->si->styleMarker > 0 ) + if ( olm != NULL && lm != NULL && lm->styles[ 1 ] != LS_NONE && g_game->load != LoadRBSPFile ) { //% info->si->styleMarker > 0 ) char key[ 32 ], styleStage[ 512 ], styleStages[ 4096 ], rgbGen[ 128 ], alphaGen[ 128 ]; @@ -3321,7 +3321,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){ /* devise a custom shader for this surface (fixme: make this work with light styles) */ else if ( olm != NULL && lm != NULL && !externalLightmaps && - ( olm->customWidth != game->lightmapSize || olm->customHeight != game->lightmapSize ) ) { + ( olm->customWidth != g_game->lightmapSize || olm->customHeight != g_game->lightmapSize ) ) { /* get output lightmap */ olm = &outLightmaps[ lm->outLightmapNums[ 0 ] ]; diff --git a/tools/quake3/q3map2/main.cpp b/tools/quake3/q3map2/main.cpp index 6de0a540..02c7ff4b 100644 --- a/tools/quake3/q3map2/main.cpp +++ b/tools/quake3/q3map2/main.cpp @@ -173,7 +173,7 @@ int main( int argc, char **argv ){ /* set game options */ if ( !patchSubdivisions ) { - patchSubdivisions = game->patchSubdivisions; + patchSubdivisions = g_game->patchSubdivisions; } /* check if we have enough options left to attempt something */ diff --git a/tools/quake3/q3map2/map.cpp b/tools/quake3/q3map2/map.cpp index 7c27a7e1..5198d236 100644 --- a/tools/quake3/q3map2/map.cpp +++ b/tools/quake3/q3map2/map.cpp @@ -567,7 +567,7 @@ void SetBrushContents( brush_t& b ){ */ void AddBrushBevels( void ){ - const int surfaceFlagsMask = game->brushBevelsSurfaceFlagsMask; + const int surfaceFlagsMask = g_game->brushBevelsSurfaceFlagsMask; auto& sides = buildBrush.sides; // diff --git a/tools/quake3/q3map2/minimap.cpp b/tools/quake3/q3map2/minimap.cpp index 81d4651c..ddda23e4 100644 --- a/tools/quake3/q3map2/minimap.cpp +++ b/tools/quake3/q3map2/minimap.cpp @@ -483,11 +483,11 @@ int MiniMapBSPMain( int argc, char **argv ){ Vector3 maxs = minimap.model->minmax.maxs; strClear( minimapFilename ); - minimapSharpen = game->miniMapSharpen; - minimap.width = minimap.height = game->miniMapSize; - border = game->miniMapBorder; - keepaspect = game->miniMapKeepAspect; - mode = game->miniMapMode; + minimapSharpen = g_game->miniMapSharpen; + minimap.width = minimap.height = g_game->miniMapSize; + border = g_game->miniMapBorder; + keepaspect = g_game->miniMapKeepAspect; + mode = g_game->miniMapMode; autolevel = false; minimap.samples = 1; @@ -594,7 +594,7 @@ int MiniMapBSPMain( int argc, char **argv ){ if ( strEmpty( minimapFilename ) ) { ExtractFileBase( source, basename ); ExtractFilePath( source, path ); - sprintf( relativeMinimapFilename, game->miniMapNameFormat, basename ); + sprintf( relativeMinimapFilename, g_game->miniMapNameFormat, basename ); MergeRelativePath( minimapFilename, path, relativeMinimapFilename ); Sys_Printf( "Output file name automatically set to %s\n", minimapFilename ); } diff --git a/tools/quake3/q3map2/path_init.cpp b/tools/quake3/q3map2/path_init.cpp index b7b6e675..aebeac9e 100644 --- a/tools/quake3/q3map2/path_init.cpp +++ b/tools/quake3/q3map2/path_init.cpp @@ -368,7 +368,7 @@ void InitPaths( int *argc, char **argv ){ LokiInitPaths( argv[ 0 ] ); /* set game to default (q3a) */ - game = &g_games[ 0 ]; + g_game = &g_games[ 0 ]; numBasePaths = 0; numGamePaths = 0; @@ -388,9 +388,9 @@ void InitPaths( int *argc, char **argv ){ Error( "Out of arguments: No game specified after %s", argv[ i - 1 ] ); } argv[ i - 1 ] = NULL; - game = GetGame( argv[ i ] ); - if ( game == NULL ) { - game = &g_games[ 0 ]; + g_game = GetGame( argv[ i ] ); + if ( g_game == NULL ) { + g_game = &g_games[ 0 ]; } argv[ i ] = NULL; } @@ -485,7 +485,7 @@ void InitPaths( int *argc, char **argv ){ *argc = k; /* add standard game path */ - AddGamePath( game->gamePath ); + AddGamePath( g_game->gamePath ); /* if there is no base path set, figure it out */ if ( numBasePaths == 0 ) { @@ -495,9 +495,9 @@ void InitPaths( int *argc, char **argv ){ /* extract the arg */ strcpy( temp, argv[ i ] ); FixDOSName( temp ); - Sys_FPrintf( SYS_VRB, "Searching for \"%s\" in \"%s\" (%d)...\n", game->magic, temp, i ); + Sys_FPrintf( SYS_VRB, "Searching for \"%s\" in \"%s\" (%d)...\n", g_game->magic, temp, i ); /* check for the game's magic word */ - char* found = strIstr( temp, game->magic ); + char* found = strIstr( temp, g_game->magic ); if( found ){ /* now find the next slash and nuke everything after it */ found = strchr( found, '/' ); @@ -524,7 +524,7 @@ void InitPaths( int *argc, char **argv ){ AddHomeBasePath( homeBasePath ); } else{ - AddHomeBasePath( game->homeBasePath ); + AddHomeBasePath( g_game->homeBasePath ); } /* initialize vfs paths */ diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp index 08a4f82c..77b6e2d5 100644 --- a/tools/quake3/q3map2/shaders.cpp +++ b/tools/quake3/q3map2/shaders.cpp @@ -234,7 +234,7 @@ bool ApplySurfaceParm( const char *name, int *contentFlags, int *surfaceFlags, i } /* walk the current game's surfaceparms */ - for( const surfaceParm_t& sp : game->surfaceParms ) + for( const surfaceParm_t& sp : g_game->surfaceParms ) { /* match? */ if ( striEqual( name, sp.name ) ) { @@ -295,7 +295,7 @@ void BeginMapShaderFile( const char *mapFile ){ mapName( PathFilename( mapFile ) ); /* append ../scripts/q3map2_.shader */ - mapShaderFile = StringOutputStream( 256 )( PathFilenameless( mapFile ), "../", game->shaderPath, "/q3map2_", mapName.c_str(), ".shader" ); + mapShaderFile = StringOutputStream( 256 )( PathFilenameless( mapFile ), "../", g_game->shaderPath, "/q3map2_", mapName.c_str(), ".shader" ); Sys_FPrintf( SYS_VRB, "Map has shader script %s\n", mapShaderFile.c_str() ); /* remove it */ @@ -1113,7 +1113,7 @@ static void ParseShaderFile( const char *filename ){ /* light (old-style flare specification) */ else if ( striEqual( token, "light" ) ) { GetTokenAppend( shaderText, false ); - si->flareShader = game->flareShader; + si->flareShader = g_game->flareShader; } /* ydnar: damageShader (sof2 mods) */ @@ -1992,7 +1992,7 @@ void LoadShaderInfo( void ){ } /* we can pile up several shader files, the one in baseq3 and ones in the mod dir or other spots */ - const auto filename = StringOutputStream( 64 )( game->shaderPath, "/shaderlist.txt" ); + const auto filename = StringOutputStream( 64 )( g_game->shaderPath, "/shaderlist.txt" ); const int count = vfsGetFileCount( filename ); /* load them all */ @@ -2023,13 +2023,13 @@ void LoadShaderInfo( void ){ if( shaderFiles.empty() ){ Sys_Printf( "%s", "No shaderlist.txt found: loading all shaders\n" ); - shaderFiles = vfsListShaderFiles( game->shaderPath ); + shaderFiles = vfsListShaderFiles( g_game->shaderPath ); } /* parse the shader files */ for ( const CopiedString& file : shaderFiles ) { - ParseShaderFile( StringOutputStream( 64 )( game->shaderPath, '/', file.c_str() ) ); + ParseShaderFile( StringOutputStream( 64 )( g_game->shaderPath, '/', file.c_str() ) ); } /* emit some statistics */ diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 97b8a036..a9b4e006 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -1070,7 +1070,7 @@ mapDrawSurface_t *DrawSurfaceForFlare( int entNum, const Vector3& origin, const ds->shaderInfo = ShaderInfoForShader( flareShader ); } else{ - ds->shaderInfo = ShaderInfoForShader( game->flareShader ); + ds->shaderInfo = ShaderInfoForShader( g_game->flareShader ); } ds->lightmapOrigin = origin; ds->lightmapVecs[ 2 ] = normal; diff --git a/tools/quake3/q3map2/writebsp.cpp b/tools/quake3/q3map2/writebsp.cpp index e35673af..f0fa20c7 100644 --- a/tools/quake3/q3map2/writebsp.cpp +++ b/tools/quake3/q3map2/writebsp.cpp @@ -523,7 +523,7 @@ void EmitFogs( void ){ } /* warn about overflow */ - if( strEqual( game->bspIdent, "RBSP" ) ){ + if( strEqual( g_game->bspIdent, "RBSP" ) ){ if( numMapFogs > MAX_RBSP_FOGS ) Sys_Warning( "MAX_RBSP_FOGS (%i) exceeded (%i). Visual inconsistencies are expected.\n", MAX_RBSP_FOGS, numMapFogs ); }