void UI_LoadArenas(void) { int numdirs; char filename[128]; char dirlist[1024]; char *dirptr; int i; int dirlen; uiInfo.mapCount = 0; // get all arenas from .arena files numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen + 1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } // sorting the maplist qsort(uiInfo.mapList, uiInfo.mapCount, sizeof(uiInfo.mapList[0]), UI_SortArenas); }
/* =============== UI_LoadArenas =============== */ void UI_LoadArenas( void ) { int numdirs; char filename[ 128 ]; char dirlist[ 1024 ]; char *dirptr; int i, n; int dirlen; char *type; ui_numArenas = 0; uiInfo.mapCount = 0; // get all arenas from .arena files numdirs = trap_FS_GetFileList( "scripts", ".arena", dirlist, 1024 ); dirptr = dirlist; for ( i = 0; i < numdirs; i++, dirptr += dirlen + 1 ) { dirlen = strlen( dirptr ); strcpy( filename, "scripts/" ); strcat( filename, dirptr ); UI_LoadArenasFromFile( filename ); } trap_Print( va( "[skipnotify]%i arenas parsed\n", ui_numArenas ) ); if ( UI_OutOfMemory() ) { trap_Print( S_WARNING "not enough memory in pool to load all arenas\n" ); } for ( n = 0; n < ui_numArenas; n++ ) { // determine type type = Info_ValueForKey( ui_arenaInfos[ n ], "type" ); // if no type specified, it will be treated as "ffa" uiInfo.mapList[ uiInfo.mapCount ].cinematic = -1; uiInfo.mapList[ uiInfo.mapCount ].mapLoadName = String_Alloc( Info_ValueForKey( ui_arenaInfos[ n ], "map" ) ); uiInfo.mapList[ uiInfo.mapCount ].mapName = String_Alloc( Info_ValueForKey( ui_arenaInfos[ n ], "longname" ) ); uiInfo.mapList[ uiInfo.mapCount ].levelShot = -1; uiInfo.mapList[ uiInfo.mapCount ].imageName = String_Alloc( va( "levelshots/%s", uiInfo.mapList[ uiInfo.mapCount ].mapLoadName ) ); uiInfo.mapCount++; if ( uiInfo.mapCount >= MAX_MAPS ) { break; } } qsort( uiInfo.mapList, uiInfo.mapCount, sizeof( mapInfo ), UI_MapNameCompare ); }
/* =============== UI_LoadArenas =============== */ void UI_LoadArenas(void) { int numdirs; char filename[128]; char dirlist[MAX_ARENAS]; char *dirptr; int i, n; int dirlen; ui_numArenas = 0; uiInfo.mapCount = 0; // get all arenas from .arena files numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, MAX_ARENAS); dirptr = dirlist; for(i = 0; i < numdirs; i++, dirptr += dirlen + 1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } trap_Print(va( "[skipnotify]%i arenas parsed\n", ui_numArenas)); if(UI_OutOfMemory()) trap_Print(S_COLOR_YELLOW "WARNING: not anough memory in pool to load all arenas\n"); for(n = 0; n < ui_numArenas; n++) { uiInfo.mapList[uiInfo.mapCount].cinematic = -1; uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map")); uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname")); uiInfo.mapList[uiInfo.mapCount].levelShot = -1; uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc( va( "levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName ) ); uiInfo.mapCount++; if(uiInfo.mapCount >= MAX_MAPS) break; } qsort(uiInfo.mapList, uiInfo.mapCount, sizeof(mapInfo), UI_MapNameCompare); }
/* =============== UI_LoadArenas =============== */ void UI_LoadArenas( void ) { int numdirs; // vmCvar_t arenasFile; char filename[128]; char dirlist[1024]; char* dirptr; int i, n; int dirlen; const char *type, *str; ui_numArenas = 0; uiInfo.mapCount = 0; /* NERVE - SMF - commented out trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM ); if( *arenasFile.string ) { UI_LoadArenasFromFile(arenasFile.string); } else { UI_LoadArenasFromFile("scripts/arenas.txt"); } */ // get all arenas from .arena files numdirs = trap_FS_GetFileList( "scripts", ".arena", dirlist, 1024 ); dirptr = dirlist; for ( i = 0; i < numdirs; i++, dirptr += dirlen + 1 ) { dirlen = strlen( dirptr ); strcpy( filename, "scripts/" ); strcat( filename, dirptr ); UI_LoadArenasFromFile( filename ); } // trap_DPrint( va( "%i arenas parsed\n", ui_numArenas ) ); // JPW NERVE pulled per atvi req if ( UI_OutOfMemory() ) { trap_Print( S_COLOR_YELLOW "WARNING: not anough memory in pool to load all arenas\n" ); } for ( n = 0; n < ui_numArenas; n++ ) { // determine type uiInfo.mapList[uiInfo.mapCount].cinematic = -1; uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc( Info_ValueForKey( ui_arenaInfos[n], "map" ) ); uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc( Info_ValueForKey( ui_arenaInfos[n], "longname" ) ); uiInfo.mapList[uiInfo.mapCount].levelShot = -1; uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc( va( "levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName ) ); uiInfo.mapList[uiInfo.mapCount].typeBits = 0; // NERVE - SMF // set timelimit str = Info_ValueForKey( ui_arenaInfos[n], "Timelimit" ); if ( *str ) { uiInfo.mapList[uiInfo.mapCount].Timelimit = atoi( str ); } else { uiInfo.mapList[uiInfo.mapCount].Timelimit = 0; } // set axis respawn time str = Info_ValueForKey( ui_arenaInfos[n], "AxisRespawnTime" ); if ( *str ) { uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime = atoi( str ); } else { uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime = 0; } // set allied respawn time str = Info_ValueForKey( ui_arenaInfos[n], "AlliedRespawnTime" ); if ( *str ) { uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime = atoi( str ); } else { uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime = 0; } // -NERVE - SMF type = Info_ValueForKey( ui_arenaInfos[n], "type" ); // if no type specified, it will be treated as "ffa" if ( *type ) { if ( strstr( type, "ffa" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_FFA ); } if ( strstr( type, "tourney" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_TOURNAMENT ); } if ( strstr( type, "ctf" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_CTF ); } // NERVE - SMF if ( strstr( type, "wolfmp" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_WOLF ); } if ( strstr( type, "wolfsw" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_WOLF_STOPWATCH ); } if ( strstr( type, "wolfcp" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_WOLF_CP ); } // -NERVE - SMF #ifdef MISSIONPACK if ( strstr( type, "oneflag" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_1FCTF ); } if ( strstr( type, "overload" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_OBELISK ); } if ( strstr( type, "harvester" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_HARVESTER ); } #endif // #ifdef MISSIONPACK } else { uiInfo.mapList[uiInfo.mapCount].typeBits |= ( 1 << GT_FFA ); } uiInfo.mapCount++; if ( uiInfo.mapCount >= MAX_MAPS ) { break; } } }
/* =============== UI_LoadArenas =============== */ static void UI_LoadArenas( void ) { int numdirs; vmCvar_t arenasFile; char filename[128]; char dirlist[1024]; char* dirptr; int i, n; int dirlen; const char *type; const char *tag; int singlePlayerNum, specialNum, otherNum; ui_numArenas = 0; _UI_trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM ); if( *arenasFile.string ) { UI_LoadArenasFromFile(arenasFile.string); } else { UI_LoadArenasFromFile("scripts/arenas.txt"); } // get all arenas from .arena files numdirs = _UI_trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 ); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } _UI_trap_Print( va( "%i arenas parsed\n", ui_numArenas ) ); if (outOfMemory) _UI_trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); // set initial numbers for( n = 0; n < ui_numArenas; n++ ) { Info_SetValueForKey( ui_arenaInfos[n], "num", va( "%i", n ) ); } // go through and count single players levels ui_numSinglePlayerArenas = 0; ui_numSpecialSinglePlayerArenas = 0; for( n = 0; n < ui_numArenas; n++ ) { // determine type type = Info_ValueForKey( ui_arenaInfos[n], "type" ); // if no type specified, it will be treated as "ffa" if( !*type ) { continue; } if( strstr( type, "single" ) ) { // check for special single player arenas (training, final) tag = Info_ValueForKey( ui_arenaInfos[n], "special" ); if( *tag ) { ui_numSpecialSinglePlayerArenas++; continue; } ui_numSinglePlayerArenas++; } } n = ui_numSinglePlayerArenas % ARENAS_PER_TIER; if( n != 0 ) { ui_numSinglePlayerArenas -= n; _UI_trap_Print( va( "%i arenas ignored to make count divisible by %i\n", n, ARENAS_PER_TIER ) ); } // go through once more and assign number to the levels singlePlayerNum = 0; specialNum = singlePlayerNum + ui_numSinglePlayerArenas; otherNum = specialNum + ui_numSpecialSinglePlayerArenas; for( n = 0; n < ui_numArenas; n++ ) { // determine type type = Info_ValueForKey( ui_arenaInfos[n], "type" ); // if no type specified, it will be treated as "ffa" if( *type ) { if( strstr( type, "single" ) ) { // check for special single player arenas (training, final) tag = Info_ValueForKey( ui_arenaInfos[n], "special" ); if( *tag ) { Info_SetValueForKey( ui_arenaInfos[n], "num", va( "%i", specialNum++ ) ); continue; } Info_SetValueForKey( ui_arenaInfos[n], "num", va( "%i", singlePlayerNum++ ) ); continue; } } Info_SetValueForKey( ui_arenaInfos[n], "num", va( "%i", otherNum++ ) ); } }
/* =============== UI_LoadArenas =============== */ void UI_LoadArenas( void ) { int numdirs; // vmCvar_t arenasFile; char filename[128]; char dirlist[1024]; char* dirptr; int i/*, n*/; int dirlen; //char *type, *str; ui_numArenas = 0; uiInfo.mapCount = 0; /* NERVE - SMF - commented out trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM ); if( *arenasFile.string ) { UI_LoadArenasFromFile(arenasFile.string); } else { UI_LoadArenasFromFile("scripts/arenas.txt"); } */ // get all arenas from .arena files numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 ); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } // trap_DPrint( va( "%i arenas parsed\n", ui_numArenas ) ); // JPW NERVE pulled per atvi req /* if (UI_OutOfMemory()) { trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); }*/ /* for( n = 0; n < ui_numArenas; n++ ) { // determine type uiInfo.mapList[uiInfo.mapCount].cinematic = -1; uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map")); uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname")); uiInfo.mapList[uiInfo.mapCount].levelShot = -1; uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc(va("levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName)); uiInfo.mapList[uiInfo.mapCount].typeBits = 0; uiInfo.mapList[uiInfo.mapCount].briefing = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "briefing")); uiInfo.mapList[uiInfo.mapCount].lmsbriefing = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "lmsbriefing")); // uiInfo.mapList[uiInfo.mapCount].objectives = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "objectives"));*/ // Gordon: cant use "\" in a key/pair translating * to \n for the moment, reeally should be using PC_ parsing stuff for this too // eek, no ; either..... // Arnout: THIS IS BAD DO NOT MODIFY A STRING AFTER IT IS ALLOCATED /*{ char* p; while(p = strchr(uiInfo.mapList[uiInfo.mapCount].description, '*')) { *p = '\n'; } while(p = strchr(uiInfo.mapList[uiInfo.mapCount].objectives, '*')) { *p = '\n'; } }*/ // NERVE - SMF // set timelimit /* str = Info_ValueForKey( ui_arenaInfos[n], "Timelimit" ); if ( *str ) uiInfo.mapList[uiInfo.mapCount].Timelimit = atoi( str ); else uiInfo.mapList[uiInfo.mapCount].Timelimit = 0; // set axis respawn time str = Info_ValueForKey( ui_arenaInfos[n], "AxisRespawnTime" ); if ( *str ) uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime = atoi( str ); else uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime = 0; // set allied respawn time str = Info_ValueForKey( ui_arenaInfos[n], "AlliedRespawnTime" ); if ( *str ) uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime = atoi( str ); else uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime = 0; // -NERVE - SMF type = Info_ValueForKey( ui_arenaInfos[n], "type" ); if( *type ) { // NERVE - SMF if( strstr( type, "wolfsp" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SINGLE_PLAYER); } if( strstr( type, "wolflms" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_LMS); } if( strstr( type, "wolfmp" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF); } if( strstr( type, "wolfsw" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_STOPWATCH); } // -NERVE - SMF } else { // Gordon: default is wolf now uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF); } str = Info_ValueForKey( ui_arenaInfos[n], "mapposition_x" ); if ( *str ) { uiInfo.mapList[uiInfo.mapCount].mappos[0] = atof(str); } else { uiInfo.mapList[uiInfo.mapCount].mappos[0] = 0.f; } str = Info_ValueForKey( ui_arenaInfos[n], "mapposition_y" ); if ( *str ) { uiInfo.mapList[uiInfo.mapCount].mappos[1] = atof(str); } else { uiInfo.mapList[uiInfo.mapCount].mappos[1] = 0.f; } uiInfo.mapCount++; if (uiInfo.mapCount >= MAX_MAPS) { break; } }*/ // CHRUKER: b090 - Sorting the map list qsort( uiInfo.mapList, uiInfo.mapCount, sizeof(uiInfo.mapList[0]), UI_SortArenas ); }
/* =============== UI_LoadArenas =============== */ void UI_LoadArenas( void ) { int numdirs; vmCvar_t arenasFile; char filename[128]; char dirlist[1024]; char* dirptr; int i, n; int dirlen; char *type; ui_numArenas = 0; uiInfo.mapCount = 0; trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM ); if( *arenasFile.string ) { UI_LoadArenasFromFile(arenasFile.string); } else { UI_LoadArenasFromFile("scripts/arenas.txt"); } // get all arenas from .arena files numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 ); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } trap_Print( va( "%i arenas parsed\n", ui_numArenas ) ); if (UI_OutOfMemory()) { trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); } for( n = 0; n < ui_numArenas; n++ ) { // determine type uiInfo.mapList[uiInfo.mapCount].cinematic = -1; uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map")); uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname")); uiInfo.mapList[uiInfo.mapCount].levelShot = -1; uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc(va("levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName)); uiInfo.mapList[uiInfo.mapCount].typeBits = 0; type = Info_ValueForKey( ui_arenaInfos[n], "type" ); // if no type specified, it will be treated as "ffa" if( *type ) { if( strstr( type, "ffa" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA); } if( strstr( type, "tourney" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_TOURNAMENT); } if( strstr( type, "ctf" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTF); } if( strstr( type, "oneflag" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_1FCTF); } if( strstr( type, "overload" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_OBELISK); } if( strstr( type, "harvester" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_HARVESTER); } } else { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA); } uiInfo.mapCount++; if (uiInfo.mapCount >= MAX_MAPS) { break; } } }
void UI_LoadArenas( void ) { int numdirs; char filename[MAX_QPATH]; char dirlist[MAPSBUFSIZE]; char* dirptr; int i, n; int dirlen; char *type; ui_numArenas = 0; uiInfo.mapCount = 0; // get all arenas from .arena files numdirs = trap->FS_GetFileList( "scripts", ".arena", dirlist, ARRAY_LEN( dirlist ) ); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } // trap->Print( "%i arenas parsed\n", ui_numArenas ); if (UI_OutOfMemory()) { trap->Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); } for( n = 0; n < ui_numArenas; n++ ) { // determine type uiInfo.mapList[uiInfo.mapCount].cinematic = -1; uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map")); uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname")); uiInfo.mapList[uiInfo.mapCount].levelShot = -1; uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc(va("levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName)); uiInfo.mapList[uiInfo.mapCount].typeBits = 0; type = Info_ValueForKey( ui_arenaInfos[n], "type" ); // if no type specified, it will be treated as "ffa" if( *type ) { if( strstr( type, "ffa" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_TEAM); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_JEDIMASTER); } if( strstr( type, "holocron" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_HOLOCRON); } if( strstr( type, "jedimaster" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_JEDIMASTER); } if( strstr( type, "duel" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_DUEL); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_POWERDUEL); } if( strstr( type, "powerduel" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_DUEL); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_POWERDUEL); } if( strstr( type, "siege" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SIEGE); } if( strstr( type, "ctf" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTF); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTY); } if( strstr( type, "cty" ) ) { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTY); } } else { uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_JEDIMASTER); } uiInfo.mapCount++; if (uiInfo.mapCount >= MAX_MAPS) { break; } } }