filesystem: add new gameinfo.txt key: demomap

This commit is contained in:
Alibek Omarov 2024-08-13 17:21:40 +03:00
parent 7bb5d9a67a
commit d114dffcb4
3 changed files with 17 additions and 0 deletions

View File

@ -78,6 +78,7 @@ These strings are specific to Xash3D FWGS.
| `internal_vgui_support` | boolean | 0 | Only for programmers! Required to be set as 1 for PrimeXT!<br>When set to 1, the engine will not load vgui_support DLL, as VGUI support is done (or intentionally ignored) on the game side. |
| `render_picbutton_text` | boolean | 0 | When set to 1, the UI will not use prerendered `btns_main.bmp` and dynamically render them instead |
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
| `demomap` | string | Empty string | The name of the demo chapter map (Half-Life Uplink) |
## Note on GoldSrc liblist.gam support

View File

@ -619,6 +619,9 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
FS_Printf( f, "internal_vgui_support\t\t%s\n", GameInfo->internal_vgui_support ? "1" : "0" );
FS_Printf( f, "render_picbutton_text\t\t%s\n", GameInfo->render_picbutton_text ? "1" : "0" );
if( COM_CheckStringEmpty( GameInfo->demomap ))
FS_Printf( f, "demomap\t\t\"%s\"\n", GameInfo->demomap );
FS_Close( f ); // all done
}
@ -879,8 +882,20 @@ static void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, cons
pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->autosave_aged_count = bound( 2, Q_atoi( token ), 99 );
}
else if( !Q_stricmp( token, "demomap" ))
{
pfile = COM_ParseFile( pfile, GameInfo->demomap, sizeof( GameInfo->demomap ));
}
}
}
// demomap only valid for gameinfo.txt but HL1 after 25th anniversary update
// comes with demo chapter. Set the demomap here.
if( !COM_CheckStringEmpty( GameInfo->demomap ))
{
if( !Q_stricmp( GameInfo->title, "Half-Life" )) // original check from GameUI
Q_strncpy( GameInfo->demomap, "hldemo1", sizeof( GameInfo->demomap ));
}
if( !found_linux || !found_osx )
{

View File

@ -118,6 +118,7 @@ typedef struct gameinfo_s
// HL25 compatibility keys
qboolean hd_background;
qboolean animated_title;
char demomap[MAX_QPATH];
} gameinfo_t;
typedef enum