From b7cd6b60885d3e982121a6221423e33b8453713f Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 29 Oct 2014 10:13:04 -0500 Subject: [PATCH] Elite Force white space clean up Also fixed some code to match ioq3 (a few comments, a printf, ..). --- code/botlib/be_ai_chat.c | 2 +- code/botlib/be_ai_chat.h | 1 + code/cgame/cg_public.h | 8 ++- code/client/cl_cgame.c | 7 +- code/client/cl_console.c | 3 +- code/client/cl_keys.c | 2 + code/client/cl_main.c | 10 +-- code/client/cl_net_chan.c | 3 +- code/client/cl_parse.c | 6 +- code/client/cl_ui.c | 12 +++- code/client/client.h | 2 +- code/client/snd_codec.c | 1 - code/client/snd_dma.c | 2 +- code/client/snd_openal.c | 6 +- code/game/g_public.h | 1 + code/qcommon/common.c | 6 +- code/qcommon/files.c | 8 +-- code/qcommon/msg.c | 36 +++++----- code/qcommon/q_shared.h | 17 ++--- code/renderercommon/tr_types.h | 122 ++++++++++++++++----------------- code/renderergl1/tr_local.h | 2 +- code/renderergl1/tr_shader.c | 2 +- code/renderergl1/tr_surface.c | 1 + code/renderergl2/tr_local.h | 2 +- code/renderergl2/tr_shader.c | 2 +- code/renderergl2/tr_surface.c | 1 + code/server/sv_client.c | 8 +-- code/server/sv_game.c | 6 ++ code/server/sv_init.c | 2 +- code/server/sv_main.c | 1 + code/server/sv_net_chan.c | 3 + code/server/sv_snapshot.c | 5 +- code/ui/ui_public.h | 2 +- 33 files changed, 163 insertions(+), 129 deletions(-) diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c index f8b4ae21..4c705f07 100644 --- a/code/botlib/be_ai_chat.c +++ b/code/botlib/be_ai_chat.c @@ -2806,7 +2806,7 @@ void BotEnterChat(int chatstate, int clientto, int sendto) { bot_chatstate_t *cs; int clientnum; - + cs = BotChatStateFromHandle(chatstate); if (!cs) return; diff --git a/code/botlib/be_ai_chat.h b/code/botlib/be_ai_chat.h index d6c84b40..5718966f 100644 --- a/code/botlib/be_ai_chat.h +++ b/code/botlib/be_ai_chat.h @@ -114,3 +114,4 @@ void BotSetChatName(int chatstate, char *name); #else void BotSetChatName(int chatstate, char *name, int client); #endif + diff --git a/code/cgame/cg_public.h b/code/cgame/cg_public.h index b0df6545..782b9815 100644 --- a/code/cgame/cg_public.h +++ b/code/cgame/cg_public.h @@ -172,9 +172,10 @@ typedef enum { CG_GETCAMERAINFO, */ #else - CG_R_REGISTERSHADER3D, //59 - CG_CVAR_SET_NO_MODIFY, // 60 -#endif + CG_R_REGISTERSHADER3D, //59 + CG_CVAR_SET_NO_MODIFY, // 60 +#endif + CG_MEMSET = 100, CG_MEMCPY, CG_STRNCPY, @@ -231,6 +232,7 @@ typedef enum { CG_LAST_ATTACKER, // int (*CG_LastAttacker)( void ); + #ifndef ELITEFORCE CG_KEY_EVENT, // void (*CG_KeyEvent)( int key, qboolean down ); diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c index ff4471f7..4efa4a96 100644 --- a/code/client/cl_cgame.c +++ b/code/client/cl_cgame.c @@ -549,11 +549,11 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { return S_RegisterSound( VMA(1), args[2] ); case CG_S_STARTBACKGROUNDTRACK: #ifdef ELITEFORCE - if(!VMA(1) || !*((char *) VMA(1))) + if ( !VMA(1) || !*((char *) VMA(1)) ) S_StopBackgroundTrack(); else #endif - S_StartBackgroundTrack(VMA(1), VMA(2)); + S_StartBackgroundTrack( VMA(1), VMA(2) ); return 0; case CG_R_LOADWORLDMAP: re.LoadWorld( VMA(1) ); @@ -645,6 +645,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { #endif + case CG_MEMSET: Com_Memset( VMA(1), args[2], args[3] ); return 0; @@ -669,6 +670,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { #ifndef ELITEFORCE case CG_ACOS: return FloatAsInt( Q_acos( VMF(1) ) ); + case CG_PC_ADD_GLOBAL_DEFINE: return botlib_export->PC_AddGlobalDefine( VMA(1) ); case CG_PC_LOAD_SOURCE: @@ -732,6 +734,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { case CG_CVAR_SET_NO_MODIFY: return qfalse; #endif + default: assert(0); Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] ); diff --git a/code/client/cl_console.c b/code/client/cl_console.c index 74255a79..1dc9265a 100644 --- a/code/client/cl_console.c +++ b/code/client/cl_console.c @@ -665,7 +665,6 @@ void Con_DrawSolidConsole( float frac ) { // draw the background y = frac * SCREEN_HEIGHT; - if ( y < 1 ) { y = 0; } @@ -685,6 +684,8 @@ void Con_DrawSolidConsole( float frac ) { color[2] = 0; color[3] = 1; SCR_FillRect( 0, y, SCREEN_WIDTH, 2, color ); + + // draw the version number re.SetColor( g_color_table[ColorIndex(COLOR_RED)] ); diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c index 976d259f..dd448b46 100644 --- a/code/client/cl_keys.c +++ b/code/client/cl_keys.c @@ -1252,6 +1252,7 @@ void CL_KeyDownEvent( int key, unsigned time ) return; } #endif + if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) { if ( clc.state == CA_ACTIVE && !clc.demoplaying ) { VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME ); @@ -1263,6 +1264,7 @@ void CL_KeyDownEvent( int key, unsigned time ) } return; } + #ifdef ELITEFORCE VM_Call( uivm, UI_KEY_EVENT, key ); #else diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 7a7a7df4..e011cae0 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -733,7 +733,6 @@ void CL_Record_f( void ) { if ( Cmd_Argc() == 2 ) { s = Cmd_Argv(1); Q_strncpyz( demoName, s, sizeof( demoName ) ); - #ifdef LEGACY_PROTOCOL if(clc.compat) #ifdef ELITEFORCE @@ -1041,7 +1040,7 @@ static int CL_WalkDemoExt(char *arg, char *name, int *demofile) { int i = 0; *demofile = 0; - + #ifdef LEGACY_PROTOCOL if(com_legacyprotocol->integer > 0) { @@ -2432,7 +2431,7 @@ void CL_CheckForResend( void ) { data[10+i] = 0; // NOTE TTimo don't forget to set the right data length! - #ifdef ELITEFORCE + #ifdef ELITEFORCE NET_OutOfBandPrint( NS_CLIENT, clc.serverAddress, "%s", data); #else NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) &data[0], i+10 ); @@ -2603,6 +2602,7 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend addresses[numservers].port += *buffptr++; addresses[numservers].port = BigShort( addresses[numservers].port ); #endif + // syntax check if (*buffptr != '\\' && *buffptr != '/') break; @@ -2881,7 +2881,7 @@ void CL_PacketEvent( netadr_t from, msg_t *msg ) { #ifdef ELITEFORCE msg->compat = clc.compat; #endif - + if ( msg->cursize >= 4 && *(int *)msg->data == -1 ) { CL_ConnectionlessPacket( from, msg ); return; @@ -4253,7 +4253,7 @@ void CL_GlobalServers_f( void ) { // -1 is used to distinguish a "no response" i = NET_StringToAdr(masteraddress, &to, NA_UNSPEC); - + if(!i) { Com_Printf( "CL_GlobalServers_f: Error: could not resolve address of master %s\n", masteraddress); diff --git a/code/client/cl_net_chan.c b/code/client/cl_net_chan.c index 8a7f9dc3..b61c5aae 100644 --- a/code/client/cl_net_chan.c +++ b/code/client/cl_net_chan.c @@ -37,7 +37,6 @@ CL_Netchan_Encode ============== */ - static void CL_Netchan_Encode( msg_t *msg ) { int serverId, messageAcknowledge, reliableAcknowledge; int i, index, srdc, sbit, soob; @@ -92,7 +91,6 @@ CL_Netchan_Decode ============== */ - static void CL_Netchan_Decode( msg_t *msg ) { long reliableAcknowledge, i, index; byte key, *string; @@ -186,6 +184,7 @@ qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg ) { ret = Netchan_Process( chan, msg ); if (!ret) return qfalse; + #ifndef ELITEFORCE #ifdef LEGACY_PROTOCOL if(chan->compat) diff --git a/code/client/cl_parse.c b/code/client/cl_parse.c index 1876264f..a9b2dadf 100644 --- a/code/client/cl_parse.c +++ b/code/client/cl_parse.c @@ -213,7 +213,7 @@ void CL_ParseSnapshot( msg_t *msg ) { if(msg->compat) clc.reliableAcknowledge = MSG_ReadLong( msg ); #endif - + // read in the new snapshot to a temporary buffer // we will only copy to cl.snap if it is valid Com_Memset (&newSnap, 0, sizeof(newSnap)); @@ -486,7 +486,7 @@ void CL_ParseGamestate( msg_t *msg ) { cmd = MSG_ReadByte( msg ); #ifdef ELITEFORCE - if((msg->compat && cmd <= 0) || cmd == svc_EOF) + if ( ( msg->compat && cmd <= 0 ) || cmd == svc_EOF ) #else if ( cmd == svc_EOF ) #endif @@ -913,7 +913,7 @@ void CL_ParseServerMessage( msg_t *msg ) { cmd = MSG_ReadByte( msg ); #ifdef ELITEFORCE - if(cmd == svc_EOF || (msg->compat && cmd == -1)) + if ( cmd == svc_EOF || ( msg->compat && cmd == -1 ) ) #else if ( cmd == svc_EOF) #endif diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c index 8aa202e5..cd6f0f7f 100644 --- a/code/client/cl_ui.c +++ b/code/client/cl_ui.c @@ -84,6 +84,7 @@ void LAN_SaveServersToCache( void ) { FS_FCloseFile(fileOut); } + #ifndef ELITEFORCE /* ==================== @@ -206,6 +207,7 @@ static void LAN_RemoveServer(int source, const char *addr) { } #endif + /* ==================== LAN_GetServerCount @@ -226,6 +228,7 @@ static int LAN_GetServerCount( int source ) { } return 0; } + /* ==================== LAN_GetLocalServerAddressString @@ -365,6 +368,7 @@ static serverInfo_t *LAN_GetServerPtr( int source, int n ) { } return NULL; } + /* ==================== LAN_CompareServers @@ -631,7 +635,7 @@ static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) { CLUI_GetCDKey ==================== */ - #ifndef ELITEFORCE +#ifndef ELITEFORCE static void CLUI_GetCDKey( char *buf, int buflen ) { #ifndef STANDALONE cvar_t *fs; @@ -647,7 +651,8 @@ static void CLUI_GetCDKey( char *buf, int buflen ) { *buf = 0; #endif } - #endif +#endif + /* ==================== @@ -966,6 +971,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { case UI_LAN_GETSERVERADDRESSSTRING: LAN_GetServerAddressString( args[1], args[2], VMA(3), args[4] ); return 0; + case UI_LAN_GETSERVERINFO: LAN_GetServerInfo( args[1], args[2], VMA(3), args[4] ); return 0; @@ -1002,6 +1008,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { CLUI_GetCDKey( VMA(1), args[2] ); return 0; #endif + case UI_SET_CDKEY: #ifndef STANDALONE CLUI_SetCDKey( VMA(1) ); @@ -1010,6 +1017,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { #endif #endif return 0; + #ifndef ELITEFORCE case UI_SET_PBCLSTATUS: return 0; diff --git a/code/client/client.h b/code/client/client.h index 50ec58b2..42785c03 100644 --- a/code/client/client.h +++ b/code/client/client.h @@ -575,7 +575,7 @@ void SCR_DrawNamedPic( float x, float y, float width, float height, const char * void SCR_DrawBigString( int x, int y, const char *s, float alpha, qboolean noColorEscape ); // draws a string with embedded color control characters with fade void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color, qboolean noColorEscape ); // ignores embedded color control characters #ifdef ELITEFORCE -void SCR_DrawSmallString( int x, int y, const char *s, float alpha ); // draws a string with embedded color control characters with fade +void SCR_DrawSmallString( int x, int y, const char *s, float alpha ); // draws a string with embedded color control characters with fade #endif void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape ); void SCR_DrawSmallChar( int x, int y, int ch ); diff --git a/code/client/snd_codec.c b/code/client/snd_codec.c index d65d0c00..a01304b6 100644 --- a/code/client/snd_codec.c +++ b/code/client/snd_codec.c @@ -200,7 +200,6 @@ void S_CodecRegister(snd_codec_t *codec) S_CodecLoad ================= */ - void *S_CodecLoad(const char *filename, snd_info_t *info) { return S_CodecGetSound(filename, info); diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index 93b61b4e..3d273432 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -375,7 +375,7 @@ sfxHandle_t S_Base_RegisterSound( const char *name, qboolean compressed ) { sfx->inMemory = qfalse; sfx->soundCompressed = compressed; - S_memoryLoad(sfx); + S_memoryLoad(sfx); if ( sfx->defaultSound ) { #ifdef ELITEFORCE diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index dc8f75bc..dbd94c6c 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -540,10 +540,10 @@ sfxHandle_t S_AL_RegisterSound( const char *sample, qboolean compressed ) S_AL_BufferLoad(sfx, s_alPrecache->integer); #ifdef ELITEFORCE - if(! *knownSfx[sfx].filename) - return 0; + if (!*knownSfx[sfx].filename) + return 0; #endif - + knownSfx[sfx].lastUsedTime = Com_Milliseconds(); if (knownSfx[sfx].isDefault) { diff --git a/code/game/g_public.h b/code/game/g_public.h index b2e27c42..ebfe59f9 100644 --- a/code/game/g_public.h +++ b/code/game/g_public.h @@ -677,6 +677,7 @@ typedef enum { } gameImport_t; #endif + // // functions exported by the game subsystem // diff --git a/code/qcommon/common.c b/code/qcommon/common.c index b6343dc1..42d19ff2 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2456,6 +2456,7 @@ void Com_ReadCDKey( const char *filename ) { fileHandle_t f; char buffer[33]; char fbuffer[MAX_OSPATH]; + #ifdef ELITEFORCE int index = 0; char curchar; @@ -2528,7 +2529,7 @@ void Com_ReadCDKey( const char *filename ) { #else FS_Read( buffer, 16, f ); FS_FCloseFile( f ); - + if (CL_CDKeyValidate(buffer, NULL)) { Q_strncpyz( cl_cdkey, buffer, 17 ); } else { @@ -2585,17 +2586,20 @@ static void Com_WriteCDKey( const char *filename, const char *ikey ) { mode_t savedumask; #endif + #ifdef ELITEFORCE sprintf(fbuffer, "%s/efq3.key", filename); #else Com_sprintf(fbuffer, sizeof(fbuffer), "%s/q3key", filename); #endif + #ifdef ELITEFORCE Q_strncpyz( key, ikey, 23 ); key[22] = '\0'; #else Q_strncpyz( key, ikey, 17 ); + if(!CL_CDKeyValidate(key, NULL) ) { return; } diff --git a/code/qcommon/files.c b/code/qcommon/files.c index fc94cb1c..b6a80f89 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -3410,7 +3410,6 @@ static void FS_CheckPak0( void ) { if(pakBasename[3] == '0') { - Com_Printf("\n\n" "**************************************************\n" "WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n" @@ -3476,11 +3475,13 @@ static void FS_CheckPak0( void ) "\"pak0.pk3\" is missing. Please copy it " "from your legitimate EliteForce CDROM. "); } + if((foundPak & 0x1fe) != 0x1fe) { Q_strcat(errorText, sizeof(errorText), "Patch files are missing. Please\n" - "copy the .pk3 files from EliteForce patch 1.2 to baseEF.\n"); } + "copy the .pk3 files from EliteForce patch 1.2 to baseEF.\n"); + } Q_strcat(errorText, sizeof(errorText), va("Also check that your EliteForce executable is in " @@ -3534,7 +3535,6 @@ static void FS_CheckPak0( void ) { if(pakBasename[3] == '0') { - Com_Printf("\n\n" "**************************************************\n" "WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n" @@ -3651,6 +3651,7 @@ static void FS_CheckPak0( void ) "\"pak0.pk3\" is missing. Please copy it " "from your legitimate Q3 CDROM. "); } + if((foundPak & 0x1fe) != 0x1fe) { Q_strcat(errorText, sizeof(errorText), @@ -4227,7 +4228,6 @@ void FS_FilenameCompletion( const char *dir, const char *ext, callback( filename ); } FS_FreeFileList( filenames ); - } const char *FS_GetCurrentGameDir(void) diff --git a/code/qcommon/msg.c b/code/qcommon/msg.c index f125e7cb..5a6ee923 100644 --- a/code/qcommon/msg.c +++ b/code/qcommon/msg.c @@ -320,6 +320,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) { } + //================================================================================ // @@ -385,7 +386,7 @@ void MSG_WriteString( msg_t *sb, const char *s ) { MSG_WriteData (sb, "", 1); } else { #ifdef ELITEFORCE - int l; + int l; #else int l,i; #endif @@ -417,7 +418,7 @@ void MSG_WriteBigString( msg_t *sb, const char *s ) { MSG_WriteData (sb, "", 1); } else { #ifdef ELITEFORCE - int l; + int l; #else int l,i; #endif @@ -550,6 +551,7 @@ char *MSG_ReadString( msg_t *msg ) { c = '.'; } #endif + string[l] = c; l++; } while (l < sizeof(string)-1); @@ -620,6 +622,7 @@ char *MSG_ReadStringLine( msg_t *msg ) { c = '.'; } #endif + string[l] = c; l++; } while (l < sizeof(string)-1); @@ -838,11 +841,7 @@ void MSG_ReadDeltaUsercmd( msg_t *msg, usercmd_t *from, usercmd_t *to ) { /* ===================== -<<<<<<< Updated upstream -MSG_WriteDeltaUsercmd -======= MSG_WriteDeltaUsercmdKey ->>>>>>> Stashed changes ===================== */ void MSG_WriteDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to ) { @@ -884,7 +883,7 @@ void MSG_WriteDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t * /* ===================== -MSG_ReadDeltaUsercmd +MSG_ReadDeltaUsercmdKey ===================== */ void MSG_ReadDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to ) { @@ -1112,6 +1111,7 @@ netField_t entityStateFields[] = }; #endif + // if (int)f == f and (int)f + ( 1<<(FLOAT_INT_BITS-1) ) < ( 1 << FLOAT_INT_BITS ) // the float will be sent with FLOAT_INT_BITS, otherwise all 32 bits will be sent #define FLOAT_INT_BITS 13 @@ -1137,8 +1137,8 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity float fullFloat; int *fromF, *toF; #ifdef ELITEFORCE - byte vector[PVECTOR_BYTES]; - int vectorIndex = -1; + byte vector[PVECTOR_BYTES]; + int vectorIndex = -1; #endif numFields = ARRAY_LEN( entityStateFields ); @@ -1163,7 +1163,7 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity Com_Error (ERR_FATAL, "MSG_WriteDeltaEntity: Bad entity number: %i", to->number ); } - #ifdef ELITEFORCE + #ifdef ELITEFORCE if(msg->compat) Com_Memset(vector, 0, sizeof(vector)); #endif @@ -1337,9 +1337,9 @@ void MSG_ReadDeltaEntity( msg_t *msg, entityState_t *from, entityState_t *to, int trunc; int startBit, endBit; #ifdef ELITEFORCE - int vectorIndex; - byte vector_space[PVECTOR_BYTES]; - byte *vector = vector_space; + int vectorIndex; + byte vector_space[PVECTOR_BYTES]; + byte *vector = vector_space; #endif if ( number < 0 || number >= MAX_GENTITIES) { @@ -1608,6 +1608,7 @@ netField_t playerStateFields[] = { PSF(loopSound), 16 } }; #endif + /* ============= MSG_WriteDeltaPlayerstate @@ -1652,7 +1653,7 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p #ifdef ELITEFORCE } #endif - + oldsize += numFields - lc; #ifdef ELITEFORCE @@ -1830,8 +1831,8 @@ void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *t { lc = MSG_ReadByte(msg); - if(lc > numFields || lc < 0) - Com_Error(ERR_DROP, "invalid entityState field count"); + if(lc > numFields || lc < 0) + Com_Error(ERR_DROP, "invalid playerState field count"); } for ( i = 0, field = playerStateFields ; i < lc ; i++, field++ ) { @@ -1882,7 +1883,8 @@ void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *t #ifdef ELITEFORCE } #endif - + + // read the arrays #ifdef ELITEFORCE if(msg->compat || MSG_ReadBits( msg, 1 )) diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index dfa8ee17..67183196 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -1158,9 +1158,9 @@ typedef struct playerState_s { vec3_t velocity; int weaponTime; #ifdef ELITEFORCE - int rechargeTime; // for the phaser - short useTime; // use debounce - int introTime; // for the holodoor + int rechargeTime; // for the phaser + short useTime; // use debounce + int introTime; // for the holodoor #endif int gravity; int speed; @@ -1263,11 +1263,11 @@ typedef struct playerState_s { // usercmd_t is sent to the server each client frame #ifdef ELITEFORCE typedef struct usercmd_s { - int serverTime; - byte buttons; - byte weapon; - int angles[3]; - signed char forwardmove, rightmove, upmove; + int serverTime; + byte buttons; + byte weapon; + int angles[3]; + signed char forwardmove, rightmove, upmove; } usercmd_t; #else typedef struct usercmd_s { @@ -1278,6 +1278,7 @@ typedef struct usercmd_s { signed char forwardmove, rightmove, upmove; } usercmd_t; #endif + //=================================================================== // if entityState->solid == SOLID_BMODEL, modelindex is an inline model number diff --git a/code/renderercommon/tr_types.h b/code/renderercommon/tr_types.h index ed5353b4..a6749132 100644 --- a/code/renderercommon/tr_types.h +++ b/code/renderercommon/tr_types.h @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define __TR_TYPES_H -#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces +#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces #define REFENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing #define REFENTITYNUM_MASK ((1<lightingOrigin instead of refEntity->origin - // for lighting. This allows entities to sink into the floor - // with their origin going solid, and allows all parts of a - // player to get the same lighting + // for lighting. This allows entities to sink into the floor + // with their origin going solid, and allows all parts of a + // player to get the same lighting #define RF_SHADOW_PLANE 0x0100 // use refEntity->shadowPlane #define RF_WRAP_FRAMES 0x0200 // mod the model frames by the maxframes to allow continuous @@ -65,8 +65,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif // refdef flags -#define RDF_NOWORLDMODEL 1 // used for player configuration screen -#define RDF_HYPERSPACE 4 // teleportation effect +#define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen +#define RDF_HYPERSPACE 0x0004 // teleportation effect typedef struct { vec3_t xyz; @@ -82,23 +82,23 @@ typedef struct poly_s { #ifdef ELITEFORCE typedef enum { - RT_MODEL, - RT_SPRITE, - RT_ORIENTEDSPRITE, // Replaces RT_POLY, which wasn't used. --Pat - RT_ALPHAVERTPOLY, // Individual alpha levels on each vertex - RT_BEAM, - RT_RAIL_CORE, - RT_RAIL_RINGS, - RT_LIGHTNING, - RT_PORTALSURFACE, // doesn't draw anything, just info for portals - RT_LINE, // New type for Trek MP --Pat - RT_ORIENTEDLINE, - RT_LINE2, // New line type for Trek MP, with taper support --Pat - RT_BEZIER, // what he said --keith - RT_CYLINDER, // Yet another Trek primitive! - RT_ELECTRICITY, // Yet another Trek primitive! + RT_MODEL, + RT_SPRITE, + RT_ORIENTEDSPRITE, // Replaces RT_POLY, which wasn't used. --Pat + RT_ALPHAVERTPOLY, // Individual alpha levels on each vertex + RT_BEAM, + RT_RAIL_CORE, + RT_RAIL_RINGS, + RT_LIGHTNING, + RT_PORTALSURFACE, // doesn't draw anything, just info for portals + RT_LINE, // New type for Trek MP --Pat + RT_ORIENTEDLINE, + RT_LINE2, // New line type for Trek MP, with taper support --Pat + RT_BEZIER, // what he said --keith + RT_CYLINDER, // Yet another Trek primitive! + RT_ELECTRICITY, // Yet another Trek primitive! - RT_MAX_REF_ENTITY_TYPE + RT_MAX_REF_ENTITY_TYPE } refEntityType_t; #else typedef enum { @@ -147,44 +147,44 @@ typedef struct { // extra sprite information #ifdef ELITEFORCE - union - { - struct - { - float rotation; - float radius; - byte vertRGBA[4][4]; - } sprite; - struct - { - float width; - float width2; - float stscale; - } line; - struct // that whole put-the-opening-brace-on-the-same-line-as-the-beginning-of-the-definition coding style is fecal // I agree. - { - float width; - vec3_t control1; - vec3_t control2; - } bezier; - struct - { - float width; - float width2; - float stscale; - float height; - float bias; - qboolean wrap; - } cylinder; - struct - { - float width; - float deviation; - float stscale; - qboolean wrap; - qboolean taper; - } electricity; - } data; + union + { + struct + { + float rotation; + float radius; + byte vertRGBA[4][4]; + } sprite; + struct + { + float width; + float width2; + float stscale; + } line; + struct // that whole put-the-opening-brace-on-the-same-line-as-the-beginning-of-the-definition coding style is fecal // I agree. + { + float width; + vec3_t control1; + vec3_t control2; + } bezier; + struct + { + float width; + float width2; + float stscale; + float height; + float bias; + qboolean wrap; + } cylinder; + struct + { + float width; + float deviation; + float stscale; + qboolean wrap; + qboolean taper; + } electricity; + } data; #else float radius; float rotation; diff --git a/code/renderergl1/tr_local.h b/code/renderergl1/tr_local.h index 0846f539..5d0fba27 100644 --- a/code/renderergl1/tr_local.h +++ b/code/renderergl1/tr_local.h @@ -944,7 +944,7 @@ typedef struct { float triangleTable[FUNCTABLE_SIZE]; float sawToothTable[FUNCTABLE_SIZE]; float inverseSawToothTable[FUNCTABLE_SIZE]; - float noiseTable[FUNCTABLE_SIZE]; + float noiseTable[FUNCTABLE_SIZE]; float fogTable[FOG_TABLE_SIZE]; } trGlobals_t; diff --git a/code/renderergl1/tr_shader.c b/code/renderergl1/tr_shader.c index 3bb2a7c7..6450abf0 100644 --- a/code/renderergl1/tr_shader.c +++ b/code/renderergl1/tr_shader.c @@ -3034,8 +3034,8 @@ static void ScanAndLoadShaderFiles( void ) break; } } + - if (buffers[i]) sum += summand; } diff --git a/code/renderergl1/tr_surface.c b/code/renderergl1/tr_surface.c index 84fc065b..6cd3320d 100644 --- a/code/renderergl1/tr_surface.c +++ b/code/renderergl1/tr_surface.c @@ -1719,6 +1719,7 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) { } } + /* =========================================================================== diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index 687708bb..2c3b13de 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1651,7 +1651,7 @@ typedef struct { float triangleTable[FUNCTABLE_SIZE]; float sawToothTable[FUNCTABLE_SIZE]; float inverseSawToothTable[FUNCTABLE_SIZE]; - float noiseTable[FUNCTABLE_SIZE]; + float noiseTable[FUNCTABLE_SIZE]; float fogTable[FOG_TABLE_SIZE]; } trGlobals_t; diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index d6263161..9d178b35 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -3820,8 +3820,8 @@ static void ScanAndLoadShaderFiles( void ) break; } } + - if (buffers[i]) sum += summand; } diff --git a/code/renderergl2/tr_surface.c b/code/renderergl2/tr_surface.c index 390a4407..0ac8ea3c 100644 --- a/code/renderergl2/tr_surface.c +++ b/code/renderergl2/tr_surface.c @@ -2067,6 +2067,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) { } } + /* =========================================================================== diff --git a/code/server/sv_client.c b/code/server/sv_client.c index 275c49a8..79eaa0e6 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -179,14 +179,14 @@ void SV_GetChallenge(netadr_t from) Com_DPrintf( "authorize server timed out\n" ); else { + // otherwise send their ip to the authorize server #ifndef ELITEFORCE cvar_t *fs; char game[1024]; #endif Com_DPrintf( "sending getIpAuthorize for %s\n", NET_AdrToString( from )); - - // otherwise send their ip to the authorize server + #ifdef ELITEFORCE NET_OutOfBandPrint( NS_SERVER, svs.authorizeAddress, "getIpAuthorize %i %i.%i.%i.%i ", challenge->challenge, @@ -204,6 +204,7 @@ void SV_GetChallenge(netadr_t from) "getIpAuthorize %i %i.%i.%i.%i %s 0 %s", challenge->challenge, from.ip[0], from.ip[1], from.ip[2], from.ip[3], game, sv_strictAuth->string ); #endif + return; } } @@ -554,7 +555,6 @@ gotnewcl: ent = SV_GentityNum( clientNum ); newcl->gentity = ent; - // save the challenge newcl->challenge = challenge; @@ -2043,7 +2043,7 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) { c = MSG_ReadByte( msg ); #ifdef ELITEFORCE - if(msg->compat && c == -1) + if ( msg->compat && c == -1 ) c = clc_EOF; #endif if ( c == clc_EOF ) diff --git a/code/server/sv_game.c b/code/server/sv_game.c index 2e053533..a7cfaa47 100644 --- a/code/server/sv_game.c +++ b/code/server/sv_game.c @@ -339,6 +339,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { case G_FS_SEEK: return FS_Seek( args[1], args[2], args[3] ); #endif + case G_LOCATE_GAME_DATA: SV_LocateGameData( VMA(1), args[2], args[3], VMA(4), args[5] ); return 0; @@ -435,6 +436,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { Q_SnapVector(VMA(1)); return 0; #endif + //==================================== case BOTLIB_SETUP: @@ -461,6 +463,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { case BOTLIB_PC_SOURCE_FILE_AND_LINE: return botlib_export->PC_SourceFileAndLine( args[1], VMA(2), VMA(3) ); #endif + case BOTLIB_START_FRAME: return botlib_export->BotLibStartFrame( VMF(1) ); case BOTLIB_LOAD_MAP: @@ -477,6 +480,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { case BOTLIB_USER_COMMAND: SV_ClientThink( &svs.clients[args[1]], VMA(2) ); return 0; + #ifndef ELITEFORCE case BOTLIB_AAS_BBOX_AREAS: return botlib_export->aas.AAS_BBoxAreas( VMA(1), VMA(2), VMA(3), args[4] ); @@ -530,6 +534,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { case BOTLIB_AAS_PREDICT_ROUTE: return botlib_export->aas.AAS_PredictRoute( VMA(1), args[2], VMA(3), args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11] ); #endif + case BOTLIB_AAS_SWIMMING: return botlib_export->aas.AAS_Swimming( VMA(1) ); case BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT: @@ -877,6 +882,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { botlib_export->ea.EA_Attack( args[1] ); return 0; #endif + default: Com_Error( ERR_DROP, "Bad game system trap: %ld", (long int) args[0] ); } diff --git a/code/server/sv_init.c b/code/server/sv_init.c index e7cf7f45..aa4eda4b 100644 --- a/code/server/sv_init.c +++ b/code/server/sv_init.c @@ -731,7 +731,7 @@ void SV_FinalMessage( char *message ) { // don't send a disconnect to a local client if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) { SV_SendServerCommand( cl, "print \"%s\n\"\n", message ); - + #ifdef ELITEFORCE if(cl->compat) SV_SendServerCommand(cl, "disconnect Server shutdown: %s", message); diff --git a/code/server/sv_main.c b/code/server/sv_main.c index 66abe0a9..155a7f5b 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -320,6 +320,7 @@ void SV_MasterHeartbeat(const char *message) // this command should be changed if the server info / status format // ever incompatably changes + #ifdef ELITEFORCE if(adr[i][0].type != NA_BAD) NET_OutOfBandPrint(NS_SERVER, adr[i][0], "\\heartbeat\\%d\\gamename\\%s\\", diff --git a/code/server/sv_net_chan.c b/code/server/sv_net_chan.c index 3f346961..cdbf2677 100644 --- a/code/server/sv_net_chan.c +++ b/code/server/sv_net_chan.c @@ -134,6 +134,7 @@ static void SV_Netchan_Decode( client_t *client, msg_t *msg ) { #endif + /* ================= SV_Netchan_FreeQueue @@ -273,12 +274,14 @@ qboolean SV_Netchan_Process( client_t *client, msg_t *msg ) { ret = Netchan_Process( &client->netchan, msg ); if (!ret) return qfalse; + #ifndef ELITEFORCE #ifdef LEGACY_PROTOCOL if(client->compat) SV_Netchan_Decode(client, msg); #endif #endif + return qtrue; } diff --git a/code/server/sv_snapshot.c b/code/server/sv_snapshot.c index f7333ab7..f34adb55 100644 --- a/code/server/sv_snapshot.c +++ b/code/server/sv_snapshot.c @@ -155,10 +155,9 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) { MSG_WriteByte (msg, svc_snapshot); #ifdef ELITEFORCE - if(msg->compat) - #endif + if(msg->compat) + #endif MSG_WriteLong( msg, client->lastClientCommand ); - // NOTE, MRE: now sent at the start of every message from server to client // let the client know which reliable clientCommands we have received diff --git a/code/ui/ui_public.h b/code/ui/ui_public.h index a2eea8ad..2ed5fe04 100644 --- a/code/ui/ui_public.h +++ b/code/ui/ui_public.h @@ -86,7 +86,7 @@ typedef enum { UI_LAN_GETLOCALSERVERADDRESSSTRING, UI_LAN_GETGLOBALSERVERCOUNT, UI_LAN_GETGLOBALSERVERADDRESSSTRING, -#endif +#endif UI_LAN_GETPINGQUEUECOUNT, UI_LAN_CLEARPING, UI_LAN_GETPING,