2012-08-04 10:54:37 +00:00
|
|
|
// Copyright (C) 1999-2000 Id Software, Inc.
|
2012-01-22 21:34:33 +00:00
|
|
|
//
|
|
|
|
//
|
|
|
|
// gameinfo.c
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "ui_local.h"
|
2013-09-04 15:58:49 +00:00
|
|
|
#include "ui_logger.h"
|
2012-01-22 21:34:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// arena and bot info
|
|
|
|
//
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
enum ui_gameinfoLimits_e {
|
|
|
|
DIRLIST_SIZE = 16384,
|
|
|
|
POOLSIZE = 48 * DIRLIST_SIZE
|
|
|
|
};
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
//#define POOLSIZE 128 * 1024
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t ui_numBots;
|
|
|
|
static char* ui_botInfos[MAX_BOTS];
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
static int32_t ui_numArenas;
|
|
|
|
static char* ui_arenaInfos[MAX_ARENAS];
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
static int32_t ui_numSinglePlayerArenas;
|
|
|
|
static int32_t ui_numSpecialSinglePlayerArenas;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
static char dirlist[DIRLIST_SIZE];
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
static char memoryPool[POOLSIZE];
|
|
|
|
static int32_t allocPoint, outOfMemory;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_Alloc
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void *UI_Alloc(int32_t size) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-08-04 10:54:37 +00:00
|
|
|
char *p;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (allocPoint + size > POOLSIZE) {
|
2012-08-04 10:54:37 +00:00
|
|
|
outOfMemory = qtrue;
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = &memoryPool[allocPoint];
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
allocPoint += (size + 31) & ~31;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_InitMemory
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_InitMemory(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-08-04 10:54:37 +00:00
|
|
|
allocPoint = 0;
|
|
|
|
outOfMemory = qfalse;
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
2012-01-22 21:34:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_ParseInfos
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_ParseInfos(char *buf, int32_t max, char *infos[]) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-01-22 21:34:33 +00:00
|
|
|
char *token;
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t count;
|
2012-01-22 21:34:33 +00:00
|
|
|
char key[MAX_TOKEN_CHARS];
|
|
|
|
char info[MAX_INFO_STRING];
|
|
|
|
|
|
|
|
count = 0;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
while (1) {
|
|
|
|
token = COM_Parse(&buf);
|
|
|
|
if (!token[0]) {
|
2012-01-22 21:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
if (strcmp(token, "{")) {
|
|
|
|
UI_Logger(LL_ERROR, "Missing { in info file\n");
|
2012-01-22 21:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (count == max) {
|
|
|
|
UI_Logger(LL_ERROR, "Max infos exceeded\n");
|
2012-01-22 21:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
info[0] = '\0';
|
2014-11-08 10:37:24 +00:00
|
|
|
while (1) {
|
|
|
|
token = COM_ParseExt(&buf, qtrue);
|
|
|
|
if (!token[0]) {
|
|
|
|
UI_Logger(LL_ERROR, "Unexpected end of info file\n");
|
2012-01-22 21:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
if (!strcmp(token, "}")) {
|
2012-01-22 21:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
Q_strncpyz(key, token, sizeof(key));
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
token = COM_ParseExt(&buf, qfalse);
|
|
|
|
if (!token[0]) {
|
|
|
|
strcpy(token, "<NULL>");
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
Info_SetValueForKey(info, key, token);
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
//NOTE: extra space for arena number
|
|
|
|
infos[count] = UI_Alloc(strlen(info) + strlen("\\num\\") + strlen(va("%d", MAX_ARENAS)) + 1);
|
|
|
|
if (infos[count]) {
|
|
|
|
strcpy(infos[count], info);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_LoadArenasFromFile
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
static void UI_LoadArenasFromFile(char *filename) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t len;
|
2012-01-22 21:34:33 +00:00
|
|
|
fileHandle_t f;
|
|
|
|
char buf[MAX_ARENAS_TEXT];
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
len = trap_FS_FOpenFile(filename, &f, FS_READ);
|
|
|
|
if (!f) {
|
|
|
|
trap_Print(va(S_COLOR_RED "file not found: %s\n", filename));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
if (len >= MAX_ARENAS_TEXT) {
|
|
|
|
trap_Print(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT));
|
|
|
|
trap_FS_FCloseFile(f);
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_FS_Read(buf, len, f);
|
2012-01-22 21:34:33 +00:00
|
|
|
buf[len] = 0;
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_FS_FCloseFile(f);
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
ui_numArenas += UI_ParseInfos(buf, MAX_ARENAS - ui_numArenas, &ui_arenaInfos[ui_numArenas]);
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2012-01-22 21:34:33 +00:00
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_LoadArenas
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
static void UI_LoadArenas(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t numdirs;
|
2012-01-22 21:34:33 +00:00
|
|
|
vmCvar_t arenasFile;
|
|
|
|
char filename[128];
|
|
|
|
char* dirptr;
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t i, n;
|
|
|
|
int32_t dirlen;
|
2012-01-22 21:34:33 +00:00
|
|
|
char *type;
|
2012-08-04 10:54:37 +00:00
|
|
|
char *tag;
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t singlePlayerNum, specialNum, otherNum;
|
2012-01-22 21:34:33 +00:00
|
|
|
|
|
|
|
ui_numArenas = 0;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_Register(&arenasFile, "g_arenasFile", "", CVAR_INIT | CVAR_ROM);
|
|
|
|
if (*arenasFile.string)
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
2012-01-22 21:34:33 +00:00
|
|
|
UI_LoadArenasFromFile(arenasFile.string);
|
|
|
|
}
|
2012-08-04 10:54:37 +00:00
|
|
|
else
|
|
|
|
{
|
2012-01-22 21:34:33 +00:00
|
|
|
UI_LoadArenasFromFile("scripts/arenas.txt");
|
|
|
|
}
|
|
|
|
|
|
|
|
// get all arenas from .arena files
|
2014-11-08 10:37:24 +00:00
|
|
|
numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, DIRLIST_SIZE);
|
|
|
|
dirptr = dirlist;
|
|
|
|
for (i = 0; i < numdirs && ui_numArenas < 1024; i++, dirptr += dirlen + 1)
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
2012-01-22 21:34:33 +00:00
|
|
|
dirlen = strlen(dirptr);
|
|
|
|
strcpy(filename, "scripts/");
|
|
|
|
strcat(filename, dirptr);
|
|
|
|
UI_LoadArenasFromFile(filename);
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Print(va("%i arenas parsed\n", ui_numArenas));
|
2012-08-04 10:54:37 +00:00
|
|
|
if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all arenas\n");
|
|
|
|
|
|
|
|
// set initial numbers
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
|
|
|
Info_SetValueForKey(ui_arenaInfos[n], "num", va("%i", n));
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
// go through and count single players levels
|
|
|
|
ui_numSinglePlayerArenas = 0;
|
|
|
|
ui_numSpecialSinglePlayerArenas = 0;
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
2012-01-22 21:34:33 +00:00
|
|
|
// determine type
|
2014-11-08 10:37:24 +00:00
|
|
|
type = Info_ValueForKey(ui_arenaInfos[n], "type");
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
// if no type specified, it will be treated as "ffa"
|
2014-11-08 10:37:24 +00:00
|
|
|
if (!*type) {
|
2012-08-04 10:54:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (strstr(type, "single")) {
|
2012-08-04 10:54:37 +00:00
|
|
|
// check for special single player arenas (training, final)
|
2014-11-08 10:37:24 +00:00
|
|
|
tag = Info_ValueForKey(ui_arenaInfos[n], "special");
|
|
|
|
if (*tag) {
|
2012-08-04 10:54:37 +00:00
|
|
|
ui_numSpecialSinglePlayerArenas++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui_numSinglePlayerArenas++;
|
|
|
|
}
|
|
|
|
}
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
// go through once more and assign number to the levels
|
|
|
|
singlePlayerNum = 0;
|
|
|
|
specialNum = singlePlayerNum + ui_numSinglePlayerArenas;
|
|
|
|
otherNum = specialNum + ui_numSpecialSinglePlayerArenas;
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
2012-08-04 10:54:37 +00:00
|
|
|
// determine type
|
2014-11-08 10:37:24 +00:00
|
|
|
type = Info_ValueForKey(ui_arenaInfos[n], "type");
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2012-01-22 21:34:33 +00:00
|
|
|
// if no type specified, it will be treated as "ffa"
|
2014-11-08 10:37:24 +00:00
|
|
|
if (*type) {
|
|
|
|
if (strstr(type, "single")) {
|
2012-08-04 10:54:37 +00:00
|
|
|
// check for special single player arenas (training, final)
|
2014-11-08 10:37:24 +00:00
|
|
|
tag = Info_ValueForKey(ui_arenaInfos[n], "special");
|
|
|
|
if (*tag) {
|
|
|
|
Info_SetValueForKey(ui_arenaInfos[n], "num", va("%i", specialNum++));
|
2012-08-04 10:54:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Info_SetValueForKey(ui_arenaInfos[n], "num", va("%i", singlePlayerNum++));
|
2012-08-04 10:54:37 +00:00
|
|
|
continue;
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Info_SetValueForKey(ui_arenaInfos[n], "num", va("%i", otherNum++));
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetArenaInfoByNumber
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
const char *UI_GetArenaInfoByNumber(int32_t num) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t n;
|
2012-08-04 10:54:37 +00:00
|
|
|
char *value;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (num < 0 || num >= ui_numArenas) {
|
|
|
|
trap_Print(va(S_COLOR_RED "Invalid arena number: %i\n", num));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
|
|
|
value = Info_ValueForKey(ui_arenaInfos[n], "num");
|
|
|
|
if (*value && atoi(value) == num) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ui_arenaInfos[n];
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetArenaInfoByMap
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
const char *UI_GetArenaInfoByMap(const char *map) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t n;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
|
|
|
if (Q_stricmp(Info_ValueForKey(ui_arenaInfos[n], "map"), map) == 0) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ui_arenaInfos[n];
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return NULL;
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetSpecialArenaInfo
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
const char *UI_GetSpecialArenaInfo(const char *tag) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t n;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numArenas; n++) {
|
|
|
|
if (Q_stricmp(Info_ValueForKey(ui_arenaInfos[n], "special"), tag) == 0) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ui_arenaInfos[n];
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-22 21:34:33 +00:00
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_LoadBotsFromFile
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
static void UI_LoadBotsFromFile(char *filename) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t len;
|
2012-01-22 21:34:33 +00:00
|
|
|
fileHandle_t f;
|
|
|
|
char buf[MAX_BOTS_TEXT];
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
len = trap_FS_FOpenFile(filename, &f, FS_READ);
|
|
|
|
if (!f) {
|
|
|
|
trap_Print(va(S_COLOR_RED "file not found: %s\n", filename));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
if (len >= MAX_BOTS_TEXT) {
|
|
|
|
trap_Print(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT));
|
|
|
|
trap_FS_FCloseFile(f);
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_FS_Read(buf, len, f);
|
2012-01-22 21:34:33 +00:00
|
|
|
buf[len] = 0;
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_FS_FCloseFile(f);
|
2012-01-22 21:34:33 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
ui_numBots += UI_ParseInfos(buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots]);
|
2012-08-04 10:54:37 +00:00
|
|
|
if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all bots\n");
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2012-01-22 21:34:33 +00:00
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_LoadBots
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
static void UI_LoadBots(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-01-22 21:34:33 +00:00
|
|
|
vmCvar_t botsFile;
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t numdirs;
|
2012-01-22 21:34:33 +00:00
|
|
|
char filename[128];
|
|
|
|
char* dirptr;
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t i;
|
|
|
|
int32_t dirlen;
|
2012-01-22 21:34:33 +00:00
|
|
|
|
|
|
|
ui_numBots = 0;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_Register(&botsFile, "g_botsFile", "", CVAR_INIT | CVAR_ROM);
|
|
|
|
if (*botsFile.string) {
|
2012-01-22 21:34:33 +00:00
|
|
|
UI_LoadBotsFromFile(botsFile.string);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
UI_LoadBotsFromFile("scripts/bots.txt");
|
|
|
|
}
|
|
|
|
|
|
|
|
// get all bots from .bot files
|
2014-11-08 10:37:24 +00:00
|
|
|
numdirs = trap_FS_GetFileList("scripts", ".bot", dirlist, DIRLIST_SIZE);
|
|
|
|
dirptr = dirlist;
|
|
|
|
for (i = 0; i < numdirs; i++, dirptr += dirlen + 1)
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
2012-01-22 21:34:33 +00:00
|
|
|
dirlen = strlen(dirptr);
|
|
|
|
strcpy(filename, "scripts/");
|
|
|
|
strcat(filename, dirptr);
|
|
|
|
UI_LoadBotsFromFile(filename);
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Print(va("%i bots parsed\n", ui_numBots));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetBotInfoByNumber
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
char *UI_GetBotInfoByNumber(int32_t num) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2014-11-08 10:37:24 +00:00
|
|
|
if (num < 0 || num >= ui_numBots) {
|
|
|
|
trap_Print(va(S_COLOR_RED "Invalid bot number: %i\n", num));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return ui_botInfos[num];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetBotInfoByName
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
char *UI_GetBotInfoByName(const char *name) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t n;
|
2012-01-22 21:34:33 +00:00
|
|
|
char *value;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < ui_numBots; n++) {
|
|
|
|
value = Info_ValueForKey(ui_botInfos[n], "name");
|
|
|
|
if (!Q_stricmp(value, name)) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return ui_botInfos[n];
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// single player game info
|
|
|
|
//
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetBestScore
|
|
|
|
|
|
|
|
Returns the player's best finish on a given level, 0 if the have not played the level
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_GetBestScore(int32_t level, int32_t *score, int32_t *skill) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t n;
|
|
|
|
int32_t skillScore;
|
|
|
|
int32_t bestScore;
|
|
|
|
int32_t bestScoreSkill;
|
2012-08-04 10:54:37 +00:00
|
|
|
char arenaKey[16];
|
|
|
|
char scores[MAX_INFO_VALUE];
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (!score || !skill) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (level < 0 || level > ui_numArenas) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bestScore = 0;
|
|
|
|
bestScoreSkill = 0;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 1; n <= 5; n++) {
|
|
|
|
trap_Cvar_VariableStringBuffer(va("g_spScores%i", n), scores, MAX_INFO_VALUE);
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Com_sprintf(arenaKey, sizeof(arenaKey), "l%i", level);
|
|
|
|
skillScore = atoi(Info_ValueForKey(scores, arenaKey));
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (skillScore < 1 || skillScore > 8) {
|
2012-08-04 10:54:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (!bestScore || skillScore <= bestScore) {
|
2012-08-04 10:54:37 +00:00
|
|
|
bestScore = skillScore;
|
|
|
|
bestScoreSkill = n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*score = bestScore;
|
|
|
|
*skill = bestScoreSkill;
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_SetBestScore
|
|
|
|
|
|
|
|
Set the player's best finish for a level
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_SetBestScore(int32_t level, int32_t score) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t skill;
|
|
|
|
int32_t oldScore;
|
2012-08-04 10:54:37 +00:00
|
|
|
char arenaKey[16];
|
|
|
|
char scores[MAX_INFO_VALUE];
|
|
|
|
|
|
|
|
// validate score
|
2014-11-08 10:37:24 +00:00
|
|
|
if (score < 1 || score > 8) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// validate skill
|
2014-11-08 10:37:24 +00:00
|
|
|
skill = (int32_t)trap_Cvar_VariableValue("g_spSkill");
|
|
|
|
if (skill < 1 || skill > 5) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get scores
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_VariableStringBuffer(va("g_spScores%i", skill), scores, MAX_INFO_VALUE);
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
// see if this is better
|
2014-11-08 10:37:24 +00:00
|
|
|
Com_sprintf(arenaKey, sizeof(arenaKey), "l%i", level);
|
|
|
|
oldScore = atoi(Info_ValueForKey(scores, arenaKey));
|
|
|
|
if (oldScore && oldScore <= score) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// update scores
|
2014-11-08 10:37:24 +00:00
|
|
|
Info_SetValueForKey(scores, arenaKey, va("%i", score));
|
|
|
|
trap_Cvar_Set(va("g_spScores%i", skill), scores);
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_LogAwardData
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_LogAwardData(int32_t award, int32_t data) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-08-04 10:54:37 +00:00
|
|
|
char key[16];
|
|
|
|
char awardData[MAX_INFO_VALUE];
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t oldValue;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (data == 0) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (award >= AWARD_MAX) {
|
|
|
|
trap_Print(va(S_COLOR_RED "Bad award %i in UI_LogAwardData\n", award));
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("g_spAwards", awardData, sizeof(awardData));
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Com_sprintf(key, sizeof(key), "a%i", award);
|
|
|
|
oldValue = atoi(Info_ValueForKey(awardData, key));
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Info_SetValueForKey(awardData, key, va("%i", oldValue + data));
|
|
|
|
trap_Cvar_Set("g_spAwards", awardData);
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetAwardLevel
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetAwardLevel(int32_t award) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-08-04 10:54:37 +00:00
|
|
|
char key[16];
|
|
|
|
char awardData[MAX_INFO_VALUE];
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("g_spAwards", awardData, sizeof(awardData));
|
2012-08-04 10:54:37 +00:00
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
Com_sprintf(key, sizeof(key), "a%i", award);
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2014-11-08 10:37:24 +00:00
|
|
|
return atoi(Info_ValueForKey(awardData, key));
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_TierCompleted
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_TierCompleted(int32_t levelWon) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t level;
|
|
|
|
int32_t n;
|
|
|
|
int32_t tier;
|
|
|
|
int32_t score;
|
|
|
|
int32_t skill;
|
|
|
|
int32_t maxarenas;
|
2012-08-04 10:54:37 +00:00
|
|
|
const char *info;
|
|
|
|
|
|
|
|
tier = levelWon / ARENAS_PER_TIER;
|
|
|
|
level = tier * ARENAS_PER_TIER;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if (tier == UI_GetNumSPTiers()) {
|
|
|
|
info = UI_GetSpecialArenaInfo("training");
|
|
|
|
if (levelWon == atoi(Info_ValueForKey(info, "num"))) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
info = UI_GetSpecialArenaInfo("final");
|
|
|
|
if (!info || levelWon == atoi(Info_ValueForKey(info, "num"))) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return tier + 1;
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uis.demoversion) {
|
|
|
|
maxarenas = 2;
|
2014-11-08 10:37:24 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-08-04 10:54:37 +00:00
|
|
|
maxarenas = ARENAS_PER_TIER;
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
for (n = 0; n < maxarenas; n++, level++) {
|
|
|
|
UI_GetBestScore(level, &score, &skill);
|
|
|
|
if (score != 1) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return tier + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetCurrentGame
|
|
|
|
|
|
|
|
Returns the next level the player has not won
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetCurrentGame(int32_t curLevel) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t level;
|
|
|
|
int32_t rank;
|
|
|
|
int32_t skill;
|
2012-08-04 10:54:37 +00:00
|
|
|
const char *info;
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
info = UI_GetSpecialArenaInfo("training");
|
|
|
|
if (info) {
|
|
|
|
level = atoi(Info_ValueForKey(info, "num"));
|
|
|
|
UI_GetBestScore(level, &rank, &skill);
|
|
|
|
if (!rank || rank > 1) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return level;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// kef 7/31/00 -- we think we'd like to just send you to the next map, not the first map you haven't won
|
2014-11-08 10:37:24 +00:00
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
if (curLevel == -1)
|
|
|
|
{
|
|
|
|
// -1 is a special value, the meaning of which is not currently clear to me
|
2014-11-08 10:37:24 +00:00
|
|
|
for (level = 0; level < ui_numSinglePlayerArenas; level++) {
|
|
|
|
UI_GetBestScore(level, &rank, &skill);
|
|
|
|
if (!rank || rank > 1)
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return level;
|
|
|
|
}
|
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
info = UI_GetSpecialArenaInfo("final");
|
|
|
|
if (!info) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2014-11-08 10:37:24 +00:00
|
|
|
return atoi(Info_ValueForKey(info, "num"));
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
else if ((curLevel >= 0) && (curLevel < (ui_numSinglePlayerArenas - 1)))
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
|
|
|
// go to next map
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2014-11-08 10:37:24 +00:00
|
|
|
return curLevel + 1;
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
2014-11-08 10:37:24 +00:00
|
|
|
else if (curLevel == (ui_numSinglePlayerArenas - 1))
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
|
|
|
// finished final map...back to the beginning
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// bogus value for curLevel
|
2014-11-08 10:37:24 +00:00
|
|
|
info = UI_GetSpecialArenaInfo("final");
|
|
|
|
if (!info) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2014-11-08 10:37:24 +00:00
|
|
|
return atoi(Info_ValueForKey(info, "num"));
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_NewGame
|
|
|
|
|
|
|
|
Clears the scores and sets the difficutly level
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_NewGame(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2014-11-08 10:37:24 +00:00
|
|
|
trap_Cvar_Set("g_spScores1", "");
|
|
|
|
trap_Cvar_Set("g_spScores2", "");
|
|
|
|
trap_Cvar_Set("g_spScores3", "");
|
|
|
|
trap_Cvar_Set("g_spScores4", "");
|
|
|
|
trap_Cvar_Set("g_spScores5", "");
|
|
|
|
trap_Cvar_Set("g_spAwards", "");
|
|
|
|
trap_Cvar_Set("g_spVideos", "");
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetNumArenas
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetNumArenas(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ui_numArenas;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetNumSPArenas
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetNumSPArenas(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ui_numSinglePlayerArenas;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetNumSPTiers
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetNumSPTiers(void)
|
2012-08-04 10:54:37 +00:00
|
|
|
{
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2013-08-16 12:58:47 +00:00
|
|
|
int32_t remainder;
|
2012-08-04 10:54:37 +00:00
|
|
|
|
|
|
|
remainder = ui_numSinglePlayerArenas % ARENAS_PER_TIER;
|
|
|
|
|
|
|
|
if (remainder)
|
|
|
|
{
|
|
|
|
remainder = 1;
|
|
|
|
}
|
|
|
|
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-08-04 10:54:37 +00:00
|
|
|
return ((ui_numSinglePlayerArenas / ARENAS_PER_TIER) + remainder);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_GetNumBots
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
int32_t UI_GetNumBots(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
return ui_numBots;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-04 10:54:37 +00:00
|
|
|
/*
|
|
|
|
===============
|
|
|
|
UI_InitGameinfo
|
|
|
|
===============
|
|
|
|
*/
|
2014-11-08 10:37:24 +00:00
|
|
|
void UI_InitGameinfo(void) {
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncBegin();
|
2012-08-04 10:54:37 +00:00
|
|
|
UI_InitMemory();
|
|
|
|
UI_LoadArenas();
|
|
|
|
UI_LoadBots();
|
|
|
|
|
2014-11-08 10:37:24 +00:00
|
|
|
if ((trap_Cvar_VariableValue("fs_restrict")) || (ui_numSpecialSinglePlayerArenas == 0 && ui_numSinglePlayerArenas == 2)) {
|
2012-08-04 10:54:37 +00:00
|
|
|
uis.demoversion = qtrue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
uis.demoversion = qfalse;
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|
2013-09-04 15:58:49 +00:00
|
|
|
UI_LogFuncEnd();
|
2012-01-22 21:34:33 +00:00
|
|
|
}
|