Skip to content

Commit

Permalink
Elite Force white space clean up
Browse files Browse the repository at this point in the history
Also fixed some code to match ioq3 (a few comments, a printf, ..).
  • Loading branch information
zturtleman committed Oct 29, 2014
1 parent 80986cb commit b7cd6b6
Show file tree
Hide file tree
Showing 33 changed files with 164 additions and 130 deletions.
2 changes: 1 addition & 1 deletion code/botlib/be_ai_chat.c
Expand Up @@ -2806,7 +2806,7 @@ void BotEnterChat(int chatstate, int clientto, int sendto)
{
bot_chatstate_t *cs;
int clientnum;

cs = BotChatStateFromHandle(chatstate);
if (!cs) return;

Expand Down
1 change: 1 addition & 0 deletions code/botlib/be_ai_chat.h
Expand Up @@ -114,3 +114,4 @@ void BotSetChatName(int chatstate, char *name);
#else
void BotSetChatName(int chatstate, char *name, int client);
#endif

8 changes: 5 additions & 3 deletions code/cgame/cg_public.h
Expand Up @@ -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,
Expand Down Expand Up @@ -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 );
Expand Down
7 changes: 5 additions & 2 deletions code/client/cl_cgame.c
Expand Up @@ -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) );
Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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] );
Expand Down
3 changes: 2 additions & 1 deletion code/client/cl_console.c
Expand Up @@ -665,7 +665,6 @@ void Con_DrawSolidConsole( float frac ) {

// draw the background
y = frac * SCREEN_HEIGHT;

if ( y < 1 ) {
y = 0;
}
Expand All @@ -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)] );
Expand Down
2 changes: 2 additions & 0 deletions code/client/cl_keys.c
Expand Up @@ -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 );
Expand All @@ -1263,6 +1264,7 @@ void CL_KeyDownEvent( int key, unsigned time )
}
return;
}

#ifdef ELITEFORCE
VM_Call( uivm, UI_KEY_EVENT, key );
#else
Expand Down
10 changes: 5 additions & 5 deletions code/client/cl_main.c
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions code/client/cl_net_chan.c
Expand Up @@ -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;
Expand Down Expand Up @@ -92,7 +91,6 @@ CL_Netchan_Decode
==============
*/

static void CL_Netchan_Decode( msg_t *msg ) {
long reliableAcknowledge, i, index;
byte key, *string;
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions code/client/cl_parse.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions code/client/cl_ui.c
Expand Up @@ -84,6 +84,7 @@ void LAN_SaveServersToCache( void ) {
FS_FCloseFile(fileOut);
}


#ifndef ELITEFORCE
/*
====================
Expand Down Expand Up @@ -206,6 +207,7 @@ static void LAN_RemoveServer(int source, const char *addr) {
}
#endif


/*
====================
LAN_GetServerCount
Expand All @@ -226,6 +228,7 @@ static int LAN_GetServerCount( int source ) {
}
return 0;
}

/*
====================
LAN_GetLocalServerAddressString
Expand Down Expand Up @@ -365,6 +368,7 @@ static serverInfo_t *LAN_GetServerPtr( int source, int n ) {
}
return NULL;
}

/*
====================
LAN_CompareServers
Expand Down Expand Up @@ -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;
Expand All @@ -647,7 +651,8 @@ static void CLUI_GetCDKey( char *buf, int buflen ) {
*buf = 0;
#endif
}
#endif
#endif


/*
====================
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) );
Expand All @@ -1010,6 +1017,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
#endif
#endif
return 0;

#ifndef ELITEFORCE
case UI_SET_PBCLSTATUS:
return 0;
Expand Down
2 changes: 1 addition & 1 deletion code/client/client.h
Expand Up @@ -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 );
Expand Down
1 change: 0 additions & 1 deletion code/client/snd_codec.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion code/client/snd_dma.c
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions code/client/snd_openal.c
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions code/game/g_public.h
Expand Up @@ -677,6 +677,7 @@ typedef enum {
} gameImport_t;
#endif


//
// functions exported by the game subsystem
//
Expand Down
6 changes: 5 additions & 1 deletion code/qcommon/common.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b7cd6b6

Please sign in to comment.