summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-10-03 20:52:19 +0000
committerTim Angus <tim@ngus.net>2005-10-03 20:52:19 +0000
commit57a17f003806d9326b64317babf866d6111c0abb (patch)
tree9783aa743a70eadc3c2e6d88117d145d6d1ba3cb /src/ui
parente6f475ab2290ff7bc847336ed1f211f2092ac602 (diff)
* Removed jump pad code (and associated media loading)
* Removed loading of some Q3 cruft * Spilled events attached to temporary entities are now reattached to their original entities, fixing the missing flame bug * Fixed "suicide god" bug * Fixed bug where zap ignores armour * Fixed missing particle systems when follow-spectating * Fixed potential bug involving dodgy pointer arithmetic in CG_LoadClientInfo * Cleaned up logic in CG_AddPlayerWeapon * MASK_SHOT traces no longer collide with corpses * Corpses timeout in 20 seconds instead of 60 * Improved robustness of spawn validation, fixing the bug on transit * A crapload of whitespace fixes
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/keycodes.h246
-rw-r--r--src/ui/ui_atoms.c624
-rw-r--r--src/ui/ui_gameinfo.c2
-rw-r--r--src/ui/ui_local.h1346
-rw-r--r--src/ui/ui_main.c528
-rw-r--r--src/ui/ui_players.c2210
-rw-r--r--src/ui/ui_shared.c284
-rw-r--r--src/ui/ui_shared.h285
-rw-r--r--src/ui/ui_syscalls.c186
9 files changed, 2830 insertions, 2881 deletions
diff --git a/src/ui/keycodes.h b/src/ui/keycodes.h
index b0830de2..cfa82223 100644
--- a/src/ui/keycodes.h
+++ b/src/ui/keycodes.h
@@ -24,134 +24,134 @@
// normal keys should be passed as lowercased ascii
typedef enum {
- K_TAB = 9,
- K_ENTER = 13,
- K_ESCAPE = 27,
- K_SPACE = 32,
-
- K_BACKSPACE = 127,
-
- K_COMMAND = 128,
- K_CAPSLOCK,
- K_POWER,
- K_PAUSE,
-
- K_UPARROW,
- K_DOWNARROW,
- K_LEFTARROW,
- K_RIGHTARROW,
-
- K_ALT,
- K_CTRL,
- K_SHIFT,
- K_INS,
- K_DEL,
- K_PGDN,
- K_PGUP,
- K_HOME,
- K_END,
-
- K_F1,
- K_F2,
- K_F3,
- K_F4,
- K_F5,
- K_F6,
- K_F7,
- K_F8,
- K_F9,
- K_F10,
- K_F11,
- K_F12,
- K_F13,
- K_F14,
- K_F15,
-
- K_KP_HOME,
- K_KP_UPARROW,
- K_KP_PGUP,
- K_KP_LEFTARROW,
- K_KP_5,
- K_KP_RIGHTARROW,
- K_KP_END,
- K_KP_DOWNARROW,
- K_KP_PGDN,
- K_KP_ENTER,
- K_KP_INS,
- K_KP_DEL,
- K_KP_SLASH,
- K_KP_MINUS,
- K_KP_PLUS,
- K_KP_NUMLOCK,
- K_KP_STAR,
- K_KP_EQUALS,
-
- K_MOUSE1,
- K_MOUSE2,
- K_MOUSE3,
- K_MOUSE4,
- K_MOUSE5,
-
- K_MWHEELDOWN,
- K_MWHEELUP,
-
- K_JOY1,
- K_JOY2,
- K_JOY3,
- K_JOY4,
- K_JOY5,
- K_JOY6,
- K_JOY7,
- K_JOY8,
- K_JOY9,
- K_JOY10,
- K_JOY11,
- K_JOY12,
- K_JOY13,
- K_JOY14,
- K_JOY15,
- K_JOY16,
- K_JOY17,
- K_JOY18,
- K_JOY19,
- K_JOY20,
- K_JOY21,
- K_JOY22,
- K_JOY23,
- K_JOY24,
- K_JOY25,
- K_JOY26,
- K_JOY27,
- K_JOY28,
- K_JOY29,
- K_JOY30,
- K_JOY31,
- K_JOY32,
-
- K_AUX1,
- K_AUX2,
- K_AUX3,
- K_AUX4,
- K_AUX5,
- K_AUX6,
- K_AUX7,
- K_AUX8,
- K_AUX9,
- K_AUX10,
- K_AUX11,
- K_AUX12,
- K_AUX13,
- K_AUX14,
- K_AUX15,
- K_AUX16,
-
- K_LAST_KEY // this had better be <256!
+ K_TAB = 9,
+ K_ENTER = 13,
+ K_ESCAPE = 27,
+ K_SPACE = 32,
+
+ K_BACKSPACE = 127,
+
+ K_COMMAND = 128,
+ K_CAPSLOCK,
+ K_POWER,
+ K_PAUSE,
+
+ K_UPARROW,
+ K_DOWNARROW,
+ K_LEFTARROW,
+ K_RIGHTARROW,
+
+ K_ALT,
+ K_CTRL,
+ K_SHIFT,
+ K_INS,
+ K_DEL,
+ K_PGDN,
+ K_PGUP,
+ K_HOME,
+ K_END,
+
+ K_F1,
+ K_F2,
+ K_F3,
+ K_F4,
+ K_F5,
+ K_F6,
+ K_F7,
+ K_F8,
+ K_F9,
+ K_F10,
+ K_F11,
+ K_F12,
+ K_F13,
+ K_F14,
+ K_F15,
+
+ K_KP_HOME,
+ K_KP_UPARROW,
+ K_KP_PGUP,
+ K_KP_LEFTARROW,
+ K_KP_5,
+ K_KP_RIGHTARROW,
+ K_KP_END,
+ K_KP_DOWNARROW,
+ K_KP_PGDN,
+ K_KP_ENTER,
+ K_KP_INS,
+ K_KP_DEL,
+ K_KP_SLASH,
+ K_KP_MINUS,
+ K_KP_PLUS,
+ K_KP_NUMLOCK,
+ K_KP_STAR,
+ K_KP_EQUALS,
+
+ K_MOUSE1,
+ K_MOUSE2,
+ K_MOUSE3,
+ K_MOUSE4,
+ K_MOUSE5,
+
+ K_MWHEELDOWN,
+ K_MWHEELUP,
+
+ K_JOY1,
+ K_JOY2,
+ K_JOY3,
+ K_JOY4,
+ K_JOY5,
+ K_JOY6,
+ K_JOY7,
+ K_JOY8,
+ K_JOY9,
+ K_JOY10,
+ K_JOY11,
+ K_JOY12,
+ K_JOY13,
+ K_JOY14,
+ K_JOY15,
+ K_JOY16,
+ K_JOY17,
+ K_JOY18,
+ K_JOY19,
+ K_JOY20,
+ K_JOY21,
+ K_JOY22,
+ K_JOY23,
+ K_JOY24,
+ K_JOY25,
+ K_JOY26,
+ K_JOY27,
+ K_JOY28,
+ K_JOY29,
+ K_JOY30,
+ K_JOY31,
+ K_JOY32,
+
+ K_AUX1,
+ K_AUX2,
+ K_AUX3,
+ K_AUX4,
+ K_AUX5,
+ K_AUX6,
+ K_AUX7,
+ K_AUX8,
+ K_AUX9,
+ K_AUX10,
+ K_AUX11,
+ K_AUX12,
+ K_AUX13,
+ K_AUX14,
+ K_AUX15,
+ K_AUX16,
+
+ K_LAST_KEY // this had better be <256!
} keyNum_t;
// The menu code needs to get both key and char events, but
// to avoid duplicating the paths, the char events are just
// distinguished by or'ing in K_CHAR_FLAG (ugly)
-#define K_CHAR_FLAG 1024
+#define K_CHAR_FLAG 1024
#endif
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c
index 5abf7c31..8139be91 100644
--- a/src/ui/ui_atoms.c
+++ b/src/ui/ui_atoms.c
@@ -15,37 +15,37 @@
*/
/**********************************************************************
- UI_ATOMS.C
+ UI_ATOMS.C
- User interface building blocks and support functions.
+ User interface building blocks and support functions.
**********************************************************************/
#include "ui_local.h"
-qboolean m_entersound; // after a frame, so caching won't disrupt the sound
+qboolean m_entersound; // after a frame, so caching won't disrupt the sound
// these are here so the functions in q_shared.c can link
#ifndef UI_HARD_LINKED
void QDECL Com_Error( int level, const char *error, ... ) {
- va_list argptr;
- char text[1024];
+ va_list argptr;
+ char text[1024];
- va_start (argptr, error);
- vsprintf (text, error, argptr);
- va_end (argptr);
+ va_start (argptr, error);
+ vsprintf (text, error, argptr);
+ va_end (argptr);
- trap_Error( va("%s", text) );
+ trap_Error( va("%s", text) );
}
void QDECL Com_Printf( const char *msg, ... ) {
- va_list argptr;
- char text[1024];
+ va_list argptr;
+ char text[1024];
- va_start (argptr, msg);
- vsprintf (text, msg, argptr);
- va_end (argptr);
+ va_start (argptr, msg);
+ vsprintf (text, msg, argptr);
+ va_end (argptr);
- trap_Print( va("%s", text) );
+ trap_Print( va("%s", text) );
}
#endif
@@ -60,9 +60,9 @@ UI_ClampCvar
*/
float UI_ClampCvar( float min, float max, float value )
{
- if ( value < min ) return min;
- if ( value > max ) return max;
- return value;
+ if ( value < min ) return min;
+ if ( value > max ) return max;
+ return value;
}
/*
@@ -71,85 +71,85 @@ UI_StartDemoLoop
=================
*/
void UI_StartDemoLoop( void ) {
- trap_Cmd_ExecuteText( EXEC_APPEND, "d1\n" );
+ trap_Cmd_ExecuteText( EXEC_APPEND, "d1\n" );
}
char *UI_Argv( int arg ) {
- static char buffer[MAX_STRING_CHARS];
+ static char buffer[MAX_STRING_CHARS];
- trap_Argv( arg, buffer, sizeof( buffer ) );
+ trap_Argv( arg, buffer, sizeof( buffer ) );
- return buffer;
+ return buffer;
}
char *UI_Cvar_VariableString( const char *var_name ) {
- static char buffer[MAX_STRING_CHARS];
+ static char buffer[MAX_STRING_CHARS];
- trap_Cvar_VariableStringBuffer( var_name, buffer, sizeof( buffer ) );
+ trap_Cvar_VariableStringBuffer( var_name, buffer, sizeof( buffer ) );
- return buffer;
+ return buffer;
}
void UI_SetBestScores(postGameInfo_t *newInfo, qboolean postGame) {
- trap_Cvar_Set("ui_scoreAccuracy", va("%i%%", newInfo->accuracy));
- trap_Cvar_Set("ui_scoreImpressives", va("%i", newInfo->impressives));
- trap_Cvar_Set("ui_scoreExcellents", va("%i", newInfo->excellents));
- trap_Cvar_Set("ui_scoreDefends", va("%i", newInfo->defends));
- trap_Cvar_Set("ui_scoreAssists", va("%i", newInfo->assists));
- trap_Cvar_Set("ui_scoreGauntlets", va("%i", newInfo->gauntlets));
- trap_Cvar_Set("ui_scoreScore", va("%i", newInfo->score));
- trap_Cvar_Set("ui_scorePerfect", va("%i", newInfo->perfects));
- trap_Cvar_Set("ui_scoreTeam", va("%i to %i", newInfo->redScore, newInfo->blueScore));
- trap_Cvar_Set("ui_scoreBase", va("%i", newInfo->baseScore));
- trap_Cvar_Set("ui_scoreTimeBonus", va("%i", newInfo->timeBonus));
- trap_Cvar_Set("ui_scoreSkillBonus", va("%i", newInfo->skillBonus));
- trap_Cvar_Set("ui_scoreShutoutBonus", va("%i", newInfo->shutoutBonus));
- trap_Cvar_Set("ui_scoreTime", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
- trap_Cvar_Set("ui_scoreCaptures", va("%i", newInfo->captures));
+ trap_Cvar_Set("ui_scoreAccuracy", va("%i%%", newInfo->accuracy));
+ trap_Cvar_Set("ui_scoreImpressives", va("%i", newInfo->impressives));
+ trap_Cvar_Set("ui_scoreExcellents", va("%i", newInfo->excellents));
+ trap_Cvar_Set("ui_scoreDefends", va("%i", newInfo->defends));
+ trap_Cvar_Set("ui_scoreAssists", va("%i", newInfo->assists));
+ trap_Cvar_Set("ui_scoreGauntlets", va("%i", newInfo->gauntlets));
+ trap_Cvar_Set("ui_scoreScore", va("%i", newInfo->score));
+ trap_Cvar_Set("ui_scorePerfect", va("%i", newInfo->perfects));
+ trap_Cvar_Set("ui_scoreTeam", va("%i to %i", newInfo->redScore, newInfo->blueScore));
+ trap_Cvar_Set("ui_scoreBase", va("%i", newInfo->baseScore));
+ trap_Cvar_Set("ui_scoreTimeBonus", va("%i", newInfo->timeBonus));
+ trap_Cvar_Set("ui_scoreSkillBonus", va("%i", newInfo->skillBonus));
+ trap_Cvar_Set("ui_scoreShutoutBonus", va("%i", newInfo->shutoutBonus));
+ trap_Cvar_Set("ui_scoreTime", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
+ trap_Cvar_Set("ui_scoreCaptures", va("%i", newInfo->captures));
if (postGame) {
- trap_Cvar_Set("ui_scoreAccuracy2", va("%i%%", newInfo->accuracy));
- trap_Cvar_Set("ui_scoreImpressives2", va("%i", newInfo->impressives));
- trap_Cvar_Set("ui_scoreExcellents2", va("%i", newInfo->excellents));
- trap_Cvar_Set("ui_scoreDefends2", va("%i", newInfo->defends));
- trap_Cvar_Set("ui_scoreAssists2", va("%i", newInfo->assists));
- trap_Cvar_Set("ui_scoreGauntlets2", va("%i", newInfo->gauntlets));
- trap_Cvar_Set("ui_scoreScore2", va("%i", newInfo->score));
- trap_Cvar_Set("ui_scorePerfect2", va("%i", newInfo->perfects));
- trap_Cvar_Set("ui_scoreTeam2", va("%i to %i", newInfo->redScore, newInfo->blueScore));
- trap_Cvar_Set("ui_scoreBase2", va("%i", newInfo->baseScore));
- trap_Cvar_Set("ui_scoreTimeBonus2", va("%i", newInfo->timeBonus));
- trap_Cvar_Set("ui_scoreSkillBonus2", va("%i", newInfo->skillBonus));
- trap_Cvar_Set("ui_scoreShutoutBonus2", va("%i", newInfo->shutoutBonus));
- trap_Cvar_Set("ui_scoreTime2", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
- trap_Cvar_Set("ui_scoreCaptures2", va("%i", newInfo->captures));
- }
+ trap_Cvar_Set("ui_scoreAccuracy2", va("%i%%", newInfo->accuracy));
+ trap_Cvar_Set("ui_scoreImpressives2", va("%i", newInfo->impressives));
+ trap_Cvar_Set("ui_scoreExcellents2", va("%i", newInfo->excellents));
+ trap_Cvar_Set("ui_scoreDefends2", va("%i", newInfo->defends));
+ trap_Cvar_Set("ui_scoreAssists2", va("%i", newInfo->assists));
+ trap_Cvar_Set("ui_scoreGauntlets2", va("%i", newInfo->gauntlets));
+ trap_Cvar_Set("ui_scoreScore2", va("%i", newInfo->score));
+ trap_Cvar_Set("ui_scorePerfect2", va("%i", newInfo->perfects));
+ trap_Cvar_Set("ui_scoreTeam2", va("%i to %i", newInfo->redScore, newInfo->blueScore));
+ trap_Cvar_Set("ui_scoreBase2", va("%i", newInfo->baseScore));
+ trap_Cvar_Set("ui_scoreTimeBonus2", va("%i", newInfo->timeBonus));
+ trap_Cvar_Set("ui_scoreSkillBonus2", va("%i", newInfo->skillBonus));
+ trap_Cvar_Set("ui_scoreShutoutBonus2", va("%i", newInfo->shutoutBonus));
+ trap_Cvar_Set("ui_scoreTime2", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
+ trap_Cvar_Set("ui_scoreCaptures2", va("%i", newInfo->captures));
+ }
}
void UI_LoadBestScores(const char *map, int game) {
- char fileName[MAX_QPATH];
- fileHandle_t f;
- postGameInfo_t newInfo;
- 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) {
- int size = 0;
- trap_FS_Read(&size, sizeof(int), f);
- if (size == sizeof(postGameInfo_t)) {
- trap_FS_Read(&newInfo, sizeof(postGameInfo_t), f);
- }
- trap_FS_FCloseFile(f);
- }
- UI_SetBestScores(&newInfo, qfalse);
-
- Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.dm_%d", map, game, (int)trap_Cvar_VariableValue("protocol"));
- uiInfo.demoAvailable = qfalse;
- if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
- uiInfo.demoAvailable = qtrue;
- trap_FS_FCloseFile(f);
- }
+ char fileName[MAX_QPATH];
+ fileHandle_t f;
+ postGameInfo_t newInfo;
+ 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) {
+ int size = 0;
+ trap_FS_Read(&size, sizeof(int), f);
+ if (size == sizeof(postGameInfo_t)) {
+ trap_FS_Read(&newInfo, sizeof(postGameInfo_t), f);
+ }
+ trap_FS_FCloseFile(f);
+ }
+ UI_SetBestScores(&newInfo, qfalse);
+
+ Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.dm_%d", map, game, (int)trap_Cvar_VariableValue("protocol"));
+ uiInfo.demoAvailable = qfalse;
+ if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
+ uiInfo.demoAvailable = qtrue;
+ trap_FS_FCloseFile(f);
+ }
}
/*
@@ -158,38 +158,38 @@ UI_ClearScores
===============
*/
void UI_ClearScores() {
- char gameList[4096];
- char *gameFile;
- int i, len, count, size;
- fileHandle_t f;
- postGameInfo_t newInfo;
-
- count = trap_FS_GetFileList( "games", "game", gameList, sizeof(gameList) );
-
- size = sizeof(postGameInfo_t);
- memset(&newInfo, 0, size);
-
- if (count > 0) {
- gameFile = gameList;
- for ( i = 0; i < count; i++ ) {
- len = strlen(gameFile);
- if (trap_FS_FOpenFile(va("games/%s",gameFile), &f, FS_WRITE) >= 0) {
- trap_FS_Write(&size, sizeof(int), f);
- trap_FS_Write(&newInfo, size, f);
- trap_FS_FCloseFile(f);
- }
- gameFile += len + 1;
- }
- }
-
- UI_SetBestScores(&newInfo, qfalse);
+ char gameList[4096];
+ char *gameFile;
+ int i, len, count, size;
+ fileHandle_t f;
+ postGameInfo_t newInfo;
+
+ count = trap_FS_GetFileList( "games", "game", gameList, sizeof(gameList) );
+
+ size = sizeof(postGameInfo_t);
+ memset(&newInfo, 0, size);
+
+ if (count > 0) {
+ gameFile = gameList;
+ for ( i = 0; i < count; i++ ) {
+ len = strlen(gameFile);
+ if (trap_FS_FOpenFile(va("games/%s",gameFile), &f, FS_WRITE) >= 0) {
+ trap_FS_Write(&size, sizeof(int), f);
+ trap_FS_Write(&newInfo, size, f);
+ trap_FS_FCloseFile(f);
+ }
+ gameFile += len + 1;
+ }
+ }
+
+ UI_SetBestScores(&newInfo, qfalse);
}
-static void UI_Cache_f() {
- Display_CacheAll();
+static void UI_Cache_f() {
+ Display_CacheAll();
}
/*
@@ -198,96 +198,96 @@ UI_CalcPostGameStats
=======================
*/
static void UI_CalcPostGameStats() {
- char map[MAX_QPATH];
- char fileName[MAX_QPATH];
- char info[MAX_INFO_STRING];
- fileHandle_t f;
- int size, game, time, adjustedTime;
- postGameInfo_t oldInfo;
- postGameInfo_t newInfo;
- qboolean newHigh = qfalse;
-
- trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
- Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
- game = atoi(Info_ValueForKey(info, "g_gametype"));
-
- // compose file name
- Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
- // see if we have one already
- memset(&oldInfo, 0, sizeof(postGameInfo_t));
- if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
- // if so load it
- size = 0;
- trap_FS_Read(&size, sizeof(int), f);
- if (size == sizeof(postGameInfo_t)) {
- trap_FS_Read(&oldInfo, sizeof(postGameInfo_t), f);
- }
- trap_FS_FCloseFile(f);
- }
-
- newInfo.accuracy = atoi(UI_Argv(3));
- newInfo.impressives = atoi(UI_Argv(4));
- newInfo.excellents = atoi(UI_Argv(5));
- newInfo.defends = atoi(UI_Argv(6));
- newInfo.assists = atoi(UI_Argv(7));
- newInfo.gauntlets = atoi(UI_Argv(8));
- newInfo.baseScore = atoi(UI_Argv(9));
- newInfo.perfects = atoi(UI_Argv(10));
- newInfo.redScore = atoi(UI_Argv(11));
- newInfo.blueScore = atoi(UI_Argv(12));
- time = atoi(UI_Argv(13));
- newInfo.captures = atoi(UI_Argv(14));
-
- newInfo.time = (time - trap_Cvar_VariableValue("ui_matchStartTime")) / 1000;
- adjustedTime = uiInfo.mapList[ui_currentMap.integer].timeToBeat[game];
- if (newInfo.time < adjustedTime) {
- newInfo.timeBonus = (adjustedTime - newInfo.time) * 10;
- } else {
- newInfo.timeBonus = 0;
- }
-
- if (newInfo.redScore > newInfo.blueScore && newInfo.blueScore <= 0) {
- newInfo.shutoutBonus = 100;
- } else {
- newInfo.shutoutBonus = 0;
- }
-
- newInfo.skillBonus = trap_Cvar_VariableValue("g_spSkill");
- if (newInfo.skillBonus <= 0) {
- newInfo.skillBonus = 1;
- }
- newInfo.score = newInfo.baseScore + newInfo.shutoutBonus + newInfo.timeBonus;
- newInfo.score *= newInfo.skillBonus;
-
- // see if the score is higher for this one
- newHigh = (newInfo.redScore > newInfo.blueScore && newInfo.score > oldInfo.score);
-
- if (newHigh) {
- // if so write out the new one
- uiInfo.newHighScoreTime = uiInfo.uiDC.realTime + 20000;
- if (trap_FS_FOpenFile(fileName, &f, FS_WRITE) >= 0) {
- size = sizeof(postGameInfo_t);
- trap_FS_Write(&size, sizeof(int), f);
- trap_FS_Write(&newInfo, sizeof(postGameInfo_t), f);
- trap_FS_FCloseFile(f);
- }
- }
-
- if (newInfo.time < oldInfo.time) {
- uiInfo.newBestTime = uiInfo.uiDC.realTime + 20000;
- }
-
- // put back all the ui overrides
- trap_Cvar_Set("capturelimit", UI_Cvar_VariableString("ui_saveCaptureLimit"));
- trap_Cvar_Set("fraglimit", UI_Cvar_VariableString("ui_saveFragLimit"));
- trap_Cvar_Set("cg_drawTimer", UI_Cvar_VariableString("ui_drawTimer"));
- trap_Cvar_Set("g_doWarmup", UI_Cvar_VariableString("ui_doWarmup"));
- trap_Cvar_Set("g_Warmup", UI_Cvar_VariableString("ui_Warmup"));
- trap_Cvar_Set("sv_pure", UI_Cvar_VariableString("ui_pure"));
- trap_Cvar_Set("g_friendlyFire", UI_Cvar_VariableString("ui_friendlyFire"));
-
- UI_SetBestScores(&newInfo, qtrue);
- UI_ShowPostGame(newHigh);
+ char map[MAX_QPATH];
+ char fileName[MAX_QPATH];
+ char info[MAX_INFO_STRING];
+ fileHandle_t f;
+ int size, game, time, adjustedTime;
+ postGameInfo_t oldInfo;
+ postGameInfo_t newInfo;
+ qboolean newHigh = qfalse;
+
+ trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
+ Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
+ game = atoi(Info_ValueForKey(info, "g_gametype"));
+
+ // compose file name
+ Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
+ // see if we have one already
+ memset(&oldInfo, 0, sizeof(postGameInfo_t));
+ if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
+ // if so load it
+ size = 0;
+ trap_FS_Read(&size, sizeof(int), f);
+ if (size == sizeof(postGameInfo_t)) {
+ trap_FS_Read(&oldInfo, sizeof(postGameInfo_t), f);
+ }
+ trap_FS_FCloseFile(f);
+ }
+
+ newInfo.accuracy = atoi(UI_Argv(3));
+ newInfo.impressives = atoi(UI_Argv(4));
+ newInfo.excellents = atoi(UI_Argv(5));
+ newInfo.defends = atoi(UI_Argv(6));
+ newInfo.assists = atoi(UI_Argv(7));
+ newInfo.gauntlets = atoi(UI_Argv(8));
+ newInfo.baseScore = atoi(UI_Argv(9));
+ newInfo.perfects = atoi(UI_Argv(10));
+ newInfo.redScore = atoi(UI_Argv(11));
+ newInfo.blueScore = atoi(UI_Argv(12));
+ time = atoi(UI_Argv(13));
+ newInfo.captures = atoi(UI_Argv(14));
+
+ newInfo.time = (time - trap_Cvar_VariableValue("ui_matchStartTime")) / 1000;
+ adjustedTime = uiInfo.mapList[ui_currentMap.integer].timeToBeat[game];
+ if (newInfo.time < adjustedTime) {
+ newInfo.timeBonus = (adjustedTime - newInfo.time) * 10;
+ } else {
+ newInfo.timeBonus = 0;
+ }
+
+ if (newInfo.redScore > newInfo.blueScore && newInfo.blueScore <= 0) {
+ newInfo.shutoutBonus = 100;
+ } else {
+ newInfo.shutoutBonus = 0;
+ }
+
+ newInfo.skillBonus = trap_Cvar_VariableValue("g_spSkill");
+ if (newInfo.skillBonus <= 0) {
+ newInfo.skillBonus = 1;
+ }
+ newInfo.score = newInfo.baseScore + newInfo.shutoutBonus + newInfo.timeBonus;
+ newInfo.score *= newInfo.skillBonus;
+
+ // see if the score is higher for this one
+ newHigh = (newInfo.redScore > newInfo.blueScore && newInfo.score > oldInfo.score);
+
+ if (newHigh) {
+ // if so write out the new one
+ uiInfo.newHighScoreTime = uiInfo.uiDC.realTime + 20000;
+ if (trap_FS_FOpenFile(fileName, &f, FS_WRITE) >= 0) {
+ size = sizeof(postGameInfo_t);
+ trap_FS_Write(&size, sizeof(int), f);
+ trap_FS_Write(&newInfo, sizeof(postGameInfo_t), f);
+ trap_FS_FCloseFile(f);
+ }
+ }
+
+ if (newInfo.time < oldInfo.time) {
+ uiInfo.newBestTime = uiInfo.uiDC.realTime + 20000;
+ }
+
+ // put back all the ui overrides
+ trap_Cvar_Set("capturelimit", UI_Cvar_VariableString("ui_saveCaptureLimit"));
+ trap_Cvar_Set("fraglimit", UI_Cvar_VariableString("ui_saveFragLimit"));
+ trap_Cvar_Set("cg_drawTimer", UI_Cvar_VariableString("ui_drawTimer"));
+ trap_Cvar_Set("g_doWarmup", UI_Cvar_VariableString("ui_doWarmup"));
+ trap_Cvar_Set("g_Warmup", UI_Cvar_VariableString("ui_Warmup"));
+ trap_Cvar_Set("sv_pure", UI_Cvar_VariableString("ui_pure"));
+ trap_Cvar_Set("g_friendlyFire", UI_Cvar_VariableString("ui_friendlyFire"));
+
+ UI_SetBestScores(&newInfo, qtrue);
+ UI_ShowPostGame(newHigh);
}
@@ -300,56 +300,56 @@ UI_ConsoleCommand
*/
qboolean UI_ConsoleCommand( int realTime )
{
- char *cmd;
+ char *cmd;
char *arg1;
- uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
- uiInfo.uiDC.realTime = realTime;
-
- cmd = UI_Argv( 0 );
-
- // ensure minimum menu data is available
- //Menu_Cache();
-
- if ( Q_stricmp (cmd, "ui_test") == 0 ) {
- UI_ShowPostGame(qtrue);
- }
-
- if ( Q_stricmp (cmd, "ui_report") == 0 ) {
- UI_Report();
- return qtrue;
- }
-
- if ( Q_stricmp (cmd, "ui_load") == 0 ) {
- UI_Load();
- return qtrue;
- }
-
- if ( Q_stricmp (cmd, "remapShader") == 0 ) {
- if (trap_Argc() == 4) {
- char shader1[MAX_QPATH];
- char shader2[MAX_QPATH];
- Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
- Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
- trap_R_RemapShader(shader1, shader2, UI_Argv(3));
- return qtrue;
- }
- }
-
- if ( Q_stricmp (cmd, "postgame") == 0 ) {
- UI_CalcPostGameStats();
- return qtrue;
- }
-
- if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
- UI_Cache_f();
- return qtrue;
- }
-
- if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
- //UI_TeamOrdersMenu_f();
- return qtrue;
- }
+ uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
+ uiInfo.uiDC.realTime = realTime;
+
+ cmd = UI_Argv( 0 );
+
+ // ensure minimum menu data is available
+ //Menu_Cache();
+
+ if ( Q_stricmp (cmd, "ui_test") == 0 ) {
+ UI_ShowPostGame(qtrue);
+ }
+
+ if ( Q_stricmp (cmd, "ui_report") == 0 ) {
+ UI_Report();
+ return qtrue;
+ }
+
+ if ( Q_stricmp (cmd, "ui_load") == 0 ) {
+ UI_Load();
+ return qtrue;
+ }
+
+ if ( Q_stricmp (cmd, "remapShader") == 0 ) {
+ if (trap_Argc() == 4) {
+ char shader1[MAX_QPATH];
+ char shader2[MAX_QPATH];
+ Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
+ Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
+ trap_R_RemapShader(shader1, shader2, UI_Argv(3));
+ return qtrue;
+ }
+ }
+
+ if ( Q_stricmp (cmd, "postgame") == 0 ) {
+ UI_CalcPostGameStats();
+ return qtrue;
+ }
+
+ if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
+ UI_Cache_f();
+ return qtrue;
+ }
+
+ if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
+ //UI_TeamOrdersMenu_f();
+ return qtrue;
+ }
if( Q_stricmp ( cmd, "menu" ) == 0 )
{
@@ -358,11 +358,11 @@ qboolean UI_ConsoleCommand( int realTime )
if( Menu_Count( ) > 0 )
{
trap_Key_SetCatcher( KEYCATCH_UI );
- Menus_ActivateByName( arg1 );
+ Menus_ActivateByName( arg1 );
return qtrue;
}
}
-
+
if( Q_stricmp ( cmd, "closemenus" ) == 0 )
{
if( Menu_Count( ) > 0 )
@@ -374,13 +374,13 @@ qboolean UI_ConsoleCommand( int realTime )
return qtrue;
}
}
-
- if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) {
- //UI_CDKeyMenu_f();
- return qtrue;
- }
- return qfalse;
+ if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) {
+ //UI_CDKeyMenu_f();
+ return qtrue;
+ }
+
+ return qfalse;
}
/*
@@ -399,57 +399,57 @@ Adjusted for resolution and screen aspect ratio
================
*/
void UI_AdjustFrom640( float *x, float *y, float *w, float *h ) {
- // expect valid pointers
+ // expect valid pointers
#if 0
- *x = *x * uiInfo.uiDC.scale + uiInfo.uiDC.bias;
- *y *= uiInfo.uiDC.scale;
- *w *= uiInfo.uiDC.scale;
- *h *= uiInfo.uiDC.scale;
+ *x = *x * uiInfo.uiDC.scale + uiInfo.uiDC.bias;
+ *y *= uiInfo.uiDC.scale;
+ *w *= uiInfo.uiDC.scale;
+ *h *= uiInfo.uiDC.scale;
#endif
- *x *= uiInfo.uiDC.xscale;
- *y *= uiInfo.uiDC.yscale;
- *w *= uiInfo.uiDC.xscale;
- *h *= uiInfo.uiDC.yscale;
+ *x *= uiInfo.uiDC.xscale;
+ *y *= uiInfo.uiDC.yscale;
+ *w *= uiInfo.uiDC.xscale;
+ *h *= uiInfo.uiDC.yscale;
}
void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
- qhandle_t hShader;
+ qhandle_t hShader;
- hShader = trap_R_RegisterShaderNoMip( picname );
- UI_AdjustFrom640( &x, &y, &width, &height );
- trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
+ hShader = trap_R_RegisterShaderNoMip( picname );
+ UI_AdjustFrom640( &x, &y, &width, &height );
+ trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
}
void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader ) {
- float s0;
- float s1;
- float t0;
- float t1;
-
- if( w < 0 ) { // flip about vertical
- w = -w;
- s0 = 1;
- s1 = 0;
- }
- else {
- s0 = 0;
- s1 = 1;
- }
-
- if( h < 0 ) { // flip about horizontal
- h = -h;
- t0 = 1;
- t1 = 0;
- }
- else {
- t0 = 0;
- t1 = 1;
- }
-
- UI_AdjustFrom640( &x, &y, &w, &h );
- trap_R_DrawStretchPic( x, y, w, h, s0, t0, s1, t1, hShader );
+ float s0;
+ float s1;
+ float t0;
+ float t1;
+
+ if( w < 0 ) { // flip about vertical
+ w = -w;
+ s0 = 1;
+ s1 = 0;
+ }
+ else {
+ s0 = 0;
+ s1 = 1;
+ }
+
+ if( h < 0 ) { // flip about horizontal
+ h = -h;
+ t0 = 1;
+ t1 = 0;
+ }
+ else {
+ t0 = 0;
+ t1 = 1;
+ }
+
+ UI_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( x, y, w, h, s0, t0, s1, t1, hShader );
}
/*
@@ -460,24 +460,24 @@ Coordinates are 640*480 virtual values
=================
*/
void UI_FillRect( float x, float y, float width, float height, const float *color ) {
- trap_R_SetColor( color );
+ trap_R_SetColor( color );
- UI_AdjustFrom640( &x, &y, &width, &height );
- trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
+ UI_AdjustFrom640( &x, &y, &width, &height );
+ trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
- trap_R_SetColor( NULL );
+ trap_R_SetColor( NULL );
}
void UI_DrawSides(float x, float y, float w, float h) {
- UI_AdjustFrom640( &x, &y, &w, &h );
- trap_R_DrawStretchPic( x, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
- trap_R_DrawStretchPic( x + w - 1, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
+ UI_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( x, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
+ trap_R_DrawStretchPic( x + w - 1, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
}
void UI_DrawTopBottom(float x, float y, float w, float h) {
- UI_AdjustFrom640( &x, &y, &w, &h );
- trap_R_DrawStretchPic( x, y, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
- trap_R_DrawStretchPic( x, y + h - 1, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
+ UI_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( x, y, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
+ trap_R_DrawStretchPic( x, y + h - 1, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
}
/*
================
@@ -487,36 +487,36 @@ Coordinates are 640*480 virtual values
=================
*/
void UI_DrawRect( float x, float y, float width, float height, const float *color ) {
- trap_R_SetColor( color );
+ trap_R_SetColor( color );
UI_DrawTopBottom(x, y, width, height);
UI_DrawSides(x, y, width, height);
- trap_R_SetColor( NULL );
+ trap_R_SetColor( NULL );
}
void UI_SetColor( const float *rgba ) {
- trap_R_SetColor( rgba );
+ trap_R_SetColor( rgba );
}
void UI_UpdateScreen( void ) {
- trap_UpdateScreen();
+ trap_UpdateScreen();
}
void UI_DrawTextBox (int x, int y, int width, int lines)
{
- UI_FillRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorBlack );
- UI_DrawRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorWhite );
+ UI_FillRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorBlack );
+ UI_DrawRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorWhite );
}
qboolean UI_CursorInRect (int x, int y, int width, int height)
{
- if (uiInfo.uiDC.cursorx < x ||
- uiInfo.uiDC.cursory < y ||
- uiInfo.uiDC.cursorx > x+width ||
- uiInfo.uiDC.cursory > y+height)
- return qfalse;
+ if (uiInfo.uiDC.cursorx < x ||
+ uiInfo.uiDC.cursory < y ||
+ uiInfo.uiDC.cursorx > x+width ||
+ uiInfo.uiDC.cursory > y+height)
+ return qfalse;
- return qtrue;
+ return qtrue;
}
diff --git a/src/ui/ui_gameinfo.c b/src/ui/ui_gameinfo.c
index 5a04db53..49d0cdb0 100644
--- a/src/ui/ui_gameinfo.c
+++ b/src/ui/ui_gameinfo.c
@@ -160,7 +160,7 @@ void UI_LoadArenas( void ) {
// determine type
type = Info_ValueForKey( ui_arenaInfos[ n ], "type" );
// if no type specified, it will be treated as "ffa"
-
+
if( *type && strstr( type, "tremulous" ) )
uiInfo.mapList[ uiInfo.mapCount ].typeBits |= ( 1 << 0 );
else
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index aa8d7aa7..8809eafc 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -26,324 +26,324 @@
// global display context
-extern vmCvar_t ui_ffa_fraglimit;
-extern vmCvar_t ui_ffa_timelimit;
-
-extern vmCvar_t ui_tourney_fraglimit;
-extern vmCvar_t ui_tourney_timelimit;
-
-extern vmCvar_t ui_team_fraglimit;
-extern vmCvar_t ui_team_timelimit;
-extern vmCvar_t ui_team_friendly;
-
-extern vmCvar_t ui_ctf_capturelimit;
-extern vmCvar_t ui_ctf_timelimit;
-extern vmCvar_t ui_ctf_friendly;
-
-extern vmCvar_t ui_arenasFile;
-extern vmCvar_t ui_botsFile;
-extern vmCvar_t ui_spScores1;
-extern vmCvar_t ui_spScores2;
-extern vmCvar_t ui_spScores3;
-extern vmCvar_t ui_spScores4;
-extern vmCvar_t ui_spScores5;
-extern vmCvar_t ui_spAwards;
-extern vmCvar_t ui_spVideos;
-extern vmCvar_t ui_spSkill;
-
-extern vmCvar_t ui_spSelection;
-
-extern vmCvar_t ui_browserMaster;
-extern vmCvar_t ui_browserGameType;
-extern vmCvar_t ui_browserSortKey;
-extern vmCvar_t ui_browserShowFull;
-extern vmCvar_t ui_browserShowEmpty;
-
-extern vmCvar_t ui_brassTime;
-extern vmCvar_t ui_drawCrosshair;
-extern vmCvar_t ui_drawCrosshairNames;
-extern vmCvar_t ui_marks;
-
-extern vmCvar_t ui_server1;
-extern vmCvar_t ui_server2;
-extern vmCvar_t ui_server3;
-extern vmCvar_t ui_server4;
-extern vmCvar_t ui_server5;
-extern vmCvar_t ui_server6;
-extern vmCvar_t ui_server7;
-extern vmCvar_t ui_server8;
-extern vmCvar_t ui_server9;
-extern vmCvar_t ui_server10;
-extern vmCvar_t ui_server11;
-extern vmCvar_t ui_server12;
-extern vmCvar_t ui_server13;
-extern vmCvar_t ui_server14;
-extern vmCvar_t ui_server15;
-extern vmCvar_t ui_server16;
-
-extern vmCvar_t ui_cdkey;
-extern vmCvar_t ui_cdkeychecked;
-
-extern vmCvar_t ui_captureLimit;
-extern vmCvar_t ui_fragLimit;
-extern vmCvar_t ui_gameType;
-extern vmCvar_t ui_netGameType;
-extern vmCvar_t ui_actualNetGameType;
-extern vmCvar_t ui_joinGameType;
-extern vmCvar_t ui_netSource;
-extern vmCvar_t ui_serverFilterType;
-extern vmCvar_t ui_dedicated;
-extern vmCvar_t ui_opponentName;
-extern vmCvar_t ui_menuFiles;
-extern vmCvar_t ui_currentTier;
-extern vmCvar_t ui_currentMap;
-extern vmCvar_t ui_currentNetMap;
-extern vmCvar_t ui_mapIndex;
-extern vmCvar_t ui_currentOpponent;
-extern vmCvar_t ui_selectedPlayer;
-extern vmCvar_t ui_selectedPlayerName;
-extern vmCvar_t ui_lastServerRefresh_0;
-extern vmCvar_t ui_lastServerRefresh_1;
-extern vmCvar_t ui_lastServerRefresh_2;
-extern vmCvar_t ui_lastServerRefresh_3;
-extern vmCvar_t ui_singlePlayerActive;
-extern vmCvar_t ui_scoreAccuracy;
-extern vmCvar_t ui_scoreImpressives;
-extern vmCvar_t ui_scoreExcellents;
-extern vmCvar_t ui_scoreDefends;
-extern vmCvar_t ui_scoreAssists;
-extern vmCvar_t ui_scoreGauntlets;
-extern vmCvar_t ui_scoreScore;
-extern vmCvar_t ui_scorePerfect;
-extern vmCvar_t ui_scoreTeam;
-extern vmCvar_t ui_scoreBase;
-extern vmCvar_t ui_scoreTimeBonus;
-extern vmCvar_t ui_scoreSkillBonus;
-extern vmCvar_t ui_scoreShutoutBonus;
-extern vmCvar_t ui_scoreTime;
-extern vmCvar_t ui_smallFont;
-extern vmCvar_t ui_bigFont;
+extern vmCvar_t ui_ffa_fraglimit;
+extern vmCvar_t ui_ffa_timelimit;
+
+extern vmCvar_t ui_tourney_fraglimit;
+extern vmCvar_t ui_tourney_timelimit;
+
+extern vmCvar_t ui_team_fraglimit;
+extern vmCvar_t ui_team_timelimit;
+extern vmCvar_t ui_team_friendly;
+
+extern vmCvar_t ui_ctf_capturelimit;
+extern vmCvar_t ui_ctf_timelimit;
+extern vmCvar_t ui_ctf_friendly;
+
+extern vmCvar_t ui_arenasFile;
+extern vmCvar_t ui_botsFile;
+extern vmCvar_t ui_spScores1;
+extern vmCvar_t ui_spScores2;
+extern vmCvar_t ui_spScores3;
+extern vmCvar_t ui_spScores4;
+extern vmCvar_t ui_spScores5;
+extern vmCvar_t ui_spAwards;
+extern vmCvar_t ui_spVideos;
+extern vmCvar_t ui_spSkill;
+
+extern vmCvar_t ui_spSelection;
+
+extern vmCvar_t ui_browserMaster;
+extern vmCvar_t ui_browserGameType;
+extern vmCvar_t ui_browserSortKey;
+extern vmCvar_t ui_browserShowFull;
+extern vmCvar_t ui_browserShowEmpty;
+
+extern vmCvar_t ui_brassTime;
+extern vmCvar_t ui_drawCrosshair;
+extern vmCvar_t ui_drawCrosshairNames;
+extern vmCvar_t ui_marks;
+
+extern vmCvar_t ui_server1;
+extern vmCvar_t ui_server2;
+extern vmCvar_t ui_server3;
+extern vmCvar_t ui_server4;
+extern vmCvar_t ui_server5;
+extern vmCvar_t ui_server6;
+extern vmCvar_t ui_server7;
+extern vmCvar_t ui_server8;
+extern vmCvar_t ui_server9;
+extern vmCvar_t ui_server10;
+extern vmCvar_t ui_server11;
+extern vmCvar_t ui_server12;
+extern vmCvar_t ui_server13;
+extern vmCvar_t ui_server14;
+extern vmCvar_t ui_server15;
+extern vmCvar_t ui_server16;
+
+extern vmCvar_t ui_cdkey;
+extern vmCvar_t ui_cdkeychecked;
+
+extern vmCvar_t ui_captureLimit;
+extern vmCvar_t ui_fragLimit;
+extern vmCvar_t ui_gameType;
+extern vmCvar_t ui_netGameType;
+extern vmCvar_t ui_actualNetGameType;
+extern vmCvar_t ui_joinGameType;
+extern vmCvar_t ui_netSource;
+extern vmCvar_t ui_serverFilterType;
+extern vmCvar_t ui_dedicated;
+extern vmCvar_t ui_opponentName;
+extern vmCvar_t ui_menuFiles;
+extern vmCvar_t ui_currentTier;
+extern vmCvar_t ui_currentMap;
+extern vmCvar_t ui_currentNetMap;
+extern vmCvar_t ui_mapIndex;
+extern vmCvar_t ui_currentOpponent;
+extern vmCvar_t ui_selectedPlayer;
+extern vmCvar_t ui_selectedPlayerName;
+extern vmCvar_t ui_lastServerRefresh_0;
+extern vmCvar_t ui_lastServerRefresh_1;
+extern vmCvar_t ui_lastServerRefresh_2;
+extern vmCvar_t ui_lastServerRefresh_3;
+extern vmCvar_t ui_singlePlayerActive;
+extern vmCvar_t ui_scoreAccuracy;
+extern vmCvar_t ui_scoreImpressives;
+extern vmCvar_t ui_scoreExcellents;
+extern vmCvar_t ui_scoreDefends;
+extern vmCvar_t ui_scoreAssists;
+extern vmCvar_t ui_scoreGauntlets;
+extern vmCvar_t ui_scoreScore;
+extern vmCvar_t ui_scorePerfect;
+extern vmCvar_t ui_scoreTeam;
+extern vmCvar_t ui_scoreBase;
+extern vmCvar_t ui_scoreTimeBonus;
+extern vmCvar_t ui_scoreSkillBonus;
+extern vmCvar_t ui_scoreShutoutBonus;
+extern vmCvar_t ui_scoreTime;
+extern vmCvar_t ui_smallFont;
+extern vmCvar_t ui_bigFont;
extern vmCvar_t ui_serverStatusTimeOut;
//TA: bank values
-extern vmCvar_t ui_bank;
+extern vmCvar_t ui_bank;
//
// ui_qmenu.c
//
-#define RCOLUMN_OFFSET ( BIGCHAR_WIDTH )
-#define LCOLUMN_OFFSET (-BIGCHAR_WIDTH )
-
-#define SLIDER_RANGE 10
-#define MAX_EDIT_LINE 256
-
-#define MAX_MENUDEPTH 8
-#define MAX_MENUITEMS 96
-
-#define MTYPE_NULL 0
-#define MTYPE_SLIDER 1
-#define MTYPE_ACTION 2
-#define MTYPE_SPINCONTROL 3
-#define MTYPE_FIELD 4
-#define MTYPE_RADIOBUTTON 5
-#define MTYPE_BITMAP 6
-#define MTYPE_TEXT 7
-#define MTYPE_SCROLLLIST 8
-#define MTYPE_PTEXT 9
-#define MTYPE_BTEXT 10
-
-#define QMF_BLINK 0x00000001
-#define QMF_SMALLFONT 0x00000002
-#define QMF_LEFT_JUSTIFY 0x00000004
-#define QMF_CENTER_JUSTIFY 0x00000008
-#define QMF_RIGHT_JUSTIFY 0x00000010
-#define QMF_NUMBERSONLY 0x00000020 // edit field is only numbers
-#define QMF_HIGHLIGHT 0x00000040
-#define QMF_HIGHLIGHT_IF_FOCUS 0x00000080 // steady focus
-#define QMF_PULSEIFFOCUS 0x00000100 // pulse if focus
-#define QMF_HASMOUSEFOCUS 0x00000200
-#define QMF_NOONOFFTEXT 0x00000400
-#define QMF_MOUSEONLY 0x00000800 // only mouse input allowed
-#define QMF_HIDDEN 0x00001000 // skips drawing
-#define QMF_GRAYED 0x00002000 // grays and disables
-#define QMF_INACTIVE 0x00004000 // disables any input
-#define QMF_NODEFAULTINIT 0x00008000 // skip default initialization
-#define QMF_OWNERDRAW 0x00010000
-#define QMF_PULSE 0x00020000
-#define QMF_LOWERCASE 0x00040000 // edit field is all lower case
-#define QMF_UPPERCASE 0x00080000 // edit field is all upper case
-#define QMF_SILENT 0x00100000
+#define RCOLUMN_OFFSET ( BIGCHAR_WIDTH )
+#define LCOLUMN_OFFSET (-BIGCHAR_WIDTH )
+
+#define SLIDER_RANGE 10
+#define MAX_EDIT_LINE 256
+
+#define MAX_MENUDEPTH 8
+#define MAX_MENUITEMS 96
+
+#define MTYPE_NULL 0
+#define MTYPE_SLIDER 1
+#define MTYPE_ACTION 2
+#define MTYPE_SPINCONTROL 3
+#define MTYPE_FIELD 4
+#define MTYPE_RADIOBUTTON 5
+#define MTYPE_BITMAP 6
+#define MTYPE_TEXT 7
+#define MTYPE_SCROLLLIST 8
+#define MTYPE_PTEXT 9
+#define MTYPE_BTEXT 10
+
+#define QMF_BLINK 0x00000001
+#define QMF_SMALLFONT 0x00000002
+#define QMF_LEFT_JUSTIFY 0x00000004
+#define QMF_CENTER_JUSTIFY 0x00000008
+#define QMF_RIGHT_JUSTIFY 0x00000010
+#define QMF_NUMBERSONLY 0x00000020 // edit field is only numbers
+#define QMF_HIGHLIGHT 0x00000040
+#define QMF_HIGHLIGHT_IF_FOCUS 0x00000080 // steady focus
+#define QMF_PULSEIFFOCUS 0x00000100 // pulse if focus
+#define QMF_HASMOUSEFOCUS 0x00000200
+#define QMF_NOONOFFTEXT 0x00000400
+#define QMF_MOUSEONLY 0x00000800 // only mouse input allowed
+#define QMF_HIDDEN 0x00001000 // skips drawing
+#define QMF_GRAYED 0x00002000 // grays and disables
+#define QMF_INACTIVE 0x00004000 // disables any input
+#define QMF_NODEFAULTINIT 0x00008000 // skip default initialization
+#define QMF_OWNERDRAW 0x00010000
+#define QMF_PULSE 0x00020000
+#define QMF_LOWERCASE 0x00040000 // edit field is all lower case
+#define QMF_UPPERCASE 0x00080000 // edit field is all upper case
+#define QMF_SILENT 0x00100000
// callback notifications
-#define QM_GOTFOCUS 1
-#define QM_LOSTFOCUS 2
-#define QM_ACTIVATED 3
+#define QM_GOTFOCUS 1
+#define QM_LOSTFOCUS 2
+#define QM_ACTIVATED 3
typedef struct _tag_menuframework
{
- int cursor;
- int cursor_prev;
+ int cursor;
+ int cursor_prev;
- int nitems;
- void *items[MAX_MENUITEMS];
+ int nitems;
+ void *items[MAX_MENUITEMS];
- void (*draw) (void);
- sfxHandle_t (*key) (int key);
+ void (*draw) (void);
+ sfxHandle_t (*key) (int key);
- qboolean wrapAround;
- qboolean fullscreen;
- qboolean showlogo;
+ qboolean wrapAround;
+ qboolean fullscreen;
+ qboolean showlogo;
} menuframework_s;
typedef struct
{
- int type;
- const char *name;
- int id;
- int x, y;
- int left;
- int top;
- int right;
- int bottom;
- menuframework_s *parent;
- int menuPosition;
- unsigned flags;
-
- void (*callback)( void *self, int event );
- void (*statusbar)( void *self );
- void (*ownerdraw)( void *self );
+ int type;
+ const char *name;
+ int id;
+ int x, y;
+ int left;
+ int top;
+ int right;
+ int bottom;
+ menuframework_s *parent;
+ int menuPosition;
+ unsigned flags;
+
+ void (*callback)( void *self, int event );
+ void (*statusbar)( void *self );
+ void (*ownerdraw)( void *self );
} menucommon_s;
typedef struct {
- int cursor;
- int scroll;
- int widthInChars;
- char buffer[MAX_EDIT_LINE];
- int maxchars;
+ int cursor;
+ int scroll;
+ int widthInChars;
+ char buffer[MAX_EDIT_LINE];
+ int maxchars;
} mfield_t;
typedef struct
{
- menucommon_s generic;
- mfield_t field;
+ menucommon_s generic;
+ mfield_t field;
} menufield_s;
-typedef struct
+typedef struct
{
- menucommon_s generic;
+ menucommon_s generic;
- float minvalue;
- float maxvalue;
- float curvalue;
+ float minvalue;
+ float maxvalue;
+ float curvalue;
- float range;
+ float range;
} menuslider_s;
typedef struct
{
- menucommon_s generic;
-
- int oldvalue;
- int curvalue;
- int numitems;
- int top;
-
- const char **itemnames;
-
- int width;
- int height;
- int columns;
- int seperation;
+ menucommon_s generic;
+
+ int oldvalue;
+ int curvalue;
+ int numitems;
+ int top;
+
+ const char **itemnames;
+
+ int width;
+ int height;
+ int columns;
+ int seperation;
} menulist_s;
typedef struct
{
- menucommon_s generic;
+ menucommon_s generic;
} menuaction_s;
typedef struct
{
- menucommon_s generic;
- int curvalue;
+ menucommon_s generic;
+ int curvalue;
} menuradiobutton_s;
typedef struct
{
- menucommon_s generic;
- char* focuspic;
- char* errorpic;
- qhandle_t shader;
- qhandle_t focusshader;
- int width;
- int height;
- float* focuscolor;
+ menucommon_s generic;
+ char* focuspic;
+ char* errorpic;
+ qhandle_t shader;
+ qhandle_t focusshader;
+ int width;
+ int height;
+ float* focuscolor;
} menubitmap_s;
typedef struct
{
- menucommon_s generic;
- char* string;
- int style;
- float* color;
+ menucommon_s generic;
+ char* string;
+ int style;
+ float* color;
} menutext_s;
-extern void Menu_Cache( void );
-extern void Menu_Focus( menucommon_s *m );
-extern void Menu_AddItem( menuframework_s *menu, void *item );
-extern void Menu_AdjustCursor( menuframework_s *menu, int dir );
-extern void Menu_Draw( menuframework_s *menu );
-extern void *Menu_ItemAtCursor( menuframework_s *m );
-extern sfxHandle_t Menu_ActivateItem( menuframework_s *s, menucommon_s* item );
-extern void Menu_SetCursor( menuframework_s *s, int cursor );
-extern void Menu_SetCursorToItem( menuframework_s *m, void* ptr );
-extern sfxHandle_t Menu_DefaultKey( menuframework_s *s, int key );
-extern void Bitmap_Init( menubitmap_s *b );
-extern void Bitmap_Draw( menubitmap_s *b );
-extern void ScrollList_Draw( menulist_s *l );
-extern sfxHandle_t ScrollList_Key( menulist_s *l, int key );
-extern sfxHandle_t menu_in_sound;
-extern sfxHandle_t menu_move_sound;
-extern sfxHandle_t menu_out_sound;
-extern sfxHandle_t menu_buzz_sound;
-extern sfxHandle_t menu_null_sound;
-extern sfxHandle_t weaponChangeSound;
-extern vec4_t menu_text_color;
-extern vec4_t menu_grayed_color;
-extern vec4_t menu_dark_color;
-extern vec4_t menu_highlight_color;
-extern vec4_t menu_red_color;
-extern vec4_t menu_black_color;
-extern vec4_t menu_dim_color;
-extern vec4_t color_black;
-extern vec4_t color_white;
-extern vec4_t color_yellow;
-extern vec4_t color_blue;
-extern vec4_t color_orange;
-extern vec4_t color_red;
-extern vec4_t color_dim;
-extern vec4_t name_color;
-extern vec4_t list_color;
-extern vec4_t listbar_color;
-extern vec4_t text_color_disabled;
-extern vec4_t text_color_normal;
-extern vec4_t text_color_highlight;
-
-extern char *ui_medalNames[];
-extern char *ui_medalPicNames[];
-extern char *ui_medalSounds[];
+extern void Menu_Cache( void );
+extern void Menu_Focus( menucommon_s *m );
+extern void Menu_AddItem( menuframework_s *menu, void *item );
+extern void Menu_AdjustCursor( menuframework_s *menu, int dir );
+extern void Menu_Draw( menuframework_s *menu );
+extern void *Menu_ItemAtCursor( menuframework_s *m );
+extern sfxHandle_t Menu_ActivateItem( menuframework_s *s, menucommon_s* item );
+extern void Menu_SetCursor( menuframework_s *s, int cursor );
+extern void Menu_SetCursorToItem( menuframework_s *m, void* ptr );
+extern sfxHandle_t Menu_DefaultKey( menuframework_s *s, int key );
+extern void Bitmap_Init( menubitmap_s *b );
+extern void Bitmap_Draw( menubitmap_s *b );
+extern void ScrollList_Draw( menulist_s *l );
+extern sfxHandle_t ScrollList_Key( menulist_s *l, int key );
+extern sfxHandle_t menu_in_sound;
+extern sfxHandle_t menu_move_sound;
+extern sfxHandle_t menu_out_sound;
+extern sfxHandle_t menu_buzz_sound;
+extern sfxHandle_t menu_null_sound;
+extern sfxHandle_t weaponChangeSound;
+extern vec4_t menu_text_color;
+extern vec4_t menu_grayed_color;
+extern vec4_t menu_dark_color;
+extern vec4_t menu_highlight_color;
+extern vec4_t menu_red_color;
+extern vec4_t menu_black_color;
+extern vec4_t menu_dim_color;
+extern vec4_t color_black;
+extern vec4_t color_white;
+extern vec4_t color_yellow;
+extern vec4_t color_blue;
+extern vec4_t color_orange;
+extern vec4_t color_red;
+extern vec4_t color_dim;
+extern vec4_t name_color;
+extern vec4_t list_color;
+extern vec4_t listbar_color;
+extern vec4_t text_color_disabled;
+extern vec4_t text_color_normal;
+extern vec4_t text_color_highlight;
+
+extern char *ui_medalNames[];
+extern char *ui_medalPicNames[];
+extern char *ui_medalSounds[];
//
// ui_mfield.c
//
-extern void MField_Clear( mfield_t *edit );
-extern void MField_KeyDownEvent( mfield_t *edit, int key );
-extern void MField_CharEvent( mfield_t *edit, int ch );
-extern void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color );
-extern void MenuField_Init( menufield_s* m );
-extern void MenuField_Draw( menufield_s *f );
-extern sfxHandle_t MenuField_Key( menufield_s* m, int* key );
+extern void MField_Clear( mfield_t *edit );
+extern void MField_KeyDownEvent( mfield_t *edit, int key );
+extern void MField_CharEvent( mfield_t *edit, int ch );
+extern void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color );
+extern void MenuField_Init( menufield_s* m );
+extern void MenuField_Draw( menufield_s *f );
+extern sfxHandle_t MenuField_Key( menufield_s* m, int* key );
//
// ui_main.c
@@ -497,71 +497,71 @@ extern void DriverInfo_Cache( void );
//FIXME ripped from cg_local.h
typedef struct {
- int oldFrame;
- int oldFrameTime; // time when ->oldFrame was exactly on
+ int oldFrame;
+ int oldFrameTime; // time when ->oldFrame was exactly on
- int frame;
- int frameTime; // time when ->frame will be exactly on
+ int frame;
+ int frameTime; // time when ->frame will be exactly on
- float backlerp;
+ float backlerp;
- float yawAngle;
- qboolean yawing;
- float pitchAngle;
- qboolean pitching;
+ float yawAngle;
+ qboolean yawing;
+ float pitchAngle;
+ qboolean pitching;
- int animationNumber; // may include ANIM_TOGGLEBIT
- animation_t *animation;
- int animationTime; // time when the first frame of the animation will be exact
+ int animationNumber; // may include ANIM_TOGGLEBIT
+ animation_t *animation;
+ int animationTime; // time when the first frame of the animation will be exact
} lerpFrame_t;
typedef struct {
- // model info
- qhandle_t legsModel;
- qhandle_t legsSkin;
- lerpFrame_t legs;
-
- qhandle_t torsoModel;
- qhandle_t torsoSkin;
- lerpFrame_t torso;
-
- qhandle_t headModel;
- qhandle_t headSkin;
-
- animation_t animations[MAX_PLAYER_TOTALANIMATIONS];
-
- qhandle_t weaponModel;
- qhandle_t barrelModel;
- qhandle_t flashModel;
- vec3_t flashDlightColor;
- int muzzleFlashTime;
-
- // currently in use drawing parms
- vec3_t viewAngles;
- vec3_t moveAngles;
- weapon_t currentWeapon;
- int legsAnim;
- int torsoAnim;
-
- // animation vars
- weapon_t weapon;
- weapon_t lastWeapon;
- weapon_t pendingWeapon;
- int weaponTimer;
- int pendingLegsAnim;
- int torsoAnimationTimer;
-
- int pendingTorsoAnim;
- int legsAnimationTimer;
-
- qboolean chat;
- qboolean newModel;
-
- qboolean barrelSpinning;
- float barrelAngle;
- int barrelTime;
-
- int realWeapon;
+ // model info
+ qhandle_t legsModel;
+ qhandle_t legsSkin;
+ lerpFrame_t legs;
+
+ qhandle_t torsoModel;
+ qhandle_t torsoSkin;
+ lerpFrame_t torso;
+
+ qhandle_t headModel;
+ qhandle_t headSkin;
+
+ animation_t animations[MAX_PLAYER_TOTALANIMATIONS];
+
+ qhandle_t weaponModel;
+ qhandle_t barrelModel;
+ qhandle_t flashModel;
+ vec3_t flashDlightColor;
+ int muzzleFlashTime;
+
+ // currently in use drawing parms
+ vec3_t viewAngles;
+ vec3_t moveAngles;
+ weapon_t currentWeapon;
+ int legsAnim;
+ int torsoAnim;
+
+ // animation vars
+ weapon_t weapon;
+ weapon_t lastWeapon;
+ weapon_t pendingWeapon;
+ int weaponTimer;
+ int pendingLegsAnim;
+ int torsoAnimationTimer;
+
+ int pendingTorsoAnim;
+ int legsAnimationTimer;
+
+ qboolean chat;
+ qboolean newModel;
+
+ qboolean barrelSpinning;
+ float barrelAngle;
+ int barrelTime;
+
+ int realWeapon;
} playerInfo_t;
void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time );
@@ -574,27 +574,27 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
//
// this is only used in the old ui, the new ui has it's own version
typedef struct {
- int frametime;
- int realtime;
- int cursorx;
- int cursory;
- glconfig_t glconfig;
- qboolean debug;
- qhandle_t whiteShader;
- qhandle_t menuBackShader;
- qhandle_t menuBackShader2;
- qhandle_t menuBackNoLogoShader;
- qhandle_t charset;
- qhandle_t charsetProp;
- qhandle_t charsetPropGlow;
- qhandle_t charsetPropB;
- qhandle_t cursor;
- qhandle_t rb_on;
- qhandle_t rb_off;
- float scale;
- float bias;
- qboolean demoversion;
- qboolean firstdraw;
+ int frametime;
+ int realtime;
+ int cursorx;
+ int cursory;
+ glconfig_t glconfig;
+ qboolean debug;
+ qhandle_t whiteShader;
+ qhandle_t menuBackShader;
+ qhandle_t menuBackShader2;
+ qhandle_t menuBackNoLogoShader;
+ qhandle_t charset;
+ qhandle_t charsetProp;
+ qhandle_t charsetPropGlow;
+ qhandle_t charsetPropB;
+ qhandle_t cursor;
+ qhandle_t rb_on;
+ qhandle_t rb_off;
+ float scale;
+ float bias;
+ qboolean demoversion;
+ qboolean firstdraw;
} uiStatic_t;
@@ -608,23 +608,23 @@ typedef struct {
#define MAX_MAPS 128
#define MAX_SPMAPS 16
#define PLAYERS_PER_TEAM 5
-#define MAX_PINGREQUESTS 32
-#define MAX_ADDRESSLENGTH 64
-#define MAX_HOSTNAMELENGTH 22
-#define MAX_MAPNAMELENGTH 16
-#define MAX_STATUSLENGTH 64
-#define MAX_LISTBOXWIDTH 59
-#define UI_FONT_THRESHOLD 0.1
-#define MAX_DISPLAY_SERVERS 2048
-#define MAX_SERVERSTATUS_LINES 128
-#define MAX_SERVERSTATUS_TEXT 1024
-#define MAX_FOUNDPLAYER_SERVERS 16
+#define MAX_PINGREQUESTS 32
+#define MAX_ADDRESSLENGTH 64
+#define MAX_HOSTNAMELENGTH 22
+#define MAX_MAPNAMELENGTH 16
+#define MAX_STATUSLENGTH 64
+#define MAX_LISTBOXWIDTH 59
+#define UI_FONT_THRESHOLD 0.1
+#define MAX_DISPLAY_SERVERS 2048
+#define MAX_SERVERSTATUS_LINES 128
+#define MAX_SERVERSTATUS_TEXT 1024
+#define MAX_FOUNDPLAYER_SERVERS 16
#define TEAM_MEMBERS 5
-#define GAMES_ALL 0
-#define GAMES_FFA 1
-#define GAMES_TEAMPLAY 2
-#define GAMES_TOURNEY 3
-#define GAMES_CTF 4
+#define GAMES_ALL 0
+#define GAMES_FFA 1
+#define GAMES_TEAMPLAY 2
+#define GAMES_TOURNEY 3
+#define GAMES_CTF 4
#define MAPS_PER_TIER 3
#define MAX_TIERS 16
#define MAX_MODS 64
@@ -635,27 +635,27 @@ typedef struct {
typedef struct {
const char *name;
- const char *imageName;
+ const char *imageName;
qhandle_t headImage;
- const char *base;
- qboolean active;
- int reference;
+ const char *base;
+ qboolean active;
+ int reference;
} characterInfo;
typedef struct {
- const char *name;
- const char *ai;
- const char *action;
+ const char *name;
+ const char *ai;
+ const char *action;
} aliasInfo;
typedef struct {
const char *teamName;
- const char *imageName;
- const char *teamMembers[TEAM_MEMBERS];
+ const char *imageName;
+ const char *teamMembers[TEAM_MEMBERS];
qhandle_t teamIcon;
qhandle_t teamIcon_Metal;
qhandle_t teamIcon_Name;
- int cinematic;
+ int cinematic;
} teamInfo;
typedef struct {
@@ -666,88 +666,88 @@ typedef struct {
typedef struct {
const char *mapName;
const char *mapLoadName;
- const char *imageName;
- const char *opponentName;
- int teamMembers;
+ const char *imageName;
+ const char *opponentName;
+ int teamMembers;
int typeBits;
- int cinematic;
- int timeToBeat[MAX_GAMETYPES];
- qhandle_t levelShot;
- qboolean active;
+ int cinematic;
+ int timeToBeat[MAX_GAMETYPES];
+ qhandle_t levelShot;
+ qboolean active;
} mapInfo;
typedef struct {
- const char *tierName;
- const char *maps[MAPS_PER_TIER];
- int gameTypes[MAPS_PER_TIER];
- qhandle_t mapHandles[MAPS_PER_TIER];
+ const char *tierName;
+ const char *maps[MAPS_PER_TIER];
+ int gameTypes[MAPS_PER_TIER];
+ qhandle_t mapHandles[MAPS_PER_TIER];
} tierInfo;
typedef struct serverFilter_s {
- const char *description;
- const char *basedir;
+ const char *description;
+ const char *basedir;
} serverFilter_t;
typedef struct {
- char adrstr[MAX_ADDRESSLENGTH];
- int start;
+ char adrstr[MAX_ADDRESSLENGTH];
+ int start;
} pinglist_t;
typedef struct serverStatus_s {
- pinglist_t pingList[MAX_PINGREQUESTS];
- int numqueriedservers;
- int currentping;
- int nextpingtime;
- int maxservers;
- int refreshtime;
- int numServers;
- int sortKey;
- int sortDir;
- int lastCount;
- qboolean refreshActive;
- int currentServer;
- int displayServers[MAX_DISPLAY_SERVERS];
- int numDisplayServers;
- int numPlayersOnServers;
- int nextDisplayRefresh;
- int nextSortTime;
- qhandle_t currentServerPreview;
- int currentServerCinematic;
- int motdLen;
- int motdWidth;
- int motdPaintX;
- int motdPaintX2;
- int motdOffset;
- int motdTime;
- char motd[MAX_STRING_CHARS];
+ pinglist_t pingList[MAX_PINGREQUESTS];
+ int numqueriedservers;
+ int currentping;
+ int nextpingtime;
+ int maxservers;
+ int refreshtime;
+ int numServers;
+ int sortKey;
+ int sortDir;
+ int lastCount;
+ qboolean refreshActive;
+ int currentServer;
+ int displayServers[MAX_DISPLAY_SERVERS];
+ int numDisplayServers;
+ int numPlayersOnServers;
+ int nextDisplayRefresh;
+ int nextSortTime;
+ qhandle_t currentServerPreview;
+ int currentServerCinematic;
+ int motdLen;
+ int motdWidth;
+ int motdPaintX;
+ int motdPaintX2;
+ int motdOffset;
+ int motdTime;
+ char motd[MAX_STRING_CHARS];
} serverStatus_t;
typedef struct {
- char adrstr[MAX_ADDRESSLENGTH];
- char name[MAX_ADDRESSLENGTH];
- int startTime;
- int serverNum;
- qboolean valid;
+ char adrstr[MAX_ADDRESSLENGTH];
+ char name[MAX_ADDRESSLENGTH];
+ int startTime;
+ int serverNum;
+ qboolean valid;
} pendingServer_t;
typedef struct {
- int num;
- pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
+ int num;
+ pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
} pendingServerStatus_t;
typedef struct {
- char address[MAX_ADDRESSLENGTH];
- char *lines[MAX_SERVERSTATUS_LINES][4];
- char text[MAX_SERVERSTATUS_TEXT];
- char pings[MAX_CLIENTS * 3];
- int numLines;
+ char address[MAX_ADDRESSLENGTH];
+ char *lines[MAX_SERVERSTATUS_LINES][4];
+ char text[MAX_SERVERSTATUS_TEXT];
+ char pings[MAX_CLIENTS * 3];
+ int numLines;
} serverStatusInfo_t;
typedef struct {
- const char *modName;
- const char *modDescr;
+ const char *modName;
+ const char *modDescr;
} modInfo_t;
//TA: tremulous menus
@@ -778,186 +778,186 @@ typedef struct
const char *name;
char text[ MAX_INFOPANE_TEXT ];
int align;
-
+
tremIPGraphic_t graphics[ MAX_INFOPANE_GRAPHICS ];
int numGraphics;
} tremInfoPane_t;
typedef struct
{
- const char *text;
- const char *cmd;
- tremInfoPane_t *infopane;
+ const char *text;
+ const char *cmd;
+ tremInfoPane_t *infopane;
} tremMenuItem_t;
//TA: tremulous menus
typedef struct {
- displayContextDef_t uiDC;
- int newHighScoreTime;
- int newBestTime;
- int showPostGameTime;
- qboolean newHighScore;
- qboolean demoAvailable;
- qboolean soundHighScore;
-
- int characterCount;
- int botIndex;
- characterInfo characterList[MAX_HEADS];
-
- int aliasCount;
- aliasInfo aliasList[MAX_ALIASES];
-
- int teamCount;
- teamInfo teamList[MAX_TEAMS];
-
- int numGameTypes;
- gameTypeInfo gameTypes[MAX_GAMETYPES];
-
- int numJoinGameTypes;
- gameTypeInfo joinGameTypes[MAX_GAMETYPES];
-
- int redBlue;
- int playerCount;
- int myTeamCount;
- int teamIndex;
- int playerRefresh;
- int playerIndex;
- int playerNumber;
- qboolean teamLeader;
- char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
- char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
- int teamClientNums[MAX_CLIENTS];
-
- int mapCount;
- mapInfo mapList[MAX_MAPS];
-
-
- int tierCount;
- tierInfo tierList[MAX_TIERS];
-
- int skillIndex;
-
- modInfo_t modList[MAX_MODS];
- int modCount;
- int modIndex;
-
- const char *demoList[MAX_DEMOS];
- int demoCount;
- int demoIndex;
-
- const char *movieList[MAX_MOVIES];
- int movieCount;
- int movieIndex;
- int previewMovie;
+ displayContextDef_t uiDC;
+ int newHighScoreTime;
+ int newBestTime;
+ int showPostGameTime;
+ qboolean newHighScore;
+ qboolean demoAvailable;
+ qboolean soundHighScore;
+
+ int characterCount;
+ int botIndex;
+ characterInfo characterList[MAX_HEADS];
+
+ int aliasCount;
+ aliasInfo aliasList[MAX_ALIASES];
+
+ int teamCount;
+ teamInfo teamList[MAX_TEAMS];
+
+ int numGameTypes;
+ gameTypeInfo gameTypes[MAX_GAMETYPES];
+
+ int numJoinGameTypes;
+ gameTypeInfo joinGameTypes[MAX_GAMETYPES];
+
+ int redBlue;
+ int playerCount;
+ int myTeamCount;
+ int teamIndex;
+ int playerRefresh;
+ int playerIndex;
+ int playerNumber;
+ qboolean teamLeader;
+ char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
+ char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
+ int teamClientNums[MAX_CLIENTS];
+
+ int mapCount;
+ mapInfo mapList[MAX_MAPS];
+
+
+ int tierCount;
+ tierInfo tierList[MAX_TIERS];
+
+ int skillIndex;
+
+ modInfo_t modList[MAX_MODS];
+ int modCount;
+ int modIndex;
+
+ const char *demoList[MAX_DEMOS];
+ int demoCount;
+ int demoIndex;
+
+ const char *movieList[MAX_MOVIES];
+ int movieCount;
+ int movieIndex;
+ int previewMovie;
tremInfoPane_t tremInfoPanes[ MAX_INFOPANES ];
int tremInfoPaneCount;
//TA: tremulous menus
- tremMenuItem_t tremTeamList[ 4 ];
- int tremTeamCount;
- int tremTeamIndex;
-
- tremMenuItem_t tremAlienClassList[ 3 ];
- int tremAlienClassCount;
- int tremAlienClassIndex;
-
- tremMenuItem_t tremHumanItemList[ 3 ];
- int tremHumanItemCount;
- int tremHumanItemIndex;
-
- tremMenuItem_t tremHumanArmouryBuyList[ 32 ];
- int tremHumanArmouryBuyCount;
- int tremHumanArmouryBuyIndex;
-
- tremMenuItem_t tremHumanArmourySellList[ 32 ];
- int tremHumanArmourySellCount;
- int tremHumanArmourySellIndex;
-
- tremMenuItem_t tremAlienUpgradeList[ 16 ];
- int tremAlienUpgradeCount;
- int tremAlienUpgradeIndex;
-
- tremMenuItem_t tremAlienBuildList[ 32 ];
- int tremAlienBuildCount;
- int tremAlienBuildIndex;
-
- tremMenuItem_t tremHumanBuildList[ 32 ];
- int tremHumanBuildCount;
- int tremHumanBuildIndex;
+ tremMenuItem_t tremTeamList[ 4 ];
+ int tremTeamCount;
+ int tremTeamIndex;
+
+ tremMenuItem_t tremAlienClassList[ 3 ];
+ int tremAlienClassCount;
+ int tremAlienClassIndex;
+
+ tremMenuItem_t tremHumanItemList[ 3 ];
+ int tremHumanItemCount;
+ int tremHumanItemIndex;
+
+ tremMenuItem_t tremHumanArmouryBuyList[ 32 ];
+ int tremHumanArmouryBuyCount;
+ int tremHumanArmouryBuyIndex;
+
+ tremMenuItem_t tremHumanArmourySellList[ 32 ];
+ int tremHumanArmourySellCount;
+ int tremHumanArmourySellIndex;
+
+ tremMenuItem_t tremAlienUpgradeList[ 16 ];
+ int tremAlienUpgradeCount;
+ int tremAlienUpgradeIndex;
+
+ tremMenuItem_t tremAlienBuildList[ 32 ];
+ int tremAlienBuildCount;
+ int tremAlienBuildIndex;
+
+ tremMenuItem_t tremHumanBuildList[ 32 ];
+ int tremHumanBuildCount;
+ int tremHumanBuildIndex;
//TA: tremulous menus
-
- serverStatus_t serverStatus;
- // for the showing the status of a server
- char serverStatusAddress[MAX_ADDRESSLENGTH];
- serverStatusInfo_t serverStatusInfo;
- int nextServerStatusRefresh;
+ serverStatus_t serverStatus;
+
+ // for the showing the status of a server
+ char serverStatusAddress[MAX_ADDRESSLENGTH];
+ serverStatusInfo_t serverStatusInfo;
+ int nextServerStatusRefresh;
- // to retrieve the status of server to find a player
- pendingServerStatus_t pendingServerStatus;
- char findPlayerName[MAX_STRING_CHARS];
- char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
- char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
- int currentFoundPlayerServer;
- int numFoundPlayerServers;
- int nextFindPlayerRefresh;
+ // to retrieve the status of server to find a player
+ pendingServerStatus_t pendingServerStatus;
+ char findPlayerName[MAX_STRING_CHARS];
+ char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
+ char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
+ int currentFoundPlayerServer;
+ int numFoundPlayerServers;
+ int nextFindPlayerRefresh;
- int currentCrosshair;
- int startPostGameTime;
- sfxHandle_t newHighScoreSound;
+ int currentCrosshair;
+ int startPostGameTime;
+ sfxHandle_t newHighScoreSound;
- int q3HeadCount;
- char q3HeadNames[MAX_PLAYERMODELS][64];
- qhandle_t q3HeadIcons[MAX_PLAYERMODELS];
- int q3SelectedHead;
+ int q3HeadCount;
+ char q3HeadNames[MAX_PLAYERMODELS][64];
+ qhandle_t q3HeadIcons[MAX_PLAYERMODELS];
+ int q3SelectedHead;
- int effectsColor;
+ int effectsColor;
- qboolean inGameLoad;
-} uiInfo_t;
+ qboolean inGameLoad;
+} uiInfo_t;
extern uiInfo_t uiInfo;
-extern void UI_Init( void );
-extern void UI_Shutdown( void );
-extern void UI_KeyEvent( int key );
-extern void UI_MouseEvent( int dx, int dy );
-extern void UI_Refresh( int realtime );
-extern qboolean UI_ConsoleCommand( int realTime );
-extern float UI_ClampCvar( float min, float max, float value );
-extern void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
-extern void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader );
-extern void UI_FillRect( float x, float y, float width, float height, const float *color );
-extern void UI_DrawRect( float x, float y, float width, float height, const float *color );
+extern void UI_Init( void );
+extern void UI_Shutdown( void );
+extern void UI_KeyEvent( int key );
+extern void UI_MouseEvent( int dx, int dy );
+extern void UI_Refresh( int realtime );
+extern qboolean UI_ConsoleCommand( int realTime );
+extern float UI_ClampCvar( float min, float max, float value );
+extern void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
+extern void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader );
+extern void UI_FillRect( float x, float y, float width, float height, const float *color );
+extern void UI_DrawRect( float x, float y, float width, float height, const float *color );
extern void UI_DrawTopBottom(float x, float y, float w, float h);
extern void UI_DrawSides(float x, float y, float w, float h);
-extern void UI_UpdateScreen( void );
-extern void UI_SetColor( const float *rgba );
-extern void UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
-extern void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
-extern float UI_ProportionalSizeScale( int style );
-extern void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
-extern int UI_ProportionalStringWidth( const char* str );
-extern void UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
-extern void UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
-extern qboolean UI_CursorInRect (int x, int y, int width, int height);
-extern void UI_AdjustFrom640( float *x, float *y, float *w, float *h );
-extern void UI_DrawTextBox (int x, int y, int width, int lines);
-extern qboolean UI_IsFullscreen( void );
-extern void UI_SetActiveMenu( uiMenuCommand_t menu );
-extern void UI_PushMenu ( menuframework_s *menu );
-extern void UI_PopMenu (void);
-extern void UI_ForceMenuOff (void);
-extern char *UI_Argv( int arg );
-extern char *UI_Cvar_VariableString( const char *var_name );
-extern void UI_Refresh( int time );
-extern void UI_KeyEvent( int key );
-extern void UI_StartDemoLoop( void );
-extern qboolean m_entersound;
+extern void UI_UpdateScreen( void );
+extern void UI_SetColor( const float *rgba );
+extern void UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
+extern void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
+extern float UI_ProportionalSizeScale( int style );
+extern void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
+extern int UI_ProportionalStringWidth( const char* str );
+extern void UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
+extern void UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
+extern qboolean UI_CursorInRect (int x, int y, int width, int height);
+extern void UI_AdjustFrom640( float *x, float *y, float *w, float *h );
+extern void UI_DrawTextBox (int x, int y, int width, int lines);
+extern qboolean UI_IsFullscreen( void );
+extern void UI_SetActiveMenu( uiMenuCommand_t menu );
+extern void UI_PushMenu ( menuframework_s *menu );
+extern void UI_PopMenu (void);
+extern void UI_ForceMenuOff (void);
+extern char *UI_Argv( int arg );
+extern char *UI_Cvar_VariableString( const char *var_name );
+extern void UI_Refresh( int time );
+extern void UI_KeyEvent( int key );
+extern void UI_StartDemoLoop( void );
+extern qboolean m_entersound;
void UI_LoadBestScores(const char *map, int game);
-extern uiStatic_t uis;
+extern uiStatic_t uis;
//
// ui_spLevel.c
@@ -987,87 +987,87 @@ void UI_SPSkillMenu_Cache( void );
//
// ui_syscalls.c
//
-void trap_Print( const char *string );
-void trap_Error( const char *string );
-int trap_Milliseconds( void );
-void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
-void trap_Cvar_Update( vmCvar_t *vmCvar );
-void trap_Cvar_Set( const char *var_name, const char *value );
-float trap_Cvar_VariableValue( const char *var_name );
-void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
-void trap_Cvar_SetValue( const char *var_name, float value );
-void trap_Cvar_Reset( const char *name );
-void trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
-void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
-int trap_Argc( void );
-void trap_Argv( int n, char *buffer, int bufferLength );
-void trap_Cmd_ExecuteText( int exec_when, const char *text ); // don't use EXEC_NOW!
-int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
-void trap_FS_Read( void *buffer, int len, fileHandle_t f );
-void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
-void trap_FS_FCloseFile( fileHandle_t f );
-int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
+void trap_Print( const char *string );
+void trap_Error( const char *string );
+int trap_Milliseconds( void );
+void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
+void trap_Cvar_Update( vmCvar_t *vmCvar );
+void trap_Cvar_Set( const char *var_name, const char *value );
+float trap_Cvar_VariableValue( const char *var_name );
+void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
+void trap_Cvar_SetValue( const char *var_name, float value );
+void trap_Cvar_Reset( const char *name );
+void trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
+void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
+int trap_Argc( void );
+void trap_Argv( int n, char *buffer, int bufferLength );
+void trap_Cmd_ExecuteText( int exec_when, const char *text ); // don't use EXEC_NOW!
+int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
+void trap_FS_Read( void *buffer, int len, fileHandle_t f );
+void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
+void trap_FS_FCloseFile( fileHandle_t f );
+int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
-qhandle_t trap_R_RegisterModel( const char *name );
-qhandle_t trap_R_RegisterSkin( const char *name );
-qhandle_t trap_R_RegisterShaderNoMip( const char *name );
-void trap_R_ClearScene( void );
-void trap_R_AddRefEntityToScene( const refEntity_t *re );
-void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
-void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
-void trap_R_RenderScene( const refdef_t *fd );
-void trap_R_SetColor( const float *rgba );
-void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
-void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
-void trap_UpdateScreen( void );
-int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
-void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
-sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed );
-void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
-void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
-void trap_Key_SetBinding( int keynum, const char *binding );
-qboolean trap_Key_IsDown( int keynum );
-qboolean trap_Key_GetOverstrikeMode( void );
-void trap_Key_SetOverstrikeMode( qboolean state );
-void trap_Key_ClearStates( void );
-int trap_Key_GetCatcher( void );
-void trap_Key_SetCatcher( int catcher );
-void trap_GetClipboardData( char *buf, int bufsize );
-void trap_GetClientState( uiClientState_t *state );
-void trap_GetGlconfig( glconfig_t *glconfig );
-int trap_GetConfigString( int index, char* buff, int buffsize );
-int trap_LAN_GetServerCount( int source );
-void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
-void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
-int trap_LAN_GetServerPing( int source, int n );
-int trap_LAN_GetPingQueueCount( void );
-void trap_LAN_ClearPing( int n );
-void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
-void trap_LAN_GetPingInfo( int n, char *buf, int buflen );
-void trap_LAN_LoadCachedServers();
-void trap_LAN_SaveCachedServers();
-void trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
-int trap_LAN_ServerIsVisible( int source, int n);
-qboolean trap_LAN_UpdateVisiblePings( int source );
-int trap_LAN_AddServer(int source, const char *name, const char *addr);
-void trap_LAN_RemoveServer(int source, const char *addr);
-void trap_LAN_ResetPings(int n);
-int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
-int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
-int trap_MemoryRemaining( void );
-void trap_GetCDKey( char *buf, int buflen );
-void trap_SetCDKey( char *buf );
-void trap_R_RegisterFont(const char *pFontname, int pointSize, fontInfo_t *font);
-void trap_S_StopBackgroundTrack( void );
-void trap_S_StartBackgroundTrack( const char *intro, const char *loop);
-int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
-e_status trap_CIN_StopCinematic(int handle);
-e_status trap_CIN_RunCinematic (int handle);
-void trap_CIN_DrawCinematic (int handle);
-void trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
-int trap_RealTime(qtime_t *qtime);
-void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
-qboolean trap_VerifyCDKey( const char *key, const char *chksum);
+qhandle_t trap_R_RegisterModel( const char *name );
+qhandle_t trap_R_RegisterSkin( const char *name );
+qhandle_t trap_R_RegisterShaderNoMip( const char *name );
+void trap_R_ClearScene( void );
+void trap_R_AddRefEntityToScene( const refEntity_t *re );
+void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
+void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
+void trap_R_RenderScene( const refdef_t *fd );
+void trap_R_SetColor( const float *rgba );
+void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
+void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
+void trap_UpdateScreen( void );
+int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
+void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
+sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed );
+void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
+void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
+void trap_Key_SetBinding( int keynum, const char *binding );
+qboolean trap_Key_IsDown( int keynum );
+qboolean trap_Key_GetOverstrikeMode( void );
+void trap_Key_SetOverstrikeMode( qboolean state );
+void trap_Key_ClearStates( void );
+int trap_Key_GetCatcher( void );
+void trap_Key_SetCatcher( int catcher );
+void trap_GetClipboardData( char *buf, int bufsize );
+void trap_GetClientState( uiClientState_t *state );
+void trap_GetGlconfig( glconfig_t *glconfig );
+int trap_GetConfigString( int index, char* buff, int buffsize );
+int trap_LAN_GetServerCount( int source );
+void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
+void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
+int trap_LAN_GetServerPing( int source, int n );
+int trap_LAN_GetPingQueueCount( void );
+void trap_LAN_ClearPing( int n );
+void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
+void trap_LAN_GetPingInfo( int n, char *buf, int buflen );
+void trap_LAN_LoadCachedServers();
+void trap_LAN_SaveCachedServers();
+void trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
+int trap_LAN_ServerIsVisible( int source, int n);
+qboolean trap_LAN_UpdateVisiblePings( int source );
+int trap_LAN_AddServer(int source, const char *name, const char *addr);
+void trap_LAN_RemoveServer(int source, const char *addr);
+void trap_LAN_ResetPings(int n);
+int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
+int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
+int trap_MemoryRemaining( void );
+void trap_GetCDKey( char *buf, int buflen );
+void trap_SetCDKey( char *buf );
+void trap_R_RegisterFont(const char *pFontname, int pointSize, fontInfo_t *font);
+void trap_S_StopBackgroundTrack( void );
+void trap_S_StartBackgroundTrack( const char *intro, const char *loop);
+int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
+e_status trap_CIN_StopCinematic(int handle);
+e_status trap_CIN_RunCinematic (int handle);
+void trap_CIN_DrawCinematic (int handle);
+void trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
+int trap_RealTime(qtime_t *qtime);
+void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
+qboolean trap_VerifyCDKey( const char *key, const char *chksum);
void trap_SetPbClStatus( int status );
@@ -1124,12 +1124,12 @@ void UI_NetworkOptionsMenu( void );
// ui_gameinfo.c
//
typedef enum {
- AWARD_ACCURACY,
- AWARD_IMPRESSIVE,
- AWARD_EXCELLENT,
- AWARD_GAUNTLET,
- AWARD_FRAGS,
- AWARD_PERFECT
+ AWARD_ACCURACY,
+ AWARD_IMPRESSIVE,
+ AWARD_EXCELLENT,
+ AWARD_GAUNTLET,
+ AWARD_FRAGS,
+ AWARD_PERFECT
} awardType_t;
const char *UI_GetArenaInfoByNumber( int num );
@@ -1179,28 +1179,28 @@ void RankStatus_Cache( void );
void UI_RankStatusMenu( void );
-// new ui
+// new ui
#define ASSET_BACKGROUND "uiBackground"
// for tracking sp game info in Team Arena
typedef struct postGameInfo_s {
- int score;
- int redScore;
- int blueScore;
- int perfects;
- int accuracy;
- int impressives;
- int excellents;
- int defends;
- int assists;
- int gauntlets;
- int captures;
- int time;
- int timeBonus;
- int shutoutBonus;
- int skillBonus;
- int baseScore;
+ int score;
+ int redScore;
+ int blueScore;
+ int perfects;
+ int accuracy;
+ int impressives;
+ int excellents;
+ int defends;
+ int assists;
+ int gauntlets;
+ int captures;
+ int time;
+ int timeBonus;
+ int shutoutBonus;
+ int skillBonus;
+ int baseScore;
} postGameInfo_t;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 34f77c91..60e801cf 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -202,20 +202,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
void AssetCache() {
- int n;
- //if (Assets.textFont == NULL) {
- //}
- //Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND );
- //Com_Printf("Menu Size: %i bytes\n", sizeof(Menus));
uiInfo.uiDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR );
- uiInfo.uiDC.Assets.fxBasePic = trap_R_RegisterShaderNoMip( ART_FX_BASE );
- uiInfo.uiDC.Assets.fxPic[0] = trap_R_RegisterShaderNoMip( ART_FX_RED );
- uiInfo.uiDC.Assets.fxPic[1] = trap_R_RegisterShaderNoMip( ART_FX_YELLOW );
- uiInfo.uiDC.Assets.fxPic[2] = trap_R_RegisterShaderNoMip( ART_FX_GREEN );
- uiInfo.uiDC.Assets.fxPic[3] = trap_R_RegisterShaderNoMip( ART_FX_TEAL );
- uiInfo.uiDC.Assets.fxPic[4] = trap_R_RegisterShaderNoMip( ART_FX_BLUE );
- uiInfo.uiDC.Assets.fxPic[5] = trap_R_RegisterShaderNoMip( ART_FX_CYAN );
- uiInfo.uiDC.Assets.fxPic[6] = trap_R_RegisterShaderNoMip( ART_FX_WHITE );
uiInfo.uiDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR );
uiInfo.uiDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN );
uiInfo.uiDC.Assets.scrollBarArrowUp = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWUP );
@@ -224,12 +211,6 @@ void AssetCache() {
uiInfo.uiDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB );
uiInfo.uiDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR );
uiInfo.uiDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB );
-
- for( n = 0; n < NUM_CROSSHAIRS; n++ ) {
- uiInfo.uiDC.Assets.crosshairShader[n] = trap_R_RegisterShaderNoMip( va("gfx/2d/crosshair%c", 'a' + n ) );
- }
-
- /*uiInfo.newHighScoreSound = trap_S_RegisterSound("sound/feedback/voc_newhighscore.wav", qfalse);*/
}
void _UI_DrawSides(float x, float y, float w, float h, float size) {
@@ -381,10 +362,10 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2;
colorBlack[3] = newColor[3];
trap_R_SetColor( colorBlack );
- Text_PaintChar(x + ofs, y - yadj + ofs,
+ Text_PaintChar(x + ofs, y - yadj + ofs,
glyph->imageWidth,
glyph->imageHeight,
- useScale,
+ useScale,
glyph->s,
glyph->t,
glyph->s2,
@@ -401,19 +382,19 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
glow[ 1 ] = newColor[ 1 ] * 0.5;
glow[ 2 ] = newColor[ 2 ] * 0.5;
glow[ 3 ] = newColor[ 3 ] * 0.2;
-
+
outer[ 0 ] = newColor[ 0 ];
outer[ 1 ] = newColor[ 1 ];
outer[ 2 ] = newColor[ 2 ];
outer[ 3 ] = newColor[ 3 ];
-
+
inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
inner[ 3 ] = newColor[ 3 ];
white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
-
+
trap_R_SetColor( glow );
Text_PaintChar( x - 1.5, y - yadj - 1.5,
glyph->imageWidth + 3,
@@ -424,7 +405,7 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( outer );
Text_PaintChar( x - 1, y - yadj - 1,
glyph->imageWidth + 2,
@@ -435,7 +416,7 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( inner );
Text_PaintChar( x - 0.5, y - yadj - 0.5,
glyph->imageWidth + 1,
@@ -446,14 +427,14 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( white );
}
-
- Text_PaintChar(x, y - yadj,
+
+ Text_PaintChar(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
- useScale,
+ useScale,
glyph->s,
glyph->t,
glyph->s2,
@@ -506,10 +487,10 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2;
colorBlack[3] = newColor[3];
trap_R_SetColor( colorBlack );
- Text_PaintChar(x + ofs, y - yadj + ofs,
+ Text_PaintChar(x + ofs, y - yadj + ofs,
glyph->imageWidth,
glyph->imageHeight,
- useScale,
+ useScale,
glyph->s,
glyph->t,
glyph->s2,
@@ -526,19 +507,19 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
glow[ 1 ] = newColor[ 1 ] * 0.5;
glow[ 2 ] = newColor[ 2 ] * 0.5;
glow[ 3 ] = newColor[ 3 ] * 0.2;
-
+
outer[ 0 ] = newColor[ 0 ];
outer[ 1 ] = newColor[ 1 ];
outer[ 2 ] = newColor[ 2 ];
outer[ 3 ] = newColor[ 3 ];
-
+
inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
inner[ 3 ] = newColor[ 3 ];
white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
-
+
trap_R_SetColor( glow );
Text_PaintChar( x - 1.5, y - yadj - 1.5,
glyph->imageWidth + 3,
@@ -549,7 +530,7 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( outer );
Text_PaintChar( x - 1, y - yadj - 1,
glyph->imageWidth + 2,
@@ -560,7 +541,7 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( inner );
Text_PaintChar( x - 0.5, y - yadj - 0.5,
glyph->imageWidth + 1,
@@ -571,14 +552,14 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
glyph->s2,
glyph->t2,
glyph->glyph );
-
+
trap_R_SetColor( white );
}
-
- Text_PaintChar(x, y - yadj,
+
+ Text_PaintChar(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
- useScale,
+ useScale,
glyph->s,
glyph->t,
glyph->s2,
@@ -588,10 +569,10 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
// CG_DrawPic(x, y - yadj, scale * uiDC.Assets.textFont.glyphs[text[i]].imageWidth, scale * uiDC.Assets.textFont.glyphs[text[i]].imageHeight, uiDC.Assets.textFont.glyphs[text[i]].glyph);
yadj = useScale * glyph2->top;
if (count == cursorPos && !((uiInfo.uiDC.realTime/BLINK_DIVISOR) & 1)) {
- Text_PaintChar(x, y - yadj,
+ Text_PaintChar(x, y - yadj,
glyph2->imageWidth,
glyph2->imageHeight,
- useScale,
+ useScale,
glyph2->s,
glyph2->t,
glyph2->s2,
@@ -607,10 +588,10 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
// need to paint cursor at end of text
if (cursorPos == len && !((uiInfo.uiDC.realTime/BLINK_DIVISOR) & 1)) {
yadj = useScale * glyph2->top;
- Text_PaintChar(x, y - yadj,
+ Text_PaintChar(x, y - yadj,
glyph2->imageWidth,
glyph2->imageHeight,
- useScale,
+ useScale,
glyph2->s,
glyph2->t,
glyph2->s2,
@@ -641,7 +622,7 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
}
useScale = scale * font->glyphScale;
trap_R_SetColor( color );
- len = strlen(text);
+ len = strlen(text);
if (limit > 0 && len > limit) {
len = limit;
}
@@ -660,10 +641,10 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
*maxX = 0;
break;
}
- Text_PaintChar(x, y - yadj,
+ Text_PaintChar(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
- useScale,
+ useScale,
glyph->s,
glyph->t,
glyph->s2,
@@ -745,8 +726,8 @@ void _UI_Refresh( int realtime )
UI_BuildServerStatus(qfalse);
// refresh find player list
UI_BuildFindPlayerList(qfalse);
- }
-
+ }
+
// draw cursor
UI_SetColor( NULL );
@@ -809,7 +790,7 @@ qboolean Asset_Parse(int handle) {
if (Q_stricmp(token.string, "{") != 0) {
return qfalse;
}
-
+
while ( 1 ) {
memset(&token, 0, sizeof(pc_token_t));
@@ -1032,7 +1013,7 @@ tremInfoPane_t *UI_FindInfoPaneByName( const char *name )
uiInfo.tremInfoPanes[ i ].name = String_Alloc( name );
strncpy( uiInfo.tremInfoPanes[ i ].text, "Not implemented.\n\nui/infopanes.def\n", MAX_INFOPANE_TEXT );
Q_strcat( uiInfo.tremInfoPanes[ i ].text, MAX_INFOPANE_TEXT, String_Alloc( name ) );
-
+
uiInfo.tremInfoPaneCount++;
return &uiInfo.tremInfoPanes[ i ];
@@ -1047,18 +1028,18 @@ qboolean UI_LoadInfoPane( int handle )
{
pc_token_t token;
qboolean valid = qfalse;
-
+
while( 1 )
{
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
if( !Q_stricmp( token.string, "name" ) )
{
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
@@ -1068,14 +1049,14 @@ qboolean UI_LoadInfoPane( int handle )
else if( !Q_stricmp( token.string, "graphic" ) )
{
int *graphic;
-
+
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
graphic = &uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].numGraphics;
-
+
if( !Q_stricmp( token.string, "top" ) )
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].side = INFOPANE_TOP;
else if( !Q_stricmp( token.string, "bottom" ) )
@@ -1088,7 +1069,7 @@ qboolean UI_LoadInfoPane( int handle )
break;
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
@@ -1096,39 +1077,39 @@ qboolean UI_LoadInfoPane( int handle )
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].offset = -1;
else
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].offset = token.intvalue;
-
+
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
-
+
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].graphic =
trap_R_RegisterShaderNoMip( token.string );
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
-
+
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].width = token.intvalue;
-
+
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
-
+
uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].height = token.intvalue;
-
+
//increment graphics
(*graphic)++;
-
+
if( *graphic == MAX_INFOPANE_GRAPHICS )
break;
}
else if( !Q_stricmp( token.string, "text" ) )
{
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
@@ -1137,7 +1118,7 @@ qboolean UI_LoadInfoPane( int handle )
else if( !Q_stricmp( token.string, "align" ) )
{
memset( &token, 0, sizeof( pc_token_t ) );
-
+
if( !trap_PC_ReadToken( handle, &token ) )
break;
@@ -1182,21 +1163,21 @@ void UI_LoadInfoPanes( const char *file )
uiInfo.tremInfoPaneCount = count = 0;
handle = trap_PC_LoadSource( file );
-
+
if( !handle )
{
trap_Error( va( S_COLOR_YELLOW "infopane file not found: %s\n", file ) );
return;
}
-
+
while( 1 )
{
if( !trap_PC_ReadToken( handle, &token ) )
break;
-
+
if( token.string[ 0 ] == 0 )
break;
-
+
if( token.string[ 0 ] == '{' )
{
if( UI_LoadInfoPane( handle ) )
@@ -1223,7 +1204,7 @@ qboolean Load_Menu(int handle) {
if (!trap_PC_ReadToken(handle, &token))
return qfalse;
-
+
if ( token.string[0] == 0 ) {
return qfalse;
}
@@ -1232,7 +1213,7 @@ qboolean Load_Menu(int handle) {
return qtrue;
}
- UI_ParseMenu(token.string);
+ UI_ParseMenu(token.string);
}
return qfalse;
}
@@ -1364,7 +1345,7 @@ static int UI_TeamIndexFromName(const char *name) {
return i;
}
}
- }
+ }
return 0;
@@ -1425,7 +1406,7 @@ static void UI_DrawPreviewCinematic(rectDef_t *rect, float scale, vec4_t color)
} else {
uiInfo.previewMovie = -2;
}
- }
+ }
}
@@ -1453,7 +1434,7 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x
float width = pane->graphics[ i ].width;
float height = pane->graphics[ i ].height;
qhandle_t graphic = pane->graphics[ i ].graphic;
-
+
if( pane->graphics[ i ].side == INFOPANE_TOP || pane->graphics[ i ].side == INFOPANE_BOTTOM )
{
//set horizontal offset of graphic
@@ -1476,14 +1457,14 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x
//set the horizontal offset of the text
if( pane->graphics[ i ].width > maxLeft )
maxLeft = pane->graphics[ i ].width + GRAPHIC_BWIDTH;
-
+
xoffset = GRAPHIC_BWIDTH;
}
else if( pane->graphics[ i ].side == INFOPANE_RIGHT )
{
if( pane->graphics[ i ].width > maxRight )
maxRight = pane->graphics[ i ].width + GRAPHIC_BWIDTH;
-
+
xoffset = rect->w - width - GRAPHIC_BWIDTH;
}
else if( pane->graphics[ i ].side == INFOPANE_TOP )
@@ -1491,21 +1472,21 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x
//set the vertical offset of the text
if( pane->graphics[ i ].height > maxTop )
maxTop = pane->graphics[ i ].height + GRAPHIC_BWIDTH;
-
+
yoffset = GRAPHIC_BWIDTH;
}
else if( pane->graphics[ i ].side == INFOPANE_BOTTOM )
{
if( pane->graphics[ i ].height > maxBottom )
maxBottom = pane->graphics[ i ].height + GRAPHIC_BWIDTH;
-
+
yoffset = rect->h - height - GRAPHIC_BWIDTH;
}
//draw the graphic
UI_DrawHandlePic( x + xoffset, y + yoffset, width, height, graphic );
}
-
+
//offset the text
x = rect->x + maxLeft;
y = rect->y + maxTop;
@@ -1513,7 +1494,7 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x
h = rect->h - ( maxTop + maxBottom );
textItem.text = pane->text;
-
+
textItem.parent = &dummyParent;
memcpy( textItem.window.foreColor, color, sizeof( vec4_t ) );
textItem.window.flags = 0;
@@ -1536,7 +1517,7 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x
textItem.window.rect.x = x;
break;
}
-
+
textItem.window.rect.y = y;
textItem.window.rect.w = w;
textItem.window.rect.h = h;
@@ -1598,11 +1579,6 @@ static void UI_DrawTeamMember(rectDef_t *rect, float scale, vec4_t color, qboole
Text_Paint(rect->x, rect->y, scale, color, text, 0, 0, textStyle);
}
-static void UI_DrawEffects(rectDef_t *rect, float scale, vec4_t color) {
- UI_DrawHandlePic( rect->x, rect->y - 14, 128, 8, uiInfo.uiDC.Assets.fxBasePic );
- UI_DrawHandlePic( rect->x + uiInfo.effectsColor * 16 + 8, rect->y - 16, 16, 12, uiInfo.uiDC.Assets.fxPic[uiInfo.effectsColor] );
-}
-
static void UI_DrawMapPreview(rectDef_t *rect, float scale, vec4_t color, qboolean net) {
int map = (net) ? ui_currentNetMap.integer : ui_currentMap.integer;
if (map < 0 || map > uiInfo.mapCount) {
@@ -1625,7 +1601,7 @@ static void UI_DrawMapPreview(rectDef_t *rect, float scale, vec4_t color, qboole
} else {
UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, trap_R_RegisterShaderNoMip("gfx/2d/load_screen"));
}
-}
+}
static void UI_DrawMapTimeToBeat(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
@@ -1647,7 +1623,7 @@ static void UI_DrawMapTimeToBeat(rectDef_t *rect, float scale, vec4_t color, int
static void UI_DrawMapCinematic(rectDef_t *rect, float scale, vec4_t color, qboolean net) {
- int map = (net) ? ui_currentNetMap.integer : ui_currentMap.integer;
+ int map = (net) ? ui_currentNetMap.integer : ui_currentMap.integer;
if (map < 0 || map > uiInfo.mapCount) {
if (net) {
ui_currentNetMap.integer = 0;
@@ -1782,7 +1758,7 @@ static void UI_DrawTierMap(rectDef_t *rect, int index) {
if (uiInfo.tierList[i].mapHandles[index] == -1) {
uiInfo.tierList[i].mapHandles[index] = trap_R_RegisterShaderNoMip(va("levelshots/%s", uiInfo.tierList[i].maps[index]));
}
-
+
UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, uiInfo.tierList[i].mapHandles[index]);
}
@@ -1843,9 +1819,9 @@ static void UI_DrawOpponent(rectDef_t *rect) {
char team[256];
vec3_t viewangles;
vec3_t moveangles;
-
+
if (updateOpponentModel) {
-
+
strcpy(model, UI_Cvar_VariableString("ui_opponentModel"));
strcpy(headmodel, UI_Cvar_VariableString("ui_opponentModel"));
team[0] = '\0';
@@ -2108,7 +2084,7 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) {
static void UI_DrawBotName(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
int value = uiInfo.botIndex;
const char *text = "";
-
+
if( value >= UI_GetNumBots( ) )
value = 0;
@@ -2127,15 +2103,6 @@ static void UI_DrawRedBlue(rectDef_t *rect, float scale, vec4_t color, int textS
Text_Paint(rect->x, rect->y, scale, color, (uiInfo.redBlue == 0) ? "Red" : "Blue", 0, 0, textStyle);
}
-static void UI_DrawCrosshair(rectDef_t *rect, float scale, vec4_t color) {
- trap_R_SetColor( color );
- if (uiInfo.currentCrosshair < 0 || uiInfo.currentCrosshair >= NUM_CROSSHAIRS) {
- uiInfo.currentCrosshair = 0;
- }
- UI_DrawHandlePic( rect->x, rect->y - rect->h, rect->w, rect->h, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]);
- trap_R_SetColor( NULL );
-}
-
/*
===============
UI_BuildPlayerList
@@ -2201,10 +2168,10 @@ static void UI_DrawSelectedPlayer(rectDef_t *rect, float scale, vec4_t color, in
static void UI_DrawServerRefreshDate(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
if (uiInfo.serverStatus.refreshActive) {
vec4_t lowLight, newColor;
- lowLight[0] = 0.8 * color[0];
- lowLight[1] = 0.8 * color[1];
- lowLight[2] = 0.8 * color[2];
- lowLight[3] = 0.8 * color[3];
+ lowLight[0] = 0.8 * color[0];
+ lowLight[1] = 0.8 * color[1];
+ lowLight[2] = 0.8 * color[2];
+ lowLight[3] = 0.8 * color[3];
LerpColor(color,lowLight,newColor,0.5+0.5*sin(uiInfo.uiDC.realTime / PULSE_DIVISOR));
Text_Paint(rect->x, rect->y, scale, newColor, va("Getting info for %d servers (ESC to cancel)", trap_LAN_GetServerCount(ui_netSource.integer)), 0, 0, textStyle);
} else {
@@ -2217,7 +2184,7 @@ static void UI_DrawServerRefreshDate(rectDef_t *rect, float scale, vec4_t color,
static void UI_DrawServerMOTD(rectDef_t *rect, float scale, vec4_t color) {
if (uiInfo.serverStatus.motdLen) {
float maxX;
-
+
if (uiInfo.serverStatus.motdWidth == -1) {
uiInfo.serverStatus.motdWidth = 0;
uiInfo.serverStatus.motdPaintX = rect->x + 1;
@@ -2256,10 +2223,10 @@ static void UI_DrawServerMOTD(rectDef_t *rect, float scale, vec4_t color) {
}
maxX = rect->x + rect->w - 2;
- Text_Paint_Limit(&maxX, uiInfo.serverStatus.motdPaintX, rect->y + rect->h - 3, scale, color, &uiInfo.serverStatus.motd[uiInfo.serverStatus.motdOffset], 0, 0);
+ Text_Paint_Limit(&maxX, uiInfo.serverStatus.motdPaintX, rect->y + rect->h - 3, scale, color, &uiInfo.serverStatus.motd[uiInfo.serverStatus.motdOffset], 0, 0);
if (uiInfo.serverStatus.motdPaintX2 >= 0) {
float maxX2 = rect->x + rect->w - 2;
- Text_Paint_Limit(&maxX2, uiInfo.serverStatus.motdPaintX2, rect->y + rect->h - 3, scale, color, uiInfo.serverStatus.motd, 0, uiInfo.serverStatus.motdOffset);
+ Text_Paint_Limit(&maxX2, uiInfo.serverStatus.motdPaintX2, rect->y + rect->h - 3, scale, color, uiInfo.serverStatus.motd, 0, uiInfo.serverStatus.motdOffset);
}
if (uiInfo.serverStatus.motdOffset && maxX > 0) {
// if we have an offset ( we are skipping the first part of the string ) and we fit the string
@@ -2350,48 +2317,45 @@ static void UI_OwnerDraw( float x, float y, float w, float h,
if( ( pane = uiInfo.tremTeamList[ uiInfo.tremTeamIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_ACLASSINFOPANE:
if( ( pane = uiInfo.tremAlienClassList[ uiInfo.tremAlienClassIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_AUPGRADEINFOPANE:
if( ( pane = uiInfo.tremAlienUpgradeList[ uiInfo.tremAlienUpgradeIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_HITEMINFOPANE:
if( ( pane = uiInfo.tremHumanItemList[ uiInfo.tremHumanItemIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_HBUYINFOPANE:
if( ( pane = uiInfo.tremHumanArmouryBuyList[ uiInfo.tremHumanArmouryBuyIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_HSELLINFOPANE:
if( ( pane = uiInfo.tremHumanArmourySellList[ uiInfo.tremHumanArmourySellIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_ABUILDINFOPANE:
if( ( pane = uiInfo.tremAlienBuildList[ uiInfo.tremAlienBuildIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_HBUILDINFOPANE:
if( ( pane = uiInfo.tremHumanBuildList[ uiInfo.tremHumanBuildIndex ].infopane ) )
UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle );
break;
-
+
case UI_HANDICAP:
UI_DrawHandicap(&rect, scale, color, textStyle);
break;
- case UI_EFFECTS:
- UI_DrawEffects(&rect, scale, color);
- break;
case UI_PLAYERMODEL:
UI_DrawPlayerModel(&rect);
break;
@@ -2520,9 +2484,6 @@ static void UI_OwnerDraw( float x, float y, float w, float h,
case UI_REDBLUE:
UI_DrawRedBlue(&rect, scale, color, textStyle);
break;
- case UI_CROSSHAIR:
- UI_DrawCrosshair(&rect, scale, color);
- break;
case UI_SELECTEDPLAYER:
UI_DrawSelectedPlayer(&rect, scale, color, textStyle);
break;
@@ -2553,34 +2514,34 @@ static qboolean UI_OwnerDrawVisible(int flags) {
trap_GetClientState( &cs );
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING );
team = atoi( Info_ValueForKey( info, "t" ) );
-
+
while (flags) {
-
+
if( flags & UI_SHOW_NOTSPECTATING )
{
if( team == PTE_NONE )
vis = qfalse;
-
+
flags &= ~UI_SHOW_NOTSPECTATING;
- }
-
+ }
+
if( flags & UI_SHOW_VOTEACTIVE )
{
if( !trap_Cvar_VariableValue( "ui_voteActive" ) )
vis = qfalse;
-
+
flags &= ~UI_SHOW_VOTEACTIVE;
- }
-
+ }
+
if( flags & UI_SHOW_CANVOTE )
{
if( trap_Cvar_VariableValue( "ui_voteActive" ) )
vis = qfalse;
-
+
flags &= ~UI_SHOW_CANVOTE;
- }
-
+ }
+
if( flags & UI_SHOW_TEAMVOTEACTIVE )
{
if( team == PTE_ALIENS )
@@ -2593,10 +2554,10 @@ static qboolean UI_OwnerDrawVisible(int flags) {
if( !trap_Cvar_VariableValue( "ui_humanTeamVoteActive" ) )
vis = qfalse;
}
-
+
flags &= ~UI_SHOW_TEAMVOTEACTIVE;
- }
-
+ }
+
if( flags & UI_SHOW_CANTEAMVOTE )
{
if( team == PTE_ALIENS )
@@ -2609,47 +2570,47 @@ static qboolean UI_OwnerDrawVisible(int flags) {
if( trap_Cvar_VariableValue( "ui_humanTeamVoteActive" ) )
vis = qfalse;
}
-
+
flags &= ~UI_SHOW_CANTEAMVOTE;
- }
-
+ }
+
if (flags & UI_SHOW_LEADER) {
// these need to show when this client can give orders to a player or a group
if (!uiInfo.teamLeader) {
vis = qfalse;
} else {
// if showing yourself
- if (ui_selectedPlayer.integer < uiInfo.myTeamCount && uiInfo.teamClientNums[ui_selectedPlayer.integer] == uiInfo.playerNumber) {
+ if (ui_selectedPlayer.integer < uiInfo.myTeamCount && uiInfo.teamClientNums[ui_selectedPlayer.integer] == uiInfo.playerNumber) {
vis = qfalse;
}
}
flags &= ~UI_SHOW_LEADER;
- }
+ }
if (flags & UI_SHOW_NOTLEADER) {
// these need to show when this client is assigning their own status or they are NOT the leader
if (uiInfo.teamLeader) {
// if not showing yourself
- if (!(ui_selectedPlayer.integer < uiInfo.myTeamCount && uiInfo.teamClientNums[ui_selectedPlayer.integer] == uiInfo.playerNumber)) {
+ if (!(ui_selectedPlayer.integer < uiInfo.myTeamCount && uiInfo.teamClientNums[ui_selectedPlayer.integer] == uiInfo.playerNumber)) {
vis = qfalse;
}
// these need to show when this client can give orders to a player or a group
}
flags &= ~UI_SHOW_NOTLEADER;
- }
+ }
if (flags & UI_SHOW_FAVORITESERVERS) {
// this assumes you only put this type of display flag on something showing in the proper context
if (ui_netSource.integer != AS_FAVORITES) {
vis = qfalse;
}
flags &= ~UI_SHOW_FAVORITESERVERS;
- }
+ }
if (flags & UI_SHOW_NOTFAVORITESERVERS) {
// this assumes you only put this type of display flag on something showing in the proper context
if (ui_netSource.integer == AS_FAVORITES) {
vis = qfalse;
}
flags &= ~UI_SHOW_NOTFAVORITESERVERS;
- }
+ }
if (flags & UI_SHOW_NEWHIGHSCORE) {
if (uiInfo.newHighScoreTime < uiInfo.uiDC.realTime) {
vis = qfalse;
@@ -2663,13 +2624,13 @@ static qboolean UI_OwnerDrawVisible(int flags) {
}
}
flags &= ~UI_SHOW_NEWHIGHSCORE;
- }
+ }
if (flags & UI_SHOW_NEWBESTTIME) {
if (uiInfo.newBestTime < uiInfo.uiDC.realTime) {
vis = qfalse;
}
flags &= ~UI_SHOW_NEWBESTTIME;
- }
+ }
if (flags & UI_SHOW_DEMOAVAILABLE) {
if (!uiInfo.demoAvailable) {
vis = qfalse;
@@ -2770,7 +2731,7 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboole
ui_gameType.integer = 3;
}
}
-
+
trap_Cvar_Set("ui_Q3Model", "0");
trap_Cvar_Set("ui_gameType", va("%d", ui_gameType.integer));
@@ -2798,7 +2759,7 @@ static qboolean UI_NetGameType_HandleKey(int flags, float *special, int key) {
ui_netGameType.integer = uiInfo.numGameTypes - 1;
} else if (ui_netGameType.integer >= uiInfo.numGameTypes) {
ui_netGameType.integer = 0;
- }
+ }
trap_Cvar_Set( "ui_netGameType", va("%d", ui_netGameType.integer));
trap_Cvar_Set( "ui_actualnetGameType", va("%d", uiInfo.gameTypes[ui_netGameType.integer].gtEnum));
@@ -2907,7 +2868,7 @@ static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboo
static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
-
+
if (key == K_MOUSE2) {
ui_netSource.integer--;
if (ui_netSource.integer == AS_MPLAYER)
@@ -2981,7 +2942,7 @@ static qboolean UI_BotName_HandleKey(int flags, float *special, int key) {
value = 0;
else if( value < 0 )
value = UI_GetNumBots( ) + 2 - 1;
-
+
uiInfo.botIndex = value;
return qtrue;
}
@@ -3026,7 +2987,7 @@ static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key) {
} else if (uiInfo.currentCrosshair < 0) {
uiInfo.currentCrosshair = NUM_CROSSHAIRS - 1;
}
- trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair));
+ trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair));
return qtrue;
}
return qfalse;
@@ -3043,7 +3004,7 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key)
return qfalse;
}
selected = trap_Cvar_VariableValue("cg_selectedPlayer");
-
+
if (key == K_MOUSE2) {
selected--;
} else {
@@ -3072,9 +3033,6 @@ static qboolean UI_OwnerDrawHandleKey(int ownerDraw, int flags, float *special,
case UI_HANDICAP:
return UI_Handicap_HandleKey(flags, special, key);
break;
- case UI_EFFECTS:
- return UI_Effects_HandleKey(flags, special, key);
- break;
case UI_CLANNAME:
return UI_ClanName_HandleKey(flags, special, key);
break;
@@ -3128,9 +3086,6 @@ static qboolean UI_OwnerDrawHandleKey(int ownerDraw, int flags, float *special,
case UI_REDBLUE:
UI_RedBlue_HandleKey(flags, special, key);
break;
- case UI_CROSSHAIR:
- UI_Crosshair_HandleKey(flags, special, key);
- break;
case UI_SELECTEDPLAYER:
UI_SelectedPlayer_HandleKey(flags, special, key);
break;
@@ -3208,7 +3163,7 @@ static void UI_StartSinglePlayer() {
}
trap_Cmd_ExecuteText( EXEC_APPEND, "wait 5; team Red\n" );
}
-
+
}
*/
@@ -3222,7 +3177,7 @@ static stage_t UI_GetCurrentAlienStage( void )
{
char buffer[ MAX_TOKEN_CHARS ];
stage_t stage, dummy;
-
+
trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) );
sscanf( buffer, "%d %d", (int *)&stage , (int *)&dummy );
@@ -3238,7 +3193,7 @@ static stage_t UI_GetCurrentHumanStage( void )
{
char buffer[ MAX_TOKEN_CHARS ];
stage_t stage, dummy;
-
+
trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) );
sscanf( buffer, "%d %d", (int *)&dummy, (int *)&stage );
@@ -3253,19 +3208,19 @@ UI_LoadTremTeams
static void UI_LoadTremTeams( void )
{
uiInfo.tremTeamCount = 4;
-
+
uiInfo.tremTeamList[ 0 ].text = String_Alloc( "Aliens" );
uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens\n" );
uiInfo.tremTeamList[ 0 ].infopane = UI_FindInfoPaneByName( "alienteam" );
-
+
uiInfo.tremTeamList[ 1 ].text = String_Alloc( "Humans" );
uiInfo.tremTeamList[ 1 ].cmd = String_Alloc( "cmd team humans\n" );
uiInfo.tremTeamList[ 1 ].infopane = UI_FindInfoPaneByName( "humanteam" );
-
+
uiInfo.tremTeamList[ 2 ].text = String_Alloc( "Spectate" );
uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate\n" );
uiInfo.tremTeamList[ 2 ].infopane = UI_FindInfoPaneByName( "spectateteam" );
-
+
uiInfo.tremTeamList[ 3 ].text = String_Alloc( "Auto select" );
uiInfo.tremTeamList[ 3 ].cmd = String_Alloc( "cmd team auto\n" );
uiInfo.tremTeamList[ 3 ].infopane = UI_FindInfoPaneByName( "autoteam" );
@@ -3279,21 +3234,21 @@ UI_LoadTremAlienClasses
static void UI_LoadTremAlienClasses( void )
{
pClass_t bClass;
-
+
uiInfo.tremAlienClassCount = 2;
-
+
uiInfo.tremAlienClassList[ 0 ].text =
String_Alloc( BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL0 ) );
uiInfo.tremAlienClassList[ 0 ].cmd =
String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( PCL_ALIEN_LEVEL0 ) ) );
uiInfo.tremAlienClassList[ 0 ].infopane =
UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( PCL_ALIEN_LEVEL0 ) ) );
-
+
if( BG_FindStagesForClass( PCL_ALIEN_BUILDER0_UPG, UI_GetCurrentAlienStage( ) ) )
bClass = PCL_ALIEN_BUILDER0_UPG;
else
bClass = PCL_ALIEN_BUILDER0;
-
+
uiInfo.tremAlienClassList[ 1 ].text =
String_Alloc( BG_FindHumanNameForClassNum( bClass ) );
uiInfo.tremAlienClassList[ 1 ].cmd =
@@ -3319,12 +3274,12 @@ static void UI_LoadTremHumanItems( void )
String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( WP_MACHINEGUN ) ) );
uiInfo.tremHumanItemList[ 0 ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( WP_MACHINEGUN ) ) );
-
+
if( BG_FindStagesForWeapon( WP_HBUILD2, UI_GetCurrentHumanStage( ) ) )
bWeapon = WP_HBUILD2;
else
bWeapon = WP_HBUILD;
-
+
uiInfo.tremHumanItemList[ 1 ].text =
String_Alloc( BG_FindHumanNameForWeapon( bWeapon ) );
uiInfo.tremHumanItemList[ 1 ].cmd =
@@ -3345,7 +3300,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades )
char *iterator;
char buffer[ MAX_TOKEN_CHARS ];
char *bufPointer;
-
+
trap_Cvar_VariableStringBuffer( "ui_carriage", carriageCvar, sizeof( carriageCvar ) );
iterator = carriageCvar;
@@ -3359,7 +3314,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades )
while( iterator && iterator[ 0 ] != '$' )
{
bufPointer = buffer;
-
+
if( iterator[ 0 ] == 'W' )
{
iterator++;
@@ -3384,7 +3339,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades )
*bufPointer++ = '\n';
i = atoi( buffer );
-
+
if( upgrades )
*upgrades |= ( 1 << i );
}
@@ -3404,7 +3359,7 @@ static void UI_LoadTremHumanArmouryBuys( )
stage_t stage = UI_GetCurrentHumanStage( );
int weapons, upgrades;
int slots = 0;
-
+
UI_ParseCarriageList( &weapons, &upgrades );
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
@@ -3412,15 +3367,15 @@ static void UI_LoadTremHumanArmouryBuys( )
if( weapons & ( 1 << i ) )
slots |= BG_FindSlotsForWeapon( i );
}
-
+
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( upgrades & ( 1 << i ) )
slots |= BG_FindSlotsForUpgrade( i );
}
-
+
uiInfo.tremHumanArmouryBuyCount = 0;
-
+
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( BG_FindTeamForWeapon( i ) == WUT_HUMANS &&
@@ -3435,13 +3390,13 @@ static void UI_LoadTremHumanArmouryBuys( )
String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForWeapon( i ) ) );
uiInfo.tremHumanArmouryBuyList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) );
-
+
j++;
uiInfo.tremHumanArmouryBuyCount++;
}
}
-
+
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( BG_FindTeamForUpgrade( i ) == WUT_HUMANS &&
@@ -3458,7 +3413,7 @@ static void UI_LoadTremHumanArmouryBuys( )
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) );
j++;
-
+
uiInfo.tremHumanArmouryBuyCount++;
}
}
@@ -3473,10 +3428,10 @@ static void UI_LoadTremHumanArmourySells( )
{
int weapons, upgrades;
int i, j = 0;
-
+
uiInfo.tremHumanArmourySellCount = 0;
UI_ParseCarriageList( &weapons, &upgrades );
-
+
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( weapons & ( 1 << i ) )
@@ -3488,11 +3443,11 @@ static void UI_LoadTremHumanArmourySells( )
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) );
j++;
-
+
uiInfo.tremHumanArmourySellCount++;
}
}
-
+
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( upgrades & ( 1 << i ) )
@@ -3504,7 +3459,7 @@ static void UI_LoadTremHumanArmourySells( )
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) );
j++;
-
+
uiInfo.tremHumanArmourySellCount++;
}
}
@@ -3521,12 +3476,12 @@ static void UI_LoadTremAlienUpgrades( )
int class, credits;
char ui_currentClass[ MAX_STRING_CHARS ];
stage_t stage = UI_GetCurrentAlienStage( );
-
+
trap_Cvar_VariableStringBuffer( "ui_currentClass", ui_currentClass, MAX_STRING_CHARS );
sscanf( ui_currentClass, "%d %d", &class, &credits );
uiInfo.tremAlienUpgradeCount = 0;
-
+
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
if( BG_ClassCanEvolveFromTo( class, i, credits, 0 ) >= 0 &&
@@ -3555,12 +3510,12 @@ static void UI_LoadTremAlienBuilds( )
int weapons;
int i, j = 0;
stage_t stage;
-
+
UI_ParseCarriageList( &weapons, NULL );
stage = UI_GetCurrentAlienStage( );
-
+
uiInfo.tremAlienBuildCount = 0;
-
+
for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ )
{
if( BG_FindTeamForBuildable( i ) == BIT_ALIENS &&
@@ -3575,7 +3530,7 @@ static void UI_LoadTremAlienBuilds( )
UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) );
j++;
-
+
uiInfo.tremAlienBuildCount++;
}
}
@@ -3591,12 +3546,12 @@ static void UI_LoadTremHumanBuilds( )
int weapons;
int i, j = 0;
stage_t stage;
-
+
UI_ParseCarriageList( &weapons, NULL );
stage = UI_GetCurrentHumanStage( );
uiInfo.tremHumanBuildCount = 0;
-
+
for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ )
{
if( BG_FindTeamForBuildable( i ) == BIT_HUMANS &&
@@ -3611,7 +3566,7 @@ static void UI_LoadTremHumanBuilds( )
UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) );
j++;
-
+
uiInfo.tremHumanBuildCount++;
}
}
@@ -3874,7 +3829,7 @@ static void UI_Update(const char *name) {
trap_Cvar_SetValue( "cg_brassTime", 2500 );
trap_Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" );
break;
- case 1: // normal
+ case 1: // normal
trap_Cvar_SetValue( "r_fullScreen", 1 );
trap_Cvar_SetValue( "r_subdivisions", 12 );
trap_Cvar_SetValue( "r_vertexlight", 0 );
@@ -3966,7 +3921,7 @@ static void UI_RunMenuScript(char **args) {
if (clients == 0) {
clients = 8;
}
-
+
if (oldclients > clients) {
clients = oldclients;
}
@@ -4019,10 +3974,10 @@ static void UI_RunMenuScript(char **args) {
} else if (Q_stricmp(name, "verifyCDKey") == 0) {
buff[0] = '\0';
- Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey1"));
- Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey2"));
- Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey3"));
- Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey4"));
+ Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey1"));
+ Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey2"));
+ Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey3"));
+ Q_strcat(buff, 1024, UI_Cvar_VariableString("cdkey4"));
trap_Cvar_Set("cdkey", buff);
if (trap_VerifyCDKey(buff, UI_Cvar_VariableString("cdkeychecksum"))) {
trap_Cvar_Set("ui_cdkeyvalid", "CD Key Appears to be valid.");
@@ -4062,7 +4017,7 @@ static void UI_RunMenuScript(char **args) {
} else if (Q_stricmp(name, "LoadMods") == 0) {
UI_LoadMods();
}
-
+
//TA: tremulous menus
else if( Q_stricmp( name, "LoadTeams" ) == 0 )
UI_LoadTremTeams( );
@@ -4135,20 +4090,20 @@ static void UI_RunMenuScript(char **args) {
// load the file
len = trap_FS_FOpenFile( "ptrc.cfg", &f, FS_READ );
-
+
if( len > 0 && ( len < sizeof( text ) - 1 ) )
{
trap_FS_Read( text, len, f );
text[ len ] = 0;
trap_FS_FCloseFile( f );
-
+
Com_sprintf( command, 32, "ptrcrestore %s", text );
-
+
trap_Cmd_ExecuteText( EXEC_APPEND, command );
}
}
//TA: tremulous menus
-
+
else if (Q_stricmp(name, "playMovie") == 0) {
if (uiInfo.previewMovie >= 0) {
trap_CIN_StopCinematic(uiInfo.previewMovie);
@@ -4426,7 +4381,7 @@ static int UI_MapCountByGameType(qboolean singlePlayer) {
qboolean UI_hasSkinForBase(const char *base, const char *team) {
char test[1024];
-
+
Com_sprintf( test, sizeof( test ), "models/players/%s/%s/lower_default.skin", base, team );
if (trap_FS_FOpenFile(test, 0, FS_READ)) {
@@ -4448,7 +4403,7 @@ UI_MapCountByTeam
static int UI_HeadCountByTeam() {
static int init = 0;
int i, j, k, c, tIndex;
-
+
c = 0;
if (!init) {
for (i = 0; i < uiInfo.characterCount; i++) {
@@ -4601,11 +4556,11 @@ static void UI_BuildServerDisplayList(qboolean force) {
if (len == 0) {
strcpy(uiInfo.serverStatus.motd, "Welcome to Tremulous!");
len = strlen(uiInfo.serverStatus.motd);
- }
+ }
if (len != uiInfo.serverStatus.motdLen) {
uiInfo.serverStatus.motdLen = len;
uiInfo.serverStatus.motdWidth = -1;
- }
+ }
if (force) {
numinvisible = 0;
@@ -4666,14 +4621,14 @@ static void UI_BuildServerDisplayList(qboolean force) {
continue;
}
}
-
+
//TA: only show tremulous servers
if( Q_stricmp( Info_ValueForKey( info, "game" ), "tremulous" ) != 0 )
{
trap_LAN_MarkServerVisible( ui_netSource.integer, i, qfalse );
continue;
}
-
+
// make sure we never add a favorite server twice
if (ui_netSource.integer == AS_FAVORITES) {
UI_RemoveServerFromDisplayList(i);
@@ -5092,7 +5047,7 @@ static int UI_FeederCount(float feederID) {
else if( feederID == FEEDER_TREMHUMANBUILD )
return uiInfo.tremHumanBuildCount;
//TA: tremulous menus
-
+
return 0;
}
@@ -5144,7 +5099,7 @@ static int UI_GetIndexFromSelection(int actual) {
return 0;
}
-static void UI_UpdatePendingPings() {
+static void UI_UpdatePendingPings() {
trap_LAN_ResetPings(ui_netSource.integer);
uiInfo.serverStatus.refreshActive = qtrue;
uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 1000;
@@ -5183,7 +5138,7 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
// UI_UpdatePendingPings();
}
switch (column) {
- case SORT_HOST :
+ case SORT_HOST :
if (ping <= 0) {
return Info_ValueForKey(info, "addr");
} else {
@@ -5201,10 +5156,10 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
}
case SORT_MAP :
return Info_ValueForKey(info, "mapname");
- case SORT_CLIENTS :
+ case SORT_CLIENTS :
Com_sprintf( clientBuff, sizeof(clientBuff), "%s (%s)", Info_ValueForKey(info, "clients"), Info_ValueForKey(info, "sv_maxclients"));
return clientBuff;
- case SORT_PING :
+ case SORT_PING :
if (ping <= 0) {
return "...";
} else {
@@ -5298,7 +5253,7 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
return uiInfo.tremHumanBuildList[ index ].text;
}
//TA: tremulous menus
-
+
return "";
}
@@ -5340,7 +5295,7 @@ static void UI_FeederSelection(float feederID, int index) {
index = actual;
if (index >= 0 && index < uiInfo.characterCount) {
trap_Cvar_Set( "team_model", va("%s", uiInfo.characterList[index].base));
- trap_Cvar_Set( "team_headmodel", va("*%s", uiInfo.characterList[index].name));
+ trap_Cvar_Set( "team_headmodel", va("*%s", uiInfo.characterList[index].name));
updateModel = qtrue;
}
} else if (feederID == FEEDER_Q3HEADS) {
@@ -5516,12 +5471,12 @@ static void UI_BuildQ3Model_List( void )
for (i=0; i<numdirs && uiInfo.q3HeadCount < MAX_PLAYERMODELS; i++,dirptr+=dirlen+1)
{
dirlen = strlen(dirptr);
-
+
if (dirlen && dirptr[dirlen-1]=='/') dirptr[dirlen-1]='\0';
if (!strcmp(dirptr,".") || !strcmp(dirptr,".."))
continue;
-
+
// iterate all skin files in directory
numfiles = trap_FS_GetFileList( va("models/players/%s",dirptr), "tga", filelist, 2048 );
fileptr = filelist;
@@ -5553,7 +5508,7 @@ static void UI_BuildQ3Model_List( void )
}
}
- }
+ }
}
@@ -5569,7 +5524,7 @@ void _UI_Init( qboolean inGameLoad ) {
int start;
BG_InitClassOverrides( );
-
+
//uiInfo.inGameLoad = inGameLoad;
UI_RegisterCvars();
@@ -5631,8 +5586,8 @@ void _UI_Init( qboolean inGameLoad ) {
uiInfo.uiDC.getBindingBuf = &trap_Key_GetBindingBuf;
uiInfo.uiDC.keynumToStringBuf = &trap_Key_KeynumToStringBuf;
uiInfo.uiDC.executeText = &trap_Cmd_ExecuteText;
- uiInfo.uiDC.Error = &Com_Error;
- uiInfo.uiDC.Print = &Com_Printf;
+ uiInfo.uiDC.Error = &Com_Error;
+ uiInfo.uiDC.Print = &Com_Printf;
uiInfo.uiDC.Pause = &UI_Pause;
uiInfo.uiDC.ownerDrawWidth = &UI_OwnerDrawWidth;
uiInfo.uiDC.registerSound = &trap_S_RegisterSound;
@@ -5646,8 +5601,7 @@ void _UI_Init( qboolean inGameLoad ) {
Init_Display(&uiInfo.uiDC);
String_Init();
-
- uiInfo.uiDC.cursor = trap_R_RegisterShaderNoMip( "menu/art/3_cursor2" );
+
uiInfo.uiDC.whiteShader = trap_R_RegisterShaderNoMip( "white" );
AssetCache();
@@ -5672,7 +5626,7 @@ void _UI_Init( qboolean inGameLoad ) {
UI_LoadMenus("ui/ingame.txt", qtrue);
} else { // bk010222: left this: UI_LoadMenus(menuSet, qtrue);
}
-#else
+#else
UI_LoadMenus(menuSet, qtrue);
UI_LoadMenus("ui/ingame.txt", qfalse);
UI_LoadMenus("ui/tremulous.txt", qfalse);
@@ -5688,7 +5642,7 @@ void _UI_Init( qboolean inGameLoad ) {
Com_Printf( "name: %s\n", uiInfo.tremInfoPanes[ i ].name );
Com_Printf( "text: %s\n", uiInfo.tremInfoPanes[ i ].text );
-
+
for( j = 0; j < uiInfo.tremInfoPanes[ i ].numGraphics; j++ )
Com_Printf( "graphic %d: %d %d %d %d\n", j, uiInfo.tremInfoPanes[ i ].graphics[ j ].side,
uiInfo.tremInfoPanes[ i ].graphics[ j ].offset,
@@ -5697,7 +5651,7 @@ void _UI_Init( qboolean inGameLoad ) {
}
}
#endif
-
+
Menus_CloseAll();
trap_LAN_LoadCachedServers();
@@ -5887,11 +5841,11 @@ static void UI_ReadableSize ( char *buf, int bufsize, int value )
{
if (value > 1024*1024*1024 ) { // gigs
Com_sprintf( buf, bufsize, "%d", value / (1024*1024*1024) );
- Com_sprintf( buf+strlen(buf), bufsize-strlen(buf), ".%02d GB",
+ Com_sprintf( buf+strlen(buf), bufsize-strlen(buf), ".%02d GB",
(value % (1024*1024*1024))*100 / (1024*1024*1024) );
} else if (value > 1024*1024 ) { // megs
Com_sprintf( buf, bufsize, "%d", value / (1024*1024) );
- Com_sprintf( buf+strlen(buf), bufsize-strlen(buf), ".%02d MB",
+ Com_sprintf( buf+strlen(buf), bufsize-strlen(buf), ".%02d MB",
(value % (1024*1024))*100 / (1024*1024) );
} else if (value > 1024 ) { // kilos
Com_sprintf( buf, bufsize, "%d KB", value / 1024 );
@@ -5919,37 +5873,37 @@ void Text_PaintCenter(float x, float y, float scale, vec4_t color, const char *t
}
void Text_PaintCenter_AutoWrapped(float x, float y, float xmax, float ystep, float scale, vec4_t color, const char *str, float adjust) {
- int width;
- char *s1,*s2,*s3;
- char c_bcp;
- char buf[1024];
-
- if (!str || str[0]=='\0')
- return;
-
- Q_strncpyz(buf, str, sizeof(buf));
- s1 = s2 = s3 = buf;
-
- while (1) {
- do {
- s3++;
- } while (*s3!=' ' && *s3!='\0');
- c_bcp = *s3;
- *s3 = '\0';
- width = Text_Width(s1, scale, 0);
- *s3 = c_bcp;
- if (width > xmax) {
- if (s1==s2)
- {
- // fuck, don't have a clean cut, we'll overflow
- s2 = s3;
- }
- *s2 = '\0';
- Text_PaintCenter(x, y, scale, color, s1, adjust);
- y += ystep;
- if (c_bcp == '\0')
+ int width;
+ char *s1,*s2,*s3;
+ char c_bcp;
+ char buf[1024];
+
+ if (!str || str[0]=='\0')
+ return;
+
+ Q_strncpyz(buf, str, sizeof(buf));
+ s1 = s2 = s3 = buf;
+
+ while (1) {
+ do {
+ s3++;
+ } while (*s3!=' ' && *s3!='\0');
+ c_bcp = *s3;
+ *s3 = '\0';
+ width = Text_Width(s1, scale, 0);
+ *s3 = c_bcp;
+ if (width > xmax) {
+ if (s1==s2)
{
- // that was the last word
+ // fuck, don't have a clean cut, we'll overflow
+ s2 = s3;
+ }
+ *s2 = '\0';
+ Text_PaintCenter(x, y, scale, color, s1, adjust);
+ y += ystep;
+ if (c_bcp == '\0')
+ {
+ // that was the last word
// we could start a new loop, but that wouldn't be much use
// even if the word is too long, we would overflow it (see above)
// so just print it now if needed
@@ -5958,20 +5912,20 @@ void Text_PaintCenter_AutoWrapped(float x, float y, float xmax, float ystep, flo
Text_PaintCenter(x, y, scale, color, s2, adjust);
break;
}
- s2++;
- s1 = s2;
- s3 = s2;
- }
- else
- {
- s2 = s3;
- if (c_bcp == '\0') // we reached the end
- {
- Text_PaintCenter(x, y, scale, color, s1, adjust);
- break;
- }
- }
- }
+ s2++;
+ s1 = s2;
+ s3 = s2;
+ }
+ else
+ {
+ s2 = s3;
+ if (c_bcp == '\0') // we reached the end
+ {
+ Text_PaintCenter(x, y, scale, color, s1, adjust);
+ break;
+ }
+ }
+ }
}
@@ -6024,7 +5978,7 @@ static void UI_DisplayDownloadInfo( const char *downloadName, float centerPoint,
int n = downloadSize / xferRate; // estimated time for entire d/l in secs
// We do it in K (/1024) because we'd overflow around 4MB
- UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf,
+ UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf,
(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000);
Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, dlTimeBuf, 0);
@@ -6058,7 +6012,7 @@ void UI_DrawConnectScreen( qboolean overlay ) {
char info[MAX_INFO_VALUE];
char text[256];
float centerPoint, yStart, scale;
-
+
menuDef_t *menu = Menus_FindByName("Connect");
@@ -6272,7 +6226,7 @@ vmCvar_t ui_realWarmUp;
vmCvar_t ui_serverStatusTimeOut;
//TA: bank values
-vmCvar_t ui_bank;
+vmCvar_t ui_bank;
// bk001129 - made static to avoid aliasing
@@ -6395,7 +6349,7 @@ static cvarTable_t cvarTable[] = {
{ &ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE},
{ &ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART},
{ &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE},
-
+
{ &ui_bank, "ui_bank", "0", 0 },
};
diff --git a/src/ui/ui_players.c b/src/ui/ui_players.c
index ee2c5126..4560cbd2 100644
--- a/src/ui/ui_players.c
+++ b/src/ui/ui_players.c
@@ -19,24 +19,24 @@
#include "ui_local.h"
-#define UI_TIMER_GESTURE 2300
-#define UI_TIMER_JUMP 1000
-#define UI_TIMER_LAND 130
-#define UI_TIMER_WEAPON_SWITCH 300
-#define UI_TIMER_ATTACK 500
-#define UI_TIMER_MUZZLE_FLASH 20
-#define UI_TIMER_WEAPON_DELAY 250
+#define UI_TIMER_GESTURE 2300
+#define UI_TIMER_JUMP 1000
+#define UI_TIMER_LAND 130
+#define UI_TIMER_WEAPON_SWITCH 300
+#define UI_TIMER_ATTACK 500
+#define UI_TIMER_MUZZLE_FLASH 20
+#define UI_TIMER_WEAPON_DELAY 250
-#define JUMP_HEIGHT 56
+#define JUMP_HEIGHT 56
-#define SWINGSPEED 0.3f
+#define SWINGSPEED 0.3f
-#define SPIN_SPEED 0.9f
-#define COAST_TIME 1000
+#define SPIN_SPEED 0.9f
+#define COAST_TIME 1000
-static int dp_realtime;
-static float jumpHeight;
+static int dp_realtime;
+static float jumpHeight;
sfxHandle_t weaponChangeSound;
@@ -48,86 +48,86 @@ UI_PlayerInfo_SetWeapon
static void UI_PlayerInfo_SetWeapon( playerInfo_t *pi, weapon_t weaponNum )
{
//TA: FIXME: this is probably useless for trem
-/* gitem_t * item;
- char path[MAX_QPATH];
+/* gitem_t * item;
+ char path[MAX_QPATH];
- pi->currentWeapon = weaponNum;
+ pi->currentWeapon = weaponNum;
tryagain:
- pi->realWeapon = weaponNum;
- pi->weaponModel = 0;
- pi->barrelModel = 0;
- pi->flashModel = 0;
-
- if ( weaponNum == WP_NONE ) {
- return;
- }
-
- if ( item->classname ) {
- pi->weaponModel = trap_R_RegisterModel( item->world_model[0] );
- }
-
- if( pi->weaponModel == 0 ) {
- if( weaponNum == WP_MACHINEGUN ) {
- weaponNum = WP_NONE;
- goto tryagain;
- }
- weaponNum = WP_MACHINEGUN;
- goto tryagain;
- }
-
- if ( weaponNum == WP_MACHINEGUN ) {
- strcpy( path, item->world_model[0] );
- COM_StripExtension( path, path );
- strcat( path, "_barrel.md3" );
- pi->barrelModel = trap_R_RegisterModel( path );
- }
-
- strcpy( path, item->world_model[0] );
- COM_StripExtension( path, path );
- strcat( path, "_flash.md3" );
- pi->flashModel = trap_R_RegisterModel( path );
-
- switch( weaponNum ) {
- case WP_GAUNTLET:
- MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
- break;
-
- case WP_MACHINEGUN:
- MAKERGB( pi->flashDlightColor, 1, 1, 0 );
- break;
-
- case WP_SHOTGUN:
- MAKERGB( pi->flashDlightColor, 1, 1, 0 );
- break;
-
- case WP_GRENADE_LAUNCHER:
- MAKERGB( pi->flashDlightColor, 1, 0.7f, 0.5f );
- break;
-
- case WP_ROCKET_LAUNCHER:
- MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 );
- break;
-
- case WP_TESLAGEN:
- MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
- break;
-
- case WP_RAILGUN:
- MAKERGB( pi->flashDlightColor, 1, 0.5f, 0 );
- break;
-
- case WP_BFG:
- MAKERGB( pi->flashDlightColor, 1, 0.7f, 1 );
- break;
-
- case WP_GRAPPLING_HOOK:
- MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
- break;
-
- default:
- MAKERGB( pi->flashDlightColor, 1, 1, 1 );
- break;
- }*/
+ pi->realWeapon = weaponNum;
+ pi->weaponModel = 0;
+ pi->barrelModel = 0;
+ pi->flashModel = 0;
+
+ if ( weaponNum == WP_NONE ) {
+ return;
+ }
+
+ if ( item->classname ) {
+ pi->weaponModel = trap_R_RegisterModel( item->world_model[0] );
+ }
+
+ if( pi->weaponModel == 0 ) {
+ if( weaponNum == WP_MACHINEGUN ) {
+ weaponNum = WP_NONE;
+ goto tryagain;
+ }
+ weaponNum = WP_MACHINEGUN;
+ goto tryagain;
+ }
+
+ if ( weaponNum == WP_MACHINEGUN ) {
+ strcpy( path, item->world_model[0] );
+ COM_StripExtension( path, path );
+ strcat( path, "_barrel.md3" );
+ pi->barrelModel = trap_R_RegisterModel( path );
+ }
+
+ strcpy( path, item->world_model[0] );
+ COM_StripExtension( path, path );
+ strcat( path, "_flash.md3" );
+ pi->flashModel = trap_R_RegisterModel( path );
+
+ switch( weaponNum ) {
+ case WP_GAUNTLET:
+ MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
+ break;
+
+ case WP_MACHINEGUN:
+ MAKERGB( pi->flashDlightColor, 1, 1, 0 );
+ break;
+
+ case WP_SHOTGUN:
+ MAKERGB( pi->flashDlightColor, 1, 1, 0 );
+ break;
+
+ case WP_GRENADE_LAUNCHER:
+ MAKERGB( pi->flashDlightColor, 1, 0.7f, 0.5f );
+ break;
+
+ case WP_ROCKET_LAUNCHER:
+ MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 );
+ break;
+
+ case WP_TESLAGEN:
+ MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
+ break;
+
+ case WP_RAILGUN:
+ MAKERGB( pi->flashDlightColor, 1, 0.5f, 0 );
+ break;
+
+ case WP_BFG:
+ MAKERGB( pi->flashDlightColor, 1, 0.7f, 1 );
+ break;
+
+ case WP_GRAPPLING_HOOK:
+ MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
+ break;
+
+ default:
+ MAKERGB( pi->flashDlightColor, 1, 1, 1 );
+ break;
+ }*/
}
@@ -137,11 +137,11 @@ UI_ForceLegsAnim
===============
*/
static void UI_ForceLegsAnim( playerInfo_t *pi, int anim ) {
- pi->legsAnim = ( ( pi->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
+ pi->legsAnim = ( ( pi->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
- if ( anim == LEGS_JUMP ) {
- pi->legsAnimationTimer = UI_TIMER_JUMP;
- }
+ if ( anim == LEGS_JUMP ) {
+ pi->legsAnimationTimer = UI_TIMER_JUMP;
+ }
}
@@ -151,11 +151,11 @@ UI_SetLegsAnim
===============
*/
static void UI_SetLegsAnim( playerInfo_t *pi, int anim ) {
- if ( pi->pendingLegsAnim ) {
- anim = pi->pendingLegsAnim;
- pi->pendingLegsAnim = 0;
- }
- UI_ForceLegsAnim( pi, anim );
+ if ( pi->pendingLegsAnim ) {
+ anim = pi->pendingLegsAnim;
+ pi->pendingLegsAnim = 0;
+ }
+ UI_ForceLegsAnim( pi, anim );
}
@@ -165,15 +165,15 @@ UI_ForceTorsoAnim
===============
*/
static void UI_ForceTorsoAnim( playerInfo_t *pi, int anim ) {
- pi->torsoAnim = ( ( pi->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
+ pi->torsoAnim = ( ( pi->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
- if ( anim == TORSO_GESTURE ) {
- pi->torsoAnimationTimer = UI_TIMER_GESTURE;
- }
+ if ( anim == TORSO_GESTURE ) {
+ pi->torsoAnimationTimer = UI_TIMER_GESTURE;
+ }
- if ( anim == TORSO_ATTACK || anim == TORSO_ATTACK2 ) {
- pi->torsoAnimationTimer = UI_TIMER_ATTACK;
- }
+ if ( anim == TORSO_ATTACK || anim == TORSO_ATTACK2 ) {
+ pi->torsoAnimationTimer = UI_TIMER_ATTACK;
+ }
}
@@ -183,12 +183,12 @@ UI_SetTorsoAnim
===============
*/
static void UI_SetTorsoAnim( playerInfo_t *pi, int anim ) {
- if ( pi->pendingTorsoAnim ) {
- anim = pi->pendingTorsoAnim;
- pi->pendingTorsoAnim = 0;
- }
+ if ( pi->pendingTorsoAnim ) {
+ anim = pi->pendingTorsoAnim;
+ pi->pendingTorsoAnim = 0;
+ }
- UI_ForceTorsoAnim( pi, anim );
+ UI_ForceTorsoAnim( pi, anim );
}
@@ -198,42 +198,42 @@ UI_TorsoSequencing
===============
*/
static void UI_TorsoSequencing( playerInfo_t *pi ) {
- int currentAnim;
-
- currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
-
- if ( pi->weapon != pi->currentWeapon ) {
- if ( currentAnim != TORSO_DROP ) {
- pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
- UI_ForceTorsoAnim( pi, TORSO_DROP );
- }
- }
-
- if ( pi->torsoAnimationTimer > 0 ) {
- return;
- }
-
- if( currentAnim == TORSO_GESTURE ) {
- UI_SetTorsoAnim( pi, TORSO_STAND );
- return;
- }
-
- if( currentAnim == TORSO_ATTACK || currentAnim == TORSO_ATTACK2 ) {
- UI_SetTorsoAnim( pi, TORSO_STAND );
- return;
- }
-
- if ( currentAnim == TORSO_DROP ) {
- UI_PlayerInfo_SetWeapon( pi, pi->weapon );
- pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
- UI_ForceTorsoAnim( pi, TORSO_RAISE );
- return;
- }
-
- if ( currentAnim == TORSO_RAISE ) {
- UI_SetTorsoAnim( pi, TORSO_STAND );
- return;
- }
+ int currentAnim;
+
+ currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
+
+ if ( pi->weapon != pi->currentWeapon ) {
+ if ( currentAnim != TORSO_DROP ) {
+ pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
+ UI_ForceTorsoAnim( pi, TORSO_DROP );
+ }
+ }
+
+ if ( pi->torsoAnimationTimer > 0 ) {
+ return;
+ }
+
+ if( currentAnim == TORSO_GESTURE ) {
+ UI_SetTorsoAnim( pi, TORSO_STAND );
+ return;
+ }
+
+ if( currentAnim == TORSO_ATTACK || currentAnim == TORSO_ATTACK2 ) {
+ UI_SetTorsoAnim( pi, TORSO_STAND );
+ return;
+ }
+
+ if ( currentAnim == TORSO_DROP ) {
+ UI_PlayerInfo_SetWeapon( pi, pi->weapon );
+ pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
+ UI_ForceTorsoAnim( pi, TORSO_RAISE );
+ return;
+ }
+
+ if ( currentAnim == TORSO_RAISE ) {
+ UI_SetTorsoAnim( pi, TORSO_STAND );
+ return;
+ }
}
@@ -243,28 +243,28 @@ UI_LegsSequencing
===============
*/
static void UI_LegsSequencing( playerInfo_t *pi ) {
- int currentAnim;
-
- currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
-
- if ( pi->legsAnimationTimer > 0 ) {
- if ( currentAnim == LEGS_JUMP ) {
- jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
- }
- return;
- }
-
- if ( currentAnim == LEGS_JUMP ) {
- UI_ForceLegsAnim( pi, LEGS_LAND );
- pi->legsAnimationTimer = UI_TIMER_LAND;
- jumpHeight = 0;
- return;
- }
-
- if ( currentAnim == LEGS_LAND ) {
- UI_SetLegsAnim( pi, LEGS_IDLE );
- return;
- }
+ int currentAnim;
+
+ currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
+
+ if ( pi->legsAnimationTimer > 0 ) {
+ if ( currentAnim == LEGS_JUMP ) {
+ jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
+ }
+ return;
+ }
+
+ if ( currentAnim == LEGS_JUMP ) {
+ UI_ForceLegsAnim( pi, LEGS_LAND );
+ pi->legsAnimationTimer = UI_TIMER_LAND;
+ jumpHeight = 0;
+ return;
+ }
+
+ if ( currentAnim == LEGS_LAND ) {
+ UI_SetLegsAnim( pi, LEGS_IDLE );
+ return;
+ }
}
@@ -273,24 +273,24 @@ static void UI_LegsSequencing( playerInfo_t *pi ) {
UI_PositionEntityOnTag
======================
*/
-static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- clipHandle_t parentModel, char *tagName ) {
- int i;
- orientation_t lerped;
-
- // lerp the tag
- trap_CM_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
-
- // FIXME: allow origin offsets along tag?
- VectorCopy( parent->origin, entity->origin );
- for ( i = 0 ; i < 3 ; i++ ) {
- VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
- }
-
- // cast away const because of compiler problems
- MatrixMultiply( lerped.axis, ((refEntity_t*)parent)->axis, entity->axis );
- entity->backlerp = parent->backlerp;
+static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
+ clipHandle_t parentModel, char *tagName ) {
+ int i;
+ orientation_t lerped;
+
+ // lerp the tag
+ trap_CM_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
+ 1.0 - parent->backlerp, tagName );
+
+ // FIXME: allow origin offsets along tag?
+ VectorCopy( parent->origin, entity->origin );
+ for ( i = 0 ; i < 3 ; i++ ) {
+ VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
+ }
+
+ // cast away const because of compiler problems
+ MatrixMultiply( lerped.axis, ((refEntity_t*)parent)->axis, entity->axis );
+ entity->backlerp = parent->backlerp;
}
@@ -299,25 +299,25 @@ static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *pare
UI_PositionRotatedEntityOnTag
======================
*/
-static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- clipHandle_t parentModel, char *tagName ) {
- int i;
- orientation_t lerped;
- vec3_t tempAxis[3];
-
- // lerp the tag
- trap_CM_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
-
- // FIXME: allow origin offsets along tag?
- VectorCopy( parent->origin, entity->origin );
- for ( i = 0 ; i < 3 ; i++ ) {
- VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
- }
-
- // cast away const because of compiler problems
- MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
- MatrixMultiply( lerped.axis, tempAxis, entity->axis );
+static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
+ clipHandle_t parentModel, char *tagName ) {
+ int i;
+ orientation_t lerped;
+ vec3_t tempAxis[3];
+
+ // lerp the tag
+ trap_CM_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
+ 1.0 - parent->backlerp, tagName );
+
+ // FIXME: allow origin offsets along tag?
+ VectorCopy( parent->origin, entity->origin );
+ for ( i = 0 ; i < 3 ; i++ ) {
+ VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
+ }
+
+ // cast away const because of compiler problems
+ MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
+ MatrixMultiply( lerped.axis, tempAxis, entity->axis );
}
@@ -327,19 +327,19 @@ UI_SetLerpFrameAnimation
===============
*/
static void UI_SetLerpFrameAnimation( playerInfo_t *ci, lerpFrame_t *lf, int newAnimation ) {
- animation_t *anim;
+ animation_t *anim;
- lf->animationNumber = newAnimation;
- newAnimation &= ~ANIM_TOGGLEBIT;
+ lf->animationNumber = newAnimation;
+ newAnimation &= ~ANIM_TOGGLEBIT;
- if ( newAnimation < 0 || newAnimation >= MAX_PLAYER_ANIMATIONS ) {
- trap_Error( va("Bad animation number: %i", newAnimation) );
- }
+ if ( newAnimation < 0 || newAnimation >= MAX_PLAYER_ANIMATIONS ) {
+ trap_Error( va("Bad animation number: %i", newAnimation) );
+ }
- anim = &ci->animations[ newAnimation ];
+ anim = &ci->animations[ newAnimation ];
- lf->animation = anim;
- lf->animationTime = lf->frameTime + anim->initialLerp;
+ lf->animation = anim;
+ lf->animationTime = lf->frameTime + anim->initialLerp;
}
@@ -349,59 +349,59 @@ UI_RunLerpFrame
===============
*/
static void UI_RunLerpFrame( playerInfo_t *ci, lerpFrame_t *lf, int newAnimation ) {
- int f;
- animation_t *anim;
-
- // see if the animation sequence is switching
- if ( newAnimation != lf->animationNumber || !lf->animation ) {
- UI_SetLerpFrameAnimation( ci, lf, newAnimation );
- }
-
- // if we have passed the current frame, move it to
- // oldFrame and calculate a new frame
- if ( dp_realtime >= lf->frameTime ) {
- lf->oldFrame = lf->frame;
- lf->oldFrameTime = lf->frameTime;
-
- // get the next frame based on the animation
- anim = lf->animation;
- if ( dp_realtime < lf->animationTime ) {
- lf->frameTime = lf->animationTime; // initial lerp
- } else {
- lf->frameTime = lf->oldFrameTime + anim->frameLerp;
- }
- f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
- if ( f >= anim->numFrames ) {
- f -= anim->numFrames;
- if ( anim->loopFrames ) {
- f %= anim->loopFrames;
- f += anim->numFrames - anim->loopFrames;
- } else {
- f = anim->numFrames - 1;
- // the animation is stuck at the end, so it
- // can immediately transition to another sequence
- lf->frameTime = dp_realtime;
- }
- }
- lf->frame = anim->firstFrame + f;
- if ( dp_realtime > lf->frameTime ) {
- lf->frameTime = dp_realtime;
- }
- }
-
- if ( lf->frameTime > dp_realtime + 200 ) {
- lf->frameTime = dp_realtime;
- }
-
- if ( lf->oldFrameTime > dp_realtime ) {
- lf->oldFrameTime = dp_realtime;
- }
- // calculate current lerp value
- if ( lf->frameTime == lf->oldFrameTime ) {
- lf->backlerp = 0;
- } else {
- lf->backlerp = 1.0 - (float)( dp_realtime - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
- }
+ int f;
+ animation_t *anim;
+
+ // see if the animation sequence is switching
+ if ( newAnimation != lf->animationNumber || !lf->animation ) {
+ UI_SetLerpFrameAnimation( ci, lf, newAnimation );
+ }
+
+ // if we have passed the current frame, move it to
+ // oldFrame and calculate a new frame
+ if ( dp_realtime >= lf->frameTime ) {
+ lf->oldFrame = lf->frame;
+ lf->oldFrameTime = lf->frameTime;
+
+ // get the next frame based on the animation
+ anim = lf->animation;
+ if ( dp_realtime < lf->animationTime ) {
+ lf->frameTime = lf->animationTime; // initial lerp
+ } else {
+ lf->frameTime = lf->oldFrameTime + anim->frameLerp;
+ }
+ f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
+ if ( f >= anim->numFrames ) {
+ f -= anim->numFrames;
+ if ( anim->loopFrames ) {
+ f %= anim->loopFrames;
+ f += anim->numFrames - anim->loopFrames;
+ } else {
+ f = anim->numFrames - 1;
+ // the animation is stuck at the end, so it
+ // can immediately transition to another sequence
+ lf->frameTime = dp_realtime;
+ }
+ }
+ lf->frame = anim->firstFrame + f;
+ if ( dp_realtime > lf->frameTime ) {
+ lf->frameTime = dp_realtime;
+ }
+ }
+
+ if ( lf->frameTime > dp_realtime + 200 ) {
+ lf->frameTime = dp_realtime;
+ }
+
+ if ( lf->oldFrameTime > dp_realtime ) {
+ lf->oldFrameTime = dp_realtime;
+ }
+ // calculate current lerp value
+ if ( lf->frameTime == lf->oldFrameTime ) {
+ lf->backlerp = 0;
+ } else {
+ lf->backlerp = 1.0 - (float)( dp_realtime - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
+ }
}
@@ -411,37 +411,37 @@ UI_PlayerAnimation
===============
*/
static void UI_PlayerAnimation( playerInfo_t *pi, int *legsOld, int *legs, float *legsBackLerp,
- int *torsoOld, int *torso, float *torsoBackLerp ) {
-
- // legs animation
- pi->legsAnimationTimer -= uiInfo.uiDC.frameTime;
- if ( pi->legsAnimationTimer < 0 ) {
- pi->legsAnimationTimer = 0;
- }
-
- UI_LegsSequencing( pi );
-
- if ( pi->legs.yawing && ( pi->legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_IDLE ) {
- UI_RunLerpFrame( pi, &pi->legs, LEGS_TURN );
- } else {
- UI_RunLerpFrame( pi, &pi->legs, pi->legsAnim );
- }
- *legsOld = pi->legs.oldFrame;
- *legs = pi->legs.frame;
- *legsBackLerp = pi->legs.backlerp;
-
- // torso animation
- pi->torsoAnimationTimer -= uiInfo.uiDC.frameTime;
- if ( pi->torsoAnimationTimer < 0 ) {
- pi->torsoAnimationTimer = 0;
- }
-
- UI_TorsoSequencing( pi );
-
- UI_RunLerpFrame( pi, &pi->torso, pi->torsoAnim );
- *torsoOld = pi->torso.oldFrame;
- *torso = pi->torso.frame;
- *torsoBackLerp = pi->torso.backlerp;
+ int *torsoOld, int *torso, float *torsoBackLerp ) {
+
+ // legs animation
+ pi->legsAnimationTimer -= uiInfo.uiDC.frameTime;
+ if ( pi->legsAnimationTimer < 0 ) {
+ pi->legsAnimationTimer = 0;
+ }
+
+ UI_LegsSequencing( pi );
+
+ if ( pi->legs.yawing && ( pi->legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_IDLE ) {
+ UI_RunLerpFrame( pi, &pi->legs, LEGS_TURN );
+ } else {
+ UI_RunLerpFrame( pi, &pi->legs, pi->legsAnim );
+ }
+ *legsOld = pi->legs.oldFrame;
+ *legs = pi->legs.frame;
+ *legsBackLerp = pi->legs.backlerp;
+
+ // torso animation
+ pi->torsoAnimationTimer -= uiInfo.uiDC.frameTime;
+ if ( pi->torsoAnimationTimer < 0 ) {
+ pi->torsoAnimationTimer = 0;
+ }
+
+ UI_TorsoSequencing( pi );
+
+ UI_RunLerpFrame( pi, &pi->torso, pi->torsoAnim );
+ *torsoOld = pi->torso.oldFrame;
+ *torso = pi->torso.frame;
+ *torsoBackLerp = pi->torso.backlerp;
}
@@ -451,59 +451,59 @@ UI_SwingAngles
==================
*/
static void UI_SwingAngles( float destination, float swingTolerance, float clampTolerance,
- float speed, float *angle, qboolean *swinging ) {
- float swing;
- float move;
- float scale;
-
- if ( !*swinging ) {
- // see if a swing should be started
- swing = AngleSubtract( *angle, destination );
- if ( swing > swingTolerance || swing < -swingTolerance ) {
- *swinging = qtrue;
- }
- }
-
- if ( !*swinging ) {
- return;
- }
-
- // modify the speed depending on the delta
- // so it doesn't seem so linear
- swing = AngleSubtract( destination, *angle );
- scale = fabs( swing );
- if ( scale < swingTolerance * 0.5 ) {
- scale = 0.5;
- } else if ( scale < swingTolerance ) {
- scale = 1.0;
- } else {
- scale = 2.0;
- }
-
- // swing towards the destination angle
- if ( swing >= 0 ) {
- move = uiInfo.uiDC.frameTime * scale * speed;
- if ( move >= swing ) {
- move = swing;
- *swinging = qfalse;
- }
- *angle = AngleMod( *angle + move );
- } else if ( swing < 0 ) {
- move = uiInfo.uiDC.frameTime * scale * -speed;
- if ( move <= swing ) {
- move = swing;
- *swinging = qfalse;
- }
- *angle = AngleMod( *angle + move );
- }
-
- // clamp to no more than tolerance
- swing = AngleSubtract( destination, *angle );
- if ( swing > clampTolerance ) {
- *angle = AngleMod( destination - (clampTolerance - 1) );
- } else if ( swing < -clampTolerance ) {
- *angle = AngleMod( destination + (clampTolerance - 1) );
- }
+ float speed, float *angle, qboolean *swinging ) {
+ float swing;
+ float move;
+ float scale;
+
+ if ( !*swinging ) {
+ // see if a swing should be started
+ swing = AngleSubtract( *angle, destination );
+ if ( swing > swingTolerance || swing < -swingTolerance ) {
+ *swinging = qtrue;
+ }
+ }
+
+ if ( !*swinging ) {
+ return;
+ }
+
+ // modify the speed depending on the delta
+ // so it doesn't seem so linear
+ swing = AngleSubtract( destination, *angle );
+ scale = fabs( swing );
+ if ( scale < swingTolerance * 0.5 ) {
+ scale = 0.5;
+ } else if ( scale < swingTolerance ) {
+ scale = 1.0;
+ } else {
+ scale = 2.0;
+ }
+
+ // swing towards the destination angle
+ if ( swing >= 0 ) {
+ move = uiInfo.uiDC.frameTime * scale * speed;
+ if ( move >= swing ) {
+ move = swing;
+ *swinging = qfalse;
+ }
+ *angle = AngleMod( *angle + move );
+ } else if ( swing < 0 ) {
+ move = uiInfo.uiDC.frameTime * scale * -speed;
+ if ( move <= swing ) {
+ move = swing;
+ *swinging = qfalse;
+ }
+ *angle = AngleMod( *angle + move );
+ }
+
+ // clamp to no more than tolerance
+ swing = AngleSubtract( destination, *angle );
+ if ( swing > clampTolerance ) {
+ *angle = AngleMod( destination - (clampTolerance - 1) );
+ } else if ( swing < -clampTolerance ) {
+ *angle = AngleMod( destination + (clampTolerance - 1) );
+ }
}
@@ -513,41 +513,41 @@ UI_MovedirAdjustment
======================
*/
static float UI_MovedirAdjustment( playerInfo_t *pi ) {
- vec3_t relativeAngles;
- vec3_t moveVector;
-
- VectorSubtract( pi->viewAngles, pi->moveAngles, relativeAngles );
- AngleVectors( relativeAngles, moveVector, NULL, NULL );
- if ( Q_fabs( moveVector[0] ) < 0.01 ) {
- moveVector[0] = 0.0;
- }
- if ( Q_fabs( moveVector[1] ) < 0.01 ) {
- moveVector[1] = 0.0;
- }
-
- if ( moveVector[1] == 0 && moveVector[0] > 0 ) {
- return 0;
- }
- if ( moveVector[1] < 0 && moveVector[0] > 0 ) {
- return 22;
- }
- if ( moveVector[1] < 0 && moveVector[0] == 0 ) {
- return 45;
- }
- if ( moveVector[1] < 0 && moveVector[0] < 0 ) {
- return -22;
- }
- if ( moveVector[1] == 0 && moveVector[0] < 0 ) {
- return 0;
- }
- if ( moveVector[1] > 0 && moveVector[0] < 0 ) {
- return 22;
- }
- if ( moveVector[1] > 0 && moveVector[0] == 0 ) {
- return -45;
- }
-
- return -22;
+ vec3_t relativeAngles;
+ vec3_t moveVector;
+
+ VectorSubtract( pi->viewAngles, pi->moveAngles, relativeAngles );
+ AngleVectors( relativeAngles, moveVector, NULL, NULL );
+ if ( Q_fabs( moveVector[0] ) < 0.01 ) {
+ moveVector[0] = 0.0;
+ }
+ if ( Q_fabs( moveVector[1] ) < 0.01 ) {
+ moveVector[1] = 0.0;
+ }
+
+ if ( moveVector[1] == 0 && moveVector[0] > 0 ) {
+ return 0;
+ }
+ if ( moveVector[1] < 0 && moveVector[0] > 0 ) {
+ return 22;
+ }
+ if ( moveVector[1] < 0 && moveVector[0] == 0 ) {
+ return 45;
+ }
+ if ( moveVector[1] < 0 && moveVector[0] < 0 ) {
+ return -22;
+ }
+ if ( moveVector[1] == 0 && moveVector[0] < 0 ) {
+ return 0;
+ }
+ if ( moveVector[1] > 0 && moveVector[0] < 0 ) {
+ return 22;
+ }
+ if ( moveVector[1] > 0 && moveVector[0] == 0 ) {
+ return -45;
+ }
+
+ return -22;
}
@@ -557,56 +557,56 @@ UI_PlayerAngles
===============
*/
static void UI_PlayerAngles( playerInfo_t *pi, vec3_t legs[3], vec3_t torso[3], vec3_t head[3] ) {
- vec3_t legsAngles, torsoAngles, headAngles;
- float dest;
- float adjust;
-
- VectorCopy( pi->viewAngles, headAngles );
- headAngles[YAW] = AngleMod( headAngles[YAW] );
- VectorClear( legsAngles );
- VectorClear( torsoAngles );
-
- // --------- yaw -------------
-
- // allow yaw to drift a bit
- if ( ( pi->legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE
- || ( pi->torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND ) {
- // if not standing still, always point all in the same direction
- pi->torso.yawing = qtrue; // always center
- pi->torso.pitching = qtrue; // always center
- pi->legs.yawing = qtrue; // always center
- }
-
- // adjust legs for movement dir
- adjust = UI_MovedirAdjustment( pi );
- legsAngles[YAW] = headAngles[YAW] + adjust;
- torsoAngles[YAW] = headAngles[YAW] + 0.25 * adjust;
-
-
- // torso
- UI_SwingAngles( torsoAngles[YAW], 25, 90, SWINGSPEED, &pi->torso.yawAngle, &pi->torso.yawing );
- UI_SwingAngles( legsAngles[YAW], 40, 90, SWINGSPEED, &pi->legs.yawAngle, &pi->legs.yawing );
-
- torsoAngles[YAW] = pi->torso.yawAngle;
- legsAngles[YAW] = pi->legs.yawAngle;
-
- // --------- pitch -------------
-
- // only show a fraction of the pitch angle in the torso
- if ( headAngles[PITCH] > 180 ) {
- dest = (-360 + headAngles[PITCH]) * 0.75;
- } else {
- dest = headAngles[PITCH] * 0.75;
- }
- UI_SwingAngles( dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching );
- torsoAngles[PITCH] = pi->torso.pitchAngle;
-
- // pull the angles back out of the hierarchial chain
- AnglesSubtract( headAngles, torsoAngles, headAngles );
- AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
- AnglesToAxis( legsAngles, legs );
- AnglesToAxis( torsoAngles, torso );
- AnglesToAxis( headAngles, head );
+ vec3_t legsAngles, torsoAngles, headAngles;
+ float dest;
+ float adjust;
+
+ VectorCopy( pi->viewAngles, headAngles );
+ headAngles[YAW] = AngleMod( headAngles[YAW] );
+ VectorClear( legsAngles );
+ VectorClear( torsoAngles );
+
+ // --------- yaw -------------
+
+ // allow yaw to drift a bit
+ if ( ( pi->legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE
+ || ( pi->torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND ) {
+ // if not standing still, always point all in the same direction
+ pi->torso.yawing = qtrue; // always center
+ pi->torso.pitching = qtrue; // always center
+ pi->legs.yawing = qtrue; // always center
+ }
+
+ // adjust legs for movement dir
+ adjust = UI_MovedirAdjustment( pi );
+ legsAngles[YAW] = headAngles[YAW] + adjust;
+ torsoAngles[YAW] = headAngles[YAW] + 0.25 * adjust;
+
+
+ // torso
+ UI_SwingAngles( torsoAngles[YAW], 25, 90, SWINGSPEED, &pi->torso.yawAngle, &pi->torso.yawing );
+ UI_SwingAngles( legsAngles[YAW], 40, 90, SWINGSPEED, &pi->legs.yawAngle, &pi->legs.yawing );
+
+ torsoAngles[YAW] = pi->torso.yawAngle;
+ legsAngles[YAW] = pi->legs.yawAngle;
+
+ // --------- pitch -------------
+
+ // only show a fraction of the pitch angle in the torso
+ if ( headAngles[PITCH] > 180 ) {
+ dest = (-360 + headAngles[PITCH]) * 0.75;
+ } else {
+ dest = headAngles[PITCH] * 0.75;
+ }
+ UI_SwingAngles( dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching );
+ torsoAngles[PITCH] = pi->torso.pitchAngle;
+
+ // pull the angles back out of the hierarchial chain
+ AnglesSubtract( headAngles, torsoAngles, headAngles );
+ AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
+ AnglesToAxis( legsAngles, legs );
+ AnglesToAxis( torsoAngles, torso );
+ AnglesToAxis( headAngles, head );
}
@@ -616,16 +616,16 @@ UI_PlayerFloatSprite
===============
*/
static void UI_PlayerFloatSprite( playerInfo_t *pi, vec3_t origin, qhandle_t shader ) {
- refEntity_t ent;
-
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( origin, ent.origin );
- ent.origin[2] += 48;
- ent.reType = RT_SPRITE;
- ent.customShader = shader;
- ent.radius = 10;
- ent.renderfx = 0;
- trap_R_AddRefEntityToScene( &ent );
+ refEntity_t ent;
+
+ memset( &ent, 0, sizeof( ent ) );
+ VectorCopy( origin, ent.origin );
+ ent.origin[2] += 48;
+ ent.reType = RT_SPRITE;
+ ent.customShader = shader;
+ ent.radius = 10;
+ ent.renderfx = 0;
+ trap_R_AddRefEntityToScene( &ent );
}
@@ -634,35 +634,35 @@ static void UI_PlayerFloatSprite( playerInfo_t *pi, vec3_t origin, qhandle_t sha
UI_MachinegunSpinAngle
======================
*/
-float UI_MachinegunSpinAngle( playerInfo_t *pi ) {
- int delta;
- float angle;
- float speed;
- int torsoAnim;
-
- delta = dp_realtime - pi->barrelTime;
- if ( pi->barrelSpinning ) {
- angle = pi->barrelAngle + delta * SPIN_SPEED;
- } else {
- if ( delta > COAST_TIME ) {
- delta = COAST_TIME;
- }
-
- speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
- angle = pi->barrelAngle + delta * speed;
- }
-
- torsoAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
- if( torsoAnim == TORSO_ATTACK2 ) {
- torsoAnim = TORSO_ATTACK;
- }
- if ( pi->barrelSpinning == !(torsoAnim == TORSO_ATTACK) ) {
- pi->barrelTime = dp_realtime;
- pi->barrelAngle = AngleMod( angle );
- pi->barrelSpinning = !!(torsoAnim == TORSO_ATTACK);
- }
-
- return angle;
+float UI_MachinegunSpinAngle( playerInfo_t *pi ) {
+ int delta;
+ float angle;
+ float speed;
+ int torsoAnim;
+
+ delta = dp_realtime - pi->barrelTime;
+ if ( pi->barrelSpinning ) {
+ angle = pi->barrelAngle + delta * SPIN_SPEED;
+ } else {
+ if ( delta > COAST_TIME ) {
+ delta = COAST_TIME;
+ }
+
+ speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
+ angle = pi->barrelAngle + delta * speed;
+ }
+
+ torsoAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
+ if( torsoAnim == TORSO_ATTACK2 ) {
+ torsoAnim = TORSO_ATTACK;
+ }
+ if ( pi->barrelSpinning == !(torsoAnim == TORSO_ATTACK) ) {
+ pi->barrelTime = dp_realtime;
+ pi->barrelAngle = AngleMod( angle );
+ pi->barrelSpinning = !!(torsoAnim == TORSO_ATTACK);
+ }
+
+ return angle;
}
@@ -672,214 +672,214 @@ UI_DrawPlayer
===============
*/
void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time ) {
- refdef_t refdef;
- refEntity_t legs;
- refEntity_t torso;
- refEntity_t head;
- refEntity_t gun;
- refEntity_t barrel;
- refEntity_t flash;
- vec3_t origin;
- int renderfx;
- vec3_t mins = {-16, -16, -24};
- vec3_t maxs = {16, 16, 32};
- float len;
- float xx;
+ refdef_t refdef;
+ refEntity_t legs;
+ refEntity_t torso;
+ refEntity_t head;
+ refEntity_t gun;
+ refEntity_t barrel;
+ refEntity_t flash;
+ vec3_t origin;
+ int renderfx;
+ vec3_t mins = {-16, -16, -24};
+ vec3_t maxs = {16, 16, 32};
+ float len;
+ float xx;
- if ( !pi->legsModel || !pi->torsoModel || !pi->headModel || !pi->animations[0].numFrames ) {
- return;
- }
-
- // this allows the ui to cache the player model on the main menu
- if (w == 0 || h == 0) {
- return;
- }
-
- dp_realtime = time;
-
- if ( pi->pendingWeapon != -1 && dp_realtime > pi->weaponTimer ) {
- pi->weapon = pi->pendingWeapon;
- pi->lastWeapon = pi->pendingWeapon;
- pi->pendingWeapon = -1;
- pi->weaponTimer = 0;
- if( pi->currentWeapon != pi->weapon ) {
- trap_S_StartLocalSound( weaponChangeSound, CHAN_LOCAL );
- }
- }
+ if ( !pi->legsModel || !pi->torsoModel || !pi->headModel || !pi->animations[0].numFrames ) {
+ return;
+ }
- UI_AdjustFrom640( &x, &y, &w, &h );
-
- y -= jumpHeight;
-
- memset( &refdef, 0, sizeof( refdef ) );
- memset( &legs, 0, sizeof(legs) );
- memset( &torso, 0, sizeof(torso) );
- memset( &head, 0, sizeof(head) );
-
- refdef.rdflags = RDF_NOWORLDMODEL;
-
- AxisClear( refdef.viewaxis );
-
- refdef.x = x;
- refdef.y = y;
- refdef.width = w;
- refdef.height = h;
-
- refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
- xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
- refdef.fov_y = atan2( refdef.height, xx );
- refdef.fov_y *= ( 360 / (float)M_PI );
-
- // calculate distance so the player nearly fills the box
- len = 0.7 * ( maxs[2] - mins[2] );
- origin[0] = len / tan( DEG2RAD(refdef.fov_x) * 0.5 );
- origin[1] = 0.5 * ( mins[1] + maxs[1] );
- origin[2] = -0.5 * ( mins[2] + maxs[2] );
-
- refdef.time = dp_realtime;
-
- trap_R_ClearScene();
-
- // get the rotation information
- UI_PlayerAngles( pi, legs.axis, torso.axis, head.axis );
-
- // get the animation state (after rotation, to allow feet shuffle)
- UI_PlayerAnimation( pi, &legs.oldframe, &legs.frame, &legs.backlerp,
- &torso.oldframe, &torso.frame, &torso.backlerp );
-
- renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
-
- //
- // add the legs
- //
- legs.hModel = pi->legsModel;
- legs.customSkin = pi->legsSkin;
-
- VectorCopy( origin, legs.origin );
-
- VectorCopy( origin, legs.lightingOrigin );
- legs.renderfx = renderfx;
- VectorCopy (legs.origin, legs.oldorigin);
-
- trap_R_AddRefEntityToScene( &legs );
-
- if (!legs.hModel) {
- return;
- }
-
- //
- // add the torso
- //
- torso.hModel = pi->torsoModel;
- if (!torso.hModel) {
- return;
- }
-
- torso.customSkin = pi->torsoSkin;
-
- VectorCopy( origin, torso.lightingOrigin );
-
- UI_PositionRotatedEntityOnTag( &torso, &legs, pi->legsModel, "tag_torso");
-
- torso.renderfx = renderfx;
-
- trap_R_AddRefEntityToScene( &torso );
-
- //
- // add the head
- //
- head.hModel = pi->headModel;
- if (!head.hModel) {
- return;
- }
- head.customSkin = pi->headSkin;
-
- VectorCopy( origin, head.lightingOrigin );
-
- UI_PositionRotatedEntityOnTag( &head, &torso, pi->torsoModel, "tag_head");
-
- head.renderfx = renderfx;
-
- trap_R_AddRefEntityToScene( &head );
-
- //
- // add the gun
- //
- if ( pi->currentWeapon != WP_NONE ) {
- memset( &gun, 0, sizeof(gun) );
- gun.hModel = pi->weaponModel;
- VectorCopy( origin, gun.lightingOrigin );
- UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");
- gun.renderfx = renderfx;
- trap_R_AddRefEntityToScene( &gun );
- }
-
- //
- // add the spinning barrel
- //
- if ( pi->realWeapon == WP_MACHINEGUN ) {
- vec3_t angles;
-
- memset( &barrel, 0, sizeof(barrel) );
- VectorCopy( origin, barrel.lightingOrigin );
- barrel.renderfx = renderfx;
-
- barrel.hModel = pi->barrelModel;
- angles[YAW] = 0;
- angles[PITCH] = 0;
- angles[ROLL] = UI_MachinegunSpinAngle( pi );
-/* if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
- angles[PITCH] = angles[ROLL];
- angles[ROLL] = 0;
- }*/
- AnglesToAxis( angles, barrel.axis );
-
- UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");
-
- trap_R_AddRefEntityToScene( &barrel );
- }
-
- //
- // add muzzle flash
- //
- if ( dp_realtime <= pi->muzzleFlashTime ) {
- if ( pi->flashModel ) {
- memset( &flash, 0, sizeof(flash) );
- flash.hModel = pi->flashModel;
- VectorCopy( origin, flash.lightingOrigin );
- UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");
- flash.renderfx = renderfx;
- trap_R_AddRefEntityToScene( &flash );
- }
-
- // make a dlight for the flash
- if ( pi->flashDlightColor[0] || pi->flashDlightColor[1] || pi->flashDlightColor[2] ) {
- trap_R_AddLightToScene( flash.origin, 200 + (rand()&31), pi->flashDlightColor[0],
- pi->flashDlightColor[1], pi->flashDlightColor[2] );
- }
- }
-
- //
- // add the chat icon
- //
- if ( pi->chat ) {
- UI_PlayerFloatSprite( pi, origin, trap_R_RegisterShaderNoMip( "sprites/balloon3" ) );
- }
-
- //
- // add an accent light
- //
- origin[0] -= 100; // + = behind, - = in front
- origin[1] += 100; // + = left, - = right
- origin[2] += 100; // + = above, - = below
- trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 1.0 );
-
- origin[0] -= 100;
- origin[1] -= 100;
- origin[2] -= 100;
- trap_R_AddLightToScene( origin, 500, 1.0, 0.0, 0.0 );
-
- trap_R_RenderScene( &refdef );
+ // this allows the ui to cache the player model on the main menu
+ if (w == 0 || h == 0) {
+ return;
+ }
+
+ dp_realtime = time;
+
+ if ( pi->pendingWeapon != -1 && dp_realtime > pi->weaponTimer ) {
+ pi->weapon = pi->pendingWeapon;
+ pi->lastWeapon = pi->pendingWeapon;
+ pi->pendingWeapon = -1;
+ pi->weaponTimer = 0;
+ if( pi->currentWeapon != pi->weapon ) {
+ trap_S_StartLocalSound( weaponChangeSound, CHAN_LOCAL );
+ }
+ }
+
+ UI_AdjustFrom640( &x, &y, &w, &h );
+
+ y -= jumpHeight;
+
+ memset( &refdef, 0, sizeof( refdef ) );
+ memset( &legs, 0, sizeof(legs) );
+ memset( &torso, 0, sizeof(torso) );
+ memset( &head, 0, sizeof(head) );
+
+ refdef.rdflags = RDF_NOWORLDMODEL;
+
+ AxisClear( refdef.viewaxis );
+
+ refdef.x = x;
+ refdef.y = y;
+ refdef.width = w;
+ refdef.height = h;
+
+ refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
+ xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
+ refdef.fov_y = atan2( refdef.height, xx );
+ refdef.fov_y *= ( 360 / (float)M_PI );
+
+ // calculate distance so the player nearly fills the box
+ len = 0.7 * ( maxs[2] - mins[2] );
+ origin[0] = len / tan( DEG2RAD(refdef.fov_x) * 0.5 );
+ origin[1] = 0.5 * ( mins[1] + maxs[1] );
+ origin[2] = -0.5 * ( mins[2] + maxs[2] );
+
+ refdef.time = dp_realtime;
+
+ trap_R_ClearScene();
+
+ // get the rotation information
+ UI_PlayerAngles( pi, legs.axis, torso.axis, head.axis );
+
+ // get the animation state (after rotation, to allow feet shuffle)
+ UI_PlayerAnimation( pi, &legs.oldframe, &legs.frame, &legs.backlerp,
+ &torso.oldframe, &torso.frame, &torso.backlerp );
+
+ renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
+
+ //
+ // add the legs
+ //
+ legs.hModel = pi->legsModel;
+ legs.customSkin = pi->legsSkin;
+
+ VectorCopy( origin, legs.origin );
+
+ VectorCopy( origin, legs.lightingOrigin );
+ legs.renderfx = renderfx;
+ VectorCopy (legs.origin, legs.oldorigin);
+
+ trap_R_AddRefEntityToScene( &legs );
+
+ if (!legs.hModel) {
+ return;
+ }
+
+ //
+ // add the torso
+ //
+ torso.hModel = pi->torsoModel;
+ if (!torso.hModel) {
+ return;
+ }
+
+ torso.customSkin = pi->torsoSkin;
+
+ VectorCopy( origin, torso.lightingOrigin );
+
+ UI_PositionRotatedEntityOnTag( &torso, &legs, pi->legsModel, "tag_torso");
+
+ torso.renderfx = renderfx;
+
+ trap_R_AddRefEntityToScene( &torso );
+
+ //
+ // add the head
+ //
+ head.hModel = pi->headModel;
+ if (!head.hModel) {
+ return;
+ }
+ head.customSkin = pi->headSkin;
+
+ VectorCopy( origin, head.lightingOrigin );
+
+ UI_PositionRotatedEntityOnTag( &head, &torso, pi->torsoModel, "tag_head");
+
+ head.renderfx = renderfx;
+
+ trap_R_AddRefEntityToScene( &head );
+
+ //
+ // add the gun
+ //
+ if ( pi->currentWeapon != WP_NONE ) {
+ memset( &gun, 0, sizeof(gun) );
+ gun.hModel = pi->weaponModel;
+ VectorCopy( origin, gun.lightingOrigin );
+ UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");
+ gun.renderfx = renderfx;
+ trap_R_AddRefEntityToScene( &gun );
+ }
+
+ //
+ // add the spinning barrel
+ //
+ if ( pi->realWeapon == WP_MACHINEGUN ) {
+ vec3_t angles;
+
+ memset( &barrel, 0, sizeof(barrel) );
+ VectorCopy( origin, barrel.lightingOrigin );
+ barrel.renderfx = renderfx;
+
+ barrel.hModel = pi->barrelModel;
+ angles[YAW] = 0;
+ angles[PITCH] = 0;
+ angles[ROLL] = UI_MachinegunSpinAngle( pi );
+/* if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
+ angles[PITCH] = angles[ROLL];
+ angles[ROLL] = 0;
+ }*/
+ AnglesToAxis( angles, barrel.axis );
+
+ UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");
+
+ trap_R_AddRefEntityToScene( &barrel );
+ }
+
+ //
+ // add muzzle flash
+ //
+ if ( dp_realtime <= pi->muzzleFlashTime ) {
+ if ( pi->flashModel ) {
+ memset( &flash, 0, sizeof(flash) );
+ flash.hModel = pi->flashModel;
+ VectorCopy( origin, flash.lightingOrigin );
+ UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");
+ flash.renderfx = renderfx;
+ trap_R_AddRefEntityToScene( &flash );
+ }
+
+ // make a dlight for the flash
+ if ( pi->flashDlightColor[0] || pi->flashDlightColor[1] || pi->flashDlightColor[2] ) {
+ trap_R_AddLightToScene( flash.origin, 200 + (rand()&31), pi->flashDlightColor[0],
+ pi->flashDlightColor[1], pi->flashDlightColor[2] );
+ }
+ }
+
+ //
+ // add the chat icon
+ //
+ if ( pi->chat ) {
+ UI_PlayerFloatSprite( pi, origin, trap_R_RegisterShaderNoMip( "sprites/balloon3" ) );
+ }
+
+ //
+ // add an accent light
+ //
+ origin[0] -= 100; // + = behind, - = in front
+ origin[1] += 100; // + = left, - = right
+ origin[2] += 100; // + = above, - = below
+ trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 1.0 );
+
+ origin[0] -= 100;
+ origin[1] -= 100;
+ origin[2] -= 100;
+ trap_R_AddLightToScene( origin, 500, 1.0, 0.0, 0.0 );
+
+ trap_R_RenderScene( &refdef );
}
/*
@@ -887,14 +887,14 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
UI_FileExists
==========================
*/
-static qboolean UI_FileExists(const char *filename) {
- int len;
-
- len = trap_FS_FOpenFile( filename, 0, FS_READ );
- if (len>0) {
- return qtrue;
- }
- return qfalse;
+static qboolean UI_FileExists(const char *filename) {
+ int len;
+
+ len = trap_FS_FOpenFile( filename, 0, FS_READ );
+ if (len>0) {
+ return qtrue;
+ }
+ return qfalse;
}
/*
@@ -902,51 +902,51 @@ static qboolean UI_FileExists(const char *filename) {
UI_FindClientHeadFile
==========================
*/
-static qboolean UI_FindClientHeadFile( char *filename, int length, const char *teamName, const char *headModelName, const char *headSkinName, const char *base, const char *ext ) {
- char *team, *headsFolder;
- int i;
-
- team = "default";
-
- if ( headModelName[0] == '*' ) {
- headsFolder = "heads/";
- headModelName++;
- }
- else {
- headsFolder = "";
- }
- while(1) {
- for ( i = 0; i < 2; i++ ) {
- if ( i == 0 && teamName && *teamName ) {
- Com_sprintf( filename, length, "models/players/%s%s/%s/%s%s_%s.%s", headsFolder, headModelName, headSkinName, teamName, base, team, ext );
- }
- else {
- Com_sprintf( filename, length, "models/players/%s%s/%s/%s_%s.%s", headsFolder, headModelName, headSkinName, base, team, ext );
- }
- if ( UI_FileExists( filename ) ) {
- return qtrue;
- }
- if ( i == 0 && teamName && *teamName ) {
- Com_sprintf( filename, length, "models/players/%s%s/%s%s_%s.%s", headsFolder, headModelName, teamName, base, headSkinName, ext );
- }
- else {
- Com_sprintf( filename, length, "models/players/%s%s/%s_%s.%s", headsFolder, headModelName, base, headSkinName, ext );
- }
- if ( UI_FileExists( filename ) ) {
- return qtrue;
- }
- if ( !teamName || !*teamName ) {
- break;
- }
- }
- // if tried the heads folder first
- if ( headsFolder[0] ) {
- break;
- }
- headsFolder = "heads/";
- }
-
- return qfalse;
+static qboolean UI_FindClientHeadFile( char *filename, int length, const char *teamName, const char *headModelName, const char *headSkinName, const char *base, const char *ext ) {
+ char *team, *headsFolder;
+ int i;
+
+ team = "default";
+
+ if ( headModelName[0] == '*' ) {
+ headsFolder = "heads/";
+ headModelName++;
+ }
+ else {
+ headsFolder = "";
+ }
+ while(1) {
+ for ( i = 0; i < 2; i++ ) {
+ if ( i == 0 && teamName && *teamName ) {
+ Com_sprintf( filename, length, "models/players/%s%s/%s/%s%s_%s.%s", headsFolder, headModelName, headSkinName, teamName, base, team, ext );
+ }
+ else {
+ Com_sprintf( filename, length, "models/players/%s%s/%s/%s_%s.%s", headsFolder, headModelName, headSkinName, base, team, ext );
+ }
+ if ( UI_FileExists( filename ) ) {
+ return qtrue;
+ }
+ if ( i == 0 && teamName && *teamName ) {
+ Com_sprintf( filename, length, "models/players/%s%s/%s%s_%s.%s", headsFolder, headModelName, teamName, base, headSkinName, ext );
+ }
+ else {
+ Com_sprintf( filename, length, "models/players/%s%s/%s_%s.%s", headsFolder, headModelName, base, headSkinName, ext );
+ }
+ if ( UI_FileExists( filename ) ) {
+ return qtrue;
+ }
+ if ( !teamName || !*teamName ) {
+ break;
+ }
+ }
+ // if tried the heads folder first
+ if ( headsFolder[0] ) {
+ break;
+ }
+ headsFolder = "heads/";
+ }
+
+ return qfalse;
}
/*
@@ -954,48 +954,48 @@ static qboolean UI_FindClientHeadFile( char *filename, int length, const char *t
UI_RegisterClientSkin
==========================
*/
-static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName , const char *teamName) {
- char filename[MAX_QPATH*2];
-
- if (teamName && *teamName) {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/lower_%s.skin", modelName, teamName, skinName );
- } else {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName );
- }
- pi->legsSkin = trap_R_RegisterSkin( filename );
- if (!pi->legsSkin) {
- if (teamName && *teamName) {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/lower_%s.skin", modelName, teamName, skinName );
- } else {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower_%s.skin", modelName, skinName );
- }
- pi->legsSkin = trap_R_RegisterSkin( filename );
- }
-
- if (teamName && *teamName) {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/upper_%s.skin", modelName, teamName, skinName );
- } else {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName );
- }
- pi->torsoSkin = trap_R_RegisterSkin( filename );
- if (!pi->torsoSkin) {
- if (teamName && *teamName) {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/upper_%s.skin", modelName, teamName, skinName );
- } else {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper_%s.skin", modelName, skinName );
- }
- pi->torsoSkin = trap_R_RegisterSkin( filename );
- }
-
- if ( UI_FindClientHeadFile( filename, sizeof(filename), teamName, headModelName, headSkinName, "head", "skin" ) ) {
- pi->headSkin = trap_R_RegisterSkin( filename );
- }
-
- if ( !pi->legsSkin || !pi->torsoSkin || !pi->headSkin ) {
- return qfalse;
- }
-
- return qtrue;
+static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName , const char *teamName) {
+ char filename[MAX_QPATH*2];
+
+ if (teamName && *teamName) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/lower_%s.skin", modelName, teamName, skinName );
+ } else {
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName );
+ }
+ pi->legsSkin = trap_R_RegisterSkin( filename );
+ if (!pi->legsSkin) {
+ if (teamName && *teamName) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/lower_%s.skin", modelName, teamName, skinName );
+ } else {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower_%s.skin", modelName, skinName );
+ }
+ pi->legsSkin = trap_R_RegisterSkin( filename );
+ }
+
+ if (teamName && *teamName) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/upper_%s.skin", modelName, teamName, skinName );
+ } else {
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName );
+ }
+ pi->torsoSkin = trap_R_RegisterSkin( filename );
+ if (!pi->torsoSkin) {
+ if (teamName && *teamName) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/upper_%s.skin", modelName, teamName, skinName );
+ } else {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper_%s.skin", modelName, skinName );
+ }
+ pi->torsoSkin = trap_R_RegisterSkin( filename );
+ }
+
+ if ( UI_FindClientHeadFile( filename, sizeof(filename), teamName, headModelName, headSkinName, "head", "skin" ) ) {
+ pi->headSkin = trap_R_RegisterSkin( filename );
+ }
+
+ if ( !pi->legsSkin || !pi->torsoSkin || !pi->headSkin ) {
+ return qfalse;
+ }
+
+ return qtrue;
}
@@ -1005,120 +1005,120 @@ UI_ParseAnimationFile
======================
*/
static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animations ) {
- char *text_p, *prev;
- int len;
- int i;
- char *token;
- float fps;
- int skip;
- char text[20000];
- fileHandle_t f;
-
- memset( animations, 0, sizeof( animation_t ) * MAX_PLAYER_ANIMATIONS );
-
- // load the file
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if ( len <= 0 ) {
- return qfalse;
- }
- if ( len >= ( sizeof( text ) - 1 ) ) {
- Com_Printf( "File %s too long\n", filename );
- return qfalse;
- }
- trap_FS_Read( text, len, f );
- text[len] = 0;
- trap_FS_FCloseFile( f );
-
- COM_Compress(text);
-
- // parse the text
- text_p = text;
- skip = 0; // quite the compiler warning
-
- // read optional parameters
- while ( 1 ) {
- prev = text_p; // so we can unget
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- if ( !Q_stricmp( token, "footsteps" ) ) {
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- continue;
- } else if ( !Q_stricmp( token, "headoffset" ) ) {
- for ( i = 0 ; i < 3 ; i++ ) {
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- }
- continue;
- } else if ( !Q_stricmp( token, "sex" ) ) {
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- continue;
- }
-
- // if it is a number, start parsing animations
- if ( token[0] >= '0' && token[0] <= '9' ) {
- text_p = prev; // unget the token
- break;
- }
-
- Com_Printf( "unknown token '%s' is %s\n", token, filename );
- }
-
- // read information for each frame
- for ( i = 0 ; i < MAX_PLAYER_ANIMATIONS ; i++ ) {
-
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- animations[i].firstFrame = atoi( token );
- // leg only frames are adjusted to not count the upper body only frames
- if ( i == LEGS_WALKCR ) {
- skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
- }
- if ( i >= LEGS_WALKCR ) {
- animations[i].firstFrame -= skip;
- }
-
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- animations[i].numFrames = atoi( token );
-
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- animations[i].loopFrames = atoi( token );
-
- token = COM_Parse( &text_p );
- if ( !token ) {
- break;
- }
- fps = atof( token );
- if ( fps == 0 ) {
- fps = 1;
- }
- animations[i].frameLerp = 1000 / fps;
- animations[i].initialLerp = 1000 / fps;
- }
-
- if ( i != MAX_PLAYER_ANIMATIONS ) {
- Com_Printf( "Error parsing animation file: %s", filename );
- return qfalse;
- }
-
- return qtrue;
+ char *text_p, *prev;
+ int len;
+ int i;
+ char *token;
+ float fps;
+ int skip;
+ char text[20000];
+ fileHandle_t f;
+
+ memset( animations, 0, sizeof( animation_t ) * MAX_PLAYER_ANIMATIONS );
+
+ // load the file
+ len = trap_FS_FOpenFile( filename, &f, FS_READ );
+ if ( len <= 0 ) {
+ return qfalse;
+ }
+ if ( len >= ( sizeof( text ) - 1 ) ) {
+ Com_Printf( "File %s too long\n", filename );
+ return qfalse;
+ }
+ trap_FS_Read( text, len, f );
+ text[len] = 0;
+ trap_FS_FCloseFile( f );
+
+ COM_Compress(text);
+
+ // parse the text
+ text_p = text;
+ skip = 0; // quite the compiler warning
+
+ // read optional parameters
+ while ( 1 ) {
+ prev = text_p; // so we can unget
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ if ( !Q_stricmp( token, "footsteps" ) ) {
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ continue;
+ } else if ( !Q_stricmp( token, "headoffset" ) ) {
+ for ( i = 0 ; i < 3 ; i++ ) {
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ }
+ continue;
+ } else if ( !Q_stricmp( token, "sex" ) ) {
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ continue;
+ }
+
+ // if it is a number, start parsing animations
+ if ( token[0] >= '0' && token[0] <= '9' ) {
+ text_p = prev; // unget the token
+ break;
+ }
+
+ Com_Printf( "unknown token '%s' is %s\n", token, filename );
+ }
+
+ // read information for each frame
+ for ( i = 0 ; i < MAX_PLAYER_ANIMATIONS ; i++ ) {
+
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ animations[i].firstFrame = atoi( token );
+ // leg only frames are adjusted to not count the upper body only frames
+ if ( i == LEGS_WALKCR ) {
+ skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
+ }
+ if ( i >= LEGS_WALKCR ) {
+ animations[i].firstFrame -= skip;
+ }
+
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ animations[i].numFrames = atoi( token );
+
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ animations[i].loopFrames = atoi( token );
+
+ token = COM_Parse( &text_p );
+ if ( !token ) {
+ break;
+ }
+ fps = atof( token );
+ if ( fps == 0 ) {
+ fps = 1;
+ }
+ animations[i].frameLerp = 1000 / fps;
+ animations[i].initialLerp = 1000 / fps;
+ }
+
+ if ( i != MAX_PLAYER_ANIMATIONS ) {
+ Com_Printf( "Error parsing animation file: %s", filename );
+ return qfalse;
+ }
+
+ return qtrue;
}
/*
@@ -1127,101 +1127,101 @@ UI_RegisterClientModelname
==========================
*/
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName, const char *headModelSkinName, const char *teamName ) {
- char modelName[MAX_QPATH];
- char skinName[MAX_QPATH];
- char headModelName[MAX_QPATH];
- char headSkinName[MAX_QPATH];
- char filename[MAX_QPATH];
- char *slash;
-
- pi->torsoModel = 0;
- pi->headModel = 0;
-
- if ( !modelSkinName[0] ) {
- return qfalse;
- }
-
- Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );
-
- slash = strchr( modelName, '/' );
- if ( !slash ) {
- // modelName did not include a skin name
- Q_strncpyz( skinName, "default", sizeof( skinName ) );
- } else {
- Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
- *slash = '\0';
- }
-
- Q_strncpyz( headModelName, headModelSkinName, sizeof( headModelName ) );
- slash = strchr( headModelName, '/' );
- if ( !slash ) {
- // modelName did not include a skin name
- Q_strncpyz( headSkinName, "default", sizeof( skinName ) );
- } else {
- Q_strncpyz( headSkinName, slash + 1, sizeof( skinName ) );
- *slash = '\0';
- }
-
- // load cmodels before models so filecache works
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
- pi->legsModel = trap_R_RegisterModel( filename );
- if ( !pi->legsModel ) {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower.md3", modelName );
- pi->legsModel = trap_R_RegisterModel( filename );
- if ( !pi->legsModel ) {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
- }
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
- pi->torsoModel = trap_R_RegisterModel( filename );
- if ( !pi->torsoModel ) {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper.md3", modelName );
- pi->torsoModel = trap_R_RegisterModel( filename );
- if ( !pi->torsoModel ) {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
- }
-
- if (headModelName && headModelName[0] == '*' ) {
- Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] );
- }
- else {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
- }
- pi->headModel = trap_R_RegisterModel( filename );
- if ( !pi->headModel && headModelName[0] != '*') {
- Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headModelName, headModelName );
- pi->headModel = trap_R_RegisterModel( filename );
- }
-
- if (!pi->headModel) {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
-
- // if any skins failed to load, fall back to default
- if ( !UI_RegisterClientSkin( pi, modelName, skinName, headModelName, headSkinName, teamName) ) {
- if ( !UI_RegisterClientSkin( pi, modelName, "default", headModelName, "default", teamName ) ) {
- Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
- return qfalse;
- }
- }
-
- // load the animations
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
- if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
- Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName );
- if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
- Com_Printf( "Failed to load animation file %s\n", filename );
- return qfalse;
- }
- }
-
- return qtrue;
+ char modelName[MAX_QPATH];
+ char skinName[MAX_QPATH];
+ char headModelName[MAX_QPATH];
+ char headSkinName[MAX_QPATH];
+ char filename[MAX_QPATH];
+ char *slash;
+
+ pi->torsoModel = 0;
+ pi->headModel = 0;
+
+ if ( !modelSkinName[0] ) {
+ return qfalse;
+ }
+
+ Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );
+
+ slash = strchr( modelName, '/' );
+ if ( !slash ) {
+ // modelName did not include a skin name
+ Q_strncpyz( skinName, "default", sizeof( skinName ) );
+ } else {
+ Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
+ *slash = '\0';
+ }
+
+ Q_strncpyz( headModelName, headModelSkinName, sizeof( headModelName ) );
+ slash = strchr( headModelName, '/' );
+ if ( !slash ) {
+ // modelName did not include a skin name
+ Q_strncpyz( headSkinName, "default", sizeof( skinName ) );
+ } else {
+ Q_strncpyz( headSkinName, slash + 1, sizeof( skinName ) );
+ *slash = '\0';
+ }
+
+ // load cmodels before models so filecache works
+
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
+ pi->legsModel = trap_R_RegisterModel( filename );
+ if ( !pi->legsModel ) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower.md3", modelName );
+ pi->legsModel = trap_R_RegisterModel( filename );
+ if ( !pi->legsModel ) {
+ Com_Printf( "Failed to load model file %s\n", filename );
+ return qfalse;
+ }
+ }
+
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
+ pi->torsoModel = trap_R_RegisterModel( filename );
+ if ( !pi->torsoModel ) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper.md3", modelName );
+ pi->torsoModel = trap_R_RegisterModel( filename );
+ if ( !pi->torsoModel ) {
+ Com_Printf( "Failed to load model file %s\n", filename );
+ return qfalse;
+ }
+ }
+
+ if (headModelName && headModelName[0] == '*' ) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] );
+ }
+ else {
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
+ }
+ pi->headModel = trap_R_RegisterModel( filename );
+ if ( !pi->headModel && headModelName[0] != '*') {
+ Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headModelName, headModelName );
+ pi->headModel = trap_R_RegisterModel( filename );
+ }
+
+ if (!pi->headModel) {
+ Com_Printf( "Failed to load model file %s\n", filename );
+ return qfalse;
+ }
+
+ // if any skins failed to load, fall back to default
+ if ( !UI_RegisterClientSkin( pi, modelName, skinName, headModelName, headSkinName, teamName) ) {
+ if ( !UI_RegisterClientSkin( pi, modelName, "default", headModelName, "default", teamName ) ) {
+ Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
+ return qfalse;
+ }
+ }
+
+ // load the animations
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
+ if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
+ Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName );
+ if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
+ Com_Printf( "Failed to load animation file %s\n", filename );
+ return qfalse;
+ }
+ }
+
+ return qtrue;
}
@@ -1231,16 +1231,16 @@ UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *headmodel, char *teamName ) {
- memset( pi, 0, sizeof(*pi) );
- UI_RegisterClientModelname( pi, model, headmodel, teamName );
- pi->weapon = WP_MACHINEGUN;
- pi->currentWeapon = pi->weapon;
- pi->lastWeapon = pi->weapon;
- pi->pendingWeapon = -1;
- pi->weaponTimer = 0;
- pi->chat = qfalse;
- pi->newModel = qtrue;
- UI_PlayerInfo_SetWeapon( pi, pi->weapon );
+ memset( pi, 0, sizeof(*pi) );
+ UI_RegisterClientModelname( pi, model, headmodel, teamName );
+ pi->weapon = WP_MACHINEGUN;
+ pi->currentWeapon = pi->weapon;
+ pi->lastWeapon = pi->weapon;
+ pi->pendingWeapon = -1;
+ pi->weaponTimer = 0;
+ pi->chat = qfalse;
+ pi->newModel = qtrue;
+ UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
@@ -1250,112 +1250,112 @@ UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
- int currentAnim;
- weapon_t weaponNum;
-
- pi->chat = chat;
-
- // view angles
- VectorCopy( viewAngles, pi->viewAngles );
-
- // move angles
- VectorCopy( moveAngles, pi->moveAngles );
-
- if ( pi->newModel ) {
- pi->newModel = qfalse;
-
- jumpHeight = 0;
- pi->pendingLegsAnim = 0;
- UI_ForceLegsAnim( pi, legsAnim );
- pi->legs.yawAngle = viewAngles[YAW];
- pi->legs.yawing = qfalse;
-
- pi->pendingTorsoAnim = 0;
- UI_ForceTorsoAnim( pi, torsoAnim );
- pi->torso.yawAngle = viewAngles[YAW];
- pi->torso.yawing = qfalse;
-
- if ( weaponNumber != -1 ) {
- pi->weapon = weaponNumber;
- pi->currentWeapon = weaponNumber;
- pi->lastWeapon = weaponNumber;
- pi->pendingWeapon = -1;
- pi->weaponTimer = 0;
- UI_PlayerInfo_SetWeapon( pi, pi->weapon );
- }
-
- return;
- }
-
- // weapon
- if ( weaponNumber == -1 ) {
- pi->pendingWeapon = -1;
- pi->weaponTimer = 0;
- }
- else if ( weaponNumber != WP_NONE ) {
- pi->pendingWeapon = weaponNumber;
- pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
- }
- weaponNum = pi->lastWeapon;
- pi->weapon = weaponNum;
-
- if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
- torsoAnim = legsAnim = BOTH_DEATH1;
- pi->weapon = pi->currentWeapon = WP_NONE;
- UI_PlayerInfo_SetWeapon( pi, pi->weapon );
-
- jumpHeight = 0;
- pi->pendingLegsAnim = 0;
- UI_ForceLegsAnim( pi, legsAnim );
-
- pi->pendingTorsoAnim = 0;
- UI_ForceTorsoAnim( pi, torsoAnim );
-
- return;
- }
-
- // leg animation
- currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
- if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
- pi->pendingLegsAnim = legsAnim;
- }
- else if ( legsAnim != currentAnim ) {
- jumpHeight = 0;
- pi->pendingLegsAnim = 0;
- UI_ForceLegsAnim( pi, legsAnim );
- }
-
- // torso animation
- if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
- if ( weaponNum == WP_NONE ) {
- torsoAnim = TORSO_STAND2;
- }
- else {
- torsoAnim = TORSO_STAND;
- }
- }
-
- if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
- if ( weaponNum == WP_NONE ) {
- torsoAnim = TORSO_ATTACK2;
- }
- else {
- torsoAnim = TORSO_ATTACK;
- }
- pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
- //FIXME play firing sound here
- }
-
- currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
-
- if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
- pi->pendingTorsoAnim = torsoAnim;
- }
- else if ( ( currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK ) && ( torsoAnim != currentAnim ) ) {
- pi->pendingTorsoAnim = torsoAnim;
- }
- else if ( torsoAnim != currentAnim ) {
- pi->pendingTorsoAnim = 0;
- UI_ForceTorsoAnim( pi, torsoAnim );
- }
+ int currentAnim;
+ weapon_t weaponNum;
+
+ pi->chat = chat;
+
+ // view angles
+ VectorCopy( viewAngles, pi->viewAngles );
+
+ // move angles
+ VectorCopy( moveAngles, pi->moveAngles );
+
+ if ( pi->newModel ) {
+ pi->newModel = qfalse;
+
+ jumpHeight = 0;
+ pi->pendingLegsAnim = 0;
+ UI_ForceLegsAnim( pi, legsAnim );
+ pi->legs.yawAngle = viewAngles[YAW];
+ pi->legs.yawing = qfalse;
+
+ pi->pendingTorsoAnim = 0;
+ UI_ForceTorsoAnim( pi, torsoAnim );
+ pi->torso.yawAngle = viewAngles[YAW];
+ pi->torso.yawing = qfalse;
+
+ if ( weaponNumber != -1 ) {
+ pi->weapon = weaponNumber;
+ pi->currentWeapon = weaponNumber;
+ pi->lastWeapon = weaponNumber;
+ pi->pendingWeapon = -1;
+ pi->weaponTimer = 0;
+ UI_PlayerInfo_SetWeapon( pi, pi->weapon );
+ }
+
+ return;
+ }
+
+ // weapon
+ if ( weaponNumber == -1 ) {
+ pi->pendingWeapon = -1;
+ pi->weaponTimer = 0;
+ }
+ else if ( weaponNumber != WP_NONE ) {
+ pi->pendingWeapon = weaponNumber;
+ pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
+ }
+ weaponNum = pi->lastWeapon;
+ pi->weapon = weaponNum;
+
+ if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
+ torsoAnim = legsAnim = BOTH_DEATH1;
+ pi->weapon = pi->currentWeapon = WP_NONE;
+ UI_PlayerInfo_SetWeapon( pi, pi->weapon );
+
+ jumpHeight = 0;
+ pi->pendingLegsAnim = 0;
+ UI_ForceLegsAnim( pi, legsAnim );
+
+ pi->pendingTorsoAnim = 0;
+ UI_ForceTorsoAnim( pi, torsoAnim );
+
+ return;
+ }
+
+ // leg animation
+ currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
+ if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
+ pi->pendingLegsAnim = legsAnim;
+ }
+ else if ( legsAnim != currentAnim ) {
+ jumpHeight = 0;
+ pi->pendingLegsAnim = 0;
+ UI_ForceLegsAnim( pi, legsAnim );
+ }
+
+ // torso animation
+ if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
+ if ( weaponNum == WP_NONE ) {
+ torsoAnim = TORSO_STAND2;
+ }
+ else {
+ torsoAnim = TORSO_STAND;
+ }
+ }
+
+ if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
+ if ( weaponNum == WP_NONE ) {
+ torsoAnim = TORSO_ATTACK2;
+ }
+ else {
+ torsoAnim = TORSO_ATTACK;
+ }
+ pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
+ //FIXME play firing sound here
+ }
+
+ currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
+
+ if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
+ pi->pendingTorsoAnim = torsoAnim;
+ }
+ else if ( ( currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK ) && ( torsoAnim != currentAnim ) ) {
+ pi->pendingTorsoAnim = torsoAnim;
+ }
+ else if ( torsoAnim != currentAnim ) {
+ pi->pendingTorsoAnim = 0;
+ UI_ForceTorsoAnim( pi, torsoAnim );
+ }
}
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 8d019150..38dbfe50 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1,4 +1,4 @@
-//
+//
// string allocation/managment
/*
@@ -84,15 +84,15 @@ static int allocPoint, outOfMemory;
===============
UI_Alloc
===============
-*/
+*/
void *UI_Alloc( int size )
{
- char *p;
+ char *p;
if( allocPoint + size > MEM_POOL_SIZE )
{
outOfMemory = qtrue;
-
+
if( DC->Print )
DC->Print( "UI_Alloc: Failure. Out of memory!\n" );
//DC->trap_Print(S_COLOR_YELLOW"WARNING: UI Out of Memory!\n");
@@ -242,7 +242,7 @@ void String_Init( )
UI_InitMemory( );
Item_SetupKeywordHash( );
Menu_SetupKeywordHash( );
-
+
if( DC && DC->getBindingBuf )
Controls_GetConfig( );
}
@@ -495,7 +495,7 @@ qboolean PC_String_Parse(int handle, const char **out) {
if (!trap_PC_ReadToken(handle, &token))
return qfalse;
-
+
*(out) = String_Alloc(token.string);
return qtrue;
}
@@ -510,9 +510,9 @@ qboolean PC_Script_Parse(int handle, const char **out) {
pc_token_t token;
memset(script, 0, sizeof(script));
- // scripts start with { and have ; separated command lists.. commands are command, arg..
+ // scripts start with { and have ; separated command lists.. commands are command, arg..
// basically we want everything between the { } as it will be interpreted at run time
-
+
if (!trap_PC_ReadToken(handle, &token))
return qfalse;
if (Q_stricmp(token.string, "{") != 0) {
@@ -539,7 +539,7 @@ qboolean PC_Script_Parse(int handle, const char **out) {
}
// display, window, menu, item code
-//
+//
/*
==================
@@ -555,7 +555,7 @@ void Init_Display( displayContextDef_t *dc )
-// type and style painting
+// type and style painting
void GradientBar_Paint( rectDef_t *rect, vec4_t color )
{
@@ -571,7 +571,7 @@ void GradientBar_Paint( rectDef_t *rect, vec4_t color )
Window_Init
Initializes a window structure ( windowDef_t ) with defaults
-
+
==================
*/
void Window_Init(Window *w) {
@@ -657,7 +657,7 @@ void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle)
if (w->cinematic == -1) {
w->cinematic = -2;
}
- }
+ }
if (w->cinematic >= 0) {
DC->runCinematicFrame(w->cinematic);
DC->drawCinematic(w->cinematic, fillRect.x, fillRect.y, fillRect.w, fillRect.h);
@@ -668,7 +668,7 @@ void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle)
// full
// HACK HACK HACK
if (w->style == WINDOW_STYLE_TEAMCOLOR) {
- if (color[0] > 0) {
+ if (color[0] > 0) {
// red
color[0] = 1;
color[1] = color[2] = .5;
@@ -705,7 +705,7 @@ void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle)
void Item_SetScreenCoords(itemDef_t *item, float x, float y) {
-
+
if (item == NULL) {
return;
}
@@ -729,7 +729,7 @@ void Item_SetScreenCoords(itemDef_t *item, float x, float y) {
void Item_UpdatePosition(itemDef_t *item) {
float x, y;
menuDef_t *menu;
-
+
if (item == NULL || item->parent == NULL) {
return;
}
@@ -738,7 +738,7 @@ void Item_UpdatePosition(itemDef_t *item) {
x = menu->window.rect.x;
y = menu->window.rect.y;
-
+
if (menu->window.border != 0) {
x += menu->window.borderSize;
y += menu->window.borderSize;
@@ -756,7 +756,7 @@ void Menu_UpdatePosition(menuDef_t *menu) {
if (menu == NULL) {
return;
}
-
+
x = menu->window.rect.x;
y = menu->window.rect.y;
if (menu->window.border != 0) {
@@ -793,13 +793,13 @@ itemDef_t *Menu_ClearFocus(menuDef_t *menu) {
for (i = 0; i < menu->itemCount; i++) {
if (menu->items[i]->window.flags & WINDOW_HASFOCUS) {
ret = menu->items[i];
- }
+ }
menu->items[i]->window.flags &= ~WINDOW_HASFOCUS;
if (menu->items[i]->leaveFocus) {
Item_RunScript(menu->items[i], menu->items[i]->leaveFocus);
}
}
-
+
return ret;
}
@@ -822,7 +822,7 @@ int Menu_ItemsMatchingGroup(menuDef_t *menu, const char *name) {
for (i = 0; i < menu->itemCount; i++) {
if (Q_stricmp(menu->items[i]->window.name, name) == 0 || (menu->items[i]->window.group && Q_stricmp(menu->items[i]->window.group, name) == 0)) {
count++;
- }
+ }
}
return count;
}
@@ -836,7 +836,7 @@ itemDef_t *Menu_GetMatchingItemByNumber(menuDef_t *menu, int index, const char *
return menu->items[i];
}
count++;
- }
+ }
}
return NULL;
}
@@ -876,7 +876,7 @@ void Script_SetAsset(itemDef_t *item, char **args) {
const char *name;
// expecting name to set asset to
if (String_Parse(args, &name)) {
- // check for a model
+ // check for a model
if (item->type == ITEM_TYPE_MODEL) {
}
}
@@ -1003,7 +1003,7 @@ menuDef_t *Menus_FindByName(const char *p) {
for (i = 0; i < menuCount; i++) {
if (Q_stricmp(Menus[i].window.name, p) == 0) {
return &Menus[i];
- }
+ }
}
return NULL;
}
@@ -1082,19 +1082,19 @@ void Script_Open(itemDef_t *item, char **args) {
}
void Script_ConditionalOpen(itemDef_t *item, char **args) {
- const char *cvar;
- const char *name1;
- const char *name2;
- float val;
-
- if ( String_Parse(args, &cvar) && String_Parse(args, &name1) && String_Parse(args, &name2) ) {
- val = DC->getCVarValue( cvar );
- if ( val == 0.f ) {
- Menus_OpenByName(name2);
- } else {
- Menus_OpenByName(name1);
- }
- }
+ const char *cvar;
+ const char *name1;
+ const char *name2;
+ float val;
+
+ if ( String_Parse(args, &cvar) && String_Parse(args, &name1) && String_Parse(args, &name2) ) {
+ val = DC->getCVarValue( cvar );
+ if ( val == 0.f ) {
+ Menus_OpenByName(name2);
+ } else {
+ Menus_OpenByName(name1);
+ }
+ }
}
void Script_Close(itemDef_t *item, char **args) {
@@ -1210,7 +1210,7 @@ void Script_SetCvar(itemDef_t *item, char **args) {
if (String_Parse(args, &cvar) && String_Parse(args, &val)) {
DC->setCVar(cvar, val);
}
-
+
}
void Script_Exec(itemDef_t *item, char **args) {
@@ -1339,7 +1339,7 @@ qboolean Item_EnableShowViaCvar(itemDef_t *item, int flag) {
}
-// will optionaly set focus to this item
+// will optionaly set focus to this item
qboolean Item_SetFocus(itemDef_t *item, float x, float y) {
int i;
itemDef_t *oldFocus;
@@ -1352,8 +1352,8 @@ qboolean Item_SetFocus(itemDef_t *item, float x, float y) {
}
// bk001206 - this can be NULL.
- parent = (menuDef_t*)item->parent;
-
+ parent = (menuDef_t*)item->parent;
+
// items can be enabled and disabled based on cvars
if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
return qfalse;
@@ -1597,11 +1597,11 @@ int Item_ListBox_OverLB(itemDef_t *item, float x, float y) {
}
-void Item_ListBox_MouseEnter(itemDef_t *item, float x, float y)
+void Item_ListBox_MouseEnter(itemDef_t *item, float x, float y)
{
rectDef_t r;
listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
-
+
item->window.flags &= ~(WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN);
item->window.flags |= Item_ListBox_OverLB(item, x, y);
@@ -1620,7 +1620,7 @@ void Item_ListBox_MouseEnter(itemDef_t *item, float x, float y)
}
}
} else {
- // text hit..
+ // text hit..
}
}
} else if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN))) {
@@ -1730,7 +1730,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
max = Item_ListBox_MaxScroll(item);
if (item->window.flags & WINDOW_HORIZONTAL) {
viewmax = (item->window.rect.w / listPtr->elementWidth);
- if ( key == K_LEFTARROW || key == K_KP_LEFTARROW )
+ if ( key == K_LEFTARROW || key == K_KP_LEFTARROW )
{
if (!listPtr->notselectable) {
listPtr->cursorPos--;
@@ -1753,7 +1753,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
}
return qtrue;
}
- if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW )
+ if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW )
{
if (!listPtr->notselectable) {
listPtr->cursorPos++;
@@ -1779,7 +1779,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
}
else {
viewmax = (item->window.rect.h / listPtr->elementHeight);
- if ( key == K_UPARROW || key == K_KP_UPARROW )
+ if ( key == K_UPARROW || key == K_KP_UPARROW )
{
if (!listPtr->notselectable) {
listPtr->cursorPos--;
@@ -1802,7 +1802,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
}
return qtrue;
}
- if ( key == K_DOWNARROW || key == K_KP_DOWNARROW )
+ if ( key == K_DOWNARROW || key == K_KP_DOWNARROW )
{
if (!listPtr->notselectable) {
listPtr->cursorPos++;
@@ -1875,7 +1875,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
return qtrue;
}
-
+
if ( key == K_HOME || key == K_KP_HOME) {
// home
listPtr->startPos = 0;
@@ -2115,7 +2115,7 @@ qboolean Item_TextField_HandleKey(itemDef_t *item, int key) {
return qtrue;
}
- if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW )
+ if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW )
{
if (editPtr->maxPaintChars && item->cursorPos >= editPtr->maxPaintChars && item->cursorPos < len) {
item->cursorPos++;
@@ -2124,11 +2124,11 @@ qboolean Item_TextField_HandleKey(itemDef_t *item, int key) {
}
if (item->cursorPos < len) {
item->cursorPos++;
- }
+ }
return qtrue;
}
- if ( key == K_LEFTARROW || key == K_KP_LEFTARROW )
+ if ( key == K_LEFTARROW || key == K_KP_LEFTARROW )
{
if ( item->cursorPos > 0 ) {
item->cursorPos--;
@@ -2185,12 +2185,12 @@ qboolean Item_TextField_HandleKey(itemDef_t *item, int key) {
static void Scroll_ListBox_AutoFunc(void *p) {
scrollInfo_t *si = (scrollInfo_t*)p;
- if (DC->realTime > si->nextScrollTime) {
+ if (DC->realTime > si->nextScrollTime) {
// need to scroll which is done by simulating a click to the item
// this is done a bit sideways as the autoscroll "knows" that the item is a listbox
// so it calls it directly
Item_ListBox_HandleKey(si->item, si->scrollKey, qtrue, qfalse);
- si->nextScrollTime = DC->realTime + si->adjustValue;
+ si->nextScrollTime = DC->realTime + si->adjustValue;
}
if (DC->realTime > si->nextAdjustTime) {
@@ -2246,12 +2246,12 @@ static void Scroll_ListBox_ThumbFunc(void *p) {
si->yStart = DC->cursory;
}
- if (DC->realTime > si->nextScrollTime) {
+ if (DC->realTime > si->nextScrollTime) {
// need to scroll which is done by simulating a click to the item
// this is done a bit sideways as the autoscroll "knows" that the item is a listbox
// so it calls it directly
Item_ListBox_HandleKey(si->item, si->scrollKey, qtrue, qfalse);
- si->nextScrollTime = DC->realTime + si->adjustValue;
+ si->nextScrollTime = DC->realTime + si->adjustValue;
}
if (DC->realTime > si->nextAdjustTime) {
@@ -2453,14 +2453,14 @@ void Item_Action(itemDef_t *item) {
itemDef_t *Menu_SetPrevCursorItem(menuDef_t *menu) {
qboolean wrapped = qfalse;
int oldCursor = menu->cursorItem;
-
+
if (menu->cursorItem < 0) {
menu->cursorItem = menu->itemCount-1;
wrapped = qtrue;
- }
+ }
while (menu->cursorItem > -1) {
-
+
menu->cursorItem--;
if (menu->cursorItem < 0 && !wrapped) {
wrapped = qtrue;
@@ -2499,7 +2499,7 @@ itemDef_t *Menu_SetNextCursorItem(menuDef_t *menu) {
Menu_HandleMouseMove(menu, menu->items[menu->cursorItem]->window.rect.x + 1, menu->items[menu->cursorItem]->window.rect.y + 1);
return menu->items[menu->cursorItem];
}
-
+
}
menu->cursorItem = oldCursor;
@@ -2564,9 +2564,9 @@ int Display_VisibleMenuCount() {
void Menus_HandleOOBClick(menuDef_t *menu, int key, qboolean down) {
if (menu) {
int i;
- // basically the behaviour we are looking for is if there are windows in the stack.. see if
- // the cursor is within any of them.. if not close them otherwise activate them and pass the
- // key on.. force a mouse move to activate focus and script stuff
+ // basically the behaviour we are looking for is if there are windows in the stack.. see if
+ // the cursor is within any of them.. if not close them otherwise activate them and pass the
+ // key on.. force a mouse move to activate focus and script stuff
if (down && menu->window.flags & WINDOW_OOB_CLICK) {
Menu_RunCloseScript(menu);
menu->window.flags &= ~(WINDOW_HASFOCUS | WINDOW_VISIBLE);
@@ -2768,7 +2768,7 @@ void ToWindowCoords(float *x, float *y, windowDef_t *window) {
if (window->border != 0) {
*x += window->borderSize;
*y += window->borderSize;
- }
+ }
*x += window->rect.x;
*y += window->rect.y;
}
@@ -2822,18 +2822,18 @@ void Item_TextColor(itemDef_t *item, vec4_t *newColor) {
Fade(&item->window.flags, &item->window.foreColor[3], parent->fadeClamp, &item->window.nextTime, parent->fadeCycle, qtrue, parent->fadeAmount);
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,*newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(newColor, &parent->focusColor, sizeof(vec4_t));
} else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) {
- lowLight[0] = 0.8 * item->window.foreColor[0];
- lowLight[1] = 0.8 * item->window.foreColor[1];
- lowLight[2] = 0.8 * item->window.foreColor[2];
- lowLight[3] = 0.8 * item->window.foreColor[3];
+ lowLight[0] = 0.8 * item->window.foreColor[0];
+ lowLight[1] = 0.8 * item->window.foreColor[1];
+ lowLight[2] = 0.8 * item->window.foreColor[2];
+ lowLight[3] = 0.8 * item->window.foreColor[3];
LerpColor(item->window.foreColor,lowLight,*newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));
} else {
memcpy(newColor, &item->window.foreColor, sizeof(vec4_t));
@@ -2878,11 +2878,11 @@ int Item_Text_AutoWrapped_Lines( itemDef_t *item )
buff[ 0 ] = '\0';
newLine = 0;
p = textPtr;
-
+
while( p )
{
textWidth = DC->textWidth( buff, item->textscale, 0 );
-
+
if( *p == ' ' || *p == '\t' || *p == '\n' || *p == '\0' )
{
newLine = len;
@@ -2900,10 +2900,10 @@ int Item_Text_AutoWrapped_Lines( itemDef_t *item )
{
if( len )
buff[ newLine ] = '\0';
-
+
if( !( *p == '\n' && !*( p + 1 ) ) )
lines++;
-
+
if( *p == '\0' )
break;
@@ -2911,10 +2911,10 @@ int Item_Text_AutoWrapped_Lines( itemDef_t *item )
p = newLinePtr;
len = 0;
newLine = 0;
-
+
continue;
}
-
+
buff[ len++ ] = *p++;
buff[ len ] = '\0';
}
@@ -2957,7 +2957,7 @@ static int checkCache( const char *text, rectDef_t *rect, int width, int height
if( awc[ i ].textWidth != width || awc[ i ].textHeight != height )
continue;
-
+
//this is a match
return i;
}
@@ -2997,7 +2997,7 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
if( *textPtr == '\0' )
return;
-
+
Item_TextColor( item, &color );
Item_SetTextExtents( item, &width, &height, textPtr );
@@ -3011,7 +3011,7 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
{
item->textRect.x = awc[ cache ].lineOffsets[ i ][ 0 ];
item->textRect.y = awc[ cache ].lineOffsets[ i ][ 1 ];
-
+
DC->drawText( item->textRect.x, item->textRect.y, item->textscale, color,
awc[ cache ].lines[ i ], 0, 0, item->textStyle );
}
@@ -3024,9 +3024,9 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
newLine = 0;
newLineWidth = 0;
p = textPtr;
-
+
totalLines = Item_Text_AutoWrapped_Lines( item );
-
+
totalY = totalLines * ( height + 5 );
diffY = totalY - item->window.rect.h;
@@ -3043,23 +3043,23 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
awc[ cacheIndex ].rect.h = item->window.rect.h;
awc[ cacheIndex ].textWidth = width;
awc[ cacheIndex ].textHeight = height;
-
+
while( p )
{
textWidth = DC->textWidth( buff, item->textscale, 0 );
-
+
if( *p == '^' )
{
lastCMod[ 0 ] = p[ 0 ];
lastCMod[ 1 ] = p[ 1 ];
}
-
+
if( *p == ' ' || *p == '\t' || *p == '\n' || *p == '\0' )
{
newLine = len;
newLinePtr = p+1;
newLineWidth = textWidth;
-
+
if( *p == '\n' ) //don't forward colours past deilberate \n's
lastCMod[ 0 ] = lastCMod[ 1 ] = 0;
else
@@ -3072,7 +3072,7 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
newLine = len;
newLinePtr = p;
newLineWidth = textWidth;
-
+
forwardColor = qtrue;
}
@@ -3109,7 +3109,7 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
//
if( !skipLines )
y += height + 5;
-
+
if( skipLines )
skipLines--;
@@ -3126,10 +3126,10 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item )
forwardColor = qfalse;
}
-
+
continue;
}
-
+
buff[ len++ ] = *p++;
buff[ len ] = '\0';
}
@@ -3275,15 +3275,15 @@ void Item_TextField_Paint(itemDef_t *item) {
if (item->cvar) {
DC->getCVarString(item->cvar, buff, sizeof(buff));
- }
+ }
parent = (menuDef_t*)item->parent;
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(newColor, &parent->focusColor, sizeof(vec4_t));
@@ -3309,10 +3309,10 @@ void Item_YesNo_Paint(itemDef_t *item) {
value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(newColor, &parent->focusColor, sizeof(vec4_t));
@@ -3334,10 +3334,10 @@ void Item_Multi_Paint(itemDef_t *item) {
menuDef_t *parent = (menuDef_t*)item->parent;
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(newColor, &parent->focusColor, sizeof(vec4_t));
@@ -3369,11 +3369,11 @@ typedef struct
{
char* name;
float defaultvalue;
- float value;
+ float value;
} configcvar_t;
-static bind_t g_bindings[] =
+static bind_t g_bindings[] =
{
{ "+scores", K_TAB, -1, -1, -1 },
{ "+button2", K_ENTER, -1, -1, -1 },
@@ -3438,7 +3438,7 @@ static bind_t g_bindings[] =
{ "tauntGauntlet", K_F5, -1, -1, -1 },
{ "scoresUp", K_KP_PGUP, -1, -1, -1 },
{ "scoresDown", K_KP_PGDN, -1, -1, -1 },
- // bk001205 - this one below was: '-1'
+ // bk001205 - this one below was: '-1'
{ "messagemode", -1, -1, -1, -1 },
{ "messagemode2", -1, -1, -1, -1 },
{ "messagemode3", -1, -1, -1, -1 },
@@ -3521,7 +3521,7 @@ void Controls_SetConfig(qboolean restart)
{
if (g_bindings[i].bind1 != -1)
- {
+ {
DC->setBinding( g_bindings[i].bind1, g_bindings[i].command );
if (g_bindings[i].bind2 != -1)
@@ -3621,10 +3621,10 @@ void Item_Slider_Paint(itemDef_t *item) {
value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(newColor, &parent->focusColor, sizeof(vec4_t));
@@ -3666,10 +3666,10 @@ void Item_Bind_Paint(itemDef_t *item) {
lowLight[2] = 0.8f * 0.0f;
lowLight[3] = 0.8f * 1.0f;
} else {
- lowLight[0] = 0.8f * parent->focusColor[0];
- lowLight[1] = 0.8f * parent->focusColor[1];
- lowLight[2] = 0.8f * parent->focusColor[2];
- lowLight[3] = 0.8f * parent->focusColor[3];
+ lowLight[0] = 0.8f * parent->focusColor[0];
+ lowLight[1] = 0.8f * parent->focusColor[1];
+ lowLight[2] = 0.8f * parent->focusColor[2];
+ lowLight[3] = 0.8f * parent->focusColor[3];
}
/*LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
@@ -3718,7 +3718,7 @@ qboolean Item_Bind_HandleKey(itemDef_t *item, int key, qboolean down) {
case K_ESCAPE:
g_waitingForKey = qfalse;
return qtrue;
-
+
case K_BACKSPACE:
id = BindingIDFromName(item->cvar);
if (id != -1) {
@@ -3778,10 +3778,10 @@ qboolean Item_Bind_HandleKey(itemDef_t *item, int key, qboolean down) {
DC->setBinding( g_bindings[id].bind2, "" );
g_bindings[id].bind1 = key;
g_bindings[id].bind2 = -1;
- }
+ }
}
- Controls_SetConfig(qtrue);
+ Controls_SetConfig(qtrue);
g_waitingForKey = qfalse;
return qtrue;
@@ -3832,7 +3832,7 @@ void Item_Model_Paint(itemDef_t *item) {
// calculate distance so the model nearly fills the box
if (qtrue) {
- float len = 0.5 * ( maxs[2] - mins[2] );
+ float len = 0.5 * ( maxs[2] - mins[2] );
origin[0] = len / 0.268; // len / tan( fov/2 )
//origin[0] = len / tan(w/2);
} else {
@@ -4095,25 +4095,25 @@ void Item_OwnerDraw_Paint(itemDef_t *item) {
}
if (item->window.flags & WINDOW_HASFOCUS) {
-/* lowLight[0] = 0.8 * parent->focusColor[0];
- lowLight[1] = 0.8 * parent->focusColor[1];
- lowLight[2] = 0.8 * parent->focusColor[2];
- lowLight[3] = 0.8 * parent->focusColor[3];
+/* lowLight[0] = 0.8 * parent->focusColor[0];
+ lowLight[1] = 0.8 * parent->focusColor[1];
+ lowLight[2] = 0.8 * parent->focusColor[2];
+ lowLight[3] = 0.8 * parent->focusColor[3];
LerpColor(parent->focusColor,lowLight,color,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/
//TA:
memcpy(color, &parent->focusColor, sizeof(vec4_t));
} else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) {
- lowLight[0] = 0.8 * item->window.foreColor[0];
- lowLight[1] = 0.8 * item->window.foreColor[1];
- lowLight[2] = 0.8 * item->window.foreColor[2];
- lowLight[3] = 0.8 * item->window.foreColor[3];
+ lowLight[0] = 0.8 * item->window.foreColor[0];
+ lowLight[1] = 0.8 * item->window.foreColor[1];
+ lowLight[2] = 0.8 * item->window.foreColor[2];
+ lowLight[3] = 0.8 * item->window.foreColor[3];
LerpColor(item->window.foreColor,lowLight,color,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));
}
if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
}
-
+
if (item->text) {
Item_Text_Paint(item);
if (item->text[0]) {
@@ -4142,7 +4142,7 @@ void Item_Paint(itemDef_t *item) {
if (item->window.flags & WINDOW_ORBITING) {
if (DC->realTime > item->window.nextTime) {
float rx, ry, a, c, s, w, h;
-
+
item->window.nextTime = DC->realTime + item->window.offsetTime;
// translate
w = item->window.rectClient.w / 2;
@@ -4265,7 +4265,7 @@ void Item_Paint(itemDef_t *item) {
return;
}
- // paint the rect first..
+ // paint the rect first..
Window_Paint(&item->window, parent->fadeAmount , parent->fadeClamp, parent->fadeCycle);
if (debugMode) {
@@ -4425,7 +4425,7 @@ menuDef_t *Menus_ActivateByName(const char *p) {
DC->feederSelection( m->items[ j ]->special, 0 );
}
}
-
+
if (openMenuCount < MAX_OPEN_MENUS && focus != NULL) {
menuStack[openMenuCount++] = focus;
}
@@ -4466,7 +4466,7 @@ void Menu_HandleMouseMove(menuDef_t *menu, float x, float y) {
return;
}
- // FIXME: this is the whole issue of focus vs. mouse over..
+ // FIXME: this is the whole issue of focus vs. mouse over..
// need a better overall solution as i don't like going through everything twice
for (pass = 0; pass < 2; pass++) {
for (i = 0; i < menu->itemCount; i++) {
@@ -4531,7 +4531,7 @@ void Menu_Paint(menuDef_t *menu, qboolean forcePaint) {
if (menu->window.ownerDrawFlags && DC->ownerDrawVisible && !DC->ownerDrawVisible(menu->window.ownerDrawFlags)) {
return;
}
-
+
if (forcePaint) {
menu->window.flags |= WINDOW_FORCED;
}
@@ -4885,7 +4885,7 @@ qboolean ItemParse_elementtype( itemDef_t *item, int handle ) {
return qtrue;
}
-// columns sets a number of columns and an x pos and width per..
+// columns sets a number of columns and an x pos and width per..
qboolean ItemParse_columns( itemDef_t *item, int handle ) {
int num, i;
listBoxDef_t *listPtr;
@@ -5210,7 +5210,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) {
pc_token_t token;
multiDef_t *multiPtr;
int pass;
-
+
Item_ValidateTypeData(item);
if (!item->typeData)
return qfalse;
@@ -5258,7 +5258,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) {
qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) {
pc_token_t token;
multiDef_t *multiPtr;
-
+
Item_ValidateTypeData(item);
if (!item->typeData)
return qfalse;
@@ -5437,7 +5437,7 @@ void Item_SetupKeywordHash( void )
int i;
memset( itemParseKeywordHash, 0, sizeof( itemParseKeywordHash ) );
-
+
for( i = 0; itemParseKeywords[ i ].keyword; i++ )
KeywordHash_Add( itemParseKeywordHash, &itemParseKeywords[ i ] );
}
@@ -5839,7 +5839,7 @@ void Menu_SetupKeywordHash( void )
int i;
memset( menuParseKeywordHash, 0, sizeof( menuParseKeywordHash ) );
-
+
for(i = 0; menuParseKeywords[ i ].keyword; i++ )
KeywordHash_Add( menuParseKeywordHash, &menuParseKeywords[ i ] );
}
@@ -5858,7 +5858,7 @@ qboolean Menu_Parse(int handle, menuDef_t *menu) {
if (*token.string != '{') {
return qfalse;
}
-
+
while ( 1 ) {
memset(&token, 0, sizeof(pc_token_t));
@@ -5929,7 +5929,7 @@ void Menu_Reset( void )
displayContextDef_t *Display_GetContext() {
return DC;
}
-
+
void *Display_CaptureItem(int x, int y) {
int i;
@@ -5944,7 +5944,7 @@ void *Display_CaptureItem(int x, int y) {
}
-// FIXME:
+// FIXME:
qboolean Display_MouseMove(void *p, int x, int y) {
int i;
menuDef_t *menu = p;
@@ -5986,7 +5986,7 @@ int Display_CursorType(int x, int y) {
void Display_HandleKey(int key, qboolean down, int x, int y) {
menuDef_t *menu = Display_CaptureItem(x, y);
- if (menu == NULL) {
+ if (menu == NULL) {
menu = Menu_GetFocused();
}
if (menu) {
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index d0864c02..fd0ed967 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -31,36 +31,36 @@
#define MAX_COLOR_RANGES 10
#define MAX_OPEN_MENUS 16
-#define WINDOW_MOUSEOVER 0x00000001 // mouse is over it, non exclusive
-#define WINDOW_HASFOCUS 0x00000002 // has cursor focus, exclusive
-#define WINDOW_VISIBLE 0x00000004 // is visible
-#define WINDOW_GREY 0x00000008 // is visible but grey ( non-active )
-#define WINDOW_DECORATION 0x00000010 // for decoration only, no mouse, keyboard, etc..
-#define WINDOW_FADINGOUT 0x00000020 // fading out, non-active
-#define WINDOW_FADINGIN 0x00000040 // fading in
-#define WINDOW_MOUSEOVERTEXT 0x00000080 // mouse is over it, non exclusive
-#define WINDOW_INTRANSITION 0x00000100 // window is in transition
-#define WINDOW_FORECOLORSET 0x00000200 // forecolor was explicitly set ( used to color alpha images or not )
-#define WINDOW_HORIZONTAL 0x00000400 // for list boxes and sliders, vertical is default this is set of horizontal
-#define WINDOW_LB_LEFTARROW 0x00000800 // mouse is over left/up arrow
-#define WINDOW_LB_RIGHTARROW 0x00001000 // mouse is over right/down arrow
-#define WINDOW_LB_THUMB 0x00002000 // mouse is over thumb
-#define WINDOW_LB_PGUP 0x00004000 // mouse is over page up
-#define WINDOW_LB_PGDN 0x00008000 // mouse is over page down
-#define WINDOW_ORBITING 0x00010000 // item is in orbit
-#define WINDOW_OOB_CLICK 0x00020000 // close on out of bounds click
-#define WINDOW_WRAPPED 0x00040000 // manually wrap text
-#define WINDOW_AUTOWRAPPED 0x00080000 // auto wrap text
-#define WINDOW_FORCED 0x00100000 // forced open
-#define WINDOW_POPUP 0x00200000 // popup
-#define WINDOW_BACKCOLORSET 0x00400000 // backcolor was explicitly set
-#define WINDOW_TIMEDVISIBLE 0x00800000 // visibility timing ( NOT implemented )
+#define WINDOW_MOUSEOVER 0x00000001 // mouse is over it, non exclusive
+#define WINDOW_HASFOCUS 0x00000002 // has cursor focus, exclusive
+#define WINDOW_VISIBLE 0x00000004 // is visible
+#define WINDOW_GREY 0x00000008 // is visible but grey ( non-active )
+#define WINDOW_DECORATION 0x00000010 // for decoration only, no mouse, keyboard, etc..
+#define WINDOW_FADINGOUT 0x00000020 // fading out, non-active
+#define WINDOW_FADINGIN 0x00000040 // fading in
+#define WINDOW_MOUSEOVERTEXT 0x00000080 // mouse is over it, non exclusive
+#define WINDOW_INTRANSITION 0x00000100 // window is in transition
+#define WINDOW_FORECOLORSET 0x00000200 // forecolor was explicitly set ( used to color alpha images or not )
+#define WINDOW_HORIZONTAL 0x00000400 // for list boxes and sliders, vertical is default this is set of horizontal
+#define WINDOW_LB_LEFTARROW 0x00000800 // mouse is over left/up arrow
+#define WINDOW_LB_RIGHTARROW 0x00001000 // mouse is over right/down arrow
+#define WINDOW_LB_THUMB 0x00002000 // mouse is over thumb
+#define WINDOW_LB_PGUP 0x00004000 // mouse is over page up
+#define WINDOW_LB_PGDN 0x00008000 // mouse is over page down
+#define WINDOW_ORBITING 0x00010000 // item is in orbit
+#define WINDOW_OOB_CLICK 0x00020000 // close on out of bounds click
+#define WINDOW_WRAPPED 0x00040000 // manually wrap text
+#define WINDOW_AUTOWRAPPED 0x00080000 // auto wrap text
+#define WINDOW_FORCED 0x00100000 // forced open
+#define WINDOW_POPUP 0x00200000 // popup
+#define WINDOW_BACKCOLORSET 0x00400000 // backcolor was explicitly set
+#define WINDOW_TIMEDVISIBLE 0x00800000 // visibility timing ( NOT implemented )
// CGAME cursor type bits
-#define CURSOR_NONE 0x00000001
-#define CURSOR_ARROW 0x00000002
-#define CURSOR_SIZER 0x00000004
+#define CURSOR_NONE 0x00000001
+#define CURSOR_ARROW 0x00000002
+#define CURSOR_SIZER 0x00000004
#ifdef CGAME
#define STRING_POOL_SIZE 128*1024
@@ -72,14 +72,14 @@
#define MAX_SCRIPT_ARGS 12
#define MAX_EDITFIELD 256
-#define ART_FX_BASE "menu/art/fx_base"
-#define ART_FX_BLUE "menu/art/fx_blue"
-#define ART_FX_CYAN "menu/art/fx_cyan"
-#define ART_FX_GREEN "menu/art/fx_grn"
-#define ART_FX_RED "menu/art/fx_red"
-#define ART_FX_TEAL "menu/art/fx_teal"
-#define ART_FX_WHITE "menu/art/fx_white"
-#define ART_FX_YELLOW "menu/art/fx_yel"
+#define ART_FX_BASE "menu/art/fx_base"
+#define ART_FX_BLUE "menu/art/fx_blue"
+#define ART_FX_CYAN "menu/art/fx_cyan"
+#define ART_FX_GREEN "menu/art/fx_grn"
+#define ART_FX_RED "menu/art/fx_red"
+#define ART_FX_TEAL "menu/art/fx_teal"
+#define ART_FX_WHITE "menu/art/fx_white"
+#define ART_FX_YELLOW "menu/art/fx_yel"
#define ASSET_GRADIENTBAR "ui/assets/gradientbar2.tga"
#define ASSET_SCROLLBAR "ui/assets/scrollbar.tga"
@@ -88,14 +88,14 @@
#define ASSET_SCROLLBAR_ARROWLEFT "ui/assets/scrollbar_arrow_left.tga"
#define ASSET_SCROLLBAR_ARROWRIGHT "ui/assets/scrollbar_arrow_right.tga"
#define ASSET_SCROLL_THUMB "ui/assets/scrollbar_thumb.tga"
-#define ASSET_SLIDER_BAR "ui/assets/slider2.tga"
-#define ASSET_SLIDER_THUMB "ui/assets/sliderbutt_1.tga"
+#define ASSET_SLIDER_BAR "ui/assets/slider2.tga"
+#define ASSET_SLIDER_THUMB "ui/assets/sliderbutt_1.tga"
#define SCROLLBAR_SIZE 16.0
#define SLIDER_WIDTH 96.0
#define SLIDER_HEIGHT 16.0
#define SLIDER_THUMB_WIDTH 12.0
#define SLIDER_THUMB_HEIGHT 20.0
-#define NUM_CROSSHAIRS 10
+#define NUM_CROSSHAIRS 10
typedef struct {
const char *command;
@@ -118,13 +118,13 @@ typedef struct {
Rectangle rectClient; // screen coord rectangle
const char *name; //
const char *group; // if it belongs to a group
- const char *cinematicName; // cinematic name
- int cinematic; // cinematic handle
+ const char *cinematicName; // cinematic name
+ int cinematic; // cinematic handle
int style; //
int border; //
- int ownerDraw; // ownerDraw style
- int ownerDrawFlags; // show flags for ownerdraw items
- float borderSize; //
+ int ownerDraw; // ownerDraw style
+ int ownerDrawFlags; // show flags for ownerdraw items
+ float borderSize; //
int flags; // visible, focus, mouseover, cursor
Rectangle rectEffects; // for various effects
Rectangle rectEffects2; // for various effects
@@ -134,86 +134,86 @@ typedef struct {
vec4_t backColor; // border color
vec4_t borderColor; // border color
vec4_t outlineColor; // border color
- qhandle_t background; // background asset
+ qhandle_t background; // background asset
} windowDef_t;
typedef windowDef_t Window;
typedef struct {
- vec4_t color;
- float low;
- float high;
+ vec4_t color;
+ float low;
+ float high;
} colorRangeDef_t;
// FIXME: combine flags into bitfields to save space
// FIXME: consolidate all of the common stuff in one structure for menus and items
// THINKABOUTME: is there any compelling reason not to have items contain items
-// and do away with a menu per say.. major issue is not being able to dynamically allocate
-// and destroy stuff.. Another point to consider is adding an alloc free call for vm's and have
+// and do away with a menu per say.. major issue is not being able to dynamically allocate
+// and destroy stuff.. Another point to consider is adding an alloc free call for vm's and have
// the engine just allocate the pool for it based on a cvar
// many of the vars are re-used for different item types, as such they are not always named appropriately
// the benefits of c++ in DOOM will greatly help crap like this
// FIXME: need to put a type ptr that points to specific type info per type
-//
+//
#define MAX_LB_COLUMNS 16
typedef struct columnInfo_s {
- int pos;
- int width;
- int maxChars;
+ int pos;
+ int width;
+ int maxChars;
int align;
} columnInfo_t;
typedef struct listBoxDef_s {
- int startPos;
- int endPos;
- int drawPadding;
- int cursorPos;
- float elementWidth;
- float elementHeight;
- int elementStyle;
- int numColumns;
- columnInfo_t columnInfo[MAX_LB_COLUMNS];
- const char *doubleClick;
- qboolean notselectable;
+ int startPos;
+ int endPos;
+ int drawPadding;
+ int cursorPos;
+ float elementWidth;
+ float elementHeight;
+ int elementStyle;
+ int numColumns;
+ columnInfo_t columnInfo[MAX_LB_COLUMNS];
+ const char *doubleClick;
+ qboolean notselectable;
} listBoxDef_t;
typedef struct editFieldDef_s {
- float minVal; // edit field limits
+ float minVal; // edit field limits
float maxVal; //
float defVal; //
- float range; //
+ float range; //
int maxChars; // for edit fields
int maxPaintChars; // for edit fields
- int paintOffset; //
+ int paintOffset; //
} editFieldDef_t;
#define MAX_MULTI_CVARS 32
typedef struct multiDef_s {
- const char *cvarList[MAX_MULTI_CVARS];
- const char *cvarStr[MAX_MULTI_CVARS];
- float cvarValue[MAX_MULTI_CVARS];
- int count;
- qboolean strDef;
+ const char *cvarList[MAX_MULTI_CVARS];
+ const char *cvarStr[MAX_MULTI_CVARS];
+ float cvarValue[MAX_MULTI_CVARS];
+ int count;
+ qboolean strDef;
} multiDef_t;
typedef struct modelDef_s {
- int angle;
- vec3_t origin;
- float fov_x;
- float fov_y;
- int rotationSpeed;
+ int angle;
+ vec3_t origin;
+ float fov_x;
+ float fov_y;
+ int rotationSpeed;
} modelDef_t;
-#define CVAR_ENABLE 0x00000001
-#define CVAR_DISABLE 0x00000002
-#define CVAR_SHOW 0x00000004
-#define CVAR_HIDE 0x00000008
+#define CVAR_ENABLE 0x00000001
+#define CVAR_DISABLE 0x00000002
+#define CVAR_SHOW 0x00000004
+#define CVAR_HIDE 0x00000008
typedef struct itemDef_s {
Window window; // common positional, border, style, layout info
- Rectangle textRect; // rectangle the text ( if any ) consumes
+ Rectangle textRect; // rectangle the text ( if any ) consumes
int type; // text, button, radiobutton, checkbox, textfield, listbox, combo
int alignment; // left center right
int textalignment; // ( optional ) alignment for text within rect based on text width
@@ -227,40 +227,40 @@ typedef struct itemDef_s {
const char *mouseEnterText; // mouse enter script
const char *mouseExitText; // mouse exit script
const char *mouseEnter; // mouse enter script
- const char *mouseExit; // mouse exit script
+ const char *mouseExit; // mouse exit script
const char *action; // select script
const char *onFocus; // select script
const char *leaveFocus; // select script
- const char *cvar; // associated cvar
+ const char *cvar; // associated cvar
const char *cvarTest; // associated cvar for enable actions
- const char *enableCvar; // enable, disable, show, or hide based on value, this can contain a list
- int cvarFlags; // what type of action to take on cvarenables
+ const char *enableCvar; // enable, disable, show, or hide based on value, this can contain a list
+ int cvarFlags; // what type of action to take on cvarenables
sfxHandle_t focusSound;
- int numColors; // number of color ranges
- colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
- float special; // used for feeder id's etc.. diff per type
+ int numColors; // number of color ranges
+ colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
+ float special; // used for feeder id's etc.. diff per type
int cursorPos; // cursor position in characters
- void *typeData; // type specific data ptr's
+ void *typeData; // type specific data ptr's
} itemDef_t;
typedef struct {
Window window;
- const char *font; // font
- qboolean fullScreen; // covers entire screen
- int itemCount; // number of items;
- int fontIndex; //
- int cursorItem; // which item as the cursor
- int fadeCycle; //
- float fadeClamp; //
- float fadeAmount; //
- const char *onOpen; // run when the menu is first opened
- const char *onClose; // run when the menu is closed
- const char *onESC; // run when the menu is closed
- const char *soundName; // background loop sound for menu
-
- vec4_t focusColor; // focus color for items
- vec4_t disableColor; // focus color for items
- itemDef_t *items[MAX_MENUITEMS]; // items this menu contains
+ const char *font; // font
+ qboolean fullScreen; // covers entire screen
+ int itemCount; // number of items;
+ int fontIndex; //
+ int cursorItem; // which item as the cursor
+ int fadeCycle; //
+ float fadeClamp; //
+ float fadeAmount; //
+ const char *onOpen; // run when the menu is first opened
+ const char *onClose; // run when the menu is closed
+ const char *onESC; // run when the menu is closed
+ const char *soundName; // background loop sound for menu
+
+ vec4_t focusColor; // focus color for items
+ vec4_t disableColor; // focus color for items
+ itemDef_t *items[MAX_MENUITEMS]; // items this menu contains
} menuDef_t;
typedef struct {
@@ -296,11 +296,6 @@ typedef struct {
float shadowFadeClamp;
qboolean fontRegistered;
- // player settings
- qhandle_t fxBasePic;
- qhandle_t fxPic[7];
- qhandle_t crosshairShader[NUM_CROSSHAIRS];
-
} cachedAssets_t;
typedef struct {
@@ -327,8 +322,8 @@ typedef struct {
void (*renderScene) ( const refdef_t *fd );
void (*registerFont) (const char *pFontname, int pointSize, fontInfo_t *font);
void (*ownerDrawItem) (float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle);
- float (*getValue) (int ownerDraw);
- qboolean (*ownerDrawVisible) (int flags);
+ float (*getValue) (int ownerDraw);
+ qboolean (*ownerDrawVisible) (int flags);
void (*runScript)(char **p);
void (*getTeamColor)(vec4_t *color);
void (*getCVarString)(const char *cvar, char *buffer, int bufsize);
@@ -343,38 +338,38 @@ typedef struct {
const char *(*feederItemText)(float feederID, int index, int column, qhandle_t *handle);
qhandle_t (*feederItemImage)(float feederID, int index);
void (*feederSelection)(float feederID, int index);
- void (*keynumToStringBuf)( int keynum, char *buf, int buflen );
- void (*getBindingBuf)( int keynum, char *buf, int buflen );
- void (*setBinding)( int keynum, const char *binding );
- void (*executeText)(int exec_when, const char *text );
- void (*Error)(int level, const char *error, ...);
- void (*Print)(const char *msg, ...);
- void (*Pause)(qboolean b);
- int (*ownerDrawWidth)(int ownerDraw, float scale);
- sfxHandle_t (*registerSound)(const char *name, qboolean compressed);
- void (*startBackgroundTrack)( const char *intro, const char *loop);
- void (*stopBackgroundTrack)();
- int (*playCinematic)(const char *name, float x, float y, float w, float h);
- void (*stopCinematic)(int handle);
- void (*drawCinematic)(int handle, float x, float y, float w, float h);
- void (*runCinematicFrame)(int handle);
-
- float yscale;
- float xscale;
- float bias;
- int realTime;
- int frameTime;
- int cursorx;
- int cursory;
- qboolean debug;
+ void (*keynumToStringBuf)( int keynum, char *buf, int buflen );
+ void (*getBindingBuf)( int keynum, char *buf, int buflen );
+ void (*setBinding)( int keynum, const char *binding );
+ void (*executeText)(int exec_when, const char *text );
+ void (*Error)(int level, const char *error, ...);
+ void (*Print)(const char *msg, ...);
+ void (*Pause)(qboolean b);
+ int (*ownerDrawWidth)(int ownerDraw, float scale);
+ sfxHandle_t (*registerSound)(const char *name, qboolean compressed);
+ void (*startBackgroundTrack)( const char *intro, const char *loop);
+ void (*stopBackgroundTrack)();
+ int (*playCinematic)(const char *name, float x, float y, float w, float h);
+ void (*stopCinematic)(int handle);
+ void (*drawCinematic)(int handle, float x, float y, float w, float h);
+ void (*runCinematicFrame)(int handle);
+
+ float yscale;
+ float xscale;
+ float bias;
+ int realTime;
+ int frameTime;
+ int cursorx;
+ int cursory;
+ qboolean debug;
cachedAssets_t Assets;
- glconfig_t glconfig;
- qhandle_t whiteShader;
+ glconfig_t glconfig;
+ qhandle_t whiteShader;
qhandle_t gradientImage;
qhandle_t cursor;
- float FPS;
+ float FPS;
} displayContextDef_t;
@@ -437,11 +432,11 @@ void Controls_SetDefaults( void );
//for cg_draw.c
void Item_Text_AutoWrapped_Paint( itemDef_t *item );
-int trap_PC_AddGlobalDefine( char *define );
-int trap_PC_LoadSource( const char *filename );
-int trap_PC_FreeSource( int handle );
-int trap_PC_ReadToken( int handle, pc_token_t *pc_token );
-int trap_PC_SourceFileAndLine( int handle, char *filename, int *line );
+int trap_PC_AddGlobalDefine( char *define );
+int trap_PC_LoadSource( const char *filename );
+int trap_PC_FreeSource( int handle );
+int trap_PC_ReadToken( int handle, pc_token_t *pc_token );
+int trap_PC_SourceFileAndLine( int handle, char *filename, int *line );
void BindingFromName( const char *cvar );
extern char g_nameBind1[ 32 ];
diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c
index 294d30f0..9a560a15 100644
--- a/src/ui/ui_syscalls.c
+++ b/src/ui/ui_syscalls.c
@@ -22,95 +22,95 @@
static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
- syscall = syscallptr;
+ syscall = syscallptr;
}
int PASSFLOAT( float x ) {
- float floatTemp;
- floatTemp = x;
- return *(int *)&floatTemp;
+ float floatTemp;
+ floatTemp = x;
+ return *(int *)&floatTemp;
}
void trap_Print( const char *string ) {
- syscall( UI_PRINT, string );
+ syscall( UI_PRINT, string );
}
void trap_Error( const char *string ) {
- syscall( UI_ERROR, string );
+ syscall( UI_ERROR, string );
}
int trap_Milliseconds( void ) {
- return syscall( UI_MILLISECONDS );
+ return syscall( UI_MILLISECONDS );
}
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
- syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
+ syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
}
void trap_Cvar_Update( vmCvar_t *cvar ) {
- syscall( UI_CVAR_UPDATE, cvar );
+ syscall( UI_CVAR_UPDATE, cvar );
}
void trap_Cvar_Set( const char *var_name, const char *value ) {
- syscall( UI_CVAR_SET, var_name, value );
+ syscall( UI_CVAR_SET, var_name, value );
}
float trap_Cvar_VariableValue( const char *var_name ) {
- int temp;
- temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
- return (*(float*)&temp);
+ int temp;
+ temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
+ return (*(float*)&temp);
}
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
- syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
+ syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
}
void trap_Cvar_SetValue( const char *var_name, float value ) {
- syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) );
+ syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) );
}
void trap_Cvar_Reset( const char *name ) {
- syscall( UI_CVAR_RESET, name );
+ syscall( UI_CVAR_RESET, name );
}
void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
- syscall( UI_CVAR_CREATE, var_name, var_value, flags );
+ syscall( UI_CVAR_CREATE, var_name, var_value, flags );
}
void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) {
- syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
+ syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
}
int trap_Argc( void ) {
- return syscall( UI_ARGC );
+ return syscall( UI_ARGC );
}
void trap_Argv( int n, char *buffer, int bufferLength ) {
- syscall( UI_ARGV, n, buffer, bufferLength );
+ syscall( UI_ARGV, n, buffer, bufferLength );
}
void trap_Cmd_ExecuteText( int exec_when, const char *text ) {
- syscall( UI_CMD_EXECUTETEXT, exec_when, text );
+ syscall( UI_CMD_EXECUTETEXT, exec_when, text );
}
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
- return syscall( UI_FS_FOPENFILE, qpath, f, mode );
+ return syscall( UI_FS_FOPENFILE, qpath, f, mode );
}
void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
- syscall( UI_FS_READ, buffer, len, f );
+ syscall( UI_FS_READ, buffer, len, f );
}
void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
- syscall( UI_FS_WRITE, buffer, len, f );
+ syscall( UI_FS_WRITE, buffer, len, f );
}
void trap_FS_FCloseFile( fileHandle_t f ) {
- syscall( UI_FS_FCLOSEFILE, f );
+ syscall( UI_FS_FCLOSEFILE, f );
}
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) {
- return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
+ return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
}
int trap_FS_Seek( fileHandle_t f, long offset, int origin ) {
@@ -118,242 +118,242 @@ int trap_FS_Seek( fileHandle_t f, long offset, int origin ) {
}
qhandle_t trap_R_RegisterModel( const char *name ) {
- return syscall( UI_R_REGISTERMODEL, name );
+ return syscall( UI_R_REGISTERMODEL, name );
}
qhandle_t trap_R_RegisterSkin( const char *name ) {
- return syscall( UI_R_REGISTERSKIN, name );
+ return syscall( UI_R_REGISTERSKIN, name );
}
void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
- syscall( UI_R_REGISTERFONT, fontName, pointSize, font );
+ syscall( UI_R_REGISTERFONT, fontName, pointSize, font );
}
qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
- return syscall( UI_R_REGISTERSHADERNOMIP, name );
+ return syscall( UI_R_REGISTERSHADERNOMIP, name );
}
void trap_R_ClearScene( void ) {
- syscall( UI_R_CLEARSCENE );
+ syscall( UI_R_CLEARSCENE );
}
void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
- syscall( UI_R_ADDREFENTITYTOSCENE, re );
+ syscall( UI_R_ADDREFENTITYTOSCENE, re );
}
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
- syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
+ syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
}
void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
- syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
+ syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
}
void trap_R_RenderScene( const refdef_t *fd ) {
- syscall( UI_R_RENDERSCENE, fd );
+ syscall( UI_R_RENDERSCENE, fd );
}
void trap_R_SetColor( const float *rgba ) {
- syscall( UI_R_SETCOLOR, rgba );
+ syscall( UI_R_SETCOLOR, rgba );
}
void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) {
- syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
+ syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
}
-void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
- syscall( UI_R_MODELBOUNDS, model, mins, maxs );
+void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
+ syscall( UI_R_MODELBOUNDS, model, mins, maxs );
}
void trap_UpdateScreen( void ) {
- syscall( UI_UPDATESCREEN );
+ syscall( UI_UPDATESCREEN );
}
int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) {
- return syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
+ return syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
}
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
- syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
+ syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
}
-sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) {
- return syscall( UI_S_REGISTERSOUND, sample, compressed );
+sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) {
+ return syscall( UI_S_REGISTERSOUND, sample, compressed );
}
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
- syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
+ syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
}
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
- syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
+ syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
}
void trap_Key_SetBinding( int keynum, const char *binding ) {
- syscall( UI_KEY_SETBINDING, keynum, binding );
+ syscall( UI_KEY_SETBINDING, keynum, binding );
}
qboolean trap_Key_IsDown( int keynum ) {
- return syscall( UI_KEY_ISDOWN, keynum );
+ return syscall( UI_KEY_ISDOWN, keynum );
}
qboolean trap_Key_GetOverstrikeMode( void ) {
- return syscall( UI_KEY_GETOVERSTRIKEMODE );
+ return syscall( UI_KEY_GETOVERSTRIKEMODE );
}
void trap_Key_SetOverstrikeMode( qboolean state ) {
- syscall( UI_KEY_SETOVERSTRIKEMODE, state );
+ syscall( UI_KEY_SETOVERSTRIKEMODE, state );
}
void trap_Key_ClearStates( void ) {
- syscall( UI_KEY_CLEARSTATES );
+ syscall( UI_KEY_CLEARSTATES );
}
int trap_Key_GetCatcher( void ) {
- return syscall( UI_KEY_GETCATCHER );
+ return syscall( UI_KEY_GETCATCHER );
}
void trap_Key_SetCatcher( int catcher ) {
- syscall( UI_KEY_SETCATCHER, catcher );
+ syscall( UI_KEY_SETCATCHER, catcher );
}
void trap_GetClipboardData( char *buf, int bufsize ) {
- syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
+ syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
}
void trap_GetClientState( uiClientState_t *state ) {
- syscall( UI_GETCLIENTSTATE, state );
+ syscall( UI_GETCLIENTSTATE, state );
}
void trap_GetGlconfig( glconfig_t *glconfig ) {
- syscall( UI_GETGLCONFIG, glconfig );
+ syscall( UI_GETGLCONFIG, glconfig );
}
int trap_GetConfigString( int index, char* buff, int buffsize ) {
- return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
+ return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
}
-int trap_LAN_GetServerCount( int source ) {
- return syscall( UI_LAN_GETSERVERCOUNT, source );
+int trap_LAN_GetServerCount( int source ) {
+ return syscall( UI_LAN_GETSERVERCOUNT, source );
}
void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) {
- syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen );
+ syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen );
}
void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
- syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen );
+ syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen );
}
int trap_LAN_GetServerPing( int source, int n ) {
- return syscall( UI_LAN_GETSERVERPING, source, n );
+ return syscall( UI_LAN_GETSERVERPING, source, n );
}
int trap_LAN_GetPingQueueCount( void ) {
- return syscall( UI_LAN_GETPINGQUEUECOUNT );
+ return syscall( UI_LAN_GETPINGQUEUECOUNT );
}
int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen ) {
- return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen );
+ return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen );
}
void trap_LAN_SaveCachedServers() {
- syscall( UI_LAN_SAVECACHEDSERVERS );
+ syscall( UI_LAN_SAVECACHEDSERVERS );
}
void trap_LAN_LoadCachedServers() {
- syscall( UI_LAN_LOADCACHEDSERVERS );
+ syscall( UI_LAN_LOADCACHEDSERVERS );
}
void trap_LAN_ResetPings(int n) {
- syscall( UI_LAN_RESETPINGS, n );
+ syscall( UI_LAN_RESETPINGS, n );
}
void trap_LAN_ClearPing( int n ) {
- syscall( UI_LAN_CLEARPING, n );
+ syscall( UI_LAN_CLEARPING, n );
}
void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
- syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
+ syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
}
void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) {
- syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
+ syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
}
void trap_LAN_MarkServerVisible( int source, int n, qboolean visible ) {
- syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible );
+ syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible );
}
int trap_LAN_ServerIsVisible( int source, int n) {
- return syscall( UI_LAN_SERVERISVISIBLE, source, n );
+ return syscall( UI_LAN_SERVERISVISIBLE, source, n );
}
qboolean trap_LAN_UpdateVisiblePings( int source ) {
- return syscall( UI_LAN_UPDATEVISIBLEPINGS, source );
+ return syscall( UI_LAN_UPDATEVISIBLEPINGS, source );
}
int trap_LAN_AddServer(int source, const char *name, const char *addr) {
- return syscall( UI_LAN_ADDSERVER, source, name, addr );
+ return syscall( UI_LAN_ADDSERVER, source, name, addr );
}
void trap_LAN_RemoveServer(int source, const char *addr) {
- syscall( UI_LAN_REMOVESERVER, source, addr );
+ syscall( UI_LAN_REMOVESERVER, source, addr );
}
int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) {
- return syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 );
+ return syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 );
}
int trap_MemoryRemaining( void ) {
- return syscall( UI_MEMORY_REMAINING );
+ return syscall( UI_MEMORY_REMAINING );
}
void trap_GetCDKey( char *buf, int buflen ) {
- syscall( UI_GET_CDKEY, buf, buflen );
+ syscall( UI_GET_CDKEY, buf, buflen );
}
void trap_SetCDKey( char *buf ) {
- syscall( UI_SET_CDKEY, buf );
+ syscall( UI_SET_CDKEY, buf );
}
int trap_PC_AddGlobalDefine( char *define ) {
- return syscall( UI_PC_ADD_GLOBAL_DEFINE, define );
+ return syscall( UI_PC_ADD_GLOBAL_DEFINE, define );
}
int trap_PC_LoadSource( const char *filename ) {
- return syscall( UI_PC_LOAD_SOURCE, filename );
+ return syscall( UI_PC_LOAD_SOURCE, filename );
}
int trap_PC_FreeSource( int handle ) {
- return syscall( UI_PC_FREE_SOURCE, handle );
+ return syscall( UI_PC_FREE_SOURCE, handle );
}
int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
- return syscall( UI_PC_READ_TOKEN, handle, pc_token );
+ return syscall( UI_PC_READ_TOKEN, handle, pc_token );
}
int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
- return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
+ return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
}
void trap_S_StopBackgroundTrack( void ) {
- syscall( UI_S_STOPBACKGROUNDTRACK );
+ syscall( UI_S_STOPBACKGROUNDTRACK );
}
void trap_S_StartBackgroundTrack( const char *intro, const char *loop) {
- syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop );
+ syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop );
}
int trap_RealTime(qtime_t *qtime) {
- return syscall( UI_REAL_TIME, qtime );
+ return syscall( UI_REAL_TIME, qtime );
}
// this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) {
return syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits);
}
-
+
// stops playing the cinematic and ends it. should always return FMV_EOF
// cinematics must be stopped in reverse order of when they are started
e_status trap_CIN_StopCinematic(int handle) {
@@ -365,13 +365,13 @@ e_status trap_CIN_StopCinematic(int handle) {
e_status trap_CIN_RunCinematic (int handle) {
return syscall(UI_CIN_RUNCINEMATIC, handle);
}
-
+
// draws the current frame
void trap_CIN_DrawCinematic (int handle) {
syscall(UI_CIN_DRAWCINEMATIC, handle);
}
-
+
// allows you to resize the animation dynamically
void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) {
@@ -379,12 +379,12 @@ void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) {
}
-void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
- syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset );
+void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
+ syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset );
}
qboolean trap_VerifyCDKey( const char *key, const char *chksum) {
- return syscall( UI_VERIFY_CDKEY, key, chksum);
+ return syscall( UI_VERIFY_CDKEY, key, chksum);
}
void trap_SetPbClStatus( int status ) {