shithub: qk1

Download patch

ref: 07150873bdc2c1c8570bb1f34821eab8ccb744cf
parent: 6dd66847bebc0aff09e8d74d60d096e925c6a9c9
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Nov 10 00:36:01 EST 2023

more stuff turned static

--- a/chase.c
+++ b/chase.c
@@ -1,16 +1,12 @@
 #include "quakedef.h"
 
-cvar_t	chase_back = {"chase_back", "100"};
-cvar_t	chase_up = {"chase_up", "16"};
-cvar_t	chase_right = {"chase_right", "0"};
-cvar_t	chase_active = {"chase_active", "0"};
+cvar_t chase_active = {"chase_active", "0"};
 
-vec3_t	chase_pos;
-vec3_t	chase_angles;
+static cvar_t chase_back = {"chase_back", "100"};
+static cvar_t chase_up = {"chase_up", "16"};
+static cvar_t chase_right = {"chase_right", "0"};
 
-vec3_t	chase_dest;
-vec3_t	chase_dest_angles;
-
+static vec3_t chase_dest;
 
 void Chase_Init (void)
 {
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -4,13 +4,13 @@
 static entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
 beam_t		cl_beams[MAX_BEAMS];
 
-Sfx			*cl_sfx_wizhit;
-Sfx			*cl_sfx_knighthit;
-Sfx			*cl_Sfxink1;
-Sfx			*cl_sfx_ric1;
-Sfx			*cl_sfx_ric2;
-Sfx			*cl_sfx_ric3;
-Sfx			*cl_sfx_r_exp3;
+static Sfx *cl_Sfxink1;
+static Sfx *cl_sfx_wizhit;
+static Sfx *cl_sfx_knighthit;
+static Sfx *cl_sfx_ric1;
+static Sfx *cl_sfx_ric2;
+static Sfx *cl_sfx_ric3;
+static Sfx *cl_sfx_r_exp3;
 
 /*
 =================
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -51,12 +51,12 @@
 };
 
 // FIXME: some of these can become statics
-int				a_sstepxfrac, a_tstepxfrac, r_lstepx, a_ststepxwhole;
+static int				a_sstepxfrac, a_tstepxfrac, r_lstepx, a_ststepxwhole;
 int				r_sstepx, r_tstepx, r_lstepy, r_sstepy, r_tstepy;
 int				r_zistepx, r_zistepy;
 int				d_aspancount, d_countextrastep;
 
-spanpackage_t			*a_spans;
+static spanpackage_t *a_spans;
 spanpackage_t			*d_pedgespanpackage;
 static int				ystart;
 byte					*d_pdest, *d_ptex;
--- a/r_draw.c
+++ b/r_draw.c
@@ -6,7 +6,7 @@
 #define FULLY_CLIPPED_CACHED	0x80000000
 #define FRAMECOUNT_MASK			0x7FFFFFFF
 
-unsigned int	cacheoffset;
+static unsigned int cacheoffset;
 
 int			c_faceclip;					// number of faces clipped
 
@@ -20,17 +20,17 @@
 clipplane_t	view_clipplanes[4];
 clipplane_t	world_clipplanes[16];
 
-medge_t			*r_pedge;
+static medge_t			*r_pedge;
 
-qboolean		r_leftclipped, r_rightclipped;
-static qboolean	makeleftedge, makerightedge;
-qboolean		r_nearzionly;
+static qboolean r_leftclipped, r_rightclipped;
+static qboolean makeleftedge, makerightedge;
+static qboolean r_nearzionly;
 
 int		sintable[SIN_BUFFER_SIZE];
 int		intsintable[SIN_BUFFER_SIZE];
 
-mvertex_t	r_leftenter, r_leftexit;
-mvertex_t	r_rightenter, r_rightexit;
+static mvertex_t	r_leftenter, r_leftexit;
+static mvertex_t	r_rightenter, r_rightexit;
 
 typedef struct
 {
@@ -38,10 +38,10 @@
 	int		ceilv;
 } evert_t;
 
-int				r_emitted;
-float			r_nearzi;
-float			r_u1, r_v1, r_lzi1;
-int				r_ceilv1;
+static int r_emitted;
+static float r_nearzi;
+static float r_u1, r_v1, r_lzi1;
+static int r_ceilv1;
 
 qboolean	r_lastvertvalid;
 
--- a/r_local.h
+++ b/r_local.h
@@ -231,7 +231,6 @@
 extern int		r_frustum_indexes[4*6];
 extern int		r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
 extern qboolean	r_surfsonstack;
-extern cshift_t	cshift_water;
 extern qboolean	r_dowarpold, r_viewchanged;
 
 extern mleaf_t	*r_viewleaf, *r_oldviewleaf;
--- a/r_main.c
+++ b/r_main.c
@@ -3,9 +3,8 @@
 //define	PASSAGES
 
 void		*colormap;
-vec3_t		viewlightvec;
+static vec3_t viewlightvec;
 alight_t	r_viewlighting = {128, 192, viewlightvec};
-float		r_time1;
 int			r_numallocatededges;
 int			r_numallocatedbasespans;
 byte		*r_basespans;
@@ -26,8 +25,6 @@
 
 byte		*r_warpbuffer;
 
-byte		*r_stack_start;
-
 //
 // view origin
 //
@@ -65,10 +62,6 @@
 int		r_drawnpolycount;
 int		r_wholepolycount;
 
-#define		VIEWMODNAME_LENGTH	256
-char		viewmodname[VIEWMODNAME_LENGTH+1];
-int			modcount;
-
 int			*pfrustum_indexes[4];
 int			r_frustum_indexes[4*6];
 
@@ -83,9 +76,6 @@
 
 int		d_lightstylevalue[256];	// 8.8 fraction of base light value
 
-float	dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;
-float	se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
-
 void R_MarkLeaves (void);
 
 cvar_t	r_clearcolor = {"r_clearcolor","2"};
@@ -158,11 +148,6 @@
 */
 void R_Init (void)
 {
-	int		dummy;
-
-	// get stack position so we can guess if we are going to overflow
-	r_stack_start = (byte *)&dummy;
-
 	R_InitTurb ();
 
 	Cmd_AddCommand("pointfile", loadpoints);
--- a/r_part.c
+++ b/r_part.c
@@ -29,12 +29,8 @@
 R_EntityParticles
 ===============
 */
-
-vec3_t	avelocities[NUMVERTEXNORMALS];
-float	beamlength = 16;
-vec3_t	avelocity = {23, 7, 3};
-float	partstep = 0.01;
-float	timescale = 0.01;
+static vec3_t avelocities[NUMVERTEXNORMALS];
+static const float beamlength = 16;
 
 void R_EntityParticles (entity_t *ent)
 {
--- a/r_surf.c
+++ b/r_surf.c
@@ -2,10 +2,7 @@
 
 drawsurf_t	r_drawsurf;
 
-int				sourcesstep, blocksize, sourcetstep;
-int				lightdelta, lightdeltastep;
-int				lightleftstep, lightrightstep, blockdivshift;
-unsigned		blockdivmask;
+static int sourcetstep, lightleftstep, lightrightstep;
 void			*prowdestbase;
 unsigned char	*pbasesource;
 int				surfrowbytes;	// used by ASM files
@@ -15,12 +12,12 @@
 int				r_numhblocks, r_numvblocks;
 unsigned char	*r_source, *r_sourcemax;
 
-void R_DrawSurfaceBlock8_mip0 (void);
-void R_DrawSurfaceBlock8_mip1 (void);
-void R_DrawSurfaceBlock8_mip2 (void);
-void R_DrawSurfaceBlock8_mip3 (void);
+static void R_DrawSurfaceBlock8_mip0 (void);
+static void R_DrawSurfaceBlock8_mip1 (void);
+static void R_DrawSurfaceBlock8_mip2 (void);
+static void R_DrawSurfaceBlock8_mip3 (void);
 
-static void	(*surfmiptable[4])(void) = {
+static void (*surfmiptable[4])(void) = {
 	R_DrawSurfaceBlock8_mip0,
 	R_DrawSurfaceBlock8_mip1,
 	R_DrawSurfaceBlock8_mip2,
@@ -27,7 +24,7 @@
 	R_DrawSurfaceBlock8_mip3
 };
 
-unsigned		blocklights[18*18];
+static unsigned blocklights[18*18];
 
 /*
 ===============
@@ -209,7 +206,7 @@
 {
 	unsigned char	*basetptr;
 	int				smax, tmax, twidth;
-	int				u;
+	int				u, blockdivshift, blocksize;
 	int				soffset, basetoffset, texwidth;
 	int				horzblockstep;
 	unsigned char	*pcolumndest;
@@ -232,7 +229,6 @@
 
 	blocksize = 16 >> r_drawsurf.surfmip;
 	blockdivshift = 4 - r_drawsurf.surfmip;
-	blockdivmask = (1 << blockdivshift) - 1;
 
 	r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1;
 
@@ -287,7 +283,7 @@
 R_DrawSurfaceBlock8_mip0
 ================
 */
-void R_DrawSurfaceBlock8_mip0 (void)
+static void R_DrawSurfaceBlock8_mip0 (void)
 {
 	int				v, i, lightstep, lighttemp, light, lightleft, lightright;
 	unsigned char	*psource, *prowdest;
@@ -345,7 +341,7 @@
 R_DrawSurfaceBlock8_mip1
 ================
 */
-void R_DrawSurfaceBlock8_mip1 (void)
+static void R_DrawSurfaceBlock8_mip1 (void)
 {
 	int				v, i, b, lightstep, lighttemp, light, lightleft, lightright;
 	unsigned char	pix, *psource, *prowdest;
@@ -394,7 +390,7 @@
 R_DrawSurfaceBlock8_mip2
 ================
 */
-void R_DrawSurfaceBlock8_mip2 (void)
+static void R_DrawSurfaceBlock8_mip2 (void)
 {
 	int				v, i, b, lightstep, lighttemp, light, lightleft, lightright;
 	unsigned char	pix, *psource, *prowdest;
@@ -443,7 +439,7 @@
 R_DrawSurfaceBlock8_mip3
 ================
 */
-void R_DrawSurfaceBlock8_mip3 (void)
+static void R_DrawSurfaceBlock8_mip3 (void)
 {
 	int				v, i, b, lightstep, lighttemp, light, lightleft, lightright;
 	unsigned char	pix, *psource, *prowdest;
--- a/view.c
+++ b/view.c
@@ -9,41 +9,42 @@
 
 */
 
-cvar_t		lcd_x = {"lcd_x","0"};
-cvar_t		lcd_yaw = {"lcd_yaw","0"};
+cvar_t lcd_x = {"lcd_x","0"};
 
-cvar_t	scr_ofsx = {"scr_ofsx","0", false};
-cvar_t	scr_ofsy = {"scr_ofsy","0", false};
-cvar_t	scr_ofsz = {"scr_ofsz","0", false};
+static cvar_t lcd_yaw = {"lcd_yaw","0"};
 
-cvar_t	cl_rollspeed = {"cl_rollspeed", "200"};
-cvar_t	cl_rollangle = {"cl_rollangle", "2.0"};
+static cvar_t scr_ofsx = {"scr_ofsx","0", false};
+static cvar_t scr_ofsy = {"scr_ofsy","0", false};
+static cvar_t scr_ofsz = {"scr_ofsz","0", false};
 
-cvar_t	cl_bob = {"cl_bob","0.02", false};
-cvar_t	cl_bobcycle = {"cl_bobcycle","0.6", false};
-cvar_t	cl_bobup = {"cl_bobup","0.5", false};
+static cvar_t cl_rollspeed = {"cl_rollspeed", "200"};
+static cvar_t cl_rollangle = {"cl_rollangle", "2.0"};
 
-cvar_t	v_kicktime = {"v_kicktime", "0.5", false};
-cvar_t	v_kickroll = {"v_kickroll", "0.6", false};
-cvar_t	v_kickpitch = {"v_kickpitch", "0.6", false};
+static cvar_t cl_bob = {"cl_bob","0.02", false};
+static cvar_t cl_bobcycle = {"cl_bobcycle","0.6", false};
+static cvar_t cl_bobup = {"cl_bobup","0.5", false};
 
-cvar_t	v_iyaw_cycle = {"v_iyaw_cycle", "2", false};
-cvar_t	v_iroll_cycle = {"v_iroll_cycle", "0.5", false};
-cvar_t	v_ipitch_cycle = {"v_ipitch_cycle", "1", false};
-cvar_t	v_iyaw_level = {"v_iyaw_level", "0.3", false};
-cvar_t	v_iroll_level = {"v_iroll_level", "0.1", false};
-cvar_t	v_ipitch_level = {"v_ipitch_level", "0.3", false};
+static cvar_t v_kicktime = {"v_kicktime", "0.5", false};
+static cvar_t v_kickroll = {"v_kickroll", "0.6", false};
+static cvar_t v_kickpitch = {"v_kickpitch", "0.6", false};
 
-cvar_t	v_idlescale = {"v_idlescale", "0", false};
+static cvar_t v_iyaw_cycle = {"v_iyaw_cycle", "2", false};
+static cvar_t v_iroll_cycle = {"v_iroll_cycle", "0.5", false};
+static cvar_t v_ipitch_cycle = {"v_ipitch_cycle", "1", false};
+static cvar_t v_iyaw_level = {"v_iyaw_level", "0.3", false};
+static cvar_t v_iroll_level = {"v_iroll_level", "0.1", false};
+static cvar_t v_ipitch_level = {"v_ipitch_level", "0.3", false};
 
-cvar_t	crosshair = {"crosshair", "0", true};
-cvar_t	cl_crossx = {"cl_crossx", "0", false};
-cvar_t	cl_crossy = {"cl_crossy", "0", false};
+static cvar_t v_idlescale = {"v_idlescale", "0", false};
 
-cvar_t	gl_cshiftpercent = {"gl_cshiftpercent", "100", false};
+static cvar_t crosshair = {"crosshair", "0", true};
+static cvar_t cl_crossx = {"cl_crossx", "0", false};
+static cvar_t cl_crossy = {"cl_crossy", "0", false};
 
-float	v_dmg_time, v_dmg_roll, v_dmg_pitch;
+static cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false};
 
+static float v_dmg_time, v_dmg_roll, v_dmg_pitch;
+
 extern	int			in_forward, in_forward2, in_back;
 
 
@@ -117,8 +118,8 @@
 //=============================================================================
 
 
-cvar_t	v_centermove = {"v_centermove", "0.15", false};
-cvar_t	v_centerspeed = {"v_centerspeed","500"};
+static cvar_t v_centermove = {"v_centermove", "0.15", false};
+static cvar_t v_centerspeed = {"v_centerspeed","500"};
 
 
 void V_StartPitchDrift (void)
@@ -227,14 +228,14 @@
 */
 
 
-cshift_t	cshift_empty = { {130,80,50}, 0 };
-cshift_t	cshift_water = { {130,80,50}, 128 };
-cshift_t	cshift_slime = { {0,25,5}, 150 };
-cshift_t	cshift_lava = { {255,80,0}, 150 };
+static cshift_t cshift_empty = { {130,80,50}, 0 };
+static cshift_t cshift_water = { {130,80,50}, 128 };
+static cshift_t cshift_slime = { {0,25,5}, 150 };
+static cshift_t cshift_lava = { {255,80,0}, 150 };
 
-cvar_t		v_gamma = {"gamma", "1", true};
+cvar_t v_gamma = {"gamma", "1", true};
 
-byte		gammatable[256];	// palette is sent through this
+static byte gammatable[256];	// palette is sent through this
 
 void BuildGammaTable (float g)
 {
--- a/view.h
+++ b/view.h
@@ -1,6 +1,5 @@
 extern	cvar_t		v_gamma;
 
-extern	byte		gammatable[256];	// palette is sent through this
 extern	byte		ramps[3][256];
 extern float v_blend[4];