1 /*
2 ===========================================================================
3 Copyright (C) 1999 - 2005, Id Software, Inc.
4 Copyright (C) 2000 - 2013, Raven Software, Inc.
5 Copyright (C) 2001 - 2013, Activision, Inc.
6 Copyright (C) 2013 - 2015, OpenJK contributors
7 
8 This file is part of the OpenJK source code.
9 
10 OpenJK is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License version 2 as
12 published by the Free Software Foundation.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 ===========================================================================
22 */
23 
24 #ifndef __BG_PUBLIC_H__
25 #define __BG_PUBLIC_H__
26 // bg_public.h -- definitions shared by both the server game and client game modules
27 #include "weapons.h"
28 #include "g_items.h"
29 #include "teams.h"
30 #include "statindex.h"
31 
32 #define	DEFAULT_GRAVITY		800
33 #define	GIB_HEALTH			-40
34 #define	ARMOR_PROTECTION	0.40
35 
36 #define	MAX_ITEMS			256
37 
38 #define	RANK_TIED_FLAG		0x4000
39 
40 #define DEFAULT_SHOTGUN_SPREAD	700
41 #define DEFAULT_SHOTGUN_COUNT	11
42 
43 #define	ITEM_RADIUS			15		// item sizes are needed for client side pickup detection
44 
45 //Player sizes
46 extern float DEFAULT_MINS_0;
47 extern float DEFAULT_MINS_1;
48 extern float DEFAULT_MAXS_0;
49 extern float DEFAULT_MAXS_1;
50 extern float DEFAULT_PLAYER_RADIUS;
51 #define DEFAULT_MINS_2		-24
52 #define DEFAULT_MAXS_2		40// was 32, but too short for player
53 #define CROUCH_MAXS_2		16
54 
55 #define ATST_MINS0			-40
56 #define ATST_MINS1			-40
57 #define ATST_MINS2			-24
58 #define ATST_MAXS0			40
59 #define ATST_MAXS1			40
60 #define ATST_MAXS2			248
61 
62 //Player viewheights
63 #define	STANDARD_VIEWHEIGHT_OFFSET -4
64 //#define	RAVEN_VIEWHEIGHT_ADJ 2
65 //#define	DEFAULT_VIEWHEIGHT	(26+RAVEN_VIEWHEIGHT_ADJ)
66 //#define CROUCH_VIEWHEIGHT	12
67 #define	DEAD_VIEWHEIGHT		-16
68 //Player movement values
69 #define	MIN_WALK_NORMAL		0.7		// can't walk on very steep slopes
70 #define	JUMP_VELOCITY		225		// 270
71 #define	STEPSIZE			18
72 
73 
74 
75 /*
76 ===================================================================================
77 
78 PMOVE MODULE
79 
80 The pmove code takes a player_state_t and a usercmd_t and generates a new player_state_t
81 and some other output data.  Used for local prediction on the client game and true
82 movement on the server game.
83 ===================================================================================
84 */
85 
86 typedef enum {
87 	PM_NORMAL,		// can accelerate and turn
88 	PM_NOCLIP,		// noclip movement
89 	PM_SPECTATOR,	// still run into walls
90 	PM_DEAD,		// no acceleration or turning, but free falling
91 	PM_FREEZE,		// stuck in place with no control
92 	PM_INTERMISSION	// no movement or status bar
93 } pmtype_t;
94 
95 typedef enum {
96 	WEAPON_READY,
97 	WEAPON_RAISING,
98 	WEAPON_DROPPING,
99 	WEAPON_FIRING,
100 	WEAPON_CHARGING,
101 	WEAPON_CHARGING_ALT,
102 	WEAPON_IDLE, //lowered
103 } weaponstate_t;
104 
105 // pmove->pm_flags
106 #define	PMF_DUCKED			1
107 #define	PMF_JUMP_HELD		2
108 #define	PMF_JUMPING			4		// yes, I really am in a jump -- Mike, you may want to come up with something better here since this is really a temp fix.
109 #define	PMF_BACKWARDS_JUMP	8		// go into backwards land
110 #define	PMF_BACKWARDS_RUN	16		// coast down to backwards run
111 #define	PMF_TIME_LAND		32		// pm_time is time before rejump
112 #define	PMF_TIME_KNOCKBACK	64		// pm_time is an air-accelerate only time
113 #define	PMF_TIME_NOFRICTION	128		// pm_time is a no-friction time
114 //#define	PMF_BLOCKED			128		// Bumped into something you can't step up - NOTHING WAS EVER CHECKING THIS
115 #define	PMF_TIME_WATERJUMP	256		// pm_time is waterjump
116 #define	PMF_RESPAWNED		512		// clear after attack and jump buttons come up
117 #define	PMF_USE_FORCE		1024	// for debouncing the button
118 #define PMF_JUMP_DUCKED		2048	// viewheight changes in mid-air
119 #define PMF_TRIGGER_PUSHED	4096	// pushed by a trigger_push or other such thing - cannot force jump and will not take impact damage
120 //#define PMF_FOLLOW			4096	// spectate following another player
121 #define PMF_SCOREBOARD		8192	// spectate as a scoreboard
122 //#define	PMF_BUMPED			16384	// Bumped into something and slid to the side - NOTHING WAS EVER CHECKING THIS
123 #define PMF_SLOW_MO_FALL	16384	// Fall slower until hit ground
124 #define	PMF_ATTACK_HELD		32768	// Holding down the attack button
125 #define	PMF_ALT_ATTACK_HELD	65536	// Holding down the alt-attack button
126 
127 #define	PMF_ALL_TIMES	(PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION)
128 
129 #define	MAXTOUCH	32
130 typedef struct gentity_s gentity_t;
131 typedef struct {
132 	// state (in / out)
133 	playerState_t	*ps;
134 
135 	// command (in)
136 	usercmd_t	cmd;
137 	int			tracemask;			// collide against these types of surfaces
138 	int			debugLevel;			// if set, diagnostic output will be printed
139 	qboolean	noFootsteps;		// if the game is setup for no footsteps by the server
140 
141 	// results (out)
142 	int			numtouch;
143 	int			touchents[MAXTOUCH];
144 
145 	int			useEvent;
146 
147 	vec3_t		mins, maxs;			// bounding box size
148 
149 	int			watertype;
150 	int			waterlevel;
151 
152 	float		xyspeed;
153 	gentity_s	*gent;				// Pointer to entity in g_entities[]
154 
155 	// callbacks to test the world
156 	// these will be different functions during game and cgame
157 	void		(*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
158 						const int passEntityNum, const int contentMask, const EG2_Collision eG2TraceType/* = (EG2_Collision)0*/, const int useLod/* = 0 */);
159 	int			(*pointcontents)( const vec3_t point, int passEntityNum );
160 } pmove_t;
161 
162 // if a full pmove isn't done on the client, you can just update the angles
163 void PM_UpdateViewAngles( playerState_t *ps, usercmd_t *cmd, gentity_t *gent );
164 void Pmove( pmove_t *pmove );
165 
166 
167 #define SETANIM_TORSO 1
168 #define SETANIM_LEGS  2
169 #define SETANIM_BOTH  (SETANIM_TORSO|SETANIM_LEGS)//3
170 
171 #define SETANIM_FLAG_NORMAL		0//Only set if timer is 0
172 #define SETANIM_FLAG_OVERRIDE	1//Override previous
173 #define SETANIM_FLAG_HOLD		2//Set the new timer
174 #define SETANIM_FLAG_RESTART	4//Allow restarting the anim if playing the same one (weapon fires)
175 #define SETANIM_FLAG_HOLDLESS	8//Set the new timer
176 
177 void PM_SetAnim(pmove_t	*pm,int setAnimParts,int anim,int setAnimFlags, int blendTime=100);
178 void PM_SetAnimFinal(int *torsoAnim,int *legsAnim,int type,int anim,int priority,int *torsoAnimTimer,int *legsAnimTimer,gentity_t *gent,int blendTime=100);
179 void PM_SetSaberMove(short newMove);
180 
181 //===================================================================================
182 
183 
184 // player_state->persistant[] indexes
185 // these fields are the only part of player_state that isn't
186 // cleared on respawn
187 //
188 //  NOTE!!! Even though this is an enum, the array that contains these uses #define MAX_PERSISTANT 16 in q_shared.h,
189 //		so be careful how many you add since it'll just overflow without telling you -slc
190 //
191 typedef enum {
192 	PERS_SCORE,						// !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!!
193 	PERS_HITS,						// total points damage inflicted so damage beeps can sound on change
194 	PERS_TEAM,
195 	PERS_SPAWN_COUNT,				// incremented every respawn
196 //	PERS_REWARD_COUNT,				// incremented for each reward sound
197 	PERS_ATTACKER,					// clientnum of last damage inflicter
198 	PERS_KILLED,					// count of the number of times you died
199 
200 	PERS_ACCURACY_SHOTS,			// scoreboard - number of player shots
201 	PERS_ACCURACY_HITS,				// scoreboard - number of player shots that hit an enemy
202 	PERS_ENEMIES_KILLED,			// scoreboard - number of enemies player killed
203 	PERS_TEAMMATES_KILLED			// scoreboard - number of teammates killed
204 } persEnum_t;
205 
206 
207 // entityState_t->eFlags
208 #define	EF_DEAD					0x00000001	// don't draw a foe marker over players with EF_DEAD
209 #define	EF_NPC					0x00000002	// An NPC
210 #define	EF_TELEPORT_BIT			0x00000004	// toggled every time the origin abruptly changes
211 #define	EF_SHADER_ANIM			0x00000008	// Animating shader (by s.frame)
212 #define	EF_BOUNCE				0x00000010	// for missiles
213 #define	EF_BOUNCE_HALF			0x00000020	// for missiles
214 #define EF_MISSILE_STICK		0x00000040	// missiles that stick to the wall.
215 #define	EF_NODRAW				0x00000080	// may have an event, but no model (unspawned items)
216 #define	EF_FIRING				0x00000100	// for lightning gun
217 #define EF_ALT_FIRING			0x00000200	// for alt-fires, mostly for lightning guns though
218 #define	EF_NO_TED				0x00000400	// won't show up on TED unless actively scan with tricorder
219 #define	EF_AUTO_SIZE			0x00000800	// CG_Ents will create the mins & max itself based on model bounds
220 #define	EF_BOUNCE_SHRAPNEL		0x00001000	// special shrapnel flag
221 #define	EF_CONNECTION			0x00002000	// draw a connection trouble sprite
222 #define EF_ANIM_ALLFAST			0x00004000	// automatically cycle through all frames at 10hz
223 #define EF_ANIM_ONCE			0x00008000	// cycle through all frames just once then stop
224 #define EF_PLANTED_CHARGE		0x00010000	// For detpack charge
225 #define EF_PROX_TRIP			0x00020000	// Proximity trip mine has been activated
226 #define EF_LOCKED_TO_WEAPON		0x00040000	// When we use an emplaced weapon, we turn this on to lock us to that weapon
227 //#define EF_use_me				0x00080000	// Not used
228 //#define EF_use_me				0x00100000	// Not used
229 //#define EF_use_me				0x00200000	// Not used
230 //#define EF_use_me				0x00400000	// Not used
231 //#define EF_use_me				0x00800000	// Not used
232 #define EF_IN_ATST				0x01000000	// Driving an ATST
233 #define EF_DISINTEGRATION		0x02000000	// Disruptor effect
234 //#define EF_use_me				0x04000000	// Not used
235 //#define EF_use_me				0x08000000	// Not used
236 #define EF_DISABLE_SHADER_ANIM	0x10000000	// Normally shader animation chugs along, but movers can force shader animation to be on frame 1
237 #define EF_FORCE_GRIPPED		0x20000000	// Force gripped effect
238 //#define EF_use_me				0x40000000	// Not used
239 #define EF_BLOCKED_MOVER		0x80000000	// for movers that are blocked - shared with previous
240 
241 typedef enum {
242 	PW_NONE,
243 	PW_QUAD,// This can go away
244 	PW_BATTLESUIT,
245 	PW_HASTE,// This can go away
246 	PW_CLOAKED,
247 	PW_UNCLOAKING,
248 	PW_DISRUPTION,
249 	PW_GALAK_SHIELD,
250 //	PW_WEAPON_OVERCHARGE,
251 	PW_SEEKER,
252 	PW_SHOCKED,//electricity effect
253 	PW_DISINT_2,//ghost
254 	PW_INVINCIBLE,
255 	PW_FORCE_PUSH,
256 
257 	PW_NUM_POWERUPS
258 } powerup_t;
259 
260 #define PW_REMOVE_AT_DEATH ((1<<PW_QUAD)|(1<<PW_BATTLESUIT)|(1<<PW_HASTE)|(1<<PW_CLOAKED)|(1<<PW_UNCLOAKING)|(1<<PW_UNCLOAKING)|(1<<PW_GALAK_SHIELD)|(1<<PW_DISINT_2)|(1<<PW_INVINCIBLE)|(1<<PW_SEEKER))
261 // entityState_t->event values
262 // entity events are for effects that take place relative
263 // to an existing entities origin.  Very network efficient.
264 
265 // two bits at the top of the entityState->event field
266 // will be incremented with each change in the event so
267 // that an identical event started twice in a row can
268 // be distinguished.  And off the value with ~EV_EVENT_BITS
269 // to retrieve the actual event number
270 #define	EV_EVENT_BIT1		0x00000100
271 #define	EV_EVENT_BIT2		0x00000200
272 #define	EV_EVENT_BITS		(EV_EVENT_BIT1|EV_EVENT_BIT2)
273 
274 typedef enum {
275 	EV_NONE,
276 
277 	EV_FOOTSTEP,
278 	EV_FOOTSTEP_METAL,
279 	EV_FOOTSPLASH,
280 	EV_FOOTWADE,
281 	EV_SWIM,
282 
283 	EV_STEP_4,
284 	EV_STEP_8,
285 	EV_STEP_12,
286 	EV_STEP_16,
287 
288 	EV_FALL_SHORT,
289 	EV_FALL_MEDIUM,
290 	EV_FALL_FAR,
291 
292 	EV_JUMP,
293 	EV_ROLL,
294 	EV_WATER_TOUCH,	// foot touches
295 	EV_WATER_LEAVE,	// foot leaves
296 	EV_WATER_UNDER,	// head touches
297 	EV_WATER_CLEAR,	// head leaves
298 	EV_WATER_GURP1,	// need air 1
299 	EV_WATER_GURP2,	// need air 2
300 	EV_WATER_DROWN,	// drowned
301 
302 	EV_ITEM_PICKUP,
303 
304 	EV_NOAMMO,
305 	EV_CHANGE_WEAPON,
306 	EV_FIRE_WEAPON,
307 	EV_ALT_FIRE,
308 	EV_POWERUP_SEEKER_FIRE,
309 	EV_POWERUP_BATTLESUIT,
310 	EV_USE,
311 
312 	EV_REPLICATOR,
313 
314 	EV_BATTERIES_CHARGED,
315 
316 	EV_GRENADE_BOUNCE,		// eventParm will be the soundindex
317 	EV_MISSILE_STICK,		// eventParm will be the soundindex
318 
319 	EV_BMODEL_SOUND,
320 	EV_GENERAL_SOUND,
321 	EV_GLOBAL_SOUND,		// no attenuation
322 
323 	EV_PLAY_EFFECT,
324 	EV_PLAY_MUZZLE_EFFECT,
325 
326 	EV_TARGET_BEAM_DRAW,
327 
328 	EV_DISRUPTOR_MAIN_SHOT,
329 	EV_DISRUPTOR_SNIPER_SHOT,
330 	EV_DISRUPTOR_SNIPER_MISS,
331 
332 	EV_DEMP2_ALT_IMPACT,
333 
334 	EV_PAIN,
335 	EV_DEATH1,
336 	EV_DEATH2,
337 	EV_DEATH3,
338 
339 	EV_MISSILE_HIT,
340 	EV_MISSILE_MISS,
341 
342 	EV_DISINTEGRATION,
343 
344 	EV_ANGER1,	//Say when acquire an enemy when didn't have one before
345 	EV_ANGER2,
346 	EV_ANGER3,
347 
348 	EV_VICTORY1,	//Say when killed an enemy
349 	EV_VICTORY2,
350 	EV_VICTORY3,
351 
352 	EV_CONFUSE1,	//Say when confused
353 	EV_CONFUSE2,
354 	EV_CONFUSE3,
355 
356 	EV_PUSHED1,		//Say when pushed
357 	EV_PUSHED2,
358 	EV_PUSHED3,
359 
360 	EV_CHOKE1,		//Say when choking
361 	EV_CHOKE2,
362 	EV_CHOKE3,
363 
364 	EV_FFWARN,		//ffire founds
365 	EV_FFTURN,
366 	//extra sounds for ST
367 	EV_CHASE1,
368 	EV_CHASE2,
369 	EV_CHASE3,
370 	EV_COVER1,
371 	EV_COVER2,
372 	EV_COVER3,
373 	EV_COVER4,
374 	EV_COVER5,
375 	EV_DETECTED1,
376 	EV_DETECTED2,
377 	EV_DETECTED3,
378 	EV_DETECTED4,
379 	EV_DETECTED5,
380 	EV_LOST1,
381 	EV_OUTFLANK1,
382 	EV_OUTFLANK2,
383 	EV_ESCAPING1,
384 	EV_ESCAPING2,
385 	EV_ESCAPING3,
386 	EV_GIVEUP1,
387 	EV_GIVEUP2,
388 	EV_GIVEUP3,
389 	EV_GIVEUP4,
390 	EV_LOOK1,
391 	EV_LOOK2,
392 	EV_SIGHT1,
393 	EV_SIGHT2,
394 	EV_SIGHT3,
395 	EV_SOUND1,
396 	EV_SOUND2,
397 	EV_SOUND3,
398 	EV_SUSPICIOUS1,
399 	EV_SUSPICIOUS2,
400 	EV_SUSPICIOUS3,
401 	EV_SUSPICIOUS4,
402 	EV_SUSPICIOUS5,
403 	//extra sounds for Jedi
404 	EV_COMBAT1,
405 	EV_COMBAT2,
406 	EV_COMBAT3,
407 	EV_JDETECTED1,
408 	EV_JDETECTED2,
409 	EV_JDETECTED3,
410 	EV_TAUNT1,
411 	EV_TAUNT2,
412 	EV_TAUNT3,
413 	EV_JCHASE1,
414 	EV_JCHASE2,
415 	EV_JCHASE3,
416 	EV_JLOST1,
417 	EV_JLOST2,
418 	EV_JLOST3,
419 	EV_DEFLECT1,
420 	EV_DEFLECT2,
421 	EV_DEFLECT3,
422 	EV_GLOAT1,
423 	EV_GLOAT2,
424 	EV_GLOAT3,
425 	EV_PUSHFAIL,
426 
427 	EV_USE_ITEM,
428 
429 	EV_USE_INV_BINOCULARS,
430 	EV_USE_INV_BACTA,
431 	EV_USE_INV_SEEKER,
432 	EV_USE_INV_LIGHTAMP_GOGGLES,
433 	EV_USE_INV_SENTRY,
434 
435 	EV_USE_FORCE,
436 
437 	EV_DRUGGED,		// hit by an interrogator
438 
439 	EV_DEBUG_LINE,
440 
441 	EV_NUM_ENTITY_EVENTS
442 } entity_event_t;
443 
444 class animation_t
445 {
446 public:
447 	int		firstFrame;
448 	int		numFrames;
449 	int		loopFrames;			// 0 to numFrames, -1 = no loop
450 	int		frameLerp;			// msec between frames
451 	int		initialLerp;		// msec to get to first frame
452 
453 
sg_export(ojk::SavedGameHelper & saved_game)454 	void sg_export(
455 		ojk::SavedGameHelper& saved_game) const
456 	{
457 		saved_game.write<int32_t>(firstFrame);
458 		saved_game.write<int32_t>(numFrames);
459 		saved_game.write<int32_t>(loopFrames);
460 		saved_game.write<int32_t>(frameLerp);
461 		saved_game.write<int32_t>(initialLerp);
462 	}
463 
sg_import(ojk::SavedGameHelper & saved_game)464 	void sg_import(
465 		ojk::SavedGameHelper& saved_game)
466 	{
467 		saved_game.read<int32_t>(firstFrame);
468 		saved_game.read<int32_t>(numFrames);
469 		saved_game.read<int32_t>(loopFrames);
470 		saved_game.read<int32_t>(frameLerp);
471 		saved_game.read<int32_t>(initialLerp);
472 	}
473 }; // animation_t
474 
475 #define	MAX_RANDOM_ANIMSOUNDS	8
476 
477 typedef struct animsounds_s
478 {
479 	int		keyFrame;			//Frame to play sound on
480 	int		soundIndex[MAX_RANDOM_ANIMSOUNDS];			//sound file to play - FIXME: should be an index, handle random some other way?
481 	int		numRandomAnimSounds;		//string variable min for va("...%d.wav", Q_irand(lowestVa, highestVa))
482 	int		probability;		//chance sound will play, zero value will not run this test (0 = 100% basically)
483 
484 
sg_exportanimsounds_s485 	void sg_export(
486 		ojk::SavedGameHelper& saved_game) const
487 	{
488 		saved_game.write<int32_t>(keyFrame);
489 		saved_game.write<int32_t>(soundIndex);
490 		saved_game.write<int32_t>(numRandomAnimSounds);
491 		saved_game.write<int32_t>(probability);
492 	}
493 
sg_importanimsounds_s494 	void sg_import(
495 		ojk::SavedGameHelper& saved_game)
496 	{
497 		saved_game.read<int32_t>(keyFrame);
498 		saved_game.read<int32_t>(soundIndex);
499 		saved_game.read<int32_t>(numRandomAnimSounds);
500 		saved_game.read<int32_t>(probability);
501 	}
502 } animsounds_t;
503 
504 // means of death
505 typedef enum {
506 
507 	MOD_UNKNOWN,
508 
509 // weapons
510 	MOD_SABER,
511 	MOD_BRYAR,
512 	MOD_BRYAR_ALT,
513 	MOD_BLASTER,
514 	MOD_BLASTER_ALT,
515 	MOD_DISRUPTOR,
516 	MOD_SNIPER,
517 	MOD_BOWCASTER,
518 	MOD_BOWCASTER_ALT,
519 	MOD_REPEATER,
520 	MOD_REPEATER_ALT,
521 	MOD_DEMP2,
522 	MOD_DEMP2_ALT,
523 	MOD_FLECHETTE,
524 	MOD_FLECHETTE_ALT,
525 	MOD_ROCKET,
526 	MOD_ROCKET_ALT,
527 	MOD_THERMAL,
528 	MOD_THERMAL_ALT,
529 	MOD_DETPACK,
530 	MOD_LASERTRIP,
531 	MOD_LASERTRIP_ALT,
532 	MOD_MELEE,
533 	MOD_SEEKER,
534 	MOD_FORCE_GRIP,
535 	MOD_EMPLACED,
536 
537 // world / generic
538 	MOD_ELECTROCUTE,
539 	MOD_EXPLOSIVE,
540 	MOD_EXPLOSIVE_SPLASH,
541 	MOD_KNOCKOUT,
542 	MOD_ENERGY,
543 	MOD_ENERGY_SPLASH,
544 	MOD_WATER,
545 	MOD_SLIME,
546 	MOD_LAVA,
547 	MOD_CRUSH,
548 	MOD_IMPACT,
549 	MOD_FALLING,
550 	MOD_SUICIDE,
551 	MOD_TRIGGER_HURT,
552 
553 	NUM_MODS,
554 
555 } meansOfDeath_t;
556 
557 
558 //---------------------------------------------------------
559 
560 // gitem_t->type
561 typedef enum
562 {
563 	IT_BAD,
564 	IT_WEAPON,
565 	IT_AMMO,
566 	IT_ARMOR,
567 	IT_HEALTH,
568 	IT_HOLDABLE,
569 	IT_BATTERY,
570 	IT_HOLOCRON,
571 
572 } itemType_t;
573 
574 
575 
576 typedef struct gitem_s {
577 	char		*classname;	// spawning name
578 	char		*pickup_sound;
579 	char		*world_model;
580 
581 	char		*icon;
582 
583 	int			quantity;		// for ammo how much, or duration of powerup
584 	itemType_t  giType;			// IT_* flags
585 
586 	int			giTag;
587 
588 	char		*precaches;		// string of all models and images this item will use
589 	char		*sounds;		// string of all sounds this item will use
590 	vec3_t		mins;			// Bbox
591 	vec3_t		maxs;			// Bbox
592 } gitem_t;
593 
594 // included in both the game dll and the client
595 extern	gitem_t	bg_itemlist[];
596 extern	const int		bg_numItems;
597 
598 
599 //==============================================================================
600 
601 /*
602 typedef struct ginfoitem_s
603 {
604 	char				*infoString;// Text message
605 	vec3_t				color;		// Text color
606 
607 } ginfoitem_t;
608 */
609 
610 //==============================================================================
611 
612 extern weaponData_t weaponData[WP_NUM_WEAPONS];
613 
614 //==============================================================================
615 extern ammoData_t ammoData[AMMO_MAX];
616 
617 //==============================================================================
618 
619 gitem_t	*FindItem( const char *className );
620 gitem_t	*FindItemForWeapon( weapon_t weapon );
621 gitem_t	*FindItemForInventory( int inv );
622 
623 #define	ITEM_INDEX(x) ((x)-bg_itemlist)
624 
625 qboolean	BG_CanItemBeGrabbed( const entityState_t *ent, const playerState_t *ps );
626 
627 
628 // content masks
629 #define	MASK_ALL				(-1)
630 #define	MASK_SOLID				(CONTENTS_SOLID)
631 #define	MASK_PLAYERSOLID		(CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY)
632 #define	MASK_NPCSOLID			(CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY)
633 #define	MASK_DEADSOLID			(CONTENTS_SOLID|CONTENTS_PLAYERCLIP)
634 #define	MASK_WATER				(CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
635 #define	MASK_OPAQUE				(CONTENTS_OPAQUE|CONTENTS_SLIME|CONTENTS_LAVA)//was CONTENTS_SOLID, not CONTENTS_OPAQUE...?
636 /*
637 Ghoul2 Insert Start
638 */
639 #define	MASK_SHOT				(CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE|CONTENTS_SHOTCLIP)
640 /*
641 Ghoul2 Insert End
642 */
643 
644 //
645 // entityState_t->eType
646 //
647 typedef enum {
648 	ET_GENERAL,
649 	ET_PLAYER,
650 	ET_ITEM,
651 	ET_MISSILE,
652 	ET_MOVER,
653 	ET_BEAM,
654 	ET_PORTAL,
655 	ET_SPEAKER,
656 	ET_PUSH_TRIGGER,
657 	ET_TELEPORT_TRIGGER,
658 	ET_INVISIBLE,
659 	ET_THINKER,
660 	ET_CLOUD, // dumb
661 
662 	ET_EVENTS				// any of the EV_* events can be added freestanding
663 							// by setting eType to ET_EVENTS + eventNum
664 							// this avoids having to set eFlags and eventNum
665 } entityType_t;
666 
667 
668 
669 void	EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
670 void	EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
671 
672 void AddEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps );
673 int	CurrentPlayerstateEvent( playerState_t *ps );
674 
675 void PlayerStateToEntityState( playerState_t *ps, entityState_t *s );
676 
677 qboolean	BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime );
678 
679 #endif//#ifndef __BG_PUBLIC_H__