- Add dual protocol support to team arena demo selector

- Fix demo selection in team arena menu on case sensitive file systems
- Some changes in the way how vanilla q3 demo file lists are compiled in the menu
This commit is contained in:
Thilo Schulz 2011-07-13 08:40:30 +00:00
parent e06c117e9e
commit a844c94af1
4 changed files with 94 additions and 59 deletions

View file

@ -146,10 +146,13 @@ void UI_SetBestScores(postGameInfo_t *newInfo, qboolean postGame) {
}
}
void UI_LoadBestScores(const char *map, int game) {
void UI_LoadBestScores(const char *map, int game)
{
char fileName[MAX_QPATH];
fileHandle_t f;
postGameInfo_t newInfo;
int protocol, protocolLegacy;
memset(&newInfo, 0, sizeof(postGameInfo_t));
Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
@ -162,11 +165,30 @@ void UI_LoadBestScores(const char *map, int game) {
}
UI_SetBestScores(&newInfo, qfalse);
Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.%s%d", map, game, DEMOEXT, (int)trap_Cvar_VariableValue("protocol"));
uiInfo.demoAvailable = qfalse;
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
protocolLegacy = trap_Cvar_VariableValue("com_legacyprotocol");
protocol = trap_Cvar_VariableValue("com_protocol");
if(!protocol)
protocol = trap_Cvar_VariableValue("protocol");
if(protocolLegacy == protocol)
protocolLegacy = 0;
Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.%s%d", map, game, DEMOEXT, protocol);
if(trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0)
{
uiInfo.demoAvailable = qtrue;
trap_FS_FCloseFile(f);
}
else if(protocolLegacy > 0)
{
Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.%s%d", map, game, DEMOEXT, protocolLegacy);
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0)
{
uiInfo.demoAvailable = qtrue;
trap_FS_FCloseFile(f);
}
}
}