diff options
author | Tim Angus <tim@ngus.net> | 2005-12-08 21:45:34 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-12-08 21:45:34 +0000 |
commit | dedac77b31fc2ddf806e9a70a4a6b536c9a79d35 (patch) | |
tree | 90637a7d1f1d43e1784f9c4fec2a26672f3ec904 /src/ui | |
parent | 10107e224bbaa2a39cd1296905d27e4d927cf207 (diff) |
* Merged in a bunch of game side fixed from ioq3
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_atoms.c | 11 | ||||
-rw-r--r-- | src/ui/ui_local.h | 10 | ||||
-rw-r--r-- | src/ui/ui_main.c | 89 | ||||
-rw-r--r-- | src/ui/ui_players.c | 3 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 24 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 26 | ||||
-rw-r--r-- | src/ui/ui_syscalls.c | 8 |
7 files changed, 65 insertions, 106 deletions
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index 8139be91..dc6496b7 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -23,9 +23,6 @@ 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]; @@ -48,8 +45,6 @@ void QDECL Com_Printf( const char *msg, ... ) { trap_Print( va("%s", text) ); } -#endif - qboolean newUI = qfalse; @@ -157,7 +152,7 @@ void UI_LoadBestScores(const char *map, int game) { UI_ClearScores =============== */ -void UI_ClearScores() { +void UI_ClearScores( void ) { char gameList[4096]; char *gameFile; int i, len, count, size; @@ -188,7 +183,7 @@ void UI_ClearScores() { -static void UI_Cache_f() { +static void UI_Cache_f( void ) { Display_CacheAll(); } @@ -197,7 +192,7 @@ static void UI_Cache_f() { UI_CalcPostGameStats ======================= */ -static void UI_CalcPostGameStats() { +static void UI_CalcPostGameStats( void ) { char map[MAX_QPATH]; char fileName[MAX_QPATH]; char info[MAX_INFO_STRING]; diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index 8809eafc..cdcfc57f 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -348,13 +348,13 @@ extern sfxHandle_t MenuField_Key( menufield_s* m, int* key ); // // ui_main.c // -void UI_Report(); -void UI_Load(); +void UI_Report( void ); +void UI_Load( void ); void UI_LoadMenus(const char *menuFile, qboolean reset); void _UI_SetActiveMenu( uiMenuCommand_t menu ); int UI_AdjustTimeByGame(int time); void UI_ShowPostGame(qboolean newHigh); -void UI_ClearScores(); +void UI_ClearScores( void ); void UI_LoadArenas(void); // @@ -1044,8 +1044,8 @@ 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_LoadCachedServers( void ); +void trap_LAN_SaveCachedServers( void ); void trap_LAN_MarkServerVisible(int source, int n, qboolean visible); int trap_LAN_ServerIsVisible( int source, int n); qboolean trap_LAN_UpdateVisiblePings( int source ); diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 19f9bb73..80a5bdb4 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -152,7 +152,9 @@ void _UI_KeyEvent( int key, qboolean down ); void _UI_MouseEvent( int dx, int dy ); void _UI_Refresh( int realtime ); qboolean _UI_IsFullscreen( void ); -int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) { +long vmMain( long command, long arg0, long arg1, long arg2, long arg3, + long arg4, long arg5, long arg6, long arg7, + long arg8, long arg9, long arg10, long arg11 ) { switch ( command ) { case UI_GETAPIVERSION: return UI_API_VERSION; @@ -200,7 +202,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a -void AssetCache() { +void AssetCache( void ) { uiInfo.uiDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR ); uiInfo.uiDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR ); uiInfo.uiDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN ); @@ -931,7 +933,7 @@ qboolean Asset_Parse(int handle) { return qfalse; } -void Font_Report() { +void Font_Report( void ) { int i; Com_Printf("Font Info\n"); Com_Printf("=========\n"); @@ -940,7 +942,7 @@ void Font_Report() { } } -void UI_Report() { +void UI_Report( void ) { String_Report(); //Font_Report(); @@ -1264,7 +1266,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { trap_PC_FreeSource( handle ); } -void UI_Load() { +void UI_Load( void ) { char lastName[1024]; menuDef_t *menu = Menu_GetFocused(); char *menuSet = UI_Cvar_VariableString("ui_menuFiles"); @@ -1840,7 +1842,7 @@ static void UI_DrawOpponent(rectDef_t *rect) { } -static void UI_NextOpponent() { +static void UI_NextOpponent( void ) { int i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); int j = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); i++; @@ -1856,7 +1858,7 @@ static void UI_NextOpponent() { trap_Cvar_Set( "ui_opponentName", uiInfo.teamList[i].teamName ); } -static void UI_PriorOpponent() { +static void UI_PriorOpponent( void ) { int i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); int j = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); i--; @@ -2107,7 +2109,7 @@ static void UI_DrawRedBlue(rectDef_t *rect, float scale, vec4_t color, int textS UI_BuildPlayerList =============== */ -static void UI_BuildPlayerList() { +static void UI_BuildPlayerList( void ) { uiClientState_t cs; int n, count, team, team2, playerTeamNumber; char info[MAX_INFO_STRING]; @@ -3087,45 +3089,6 @@ void UI_ServersSort(int column, qboolean force) { qsort( &uiInfo.serverStatus.displayServers[0], uiInfo.serverStatus.numDisplayServers, sizeof(int), UI_ServersQsortCompare); } -/* -static void UI_StartSinglePlayer() { - int i,j, k, skill; - char buff[1024]; - i = trap_Cvar_VariableValue( "ui_currentTier" ); - if (i < 0 || i >= tierCount) { - i = 0; - } - j = trap_Cvar_VariableValue("ui_currentMap"); - if (j < 0 || j > MAPS_PER_TIER) { - j = 0; - } - - trap_Cvar_SetValue( "singleplayer", 1 ); - trap_Cvar_SetValue( "g_gametype", Com_Clamp( 0, 7, tierList[i].gameTypes[j] ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map %s\n", tierList[i].maps[j] ) ); - skill = trap_Cvar_VariableValue( "g_spSkill" ); - - if (j == MAPS_PER_TIER-1) { - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[0]), skill, "", teamList[k].teamMembers[0]); - } else { - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); - for (i = 0; i < PLAYERS_PER_TEAM; i++) { - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[i]), skill, "Blue", teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - } - - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); - for (i = 1; i < PLAYERS_PER_TEAM; i++) { - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[i]), skill, "Red", teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - } - trap_Cmd_ExecuteText( EXEC_APPEND, "wait 5; team Red\n" ); - } - - -} -*/ /* =============== @@ -3426,7 +3389,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades ) UI_LoadTremHumanArmouryBuys =============== */ -static void UI_LoadTremHumanArmouryBuys( ) +static void UI_LoadTremHumanArmouryBuys( void ) { int i, j = 0; stage_t stage = UI_GetCurrentHumanStage( ); @@ -3499,7 +3462,7 @@ static void UI_LoadTremHumanArmouryBuys( ) UI_LoadTremHumanArmourySells =============== */ -static void UI_LoadTremHumanArmourySells( ) +static void UI_LoadTremHumanArmourySells( void ) { int weapons, upgrades; int i, j = 0; @@ -3545,7 +3508,7 @@ static void UI_LoadTremHumanArmourySells( ) UI_LoadTremAlienUpgrades =============== */ -static void UI_LoadTremAlienUpgrades( ) +static void UI_LoadTremAlienUpgrades( void ) { int i, j = 0; int class, credits; @@ -3581,7 +3544,7 @@ static void UI_LoadTremAlienUpgrades( ) UI_LoadTremAlienBuilds =============== */ -static void UI_LoadTremAlienBuilds( ) +static void UI_LoadTremAlienBuilds( void ) { int weapons; int i, j = 0; @@ -3618,7 +3581,7 @@ static void UI_LoadTremAlienBuilds( ) UI_LoadTremHumanBuilds =============== */ -static void UI_LoadTremHumanBuilds( ) +static void UI_LoadTremHumanBuilds( void ) { int weapons; int i, j = 0; @@ -3655,7 +3618,7 @@ static void UI_LoadTremHumanBuilds( ) UI_LoadMods =============== */ -static void UI_LoadMods() { +static void UI_LoadMods( void ) { int numdirs; char dirlist[2048]; char *dirptr; @@ -3686,7 +3649,7 @@ static void UI_LoadMods() { UI_LoadMovies =============== */ -static void UI_LoadMovies() { +static void UI_LoadMovies( void ) { char movielist[4096]; char *moviename; int i, len; @@ -3718,7 +3681,7 @@ static void UI_LoadMovies() { UI_LoadDemos =============== */ -static void UI_LoadDemos() { +static void UI_LoadDemos( void ) { char demolist[4096]; char demoExt[32]; char *demoname; @@ -3773,7 +3736,7 @@ static void UI_StartSkirmish(qboolean next) { UI_SelectedMap(index, &actual); if (UI_SetNextMap(actual, index)) { } else { - UI_GameType_HandleKey(0, 0, K_MOUSE1, qfalse); + UI_GameType_HandleKey(0, NULL, K_MOUSE1, qfalse); UI_MapCountByGameType(qtrue); Menu_SetFeederSelection(NULL, FEEDER_MAPS, 0, "skirmish"); } @@ -4024,8 +3987,8 @@ static void UI_RunMenuScript(char **args) { ui_mapIndex.integer = UI_GetIndexFromSelection(ui_currentMap.integer); trap_Cvar_Set("ui_mapIndex", va("%d", ui_mapIndex.integer)); Menu_SetFeederSelection(NULL, FEEDER_MAPS, ui_mapIndex.integer, "skirmish"); - UI_GameType_HandleKey(0, 0, K_MOUSE1, qfalse); - UI_GameType_HandleKey(0, 0, K_MOUSE2, qfalse); + UI_GameType_HandleKey(0, NULL, K_MOUSE1, qfalse); + UI_GameType_HandleKey(0, NULL, K_MOUSE2, qfalse); } else if (Q_stricmp(name, "resetDefaults") == 0) { trap_Cmd_ExecuteText( EXEC_APPEND, "exec default.cfg\n"); trap_Cmd_ExecuteText( EXEC_APPEND, "cvar_restart\n"); @@ -4462,12 +4425,12 @@ qboolean UI_hasSkinForBase(const char *base, const char *team) { Com_sprintf( test, sizeof( test ), "models/players/%s/%s/lower_default.skin", base, team ); - if (trap_FS_FOpenFile(test, 0, FS_READ)) { + if (trap_FS_FOpenFile(test, NULL, FS_READ)) { return qtrue; } Com_sprintf( test, sizeof( test ), "models/players/characters/%s/%s/lower_default.skin", base, team ); - if (trap_FS_FOpenFile(test, 0, FS_READ)) { + if (trap_FS_FOpenFile(test, NULL, FS_READ)) { return qtrue; } return qfalse; @@ -4478,7 +4441,7 @@ qboolean UI_hasSkinForBase(const char *base, const char *team) { UI_MapCountByTeam ================== */ -static int UI_HeadCountByTeam() { +static int UI_HeadCountByTeam( void ) { static int init = 0; int i, j, k, c, tIndex; @@ -5177,7 +5140,7 @@ static int UI_GetIndexFromSelection(int actual) { return 0; } -static void UI_UpdatePendingPings() { +static void UI_UpdatePendingPings( void ) { trap_LAN_ResetPings(ui_netSource.integer); uiInfo.serverStatus.refreshActive = qtrue; uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 1000; @@ -5813,7 +5776,7 @@ void _UI_MouseEvent( int dx, int dy ) } -void UI_LoadNonIngame() { +void UI_LoadNonIngame( void ) { const char *menuSet = UI_Cvar_VariableString("ui_menuFiles"); if (menuSet == NULL || menuSet[0] == '\0') { menuSet = "ui/menus.txt"; diff --git a/src/ui/ui_players.c b/src/ui/ui_players.c index 4560cbd2..71c4f5cc 100644 --- a/src/ui/ui_players.c +++ b/src/ui/ui_players.c @@ -890,7 +890,7 @@ UI_FileExists static qboolean UI_FileExists(const char *filename) { int len; - len = trap_FS_FOpenFile( filename, 0, FS_READ ); + len = trap_FS_FOpenFile( filename, NULL, FS_READ ); if (len>0) { return qtrue; } @@ -1023,6 +1023,7 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat } if ( len >= ( sizeof( text ) - 1 ) ) { Com_Printf( "File %s too long\n", filename ); + trap_FS_FCloseFile( f ); return qfalse; } trap_FS_Read( text, len, f ); diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 38dbfe50..43c25ff8 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -210,7 +210,7 @@ const char *String_Alloc(const char *p) { return NULL; } -void String_Report() { +void String_Report( void ) { float f; Com_Printf("Memory/String Pool Info\n"); Com_Printf("----------------\n"); @@ -229,7 +229,7 @@ void String_Report() { String_Init ================= */ -void String_Init( ) +void String_Init( void ) { int i; for( i = 0; i < HASH_TABLE_SIZE; i++ ) @@ -1035,7 +1035,7 @@ void Menus_CloseByName(const char *p) { } } -void Menus_CloseAll() { +void Menus_CloseAll( void ) { int i; for (i = 0; i < menuCount; i++) { Menu_RunCloseScript(&Menus[i]); @@ -2526,7 +2526,7 @@ static void Menu_CloseCinematics(menuDef_t *menu) { } } -static void Display_CloseCinematics() { +static void Display_CloseCinematics( void ) { int i; for (i = 0; i < menuCount; i++) { Menu_CloseCinematics(&Menus[i]); @@ -2550,7 +2550,7 @@ void Menus_Activate(menuDef_t *menu) { } -int Display_VisibleMenuCount() { +int Display_VisibleMenuCount( void ) { int i, count; count = 0; for (i = 0; i < menuCount; i++) { @@ -3687,7 +3687,7 @@ void Item_Bind_Paint(itemDef_t *item) { } } -qboolean Display_KeyBindPending() { +qboolean Display_KeyBindPending( void ) { return g_waitingForKey; } @@ -4344,7 +4344,7 @@ itemDef_t *Menu_GetFocusedItem(menuDef_t *menu) { return NULL; } -menuDef_t *Menu_GetFocused() { +menuDef_t *Menu_GetFocused( void ) { int i; for (i = 0; i < menuCount; i++) { if (Menus[i].window.flags & WINDOW_HASFOCUS && Menus[i].window.flags & WINDOW_VISIBLE) { @@ -4394,7 +4394,7 @@ void Menu_SetFeederSelection(menuDef_t *menu, int feeder, int index, const char } } -qboolean Menus_AnyFullScreenVisible() { +qboolean Menus_AnyFullScreenVisible( void ) { int i; for (i = 0; i < menuCount; i++) { if (Menus[i].window.flags & WINDOW_VISIBLE && Menus[i].fullScreen) { @@ -5901,11 +5901,11 @@ void Menu_New(int handle) { } } -int Menu_Count() { +int Menu_Count( void ) { return menuCount; } -void Menu_PaintAll() { +void Menu_PaintAll( void ) { int i; if (captureFunc) { captureFunc(captureData); @@ -5926,7 +5926,7 @@ void Menu_Reset( void ) menuCount = 0; } -displayContextDef_t *Display_GetContext() { +displayContextDef_t *Display_GetContext( void ) { return DC; } @@ -6026,7 +6026,7 @@ static void Menu_CacheContents(menuDef_t *menu) { } -void Display_CacheAll() { +void Display_CacheAll( void ) { int i; for (i = 0; i < menuCount; i++) { Menu_CacheContents(&Menus[i]); diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index fd0ed967..b41b97e5 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -317,7 +317,7 @@ typedef struct { void (*drawRect) ( float x, float y, float w, float h, float size, const vec4_t color); void (*drawSides) (float x, float y, float w, float h, float size); void (*drawTopBottom) (float x, float y, float w, float h, float size); - void (*clearScene) (); + void (*clearScene) (void); void (*addRefEntityToScene) (const refEntity_t *re ); void (*renderScene) ( const refdef_t *fd ); void (*registerFont) (const char *pFontname, int pointSize, fontInfo_t *font); @@ -348,7 +348,7 @@ typedef struct { int (*ownerDrawWidth)(int ownerDraw, float scale); sfxHandle_t (*registerSound)(const char *name, qboolean compressed); void (*startBackgroundTrack)( const char *intro, const char *loop); - void (*stopBackgroundTrack)(); + void (*stopBackgroundTrack)( void ); 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); @@ -374,14 +374,14 @@ typedef struct { } displayContextDef_t; const char *String_Alloc(const char *p); -void String_Init(); -void String_Report(); +void String_Init( void ); +void String_Report( void ); void Init_Display(displayContextDef_t *dc); void Display_ExpandMacros(char * buff); void Menu_Init(menuDef_t *menu); void Item_Init(itemDef_t *item); void Menu_PostParse(menuDef_t *menu); -menuDef_t *Menu_GetFocused(); +menuDef_t *Menu_GetFocused( void ); void Menu_HandleKey(menuDef_t *menu, int key, qboolean down); void Menu_HandleMouseMove(menuDef_t *menu, float x, float y); void Menu_ScrollFeeder(menuDef_t *menu, int feeder, qboolean down); @@ -397,33 +397,33 @@ qboolean PC_Int_Parse(int handle, int *i); qboolean PC_Rect_Parse(int handle, rectDef_t *r); qboolean PC_String_Parse(int handle, const char **out); qboolean PC_Script_Parse(int handle, const char **out); -int Menu_Count(); +int Menu_Count( void ); void Menu_New(int handle); -void Menu_PaintAll(); +void Menu_PaintAll( void ); menuDef_t *Menus_ActivateByName(const char *p); -void Menu_Reset(); +void Menu_Reset( void ); qboolean Menus_AnyFullScreenVisible(); void Menus_Activate(menuDef_t *menu); -displayContextDef_t *Display_GetContext(); +displayContextDef_t *Display_GetContext( void ); void *Display_CaptureItem(int x, int y); qboolean Display_MouseMove(void *p, int x, int y); int Display_CursorType(int x, int y); -qboolean Display_KeyBindPending(); +qboolean Display_KeyBindPending( void ); void Menus_OpenByName(const char *p); menuDef_t *Menus_FindByName(const char *p); void Menus_ShowByName(const char *p); void Menus_CloseByName(const char *p); void Display_HandleKey(int key, qboolean down, int x, int y); void LerpColor(vec4_t a, vec4_t b, vec4_t c, float t); -void Menus_CloseAll(); +void Menus_CloseAll( void ); void Menu_Paint(menuDef_t *menu, qboolean forcePaint); void Menu_SetFeederSelection(menuDef_t *menu, int feeder, int index, const char *name); -void Display_CacheAll(); +void Display_CacheAll( void ); void *UI_Alloc( int size ); void UI_InitMemory( void ); -qboolean UI_OutOfMemory(); +qboolean UI_OutOfMemory( void ); void Controls_GetConfig( void ); void Controls_SetConfig(qboolean restart); diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c index 9a560a15..cef3b74f 100644 --- a/src/ui/ui_syscalls.c +++ b/src/ui/ui_syscalls.c @@ -19,9 +19,9 @@ // this file is only included when building a dll // syscalls.asm is included instead when building a qvm -static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1; +static long (QDECL *syscall)( long arg, ... ) = (long (QDECL *)( long, ...))-1; -void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) { +void dllEntry( long (QDECL *syscallptr)( long arg,... ) ) { syscall = syscallptr; } @@ -257,11 +257,11 @@ int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int ma return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen ); } -void trap_LAN_SaveCachedServers() { +void trap_LAN_SaveCachedServers( void ) { syscall( UI_LAN_SAVECACHEDSERVERS ); } -void trap_LAN_LoadCachedServers() { +void trap_LAN_LoadCachedServers( void ) { syscall( UI_LAN_LOADCACHEDSERVERS ); } |