fix link errors on compilers with strict "extern" enforcement
[rofl0r-openbor.git] / openbor.h
blobfc3c47121f291d748a3ce709cbe8af387b6a21de
1 /*
2 * OpenBOR - http://www.LavaLit.com
3 * -
4 ----------------------------------------------------------------------
5 * Licensed under the BSD license, see LICENSE in OpenBOR root for details.
7 * Copyright (c) 2004 - 2011 OpenBOR Team
8 */
10 /////////////////////////////////////////////////////////////////////////////
11 // Beats of Rage //
12 // Side-scrolling beat-'em-up //
13 /////////////////////////////////////////////////////////////////////////////
15 #ifndef OPENBOR_H
16 #define OPENBOR_H
19 /////////////////////////////////////////////////////////////////////////////
21 #include "types.h"
22 #include "video.h"
23 #include "vga.h"
24 #include "screen.h"
25 #include "loadimg.h"
26 #include "bitmap.h"
27 #include "sprite.h"
28 #include "spriteq.h"
29 #include "font.h"
30 #include "timer.h"
31 #include "rand32.h"
32 #include "sblaster.h"
33 #include "soundmix.h"
34 #include "control.h"
35 #include "draw.h"
36 #include "packfile.h"
37 #include "palette.h"
38 #include "anigif.h"
39 #include "texture.h"
40 #include "openborscript.h"
41 #include "globals.h"
42 #include "version.h"
44 #ifdef SDL
45 #include "gfx.h"
46 #endif
48 /////////////////////////////////////////////////////////////////////////////
50 // FIXME wow. this needs to be fixed. does rename every occurence of those variables/functions.
52 #define exit borExit
53 #define kill borKill
54 #define pause borPause
55 #define shutdown(ec, fmt, args...) borShutdown(__FUNCTION__, ec, fmt, ## args)
57 #define COMPATIBLEVERSION 0x00030000
58 #define CV_SAVED_GAME 0x00021276
59 #define CV_HIGH_SCORE 0x00020048
60 #define GAME_SPEED 200
61 #define THINK_SPEED 2
62 #define COUNTER_SPEED (GAME_SPEED*2)
63 #define MAX_ENTS 150
64 #define MAX_PANELS 52
65 #define MAX_WEAPONS 10
66 #define MAX_COLOUR_MAPS 30
67 #define MAX_NAME_LEN 40
68 #define LEVEL_MAX_SPAWNS 600
69 #define LEVEL_MAX_PANELS 100
70 #define LEVEL_MAX_HOLES 40
71 #define LEVEL_MAX_WALLS 40
72 #define LEVEL_MAX_BGLAYERS 100
73 #define LEVEL_MAX_FGLAYERS 10
74 #define LEVEL_MAX_TEXTOBJS 50
75 #define LEVEL_MAX_FILESTREAMS 50
76 #define LEVEL_MAX_PALETTES 40 // altered palettes
77 #define MAX_LEVELS 100
78 #define MAX_DIFFICULTIES 10
79 #define MAX_SPECIALS 8 // Added for customizable freespecials
80 #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
81 #define MAX_ATCHAIN 12 // Maximum attack chain length
82 #define MAX_IDLES 1 // Idle animations.
83 #define MAX_WALKS 1 // Walk animations.
84 #define MAX_BACKWALKS 1 // Backwalk animations.
85 #define MAX_UPS 1 // Walk up animations.
86 #define MAX_DOWNS 1 // Walk down animations.
87 #define MAX_ATTACKS 4 // Total number of attacks players have
88 #define MAX_FOLLOWS 4 // For followup animations
89 #define MAX_PLAYERS 4
90 #define MAX_ARG_LEN 512
91 #define MAX_PAL_SIZE 1024
92 #define MAX_CACHED_BACKGROUNDS 9
94 #define FLAG_ESC 0x00000001
95 #define FLAG_START 0x00000002
96 #define FLAG_MOVELEFT 0x00000004
97 #define FLAG_MOVERIGHT 0x00000008
98 #define FLAG_MOVEUP 0x00000010
99 #define FLAG_MOVEDOWN 0x00000020
100 #define FLAG_ATTACK 0x00000040
101 #define FLAG_JUMP 0x00000080
102 #define FLAG_SPECIAL 0x00000100
103 #define FLAG_SCREENSHOT 0x00000200
104 #define FLAG_ATTACK2 0x00000400
105 #define FLAG_ATTACK3 0x00000800
106 #define FLAG_ATTACK4 0x00001000
107 #define FLAG_ANYBUTTON (FLAG_START|FLAG_SPECIAL|FLAG_ATTACK|FLAG_ATTACK2|FLAG_ATTACK3|FLAG_ATTACK4|FLAG_JUMP)
108 #define FLAG_FORWARD 0
109 #define FLAG_BACKWARD 1
111 #define SDID_MOVEUP 0
112 #define SDID_MOVEDOWN 1
113 #define SDID_MOVELEFT 2
114 #define SDID_MOVERIGHT 3
115 #define SDID_ATTACK 4
116 #define SDID_ATTACK2 5
117 #define SDID_ATTACK3 6
118 #define SDID_ATTACK4 7
119 #define SDID_JUMP 8
120 #define SDID_SPECIAL 9
121 #define SDID_START 10
122 #define SDID_SCREENSHOT 11
124 #define TYPE_NONE 0
125 #define TYPE_PLAYER 1
126 #define TYPE_ENEMY 2
127 #define TYPE_ITEM 4
128 #define TYPE_OBSTACLE 8
129 #define TYPE_STEAMER 16
130 #define TYPE_SHOT 32 // 7-1-2005 type to use for player projectiles
131 #define TYPE_TRAP 64 // 7-1-2005 lets face it enemies are going to just let you storm in without setting a trap or two!
132 #define TYPE_TEXTBOX 128 // New textbox type for displaying messages
133 #define TYPE_ENDLEVEL 256 // New endlevel type that ends the level when touched
134 #define TYPE_NPC 512 // A character can be an ally or enemy.
135 #define TYPE_PANEL 1024 // Fake panel, scroll with screen using model speed
137 #define SUBTYPE_NONE 0
138 #define SUBTYPE_BIKER 1
139 #define SUBTYPE_NOTGRAB 2 //7-1-2005 new subtype for those ungrabbable enemies
140 #define SUBTYPE_ARROW 3 //7-1-2005 subtype for an "enemy" that flies across the screen and dies
141 #define SUBTYPE_TOUCH 4 // ltb 1-18-05 new Item subtype for a more platformer feel.
142 #define SUBTYPE_WEAPON 5
143 #define SUBTYPE_NOSKIP 6 // Text type that can't be skipped
144 #define SUBTYPE_FLYDIE 7 // Now obstacles can be hit and fly like on Simpsons/TMNT
145 #define SUBTYPE_BOTH 8 // Used with TYPE_ENDLEVEL to force both players to reach the point before ending level
146 #define SUBTYPE_PROJECTILE 9 // New weapon projectile type that can be picked up by players/enemies
147 #define SUBTYPE_FOLLOW 10 // Used by NPC character, if set, they will try to follow players
148 #define SUBTYPE_CHASE 11 // Used by enemy always chasing you
150 //------------reserved for A.I. types-------------------------
151 // A.I. move1, affect movement path
152 #define AIMOVE1_NORMAL 0 // Current default style
153 #define AIMOVE1_CHASE 0x00000001 // alway move towards target, and can run to them if target is farway
154 #define AIMOVE1_CHASEZ 0x00000002 // only try to get close in z direction
155 #define AIMOVE1_CHASEX 0x00000004 // only try to get colse in x direction
156 #define AIMOVE1_AVOID 0x00000008 // try to avoid target
157 #define AIMOVE1_AVOIDZ 0x00000010 // only try to avoid target in z direction
158 #define AIMOVE1_AVOIDX 0x00000020 // only try to avoid target in x direction
159 #define AIMOVE1_WANDER 0x00000040 // ignore the target's position completely, wander everywhere, long idle time
160 #define AIMOVE1_BIKER 0x00000080 // move like a biker
161 #define AIMOVE1_ARROW 0x00000100 // fly like an arrow
162 #define AIMOVE1_STAR 0x00000200 // fly like a star, subject to ground
163 #define AIMOVE1_BOMB 0x00000400 // fly like a bomb, subject to ground/wall etc
164 #define AIMOVE1_NOMOVE 0x00000800 // don't move at all
165 #define AIMOVE1_BOOMRANG 0x00001000 // boomrang
166 #define MASK_AIMOVE1 0x0000FFFF
168 // A.I move2, affect terrain reflect
169 #define AIMOVE2_NORMAL 0 // Current default style
170 #define AIMOVE2_IGNOREHOLES 0x00010000 // don't avoid holes
171 #define MASK_AIMOVE2 0xFFFF0000
173 // A.I. attack1, affect attacking style
174 #define AIATTACK1_NORMAL 0 // Current default style
175 #define AIATTACK1_LONG 0x00000001 // Long range first
176 #define AIATTACK1_MELEE 0x00000002 // Melee attack first
177 #define AIATTACK1_NOATTACK 0x00000004 // dont attack at all
178 #define MASK_AIATTACK1 0x0000FFFF
180 // A.I. attack2, affect Defending style
181 #define AIATTACK2_NORMAL 0 // Current default style, don't dodge at all
182 #define AIATTACK2_DODGE 0x00010000 // Use dodge animation to avoid attack
183 #define AIATTACK2_DODGEMOVE 0x00020000 // Try to move in z direction if a jump attack is about to hit him
184 // and try to step back if a melee attack is about to hit him
185 #define MASK_AIATTACK2 0xFFFF0000
188 typedef struct {
189 short player_min_z;
190 short player_max_z;
191 short bgheight;
192 } s_player_min_max_z_bgheight;
194 extern s_player_min_max_z_bgheight player_min_max_z_bgheight;
195 #define PLAYER_MIN_Z (player_min_max_z_bgheight.player_min_z)
196 #define PLAYER_MAX_Z (player_min_max_z_bgheight.player_max_z)
197 #define BGHEIGHT (player_min_max_z_bgheight.bgheight)
199 // Note: the minimum Z coordinate of the player is important
200 // for several other drawing operations.
201 // movement restirctions are here!
202 //int PLAYER_MIN_Z = 160; // 2-10-05 adjustable walking area
203 //int PLAYER_MAX_Z = 232; // 2-10-05 adjustable walking area
204 //int BGHEIGHT = 160; // 2-10-05 adjustable BGHeight
205 //int MAX_WALL_HEIGHT = 1000; // max wall height that an entity can be spawned on
206 #define FRONTPANEL_Z (PLAYER_MAX_Z+50)
207 #define HUD_Z (FRONTPANEL_Z+10000)
208 #define HOLE_Z (PLAYER_MIN_Z-46)
209 #define NEONPANEL_Z (PLAYER_MIN_Z-47)
210 #define SHADOW_Z (PLAYER_MIN_Z-48)
211 #define SCREENPANEL_Z (PLAYER_MIN_Z-49)
212 #define PANEL_Z (PLAYER_MIN_Z-50)
213 #define MIRROR_Z (PLAYER_MIN_Z-5)
214 #define PIT_DEPTH -250
215 #define P2_STATS_DIST 180
216 #define CONTACT_DIST_H 30 // Distance to make contact
217 #define CONTACT_DIST_V 12
218 #define GRAB_DIST 36 // Grabbing ents will be placed this far apart.
219 #define GRAB_STALL (GAME_SPEED * 8 / 10)
221 typedef enum {
222 ATK_NORMAL = 0,
223 ATK_NORMAL2,
224 ATK_NORMAL3,
225 ATK_NORMAL4,
226 ATK_BLAST,
227 ATK_BURN,
228 ATK_FREEZE,
229 ATK_SHOCK,
230 ATK_STEAL, // Steal opponents life
231 ATK_NORMAL5,
232 ATK_NORMAL6,
233 ATK_NORMAL7,
234 ATK_NORMAL8,
235 ATK_NORMAL9,
236 ATK_NORMAL10,
237 ATK_ITEM,
238 MAX_ATKS
239 } attack_types;
241 #define STA_ATKS 6 // default special attack types: blast burn shock freeze steal
242 #define MAX_DOTS 10 // Max active dot effects.
244 #define SCROLL_RIGHT 2
245 #define SCROLL_DOWN 4
246 #define SCROLL_LEFT 8
247 #define SCROLL_UP 16
248 #define SCROLL_BACK 1
249 #define SCROLL_BOTH (SCROLL_BACK|SCROLL_RIGHT)
250 #define SCROLL_RIGHTLEFT SCROLL_BOTH
251 #define SCROLL_LEFTRIGHT (SCROLL_LEFT|SCROLL_BACK)
252 #define SCROLL_INWARD 32
253 #define SCROLL_OUTWARD 64
254 #define SCROLL_OUTIN (SCROLL_OUTWARD|SCROLL_BACK)
255 #define SCROLL_INOUT (SCROLL_INWARD|SCROLL_BACK)
256 #define SCROLL_UPWARD 128
257 #define SCROLL_DOWNWARD 256
258 // blah, blah,
260 typedef enum {
261 ANI_IDLE = 0,
262 ANI_WALK,
263 ANI_JUMP,
264 ANI_LAND,
265 ANI_ATTACK,
266 ANI_ATTACK1 = ANI_ATTACK,
267 ANI_ATTACK2,
268 ANI_ATTACK3,
269 ANI_ATTACK4, // Very important
270 ANI_UPPER,
271 ANI_BLOCK, // New block animation
272 ANI_JUMPATTACK,
273 ANI_JUMPATTACK1 = ANI_JUMPATTACK,
274 ANI_JUMPATTACK2,
275 ANI_JUMPATTACK3,
276 ANI_GET,
277 ANI_GRAB,
278 ANI_GRABATTACK,
279 ANI_GRABATTACK1 = ANI_GRABATTACK,
280 ANI_GRABATTACK2,
281 ANI_THROW,
282 ANI_SPECIAL,
283 ANI_SPECIAL1 = ANI_SPECIAL,
284 ANI_SPECIAL2, // Animation played for when pressing forward special
285 ANI_SPECIAL3, // special3 is an alias for jumpspecial
286 ANI_JUMPSPECIAL = ANI_SPECIAL3,
287 ANI_FREESPECIAL,
288 ANI_FREESPECIAL1 = ANI_FREESPECIAL,
289 ANI_FREESPECIAL2,
290 ANI_FREESPECIAL3,
291 ANI_FREESPECIAL4, // More freespecials added
292 ANI_FREESPECIAL5, // More freespecials added
293 ANI_FREESPECIAL6, // More freespecials added
294 ANI_FREESPECIAL7, // More freespecials added
295 ANI_FREESPECIAL8, // More freespecials added
296 ANI_SPAWN, // 26-12-2004 new animation added here ani_spawn
297 ANI_PICK, // 7-1-2005 used when players select their character at the select screen
298 ANI_UP, // Mar 2, 2005 - Animation for when going up
299 ANI_DOWN, // Mar 2, 2005 - Animation for when going down
300 ANI_SHOCK, // Animation played when knocked down by shock attack
301 ANI_BURN, // Animation played when knocked down by burn attack
302 ANI_SHOCKPAIN, // Animation played when not knocked down by shock attack
303 ANI_BURNPAIN, // Animation played when not knocked down by shock attack
304 ANI_GRABBED, // Animation played when grabbed
305 ANI_RUN, // Animation played when a player is running
306 ANI_RUNATTACK, // Animation played when a player is running and presses attack
307 ANI_RUNJUMPATTACK, // Animation played when a player is running and jumps and presses attack
308 ANI_ATTACKUP, // u u animation
309 ANI_ATTACKDOWN, // d d animation
310 ANI_ATTACKFORWARD, // f f animation
311 ANI_ATTACKBACKWARD, // Used for attacking backwards
312 ANI_DODGE, // Used for up up / down down SOR3 dodge moves for players
313 ANI_ATTACKBOTH, // Used for when a player holds down attack and presses jump
314 ANI_GRABFORWARD, // New grab attack for when a player holds down forward/attack
315 ANI_GRABFORWARD2, // New second grab attack for when a player holds down forward/attack
316 ANI_JUMPFORWARD, // Attack when a player is moving and jumps
317 ANI_GRABDOWN, // Attack when a player has grabbed an opponent and presses down/attack
318 ANI_GRABDOWN2, // Attack when a player has grabbed an opponent and presses down/attack
319 ANI_GRABUP, // Attack when a player has grabbed an opponent and presses up/attack
320 ANI_GRABUP2, // Attack when a player has grabbed an opponent and presses up/attack
321 ANI_SELECT, // Animation that is displayed at the select screen
322 ANI_DUCK, // Animation that is played when pressing down in "platform" type levels
323 ANI_FAINT, // Faint animations for players/enemys by tails
324 ANI_CANT, // Can't animation for players(animation when mp is less than mpcost) by tails.
325 ANI_THROWATTACK, // Added for subtype projectile
326 ANI_CHARGEATTACK, // Plays when player releases attack1 after holding >= chargetime.
327 ANI_VAULT, // Now you can flip over people like in SOR.
328 ANI_JUMPCANT,
329 ANI_BURNDIE,
330 ANI_SHOCKDIE,
331 ANI_PAIN, //the pain anims must be in a sequence as they're used to calculate offsets in lcmHandleCommandAnim()
332 ANI_PAIN1 = ANI_PAIN,
333 ANI_PAIN2,
334 ANI_PAIN3,
335 ANI_PAIN4,
336 ANI_PAIN5,
337 ANI_PAIN6,
338 ANI_PAIN7,
339 ANI_PAIN8,
340 ANI_PAIN9,
341 ANI_PAIN10,
342 ANI_FALL,
343 ANI_FALL1 = ANI_FALL,
344 ANI_FALL2,
345 ANI_FALL3,
346 ANI_FALL4,
347 ANI_FALL5,
348 ANI_FALL6,
349 ANI_FALL7,
350 ANI_FALL8,
351 ANI_FALL9,
352 ANI_FALL10,
353 ANI_DIE, // 29-12-2004 new animation added here ani_die
354 ANI_DIE1 = ANI_DIE,
355 ANI_DIE2,
356 ANI_DIE3,
357 ANI_DIE4,
358 ANI_DIE5,
359 ANI_DIE6,
360 ANI_DIE7,
361 ANI_DIE8,
362 ANI_DIE9,
363 ANI_DIE10,
364 ANI_CHARGE,
365 ANI_BACKWALK,
366 ANI_SLEEP,
367 ANI_FOLLOW,
368 ANI_FOLLOW1 = ANI_FOLLOW,
369 ANI_FOLLOW2,
370 ANI_FOLLOW3,
371 ANI_FOLLOW4,
372 ANI_TURN, // turn back/flip
373 ANI_RESPAWN, //now spawn works for players
374 ANI_FORWARDJUMP,
375 ANI_RUNJUMP,
376 ANI_JUMPLAND,
377 ANI_JUMPDELAY,
378 ANI_HITWALL,
379 ANI_GRABBACKWARD,
380 ANI_GRABBACKWARD1 = ANI_GRABBACKWARD,
381 ANI_GRABBACKWARD2,
382 ANI_GRABWALK,
383 ANI_GRABBEDWALK,
384 ANI_GRABWALKUP,
385 ANI_GRABBEDWALKUP,
386 ANI_GRABWALKDOWN,
387 ANI_GRABBEDWALKDOWN,
388 ANI_GRABTURN,
389 ANI_GRABBEDTURN,
390 ANI_GRABBACKWALK,
391 ANI_GRABBEDBACKWALK,
392 ANI_SLIDE, //Down + Jump animation.
393 ANI_RUNSLIDE, //Down + Jump while running.
394 ANI_DUCKATTACK,
395 ANI_RISE,
396 ANI_RISE1 = ANI_RISE,
397 ANI_RISE2,
398 ANI_RISE3,
399 ANI_RISE4,
400 ANI_RISE5,
401 ANI_RISE6,
402 ANI_RISE7,
403 ANI_RISE8,
404 ANI_RISE9,
405 ANI_RISE10,
406 ANI_RISEB,
407 ANI_RISES,
408 ANI_BLOCKPAIN, //If entity has this, it will play in place of "pain" when its blockpain is 1 and incoming attack is blocked.
409 ANI_BLOCKPAIN1 = ANI_BLOCKPAIN,
410 ANI_BLOCKPAIN2,
411 ANI_BLOCKPAIN3,
412 ANI_BLOCKPAIN4,
413 ANI_BLOCKPAIN5,
414 ANI_BLOCKPAIN6,
415 ANI_BLOCKPAIN7,
416 ANI_BLOCKPAIN8,
417 ANI_BLOCKPAIN9,
418 ANI_BLOCKPAIN10,
419 ANI_BLOCKPAINB,
420 ANI_BLOCKPAINS,
421 ANI_CHIPDEATH,
422 ANI_GUARDBREAK,
423 ANI_RISEATTACK, // Attack used for enemies when players are crowding around after knocking them down
424 ANI_RISEATTACK1 = ANI_RISEATTACK,
425 ANI_RISEATTACK2,
426 ANI_RISEATTACK3,
427 ANI_RISEATTACK4,
428 ANI_RISEATTACK5,
429 ANI_RISEATTACK6,
430 ANI_RISEATTACK7,
431 ANI_RISEATTACK8,
432 ANI_RISEATTACK9,
433 ANI_RISEATTACK10,
434 ANI_RISEATTACKB,
435 ANI_RISEATTACKS,
436 ANI_WALKOFF,
437 MAX_ANIS
438 } ani_types;
439 #define ARG_FLOAT 0
440 #define ARG_STRING 1
441 #define ARG_INT 2
443 // perhaps outdated, now use separted flags for entity
444 #define SUBJECT_TO_WALL 1
445 #define SUBJECT_TO_HOLE 2
446 #define SUBJECT_TO_OBSTACLE 4
447 #define SUBJECT_TO_BORDER 8
448 #define SUBJECT_TO_SCREEN 16
449 #define SUBJECT_TO_MINZ 32
450 #define SUBJECT_TO_MAXZ 48
452 //macros for drawing menu text, fits different font size
454 #ifdef _MSC_VER
455 #define _strmidx(f,s, ...) ((videomodes.hRes-font_string_width((f), s, __VA_ARGS__))/2)
456 #else
457 #define _strmidx(f,s, args...) ((videomodes.hRes-font_string_width((f), s, ##args))/2)
458 #endif
459 #define _colx(f,c) ((int)(videomodes.hRes/2+(c)*(font_monowidths[(f)]+1)))
460 #define _liney(f,l) ((int)(videomodes.vRes/2+(l)*(font_heights[(f)]+1)))
461 #ifdef _MSC_VER
462 #define _menutextm(f, l, shift, s, ...) font_printf(_strmidx(f,s, __VA_ARGS__)+(int)((shift)*(font_monowidths[(f)]+1)), _liney(f,l), (f), 0, s, __VA_ARGS__)
463 #define _menutext(f, c, l, s, ...) font_printf(_colx(f,c), _liney(f,l), (f), 0, s, __VA_ARGS__)
464 #else
465 #define _menutextm(f, l, shift, s, args...) font_printf(_strmidx(f,s, ##args)+(int)((shift)*(font_monowidths[(f)]+1)), _liney(f,l), (f), 0, s, ##args)
466 #define _menutext(f, c, l, s, args...) font_printf(_colx(f,c), _liney(f,l), (f), 0, s, ##args)
467 #endif
470 #define ICO_NORMAL 0
471 #define ICO_PAIN 1
472 #define ICO_DIE 2
473 #define ICO_GET 3
474 #define ICO_WEAPON 4*/
476 // model flags
477 #define MODEL_NO_COPY 0x00000001 //dont copy anything from original model
478 #define MODEL_NO_WEAPON_COPY 0x00000002 //dont copy weapon list from original model
480 #define lut_mul ((level && current_palette)?(level->blendings[current_palette-1][BLEND_MULTIPLY]):(blendings[BLEND_MULTIPLY]))
481 #define lut_screen ((level && current_palette)?(level->blendings[current_palette-1][BLEND_SCREEN]):(blendings[BLEND_SCREEN]))
482 #define lut_overlay ((level && current_palette)?(level->blendings[current_palette-1][BLEND_OVERLAY]):(blendings[BLEND_OVERLAY]))
483 #define lut_hl ((level && current_palette)?(level->blendings[current_palette-1][BLEND_HARDLIGHT]):(blendings[BLEND_HARDLIGHT]))
484 #define lut_dodge ((level && current_palette)?(level->blendings[current_palette-1][BLEND_DODGE]):(blendings[BLEND_DODGE]))
485 #define lut_half ((level && current_palette)?(level->blendings[current_palette-1][BLEND_HALF]):(blendings[BLEND_HALF]))
486 #define lut ((level && current_palette)?(level->blendings[current_palette-1]):(blendings))
488 #define ABS(x) ((x)>0?(x):(-(x)))
490 #define set_attacking(e) e->attacking = 1;\
491 e->idling = 0;
493 #define set_jumping(e) e->jumping = 1;\
494 e->idling = 0;
496 #define set_charging(e) e->charging = 1;\
497 e->idling = 0;
499 #define set_getting(e) e->getting = 1;\
500 e->idling = 0;
502 #define set_blocking(e) e->blocking = 1;\
503 e->idling = 0;
505 #define set_turning(e) e->turning = 1;\
506 e->idling = 0;
508 #define is_frozen(e) ((textbox && e->modeldata.type != TYPE_TEXTBOX) || \
509 (smartbomber && e != smartbomber && e->modeldata.type != TYPE_TEXTBOX) ||(self->frozen&&self->freezetime > borTime))
511 #define expand_time(e) if(e->stalltime>0) e->stalltime++;\
512 if(e->releasetime>0)e->releasetime++;\
513 if(e->nextanim>0)e->nextanim++;\
514 if(e->nextthink>0)e->nextthink++;\
515 if(e->magictime>0)e->magictime++;\
516 if(e->guardtime>0)e->guardtime++;\
517 if(e->toss_time>0)e->toss_time++;\
518 if(e->freezetime>0 && (textbox || smartbomber))e->freezetime++;\
519 if(e->mpchargetime>0)e->mpchargetime++;\
520 if(e->invinctime>0) e->invinctime++;\
521 if(e->sealtime>0) e->sealtime++;
522 /* if(e->dot_time>0) e->dot_time++;\
523 if(e->dot_cnt>0) e->dot_cnt++;
526 #define freezeall (smartbomber || textbox)
528 #define is_projectile(e) (e->modeldata.type == TYPE_SHOT || e->model->subtype == SUBTYPE_ARROW || e->owner)
530 #define check_range(self, target, animnum) \
531 ( target && \
532 (self->direction ? \
533 target->x > self->x+self->modeldata.animation[animnum]->range[0] &&\
534 target->x < self->x+self->modeldata.animation[animnum]->range[1]\
536 target->x < self->x-self->modeldata.animation[animnum]->range[0] &&\
537 target->x > self->x-self->modeldata.animation[animnum]->range[1])\
538 && target->z - self->z > self->modeldata.animation[animnum]->range[2] \
539 && target->z - self->z < self->modeldata.animation[animnum]->range[3] \
540 && (target->a - self->a) > self->modeldata.animation[animnum]->range[4] \
541 && (target->a - self->a) < self->modeldata.animation[animnum]->range[5] \
542 && (target->base - self->base) > self->modeldata.animation[animnum]->range[6] \
543 && (target->base - self->base) < self->modeldata.animation[animnum]->range[7] \
546 #define check_range_both(self, target, animnum) \
547 ( target && \
548 ((target->x > self->x+self->modeldata.animation[animnum]->range[0] &&\
549 target->x < self->x+self->modeldata.animation[animnum]->range[1])\
551 (target->x < self->x-self->modeldata.animation[animnum]->range[0] &&\
552 target->x > self->x-self->modeldata.animation[animnum]->range[1]))\
553 && target->z - self->z > self->modeldata.animation[animnum]->range[2] \
554 && target->z - self->z < self->modeldata.animation[animnum]->range[3] \
555 && (target->a - self->a) > self->modeldata.animation[animnum]->range[4] \
556 && (target->a - self->a) < self->modeldata.animation[animnum]->range[5] \
557 && (target->base - self->base) > self->modeldata.animation[animnum]->range[6] \
558 && (target->base - self->base) < self->modeldata.animation[animnum]->range[7] \
562 #define tobounce(e) (e->animation->bounce && diff(0, e->tossv) > 2 && \
563 !((autoland == 1 && e->damage_on_landing == -1) ||e->damage_on_landing == -2))
565 #define getpal ((current_palette&&level)?(level->palettes[current_palette-1]):pal)
567 #define canbegrabbed(self, other) \
568 (other->animation->vulnerable[other->animpos] && \
569 (!self->animation->move || self->animation->move[self->animpos] == 0) && \
570 (!self->animation->movez || self->animation->movez[self->animpos] == 0 ) && \
571 !(other->nograb || other->invincible || other->link || \
572 other->model->animal || inair(other) || \
573 (self->modeldata.type == TYPE_PLAYER && other->modeldata.type == TYPE_PLAYER && savedata.mode)))
575 #define cangrab(self, other) \
576 ((other->model->antigrab - self->model->grabforce + \
577 (other->model->paingrab?(other->model->paingrab-other->inpain):0)<=0) &&\
578 canbegrabbed(self, other) && \
579 !inair(self) && \
580 diff(other->a, self->a) <= 0.1)
582 #define unfrozen(e) \
583 ent_set_colourmap(e, e->map);\
584 e->frozen = 0;\
585 e->freezetime = 0;
587 #define validanim(e, a) ((e)->modeldata.animation[a]&&(e)->modeldata.animation[a]->numframes)
589 //#define MAX_MOVES 16
590 //#define MAX_MOVE_STEPS 16
592 #define MENU_PACK_FILENAME "Menu.xxx"
594 #pragma pack (4)
596 typedef struct {
597 unsigned int compatibleversion;
598 short gamma;
599 short brightness;
600 char usesound; // Use SB
601 unsigned short soundrate; // SB freq
602 short soundvol; // SB volume
603 char usemusic; // Play music
604 short musicvol; // Music volume
605 short effectvol; // Sound fx volume
606 char soundbits; // SB bits
607 char usejoy;
608 char mode; // Mode now saves
609 char windowpos;
610 int keys[MAX_PLAYERS][12];
611 char showtitles;
612 char videoNTSC;
613 char screen[7][2]; // Screen Filtering/Scaling Effects
614 char logo;
615 char uselog;
616 char debuginfo; // FPS, Memory, etc...
617 char fullscreen; // Window or Full Screen Mode
618 char stretch; // Stretch (1) or preserve aspect ratio (0) in fullscreen mode
619 char usegl; // 1 if OpenGL is preferred over SDL software blitting
620 float glscale; // Scale factor for OpenGL
621 char glfilter; // Simple or bilinear scaling
622 } s_savedata;
624 typedef struct {
625 unsigned int compatibleversion:32;
626 char dName[MAX_NAME_LEN + 1]; // Difficulty Name
627 unsigned short level:16; // Level Number
628 unsigned short stage:16; // Stage
629 unsigned char pLives[MAX_PLAYERS]; // Player Lives Left
630 unsigned char pCredits[MAX_PLAYERS]; // Player Credits Left
631 unsigned int pScores[MAX_PLAYERS]; // Player Scores
632 unsigned char credits:8; // Number Of Credits
633 unsigned short times_completed:16;
634 unsigned short which_set:16;
635 //-------------------new strict save features-----------------------
636 char flag:8; // 0 useless slot 1 only load level number 2 load player info and level
637 char pName[MAX_PLAYERS][MAX_NAME_LEN + 1]; // player names
638 int pSpawnhealth[MAX_PLAYERS]; // hit points left
639 int pSpawnmp[MAX_PLAYERS]; // magic points left
640 char pWeapnum[MAX_PLAYERS]; // weapon
641 char pColourmap[MAX_PLAYERS]; // colour map
642 } s_savelevel;
645 typedef struct {
646 unsigned int compatibleversion:32;
647 unsigned int highsc[10];
648 char hscoren[10][MAX_NAME_LEN + 1];
649 } s_savescore;
652 typedef struct {
653 float dropv[3]; // fly height/x/z if the target is knoced down
654 float grab_distance; // suck target near by
656 int staydown[3]; // [0] = Add to rise delay. [1] = Add to rise attack delay.
657 int freezetime;
658 int maptime;
659 int sealtime;
660 int dot; //Dot mode.
661 int dot_index; //Dot index.
662 int dot_time; //Dot time to expire.
663 int dot_force; //Dot amount per tick.
664 int dot_rate; //Dot tick delay.
665 int hitsound; // Sound effect to be played when attack hits opponent
666 int hitflash; // Custom flash for each animation, model id
667 int blockflash; // Custom bflash for each animation, model id
668 int blocksound; // Custom sound for when an attack is blocked
670 short attack_force;
671 short attack_coords[5]; // stick on the only one victim
672 short jugglecost; // cost for juggling a falling ent
673 short guardcost; // cost for blocking an attack
674 short pause_add; // Flag to determine if an attack adds a pause before updating the animation
676 signed char counterattack;
677 signed char no_pain;
678 signed char no_flash; // Flag to determine if an attack spawns a flash or not
679 signed char no_block; // Flag to determine if an attack is blockable (default 0 - blockable)
680 signed char grab;
681 signed char force_direction; // 0 dont care, 1 same direction as attacker, -1 opposite drection as attacker, 2 right, -2 left
682 signed char blast;
683 signed char freeze;
684 signed char steal;
685 signed char forcemap;
686 signed char seal;
687 signed char otg; // Over The Ground. Gives ground projectiles the ability to hit lying ents.
688 signed char attack_drop; // now be a knock-down factor, how many this attack will knock victim down
689 signed char attack_type;
690 signed char damage_on_landing; // same as throw damage type
692 } s_attack;
694 typedef struct {
695 int model_index;
696 short numframes:16;
697 int loop[3]; // Animation loop (0 = loop on/off, 1 = Loop to frame, 2 = Loop end frame).
698 short height:16; // entity's height during animation
699 short tossframe:16; // Used to determine which frame will toss a bomb/grenade
700 short shootframe:16;
701 short throwframe:16;
702 short throwa:16; // Used for setting the "a" at which weapons are spawned
703 // various entity model id, knife/star/bomb etc
704 int custknife;
705 int custstar;
706 int custbomb; // Used for new projectile bomb
707 int custpshotno;
708 int subentity; // Store the sub-entity's name for further use
709 char fastattack:8; // Flag to determine if the opponent uses their pain time
710 short energycost[3]; // 1-10-05 to adjust the amount of energy used for specials. 05072010: Made array with mponly. 0 = Energycost, 1 = MPonly, 2 = Disable flag (see check_energy function).
711 float chargetime; // charge time for an animation
712 short jumpframe:16;
713 float jumpv; // moveflag // So movement forward can be specified for jumpframes
714 float jumpx; // override move forward value
715 float jumpz; // override move z value
716 int jumpd; // Index of dust entity to spawn on liftoff of jumpframe.
717 float bounce; // -tossv/bounce = new tossv
718 float dive[2]; // new dive kick by tails
719 int *soundtoplay; // each frame can have a sound
720 int *sprite; // sprite[set][framenumber]
721 short *delay;
722 short *move;
723 short *movez;
724 short *movea;
725 short *seta; // Now characters can have a custom "a" value
726 short *vulnerable;
727 short (*bbox_coords)[5];
728 int *shadow;
729 unsigned char *idle; // Allow free move
730 short (*shadow_coords)[2]; // x, z offset of shadow
731 s_drawmethod **drawmethods;
732 char attackone:8;
733 s_attack **attacks;
734 float (*platform)[8]; // Now entities can have others land on them
735 int range[8]; // Use for attacks; xmin, xmax, zmin, zmax, amin, amax, basemin, basemax
736 short flipframe:16; // Turns entities around on the desired frame
737 short followanim:16; // use which FOLLOW anim?
738 char followcond:8; // conditions under which to use a followup
739 short counterframe[4]; // 0,1; Counter frame, 2 counter cond, 3 counterdam
740 char cancel:8; // Cancel anims with freespecial
741 short *weaponframe; // Specify with a frame when to switch to a weapon model
742 short quakeframe[4]; // Specify with a frame, repeat, quake (4 is highest)
743 float *spawnframe; // Spawn the subentity as its default type. {frame} {x} {z} {a} {relative?}
744 float *summonframe; // Summon the subentity as an ally, only one though {frame} {x} {z} {a} {relative?}
745 short unsummonframe:16; // Un-summon the entity
746 short landframe[2]; // 0 frame switch to when land, 1 dust to spawn.
747 short dropframe:16; // if tossv < 0, this frame will be set
748 short animhits:16; // Does the attack need to hit before cancel is allowed?
749 } s_anim;
751 typedef struct {
752 int mode;
753 float factor;
754 int cap_min;
755 int cap_max;
756 int range_min;
757 int range_max;
758 } s_edelay;
760 struct animlist {
761 s_anim *anim;
762 struct animlist *next;
764 typedef struct animlist s_anim_list;
765 extern s_anim_list *anim_list;
767 typedef enum {
768 horizontalbar = 0,
769 verticalbar = 1,
770 } barorient;
772 typedef enum {
773 valuebar = 0,
774 percentagebar = 1,
775 } bartype;
777 typedef struct {
778 int (*colourtable)[11]; //0 default backfill 1-10 foreground colours
779 int barlayer;
780 int backlayer;
781 int borderlayer;
782 int shadowlayer;
784 short offsetx;
785 short offsety;
786 short sizex;
787 short sizey;
788 char noborder:1;
789 char direction:1; //0) left to right or botom to top 1) reversed
790 bartype type:1;
791 barorient orientation:1;
792 } s_barstatus;
794 typedef enum {
795 LSTYPE_NONE = 0,
796 LSTYPE_BAR = 1,
797 LSTYPE_BACKGROUND = 2,
798 } loadingScreenType;
800 typedef struct {
801 loadingScreenType set;
802 /*set determines how loading screen would be.
803 - 0 = no loading screen.
804 - 1 = background and status bar.
805 - 2 = background only.
806 - 3 = status bar only.
808 char tf; //determines used font number for "LOADING" text (last element in command, moved here because of alignment)
810 - 0 = font.gif
811 - 1 = font2.gif
812 - 2 = font3.gif
813 - 3 = font4.gif */
814 short bx; //determines x and y coordinates of loading bar top left's location respectively
815 short by;
816 short bsize; // length of bar in pixels
817 short tx; //determines x and y coordinates of "LOADING" text location respectively.
818 short ty;
819 short refreshMs; // modder defined number of milliseconds in which the screen is updated while loading
820 } s_loadingbar;
822 typedef struct {
823 Script *animation_script; //system generated script
824 Script *update_script; //execute when update_ents
825 Script *think_script; //execute when entity thinks.
826 Script *takedamage_script; //execute when taking damage.
827 Script *ondeath_script; //execute when killed in game.
828 Script *onkill_script; //execute when removed from play.
829 Script *onpain_script; //Execute when put in pain animation.
830 Script *onfall_script; //execute when falling.
831 Script *onblocks_script; //execute when blocked by screen.
832 Script *onblockw_script; //execute when blocked by wall.
833 Script *onblocko_script; //execute when blocked by obstacle.
834 Script *onblockz_script; //execute when blocked by Z.
835 Script *onblocka_script; //execute when "hit head".
836 Script *onmovex_script; //execute when moving along X axis.
837 Script *onmovez_script; //execute when moving along Z axis.
838 Script *onmovea_script; //execute when moving along A axis.
839 Script *didhit_script; //execute when attack hits another.
840 Script *onspawn_script; //execute when spawned.
841 Script *key_script; //execute when entity's player presses a key
842 Script *didblock_script; //execute when blocking attack.
843 Script *ondoattack_script; //execute when attack passes do_attack checks.
844 } s_scripts;
846 typedef struct {
847 //global script
848 Script level_script; //execute when level start
849 Script endlevel_script; //execute when level finished
850 Script update_script; //execute when ingame update
851 Script updated_script; //execute when ingame update finished
852 Script key_script_all; //keyscript for all players
853 Script timetick_script; //time tick script.
854 //player script
855 Script score_script[4]; //execute when add score, 4 players
856 Script key_script[4]; //key listeners, lol
857 Script join_script[4]; //player join scripts
858 Script respawn_script[4]; //player respawn scripts
859 Script pdie_script[4]; //player death scripts
860 } s_game_scripts;
862 extern s_game_scripts game_scripts;
864 typedef enum {
865 MF_NONE = 0,
866 MF_ANIMLIST = 1,
867 MF_COLOURMAP = 2,
868 MF_PALETTE = 4,
869 MF_WEAPONS = 8,
870 MF_BRANCH = 16,
871 MF_ANIMATION = 32,
872 MF_DEF_FACTORS = 64,
873 MF_DEF_PAIN = 128,
874 MF_DEF_KNOCKDOWN = 256,
875 MF_DEF_BLOCKPOWER = 512,
876 MF_DEF_BLOCKTRESHOLD = 1024,
877 MF_DEF_BLOCKRATIO = 2048,
878 MF_DEF_BLOCKTYPE = 4096,
879 MF_OFF_FACTORS = 8192,
880 MF_SPECIAL = 16384,
881 MF_SMARTBOMB = 32768,
882 MF_SCRIPTS = 65536,
883 } ModelFreetype;
884 #define MF_ALL 0x1FFFF
886 typedef struct {
887 int (*special)[MAX_SPECIAL_INPUTS]; // Stores freespecials
888 int (*weapon)[MAX_WEAPONS]; // weapon model list
890 unsigned char *palette; // original palette for 32/16bit mode
891 unsigned char *colourmap[MAX_COLOUR_MAPS];
892 char *name;
893 char *path; // Path, so scripts can dynamically get files, sprites, sounds, etc.
894 char *branch; //level branch name
895 float *defense_factors; //basic defense factors: damage = damage*(1-def)
896 float *defense_pain; //Pain factor (like nopain) for defense type.
897 float *defense_knockdown; //Knockdowncount (like knockdowncount) for attack type.
898 float *defense_blockpower; //If > unblockable, this attack type is blocked.
899 float *defense_blockthreshold; //Strongest attack from this attack type that can be blocked.
900 float *defense_blockratio; //% of damage still taken from this attack type when blocked.
901 float *defense_blocktype; //0 = HP, 1=MP, 2=both taken when this attack type is blocked.
902 float *offense_factors; //basic offense factors: damage = damage*(1+def)
903 s_attack *smartbomb;
904 s_anim **animation;
906 int health;
907 int mp; // mp's variable for mpbar by tails
908 int makeinv; // Option to spawn player invincible >0 blink <0 noblink
909 int riseinv; // how many seconds will the character become invincible after rise >0 blink, <0 noblink
910 int multiple; // So you can control how many points are given for hitting opponents
911 int icon;
912 int iconpain; // 20-1-2005 New icons
913 int iconget; // 20-1-2005 New icons
914 int icondie; // 20-1-2005 New icons
915 int iconw; // icon for the weapon like in beat of fighting by tails
916 int iconmp[3]; // icon for the mpbar 3 levels
917 int parrow[MAX_PLAYERS][3]; // Image to be displayed when player spawns invincible
918 int setlayer; // Used for forcing enities to be displayed behind
919 int diesound;
921 int index;
922 // these are model id of various stuff
923 int project;
924 int rider; // 7-1-2005 now every "biker" can have a new driver!
925 int knife; // 7-1-2005 now every enemy can have their own "knife" projectile
926 int pshotno; // 7-1-2005 now every enemy can have their own "knife" projectile
927 int star; // 7-1-2005 now every enemy can have their own "ninja star" projectiles
928 int bomb; // New projectile type for exploding bombs/grenades/dynamite
929 int flash; // Now each entity can have their own flash
930 int bflash; // Flash that plays when an attack is blocked
931 int dust[3]; // Dust spawn (0 = Fall land, 1 = Jumpland, 2 = Jumpstart.)
932 int grabforce; // grab factor, antigrab - grabforce <= 0 means can grab
933 int sight[6]; // Sight ranges, xmin, xmax, zmin, zmax, amin, amax
934 int jugglepoints[2]; // juggle points. [0] = current [1] = max total
935 int guardpoints[2]; // guard points. [0] = current [1] = max total
937 unsigned int aiattack; // attack/defend style
938 unsigned int aimove; // move style
939 unsigned int offscreenkill; // for biker, arrow, etc
940 unsigned int score;
942 float stats[20]; // Parameters that do nothing on their own.
943 float scroll; // Autoscroll like panel entity.
945 float speed;
946 float grabdistance; // 30-12-2004 grabdistance varirable adder per character
947 float jumpspeed; // normal jump foward speed, default to max(1, speed)
948 float jumpheight; // 28-12-2004 Jump height variable added per character
949 float grabwalkspeed;
950 float runspeed; // The speed the character runs at
951 float runjumpheight; // The height the character jumps when running
952 float runjumpdist; // The distance the character jumps when running
953 float throwheight; // The height at which an opponent can now be adjusted
954 float throwdist; // The distance an opponent can now be adjusted
955 float lifespan; // lifespan count down
956 float knockdowncount; // the knock down count for this entity
957 float antigravity; //antigravity : gravity * (1- antigravity)
959 short mpstableval; // MP Stable target.
960 short aggression; // For enemy A.I.
961 short risetime[2]; // 0 = Rise delay, 1 = Riseattack delay.
962 short sleepwait;
963 short counter; // counter of weapons by tails
964 short type;
965 short thold; // The entities threshold for block
966 short blockodds; // Odds that an enemy will block an attack (1 : blockodds)
967 short throwframewait; // The frame victim is thrown during ANIM_THROW, added by kbandressen 10/20/06
968 short specials_loaded; // Stores how many specials have been loaded
969 short valid_special; // Used for setting when a valid special has been found
970 short height; // Used to set height of player in pixels
971 short turndelay; // turn delay
972 short stealth[2]; // 0 = Entity's invisibility to AI. 1 = AI ability to see through stealth.
974 //---------------new A.I. switches-----------
975 short hostile; // specify hostile types
976 short candamage; // specify types that can be damaged by this entity
977 short projectilehit; // specify types that can be hit by this entity if it is thrown
979 short throwdamage; // 1-14-05 adjust throw damage
980 short hpx;
981 short hpy;
982 short iconx;
983 short icony;
984 short namex;
985 short namey;
987 unsigned char shootnum; // counter of shots by tails
988 unsigned char reload; // reload max shots by tails
989 char weapnum;
990 char secret;
991 char weaploss[2]; // Determines possibility of losing weapon.
992 char ownweapons; // is the weapon list own or share with others
993 char reactive; // Used for setting the "a" at which weapons are spawned
994 char typeshot; // see if weapon is a gun or knife by tails
995 char animal; // see is the weapon is a animal by tails
996 char nolife; // Feb 25, 2005 - Variable flag to show life 0 = no, else yes
997 char dofreeze; // Flag to freeze all enemies/players while special is executed
998 char noquake; // Flag to make the screen shake when entity lands 1 = no, else yes
999 char ground; // Flag to determine if enemy projectiles only hit the enemy when hitting the ground
1000 char bounce; // Flag to determine if bounce/quake is to be used.
1001 char subtype;
1002 char fmap; // Corresponds to which remap to use for when a character is frozen
1003 char komap[2]; // Remap to use when KO'd
1004 char hmap1; //Bottom range of remaps unavailable at select screen.
1005 char hmap2; //Top range of remaps unavailable at select screen.
1006 char alpha; // New alpha variable to determine if the entity uses alpha transparency
1007 char toflip; // Flag to determine if flashes flip or not
1008 char shadow;
1009 char gfxshadow; // use current frame to create a shadow
1010 char aironly; // Used to determine if shadows will be shown when jumping only
1011 char nomove; // Flag for static enemies
1012 char noflip; // Flag to determine if static enemies flip or stay facing the same direction
1013 char nodrop; // Flag to determine if enemies can be knocked down
1014 char nodieblink; // Flag to determine if blinking while playing die animation
1015 char holdblock; // Continue the block animation as long as the player holds the button down
1016 char nopassiveblock; // Don't auto block randomly
1017 char blockback; // Able to block attacks from behind
1018 char noatflash; // Flag to determine if attacking characters attack spawns a flash
1019 char runupdown; // Flag to determine if a player will continue to run while pressing up or down
1020 char runhold; // Flag to determine if a player will continue to run if holding down forward when landing
1021 char remove; // Flag to remove a projectile on contact or not
1022 char jumpmovex; // low byte: 0 default 1 flip in air, 2 move in air, 3 flip and move
1023 char jumpmovez; // 2nd byte: 0 default 1 zjump with flip(not implemented yet) 2 z jump move in air, 3 1+2
1024 char grabfinish; // wait for grab animation to finish before do other actoins
1025 char antigrab; // anti-grab factor
1026 char facing; // 0 no effect, 1 alway right, 2 always left, 3, affected by level dir
1027 char grabback; // Flag to determine if entities grab images display behind opponenets
1028 char grabturn;
1029 char paingrab; // Can only be grabbed when in pain
1030 char maps_loaded; // Used for player colourmap selecting
1031 char unload; // Unload model after level completed?
1032 char falldie; // Play die animation?
1033 char globalmap; // use global palette for its colour map in 24bit mode
1034 char nopain;
1035 char summonkill; // kill it's summoned entity when died; 0. dont kill 1. kill summoned only 2. kill all spawned entity
1036 char combostyle;
1037 char blockpain;
1038 char atchain[MAX_ATCHAIN];
1039 char chainlength;
1040 char credit;
1041 char escapehits; // Escape spammers!
1042 char chargerate; // For the charge animation
1043 char guardrate; // Rate for guardpoints recover.
1044 char mprate; // For time-based mp recovery.
1045 char mpdroprate; // Time based MP loss.
1046 char mpstable; // MP stable type.
1047 char riseattacktype;
1048 char mpswitch; // switch between reduce or gain mp for mpstabletype 4
1049 char model_flag; //used to judge some copy method when setting new model to an entity
1050 // movement flags
1051 char subject_to_wall;
1052 char subject_to_platform;
1053 char subject_to_obstacle;
1054 char subject_to_hole;
1055 char subject_to_gravity;
1056 char subject_to_screen;
1057 char subject_to_minz;
1058 char subject_to_maxz;
1059 char no_adjust_base; // dont change base to 0 automatically
1060 char instantitemdeath; // no delay before item suicides
1061 char isSubclassed;
1063 ModelFreetype freetypes;
1064 s_scripts scripts;
1065 s_barstatus hpbarstatus;
1066 s_edelay edelay; // Entity level delay adjustment.
1067 } s_model;
1069 typedef struct {
1070 char *name;
1071 char *path;
1072 s_model *model;
1073 char loadflag;
1074 char selectable;
1075 } s_modelcache;
1076 extern s_modelcache *model_cache;
1079 typedef struct entity {
1080 struct entity *link; // Used to link 2 entities together.
1081 struct entity *owner; // Added for "hitenemy" flag so projectile recognizes its owner
1082 struct entity *grabbing; // Added for "platform level" layering
1083 struct entity *weapent;
1084 struct entity *parent; //Its spawner
1085 struct entity *subentity; //store the sub entity
1086 struct entity *opponent;
1087 struct entity *lasthit;
1088 struct entity *hithead; // when a player jumps and hits head on the bottom of a platform
1089 struct entity *bound; // ignore trymove method, follow this entity
1090 struct entity *landed_on_platform;
1091 struct entity *dot_owner[MAX_DOTS]; //Dot owner.
1093 void (*think) ();
1094 void (*takeaction) ();
1095 int (*takedamage) (struct entity *, s_attack *);
1096 int (*trymove) (float, float);
1098 unsigned char *colourmap;
1100 ScriptVariant *entvars;
1102 s_model *defaultmodel; // this is the default model
1103 s_model *model; // current model
1105 s_anim *animation;
1108 float *defense_factors; //defense factors: damage = damage*(1-def)
1109 float *defense_pain; //Pain factor (like nopain) for defense type.
1110 float *defense_knockdown; //Knockdowncount (like knockdowncount) for attack type.
1111 float *defense_blockpower; //If > unblockable, this attack type is blocked.
1112 float *defense_blockthreshold; //Strongest attack from this attack type that can be blocked.
1113 float *defense_blockratio; //% of damage still taken from this attack type when blocked.
1114 float *defense_blocktype; //0 = HP, 1=MP, 2=both taken when this attack type is blocked.
1115 float *offense_factors; //offense factors: damage = damage*(1+def)
1117 float x; // X
1118 float z; // Depth
1119 float a; // Altitude
1120 float xdir;
1121 float zdir;
1122 float base; // Default altitude
1123 float altbase; // Altitude affected by movea
1124 float tossv; // Effect of gravity
1125 float jumpz;
1126 float jumpx;
1127 float jumpv;
1128 float stats[20]; // Parameters that do nothing on their own.
1129 float lifespancountdown; // life span count down
1130 float antigravity; // gravity*(1-antigravity)
1131 float knockdowncount;
1133 int health; // current hp
1134 int mp; // current mp
1135 int oldhealth;
1136 int oldmp; //mp's variable for mp for players by tails
1137 int sortid; // id for sprite queue sort
1138 int itemhealth; // Now items spawned can have their properties changed
1139 int dot[MAX_DOTS]; //Dot mode.
1140 int dot_atk[MAX_DOTS]; //Dot attack type.
1141 int dot_force[MAX_DOTS]; //Dot amount.
1142 int dot_rate[MAX_DOTS]; //Dot delay per tick.
1143 int dot_cnt[MAX_DOTS]; //Dot time of next tick.
1145 // ---------------------- action times -------------------------------
1146 unsigned int lastmove;
1147 unsigned int lastdir;
1148 unsigned int timestamp;
1149 unsigned int releasetime;
1150 unsigned int toss_time; // Used by gravity code
1151 unsigned int stalltime;
1152 unsigned int combotime; // For multiple-hit combo
1153 unsigned int movetime; // For special move
1154 unsigned int freezetime; // Used to store at what point the a frozen entity becomes unfrozen
1155 unsigned int maptime; // used by forcemap
1156 unsigned int sealtime; // used by seal (stops special moves).
1157 unsigned int dot_time[MAX_DOTS]; //Dot time to expire.
1158 unsigned int magictime;
1159 unsigned int guardtime;
1160 unsigned int nextanim;
1161 unsigned int nextthink;
1162 unsigned int pain_time;
1163 unsigned int mpchargetime; // For the CHARGE animation
1164 unsigned int sleeptime; // For the SLEEP animation
1165 unsigned int rushtime; // rush combo timer
1166 unsigned int knockdowntime; // count knock down hit
1167 unsigned int invinctime; // Used to set time for invincibility to expire
1168 unsigned int turntime;
1169 unsigned int staydown[3]; // [0] = Extra time before next rise. [1] = Extra time before next rise attack. [3] = Stalltime placeholder for riseattack.
1171 s_drawmethod drawmethod;
1172 s_scripts scripts;
1173 s_model modeldata; // model data copyied here
1175 short itemplayer_count;
1176 short boss;
1177 short item; // item model id
1179 short jumpid;
1180 short animpos;
1181 short lastanimpos; // Used by AI
1182 short animnum; // animation id
1184 short attack_id;
1185 short hit_by_attack_id;
1186 //struct entity *thrower;
1187 short bindoffset[4]; // x, z, a, dir; int is ok
1188 short bindanim; // keep the bound entities same animation id
1190 unsigned short rush[2]; // rush combo and max combo
1192 char escapecount; // For escapehits
1193 char update_mark;
1194 char damage_on_landing;
1195 char damagetype; // used for set death animation or pain animation
1196 char map; // Stores the colourmap for restoring purposes
1199 char spawntype; // Type of spawn. 1 = Level spawn. 0 for all else (subject to change).
1200 char exists; // flag to determine if it is a valid entity.
1201 char reactive; // Used for setting the "a" at which weapons are spawned
1202 char ptype;
1203 char playerindex;
1205 char dying; // Coresponds with which remap is to be used for the dying flash
1206 char per1; // Used to store at what health value the entity begins to flash
1207 char per2; // Used to store at what health value the entity flashes more rapidly
1208 char direction; // 0=left 1=right
1209 char nograb; // Some enemies cannot be grabbed (bikes) - now used with cantgrab as well
1210 char movestep;
1211 char name[MAX_NAME_LEN + 1]; // this is display name
1213 char itemmap; // Now items spawned can have their properties changed
1214 char itemtrans; // alpha effect of item
1215 char itemalias[MAX_NAME_LEN + 1]; // Now items spawned can have their properties changed
1216 unsigned char combostep[MAX_SPECIAL_INPUTS]; // merge into an array to clear up some code
1220 //------------------------- a lot of flags ---------------------------
1221 //TODO check if these can be set to 1 bit.
1223 char seal; //1 = No specials.
1224 char dead;
1225 char jumping; // Stuff useful for AI
1226 char idling;
1227 char drop;
1228 char attacking;
1229 char getting;
1230 char turning;
1231 char charging;
1232 char blocking;
1233 char falling;
1234 char running; // Flag to determine if a player is running
1235 char grabwalking; // a flag for grabwalk check
1236 char inpain; // playing pain animation
1237 char frozen; // Flag to determine if an entity is frozen
1238 char blink;
1239 char invincible; // Flag used to determine if player is currently invincible
1240 char autokill; // Kill on end animation
1241 char remove_on_attack;
1242 char cantfire; // Flag to determine if another shot can be fired that costs energy
1243 char tocost; // Flag to determine if special costs life if doesn't hit an enemy
1244 char noaicontrol; // pause A.I. control
1245 char projectile;
1246 char toexplode; // Needed to determine if the projectile is a type that will explode (bombs, dynamite, etc)
1247 char animating; // Set by animation code
1248 char arrowon; // Flag to display parrow/parrow2 or not
1249 char pathblocked;
1252 } entity;
1256 typedef struct {
1257 char name[MAX_NAME_LEN + 1];
1258 char colourmap:8;
1259 unsigned int score:32;
1260 unsigned char lives:8;
1261 unsigned char credits:8;
1262 entity *ent;
1263 u32 keys;
1264 u32 newkeys;
1265 u32 playkeys;
1266 u32 releasekeys;
1267 int spawnhealth;
1268 int spawnmp;
1269 char joining:8;
1270 char hasplayed:8;
1271 char weapnum:8;
1272 } s_player;
1275 typedef struct {
1276 s_sprite *sprite_normal;
1277 s_sprite *sprite_neon;
1278 s_sprite *sprite_screen;
1279 } s_panel;
1281 typedef struct {
1282 char *sprite_normal;
1283 char *sprite_neon;
1284 char *sprite_screen;
1285 } s_panel_filenames;
1287 typedef struct s_spawn_script_cache_node {
1288 char *filename;
1289 Script *cached_spawn_script;
1290 struct s_spawn_script_cache_node *next;
1291 } s_spawn_script_cache_node;
1293 typedef struct s_spawn_script_list_node {
1294 Script *spawn_script;
1295 struct s_spawn_script_list_node *next;
1296 } s_spawn_script_list_node;
1299 typedef struct {
1300 short at:16;
1301 char wait:8;
1302 char nojoin:8; // dont allow new hero to join
1303 char spawnplayer_count:8; // spawn this entity according to the amount of players
1304 char palette:8; //change system palette to ...
1305 short groupmin:16;
1306 short groupmax:16;
1307 short scrollminz:16; // new scroll limit
1308 short scrollmaxz:16;
1309 short blockade:16; //limit how far you can go back
1310 short light[2]; // x, z light direction, for gfx shadow
1311 char shadowcolor:8; // -1 no shadow
1312 int shadowalpha:8;
1313 char music[128];
1314 float musicfade;
1315 u32 musicoffset;
1316 char *name; // must be a name in the model list, so just reference
1317 int index; // model id
1318 int itemindex; // item model id
1319 int weaponindex; // the spawned entity with an weapon item, this is the id of the item model
1320 char alpha:8; // Used for alpha effects
1321 char boss:8;
1322 char flip:8;
1323 char itemtrans:8;
1324 char itemmap:8;
1325 char colourmap:8;
1326 char dying:8; // Used for the dying flash animation
1327 char per1:8; // Used to store at what health value the entity begins to flash
1328 char per2:8; // Used to store at what health value the entity flashes more rapidly
1329 char nolife:8; // So nolife can be overriden for all characters
1330 char itemplayer_count:8; // spawn the item according to the amount of players
1331 s_model *itemmodel;
1332 s_model *model;
1333 char alias[MAX_NAME_LEN + 1];
1334 char *item; // must be a name in the model list, so just reference
1335 char itemalias[MAX_NAME_LEN + 1];
1336 int itemhealth;
1337 int health[MAX_PLAYERS];
1338 int mp; // mp's variable for mpbar by tails
1339 unsigned int score:32; // So score can be overridden for enemies/obstacles
1340 int multiple; // So score can be overridden for enemies/obstacles
1341 // coords
1342 float x;
1343 float z;
1344 float a;
1345 unsigned char credit:8;
1346 short aggression:16; // For enemy A.I.
1347 char spawntype; // Pass 1 when a level spawn.
1348 char *weapon; // spawn with a weapon, since it should be in the model list, so the model must be loaded, just reference its name
1349 s_model *weaponmodel;
1350 s_spawn_script_list_node *spawn_script_list_head;
1351 } s_spawn_entry;
1353 typedef enum {
1354 normal_level = 0,
1355 cut_scene = 1,
1356 select_screen = 2,
1357 } le_type;
1359 typedef struct {
1360 char *branchname; // Use a name so we can find this level in branches
1361 char *filename;
1362 le_type type; // see le_type
1363 int z_coords[3]; // Used for setting custom "z"
1364 int gonext; // 0. dont complete this level and display score,
1365 // 1. complete level and display score,
1366 // 2. complete game, show hall of fame
1367 } s_level_entry;
1370 typedef enum {
1371 bg_sprite,
1372 bg_screen
1373 } bglayer_type;
1375 typedef enum {
1376 fg_sprite,
1377 fg_screen
1378 } fglayer_type;
1380 typedef struct {
1381 union {
1382 s_sprite *sprite;
1383 s_screen *screen;
1384 void *handle;
1386 bglayer_type type;
1387 int width;
1388 int height;
1389 float xratio;
1390 float zratio;
1391 int xoffset;
1392 int zoffset;
1393 int xspacing;
1394 int zspacing;
1395 int xrepeat;
1396 int zrepeat;
1397 int transparency;
1398 int alpha;
1399 int watermode;
1400 int amplitude;
1401 int wavelength;
1402 float wavespeed;
1403 float bgspeedratio;
1404 int enabled;
1405 } s_bglayer;
1407 typedef struct {
1408 union {
1409 s_sprite *sprite;
1410 s_screen *screen;
1411 void *handle;
1413 fglayer_type type;
1414 int width;
1415 int height;
1416 float xratio;
1417 float zratio;
1418 int xoffset;
1419 int zoffset;
1420 int xspacing;
1421 int zspacing;
1422 int xrepeat;
1423 int zrepeat;
1424 int transparency;
1425 int alpha;
1426 int watermode;
1427 int amplitude;
1428 int wavelength;
1429 float wavespeed;
1430 float bgspeedratio;
1431 int enabled;
1432 int z;
1433 } s_fglayer;
1435 typedef struct {
1436 char *text;
1437 int t; //Time to expire.
1438 int x;
1439 int y;
1440 int font;
1441 int z;
1442 } s_textobj;
1444 typedef struct {
1445 int pos;
1446 char *buf;
1447 size_t size;
1448 } s_filestream;
1450 typedef struct {
1451 float x;
1452 float z;
1453 float upperleft;
1454 float lowerleft;
1455 float upperright;
1456 float lowerright;
1457 float depth;
1458 } s_hole;
1460 // attention, s_wall must have all the members of s_hole in the same order
1461 // as it is used in checkwall_or_hole()
1462 typedef struct {
1463 float x;
1464 float z;
1465 float upperleft;
1466 float lowerleft;
1467 float upperright;
1468 float lowerright;
1469 float depth;
1470 float alt;
1471 } s_wall;
1473 typedef struct {
1474 char *name;
1475 int numspawns;
1476 s_spawn_entry spawnpoints[LEVEL_MAX_SPAWNS];
1477 int numpanels;
1478 int order[LEVEL_MAX_PANELS];
1479 s_bglayer bglayers[LEVEL_MAX_BGLAYERS];
1480 s_fglayer fglayers[LEVEL_MAX_FGLAYERS];
1481 s_textobj textobjs[LEVEL_MAX_TEXTOBJS];
1482 int numbglayers;
1483 int numfglayers;
1484 s_filestream filestreams[LEVEL_MAX_FILESTREAMS];
1485 int numfilestreams;
1486 int cameraxoffset;
1487 int camerazoffset;
1488 int numholes;
1489 int numwalls; // Stores number of walls loaded
1490 s_hole holes[LEVEL_MAX_HOLES];
1491 int holesfound[LEVEL_MAX_HOLES];
1492 s_wall walls[LEVEL_MAX_WALLS]; // Now you can have walls for different walkable areas
1493 int wallsfound[LEVEL_MAX_WALLS];
1494 int exit_blocked;
1495 int exit_hole;
1496 int scrolldir;
1497 int width;
1498 int rocking;
1499 float bgspeed; // Used to make autoscrolling backgrounds
1500 int bgdir; // Used to set which direction the backgrounds scroll for autoscrolling backgrounds
1501 int mirror;
1502 int bosses;
1503 char bossmusic[256];
1504 unsigned int bossmusic_offset;
1505 int numpalettes;
1506 unsigned char palettes[LEVEL_MAX_PALETTES][1024]; //dynamic palettes
1507 unsigned char *blendings[LEVEL_MAX_PALETTES][MAX_BLENDINGS]; //blending tables
1508 int settime; // Set time limit per level
1509 int notime; // Used to specify if the time is displayed 1 = no, else yes
1510 int noreset; // If set, clock will not reset when players spawn/die
1511 int type; // Used to specify which level type (1 = bonus, else regular)
1512 int nospecial; // Used to specify if you can use your special during bonus levels
1513 int nohurt; // Used to specify if you can hurt the other player during bonus levels
1514 int noslow; // Flag so the level doesn't slow down after a boss is defeated
1515 int nohit; // Not able to grab / hit other player on a per level basis
1516 int spawn[MAX_PLAYERS][4]; // Used to determine the spawn position of players
1517 int setweap; // Levels can now specified which weapon will be used by default
1518 int facing; // Force the players to face to ... 0 no effects, 1 right, 2 left, 3 affected by level dir
1519 //--------------------gravity system-------------------------
1520 float maxfallspeed;
1521 float maxtossspeed;
1522 float gravity;
1523 //---------------------scripts-------------------------------
1524 Script update_script;
1525 Script updated_script;
1526 Script key_script;
1527 Script level_script;
1528 Script endlevel_script;
1529 s_spawn_script_cache_node *spawn_script_cache_head;
1530 int pos;
1531 u32 advancetime;
1532 u32 quaketime;
1533 int quake;
1534 int waiting;
1536 } s_level;
1539 typedef struct ArgList {
1540 size_t count;
1541 size_t arglen[18];
1542 char *args[18];
1543 } ArgList;
1545 typedef struct {
1546 int black;
1547 int red;
1548 int orange;
1549 int yellow;
1550 int white;
1551 int blue;
1552 int green;
1553 int pink;
1554 int purple;
1555 int magic;
1556 int magic2;
1557 int shadow;
1558 } s_colors;
1559 #define s_colors_itemcount 12
1561 typedef struct {
1562 int r; int g; int b;
1563 } s_rgb;
1565 typedef struct {
1566 s_rgb black;
1567 s_rgb red;
1568 s_rgb orange;
1569 s_rgb yellow;
1570 s_rgb white;
1571 s_rgb blue;
1572 s_rgb green;
1573 s_rgb pink;
1574 s_rgb purple;
1575 s_rgb magic;
1576 s_rgb magic2;
1577 s_rgb shadow;
1578 } s_colors_rgb;
1580 extern s_colors colors;
1582 typedef struct {
1583 int go;
1584 int beat;
1585 int block;
1586 int indirect;
1587 int get;
1588 int get2;
1589 int fall;
1590 int jump;
1591 int punch;
1592 int oneup;
1593 int timeover;
1594 int beep;
1595 int beep2;
1596 int bike;
1597 } s_samples;
1599 extern s_samples samples;
1600 #define s_samples_itemcount 14
1602 typedef struct {
1603 char* go;
1604 char* beat;
1605 char* block;
1606 char* indirect;
1607 char* get;
1608 char* get2;
1609 char* fall;
1610 char* jump;
1611 char* punch;
1612 char* oneup;
1613 char* timeover;
1614 char* beep;
1615 char* beep2;
1616 char* bike;
1617 } s_samples_strings;
1619 extern List *scriptConstantsCommandList;
1620 typedef struct {
1621 VARTYPE vt;
1622 intptr_t value;
1623 } s_script_args_tuple;
1625 typedef struct {
1626 s_script_args_tuple ent;
1627 s_script_args_tuple attacker;
1628 s_script_args_tuple drop;
1629 s_script_args_tuple type;
1630 s_script_args_tuple noblock;
1631 s_script_args_tuple guardcost;
1632 s_script_args_tuple jugglecost;
1633 s_script_args_tuple pauseadd;
1634 s_script_args_tuple which;
1635 s_script_args_tuple atkid;
1636 s_script_args_tuple blocked;
1637 s_script_args_tuple animnum;
1638 s_script_args_tuple frame;
1639 s_script_args_tuple player;
1640 s_script_args_tuple attacktype;
1641 s_script_args_tuple reset;
1642 s_script_args_tuple plane;
1643 s_script_args_tuple height;
1644 s_script_args_tuple obstacle;
1645 s_script_args_tuple time;
1646 s_script_args_tuple gotime;
1647 s_script_args_tuple damage;
1648 s_script_args_tuple damagetaker;
1649 s_script_args_tuple other;
1650 } s_script_args;
1652 typedef struct {
1653 char* ent;
1654 char* attacker;
1655 char* drop;
1656 char* type;
1657 char* noblock;
1658 char* guardcost;
1659 char* jugglecost;
1660 char* pauseadd;
1661 char* which;
1662 char* atkid;
1663 char* blocked;
1664 char* animnum;
1665 char* frame;
1666 char* player;
1667 char* attacktype;
1668 char* reset;
1669 char* plane;
1670 char* height;
1671 char* obstacle;
1672 char* time;
1673 char* gotime;
1674 char* damage;
1675 char* damagetaker;
1676 char* other;
1677 } s_script_args_names;
1678 #define s_script_args_membercount (sizeof(s_script_args_names) / sizeof(char*))
1680 typedef enum {
1681 CB_UP = 0,
1682 CB_DOWN,
1683 CB_LEFT,
1684 CB_RIGHT,
1685 CB_ATK1,
1686 CB_ATK2,
1687 CB_ATK3,
1688 CB_ATK4,
1689 CB_JUMP,
1690 CB_SPECIAL,
1691 CB_START,
1692 CB_SCREENSHOT,
1693 CB_MAX
1694 } control_buttons;
1696 int buffer_pakfile(char *filename, char **pbuffer, size_t * psize);
1697 int getsyspropertybyindex(ScriptVariant * var, int index);
1698 int changesyspropertybyindex(int index, ScriptVariant * value);
1699 int load_script(Script * script, char *path);
1700 void init_scripts();
1701 void load_scripts();
1702 void execute_animation_script(entity * ent);
1703 void execute_takedamage_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1704 int jugglecost, int pauseadd);
1705 void execute_ondeath_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1706 int jugglecost, int pauseadd);
1707 void execute_onkill_script(entity * ent);
1708 void execute_onpain_script(entity * ent, int iType, int iReset);
1709 void execute_onfall_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1710 int jugglecost, int pauseadd);
1711 void execute_onblocks_script(entity * ent);
1712 void execute_onblockw_script(entity * ent, int plane, float height);
1713 void execute_onblocko_script(entity * ent, entity * other);
1714 void execute_onblockz_script(entity * ent);
1715 void execute_onblocka_script(entity * ent, entity * other);
1716 void execute_onmovex_script(entity * ent);
1717 void execute_onmovez_script(entity * ent);
1718 void execute_onmovea_script(entity * ent);
1719 void execute_didblock_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1720 int jugglecost, int pauseadd);
1721 void execute_ondoattack_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1722 int jugglecost, int pauseadd, int iWhich, int iAtkID);
1723 void execute_updateentity_script(entity * ent);
1724 void execute_think_script(entity * ent);
1725 void execute_didhit_script(entity * ent, entity * other, int force, int drop, int type, int noblock, int guardcost,
1726 int jugglecost, int pauseadd, int blocked);
1727 void execute_onspawn_script(entity * ent);
1728 void clearsettings(void);
1729 void savesettings(void);
1730 void saveasdefault(void);
1731 void loadsettings(void);
1732 void loadfromdefault(void);
1733 void clearSavedGame(void);
1734 void clearHighScore(void);
1735 void saveGameFile(void);
1736 int loadGameFile(void);
1737 void saveHighScoreFile(void);
1738 void loadHighScoreFile(void);
1739 int music(char *filename, int loop, long offset);
1740 #if DC
1741 void check_music_opened(void);
1742 #endif
1743 char *findarg(char *command, int which);
1744 float diff(float a, float b);
1745 int inair(entity * e);
1746 float randf(float max);
1747 int _makecolour(int r, int g, int b);
1748 int load_colourmap(s_model * model, char *image1, char *image2);
1749 int load_palette(unsigned char *pal, char *filename);
1750 void standard_palette();
1751 void change_system_palette(int palindex);
1752 void unload_background();
1753 void lifebar_colors();
1754 void load_background(char *filename, int createtables);
1755 void unload_texture();
1756 void load_texture(char *filename);
1757 void freepanels();
1758 s_sprite *loadpanel2(char *filename);
1759 int loadpanel(s_panel_filenames*);
1760 int loadfrontpanel(char *filename);
1761 void resourceCleanUp(void);
1762 void freesprites();
1763 s_sprite *loadsprite2(char *filename, int *width, int *height);
1764 int loadsprite(char *filename, int ofsx, int ofsy, int bmpformat);
1765 void load_special_sprites();
1766 int load_special_sounds();
1767 s_model *find_model(char *name);
1768 s_model *nextplayermodel(s_model * current);
1769 s_model *prevplayermodel(s_model * current);
1770 void free_anim(s_anim * anim);
1771 void free_models();
1772 s_anim *alloc_anim();
1773 int addframe(s_anim * a, int spriteindex, int framecount, short delay, unsigned char idle,
1774 short *bbox, s_attack * attack, short move, short movez,
1775 short movea, short seta, float *platform, int frameshadow,
1776 short *shadow_coords, int soundtoplay, s_drawmethod * drawmethod);
1777 void cache_model(char *name, char *path, int flag);
1778 void remove_from_cache(char *name);
1779 void free_modelcache();
1780 int get_cached_model_index(char *name);
1781 char *get_cached_model_path(char *name);
1782 s_model *load_cached_model(char *name, char *owner, char unload);
1783 int is_set(s_model * model, int m);
1784 int load_script_setting();
1785 int load_models();
1786 void unload_levelorder();
1787 void add_level(char *filename, int diff);
1788 void add_scene(char *filename, int diff);
1789 void load_levelorder();
1790 void unload_level();
1791 void load_level(char *filename);
1792 void drawlifebar(int x, int y, int h, int maxh);
1793 void drawmpbar(int x, int y, int m, int maxm);
1794 void update_loading(s_loadingbar * s, int value, int max);
1795 void spawnplayer(int);
1796 void drop_all_enemies();
1797 void kill_all_enemies();
1798 void ent_set_colourmap(entity * ent, unsigned int which);
1799 void predrawstatus();
1800 void drawstatus();
1801 void addscore(int playerindex, int add);
1802 void free_ent(entity * e);
1803 void free_ents();
1804 int alloc_ents();
1805 entity *smartspawn(s_spawn_entry * p);
1806 int adjust_grabposition(entity * ent, entity * other, float dist, int grabin);
1807 int player_trymove(float xdir, float zdir);
1808 void toss(entity * ent, float lift);
1809 void player_think(void);
1810 void subtract_shot(void);
1811 void set_model_ex(entity * ent, char *modelname, int index, s_model * newmodel, int flag);
1812 void dropweapon(int flag);
1813 void biker_drive(void);
1814 void trap_think(void);
1815 void steamer_think(void);
1816 void text_think(void);
1817 void anything_walk(void);
1818 void adjust_walk_animation(entity * other);
1819 void kill(entity *);
1820 int player_takedamage(entity * other, s_attack * attack);
1821 int biker_takedamage(entity * other, s_attack * attack);
1822 int obstacle_takedamage(entity * other, s_attack * attack);
1823 void ent_set_anim(entity *, int, int);
1824 void suicide(void);
1825 void player_blink(void);
1826 void common_prejump();
1827 void common_dot();
1828 void tryjump(float, float, float, int);
1829 void dojump(float, float, float, int);
1830 void biker_drive(void);
1831 void ent_default_init(entity * e);
1832 void ent_spawn_ent(entity * ent);
1833 void ent_summon_ent(entity * ent);
1834 void ent_set_anim(entity * ent, int aninum, int resetable);
1835 void ent_set_colourmap(entity * ent, unsigned int which);
1836 void ent_set_model(entity * ent, char *modelname);
1837 entity *spawn(float x, float z, float a, int direction, char *name, int index, s_model * model);
1838 void ent_unlink(entity * e);
1839 void ents_link(entity * e1, entity * e2);
1840 void kill(entity * victim);
1841 void kill_all();
1842 int checkhit(entity * attacker, entity * target, int counter);
1843 int checkhole(float x, float z);
1844 int testplatform(entity *, float, float);
1845 int testhole(int, float, float);
1846 int testwall(int, float, float);
1847 int checkwalls(float x, float z, float a1, float a2);
1848 int checkholes(float, float);
1849 int checkwall_below(float x, float z, float a);
1850 int checkwall(float x, float z);
1851 entity *check_platform_below(float x, float z, float a);
1852 entity *check_platform(float x, float z);
1853 void do_attack(entity * e);
1854 void update_ents();
1855 entity *find_ent_here(entity * exclude, float x, float z, int types);
1856 void display_ents();
1857 void toss(entity * ent, float lift);
1858 entity *findent(int types);
1859 int count_ents(int types);
1860 entity *find_ent_here(entity * exclude, float x, float z, int types);
1861 int set_idle(entity * ent);
1862 int set_death(entity * iDie, int type, int reset);
1863 int set_fall(entity * iFall, int type, int reset, entity * other, int force, int drop, int noblock, int guardcost,
1864 int jugglecost, int pauseadd);
1865 int set_rise(entity * iRise, int type, int reset);
1866 int set_riseattack(entity * iRiseattack, int type, int reset);
1867 int set_blockpain(entity * iBlkpain, int type, int reset);
1868 int set_pain(entity * iPain, int type, int reset);
1869 void set_weapon(entity * ent, int wpnum, int anim_flag);
1870 entity *melee_find_target();
1871 entity *long_find_target();
1872 entity *normal_find_target(int anim);
1873 entity *normal_find_item();
1874 int long_attack();
1875 int melee_attack();
1876 void dothrow();
1877 void doprethrow();
1878 void dograbattack(int);
1879 int check_special();
1880 void normal_prepare();
1881 void common_jump();
1882 void common_spawn(void);
1883 void common_drop(void);
1884 void common_jumpattack();
1885 void common_turn();
1886 void common_fall();
1887 void common_lie();
1888 void common_rise();
1889 void common_pain();
1890 void common_vault();
1891 void common_get();
1892 void common_land();
1893 void common_grab(void);
1894 void common_grabattack();
1895 void common_grabbed();
1896 void common_block(void);
1897 int arrow_takedamage(entity * other, s_attack * attack);
1898 int common_takedamage(entity * other, s_attack * attack);
1899 int normal_attack();
1900 void common_throw(void);
1901 void common_throw_wait(void);
1902 void common_prethrow(void);
1903 void npc_warp();
1904 int common_trymove(float xdir, float zdir);
1905 void normal_runoff();
1906 void common_stuck_underneath();
1907 void common_attack_proc();
1908 void normal_attack_finish();
1909 entity *common_find_target();
1910 int common_attack(void);
1911 int common_try_jump(void);
1912 int common_try_pick(entity * other);
1913 int common_try_chase(entity * target);
1914 int common_try_follow();
1915 int common_try_avoid(entity * target);
1916 int common_try_wandercompletely();
1917 int common_try_wander(entity * target);
1918 void common_pickupitem(entity * other);
1919 int common_walk_anim(entity * ent);
1920 int common_idle_anim(entity * ent);
1921 int common_up_anim(entity * ent);
1922 int common_down_anim(entity * ent);
1923 int common_backwalk_anim(entity * ent);
1924 int bomb_move(void);
1925 int arrow_move(void);
1926 int normal_move(void);
1927 int avoid_move(void);
1928 int chase_move(void);
1929 int wander_move(void);
1930 int common_move(void);
1931 void common_think(void);
1932 void suicide(void);
1933 void prethrow(void);
1934 void player_die();
1935 int player_trymove(float xdir, float zdir);
1936 int check_energy(int which, int ani);
1937 void player_preinput();
1938 int player_check_special();
1939 void runanimal(void);
1940 void player_blink(void);
1941 int check_combo(int m);
1942 int check_costmove(int s, int fs);
1943 void didfind_item(entity * other);
1944 void player_think(void);
1945 void subtract_shot();
1946 void dropweapon(int flag);
1947 void drop_all_enemies();
1948 void kill_all_enemies();
1949 void smart_bomb(entity * e, s_attack * attack);
1950 void anything_walk(void);
1951 entity *knife_spawn(char *name, int index, float x, float z, float a, int direction, int type, int map);
1952 entity *bomb_spawn(char *name, int index, float x, float z, float a, int direction, int map);
1953 void bomb_explode(void);
1954 int star_spawn(float x, float z, float a, int direction);
1955 void steam_think(void);
1956 void trap_think(void);
1957 void steam_spawn(float x, float z, float a);
1958 void steamer_think(void);
1959 void text_think(void);
1960 entity *homing_find_target(int type);
1961 void biker_drive(void);
1962 void bike_crash(void);
1963 void obstacle_fall(void);
1964 void obstacle_fly(void);
1965 entity *smartspawn(s_spawn_entry * props);
1966 void spawnplayer(int index);
1967 void time_over();
1968 void update_scroller();
1969 void draw_scrolled_bg();
1970 void update(int ingame, int usevwait);
1971 void fade_out(int type, int speed);
1972 void apply_controls();
1973 void display_credits(void);
1974 void borShutdown(const char *caller, int status, char *msg, ...);
1975 void guistartup(void);
1976 void startup(void);
1977 int playgif(char *filename, int x, int y, int noskip);
1978 void playscene(char *filename);
1979 void gameover();
1980 void hallfame(int addtoscore);
1981 void showcomplete(int num);
1982 int playlevel(char *filename);
1983 int selectplayer(int *players, char *filename);
1984 void playgame(int *players, unsigned which_set, int useSavedGame);
1985 int choose_difficulty();
1986 int load_saved_game();
1987 void term_videomodes();
1988 int init_videomodes(void);
1989 void safe_set(int *arr, int index, int newkey, int oldkey);
1990 void keyboard_setup(int player);
1991 void input_options();
1992 void inputrefresh();
1993 void soundvol_options();
1994 void config_options();
1995 void cheatoptions();
1996 void system_options();
1997 void video_options();
1998 void options();
1999 void soundcard_options();
2000 void openborMain(int argc, char **argv);
2001 int getValidInt(char *text, char *file, char *cmd);
2002 float getValidFloat(char *text, char *file, char *cmd);
2003 int set_color_correction(int gm, int br);
2005 extern s_videomodes videomodes;
2006 extern unsigned int videoMode;
2007 extern int current_palette;
2008 extern unsigned char pal[MAX_PAL_SIZE];
2010 extern s_savelevel savelevel[MAX_DIFFICULTIES];
2011 extern s_savescore savescore;
2012 extern s_savedata savedata;
2014 extern int quit_game;
2015 extern u32 bothkeys;
2016 extern u32 bothnewkeys;
2017 extern u32 interval;
2018 extern s_playercontrols *playercontrolpointers[];
2019 extern int cheats;
2020 extern int livescheat;
2021 extern int creditscheat;
2022 extern int healthcheat;
2023 extern int keyscriptrate;
2024 extern int versusdamage;
2025 extern int ctrlmaxplayers[MAX_DIFFICULTIES];
2026 extern int maxplayers[MAX_DIFFICULTIES];
2027 extern int current_set;
2028 extern int pause; //FIXME rename to borPause and remove pause macro
2029 extern int forcecheatsoff;
2030 extern unsigned int ifcomplete[MAX_DIFFICULTIES];
2031 extern unsigned int num_difficulties;
2032 extern int bonus;
2033 extern int saveslot;
2034 extern char set_names[MAX_DIFFICULTIES][MAX_NAME_LEN + 1];
2035 extern s_player player[4];
2036 extern u32 borTime;
2037 extern int shadowsprites[6];
2038 extern int gosprite;
2039 extern int golsprite;
2040 extern char *custBkgrds;
2041 extern char *custLevels;
2042 extern char *custModels;
2043 #endif