ref: 5456cc33b02aa386b4b6d5800b8b9841726daf20
parent: c1b63eafb8d142260660717b929d500e4a9185cf
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Nov 10 20:49:10 EST 2023
remove a bunch of unused stuff
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,6 @@
cvar.o\
d_alpha.o\
d_edge.o\
- d_fill.o\
d_init.o\
d_modech.o\
d_part.o\
--- a/chase.c
+++ b/chase.c
@@ -16,12 +16,6 @@
Cvar_RegisterVariable (&chase_active);
}
-void Chase_Reset (void)
-{
- // for respawning and teleporting
- // start position 12 units behind head
-}
-
void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
{
trace_t trace;
--- a/cl_input.c
+++ b/cl_input.c
@@ -22,16 +22,16 @@
*/
-kbutton_t in_mlook, in_klook;
-kbutton_t in_left, in_right, in_forward, in_back;
-kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
-kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack;
-kbutton_t in_up, in_down;
+kbutton_t in_strafe, in_mlook;
+static kbutton_t in_left, in_right, in_forward, in_back;
+static kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
+static kbutton_t in_klook, in_speed, in_use, in_jump, in_attack;
+static kbutton_t in_up, in_down;
-int in_impulse;
+static int in_impulse;
-void KeyDown (kbutton_t *b)
+static void KeyDown (kbutton_t *b)
{
int k;
char *c;
@@ -60,7 +60,7 @@
b->state |= 1 + 2; // down + impulse down
}
-void KeyUp (kbutton_t *b)
+static void KeyUp (kbutton_t *b)
{
int k;
char *c;
@@ -90,49 +90,49 @@
b->state |= 4; // impulse up
}
-void IN_KLookDown (void) {KeyDown(&in_klook);}
-void IN_KLookUp (void) {KeyUp(&in_klook);}
-void IN_MLookDown (void) {KeyDown(&in_mlook);}
-void IN_MLookUp (void) {
-KeyUp(&in_mlook);
-if ( !(in_mlook.state&1) && lookspring.value)
- V_StartPitchDrift();
+static void IN_KLookDown (void) {KeyDown(&in_klook);}
+static void IN_KLookUp (void) {KeyUp(&in_klook);}
+static void IN_MLookDown (void) {KeyDown(&in_mlook);}
+static void IN_MLookUp (void) {
+ KeyUp(&in_mlook);
+ if ( !(in_mlook.state&1) && lookspring.value)
+ V_StartPitchDrift();
}
-void IN_UpDown(void) {KeyDown(&in_up);}
-void IN_UpUp(void) {KeyUp(&in_up);}
-void IN_DownDown(void) {KeyDown(&in_down);}
-void IN_DownUp(void) {KeyUp(&in_down);}
-void IN_LeftDown(void) {KeyDown(&in_left);}
-void IN_LeftUp(void) {KeyUp(&in_left);}
-void IN_RightDown(void) {KeyDown(&in_right);}
-void IN_RightUp(void) {KeyUp(&in_right);}
-void IN_ForwardDown(void) {KeyDown(&in_forward);}
-void IN_ForwardUp(void) {KeyUp(&in_forward);}
-void IN_BackDown(void) {KeyDown(&in_back);}
-void IN_BackUp(void) {KeyUp(&in_back);}
-void IN_LookupDown(void) {KeyDown(&in_lookup);}
-void IN_LookupUp(void) {KeyUp(&in_lookup);}
-void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
-void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
-void IN_MoveleftDown(void) {KeyDown(&in_moveleft);}
-void IN_MoveleftUp(void) {KeyUp(&in_moveleft);}
-void IN_MoverightDown(void) {KeyDown(&in_moveright);}
-void IN_MoverightUp(void) {KeyUp(&in_moveright);}
+static void IN_UpDown(void) {KeyDown(&in_up);}
+static void IN_UpUp(void) {KeyUp(&in_up);}
+static void IN_DownDown(void) {KeyDown(&in_down);}
+static void IN_DownUp(void) {KeyUp(&in_down);}
+static void IN_LeftDown(void) {KeyDown(&in_left);}
+static void IN_LeftUp(void) {KeyUp(&in_left);}
+static void IN_RightDown(void) {KeyDown(&in_right);}
+static void IN_RightUp(void) {KeyUp(&in_right);}
+static void IN_ForwardDown(void) {KeyDown(&in_forward);}
+static void IN_ForwardUp(void) {KeyUp(&in_forward);}
+static void IN_BackDown(void) {KeyDown(&in_back);}
+static void IN_BackUp(void) {KeyUp(&in_back);}
+static void IN_LookupDown(void) {KeyDown(&in_lookup);}
+static void IN_LookupUp(void) {KeyUp(&in_lookup);}
+static void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
+static void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
+static void IN_MoveleftDown(void) {KeyDown(&in_moveleft);}
+static void IN_MoveleftUp(void) {KeyUp(&in_moveleft);}
+static void IN_MoverightDown(void) {KeyDown(&in_moveright);}
+static void IN_MoverightUp(void) {KeyUp(&in_moveright);}
-void IN_SpeedDown(void) {KeyDown(&in_speed);}
-void IN_SpeedUp(void) {KeyUp(&in_speed);}
-void IN_StrafeDown(void) {KeyDown(&in_strafe);}
-void IN_StrafeUp(void) {KeyUp(&in_strafe);}
+static void IN_SpeedDown(void) {KeyDown(&in_speed);}
+static void IN_SpeedUp(void) {KeyUp(&in_speed);}
+static void IN_StrafeDown(void) {KeyDown(&in_strafe);}
+static void IN_StrafeUp(void) {KeyUp(&in_strafe);}
-void IN_AttackDown(void) {KeyDown(&in_attack);}
-void IN_AttackUp(void) {KeyUp(&in_attack);}
+static void IN_AttackDown(void) {KeyDown(&in_attack);}
+static void IN_AttackUp(void) {KeyUp(&in_attack);}
-void IN_UseDown (void) {KeyDown(&in_use);}
-void IN_UseUp (void) {KeyUp(&in_use);}
-void IN_JumpDown (void) {KeyDown(&in_jump);}
-void IN_JumpUp (void) {KeyUp(&in_jump);}
+static void IN_UseDown (void) {KeyDown(&in_use);}
+static void IN_UseUp (void) {KeyUp(&in_use);}
+static void IN_JumpDown (void) {KeyDown(&in_jump);}
+static void IN_JumpUp (void) {KeyUp(&in_jump);}
-void
+static void
IN_Impulse(void)
{
in_impulse = atoi(Cmd_Argv(1));
@@ -148,7 +148,7 @@
1.0 if held for the entire time
===============
*/
-float CL_KeyState (kbutton_t *key)
+static float CL_KeyState (kbutton_t *key)
{
float val;
bool impulsedown, impulseup, down;
@@ -197,7 +197,7 @@
Moves the local angle positions
================
*/
-void CL_AdjustAngles (void)
+static void CL_AdjustAngles (void)
{
float speed;
float up, down;
@@ -390,6 +390,4 @@
Cmd_AddCommand ("-klook", IN_KLookUp);
Cmd_AddCommand ("+mlook", IN_MLookDown);
Cmd_AddCommand ("-mlook", IN_MLookUp);
-
}
-
--- a/cl_main.c
+++ b/cl_main.c
@@ -8,7 +8,7 @@
cvar_t cl_color = {"_cl_color", "0", true};
cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2
-cvar_t cl_nolerp = {"cl_nolerp","0"};
+static cvar_t cl_nolerp = {"cl_nolerp","0"};
cvar_t lookspring = {"lookspring","0", true};
cvar_t lookstrafe = {"lookstrafe","0", true};
@@ -19,11 +19,11 @@
cvar_t m_forward = {"m_forward","1", true};
cvar_t m_side = {"m_side","0.8", true};
+static efrag_t *cl_efrags;
client_static_t cls;
client_state_t cl;
entity_t **cl_visedicts;
-efrag_t *cl_efrags;
entity_t *cl_entities;
entity_t *cl_static_entities;
lightstyle_t cl_lightstyle[Nlights];
@@ -77,7 +77,7 @@
stopallsfx();
// bring the console down and fade the colors back to normal
- // SCR_BringDownConsole ();
+ SCR_BringDownConsole ();
// if running a local server, shut it down
if (cls.demoplayback)
@@ -110,9 +110,6 @@
Host_ShutdownServer (false);
}
-
-
-
/*
=====================
CL_EstablishConnection
@@ -220,7 +217,7 @@
CL_PrintEntities_f
==============
*/
-void CL_PrintEntities_f (void)
+static void CL_PrintEntities_f (void)
{
entity_t *ent;
int i;
@@ -237,20 +234,8 @@
}
}
-
/*
===============
-SetPal
-
-Debugging tool, just flashes the screen
-===============
-*/
-void SetPal (int /*i*/)
-{
-}
-
-/*
-===============
CL_AllocDlight
===============
@@ -329,7 +314,7 @@
should be put at.
===============
*/
-float CL_LerpPoint (void)
+static float CL_LerpPoint (void)
{
float f, frac;
@@ -347,29 +332,18 @@
f = 0.1;
}
frac = (cl.time - cl.mtime[1]) / f;
- //Con_Printf ("frac: %f\n",frac);
if (frac < 0)
{
if (frac < -0.01)
- {
- SetPal(1);
cl.time = cl.mtime[1];
- //Con_Printf ("low frac\n");
- }
frac = 0;
}
else if (frac > 1)
{
if (frac > 1.01)
- {
- SetPal(2);
cl.time = cl.mtime[0];
- //Con_Printf ("high frac\n");
- }
frac = 1;
}
- else
- SetPal(0);
return frac;
}
@@ -380,7 +354,7 @@
CL_RelinkEntities
===============
*/
-void CL_RelinkEntities (void)
+static void CL_RelinkEntities (void)
{
entity_t *ent;
int i, j;
@@ -588,13 +562,13 @@
if (cls.signon == SIGNONS)
{
- // get basic movement from keyboard
+ // get basic movement from keyboard
CL_BaseMove (&cmd);
- // allow mice or other external controllers to add to the move
+ // allow mice or other external controllers to add to the move
IN_Move (&cmd);
- // send the unreliable message
+ // send the unreliable message
CL_SendMove (&cmd);
}
@@ -661,8 +635,8 @@
Cvar_RegisterVariable (&m_forward);
Cvar_RegisterVariable (&m_side);
- Cmd_AddCommand ("entities", CL_PrintEntities_f);
- Cmd_AddCommand ("disconnect", CL_Disconnect_f);
+ Cmd_AddCommand("entities", CL_PrintEntities_f);
+ Cmd_AddCommand("disconnect", CL_Disconnect_f);
Cmd_AddCommand("stop", stopdemo);
Cmd_AddCommand("record", recdemo);
Cmd_AddCommand("playdemo", playdemo);
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -1,6 +1,6 @@
#include "quakedef.h"
-static char *svc_strings[] =
+static const char *svc_strings[] =
{
"svc_bad",
"svc_nop",
--- a/client.h
+++ b/client.h
@@ -221,7 +221,6 @@
extern cvar_t cl_anglespeedkey;
extern cvar_t cl_shownet;
-extern cvar_t cl_nolerp;
extern cvar_t cl_pitchdriftspeed;
extern cvar_t lookspring;
@@ -239,8 +238,6 @@
extern client_state_t cl;
-// FIXME, allocate dynamically
-extern efrag_t *cl_efrags;
extern entity_t *cl_entities;
extern entity_t *cl_static_entities;
extern lightstyle_t cl_lightstyle[Nlights];
@@ -280,9 +277,7 @@
int state; // low bit is down state
} kbutton_t;
-extern kbutton_t in_mlook, in_klook;
-extern kbutton_t in_strafe;
-extern kbutton_t in_speed;
+extern kbutton_t in_mlook, in_strafe;
void CL_InitInput (void);
void CL_SendCmd (void);
@@ -300,7 +295,6 @@
void CL_BaseMove (usercmd_t *cmd);
-float CL_KeyState (kbutton_t *key);
char *Key_KeynumToString (int keynum);
//
--- a/cmd.c
+++ b/cmd.c
@@ -11,13 +11,10 @@
char *value;
} cmdalias_t;
-cmdalias_t *cmd_alias;
+static cmdalias_t *cmd_alias;
-int trashtest;
-int *trashspot;
+static bool cmd_wait;
-bool cmd_wait;
-
//=============================================================================
/*
@@ -29,8 +26,8 @@
bind g "impulse 5 ; +attack ; wait ; -attack ; impulse 2"
============
*/
-void Cmd_Wait_f (void)
-{
+static void Cmd_Wait_f (void)
+{
cmd_wait = true;
}
@@ -42,7 +39,7 @@
=============================================================================
*/
-sizebuf_t cmd_text;
+static sizebuf_t cmd_text;
/*
============
@@ -179,81 +176,6 @@
/*
===============
-Cmd_StuffCmds_f
-
-Adds command line parameters as script statements
-Commands lead with a +, and continue until a - or another +
-quake +prog jctest.qp +cmd amlev1
-quake -nosound +cmd amlev1
-===============
-*/
-void Cmd_StuffCmds_f (void)
-{
- int i, j;
- int s;
- char *text, *build, c;
-
- if (Cmd_Argc () != 1)
- {
- Con_Printf ("stuffcmds : execute command line parameters\n");
- return;
- }
-
- // build the combined string to parse from
- s = 0;
- for (i=1 ; i<com_argc ; i++)
- {
- if (!com_argv[i])
- continue; // NEXTSTEP nulls out -NXHost
- s += strlen(com_argv[i]) + 1;
- }
- if (!s)
- return;
-
- text = Z_Malloc (s+1);
- text[0] = 0;
- for (i=1 ; i<com_argc ; i++)
- {
- if (!com_argv[i])
- continue; // NEXTSTEP nulls out -NXHost
- strcat(text, com_argv[i]);
- if (i != com_argc-1)
- strcat(text, " ");
- }
-
- // pull out the commands
- build = Z_Malloc (s+1);
- build[0] = 0;
-
- for (i=0 ; i<s-1 ; i++)
- {
- if (text[i] == '+')
- {
- i++;
-
- for (j=i ; (text[j] != '+') && (text[j] != '-') && (text[j] != 0) ; j++)
- ;
-
- c = text[j];
- text[j] = 0;
-
- strcat(build, text+i);
- strcat(build, "\n");
- text[j] = c;
- i = j-1;
- }
- }
-
- if (build[0])
- Cbuf_InsertText (build);
-
- Z_Free (text);
- Z_Free (build);
-}
-
-
-/*
-===============
Cmd_Exec_f
===============
*/
@@ -403,7 +325,6 @@
*/
void Cmd_Init (void)
{
- Cmd_AddCommand ("stuffcmds",Cmd_StuffCmds_f);
Cmd_AddCommand ("exec",Cmd_Exec_f);
Cmd_AddCommand ("echo",Cmd_Echo_f);
Cmd_AddCommand ("alias",Cmd_Alias_f);
--- a/common.c
+++ b/common.c
@@ -2,11 +2,7 @@
cvar_t registered = {"registered","0"};
-bool msg_suppress_1 = 0;
-
char com_token[1024];
-int com_argc;
-char **com_argv;
bool standard_quake = true, rogue, hipnotic;
@@ -44,13 +40,6 @@
l->prev->next = l;
l->next->prev = l;
}
-void InsertLinkAfter (link_t *l, link_t *after)
-{
- l->next = after->next;
- l->prev = after;
- l->prev->next = l;
- l->next->prev = l;
-}
/*
============================================================================
@@ -334,16 +323,6 @@
buf->maxsize = startsize;
buf->cursize = 0;
setmalloctag(buf->data, getcallerpc(&buf));
-}
-
-
-void
-SZ_Free(sizebuf_t *buf)
-{
- //Z_Free (buf->data);
- //buf->data = nil;
- //buf->maxsize = 0;
- buf->cursize = 0;
}
void
--- a/common.h
+++ b/common.h
@@ -11,7 +11,6 @@
} sizebuf_t;
void SZ_Alloc (sizebuf_t *buf, int startsize);
-void SZ_Free (sizebuf_t *buf);
void SZ_Clear (sizebuf_t *buf);
void *SZ_GetSpace (sizebuf_t *buf, int length);
void SZ_Write (sizebuf_t *buf, void *data, int length);
@@ -28,7 +27,6 @@
void ClearLink (link_t *l);
void RemoveLink (link_t *l);
void InsertLinkBefore (link_t *l, link_t *before);
-void InsertLinkAfter (link_t *l, link_t *after);
//============================================================================
@@ -112,8 +110,6 @@
extern bool com_eof;
char *COM_Parse (char *data);
-extern int com_argc;
-extern char **com_argv;
#pragma varargck argpos va 1
char *va(char *format, ...);
--- a/console.c
+++ b/console.c
@@ -304,10 +304,10 @@
// update the screen if the console is displayed
if(cls.signon != SIGNONS && !scr_disabled_for_loading){
/* protect against infinite loop if something in
- * SCR_UpdateScreen() calls Con_Printf() */
+ * SCR_UpdateScreen(...) calls Con_Printf() */
if(!inupdate){
inupdate = true;
- SCR_UpdateScreen();
+ SCR_UpdateScreen(false);
inupdate = false;
}
}
@@ -415,7 +415,6 @@
text = con_text + (i % con_totallines)*con_linewidth;
clearnotify = 0;
- scr_copytop = 1;
for (x = 0 ; x < con_linewidth ; x++)
Draw_Character ( (x+1)<<3, v, text[x]);
@@ -427,7 +426,6 @@
if (key_dest == key_message)
{
clearnotify = 0;
- scr_copytop = 1;
x = 0;
--- a/cvar.c
+++ b/cvar.c
@@ -1,7 +1,6 @@
#include "quakedef.h"
cvar_t *cvar_vars;
-char *cvar_null_string = "";
/*
============
@@ -45,7 +44,7 @@
var = Cvar_FindVar (var_name);
if (!var)
- return cvar_null_string;
+ return "";
return var->string;
}
--- a/d_edge.c
+++ b/d_edge.c
@@ -9,26 +9,12 @@
extern void R_RotateBmodel (void);
extern void R_TransformFrustum (void);
-vec3_t transformed_modelorg;
-
/*
-==============
-D_DrawPoly
-
-==============
-*/
-void D_DrawPoly (void)
-{
-// this driver takes spans, not polygons
-}
-
-
-/*
=============
D_MipLevelForScale
=============
*/
-int D_MipLevelForScale (float scale)
+static int D_MipLevelForScale (float scale)
{
int lmiplevel;
@@ -56,7 +42,7 @@
// FIXME: clean this up
-void D_DrawSolidSurface (surf_t *surf, int color)
+static void D_DrawSolidSurface (surf_t *surf, int color)
{
espan_t *span;
byte *pdest;
@@ -96,7 +82,7 @@
D_CalcGradients
==============
*/
-void D_CalcGradients (msurface_t *pface)
+static void D_CalcGradients (msurface_t *pface, vec3_t transformed_modelorg)
{
float mipscale;
vec3_t p_temp1;
@@ -148,6 +134,7 @@
surfcache_t *pcurrentcache;
vec3_t world_transformed_modelorg;
vec3_t local_modelorg;
+ vec3_t transformed_modelorg;
byte alpha;
currententity = &cl_entities[0];
@@ -215,7 +202,7 @@
// make entity passed in
}
- D_CalcGradients (pface);
+ D_CalcGradients (pface, transformed_modelorg);
Turbulent8 (s->spans, alpha);
D_DrawZSpans (s->spans);
@@ -262,7 +249,7 @@
cacheblock = (pixel_t *)pcurrentcache->data;
cachewidth = pcurrentcache->width;
- D_CalcGradients (pface);
+ D_CalcGradients (pface, transformed_modelorg);
if(s->flags & SURF_FENCE)
D_DrawSpans16_Fence(s->spans, alpha);
--- a/d_fill.c
+++ /dev/null
@@ -1,66 +1,0 @@
-#include "quakedef.h"
-
-/*
-================
-D_FillRect
-================
-*/
-void D_FillRect (vrect_t *rect, int color)
-{
- int rx, ry, rwidth, rheight;
- unsigned char *dest;
- unsigned *ldest;
-
- rx = rect->x;
- ry = rect->y;
- rwidth = rect->width;
- rheight = rect->height;
-
- if (rx < 0)
- {
- rwidth += rx;
- rx = 0;
- }
- if (ry < 0)
- {
- rheight += ry;
- ry = 0;
- }
- if (rx+rwidth > vid.width)
- rwidth = vid.width - rx;
- if (ry+rheight > vid.height)
- rheight = vid.height - rx;
-
- if (rwidth < 1 || rheight < 1)
- return;
-
- dest = ((byte *)vid.buffer + ry*vid.rowbytes + rx);
-
- if (((rwidth & 0x03) == 0) && (((uintptr)dest & 0x03) == 0))
- {
- // faster aligned dword clear
- ldest = (unsigned *)dest;
- color += color << 16;
-
- rwidth >>= 2;
- color += color << 8;
-
- for (ry=0 ; ry<rheight ; ry++)
- {
- for (rx=0 ; rx<rwidth ; rx++)
- ldest[rx] = color;
- ldest = (unsigned *)((byte*)ldest + vid.rowbytes);
- }
- }
- else
- {
- // slower byte-by-byte clear for unaligned cases
- for (ry=0 ; ry<rheight ; ry++)
- {
- for (rx=0 ; rx<rwidth ; rx++)
- dest[rx] = color;
- dest += vid.rowbytes;
- }
- }
-}
-
--- a/d_iface.h
+++ b/d_iface.h
@@ -37,13 +37,6 @@
float u, v, zi, s, t;
} polyvert_t;
-typedef struct polydesc_s {
- int numverts;
- float nearzi;
- msurface_t *pcurrentface;
- polyvert_t *pverts;
-} polydesc_t;
-
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct finalvert_s {
int v[6]; // u, v, s, t, l, 1/z
@@ -81,13 +74,6 @@
float nearzi;
} spritedesc_t;
-typedef struct
-{
- int u, v;
- float zi;
- int color;
-} zpointdesc_t;
-
extern int d_spanpixcount;
extern int r_framecount; // sequence # of current frame since Quake
// started
@@ -104,8 +90,6 @@
extern affinetridesc_t r_affinetridesc;
extern spritedesc_t r_spritedesc;
-extern zpointdesc_t r_zpointdesc;
-extern polydesc_t r_polydesc;
extern vec3_t r_pright, r_pup, r_ppn;
@@ -123,9 +107,7 @@
void D_StartParticles (void);
void D_WarpScreen (void);
-void D_FillRect (vrect_t *vrect, int color);
void D_DrawRect (void);
-void D_UpdateRects (vrect_t *prect);
// currently for internal use only, and should be a do-nothing function in
// hardware drivers
@@ -164,9 +146,7 @@
extern drawsurf_t r_drawsurf;
void R_DrawSurface (void);
-void R_GenTile (msurface_t *psurf, void *pdest);
-
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
#define TURB_TEX_SIZE 64 // base turbulent texture size
@@ -175,7 +155,7 @@
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
-extern float skyspeed, skyspeed2;
+extern float skyspeed;
extern float skytime;
extern int c_surf;
--- a/d_init.c
+++ b/d_init.c
@@ -2,8 +2,8 @@
#define NUM_MIPS 4
-cvar_t d_mipcap = {"d_mipcap", "0"};
-cvar_t d_mipscale = {"d_mipscale", "1"};
+static cvar_t d_mipcap = {"d_mipcap", "0"};
+static cvar_t d_mipscale = {"d_mipscale", "1"};
surfcache_t *d_initial_rover;
bool d_roverwrapped;
@@ -62,16 +62,3 @@
d_drawspans = D_DrawSpans16;
}
-
-
-/*
-===============
-D_UpdateRects
-===============
-*/
-void D_UpdateRects (vrect_t *prect)
-{
- // the software driver draws these directly to the vid buffer
- USED(prect);
-}
-
--- a/d_local.h
+++ b/d_local.h
@@ -62,8 +62,6 @@
void R_ShowSubDiv (void);
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
-extern int D_MipLevelForScale (float scale);
-
extern uzint *d_pzbuffer;
extern unsigned int d_zrowbytes, d_zwidth;
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -52,7 +52,7 @@
static int r_zistepx, r_zistepy;
static int d_aspancount, d_countextrastep;
-spanpackage_t *d_pedgespanpackage;
+static spanpackage_t *d_pedgespanpackage;
static int ystart;
static byte *d_pdest, *d_ptex;
static uzint *d_pz;
--- a/d_surf.c
+++ b/d_surf.c
@@ -1,7 +1,7 @@
#include "quakedef.h"
-float surfscale;
-bool r_cache_thrash; // set if surface cache is thrashing
+static float surfscale;
+bool r_cache_thrash; // set if surface cache is thrashing
surfcache_t *sc_rover;
@@ -54,8 +54,7 @@
*/
void D_InitCaches (void *buffer, int size)
{
- if (!msg_suppress_1)
- Con_Printf ("%dk surface cache\n", size/1024);
+ Con_Printf ("%dk surface cache\n", size/1024);
sc_size = size - GUARDSIZE;
sc_base = (surfcache_t *)buffer;
@@ -177,18 +176,6 @@
D_CheckCacheGuard (); // DEBUG
return new;
-}
-
-void
-D_SCDump(void)
-{
- surfcache_t *s;
-
- for(s = sc_base; s != nil; s = s->next){
- if(s == sc_rover)
- Con_DPrintf("ROVER:\n");
- Con_DPrintf("%p : %d bytes %ud width\n", s, s->size, s->width);
- }
}
/*
--- a/draw.c
+++ b/draw.c
@@ -8,12 +8,12 @@
int rowbytes;
} rectdesc_t;
+qpic_t *draw_disc;
+
static rectdesc_t r_rectdesc;
+static byte *draw_chars; // 8*8 graphic characters
+static qpic_t *draw_backtile;
-byte *draw_chars; // 8*8 graphic characters
-qpic_t *draw_disc;
-qpic_t *draw_backtile;
-
//=============================================================================
/* Support Routines */
@@ -24,10 +24,9 @@
} cachepic_t;
#define MAX_CACHED_PICS 128
-cachepic_t menu_cachepics[MAX_CACHED_PICS];
-int menu_numcachepics;
+static cachepic_t menu_cachepics[MAX_CACHED_PICS];
+static int menu_numcachepics;
-
qpic_t *Draw_PicFromWad (char *name)
{
return W_GetLumpName (name);
@@ -158,49 +157,6 @@
Draw_Character (x, y, *str);
str++;
x += 8;
- }
-}
-
-/*
-================
-Draw_DebugChar
-
-Draws a single character directly to the upper right corner of the screen.
-This is for debugging lockups by drawing different chars in different parts
-of the code.
-================
-*/
-void Draw_DebugChar (char num)
-{
- byte *dest;
- byte *source;
- int drawline;
- extern byte *draw_chars;
- int row, col;
-
- if (!vid.direct)
- return; // don't have direct FB access, so no debugchars...
-
- drawline = 8;
-
- row = num>>4;
- col = num&15;
- source = draw_chars + (row<<10) + (col<<3);
-
- dest = vid.direct + 312;
-
- while (drawline--)
- {
- dest[0] = source[0];
- dest[1] = source[1];
- dest[2] = source[2];
- dest[3] = source[3];
- dest[4] = source[4];
- dest[5] = source[5];
- dest[6] = source[6];
- dest[7] = source[7];
- source += 128;
- dest += 320;
}
}
--- a/draw.h
+++ b/draw.h
@@ -5,7 +5,6 @@
void Draw_Init (void);
void Draw_Character (int x, int y, int num);
-void Draw_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic);
void Draw_TransPic (int x, int y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
--- a/host.c
+++ b/host.c
@@ -17,11 +17,12 @@
double host_frametime;
double host_time;
double realtime; // without any filtering or bounding
-double oldrealtime; // last frame run
int host_framecount;
-void *host_hunklevel;
+static double oldrealtime; // last frame run
+static void *host_hunklevel;
+
client_t *host_client; // current client
jmp_buf host_abortserver;
@@ -502,7 +503,7 @@
if (host_speeds.value)
time1 = dtime ();
- SCR_UpdateScreen ();
+ SCR_UpdateScreen (false);
if (host_speeds.value)
time2 = dtime ();
--- a/keys.c
+++ b/keys.c
@@ -10,22 +10,23 @@
#define MAXCMDLINE 256
char key_lines[32][MAXCMDLINE];
int key_linepos;
-int shift_down=false;
int key_lastpress;
+static bool shift_down;
int edit_line=0;
-int history_line=0;
+static int history_line;
keydest_t key_dest;
int key_count; // incremented every key event
-char *keybindings[256];
-bool consolekeys[256]; // if true, can't be rebound while in console
-bool menubound[256]; // if true, can't be rebound while in menu
-int keyshift[256]; // key to map to if shift held down in console
-int key_repeats[256]; // if > 1, it is autorepeating
+char *keybindings[256];
+static bool menubound[256]; // if true, can't be rebound while in menu
+static int keyshift[256]; // key to map to if shift held down in console
+static int key_repeats[256]; // if > 1, it is autorepeating
+static bool consolekeys[256]; // if true, can't be rebound while in console
+
typedef struct
{
char *name;
@@ -32,7 +33,7 @@
int keynum;
} keyname_t;
-keyname_t keynames[] =
+static keyname_t keynames[] =
{
{"TAB", K_TAB},
{"ENTER", K_ENTER},
@@ -150,7 +151,7 @@
key_lines[edit_line][0] = ']';
key_linepos = 1;
if (cls.state == ca_disconnected)
- SCR_UpdateScreen (); // force an update, because the command
+ SCR_UpdateScreen (false); // force an update, because the command
// may take some time
return;
}
@@ -676,13 +677,4 @@
default:
fatal ("Bad key_dest");
}
-}
-
-void
-Key_ClearStates(void)
-{
- int i;
-
- for(i=0; i<256; i++)
- key_repeats[i] = 0;
}
--- a/keys.h
+++ b/keys.h
@@ -101,7 +101,6 @@
extern keydest_t key_dest;
extern char *keybindings[256];
-extern int key_repeats[256];
extern int key_count; // incremented every key event
extern int key_lastpress;
@@ -108,5 +107,3 @@
void Key_Event (int key, bool down);
void Key_Init (void);
void Key_SetBinding (int keynum, char *binding);
-void Key_ClearStates (void);
-
--- a/mathlib.c
+++ b/mathlib.c
@@ -2,121 +2,8 @@
vec3_t vec3_origin = {0,0,0};
-/*-----------------------------------------------------------------*/
-
#define DEG2RAD( a ) (a*M_PI/180.0)
-void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
-{
- float d;
- vec3_t n;
- float inv_denom;
-
- inv_denom = 1.0F / DotProduct( normal, normal );
-
- d = DotProduct( normal, p ) * inv_denom;
-
- n[0] = normal[0] * inv_denom;
- n[1] = normal[1] * inv_denom;
- n[2] = normal[2] * inv_denom;
-
- dst[0] = p[0] - d * n[0];
- dst[1] = p[1] - d * n[1];
- dst[2] = p[2] - d * n[2];
-}
-
-/*
-** assumes "src" is normalized
-*/
-void PerpendicularVector( vec3_t dst, const vec3_t src )
-{
- int pos;
- int i;
- float minelem = 1.0F;
- vec3_t tempvec;
-
- /*
- ** find the smallest magnitude axially aligned vector
- */
- for ( pos = 0, i = 0; i < 3; i++ )
- {
- if ( fabs( src[i] ) < minelem )
- {
- pos = i;
- minelem = fabs( src[i] );
- }
- }
- tempvec[0] = tempvec[1] = tempvec[2] = 0.0F;
- tempvec[pos] = 1.0F;
-
- /*
- ** project the point onto the plane defined by src
- */
- ProjectPointOnPlane( dst, tempvec, src );
-
- /*
- ** normalize the result
- */
- VectorNormalize( dst );
-}
-
-void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees )
-{
- float m[3][3];
- float im[3][3];
- float zrot[3][3];
- float tmpmat[3][3];
- float rot[3][3];
- int i;
- vec3_t vr, vup, vf;
-
- vf[0] = dir[0];
- vf[1] = dir[1];
- vf[2] = dir[2];
-
- PerpendicularVector( vr, dir );
- CrossProduct( vr, vf, vup );
-
- m[0][0] = vr[0];
- m[1][0] = vr[1];
- m[2][0] = vr[2];
-
- m[0][1] = vup[0];
- m[1][1] = vup[1];
- m[2][1] = vup[2];
-
- m[0][2] = vf[0];
- m[1][2] = vf[1];
- m[2][2] = vf[2];
-
- memcpy(im, m, sizeof im);
-
- im[0][1] = m[1][0];
- im[0][2] = m[2][0];
- im[1][0] = m[0][1];
- im[1][2] = m[2][1];
- im[2][0] = m[0][2];
- im[2][1] = m[1][2];
-
- memset(zrot, 0, sizeof zrot);
- zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F;
-
- zrot[0][0] = cos( DEG2RAD( degrees ) );
- zrot[0][1] = sin( DEG2RAD( degrees ) );
- zrot[1][0] = -sin( DEG2RAD( degrees ) );
- zrot[1][1] = cos( DEG2RAD( degrees ) );
-
- R_ConcatRotations( m, zrot, tmpmat );
- R_ConcatRotations( tmpmat, im, rot );
-
- for ( i = 0; i < 3; i++ )
- {
- dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2];
- }
-}
-
-/*-----------------------------------------------------------------*/
-
float anglemod(float a)
{
a = (360.0/65536.0) * ((int)(a*(65536.0/360.0)) & 65535);
@@ -217,17 +104,6 @@
up[2] = cr*cp;
}
-int VectorCompare (vec3_t v1, vec3_t v2)
-{
- int i;
-
- for (i=0 ; i<3 ; i++)
- if (v1[i] != v2[i])
- return 0;
-
- return 1;
-}
-
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
{
vecc[0] = veca[0] + scale*vecb[0];
@@ -235,27 +111,6 @@
vecc[2] = veca[2] + scale*vecb[2];
}
-void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out)
-{
- out[0] = veca[0]-vecb[0];
- out[1] = veca[1]-vecb[1];
- out[2] = veca[2]-vecb[2];
-}
-
-void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out)
-{
- out[0] = veca[0]+vecb[0];
- out[1] = veca[1]+vecb[1];
- out[2] = veca[2]+vecb[2];
-}
-
-void _VectorCopy (vec3_t in, vec3_t out)
-{
- out[0] = in[0];
- out[1] = in[1];
- out[2] = in[2];
-}
-
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross)
{
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
@@ -417,23 +272,4 @@
return (i2);
return GreatestCommonDivisor (i1, i2 % i1);
}
-}
-
-// TODO: move to nonintel.c
-
-/*
-===================
-Invert24To16
-
-Inverts an 8.24 value to a 16.16 value
-====================
-*/
-
-fixed16_t Invert24To16(fixed16_t val)
-{
- if (val < 256)
- return 0xFFFFFFFF;
-
- return (fixed16_t)
- (((double)0x10000 * (double)0x1000000 / (double)val) + 0.5);
}
--- a/mathlib.h
+++ b/mathlib.h
@@ -29,11 +29,7 @@
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t DotProduct (const vec3_t v1, const vec3_t v2);
-void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
-void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
-void _VectorCopy (vec3_t in, vec3_t out);
-int VectorCompare (vec3_t v1, vec3_t v2);
vec_t Length (vec3_t v);
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length
@@ -45,7 +41,6 @@
void FloorDivMod (double numer, double denom, int *quotient,
int *rem);
-fixed16_t Invert24To16(fixed16_t val);
int GreatestCommonDivisor (int i1, int i2);
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
--- a/menu.c
+++ b/menu.c
@@ -6,50 +6,50 @@
enum {m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_keys, m_help, m_quit, m_lanconfig, m_gameoptions} m_state;
void M_Menu_Main_f (void);
- void M_Menu_SinglePlayer_f (void);
- void M_Menu_Load_f (void);
- void M_Menu_Save_f (void);
- void M_Menu_MultiPlayer_f (void);
- void M_Menu_Setup_f (void);
- void M_Menu_Net_f (void);
- void M_Menu_Options_f (void);
- void M_Menu_Keys_f (void);
- void M_Menu_Help_f (void);
+ static void M_Menu_SinglePlayer_f (void);
+ static void M_Menu_Load_f (void);
+ static void M_Menu_Save_f (void);
+ static void M_Menu_MultiPlayer_f (void);
+ static void M_Menu_Setup_f (void);
+ static void M_Menu_Net_f (void);
+ static void M_Menu_Options_f (void);
+ static void M_Menu_Keys_f (void);
+ static void M_Menu_Help_f (void);
void M_Menu_Quit_f (void);
-void M_Menu_LanConfig_f (void);
-void M_Menu_GameOptions_f (void);
+static void M_Menu_LanConfig_f (void);
+static void M_Menu_GameOptions_f (void);
-void M_Main_Draw (void);
- void M_SinglePlayer_Draw (void);
- void M_Load_Draw (void);
- void M_Save_Draw (void);
- void M_MultiPlayer_Draw (void);
- void M_Setup_Draw (void);
- void M_Net_Draw (void);
- void M_Options_Draw (void);
- void M_Keys_Draw (void);
- void M_Help_Draw (void);
- void M_Quit_Draw (void);
-void M_LanConfig_Draw (void);
-void M_GameOptions_Draw (void);
+static void M_Main_Draw (void);
+ static void M_SinglePlayer_Draw (void);
+ static void M_Load_Draw (void);
+ static void M_Save_Draw (void);
+ static void M_MultiPlayer_Draw (void);
+ static void M_Setup_Draw (void);
+ static void M_Net_Draw (void);
+ static void M_Options_Draw (void);
+ static void M_Keys_Draw (void);
+ static void M_Help_Draw (void);
+ static void M_Quit_Draw (void);
+static void M_LanConfig_Draw (void);
+static void M_GameOptions_Draw (void);
-void M_Main_Key (int key);
- void M_SinglePlayer_Key (int key);
- void M_Load_Key (int key);
- void M_Save_Key (int key);
- void M_MultiPlayer_Key (int key);
- void M_Setup_Key (int key);
- void M_Net_Key (int key);
- void M_Options_Key (int key);
- void M_Keys_Key (int key);
- void M_Help_Key (int key);
- void M_Quit_Key (int key);
-void M_LanConfig_Key (int key);
-void M_GameOptions_Key (int key);
+static void M_Main_Key (int key);
+ static void M_SinglePlayer_Key (int key);
+ static void M_Load_Key (int key);
+ static void M_Save_Key (int key);
+ static void M_MultiPlayer_Key (int key);
+ static void M_Setup_Key (int key);
+ static void M_Net_Key (int key);
+ static void M_Options_Key (int key);
+ static void M_Keys_Key (int key);
+ static void M_Help_Key (int key);
+ static void M_Quit_Key (int key);
+static void M_LanConfig_Key (int key);
+static void M_GameOptions_Key (int key);
-bool m_entersound; // play after drawing a frame, so caching
+static bool m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
-bool m_recursiveDraw;
+static bool m_recursiveDraw;
int m_return_state;
bool m_return_onerror;
@@ -66,12 +66,12 @@
Draws one solid graphics character
================
*/
-void M_DrawCharacter (int cx, int line, int num)
+static void M_DrawCharacter (int cx, int line, int num)
{
Draw_Character ( cx + ((vid.width - 320)>>1), line, num);
}
-void M_Print (int cx, int cy, char *str)
+static void M_Print (int cx, int cy, char *str)
{
while (*str)
{
@@ -81,7 +81,7 @@
}
}
-void M_PrintWhite (int cx, int cy, char *str)
+static void M_PrintWhite (int cx, int cy, char *str)
{
while (*str)
{
@@ -91,7 +91,7 @@
}
}
-void M_DrawTransPic (int x, int y, qpic_t *pic)
+static void M_DrawTransPic (int x, int y, qpic_t *pic)
{
Draw_TransPic (x + ((vid.width - 320)>>1), y, pic);
}
@@ -101,10 +101,10 @@
Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
}
-byte identityTable[256];
-byte translationTable[256];
+static byte identityTable[256];
+static byte translationTable[256];
-void M_BuildTranslationTable(int top, int bottom)
+static void M_BuildTranslationTable(int top, int bottom)
{
int j;
byte *dest, *source;
@@ -128,14 +128,12 @@
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
-
-void M_DrawTransPicTranslate (int x, int y, qpic_t *pic)
+static void M_DrawTransPicTranslate (int x, int y, qpic_t *pic)
{
Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
}
-
-void M_DrawTextBox (int x, int y, int width, int lines)
+static void M_DrawTextBox (int x, int y, int width, int lines)
{
qpic_t *p;
int cx, cy;
@@ -192,7 +190,7 @@
//=============================================================================
-int m_save_demonum;
+static int m_save_demonum;
void
M_ToggleMenu_f(void)
@@ -220,7 +218,7 @@
//=============================================================================
/* MAIN MENU */
-int m_main_cursor;
+static int m_main_cursor;
#define MAIN_ITEMS 5
@@ -237,7 +235,7 @@
}
-void M_Main_Draw (void)
+static void M_Main_Draw (void)
{
int f;
qpic_t *p;
@@ -253,7 +251,7 @@
}
-void M_Main_Key (int key)
+static void M_Main_Key (int key)
{
switch (key)
{
@@ -310,11 +308,10 @@
//=============================================================================
/* SINGLE PLAYER MENU */
-int m_singleplayer_cursor;
+static int m_singleplayer_cursor;
#define SINGLEPLAYER_ITEMS 3
-
-void M_Menu_SinglePlayer_f (void)
+static void M_Menu_SinglePlayer_f (void)
{
key_dest = key_menu;
m_state = m_singleplayer;
@@ -321,8 +318,7 @@
m_entersound = true;
}
-
-void M_SinglePlayer_Draw (void)
+static void M_SinglePlayer_Draw (void)
{
int f;
qpic_t *p;
@@ -337,8 +333,7 @@
M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
-
-void M_SinglePlayer_Key (int key)
+static void M_SinglePlayer_Key (int key)
{
switch (key)
{
@@ -388,9 +383,9 @@
//=============================================================================
/* LOAD/SAVE MENU */
-int load_cursor; // 0 < load_cursor < Nsav
+static int load_cursor; // 0 < load_cursor < Nsav
-void M_Menu_Load_f (void)
+static void M_Menu_Load_f (void)
{
m_entersound = true;
m_state = m_load;
@@ -398,8 +393,7 @@
savnames();
}
-
-void M_Menu_Save_f (void)
+static void M_Menu_Save_f (void)
{
if (!sv.active)
return;
@@ -413,8 +407,7 @@
savnames();
}
-
-void M_Load_Draw (void)
+static void M_Load_Draw (void)
{
int i;
qpic_t *p;
@@ -429,8 +422,7 @@
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
}
-
-void M_Save_Draw (void)
+static void M_Save_Draw (void)
{
int i;
qpic_t *p;
@@ -445,8 +437,7 @@
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
}
-
-void M_Load_Key (int k)
+static void M_Load_Key (int k)
{
switch (k)
{
@@ -487,8 +478,7 @@
}
}
-
-void M_Save_Key (int k)
+static void M_Save_Key (int k)
{
switch (k)
{
@@ -523,11 +513,10 @@
//=============================================================================
/* MULTIPLAYER MENU */
-int m_multiplayer_cursor;
+static int m_multiplayer_cursor;
#define MULTIPLAYER_ITEMS 3
-
-void M_Menu_MultiPlayer_f (void)
+static void M_Menu_MultiPlayer_f (void)
{
key_dest = key_menu;
m_state = m_multiplayer;
@@ -534,8 +523,7 @@
m_entersound = true;
}
-
-void M_MultiPlayer_Draw (void)
+static void M_MultiPlayer_Draw (void)
{
int f;
qpic_t *p;
@@ -550,8 +538,7 @@
M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
-
-void M_MultiPlayer_Key (int key)
+static void M_MultiPlayer_Key (int key)
{
switch (key)
{
@@ -593,19 +580,19 @@
//=============================================================================
/* SETUP MENU */
-int setup_cursor = 4;
-int setup_cursor_table[] = {40, 56, 80, 104, 140};
+static int setup_cursor = 4;
+static int setup_cursor_table[] = {40, 56, 80, 104, 140};
-char setup_hostname[16];
-char setup_myname[16];
-int setup_oldtop;
-int setup_oldbottom;
-int setup_top;
-int setup_bottom;
+static char setup_hostname[16];
+static char setup_myname[16];
+static int setup_oldtop;
+static int setup_oldbottom;
+static int setup_top;
+static int setup_bottom;
#define NUM_SETUP_CMDS 5
-void M_Menu_Setup_f (void)
+static void M_Menu_Setup_f (void)
{
key_dest = key_menu;
m_state = m_setup;
@@ -616,8 +603,7 @@
setup_bottom = setup_oldbottom = ((int)cl_color.value) & 15;
}
-
-void M_Setup_Draw (void)
+static void M_Setup_Draw (void)
{
qpic_t *p;
@@ -654,8 +640,7 @@
M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
}
-
-void M_Setup_Key (int k)
+static void M_Setup_Key (int k)
{
int l;
@@ -767,11 +752,10 @@
//=============================================================================
/* NET MENU */
-int m_net_cursor;
-int m_net_items;
-int m_net_saveHeight;
+static int m_net_cursor;
+static int m_net_items;
-char *net_helpMessage [] =
+static char *net_helpMessage [] =
{
/* .........1.........2.... */
" ",
@@ -790,7 +774,7 @@
" Area Network. "
};
-void M_Menu_Net_f (void)
+static void M_Menu_Net_f (void)
{
key_dest = key_menu;
m_state = m_net;
@@ -803,8 +787,7 @@
M_Net_Key (K_DOWNARROW);
}
-
-void M_Net_Draw (void)
+static void M_Net_Draw (void)
{
int f;
qpic_t *p;
@@ -842,8 +825,7 @@
M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
-
-void M_Net_Key (int k)
+static void M_Net_Key (int k)
{
again:
switch (k)
@@ -891,9 +873,9 @@
#define SLIDER_RANGE 10
-int options_cursor;
+static int options_cursor;
-void M_Menu_Options_f (void)
+static void M_Menu_Options_f (void)
{
key_dest = key_menu;
m_state = m_options;
@@ -900,8 +882,7 @@
m_entersound = true;
}
-
-void M_AdjustSliders (int dir)
+static void M_AdjustSliders (int dir)
{
localsfx ("misc/menu3.wav");
@@ -975,8 +956,7 @@
}
}
-
-void M_DrawSlider (int x, int y, float range)
+static void M_DrawSlider (int x, int y, float range)
{
int i;
@@ -991,7 +971,7 @@
M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
}
-void M_DrawCheckbox (int x, int y, int on)
+static void M_DrawCheckbox (int x, int y, int on)
{
/*
if (on)
@@ -1005,7 +985,7 @@
M_Print (x, y, "off");
}
-void M_Options_Draw (void)
+static void M_Options_Draw (void)
{
float r;
qpic_t *p;
@@ -1054,8 +1034,7 @@
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
}
-
-void M_Options_Key (int k)
+static void M_Options_Key (int k)
{
switch (k)
{
@@ -1117,7 +1096,7 @@
//=============================================================================
/* KEYS MENU */
-char *bindnames[][2] =
+static char *bindnames[][2] =
{
{"+attack", "attack"},
{"impulse 10", "change weapon"},
@@ -1139,10 +1118,10 @@
{"+movedown", "swim down"}
};
-int keys_cursor;
-int bind_grab;
+static int keys_cursor;
+static int bind_grab;
-void M_Menu_Keys_f (void)
+static void M_Menu_Keys_f (void)
{
key_dest = key_menu;
m_state = m_keys;
@@ -1149,8 +1128,7 @@
m_entersound = true;
}
-
-void M_FindKeysForCommand (char *command, int *twokeys)
+static void M_FindKeysForCommand (char *command, int *twokeys)
{
int count;
int j;
@@ -1176,7 +1154,7 @@
}
}
-void M_UnbindCommand (char *command)
+static void M_UnbindCommand (char *command)
{
int j;
int l;
@@ -1194,8 +1172,7 @@
}
}
-
-void M_Keys_Draw (void)
+static void M_Keys_Draw (void)
{
int i;
int keys[2];
@@ -1243,8 +1220,7 @@
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
}
-
-void M_Keys_Key (int k)
+static void M_Keys_Key (int k)
{
char cmd[80];
int keys[2];
@@ -1303,11 +1279,10 @@
//=============================================================================
/* HELP MENU */
-int help_page;
+static int help_page;
#define NUM_HELP_PAGES 6
-
-void M_Menu_Help_f (void)
+static void M_Menu_Help_f (void)
{
key_dest = key_menu;
m_state = m_help;
@@ -1315,15 +1290,12 @@
help_page = 0;
}
-
-
-void M_Help_Draw (void)
+static void M_Help_Draw (void)
{
M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%d.lmp", help_page)) );
}
-
-void M_Help_Key (int key)
+static void M_Help_Key (int key)
{
switch (key)
{
@@ -1351,11 +1323,11 @@
//=============================================================================
/* QUIT MENU */
-int msgNumber;
-int m_quit_prevstate;
-bool wasInMenus;
+static int msgNumber;
+static int m_quit_prevstate;
+static bool wasInMenus;
-char *quitMessage [] =
+static char *quitMessage [] =
{
/* .........1.........2.... */
" Are you gonna quit ",
@@ -1411,8 +1383,7 @@
msgNumber = rand()&7;
}
-
-void M_Quit_Key (int key)
+static void M_Quit_Key (int key)
{
switch (key)
{
@@ -1443,7 +1414,7 @@
}
-void
+static void
M_Quit_Draw(void)
{
if(wasInMenus){
@@ -1463,14 +1434,14 @@
//=============================================================================
/* LAN CONFIG MENU */
-int lanConfig_cursor = -1;
-int lanConfig_cursor_table [] = {72, 92};
+static int lanConfig_cursor = -1;
+static int lanConfig_cursor_table [] = {72, 92};
#define NUM_LANCONFIG_CMDS 2
-char lanConfig_portname[8];
-char lanConfig_joinname[22];
+static char lanConfig_portname[8];
+static char lanConfig_joinname[22];
-void M_Menu_LanConfig_f (void)
+static void M_Menu_LanConfig_f (void)
{
key_dest = key_menu;
m_state = m_lanconfig;
@@ -1482,8 +1453,7 @@
m_return_reason[0] = 0;
}
-
-void M_LanConfig_Draw (void)
+static void M_LanConfig_Draw (void)
{
qpic_t *p;
int basex;
@@ -1532,8 +1502,7 @@
M_PrintWhite (basex, 148, m_return_reason);
}
-
-void M_LanConfig_Key (int key)
+static void M_LanConfig_Key (int key)
{
int l;
@@ -1638,7 +1607,7 @@
char *description;
} level_t;
-level_t levels[] =
+static level_t levels[] =
{
{"start", "Entrance"}, // 0
@@ -1687,7 +1656,7 @@
};
//MED 01/06/97 added hipnotic levels
-level_t hipnoticlevels[] =
+static level_t hipnoticlevels[] =
{
{"start", "Command HQ"}, // 0
@@ -1716,7 +1685,7 @@
//PGM 01/07/97 added rogue levels
//PGM 03/02/97 added dmatch level
-level_t roguelevels[] =
+static level_t roguelevels[] =
{
{"start", "Split Decision"},
{"r1m1", "Deviant's Domain"},
@@ -1744,7 +1713,7 @@
int levels;
} episode_t;
-episode_t episodes[] =
+static episode_t episodes[] =
{
{"Welcome to Quake", 0, 1},
{"Doomed Dimension", 1, 8},
@@ -1756,7 +1725,7 @@
};
//MED 01/06/97 added hipnotic episodes
-episode_t hipnoticepisodes[] =
+static episode_t hipnoticepisodes[] =
{
{"Scourge of Armagon", 0, 1},
{"Fortress of the Dead", 1, 5},
@@ -1768,7 +1737,7 @@
//PGM 01/07/97 added rogue episodes
//PGM 03/02/97 added dmatch episode
-episode_t rogueepisodes[] =
+static episode_t rogueepisodes[] =
{
{"Introduction", 0, 1},
{"Hell's Fortress", 1, 7},
@@ -1776,13 +1745,13 @@
{"Deathmatch Arena", 16, 1}
};
-int startepisode;
-int startlevel;
-int maxplayers;
-bool m_serverInfoMessage = false;
-double m_serverInfoMessageTime;
+static int startepisode;
+static int startlevel;
+static int maxplayers;
+static bool m_serverInfoMessage = false;
+static double m_serverInfoMessageTime;
-void M_Menu_GameOptions_f (void)
+static void M_Menu_GameOptions_f (void)
{
key_dest = key_menu;
m_state = m_gameoptions;
@@ -1793,12 +1762,11 @@
maxplayers = svs.maxclientslimit;
}
-
-int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
+static int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
#define NUM_GAMEOPTIONS 9
-int gameoptions_cursor;
+static int gameoptions_cursor;
-void M_GameOptions_Draw (void)
+static void M_GameOptions_Draw (void)
{
qpic_t *p;
int x;
@@ -1922,8 +1890,7 @@
}
}
-
-void M_NetStart_Change (int dir)
+static void M_NetStart_Change (int dir)
{
int count;
@@ -2025,7 +1992,7 @@
}
}
-void M_GameOptions_Key (int key)
+static void M_GameOptions_Key (int key)
{
switch (key)
{
@@ -2088,7 +2055,6 @@
//=============================================================================
/* Menu Subsystem */
-
void M_Init (void)
{
Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
@@ -2105,7 +2071,6 @@
Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
}
-
void M_Draw (void)
{
if (m_state == m_none || key_dest != key_menu)
@@ -2113,8 +2078,6 @@
if (!m_recursiveDraw)
{
- scr_copyeverything = 1;
-
if (scr_con_current)
Draw_ConsoleBackground (vid.height);
else
--- a/mkfile
+++ b/mkfile
@@ -23,7 +23,6 @@
draw.$O\
d_alpha.$O\
d_edge.$O\
- d_fill.$O\
d_init.$O\
d_modech.$O\
d_part.$O\
--- a/model.c
+++ b/model.c
@@ -1,7 +1,7 @@
#include "quakedef.h"
-model_t *loadmodel;
-char loadname[32]; // for hunk tags
+static model_t *loadmodel;
+static char loadname[32]; // for hunk tags
void Mod_LoadSpriteModel (model_t *mod, void *buffer);
void Mod_LoadBrushModel (model_t *mod, void *buffer);
@@ -9,8 +9,8 @@
model_t *Mod_LoadModel (model_t *mod, bool crash);
#define MAX_MOD_KNOWN 4096
-model_t *mod_known;
-int mod_numknown;
+static model_t *mod_known;
+static int mod_numknown;
// values for model_t's needload
#define NL_PRESENT 0
@@ -305,8 +305,7 @@
===============================================================================
*/
-byte *mod_base;
-
+static byte *mod_base;
/*
=================
--- a/net.h
+++ b/net.h
@@ -85,7 +85,6 @@
extern qsocket_t *net_activeSockets;
extern qsocket_t *net_freeSockets;
-extern int net_numsockets;
typedef struct Landrv Landrv;
typedef struct Netdrv Netdrv;
@@ -121,8 +120,6 @@
void (*Close)(qsocket_t *);
void (*Shutdown)(void);
};
-extern int net_numdrivers;
-extern Netdrv netdrv[MAX_NET_DRIVERS];
extern int net_driverlevel;
extern cvar_t hostname;
@@ -201,7 +198,6 @@
void Datagram_Shutdown (void);
int Loop_Init (void);
-void Loop_Listen (bool state);
qsocket_t *Loop_Connect (char *host);
qsocket_t *Loop_CheckNewConnections (void);
int Loop_GetMessage (qsocket_t *sock);
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -10,12 +10,12 @@
static int net_landriverlevel;
/* statistic counters */
-int packetsSent;
-int packetsReSent;
-int packetsReceived;
-int receivedDuplicateCount;
-int shortPacketCount;
-int droppedDatagrams;
+static int packetsSent;
+static int packetsReSent;
+static int packetsReceived;
+static int receivedDuplicateCount;
+static int shortPacketCount;
+static int droppedDatagrams;
static int myDriverLevel;
@@ -619,7 +619,7 @@
memcpy(&readaddr, &sendaddr, sizeof readaddr);
// send the connection request
- Con_Printf("trying...\n"); SCR_UpdateScreen ();
+ Con_Printf("trying...\n"); SCR_UpdateScreen (false);
start_time = net_time;
UDP_Listen(1);
@@ -671,7 +671,7 @@
while (ret == 0 && (SetNetTime() - start_time) < 2.5);
if (ret)
break;
- Con_Printf("still trying...\n"); SCR_UpdateScreen ();
+ Con_Printf("still trying...\n"); SCR_UpdateScreen (false);
start_time = SetNetTime();
}
/* bullshit workaround for non-plan9 servers replying from different
--- a/net_loop.c
+++ b/net_loop.c
@@ -1,8 +1,8 @@
#include "quakedef.h"
-bool localconnectpending = false;
-qsocket_t *loop_client = nil;
-qsocket_t *loop_server = nil;
+static bool localconnectpending;
+static qsocket_t *loop_client;
+static qsocket_t *loop_server;
int Loop_Init (void)
{
@@ -11,13 +11,7 @@
return 0;
}
-
void Loop_Shutdown (void)
-{
-}
-
-
-void Loop_Listen (bool) /*state*/
{
}
--- a/net_main.c
+++ b/net_main.c
@@ -2,7 +2,7 @@
qsocket_t *net_activeSockets = nil;
qsocket_t *net_freeSockets = nil;
-int net_numsockets = 0;
+static int net_numsockets;
sizebuf_t net_message;
int net_activeconnections = 0;
@@ -15,7 +15,7 @@
static cvar_t net_messagetimeout = {"net_messagetimeout","300"};
cvar_t hostname = {"hostname", "UNNAMED"};
-Netdrv netdrv[MAX_NET_DRIVERS] = {
+static Netdrv netdrv[MAX_NET_DRIVERS] = {
{
"Loopback",
false,
@@ -48,7 +48,7 @@
}
#endif
};
-int net_numdrivers = 0;
+static int net_numdrivers;
Landrv landrv[MAX_NET_DRIVERS] = {
#ifdef __plan9__
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -616,21 +616,6 @@
pr_global_struct->trace_ent = EDICT_TO_PROG(sv.edicts);
}
-
-/*
-=================
-PF_checkpos
-
-Returns true if the given entity can move to the given position from it's
-current position by walking or rolling.
-FIXME: make work...
-scalar checkpos (entity, vector)
-=================
-*/
-void PF_checkpos (void)
-{
-}
-
//============================================================================
static byte *checkpvs;
@@ -706,7 +691,6 @@
=================
*/
#define MAX_CHECK 16
-int c_invis, c_notvis;
void PF_checkclient (void)
{
edict_t *ent, *self;
@@ -736,13 +720,11 @@
l = (leaf - sv.worldmodel->leafs) - 1;
if ( (l<0) || !(checkpvs[l>>3] & (1<<(l&7)) ) )
{
- c_notvis++;
RETURN_EDICT(sv.edicts);
return;
}
// might be able to see it
- c_invis++;
RETURN_EDICT(ent);
}
@@ -1549,7 +1531,7 @@
// even though it does *not* check for the extension
}
-builtin_t pr_builtin[] =
+static const builtin_t pr_builtin[] =
{
PF_Fixme,
PF_makevectors, // void(entity e) makevectors = #1;
@@ -1643,6 +1625,6 @@
[232] = PF_clientstat,
};
-builtin_t *pr_builtins = pr_builtin;
-int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
+const builtin_t *pr_builtins = pr_builtin;
+const int pr_numbuiltins = nelem(pr_builtin);
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -2,7 +2,7 @@
dprograms_t *progs;
dfunction_t *pr_functions;
-char *pr_strings;
+static char *pr_strings;
static int pr_strings_size;
ddef_t *pr_fielddefs;
ddef_t *pr_globaldefs;
@@ -26,18 +26,19 @@
bool ED_ParseEpair (void *base, ddef_t *key, char *s);
cvar_t nomonsters = {"nomonsters", "0"};
-cvar_t gamecfg = {"gamecfg", "0"};
-cvar_t scratch1 = {"scratch1", "0"};
-cvar_t scratch2 = {"scratch2", "0"};
-cvar_t scratch3 = {"scratch3", "0"};
-cvar_t scratch4 = {"scratch4", "0"};
-cvar_t savedgamecfg = {"savedgamecfg", "0", true};
-cvar_t saved1 = {"saved1", "0", true};
-cvar_t saved2 = {"saved2", "0", true};
-cvar_t saved3 = {"saved3", "0", true};
-cvar_t saved4 = {"saved4", "0", true};
-cvar_t pr_checkextension = {"pr_checkextension", "1"};
+static cvar_t scratch1 = {"scratch1", "0"};
+static cvar_t scratch2 = {"scratch2", "0"};
+static cvar_t scratch3 = {"scratch3", "0"};
+static cvar_t scratch4 = {"scratch4", "0"};
+static cvar_t saved1 = {"saved1", "0", true};
+static cvar_t saved2 = {"saved2", "0", true};
+static cvar_t saved3 = {"saved3", "0", true};
+static cvar_t saved4 = {"saved4", "0", true};
+static cvar_t gamecfg = {"gamecfg", "0"};
+static cvar_t savedgamecfg = {"savedgamecfg", "0", true};
+static cvar_t pr_checkextension = {"pr_checkextension", "1"};
+
#define MAX_FIELD_LEN 64
#define GEFV_CACHESIZE 2
@@ -49,14 +50,14 @@
static gefv_cache gefvCache[GEFV_CACHESIZE] = {{nil, ""}, {nil, ""}};
#define MAX_PRSTR 1024
-char **prstr;
-int num_prstr;
-int max_prstr;
+static char **prstr;
+static int max_prstr;
+static int num_prstr;
#define MAX_PRTEMPSTR 1024
#define PRTEMPSTR_SIZE 1024
-char *prtempstr;
-int num_prtempstr;
+static char *prtempstr;
+static int num_prtempstr;
char *
PR_StrTmp(void)
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -17,12 +17,12 @@
bool pr_trace;
dfunction_t *pr_xfunction;
-int pr_xstatement;
+static int pr_xstatement;
int pr_argc;
-char *pr_opnames[] =
+static const char *pr_opnames[] =
{
"DONE",
--- a/progs.h
+++ b/progs.h
@@ -33,7 +33,6 @@
extern dprograms_t *progs;
extern dfunction_t *pr_functions;
-extern char *pr_strings;
extern ddef_t *pr_globaldefs;
extern ddef_t *pr_fielddefs;
extern dstatement_t *pr_statements;
@@ -99,14 +98,13 @@
extern int type_size[8];
typedef void (*builtin_t) (void);
-extern builtin_t *pr_builtins;
-extern int pr_numbuiltins;
+extern const builtin_t *pr_builtins;
+extern const int pr_numbuiltins;
extern int pr_argc;
extern bool pr_trace;
extern dfunction_t *pr_xfunction;
-extern int pr_xstatement;
#pragma varargck argpos PR_RunError 1
void PR_RunError (char *error, ...);
--- a/quakedef.h
+++ b/quakedef.h
@@ -191,8 +191,6 @@
void Host_ShutdownServer (bool crash);
extern cvar_t pausable;
-extern bool msg_suppress_1; // suppresses resolution and cache size console output
- // an fullscreen DIB focus gain/loss
extern int current_skill; // skill level for currently loaded level (in case
// the user changes the cvar while the level is
// running, this reflects the level actually in use)
--- a/r_draw.c
+++ b/r_draw.c
@@ -10,15 +10,9 @@
int c_faceclip; // number of faces clipped
-zpointdesc_t r_zpointdesc;
-
-polydesc_t r_polydesc;
-
int r_drawflags;
-clipplane_t *entity_clipplanes;
clipplane_t view_clipplanes[4];
-clipplane_t world_clipplanes[16];
static medge_t *r_pedge;
@@ -43,7 +37,7 @@
static float r_u1, r_v1, r_lzi1;
static int r_ceilv1;
-bool r_lastvertvalid;
+static bool r_lastvertvalid;
int
surfdrawflags(int flags)
@@ -640,221 +634,3 @@
surface_p++;
}
-
-
-/*
-================
-R_RenderPoly
-================
-*/
-void R_RenderPoly (msurface_t *fa, int clipflags)
-{
- int i, lindex, lnumverts, s_axis, t_axis;
- float dist, lastdist, lzi, scale, u, v, frac;
- unsigned mask;
- vec3_t local, transformed;
- clipplane_t *pclip;
- medge_t *pedges;
- mplane_t *pplane;
- mvertex_t verts[2][100]; //FIXME: do real number
- polyvert_t pverts[100]; //FIXME: do real number, safely
- int vertpage, newverts, newpage, lastvert;
- bool visible;
-
- // FIXME: clean this up and make it faster
- // FIXME: guard against running out of vertices
-
- s_axis = t_axis = 0; // keep compiler happy
-
- // set up clip planes
- pclip = nil;
-
- for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
- {
- if (clipflags & mask)
- {
- view_clipplanes[i].next = pclip;
- pclip = &view_clipplanes[i];
- }
- }
-
- memset(verts, 0, sizeof(verts));
-
- // reconstruct the polygon
- // FIXME: these should be precalculated and loaded off disk
- pedges = currententity->model->edges;
- lnumverts = fa->numedges;
- vertpage = 0;
-
- for (i=0 ; i<lnumverts ; i++)
- {
- lindex = currententity->model->surfedges[fa->firstedge + i];
-
- if (lindex > 0)
- {
- r_pedge = &pedges[lindex];
- verts[0][i] = r_pcurrentvertbase[r_pedge->v[0]];
- }
- else
- {
- r_pedge = &pedges[-lindex];
- verts[0][i] = r_pcurrentvertbase[r_pedge->v[1]];
- }
- }
-
- // clip the polygon, done if not visible
- while (pclip)
- {
- lastvert = lnumverts - 1;
- assert(vertpage < 2);
- assert(lastvert < 100);
- lastdist = DotProduct (verts[vertpage][lastvert].position,
- pclip->normal) - pclip->dist;
-
- visible = false;
- newverts = 0;
- newpage = vertpage ^ 1;
-
- for (i=0 ; i<lnumverts ; i++)
- {
- dist = DotProduct (verts[vertpage][i].position, pclip->normal) -
- pclip->dist;
-
- if ((lastdist > 0) != (dist > 0))
- {
- frac = dist / (dist - lastdist);
- verts[newpage][newverts].position[0] =
- verts[vertpage][i].position[0] +
- ((verts[vertpage][lastvert].position[0] -
- verts[vertpage][i].position[0]) * frac);
- verts[newpage][newverts].position[1] =
- verts[vertpage][i].position[1] +
- ((verts[vertpage][lastvert].position[1] -
- verts[vertpage][i].position[1]) * frac);
- verts[newpage][newverts].position[2] =
- verts[vertpage][i].position[2] +
- ((verts[vertpage][lastvert].position[2] -
- verts[vertpage][i].position[2]) * frac);
- newverts++;
- }
-
- if (dist >= 0)
- {
- verts[newpage][newverts] = verts[vertpage][i];
- newverts++;
- visible = true;
- }
-
- lastvert = i;
- lastdist = dist;
- }
-
- if (!visible || (newverts < 3))
- return;
-
- lnumverts = newverts;
- vertpage ^= 1;
- pclip = pclip->next;
- }
-
- // transform and project, remembering the z values at the vertices and
- // r_nearzi, and extract the s and t coordinates at the vertices
- pplane = fa->plane;
- switch (pplane->type)
- {
- case PLANE_X:
- case PLANE_ANYX:
- s_axis = 1;
- t_axis = 2;
- break;
- case PLANE_Y:
- case PLANE_ANYY:
- s_axis = 0;
- t_axis = 2;
- break;
- case PLANE_Z:
- case PLANE_ANYZ:
- s_axis = 0;
- t_axis = 1;
- break;
- }
-
- r_nearzi = 0;
-
- for (i=0 ; i<lnumverts ; i++)
- {
- // transform and project
- VectorSubtract (verts[vertpage][i].position, modelorg, local);
- TransformVector (local, transformed);
-
- if (transformed[2] < NEAR_CLIP)
- transformed[2] = NEAR_CLIP;
-
- lzi = 1.0 / transformed[2];
-
- if (lzi > r_nearzi) // for mipmap finding
- r_nearzi = lzi;
-
- // FIXME: build x/yscale into transform?
- scale = xscale * lzi;
- u = (xcenter + scale*transformed[0]);
- if (u < r_refdef.fvrectx_adj)
- u = r_refdef.fvrectx_adj;
- if (u > r_refdef.fvrectright_adj)
- u = r_refdef.fvrectright_adj;
-
- scale = yscale * lzi;
- v = (ycenter - scale*transformed[1]);
- if (v < r_refdef.fvrecty_adj)
- v = r_refdef.fvrecty_adj;
- if (v > r_refdef.fvrectbottom_adj)
- v = r_refdef.fvrectbottom_adj;
-
- pverts[i].u = u;
- pverts[i].v = v;
- pverts[i].zi = lzi;
- pverts[i].s = verts[vertpage][i].position[s_axis];
- pverts[i].t = verts[vertpage][i].position[t_axis];
- }
-
- // build the polygon descriptor, including fa, r_nearzi, and u, v, s, t, and z
- // for each vertex
- r_polydesc.numverts = lnumverts;
- r_polydesc.nearzi = r_nearzi;
- r_polydesc.pcurrentface = fa;
- r_polydesc.pverts = pverts;
-
- // draw the polygon
- D_DrawPoly ();
-}
-
-
-/*
-================
-R_ZDrawSubmodelPolys
-================
-*/
-void R_ZDrawSubmodelPolys (model_t *pmodel)
-{
- int i, numsurfaces;
- msurface_t *psurf;
- float dot;
- mplane_t *pplane;
-
- psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
- numsurfaces = pmodel->nummodelsurfaces;
-
- for (i=0 ; i<numsurfaces ; i++, psurf++)
- {
- // find which side of the node we are on
- pplane = psurf->plane;
-
- dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
-
- // draw the polygon
- // FIXME: use bounding-box-based frustum clipping info?
- if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
- R_RenderPoly (psurf, 15);
- }
-}
-
--- a/r_edge.c
+++ b/r_edge.c
@@ -21,25 +21,18 @@
edge_t *newedges[MAXHEIGHT];
edge_t *removeedges[MAXHEIGHT];
-espan_t *span_p, *max_span_p;
+static espan_t *span_p, *max_span_p;
int r_currentkey;
extern int screenwidth;
-int current_iv;
+static int current_iv, edge_head_u_shift20, edge_tail_u_shift20;
+static edge_t edge_head, edge_tail, edge_aftertail, edge_sentinel;
+static float fv;
-int edge_head_u_shift20, edge_tail_u_shift20;
-
static void (*pdrawfunc)(void);
-edge_t edge_head;
-edge_t edge_tail;
-edge_t edge_aftertail;
-edge_t edge_sentinel;
-
-float fv;
-
void R_GenerateSpans (void);
void R_LeadingEdge (edge_t *edge);
@@ -233,87 +226,6 @@
surf = surf->next;
} while (surf != &surfaces[1]);
}
-
-
-/*
-==============
-R_LeadingEdgeBackwards
-==============
-*/
-void R_LeadingEdgeBackwards (edge_t *edge)
-{
- espan_t *span;
- surf_t *surf, *surf2;
- int iu;
-
- // it's adding a new surface in, so find the correct place
- surf = &surfaces[edge->surfs[1]];
-
- // don't start a span if this is an inverted span, with the end
- // edge preceding the start edge (that is, we've already seen the
- // end edge)
- if (++surf->spanstate == 1)
- {
- surf2 = surfaces[1].next;
-
- if (surf->key > surf2->key)
- goto newtop;
-
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
- if (surf->insubmodel && (surf->key == surf2->key))
- {
- // must be two bmodels in the same leaf; don't care, because they'll
- // never be farthest anyway
- goto newtop;
- }
-
-continue_search:
-
- do
- {
- surf2 = surf2->next;
- } while (surf->key < surf2->key);
-
- if (surf->key == surf2->key)
- {
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
- if (!surf->insubmodel)
- goto continue_search;
-
- // must be two bmodels in the same leaf; don't care which is really
- // in front, because they'll never be farthest anyway
- }
-
- goto gotposition;
-
-newtop:
- // emit a span (obscures current top)
- iu = edge->u >> 20;
-
- if (iu > surf2->last_u)
- {
- span = span_p++;
- span->u = surf2->last_u;
- span->count = iu - span->u;
- span->v = current_iv;
- span->pnext = surf2->spans;
- surf2->spans = span;
- }
-
- // set last_u on the new span
- surf->last_u = iu;
-
-gotposition:
- // insert before surf2
- surf->next = surf2;
- surf->prev = surf2->prev;
- surf2->prev->next = surf;
- surf2->prev = surf;
- }
-}
-
/*
==============
--- a/r_efrag.c
+++ b/r_efrag.c
@@ -13,13 +13,11 @@
===============================================================================
*/
-efrag_t **lastlink;
+static efrag_t **lastlink;
vec3_t r_emins, r_emaxs;
-entity_t *r_addent;
-
/*
================
R_RemoveEfrags
@@ -66,7 +64,7 @@
R_SplitEntityOnNode
===================
*/
-void R_SplitEntityOnNode (mnode_t *node)
+static void R_SplitEntityOnNode (mnode_t *node, entity_t *add)
{
efrag_t *ef;
mplane_t *splitplane;
@@ -96,7 +94,7 @@
}
cl.free_efrags = cl.free_efrags->entnext;
- ef->entity = r_addent;
+ ef->entity = add;
// add the entity link
*lastlink = ef;
@@ -126,10 +124,10 @@
// recurse down the contacted sides
if (sides & 1)
- R_SplitEntityOnNode (node->children[0]);
+ R_SplitEntityOnNode (node->children[0], add);
if (sides & 2)
- R_SplitEntityOnNode (node->children[1]);
+ R_SplitEntityOnNode (node->children[1], add);
}
@@ -188,8 +186,6 @@
if (ent == cl_entities)
return; // never add the world
- r_addent = ent;
-
lastlink = &ent->efrag;
r_pefragtopnode = nil;
@@ -201,7 +197,7 @@
r_emaxs[i] = ent->origin[i] + entmodel->maxs[i];
}
- R_SplitEntityOnNode (cl.worldmodel->nodes);
+ R_SplitEntityOnNode (cl.worldmodel->nodes, ent);
ent->topnode = r_pefragtopnode;
}
--- a/r_local.h
+++ b/r_local.h
@@ -45,7 +45,6 @@
extern cvar_t r_clearcolor;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
-extern cvar_t r_drawentities;
extern cvar_t r_ambient;
extern cvar_t r_reportsurfout;
extern cvar_t r_numsurfs;
@@ -114,9 +113,7 @@
void R_DrawSprite (void);
int R_RenderFace (msurface_t *fa, int clipflags);
-void R_RenderPoly (msurface_t *fa, int clipflags);
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf);
-void R_TransformPlane (mplane_t *p, float *normal, float *dist);
void R_TransformFrustum (void);
void R_SetSkyFrame (void);
void R_DrawSurfaceBlock8 (void);
@@ -171,7 +168,6 @@
extern int r_currentbkey;
void R_InitTurb (void);
-void R_ZDrawSubmodelPolys (model_t *clmodel);
//=========================================================
// Alias models
@@ -211,9 +207,6 @@
extern int screenwidth;
// FIXME: make stack vars when debugging done
-extern edge_t edge_head;
-extern edge_t edge_tail;
-extern edge_t edge_aftertail;
extern int r_bmodelactive;
extern float aliasxscale, aliasyscale, aliasxcenter, aliasycenter;
--- a/r_main.c
+++ b/r_main.c
@@ -4,7 +4,7 @@
void *colormap;
static vec3_t viewlightvec;
-alight_t r_viewlighting = {128, 192, viewlightvec};
+static alight_t r_viewlighting = {128, 192, viewlightvec};
int r_numallocatededges;
int r_numallocatedbasespans;
byte *r_basespans;
@@ -78,18 +78,19 @@
void R_MarkLeaves (void);
+static cvar_t r_drawentities = {"r_drawentities","1"};
+static cvar_t r_drawviewmodel = {"r_drawviewmodel","1"};
+
cvar_t r_clearcolor = {"r_clearcolor","2"};
cvar_t r_waterwarp = {"r_waterwarp","1"};
cvar_t r_fullbright = {"r_fullbright","0"};
-cvar_t r_drawentities = {"r_drawentities","1"};
-cvar_t r_drawviewmodel = {"r_drawviewmodel","1"};
cvar_t r_ambient = {"r_ambient", "0"};
cvar_t r_reportsurfout = {"r_reportsurfout", "0"};
cvar_t r_numsurfs = {"r_numsurfs", "0"};
cvar_t r_reportedgeout = {"r_reportedgeout", "0"};
cvar_t r_numedges = {"r_numedges", "0"};
-cvar_t r_aliastransbase = {"r_aliastransbase", "200"};
-cvar_t r_aliastransadj = {"r_aliastransadj", "100"};
+static cvar_t r_aliastransbase = {"r_aliastransbase", "200"};
+static cvar_t r_aliastransadj = {"r_aliastransadj", "100"};
cvar_t r_part_scale = {"r_part_scale", "0.75", true};
cvar_t r_wateralpha = {"r_wateralpha", "1", true};
cvar_t r_lavaalpha = {"r_lavaalpha", "1", true};
--- a/r_misc.c
+++ b/r_misc.c
@@ -16,29 +16,6 @@
}
}
-void WarpPalette (void)
-{
- int i,j;
- byte newpalette[768];
- int basecolor[3];
-
- basecolor[0] = 130;
- basecolor[1] = 80;
- basecolor[2] = 50;
-
- // pull the colors halfway to bright brown
- for (i=0 ; i<256 ; i++)
- {
- for (j=0 ; j<3 ; j++)
- {
- newpalette[i*3+j] = (host_basepal[i*3+j] + basecolor[j])/2;
- }
- }
-
- setpal(newpalette);
-}
-
-
/*
===================
R_TransformFrustum
@@ -77,23 +54,6 @@
out[1] = DotProduct(in,vup);
out[2] = DotProduct(in,vpn);
}
-
-
-/*
-================
-R_TransformPlane
-================
-*/
-void R_TransformPlane (mplane_t *p, float *normal, float *dist)
-{
- float d;
-
- d = DotProduct (r_origin, p->normal);
- *dist = p->dist - d;
- // TODO: when we have rotating entities, this will need to use the view matrix
- TransformVector (p->normal, normal);
-}
-
/*
===============
--- a/r_part.c
+++ b/r_part.c
@@ -5,16 +5,16 @@
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
// on the command line
-int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
-int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
-int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
+static int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
+static int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
+static int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
particle_t *active_particles, *free_particles;
-particle_t *particles;
-int r_numparticles;
+static particle_t *particles;
+static int r_numparticles;
-vec3_t r_pright, r_pup, r_ppn;
+vec3_t r_pright, r_pup, r_ppn;
void
--- a/r_sky.c
+++ b/r_sky.c
@@ -1,14 +1,15 @@
#include "quakedef.h"
-int iskyspeed = 8;
-int iskyspeed2 = 2;
-float skyspeed, skyspeed2;
+static int iskyspeed = 8;
+static int iskyspeed2 = 2;
+static float skyspeed2;
-float skytime;
+float skyspeed, skytime;
-byte *r_skysource[2];
+byte *r_skysource[2];
-int r_skymade, skyw, skyh;
+static int r_skymade;
+int skyw, skyh;
/*
=============
--- a/r_surf.c
+++ b/r_surf.c
@@ -3,14 +3,14 @@
drawsurf_t r_drawsurf;
static int sourcetstep, lightleftstep, lightrightstep;
-void *prowdestbase;
-unsigned char *pbasesource;
-int surfrowbytes; // used by ASM files
-unsigned *r_lightptr;
-int r_stepback;
-int r_lightwidth;
-int r_numhblocks, r_numvblocks;
-unsigned char *r_source, *r_sourcemax;
+static int surfrowbytes; // used by ASM files
+static int r_stepback;
+static int r_numhblocks, r_numvblocks;
+static byte *r_source, *r_sourcemax;
+static unsigned *r_lightptr;
+static int r_lightwidth;
+static byte *pbasesource;
+static void *prowdestbase;
static void R_DrawSurfaceBlock8_mip0 (void);
static void R_DrawSurfaceBlock8_mip1 (void);
@@ -480,40 +480,4 @@
if (psource >= r_sourcemax)
psource -= r_stepback;
}
-}
-
-/*
-================
-R_GenTurbTile
-================
-*/
-void R_GenTurbTile (pixel_t *pbasetex, void *pdest)
-{
- int *turb;
- int i, j, s, t;
- byte *pd;
-
- turb = sintable + ((int)(cl.time*SPEED)&(CYCLE-1));
- pd = (byte *)pdest;
-
- for (i=0 ; i<TILE_SIZE ; i++)
- {
- for (j=0 ; j<TILE_SIZE ; j++)
- {
- s = (((j << 16) + turb[i & (CYCLE-1)]) >> 16) & 63;
- t = (((i << 16) + turb[j & (CYCLE-1)]) >> 16) & 63;
- *pd++ = *(pbasetex + (t<<6) + s);
- }
- }
-}
-
-void
-R_GenTile(msurface_t *psurf, void *pdest)
-{
- if(psurf->flags & SURF_DRAWTURB){
- R_GenTurbTile((pixel_t *)
- ((byte *)psurf->texinfo->texture
- + psurf->texinfo->texture->offsets[0]), pdest);
- }else if((psurf->flags & SURF_DRAWSKY) == 0)
- fatal("Unknown tile type");
}
--- a/sbar.c
+++ b/sbar.c
@@ -1,44 +1,44 @@
#include "quakedef.h"
-int sb_updates; // if >= vid.numpages, no update needed
+static int sb_updates; // if >= vid.numpages, no update needed
#define STAT_MINUS 10 // num frame for '-' stats digit
-qpic_t *sb_nums[2][11];
-qpic_t *sb_colon, *sb_slash;
-qpic_t *sb_ibar;
-qpic_t *sb_sbar;
-qpic_t *sb_scorebar;
+static qpic_t *sb_nums[2][11];
+static qpic_t *sb_colon, *sb_slash;
+static qpic_t *sb_ibar;
+static qpic_t *sb_sbar;
+static qpic_t *sb_scorebar;
-qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
-qpic_t *sb_ammo[4];
-qpic_t *sb_sigil[4];
-qpic_t *sb_armor[3];
-qpic_t *sb_items[32];
+static qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
+static qpic_t *sb_ammo[4];
+static qpic_t *sb_sigil[4];
+static qpic_t *sb_armor[3];
+static qpic_t *sb_items[32];
-qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
- // 0 is static, 1 is temporary animation
-qpic_t *sb_face_invis;
-qpic_t *sb_face_quad;
-qpic_t *sb_face_invuln;
-qpic_t *sb_face_invis_invuln;
+static qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
+// 0 is static, 1 is temporary animation
+static qpic_t *sb_face_invis;
+static qpic_t *sb_face_quad;
+static qpic_t *sb_face_invuln;
+static qpic_t *sb_face_invis_invuln;
-bool sb_showscores;
+static bool sb_showscores;
int sb_lines; // scan lines to draw
-qpic_t *rsb_invbar[2];
-qpic_t *rsb_weapons[5];
-qpic_t *rsb_items[2];
-qpic_t *rsb_ammo[3];
-qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
+static qpic_t *rsb_invbar[2];
+static qpic_t *rsb_weapons[5];
+static qpic_t *rsb_items[2];
+static qpic_t *rsb_ammo[3];
+static qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
//MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
-qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
+static qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
//MED 01/04/97 added array to simplify weapon parsing
-int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
+static int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
//MED 01/04/97 added hipnotic items array
-qpic_t *hsb_items[2];
+static qpic_t *hsb_items[2];
void Sbar_MiniDeathmatchOverlay (void);
void Sbar_DeathmatchOverlay (void);
@@ -354,14 +354,9 @@
//=============================================================================
-int fragsort[MAX_SCOREBOARD];
+static int fragsort[MAX_SCOREBOARD];
+static int scoreboardlines;
-char scoreboardtext[MAX_SCOREBOARD][48];
-int scoreboardtop[MAX_SCOREBOARD];
-int scoreboardbottom[MAX_SCOREBOARD];
-int scoreboardcount[MAX_SCOREBOARD];
-int scoreboardlines;
-
/*
===============
Sbar_SortFrags
@@ -399,37 +394,6 @@
/*
===============
-Sbar_UpdateScoreboard
-===============
-*/
-void Sbar_UpdateScoreboard (void)
-{
- int i, k;
- int top, bottom;
- scoreboard_t *s;
-
- Sbar_SortFrags ();
-
-// draw the text
- memset(scoreboardtext, 0, sizeof scoreboardtext);
-
- for (i=0 ; i<scoreboardlines; i++)
- {
- k = fragsort[i];
- s = &cl.scores[k];
- snprint (scoreboardtext[i]+1, sizeof(scoreboardtext[i])-1, "%3d %s", s->frags, s->name);
-
- top = s->colors & 0xf0;
- bottom = (s->colors & 15) <<4;
- scoreboardtop[i] = Sbar_ColorForMap (top);
- scoreboardbottom[i] = Sbar_ColorForMap (bottom);
- }
-}
-
-
-
-/*
-===============
Sbar_SoloScoreboard
===============
*/
@@ -468,51 +432,6 @@
Sbar_SoloScoreboard ();
if (cl.gametype == GAME_DEATHMATCH)
Sbar_DeathmatchOverlay ();
-/*
- int i, j, c;
- int x, y;
- int l;
- int top, bottom;
- scoreboard_t *s;
-
- if (cl.gametype != GAME_DEATHMATCH)
- {
- Sbar_SoloScoreboard ();
- return;
- }
-
- Sbar_UpdateScoreboard ();
-
- l = scoreboardlines <= 6 ? scoreboardlines : 6;
-
- for (i=0 ; i<l ; i++)
- {
- x = 20*(i&1);
- y = i/2 * 8;
-
- s = &cl.scores[fragsort[i]];
- if (!s->name[0])
- continue;
-
- // draw background
- top = s->colors & 0xf0;
- bottom = (s->colors & 15)<<4;
- top = Sbar_ColorForMap (top);
- bottom = Sbar_ColorForMap (bottom);
-
- Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
- Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
-
- // draw text
- for (j=0 ; j<20 ; j++)
- {
- c = scoreboardtext[i][j];
- if (c == 0 || c == ' ')
- continue;
- Sbar_DrawCharacter ( (x+j)*8, y, c);
- }
- }
-*/
}
//=============================================================================
@@ -910,8 +829,6 @@
if (sb_updates >= vid.numpages)
return;
- scr_copyeverything = 1;
-
sb_updates++;
if (sb_lines && vid.width > 320)
@@ -1071,7 +988,6 @@
char num[12];
scoreboard_t *s;
- scr_copyeverything = 1;
scr_fullupdate = 0;
pic = Draw_CachePic ("gfx/ranking.lmp");
@@ -1155,7 +1071,6 @@
if (vid.width < 512 || !sb_lines)
return;
- scr_copyeverything = 1;
scr_fullupdate = 0;
// scores
@@ -1249,7 +1164,6 @@
int dig;
int num;
- scr_copyeverything = 1;
scr_fullupdate = 0;
if (cl.gametype == GAME_DEATHMATCH)
@@ -1292,8 +1206,6 @@
void Sbar_FinaleOverlay (void)
{
qpic_t *pic;
-
- scr_copyeverything = 1;
pic = Draw_CachePic ("gfx/finale.lmp");
Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);
--- a/screen.c
+++ b/screen.c
@@ -1,44 +1,37 @@
#include "quakedef.h"
-// only the refresh window will be updated unless these variables are flagged
-int scr_copytop;
-int scr_copyeverything;
+float scr_con_current;
+static float scr_conlines; // lines of console to display
-float scr_con_current;
-float scr_conlines; // lines of console to display
+static float oldscreensize, oldfov;
+cvar_t scr_viewsize = {"viewsize","100", true};
-float oldscreensize, oldfov;
-cvar_t scr_viewsize = {"viewsize","100", true};
-cvar_t scr_fov = {"fov","90",true}; // 10 - 170
-cvar_t scr_conspeed = {"scr_conspeed","300",true};
-cvar_t scr_centertime = {"scr_centertime","2"};
-cvar_t scr_showram = {"showram","1"};
-cvar_t scr_showturtle = {"showturtle","0"};
-cvar_t scr_showpause = {"showpause","1"};
-cvar_t scr_printspeed = {"scr_printspeed","8"};
-cvar_t scr_showfps = {"showfps","0", true};
+static cvar_t scr_fov = {"fov","90",true}; // 10 - 170
+static cvar_t scr_conspeed = {"scr_conspeed","300",true};
+static cvar_t scr_centertime = {"scr_centertime","2"};
+static cvar_t scr_showram = {"showram","1"};
+static cvar_t scr_showturtle = {"showturtle","0"};
+static cvar_t scr_showpause = {"showpause","1"};
+static cvar_t scr_printspeed = {"scr_printspeed","8"};
+static cvar_t scr_showfps = {"showfps","0", true};
-bool scr_initialized; // ready to draw
+static bool scr_initialized; // ready to draw
-qpic_t *scr_net;
-qpic_t *scr_turtle;
+static qpic_t *scr_net, *scr_turtle;
-int scr_fullupdate;
+int scr_fullupdate;
-int clearconsole;
-int clearnotify;
+static int clearconsole;
+int clearnotify;
-viddef_t vid; // global video state
+viddef_t vid; // global video state
-vrect_t scr_vrect;
+vrect_t scr_vrect;
-bool scr_disabled_for_loading;
-bool scr_drawloading;
-float scr_disabled_time;
-bool scr_skipupdate;
+bool scr_disabled_for_loading;
+static bool scr_drawloading;
+static float scr_disabled_time;
-bool block_drawing;
-
/*
===============================================================================
@@ -47,12 +40,12 @@
===============================================================================
*/
-char scr_centerstring[1024];
-float scr_centertime_start; // for slow victory printing
-float scr_centertime_off;
-int scr_center_lines;
-int scr_erase_lines;
-int scr_erase_center;
+float scr_centertime_off;
+static char scr_centerstring[1024];
+static float scr_centertime_start; // for slow victory printing
+static int scr_center_lines;
+static int scr_erase_lines;
+static int scr_erase_center;
/*
==============
@@ -78,7 +71,7 @@
}
}
-void SCR_EraseCenterString (void)
+static void SCR_EraseCenterString (void)
{
int y;
@@ -93,11 +86,10 @@
else
y = 48;
- scr_copytop = 1;
Draw_TileClear (0, y,vid.width, 8*scr_erase_lines);
}
-void SCR_DrawCenterString (void)
+static void SCR_DrawCenterString (void)
{
char *start;
int l;
@@ -144,9 +136,8 @@
} while (1);
}
-void SCR_CheckDrawCenterString (void)
+static void SCR_CheckDrawCenterString (void)
{
- scr_copytop = 1;
if (scr_center_lines > scr_erase_lines)
scr_erase_lines = scr_center_lines;
@@ -167,7 +158,7 @@
CalcFov
====================
*/
-float CalcFov (float fov_x, float width, float height)
+static float CalcFov (float fov_x, float width, float height)
{
float a = 0;
float x;
@@ -259,7 +250,7 @@
Keybinding command
=================
*/
-void SCR_SizeUp_f (void)
+static void SCR_SizeUp_f (void)
{
setcvarv ("viewsize",scr_viewsize.value+10);
vid.recalc_refdef = 1;
@@ -273,7 +264,7 @@
Keybinding command
=================
*/
-void SCR_SizeDown_f (void)
+static void SCR_SizeDown_f (void)
{
setcvarv ("viewsize",scr_viewsize.value-10);
vid.recalc_refdef = 1;
@@ -304,7 +295,7 @@
SCR_DrawTurtle
==============
*/
-void SCR_DrawTurtle (void)
+static void SCR_DrawTurtle (void)
{
static int count;
@@ -324,7 +315,7 @@
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
}
-void SCR_DrawFPS (void)
+static void SCR_DrawFPS (void)
{
static uvlong lastframetime;
static int lastcnt, fps;
@@ -349,7 +340,7 @@
SCR_DrawNet
==============
*/
-void SCR_DrawNet (void)
+static void SCR_DrawNet (void)
{
if (realtime - cl.last_received_message < 0.3)
return;
@@ -364,7 +355,7 @@
DrawPause
==============
*/
-void SCR_DrawPause (void)
+static void SCR_DrawPause (void)
{
qpic_t *pic;
@@ -386,7 +377,7 @@
SCR_DrawLoading
==============
*/
-void SCR_DrawLoading (void)
+static void SCR_DrawLoading (void)
{
qpic_t *pic;
@@ -408,7 +399,7 @@
SCR_SetUpToDrawConsole
==================
*/
-void SCR_SetUpToDrawConsole (void)
+static void SCR_SetUpToDrawConsole (void)
{
Con_CheckResize ();
@@ -444,13 +435,11 @@
if (clearconsole++ < vid.numpages)
{
- scr_copytop = 1;
Draw_TileClear (0,(int)scr_con_current,vid.width, vid.height - (int)scr_con_current);
Sbar_Changed ();
}
else if (clearnotify++ < vid.numpages)
{
- scr_copytop = 1;
Draw_TileClear (0,0,vid.width, con_notifylines);
}
else
@@ -462,11 +451,10 @@
SCR_DrawConsole
==================
*/
-void SCR_DrawConsole (void)
+static void SCR_DrawConsole (void)
{
if (scr_con_current)
{
- scr_copyeverything = 1;
Con_DrawConsole (scr_con_current, true);
clearconsole = 0;
}
@@ -500,7 +488,7 @@
scr_drawloading = true;
scr_fullupdate = 0;
Sbar_Changed ();
- SCR_UpdateScreen ();
+ SCR_UpdateScreen(false);
scr_drawloading = false;
scr_disabled_for_loading = true;
@@ -523,10 +511,9 @@
//=============================================================================
-char *scr_notifystring;
-bool scr_drawdialog;
+static char *scr_notifystring;
-void SCR_DrawNotifyString (void)
+static void SCR_DrawNotifyString (void)
{
char *start;
int l;
@@ -575,9 +562,7 @@
// draw a fresh screen
scr_fullupdate = 0;
- scr_drawdialog = true;
- SCR_UpdateScreen ();
- scr_drawdialog = false;
+ SCR_UpdateScreen (true);
do
{
key_count = -1; // wait for a key down and up
@@ -585,7 +570,7 @@
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
scr_fullupdate = 0;
- SCR_UpdateScreen ();
+ SCR_UpdateScreen (false);
return key_lastpress == 'y';
}
@@ -607,7 +592,7 @@
scr_centertime_off = 0;
for (i=0 ; i<20 && scr_conlines != scr_con_current ; i++)
- SCR_UpdateScreen ();
+ SCR_UpdateScreen(false);
cl.cshifts[0].percent = 0; // no area contents palette on next frame
setpal(host_basepal);
@@ -625,16 +610,10 @@
needs almost the entire 256k of stack space!
==================
*/
-void SCR_UpdateScreen (void)
+void SCR_UpdateScreen (bool drawdialog)
{
static float oldlcd_x;
- if (scr_skipupdate || block_drawing)
- return;
-
- scr_copytop = 0;
- scr_copyeverything = 0;
-
if (scr_disabled_for_loading)
{
if (realtime - scr_disabled_time > 60)
@@ -680,7 +659,6 @@
// do 3D refresh drawing, and then update the screen
if (scr_fullupdate++ < vid.numpages)
{ // clear the entire screen
- scr_copyeverything = 1;
Draw_TileClear (0,0,vid.width,vid.height);
Sbar_Changed ();
}
@@ -690,12 +668,11 @@
V_RenderView ();
- if (scr_drawdialog)
+ if (drawdialog)
{
Sbar_Draw ();
Draw_FadeScreen ();
SCR_DrawNotifyString ();
- scr_copyeverything = true;
}
else if (scr_drawloading)
{
--- a/screen.h
+++ b/screen.h
@@ -1,8 +1,7 @@
void SCR_Init (void);
-void SCR_UpdateScreen (void);
+void SCR_UpdateScreen (bool drawdialog);
-
void SCR_SizeUp (void);
void SCR_SizeDown (void);
void SCR_BringDownConsole (void);
@@ -14,7 +13,6 @@
int SCR_ModalMessage (char *text);
extern float scr_con_current;
-extern float scr_conlines; // lines of console to display
extern int scr_fullupdate; // set to 0 to force full redraw
extern int sb_lines;
@@ -21,12 +19,5 @@
extern int clearnotify; // set to 0 whenever notify text is drawn
extern bool scr_disabled_for_loading;
-extern bool scr_skipupdate;
extern cvar_t scr_viewsize;
-
-// only the refresh window will be updated unless these variables are flagged
-extern int scr_copytop;
-extern int scr_copyeverything;
-
-extern bool block_drawing;
--- a/shell.nix
+++ b/shell.nix
@@ -1,8 +1,9 @@
with import <nixpkgs> {};
-stdenv.mkDerivation {
+stdenvNoCC.mkDerivation {
name = "qk1";
buildInputs = with pkgs; [
SDL2
pkg-config
+ gcc13
];
}
--- a/sv_move.c
+++ b/sv_move.c
@@ -11,8 +11,6 @@
=============
*/
-int c_yes, c_no;
-
bool SV_CheckBottom (edict_t *ent)
{
vec3_t mins, maxs, start, stop;
@@ -36,11 +34,9 @@
goto realcheck;
}
- c_yes++;
return true; // we got out easy
realcheck:
- c_no++;
// check it for real...
start[2] = mins[2];
@@ -70,7 +66,6 @@
return false;
}
- c_yes++;
return true;
}
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -30,32 +30,6 @@
/*
================
-SV_CheckAllEnts
-================
-*/
-void SV_CheckAllEnts (void)
-{
- int e;
- edict_t *check;
-
- // see if any solid entities are inside the final position
- check = NEXT_EDICT(sv.edicts);
- for (e=1 ; e<sv.num_edicts ; e++, check = NEXT_EDICT(check))
- {
- if (check->free)
- continue;
- if (check->v.movetype == MOVETYPE_PUSH
- || check->v.movetype == MOVETYPE_NONE
- || check->v.movetype == MOVETYPE_NOCLIP)
- continue;
-
- if (SV_TestEntityPosition (check))
- Con_Printf ("entity in invalid position\n");
- }
-}
-
-/*
-================
SV_CheckVelocity
================
*/
@@ -1099,8 +1073,6 @@
pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
pr_global_struct->time = sv.time;
PR_ExecuteProgram (pr_global_struct->StartFrame);
-
- //SV_CheckAllEnts ();
// treat each object in turn
ent = sv.edicts;
--- a/sv_user.c
+++ b/sv_user.c
@@ -10,8 +10,8 @@
static vec3_t forward, right, up;
-vec3_t wishdir;
-float wishspeed;
+static vec3_t wishdir;
+static float wishspeed;
// world
float *angles;
--- a/wad.c
+++ b/wad.c
@@ -1,8 +1,8 @@
#include "quakedef.h"
-int wad_numlumps;
-lumpinfo_t *wad_lumps;
-byte *wad_base;
+static int wad_numlumps;
+static lumpinfo_t *wad_lumps;
+static byte *wad_base;
void SwapPic (qpic_t *pic);
@@ -106,18 +106,6 @@
lumpinfo_t *lump;
lump = W_GetLumpinfo (name);
-
- return (void *)(wad_base + lump->filepos);
-}
-
-void *W_GetLumpNum (int num)
-{
- lumpinfo_t *lump;
-
- if (num < 0 || num > wad_numlumps)
- fatal ("W_GetLumpNum: bad number: %d", num);
-
- lump = wad_lumps + num;
return (void *)(wad_base + lump->filepos);
}
--- a/wad.h
+++ b/wad.h
@@ -41,14 +41,9 @@
char name[16]; // must be null terminated
} lumpinfo_t;
-extern int wad_numlumps;
-extern lumpinfo_t *wad_lumps;
-extern byte *wad_base;
-
void W_LoadWadFile (char *filename);
void W_CleanupName (char *in, char *out);
lumpinfo_t *W_GetLumpinfo (char *name);
void *W_GetLumpName (char *name);
-void *W_GetLumpNum (int num);
void SwapPic (qpic_t *pic);
--- a/world.c
+++ b/world.c
@@ -457,11 +457,6 @@
return cont;
}
-int SV_TruePointContents (vec3_t p)
-{
- return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p);
-}
-
//===========================================================================
/*
--- a/world.h
+++ b/world.h
@@ -37,10 +37,6 @@
// if touchtriggers, calls prog functions for the intersected triggers
int SV_PointContents (vec3_t p);
-int SV_TruePointContents (vec3_t p);
-// returns the CONTENTS_* value from the world at the given point.
-// does not check any entities at all
-// the non-true version remaps the water current contents to content_water
edict_t *SV_TestEntityPosition (edict_t *ent);
bool SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,