shithub: qk1

Download patch

ref: 645a201fa018760137aecadb2ab4a7f779a566c8
parent: 8ffc3f30a12d8e4b8aa5a05cb6477c7bc5dfb570
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Jan 11 09:30:03 EST 2024

rearrange struct fields

--- a/client.h
+++ b/client.h
@@ -59,8 +59,8 @@
 #define	MAX_BEAMS	128
 typedef struct
 {
-	int		entity;
 	struct model_s	*model;
+	int		entity;
 	float	endtime;
 	vec3_t	start, end;
 } beam_t;
--- a/cvar.h
+++ b/cvar.h
@@ -38,11 +38,11 @@
 {
 	char *name;
 	char *string;
-	bool archive;		// set to true to cause it to be saved to vars.rc
-	bool server;		// notifies players when changed
+	bool archive; // set to true to cause it to be saved to vars.rc
 	float value;
-	void (*cb) (cvar_t *);
 	struct cvar_s *next;
+	void (*cb) (cvar_t *);
+	bool server;		// notifies players when changed
 };
 
 void 	Cvar_RegisterVariable (cvar_t *variable);
--- a/d_iface.h
+++ b/d_iface.h
@@ -45,10 +45,10 @@
 {
 	pixel_t				*pskin;
 	maliasskindesc_t	*pskindesc;
-	int					skinwidth;
-	int					skinheight;
 	mtriangle_t			*ptriangles;
 	finalvert_t			*pfinalverts;
+	int					skinwidth;
+	int					skinheight;
 	int					numtriangles;
 	int					drawtype;
 	int					seamfixupX16;
@@ -56,11 +56,11 @@
 
 typedef struct
 {
-	int			nump;
 	emitpoint_t	*pverts;	// there's room for an extra element at [nump],
 							//  if the driver wants to duplicate element [0] at
 							//  element [nump] to avoid dealing with wrapping
 	mspriteframe_t	*pspriteframe;
+	int			nump;
 	vec3_t			vup, vright, vpn;	// in worldspace
 	float			nearzi;
 } spritedesc_t;
--- a/d_local.h
+++ b/d_local.h
@@ -8,8 +8,8 @@
 
 typedef struct {
 	struct {
-		float stepu;
 		float stepv;
+		float stepu;
 		float origin;
 	}divz;
 	fixed16_t adjust;
@@ -17,14 +17,14 @@
 }tavars_t;
 
 typedef struct {
-	pixel_t *p;
-	unsigned w;
-	tavars_t s, t;
 	struct {
-		float stepu;
-		float stepv;
 		float origin;
+		float stepv;
+		float stepu;
 	}z;
+	unsigned w;
+	pixel_t *p;
+	tavars_t s, t;
 }texvars_t;
 
 typedef struct {
@@ -45,6 +45,7 @@
 {
 	struct surfcache_s	*next;
 	struct surfcache_s 	**owner;		// NULL is an empty chunk of memory
+	struct texture_s	*texture;	// checked for animating textures
 	int					lightadj[MAXLIGHTMAPS]; // checked for strobe flush
 	int					dlight;
 	int					size;		// including header
@@ -51,7 +52,6 @@
 	int					width;
 	int					height;		// DEBUG only needed for debug
 	float				mipscale;
-	struct texture_s	*texture;	// checked for animating textures
 	pixel_t				pixels[];	// width*height elements
 } surfcache_t;
 
--- a/mathlib.h
+++ b/mathlib.h
@@ -37,8 +37,7 @@
 void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
 void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
 
-void FloorDivMod (double numer, double denom, int *quotient,
-		int *rem);
+void FloorDivMod (double numer, double denom, int *quotient, int *rem);
 int GreatestCommonDivisor (int i1, int i2);
 
 void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
@@ -47,11 +46,11 @@
 
 typedef struct clipplane_s
 {
-	vec3_t		normal;
 	float		dist;
-	struct		clipplane_s	*next;
+	vec3_t		normal;
 	byte		leftedge;
 	byte		rightedge;
+	struct		clipplane_s	*next;
 } clipplane_t;
 
 typedef struct {
--- a/model.h
+++ b/model.h
@@ -42,7 +42,6 @@
 	float	dist;
 	byte	type;			// for texture axis selection and fast side tests
 	byte	signbits;		// signx + signy<<1 + signz<<1
-	byte	pad[2];
 } mplane_t;
 
 enum {
@@ -52,12 +51,12 @@
 typedef struct texture_s
 {
 	char name[16];
+	struct texture_s *anim_next;		// in the animation sequence
+	struct texture_s *alternate_anims;	// bmodels in frmae 1 use these
 	int drawsurf;
 	int width, height;
 	int anim_total;				// total tenths in sequence ( 0 = no)
 	int anim_min, anim_max;		// time for this frame min <=time< max
-	struct texture_s *anim_next;		// in the animation sequence
-	struct texture_s *alternate_anims;	// bmodels in frmae 1 use these
 	int offsets[MIPLEVELS];		// four mip maps stored
 	pixel_t pixels[];
 } texture_t;
@@ -88,9 +87,9 @@
 
 typedef struct
 {
+	texture_t	*texture;
 	float		vecs[2][4];
 	float		mipadjust;
-	texture_t	*texture;
 	int			flags;
 } mtexinfo_t;
 
@@ -187,7 +186,6 @@
 {
 	int		width;
 	int		height;
-	void	*pcachespot;			// remove?
 	float	up, down, left, right;
 	pixel_t	pixels[];
 } mspriteframe_t;
@@ -201,11 +199,11 @@
 
 typedef struct
 {
-	spriteframetype_t	type;
 	union {
 		mspriteframe_t *frameptr;
 		mspritegroup_t *framegrp;
 	};
+	spriteframetype_t	type;
 } mspriteframedesc_t;
 
 typedef struct
@@ -216,7 +214,6 @@
 	int					maxheight;
 	int					numframes;
 	float				beamlength;		// remove?
-	void				*cachespot;		// remove?
 	mspriteframedesc_t	frames[];
 } msprite_t;
 
@@ -242,7 +239,6 @@
 typedef struct
 {
 	aliasskintype_t		type;
-	void				*pcachespot;
 	int					skin;
 } maliasskindesc_t;
 
@@ -315,9 +311,9 @@
 
 typedef struct model_s
 {
-	char		name[Npath];
-	int	needload;		// bmodels and sprites don't cache normally
-	bool	blend;
+	char name[Npath];
+	int needload;		// bmodels and sprites don't cache normally
+	bool blend;
 
 	int ver;
 	int numwads;
@@ -339,49 +335,36 @@
 //
 // brush model
 //
-	int			firstmodelsurface, nummodelsurfaces;
-
-	int			numsubmodels;
 	submodel_t	*submodels;
-
-	int			numplanes;
 	mplane_t	*planes;
-
-	int			numleafs;		// number of visible leafs, not counting 0
 	mleaf_t		*leafs;
-
-	int			numvertexes;
 	mvertex_t	*vertexes;
-
-	int			numedges;
 	medge_t		*edges;
-
-	int			numnodes;
 	mnode_t		*nodes;
-
-	int			numtexinfo;
 	mtexinfo_t	*texinfo;
-
-	int			numsurfaces;
 	msurface_t	*surfaces;
-
-	int			numsurfedges;
 	int			*surfedges;
-
-	int			numclipnodes;
 	mclipnode_t	*clipnodes;
-
-	int			nummarksurfaces;
 	msurface_t	**marksurfaces;
-
-	hull_t		hulls[MAX_MAP_HULLS];
-
-	int			numtextures;
 	texture_t	**textures;
-
 	byte		*visdata;
 	byte		*lightdata;
 	char		*entities;
+
+	int			firstmodelsurface, nummodelsurfaces;
+	int			numsubmodels;
+	int			numplanes;
+	int			numleafs;		// number of visible leafs, not counting 0
+	int			numvertexes;
+	int			numedges;
+	int			numnodes;
+	int			numtexinfo;
+	int			numsurfaces;
+	int			numsurfedges;
+	int			numclipnodes;
+	int			nummarksurfaces;
+	hull_t		hulls[MAX_MAP_HULLS];
+	int			numtextures;
 
 //
 // additional model data
--- a/r_local.h
+++ b/r_local.h
@@ -22,9 +22,9 @@
 // viewmodel lighting
 
 typedef struct {
+	float		*plightvec;
 	int			ambientlight[3];
 	int			shadelight[3];
-	float		*plightvec;
 } alight_t;
 
 //===========================================================================
--- a/r_main.c
+++ b/r_main.c
@@ -2,7 +2,7 @@
 
 void		*colormap;
 static vec3_t viewlightvec;
-static alight_t r_viewlighting = {{128,128,128}, {192,192,192}, viewlightvec};
+static alight_t r_viewlighting = {viewlightvec, {128,128,128}, {192,192,192}};
 int			r_numallocatededges;
 int			r_numallocatedbasespans;
 void		*r_basespans;
--- a/r_shared.h
+++ b/r_shared.h
@@ -54,26 +54,28 @@
 // !!! if this is changed, it must be changed in asm_draw.h too !!!
 typedef struct espan_s
 {
-	int				u, v, count;
-	struct espan_s	*pnext;
+	struct espan_s *pnext;
+	u16int v, u, count;
 } espan_t;
 
 typedef struct surf_s
 {
 	int			key;				// sorting key (BSP order)
-	int			flags;
 	s16int		last_u;				// set during tracing
 	s16int		spanstate;			// 0 = not in span
 									// 1 = in span
 									// -1 = in inverted span (end before
 									//  start)
-	float		nearzi;				// nearest 1/z on surface, for mipmapping
-	float		d_ziorigin, d_zistepu, d_zistepv;
 	struct surf_s	*next;			// active surface stack in r_edge.c
 	struct surf_s	*prev;			// used in r_edge.c for active surf stack
 	struct espan_s	*spans;			// pointer to linked list of spans to draw
 	void		*data;				// associated data like msurface_t
 	entity_t	*entity;
+	int			flags;
+	float		nearzi;				// nearest 1/z on surface, for mipmapping
+	float		d_ziorigin;
+	float		d_zistepu;
+	float		d_zistepv;
 } surf_t;
 
 extern int r_numallocatedbasespans;
@@ -116,11 +118,11 @@
 // !!! if this is changed, it must be changed in asm_draw.h too !!!
 typedef struct edge_s
 {
+	u16int	surfs[2];
 	fixed16_t		u;
 	fixed16_t		u_step;
+	float			nearzi;
 	struct edge_s	*prev, *next;
-	unsigned int	surfs[2];
 	struct edge_s	*nextremove;
-	float			nearzi;
 	medge_t			*owner;
 } edge_t;
--- a/render.h
+++ b/render.h
@@ -17,22 +17,20 @@
 
 typedef struct entity_s
 {
-	bool				forcelink;		// model changed
-
-	int						update_type;
-
+	struct model_s			*model;			// NULL = no model
+	struct efrag_s			*efrag;			// linked list of efrags
+	pixel_t					*colormap;
+	struct entity_s			*last_reject;
 	entity_state_t			baseline;		// to fill in defaults in updates
 
 	double					msgtime;		// time of last update
+
 	vec3_t					msg_origins[2];	// last two updates (0 is newest)
 	vec3_t					origin;
 	vec3_t					msg_angles[2];	// last two updates (0 is newest)
 	vec3_t					angles;
-	struct model_s			*model;			// NULL = no model
-	struct efrag_s			*efrag;			// linked list of efrags
 	int						frame;
 	float					syncbase;		// for client-side animations
-	pixel_t					*colormap;
 	int						effects;		// light, particals, etc
 	int						skinnum;		// for Alias models
 	int						visframe;		// last frame this entity was
@@ -41,15 +39,15 @@
 	int						dlightframe;	// dynamic lighting
 	int						dlightbits;
 
+	bool forcelink;		// model changed
+	int update_type;
+	byte alpha;
+
 // FIXME: could turn these into a union
 	int						trivial_accept;
 	struct mnode_s			*topnode;		// for bmodels, first world node
 											//  that splits bmodel, or NULL if
 											//  not split
-
-	struct entity_s			*last_reject;
-
-	byte alpha;
 } entity_t;
 
 // !!! if this is changed, it must be changed in asm_draw.h too !!!