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			128
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<<0)//1
107 #define	PMF_JUMP_HELD		(1<<1)//2
108 #define	PMF_JUMPING			(1<<2)//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	(1<<3)//8		// go into backwards land
110 #define	PMF_BACKWARDS_RUN	(1<<4)//16		// coast down to backwards run
111 #define	PMF_TIME_LAND		(1<<5)//32		// pm_time is time before rejump
112 #define	PMF_TIME_KNOCKBACK	(1<<6)//64		// pm_time is an air-accelerate only time
113 #define	PMF_TIME_NOFRICTION	(1<<7)//128		// pm_time is a no-friction time
114 #define	PMF_TIME_WATERJUMP	(1<<8)//256		// pm_time is waterjump
115 #define	PMF_RESPAWNED		(1<<9)//512		// clear after attack and jump buttons come up
116 #define	PMF_USEFORCE_HELD	(1<<10)//1024	// for debouncing the button
117 #define PMF_JUMP_DUCKED		(1<<11)//2048	// viewheight changes in mid-air
118 #define PMF_TRIGGER_PUSHED	(1<<12)//4096	// pushed by a trigger_push or other such thing - cannot force jump and will not take impact damage
119 #define PMF_STUCK_TO_WALL	(1<<13)//8192	// grabbing a wall
120 #define PMF_SLOW_MO_FALL	(1<<14)//16384	// Fall slower until hit ground
121 #define	PMF_ATTACK_HELD		(1<<15)//32768	// Holding down the attack button
122 #define	PMF_ALT_ATTACK_HELD	(1<<16)//65536	// Holding down the alt-attack button
123 #define PMF_BUMPED			(1<<17)//131072	// Bumped into something
124 #define PMF_FORCE_FOCUS_HELD	(1<<18)//262144	// Holding down the saberthrow/kick button
125 #define PMF_FIX_MINS		(1<<19)//524288	// Mins raised for dual forward jump, fix them
126 #define	PMF_ALL_TIMES	(PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION)
127 
128 #define	MAXTOUCH	32
129 typedef struct gentity_s gentity_t;
130 typedef struct {
131 	// state (in / out)
132 	playerState_t	*ps;
133 
134 	// command (in)
135 	usercmd_t	cmd;
136 	int			tracemask;			// collide against these types of surfaces
137 	int			debugLevel;			// if set, diagnostic output will be printed
138 	qboolean	noFootsteps;		// if the game is setup for no footsteps by the server
139 
140 	// results (out)
141 	int			numtouch;
142 	int			touchents[MAXTOUCH];
143 
144 	int			useEvent;
145 
146 	vec3_t		mins, maxs;			// bounding box size
147 
148 	int			watertype;
149 	int			waterlevel;
150 
151 	float		xyspeed;
152 	gentity_s	*gent;				// Pointer to entity in g_entities[]
153 
154 	// callbacks to test the world
155 	// these will be different functions during game and cgame
156 	void		(*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
157 						const int passEntityNum, const int contentMask, const EG2_Collision eG2TraceType, const int useLod );
158 	int			(*pointcontents)( const vec3_t point, int passEntityNum );
159 } pmove_t;
160 
161 // if a full pmove isn't done on the client, you can just update the angles
162 void PM_UpdateViewAngles( playerState_t *ps, usercmd_t *cmd, gentity_t *gent );
163 void Pmove( pmove_t *pmove );
164 
165 
166 #define SETANIM_TORSO 1
167 #define SETANIM_LEGS  2
168 #define SETANIM_BOTH  (SETANIM_TORSO|SETANIM_LEGS)//3
169 
170 #define SETANIM_FLAG_NORMAL		0//Only set if timer is 0
171 #define SETANIM_FLAG_OVERRIDE	1//Override previous
172 #define SETANIM_FLAG_HOLD		2//Set the new timer
173 #define SETANIM_FLAG_RESTART	4//Allow restarting the anim if playing the same one (weapon fires)
174 #define SETANIM_FLAG_HOLDLESS	8//Set the new timer
175 
176 #define SETANIM_BLEND_DEFAULT	100
177 
178 void PM_SetAnim(pmove_t	*pm,int setAnimParts,int anim,int setAnimFlags, int blendTime=SETANIM_BLEND_DEFAULT);
179 void PM_SetAnimFinal(int *torsoAnim,int *legsAnim,int type,int anim,int priority,int *torsoAnimTimer,int *legsAnimTimer,gentity_t *gent,int blendTime=SETANIM_BLEND_DEFAULT);
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_HELD_BY_SAND_CREATURE 0x00000001	// In a sand creature's mouth
209 #define	EF_HELD_BY_RANCOR		0x00000002	// Being held by Rancor
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_VEH_BOARDING			0x00000400	// Whether a vehicle is being boarded or not.
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_USE_ANGLEDELTA		0x00002000	// Not used.
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_HELD_BY_WAMPA		0x00010000	// being held by the Wampa
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 
228 //rest not sent over net?
229 
230 #define EF_PERMANENT			0x00080000	// this entity is permanent and is never updated (sent only in the game state)
231 #define EF_SPOTLIGHT			0x00100000	// Your lights are on...
232 #define EF_PLANTED_CHARGE		0x00200000	// For detpack charge
233 #define EF_POWERING_ROSH		0x00400000	// Only for Twins powering up Rosh
234 #define EF_FORCE_VISIBLE		0x00800000	// Always visible with force sight
235 #define EF_IN_ATST				0x01000000	// Driving an ATST
236 #define EF_DISINTEGRATION		0x02000000	// Disruptor effect
237 #define EF_LESS_ATTEN			0x04000000	// Use less sound attenuation (louder even when farther).
238 #define EF_JETPACK_ACTIVE		0x08000000	// Not used
239 #define EF_DISABLE_SHADER_ANIM	0x10000000	// Normally shader animation chugs along, but movers can force shader animation to be on frame 1
240 #define EF_FORCE_GRIPPED		0x20000000	// Force gripped effect
241 #define EF_FORCE_DRAINED		0x40000000	// Force drained effect
242 #define EF_BLOCKED_MOVER		0x80000000	// for movers that are blocked - shared with previous
243 
244 typedef enum {
245 	PW_NONE,
246 	PW_QUAD,// This can go away
247 	PW_BATTLESUIT,
248 	PW_HASTE,// This can go away
249 	PW_CLOAKED,
250 	PW_UNCLOAKING,
251 	PW_DISRUPTION,
252 	PW_GALAK_SHIELD,
253 //	PW_WEAPON_OVERCHARGE,
254 	PW_SEEKER,
255 	PW_SHOCKED,//electricity effect
256 	PW_DRAINED,//drain effect
257 	PW_DISINT_2,//ghost
258 	PW_INVINCIBLE,
259 	PW_FORCE_PUSH,
260 	PW_FORCE_PUSH_RHAND,
261 
262 	PW_NUM_POWERUPS
263 } powerup_t;
264 
265 #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))
266 // entityState_t->event values
267 // entity events are for effects that take place relative
268 // to an existing entities origin.  Very network efficient.
269 
270 // two bits at the top of the entityState->event field
271 // will be incremented with each change in the event so
272 // that an identical event started twice in a row can
273 // be distinguished.  And off the value with ~EV_EVENT_BITS
274 // to retrieve the actual event number
275 #define	EV_EVENT_BIT1		0x00000100
276 #define	EV_EVENT_BIT2		0x00000200
277 #define	EV_EVENT_BITS		(EV_EVENT_BIT1|EV_EVENT_BIT2)
278 
279 typedef enum {
280 	EV_NONE,
281 
282 	EV_FOOTSTEP,
283 	EV_FOOTSTEP_METAL,
284 	EV_FOOTSPLASH,
285 	EV_FOOTWADE,
286 	EV_SWIM,
287 
288 	EV_STEP_4,
289 	EV_STEP_8,
290 	EV_STEP_12,
291 	EV_STEP_16,
292 
293 	EV_FALL_SHORT,
294 	EV_FALL_MEDIUM,
295 	EV_FALL_FAR,
296 
297 	EV_JUMP,
298 	EV_ROLL,
299 	EV_WATER_TOUCH,	// foot touches
300 	EV_WATER_LEAVE,	// foot leaves
301 	EV_WATER_UNDER,	// head touches
302 	EV_WATER_CLEAR,	// head leaves
303 	EV_WATER_GURP1,	// need air 1
304 	EV_WATER_GURP2,	// need air 2
305 	EV_WATER_DROWN,	// drowned
306 	EV_LAVA_TOUCH,	// foot touches
307 	EV_LAVA_LEAVE,	// foot leaves
308 	EV_LAVA_UNDER,	// head touches
309 
310 	EV_ITEM_PICKUP,
311 
312 	EV_NOAMMO,
313 	EV_CHANGE_WEAPON,
314 	EV_FIRE_WEAPON,
315 	EV_ALT_FIRE,
316 	EV_POWERUP_SEEKER_FIRE,
317 	EV_POWERUP_BATTLESUIT,
318 	EV_USE,
319 
320 	EV_REPLICATOR,
321 
322 	EV_BATTERIES_CHARGED,
323 
324 	EV_GRENADE_BOUNCE,		// eventParm will be the soundindex
325 	EV_MISSILE_STICK,		// eventParm will be the soundindex
326 
327 	EV_BMODEL_SOUND,
328 	EV_GENERAL_SOUND,
329 	EV_GLOBAL_SOUND,		// no attenuation
330 
331 	EV_PLAY_EFFECT,
332 	EV_PLAY_MUZZLE_EFFECT,
333 	EV_STOP_EFFECT,
334 
335 	EV_TARGET_BEAM_DRAW,
336 
337 	EV_DISRUPTOR_MAIN_SHOT,
338 	EV_DISRUPTOR_SNIPER_SHOT,
339 	EV_DISRUPTOR_SNIPER_MISS,
340 
341 	EV_DEMP2_ALT_IMPACT,
342 //NEW for JKA weapons:
343 	EV_CONC_ALT_SHOT,
344 	EV_CONC_ALT_MISS,
345 //END JKA weapons
346 	EV_PAIN,
347 	EV_DEATH1,
348 	EV_DEATH2,
349 	EV_DEATH3,
350 
351 	EV_MISSILE_HIT,
352 	EV_MISSILE_MISS,
353 
354 	EV_DISINTEGRATION,
355 
356 	EV_ANGER1,	//Say when acquire an enemy when didn't have one before
357 	EV_ANGER2,
358 	EV_ANGER3,
359 
360 	EV_VICTORY1,	//Say when killed an enemy
361 	EV_VICTORY2,
362 	EV_VICTORY3,
363 
364 	EV_CONFUSE1,	//Say when confused
365 	EV_CONFUSE2,
366 	EV_CONFUSE3,
367 
368 	EV_PUSHED1,		//Say when pushed
369 	EV_PUSHED2,
370 	EV_PUSHED3,
371 
372 	EV_CHOKE1,		//Say when choking
373 	EV_CHOKE2,
374 	EV_CHOKE3,
375 
376 	EV_FFWARN,		//ffire founds
377 	EV_FFTURN,
378 	//extra sounds for ST
379 	EV_CHASE1,
380 	EV_CHASE2,
381 	EV_CHASE3,
382 	EV_COVER1,
383 	EV_COVER2,
384 	EV_COVER3,
385 	EV_COVER4,
386 	EV_COVER5,
387 	EV_DETECTED1,
388 	EV_DETECTED2,
389 	EV_DETECTED3,
390 	EV_DETECTED4,
391 	EV_DETECTED5,
392 	EV_LOST1,
393 	EV_OUTFLANK1,
394 	EV_OUTFLANK2,
395 	EV_ESCAPING1,
396 	EV_ESCAPING2,
397 	EV_ESCAPING3,
398 	EV_GIVEUP1,
399 	EV_GIVEUP2,
400 	EV_GIVEUP3,
401 	EV_GIVEUP4,
402 	EV_LOOK1,
403 	EV_LOOK2,
404 	EV_SIGHT1,
405 	EV_SIGHT2,
406 	EV_SIGHT3,
407 	EV_SOUND1,
408 	EV_SOUND2,
409 	EV_SOUND3,
410 	EV_SUSPICIOUS1,
411 	EV_SUSPICIOUS2,
412 	EV_SUSPICIOUS3,
413 	EV_SUSPICIOUS4,
414 	EV_SUSPICIOUS5,
415 	//extra sounds for Jedi
416 	EV_COMBAT1,
417 	EV_COMBAT2,
418 	EV_COMBAT3,
419 	EV_JDETECTED1,
420 	EV_JDETECTED2,
421 	EV_JDETECTED3,
422 	EV_TAUNT1,
423 	EV_TAUNT2,
424 	EV_TAUNT3,
425 	EV_JCHASE1,
426 	EV_JCHASE2,
427 	EV_JCHASE3,
428 	EV_JLOST1,
429 	EV_JLOST2,
430 	EV_JLOST3,
431 	EV_DEFLECT1,
432 	EV_DEFLECT2,
433 	EV_DEFLECT3,
434 	EV_GLOAT1,
435 	EV_GLOAT2,
436 	EV_GLOAT3,
437 	EV_PUSHFAIL,
438 
439 	EV_USE_ITEM,
440 
441 	EV_USE_INV_BINOCULARS,
442 	EV_USE_INV_BACTA,
443 	EV_USE_INV_SEEKER,
444 	EV_USE_INV_LIGHTAMP_GOGGLES,
445 	EV_USE_INV_SENTRY,
446 
447 	EV_USE_FORCE,
448 
449 	EV_DRUGGED,		// hit by an interrogator
450 
451 	EV_DEBUG_LINE,
452 	EV_KOTHOS_BEAM,
453 
454 	EV_NUM_ENTITY_EVENTS
455 } entity_event_t;
456 
457 class animation_t
458 {
459 public:
460 	unsigned short		firstFrame;
461 	unsigned short		numFrames;
462 	short			frameLerp;			// msec between frames
463 	//initial lerp is abs(frameLerp)
464 	signed char		loopFrames;			// 0 to numFrames, -1 = no loop
465 	unsigned char	glaIndex;
466 
467 
sg_export(ojk::SavedGameHelper & saved_game)468 	void sg_export(
469 		ojk::SavedGameHelper& saved_game) const
470 	{
471 		saved_game.write<uint16_t>(firstFrame);
472 		saved_game.write<uint16_t>(numFrames);
473 		saved_game.write<int16_t>(frameLerp);
474 		saved_game.write<int8_t>(loopFrames);
475 		saved_game.write<uint8_t>(glaIndex);
476 	}
477 
sg_import(ojk::SavedGameHelper & saved_game)478 	void sg_import(
479 		ojk::SavedGameHelper& saved_game)
480 	{
481 		saved_game.read<uint16_t>(firstFrame);
482 		saved_game.read<uint16_t>(numFrames);
483 		saved_game.read<int16_t>(frameLerp);
484 		saved_game.read<int8_t>(loopFrames);
485 		saved_game.read<uint8_t>(glaIndex);
486 	}
487 }; // animation_t
488 
489 #define MAX_ANIM_FILES	16
490 #define MAX_ANIM_EVENTS 300
491 
492 //size of Anim eventData array...
493 #define MAX_RANDOM_ANIM_SOUNDS		8
494 #define	AED_ARRAY_SIZE				(MAX_RANDOM_ANIM_SOUNDS+3)
495 //indices for AEV_SOUND data
496 #define	AED_SOUNDINDEX_START		0
497 #define	AED_SOUNDINDEX_END			(MAX_RANDOM_ANIM_SOUNDS-1)
498 #define	AED_SOUND_NUMRANDOMSNDS		(MAX_RANDOM_ANIM_SOUNDS)
499 #define	AED_SOUND_PROBABILITY		(MAX_RANDOM_ANIM_SOUNDS+1)
500 //indices for AEV_SOUNDCHAN data
501 #define	AED_SOUNDCHANNEL			(MAX_RANDOM_ANIM_SOUNDS+2)
502 //indices for AEV_FOOTSTEP data
503 #define	AED_FOOTSTEP_TYPE			0
504 #define	AED_FOOTSTEP_PROBABILITY	1
505 //indices for AEV_EFFECT data
506 #define	AED_EFFECTINDEX				0
507 #define	AED_BOLTINDEX				1
508 #define	AED_EFFECT_PROBABILITY		2
509 #define	AED_MODELINDEX				3
510 //indices for AEV_FIRE data
511 #define	AED_FIRE_ALT				0
512 #define	AED_FIRE_PROBABILITY		1
513 //indices for AEV_MOVE data
514 #define	AED_MOVE_FWD				0
515 #define	AED_MOVE_RT					1
516 #define	AED_MOVE_UP					2
517 //indices for AEV_SABER_SWING data
518 #define	AED_SABER_SWING_SABERNUM	0
519 #define	AED_SABER_SWING_TYPE		1
520 #define	AED_SABER_SWING_PROBABILITY	2
521 //indices for AEV_SABER_SPIN data
522 #define	AED_SABER_SPIN_SABERNUM		0
523 #define	AED_SABER_SPIN_TYPE			1	//0 = saberspinoff, 1 = saberspin, 2-4 = saberspin1-saberspin3
524 #define	AED_SABER_SPIN_PROBABILITY	2
525 
526 typedef enum
527 {//NOTENOTE:  Be sure to update animEventTypeTable and ParseAnimationEvtBlock(...) if you change this enum list!
528 	AEV_NONE,
529 	AEV_SOUND,		//# animID AEV_SOUND framenum soundpath randomlow randomhi chancetoplay
530 	AEV_FOOTSTEP,	//# animID AEV_FOOTSTEP framenum footstepType chancetoplay
531 	AEV_EFFECT,		//# animID AEV_EFFECT framenum effectpath boltName chancetoplay
532 	AEV_FIRE,		//# animID AEV_FIRE framenum altfire chancetofire
533 	AEV_MOVE,		//# animID AEV_MOVE framenum forwardpush rightpush uppush
534 	AEV_SOUNDCHAN,  //# animID AEV_SOUNDCHAN framenum CHANNEL soundpath randomlow randomhi chancetoplay
535 	AEV_SABER_SWING,  //# animID AEV_SABER_SWING framenum CHANNEL randomlow randomhi chancetoplay
536 	AEV_SABER_SPIN,  //# animID AEV_SABER_SPIN framenum CHANNEL chancetoplay
537 	AEV_NUM_AEV
538 } animEventType_t;
539 
540 typedef struct animevent_s
541 {
542 	animEventType_t	eventType;
543 	signed short	modelOnly;			//event is specific to a modelname to skeleton
544 	unsigned short	glaIndex;
545 	unsigned short	keyFrame;			//Frame to play event on
546 	signed short	eventData[AED_ARRAY_SIZE];	//Unique IDs, can be soundIndex of sound file to play OR effect index or footstep type, etc.
547 	char			*stringData;		//we allow storage of one string, temporarily (in case we have to look up an index later, then make sure to set stringData to NULL so we only do the look-up once)
548 
549 
sg_exportanimevent_s550 	void sg_export(
551 		ojk::SavedGameHelper& saved_game) const
552 	{
553 		saved_game.write<int32_t>(eventType);
554 		saved_game.write<int16_t>(modelOnly);
555 		saved_game.write<uint16_t>(glaIndex);
556 		saved_game.write<uint16_t>(keyFrame);
557 		saved_game.write<int16_t>(eventData);
558 		saved_game.write<int32_t>(stringData);
559 	}
560 
sg_importanimevent_s561 	void sg_import(
562 		ojk::SavedGameHelper& saved_game)
563 	{
564 		saved_game.read<int32_t>(eventType);
565 		saved_game.read<int16_t>(modelOnly);
566 		saved_game.read<uint16_t>(glaIndex);
567 		saved_game.read<uint16_t>(keyFrame);
568 		saved_game.read<int16_t>(eventData);
569 		saved_game.read<int32_t>(stringData);
570 	}
571 } animevent_t;
572 
573 typedef enum
574 {
575 	FOOTSTEP_R,
576 	FOOTSTEP_L,
577 	FOOTSTEP_HEAVY_R,
578 	FOOTSTEP_HEAVY_L,
579 	NUM_FOOTSTEP_TYPES
580 } footstepType_t;
581 
582 // means of death
583 typedef enum {
584 
585 	MOD_UNKNOWN,
586 
587 // weapons
588 	MOD_SABER,
589 	MOD_BRYAR,
590 	MOD_BRYAR_ALT,
591 	MOD_BLASTER,
592 	MOD_BLASTER_ALT,
593 	MOD_DISRUPTOR,
594 	MOD_SNIPER,
595 	MOD_BOWCASTER,
596 	MOD_BOWCASTER_ALT,
597 	MOD_REPEATER,
598 	MOD_REPEATER_ALT,
599 	MOD_DEMP2,
600 	MOD_DEMP2_ALT,
601 	MOD_FLECHETTE,
602 	MOD_FLECHETTE_ALT,
603 	MOD_ROCKET,
604 	MOD_ROCKET_ALT,
605 //NEW for JKA weapons:
606 	MOD_CONC,
607 	MOD_CONC_ALT,
608 //END JKA weapons.
609 	MOD_THERMAL,
610 	MOD_THERMAL_ALT,
611 	MOD_DETPACK,
612 	MOD_LASERTRIP,
613 	MOD_LASERTRIP_ALT,
614 	MOD_MELEE,
615 	MOD_SEEKER,
616 	MOD_FORCE_GRIP,
617 	MOD_FORCE_LIGHTNING,
618 	MOD_FORCE_DRAIN,
619 	MOD_EMPLACED,
620 
621 // world / generic
622 	MOD_ELECTROCUTE,
623 	MOD_EXPLOSIVE,
624 	MOD_EXPLOSIVE_SPLASH,
625 	MOD_KNOCKOUT,
626 	MOD_ENERGY,
627 	MOD_ENERGY_SPLASH,
628 	MOD_WATER,
629 	MOD_SLIME,
630 	MOD_LAVA,
631 	MOD_CRUSH,
632 	MOD_IMPACT,
633 	MOD_FALLING,
634 	MOD_SUICIDE,
635 	MOD_TRIGGER_HURT,
636 	MOD_GAS,
637 
638 	NUM_MODS,
639 
640 } meansOfDeath_t;
641 
642 
643 //---------------------------------------------------------
644 
645 // gitem_t->type
646 typedef enum
647 {
648 	IT_BAD,
649 	IT_WEAPON,
650 	IT_AMMO,
651 	IT_ARMOR,
652 	IT_HEALTH,
653 	IT_HOLDABLE,
654 	IT_BATTERY,
655 	IT_HOLOCRON,
656 
657 } itemType_t;
658 
659 
660 
661 typedef struct gitem_s {
662 	const char	*classname;	// spawning name
663 	const char	*pickup_sound;
664 	const char	*world_model;
665 
666 	const char	*icon;
667 
668 	int			quantity;		// for ammo how much, or duration of powerup
669 	itemType_t  giType;			// IT_* flags
670 
671 	int			giTag;
672 
673 	const char	*precaches;		// string of all models and images this item will use
674 	const char	*sounds;		// string of all sounds this item will use
675 	vec3_t		mins;			// Bbox
676 	vec3_t		maxs;			// Bbox
677 } gitem_t;
678 
679 // included in both the game dll and the client
680 extern	gitem_t	bg_itemlist[];
681 extern	const int		bg_numItems;
682 
683 
684 //==============================================================================
685 
686 /*
687 typedef struct ginfoitem_s
688 {
689 	char				*infoString;// Text message
690 	vec3_t				color;		// Text color
691 
692 } ginfoitem_t;
693 */
694 
695 //==============================================================================
696 
697 extern weaponData_t weaponData[WP_NUM_WEAPONS];
698 
699 //==============================================================================
700 extern ammoData_t ammoData[AMMO_MAX];
701 
702 //==============================================================================
703 
704 gitem_t	*FindItem( const char *className );
705 gitem_t	*FindItemForWeapon( weapon_t weapon );
706 gitem_t	*FindItemForInventory( int inv );
707 
708 #define	ITEM_INDEX(x) ((x)-bg_itemlist)
709 
710 qboolean	BG_CanItemBeGrabbed( const entityState_t *ent, const playerState_t *ps );
711 
712 
713 // content masks
714 #define	MASK_ALL				(-1)
715 #define	MASK_SOLID				(CONTENTS_SOLID|CONTENTS_TERRAIN)
716 #define	MASK_PLAYERSOLID		(CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY|CONTENTS_TERRAIN)
717 #define	MASK_NPCSOLID			(CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY|CONTENTS_TERRAIN)
718 #define	MASK_DEADSOLID			(CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_TERRAIN)
719 #define	MASK_WATER				(CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
720 #define	MASK_OPAQUE				(CONTENTS_OPAQUE|CONTENTS_SLIME|CONTENTS_LAVA)//was CONTENTS_SOLID, not CONTENTS_OPAQUE...?
721 /*
722 Ghoul2 Insert Start
723 */
724 #define	MASK_SHOT				(CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE|CONTENTS_SHOTCLIP|CONTENTS_TERRAIN)
725 /*
726 Ghoul2 Insert End
727 */
728 
729 //
730 // entityState_t->eType
731 //
732 typedef enum {
733 	ET_GENERAL,
734 	ET_PLAYER,
735 	ET_ITEM,
736 	ET_MISSILE,
737 	ET_MOVER,
738 	ET_BEAM,
739 	ET_PORTAL,
740 	ET_SPEAKER,
741 	ET_PUSH_TRIGGER,
742 	ET_TELEPORT_TRIGGER,
743 	ET_INVISIBLE,
744 	ET_THINKER,
745 	ET_CLOUD, // dumb
746 	ET_TERRAIN,
747 
748 	ET_EVENTS				// any of the EV_* events can be added freestanding
749 							// by setting eType to ET_EVENTS + eventNum
750 							// this avoids having to set eFlags and eventNum
751 } entityType_t;
752 
753 
754 
755 void	EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
756 void	EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
757 
758 void AddEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps );
759 int	CurrentPlayerstateEvent( playerState_t *ps );
760 
761 void PlayerStateToEntityState( playerState_t *ps, entityState_t *s );
762 
763 qboolean	BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime );
764 
765 #endif//#ifndef __BG_PUBLIC_H__
766