//#include "extern.qh"
#include "options.qh"

// because I want a boolean type :)
#define boolean integer

//
// constants
//
// edict.flags
#define FL_FLY		1 
#define FL_SWIM		2 
#define FL_CLIENT		8 	// set for all client edicts
#define FL_INWATER	16 	// for enter / leave water splash
#define FL_MONSTER	32 
#define FL_GODMODE	64 	// player cheat
#define FL_NOTARGET	128 	// player cheat
#define FL_ITEM		256 	// extra wide size for bonus items
#define FL_ONGROUND	512 	// standing on something
#define FL_PARTIALGROUND 1024 	// not all corners are valid
#define FL_WATERJUMP	2048 	// player jumping out of water
#define FL_JUMPRELEASED	4096 	// for jump debouncing

// edict.movetype values
#define MOVETYPE_NONE			0 	// never moves
//#define MOVETYPE_ANGLENOCLIP	1 
//#define MOVETYPE_ANGLECLIP		2 
#define MOVETYPE_WALK			3 	// players only
#define MOVETYPE_STEP			4 	// discrete, not real time unless fall
#define MOVETYPE_FLY			5 
#define MOVETYPE_TOSS			6 	// gravity
#define MOVETYPE_PUSH			7 	// no clip to world, push and crush
#define MOVETYPE_NOCLIP			8 
#define MOVETYPE_FLYMISSILE		9 	// fly with extra size against monsters
#define MOVETYPE_BOUNCE			10 
#define MOVETYPE_BOUNCEMISSILE	11 	// bounce with extra size

// checkmove types
#define MOVE_NORMAL		0
#define MOVE_NOMONSTERS	1
#define MOVE_MISSILE	2

// edict.solid values
#define SOLID_NOT		0 	// no interaction with other objects
#define SOLID_TRIGGER	1 	// touch on edge, but not blocking
#define SOLID_BBOX	    2 	// touch on edge, block
#define SOLID_SLIDEBOX	3 	// touch on edge, but not an onground
#define SOLID_BSP		4 	// bsp clip, touch on edge, block

// range values
#define RANGE_MELEE	    0 
#define RANGE_NEAR	    1 
#define RANGE_MID		2 
#define RANGE_FAR		3 
#define RANGE_VERYFAR   4 //- OfN - Used for sentries

// deadflag values

#define DEAD_NO			0 
#define DEAD_DYING		1 
#define DEAD_DEAD			2 
#define DEAD_RESPAWNABLE	3 

// takedamage values

#define DAMAGE_NO			0 
#define DAMAGE_YES		1 
#define DAMAGE_AIM		2 

// items
#define IT_AXE			4096 
#define IT_SHOTGUN		1 
#define IT_SUPER_SHOTGUN	2 
#define IT_NAILGUN		4 
#define IT_LIGHT_ASSAULT 	8 
#define IT_GRENADE_LAUNCHER	16 
#define IT_ROCKET_LAUNCHER	32 
#define IT_LIGHTNING		64 
#define IT_EXTRA_WEAPON		128 

#define IT_SHELLS			256 
#define IT_NAILS			512 
#define IT_ROCKETS		1024 
#define IT_CELLS			2048 

#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_HOOK			8388608

// point content values

#define CONTENTS_EMPTY	-1 
#define CONTENTS_SOLID	-2 
#define CONTENTS_WATER	-3 
#define CONTENTS_SLIME	-4 
#define CONTENTS_LAVA	-5 
#define CONTENTS_SKY	-6 

#define STATE_TOP	0 
#define STATE_BOTTOM	1 
#define STATE_UP		2 
#define STATE_DOWN	3 

#define VEC_ORIGIN		'0 0 0' 
#define VEC_HULL_MIN	'-16 -16 -24' 
#define VEC_HULL_MAX	'16 16 32' 

#define VEC_HULL2_MIN	'-32 -32 -24' 
#define VEC_HULL2_MAX	'32 32 64' 

// protocol bytes
#define SVC_SETVIEWPORT		5
#define SVC_SETANGLE		10
#define SVC_TEMPENTITY		23 
#define SVC_KILLEDMONSTER	27 
#define SVC_FOUNDSECRET		28 
#define SVC_INTERMISSION	30 
#define SVC_FINALE		31 
#define SVC_CDTRACK		32 
#define SVC_SELLSCREEN		33 

#define SVC_SMALLKICK	 34
#define SVC_BIGKICK	 35
#define SVC_MUZZLEFLASH	 39


#define TE_SPIKE			0 
#define TE_SUPERSPIKE		1 
#define TE_GUNSHOT	    	2 
#define TE_EXPLOSION		3 
#define TE_TAREXPLOSION		4 
#define TE_LIGHTNING1		5 
#define TE_LIGHTNING2		6 
#define TE_WIZSPIKE		    7 
#define TE_KNIGHTSPIKE		8 
#define TE_LIGHTNING3		9 
#define TE_LAVASPLASH		10 
#define TE_TELEPORT		    11 
#define TE_BLOOD        	12
#define TE_LIGHTNINGBLOOD	13

// sound channels
// channel 0 never willingly overrides
// other channels (1-7) allways override a playing sound on that channel
#define CHAN_AUTO	0 
#define CHAN_WEAPON	1 
#define CHAN_VOICE	2 
#define CHAN_ITEM	3 
#define CHAN_BODY	4 
#define CHAN_MUSIC  5 //WK For orff.wav
#define CHAN_MISC   6
//#define CHAN_MONSTER 7

#define ATTN_NONE	0 
#define ATTN_NORM	1 
#define ATTN_IDLE	2 
#define ATTN_STATIC	3 

// update types

#define UPDATE_GENERAL	0 
#define UPDATE_STATIC	1 
#define UPDATE_BINARY	2 
#define UPDATE_TEMP	3 

// entity effects

#define EF_BRIGHTFIELD	8  //really 1, doesn't exist in quakeworld
#define EF_MUZZLEFLASH	8  //really 2, doesn't exist in quakeworld
 
#define EF_BRIGHTLIGHT	4 
#define EF_DIMLIGHT	8
#define EF_FLAG1	16
#define EF_FLAG2	32
#define EF_BLUE		64
#define EF_RED		128 

#define EF_ANYGLOW (EF_BRIGHTLIGHT | EF_DIMLIGHT |  EF_RED | EF_BLUE)

float (entity e) EF_GlowColor;

// network writes.  argument to Write*
#define MSG_ONE			1 		// reliable to one (msg_entity)
#define MSG_ALL			2 		// reliable to all
#define MSG_INIT		3 		// write to the init string
#define MSG_MULTICAST	4		// only those in pvs/phs.  see
								//   multicast sets below


// message levels
#define	PRINT_LOW		 0.0		// pickup messages
#define	PRINT_MEDIUM	 1.0		// death messages
#define	PRINT_HIGH		 2.0		// critical messages
#define PRINT_CHAT		 3.0		// also goes to chat console

// multicast sets.  argument to multicast
#define MULTICAST_ALL    0    	// every client
#define MULTICAST_PHS    1    	// within hearing
#define MULTICAST_PVS    2    	// within sight
#define MULTICAST_ALL_R  3    	// every client, reliable
#define MULTICAST_PHS_R  4    	// within hearing, reliable
#define MULTICAST_PVS_R  5  	// within sight, reliable


#define AS_STRAIGHT	1 
#define AS_SLIDING	2 
#define AS_MELEE		3 
#define AS_MISSILE	4 
#define AS_FIREBALL	5 


#define MAX_HOVER_FUEL 10 //Boots will recharge up to this maximum

#define CUSTOM_ON_SPAWN 1  //When dead, rebuild
#define CUSTOM_FINISHED 2  //Normal gameplay
#define CUSTOM_BUILDING 4  //Making a class
#define CUSTOM_OVERRIDE 8  //Used internally by menu.qc
#define CUSTOM_SELLING  16 //Person wants to sell his frags for money

#define SPENDING_LIMIT 10000 //How much to start with if serverinfo m is not set

// TeamFortress State Flags
#define TFSTATE_GRENPRIMED	 1 	// Whether the player has a primed grenade
#define TFSTATE_RELOADING	 2 	// Whether the player is reloading
#define TFSTATE_CONCUSSIONED     4  	// If the person is dizzy and fumbling
#define TFSTATE_RANDOMPC	 8    // Whether Playerclass is random, new one each respawn
#define TFSTATE_INFECTED	 16 	// set when player is infected by the bioweapon
#define TFSTATE_INVINCIBLE	 32 	// Player has permanent Invincibility (Usually by GoalItem)
#define TFSTATE_INVISIBLE	 64 	// Player has permanent Invisibility (Usually by GoalItem)
#define TFSTATE_QUAD		 128  // Player has permanent Quad Damage (Usually by GoalItem)
#define TFSTATE_RADSUIT		 256    // Player has permanent Radsuit (Usually by GoalItem)
#define TFSTATE_BURNING		 512    // Is on fire
#define TFSTATE_GRENTHROWING	 1024   // is throwing a grenade
#define TFSTATE_AIMING		 2048   // is using the laser sight
#define TFSTATE_ZOOMOFF		 4096   // doesn't want the FOV changed when zooming
#define TFSTATE_RESPAWN_READY	 8192   // is waiting for respawn, and has pressed fire
#define TFSTATE_HALLUCINATING  16384  // set when player is hallucinating
#define TFSTATE_TRANQUILISED   32768  // set when player is tranquilised
#define TFSTATE_CANT_MOVE	 65536  // set when player is setting a detpack
//WK
#define TFSTATE_INSPIRED	 131072 // set when chaplan is in their area
//CH
#define TFSTATE_RL_LASER	 262144 //CH set when aiming laser with rl
//SB
#define TFSTATE_C4THROW			524288 // we're priming the detpack
#define TFSTATE_ASSAULTCANNON	1048576 // we're firing an assault cannon
#define TFSTATE_DISARMED	2097152 // We've been disarmed.


// Defines used by TF_T_Damage (see combat.qc)
#define TF_TD_IGNOREARMOUR	1  // Bypasses the armour of the target
#define TF_TD_NOTTEAM		2  // Doesn't damage a team member (indicates direct fire weapon)
#define TF_TD_NOTSELF		4  // Doesn't damage self

#define TF_TD_OTHER		0  // Ignore armorclass
#define TF_TD_SHOT		1  // Bullet damage
#define TF_TD_NAIL		2  // Nail damage
#define TF_TD_EXPLOSION		4  // Explosion damage
#define TF_TD_ELECTRICITY	8  // Electric damage
#define TF_TD_FIRE		16  // Fire damage
#define TF_TD_NOSOUND		256 // Special damage. Makes no sound/painframe, etc
#define TF_TD_MELEE		512


//WK 152 Default, must be > 6.
//#define MOTD_FINISHED 242 		//Delay in 1/10th seconds for motd to show
#define MOTD_FINISHED 150


/*==================================================*/
/* Toggleable Game Settings							*/
/*==================================================*/

#define TF_RESPAWNDELAY1	5 	// seconds of waiting before player can respawn
#define TF_RESPAWNDELAY2	10 	// seconds of waiting before player can respawn
#define TF_RESPAWNDELAY3	20 	// seconds of waiting before player can respawn


#define TEAMPLAY_NORMAL			 1			
#define TEAMPLAY_HALFDIRECT		 2
#define TEAMPLAY_NODIRECT		 4
#define TEAMPLAY_HALFEXPLOSIVE	 8
#define TEAMPLAY_NOEXPLOSIVE	 	16
#define TEAMPLAY_LESSPLAYERSHELP 	32
#define TEAMPLAY_LESSSCOREHELP	64
#define TEAMPLAY_HALFARMORDIRECT	128
#define TEAMPLAY_NOARMORDIRECT	256
#define TEAMPLAY_HALFARMOREXPLOSIVE	512
#define TEAMPLAY_NOARMOREXPLOSIVE	1024
#define TEAMPLAY_HALFMIRRORDIRECT	2048
#define TEAMPLAY_FULLMIRRORDIRECT	4096
#define TEAMPLAY_HALFMIRROREXPLOSIVE 8192
#define TEAMPLAY_FULLMIRROREXPLOSIVE 16384
#define TEAMPLAY_VAMPIRE		 32768
//#define TEAMPLAY_LIGHT_DAMAGE 		131072

// FortressMap stuff
#define TEAM1_CIVILIANS 1	
#define TEAM2_CIVILIANS 2
#define TEAM3_CIVILIANS 4	
#define TEAM4_CIVILIANS 8	


// Defines for the playerclass
#define PC_UNDEFINED	0 

#define PC_SCOUT		1 
#define PC_SNIPER		2 
#define PC_SOLDIER	3 
#define PC_DEMOMAN	4 
#define PC_MEDIC		5 
#define PC_HVYWEAP	6 
#define PC_PYRO		7
#define PC_SPY		8
#define PC_ENGINEER	9

// Insert new class definitions here

// PC_RANDOM _MUST_ be the third last class WK - Why?
#define PC_RANDOM		10 		// Random playerclass
#define PC_CUSTOM		11		// WK - THE NEW CLASS BEEEATCH
#define PC_CIVILIAN	12		// Civilians are a special class. They cannot
						// be chosen by players, only enforced by maps
#define PC_LASTCLASS	13 		// Use this as the high-boundary for any loops
						// through the playerclass.

/*==================================================*/
/* Impulse Defines		                        	*/
/*==================================================*/
// *must* be less than 4194304
#define TF_ALIASVERSION 100

// Alias check to see whether they already have the aliases
#define TF_ALIAS_CHECK		13 

// CTF Support Impulses
#define HOOK_IMP1			22
#define FLAG_INFO			23
#define HOOK_IMP2			39

// Axe
#define AXE_IMP			40

// Camera Impulse
#define TF_CAM_TARGET			50
#define TF_CAM_ZOOM			51
#define TF_CAM_ANGLE			52
#define TF_CAM_VEC			53
#define TF_CAM_PROJECTILE		54
#define TF_CAM_PROJECTILE_Z		55
#define TF_CAM_REVANGLE			56
#define TF_CAM_OFFSET			57
#define TF_CAM_DROP			58	
#define TF_CAM_FADETOBLACK		59
#define TF_CAM_FADEFROMBLACK		60
#define TF_CAM_FADETOWHITE		61
#define TF_CAM_FADEFROMWHITE		62

// Status Bar Resolution Settings.  Same as CTF to maintain ease of use.
#define TF_STATUSBAR_RES_START	71
#define TF_STATUSBAR_RES_END	81

// Added to PC_??? to get impulse to use if this clashes with your 
// own impulses, just change this value, not the PC_??
#define TF_CHANGEPC			100 
// The next few impulses are all the class selections
//PC_SCOUT		101 
//PC_SNIPER		102 
//PC_SOLDIER	103 
//PC_DEMOMAN	104 
//PC_MEDIC		105 
//PC_HVYWEAP	106 
//PC_PYRO		107 
//PC_RANDOM		108
//PC_CIVILIAN	109  // Cannot be used
//PC_SPY		110
//PC_ENGINEER	111  //Changed, this is Custom now

// Help impulses
#define TF_DISPLAYLOCATION  	118
#define TF_STATUS_QUERY		119
#define TF_CHANGECLASS		120
#define TF_UNCUSTOM		121
#define TF_HELP_MAP		131

// Information impulses
#define TF_INVENTORY		135
#define TF_SHOWTF			136 
#define TF_SHOWLEGALCLASSES	137

// Team Impulses
#define TF_TEAM_1			140   // Join Team 1
#define TF_TEAM_2			141   // Join Team 2
#define TF_TEAM_3			142   // Join Team 3
#define TF_TEAM_4			143   // Join Team 4
#define TF_TEAM_CLASSES		144   // Impulse to display team classes
#define TF_TEAM_SCORES		145   // Impulse to display team scores
#define TF_TEAM_LIST		146   // Impulse to display the players in each team.
#define TF_TEAM_ENUM		147	// WK WK

// Grenade Impulses
#define TF_GRENADE_1		150   // Prime grenade type 1
#define TF_GRENADE_2		151   // Prime grenade type 2
#define TF_GRENADE_T		152   // Throw primed grenade

// Impulses for new items
#define TF_SCAN			159		// Scanner Pre-Impulse
#define TF_SCAN_ENEMY		160		// Impulses to toggle scanning of enemies
#define TF_SCAN_FRIENDLY	161		// Impulses to toggle scanning of friendlies 
#define TF_SCAN_10		162		// Scan using 10 enery (1 cell)
#define TF_SCAN_30		163		// Scan using 30 energy (2 cells)
#define TF_SCAN_100		164		// Scan using 100 energy (5 cells)
#define TF_DETPACK_5		165		// Detpack set to 5 seconds
#define TF_DETPACK_20		166		// Detpack set to 20 seconds
#define TF_DETPACK_50		167		// Detpack set to 50 seconds
#define TF_DETPACK		168		// Detpack Pre-Impulse
#define TF_DETPACK_STOP		169		// Impulse to stop setting detpack
#define TF_PB_DETONATE		170		// Detonate Pipebombs

// Special skill
#define TF_SPECIAL_SKILL	171

// Ammo Drop impulse
#define TF_DROP_AMMO        	172

// Reload impulse
#define TF_RELOAD			173

// auto-zoom toggle
#define TF_AUTOZOOM		174

// drop/pass commands
#define TF_DROPKEY		175

// Select Medikit		
#define TF_MEDIKIT		176

// Spy Impulses
#define TF_SPY_SPY		177		// Bring up spy menu
#define TF_SPY_DIE		178		// Feign Death
#define TF_SPY_DIE2		213		//CH sfeign

// Engineer Impulses
#define TF_ENGINEER_BUILD	179
//#define TF_ENGINEER_SANDBAG	180

// SB new impulses
//#define BUILD_SENSOR 		190
#define THROW_DETPACK		191
//#define IMPULSE_INTERFACE	192 // now its a profession
#define IMPULSE_HOLO	192 //- OfN

//#define SWITCH_CAMERA		199

// Medic!! 
#define TF_MEDIC_HELPME		181

// taunts
#define TF_TAUNT			203 //WK
#define TF_TAUNT2			204 //WK
#define TF_TAUNT3			205 //WK
#define TF_TAUNT4			206 //WK
#define TF_TAUNT5			207 //WK

// Status bar
#define TF_STATUSBAR_ON		182
#define TF_STATUSBAR_OFF	183

// Discard impulse
#define TF_DISCARD 	  	184

// ID Player impulse
#define TF_ID	 	  	185

// WK Sell off frags
#define TF_SELL			187
#define TF_SKILL			200
#define TF_LAY			201 //MegaTFer killer

#define TF_DROPITEMS		202 //CH

#define TF_BITSTART	250
#define TF_BIT0		251
#define TF_BIT1		252
#define TF_BITEND	253
#define TF_BITNONE	254

#define TF_ALIASNEXT	255

//CH in admin.qc is a list of impulses that can be used during ceasefire
//To fool proof the cheat impulses
#define I_CHEAT_ONE		155
#define I_CHEAT_TWO		83
#define I_CHEAT_THREE		212


//Alias checking
#define TF_GOTALIAS_PRECHECK	0
#define TF_GOTALIAS_CHECKING	1
#define TF_GOTALIAS_SETTING		2
#define TF_GOTALIAS_DONE		4

/*==================================================*/
/*	Colors		      			    */
/*==================================================*/
#define WHITE 		1
#define BROWN 		2
#define BLUE 		3
#define GREEN   	4
#define RED 		5
#define TAN     	6
#define PINK    	7
#define ORANGE  	8
#define PURPLE  	9
#define DARKPURPLE 	10
#define GREY    	11
#define DARKGREEN  	12
#define YELLOW 		13
#define DARKBLUE   	14

/*==================================================*/
/* Defines for the ENGINEER's Building ability      */
/*==================================================*/
// Ammo costs
#define AMMO_COST_SHELLS		3		// Metal needed to make 1 shell
#define AMMO_COST_NAILS			2
#define AMMO_COST_ROCKETS		5
#define AMMO_COST_CELLS			5

// Building types
#define BUILD_DISPENSER			1
#define BUILD_SENTRYGUN			2
#define BUILD_TESLA			    3
#define BUILD_SECURITY_CAMERA	4
#define BUILD_TELEPORTER		5
#define BUILD_FIELDGEN          6

// Building metal costs
#define BUILD_COST_DISPENSER		100		// Built thru the menu
#define BUILD_COST_SENTRYGUN		130		// Built thru the menu
#define BUILD_COST_TURRET		75		// Built thru the menu
#define BUILD_COST_TESLA		100		// Built thru the menu
#define BUILD_COST_CAMERA		55		//NOTE is used to check if can build stuff
#define BUILD_COST_TELEPORTER		90
#define BUILD_COST_SENSOR			60
#define BUILD_COST_FIELDGEN			140


// Building times
#define BUILD_TIME_DISPENSER		2		// 2 seconds to build
#define BUILD_TIME_SENTRYGUN		5		// 5 seconds to build
#define BUILD_TIME_TESLA		    6		// 8 seconds to build
#define BUILD_TIME_TELEPORTER		3		// 3 seconds to build
#define BUILD_TIME_FIELDGEN 		4		// 7 seconds to build 

//Camera is thrown, no build time - OfN - sensor neither

// Building health levels
#define BUILD_HEALTH_DISPENSER	150		// Built thru the menu
#define BUILD_HEALTH_SENTRYGUN	150		// Built thru the menu
#define BUILD_HEALTH_TESLA		200		// Built thru the menu
#define BUILD_HEALTH_CAMERA		400		// They dont do much // was 600
#define BUILD_HEALTH_SENSOR		250		// may not do much, but v. annoying // was 200
#define BUILD_HEALTH_TELEPORTER	300
#define BUILD_HEALTH_FIELDGEN	300     //

// Amount of CELLS you can repair something in one go (NOT HEALTH! health is 5x this)
// this is going to be tweaked a lot

#define BUILD_DISPENSER_REPAIR  20		// 2 repairs
#define BUILD_SENTRYGUN_REPAIR  40		// 2-ish for l3, 1 for l1 sents
#define BUILD_TESLA_REPAIR	40		// a lot of repairs for many teslas, 1 for regular ones
#define BUILD_CAMERA_REPAIR	50		// 2 repairs
#define BUILD_SENSOR_REPAIR	50		// 1 repair (these things get attacked a lot)
#define BUILD_TELEPORT_REPAIR   30		// 2 or 3
#define BUILD_FIELDGEN_REPAIR	30		// also 2 or 3, decheapening here

// same, but for amount you can recharge. this is the same as the number of cells used

#define BUILD_TESLA_RECHARGE	200
#define BUILD_TELEPORT_RECHARGE	100
#define BUILD_FIELDGEN_RECHARGE 50

// Building screwups
#define SCREWUP_ONE     1
#define SCREWUP_TWO     2
#define SCREWUP_THREE   4
#define	SCREWUP_FOUR    8
//#define SCREWUP_FIVE 16

//- OfN Building hack-impovements -//
#define IMPROVED_ONE     1         //
#define IMPROVED_TWO     2         // level 1 ice (more time to hack it)
#define IMPROVED_THREE   4         //
#define	IMPROVED_FOUR    8         //(usually takeover xcept for teleporter and dispensern)
#define	IMPROVED_FIVE    16        // Level 2 ice (unable to hack it)
#define	IMPROVED_SIX     32        // Level 3 ice (kills hacker)
#define IMPROVED_SEVEN   64        // used for 2nd sensor revealer hack (for thieves)
//---------------------------------//

//CH Max distance for teleporter
#define TELEPORTER_RANGE		3072

// Dispenser's maximum carrying capability
#define BUILD_DISPENSER_MAX_SHELLS  400
#define BUILD_DISPENSER_MAX_NAILS   600
#define BUILD_DISPENSER_MAX_ROCKETS 300
#define BUILD_DISPENSER_MAX_CELLS   400
#define BUILD_DISPENSER_MAX_ARMOR   500


/*==================================================*/
/* Ammo quantities for dropping            			*/
/*==================================================*/
#define DROP_SHELLS   20
#define DROP_NAILS    20
#define DROP_ROCKETS  10
#define DROP_CELLS    10
#define DROP_ARMOR    40

/*==================================================*/
/* Team Defines				            			*/
/*==================================================*/
#define TM_MAX_NO	4 			// Max number of teams. Simply changing this value isn't enough.
								// A new global to hold new team colors is needed, and more flags
								// in the spawnpoint spawnflags may need to be used.
								// Basically, don't change this unless you know what you're doing :)


/*==================================================*/
/* New Weapon Defines		                        */
/*==================================================*/
// WK -- Removed "weapons" to free up space for shootable things
// We can remove some more by giving the weapons a weapon mode (like the rifle)
#define WEAP_HOOK			1
#define WEAP_MEDIKIT			4
#define WEAP_SPANNER			8
#define WEAP_AXE			16
#define WEAP_SNIPER_RIFLE		32

#ifndef NO_AUTORIFLE
# define WEAP_AUTO_RIFLE		64
#endif

#define WEAP_SHOTGUN			128
#define WEAP_SUPER_SHOTGUN		256
#define WEAP_NAILGUN			512
#define WEAP_LIGHT_ASSAULT		1024
#define WEAP_GRENADE_LAUNCHER		2048
#define WEAP_FLAMETHROWER		4096
#define WEAP_ROCKET_LAUNCHER		8192
#define WEAP_INCENDIARY			16384
#define WEAP_ASSAULT_CANNON		32768
#define WEAP_LIGHTNING			65536
#define WEAP_DAEDALUS			131072
//#define WEAP_DETPACK			131072 DONT MAKE ANY AMMOTYPES USE THIS NUMBER!
#define WEAP_TRANQ			262144
#define WEAP_LASER			524288
#define WEAP_MAUSER			1048576

#define WEAP_AIRF               	2097152 //- OfN - airfist
#define WEAP_LASERCANNON        	4194304 //- OfN - LASER CANNON
#define WEAP_SNG                	8388608
//MAX 24 BITS OF PRECISION IN FLOAT!

/*====================================================*/
/* New Items WK -- Things to buy in custom!		*/
/* Treated as weapons, but be sure to check the right */
/* bitfield -- .weapons_carried vs .tf_items!		*/
/*====================================================*/

//WK these are carried in self.tf_items
#define NIT_SCANNER				1 
#define NIT_TURRET				2 //Turret
#define NIT_KEVLAR				4 //Special Armors
#define NIT_GEL					8
#define NIT_BLAST					16
#define NIT_CERAMIC				32
#define NIT_ASBESTOS				64
#define NIT_AMMO_BACKPACK			128 //Increases ammo capacity
#define NIT_AMMO_BANDOLIER			256 //Increases starting ammo
#define NIT_SCUBA					512 //The Scuba Commando!
//WK this next one is only used on teslas, not people, hence the conflict
#define NIT_TESLA_CLOAKING			512 //CH Tesla got a cloaking device
#define NIT_AUTOID				1024
#define NIT_AUTOMEDIC				2048
#define NIT_RESPAWN_GUARD			4096
#define NIT_AUTOSCANNER				8192 
#define NIT_HOVER_BOOTS				16384  //Like a jet pack
#define NIT_TESLA		 			32768  //The *real* bug zapper! 
#define NIT_SECURITY_CAMERA			65536  //CH Security Camera
#define NIT_TELEPORTER				131072 //CH Teleporter
#define NIT_TESLA_UPGRADE 			262144 //Get more tesla upgrades
#define NIT_HOVER_BOOTS_UPGRADE		524288 //CH you get 2x fuel
#define NIT_RL_LASER_SIGHT			1048576 //CH
#define NIT_CLUSTER_ROCKETS			2097152 //CH
//2 more allowed, before we run out of bits in a .float

//WK On to the third 24-wide bitfield for holding purchases
#define CUTF_DETPACK			1
#define CUTF_KNIFE				2  //More like a powerup
#define CUTF_SPY_KIT			4  //Allows disguise
#define CUTF_HWGUY				8  //Person doesn't bounce
#define CUTF_SENTRYGUN			16 //Allows building a gun
#define CUTF_JAMMER				32 // SB scanner jammer
#define CUTF_FULLARMOUR			64 // SB full armour when spawning
#define CUTF_CYBERAUG			128 // SB cybernetic augmentation
#define CUTF_SENSOR				256 // SB motion sensor
#define CUTF_INTERFACE			512 // SB tech interface - for hax0ring SGs
#define CUTF_TOSSABLEDET		1024 // C4 tossable detpack
#define CUTF_DISPENSER			2048 // the new buyable dispenc0r
#define CUTF_STEALTH			4096 // balance proficiency - done
#define CUTF_HIGHJUMP			8192 // highjump proficiency - done
#define CUTF_GYMNAST			16384 // Gymnast proficiency
#define CUTF_DEMONLORE			32768 // demon lore proficiency
#define CUTF_EXPBODY			65536 // martyr
#define CUTF_CLOSECOMBAT		131072 // close combat guy
//-----------------------------------//
#define CUTF_HOLO               262144 // OfN - Holograph
#define CUTF_OTR                524288 // OfN - OTR bullets for sniper rifle
#define CUTF_FIELDGEN           1048576 // OfN - field generators

//Time to be invincible from the respawn guard
#define RESPAWN_GUARD_TIME		5

//JOBS AVAILABLE
#define JOB_THIEF				1
#define JOB_RUNNER				2
#define JOB_WARLOCK				4
#define JOB_CHAPLAN				8
#define JOB_BERSERKER			16
#define JOB_GUERILLA			32
#define JOB_JUDOKA				64
//- OfN - New jobs -
#define JOB_ARMY                128
#define JOB_HACKER              256
#define JOB_MARTYR              512
#define JOB_CRUSADER           1024

//This is the sum of all jobs...
#define JOB_ALL					2047 //Not a job, used to simplify bit operators

//STATES WE ARE IN FOR JOB
//Every time we add one, make sure it gets reset in tfort.qc!
#define JOB_ACTIVE				2048  //Job is 'on' like currently hiding
#define JOB_FULL_HIDE			4096  //Job is in phase two of "hide"
#define JOB_TIRED				8192  //Recovering from a sprint
#define JOB_BLOODY_KNIFE		16384 //We've gone OJ on someone
#define JOB_DEMON_OUT			32768 //We have a demon in the world
//#define JOB_MARTYR_ENEMY		^double //We have been shot, and enemy remembered

/*==================================================*/
/* New Weapon Related Defines		                */
/*==================================================*/
// shots per reload 
#define RE_SHOTGUN		    	8 
#define RE_SUPER_SHOTGUN		16 // 8 shots
#define RE_GRENADE_LAUNCHER		6 
#define RE_ROCKET_LAUNCHER		4 
#define RE_LIGHT_ASSAULT		40 


// reload times
#define RE_SHOTGUN_TIME			    2 
#define RE_SUPER_SHOTGUN_TIME		3 
#define RE_GRENADE_LAUNCHER_TIME	4 
#define RE_ROCKET_LAUNCHER_TIME 	5 
#define RE_LIGHT_ASSAULT_TIME		3.5 



// Maximum velocity you can move and fire the Sniper Rifle
#define WEAP_SNIPER_RIFLE_MAX_MOVE	50 

// Medikit
#define WEAP_MEDIKIT_HEAL	200  // Amount medikit heals per hit
#define WEAP_MEDIKIT_OVERHEAL 50 // Amount of superhealth over max_health the medikit will dispense

// Spanner
#define WEAP_SPANNER_REPAIR 50

// Detpack
#define WEAP_DETPACK_DISARMTIME	1   	//Time it takes to disarm a Detpack
#define WEAP_DETPACK_SETTIME		4   	// Time it takes to set a Detpack
#define WEAP_DETPACK_SIZE		800 
#define WEAP_DETPACK_BITS_NO		12  	// Bits that detpack explodes into

// Tranquiliser Gun
#define TRANQ_TIME			5

// Grenades
#define GR_PRIMETIME		3 

// Grenade types
#define GR_TYPE_NONE		0 
#define GR_TYPE_NORMAL		1 
#define GR_TYPE_CONCUSSION	2 
#define GR_TYPE_NAIL		3 
#define GR_TYPE_MIRV		4 
#define GR_TYPE_NAPALM		5 
#define GR_TYPE_FLAME		5 //WK Our special napalm grenade ;)
#define GR_TYPE_FLARE		6 
#define GR_TYPE_GAS		7
#define GR_TYPE_EMP		8
#define GR_TYPE_FLASH		9
#define GR_TYPE_FRAG		10
#define GR_TYPE_KRAC		11
#define GR_TYPE_ANTIGRAV	12
#define GR_TYPE_BIO         13
#define GR_TYPE_CALTROP     14


// Defines for WeaponMode
#define GL_NORMAL	0 
#define GL_PIPEBOMB	1 

// Defines for Concussion Grenade
#define GR_CONCUSS_AMOUNT	75	// Initial conc amount
#define GR_CONCUSS_TIME		0.2	// Time between conc timers
#define GR_CONCUSS_DEC		0.5	// Amount of conc to remove each timer
#define GR_CONCUSS_MAX  	100	// Highest amount of conc you can get
#define	GR_CONCUSS_IDLE 	1	// Idlescale amount with OLD_CONC_GRENADE
#define GR_CONCUSS_X		0.039	// X mult
#define GR_CONCUSS_Y		0.056	// Y mult
#define GR_CONCUSS_MAX_X	30
#define GR_CONCUSS_MAX_Y	60
#define GR_CONCUSS_MIN_X	-30
#define GR_CONCUSS_MIN_Y	-60
#define GR_CONCUSS_KICK		0.032	// Amount of stumbling you do while moving
#define GR_CONCUSS_FIXTIME	5	// Time between sending setangles and resetting
#define GR_CONCUSS_BUBBLETIME	5

#define GR_ANTIGRAV_AMOUNT	100 
#define GR_ANTIGRAV_TIME	3 
#define GR_ANTIGRAV_DEC		30 

#undef NEW_CONCUSS_BOUNCE	// New conc bounce algo (same as regular gren)
#undef GR_CONCUSS_SETANGLE	// Laggy visual effect
#undef OLD_CONC_GRENADE

// Defines for the Gas Grenade
#define GR_HALLU_TIME	0.1
#define GR_HALLU_DEC	2.5

#define NIT_SILVER_DOOR_OPENED 		IT_KEY1	// 131072 
#define NIT_GOLD_DOOR_OPENED 			IT_KEY2	// 262144

/*==================================================*/
/* New Item Flags		                        	*/
/*==================================================*/
#define NIT_SCANNER_ENEMY		1 	// Detect enemies
#define NIT_SCANNER_FRIENDLY	2 	// Detect friendlies (team members)
#define NIT_SCANNER_MOVEMENT	4 	// Motion detection. Only report moving entities.

/*==================================================*/
/* New Item Related Defines		                    */
/*==================================================*/
#define NIT_SCANNER_POWER			100	// The amount of power spent on a scan with the scanner
										// is multiplied by this to get the scanrange.
#define NIT_SCANNER_MAXCELL			50 	// The maximum number of cells than can be used in one scan
#define NIT_SCANNER_MIN_MOVEMENT	50 	// The minimum velocity an entity must have to be detected
										// by scanners that only detect movement


// Armor Classes : Bitfields. Use the "armorclass" of armor for the Armor Type.

#define AT_SAVESHOT			    1   // Kevlar	: Reduces bullet damage by 15%
#define AT_SAVENAIL			2   // Wood	: Reduces nail damage 15%
#define AT_SAVEEXPLOSION		4   // Blast	: Reduces explosion damage 15%
#define AT_SAVEELECTRICITY	    8 	// Shock	: Reduces electricity damage by 15%
#define AT_SAVEFIRE			    16 	// Asbestos	: Reduces fire damage by 15%
#define AT_SAVEMELEE			32   // Gel		: Reduces melee attacks by 15%


/*==========================================================================*/
/* TEAMFORTRESS CLASS DETAILS												*/
/*==========================================================================*/
// Class Details for SCOUT
#define PC_SCOUT_SKIN			4 		// Skin for this class when Classkin is on.
#define PC_SCOUT_MAXHEALTH		75 		// Maximum Health Level
#define PC_SCOUT_MAXSPEED		420		// Maximum movement speed
#define PC_SCOUT_MAXSTRAFESPEED	420		// Maximum strafing movement speed
#define PC_SCOUT_MAXARMOR		50 		// Maximum Armor Level, of any armor class
#define PC_SCOUT_INITARMOR		25 		// Armor level when respawned
#define PC_SCOUT_MAXARMORTYPE		0.3		// Maximum level of Armor absorption
#define PC_SCOUT_INITARMORTYPE	0.3		// Absorption Level of armor when respawned
#define PC_SCOUT_ARMORCLASSES		3 		// AT_SAVESHOT | AT_SAVEMELEE   		<-Armor Classes allowed for this class
#define PC_SCOUT_INITARMORCLASS	0 		// Armorclass worn when respawned
#define PC_SCOUT_WEAPONS		WEAP_AXE | WEAP_SHOTGUN | WEAP_NAILGUN | WEAP_AIRF
#define PC_SCOUT_MAXAMMO_SHOT		50 		// Maximum amount of shot ammo this class can carry
#define PC_SCOUT_MAXAMMO_NAIL		100		// Maximum amount of nail ammo this class can carry
#define PC_SCOUT_MAXAMMO_CELL		100		// Maximum amount of cell ammo this class can carry
#define PC_SCOUT_MAXAMMO_ROCKET		25 		// Maximum amount of rocket ammo this class can carry
#define PC_SCOUT_INITAMMO_SHOT		25 		// Amount of shot ammo this class has when respawned
#define PC_SCOUT_INITAMMO_NAIL		100		// Amount of nail ammo this class has when respawned
#define PC_SCOUT_INITAMMO_CELL		50 		// Amount of cell ammo this class has when respawned
#define PC_SCOUT_INITAMMO_ROCKET		0 		// Amount of rocket ammo this class has when respawned
//#define PC_SCOUT_GRENADE_TYPE_1		GR_TYPE_NORMAL			 //    <- 1st Type of Grenade this class has
#define PC_SCOUT_GRENADE_TYPE_1		GR_TYPE_CALTROP //GR_TYPE_FLASH			 //    <- 1st Type of Grenade this class has
#define PC_SCOUT_GRENADE_TYPE_2		GR_TYPE_CONCUSSION      //    <- 2nd Type of Grenade this class has
#define PC_SCOUT_GRENADE_INIT_1		4 		// Number of grenades of Type 1 this class has when respawned
#define PC_SCOUT_GRENADE_INIT_2		4 		// Number of grenades of Type 2 this class has when respawned
#define PC_SCOUT_TF_ITEMS			NIT_SECURITY_CAMERA | NIT_SCANNER | NIT_AUTOSCANNER | NIT_HOVER_BOOTS | NIT_HOVER_BOOTS_UPGRADE  // OfN Now with hover boots
#define PC_SCOUT_CUTFITEMS				CUTF_HOLO // | CUTF_CYBERAUG // OfN Scouts with holo now and cyberaug!
#define PC_SCOUT_JOB			JOB_THIEF

#define PC_SCOUT_MOTION_MIN_I			0.5 	// < Short range
#define PC_SCOUT_MOTION_MIN_MOVE		50 		// Minimum vlen of player velocity to be picked up by motion detector

// Class Details for SNIPER
#define PC_SNIPER_SKIN				5 
#define PC_SNIPER_MAXHEALTH			90 
#define PC_SNIPER_MAXSPEED			320 		
#define PC_SNIPER_MAXSTRAFESPEED		320 
#define PC_SNIPER_MAXARMOR			50 
#define PC_SNIPER_INITARMOR			50 
#define PC_SNIPER_MAXARMORTYPE		0.3 
#define PC_SNIPER_INITARMORTYPE		0.3 
#define PC_SNIPER_ARMORCLASSES		3 		// AT_SAVESHOT | AT_SAVEMELEE
#define PC_SNIPER_INITARMORCLASS		1 

#ifndef NO_AUTORIFLE
# define PC_SNIPER_WEAPONS			WEAP_SNIPER_RIFLE | WEAP_AUTO_RIFLE | WEAP_AXE | WEAP_NAILGUN
#else
# define PC_SNIPER_WEAPONS			WEAP_SNIPER_RIFLE | WEAP_AXE | WEAP_NAILGUN
#endif

#define PC_SNIPER_MAXAMMO_SHOT		75 
#define PC_SNIPER_MAXAMMO_NAIL		100 
#define PC_SNIPER_MAXAMMO_CELL		150 
#define PC_SNIPER_MAXAMMO_ROCKET		25 
#define PC_SNIPER_INITAMMO_SHOT		60 
#define PC_SNIPER_INITAMMO_NAIL		50 
#define PC_SNIPER_INITAMMO_CELL		0 
#define PC_SNIPER_INITAMMO_ROCKET		0 
#define PC_SNIPER_GRENADE_TYPE_1		GR_TYPE_CALTROP
#define PC_SNIPER_GRENADE_TYPE_2		GR_TYPE_FLARE //- OfN it was GR_TYPE_FLASH 
#define PC_SNIPER_GRENADE_INIT_1		4 	 
#define PC_SNIPER_GRENADE_INIT_2		6 // OfN it was 4
#define PC_SNIPER_TF_ITEMS			NIT_SECURITY_CAMERA // | NIT_TESLA 
#define PC_SNIPER_CUTF_ITEMS        0 // CUTF_OTR
#define PC_SNIPER_JOB				JOB_JUDOKA

// Class Details for SOLDIER
#define PC_SOLDIER_SKIN				6 			
#define PC_SOLDIER_MAXHEALTH			100	 
#define PC_SOLDIER_MAXSPEED			250 		
#define PC_SOLDIER_MAXSTRAFESPEED		250 
#define PC_SOLDIER_MAXARMOR			200 
#define PC_SOLDIER_INITARMOR			100 
#define PC_SOLDIER_MAXARMORTYPE		0.8 
#define PC_SOLDIER_INITARMORTYPE		0.8 
#define PC_SOLDIER_ARMORCLASSES		31 		// ALL
#define PC_SOLDIER_INITARMORCLASS		0 
#define PC_SOLDIER_WEAPONS		 	WEAP_AXE | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN | WEAP_ROCKET_LAUNCHER
#define PC_SOLDIER_MAXAMMO_SHOT		100 
#define PC_SOLDIER_MAXAMMO_NAIL		100 
#define PC_SOLDIER_MAXAMMO_CELL		50 
#define PC_SOLDIER_MAXAMMO_ROCKET		40 
#define PC_SOLDIER_INITAMMO_SHOT		50 
#define PC_SOLDIER_INITAMMO_NAIL		0 
#define PC_SOLDIER_INITAMMO_CELL		0 
#define PC_SOLDIER_INITAMMO_ROCKET		20 
#define PC_SOLDIER_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_SOLDIER_GRENADE_TYPE_2		GR_TYPE_NAIL
#define PC_SOLDIER_GRENADE_INIT_1		4 	 
#define PC_SOLDIER_GRENADE_INIT_2		2 	 
#define PC_SOLDIER_TF_ITEMS			0 //NIT_RL_LASER_SIGHT //WK no Cluster - OfN no hover boots
#define PC_SOLDIER_JOB				JOB_ARMY //JOB_RUNNER

// Class Details for DEMOLITION MAN
#define PC_DEMOMAN_SKIN				1 
#define PC_DEMOMAN_MAXHEALTH			100 
#define PC_DEMOMAN_MAXSPEED			290 		
#define PC_DEMOMAN_MAXSTRAFESPEED		290 
#define PC_DEMOMAN_MAXARMOR			100 
#define PC_DEMOMAN_INITARMOR			50 
#define PC_DEMOMAN_MAXARMORTYPE		0.6 
#define PC_DEMOMAN_INITARMORTYPE		0.6 
#define PC_DEMOMAN_ARMORCLASSES		31 		// ALL
#define PC_DEMOMAN_INITARMORCLASS		0 		// AT_SAVEEXPLOSION 
#define PC_DEMOMAN_WEAPONS			WEAP_AXE | WEAP_SHOTGUN | WEAP_GRENADE_LAUNCHER
#define PC_DEMOMAN_MAXAMMO_SHOT		75 
#define PC_DEMOMAN_MAXAMMO_NAIL		50 
#define PC_DEMOMAN_MAXAMMO_CELL		50 
#define PC_DEMOMAN_MAXAMMO_ROCKET		50 
#define PC_DEMOMAN_MAXAMMO_DETPACK		2 
#define PC_DEMOMAN_INITAMMO_SHOT		30 
#define PC_DEMOMAN_INITAMMO_NAIL		0 
#define PC_DEMOMAN_INITAMMO_CELL		0 
#define PC_DEMOMAN_INITAMMO_ROCKET		20 
#define PC_DEMOMAN_INITAMMO_DETPACK		1 
#define PC_DEMOMAN_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_DEMOMAN_GRENADE_TYPE_2		GR_TYPE_MIRV
#define PC_DEMOMAN_GRENADE_INIT_1		5 	 
#define PC_DEMOMAN_GRENADE_INIT_2		2 	 
#define PC_DEMOMAN_TF_ITEMS			NIT_AMMO_BANDOLIER 
#define PC_DEMOMAN_JOB				JOB_GUERILLA
#define PC_DEMOMAN_CUTFITEMS		CUTF_DETPACK | CUTF_TOSSABLEDET

// Class Details for COMBAT MEDIC
#define PC_MEDIC_SKIN				3 
#define PC_MEDIC_MAXHEALTH			90 
#define PC_MEDIC_MAXSPEED			340 
#define PC_MEDIC_MAXSTRAFESPEED		340 
#define PC_MEDIC_MAXARMOR			100
#define PC_MEDIC_INITARMOR			50 
#define PC_MEDIC_MAXARMORTYPE			0.6 
#define PC_MEDIC_INITARMORTYPE		0.3 
#define PC_MEDIC_ARMORCLASSES			11 		// ALL except EXPLOSION
#define PC_MEDIC_INITARMORCLASS		0 
#define PC_MEDIC_WEAPONS			WEAP_MEDIKIT | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN | WEAP_LIGHT_ASSAULT
#define PC_MEDIC_MAXAMMO_SHOT			75 
#define PC_MEDIC_MAXAMMO_NAIL			150 
#define PC_MEDIC_MAXAMMO_CELL			50 
#define PC_MEDIC_MAXAMMO_ROCKET		25 
#define PC_MEDIC_MAXAMMO_MEDIKIT		100 
#define PC_MEDIC_INITAMMO_SHOT		50 
#define PC_MEDIC_INITAMMO_NAIL		50 
#define PC_MEDIC_INITAMMO_CELL		0 
#define PC_MEDIC_INITAMMO_ROCKET		0 
#define PC_MEDIC_INITAMMO_MEDIKIT		50 
#define PC_MEDIC_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_MEDIC_GRENADE_TYPE_2		GR_TYPE_BIO  //GR_TYPE_CONCUSSION
#define PC_MEDIC_GRENADE_INIT_1		3 	 
#define PC_MEDIC_GRENADE_INIT_2		2 	 
#define PC_MEDIC_TF_ITEMS			0 //NIT_AUTOMEDIC // SB no more automedic - OfN no way! :)
#define PC_MEDIC_REGEN_TIME			3   // Number of seconds between each regen.
#define PC_MEDIC_REGEN_AMOUNT		6   // Amount of health regenerated each regen.
#define PC_MEDIC_JOB				JOB_CRUSADER

// Class Details for HVYWEAP
#define PC_HVYWEAP_SKIN				2 
#define PC_HVYWEAP_MAXHEALTH			100 
#define PC_HVYWEAP_MAXSPEED			250 		
#define PC_HVYWEAP_MAXSTRAFESPEED		250 
#define PC_HVYWEAP_MAXARMOR			300 
#define PC_HVYWEAP_INITARMOR			300 
#define PC_HVYWEAP_MAXARMORTYPE		0.8 
#define PC_HVYWEAP_INITARMORTYPE		0.8 
#define PC_HVYWEAP_ARMORCLASSES		31 			// ALL
#define PC_HVYWEAP_INITARMORCLASS		0 		
#define PC_HVYWEAP_WEAPONS			WEAP_ASSAULT_CANNON | WEAP_AXE | WEAP_SHOTGUN | WEAP_SUPER_SHOTGUN
#define PC_HVYWEAP_MAXAMMO_SHOT		200 
#define PC_HVYWEAP_MAXAMMO_NAIL		200 
#define PC_HVYWEAP_MAXAMMO_CELL		50 
#define PC_HVYWEAP_MAXAMMO_ROCKET		25 
#define PC_HVYWEAP_INITAMMO_SHOT		200 
#define PC_HVYWEAP_INITAMMO_NAIL		0 
#define PC_HVYWEAP_INITAMMO_CELL		24 
#define PC_HVYWEAP_INITAMMO_ROCKET		0 
#define PC_HVYWEAP_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_HVYWEAP_GRENADE_TYPE_2		GR_TYPE_MIRV
#define PC_HVYWEAP_GRENADE_INIT_1		5 	 
#define PC_HVYWEAP_GRENADE_INIT_2		2 	 
#define PC_HVYWEAP_TF_ITEMS			NIT_AMMO_BANDOLIER 
#define PC_HVYWEAP_JOB				JOB_RUNNER


// Class Details for PYRO
#define PC_PYRO_SKIN				21 
#define PC_PYRO_MAXHEALTH			100 
#define PC_PYRO_MAXSPEED			290 
#define PC_PYRO_MAXSTRAFESPEED		290 
#define PC_PYRO_MAXARMOR			150 
#define PC_PYRO_INITARMOR			50 
#define PC_PYRO_MAXARMORTYPE		0.6 
#define PC_PYRO_INITARMORTYPE		0.6 
#define PC_PYRO_ARMORCLASSES		27 		// ALL except EXPLOSION
#define PC_PYRO_INITARMORCLASS		16  	// AT_SAVEFIRE
#define PC_PYRO_WEAPONS				WEAP_INCENDIARY | WEAP_FLAMETHROWER | WEAP_AXE | WEAP_SHOTGUN
#define PC_PYRO_MAXAMMO_SHOT		40 
#define PC_PYRO_MAXAMMO_NAIL		50 
#define PC_PYRO_MAXAMMO_CELL		200 
#define PC_PYRO_MAXAMMO_ROCKET		60 
#define PC_PYRO_INITAMMO_SHOT		20 
#define PC_PYRO_INITAMMO_NAIL		0 
#define PC_PYRO_INITAMMO_CELL		120 
#define PC_PYRO_INITAMMO_ROCKET		24 
#define PC_PYRO_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_PYRO_GRENADE_TYPE_2		GR_TYPE_NAPALM
#define PC_PYRO_GRENADE_INIT_1		4 	 
#define PC_PYRO_GRENADE_INIT_2		4 	 
#define PC_PYRO_TF_ITEMS			NIT_HOVER_BOOTS | NIT_HOVER_BOOTS_UPGRADE // OfN why this = NIT_HOVER_BOOTS || NIT_HOVER_BOOTS_UPGRADE ??
#define PC_PYRO_JOB				    JOB_THIEF

// Class Details for SPY
#define PC_SPY_SKIN				    22 
#define PC_SPY_MAXHEALTH			90 
#define PC_SPY_MAXSPEED				320 
#define PC_SPY_MAXSTRAFESPEED		320 
#define PC_SPY_MAXARMOR				100 
#define PC_SPY_INITARMOR			50 
#define PC_SPY_MAXARMORTYPE			0.6
#define PC_SPY_INITARMORTYPE		0.6 
#define PC_SPY_ARMORCLASSES			27 		// ALL except EXPLOSION
#define PC_SPY_INITARMORCLASS		0  
#define PC_SPY_WEAPONS				WEAP_AXE | WEAP_TRANQ | WEAP_SUPER_SHOTGUN | WEAP_NAILGUN
#define PC_SPY_MAXAMMO_SHOT			40 
#define PC_SPY_MAXAMMO_NAIL			50 
#define PC_SPY_MAXAMMO_CELL			200 
#define PC_SPY_MAXAMMO_ROCKET		15 
#define PC_SPY_INITAMMO_SHOT		40 
#define PC_SPY_INITAMMO_NAIL		0 
#define PC_SPY_INITAMMO_CELL		100
#define PC_SPY_INITAMMO_ROCKET		0 
#define PC_SPY_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_SPY_GRENADE_TYPE_2		GR_TYPE_GAS
#define PC_SPY_GRENADE_INIT_1		4 	 
#define PC_SPY_GRENADE_INIT_2		2 	 
#define PC_SPY_TF_ITEMS				NIT_SECURITY_CAMERA | NIT_TELEPORTER
#define PC_SPY_CELL_REGEN_TIME		0.05
#define PC_SPY_CELL_REGEN_AMOUNT	10
#define PC_SPY_CELL_USAGE			25	// Amount of cells spent while invisible
#define PC_SPY_GO_UNDERCOVER_TIME	4	// Time it takes to go undercover
#define PC_SPY_JOB				    JOB_HACKER // OfN - It was JOB_WARLOCK
#define PC_SPY_CUTFITEMS			CUTF_SPY_KIT | CUTF_KNIFE

// Class Details for ENGINEER
#define PC_ENGINEER_SKIN			22 		// Not used anymore
#define PC_ENGINEER_MAXHEALTH			100 
#define PC_ENGINEER_MAXSPEED			290 
#define PC_ENGINEER_MAXSTRAFESPEED		290 
#define PC_ENGINEER_MAXARMOR			75
#define PC_ENGINEER_INITARMOR			75 
#define PC_ENGINEER_MAXARMORTYPE		0.6 
#define PC_ENGINEER_INITARMORTYPE		0.3 
#define PC_ENGINEER_ARMORCLASSES		31 		// ALL
#define PC_ENGINEER_INITARMORCLASS		0  
#define PC_ENGINEER_WEAPONS			WEAP_SPANNER | WEAP_LASER | WEAP_SUPER_SHOTGUN
#define PC_ENGINEER_MAXAMMO_SHOT		75
#define PC_ENGINEER_MAXAMMO_NAIL		50 
#define PC_ENGINEER_MAXAMMO_CELL		320		// synonymous with metal 
#define PC_ENGINEER_MAXAMMO_ROCKET		30 
#define PC_ENGINEER_INITAMMO_SHOT		30 
#define PC_ENGINEER_INITAMMO_NAIL		25 
#define PC_ENGINEER_INITAMMO_CELL		200 	// synonymous with metal 
#define PC_ENGINEER_INITAMMO_ROCKET		0 
#define PC_ENGINEER_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_ENGINEER_GRENADE_TYPE_2		GR_TYPE_EMP
#define PC_ENGINEER_GRENADE_INIT_1		4 	 
#define PC_ENGINEER_GRENADE_INIT_2		3
#define PC_ENGINEER_TF_ITEMS			NIT_TESLA | NIT_SECURITY_CAMERA | NIT_TELEPORTER
#define PC_ENGINEER_CUTFITEMS			CUTF_SENTRYGUN | CUTF_DISPENSER | CUTF_SENSOR | CUTF_FIELDGEN
#define PC_ENGINEER_JOB				    JOB_HACKER //JOB_JUDOKA

// Class Details for CIVILIAN
#define PC_CIVILIAN_SKIN			22 
#define PC_CIVILIAN_MAXHEALTH			90
#define PC_CIVILIAN_MAXSPEED			290
#define PC_CIVILIAN_MAXSTRAFESPEED		290
#define PC_CIVILIAN_MAXARMOR			75
#define PC_CIVILIAN_INITARMOR			75 
#define PC_CIVILIAN_MAXARMORTYPE		0.3
#define PC_CIVILIAN_INITARMORTYPE		0.3
#define PC_CIVILIAN_ARMORCLASSES		0 		
#define PC_CIVILIAN_INITARMORCLASS		0
#define PC_CIVILIAN_WEAPONS			    WEAP_AXE | WEAP_SUPER_SHOTGUN | WEAP_SHOTGUN
#define PC_CIVILIAN_MAXAMMO_SHOT		50
#define PC_CIVILIAN_MAXAMMO_NAIL		0 
#define PC_CIVILIAN_MAXAMMO_CELL		0 
#define PC_CIVILIAN_MAXAMMO_ROCKET		0 
#define PC_CIVILIAN_INITAMMO_SHOT		30 
#define PC_CIVILIAN_INITAMMO_NAIL		0 
#define PC_CIVILIAN_INITAMMO_CELL		0 
#define PC_CIVILIAN_INITAMMO_ROCKET		0 
#define PC_CIVILIAN_GRENADE_TYPE_1		GR_TYPE_NORMAL
#define PC_CIVILIAN_GRENADE_TYPE_2		0
#define PC_CIVILIAN_GRENADE_INIT_1		2 	 
#define PC_CIVILIAN_GRENADE_INIT_2		0 	 
#define PC_CIVILIAN_TF_ITEMS			0 
#define PC_CIVILIAN_JOB				JOB_THIEF
#define PC_CIVILIAN_CUTFITEMS			CUTF_KNIFE


/*==========================================================================*/
/* TEAMFORTRESS GOALS														*/
/*==========================================================================*/
// For all these defines, see the tfortmap.txt that came with the zip
// for complete descriptions.
// Defines for Goal Activation types : goal_activation (in goals)
#define TFGA_TOUCH			1  // Activated when touched
#define TFGA_TOUCH_DETPACK	2  // Activated when touched by a detpack explosion
#define TFGA_REVERSE_AP		4  // Activated when AP details are _not_ met
#define TFGA_SPANNER		8  // Activated when hit by an engineer's spanner

// Defines for Goal Effects types : goal_effect
#define TFGE_AP				1   // AP is affected. Default.
#define TFGE_AP_TEAM		  	2   // All of the AP's team.
#define TFGE_NOT_AP_TEAM	  	4   // All except AP's team.
#define TFGE_NOT_AP			8   // All except AP.
#define TFGE_WALL			  	16  // If set, walls stop the Radius effects
#define TFGE_SAME_ENVIRONMENT 	32  // If set, players in a different environment to the Goal are not affected
#define TFGE_TIMER_CHECK_AP	  	64  // If set, Timer Goals check their critera for all players fitting their effects
#define TFGE_CAUSE_EXPLOSION		128 //CH if set spawn explosion and use t_length

// Defines for Goal Result types : goal_result
#define TFGR_SINGLE		1	// Goal can only be activated once
#define TFGR_ADD_BONUSES	2	// Any Goals activated by this one give their bonuses
#define TFGR_ENDGAME		4	// Goal fires Intermission, displays scores, and ends level
#define TFGR_NO_ITEM_RESULTS	8	// GoalItems given by this Goal don't do results
#define TFGR_REMOVE_DISGUISE	16	// Prevent/Remove undercover from any Spy
#define TFGR_CAUSERESPAWN	32	//CH force respawn, not die

// Defines for Goal Group Result types : goal_group
// None!
// But I'm leaving this variable in there, since it's fairly likely
// that some will show up sometime.

// Defines for Goal Item types, : goal_activation (in items)
#define TFGI_GLOW			1    // Players carrying this GoalItem will glow
#define TFGI_SLOW			2    // Players carrying this GoalItem will move at half-speed
#define TFGI_DROP			4    // Players dying with this item will drop it
#define TFGI_RETURN_DROP	8    // Return if a player with it dies
#define TFGI_RETURN_GOAL	16   // Return if a player with it has it removed by a goal's activation
#define TFGI_RETURN_REMOVE	32   // Return if it is removed by TFGI_REMOVE
#define TFGI_REVERSE_AP		64   // Only pickup if the player _doesn't_ match AP Details
#define TFGI_REMOVE		128  // Remove if left untouched for 2 minutes after being dropped
#define TFGI_KEEP			256  // Players keep this item even when they die
#define TFGI_ITEMGLOWS		512  // Item glows when on the ground
#define TFGI_DONTREMOVERES	1024 // Don't remove results when the item is removed
#define TFGI_GOAL_TO_GROUND	2048 //CH GoalItem drops to ground when spawns
#define TFGI_DROPITEMS		4096 //GR TF docs mislabel this as being in goal_results, ha ha!
#define TFGI_GOAL_IS_SOLID	8192 //CH GoalItem is solid

// Defines for TeamSpawnpoints : goal_activation (in teamspawns)
#define TFSP_MULTIPLEITEMS	1  // Give out the GoalItem multiple times
#define TFSP_MULTIPLEMSGS	2  // Display the message multiple times

// Defines for TeamSpawnpoints : goal_effects (in teamspawns)
#define TFSP_REMOVESELF		1  // Remove itself after being spawned on

// Defines for Goal States
#define TFGS_ACTIVE		1 
#define TFGS_INACTIVE	2 
#define TFGS_REMOVED	3 
#define TFGS_DELAYED	4


// Legal Playerclass Handling
#define TF_ILL_SCOUT 		1
#define TF_ILL_SNIPER		2
#define TF_ILL_SOLDIER		4
#define TF_ILL_DEMOMAN		8
#define TF_ILL_MEDIC		16
#define TF_ILL_HVYWEP		32
#define TF_ILL_PYRO			64
#define TF_ILL_RANDOMPC		128
#define TF_ILL_SPY			256
#define TF_ILL_ENGINEER		512
	   
/*==========================================================================*/
/* Flamethrower																*/
/*==========================================================================*/

#define FLAME_PLYRMAXTIME	45  // lifetime in 0.1 sec of a flame on a player
#define FLAME_MAXBURNTIME	8  	// lifetime in seconds of a flame on the world (big ones)
#define NAPALM_MAXBURNTIME	20 	// lifetime in seconds of flame from a napalm grenade
#define FLAME_MAXPLYRFLAMES	4 	// maximum number of flames on a player
#define FLAME_NUMLIGHTS		1 	// maximum number of light flame 
#define FLAME_BURNRATIO		0.3 // the chance of a flame not 'sticking'
#define GR_TYPE_FLAMES_NO	15 	// number of flames spawned when a grenade explode

/*==================================================*/
/* CTF Support defines 								*/
/*==================================================*/
#define CTF_FLAG1 		1
#define CTF_FLAG2 		2
#define CTF_DROPOFF1 	3
#define CTF_DROPOFF2 	4
#define CTF_SCORE1   	5
#define CTF_SCORE2   	6


/*==================================================*/
/* Death Message defines							*/
/*==================================================*/

#define DMSG_SHOTGUN			1
#define DMSG_SSHOTGUN			2
#define DMSG_NAILGUN			3
#define DMSG_LIGHT_ASSAULT		4
#define DMSG_GRENADEL			5
#define DMSG_ROCKETL			6
#define DMSG_LIGHTNING			7
#define DMSG_GREN_HAND			8
#define DMSG_GREN_NAIL			9
#define DMSG_GREN_MIRV			10
#define DMSG_GREN_PIPE			11
#define DMSG_DETPACK			12
#define DMSG_BIOWEAPON			13
#define DMSG_BIOWEAPON_ATT		14
#define DMSG_FLAME				15
#define DMSG_DETPACK_DIS		16
#define DMSG_AXE				17
#define DMSG_SNIPERRIFLE		18
#define DMSG_AUTORIFLE			19
#define DMSG_ASSAULTCANNON		20
#define DMSG_HOOK				21
#define DMSG_BACKSTAB			22
#define DMSG_MEDIKIT			23
#define DMSG_GREN_GAS			24
#define DMSG_TRANQ			    25
#define DMSG_LASERBOLT			26
#define DMSG_SENTRYGUN_BULLET 	27
#define DMSG_SNIPERLEGSHOT		28
#define DMSG_SNIPERHEADSHOT		29
#define DMSG_GREN_EMP			30
#define DMSG_GREN_EMP_AMMO		31
#define DMSG_SPANNER			32
#define DMSG_INCENDIARY			33
#define DMSG_SENTRYGUN_ROCKET	34
#define DMSG_GREN_FLASH			35
#define DMSG_TRIGGER			36
#define DMSG_BUG_ZAPPER			37
#define DMSG_GREN_FRAG			38
#define DMSG_JUDOKA				39
#define DMSG_MARTYR				40
#define DMSG_HOVER				41 //Boot exhaust!
#define DMSG_LAND_MINE			42
#define DMSG_GREN_EMP_RADIUS		43
#define DMSG_DEMON_FIRE			44
#define DMSG_BERSERK			45
#define DMSG_MAUSER				50
#define DMSG_DAEDALUS			51

#define DMSG_EXPBODY			52 //- OfN -
#define DMSG_ANTIHACK			53
#define DMSG_ANTIDISM			54
#define DMSG_CYBERNET			55
#define DMSG_AIRG	            56
#define DMSG_AIRG_WATER         57
#define DMSG_LASERCANNON        58
#define DMSG_DISPEL             59
#define DMSG_CALTROP            60
#define DMSG_CLUSTER_ROCKET     61
#define DMSG_FLYCALTROP         62
#define DMSG_SNG                63
#define DMSG_FORCEFIELD         64
#define DMSG_STUCK_FORCEFIELD   65
#define DMSG_SPANNERFIELD       66
#define DMSG_FGTRAP             67
#define DMSG_FF_HACKED			68
#define DMSG_FF_STUCK_HACKED	69
#define DMSG_PHYSICS		70
#define DMSG_OUTOFBOUNDS	71

//Defs for objects a spikeshooter can spawn  Misc.qc
#define SPAWNFLAG_SUPERSPIKE	1 
#define SPAWNFLAG_LASER		2 
//CH add new things a trap can spawn
#define SPAWNFLAG_TFROCKET	4
#define SPAWNFLAG_TFGRENADE	8
#define SPAWNFLAG_TFFLAME	16

// OfN - Crusader auras
#define AURA_POWER		1
#define AURA_RESISTANCE	2
#define AURA_HASTE		3
#define AURA_INVIS		4

#ifdef DEBUG
# define RPrint Real_RPrint
#else
# define RPrint(...)
# define dremove remove
# define printtrace(...)
#endif

#include "ofndefs.qh"

#define AVG(a,b) (((a) + (b)) * 0.5)
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define BOUND(a,b,c) (MAX((a), MIN((b), (c))))
#define ASSERT(a) do {if (!(a)) error (__FILE__ + ":" + itos(__LINE__) + ": Assert failed: " + #a);} while (0)
#define SIGN_i(a) (((a) < 0) ? -1 : +1)
#define SIGN_f(a) (((a) < 0) ? -1.0 : +1.0)
#define printf(...) do {RPrint (sprintf (__VA_ARGS__));} while (0)