diff noise reduction.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-05-14 19:46:16 +00:00
parent 2c80bff085
commit 0c16f56c23
4 changed files with 118 additions and 192 deletions

View file

@ -56,9 +56,12 @@ byte *vid_colormap;
cvar_t *cl_name; cvar_t *cl_name;
cvar_t *cl_color; cvar_t *cl_color;
cvar_t *writecfg;
cvar_t *cl_shownet; cvar_t *cl_shownet;
cvar_t *cl_nolerp; cvar_t *cl_nolerp;
cvar_t *cl_sbar; cvar_t *cl_sbar;
cvar_t *cl_sbar_separator;
cvar_t *cl_hudswap; cvar_t *cl_hudswap;
cvar_t *cl_cshift_bonus; cvar_t *cl_cshift_bonus;
@ -162,12 +165,12 @@ CL_ClearState (void)
if (!sv.active) if (!sv.active)
Host_ClearMemory (); Host_ClearMemory ();
// wipe the entire cl structure // wipe the entire cl structure
memset (&cl, 0, sizeof (cl)); memset (&cl, 0, sizeof (cl));
SZ_Clear (&cls.message); SZ_Clear (&cls.message);
// clear other arrays // clear other arrays
memset (cl_efrags, 0, sizeof (cl_efrags)); memset (cl_efrags, 0, sizeof (cl_efrags));
memset (cl_entities, 0, sizeof (cl_entities)); memset (cl_entities, 0, sizeof (cl_entities));
memset (cl_dlights, 0, sizeof (cl_dlights)); memset (cl_dlights, 0, sizeof (cl_dlights));
@ -175,9 +178,7 @@ CL_ClearState (void)
memset (cl_temp_entities, 0, sizeof (cl_temp_entities)); memset (cl_temp_entities, 0, sizeof (cl_temp_entities));
memset (cl_beams, 0, sizeof (cl_beams)); memset (cl_beams, 0, sizeof (cl_beams));
// // allocate the efrags and chain together into a free list
// allocate the efrags and chain together into a free list
//
cl.free_efrags = cl_efrags; cl.free_efrags = cl_efrags;
for (i = 0; i < MAX_EFRAGS - 1; i++) for (i = 0; i < MAX_EFRAGS - 1; i++)
cl.free_efrags[i].entnext = &cl.free_efrags[i + 1]; cl.free_efrags[i].entnext = &cl.free_efrags[i + 1];
@ -276,7 +277,7 @@ CL_EstablishConnection (char *host)
cls.demonum = -1; // not in the demo loop now cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected; cls.state = ca_connected;
cls.signon = 0; // need all the signon messages cls.signon = 0; // need all the signon messages
// before playing // before playing
} }
@ -293,32 +294,30 @@ CL_SignonReply (void)
Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon) { switch (cls.signon) {
case 1: case 1:
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "prespawn"); MSG_WriteString (&cls.message, "prespawn");
break; break;
case 2: case 2:
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va ("name \"%s\"\n", cl_name->string)); MSG_WriteString (&cls.message, va ("name \"%s\"\n", cl_name->string));
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, MSG_WriteString (&cls.message,
va ("color %i %i\n", (cl_color->int_val) >> 4, va ("color %i %i\n", (cl_color->int_val) >> 4,
(cl_color->int_val) & 15)); (cl_color->int_val) & 15));
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
snprintf (str, sizeof (str), "spawn %s", cls.spawnparms); snprintf (str, sizeof (str), "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str); MSG_WriteString (&cls.message, str);
break; break;
case 3: case 3:
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "begin"); MSG_WriteString (&cls.message, "begin");
Cache_Report (); // print remaining memory Cache_Report (); // print remaining memory
break; break;
case 4: case 4:
// SCR_EndLoadingPlaque (); // allow normal screen updates // SCR_EndLoadingPlaque (); // allow normal screen updates
break; break;
} }
@ -374,11 +373,9 @@ CL_PrintEntities_f (void)
/* /*
=============== SetPal
SetPal
Debugging tool, just flashes the screen Debugging tool, just flashes the screen
===============
*/ */
void void
SetPal (int i) SetPal (int i)
@ -413,13 +410,13 @@ SetPal (int i)
} }
dlight_t * dlight_t *
CL_AllocDlight (int key) CL_AllocDlight (int key)
{ {
int i; int i;
dlight_t *dl; dlight_t *dl;
// first look for an exact key match // first look for an exact key match
if (key) { if (key) {
dl = cl_dlights; dl = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, dl++) { for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
@ -430,7 +427,7 @@ CL_AllocDlight (int key)
} }
} }
} }
// then look for anything else // then look for anything else
dl = cl_dlights; dl = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, dl++) { for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
if (dl->die < cl.time) { if (dl->die < cl.time) {
@ -460,23 +457,23 @@ CL_NewDlight (int key, float x, float y, float z, float radius, float time,
dl->radius = radius; dl->radius = radius;
dl->die = cl.time + time; dl->die = cl.time + time;
switch (type) { switch (type) {
default: default:
case 0: case 0:
dl->color[0] = 0.4; dl->color[0] = 0.4;
dl->color[1] = 0.2; dl->color[1] = 0.2;
dl->color[2] = 0.05; dl->color[2] = 0.05;
break; break;
case 1: // blue case 1: // blue
dl->color[0] = 0.05; dl->color[0] = 0.05;
dl->color[1] = 0.05; dl->color[1] = 0.05;
dl->color[2] = 0.5; dl->color[2] = 0.5;
break; break;
case 2: // red case 2: // red
dl->color[0] = 0.5; dl->color[0] = 0.5;
dl->color[1] = 0.05; dl->color[1] = 0.05;
dl->color[2] = 0.05; dl->color[2] = 0.05;
break; break;
case 3: // purple case 3: // purple
dl->color[0] = 0.5; dl->color[0] = 0.5;
dl->color[1] = 0.05; dl->color[1] = 0.05;
dl->color[2] = 0.5; dl->color[2] = 0.5;
@ -507,12 +504,10 @@ CL_DecayLights (void)
/* /*
=============== CL_LerpPoint
CL_LerpPoint
Determines the fraction between the last two messages that the objects Determines the fraction between the last two messages that the objects
should be put at. should be put at.
===============
*/ */
float float
CL_LerpPoint (void) CL_LerpPoint (void)
@ -531,19 +526,19 @@ CL_LerpPoint (void)
f = 0.1; f = 0.1;
} }
frac = (cl.time - cl.mtime[1]) / f; frac = (cl.time - cl.mtime[1]) / f;
//Con_Printf ("frac: %f\n",frac); // Con_Printf ("frac: %f\n",frac);
if (frac < 0) { if (frac < 0) {
if (frac < -0.01) { if (frac < -0.01) {
SetPal (1); SetPal (1);
cl.time = cl.mtime[1]; cl.time = cl.mtime[1];
// Con_Printf ("low frac\n"); // Con_Printf ("low frac\n");
} }
frac = 0; frac = 0;
} else if (frac > 1) { } else if (frac > 1) {
if (frac > 1.01) { if (frac > 1.01) {
SetPal (2); SetPal (2);
cl.time = cl.mtime[0]; cl.time = cl.mtime[0];
// Con_Printf ("high frac\n"); // Con_Printf ("high frac\n");
} }
frac = 1; frac = 1;
} else } else
@ -564,14 +559,12 @@ CL_RelinkEntities (void)
vec3_t oldorg; vec3_t oldorg;
dlight_t *dl; dlight_t *dl;
// determine partial update time // determine partial update time
frac = CL_LerpPoint (); frac = CL_LerpPoint ();
cl_numvisedicts = 0; cl_numvisedicts = 0;
// // interpolate player info
// interpolate player info
//
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
cl.velocity[i] = cl.mvelocity[1][i] + cl.velocity[i] = cl.mvelocity[1][i] +
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]); frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
@ -590,14 +583,14 @@ CL_RelinkEntities (void)
bobjrotate = anglemod (100 * cl.time); bobjrotate = anglemod (100 * cl.time);
// start on the entity after the world // start on the entity after the world
for (i = 1, ent = cl_entities + 1; i < cl.num_entities; i++, ent++) { for (i = 1, ent = cl_entities + 1; i < cl.num_entities; i++, ent++) {
if (!ent->model) { // empty slot if (!ent->model) { // empty slot
if (ent->forcelink) if (ent->forcelink)
R_RemoveEfrags (ent); // just became empty R_RemoveEfrags (ent); // just became empty
continue; continue;
} }
// if the object wasn't included in the last packet, remove it // if the object wasn't included in the last packet, remove it
if (ent->msgtime != cl.mtime[0]) { if (ent->msgtime != cl.mtime[0]) {
ent->model = NULL; ent->model = NULL;
continue; continue;
@ -605,19 +598,17 @@ CL_RelinkEntities (void)
VectorCopy (ent->origin, oldorg); VectorCopy (ent->origin, oldorg);
if (ent->forcelink) { // the entity was not updated in the if (ent->forcelink) { // the entity was not updated in the
// last message // last message so move to the final spot
// so move to the final spot
VectorCopy (ent->msg_origins[0], ent->origin); VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->angles); VectorCopy (ent->msg_angles[0], ent->angles);
} else { // if the delta is large, assume a } else { // if the delta is large, assume a
// teleport and don't lerp // teleport and don't lerp
f = frac; f = frac;
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j]; delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j];
if (delta[j] > 100 || delta[j] < -100) if (delta[j] > 100 || delta[j] < -100)
f = 1; // assume a teleportation, not a f = 1; // assume a teleportation, not a motion
// motion
} }
// interpolate the origin and angles // interpolate the origin and angles
@ -634,7 +625,7 @@ CL_RelinkEntities (void)
} }
// rotate binary objects locally // rotate binary objects locally
if (ent->model->flags & EF_ROTATE) if (ent->model->flags & EF_ROTATE)
ent->angles[1] = bobjrotate; ent->angles[1] = bobjrotate;
@ -690,7 +681,6 @@ CL_RelinkEntities (void)
dl->die = cl.time + 0.001; dl->die = cl.time + 0.001;
} }
#endif #endif
if (VectorDistance_fast(ent->msg_origins[1], ent->origin) > (256*256)) if (VectorDistance_fast(ent->msg_origins[1], ent->origin) > (256*256))
VectorCopy (ent ->origin, ent->msg_origins[1]); VectorCopy (ent ->origin, ent->msg_origins[1]);
if (ent->model->flags & EF_ROCKET) { if (ent->model->flags & EF_ROCKET) {
@ -717,7 +707,6 @@ CL_RelinkEntities (void)
if (i == cl.viewentity && !chase_active->int_val) if (i == cl.viewentity && !chase_active->int_val)
continue; continue;
#ifdef QUAKE2 #ifdef QUAKE2
if (ent->effects & EF_NODRAW) if (ent->effects & EF_NODRAW)
continue; continue;
@ -727,16 +716,13 @@ CL_RelinkEntities (void)
cl_numvisedicts++; cl_numvisedicts++;
} }
} }
} }
/* /*
=============== CL_ReadFromServer
CL_ReadFromServer
Read all incoming data from the server Read all incoming data from the server
===============
*/ */
int int
CL_ReadFromServer (void) CL_ReadFromServer (void)
@ -763,17 +749,11 @@ CL_ReadFromServer (void)
CL_RelinkEntities (); CL_RelinkEntities ();
CL_UpdateTEnts (); CL_UpdateTEnts ();
// // bring the links up to date
// bring the links up to date
//
return 0; return 0;
} }
/*
=================
CL_SendCmd
=================
*/
void void
CL_SendCmd (void) CL_SendCmd (void)
{ {
@ -794,7 +774,7 @@ CL_SendCmd (void)
SZ_Clear (&cls.message); SZ_Clear (&cls.message);
return; return;
} }
// send the reliable message // send the reliable message
if (!cls.message.cursize) if (!cls.message.cursize)
return; // no message at all return; // no message at all
@ -809,11 +789,7 @@ CL_SendCmd (void)
SZ_Clear (&cls.message); SZ_Clear (&cls.message);
} }
/*
=================
CL_Init
=================
*/
void void
CL_Init (void) CL_Init (void)
{ {

View file

@ -44,29 +44,23 @@
#include "client.h" #include "client.h"
#include "server.h" #include "server.h"
int sb_updates; // if >= vid.numpages, no update int sb_updates; // if >= vid.numpages, no update needed
// needed #define STAT_MINUS 10 // num frame for '-' stats digit
#define STAT_MINUS 10 // num frame for '-' stats digit
qpic_t *sb_nums[2][11]; qpic_t *sb_nums[2][11];
qpic_t *sb_colon, *sb_slash; qpic_t *sb_colon, *sb_slash;
qpic_t *sb_ibar; qpic_t *sb_ibar;
qpic_t *sb_sbar; qpic_t *sb_sbar;
qpic_t *sb_scorebar; qpic_t *sb_scorebar;
qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
// flashes
qpic_t *sb_ammo[4]; qpic_t *sb_ammo[4];
qpic_t *sb_sigil[4]; qpic_t *sb_sigil[4];
qpic_t *sb_armor[3]; qpic_t *sb_armor[3];
qpic_t *sb_items[32]; qpic_t *sb_items[32];
qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
// 0 is static, 1 is temporary animation
// alive
// 0 is static, 1 is temporary animation
qpic_t *sb_face_invis; qpic_t *sb_face_invis;
qpic_t *sb_face_quad; qpic_t *sb_face_quad;
qpic_t *sb_face_invuln; qpic_t *sb_face_invuln;
@ -74,28 +68,24 @@ qpic_t *sb_face_invis_invuln;
qboolean sb_showscores; qboolean sb_showscores;
int sb_lines; // scan lines to draw int sb_lines; // scan lines to draw
// FIXME: MISSIONHUD (rsb_*, hsb_*) // FIXME: MISSIONHUD (rsb_*, hsb_*)
//qpic_t *rsb_invbar[2]; //qpic_t *rsb_invbar[2];
//qpic_t *rsb_weapons[5]; //qpic_t *rsb_weapons[5];
//qpic_t *rsb_items[2]; //qpic_t *rsb_items[2];
//qpic_t *rsb_ammo[3]; //qpic_t *rsb_ammo[3];
//qpic_t *rsb_teambord; // PGM 01/19/97 - team color border //qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
// MED 01/04/97 added two more weapons + 3 // MED 01/04/97 added two more weapons + 3
// alternates for grenade launcher // alternates for grenade launcher
//qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are //qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
// flashes
// MED 01/04/97 added array to simplify // MED 01/04/97 added array to simplify
// weapon parsing // weapon parsing
//int hipweapons[4] = //int hipweapons[4] =
// { HIT_LASER_CANNON_BIT, HIT_MJOLNIR_BIT, 4, HIT_PROXIMITY_GUN_BIT }; // { HIT_LASER_CANNON_BIT, HIT_MJOLNIR_BIT, 4, HIT_PROXIMITY_GUN_BIT };
//qpic_t *hsb_items[2]; // MED 01/04/97 added hipnotic items //qpic_t *hsb_items[2]; // MED 01/04/97 added hipnotic items array
// array
qboolean headsup; qboolean headsup;
qboolean sbar_centered; qboolean sbar_centered;
@ -103,11 +93,6 @@ qboolean sbar_centered;
void Sbar_MiniDeathmatchOverlay (void); void Sbar_MiniDeathmatchOverlay (void);
void Sbar_DeathmatchOverlay (void); void Sbar_DeathmatchOverlay (void);
/*
*
* Status Bar Utility Functions
*
*/
/* /*
Sbar_ColorForMap Sbar_ColorForMap
@ -123,7 +108,6 @@ Sbar_ColorForMap (int m)
} }
/* /*
Sbar_ShowScores Sbar_ShowScores
@ -138,6 +122,7 @@ Sbar_ShowScores (void)
sb_updates = 0; sb_updates = 0;
} }
/* /*
Sbar_DontShowScores Sbar_DontShowScores
@ -152,6 +137,7 @@ Sbar_DontShowScores (void)
sb_updates = 0; sb_updates = 0;
} }
/* /*
Sbar_Changed Sbar_Changed
@ -205,6 +191,7 @@ Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
height); height);
} }
/* /*
Sbar_DrawTransPic Sbar_DrawTransPic
@ -313,10 +300,8 @@ Sbar_DrawNum (int x, int y, int num, int digits, int color)
} }
} }
//=============================================================================
int fragsort[MAX_SCOREBOARD]; int fragsort[MAX_SCOREBOARD];
char scoreboardtext[MAX_SCOREBOARD][20]; char scoreboardtext[MAX_SCOREBOARD][20];
int scoreboardtop[MAX_SCOREBOARD]; int scoreboardtop[MAX_SCOREBOARD];
int scoreboardbottom[MAX_SCOREBOARD]; int scoreboardbottom[MAX_SCOREBOARD];
@ -417,9 +402,6 @@ Sbar_DrawScoreboard (void)
} }
//=============================================================================
void void
Sbar_DrawInventory (void) Sbar_DrawInventory (void)
{ {
@ -636,9 +618,6 @@ Sbar_DrawInventory (void)
} }
//=============================================================================
void void
Sbar_DrawFrags (void) Sbar_DrawFrags (void)
{ {
@ -695,9 +674,6 @@ Sbar_DrawFrags (void)
} }
//=============================================================================
void void
Sbar_DrawFace (void) Sbar_DrawFace (void)
{ {
@ -918,9 +894,6 @@ Sbar_Draw (void)
} }
//=============================================================================
void void
Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
{ {
@ -1278,4 +1251,3 @@ Sbar_Init (void)
// rsb_ammo[2] = Draw_PicFromWad ("r_ammoplasma"); // rsb_ammo[2] = Draw_PicFromWad ("r_ammoplasma");
// } // }
} }

View file

@ -118,7 +118,7 @@ cvar_t *cl_allow_cmd_pkt;
cvar_t *cl_timeout; cvar_t *cl_timeout;
cvar_t *cl_shownet; // can be 0, 1, or 2 cvar_t *cl_shownet;
cvar_t *cl_autoexec; cvar_t *cl_autoexec;
cvar_t *cl_sbar; cvar_t *cl_sbar;
cvar_t *cl_sbar_separator; cvar_t *cl_sbar_separator;

View file

@ -51,29 +51,23 @@
#include "client.h" #include "client.h"
#include "sbar.h" #include "sbar.h"
int sb_updates; // if >= vid.numpages, no update int sb_updates; // if >= vid.numpages, no update needed
// needed #define STAT_MINUS 10 // num frame for '-' stats digit
#define STAT_MINUS 10 // num frame for '-' stats digit
qpic_t *sb_nums[2][11]; qpic_t *sb_nums[2][11];
qpic_t *sb_colon, *sb_slash; qpic_t *sb_colon, *sb_slash;
qpic_t *sb_ibar; qpic_t *sb_ibar;
qpic_t *sb_sbar; qpic_t *sb_sbar;
qpic_t *sb_scorebar; qpic_t *sb_scorebar;
qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
// flashes
qpic_t *sb_ammo[4]; qpic_t *sb_ammo[4];
qpic_t *sb_sigil[4]; qpic_t *sb_sigil[4];
qpic_t *sb_armor[3]; qpic_t *sb_armor[3];
qpic_t *sb_items[32]; qpic_t *sb_items[32];
qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
// 0 is static, 1 is temporary animation
// alive
// 0 is static, 1 is temporary animation
qpic_t *sb_face_invis; qpic_t *sb_face_invis;
qpic_t *sb_face_quad; qpic_t *sb_face_quad;
qpic_t *sb_face_invuln; qpic_t *sb_face_invuln;
@ -82,7 +76,7 @@ qpic_t *sb_face_invis_invuln;
qboolean sb_showscores; qboolean sb_showscores;
qboolean sb_showteamscores; qboolean sb_showteamscores;
int sb_lines; // scan lines to draw int sb_lines; // scan lines to draw
void Sbar_DeathmatchOverlay (int start); void Sbar_DeathmatchOverlay (int start);
void Sbar_TeamOverlay (void); void Sbar_TeamOverlay (void);
@ -235,11 +229,14 @@ Sbar_Init (void)
sb_face_invis_invuln = Draw_PicFromWad ("face_inv2"); sb_face_invis_invuln = Draw_PicFromWad ("face_inv2");
sb_face_quad = Draw_PicFromWad ("face_quad"); sb_face_quad = Draw_PicFromWad ("face_quad");
Cmd_AddCommand ("+showscores", Sbar_ShowScores, "Display information on everyone playing"); Cmd_AddCommand ("+showscores", Sbar_ShowScores,
Cmd_AddCommand ("-showscores", Sbar_DontShowScores, "Stop displaying information on everyone playing"); "Display information on everyone playing");
Cmd_AddCommand ("-showscores", Sbar_DontShowScores,
Cmd_AddCommand ("+showteamscores", Sbar_ShowTeamScores, "Display information for your team"); "Stop displaying information on everyone playing");
Cmd_AddCommand ("-showteamscores", Sbar_DontShowTeamScores, "Stop displaying information for your team"); Cmd_AddCommand ("+showteamscores", Sbar_ShowTeamScores,
"Display information for your team");
Cmd_AddCommand ("-showteamscores", Sbar_DontShowTeamScores,
"Stop displaying information for your team");
sb_sbar = Draw_PicFromWad ("sbar"); sb_sbar = Draw_PicFromWad ("sbar");
sb_ibar = Draw_PicFromWad ("ibar"); sb_ibar = Draw_PicFromWad ("ibar");
@ -247,16 +244,11 @@ Sbar_Init (void)
} }
//=============================================================================
// drawing routines are reletive to the status bar location // drawing routines are reletive to the status bar location
void void
Sbar_DrawPic (int x, int y, qpic_t *pic) Sbar_DrawPic (int x, int y, qpic_t *pic)
{ {
Draw_Pic (x /* + ((vid.width - 320)>>1) */ , y + (vid.height - SBAR_HEIGHT), Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic);
pic);
} }
@ -277,7 +269,7 @@ Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
void void
Sbar_DrawTransPic (int x, int y, qpic_t *pic) Sbar_DrawTransPic (int x, int y, qpic_t *pic)
{ {
Draw_Pic (x /* + ((vid.width - 320)>>1) */ , y + (vid.height - SBAR_HEIGHT), Draw_Pic (x, y + (vid.height - SBAR_HEIGHT),
pic); pic);
} }
@ -290,16 +282,14 @@ Sbar_DrawTransPic (int x, int y, qpic_t *pic)
void void
Sbar_DrawCharacter (int x, int y, int num) Sbar_DrawCharacter (int x, int y, int num)
{ {
Draw_Character8 (x /* + ((vid.width - 320)>>1) */ + 4, Draw_Character8 (x + 4, y + vid.height - SBAR_HEIGHT, num);
y + vid.height - SBAR_HEIGHT, num);
} }
void void
Sbar_DrawString (int x, int y, char *str) Sbar_DrawString (int x, int y, char *str)
{ {
Draw_String8 (x /* + ((vid.width - 320)>>1) */ , Draw_String8 (x, y + vid.height - SBAR_HEIGHT, str);
y + vid.height - SBAR_HEIGHT, str);
} }
@ -359,8 +349,6 @@ Sbar_DrawNum (int x, int y, int num, int digits, int color)
} }
//=============================================================================
//ZOID: this should be MAX_CLIENTS, not MAX_SCOREBOARD!! //ZOID: this should be MAX_CLIENTS, not MAX_SCOREBOARD!!
//int fragsort[MAX_SCOREBOARD]; //int fragsort[MAX_SCOREBOARD];
int fragsort[MAX_CLIENTS]; int fragsort[MAX_CLIENTS];
@ -381,7 +369,7 @@ Sbar_SortFrags (qboolean includespec)
{ {
int i, j, k; int i, j, k;
// sort by frags // sort by frags
scoreboardlines = 0; scoreboardlines = 0;
for (i = 0; i < MAX_CLIENTS; i++) { for (i = 0; i < MAX_CLIENTS; i++) {
if (cl.players[i].name[0] && (!cl.players[i].spectator || includespec)) { if (cl.players[i].name[0] && (!cl.players[i].spectator || includespec)) {
@ -411,14 +399,14 @@ Sbar_SortTeams (void)
int teamplay; int teamplay;
char t[16 + 1]; char t[16 + 1];
// request new ping times every two second // request new ping times every two second
scoreboardteams = 0; scoreboardteams = 0;
teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay")); teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay"));
if (!teamplay) if (!teamplay)
return; return;
// sort the teams // sort the teams
memset (teams, 0, sizeof (teams)); memset (teams, 0, sizeof (teams));
for (i = 0; i < MAX_CLIENTS; i++) for (i = 0; i < MAX_CLIENTS; i++)
teams[i].plow = 999; teams[i].plow = 999;
@ -495,9 +483,6 @@ Sbar_SoloScoreboard (void)
} }
//=============================================================================
void void
Sbar_DrawInventory (void) Sbar_DrawInventory (void)
{ {
@ -513,7 +498,7 @@ Sbar_DrawInventory (void)
if (!headsup) if (!headsup)
Sbar_DrawPic (0, -24, sb_ibar); Sbar_DrawPic (0, -24, sb_ibar);
// weapons // weapons
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) {
time = cl.item_gettime[i]; time = cl.item_gettime[i];
@ -536,18 +521,18 @@ Sbar_DrawInventory (void)
} else } else
Sbar_DrawPic (i * 24, -16, sb_weapons[flashon][i]); Sbar_DrawPic (i * 24, -16, sb_weapons[flashon][i]);
// Sbar_DrawSubPic (0,0,20,20,i*24, -16, sb_weapons[flashon][i]); // Sbar_DrawSubPic (0, 0, 20, 20, i*24, -16, sb_weapons[flashon][i]);
if (flashon > 1) if (flashon > 1)
sb_updates = 0; // force update to remove flash sb_updates = 0; // force update to remove flash
} }
} }
// ammo counts // ammo counts
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
snprintf (num, sizeof (num), "%3i", cl.stats[STAT_SHELLS + i]); snprintf (num, sizeof (num), "%3i", cl.stats[STAT_SHELLS + i]);
if (headsup) { if (headsup) {
// Sbar_DrawSubPic(3, -24, sb_ibar, 3, 0, 42,11); // Sbar_DrawSubPic(3, -24, sb_ibar, 3, 0, 42, 11);
Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width - 42), Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width - 42),
-24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42, -24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42,
11); 11);
@ -574,7 +559,7 @@ Sbar_DrawInventory (void)
} }
flashon = 0; flashon = 0;
// items // items
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (cl.stats[STAT_ITEMS] & (1 << (17 + i))) { if (cl.stats[STAT_ITEMS] & (1 << (17 + i))) {
time = cl.item_gettime[17 + i]; time = cl.item_gettime[17 + i];
@ -585,7 +570,7 @@ Sbar_DrawInventory (void)
if (time && time > cl.time - 2) if (time && time > cl.time - 2)
sb_updates = 0; sb_updates = 0;
} }
// sigils // sigils
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (cl.stats[STAT_ITEMS] & (1 << (28 + i))) { if (cl.stats[STAT_ITEMS] & (1 << (28 + i))) {
time = cl.item_gettime[28 + i]; time = cl.item_gettime[28 + i];
@ -599,9 +584,6 @@ Sbar_DrawInventory (void)
} }
//=============================================================================
void void
Sbar_DrawFrags (void) Sbar_DrawFrags (void)
{ {
@ -613,11 +595,11 @@ Sbar_DrawFrags (void)
Sbar_SortFrags (false); Sbar_SortFrags (false);
// draw the text // draw the text
l = scoreboardlines <= 4 ? scoreboardlines : 4; l = scoreboardlines <= 4 ? scoreboardlines : 4;
x = 23; x = 23;
// xofs = (vid.width - 320)>>1; // xofs = (vid.width - 320)>>1;
y = vid.height - SBAR_HEIGHT - 23; y = vid.height - SBAR_HEIGHT - 23;
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
@ -637,8 +619,8 @@ Sbar_DrawFrags (void)
top = Sbar_ColorForMap (top); top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom); bottom = Sbar_ColorForMap (bottom);
// Draw_Fill (xofs + x*8 + 10, y, 28, 4, top); // Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
// Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom); // Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
Draw_Fill (x * 8 + 10, y, 28, 4, top); Draw_Fill (x * 8 + 10, y, 28, 4, top);
Draw_Fill (x * 8 + 10, y + 4, 28, 3, bottom); Draw_Fill (x * 8 + 10, y + 4, 28, 3, bottom);
@ -659,9 +641,6 @@ Sbar_DrawFrags (void)
} }
//=============================================================================
void void
Sbar_DrawFace (void) Sbar_DrawFace (void)
{ {
@ -705,7 +684,7 @@ Sbar_DrawNormal (void)
if (cl_sbar->int_val || scr_viewsize->int_val < 100) if (cl_sbar->int_val || scr_viewsize->int_val < 100)
Sbar_DrawPic (0, 0, sb_sbar); Sbar_DrawPic (0, 0, sb_sbar);
// armor // armor
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) { if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) {
Sbar_DrawNum (24, 0, 666, 3, 1); Sbar_DrawNum (24, 0, 666, 3, 1);
Sbar_DrawPic (0, 0, draw_disc); Sbar_DrawPic (0, 0, draw_disc);
@ -720,14 +699,14 @@ Sbar_DrawNormal (void)
Sbar_DrawPic (0, 0, sb_armor[0]); Sbar_DrawPic (0, 0, sb_armor[0]);
} }
// face // face
Sbar_DrawFace (); Sbar_DrawFace ();
// health // health
Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3, Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3,
cl.stats[STAT_HEALTH] <= 25); cl.stats[STAT_HEALTH] <= 25);
// ammo icon // ammo icon
if (cl.stats[STAT_ITEMS] & IT_SHELLS) if (cl.stats[STAT_ITEMS] & IT_SHELLS)
Sbar_DrawPic (224, 0, sb_ammo[0]); Sbar_DrawPic (224, 0, sb_ammo[0]);
else if (cl.stats[STAT_ITEMS] & IT_NAILS) else if (cl.stats[STAT_ITEMS] & IT_NAILS)
@ -755,18 +734,18 @@ Sbar_Draw (void)
return; // console is full screen return; // console is full screen
scr_copyeverything = 1; scr_copyeverything = 1;
// scr_fullupdate = 0; // scr_fullupdate = 0;
sb_updates++; sb_updates++;
// top line // top line
if (sb_lines > 24) { if (sb_lines > 24) {
if (!cl.spectator || autocam == CAM_TRACK) if (!cl.spectator || autocam == CAM_TRACK)
Sbar_DrawInventory (); Sbar_DrawInventory ();
if (!headsup || vid.width < 512) if (!headsup || vid.width < 512)
Sbar_DrawFrags (); Sbar_DrawFrags ();
} }
// main area // main area
if (sb_lines > 0) { if (sb_lines > 0) {
if (cl.spectator) { if (cl.spectator) {
if (autocam != CAM_TRACK) { if (autocam != CAM_TRACK) {
@ -780,7 +759,7 @@ Sbar_Draw (void)
else else
Sbar_DrawNormal (); Sbar_DrawNormal ();
// Sbar_DrawString (160-14*8+4,4, "SPECTATOR MODE - TRACK CAMERA"); // Sbar_DrawString (160-14*8+4,4, "SPECTATOR MODE - TRACK CAMERA");
snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next", snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next",
cl.players[spec_track].name); cl.players[spec_track].name);
Sbar_DrawString (0, -8, st); Sbar_DrawString (0, -8, st);
@ -790,7 +769,7 @@ Sbar_Draw (void)
else else
Sbar_DrawNormal (); Sbar_DrawNormal ();
} }
// main screen deathmatch rankings // main screen deathmatch rankings
// if we're dead show team scores in team games // if we're dead show team scores in team games
if (cl.stats[STAT_HEALTH] <= 0 && !cl.spectator) if (cl.stats[STAT_HEALTH] <= 0 && !cl.spectator)
if (atoi (Info_ValueForKey (cl.serverinfo, "teamplay")) > 0 && if (atoi (Info_ValueForKey (cl.serverinfo, "teamplay")) > 0 &&
@ -812,9 +791,6 @@ Sbar_Draw (void)
} }
//=============================================================================
void void
Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
{ {
@ -860,7 +836,7 @@ Sbar_TeamOverlay (void)
team_t *tm; team_t *tm;
int plow, phigh, pavg; int plow, phigh, pavg;
// request new ping times every two second // request new ping times every two second
teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay")); teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay"));
if (!teamplay) { if (!teamplay) {
@ -878,15 +854,16 @@ Sbar_TeamOverlay (void)
x = 36; x = 36;
Draw_String8 (x, y, "low/avg/high team total players"); Draw_String8 (x, y, "low/avg/high team total players");
y += 8; y += 8;
// Draw_String8 (x, y, "------------ ---- ----- -------"); // Draw_String8 (x, y, "------------ ---- ----- -------");
Draw_String8 (x, y, Draw_String8 (x, y, "\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f "
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1f"); "\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
"\x1d\x1e\x1e\x1e\x1e\x1e\x1f");
y += 8; y += 8;
// sort the teams // sort the teams
Sbar_SortTeams (); Sbar_SortTeams ();
// draw the text // draw the text
l = scoreboardlines; l = scoreboardlines;
for (i = 0; i < scoreboardteams && y <= vid.height - 10; i++) { for (i = 0; i < scoreboardteams && y <= vid.height - 10; i++) {
@ -960,7 +937,7 @@ Sbar_DeathmatchOverlay (int start)
if (largegame) if (largegame)
skip = 8; skip = 8;
// request new ping times every two second // request new ping times every two second
if (realtime - cl.last_ping_request > 2) { if (realtime - cl.last_ping_request > 2) {
cl.last_ping_request = realtime; cl.last_ping_request = realtime;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
@ -976,10 +953,10 @@ Sbar_DeathmatchOverlay (int start)
pic = Draw_CachePic ("gfx/ranking.lmp", true); pic = Draw_CachePic ("gfx/ranking.lmp", true);
Draw_Pic (160 - pic->width / 2, 0, pic); Draw_Pic (160 - pic->width / 2, 0, pic);
} }
// scores // scores
Sbar_SortFrags (true); Sbar_SortFrags (true);
// draw the text // draw the text
l = scoreboardlines; l = scoreboardlines;
if (start) if (start)
@ -988,21 +965,23 @@ Sbar_DeathmatchOverlay (int start)
y = 24; y = 24;
if (teamplay) { if (teamplay) {
x = 4; x = 4;
// 0 40 64 104 152 192 // 0 40 64 104 152 192
Draw_String8 (x, y, "ping pl time frags team name"); Draw_String8 (x, y, "ping pl time frags team name");
y += 8; y += 8;
// Draw_String8 ( x , y, "---- -- ---- ----- ---- ----------------"); // Draw_String8 ( x , y, "---- -- ---- ----- ---- ----------------");
Draw_String8 (x, y, Draw_String8 (x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f "
"\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f"); "\x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e"
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
y += 8; y += 8;
} else { } else {
x = 16; x = 16;
// 0 40 64 104 152 // 0 40 64 104 152
Draw_String8 (x, y, "ping pl time frags name"); Draw_String8 (x, y, "ping pl time frags name");
y += 8; y += 8;
// Draw_String8 ( x , y, "---- -- ---- ----- ----------------"); // Draw_String8 ( x , y, "---- -- ---- ----- ----------------");
Draw_String8 (x, y, Draw_String8 (x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f "
"\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f"); "\x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e"
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
y += 8; y += 8;
} }
@ -1086,8 +1065,7 @@ Sbar_DeathmatchOverlay (int start)
y += skip; y += skip;
} }
if (y >= vid.height - 10) // we ran over the screen size, if (y >= vid.height - 10) // we ran over the screen size, squish
// squish
largegame = true; largegame = true;
} }
@ -1121,7 +1099,7 @@ Sbar_MiniDeathmatchOverlay (void)
scr_copyeverything = 1; scr_copyeverything = 1;
scr_fullupdate = 0; scr_fullupdate = 0;
// scores // scores
Sbar_SortFrags (false); Sbar_SortFrags (false);
if (vid.width >= 640) if (vid.width >= 640)
Sbar_SortTeams (); Sbar_SortTeams ();
@ -1129,7 +1107,7 @@ Sbar_MiniDeathmatchOverlay (void)
if (!scoreboardlines) if (!scoreboardlines)
return; // no one there? return; // no one there?
// draw the text // draw the text
y = vid.height - sb_lines - 1; y = vid.height - sb_lines - 1;
numlines = sb_lines / 8; numlines = sb_lines / 8;
if (numlines < 3) if (numlines < 3)