From dedac77b31fc2ddf806e9a70a4a6b536c9a79d35 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 8 Dec 2005 21:45:34 +0000 Subject: * Merged in a bunch of game side fixed from ioq3 --- src/cgame/cg_buildable.c | 2 +- src/cgame/cg_draw.c | 4 +-- src/cgame/cg_local.h | 6 ++-- src/cgame/cg_main.c | 13 +++---- src/cgame/cg_players.c | 1 + src/cgame/cg_syscalls.c | 4 +-- src/game/bg_lib.c | 12 ++----- src/game/bg_lib.h | 7 ++++ src/game/g_local.h | 2 +- src/game/g_main.c | 13 +++---- src/game/g_spawn.c | 2 +- src/game/g_syscalls.c | 4 +-- src/game/g_utils.c | 2 +- src/game/q_math.c | 2 ++ src/game/q_shared.h | 8 ----- src/ui/ui_atoms.c | 11 ++---- src/ui/ui_local.h | 10 +++--- src/ui/ui_main.c | 89 ++++++++++++++---------------------------------- src/ui/ui_players.c | 3 +- src/ui/ui_shared.c | 24 ++++++------- src/ui/ui_shared.h | 26 +++++++------- src/ui/ui_syscalls.c | 8 ++--- 22 files changed, 99 insertions(+), 154 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 39b6d959..348bb433 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -296,7 +296,7 @@ CG_InitBuildables Initialises the animation db =============== */ -void CG_InitBuildables( ) +void CG_InitBuildables( void ) { char filename[ MAX_QPATH ]; char soundfile[ MAX_QPATH ]; diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 38af5c76..d7c07036 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -514,7 +514,7 @@ static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale, //=============== TA: was cg_newdraw.c -void CG_InitTeamChat( ) +void CG_InitTeamChat( void ) { memset( teamChat1, 0, sizeof( teamChat1 ) ); memset( teamChat2, 0, sizeof( teamChat2 ) ); @@ -3016,7 +3016,7 @@ static void CG_DrawTeamVote( void ) } -static qboolean CG_DrawScoreboard( ) +static qboolean CG_DrawScoreboard( void ) { static qboolean firstTime = qtrue; float fade, *fadeColor; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 7ee70554..88df61ba 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1510,7 +1510,7 @@ void CG_KeyEvent( int key, qboolean down ); void CG_MouseEvent( int x, int y ); void CG_EventHandling( int type ); void CG_SetScoreSelection( void *menu ); -void CG_BuildSpectatorString( ); +void CG_BuildSpectatorString( void ); qboolean CG_FileExists( char *filename ); void CG_RemoveConsoleLine( void ); @@ -1576,7 +1576,7 @@ int CG_Text_Height( const char *text, float scale, int limit ); float CG_GetValue(int ownerDraw); void CG_RunMenuScript(char **args); void CG_SetPrintString( int type, const char *p ); -void CG_InitTeamChat( ); +void CG_InitTeamChat( void ); void CG_GetTeamColor( vec4_t *color ); const char *CG_GetKillerText(); void CG_Text_PaintChar( float x, float y, float width, float height, float scale, @@ -1603,7 +1603,7 @@ void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum ); // void CG_GhostBuildable( buildable_t buildable ); void CG_Buildable( centity_t *cent ); -void CG_InitBuildables( ); +void CG_InitBuildables( void ); void CG_HumanBuildableExplosion( vec3_t origin, vec3_t dir ); void CG_AlienBuildableExplosion( vec3_t origin, vec3_t dir ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 767aabef..81470e0e 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -34,9 +34,9 @@ This is the only way control passes into the module. This must be the very first function compiled into the .q3vm file ================ */ -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 ) { @@ -524,9 +524,6 @@ void QDECL CG_Error( const char *msg, ... ) trap_Error( text ); } -#ifndef CGAME_HARD_LINKED -// this is only here so the functions in q_shared.c and bg_*.c can link (FIXME) - void QDECL Com_Error( int level, const char *error, ... ) { va_list argptr; @@ -562,8 +559,6 @@ void QDECL Com_Printf( const char *msg, ... ) { CG_Printf ("%s", text); } -#endif - /* @@ -1591,7 +1586,7 @@ static qboolean CG_OwnerDrawVisible( int parameter ) CG_LoadHudMenu ================= */ -void CG_LoadHudMenu( ) +void CG_LoadHudMenu( void ) { char buff[ 1024 ]; const char *hudSet; diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index fd186145..ac1ec181 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -104,6 +104,7 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci ) if( len >= sizeof( text ) - 1 ) { CG_Printf( "File %s too long\n", filename ); + trap_FS_FCloseFile( f ); return qfalse; } diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index f556035d..3e8c5849 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -18,10 +18,10 @@ #include "cg_local.h" -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; } diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index b4ba5696..d940c6d8 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -51,6 +51,8 @@ * SUCH DAMAGE. */ +#include "bg_lib.h" + #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93"; @@ -312,9 +314,6 @@ char *strstr( const char *string, const char *strCharSet ) #endif // bk001211 -// bk001120 - presumably needed for Mac -//#if !defined(_MSC_VER) && !defined(__linux__) -// bk001127 - undid undo #if defined ( Q3_VM ) int tolower( int c ) @@ -335,7 +334,6 @@ int toupper( int c ) } #endif -//#ifndef _MSC_VER void *memmove( void *dest, const void *src, size_t count ) { @@ -1469,10 +1467,6 @@ double _atof( const char **stringPtr ) } -// bk001120 - presumably needed for Mac -//#if !defined ( _MSC_VER ) && ! defined ( __linux__ ) - -// bk001127 - undid undo #if defined ( Q3_VM ) int atoi( const char *string ) @@ -1870,7 +1864,7 @@ reswitch: case 'f': AddFloat( &buf_p, *(double *)arg, width, prec ); -#ifdef __LCC__ +#ifdef Q3_VM arg += 1; // everything is 32 bit in my compiler #else arg += 2; diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h index d31f4cf8..61d64025 100644 --- a/src/game/bg_lib.h +++ b/src/game/bg_lib.h @@ -2,6 +2,12 @@ // compiled for the virtual machine // This file is NOT included on native builds +#ifndef BG_LIB_H +#define BG_LIB_H + +#ifndef NULL +#define NULL ((void *)0) +#endif /* * Portions Copyright (C) 2000-2001 Tim Angus @@ -83,3 +89,4 @@ double fabs( double x ); double acos( double x ); float pow( float x, float y ); +#endif // BG_LIB_H diff --git a/src/game/g_local.h b/src/game/g_local.h index d9997d49..57e1934a 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -709,7 +709,7 @@ void G_AddEvent( gentity_t *ent, int event, int eventParm ); void G_BroadcastEvent( int event, int eventParm ); void G_SetOrigin( gentity_t *ent, vec3_t origin ); void AddRemap(const char *oldShader, const char *newShader, float timeOffset); -const char *BuildShaderStateConfig(); +const char *BuildShaderStateConfig( void ); #define MAX_QUEUE_COMMANDS 64 //should be MAX_RELIABLE_COMMANDS/server.h diff --git a/src/game/g_main.c b/src/game/g_main.c index 52fec4e0..22ff74f7 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -209,9 +209,9 @@ This is the only way control passes into the module. This must be the very first function compiled into the .q3vm file ================ */ -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 ) { @@ -224,7 +224,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, return 0; case GAME_CLIENT_CONNECT: - return (int)ClientConnect( arg0, arg1, arg2 ); + return (long)ClientConnect( arg0, arg1, arg2 ); case GAME_CLIENT_THINK: ClientThink( arg0 ); @@ -698,9 +698,6 @@ void G_ShutdownGame( int restart ) //=================================================================== -#ifndef GAME_HARD_LINKED -// this is only here so the functions in q_shared.c and bg_*.c can link - void QDECL Com_Error( int level, const char *error, ... ) { va_list argptr; @@ -725,8 +722,6 @@ void QDECL Com_Printf( const char *msg, ... ) G_Printf( "%s", text ); } -#endif - /* ======================================================================== diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 080f7b41..c8481d9d 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -297,7 +297,7 @@ spawn_t spawns[ ] = { "misc_anim_model", SP_misc_anim_model }, { "misc_light_flare", SP_misc_light_flare }, - { 0, 0 } + { NULL, 0 } }; /* diff --git a/src/game/g_syscalls.c b/src/game/g_syscalls.c index 93035395..4f8a8ca7 100644 --- a/src/game/g_syscalls.c +++ b/src/game/g_syscalls.c @@ -19,10 +19,10 @@ // this file is only included when building a dll // g_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; } diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 1f4fa6df..9b163a92 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -53,7 +53,7 @@ void AddRemap( const char *oldShader, const char *newShader, float timeOffset ) } } -const char *BuildShaderStateConfig( ) +const char *BuildShaderStateConfig( void ) { static char buff[ MAX_STRING_CHARS * 4 ]; char out[ ( MAX_QPATH * 2 ) + 5 ]; diff --git a/src/game/q_math.c b/src/game/q_math.c index 83410479..4171ebfc 100644 --- a/src/game/q_math.c +++ b/src/game/q_math.c @@ -1466,6 +1466,7 @@ float VectorMinComponent( vec3_t v ) return smallest; } +#ifdef Q3_VM /* =============== round @@ -1478,3 +1479,4 @@ float round( float v ) else return floor( v ); } +#endif diff --git a/src/game/q_shared.h b/src/game/q_shared.h index 6b1c8932..b59f1a5e 100644 --- a/src/game/q_shared.h +++ b/src/game/q_shared.h @@ -248,14 +248,6 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); } #define PATH_SEP '/' -// bk001205 - try -#ifdef Q3_STATIC -#define GAME_HARD_LINKED -#define CGAME_HARD_LINKED -#define UI_HARD_LINKED -#define BOTLIB_HARD_LINKED -#endif - #if !idppc inline static short BigShort( short l) { return ShortSwap(l); } #define LittleShort 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 ); } -- cgit