rename game -> g_game

This commit is contained in:
Garux 2021-09-13 18:49:09 +03:00
parent 5c5f698c28
commit dbeb2d0718
18 changed files with 99 additions and 99 deletions

View File

@ -320,7 +320,7 @@ int pk3BSPMain( int argc, char **argv ){
} }
} }
pk3Shaderfiles = vfsListShaderFiles( game->shaderPath ); pk3Shaderfiles = vfsListShaderFiles( g_game->shaderPath );
if( dbg ){ if( dbg ){
Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() ); Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() );
@ -342,7 +342,7 @@ int pk3BSPMain( int argc, char **argv ){
char* ExReasonShaderFile[4096] = { NULL }; 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 ){ for ( i = 0; i < ExTextures->n; ++i ){
if( !StrList_find( ExShaders, ExTextures->s[i] ) ) if( !StrList_find( ExShaders, ExTextures->s[i] ) )
@ -389,7 +389,7 @@ int pk3BSPMain( int argc, char **argv ){
/* load the shader */ /* load the shader */
char scriptFile[128]; 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 ); SilentLoadScriptFile( scriptFile, 0 );
if( dbg ) if( dbg )
Sys_Printf( "\n\tentering %s\n", file.c_str() ); Sys_Printf( "\n\tentering %s\n", file.c_str() );
@ -682,7 +682,7 @@ int pk3BSPMain( int argc, char **argv ){
for ( CopiedString& file : pk3Shaderfiles ){ for ( CopiedString& file : pk3Shaderfiles ){
if ( !file.empty() ){ if ( !file.empty() ){
stream( game->shaderPath, "/", file.c_str() ); stream( g_game->shaderPath, "/", file.c_str() );
if ( !packResource( stream, packname, compLevel ) ){ if ( !packResource( stream, packname, compLevel ) ){
Sys_FPrintf( SYS_WRN, " !FAIL! %s\n", pk3Shaders->s[i] ); Sys_FPrintf( SYS_WRN, " !FAIL! %s\n", pk3Shaders->s[i] );
packFAIL = true; packFAIL = true;
@ -784,7 +784,7 @@ int repackBSPMain( int argc, char **argv ){
StrList* ExPureTextures = StrList_allocate( 4096 ); 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 ){ for ( i = 0; i < ExTextures->n; ++i ){
if( !StrList_find( ExShaders, ExTextures->s[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 ){ if( dbg ){
Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() ); Sys_Printf( "\n\tSchroider fileses.....%zu\n", pk3Shaderfiles.size() );
@ -1140,7 +1140,7 @@ int repackBSPMain( int argc, char **argv ){
/* load the shader */ /* load the shader */
char scriptFile[128]; char scriptFile[128];
sprintf( scriptFile, "%s/%s", game->shaderPath, file.c_str() ); sprintf( scriptFile, "%s/%s", g_game->shaderPath, file.c_str() );
if ( dbg ) if ( dbg )
Sys_Printf( "\n\tentering %s\n", file.c_str() ); Sys_Printf( "\n\tentering %s\n", file.c_str() );
SilentLoadScriptFile( scriptFile, 0 ); SilentLoadScriptFile( scriptFile, 0 );

View File

@ -683,13 +683,13 @@ int BSPMain( int argc, char **argv ){
strClear( tempSource ); strClear( tempSource );
/* set standard game flags */ /* set standard game flags */
maxLMSurfaceVerts = game->maxLMSurfaceVerts; maxLMSurfaceVerts = g_game->maxLMSurfaceVerts;
maxSurfaceVerts = game->maxSurfaceVerts; maxSurfaceVerts = g_game->maxSurfaceVerts;
maxSurfaceIndexes = game->maxSurfaceIndexes; maxSurfaceIndexes = g_game->maxSurfaceIndexes;
emitFlares = game->emitFlares; emitFlares = g_game->emitFlares;
texturesRGB = game->texturesRGB; texturesRGB = g_game->texturesRGB;
colorsRGB = game->colorsRGB; colorsRGB = g_game->colorsRGB;
keepLights = game->keepLights; keepLights = g_game->keepLights;
/* process arguments */ /* process arguments */
for ( i = 1; i < ( argc - 1 ); i++ ) for ( i = 1; i < ( argc - 1 ); i++ )

View File

@ -349,12 +349,12 @@ void AddLump( FILE *file, bspHeader_t *header, int lumpNum, const void *data, in
void LoadBSPFile( const char *filename ){ void LoadBSPFile( const char *filename ){
/* dummy check */ /* dummy check */
if ( game == NULL || game->load == NULL ) { if ( g_game == NULL || g_game->load == NULL ) {
Error( "LoadBSPFile: unsupported BSP file format" ); Error( "LoadBSPFile: unsupported BSP file format" );
} }
/* load it, then byte swap the in-memory version */ /* load it, then byte swap the in-memory version */
game->load( filename ); g_game->load( filename );
SwapBSPFile(); SwapBSPFile();
} }
@ -366,12 +366,12 @@ void LoadBSPFile( const char *filename ){
void PartialLoadBSPFile( const char *filename ){ void PartialLoadBSPFile( const char *filename ){
/* dummy check */ /* dummy check */
if ( game == NULL || game->load == NULL ) { if ( g_game == NULL || g_game->load == NULL ) {
Error( "LoadBSPFile: unsupported BSP file format" ); Error( "LoadBSPFile: unsupported BSP file format" );
} }
/* load it, then byte swap the in-memory version */ /* load it, then byte swap the in-memory version */
//game->load( filename ); //g_game->load( filename );
PartialLoadIBSPFile( filename ); PartialLoadIBSPFile( filename );
/* PartialSwapBSPFile() */ /* PartialSwapBSPFile() */
@ -407,7 +407,7 @@ void WriteBSPFile( const char *filename ){
/* dummy check */ /* dummy check */
if ( game == NULL || game->write == NULL ) { if ( g_game == NULL || g_game->write == NULL ) {
Error( "WriteBSPFile: unsupported BSP file format" ); 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 */ /* byteswap, write the bsp, then swap back so it can be manipulated further */
SwapBSPFile(); SwapBSPFile();
game->write( tempname ); g_game->write( tempname );
SwapBSPFile(); SwapBSPFile();
/* replace existing bsp file */ /* replace existing bsp file */
@ -491,7 +491,7 @@ void PrintBSPFileSizes( void ){
Sys_Printf( "\n" ); Sys_Printf( "\n" );
Sys_Printf( "%9d lightmaps %9d\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", Sys_Printf( "%9d lightgrid %9d *\n",
numBSPGridPoints, (int) ( numBSPGridPoints * sizeof( *bspGridPoints ) ) ); numBSPGridPoints, (int) ( numBSPGridPoints * sizeof( *bspGridPoints ) ) );
Sys_Printf( " visibility %9d\n", 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 */ /* 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 */ /* vortex: deluxe quake default shadow flags */
if ( ent->classname_is( "func_wall" ) ) { if ( ent->classname_is( "func_wall" ) ) {
if ( recvShadows != NULL ) { if ( recvShadows != NULL ) {

View File

@ -424,11 +424,11 @@ void LoadIBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) );
/* make sure it matches the format we're trying to load */ /* make sure it matches the format we're trying to load */
if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) {
Error( "%s is not a %s file", filename, game->bspIdent ); Error( "%s is not a %s file", filename, g_game->bspIdent );
} }
if ( !force && header->version != game->bspVersion ) { if ( !force && header->version != g_game->bspVersion ) {
Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion );
} }
/* load/convert lumps */ /* load/convert lumps */
@ -469,7 +469,7 @@ void LoadIBSPFile( const char *filename ){
CopyLightGridLumps( header ); CopyLightGridLumps( header );
/* advertisements */ /* 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 ) ); numBSPAds = CopyLump( (bspHeader_t*) header, LUMP_ADVERTISEMENTS, bspAds, sizeof( bspAdvertisement_t ) );
} }
else{ else{
@ -496,11 +496,11 @@ void PartialLoadIBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) );
/* make sure it matches the format we're trying to load */ /* make sure it matches the format we're trying to load */
if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) {
Error( "%s is not a %s file", filename, game->bspIdent ); Error( "%s is not a %s file", filename, g_game->bspIdent );
} }
if ( !force && header->version != game->bspVersion ) { if ( !force && header->version != g_game->bspVersion ) {
Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion );
} }
/* load/convert lumps */ /* load/convert lumps */
@ -536,8 +536,8 @@ void WriteIBSPFile( const char *filename ){
//% Swapfile(); //% Swapfile();
/* set up header */ /* set up header */
*( (int*) (bspHeader_t*) header->ident ) = *( (const int*) game->bspIdent ); *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) g_game->bspIdent );
header->version = LittleLong( game->bspVersion ); header->version = LittleLong( g_game->bspVersion );
/* write initial header */ /* write initial header */
file = SafeOpenWrite( filename ); file = SafeOpenWrite( filename );

View File

@ -215,11 +215,11 @@ void LoadRBSPFile( const char *filename ){
SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) ); SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) );
/* make sure it matches the format we're trying to load */ /* make sure it matches the format we're trying to load */
if ( !force && *( (int*) header->ident ) != *( (const int*) game->bspIdent ) ) { if ( !force && *( (int*) header->ident ) != *( (const int*) g_game->bspIdent ) ) {
Error( "%s is not a %s file", filename, game->bspIdent ); Error( "%s is not a %s file", filename, g_game->bspIdent );
} }
if ( !force && header->version != game->bspVersion ) { if ( !force && header->version != g_game->bspVersion ) {
Error( "%s is version %d, not %d", filename, header->version, game->bspVersion ); Error( "%s is version %d, not %d", filename, header->version, g_game->bspVersion );
} }
/* load/convert lumps */ /* load/convert lumps */
@ -289,8 +289,8 @@ void WriteRBSPFile( const char *filename ){
//% Swapfile(); //% Swapfile();
/* set up header */ /* set up header */
*( (int*) (bspHeader_t*) header->ident ) = *( (const int*) game->bspIdent ); *( (int*) (bspHeader_t*) header->ident ) = *( (const int*) g_game->bspIdent );
header->version = LittleLong( game->bspVersion ); header->version = LittleLong( g_game->bspVersion );
/* write initial header */ /* write initial header */
file = SafeOpenWrite( filename ); file = SafeOpenWrite( filename );

View File

@ -925,7 +925,7 @@ int ConvertBSPMain( int argc, char **argv ){
/* bsp format convert? */ /* bsp format convert? */
if ( convertGame != NULL ) { if ( convertGame != NULL ) {
/* set global game */ /* set global game */
game = convertGame; g_game = convertGame;
/* write bsp */ /* write bsp */
path_set_extension( source, "_c.bsp" ); path_set_extension( source, "_c.bsp" );

View File

@ -205,7 +205,7 @@ static void ConvertLightmapToMTL( FILE *f, const char *base, int lightmapNum ){
int Convert_CountLightmaps( const char* dirname ){ int Convert_CountLightmaps( const char* dirname ){
int lightmapCount; 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 = 0; lightmapCount < numBSPLightmaps; lightmapCount++ )
; ;
for ( ; ; lightmapCount++ ) for ( ; ; lightmapCount++ )
@ -226,7 +226,7 @@ void Convert_ReferenceLightmaps( const char* base, int* lmIndices ){
lmIndices[i] = -1; lmIndices[i] = -1;
char shaderfile[256]; 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 ); LoadScriptFile( shaderfile, 0 );
/* tokenize it */ /* tokenize it */
while ( 1 ) while ( 1 )

View File

@ -941,4 +941,4 @@ const std::vector<game_t> g_games = { game_quake3(),
game_jk2(), game_jk2(),
game_ja(), game_ja(),
}; };
const game_t *game = &g_games[0]; const game_t *g_game = &g_games[0];

View File

@ -117,4 +117,4 @@ struct game_t
}; };
extern const std::vector<game_t> g_games; extern const std::vector<game_t> g_games;
extern const game_t *game; extern const game_t *g_game;

View File

@ -1928,7 +1928,7 @@ int LightMain( int argc, char **argv ){
Sys_Printf( "--- ProcessGameSpecific ---\n" ); Sys_Printf( "--- ProcessGameSpecific ---\n" );
/* set standard game flags */ /* set standard game flags */
wolfLight = game->wolfLight; wolfLight = g_game->wolfLight;
if ( wolfLight ) { if ( wolfLight ) {
Sys_Printf( " lightning model: wolf\n" ); Sys_Printf( " lightning model: wolf\n" );
} }
@ -1936,13 +1936,13 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " lightning model: quake3\n" ); 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 ); 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 ); Sys_Printf( " lightning gamma: %f\n", lightmapGamma );
lightmapsRGB = game->lightmapsRGB; lightmapsRGB = g_game->lightmapsRGB;
if ( lightmapsRGB ) { if ( lightmapsRGB ) {
Sys_Printf( " lightmap colorspace: sRGB\n" ); Sys_Printf( " lightmap colorspace: sRGB\n" );
} }
@ -1950,7 +1950,7 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " lightmap colorspace: linear\n" ); Sys_Printf( " lightmap colorspace: linear\n" );
} }
texturesRGB = game->texturesRGB; texturesRGB = g_game->texturesRGB;
if ( texturesRGB ) { if ( texturesRGB ) {
Sys_Printf( " texture colorspace: sRGB\n" ); Sys_Printf( " texture colorspace: sRGB\n" );
} }
@ -1958,7 +1958,7 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " texture colorspace: linear\n" ); Sys_Printf( " texture colorspace: linear\n" );
} }
colorsRGB = game->colorsRGB; colorsRGB = g_game->colorsRGB;
if ( colorsRGB ) { if ( colorsRGB ) {
Sys_Printf( " _color colorspace: sRGB\n" ); Sys_Printf( " _color colorspace: sRGB\n" );
} }
@ -1966,24 +1966,24 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " _color colorspace: linear\n" ); Sys_Printf( " _color colorspace: linear\n" );
} }
lightmapCompensate = game->lightmapCompensate; lightmapCompensate = g_game->lightmapCompensate;
Sys_Printf( " lightning compensation: %f\n", lightmapCompensate ); Sys_Printf( " lightning compensation: %f\n", lightmapCompensate );
lightmapExposure = game->lightmapExposure; lightmapExposure = g_game->lightmapExposure;
Sys_Printf( " lightning exposure: %f\n", lightmapExposure ); Sys_Printf( " lightning exposure: %f\n", lightmapExposure );
gridScale = game->gridScale; gridScale = g_game->gridScale;
Sys_Printf( " lightgrid scale: %f\n", gridScale ); Sys_Printf( " lightgrid scale: %f\n", gridScale );
gridAmbientScale = game->gridAmbientScale; gridAmbientScale = g_game->gridAmbientScale;
Sys_Printf( " lightgrid ambient scale: %f\n", gridAmbientScale ); Sys_Printf( " lightgrid ambient scale: %f\n", gridAmbientScale );
lightAngleHL = game->lightAngleHL; lightAngleHL = g_game->lightAngleHL;
if ( lightAngleHL ) { if ( lightAngleHL ) {
Sys_Printf( " half lambert light angle attenuation enabled \n" ); Sys_Printf( " half lambert light angle attenuation enabled \n" );
} }
noStyles = game->noStyles; noStyles = g_game->noStyles;
if ( noStyles ) { if ( noStyles ) {
Sys_Printf( " shader lightstyles hack: disabled\n" ); Sys_Printf( " shader lightstyles hack: disabled\n" );
} }
@ -1991,7 +1991,7 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " shader lightstyles hack: enabled\n" ); Sys_Printf( " shader lightstyles hack: enabled\n" );
} }
patchShadows = game->patchShadows; patchShadows = g_game->patchShadows;
if ( patchShadows ) { if ( patchShadows ) {
Sys_Printf( " patch shadows: enabled\n" ); Sys_Printf( " patch shadows: enabled\n" );
} }
@ -1999,8 +1999,8 @@ int LightMain( int argc, char **argv ){
Sys_Printf( " patch shadows: disabled\n" ); Sys_Printf( " patch shadows: disabled\n" );
} }
deluxemap = game->deluxeMap; deluxemap = g_game->deluxeMap;
deluxemode = game->deluxeMode; deluxemode = g_game->deluxeMode;
if ( deluxemap ) { if ( deluxemap ) {
if ( deluxemode ) { if ( deluxemode ) {
Sys_Printf( " deluxemapping: enabled with tangentspace deluxemaps\n" ); Sys_Printf( " deluxemapping: enabled with tangentspace deluxemaps\n" );
@ -2339,12 +2339,12 @@ int LightMain( int argc, char **argv ){
if ( ( ( lmCustomSizeW - 1 ) & lmCustomSizeW ) || lmCustomSizeW < 2 || if ( ( ( lmCustomSizeW - 1 ) & lmCustomSizeW ) || lmCustomSizeW < 2 ||
( ( lmCustomSizeH - 1 ) & lmCustomSizeH ) || lmCustomSizeH < 2 ) { ( ( lmCustomSizeH - 1 ) & lmCustomSizeH ) || lmCustomSizeH < 2 ) {
Sys_Warning( "Lightmap size must be a power of 2, greater or equal to 2 pixels.\n" ); 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 ); Sys_Printf( "Default lightmap size set to %d x %d pixels\n", lmCustomSizeW, lmCustomSizeH );
/* enable external lightmaps */ /* 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, /* -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 */ so brand new switch here for external lms, referenced by shaders hack/behavior */
externalLightmaps = !extlmhack; externalLightmaps = !extlmhack;
@ -2412,7 +2412,7 @@ int LightMain( int argc, char **argv ){
} }
else if ( striEqual( argv[ i ], "-lightmapsearchpower" ) ) { else if ( striEqual( argv[ i ], "-lightmapsearchpower" ) ) {
lightmapMergeSize = ( game->lightmapSize << atoi( argv[i + 1] ) ); lightmapMergeSize = ( g_game->lightmapSize << atoi( argv[i + 1] ) );
++i; ++i;
Sys_Printf( "Restricted lightmap searching enabled - optimize for lightmap merge power %d (size %d)\n", atoi( argv[i] ), lightmapMergeSize ); Sys_Printf( "Restricted lightmap searching enabled - optimize for lightmap merge power %d (size %d)\n", atoi( argv[i] ), lightmapMergeSize );
} }

View File

@ -129,12 +129,12 @@ void ExportLightmaps( void ){
Q_mkdir( dirname ); Q_mkdir( dirname );
/* iterate through the lightmaps */ /* 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 */ /* write a tga image out */
sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); sprintf( filename, "%s/lightmap_%04d.tga", dirname, i );
Sys_Printf( "Writing %s\n", filename ); 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 ); Q_mkdir( dirname );
/* iterate through the lightmaps */ /* 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 */ /* read a tga image */
sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); 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 ); Sys_Warning( "Unable to load image %s\n", filename );
continue; 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", 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 */ /* copy the pixels */
in = 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 ); out = lightmap + ( ( g_game->lightmapSize - y ) * g_game->lightmapSize * 3 );
for ( x = 0; x < game->lightmapSize; x++, in += 4, out += 3 ) for ( x = 0; x < g_game->lightmapSize; x++, in += 4, out += 3 )
VectorCopy( in, out ); VectorCopy( in, out );
} }
@ -1826,7 +1826,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){
} }
/* is this a "normal" bsp-stored lightmap? */ /* 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; olm->lightmapNum = numBSPLightmaps;
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 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; olm->extLightmapNum = 0;
} }
@ -2976,7 +2976,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){
/* count the bsp lightmaps and allocate space */ /* count the bsp lightmaps and allocate space */
free( bspLightBytes ); 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 ) { if ( numBSPLightmaps == 0 || externalLightmaps ) {
numBSPLightBytes = 0; numBSPLightBytes = 0;
bspLightBytes = NULL; 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) */ /* 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 ]; 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) */ /* devise a custom shader for this surface (fixme: make this work with light styles) */
else if ( olm != NULL && lm != NULL && !externalLightmaps && 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 */ /* get output lightmap */
olm = &outLightmaps[ lm->outLightmapNums[ 0 ] ]; olm = &outLightmaps[ lm->outLightmapNums[ 0 ] ];

View File

@ -173,7 +173,7 @@ int main( int argc, char **argv ){
/* set game options */ /* set game options */
if ( !patchSubdivisions ) { if ( !patchSubdivisions ) {
patchSubdivisions = game->patchSubdivisions; patchSubdivisions = g_game->patchSubdivisions;
} }
/* check if we have enough options left to attempt something */ /* check if we have enough options left to attempt something */

View File

@ -567,7 +567,7 @@ void SetBrushContents( brush_t& b ){
*/ */
void AddBrushBevels( void ){ void AddBrushBevels( void ){
const int surfaceFlagsMask = game->brushBevelsSurfaceFlagsMask; const int surfaceFlagsMask = g_game->brushBevelsSurfaceFlagsMask;
auto& sides = buildBrush.sides; auto& sides = buildBrush.sides;
// //

View File

@ -483,11 +483,11 @@ int MiniMapBSPMain( int argc, char **argv ){
Vector3 maxs = minimap.model->minmax.maxs; Vector3 maxs = minimap.model->minmax.maxs;
strClear( minimapFilename ); strClear( minimapFilename );
minimapSharpen = game->miniMapSharpen; minimapSharpen = g_game->miniMapSharpen;
minimap.width = minimap.height = game->miniMapSize; minimap.width = minimap.height = g_game->miniMapSize;
border = game->miniMapBorder; border = g_game->miniMapBorder;
keepaspect = game->miniMapKeepAspect; keepaspect = g_game->miniMapKeepAspect;
mode = game->miniMapMode; mode = g_game->miniMapMode;
autolevel = false; autolevel = false;
minimap.samples = 1; minimap.samples = 1;
@ -594,7 +594,7 @@ int MiniMapBSPMain( int argc, char **argv ){
if ( strEmpty( minimapFilename ) ) { if ( strEmpty( minimapFilename ) ) {
ExtractFileBase( source, basename ); ExtractFileBase( source, basename );
ExtractFilePath( source, path ); ExtractFilePath( source, path );
sprintf( relativeMinimapFilename, game->miniMapNameFormat, basename ); sprintf( relativeMinimapFilename, g_game->miniMapNameFormat, basename );
MergeRelativePath( minimapFilename, path, relativeMinimapFilename ); MergeRelativePath( minimapFilename, path, relativeMinimapFilename );
Sys_Printf( "Output file name automatically set to %s\n", minimapFilename ); Sys_Printf( "Output file name automatically set to %s\n", minimapFilename );
} }

View File

@ -368,7 +368,7 @@ void InitPaths( int *argc, char **argv ){
LokiInitPaths( argv[ 0 ] ); LokiInitPaths( argv[ 0 ] );
/* set game to default (q3a) */ /* set game to default (q3a) */
game = &g_games[ 0 ]; g_game = &g_games[ 0 ];
numBasePaths = 0; numBasePaths = 0;
numGamePaths = 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 ] ); Error( "Out of arguments: No game specified after %s", argv[ i - 1 ] );
} }
argv[ i - 1 ] = NULL; argv[ i - 1 ] = NULL;
game = GetGame( argv[ i ] ); g_game = GetGame( argv[ i ] );
if ( game == NULL ) { if ( g_game == NULL ) {
game = &g_games[ 0 ]; g_game = &g_games[ 0 ];
} }
argv[ i ] = NULL; argv[ i ] = NULL;
} }
@ -485,7 +485,7 @@ void InitPaths( int *argc, char **argv ){
*argc = k; *argc = k;
/* add standard game path */ /* add standard game path */
AddGamePath( game->gamePath ); AddGamePath( g_game->gamePath );
/* if there is no base path set, figure it out */ /* if there is no base path set, figure it out */
if ( numBasePaths == 0 ) { if ( numBasePaths == 0 ) {
@ -495,9 +495,9 @@ void InitPaths( int *argc, char **argv ){
/* extract the arg */ /* extract the arg */
strcpy( temp, argv[ i ] ); strcpy( temp, argv[ i ] );
FixDOSName( temp ); 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 */ /* check for the game's magic word */
char* found = strIstr( temp, game->magic ); char* found = strIstr( temp, g_game->magic );
if( found ){ if( found ){
/* now find the next slash and nuke everything after it */ /* now find the next slash and nuke everything after it */
found = strchr( found, '/' ); found = strchr( found, '/' );
@ -524,7 +524,7 @@ void InitPaths( int *argc, char **argv ){
AddHomeBasePath( homeBasePath ); AddHomeBasePath( homeBasePath );
} }
else{ else{
AddHomeBasePath( game->homeBasePath ); AddHomeBasePath( g_game->homeBasePath );
} }
/* initialize vfs paths */ /* initialize vfs paths */

View File

@ -234,7 +234,7 @@ bool ApplySurfaceParm( const char *name, int *contentFlags, int *surfaceFlags, i
} }
/* walk the current game's surfaceparms */ /* walk the current game's surfaceparms */
for( const surfaceParm_t& sp : game->surfaceParms ) for( const surfaceParm_t& sp : g_game->surfaceParms )
{ {
/* match? */ /* match? */
if ( striEqual( name, sp.name ) ) { if ( striEqual( name, sp.name ) ) {
@ -295,7 +295,7 @@ void BeginMapShaderFile( const char *mapFile ){
mapName( PathFilename( mapFile ) ); mapName( PathFilename( mapFile ) );
/* append ../scripts/q3map2_<mapname>.shader */ /* append ../scripts/q3map2_<mapname>.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() ); Sys_FPrintf( SYS_VRB, "Map has shader script %s\n", mapShaderFile.c_str() );
/* remove it */ /* remove it */
@ -1113,7 +1113,7 @@ static void ParseShaderFile( const char *filename ){
/* light <value> (old-style flare specification) */ /* light <value> (old-style flare specification) */
else if ( striEqual( token, "light" ) ) { else if ( striEqual( token, "light" ) ) {
GetTokenAppend( shaderText, false ); GetTokenAppend( shaderText, false );
si->flareShader = game->flareShader; si->flareShader = g_game->flareShader;
} }
/* ydnar: damageShader <shader> <health> (sof2 mods) */ /* ydnar: damageShader <shader> <health> (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 */ /* 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 ); const int count = vfsGetFileCount( filename );
/* load them all */ /* load them all */
@ -2023,13 +2023,13 @@ void LoadShaderInfo( void ){
if( shaderFiles.empty() ){ if( shaderFiles.empty() ){
Sys_Printf( "%s", "No shaderlist.txt found: loading all shaders\n" ); Sys_Printf( "%s", "No shaderlist.txt found: loading all shaders\n" );
shaderFiles = vfsListShaderFiles( game->shaderPath ); shaderFiles = vfsListShaderFiles( g_game->shaderPath );
} }
/* parse the shader files */ /* parse the shader files */
for ( const CopiedString& file : shaderFiles ) 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 */ /* emit some statistics */

View File

@ -1070,7 +1070,7 @@ mapDrawSurface_t *DrawSurfaceForFlare( int entNum, const Vector3& origin, const
ds->shaderInfo = ShaderInfoForShader( flareShader ); ds->shaderInfo = ShaderInfoForShader( flareShader );
} }
else{ else{
ds->shaderInfo = ShaderInfoForShader( game->flareShader ); ds->shaderInfo = ShaderInfoForShader( g_game->flareShader );
} }
ds->lightmapOrigin = origin; ds->lightmapOrigin = origin;
ds->lightmapVecs[ 2 ] = normal; ds->lightmapVecs[ 2 ] = normal;

View File

@ -523,7 +523,7 @@ void EmitFogs( void ){
} }
/* warn about overflow */ /* warn about overflow */
if( strEqual( game->bspIdent, "RBSP" ) ){ if( strEqual( g_game->bspIdent, "RBSP" ) ){
if( numMapFogs > MAX_RBSP_FOGS ) if( numMapFogs > MAX_RBSP_FOGS )
Sys_Warning( "MAX_RBSP_FOGS (%i) exceeded (%i). Visual inconsistencies are expected.\n", MAX_RBSP_FOGS, numMapFogs ); Sys_Warning( "MAX_RBSP_FOGS (%i) exceeded (%i). Visual inconsistencies are expected.\n", MAX_RBSP_FOGS, numMapFogs );
} }