#include "ui_local.h"
Include dependency graph for ui_gameinfo.c:

Go to the source code of this file.
Functions | |
| char * | UI_GetBotInfoByName (const char *name) |
| char * | UI_GetBotInfoByNumber (int num) |
| char * | UI_GetBotNameByNumber (int num) |
| int | UI_GetNumBots () |
| void | UI_LoadArenas (void) |
| void | UI_LoadArenasFromFile (char *filename) |
| void | UI_LoadBots (void) |
| void | UI_LoadBotsFromFile (char *filename) |
| int | UI_ParseInfos (char *buf, int max, char *infos[]) |
Variables | |
| char * | ui_arenaInfos [MAX_ARENAS] |
| char * | ui_botInfos [MAX_BOTS] |
| int | ui_numArenas |
| int | ui_numBots |
| int | ui_numSinglePlayerArenas |
| int | ui_numSpecialSinglePlayerArenas |
|
|
Definition at line 299 of file ui_gameinfo.c. References Info_ValueForKey(), n, name, Q_stricmp(), ui_botInfos, and value. Referenced by ServerOptions_InitBotNames(), and UI_SPLevelMenu_SetBots(). 00299 {
00300 int n;
00301 char *value;
00302
00303 for ( n = 0; n < ui_numBots ; n++ ) {
00304 value = Info_ValueForKey( ui_botInfos[n], "name" );
00305 if ( !Q_stricmp( value, name ) ) {
00306 return ui_botInfos[n];
00307 }
00308 }
00309
00310 return NULL;
00311 }
|
Here is the call graph for this function:

|
|
Definition at line 285 of file ui_gameinfo.c. References S_COLOR_RED, trap_Print(), ui_botInfos, and va(). Referenced by UI_AddBotsMenu_SetBotNames(), UI_AddBotsMenu_SortCompare(), UI_BotSelectMenu_Default(), UI_BotSelectMenu_SortCompare(), UI_BotSelectMenu_UpdateGrid(), and UI_GetBotNameByNumber(). 00285 {
00286 if( num < 0 || num >= ui_numBots ) {
00287 trap_Print( va( S_COLOR_RED "Invalid bot number: %i\n", num ) );
00288 return NULL;
00289 }
00290 return ui_botInfos[num];
00291 }
|
Here is the call graph for this function:

|
|
Definition at line 318 of file ui_gameinfo.c. References Info_ValueForKey(), and UI_GetBotInfoByNumber(). Referenced by UI_DrawBotName(), UI_DrawTeamMember(), and UI_RunMenuScript(). 00318 {
00319 char *info = UI_GetBotInfoByNumber(num);
00320 if (info) {
00321 return Info_ValueForKey( info, "name" );
00322 }
00323 return "Sarge";
00324 }
|
Here is the call graph for this function:

|
|
Definition at line 313 of file ui_gameinfo.c. 00313 {
00314 return ui_numBots;
00315 }
|
|
|
Definition at line 135 of file ui_gameinfo.c. References mapInfo::cinematic, CVAR_INIT, CVAR_ROM, i, mapInfo::imageName, Info_ValueForKey(), mapInfo::levelShot, uiInfo_t::mapCount, uiInfo_t::mapList, mapInfo::mapLoadName, mapInfo::mapName, n, S_COLOR_YELLOW, strcat(), strcpy(), vmCvar_t::string, String_Alloc(), strlen(), strstr(), trap_Cvar_Register(), trap_FS_GetFileList(), trap_Print(), type, mapInfo::typeBits, ui_arenaInfos, UI_LoadArenasFromFile(), ui_numArenas, UI_OutOfMemory(), uiInfo, and va(). 00135 {
00136 int numdirs;
00137 vmCvar_t arenasFile;
00138 char filename[128];
00139 char dirlist[1024];
00140 char* dirptr;
00141 int i, n;
00142 int dirlen;
00143 char *type;
00144
00145 ui_numArenas = 0;
00146 uiInfo.mapCount = 0;
00147
00148 trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM );
00149 if( *arenasFile.string ) {
00150 UI_LoadArenasFromFile(arenasFile.string);
00151 }
00152 else {
00153 UI_LoadArenasFromFile("scripts/arenas.txt");
00154 }
00155
00156 // get all arenas from .arena files
00157 numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 );
00158 dirptr = dirlist;
00159 for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
00160 dirlen = strlen(dirptr);
00161 strcpy(filename, "scripts/");
00162 strcat(filename, dirptr);
00163 UI_LoadArenasFromFile(filename);
00164 }
00165 trap_Print( va( "%i arenas parsed\n", ui_numArenas ) );
00166 if (UI_OutOfMemory()) {
00167 trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n");
00168 }
00169
00170 for( n = 0; n < ui_numArenas; n++ ) {
00171 // determine type
00172
00173 uiInfo.mapList[uiInfo.mapCount].cinematic = -1;
00174 uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map"));
00175 uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname"));
00176 uiInfo.mapList[uiInfo.mapCount].levelShot = -1;
00177 uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc(va("levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName));
00178 uiInfo.mapList[uiInfo.mapCount].typeBits = 0;
00179
00180 type = Info_ValueForKey( ui_arenaInfos[n], "type" );
00181 // if no type specified, it will be treated as "ffa"
00182 if( *type ) {
00183 if( strstr( type, "ffa" ) ) {
00184 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA);
00185 }
00186 if( strstr( type, "tourney" ) ) {
00187 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_TOURNAMENT);
00188 }
00189 if( strstr( type, "ctf" ) ) {
00190 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTF);
00191 }
00192 if( strstr( type, "oneflag" ) ) {
00193 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_1FCTF);
00194 }
00195 if( strstr( type, "overload" ) ) {
00196 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_OBELISK);
00197 }
00198 if( strstr( type, "harvester" ) ) {
00199 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_HARVESTER);
00200 }
00201 } else {
00202 uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA);
00203 }
00204
00205 uiInfo.mapCount++;
00206 if (uiInfo.mapCount >= MAX_MAPS) {
00207 break;
00208 }
00209 }
00210 }
|
Here is the call graph for this function:

|
|
Definition at line 107 of file ui_gameinfo.c. References f, fileHandle_t, FS_READ, MAX_ARENAS, MAX_ARENAS_TEXT, S_COLOR_RED, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_Print(), ui_arenaInfos, ui_numArenas, UI_ParseInfos(), and va(). Referenced by UI_LoadArenas(). 00107 {
00108 int len;
00109 fileHandle_t f;
00110 char buf[MAX_ARENAS_TEXT];
00111
00112 len = trap_FS_FOpenFile( filename, &f, FS_READ );
00113 if ( !f ) {
00114 trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
00115 return;
00116 }
00117 if ( len >= MAX_ARENAS_TEXT ) {
00118 trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) );
00119 trap_FS_FCloseFile( f );
00120 return;
00121 }
00122
00123 trap_FS_Read( buf, len, f );
00124 buf[len] = 0;
00125 trap_FS_FCloseFile( f );
00126
00127 ui_numArenas += UI_ParseInfos( buf, MAX_ARENAS - ui_numArenas, &ui_arenaInfos[ui_numArenas] );
00128 }
|
Here is the call graph for this function:

|
|
Definition at line 248 of file ui_gameinfo.c. References CVAR_INIT, CVAR_ROM, i, strcat(), strcpy(), vmCvar_t::string, strlen(), trap_Cvar_Register(), trap_FS_GetFileList(), trap_Print(), UI_LoadBotsFromFile(), ui_numBots, and va(). 00248 {
00249 vmCvar_t botsFile;
00250 int numdirs;
00251 char filename[128];
00252 char dirlist[1024];
00253 char* dirptr;
00254 int i;
00255 int dirlen;
00256
00257 ui_numBots = 0;
00258
00259 trap_Cvar_Register( &botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM );
00260 if( *botsFile.string ) {
00261 UI_LoadBotsFromFile(botsFile.string);
00262 }
00263 else {
00264 UI_LoadBotsFromFile("scripts/bots.txt");
00265 }
00266
00267 // get all bots from .bot files
00268 numdirs = trap_FS_GetFileList("scripts", ".bot", dirlist, 1024 );
00269 dirptr = dirlist;
00270 for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
00271 dirlen = strlen(dirptr);
00272 strcpy(filename, "scripts/");
00273 strcat(filename, dirptr);
00274 UI_LoadBotsFromFile(filename);
00275 }
00276 trap_Print( va( "%i bots parsed\n", ui_numBots ) );
00277 }
|
Here is the call graph for this function:

|
|
Definition at line 218 of file ui_gameinfo.c. References COM_Compress(), f, fileHandle_t, FS_READ, MAX_BOTS, MAX_BOTS_TEXT, S_COLOR_RED, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_Print(), ui_botInfos, ui_numBots, UI_ParseInfos(), and va(). Referenced by UI_LoadBots(). 00218 {
00219 int len;
00220 fileHandle_t f;
00221 char buf[MAX_BOTS_TEXT];
00222
00223 len = trap_FS_FOpenFile( filename, &f, FS_READ );
00224 if ( !f ) {
00225 trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
00226 return;
00227 }
00228 if ( len >= MAX_BOTS_TEXT ) {
00229 trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) );
00230 trap_FS_FCloseFile( f );
00231 return;
00232 }
00233
00234 trap_FS_Read( buf, len, f );
00235 buf[len] = 0;
00236 trap_FS_FCloseFile( f );
00237
00238 COM_Compress(buf);
00239
00240 ui_numBots += UI_ParseInfos( buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots] );
00241 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 51 of file ui_gameinfo.c. References COM_Parse(), COM_ParseExt(), Com_Printf(), count, Info_SetValueForKey(), MAX_ARENAS, Q_strncpyz(), qfalse, qtrue, strcmp(), strcpy(), strlen(), token, UI_Alloc(), and va(). Referenced by UI_LoadArenasFromFile(), and UI_LoadBotsFromFile(). 00051 {
00052 char *token;
00053 int count;
00054 char key[MAX_TOKEN_CHARS];
00055 char info[MAX_INFO_STRING];
00056
00057 count = 0;
00058
00059 while ( 1 ) {
00060 token = COM_Parse( &buf );
00061 if ( !token[0] ) {
00062 break;
00063 }
00064 if ( strcmp( token, "{" ) ) {
00065 Com_Printf( "Missing { in info file\n" );
00066 break;
00067 }
00068
00069 if ( count == max ) {
00070 Com_Printf( "Max infos exceeded\n" );
00071 break;
00072 }
00073
00074 info[0] = '\0';
00075 while ( 1 ) {
00076 token = COM_ParseExt( &buf, qtrue );
00077 if ( !token[0] ) {
00078 Com_Printf( "Unexpected end of info file\n" );
00079 break;
00080 }
00081 if ( !strcmp( token, "}" ) ) {
00082 break;
00083 }
00084 Q_strncpyz( key, token, sizeof( key ) );
00085
00086 token = COM_ParseExt( &buf, qfalse );
00087 if ( !token[0] ) {
00088 strcpy( token, "<NULL>" );
00089 }
00090 Info_SetValueForKey( info, key, token );
00091 }
00092 //NOTE: extra space for arena number
00093 infos[count] = UI_Alloc(strlen(info) + strlen("\\num\\") + strlen(va("%d", MAX_ARENAS)) + 1);
00094 if (infos[count]) {
00095 strcpy(infos[count], info);
00096 count++;
00097 }
00098 }
00099 return count;
00100 }
|
Here is the call graph for this function:

|
|
Definition at line 39 of file ui_gameinfo.c. Referenced by UI_LoadArenas(), and UI_LoadArenasFromFile(). |
|
|
Definition at line 36 of file ui_gameinfo.c. Referenced by UI_GetBotInfoByName(), UI_GetBotInfoByNumber(), and UI_LoadBotsFromFile(). |
|
|
Definition at line 38 of file ui_gameinfo.c. Referenced by UI_LoadArenas(), and UI_LoadArenasFromFile(). |
|
|
Definition at line 35 of file ui_gameinfo.c. |
|
|
Definition at line 42 of file ui_gameinfo.c. |
|
|
Definition at line 43 of file ui_gameinfo.c. |
1.3.9.1