Skip to content

Commit

Permalink
general: clean up, refs #31
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSimek committed Dec 30, 2012
1 parent 2923f20 commit ab3ec05
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 55 deletions.
3 changes: 0 additions & 3 deletions src/client/cl_keys.c
Expand Up @@ -1473,7 +1473,6 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
}

// most keys during demo playback will bring up the menu, but non-ascii

// keys can still be used for bound actions
if (down && (key < 128 || key == K_MOUSE1)
&& (clc.demoplaying || cls.state == CA_CINEMATIC) && !cls.keyCatchers)
Expand Down Expand Up @@ -1612,12 +1611,10 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
}
else if (cls.state == CA_DISCONNECTED)
{

if (!onlybinds)
{
Console_Key(key);
}

}
else
{
Expand Down
22 changes: 10 additions & 12 deletions src/client/cl_main.c
Expand Up @@ -49,8 +49,13 @@ cvar_t *cl_nodelta;
cvar_t *cl_debugMove;

cvar_t *cl_noprint;
cvar_t *cl_motd;

// Auto-Update
cvar_t *cl_autoupdate;
cvar_t *cl_updateavailable;
cvar_t *cl_updatefiles;

cvar_t *cl_motd;

cvar_t *rcon_client_password;
cvar_t *rconAddress;
Expand Down Expand Up @@ -101,11 +106,6 @@ cvar_t *cl_missionStats;
cvar_t *cl_language;
cvar_t *cl_debugTranslation;

// Auto-Update
cvar_t *cl_updateavailable;
cvar_t *cl_updatefiles;


cvar_t *cl_profile;
cvar_t *cl_defaultProfile;

Expand Down Expand Up @@ -168,8 +168,6 @@ void CL_LoadTranslations_f(void);
void CL_WriteWaveClose(void);
void CL_WavStopRecord_f(void);

void CL_GetAndRegGUID(void);

void CL_PurgeCache(void)
{
cls.doCachePurge = qtrue;
Expand Down Expand Up @@ -585,7 +583,7 @@ typedef struct wav_hdr_s
unsigned int Format; // big endian

unsigned int Subchunk1ID; // big endian
unsigned int Subchunk1Size; // little endian
unsigned int Subchunk1Size; // little endian
unsigned short AudioFormat; // little endian
unsigned short NumChannels; // little endian
unsigned int SampleRate; // little endian
Expand All @@ -594,7 +592,7 @@ typedef struct wav_hdr_s
unsigned short BitsPerSample; // little endian

unsigned int Subchunk2ID; // big endian
unsigned int Subchunk2Size; // little indian ;)
unsigned int Subchunk2Size; // little indian ;)

unsigned int NumSamples;
} wav_hdr_t;
Expand Down Expand Up @@ -1088,7 +1086,7 @@ void CL_Disconnect(qboolean showMainMenu)

SCR_StopCinematic();
S_ClearSoundBuffer(qtrue); // modified
#if 1

// send a disconnect message to the server
// send it a few times in case one is dropped
if (cls.state >= CA_CONNECTED)
Expand All @@ -1098,7 +1096,7 @@ void CL_Disconnect(qboolean showMainMenu)
CL_WritePacket();
CL_WritePacket();
}
#endif

CL_ClearState();

// wipe the client connection
Expand Down
7 changes: 1 addition & 6 deletions src/client/cl_parse.c
Expand Up @@ -64,7 +64,6 @@ MESSAGE PARSING
=========================================================================
*/
#if 1

int entLastVisible[MAX_CLIENTS];

Expand Down Expand Up @@ -187,8 +186,6 @@ qboolean isEntVisible(entityState_t *ent)
return qfalse;
}

#endif

/*
==================
CL_DeltaEntity
Expand Down Expand Up @@ -220,7 +217,6 @@ void CL_DeltaEntity(msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t *
return; // entity was delta removed
}

#if 1
// Only draw clients if visible
if (clc.onlyVisibleClients)
{
Expand All @@ -240,7 +236,6 @@ void CL_DeltaEntity(msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t *
}
}
}
#endif

cl.parseEntitiesNum++;
frame->numEntities++;
Expand Down Expand Up @@ -604,8 +599,8 @@ void CL_SystemInfoChanged(void)
char value[BIG_INFO_VALUE];

systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO];

// NOTE: when the serverId changes, any further messages we send to the server will use this new serverId
// show_bug.cgi?id=475
// in some cases, outdated cp commands might get sent with this news serverId
cl.serverId = atoi(Info_ValueForKey(systemInfo, "sv_serverid"));

Expand Down
1 change: 0 additions & 1 deletion src/game/g_client.c
Expand Up @@ -2887,7 +2887,6 @@ void ClientSpawn(gentity_t *ent, qboolean revived, qboolean teamChange, qboolean
// clear entity state values
BG_PlayerStateToEntityState(&client->ps, &ent->s, qtrue);

// show_bug.cgi?id=569
G_ResetMarkers(ent);

// start the scripting system
Expand Down
1 change: 0 additions & 1 deletion src/null/null_input.c
Expand Up @@ -49,7 +49,6 @@ void Sys_SendKeyEvents(void)
{
}

// TTimo: added for win32 dedicated
void IN_MouseEvent(int mstate)
{
}
Expand Down
3 changes: 1 addition & 2 deletions src/null/null_snddma.c
Expand Up @@ -70,12 +70,11 @@ void S_ClearSoundBuffer(qboolean killStreaming)
{
}

// TTimo: added for win32 dedicated
// added for win32 dedicated
void SNDDMA_Activate(void)
{
}

// show_bug.cgi?id=574
int S_GetSoundLength(sfxHandle_t sfxHandle)
{
Com_Error(ERR_DROP, "null_snddma.c: S_GetSoundLength\n");
Expand Down
7 changes: 3 additions & 4 deletions src/qcommon/cmd.c
Expand Up @@ -351,7 +351,8 @@ void Cmd_Vstr_f(void)
}

/**
* @brief Just prints the rest of the line to the console
* @brief Prints the rest of the line to the console
* and shows a notification if connected to a server.
*/
void Cmd_Echo_f(void)
{
Expand Down Expand Up @@ -518,9 +519,7 @@ char *Cmd_Cmd(void)
/*
* @brief Replaces command separators with space to prevent interpretation
*
* This is a hack to protect buggy qvms
* https://bugzilla.icculus.org/show_bug.cgi?id=3593
* https://bugzilla.icculus.org/show_bug.cgi?id=4769
* This prevents the infamous callvote hack.
*/
void Cmd_Args_Sanitize(void)
{
Expand Down
4 changes: 2 additions & 2 deletions src/qcommon/files.c
Expand Up @@ -3393,8 +3393,8 @@ void FS_Shutdown(qboolean closemfp)
/*
================
FS_ReorderPurePaks
NOTE TTimo: the reordering that happens here is not reflected in the cvars (\cvarlist *pak*)
this can lead to misleading situations, see show_bug.cgi?id=540
NOTE: the reordering that happens here is not reflected in the cvars (\cvarlist *pak*)
this can lead to misleading situations
================
*/
static void FS_ReorderPurePaks(void)
Expand Down
4 changes: 2 additions & 2 deletions src/qcommon/msg.c
Expand Up @@ -844,7 +844,7 @@ void MSG_ReadDeltaUsercmd(msg_t *msg, usercmd_t *from, usercmd_t *to)
to->angles[1] = MSG_ReadDelta(msg, from->angles[1], 16);
to->angles[2] = MSG_ReadDelta(msg, from->angles[2], 16);

// disallow moves of -128 - see https://bugzilla.icculus.org/show_bug.cgi?id=5273 patch by /dev/humancontroller
// disallow moves of -128 (speedhack)
to->forwardmove = MSG_ReadDelta(msg, from->forwardmove, 8);
if (to->forwardmove == -128)
{
Expand Down Expand Up @@ -941,7 +941,7 @@ void MSG_ReadDeltaUsercmdKey(msg_t *msg, int key, usercmd_t *from, usercmd_t *to
to->angles[1] = MSG_ReadDeltaKey(msg, key, from->angles[1], 16);
to->angles[2] = MSG_ReadDeltaKey(msg, key, from->angles[2], 16);

// disallow moves of -128 - see https://bugzilla.icculus.org/show_bug.cgi?id=5273 patch by /dev/humancontroller
// disallow moves of -128 (speedhack)
to->forwardmove = MSG_ReadDeltaKey(msg, key, from->forwardmove, 8);
if (to->forwardmove == -128)
{
Expand Down
26 changes: 14 additions & 12 deletions src/qcommon/q_shared.h
Expand Up @@ -1283,7 +1283,8 @@ typedef enum
// will occur

// you can't add anything to this without modifying the code in msg.c
// (unless it doesnt need transmitted over the network, in which case it should prolly go in the new pmext struct anyway)
// (unless it doesnt need transmitted over the network, in which case it should
// prolly go in the new pmext struct anyway)

// playerState_t is a full superset of entityState_t as it is used by players,
// so if a playerState_t is transmitted, the entityState_t can be fully derived
Expand All @@ -1301,7 +1302,7 @@ typedef struct playerState_s
vec3_t velocity;
int weaponTime;
int weaponDelay; // for weapons that don't fire immediately when 'fire' is hit (grenades, venom, ...)
int grenadeTimeLeft; // for delayed grenade throwing. this is set to a #define for grenade
int grenadeTimeLeft; // for delayed grenade throwing. this is set to a #define for grenade
// lifetime when the attack button goes down, then when attack is released
// this is the amount of time left before the grenade goes off (or if it
// gets to 0 while in players hand, it explodes)
Expand Down Expand Up @@ -1331,7 +1332,7 @@ typedef struct playerState_s
int eventSequence; // pmove generated events
int events[MAX_EVENTS];
int eventParms[MAX_EVENTS];
int oldEventSequence; // so we can see which events have been added since we last converted to entityState_t
int oldEventSequence; // so we can see which events have been added since we last converted to entityState_t

int externalEvent; // events set on player from another source
int externalEventParm;
Expand Down Expand Up @@ -1396,7 +1397,7 @@ typedef struct playerState_s

// use the pmoveExt_t structure in bg_public.h to store this kind of data now (persistant on client, not network transmitted)

int ping; // server to game info for scoreboard
int ping; // server to game info for scoreboard
int pmove_framecount;
int entityEventSequence;

Expand All @@ -1410,12 +1411,14 @@ typedef struct playerState_s

qboolean releasedFire;

float aimSpreadScaleFloat; // the server-side aimspreadscale that lets it track finer changes but still only
float aimSpreadScaleFloat; // the server-side aimspreadscale that lets it track finer changes but still only
// transmit the 8bit int to the client
int aimSpreadScale; // 0 - 255 increases with angular movement // Arnout : DOES get send over the network
int lastFireTime; // used by server to hold last firing frame briefly when randomly releasing trigger (AI)
int quickGrenTime;
int leanStopDebounceTime;
int aimSpreadScale; // 0 - 255 increases with angular movement. DOES get send over the network
int lastFireTime; // used by server to hold last firing frame briefly when randomly releasing trigger (AI)
// Set, but never used?

int quickGrenTime; // unused
int leanStopDebounceTime; // unused

// seems like heat and aimspread could be tied together somehow, however, they (appear to) change at different rates and
// I can't currently see how to optimize this to one server->client transmission "weapstatus" value.
Expand All @@ -1429,10 +1432,9 @@ typedef struct playerState_s

//====================================================================

//
// usercmd_t->button bits, many of which are generated by the client system,
// so they aren't game/cgame only definitions
//

#define BUTTON_ATTACK 1
#define BUTTON_TALK 2 // displays talk balloon and disables actions
//#define BUTTON_USE_HOLDABLE 4 // obsolete/unused
Expand Down Expand Up @@ -1659,7 +1661,7 @@ typedef struct entityState_s
int eventParms[MAX_EVENTS];

// for players
int powerups; // bit flags // Arnout: used to store entState_t for non-player entities (so we know to draw them translucent clientsided)
int powerups; // bit flags. Used to store entState_t for non-player entities (so we know to draw them translucent clientsided)
int weapon; // determines weapon and flash model, etc
int legsAnim; // mask off ANIM_TOGGLEBIT
int torsoAnim; // mask off ANIM_TOGGLEBIT
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/tr_model.c
Expand Up @@ -2192,11 +2192,10 @@ void *R_Hunk_Begin(void)
// now if needed
membase = VirtualAlloc(NULL, maxsize, MEM_RESERVE, PAGE_NOACCESS);
#else
// show_bug.cgi?id=440
// if not win32, then just allocate it now
// it is possible that we have been allocated already, in case we don't do anything
membase = malloc(maxsize);
// TTimo NOTE: initially, I was doing the memset even if we had an existing membase
// NOTE: initially, I was doing the memset even if we had an existing membase
// but this breaks some shaders (i.e. /map mp_beach, then go back to the main menu .. some shaders are missing)
// I assume the shader missing is because we don't clear memory either on win32
// meaning even on win32 we are using memory that is still reserved but was uncommited .. it works out of pure luck
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/tr_scene.c
Expand Up @@ -416,11 +416,12 @@ void RE_AddRefEntityToScene(const refEntity_t *ent)
{
return;
}
// show_bug.cgi?id=402

if (r_numentities >= ENTITYNUM_WORLD)
{
return;
}

if ((int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE)
{
ri.Error(ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType);
Expand Down
4 changes: 3 additions & 1 deletion src/sdl/sdl_glimp.c
Expand Up @@ -450,7 +450,9 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

#if 0 // See http://bugzilla.icculus.org/show_bug.cgi?id=3526
#if 0
// TODO: SDL_GL_ACCELERATED_VISUAL is broken on ATI cards
// This code can be enabled once we move to SDL >= 1.3
// If not allowing software GL, demand accelerated
if (!r_allowSoftwareGL->integer)
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/sv_main.c
Expand Up @@ -793,7 +793,7 @@ void SVC_Info(netadr_t from)
Info_SetValueForKey(infostring, "friendlyFire", va("%i", sv_friendlyFire->integer));
Info_SetValueForKey(infostring, "maxlives", va("%i", sv_maxlives->integer ? 1 : 0));
Info_SetValueForKey(infostring, "needpass", va("%i", sv_needpass->integer ? 1 : 0));
Info_SetValueForKey(infostring, "gamename", GAMENAME_STRING); // Arnout: to be able to filter out Quake servers
Info_SetValueForKey(infostring, "gamename", GAMENAME_STRING);

antilag = Cvar_VariableString("g_antilag");
if (antilag)
Expand Down
1 change: 0 additions & 1 deletion src/server/sv_snapshot.c
Expand Up @@ -653,7 +653,6 @@ static void SV_BuildClientSnapshot(client_t *client)
entityNumbers.numSnapshotEntities = 0;
memset(frame->areabits, 0, sizeof(frame->areabits));

// show_bug.cgi?id=62
frame->num_entities = 0;

clent = client->gentity;
Expand Down
5 changes: 2 additions & 3 deletions src/ui/ui_main.c
Expand Up @@ -7727,9 +7727,8 @@ void _UI_SetActiveMenu(uiMenuCommand_t menu)

trap_Cvar_VariableStringBuffer("com_errorMessage", buf, sizeof(buf));

// JPW NERVE stricmp() is silly but works, take a look at error.menu to see why. I think this is bustified in q3ta
// NOTE TTimo - I'm not sure Q_stricmp is useful to anything anymore
// show_bug.cgi?id=507
// stricmp() is silly but works, take a look at error.menu to see why.
// NOTE: I'm not sure Q_stricmp is useful to anything anymore
// TTimo - improved and tweaked that area a whole bunch
if ((*buf) && (Q_stricmp(buf, ";")))
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ui_shared.c
Expand Up @@ -3144,7 +3144,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
else
{
// select an item
// Arnout: can't select something that doesn't exist
// can't select something that doesn't exist
if (listPtr->cursorPos >= count)
{
listPtr->cursorPos = count - 1;
Expand Down

0 comments on commit ab3ec05

Please sign in to comment.