1 /*
2  * OpenBOR - http://www.chronocrash.com
3  * -
4  ----------------------------------------------------------------------
5  * All rights reserved, see LICENSE in OpenBOR root for details.
6  *
7  * Copyright (c) 2004 - 2014 OpenBOR Team
8  */
9 
10 /////////////////////////////////////////////////////////////////////////////
11 //	Beats of Rage                                                          //
12 //	Side-scrolling beat-'em-up                                             //
13 /////////////////////////////////////////////////////////////////////////////
14 
15 #ifndef OPENBOR_H
16 #define OPENBOR_H
17 
18 
19 /////////////////////////////////////////////////////////////////////////////
20 
21 // INCS in makefile
22 #include	"types.h"
23 #include	"video.h"
24 #include	"vga.h"
25 #include	"screen.h"
26 #include	"transform.h"
27 #include	"loadimg.h"
28 #include	"bitmap.h"
29 #include	"sprite.h"
30 #include	"spriteq.h"
31 #include	"font.h"
32 #include	"timer.h"
33 #include	"rand32.h"
34 #include	"sblaster.h"
35 #include	"soundmix.h"
36 #include	"control.h"
37 #include	"draw.h"
38 #include	"packfile.h"
39 #include	"palette.h"
40 #include	"anigif.h"
41 #include    "config.h"
42 #include    "globals.h"
43 #include    "ram.h"
44 #include    "version.h"
45 #include    "savedata.h"
46 
47 #ifdef SDL
48 #include    "gfx.h"
49 #endif
50 
51 #ifdef WEBM
52 #include    "yuv.h"
53 #include    "vidplay.h"
54 #endif
55 
56 /////////////////////////////////////////////////////////////////////////////
57 
58 #define		DEFAULT_SHUTDOWN_MESSAGE \
59 			"OpenBOR " VERSION ", Compile Date: " __DATE__ "\n" \
60 			"Presented by the OpenBOR Team.\n" \
61 			"www.chronocrash.com\n"\
62 			"OpenBOR is the open source continuation of Beats of Rage by Senile Team.\n" \
63 			"\n" \
64 			"Special thanks to SEGA and SNK.\n\n"
65 
66 #define		COMPATIBLEVERSION	0x00033748
67 #define		CV_SAVED_GAME		0x00033747
68 #define		CV_HIGH_SCORE		0x00033747
69 #define     GAME_SPEED          200
70 #define		THINK_SPEED			2
71 #define		COUNTER_SPEED		(GAME_SPEED*2)
72 #define		MAX_NAME_LEN		50 //47
73 #define		MAX_ENTS			150
74 #define		MAX_SPECIALS		8					// Added for customizable freespecials
75 #define     MAX_SPECIAL_INPUTS  27                  // max freespecial input steps, MAX_SPECIAL_INPUTS-1 is reserved, MAX_SPECIAL_INPUTS-2 is animation index, MAX_SPECIAL_INPUTS-3 is reserved. OX -4 , -5 , -6 , -7 , -8 , -9 , -10 also for cancels
76 #define		MAX_ATCHAIN			12					// max attack chain length
77 #define     MAX_IDLES           1                   // Idle animations.
78 #define     MAX_WALKS           1                   // Walk animations.
79 #define     MAX_BACKWALKS       1                   // Backwalk animations.
80 #define     MAX_UPS             1                   // Walk up animations.
81 #define     MAX_DOWNS           1                   // Walk down animations.
82 #define		MAX_ATTACKS			4					// Total number of attacks players have
83 #define     MAX_FOLLOWS         4					// For followup animations
84 #define     MAX_COLLISIONS      2                   // Collision boxes.
85 #define		MAX_ARG_LEN			512
86 #define		MAX_ALLOWSELECT_LEN	1024
87 #define		MAX_SELECT_LOADS   	512
88 #define		MAX_PAL_SIZE		1024
89 #define		MAX_CACHED_BACKGROUNDS 9
90 #define     MAX_ARG_COUNT       64
91 #define     PLATFORM_DEFAULT_X  99999
92 #define     LIFESPAN_DEFAULT	0x7fffffff
93 /*
94 Note: the min Z coordinate of the player is important
95 for several other drawing operations.
96 movement restirctions are here!
97 */
98 
99 #define		FRONTPANEL_Z		(PLAYER_MAX_Z+50)
100 #define     HUD_Z               (FRONTPANEL_Z+10000)
101 #define		HOLE_Z				(PLAYER_MIN_Z-46)
102 #define		SHADOW_Z			(PLAYER_MIN_Z-47)
103 #define		NEONPANEL_Z			(PLAYER_MIN_Z-48)
104 #define		SCREENPANEL_Z		(PLAYER_MIN_Z-49)
105 #define		PANEL_Z				(PLAYER_MIN_Z-50)
106 #define		MIRROR_Z			(PLAYER_MIN_Z-5)
107 #define		PIT_DEPTH			-250
108 #define		P2_STATS_DIST		180
109 #define		CONTACT_DIST_H		30					// Distance to make contact
110 #define		CONTACT_DIST_V		12
111 #define		GRAB_DIST			36					// Grabbing ents will be placed this far apart.
112 #define		GRAB_STALL			(GAME_SPEED * 8 / 10)
113 #define		T_WALKOFF 			2.0
114 #define		T_MIN_BASEMAP 		-1000
115 #define     T_MAX_CHECK_ALTITUDE 9999999
116 #define		DEFAULT_ATK_DROPV_Y 3.0
117 #define		DEFAULT_ATK_DROPV_X 1.2
118 #define		DEFAULT_ATK_DROPV_Z 0
119 
120 #define		ITEM_HIDE_POSITION_Z 100000
121 
122 // Caskey, Damon V.
123 // 2019-01-27
124 //
125 // Flags for animation status.
126 typedef enum
127 {
128 	ANIMATING_REVERSE = -1,
129 	ANIMATING_NONE = 0,
130 	ANIMATING_FORWARD = 1
131 } e_animating;
132 
133 // Caskey, Damon V.
134 // 2019-02-04
135 //
136 // Flags for special attack force values.
137 typedef enum
138 {
139 	ATTACK_FORCE_LAND_AUTO		= -1,
140 	ATTACK_FORCE_LAND_COMMAND	= -2
141 } e_attack_force;
142 
143 // Caskey, Damon V.
144 // 2019-02-05
145 typedef enum
146 {
147 	AUTOKILL_NONE				= 0,
148 	AUTOKILL_ANIMATION_COMPLETE	= (1 << 0),
149 	AUTOKILL_ATTACK_HIT			= (1 << 1)
150 } e_autokill_state;
151 
152 // Caskey, Damon V.
153 // 2019-02-05
154 typedef enum
155 {
156 	INVINCIBLE_NONE			= 0,
157 	INVINCIBLE_INTANGIBLE	= (1 << 0),
158 	INVINCIBLE_HP_MINIMUM	= (1 << 1),
159 	INVINCIBLE_HP_NULLIFY	= (1 << 2),
160 	INVINCIBLE_HP_RESET		= (1 << 3)
161 } e_invincible_state;
162 
163 // Caskey, Damon V.
164 // 2019-01-25
165 //
166 // Flags for flags used to time update functions.
167 typedef enum
168 {
169 	UPDATE_MARK_NONE				= 0,
170 	UPDATE_MARK_CHECK_AI			= (1 << 0),
171 	UPDATE_MARK_CHECK_GRAVITY		= (1 << 1),
172 	UPDATE_MARK_CHECK_MOVE			= (1 << 2),
173 	UPDATE_MARK_UPDATE_ANIMATION	= (1 << 3)
174 } e_update_mark;
175 
176 // Caskey, Damon V.
177 // 2019-02-04
178 //
179 // Flags for legacy bomb projectiles.
180 typedef enum
181 {
182 	EXPLODE_NONE		= 0,
183 	EXPLODE_PREPARED	= (1 << 0),
184 	EXPLODE_DETONATE	= (1 << 1)
185 } e_explode_state;
186 
187 // Caskey, Damon V.
188 // 2019-01-25
189 //
190 // Flags for rising state.
191 typedef enum
192 {
193 	RISING_NONE	= 0,
194 	RISING_RISE		= (1 << 0),
195 	RISING_ATTACK	= (1 << 1)
196 } e_rising_state;
197 
198 // PLAY/REC INPUT vars
199 typedef struct InputKeys
200 {
201     u64 keys[MAX_PLAYERS];
202     u64 newkeys[MAX_PLAYERS];
203     u64 releasekeys[MAX_PLAYERS];
204     u64 playkeys[MAX_PLAYERS];
205     u32 time;
206     u32 interval;
207     u32 synctime;
208 } RecKeys;
209 
210 typedef enum
211 {
212     A_REC_STOP,
213     A_REC_REC,
214     A_REC_PLAY,
215     A_REC_FREE,
216 } a_recstatus;
217 
218 typedef struct PlayRecStatus {
219   char filename[MAX_ARG_LEN];
220   char path[MAX_ARG_LEN];
221   int status; // 0 = stop / 1 = rec / 2 = play
222   int begin;
223   u32 starttime;
224   u32 endtime;
225   u32 synctime; // used to sync rec time with game time
226   u32 totsynctime;
227   u32 cseed;
228   unsigned long seed;
229   unsigned ticks;
230   FILE *handle;
231   RecKeys *buffer;
232 } a_playrecstatus;
233 
234 extern a_playrecstatus *playrecstatus;
235 
236 // Caskey, Damon V.
237 // 2019-03-29
238 //
239 // Blending options.
240 typedef enum
241 {
242 	BLEND_MODE_MODEL = -1,
243 	BLEND_MODE_NONE,
244 	BLEND_MODE_ALPHA,
245 	BLEND_MODE_ALPHA_NEGATIVE,
246 	BLEND_MODE_OVERLAY,
247 	BLEND_MODE_HARDLIGHT,
248 	BLEND_MODE_DODGE,
249 	BLEND_MODE_AVERAGE
250 } e_blend_mode;
251 
252 // Caskey, Damon V.
253 // 2018-04-23
254 //
255 // Initial values for projectile spawns.
256 typedef enum
257 {
258     // Use bitwise ready values here so we can cram
259     // different types of data into one value.
260 
261 	PROJECTILE_PRIME_NONE				= 0,
262 
263     // Source for projectiles base.
264     PROJECTILE_PRIME_BASE_FLOOR         = (1 << 0),
265     PROJECTILE_PRIME_BASE_Y             = (1 << 1),
266 
267     // Movement behavior on launch.
268     PROJECTILE_PRIME_LAUNCH_MOVING      = (1 << 2),
269     PROJECTILE_PRIME_LAUNCH_STATIONARY  = (1 << 3),
270 
271     // Type of projectile as determined by launch method.
272     PROJECTILE_PRIME_REQUEST_FLASH      = (1 << 4),
273     PROJECTILE_PRIME_REQUEST_KNIFE      = (1 << 5),
274     PROJECTILE_PRIME_REQUEST_PROJECTILE = (1 << 6),
275     PROJECTILE_PRIME_REQUEST_PSHOTNO    = (1 << 7),
276     PROJECTILE_PRIME_REQUEST_SHOT       = (1 << 8),
277     PROJECTILE_PRIME_REQUEST_UNDEFINED  = (1 << 9),		// Probably by a script.
278 
279 
280     // How was projectile model determined?
281     PROJECTILE_PRIME_SOURCE_ANIMATION   = (1 << 10),	//  Animation setting.
282     PROJECTILE_PRIME_SOURCE_GLOBAL      = (1 << 11),	//  Global "knife" or global "shot".
283     PROJECTILE_PRIME_SOURCE_INDEX       = (1 << 12),	//  By projectile's model index.
284     PROJECTILE_PRIME_SOURCE_HEADER      = (1 << 13),	//  Model header setting.
285     PROJECTILE_PRIME_SOURCE_NAME        = (1 << 14),	//  By projectile's model name.
286     PROJECTILE_PRIME_SOURCE_WEAPON      = (1 << 15)		//  From a SUBTYPE_PROJECTLE weapon pickup.
287 } e_projectile_prime;
288 
289 // State of attack boxes.
290 typedef enum
291 {
292     ATTACKING_NONE,
293     ATTACKING_PREPARED,
294     ATTACKING_ACTIVE
295     // Next should be 4, 8, ... for bitwise evaluations.
296 } e_attacking_state;
297 
298 // Caskey, Damon V.
299 // 2019-02-06
300 //
301 // State of blasted (thrown or hit withblasting attack).
302 typedef enum
303 {
304 	BLAST_NONE,
305 	BLAST_ATTACK,
306 	BLAST_TOSS
307 } e_blasted_state;
308 
309 // State of idle
310 typedef enum
311 {
312     IDLING_NONE,
313     IDLING_PREPARED,
314     IDLING_ACTIVE
315 } e_idling_state;
316 
317 // State of edge.
318 typedef enum
319 {
320     EDGE_NONE,
321     EDGE_LEFT,
322     EDGE_RIGHT
323 } e_edge_state;
324 
325 // State of duck.
326 typedef enum
327 {
328     DUCK_NONE	= 0,
329     DUCK_PREPARED	= (1 << 0),
330     DUCK_ACTIVE		= (1 << 1),
331     DUCK_RISE		= (1 << 2)
332 } e_duck_state;
333 
334 // Platform props
335 typedef enum
336 {
337     PLATFORM_X,
338     PLATFORM_Z,
339     PLATFORM_UPPERLEFT,
340     PLATFORM_LOWERLEFT,
341     PLATFORM_UPPERRIGHT,
342     PLATFORM_LOWERRIGHT,
343     PLATFORM_DEPTH,
344     PLATFORM_HEIGHT
345 } e_platform_props;
346 
347 typedef enum
348 {
349     PORTING_ANDROID,
350     PORTING_DARWIN,
351     PORTING_DREAMCAST,
352     PORTING_GPX2,
353     PORTING_LINUX,
354     PORTING_OPENDINGUX,
355     PORTING_PSP,
356     PORTING_UNKNOWN,
357     PORTING_WII,
358     PORTING_WINDOWS,
359     PORTING_WIZ,
360     PORTING_XBOX,
361     PORTING_VITA
362 } e_porting;
363 
364 // Caskey, Damon V.
365 // 2019-01-08
366 //
367 // Debugging display options for end user.
368 typedef enum
369 {
370 	DEBUG_DISPLAY_NONE				= (1 << 0),
371 	DEBUG_DISPLAY_COLLISION_ATTACK	= (1 << 1),
372 	DEBUG_DISPLAY_COLLISION_BODY	= (1 << 2),
373 	DEBUG_DISPLAY_PERFORMANCE		= (1 << 3),
374 	DEBUG_DISPLAY_PROPERTIES		= (1 << 4),
375 	DEBUG_DISPLAY_RANGE				= (1 << 5)
376 } e_debug_display;
377 
378 typedef enum
379 {
380     SPAWN_TYPE_UNDEFINED,
381     SPAWN_TYPE_BIKER,
382     SPAWN_TYPE_CMD_SPAWN,
383     SPAWN_TYPE_CMD_SUMMON,
384     SPAWN_TYPE_DUST_FALL,
385     SPAWN_TYPE_DUST_JUMP,
386     SPAWN_TYPE_DUST_LAND,
387     SPAWN_TYPE_FLASH,
388     SPAWN_TYPE_ITEM,
389     SPAWN_TYPE_LEVEL,
390     SPAWN_TYPE_PLAYER_MAIN,
391     SPAWN_TYPE_PLAYER_SELECT,
392     SPAWN_TYPE_PROJECTILE_BOMB,
393     SPAWN_TYPE_PROJECTILE_NORMAL,
394     SPAWN_TYPE_PROJECTILE_STAR,
395     SPAWN_TYPE_STEAM,
396     SPAWN_TYPE_WEAPON
397 } e_spawn_type;
398 
399 typedef enum
400 {
401     PLANE_X,
402     PLANE_Y,
403     PLANE_Z
404 } e_plane;
405 
406 typedef struct
407 {
408     int x;
409     int y;
410     int font_index;
411 } s_debug_xy_msg;
412 
413 // Caskey, Damon V
414 // 2013-12-27
415 //
416 // Key definitions.
417 typedef enum
418 {
419     SDID_MOVEUP,
420     SDID_MOVEDOWN,
421     SDID_MOVELEFT,
422     SDID_MOVERIGHT,
423     SDID_ATTACK,
424     SDID_ATTACK2,
425     SDID_ATTACK3,
426     SDID_ATTACK4,
427     SDID_JUMP,
428     SDID_SPECIAL,
429     SDID_START,
430     SDID_SCREENSHOT,
431     SDID_ESC,
432     SDID_COUNT // not a key ID; it's the number of key IDs
433 } e_key_id;
434 
435 // Caskey, Damon V.
436 // 2013-12-27
437 //
438 // Entity types.
439 typedef enum
440 {
441     FLAG_MOVEUP         = (1 << SDID_MOVEUP),
442     FLAG_MOVEDOWN       = (1 << SDID_MOVEDOWN),
443     FLAG_MOVELEFT       = (1 << SDID_MOVELEFT),
444     FLAG_MOVERIGHT      = (1 << SDID_MOVERIGHT),
445     FLAG_ATTACK         = (1 << SDID_ATTACK),
446     FLAG_ATTACK2        = (1 << SDID_ATTACK2),
447     FLAG_ATTACK3        = (1 << SDID_ATTACK3),
448     FLAG_ATTACK4        = (1 << SDID_ATTACK4),
449     FLAG_JUMP           = (1 << SDID_JUMP),
450     FLAG_SPECIAL        = (1 << SDID_SPECIAL),
451     FLAG_START          = (1 << SDID_START),
452     FLAG_SCREENSHOT     = (1 << SDID_SCREENSHOT),
453     FLAG_ESC            = (1 << SDID_ESC),
454 
455     FLAG_ANYBUTTON		= (FLAG_START|FLAG_SPECIAL|FLAG_ATTACK|FLAG_ATTACK2|FLAG_ATTACK3|FLAG_ATTACK4|FLAG_JUMP),
456     FLAG_CONTROLKEYS    = (FLAG_SPECIAL|FLAG_ATTACK|FLAG_ATTACK2|FLAG_ATTACK3|FLAG_ATTACK4|FLAG_JUMP|FLAG_MOVEUP|FLAG_MOVEDOWN|FLAG_MOVELEFT|FLAG_MOVERIGHT),
457     FLAG_FORWARD		= 0x40000000,
458     FLAG_BACKWARD		= 0x80000000
459 } e_key_def;
460 
461 typedef enum
462 {
463     /*
464     Entity type enumerator.
465     Damon V. Caskey
466     2013-12-27
467     */
468 
469     TYPE_NONE		= (1 << 0),
470     TYPE_PLAYER		= (1 << 1),
471     TYPE_ENEMY		= (1 << 2),
472     TYPE_ITEM		= (1 << 3),
473     TYPE_OBSTACLE	= (1 << 4),
474     TYPE_STEAMER	= (1 << 5),
475     TYPE_SHOT		= (1 << 6),		// 7-1-2005 type to use for player projectiles
476     TYPE_TRAP		= (1 << 7),		// 7-1-2005 lets face it enemies are going to just let you storm in without setting a trap or two!
477     TYPE_TEXTBOX	= (1 << 8),		// New textbox type for displaying messages
478     TYPE_ENDLEVEL	= (1 << 9),		// New endlevel type that ends the level when touched
479     TYPE_NPC		= (1 << 10),	// A character can be an ally or enemy.
480     TYPE_PANEL		= (1 << 11),	// Fake panel, scroll with screen using model speed
481     TYPE_MAX		= TYPE_PANEL,	// For openbor constant check and type hack (i.e., custom hostile and candamage)
482     TYPE_RESERVED	= 0x40000000    // should not use as a type
483 } e_entity_type;
484 
485 // Caskey, Damon V.
486 // 2013-12-27
487 //
488 // Entity sub-types.
489 typedef enum
490 {
491     SUBTYPE_NONE		= (1 << 0),
492     SUBTYPE_BIKER		= (1 << 1),
493     SUBTYPE_NOTGRAB		= (1 << 2),
494     SUBTYPE_ARROW		= (1 << 3),		// 7-1-2005  subtype for an "enemy" that flies across the screen and dies
495     SUBTYPE_TOUCH		= (1 << 4),		// ltb 1-18-05  new Item subtype for a more platformer feel.
496     SUBTYPE_WEAPON		= (1 << 5),
497     SUBTYPE_NOSKIP		= (1 << 6),		// Text type that can't be skipped
498     SUBTYPE_FLYDIE		= (1 << 7),		// Now obstacles can be hit and fly like on Simpsons/TMNT
499     SUBTYPE_BOTH		= (1 << 8),		// Used with TYPE_ENDLEVEL to force both players to reach the point before ending level
500     SUBTYPE_PROJECTILE	= (1 << 9),		// New weapon projectile type that can be picked up by players/enemies
501     SUBTYPE_FOLLOW		= (1 << 10),	// Used by NPC character, if set, they will try to follow players
502     SUBTYPE_CHASE		= (1 << 11)		// Used by enemy always chasing you
503 } e_entity_type_sub;
504 
505 typedef enum
506 {
507     EXCHANGE_CONFERRER,
508     EXCHANGE_RECIPIANT
509 } e_exchange;
510 
511 //------------reserved for A.I. types-------------------------
512 typedef enum
513 {
514     /*
515     AI move 1 enum: Affects movement path
516     Damon V. Caskey
517     2013-12-27
518     */
519 
520     AIMOVE1_NORMAL,                     // Current default style
521     AIMOVE1_CHASE       = 0x00000001,   // alway move towards target, and can run to them if target is farway
522     AIMOVE1_CHASEZ      = 0x00000002,   // only try to get close in z direction
523     AIMOVE1_CHASEX      = 0x00000004,   // only try to get colse in x direction
524     AIMOVE1_AVOID       = 0x00000008,   // try to avoid target
525     AIMOVE1_AVOIDZ      = 0x00000010,   // only try to avoid target in z direction
526     AIMOVE1_AVOIDX      = 0x00000020,   // only try to avoid target in x direction
527     AIMOVE1_WANDER      = 0x00000040,   // ignore the target's position completely, wander everywhere, long idle time
528     AIMOVE1_BIKER       = 0x00000080,   // move like a biker
529     AIMOVE1_ARROW       = 0x00000100,   // fly like an arrow
530     AIMOVE1_STAR        = 0x00000200,   // fly like a star, subject to ground
531     AIMOVE1_BOMB        = 0x00000400,   // fly like a bomb, subject to ground/wall etc
532     AIMOVE1_NOMOVE      = 0x00000800,   // don't move at all
533     MASK_AIMOVE1        = 0x0000FFFF
534 } e_aimove_1;
535 
536 typedef enum
537 {
538     /*
539     A.I move 2 enum: Affect terrain reflect
540     Damon V. Caskey
541     2013-12-27
542     */
543 
544     AIMOVE2_NORMAL,                         // Current default style
545     AIMOVE2_IGNOREHOLES     = 0x00010000,   // don't avoid holes
546     AIMOVE2_NOTARGETIDLE    = 0x00020000,   // don't move when there's no target
547     MASK_AIMOVE2            = 0xFFFF0000
548 } e_aimove_2;
549 
550 typedef enum
551 {
552     /*
553     A.I. attack1 enum: Affect attacking style.
554     Damon V. Caskey
555     2013-12-27
556     */
557 
558     AIATTACK1_NORMAL,                   // Current default style
559     AIATTACK1_LONG      = 0x00000001,   // Long range first, not used
560     AIATTACK1_MELEE     = 0x00000002,   // Melee attack first, not used
561     AIATTACK1_NOATTACK  = 0x00000004,   // dont attack at all
562     AIATTACK1_ALWAYS    = 0x00000008,   // more aggression than default, useful for traps who don't think
563     MASK_AIATTACK1      = 0x0000FFFF
564 } e_aiattack_1;
565 
566 typedef enum
567 {
568     /*
569     A.I. attack1 enum: Affect Defending style.
570     Damon V. Caskey
571     2013-12-27
572     */
573 
574     AIATTACK2_NORMAL,                   // Current default style, don't dodge at all
575     AIATTACK2_DODGE     = 0x00010000,   // Use dodge animation to avoid attack
576     AIATTACK2_DODGEMOVE = 0x00020000,   // Try to move in z direction if a jump attack is about to hit him and try to step back if a melee attack is about to hit him.
577     MASK_AIATTACK2      = 0xFFFF0000
578 } e_aiattack_2;
579 
580 typedef enum //Animations
581 {
582     /*
583     Animations enum.
584     Damon V. Caskey
585     2013-12-27
586     */
587 
588     ANI_NONE,               // To indicate a blank or no animation at all.
589     ANI_IDLE,
590     ANI_WALK,
591     ANI_JUMP,
592     ANI_LAND,
593     ANI_PAIN,
594     ANI_FALL,
595     ANI_RISE,
596     ANI_ATTACK,
597     ANI_ATTACK1,
598     ANI_ATTACK2,
599     ANI_ATTACK3,
600     ANI_ATTACK4,			// Very important
601     ANI_UPPER,
602     ANI_BLOCK,				// New block animation
603 	ANI_BLOCKRELEASE,		// Transition out of block.
604 	ANI_BLOCKSTART,			// Transition to block.
605     ANI_JUMPATTACK,
606     ANI_JUMPATTACK2,
607     ANI_GET,
608     ANI_GRAB,
609     ANI_GRABATTACK,
610     ANI_GRABATTACK2,
611     ANI_THROW,
612     ANI_SPECIAL,
613     ANI_FREESPECIAL,
614     ANI_SPAWN, 				// 26-12-2004 new animation added here ani_spawn
615     ANI_DIE,				// 29-12-2004 new animation added here ani_die
616     ANI_PICK,				// 7-1-2005 used when players select their character at the select screen
617     ANI_FREESPECIAL2,
618     ANI_JUMPATTACK3,
619     ANI_FREESPECIAL3,
620     ANI_UP,					// Mar 2, 2005 - Animation for when going up
621     ANI_DOWN,				// Mar 2, 2005 - Animation for when going down
622     ANI_SHOCK,				// Animation played when knocked down by shock attack
623     ANI_BURN,				// Animation played when knocked down by burn attack
624     ANI_SHOCKPAIN,			// Animation played when not knocked down by shock attack
625     ANI_BURNPAIN,			// Animation played when not knocked down by shock attack
626     ANI_GRABBED,			// Animation played when grabbed
627     ANI_SPECIAL2,			// Animation played for when pressing forward special
628     ANI_RUN,				// Animation played when a player is running
629     ANI_RUNATTACK,			// Animation played when a player is running and presses attack
630     ANI_RUNJUMPATTACK,		// Animation played when a player is running and jumps and presses attack
631     ANI_ATTACKUP,			// u u animation
632     ANI_ATTACKDOWN,			// d d animation
633     ANI_ATTACKFORWARD,		// f f animation
634     ANI_ATTACKBACKWARD,		// Used for attacking backwards
635     ANI_FREESPECIAL4,		// More freespecials added
636     ANI_FREESPECIAL5,		// More freespecials added
637     ANI_FREESPECIAL6,		// More freespecials added
638     ANI_FREESPECIAL7,		// More freespecials added
639     ANI_FREESPECIAL8,		// More freespecials added
640     ANI_RISEATTACK,			// Attack used for enemies when players are crowding around after knocking them down
641     ANI_DODGE,				// Used for up up / down down SOR3 dodge moves for players
642     ANI_ATTACKBOTH,			// Used for when a player holds down attack and presses jump
643     ANI_GRABFORWARD,		// New grab attack for when a player holds down forward/attack
644     ANI_GRABFORWARD2,		// New second grab attack for when a player holds down forward/attack
645     ANI_JUMPFORWARD,		// Attack when a player is moving and jumps
646     ANI_GRABDOWN,			// Attack when a player has grabbed an opponent and presses down/attack
647     ANI_GRABDOWN2,			// Attack when a player has grabbed an opponent and presses down/attack
648     ANI_GRABUP,				// Attack when a player has grabbed an opponent and presses up/attack
649     ANI_GRABUP2,			// Attack when a player has grabbed an opponent and presses up/attack
650     ANI_SELECT,				// Animation that is displayed at the select screen in place of idle.
651 	ANI_SELECTIN,			// Animation that is displayed at the select screen, when first highlighted.
652 	ANI_SELECTOUT,			// Animation that is displayed at the select screen, when moving to another character.
653     ANI_DUCK,				// Animation that is played when pressing down in "platform" type levels
654     ANI_FAINT,  			// Faint animations for players/enemys by tails
655     ANI_CANT,  				// Can't animation for players(animation when mp is less than mpcost) by tails.
656     ANI_THROWATTACK,		// Added for subtype projectile
657     ANI_CHARGEATTACK,       // Plays when player releases attack1 after holding >= chargetime.
658     ANI_JUMPCANT,
659     ANI_JUMPSPECIAL,
660     ANI_BURNDIE,
661     ANI_SHOCKDIE,
662     ANI_PAIN2,
663     ANI_PAIN3,
664     ANI_PAIN4,
665     ANI_FALL2,
666     ANI_FALL3,
667     ANI_FALL4,
668     ANI_DIE2,
669     ANI_DIE3,
670     ANI_DIE4,
671     ANI_CHARGE,
672     ANI_BACKWALK,
673     ANI_SLEEP,
674     ANI_FOLLOW1,
675     ANI_FOLLOW2,
676     ANI_FOLLOW3,
677     ANI_FOLLOW4,
678     ANI_PAIN5,
679     ANI_PAIN6,
680     ANI_PAIN7,
681     ANI_PAIN8,
682     ANI_PAIN9,
683     ANI_PAIN10,
684     ANI_FALL5,
685     ANI_FALL6,
686     ANI_FALL7,
687     ANI_FALL8,
688     ANI_FALL9,
689     ANI_FALL10,
690     ANI_DIE5,
691     ANI_DIE6,
692     ANI_DIE7,
693     ANI_DIE8,
694     ANI_DIE9,
695     ANI_DIE10,
696     ANI_TURN,               // turn back/flip
697     ANI_RESPAWN,            //now spawn works for players
698     ANI_FORWARDJUMP,
699     ANI_RUNJUMP,
700     ANI_JUMPLAND,
701     ANI_JUMPDELAY,
702     ANI_HITOBSTACLE,
703     ANI_HITPLATFORM,
704     ANI_HITWALL,
705     ANI_GRABBACKWARD,
706     ANI_GRABBACKWARD2,
707     ANI_GRABWALK,
708     ANI_GRABBEDWALK,
709     ANI_GRABWALKUP,
710     ANI_GRABBEDWALKUP,
711     ANI_GRABWALKDOWN,
712     ANI_GRABBEDWALKDOWN,
713     ANI_GRABTURN,
714     ANI_GRABBEDTURN,
715     ANI_GRABBACKWALK,
716     ANI_GRABBEDBACKWALK,
717     ANI_SLIDE,              //Down + Jump animation.
718     ANI_RUNSLIDE,           //Down + Jump while running.
719     ANI_BLOCKPAIN,          //If entity has this, it will play in place of "pain" when it's blokcpain is 1 and incomming attack is blocked.
720     ANI_DUCKATTACK,
721     ANI_RISE2,
722     ANI_RISE3,
723     ANI_RISE4,
724     ANI_RISE5,
725     ANI_RISE6,
726     ANI_RISE7,
727     ANI_RISE8,
728     ANI_RISE9,
729     ANI_RISE10,
730     ANI_RISEB,
731     ANI_RISES,
732     ANI_BLOCKPAIN2,
733     ANI_BLOCKPAIN3,
734     ANI_BLOCKPAIN4,
735     ANI_BLOCKPAIN5,
736     ANI_BLOCKPAIN6,
737     ANI_BLOCKPAIN7,
738     ANI_BLOCKPAIN8,
739     ANI_BLOCKPAIN9,
740     ANI_BLOCKPAIN10,
741     ANI_BLOCKPAINB,
742     ANI_BLOCKPAINS,
743     ANI_CHIPDEATH,
744     ANI_GUARDBREAK,
745     ANI_RISEATTACK2,
746     ANI_RISEATTACK3,
747     ANI_RISEATTACK4,
748     ANI_RISEATTACK5,
749     ANI_RISEATTACK6,
750     ANI_RISEATTACK7,
751     ANI_RISEATTACK8,
752     ANI_RISEATTACK9,
753     ANI_RISEATTACK10,
754     ANI_RISEATTACKB,
755     ANI_RISEATTACKS,
756     ANI_WALKOFF,
757     ANI_BACKPAIN,
758     ANI_BACKPAIN2,
759     ANI_BACKPAIN3,
760     ANI_BACKPAIN4,
761     ANI_BACKPAIN5,
762     ANI_BACKPAIN6,
763     ANI_BACKPAIN7,
764     ANI_BACKPAIN8,
765     ANI_BACKPAIN9,
766     ANI_BACKPAIN10,
767     ANI_BACKFALL,
768     ANI_BACKFALL2,
769     ANI_BACKFALL3,
770     ANI_BACKFALL4,
771     ANI_BACKFALL5,
772     ANI_BACKFALL6,
773     ANI_BACKFALL7,
774     ANI_BACKFALL8,
775     ANI_BACKFALL9,
776     ANI_BACKFALL10,
777     ANI_BACKDIE,
778     ANI_BACKDIE2,
779     ANI_BACKDIE3,
780     ANI_BACKDIE4,
781     ANI_BACKDIE5,
782     ANI_BACKDIE6,
783     ANI_BACKDIE7,
784     ANI_BACKDIE8,
785     ANI_BACKDIE9,
786     ANI_BACKDIE10,
787     ANI_BACKRUN,
788     ANI_BACKBURNPAIN,
789     ANI_BACKSHOCKPAIN,
790     ANI_BACKBURN,
791     ANI_BACKSHOCK,
792     ANI_BACKBURNDIE,
793     ANI_BACKSHOCKDIE,
794     ANI_BACKRISEB,
795     ANI_BACKRISES,
796     ANI_BACKRISE,
797     ANI_BACKRISE2,
798     ANI_BACKRISE3,
799     ANI_BACKRISE4,
800     ANI_BACKRISE5,
801     ANI_BACKRISE6,
802     ANI_BACKRISE7,
803     ANI_BACKRISE8,
804     ANI_BACKRISE9,
805     ANI_BACKRISE10,
806     ANI_BACKRISEATTACKB,
807     ANI_BACKRISEATTACKS,
808     ANI_BACKRISEATTACK,
809     ANI_BACKRISEATTACK2,
810     ANI_BACKRISEATTACK3,
811     ANI_BACKRISEATTACK4,
812     ANI_BACKRISEATTACK5,
813     ANI_BACKRISEATTACK6,
814     ANI_BACKRISEATTACK7,
815     ANI_BACKRISEATTACK8,
816     ANI_BACKRISEATTACK9,
817     ANI_BACKRISEATTACK10,
818     ANI_BACKBLOCKPAINB,
819     ANI_BACKBLOCKPAINS,
820     ANI_BACKBLOCKPAIN,
821     ANI_BACKBLOCKPAIN2,
822     ANI_BACKBLOCKPAIN3,
823     ANI_BACKBLOCKPAIN4,
824     ANI_BACKBLOCKPAIN5,
825     ANI_BACKBLOCKPAIN6,
826     ANI_BACKBLOCKPAIN7,
827     ANI_BACKBLOCKPAIN8,
828     ANI_BACKBLOCKPAIN9,
829     ANI_BACKBLOCKPAIN10,
830     ANI_EDGE,
831     ANI_BACKEDGE,
832     ANI_DUCKING,
833     ANI_DUCKRISE,
834     ANI_VICTORY,
835     ANI_FALLLOSE,
836     ANI_LOSE,
837     MAX_ANIS                // Maximum # of animations. This must always be last.
838 } e_animations;
839 
840 typedef enum
841 {
842     ANI_PROP_ANIMHITS,     // Does the attack need to hit before cancel is allowed?
843     ANI_PROP_ANTIGRAV,     // UT: make dive a similar property as antigravity.
844     ANI_PROP_ATTACK,
845     ANI_PROP_COLLISIONONE,    // stick on the only one victim
846     ANI_PROP_BODY_COLLISION,
847     ANI_PROP_ENTITY_COLLISION,
848     ANI_PROP_BOUNCE,       //FLOAT -tossv/bounce = new tossv
849     ANI_PROP_CANCEL,       // Cancel anims with freespecial
850     ANI_PROP_CHARGETIME,   //INT charge time for an animation
851     ANI_PROP_COUNTERRANGE, //SUB Auto counter attack. 2011_04_01, DC: Moved to struct.
852     ANI_PROP_DELAY,
853     ANI_PROP_DRAWMETHODS,
854     ANI_PROP_DROPFRAME,    // SUB if tossv < 0, this frame will be set
855     ANI_PROP_DROPV,    // SUB if tossv < 0, this frame will be set
856     ANI_PROP_ENERGYCOST,   //SUB. 1-10-05 to adjust the amount of energy used for specials. 2011_03_31, DC: Moved to struct.
857     ANI_PROP_FLIPFRAME,    // Turns entities around on the desired frame
858     ANI_PROP_FOLLOWUP,     // use which FOLLOW anim?
859     ANI_PROP_IDLE,
860     ANI_PROP_IGNOREATTACKID,
861     ANI_PROP_INDEX,        //unique id
862     ANI_PROP_JUMPFRAME,    //SUB
863     ANI_PROP_LANDFRAME,    // SUB Landing behavior. 2011_04_01, DC: Moved to struct.
864     ANI_PROP_LOOP,         // Animation looping. 2011_03_31, DC: Moved to struct.
865     ANI_PROP_MODEL_INDEX,
866     ANI_PROP_MOVE,
867     ANI_PROP_NUMFRAMES,    //Framecount.
868     ANI_PROP_OFFSET,
869     ANI_PROP_PLATFORM,
870     ANI_PROP_PROJECTILE,
871     ANI_PROP_QUAKEFRAME,   // SUB Screen shake effect. 2011_04_01, DC; Moved to struct.
872     ANI_PROP_RANGE,        //SUB Verify distance to target, jump landings, etc.. 2011_04_01, DC: Moved to struct.
873     ANI_PROP_SHADOW,
874     ANI_PROP_SIZE,         // SUB entity's size (height) during animation
875     ANI_PROP_SOUNDTOPLAY,
876     ANI_PROP_SPAWNFRAME,   // SUB Spawn the subentity as its default type. {frame} {x} {z} {a} {relative?}
877     ANI_PROP_SPRITE,
878     ANI_PROP_SPRITEA,
879     ANI_PROP_SUBENTITY,    // Store the sub-entity's name for further use
880     ANI_PROP_SUMMONFRAME,  // SUB Summon the subentity as an ally, only one though {frame} {x} {z} {a} {relative?}
881     ANI_PROP_SYNC,         // sychronize frame to previous animation if they matches
882     ANI_PROP_UNSUMMONFRAME,// SUB Un-summon the entity
883     ANI_PROP_VULNERABLE,
884     ANI_PROP_WEAPONFRAME    // SUB Specify with a frame when to switch to a weapon model
885 } e_animation_properties;
886 
887 typedef enum
888 {
889     BOSS_SLOW_OFF,
890     BOSS_SLOW_ON
891 } e_boss_slow_flag;
892 
893 typedef enum
894 {
895     DAMAGE_FROM_ENEMY_OFF,
896     DAMAGE_FROM_ENEMY_ON
897 } e_damage_from_enemy_flag;
898 
899 typedef enum
900 {
901     DAMAGE_FROM_PLAYER_OFF,
902     DAMAGE_FROM_PLAYER_ON
903 } e_damage_from_player_flag;
904 
905 typedef enum
906 {
907     LEVEL_PROP_AUTO_SCROLL_DIRECTION,           // int bgdir;
908     LEVEL_PROP_AUTO_SCROLL_X,                   // float bgspeed;
909     LEVEL_PROP_AUTO_SCROLL_Y,                   // float vbgspeed;
910     LEVEL_PROP_BASEMAP_COLLECTION,              // s_basemap *basemaps;
911     LEVEL_PROP_BASEMAP_COUNT,                   // int numbasemaps;
912     LEVEL_PROP_BOSS_COUNT,                      // int bossescount;
913     LEVEL_PROP_BOSS_MUSIC_NAME,                 // char bossmusic[256];
914     LEVEL_PROP_BOSS_MUSIC_OFFSET,               // unsigned bossmusic_offset;
915     LEVEL_PROP_BOSS_SLOW,                       // int boss_slow;
916     LEVEL_PROP_CAMERA_OFFSET_X,                 // int cameraxoffset;
917     LEVEL_PROP_CAMERA_OFFSET_Z,                 // int camerazoffset;
918     LEVEL_PROP_COMPLETE_FORCE,                  // int force_finishlevel;
919     LEVEL_PROP_GAMEOVER,                        // int force_gameover;
920     LEVEL_PROP_DAMAGE_FROM_ENEMY,               // int nohurt;
921     LEVEL_PROP_DAMAGE_FROM_PLAYER,              // int nohit;
922     LEVEL_PROP_FACING,                          // e_facing_adjust facing;
923     LEVEL_PROP_GRAVITY,                         // float gravity;
924     LEVEL_PROP_HOLE_COLLECTION,                 // s_terrain *holes;
925     LEVEL_PROP_HOLE_COUNT,                      // int numholes;
926     LEVEL_PROP_LAYER_BACKGROUND_DEFAULT_HANDLE, // s_layer *background;
927     LEVEL_PROP_LAYER_BACKGROUND_COLLECTION,     // s_layer **bglayers;
928     LEVEL_PROP_LAYER_BACKGROUND_COUNT,          // int numbglayers;
929     LEVEL_PROP_LAYER_COLLECTION,                // s_layer *layers;
930     LEVEL_PROP_LAYER_COUNT,                     // int numlayers;
931     LEVEL_PROP_LAYER_FOREGROUND_COLLECTION,     // s_layer **fglayers;
932     LEVEL_PROP_LAYER_FOREGROUND_COUNT,          // int numfglayers;
933     LEVEL_PROP_LAYER_FRONTPANEL_COLLECTION,     // s_layer **frontpanels;
934     LEVEL_PROP_LAYER_FRONTPANEL_COUNT,          // int numfrontpanels;
935     LEVEL_PROP_LAYER_GENERIC_COLLECTION,        // s_layer **genericlayers;
936     LEVEL_PROP_LAYER_GENERIC_COUNT,             // int numgenericlayers;
937     LEVEL_PROP_LAYER_PANEL_COLLECTION,          // s_layer *(*panels)[3]; //normal neon screen
938     LEVEL_PROP_LAYER_PANEL_COUNT,               // int numpanels;
939     LEVEL_PROP_LAYER_REF_COLLECTION,            // s_layer *layersref;
940     LEVEL_PROP_LAYER_REF_COUNT,                 // int numlayersref;
941     LEVEL_PROP_LAYER_WATER_COLLECTION,          // s_layer **waters;
942     LEVEL_PROP_LAYER_WATER_COUNT,               // int numwaters;
943     LEVEL_PROP_MAX_FALL_VELOCITY,               // float maxfallspeed;
944     LEVEL_PROP_MAX_TOSS_VELOCITY,               // float maxtossspeed;
945     LEVEL_PROP_MIRROR,                          // int mirror;
946     LEVEL_PROP_NAME,                            // char *name;
947     LEVEL_PROP_NUM_BOSSES,                      // int numbosses;
948     LEVEL_PROP_PALETTE_BLENDING_COLLECTION,     // unsigned char *(*blendings)[MAX_BLENDINGS];
949     LEVEL_PROP_PALETTE_COLLECTION,              // unsigned char (*palettes)[1024];
950     LEVEL_PROP_PALETTE_COUNT,                   // int numpalettes;
951     LEVEL_PROP_POSITION_X,                      // int pos;
952     LEVEL_PROP_QUAKE,                           // int quake;
953     LEVEL_PROP_QUAKE_TIME,                      // u32 quaketime;
954     LEVEL_PROP_ROCKING,                         // int rocking;
955     LEVEL_PROP_SCRIPT_LEVEL_END,                // Script endlevel_script;
956     LEVEL_PROP_SCRIPT_LEVEL_START,              // Script level_script;
957     LEVEL_PROP_SCRIPT_KEY,                      // Script key_script;
958     LEVEL_PROP_SCRIPT_UPDATE,                   // Script update_script;
959     LEVEL_PROP_SCRIPT_UPDATED,                  // Script updated_script;
960     LEVEL_PROP_SCROLL_DIRECTION,                // int scrolldir;
961     LEVEL_PROP_SCROLL_VELOCITY,                 // float scrollspeed;
962     LEVEL_PROP_SIZE_X,                          // int width;
963     LEVEL_PROP_SPAWN_COLLECTION,                // s_spawn_entry *spawnpoints;
964     LEVEL_PROP_SPAWN_COUNT,                     // int numspawns;
965     LEVEL_PROP_SPAWN_PLAYER_COLLECTION,         // s_axis_principal_float spawn[MAX_PLAYERS];
966     LEVEL_PROP_SPECIAL_DISABLE,                 // int nospecial;
967     LEVEL_PROP_TEXT_OBJECT_COLLECTION,          // s_textobj *textobjs;
968     LEVEL_PROP_TEXT_OBJECT_COUNT,               // int numtextobjs;
969     LEVEL_PROP_TIME_ADVANCE,                    // u32 advancetime;
970     LEVEL_PROP_TIME_DISPLAY,                    // int notime;
971     LEVEL_PROP_TIME_RESET,                      // int noreset;
972     LEVEL_PROP_TIME_SET,                        // int settime;
973     LEVEL_PROP_TYPE,                            // int type;
974     LEVEL_PROP_WAITING,                         // int waiting;
975     LEVEL_PROP_WALL_COLLECTION,                 // s_terrain *walls;
976     LEVEL_PROP_WALL_COUNT,                      // int numwalls;
977     LEVEL_PROP_WEAPON                           // int setweap;
978 } e_level_properties;
979 
980 typedef enum
981 {
982     SET_PROP_COMPLETE_FLAG,         // int ifcomplete;
983     SET_PROP_COMPLETE_SKIP,         // int noshowcomplete;
984     SET_PROP_CONTINUE_SCORE_TYPE,   // int continuescore;
985     SET_PROP_CREDITS,               // int credits;
986     SET_PROP_GAME_OVER_SKIP,        // int noshowgameover;
987     SET_PROP_HOF_DISABLE,           // int noshowhof;
988     SET_PROP_LEVELSET_COLLECTION,   // s_level_entry *levelorder;
989     SET_PROP_LEVELSET_COUNT,        // int numlevels;
990     SET_PROP_LIVES,                 // int lives;
991     SET_PROP_MP_RECOVER_TYPE,       // int typemp;
992     SET_PROP_MUSIC_FADE_TIME,       // int custfade;
993     SET_PROP_MUSIC_OVERLAP,         // int musicoverlap;
994     SET_PROP_NAME,                  // char *name;
995     SET_PROP_PLAYER_MAX,            // int maxplayers;
996     SET_PROP_SAVE_TYPE,             // int saveflag;
997     SET_PROP_SELECT_DISABLE,        // int noselect;
998     SET_PROP_SELECT_NO_SAME         // int nosame;
999 } e_set_properties;
1000 
1001 typedef enum
1002 {
1003     /*
1004     Argument type enum.
1005     Damon V. Caskey
1006     2013-12-27
1007     */
1008 
1009     ARG_FLOAT,
1010     ARG_STRING,
1011     ARG_INT
1012 } e_arg_types;
1013 
1014 
1015 // Caskey, Damon V.
1016 // 2013-12-27
1017 //
1018 // Attack types. If more types are added,
1019 // don't forget to add them to script
1020 // access and account for them in the
1021 // model load logic.
1022 typedef enum
1023 {
1024     ATK_NONE            = -1,   // When we want no attack at all, such as damage_on_landing's default.
1025     ATK_NORMAL,
1026     ATK_NORMAL1			= ATK_NORMAL,
1027     ATK_NORMAL2,
1028     ATK_NORMAL3,
1029     ATK_NORMAL4,
1030     ATK_BLAST,
1031     ATK_BURN,
1032     ATK_FREEZE,
1033     ATK_SHOCK,
1034     ATK_STEAL,
1035     ATK_NORMAL5,
1036     ATK_NORMAL6,
1037     ATK_NORMAL7,
1038     ATK_NORMAL8,
1039     ATK_NORMAL9,
1040     ATK_NORMAL10,
1041 
1042     // For engine and script use. These are
1043     // applied automatically by various
1044     // conditions or intended for script logic.
1045     ATK_BOSS_DEATH, // KO leftover enemies when boss is defeated.
1046     ATK_ITEM,       // Scripting item logic. Item "attacks" entity that collects it.
1047     ATK_LAND,       // Touching ground during a damage on landing fall.
1048     ATK_LIFESPAN,   // Entity's lifespan timer expires.
1049     ATK_LOSE,       // Players (with lose animation) when level time expires.
1050     ATK_PIT,        // Entity falls into a pit and reaches specified depth.
1051     ATK_TIMEOVER,   // Players (without lose animation) when level time expires.
1052 
1053     // Default max attack types (must
1054     // be below all attack types in enum
1055     // to get correct value)
1056     MAX_ATKS,
1057     STA_ATKS        = (MAX_ATKS-10)
1058 } e_attack_types;
1059 
1060 // Attack box properties.
1061 // Caskey, Damon V.
1062 // 2016-10-26
1063 typedef enum
1064 {
1065     ATTACK_PROP_BLOCK_COST,
1066     ATTACK_PROP_BLOCK_PENETRATE,
1067     ATTACK_PROP_COORDINATES,
1068     ATTACK_PROP_COUNTER,
1069     ATTACK_PROP_DAMAGE_FORCE,
1070     ATTACK_PROP_DAMAGE_LAND_FORCE,
1071     ATTACK_PROP_DAMAGE_LAND_MODE,
1072     ATTACK_PROP_DAMAGE_LETHAL_DISABLE,
1073     ATTACK_PROP_DAMAGE_RECURSIVE_FORCE,
1074     ATTACK_PROP_DAMAGE_RECURSIVE_INDEX,
1075     ATTACK_PROP_DAMAGE_RECURSIVE_MODE,
1076     ATTACK_PROP_DAMAGE_RECURSIVE_TIME_RATE,
1077     ATTACK_PROP_DAMAGE_RECURSIVE_TIME_EXPIRE,
1078     ATTACK_PROP_DAMAGE_STEAL,
1079     ATTACK_PROP_DAMAGE_TYPE,
1080     ATTACK_PROP_EFFECT_BLOCK_FLASH,
1081     ATTACK_PROP_EFFECT_BLOCK_SOUND,
1082     ATTACK_PROP_EFFECT_HIT_FLASH,
1083     ATTACK_PROP_EFFECT_HIT_FLASH_DISABLE,
1084     ATTACK_PROP_EFFECT_HIT_SOUND,
1085     ATTACK_PROP_INDEX,
1086     ATTACK_PROP_GROUND,
1087     ATTACK_PROP_MAP_INDEX,
1088     ATTACK_PROP_MAP_TIME,
1089     ATTACK_PROP_REACTION_FALL_FORCE,
1090     ATTACK_PROP_REACTION_FALL_VELOCITY,
1091     ATTACK_PROP_REACTION_FREEZE_MODE,
1092     ATTACK_PROP_REACTION_FREEZE_TIME,
1093     ATTACK_PROP_REACTION_INVINCIBLE_TIME,
1094     ATTACK_PROP_REACTION_REPOSITION_DIRECTION,
1095     ATTACK_PROP_REACTION_REPOSITION_DISTANCE,
1096     ATTACK_PROP_REACTION_REPOSITION_MODE,
1097     ATTACK_PROP_REACTION_PAIN_SKIP,
1098     ATTACK_PROP_REACTION_PAUSE_TIME,
1099     ATTACK_PROP_SEAL_COST,
1100     ATTACK_PROP_SEAL_TIME,
1101     ATTACK_PROP_STAYDOWN_RISE,
1102     ATTACK_PROP_STAYDOWN_RISEATTACK,
1103     ATTACK_PROP_TAG
1104 } e_attack_properties;
1105 
1106 // Body collision (bbox) properties.
1107 // Caskey, Damon V.
1108 // 2016-10-31
1109 typedef enum
1110 {
1111     BODY_COLLISION_PROP_COORDINATES,
1112     BODY_COLLISION_PROP_DEFENSE,
1113     BODY_COLLISION_PROP_TAG
1114 } e_body_collision_properties;
1115 
1116 // Caskey, Damon V.
1117 // 2018-01-04
1118 //
1119 // Coordinate structure, mainly for accessing
1120 // collision box position and dimensions.
1121 typedef enum
1122 {
1123     COLLISION_COORDINATES_PROP_DEPTH_BACKGROUND,
1124     COLLISION_COORDINATES_PROP_DEPTH_FOREGROUND,
1125     COLLISION_COORDINATES_PROP_HEIGHT,
1126     COLLISION_COORDINATES_PROP_WIDTH,
1127     COLLISION_COORDINATES_PROP_X,
1128     COLLISION_COORDINATES_PROP_Y
1129 } e_collision_coordinates;
1130 
1131 // Entity collision (ebox) properties.
1132 typedef enum
1133 {
1134     ENTITY_COLLISION_PROP_COORDINATES,
1135     ENTITY_COLLISION_PROP_TAG
1136 } e_entity_collision_properties;
1137 
1138 typedef enum
1139 {
1140     /*
1141     Status bar direction enum.
1142     Damon V. Caskey
1143     2013-12-29
1144     */
1145 
1146     BARSTATUS_DIR_NORMAL,  //Left to Right or Up to Down.
1147     BARSTATUS_DIR_INVERT   //Right to Left or Down to Up.
1148 } e_bar_dir;
1149 
1150 typedef enum
1151 {
1152     HORIZONTALBAR,
1153     VERTICALBAR
1154 } e_barorient;
1155 
1156 typedef enum
1157 {
1158     VALUEBAR,
1159     PERCENTAGEBAR
1160 } e_bartype;
1161 
1162 typedef enum
1163 {
1164     BGT_BGLAYER,
1165     BGT_FGLAYER,
1166     BGT_PANEL,
1167     BGT_FRONTPANEL,
1168     BGT_WATER,
1169     BGT_BACKGROUND,
1170     BGT_GENERIC
1171 } e_bgloldtype;
1172 
1173 typedef enum
1174 {
1175     /*
1176     Blocktype enum. Type of resource drained (if any) when attack is blocked.
1177     Damon V. Caskey
1178     2013-12-28
1179     */
1180 
1181     BLOCK_TYPE_HP         = -1,   //HP only.
1182     BLOCK_TYPE_MP_FIRST   = 1,    //MP until MP is exhuasted, then HP.
1183     BLOCK_TYPE_BOTH,              //Both MP and HP.
1184     BLOCK_TYPE_MP_ONLY            //Only MP, even if MP is 0.
1185 } e_blocktype;
1186 
1187 typedef enum
1188 {
1189     /*
1190     Energy check type enum.
1191     Damon V. Caskey
1192     2013-12-29
1193     */
1194 
1195     COST_CHECK_HP,
1196     COST_CHECK_MP
1197 } e_cost_check;
1198 
1199 typedef enum
1200 {
1201     /*
1202     Energycost type enum.
1203     Damon V. Caskey
1204     2013-12-29
1205     */
1206 
1207     COST_TYPE_MP_THEN_HP,
1208     COST_TYPE_MP_ONLY,
1209     COST_TYPE_HP_ONLY
1210 } e_cost_type;
1211 
1212 typedef enum
1213 {
1214     /*
1215     Energycost value enum.
1216     */
1217 
1218     ENERGYCOST_NOCOST = 0,
1219     ENERGYCOST_DEFAULT_COST = 6,
1220 } e_cost_value;
1221 
1222 typedef enum
1223 {
1224     /*
1225     Counter action conditionals.
1226     2012-12-16
1227     Damon V. Caskey
1228     */
1229 
1230     COUNTERACTION_CONDITION_NONE,                  //No counter.
1231     COUNTERACTION_CONDITION_ALWAYS,                //Always perform coutner action.
1232     COUNTERACTION_CONDITION_HOSTILE,               //Only if attacker is hostile entity.
1233     COUNTERACTION_CONDITION_HOSTILE_FRONT_NOFREEZE, //Attacker is hostile, strikes from front, and uses non-freeze attack.
1234     COUNTERACTION_CONDITION_ALWAYS_RAGE,           //Always perform coutner action and if health - attack_damage <= 0, set health to 1
1235 } e_counteraction_condition;
1236 
1237 typedef enum
1238 {
1239     /*
1240     Counteraction damage taking modes.
1241     2012-12-16
1242     Damon V. Caskey
1243     */
1244 
1245     COUNTERACTION_DAMAGE_NONE,  //No damage.
1246     COUNTERACTION_DAMAGE_NORMAL //Normal damage.
1247 } e_counteraction_damage;
1248 
1249 typedef enum
1250 {
1251     // These must be kept in the current order
1252     // to ensure backward compatibility with
1253     // modules that used magic numbers before
1254     // constants were available.
1255 	BIND_ANIMATION_NONE				= 0,
1256     BIND_ANIMATION_TARGET			= (1 << 0),
1257     BIND_ANIMATION_FRAME_TARGET		= (1 << 1),
1258     BIND_ANIMATION_REMOVE			= (1 << 2),
1259     BIND_ANIMATION_FRAME_REMOVE		= (1 << 3),
1260 
1261 	// Following were added post constant availablity, so
1262 	// order does not matter.
1263 
1264     BIND_ANIMATION_DEFINED			= (1 << 4),
1265     BIND_ANIMATION_FRAME_DEFINED	= (1 << 5)
1266 } e_bind_animation_match;
1267 
1268 typedef enum
1269 {
1270     // These must be kept in the current order
1271     // to ensure backward compatibility with
1272     // modules that used magic numbers before
1273     // constants were available.
1274 
1275     BIND_MODE_NONE		= 0,
1276     BIND_MODE_TARGET	= (1 << 0),
1277     BIND_MODE_LEVEL		= (1 << 1)
1278 } e_bind_mode;
1279 
1280 typedef enum
1281 {
1282     BIND_OVERRIDE_NONE             = 0,
1283     BIND_OVERRIDE_FALL_LAND        = (1 << 0),
1284     BIND_OVERRIDE_LANDFRAME        = (1 << 1),
1285     BIND_OVERRIDE_SPECIAL_AI       = (1 << 2),
1286     BIND_OVERRIDE_SPECIAL_PLAYER   = (1 << 3)
1287 } e_bind_override;
1288 
1289 // Caskey, Damon V.
1290 // 2013-12-16
1291 //
1292 // Direction (facing) enum.
1293 typedef enum
1294 {
1295 	DIRECTION_NONE = -1,	// Only to indicate a temporary direction flag isn't set or in use.
1296 	DIRECTION_LEFT,
1297 	DIRECTION_RIGHT
1298 } e_direction;
1299 
1300 // Caskey, Damon V.
1301 // 2013-12-28
1302 //
1303 // Direction adjustment enum. Used for binding and changing direction of defender when hit.
1304 typedef enum
1305 {
1306 
1307 
1308     DIRECTION_ADJUST_NONE,             //Leave as is.
1309     DIRECTION_ADJUST_SAME,             //Same as attacker/bind/etc.
1310     DIRECTION_ADJUST_OPPOSITE  = -1,   //Opposite attacker/bind/etc.
1311     DIRECTION_ADJUST_RIGHT     = 2,    //Always right.
1312     DIRECTION_ADJUST_LEFT      = -2    //Always left.
1313 } e_direction_adjust;
1314 
1315 typedef enum
1316 {
1317     /*
1318     Run adjust_grabposition check on dograb or not.
1319     Damon V. Caskey
1320     2013-12-30
1321     */
1322 
1323     DOGRAB_ADJUSTCHECK_TRUE,
1324     DOGRAB_ADJUSTCHECK_FALSE
1325 } e_dograb_adjustcheck;
1326 
1327 typedef enum
1328 {
1329 	DAMAGE_RECURSIVE_MODE_NONE			= 0,
1330 	DAMAGE_RECURSIVE_MODE_HP			= (1 << 0),
1331 	DAMAGE_RECURSIVE_MODE_MP			= (1 << 1),
1332 	DAMAGE_RECURSIVE_MODE_NON_LETHAL	= (1 << 2)
1333 } e_damage_recursive;
1334 
1335 typedef enum
1336 {
1337     /*
1338     Edelay factor modes.
1339     2013-12-16
1340     Damon V. Caskey
1341     */
1342     EDELAY_MODE_ADD,       //Factor is added directly to edelay.
1343     EDELAY_MODE_MULTIPLY   //Orginal delay value is multiplied by factor.
1344 } e_edelay_mode;
1345 
1346 typedef enum
1347 {
1348     /*
1349     Facing adjustment enum.
1350     Damon V. Caskey
1351     2013-12-29
1352     */
1353 
1354     FACING_ADJUST_NONE,    //No facing adjustment.
1355     FACING_ADJUST_RIGHT,   //Always face right.
1356     FACING_ADJUST_LEFT,    //Always face left.
1357     FACING_ADJUST_LEVEL    //Face according to level scroll direction.
1358 } e_facing_adjust;
1359 
1360 typedef enum
1361 {
1362     /*
1363     Follow up conditional enumerator.
1364     Damon V. Caskey
1365     2014-01-04
1366     */
1367 
1368     FOLLOW_CONDITION_DISABLED,                     //No followup (default).
1369     FOLLOW_CONDITION_ALWAYS,                       //Always perform.
1370     FOLLOW_CONDITION_HOSTILE,                      //Perform if target is hostile.
1371     FOLLOW_CONDITION_HOSTILE_NOKILL_NOBLOCK,       //Perform if target is hostile, will not be killed and didn't block.
1372     FOLLOW_CONDITION_HOSTILE_NOKILL_NOBLOCK_NOGRAB, //Perform if target is hostile, will not be killed, didn't block, and cannot be grabbed.
1373     FOLLOW_CONDITION_HOSTILE_NOKILL_BLOCK,         //Perform if target is hostile, will not be killed and block.
1374 } e_follow_condition;
1375 
1376 // Caskey, Damon V.
1377 // 2019-05-31
1378 // Grab attack selection.
1379 typedef enum
1380 {
1381 	// Note these action constants are used as element IDs for
1382 	// an array of grab attack options.
1383 	//
1384 	// GRAB_ACTION_SELECT_FINISH is a special action not included
1385 	// in the array of grab attacks, and GRAB_ACTION_SELECT_MAX
1386 	// is used as the array size.
1387 
1388 	// Also note that AI selects which grab attack to perform
1389 	// by randomly generating a number from 0 to GRAB_ACTION_SELECT_MAX.
1390 	// This means GRAB_ACTION_SELECT_MAX should reflect number
1391 	// of options with exception of GRAB_ACTION_SELECT_FINISH,
1392 	// and that the value GRAB_ACTION_SELECT_FINISH should always
1393 	// fall outside of the 0 to GRAB_ACTION_SELECT_MAX range. Order
1394 	// of the options does not matter otherwise.
1395 
1396 	GRAB_ACTION_SELECT_ATTACK,
1397 	GRAB_ACTION_SELECT_BACKWARD,
1398 	GRAB_ACTION_SELECT_FORWARD,
1399 	GRAB_ACTION_SELECT_DOWN,
1400 	GRAB_ACTION_SELECT_UP,
1401 	GRAB_ACTION_SELECT_MAX,
1402 	GRAB_ACTION_SELECT_FINISH
1403 } e_grab_action_select;
1404 
1405 typedef enum
1406 {
1407     /*
1408     Komap application enum. When to apply KO map to entity.
1409     Damon V. Caskey
1410     2013-12-28
1411     */
1412 
1413     KOMAP_TYPE_IMMEDIATELY,    //Apply instantly.
1414     KOMAP_TYPE_LAST_FALL_FRAME //Apply on last frame of fall.
1415 } e_komap_type;
1416 
1417 typedef enum
1418 {
1419     LE_TYPE_NORMAL,
1420     LE_TYPE_CUT_SCENE,
1421     LE_TYPE_SELECT_SCREEN,
1422     LE_TYPE_SKIP_SELECT
1423 } e_le_type;
1424 
1425 typedef enum
1426 {
1427     LS_TYPE_NONE,        //No loading screen.
1428     LS_TYPE_BOTH,        //Background and status bar.
1429     LS_TYPE_BACKGROUND,  //Background only.
1430     LS_TYPE_BAR,         //Status bar only.
1431 } e_loadingScreenType;
1432 
1433 typedef enum
1434 {
1435     /*
1436     Model copy flag enum.
1437     Damon V. Caskey
1438     2013-12-28
1439     */
1440 
1441     MODEL_NO_COPY           = 0x00000001,   //dont copy anything from original model
1442     MODEL_NO_WEAPON_COPY    = 0x00000002,   //dont copy weapon list from original model
1443     MODEL_NO_SCRIPT_COPY    = 0x00000004    //don't copy scripts
1444 } e_model_copy;
1445 
1446 typedef enum
1447 {
1448     MF_NONE,
1449     MF_ANIMLIST,
1450     MF_COLOURMAP,
1451     MF_PALETTE              = 4,
1452     MF_WEAPONS              = 8,
1453     MF_BRANCH               = 16,
1454     MF_ANIMATION            = 32,
1455     MF_DEFENSE              = 64,
1456     MF_OFF_FACTORS          = 128,
1457     MF_SPECIAL              = 256,
1458     MF_SMARTBOMB            = 512,
1459     MF_SCRIPTS              = 1024,
1460     MF_ALL                  = 0x7ff
1461 } e_ModelFreetype;
1462 
1463 typedef enum
1464 {
1465     /*
1466     Over thr ground enum. Controls ability to hit downed targets.
1467     Damon V. Caskey
1468     2013-12-28
1469     */
1470 
1471    OTG_NONE,       //Cannot hit grounded targets.
1472    OTG_BOTH,       //Can hit grounded targets.
1473    OTG_GROUND_ONLY //Can ONLY hit grounded targets.
1474 } e_otg;
1475 
1476 typedef enum
1477 {
1478     /*
1479     Scroll enum.
1480     Damon V. Caskey
1481     2013-12-28
1482     */
1483 
1484     SCROLL_RIGHT        = 2,
1485     SCROLL_DOWN			= 4,
1486     SCROLL_LEFT			= 8,
1487     SCROLL_UP			= 16,
1488     SCROLL_BACK			= 1,
1489     SCROLL_BOTH			= (SCROLL_BACK|SCROLL_RIGHT),
1490     SCROLL_RIGHTLEFT    = SCROLL_BOTH,
1491     SCROLL_LEFTRIGHT    = (SCROLL_LEFT|SCROLL_BACK),
1492     SCROLL_INWARD       = 32,
1493     SCROLL_OUTWARD      = 64,
1494     SCROLL_OUTIN		= (SCROLL_OUTWARD|SCROLL_BACK),
1495     SCROLL_INOUT		= (SCROLL_INWARD|SCROLL_BACK),
1496     SCROLL_UPWARD       = 128,
1497     SCROLL_DOWNWARD     = 256
1498 } e_scroll;
1499 
1500 typedef enum
1501 {
1502     /*
1503     Slow motion switch enum.
1504     Damon V. Caskey
1505     2014-01-21
1506     */
1507 
1508     SLOW_MOTION_OFF,
1509     SLOW_MOTION_ON
1510 } e_slow_motion_enable;
1511 
1512 typedef enum
1513 {
1514     /*
1515     Weapon loss type enum.
1516     Damon V. Caskey
1517     2013-12-29
1518     */
1519 
1520     WEAPLOSS_TYPE_ANY,         //Weapon lost taking any hit.
1521     WEAPLOSS_TYPE_KNOCKDOWN,   //Weapon lost on knockdown.
1522     WEAPLOSS_TYPE_DEATH,       //Weapon lost on death.
1523     WEAPLOSS_TYPE_CHANGE       //weapon is lost only when level ends or character is changed during continue. This depends on the level settings and whether players had weapons on start or not.
1524 } e_weaploss_type;
1525 
1526 //macros for drawing menu text, fits different font size
1527 #define _strmidx(f,s, args...) ((videomodes.hRes-font_string_width((f), s, ##args))/2)
1528 #define _colx(f,c) ((int)(videomodes.hRes/2+(c)*(fontmonowidth((f))+1)))
1529 #define _liney(f,l) ((int)(videomodes.vRes/2+(l)*(fontheight((f))+1)))
1530 #define _menutextm(f, l, shift, s, args...) font_printf(_strmidx(f,s, ##args)+(int)((shift)*(fontmonowidth((f))+1)), _liney(f,l), (f), 0, s, ##args)
1531 #define _menutextmshift(f, l, shift, shiftx, shifty, s, args...) font_printf(_strmidx(f,s, ##args)+(int)((shift)*(fontmonowidth((f))+1))+shiftx, _liney(f,l)+shifty, (f), 0, s, ##args)
1532 #define _menutext(f, c, l, s, args...) font_printf(_colx(f,c), _liney(f,l), (f), 0, s, ##args)
1533 #define _menutextshift(f, c, l, shiftx, shifty, s, args...) font_printf(_colx(f,c)+shiftx, _liney(f,l)+shifty, (f), 0, s, ##args)
1534 
1535 //string starts with constant, for animation# series
1536 #define strclen(s) (sizeof(s)-1)
1537 #define starts_with(a, b) (strnicmp(a, b, strclen(b))==0)
1538 #define starts_with_num(a, b) (starts_with(a, b) && (!a[strclen(b)] || (a[strclen(b)] >= '1' && a[strclen(b)] <= '9')))
1539 #define get_tail_number(n, a, b) \
1540 n = atoi(a+strclen(b)); \
1541 if(n<1) n = 1;
1542 
1543 #define ABS(x) ((x)>0?(x):(-(x)))
1544 
1545 #define set_attacking(e) e->attacking = ATTACKING_PREPARED;\
1546 						 e->idling = IDLING_NONE;
1547 
1548 #define set_jumping(e)   e->jumping = 1;\
1549 						 e->idling = IDLING_NONE; \
1550 						 e->ducking = DUCK_NONE;
1551 
1552 #define set_charging(e)  e->charging = 1;\
1553 						 e->idling = IDLING_NONE; \
1554 						 e->ducking = DUCK_NONE;
1555 
1556 #define set_getting(e)   e->getting = 1;\
1557 						 e->idling = IDLING_NONE; \
1558 						 e->ducking = DUCK_NONE;
1559 
1560 #define set_blocking(e)  e->blocking = 1;\
1561 						 e->idling = IDLING_NONE;
1562 
1563 #define set_turning(e)  e->turning = 1;\
1564 						e->idling = IDLING_NONE; \
1565 						 e->ducking = DUCK_NONE;
1566 
1567 #define expand_time(e)   if(e->stalltime>0) e->stalltime++;\
1568 						 if(e->releasetime>0)e->releasetime++;\
1569 						 if(e->nextanim>0)e->nextanim++;\
1570 						 if(e->nextthink>0)e->nextthink++;\
1571 						 if(e->nextmove>0)e->nextmove++;\
1572 						 if(e->magictime>0)e->magictime++;\
1573 						 if(e->guardtime>0)e->guardtime++;\
1574 						 if(e->toss_time>0)e->toss_time++;\
1575 						 if(e->freezetime>0 && (textbox || smartbomber))e->freezetime++;\
1576 						 if(e->mpchargetime>0)e->mpchargetime++;\
1577 						 if(e->invinctime>0) e->invinctime++;\
1578 						 if(e->turntime>0) e->turntime++;\
1579 						 if(e->sealtime>0) e->sealtime++;
1580 /*                       if(e->dot_time>0) e->dot_time++;\
1581 						 if(e->dot_cnt>0) e->dot_cnt++;
1582 */
1583 
1584 #define freezeall        (smartbomber || textbox)
1585 
1586 #define is_projectile(e) (e->modeldata.type == TYPE_SHOT || e->model->subtype == SUBTYPE_ARROW || e->owner)
1587 
1588 #define screeny (level?((level->scrolldir == SCROLL_UP || level->scrolldir == SCROLL_DOWN )? 0:advancey ):0)
1589 #define screenx (level?advancex:0)
1590 
1591 #define tobounce(e) (e->animation->bounce && diff(0, e->velocity.y) > 1.5 && \
1592 					 !((autoland == 1 && e->damage_on_landing.attack_force == -1) || e->damage_on_landing.attack_force == -2))
1593 
1594 #define getpal ((current_palette&&level)?(level->palettes[current_palette-1]):pal)
1595 
1596 #define canbegrabbed(self, other) \
1597 		(other->animation->vulnerable[other->animpos] && \
1598 		 (!self->animation->move || self->animation->move[self->animpos]->axis.x == 0) && \
1599 		 (!self->animation->move || self->animation->move[self->animpos]->axis.z == 0 ) && \
1600 		 !(other->nograb || other->invincible & INVINCIBLE_INTANGIBLE || other->link || \
1601 		   other->model->animal || inair(other) || \
1602 		  (self->modeldata.type == TYPE_PLAYER && other->modeldata.type == TYPE_PLAYER && savedata.mode)))
1603 
1604 #define cangrab(self, other) \
1605 		((other->modeldata.antigrab - self->modeldata.grabforce + \
1606 		  (other->modeldata.paingrab?(other->modeldata.paingrab-other->inpain):0)<=0) &&\
1607 		 canbegrabbed(self, other) && \
1608 		 !inair_range(self) && \
1609 		 diff(other->position.y, self->position.y) <= T_WALKOFF)
1610 		 //diff(other->position.y, self->position.y) <= 0.1)
1611 
1612 #define validanim(e, a) ((e)->modeldata.animation[a]&&(e)->modeldata.animation[a]->numframes)
1613 
1614 #define inScreen ( selectScreen || titleScreen || hallOfFame || gameOver || showComplete || currentScene || enginecreditsScreen || menuScreen || startgameMenu || \
1615                   newgameMenu || loadgameMenu || optionsMenu || controloptionsMenu || soundoptionsMenu || videooptionsMenu || systemoptionsMenu )
1616 
1617 //#define     MAX_MOVES             16
1618 //#define     MAX_MOVE_STEPS        16
1619 
1620 #pragma pack(4)
1621 
1622 // Caskey, Damon V.
1623 // 2014-01-20
1624 //
1625 // Axis - Horizontal and lateral only (float).
1626 typedef struct
1627 {
1628     float x;    // Horizontal axis.
1629     float z;    // Lateral axis.
1630 } s_axis_plane_lateral_float;
1631 
1632 // Caskey, Damon V.
1633 // 2014-01-20
1634 //
1635 // Axis - Horizontal and lateral only (int).
1636 typedef struct
1637 {
1638     int x;    // Horizontal axis.
1639     int z;    // Lateral axis.
1640 } s_axis_plane_lateral_int;
1641 
1642 // Caskey, Damon V.
1643 // 2014-01-20
1644 //
1645 // Axis - Horizontal and vertical only (int).
1646 typedef struct
1647 {
1648     int x;      // Horizontal axis.
1649     int y;      // Altitude/Vertical axis.
1650 } s_axis_plane_vertical_int;
1651 
1652 // Caskey, Damon V.
1653 // 2018-04-18
1654 //
1655 // Axis - 3D float.
1656 typedef struct
1657 {
1658     float x;
1659     float y;
1660     float z;
1661 } s_axis_principal_float;
1662 
1663 // Caskey, Damon V.
1664 // 2018-04-18
1665 //
1666 // Axis - 3D int.
1667 typedef struct
1668 {
1669     int x;
1670     int y;
1671     int z;
1672 } s_axis_principal_int;
1673 
1674 typedef struct
1675 {
1676     s_axis_principal_int    axis;
1677     int                     base;
1678 } s_move;
1679 
1680 // distance x and z for edge animation
1681 typedef struct
1682 {
1683     float x;
1684     float z;
1685 } s_edge_range;
1686 
1687 typedef struct
1688 {
1689     /*
1690     Min/max cap for integer measurements.
1691     2013-12-10
1692     Damon Caskey
1693     */
1694 
1695     int max;    //max value.
1696     int min;    //min value.
1697 } s_metric_range;
1698 
1699 typedef struct
1700 {
1701     /*
1702     Min/current/max cap for integer measurements.
1703     2014-01-20
1704     Damon Caskey
1705     */
1706 
1707     int current;    //Current.
1708     int max;    //max value.
1709     int min;    //min value.
1710 } s_metric_range_current;
1711 
1712 typedef struct
1713 {
1714     unsigned compatibleversion;
1715     char dName[MAX_NAME_LEN]; // Difficulty Name
1716     unsigned level; // Level Number
1717     unsigned stage; // Stage
1718     unsigned pLives[MAX_PLAYERS]; // Player Lives Left
1719     unsigned pCredits[MAX_PLAYERS]; // Player Credits Left
1720     unsigned pScores[MAX_PLAYERS]; // Player Scores
1721     unsigned credits; // Number Of Credits
1722     unsigned times_completed;
1723     unsigned which_set;
1724     //-------------------new strict save features-----------------------
1725     int flag; // 0 useless slot 1 only load level number 2 load player info and level
1726     char pName[MAX_PLAYERS][MAX_NAME_LEN];   // player names
1727     int pSpawnhealth[MAX_PLAYERS];              // hit points left
1728     int pSpawnmp[MAX_PLAYERS];                  // magic points left
1729     int pWeapnum[MAX_PLAYERS];                  // weapon
1730     int pColourmap[MAX_PLAYERS];                // colour map
1731 
1732     int selectFlag;                             // saved a select.txt infos
1733     char allowSelectArgs[MAX_ALLOWSELECT_LEN];      // allowselect arguments
1734     char selectMusic[MAX_ARG_LEN];          // select music arguments
1735     char selectBackground[MAX_ARG_LEN];     // select background arguments
1736     char selectLoad[MAX_SELECT_LOADS][MAX_ARG_LEN];           // select load arguments
1737     int selectLoadCount;
1738     char selectSkipSelect[MAX_ARG_LEN];     // skipselect arguments
1739 } s_savelevel;
1740 
1741 typedef struct
1742 {
1743     unsigned compatibleversion;
1744     unsigned highsc[10];
1745     char hscoren[10][MAX_NAME_LEN];
1746 } s_savescore;
1747 
1748 typedef struct
1749 {
1750     /*
1751     Slow motion struct
1752     Damon V. Caskey
1753     2014-01-21
1754     */
1755 
1756     int duration;
1757     int counter;
1758     int toggle;
1759 } s_slow_motion;
1760 
1761 // Caskey, Damon V.
1762 // 2011-04-08
1763 //
1764 // Delay modifiers before rise or
1765 // riseattack can take place.
1766 typedef struct
1767 {
1768     unsigned int rise;               // Time modifier before rise.
1769     unsigned int riseattack;         // Time modifier before riseattack.
1770     unsigned int riseattack_stall;   // Total stalltime before riseattack.
1771 } s_staydown;
1772 
1773 // Caskey, Damon V.
1774 // 2016-10-31
1775 //
1776 // Recursive damage structure
1777 // for attack boxes and damage
1778 // recipient.
1779 typedef struct s_damage_recursive
1780 {
1781     int							force;  // Damage force per tick.
1782     int							index;  // Index.
1783 	e_damage_recursive			mode;   // Mode.
1784     int							rate;   // Tick delay.
1785 	int							tag;	// User defined value.
1786 	unsigned int				tick;   // Time of next tick.
1787     unsigned int				time;   // Time to expire.
1788 	int							type;	// Attack type.
1789 	struct entity				*owner;	// Entity that caused the recursive damage.
1790 	struct s_damage_recursive	*next;	// Next node of linked list.
1791 } s_damage_recursive;
1792 
1793 typedef struct
1794 {
1795 	int x;
1796 	int y;
1797 	int width;
1798 	int height;
1799 	int z1;
1800 	int z2;
1801 } s_hitbox;
1802 
1803 typedef struct
1804 {
1805     float       blockpower;     // If > unblockable, this attack type is blocked.
1806     float       blockthreshold; // Strongest attack from this attack type that can be blocked.
1807     float       blockratio;     // % of damage still taken from this attack type when blocked.
1808     e_blocktype blocktype;      // Resource drained when attack is blocked.
1809     float       factor;         // basic defense factors: damage = damage*defense
1810     float       knockdown;      // Knockdowncount (like knockdowncount) for attack type.
1811     float       pain;           // Pain factor (like nopain) for defense type.
1812 } s_defense;
1813 
1814 // Caskey, Damon V.
1815 // 2018-04-10
1816 //
1817 // Causing damage when an entity lands from
1818 // a fall.
1819 typedef struct
1820 {
1821     int attack_force;
1822     e_attack_types attack_type;
1823 } s_damage_on_landing;
1824 
1825 // Caskey, Damon V.
1826 // 2016-10~
1827 //
1828 // Collision box for detecting
1829 // body boxes.
1830 typedef struct
1831 {
1832     s_hitbox    *coords;        // Collision box dimensions.
1833     s_defense   *defense;       // Defense properties for this collision box only.
1834     int         index;          // To enable user tracking of this box's index when multiple instances are in use.
1835     int         tag;            // User defined tag for scripts. No hard coded purpose.
1836 } s_collision_body;
1837 
1838 // Caskey, Damon V.
1839 // 2016-10~
1840 //
1841 // List of collision body boxes
1842 // per animation frame.
1843 typedef struct
1844 {
1845     s_collision_body **instance;
1846 } s_collision_body_list;
1847 
1848 // Collision box for detecting
1849 // entity boxes.
1850 typedef struct
1851 {
1852     s_hitbox    *coords;        // Collision box dimensions.
1853     int         index;          // To enable user tracking of this box's index when multiple instances are in use.
1854     int         tag;            // User defined tag for scripts. No hard coded purpose.
1855 } s_collision_entity;
1856 
1857 // List of collision body boxes
1858 // per animation frame.
1859 typedef struct
1860 {
1861     s_collision_entity **instance;
1862 } s_collision_entity_list;
1863 
1864 // Collision box for active
1865 // attacks.
1866 typedef struct
1867 {
1868     bool                blast;              // Attack box active on hit opponent's fall animation.
1869     bool                steal;              // Add damage to owner's hp.
1870     bool                ignore_attack_id;   // Ignore attack ID to attack in every frame
1871     bool                no_flash;           // Flag to determine if an attack spawns a flash or not
1872     bool                no_kill;            // this attack won't kill target (leave 1 HP)
1873     bool                no_pain;            // No animation reaction on hit.
1874     int                 attack_drop;        // now be a knock-down factor, how many this attack will knock victim down
1875     int                 attack_type;        // Reaction animation, death, etc.
1876     int                 counterattack;      // Treat other attack boxes as body box.
1877     int                 freeze;             // Lock target in place and set freeze time.
1878     int                 jugglecost;         // cost for juggling a falling ent
1879     int                 no_block;           // If this is greater than defense block power, make the hit
1880     int                 pause_add;          // Flag to determine if an attack adds a pause before updating the animation
1881     int                 seal;               // Disable target's animations with energycost > seal.
1882     e_otg               otg;                // Over The Ground. Gives ground projectiles the ability to hit lying ents.
1883     e_direction_adjust  force_direction;    // Adjust target's direction on hit.
1884     int                 attack_force;       // Hit point damage attack inflicts.
1885     int                 blockflash;         // Custom bflash for each animation, model id
1886     int                 blocksound;         // Custom sound for when an attack is blocked
1887     int                 forcemap;           // Set target's palette on hit.
1888     unsigned int        freezetime;         // Time for target to remain frozen.
1889     int                 grab;               // Not a grab as in grapple - behavior on hit for setting target's position
1890     int                 guardcost;          // cost for blocking an attack
1891     int                 hitflash;           // Custom flash for each animation, model id
1892     int                 hitsound;           // Sound effect to be played when attack hits opponent
1893     int                 index;              // Possible future support of multiple boxes - it's doubt even if support is added this property will be needed.
1894     unsigned int        maptime;            // Time for forcemap to remain in effect.
1895     unsigned int        next_hit_time;          // pain invincible time
1896     unsigned int        sealtime;           // Time for seal to remain in effect.
1897     int                 tag;                // User defined tag for scripts. No hard coded purpose.
1898     int                 grab_distance;      // Distance used by "grab".
1899     s_axis_principal_float            dropv;              // Velocity of target if knocked down.
1900     s_damage_on_landing damage_on_landing;  // Cause damage when target entity lands from fall.
1901     s_staydown          staydown;           // Modify victum's stayodwn properties.
1902     s_damage_recursive  *recursive;         // Set up recursive damage (dot) on hit.
1903     s_hitbox            *coords;            // Collision detection coordinates.
1904 } s_collision_attack;
1905 
1906 // Caskey, Damon V.
1907 // 2016-10~
1908 //
1909 // List of collision attack boxes
1910 // per animation frame.
1911 typedef struct
1912 {
1913     s_collision_attack **instance;
1914 } s_collision_attack_list;
1915 
1916 // Caskey, Damon V.
1917 // 2013-12-15
1918 //
1919 // Last hit structure. Populated each time a collision is detected.
1920 typedef struct
1921 {
1922     int						confirm;    // Will engine's default hit handling be used?
1923     s_axis_principal_float	position;   // X,Y,Z of last hit.
1924     s_collision_attack		*attack;    // Collision attacking box.
1925     s_collision_body		*body;      // Collision detect box.
1926 	struct entity			*target;	// Entity taking the hit.
1927 	struct entity			*attacker;	// Entity dishing out the hit.
1928 } s_lasthit;
1929 
1930 typedef struct
1931 {
1932     /*
1933     Counter action when taking hit.
1934     Damon V. Caskey
1935     2011-04-01
1936     */
1937 
1938     e_counteraction_condition condition; //Counter conditions.
1939     e_counteraction_damage damaged;      //Receive damage from attack.
1940     s_metric_range frame;   //Frame range.
1941 } s_counterrange;
1942 
1943 typedef struct
1944 {
1945     /*
1946     HP and/or MP cost to perform special/freespecials.
1947     Damon V. Caskey
1948     2011-04-01
1949     */
1950 
1951     int cost;           //Amount of energy cost.
1952     int disable;        //Disable flag. See check_energy function.
1953     e_cost_type mponly; //MPonly type. 0 = MP while available, then HP. 1 = MP only. 2 = HP only.
1954 } s_energycost;
1955 
1956 // Caskey, Damon V.
1957 // 2011-04-01
1958 //
1959 // On frame movement (slide, jump, dive, etc.).
1960 typedef struct
1961 {
1962     unsigned int  frame;      // Frame to perform action.
1963     int                 ent;        // Index of entity to spawn.
1964     s_axis_principal_float            velocity;   // x,a,z velocity.
1965 } s_onframe_move;
1966 
1967 // Caskey, Damon V.
1968 // 2018-04-20
1969 //
1970 // On frame action, where no movement is needed. (Landing, starting to fall...).
1971 typedef struct
1972 {
1973     unsigned int  frame;  // Frame to perform action.
1974     int         ent;        // Index of entity to spawn.
1975 } s_onframe_set;
1976 
1977 typedef struct
1978 {
1979     /*
1980     Animation looping.
1981     Damon V. Caskey
1982     2011-04-01
1983     */
1984 
1985     s_metric_range frame;   // max = Frame animation reaches before looping, min = Frame animation loops back to.
1986     int mode;           // 0 = No loop, 1 = Loop. Redundant after frame additions, but needed for backward compatibility.
1987 } s_loop;
1988 
1989 typedef struct //2011_04_01, DC: Frame based screen shake functionality.
1990 {
1991     int cnt;        //Repetition count.
1992     int framestart; //Frame to start quake.
1993     int repeat;     //Repetitons.
1994     int v;          //Vertical distance of screen movement (in pixels).
1995 } s_quakeframe;
1996 
1997 // Caskey, Damon V.
1998 //
1999 // Distance to target verification for AI running, jumping,
2000 // following parent, and combo chains for all entity types.
2001 typedef struct
2002 {
2003     s_metric_range base;
2004     s_metric_range x;
2005     s_metric_range y;
2006     s_metric_range z;
2007 } s_range;
2008 
2009 typedef struct
2010 {
2011     /*
2012     Model/entity level delay modifier.
2013     Damon V. Caskey
2014     (unknown date) revised 2013-12-16.
2015     */
2016     s_metric_range cap;
2017     float factor;
2018     e_edelay_mode mode;
2019     s_metric_range range;
2020 } s_edelay;
2021 
2022 typedef struct
2023 {
2024     /*
2025     Follow up animation struct.
2026     Damon V. caskey
2027     2014-01-04
2028     */
2029 
2030     unsigned int animation;   // Follow animation to perform.
2031     e_follow_condition condition;   // Condition in which follow up will be performed.
2032 } s_follow;
2033 
2034 // Caskey, Damon V.
2035 // 2014-01-18
2036 //
2037 // Projectile spawning.
2038 typedef struct
2039 {
2040     unsigned int      shootframe;
2041     unsigned int      throwframe;
2042     unsigned int      tossframe;  // Frame to toss bomb/grenade
2043     int                     bomb;       // custbomb;
2044     int                     flash;      // custpshotno;
2045     int                     knife;      // custknife;
2046     s_axis_principal_int  position;   // Location at which projectiles are spawned
2047     int                     star;       // custstar;
2048 } s_projectile;
2049 
2050 typedef struct
2051 {
2052     bool                    antigrav;               // This animation ignores gravity.
2053     int                     animhits;               // How many consecutive hits have been made? Used for canceling.
2054     unsigned int            chargetime;             // charge time for an animation
2055     int                     flipframe;              // Turns entities around on the desired frame
2056     int                     numframes;              // Count of frames in the animation.
2057     int                     unsummonframe;          // Un-summon the entity
2058     bool                    attackone;              // Attack hits only one target.
2059     int                     cancel;                 // Cancel anims with freespecial
2060     int                     index;                  // unique id
2061     int                     model_index;
2062     int                     subentity;              // Store the sub-entity's name for further use
2063     int                     sync;                   // Synchronize frame to previous animation if they matches
2064     float                   bounce;                 // -tossv/bounce = new tossv
2065     s_follow                followup;               // Subsequent animation on hit.
2066     s_loop                  loop;                   // Animation looping. 2011_03_31, DC: Moved to struct.
2067     s_projectile            projectile;             // Subentity spawn for knives, stars, bombs, hadoken, etc.
2068     s_quakeframe            quakeframe;             // Screen shake effect. 2011_04_01, DC; Moved to struct.
2069     s_range                 range;                  // Verify distance to target, jump landings, etc.. 2011_04_01, DC: Moved to struct.
2070     s_axis_principal_int                size;                   // Dimensions (height, width).
2071     unsigned                *idle;                  // Allow free move
2072     int                     *delay;
2073     float                   (*platform)[8];         // Now entities can have others land on them
2074     int                     *shadow;
2075     int                     (*shadow_coords)[2];    // x, z offset of shadow
2076     int                     *soundtoplay;           // each frame can have a sound
2077     float                   *spawnframe;            // Spawn the subentity as its default type. {frame} {x} {z} {a} {relative?}
2078     float                   *starvelocity;          // 3 velocities for the start projectile
2079     int                     *sprite;                // sprite[set][framenumber]
2080     float                   *summonframe;           // Summon the subentity as an ally, only one though {frame} {x} {z} {a} {relative?}
2081     int                     *vulnerable;
2082     int                     *weaponframe;           // Specify with a frame when to switch to a weapon model
2083     s_collision_attack_list **collision_attack;
2084     s_collision_body_list   **collision_body;
2085     s_collision_entity_list **collision_entity;
2086     s_counterrange          *counterrange;           // Auto counter attack. 2011_04_01, DC: Moved to struct.
2087     s_drawmethod            **drawmethods;
2088     s_onframe_set           *dropframe;             // if tossv < 0, this frame will be set
2089     s_onframe_move          *jumpframe;              // Jumpframe action. 2011_04_01, DC: moved to struct.
2090     s_onframe_set           *landframe;             // Landing behavior.
2091     s_energycost            *energycost;            // 1-10-05 to adjust the amount of energy used for specials. 2011_03_31, DC: Moved to struct.
2092     s_move                  **move;                 // base = seta, x = move, y = movea, z = movez
2093     s_axis_plane_vertical_int   **offset;               // original sprite offsets
2094 } s_anim;
2095 
2096 struct animlist
2097 {
2098     s_anim *anim;
2099     struct animlist *next;
2100 };
2101 typedef struct animlist s_anim_list;
2102 extern s_anim_list *anim_list;
2103 
2104 typedef struct
2105 {
2106     s_axis_plane_vertical_int offset;
2107     s_axis_plane_vertical_int size;
2108     e_bartype type;
2109     e_barorient orientation;
2110     int noborder;
2111     e_bar_dir direction;
2112     int barlayer;
2113     int backlayer;
2114     int borderlayer;
2115     int shadowlayer;
2116     int (*colourtable)[11]; //0 default backfill 1-10 foreground colours
2117 } s_barstatus;
2118 
2119 typedef struct
2120 {
2121     e_loadingScreenType set;    //Loading bar mode.
2122     int tf;                     //Font number for "LOADING" text (last element in command, moved here because of alignment)
2123     s_axis_plane_vertical_int bar_position;   //Loading bar position.
2124     s_axis_plane_vertical_int text_position;  //Loading text position.
2125     int bsize;                  // length of bar in pixels
2126     int refreshMs;              // modder defined number of milliseconds in which the screen is updated while loading
2127 } s_loadingbar;
2128 
2129 typedef struct
2130 {
2131     Script         *animation_script;               //system generated script
2132     Script         *update_script;                  //execute when update_ents
2133     Script         *think_script;                   //execute when entity thinks.
2134     Script         *takedamage_script;              //execute when taking damage.
2135     Script         *on_bind_update_other_to_self_script;   //execute when adjust_bind runs, for the bind target entity.
2136     Script         *on_bind_update_self_to_other_script;   //execute when adjust_bind runs, for the bound entity.
2137     Script         *ondeath_script;                 //execute when killed in game.
2138     Script         *onkill_script;                  //execute when removed from play.
2139     Script         *onpain_script;                  //Execute when put in pain animation.
2140     Script         *onfall_script;                  //execute when falling.
2141     Script         *inhole_script;                  //execute when yoy're in a hole
2142     Script         *onblocks_script;                //execute when blocked by screen.
2143     Script         *onblockw_script;                //execute when blocked by wall.
2144     Script         *onblockp_script;                //execute when blocked by platform.
2145     Script         *onblocko_script;                //execute when blocked by obstacle.
2146     Script         *onblockz_script;                //execute when blocked by Z.
2147     Script         *onblocka_script;                //execute when "hit head".
2148     Script         *onmovex_script;                 //execute when moving along X axis.
2149     Script         *onmovez_script;                 //execute when moving along Z axis.
2150     Script         *onmovea_script;                 //execute when moving along A axis.
2151     Script         *didhit_script;                  //execute when attack hits another.
2152     Script         *onspawn_script;                 //execute when spawned.
2153     Script         *key_script;                     //execute when entity's player presses a key
2154     Script         *didblock_script;                //execute when blocking attack.
2155     Script         *ondoattack_script;              //execute when attack passes do_attack checks.
2156     Script			*onmodelcopy_script;			//execute when set_model_ex is done
2157     Script			*ondraw_script;					//when update_ents is called
2158     Script			*onentitycollision_script;		//execute when entity collides with other entity
2159 } s_scripts;
2160 
2161 typedef struct
2162 {
2163     /*
2164     In game icons added 2005_01_20.
2165     2011-04-05
2166     Damon V. Caskey
2167     */
2168 
2169     int def; //Default icon.
2170     int die; //Health depleted.
2171     int get; //Retrieving item.
2172     int mphigh; //MP bar icon; at 66% or more (default if other mp icons not used).
2173     int mplow; //MP bar icon; at or between 0% and 32%.
2174     int mpmed; //MP bar icon; at or between 33% and 65%.
2175     int pain; //Taking damage.
2176     int usemap;
2177     int weapon; //Weapon model.
2178     s_axis_plane_vertical_int position;
2179 } s_icon;
2180 
2181 typedef struct
2182 {
2183     /*
2184     Pre defined color map selections and behavior.
2185     Damon V. Caskey
2186     2011_04_07
2187     */
2188 
2189     int frozen;             //Frozen.
2190     int hide_end;           //End range for maps hidden during character selection.
2191     int hide_start;         //Start range for maps hidden during character selection.
2192     int ko;                 //Health depleted.
2193     e_komap_type kotype;   //KO map application.
2194 } s_maps;
2195 
2196 typedef struct
2197 {
2198     /*
2199     Perception distance (range from self AI can detect other entities).
2200     Damon V. Caskey
2201     2013-12-16
2202     */
2203 
2204     s_axis_principal_int max;   //Maximum.
2205     s_axis_principal_int min;   //Minimum.
2206 } s_sight;
2207 
2208 typedef struct
2209 {
2210     signed char     detect;                         //Invisbility penetration. If self's detect >= target's hide, self can "see" target.
2211     signed char     hide;                           //Invisibility to AI.
2212 } s_stealth;                                        //2011_04_05, DC: Invisibility to AI feature added by DC.
2213 
2214 
2215 // WIP
2216 typedef struct
2217 {
2218     int input[MAX_SPECIAL_INPUTS];
2219     int	steps;
2220     int numkeys; // num keys pressed
2221     int anim;
2222     int	cancel;		//should be fine to have 0 if idle is not a valid choice
2223     s_metric_range frame;
2224     int hits;
2225     int valid;		// should not be global unless nosame is set, but anyway...
2226     //int (*function)(); //reserved
2227 } s_com;
2228 
2229 //UT: new bit flags for noquake property
2230 #define NO_QUAKE 1  //do not make screen quake
2231 #define NO_QUAKEN 2  //do not quake with screen
2232 
2233 typedef struct
2234 {
2235     /*
2236     Dust struct. "Dust" effect entity spawned during certain actions.
2237     Damon V. Caskey
2238     2013-12-28
2239     */
2240 
2241     int fall_land;  //Knockdown landing.
2242     int jump_land;  //Jump landing.
2243     int jump_start; //Jump lift off.
2244 } s_dust;
2245 
2246 typedef struct
2247 {
2248     int index;
2249     char *name;
2250     char *path; // Path, so scripts can dynamically get files, sprites, sounds, etc.
2251     unsigned score;
2252     int health;
2253     float scroll; // Autoscroll like panel entity.
2254     unsigned offscreenkill;                  // for biker, arrow, etc
2255     float offscreen_noatk_factor;
2256     int	priority;
2257     //unsigned offscreenkillz;
2258     //unsigned offscreeenkila;
2259     int mp; // mp's variable for mpbar by tails
2260     int counter; // counter of weapons by tails
2261     unsigned shootnum; // counter of shots by tails
2262     unsigned reload; // reload max shots by tails
2263     int deduct_ammo; // Used for setting the "a" at which weapons are spawned
2264     int typeshot; // see if weapon is a gun or knife by tails
2265     int animal; // see is the weapon is a animal by tails
2266     int nolife; // Feb 25, 2005 - Variable flag to show life 0 = no, else yes
2267     int makeinv; // Option to spawn player invincible >0 blink <0 noblink
2268     int riseinv; // how many seconds will the character become invincible after rise >0 blink, <0 noblink
2269     int dofreeze; // Flag to freeze all enemies/players while special is executed
2270     int noquake; // Flag to make the screen shake when entity lands 1 = no, else yes
2271     int ground; // Flag to determine if enemy projectiles only hit the enemy when hitting the ground
2272     int multiple; // So you can control how many points are given for hitting opponents
2273     int bounce; // Flag to determine if bounce/quake is to be used.
2274     e_entity_type type;
2275     e_entity_type_sub subtype;
2276     s_icon icon; //In game icons added 2005_01_20. 2011_04_05, DC: Moved to struct.
2277     int parrow[MAX_PLAYERS][3]; // Image to be displayed when player spawns invincible
2278     int setlayer; // Used for forcing enities to be displayed behind
2279     int thold; // The entities threshold for block
2280     s_maps maps; //2011_04_07, DC: Pre defined color map selections and behavior.
2281     int alpha; // New alpha variable to determine if the entity uses alpha transparency
2282     int toflip; // Flag to determine if flashes flip or not
2283     int shadow;
2284     int gfxshadow; // use current frame to create a shadow
2285     int shadowbase;
2286     int aironly; // Used to determine if shadows will be shown when jumping only
2287     int nomove; // Flag for static enemies
2288     int noflip; // Flag to determine if static enemies flip or stay facing the same direction
2289     int nodrop; // Flag to determine if enemies can be knocked down
2290     int nodieblink; // Flag to determine if blinking while playing die animation
2291     int holdblock; // Continue the block animation as long as the player holds the button down
2292     int nopassiveblock; // Don't auto block randomly
2293     int blockback; // Able to block attacks from behind
2294     int blockodds; // Odds that an enemy will block an attack (1 : blockodds)
2295     s_edelay edelay; // Entity level delay adjustment.
2296     float runspeed; // The speed the character runs at
2297     float runjumpheight; // The height the character jumps when running
2298     float runjumpdist; // The distance the character jumps when running
2299     int noatflash; // Flag to determine if attacking characters attack spawns a flash
2300     int runupdown; // Flag to determine if a player will continue to run while pressing up or down
2301     int runhold; // Flag to determine if a player will continue to run if holding down forward when landing
2302     int remove; // Flag to remove a projectile on contact or not
2303     float throwheight; // The height at which an opponent can now be adjusted
2304     float throwdist; // The distance an opponent can now be adjusted
2305     int throwframewait; // The frame victim is thrown during ANIM_THROW, added by kbandressen 10/20/06
2306     s_com *special; // Stores freespecials
2307     int specials_loaded; // Stores how many specials have been loaded
2308     int diesound;
2309     int weapnum;
2310     int secret;
2311     int clearcount;
2312     int weaploss[2]; // Determines possibility of losing weapon.
2313     int ownweapons; // is the weapon list own or share with others
2314     int *weapon; // weapon model list
2315     int numweapons;
2316 
2317     // these are model id of various stuff
2318     int project;
2319     int rider; // 7-1-2005 now every "biker" can have a new driver!
2320     int knife; // 7-1-2005 now every enemy can have their own "knife" projectile
2321     int pshotno; // 7-1-2005 now every enemy can have their own "knife" projectile
2322     int star; // 7-1-2005 now every enemy can have their own "ninja star" projectiles
2323     int bomb; // New projectile type for exploding bombs/grenades/dynamite
2324     int flash; // Now each entity can have their own flash
2325     int bflash; // Flash that plays when an attack is blocked
2326     s_dust dust; //Spawn entity during certain actions.
2327     s_axis_plane_vertical_int size; // Used to set height of player in pixels
2328     float speed;
2329     float grabdistance; // 30-12-2004	grabdistance varirable adder per character
2330     float pathfindstep; // UT: how long each step if the entity is trying to find a way
2331     int grabflip; // Flip target or not, bit0: grabber, bit1: opponent
2332     float jumpspeed; // normal jump foward speed, default to max(1, speed)
2333     float jumpheight; // 28-12-2004	Jump height variable added per character
2334     int jumpmovex; // low byte: 0 default 1 flip in air, 2 move in air, 3 flip and move
2335     int jumpmovez; // 2nd byte: 0 default 1 zjump with flip(not implemented yet) 2 z jump move in air, 3 1+2
2336     int walkoffmovex; // low byte: 0 default 1 flip in air, 2 move in air, 3 flip and move
2337     int walkoffmovez; // 2nd byte: 0 default 1 zjump with flip(not implemented yet) 2 z jump move in air, 3 1+2
2338     int grabfinish; // wait for grab animation to finish before do other actoins
2339     int antigrab; // anti-grab factor
2340     int grabforce; // grab factor, antigrab - grabforce <= 0 means can grab
2341     e_facing_adjust facing;
2342     int grabback; // Flag to determine if entities grab images display behind opponenets
2343     int grabturn;
2344     int paingrab; // Can only be grabbed when in pain
2345     float grabwalkspeed;
2346     int throwdamage; // 1-14-05  adjust throw damage
2347     unsigned char  *palette; // original palette for 32/16bit mode
2348     unsigned char	**colourmap;
2349     int maps_loaded; // Used for player colourmap selecting
2350     int unload; // Unload model after level completed?
2351     int falldie; // Play die animation?
2352     int globalmap; // use global palette for its colour map in 24bit mode
2353     int nopain;
2354     int summonkill; // kill it's summoned entity when died;  0. dont kill 1. kill summoned only 2. kill all spawned entity
2355     int combostyle;
2356     int blockpain;
2357     int atchain[MAX_ATCHAIN];
2358     int chainlength;
2359     s_anim **animation;
2360     int credit;
2361     int escapehits; // Escape spammers!
2362     int chargerate; // For the charge animation
2363     int guardrate; // Rate for guardpoints recover.
2364     int mprate; // For time-based mp recovery.
2365     int mpdroprate; // Time based MP loss.
2366     int mpstable; // MP stable type.
2367     int mpstableval; // MP Stable target.
2368     int aggression; // For enemy A.I.
2369     s_staydown risetime;
2370     unsigned sleepwait;
2371     int riseattacktype;
2372     s_metric_range_current jugglepoints; // Juggle points feature by OX. 2011_04_05, DC: Moved to struct.
2373     s_metric_range_current guardpoints; // Guard points feature by OX. 2011_04_05, DC: Moved to struct.
2374     int mpswitch; // switch between reduce or gain mp for mpstabletype 4
2375     int turndelay; // turn delay
2376     int lifespan; // lifespan count down
2377     float knockdowncount; // the knock down count for this entity
2378     float attackthrottle; // how often the enemy refuse to attack
2379     float attackthrottletime; // how long does the throttle status last
2380     s_stealth stealth; // Invisibility to AI feature added by DC. 2011_04_05, DC: Moved to struct.
2381     s_edge_range edgerange; // Edge range
2382     int entitypushing; // entity pushing active in entity collision
2383     float pushingfactor; // pushing factor in entity collision
2384 
2385     //---------------new A.I. switches-----------
2386     int hostile; // specify hostile types
2387     int candamage; // specify types that can be damaged by this entity
2388     int projectilehit; // specify types that can be hit by this entity if it is thrown
2389     unsigned aimove; // move style
2390     s_sight sight; // Sight range. 2011_04_05, DC: Moved to struct.
2391     unsigned aiattack; // attack/defend style
2392 
2393     //----------------physical system-------------------
2394     float antigravity;                    //antigravity : gravity * (1- antigravity)
2395 
2396     //--------------new property for endlevel item--------
2397     char *branch; //level branch name
2398     int model_flag; //used to judge some copy method when setting new model to an entity
2399 
2400     s_defense *defense; //defense related, make a struct to aid copying
2401     float *offense_factors; //basic offense factors: damage = damage*offense
2402     s_collision_attack *smartbomb;
2403 
2404     // e.g., boss
2405     s_barstatus hpbarstatus;
2406     int hpx;
2407     int hpy;
2408     int namex;
2409     int namey;
2410 
2411     // movement flags
2412     int subject_to_basemap;
2413     int subject_to_wall;
2414     int subject_to_platform;
2415     int subject_to_obstacle;
2416     int subject_to_hole;
2417     int subject_to_gravity;
2418     int subject_to_screen;
2419     int subject_to_minz;
2420     int subject_to_maxz;
2421     int no_adjust_base; // dont change base to 0 automatically
2422     int instantitemdeath; // no delay before item suicides
2423     int	hasPlatforms;
2424     int isSubclassed;
2425     int backpain;
2426     int nohithead; // used to hit or not a platform with head also when you set a height
2427     int hitwalltype; // wall type to toggle hitwall animations
2428     e_ModelFreetype freetypes;
2429     s_scripts *scripts;
2430 } s_model;
2431 
2432 typedef struct
2433 {
2434     char *name;
2435     char *path;
2436     s_model *model;
2437     int loadflag;
2438     int selectable;
2439 } s_modelcache;
2440 extern s_modelcache *model_cache;
2441 
2442 // Caskey, Damon V.
2443 // 2013-12-08
2444 //
2445 // Jumping action setup.
2446 typedef struct
2447 {
2448     e_animations    animation_id;   // Jumping Animation.
2449     s_axis_principal_float        velocity;       // x,a,z velocity setting.
2450 } s_jump;
2451 
2452 // Caskey, Damon V.
2453 // 2013-12-17
2454 //
2455 // Binding struct. Control linking
2456 // of entity to a target entity.
2457 typedef struct
2458 {
2459     unsigned int            match;			// Animation binding type. ~~
2460     int                     tag;            // User data.
2461     int                     sortid;         // Relative binding sortid. Default = -1
2462     int                     frame;          // Frame to match (only if requested in matching).
2463     e_bind_override			overriding;     // Override specific AI behaviors while in bind (fall land, drop frame, specials, etc).
2464     e_animations            animation;      // Animation to match (only if requested in matching).
2465     s_axis_principal_int    positioning;    // Toggle binding on X, Y and Z axis.
2466     s_axis_principal_int    offset;         // x,y,z offset.
2467     e_direction_adjust      direction;      // Direction force.
2468     struct entity           *ent;           // Entity subject will bind itself to.
2469 } s_bind;
2470 
2471 typedef struct
2472 {
2473     /*
2474     Rush combo struct.
2475     Damon V. Caskey
2476     2013-12-17
2477     */
2478 
2479     s_metric_range_current count;   //Hits counter.
2480     u32 time;           //Time to perform combo.
2481 } s_rush;
2482 
2483 typedef struct
2484 {
2485     int health_current;
2486     int health_old;
2487     int mp_current;
2488     int mp_old;
2489 } s_energy_state;
2490 
2491 // Caskey, Damon V.
2492 // 2018-04-25
2493 //
2494 // Entity item values. Encapsulates properties
2495 // entity uses for item pickups.
2496 typedef struct
2497 {
2498     int alpha;                      // int itemmap alpha effect of item
2499     int colorset;                   // int itemmap; // Now items spawned can have their properties changed
2500     int health;                     // int itemhealth; // Now items spawned can have their properties changed
2501     int index;                      // int itemindex; // item model index
2502     int player_count;               // int itemplayer_count;
2503     char alias[MAX_NAME_LEN];   // char itemalias[MAX_NAME_LEN]; // Now items spawned can have their properties changed
2504 } s_item_properties;
2505 
2506 typedef struct entity
2507 {
2508 	// Sub structures.
2509 	s_damage_on_landing		damage_on_landing;					// ~~
2510 	s_bind					binding;							// Binding self to another entity. ~~
2511 	s_axis_principal_float	position;							// x,y,z location. ~~
2512 	s_axis_principal_float	velocity;							// x,y,z movement speed. ~~
2513 	s_energy_state			energy_state;						// Health and MP. ~~
2514 	s_model					modeldata;							// model data copied here ~~
2515 	s_jump					jump;								// Jumping velocity and animationnid. ~~
2516 	s_rush					rush;								// Rush combo display. ~~
2517 
2518 	// Structured pointers.
2519 	s_anim					*animation;							// Pointer to animation collection. ~~
2520 	s_drawmethod			*drawmethod;						// Graphic settings. ~~
2521 	s_item_properties		*item_properties;					// Properties copied to an item entity when it is dropped. ~~
2522 	s_model					*defaultmodel;						// this is the default model ~~
2523 	s_defense				*defense;							// Resistance or vulnerability to certain attack types. ~~
2524 	s_model					*model;								// current model ~~
2525 	s_damage_recursive		*recursive_damage;					// Recursive damage linked list head. ~~
2526 	s_axis_plane_lateral_float *waypoints;						// Pathfinding waypoint array. ~~
2527 	s_scripts				*scripts;							// Loaded scripts. ~~
2528 
2529 	struct entity			*collided_entity;					// Opposing entity when entities occupy same space. ~~
2530 	struct entity			*custom_target;						// Target forced by modder via script ~~
2531 	struct entity			*grabbing;							// Added for "platform level" layering. ~~
2532 	struct entity			*hithead;							// Platform entity when jumping and hitting head on the bottom. ~~
2533 	struct entity			*landed_on_platform;				// Platform entity this entity landed on. ~~
2534 	struct entity			*lasthit;							// Last entity this one hit. ~~
2535 	struct entity			*link;								// Used to link 2 entities together. ~~
2536 	struct entity			*opponent;							// Last entity interacted with. ~~
2537 	struct entity			*owner;								// Projectile knows its owner. ~~
2538 	struct entity			*parent;							// Its spawner (when a sub entity). ~~
2539 	struct entity			*subentity;							// Summoned sub entity. ~~
2540 	struct entity			*weapent;							// Item entity that was picked up as a weapon. ~~
2541 
2542 	// Pointers
2543 	float					*offense_factors;					// Augment or reduce damage output for some attack types. ~~
2544 
2545 	unsigned char			*colourmap;							// Colortable in use. ~~
2546 
2547 	Varlist					*varlist;							// Entity var collection. ~~
2548 
2549 	// Floating decimals.
2550 	float					altbase;							// Altitude affected by movea. ~~
2551 	float					base;								// Default altitude. ~~
2552 	float					destx;								// temporary values for ai functions ~~
2553 	float					destz;								// ~~
2554 	float					knockdowncount;						// Attack knockdown force reduces this. Only fall when at 0. ~~
2555 	float					movex;								// Reposition this many pixels per frame. Used by animation movex command. ~~
2556 	float					movez;								// Reposition this many pixels per frame. Used by animation movez command. ~~
2557 	float					speedmul;							// Final multiplier for movement/velocity. ~~
2558 
2559     // Size defined ints (for time).
2560 	u32						combotime;							// If not expired, continue to next attack in series combo. ~~
2561 	u32						guardtime;							// Next time to auto adjust guardpoints. ~~
2562 	u32						freezetime;							// Used to store at what point the a frozen entity becomes unfrozen. ~~
2563 	u32						invinctime;							// Used to set time for invincibility to expire. ~~
2564 	u32						knockdowntime;						// When knockdown count is expired. ~~
2565 	u32						magictime;							// Next time to auto adjust MP. ~~
2566 	u32						maptime;							// When forcemap expires. ~~
2567 	u32						movetime;							// For special moves. Grace time between player inputs. ~~
2568 	u32						mpchargetime;						// Next recharge tick when in the CHARGE animation. ~~
2569 	u32						next_hit_time;						// When temporary invincibility after getting hit expires. ~~
2570 	u32						nextanim;							// Time for next frame (or to mark animation finished). ~~
2571 	u32						nextattack;							// Time for next chance to attack. ~~
2572 	u32						nextmove;							// Same as tosstime, but for X, Z movement. ~~
2573 	u32						nextthink;							// Time for next main AI update. ~~
2574 	u32						pausetime;							// 2012/4/30 UT: Remove lastanimpos and add this. Otherwise hit pause is always bound to frame and attack box. ~~
2575 	u32						releasetime;						// Delay letting go of grab when holding away command. ~~
2576 	u32						sealtime;							// When seal expires. ~~
2577 	u32						sleeptime;							// When to start the SLEEP animation. ~~
2578 	u32						stalltime;							// AI waits to perform actions. ~~
2579 	s_staydown				staydown;							// Delay modifiers before rise or riseattack can take place. 2011_04_08, DC: moved to struct. ~~
2580 	u32						timestamp;							// Elasped time assigned when spawned. ~~
2581     u32						toss_time;							// Used by gravity code (If > elapsed time, gravity has no effect). ~~
2582     u32						turntime;							// Time when entity can switch direction. ~~
2583     // -------------------------end of times ------------------------------
2584 
2585 	// Unsigned integers
2586 	unsigned int			animpos;							// Current animation frame. ~~
2587 	unsigned int			attack_id_incoming;					// ~~
2588     unsigned int			attack_id_incoming2;				//Kratus (20-04-21) used to memorize the last 4 hitboxes and avoid the multihit bug
2589     unsigned int			attack_id_incoming3;				//Kratus (20-04-21) used to memorize the last 4 hitboxes and avoid the multihit bug
2590     unsigned int			attack_id_incoming4;				//Kratus (20-04-21) used to memorize the last 4 hitboxes and avoid the multihit bug
2591 	unsigned int			attack_id_outgoing;					// ~~
2592 	unsigned int			animnum;							// Current animation id. ~~
2593 	unsigned int			animnum_previous;					// Previous animation id. ~~
2594 	unsigned int			combostep[MAX_SPECIAL_INPUTS];		// merge into an array to clear up some code. ~~
2595 	unsigned int			dying;								// Corresponds with which remap is to be used for the dying flash ~~
2596 	unsigned int			dying2;								// Corresponds with which remap is to be used for the dying flash for per2 ~~
2597 	unsigned int			escapecount;						// hit count for escapehits. ~~
2598 	unsigned int			idlemode;							// Force a specfic alternate idle. ~~
2599 	unsigned int			pathblocked;						// Time accumulated while obstructed. Used to start pathfining routine. ~~
2600 	unsigned int			per1;								// Used to store at what health value the entity begins to flash ~~
2601 	unsigned int			per2;								// Used to store at what health value the entity flashes more rapidly ~~
2602 	unsigned int			numwaypoints;						// Count of waypoints in use. ~~
2603 	unsigned int			walkmode;							// Force a specfic alternate walk. ~~
2604 
2605 	// Signed integers
2606 	int						last_damage_type;					// Used for set death, pain, rise, etc. animation. ~~
2607 	int						lifespancountdown;					// Life span count down. ~~
2608 	int						map;								// Stores the colourmap for restoring purposes. ~~
2609 	int						nograb;								// Some enemies cannot be grabbed (bikes) - now used with cantgrab as well ~~
2610 	int						nograb_default;						// equal to nograb  but this is remain the default value setetd in entity txt file (by White Dragon) ~~
2611 	int						playerindex;						// Player controlling the entity. ~~
2612 	int						seal;								// If 0+, entity can't perform special with >= energy cost. ~~
2613 	int						sortid;								// Drawing order (sprite queue sort id). ~~
2614 
2615 	// Enumerated integers.
2616 	e_spawn_type			spawntype;							// Type of spawn (level spawn, script spawn, ...) ~~
2617 	e_projectile_prime		projectile_prime;					// If this entity is a projectile, several priming values go here to set up its behavior. ~~
2618 	e_animating				animating;							// Animation status (none, forward, reverse). ~~
2619 	e_attacking_state		attacking;							// ~~
2620 	e_autokill_state		autokill;							// Kill entity on condition. ~~
2621 	e_direction				direction;							//  ~~
2622 	e_duck_state			ducking;							// In or transitioning to/from duck. ~~
2623 	e_edge_state			edge;								// At an edge (unbalanced).
2624 	e_invincible_state		invincible;							// Attack invulnerability. ~~
2625 	e_direction				normaldamageflipdir;				// Used to reset backpain direction. ~~
2626 	e_blasted_state			projectile;							// Blasted or tossed (bowl over other entities in fall). ~~
2627 	e_rising_state			rising;								// Rise/Rise attacking. ~~
2628 	e_explode_state			toexplode;							// Bomb projectiles prepared or time to detonate. ~~
2629 	e_update_mark			update_mark;						// Which updates are completed. ~~
2630 
2631 	// Boolean flags.
2632     bool					arrowon;							// Display arrow icon (parrow<player>) ~~
2633 	bool					blink;								// Toggle flash effect. ~~
2634 	bool					boss;								// I'm the BOSS playa, I'm the reason that you lost! ~~
2635 	bool					blocking;							// In blocking state. ~~
2636 	bool					charging;							// Charging MP. Gain according to chargerate. ~~
2637 	bool					dead;								// He's dead Jim. ~~
2638 	bool					deduct_ammo;						// Check for ammo count? ~~
2639 	bool					die_on_landing;						// Flag for death by damageonlanding (active if self->health <= 0). ~~
2640 	bool					drop;								// Knocked down. Remains true until rising. ~~
2641 	bool					exists;								// flag to determine if it is a valid entity. ~~
2642 	bool					falling;							// Knocked down and haven't landed. ~~
2643 	bool					frozen;								// Frozen in place. ~~
2644 	bool					getting;							// Picking up item. ~~
2645 	bool					grabwalking;						// Walking while grappling. ~~
2646 	bool					hitwall;							// Blcoked by wall/platform/obstacle. ~~
2647 	bool					idling;								// ~~
2648 	bool					inbackpain;							// Playing back pain/fall/rise/riseattack/die animation. ~~
2649 	bool					inpain;								// Hit and block stun. ~~
2650 	bool					jumping;							// ~~
2651 	bool					noaicontrol;						// No AI or automated control. ~~
2652 	bool					running;							// ~~
2653 	bool					tocost;								// Cost life on hit with special. ~~
2654 	bool					turning;							// Turning around. ~~
2655 	bool					walking;							// ~~
2656 
2657 	// Signed char.
2658 	char					name[MAX_NAME_LEN];					// Display name (alias). ~~
2659 
2660     // Function pointers.
2661 	void					(*takeaction)();					// Take an action (lie, attack, etc.). ~~
2662 	void					(*think)();							// Entity thinks. ~~
2663 
2664 	int						(*takedamage)(struct entity *, s_collision_attack *, int);	// Entity applies damage to itself when hit, thrown, and so on. ~~
2665     int						(*trymove)(float, float);			// Attempts to move. Container for most movement logic. ~~
2666 } entity;
2667 
2668 
2669 typedef struct
2670 {
2671     char name[MAX_NAME_LEN];
2672     int colourmap;
2673     unsigned score;
2674     unsigned lives;
2675     unsigned credits;
2676     entity *ent;
2677     u64 keys;
2678     u64 newkeys;
2679     u64 playkeys;
2680     u64 releasekeys;
2681     u32 combokey[MAX_SPECIAL_INPUTS];
2682     u32 inputtime[MAX_SPECIAL_INPUTS];
2683     u64 disablekeys;
2684     u64 prevkeys; // used for play/rec mode
2685     int combostep;
2686     int spawnhealth;
2687     int spawnmp;
2688     int joining;
2689     int hasplayed;
2690     int weapnum;
2691     int status;
2692 } s_player;
2693 
2694 typedef struct
2695 {
2696     int at;
2697     int wait;
2698     int nojoin; // dont allow new hero to join
2699     int spawnplayer_count; // spawn this entity according to the amount of players
2700     int palette; //change system palette to ...
2701     int groupmin;
2702     int groupmax;
2703     int scrollminz; // new scroll limit
2704     int scrollmaxz;
2705     int scrollminx; // new scroll limit
2706     int scrollmaxx;
2707     int blockade; //limit how far you can go back
2708     s_axis_plane_vertical_int light; // light direction, for gfx shadow
2709     int shadowcolor; // -1 no shadow
2710     int shadowalpha;
2711     int shadowopacity;
2712     char music[MAX_BUFFER_LEN];
2713     float musicfade;
2714     u32 musicoffset;
2715     char *name; // must be a name in the model list, so just reference
2716     int index; // model index
2717     int weaponindex; // the spawned entity with an weapon item, this is the index of the item model
2718     int alpha; // Used for alpha effects
2719     int boss;
2720     int flip;
2721     int colourmap;
2722     int dying; // Used for the dying flash animation
2723     int dying2; // Used for the dying flash animation health 25% (optional)
2724     unsigned per1; // Used to store at what health value the entity begins to flash
2725     unsigned per2; // Used to store at what health value the entity flashes more rapidly
2726     int nolife; // So nolife can be overriden for all characters
2727     s_item_properties item_properties; // Alias, health, index, etc. for items.
2728     char *item; // must be a name in the model list, so just reference
2729     s_model *itemmodel;
2730     s_model *model;
2731     char alias[MAX_NAME_LEN];
2732     int health[MAX_PLAYERS];
2733     int mp; // mp's variable for mpbar by tails
2734     unsigned score; // So score can be overridden for enemies/obstacles
2735     int multiple; // So score can be overridden for enemies/obstacles
2736     s_axis_principal_float position;  //x, y, z location.
2737     unsigned credit;
2738     int aggression; // For enemy A.I.
2739     int spawntype; // Pass 1 when a level spawn.
2740     int entitytype; // if it's a enemy, player etc..
2741     entity *parent;
2742     char *weapon; // spawn with a weapon, since it should be in the model list, so the model must be loaded, just reference its name
2743     s_model *weaponmodel;
2744     Script spawnscript;
2745 } s_spawn_entry;
2746 
2747 typedef struct
2748 {
2749     char *branchname; // Use a name so we can find this level in branches
2750     char *filename;
2751     e_le_type type; // see e_le_type
2752     int z_coords[3]; // Used for setting custom "z"
2753     int gonext; // 0. dont complete this level and display score,
2754     char *skipselect[MAX_PLAYERS]; // skipselect level based //[MAX_NAME_LEN]
2755     int	noselect;
2756     // 1. complete level and display score,
2757     // 2. complete game, show hall of fame
2758 } s_level_entry;
2759 
2760 typedef struct
2761 {
2762     char *name;
2763     int maxplayers;
2764     int numlevels;
2765     s_level_entry *levelorder;
2766     int ifcomplete;
2767     int noshowhof;
2768     int noshowgameover;
2769     int lives;
2770     int credits;
2771     int custfade;
2772     int musicoverlap; //** shouldn't it be level based?
2773     int typemp; //** shouldn't it be model based?
2774     int continuescore;
2775     //char *skipselect[MAX_PLAYERS]; //** better if level based // depreciated
2776     int	noselect;
2777     int saveflag;
2778     int nosame;
2779     int noshowcomplete;
2780 } s_set_entry;
2781 
2782 typedef struct
2783 {
2784     e_bgloldtype    oldtype;
2785     int             order;	        // for panel order
2786     gfx_entry       gfx;
2787     s_axis_plane_vertical_int   size;
2788     s_axis_plane_lateral_float  ratio;          // Only x and z.
2789     s_axis_plane_lateral_int    offset;         // Only x and z.
2790     s_axis_plane_lateral_int    spacing;        // Only x and z.
2791     s_drawmethod    drawmethod;
2792     float           bgspeedratio;
2793     int             enabled;
2794     int             z;
2795     int             quake;
2796     int             neon;
2797 } s_layer;
2798 
2799 typedef struct
2800 {
2801     /*
2802     Text object (display text on screen) struct
2803     2013-12-07
2804     Damon Caskey (Feature originally added by kbanderson)
2805     */
2806 
2807     int font;           //Font index.
2808     s_axis_principal_int position;  //x,y,z location on screen.
2809     u32 time;           //Time to expire.
2810     char *text;         //Text to display.
2811 } s_textobj;
2812 
2813 typedef struct
2814 {
2815     int pos;
2816     char *buf;
2817     size_t size;
2818 } s_filestream;
2819 
2820 typedef struct
2821 {
2822     s_axis_plane_lateral_int position;
2823     s_axis_plane_lateral_int size;
2824     float *map;
2825 } s_basemap;
2826 
2827  typedef struct
2828  {
2829     /*
2830     Hole/Wall structure.
2831     2013-12-07
2832     Damon Caskey
2833     */
2834     float depth;
2835     float height;
2836     float lowerleft;
2837     float lowerright;
2838     float upperleft;
2839     float upperright;
2840     float x;
2841     float z;
2842     int type;
2843 } s_terrain;
2844 
2845 typedef struct
2846 {
2847     char *name;
2848     int numspawns;
2849     s_spawn_entry *spawnpoints;
2850     int numlayers;
2851     s_layer *layers;
2852     int numlayersref;
2853     s_layer *layersref;
2854     ////////////////these below are layer reference
2855     ////////////////use them to ease layer finding for script users
2856     s_layer *background; // the bglayer that contains the default background
2857     int numpanels;
2858     s_layer *(*panels)[3]; //normal neon screen
2859     int numfrontpanels;
2860     s_layer **frontpanels;
2861     int numbglayers;
2862     s_layer **bglayers;
2863     int numfglayers;
2864     s_layer **fglayers;
2865     int numgenericlayers;
2866     s_layer **genericlayers;
2867     int numwaters;
2868     s_layer **waters;
2869     ////////////////layer reference ends here
2870     ///////////////////////////////////////////////////////////////
2871     int numtextobjs;
2872     s_textobj *textobjs;
2873     int cameraxoffset;
2874     int camerazoffset;
2875     int numholes;
2876     int numwalls;
2877     int numbasemaps;
2878     s_terrain *holes;
2879     s_terrain *walls;
2880     s_basemap *basemaps;
2881     int scrolldir;
2882     int width;
2883     int rocking;
2884     float bgspeed; // Used to make autoscrolling backgrounds
2885     float vbgspeed;
2886     float scrollspeed; // UT: restore this command  2011/7/8
2887     int bgdir; // Used to set which direction the backgrounds scroll for autoscrolling backgrounds
2888     int mirror;
2889     int bossescount;
2890     int numbosses;
2891     char bossmusic[MAX_BUFFER_LEN];
2892     unsigned bossmusic_offset;
2893     int numpalettes;
2894     unsigned char (*palettes)[1024];//dynamic palettes
2895     int settime; // Set time limit per level
2896     int notime; // Used to specify if the time is displayed 1 = no, else yes
2897     int noreset; // If set, clock will not reset when players spawn/die
2898     int type; // Used to specify which level type (1 = bonus, else regular)
2899     int nospecial; // Used to specify if you can use your special during bonus levels
2900     int nohurt; // Used to specify if you can hurt the other player during bonus levels
2901     int boss_slow; // Flag so the level doesn't slow down after a boss is defeated
2902     int nohit; // Not able to grab / hit other player on a per level basis
2903     int force_finishlevel; // flag to force to finish a level
2904     int force_gameover; // flag to force game over
2905     s_axis_principal_float *spawn; // Used to determine the spawn position of players
2906     int setweap; // Levels can now specified which weapon will be used by default
2907     e_facing_adjust facing; // Force the players to face to ...
2908 //--------------------gravity system-------------------------
2909     float maxfallspeed;
2910     float maxtossspeed;
2911     float gravity;
2912 //---------------------scripts-------------------------------
2913     Script update_script;
2914     Script updated_script;
2915     Script key_script;
2916     Script level_script;
2917     Script endlevel_script;
2918     int pos;
2919     u32 advancetime;
2920     u32 quaketime;
2921     int quake;
2922     int waiting;
2923 
2924 } s_level;
2925 
2926 typedef struct ArgList
2927 {
2928     size_t count;
2929     size_t arglen[MAX_ARG_COUNT];
2930     char *args[MAX_ARG_COUNT];
2931 } ArgList;
2932 
2933 #pragma pack()
2934 
2935 
2936 #define GET_ARG(z) (arglist.count > z ? arglist.args[z] : "")
2937 #define GET_ARG_LEN(z) (arglist.count > z ? arglist.arglen[z] : 0)
2938 #define GET_ARGP(z) (arglist->count > z ? arglist->args[z] : "")
2939 #define GET_ARGP_LEN(z) (arglist->count > z ? arglist->arglen[z] : 0)
2940 #define GET_INT_ARG(z) getValidInt(GET_ARG(z), filename, command)
2941 #define GET_FLOAT_ARG(z) getValidFloat(GET_ARG(z), filename, command)
2942 #define GET_INT_ARGP(z) getValidInt(GET_ARGP(z), filename, command)
2943 #define GET_FLOAT_ARGP(z) getValidFloat(GET_ARGP(z), filename, command)
2944 
2945 #define GET_FRAME_ARG(z) (stricmp(GET_ARG(z), "this")==0?newanim->numframes:GET_INT_ARG(z))
2946 
2947 int is_frozen(entity *e);
2948 void unfrozen(entity *e);
2949 void    adjust_bind(entity *e);
2950 float	binding_position(float position_default, float position_target, int offset, e_bind_mode positioning);
2951 int     check_bind_override(entity *ent, e_bind_override overriding);
2952 
2953 // Linked lists
2954 void	free_recursive_list(s_damage_recursive * head);
2955 
2956 // Blocking logic.
2957 int     check_blocking_decision(entity *ent);
2958 int     check_blocking_eligible(entity *ent, entity *other, s_collision_attack *attack);
2959 int     check_blocking_master(entity *ent, entity *other, s_collision_attack *attack);
2960 int     check_blocking_rules(entity *ent);
2961 int     check_blocking_pain(entity *ent, s_collision_attack *attack);
2962 void	do_active_block(entity *ent);
2963 void	do_passive_block(entity *ent, entity *other, s_collision_attack *attack);
2964 void    set_blocking_action(entity *ent, entity *other, s_collision_attack *attack);
2965 void    set_blocking_animation(entity *ent, s_collision_attack *attack);
2966 
2967 // Select player models.
2968 int		find_selectable_model_count				();
2969 int		is_model_cache_index_selectable			(int cache_index);
2970 int		is_model_selectable						(s_model *model);
2971 s_model *nextplayermodel						(s_model *current);
2972 s_model *nextplayermodeln						(s_model *current, int player_index);
2973 s_model *prevplayermodel						(s_model *current);
2974 s_model *prevplayermodeln						(s_model *current, int player_index);
2975 
2976 // Select player maps (colors).
2977 int		is_map_hidden							(s_model *model, int map_index);
2978 int		nextcolourmap							(s_model *model, int map_index);
2979 int		nextcolourmapn							(s_model *model, int map_index, int player_index);
2980 int		prevcolourmap							(s_model *model, int map_index);
2981 int		prevcolourmapn							(s_model *model, int map_index, int player_index);
2982 
2983 int     buffer_pakfile							(char *filename, char **pbuffer, size_t *psize);
2984 size_t  ParseArgs								(ArgList *list, char *input, char *output);
2985 int     getsyspropertybyindex					(ScriptVariant *var, int index);
2986 int     changesyspropertybyindex				(int index, ScriptVariant *value);
2987 e_direction	direction_adjustment				(e_direction direction_default, e_direction direction_target, e_direction_adjust adjustment);
2988 int     load_script								(Script *script, char *path);
2989 void    init_scripts();
2990 void    load_scripts();
2991 void    execute_animation_script                (entity *ent);
2992 void    execute_takedamage_script               (entity *ent, entity *other, s_collision_attack *attack);
2993 void    execute_on_bind_update_other_to_self    (entity *ent, entity *other, s_bind *bind);
2994 void    execute_on_bind_update_self_to_other    (entity *ent, entity *other, s_bind *bind);
2995 void    execute_ondeath_script                  (entity *ent, entity *other, s_collision_attack *attack);
2996 void    execute_onkill_script                   (entity *ent);
2997 void    execute_onpain_script                   (entity *ent, int iType, int iReset);
2998 void    execute_onfall_script                   (entity *ent, entity *other, s_collision_attack *attack);
2999 void    execute_inhole_script                   (entity *ent, s_terrain *hole, int index);
3000 void    execute_onblocks_script                 (entity *ent);
3001 void    execute_onblockw_script                 (entity *ent, s_terrain *wall, int index, e_plane plane);
3002 void    execute_onblockp_script                 (entity *ent, int plane, entity *platform);
3003 void    execute_onblocko_script                 (entity *ent, int plane, entity *other);
3004 void    execute_onblockz_script                 (entity *ent);
3005 void    execute_onblocka_script                 (entity *ent, entity *other);
3006 void    execute_onmovex_script                  (entity *ent);
3007 void    execute_onmovez_script                  (entity *ent);
3008 void    execute_onmovea_script                  (entity *ent);
3009 void    execute_didblock_script                 (entity *ent, entity *other, s_collision_attack *attack);
3010 void    execute_ondoattack_script               (entity *ent, entity *other, s_collision_attack *attack, e_exchange which, int attack_id);
3011 void    execute_updateentity_script             (entity *ent);
3012 void    execute_think_script                    (entity *ent);
3013 void    execute_didhit_script                   (entity *ent, entity *other, s_collision_attack *attack, int blocked);
3014 void    execute_onspawn_script                  (entity *ent);
3015 void    clearbuttonss(int player);
3016 void    clearsettings(void);
3017 void    savesettings(void);
3018 void    saveasdefault(void);
3019 void    loadsettings(void);
3020 void    loadfromdefault(void);
3021 void    clearSavedGame(void);
3022 void    clearHighScore(void);
3023 int    saveGameFile(void);
3024 int     loadGameFile(void);
3025 int		saveScriptFile(void);
3026 int		loadScriptFile(void);
3027 int    saveHighScoreFile(void);
3028 int    loadHighScoreFile(void);
3029 int translate_SDID(char *value);
3030 int music(char *filename, int loop, long offset);
3031 int readByte(char* buf);
3032 char *findarg(char *command, int which);
3033 float diff(float a, float b);
3034 int inair(entity *e);
3035 int inair_range(entity *e);
3036 float randf(float max);
3037 int _makecolour(int r, int g, int b);
3038 int load_colourmap(s_model *model, char *image1, char *image2);
3039 int load_palette(unsigned char *pal, char *filename);
3040 void standard_palette();
3041 void change_system_palette(int palindex);
3042 void unload_background();
3043 void lifebar_colors();
3044 void load_background(char *filename);
3045 void unload_texture();
3046 void load_texture(char *filename);
3047 void freepanels();
3048 s_sprite *loadpanel2(char *filename);
3049 int loadpanel(char *filename_normal, char *filename_neon, char *filename_screen);
3050 int loadfrontpanel(char *filename);
3051 void resourceCleanUp(void);
3052 void freesprites();
3053 s_sprite *loadsprite2(char *filename, int *width, int *height);
3054 int loadsprite(char *filename, int ofsx, int ofsy, int bmpformat);
3055 void load_special_sprites();
3056 int load_special_sounds();
3057 s_model *find_model(char *name);
3058 s_model *nextplayermodel(s_model *current);
3059 s_model *prevplayermodel(s_model *current);
3060 void free_anim(s_anim *anim);
3061 void free_models();
3062 int free_model();
3063 void cache_model_sprites();
3064 s_anim                  *alloc_anim();
3065 s_collision_attack      *collision_alloc_attack_instance(s_collision_attack* properties);
3066 s_collision_attack      **collision_alloc_attack_list();
3067 s_collision_body        *collision_alloc_body_instance(s_collision_body *properties);
3068 s_collision_body        **collision_alloc_body_list();
3069 s_collision_entity      *collision_alloc_entity_instance(s_collision_entity *properties);
3070 s_collision_entity      **collision_alloc_entity_list();
3071 s_hitbox                *collision_alloc_coords(s_hitbox *coords);
3072 int                     addframe(s_anim             *a,
3073                                 int                 spriteindex,
3074                                 int                 framecount,
3075                                 int                 delay,
3076                                 unsigned            idle,
3077                                 s_collision_entity  *ebox,
3078                                 s_collision_body    *bbox,
3079                                 s_collision_attack  *attack,
3080                                 s_move              *move,
3081                                 float               *platform,
3082                                 int                 frameshadow,
3083                                 int                 *shadow_coords,
3084                                 int                 soundtoplay,
3085                                 s_drawmethod        *drawmethod,
3086                                 s_axis_plane_vertical_int         *offset,
3087                                 s_damage_recursive  *recursive,
3088                                 s_hitbox            *attack_coords,
3089                                 s_hitbox            *body_coords,
3090                                 s_hitbox            *entity_coords);
3091 void cache_model(char *name, char *path, int flag);
3092 void remove_from_cache(char *name);
3093 void free_modelcache();
3094 int get_cached_model_index(char *name);
3095 char *get_cached_model_path(char *name);
3096 s_model *load_cached_model(char *name, char *owner, char unload);
3097 int is_set(s_model *model, int m);
3098 int load_script_setting();
3099 int load_models();
3100 void unload_levelorder();
3101 void load_levelorder();
3102 void unload_level();
3103 void load_level(char *filename);
3104 void drawlifebar(int x, int y, int h, int maxh);
3105 void drawmpbar(int x, int y, int m, int maxm);
3106 void update_loading(s_loadingbar *s,  int value, int max);
3107 void spawnplayer(int);
3108 unsigned getFPS(void);
3109 unsigned char *model_get_colourmap(s_model *model, unsigned which);
3110 void ent_set_colourmap(entity *ent, unsigned int which);
3111 void predrawstatus();
3112 void drawstatus();
3113 void addscore(int playerindex, int add);
3114 void free_ent(entity *e);
3115 void free_ents();
3116 int alloc_ents();
3117 int is_walking(int iAni);
3118 entity *smartspawn(s_spawn_entry *p);
3119 void initialize_item_carry(entity *ent, s_spawn_entry *spawn_entry);
3120 int adjust_grabposition(entity *ent, entity *other, float dist, int grabin);
3121 int player_trymove(float xdir, float zdir);
3122 void toss(entity *ent, float lift);
3123 void player_think(void);
3124 void subtract_shot(void);
3125 void set_model_ex(entity *ent, char *modelname, int index, s_model *newmodel, int flag);
3126 void dropweapon(int flag);
3127 void biker_drive(void);
3128 void trap_think(void);
3129 void steamer_think(void);
3130 void text_think(void);
3131 void anything_walk(void);
3132 void adjust_walk_animation(entity *other);
3133 int player_takedamage(entity *other, s_collision_attack *attack, int);
3134 int biker_takedamage(entity *other, s_collision_attack *attack, int);
3135 int obstacle_takedamage(entity *other, s_collision_attack *attack, int);
3136 void suicide(void);
3137 void player_blink(void);
3138 void common_prejump();
3139 void common_preduck();
3140 void common_idle();
3141 void damage_recursive(entity *target);
3142 void tryjump(float, float, float, int);
3143 void dojump(float, float, float, int);
3144 void tryduck(entity*);
3145 void tryduckrise(entity*);
3146 void tryvictorypose(entity*);
3147 void doduck(entity*);
3148 void biker_drive(void);
3149 void ent_default_init(entity *e);
3150 void ent_spawn_ent(entity *ent);
3151 void ent_summon_ent(entity *ent);
3152 void ent_set_anim(entity *ent, int aninum, int resetable);
3153 void ent_set_colourmap(entity *ent, unsigned int which);
3154 void ent_set_model(entity *ent, char *modelname, int syncAnim);
3155 entity *spawn_attack_flash(entity *ent, s_collision_attack *attack, int attack_flash, int model_flash);
3156 entity *spawn(float x, float z, float a, e_direction direction, char *name, int index, s_model *model);
3157 void ent_unlink(entity *e);
3158 void ents_link(entity *e1, entity *e2);
3159 void kill_entity(entity *victim);
3160 void kill_all();
3161 
3162 
3163 int projectile_wall_deflect(entity *ent);
3164 
3165 void sort_invert_by_parent(entity *ent, entity* parent);
3166 
3167 int checkgrab(entity *other, s_collision_attack *attack);
3168 void checkdamageeffects(s_collision_attack *attack);
3169 void check_damage_recursive(entity *ent, entity *other, s_collision_attack *attack);
3170 void checkdamagedrop(s_collision_attack *attack);
3171 void checkmpadd();
3172 void checkhitscore(entity *other, s_collision_attack *attack);
3173 int calculate_force_damage(entity *other, s_collision_attack *attack);
3174 void checkdamage(entity *other, s_collision_attack *attack);
3175 void checkdamageonlanding();
3176 int checkhit(entity *attacker, entity *target);
3177 int checkhole(float x, float z);
3178 int checkhole_index(float x, float z);
3179 int checkhole_in(float x, float z, float a);
3180 int checkholeindex_in(float x, float z, float a);
3181 int checkhole_between(float x, float z, float a1, float a2);
3182 int testplatform(entity *, float, float, entity *);
3183 int testhole(int, float, float);
3184 int testwall(int, float, float);
3185 int checkwalls(float x, float z, float a1, float a2);
3186 int checkholes(float, float);
3187 int checkwall_below(float x, float z, float a);
3188 int checkwall_index(float x, float z);
3189 float check_basemap(int x, int z);
3190 int check_basemap_index(int x, int z);
3191 float checkbase(float x, float z, float y, entity *ent);
3192 entity *check_block_obstacle(entity *entity);
3193 int check_block_wall(entity *entity);
3194 int colorset_timed_expire(entity *ent);
3195 int check_lost();
3196 int check_range_target_all(entity *ent, entity *target, e_animations animation_id);
3197 int check_range_target_base(entity *ent, entity *target, s_anim *animation);
3198 int check_range_target_x(entity *ent, entity *target, s_anim *animation);
3199 int check_range_target_y(entity *ent, entity *target, s_anim *animation);
3200 int check_range_target_z(entity *ent, entity *target, s_anim *animation);
3201 void check_entity_collision_for(entity* ent);
3202 int check_entity_collision(entity *ent, entity *target);
3203 
3204 
3205 void generate_basemap(int map_index, float rx, float rz, float x_size, float z_size, float min_a, float max_a, int x_cont);
3206 int testmove(entity *, float, float, float, float);
3207 entity *check_platform_below(float x, float z, float a, entity *exclude);
3208 entity *check_platform_above(float x, float z, float a, entity *exclude);
3209 entity *check_platform_between(float x, float z, float amin, float amax, entity *exclude);
3210 entity *check_platform(float x, float z, entity *exclude);
3211 float get_platform_base(entity *);
3212 int is_on_platform(entity *);
3213 entity *get_platform_on(entity *);
3214 void do_item_script(entity *ent, entity *item);
3215 void do_attack(entity *e);
3216 int do_energy_charge(entity *ent);
3217 void adjust_base(entity *e, entity **pla);
3218 void check_gravity(entity *e);
3219 bool check_jumpframe(entity *ent, unsigned int frame);
3220 bool check_landframe(entity *ent);
3221 int check_edge(entity *ent);
3222 void update_ents();
3223 entity *find_ent_here(entity *exclude, float x, float z, int types, int (*test)(entity *, entity *));
3224 void display_ents();
3225 void toss(entity *ent, float lift);
3226 entity *findent(int types);
3227 int count_ents(int types);
3228 int set_idle(entity *ent);
3229 int set_death(entity *iDie, int type, int reset);
3230 int set_fall(entity *ent, entity *other, s_collision_attack *attack, int reset);
3231 int set_rise(entity *iRise, int type, int reset);
3232 int set_riseattack(entity *iRiseattack, int type, int reset);
3233 int set_blockpain(entity *iBlkpain, int type, int reset);
3234 int set_pain(entity *iPain, int type, int reset);
3235 int reset_backpain(entity *ent);
3236 int check_backpain(entity* attacker, entity* defender);
3237 void set_weapon(entity *ent, int wpnum, int anim_flag);
3238 entity *melee_find_target();
3239 entity *long_find_target();
3240 entity *normal_find_target(int anim, int iDetect);
3241 entity *normal_find_item();
3242 int long_attack();
3243 int melee_attack();
3244 void dothrow();
3245 void doprethrow();
3246 void dograbattack(int which);
3247 e_animations do_grab_attack_finish(entity *ent, int which);
3248 int check_special();
3249 void normal_prepare();
3250 void common_jump();
3251 void common_spawn(void);
3252 void common_drop(void);
3253 void common_walkoff(void);
3254 void common_jumpattack();
3255 void common_turn();
3256 void common_fall();
3257 void common_lie();
3258 void common_rise();
3259 void common_pain();
3260 void common_get();
3261 void common_land();
3262 void common_grab(void);
3263 void common_grabattack();
3264 void common_grabbed();
3265 void common_block(void);
3266 int arrow_takedamage(entity *other, s_collision_attack *attack, int fall_flag);
3267 int common_takedamage(entity *other, s_collision_attack *attack, int fall_flag);
3268 int normal_attack();
3269 void common_throw(void);
3270 void common_throw_wait(void);
3271 void common_prethrow(void);
3272 void npc_warp();
3273 int checkpathblocked();
3274 int common_trymove(float xdir, float zdir);
3275 void normal_runoff();
3276 void common_animation_normal();
3277 void common_attack_proc();
3278 void normal_attack_finish();
3279 entity *common_find_target();
3280 int common_attack(void);
3281 int common_try_jump(void);
3282 int common_try_pick(entity *other);
3283 int common_try_chase(entity *target, int dox, int doz);
3284 int common_try_follow(entity *target, int dox, int doz);
3285 int common_try_avoid(entity *target, int dox, int doz);
3286 int common_try_wandercompletely(int dox, int doz);
3287 int common_try_wander(entity *target, int dox, int doz);
3288 void common_pickupitem(entity *other);
3289 int common_backwalk_anim(entity *ent);
3290 void draw_properties_entity(entity *entity, int offset_z, int color, s_drawmethod *drawmethod);
3291 void draw_box_on_entity(entity *entity, int pos_x, int pos_y, int pos_z, int size_w, int size_h, int offset_z, int color, s_drawmethod *drawmethod);
3292 void draw_visual_debug();
3293 int bomb_move(void);
3294 int arrow_move(void);
3295 int common_move(void);
3296 void common_think(void);
3297 void suicide(void);
3298 void prethrow(void);
3299 void player_die();
3300 int player_trymove(float xdir, float zdir);
3301 int check_energy(e_cost_check which, int ani);
3302 int player_preinput();
3303 int player_check_special();
3304 void runanimal(void);
3305 void player_blink(void);
3306 int check_combo();
3307 int check_costmove(int s, int fs, int jumphack);
3308 void didfind_item(entity *other);
3309 void player_think(void);
3310 void subtract_shot();
3311 void dropweapon(int flag);
3312 void drop_all_enemies();
3313 void kill_all_enemies();
3314 void smart_bomb(entity *e, s_collision_attack *attack);
3315 void anything_walk(void);
3316 entity *knife_spawn(char *name, int index, float x, float z, float a, int direction, int type, int map);
3317 entity *bomb_spawn(char *name, int index, float x, float z, float a, int direction, int map);
3318 void bomb_explode(void);
3319 int star_spawn(float x, float z, float a, int direction);
3320 void steam_think(void);
3321 void trap_think(void);
3322 void steam_spawn(float x, float z, float a);
3323 void steamer_think(void);
3324 void text_think(void);
3325 entity *homing_find_target(int type);
3326 void biker_drive(void);
3327 void bike_crash(void);
3328 void obstacle_fall(void);
3329 void obstacle_fly(void);
3330 entity *smartspawn(s_spawn_entry *props);
3331 int is_incam(float x, float z, float a, float threshold);
3332 void spawnplayer(int index);
3333 void time_over();
3334 void update_scroller();
3335 void draw_scrolled_bg();
3336 void update(int ingame, int usevwait);
3337 void fade_out(int type, int speed);
3338 void apply_controls();
3339 void plan();
3340 int is_in_backrun(entity*);
3341 int ai_check_ducking();
3342 int ai_check_warp();
3343 int ai_check_lie();
3344 int ai_check_grabbed();
3345 int ai_check_grab();
3346 int ai_check_escape();
3347 int ai_check_busy();
3348 void display_credits(void);
3349 void borShutdown(int status, char *msg, ...);
3350 #ifdef DC
3351 void guistartup(void);
3352 #endif
3353 void startup(void);
3354 int playgif(char *filename, int x, int y, int noskip);
3355 void playscene(char *filename);
3356 void gameover();
3357 void hallfame(int addtoscore);
3358 void showcomplete(int num);
3359 int playlevel(char *filename);
3360 int selectplayer(int *players, char *filename, int useSavedGame);
3361 void playgame(int *players,  unsigned which_set, int useSavedGame);
3362 int load_saved_game();
3363 void term_videomodes();
3364 void init_videomodes(int log);
3365 void safe_set(int *arr, int index, int newkey, int oldkey);
3366 
3367 void keyboard_setup_menu(int player);
3368 void keyboard_setup(int player);
3369 void inputrefresh();
3370 
3371 int menu_difficulty();
3372 void menu_options();
3373 void menu_options_config();
3374 void menu_options_debug();
3375 void menu_options_input();
3376 void menu_options_sound();
3377 void menu_options_soundcard();
3378 void menu_options_system();
3379 void menu_options_video();
3380 
3381 void openborMain(int argc, char **argv);
3382 int is_cheat_actived();
3383 int getValidInt(char *text, char *file, char *cmd);
3384 float getValidFloat(char *text, char *file, char *cmd);
3385 int dograb(entity *attacker, entity *target, e_dograb_adjustcheck adjustcheck);
3386 int stopRecordInputs(void);
3387 int recordInputs(void);
3388 int playRecordedInputs(void);
3389 int freeRecordedInputs(void);
3390 a_playrecstatus* init_input_recorder(void);
3391 void free_input_recorder(void);
3392 void goto_mainmenu(int);
3393 
3394 extern s_savelevel   *savelevel;
3395 extern s_savescore    savescore;
3396 
3397 #endif
3398