shithub: qk1

Download patch

ref: 339418856effb2621be9b90e1ee970e78a416244
parent: 802e7e75604dab17e98c4d7da3252d8e35d81e7c
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sat Oct 14 16:18:17 EDT 2023

I don't like defines

--- a/quakedef.h
+++ b/quakedef.h
@@ -10,128 +10,111 @@
 #define UNALIGNED_OK	// unset if unaligned accesses are not supported
 #endif
 
-// !!! if this is changed, it must be changed in d_ifacea.h too !!!
-#define CACHE_SIZE	32		// used to align key data structures
+enum {
+	// !!! if this is changed, it must be changed in d_ifacea.h too !!!
+	CACHE_SIZE = 32, // used to align key data structures
 
-#define MAX_NUM_ARGVS	50
+	MAX_DATAGRAM = 1400,		// max length of unreliable message
+	MAX_DATAGRAM_LOCAL = 65000,	// on loopback we don't care
 
-// up / down
-#define	PITCH	0
+	PITCH = 0, // up / down
+	YAW, // left / right
+	ROLL, // fall over
 
-// left / right
-#define	YAW		1
+	// limits
+	MAX_EDICTS = 65536,
+	MAX_MODELS = 4096,
+	MAX_SOUNDS = 2048,
+	MAX_STYLESTRING	= 64,
+	MAX_SCOREBOARD = 16,
+	MAX_SCOREBOARDNAME = 32,
+	Nlights = 64,
 
-// fall over
-#define	ROLL	2
+	// stats are integers communicated to the client by the server
+	MAX_CL_STATS = 256,
 
-#define	ON_EPSILON		0.1			// point on plane side epsilon
+	STAT_HEALTH = 0,
+	STAT_FRAGS,
+	STAT_WEAPON,
+	STAT_AMMO,
+	STAT_ARMOR,
+	STAT_WEAPONFRAME,
+	STAT_SHELLS,
+	STAT_NAILS,
+	STAT_ROCKETS,
+	STAT_CELLS,
+	STAT_ACTIVEWEAPON,
+	STAT_TOTALSECRETS,
+	STAT_TOTALMONSTERS,
+	STAT_SECRETS, // bumped on client side by svc_foundsecret
+	STAT_MONSTERS, // bumped by svc_killedmonster
 
-#define	MAX_DATAGRAM	1400		// max length of unreliable message
-#define	MAX_DATAGRAM_LOCAL	65000	// on loopback we don't care
+	// stock
+	IT_SHOTGUN = 1<<0,
+	IT_SUPER_SHOTGUN = 1<<1,
+	IT_NAILGUN = 1<<2,
+	IT_SUPER_NAILGUN = 1<<3,
+	IT_GRENADE_LAUNCHER = 1<<4,
+	IT_ROCKET_LAUNCHER = 1<<5,
+	IT_LIGHTNING = 1<<6,
+	IT_SUPER_LIGHTNING = 1<<7,
+	IT_SHELLS = 1<<8,
+	IT_NAILS = 1<<9,
+	IT_ROCKETS = 1<<10,
+	IT_CELLS = 1<<11,
+	IT_AXE = 1<<12,
+	IT_ARMOR1 = 1<<13,
+	IT_ARMOR2 = 1<<14,
+	IT_ARMOR3 = 1<<15,
+	IT_SUPERHEALTH = 1<<16,
+	IT_KEY1 = 1<<17,
+	IT_KEY2 = 1<<18,
+	IT_INVISIBILITY = 1<<19,
+	IT_INVULNERABILITY = 1<<20,
+	IT_SUIT = 1<<21,
+	IT_QUAD = 1<<22,
+	IT_SIGIL1 = 1<<28,
+	IT_SIGIL2 = 1<<29,
+	IT_SIGIL3 = 1<<30,
+	IT_SIGIL4 = 1<<31,
 
-//
-// per-level limits
-//
-#define	MAX_EDICTS		65536
-#define	Nlights	64
-#define	MAX_MODELS		4096			// these are sent over the net as bytes with NQ
-#define	MAX_SOUNDS		2048
+	// rogue changed and added defines
+	RIT_SHELLS = 1<<7,
+	RIT_NAILS = 1<<8,
+	RIT_ROCKETS = 1<<9,
+	RIT_CELLS = 1<<10,
+	RIT_AXE = 1<<11,
+	RIT_LAVA_NAILGUN = 1<<12,
+	RIT_LAVA_SUPER_NAILGUN = 1<<13,
+	RIT_MULTI_GRENADE = 1<<14,
+	RIT_MULTI_ROCKET = 1<<15,
+	RIT_PLASMA_GUN = 1<<16,
+	RIT_ARMOR1 = 1<<23,
+	RIT_ARMOR2 = 1<<24,
+	RIT_ARMOR3 = 1<<25,
+	RIT_LAVA_NAILS = 1<<26,
+	RIT_PLASMA_AMMO = 1<<27,
+	RIT_MULTI_ROCKETS = 1<<28,
+	RIT_SHIELD = 1<<29,
+	RIT_ANTIGRAV = 1<<30,
+	RIT_SUPERHEALTH = 1<<31,
 
-#define	MAX_STYLESTRING	64
+	// hipnotic added defines,
+	HIT_PROXIMITY_GUN_BIT = 16,
+	HIT_MJOLNIR_BIT = 7,
+	HIT_LASER_CANNON_BIT = 23,
+	HIT_PROXIMITY_GUN = 1<<HIT_PROXIMITY_GUN_BIT,
+	HIT_MJOLNIR = 1<<HIT_MJOLNIR_BIT,
+	HIT_LASER_CANNON = 1<<HIT_LASER_CANNON_BIT,
+	HIT_WETSUIT = 1<<(23+2),
+	HIT_EMPATHY_SHIELDS = 1<<(23+3),
+};
 
-//
-// stats are integers communicated to the client by the server
-//
-#define	MAX_CL_STATS		256
-#define	STAT_HEALTH			0
-#define	STAT_FRAGS			1
-#define	STAT_WEAPON			2
-#define	STAT_AMMO			3
-#define	STAT_ARMOR			4
-#define	STAT_WEAPONFRAME	5
-#define	STAT_SHELLS			6
-#define	STAT_NAILS			7
-#define	STAT_ROCKETS		8
-#define	STAT_CELLS			9
-#define	STAT_ACTIVEWEAPON	10
-#define	STAT_TOTALSECRETS	11
-#define	STAT_TOTALMONSTERS	12
-#define	STAT_SECRETS		13		// bumped on client side by svc_foundsecret
-#define	STAT_MONSTERS		14		// bumped by svc_killedmonster
-
-// stock defines
-
-#define	IT_SHOTGUN				1
-#define	IT_SUPER_SHOTGUN		2
-#define	IT_NAILGUN				4
-#define	IT_SUPER_NAILGUN		8
-#define	IT_GRENADE_LAUNCHER		16
-#define	IT_ROCKET_LAUNCHER		32
-#define	IT_LIGHTNING			64
-#define IT_SUPER_LIGHTNING      128
-#define IT_SHELLS               256
-#define IT_NAILS                512
-#define IT_ROCKETS              1024
-#define IT_CELLS                2048
-#define IT_AXE                  4096
-#define IT_ARMOR1               8192
-#define IT_ARMOR2               16384
-#define IT_ARMOR3               32768
-#define IT_SUPERHEALTH          65536
-#define IT_KEY1                 131072
-#define IT_KEY2                 262144
-#define	IT_INVISIBILITY			524288
-#define	IT_INVULNERABILITY		1048576
-#define	IT_SUIT					2097152
-#define	IT_QUAD					4194304
-#define IT_SIGIL1               (1<<28)
-#define IT_SIGIL2               (1<<29)
-#define IT_SIGIL3               (1<<30)
-#define IT_SIGIL4               (1<<31)
-
 //===========================================
-//rogue changed and added defines
 
-#define RIT_SHELLS              128
-#define RIT_NAILS               256
-#define RIT_ROCKETS             512
-#define RIT_CELLS               1024
-#define RIT_AXE                 2048
-#define RIT_LAVA_NAILGUN        4096
-#define RIT_LAVA_SUPER_NAILGUN  8192
-#define RIT_MULTI_GRENADE       16384
-#define RIT_MULTI_ROCKET        32768
-#define RIT_PLASMA_GUN          65536
-#define RIT_ARMOR1              8388608
-#define RIT_ARMOR2              16777216
-#define RIT_ARMOR3              33554432
-#define RIT_LAVA_NAILS          67108864
-#define RIT_PLASMA_AMMO         134217728
-#define RIT_MULTI_ROCKETS       268435456
-#define RIT_SHIELD              536870912
-#define RIT_ANTIGRAV            1073741824
-#define RIT_SUPERHEALTH         2147483648
+typedef u8int byte;
+typedef enum {false, true} qboolean;
 
-//MED 01/04/97 added hipnotic defines
-//===========================================
-//hipnotic added defines
-#define HIT_PROXIMITY_GUN_BIT 16
-#define HIT_MJOLNIR_BIT       7
-#define HIT_LASER_CANNON_BIT  23
-#define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
-#define HIT_MJOLNIR         (1<<HIT_MJOLNIR_BIT)
-#define HIT_LASER_CANNON    (1<<HIT_LASER_CANNON_BIT)
-#define HIT_WETSUIT         (1<<(23+2))
-#define HIT_EMPATHY_SHIELDS (1<<(23+3))
-
-//===========================================
-
-#define	MAX_SCOREBOARD		16
-#define	MAX_SCOREBOARDNAME	32
-
-typedef unsigned char 		byte;
-typedef enum {false, true}	qboolean;
-
 #include "cvar.h"
 #include "common.h"
 #include "bspfile.h"
@@ -178,8 +161,6 @@
 #include "console.h"
 #include "view.h"
 #include "menu.h"
-
-/* included here to avoid type incompatibilities errors from 2c(1),2l(1) */
 #include "r_local.h"
 #include "d_local.h"
 
--- a/sv_user.c
+++ b/sv_user.c
@@ -4,6 +4,8 @@
 #include "quakedef.h"
 #include "fns.h"
 
+#define	ON_EPSILON		0.1			// point on plane side epsilon
+
 edict_t	*sv_player;
 
 extern	cvar_t	sv_friction;