Elite Force white space clean up

Also fixed some code to match ioq3 (a few comments, a printf, ..).
This commit is contained in:
Zack Middleton 2014-10-29 10:13:04 -05:00
parent 80986cbf21
commit b7cd6b6088
33 changed files with 163 additions and 129 deletions

View file

@ -114,3 +114,4 @@ void BotSetChatName(int chatstate, char *name);
#else
void BotSetChatName(int chatstate, char *name, int client);
#endif

View file

@ -175,6 +175,7 @@ typedef enum {
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 );

View file

@ -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] );

View file

@ -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)] );

View file

@ -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

View file

@ -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
@ -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;

View file

@ -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)

View file

@ -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
@ -649,6 +653,7 @@ static void CLUI_GetCDKey( char *buf, int buflen ) {
}
#endif
/*
====================
CLUI_SetCDKey
@ -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;

View file

@ -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);

View file

@ -677,6 +677,7 @@ typedef enum {
} gameImport_t;
#endif
//
// functions exported by the game subsystem
//

View file

@ -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;
@ -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;
}

View file

@ -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)

View file

@ -320,6 +320,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
}
//================================================================================
//
@ -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
@ -1608,6 +1608,7 @@ netField_t playerStateFields[] =
{ PSF(loopSound), 16 }
};
#endif
/*
=============
MSG_WriteDeltaPlayerstate
@ -1831,7 +1832,7 @@ 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");
Com_Error(ERR_DROP, "invalid playerState field count");
}
for ( i = 0, field = playerStateFields ; i < lc ; i++, field++ ) {
@ -1883,6 +1884,7 @@ void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *t
}
#endif
// read the arrays
#ifdef ELITEFORCE
if(msg->compat || MSG_ReadBits( msg, 1 ))

View file

@ -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

View file

@ -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;

View file

@ -1719,6 +1719,7 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
}
}
/*
===========================================================================

View file

@ -2067,6 +2067,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
}
}
/*
===========================================================================

View file

@ -179,6 +179,7 @@ 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];
@ -186,7 +187,6 @@ void SV_GetChallenge(netadr_t from)
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;

View file

@ -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] );
}

View file

@ -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\\",

View file

@ -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;
}

View file

@ -159,7 +159,6 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
#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
//MSG_WriteLong( msg, client->lastClientCommand );