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 #include "types.h" 22 #include "video.h" 23 #include "vga.h" 24 #include "screen.h" 25 #include "transform.h" 26 #include "loadimg.h" 27 #include "bitmap.h" 28 #include "sprite.h" 29 #include "spriteq.h" 30 #include "font.h" 31 #include "timer.h" 32 #include "rand32.h" 33 #include "sblaster.h" 34 #include "soundmix.h" 35 #include "control.h" 36 #include "draw.h" 37 #include "packfile.h" 38 #include "palette.h" 39 #include "anigif.h" 40 #include "openborscript.h" 41 #include "globals.h" 42 #include "ram.h" 43 #include "version.h" 44 #include "savedata.h" 45 46 #ifdef SDL 47 #include "gfx.h" 48 #endif 49 50 #ifdef WEBM 51 #include "yuv.h" 52 #include "vidplay.h" 53 #endif 54 55 ///////////////////////////////////////////////////////////////////////////// 56 57 #define DEFAULT_SHUTDOWN_MESSAGE \ 58 "OpenBOR " VERSION ", Compile Date: " __DATE__ "\n" \ 59 "Presented by the OpenBOR Team.\n" \ 60 "www.chronocrash.com\n"\ 61 "OpenBOR is the open source continuation of Beats of Rage by Senile Team.\n" \ 62 "\n" \ 63 "Special thanks to SEGA and SNK.\n\n" 64 65 #define COMPATIBLEVERSION 0x00033747 66 #define CV_SAVED_GAME 0x00033747 67 #define CV_HIGH_SCORE 0x00033747 68 #define GAME_SPEED 200 69 #define THINK_SPEED 2 70 #define COUNTER_SPEED (GAME_SPEED*2) 71 #define MAX_NAME_LEN 50 //47 72 #define MAX_ENTS 150 73 #define MAX_SPECIALS 8 // Added for customizable freespecials 74 #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 75 #define MAX_ATCHAIN 12 // max attack chain length 76 #define MAX_IDLES 1 // Idle animations. 77 #define MAX_WALKS 1 // Walk animations. 78 #define MAX_BACKWALKS 1 // Backwalk animations. 79 #define MAX_UPS 1 // Walk up animations. 80 #define MAX_DOWNS 1 // Walk down animations. 81 #define MAX_ATTACKS 4 // Total number of attacks players have 82 #define MAX_FOLLOWS 4 // For followup animations 83 #define MAX_COLLISIONS 2 // Collision boxes. 84 #define MAX_ARG_LEN 512 //511 85 #define MAX_ALLOWSELECT_LEN 1024 86 #define MAX_SELECT_LOADS 512 87 #define MAX_PAL_SIZE 1024 88 #define MAX_CACHED_BACKGROUNDS 9 89 #define MAX_DOTS 10 // Max active dot effects. 90 #define MAX_ARG_COUNT 64 91 92 /* 93 Note: the min Z coordinate of the player is important 94 for several other drawing operations. 95 movement restirctions are here! 96 */ 97 98 #define FRONTPANEL_Z (PLAYER_MAX_Z+50) 99 #define HUD_Z (FRONTPANEL_Z+10000) 100 #define HOLE_Z (PLAYER_MIN_Z-46) 101 #define NEONPANEL_Z (PLAYER_MIN_Z-47) 102 #define SHADOW_Z (PLAYER_MIN_Z-48) 103 #define SCREENPANEL_Z (PLAYER_MIN_Z-49) 104 #define PANEL_Z (PLAYER_MIN_Z-50) 105 #define MIRROR_Z (PLAYER_MIN_Z-5) 106 #define PIT_DEPTH -250 107 #define P2_STATS_DIST 180 108 #define CONTACT_DIST_H 30 // Distance to make contact 109 #define CONTACT_DIST_V 12 110 #define GRAB_DIST 36 // Grabbing ents will be placed this far apart. 111 #define GRAB_STALL (GAME_SPEED * 8 / 10) 112 #define T_WALKOFF 2.0 113 #define DEFAULT_ATK_DROPV_Y 3.0 114 #define DEFAULT_ATK_DROPV_X 1.2 115 #define DEFAULT_ATK_DROPV_Z 0 116 117 // PLAY/REC INPUT vars 118 typedef struct InputKeys 119 { 120 u32 keys[MAX_PLAYERS]; 121 u32 newkeys[MAX_PLAYERS]; 122 u32 releasekeys[MAX_PLAYERS]; 123 u32 playkeys[MAX_PLAYERS]; 124 u32 time; 125 u32 interval; 126 u32 synctime; 127 } RecKeys; 128 129 typedef enum 130 { 131 A_REC_STOP, 132 A_REC_REC, 133 A_REC_PLAY, 134 A_REC_FREE, 135 } a_recstatus; 136 137 typedef struct PlayRecStatus { 138 char filename[MAX_ARG_LEN + 1]; 139 char path[MAX_ARG_LEN + 1]; 140 int status; // 0 = stop / 1 = rec / 2 = play 141 int begin; 142 u32 starttime; 143 u32 endtime; 144 u32 synctime; // used to sync rec time with game time 145 u32 totsynctime; 146 u32 cseed; 147 unsigned long seed; 148 unsigned ticks; 149 FILE *handle; 150 RecKeys *buffer; 151 } a_playrecstatus; 152 153 extern a_playrecstatus *playrecstatus; 154 155 typedef enum 156 { 157 PORTING_ANDROID, 158 PORTING_DARWIN, 159 PORTING_DREAMCAST, 160 PORTING_GPX2, 161 PORTING_LINUX, 162 PORTING_OPENDINGUX, 163 PORTING_PSP, 164 PORTING_UNKNOWN, 165 PORTING_WII, 166 PORTING_WINDOWS, 167 PORTING_WIZ, 168 PORTING_XBOX 169 } e_porting; 170 171 172 typedef struct 173 { 174 int x; 175 int y; 176 int font_index; 177 } s_debug_xy_msg; 178 179 typedef enum 180 { 181 /* 182 Key def enum. 183 Damon V. Caskey 184 2013-12-27 185 */ 186 187 FLAG_ESC = 0x00000001, 188 FLAG_START = 0x00000002, 189 FLAG_MOVELEFT = 0x00000004, 190 FLAG_MOVERIGHT = 0x00000008, 191 FLAG_MOVEUP = 0x00000010, 192 FLAG_MOVEDOWN = 0x00000020, 193 FLAG_ATTACK = 0x00000040, 194 FLAG_JUMP = 0x00000080, 195 FLAG_SPECIAL = 0x00000100, 196 FLAG_SCREENSHOT = 0x00000200, 197 FLAG_ATTACK2 = 0x00000400, 198 FLAG_ATTACK3 = 0x00000800, 199 FLAG_ATTACK4 = 0x00001000, 200 FLAG_ANYBUTTON = (FLAG_START|FLAG_SPECIAL|FLAG_ATTACK|FLAG_ATTACK2|FLAG_ATTACK3|FLAG_ATTACK4|FLAG_JUMP), 201 FLAG_CONTROLKEYS = (FLAG_SPECIAL|FLAG_ATTACK|FLAG_ATTACK2|FLAG_ATTACK3|FLAG_ATTACK4|FLAG_JUMP|FLAG_MOVEUP|FLAG_MOVEDOWN|FLAG_MOVELEFT|FLAG_MOVERIGHT), 202 FLAG_FORWARD = 0x40000000, 203 FLAG_BACKWARD = 0x80000000 204 } e_key_def; 205 206 typedef enum 207 { 208 /* 209 Key id enum. 210 Damon V. Caskey 211 2013-12-27 212 */ 213 214 SDID_MOVEUP, 215 SDID_MOVEDOWN, 216 SDID_MOVELEFT, 217 SDID_MOVERIGHT, 218 SDID_ATTACK, 219 SDID_ATTACK2, 220 SDID_ATTACK3, 221 SDID_ATTACK4, 222 SDID_JUMP, 223 SDID_SPECIAL, 224 SDID_START, 225 SDID_SCREENSHOT, 226 SDID_ESC 227 } e_key_id; 228 229 typedef enum 230 { 231 /* 232 Entity type enumerator. 233 Damon V. Caskey 234 2013-12-27 235 */ 236 237 TYPE_NONE, 238 TYPE_PLAYER, 239 TYPE_ENEMY, 240 TYPE_ITEM = 4, 241 TYPE_OBSTACLE = 8, 242 TYPE_STEAMER = 16, 243 TYPE_SHOT = 32, // 7-1-2005 type to use for player projectiles 244 TYPE_TRAP = 64, // 7-1-2005 lets face it enemies are going to just let you storm in without setting a trap or two! 245 TYPE_TEXTBOX = 128, // New textbox type for displaying messages 246 TYPE_ENDLEVEL = 256, // New endlevel type that ends the level when touched 247 TYPE_NPC = 512, // A character can be an ally or enemy. 248 TYPE_PANEL = 1024, // Fake panel, scroll with screen using model speed 249 TYPE_MAX = TYPE_PANEL, // For openbor constant check and type hack (i.e., custom hostile and candamage) 250 TYPE_RESERVED = 0x40000000 // should not use as a type 251 } e_entity_type; 252 253 typedef enum 254 { 255 /* 256 Entity subtype enumerator. 257 Damon V. Caskey 258 2013-12-27 259 */ 260 261 SUBTYPE_NONE, 262 SUBTYPE_BIKER, 263 SUBTYPE_NOTGRAB, 264 SUBTYPE_ARROW, //7-1-2005 subtype for an "enemy" that flies across the screen and dies 265 SUBTYPE_BOOMERANG, 266 SUBTYPE_TOUCH, // ltb 1-18-05 new Item subtype for a more platformer feel. 267 SUBTYPE_WEAPON, 268 SUBTYPE_NOSKIP, // Text type that can't be skipped 269 SUBTYPE_FLYDIE, // Now obstacles can be hit and fly like on Simpsons/TMNT 270 SUBTYPE_BOTH, // Used with TYPE_ENDLEVEL to force both players to reach the point before ending level 271 SUBTYPE_PROJECTILE, // New weapon projectile type that can be picked up by players/enemies 272 SUBTYPE_FOLLOW, // Used by NPC character, if set, they will try to follow players 273 SUBTYPE_CHASE // Used by enemy always chasing you 274 } e_entity_type_sub; 275 276 //------------reserved for A.I. types------------------------- 277 typedef enum 278 { 279 /* 280 AI move 1 enum: Affects movement path 281 Damon V. Caskey 282 2013-12-27 283 */ 284 285 AIMOVE1_NORMAL, // Current default style 286 AIMOVE1_CHASE = 0x00000001, // alway move towards target, and can run to them if target is farway 287 AIMOVE1_CHASEZ = 0x00000002, // only try to get close in z direction 288 AIMOVE1_CHASEX = 0x00000004, // only try to get colse in x direction 289 AIMOVE1_AVOID = 0x00000008, // try to avoid target 290 AIMOVE1_AVOIDZ = 0x00000010, // only try to avoid target in z direction 291 AIMOVE1_AVOIDX = 0x00000020, // only try to avoid target in x direction 292 AIMOVE1_WANDER = 0x00000040, // ignore the target's position completely, wander everywhere, long idle time 293 AIMOVE1_BIKER = 0x00000080, // move like a biker 294 AIMOVE1_ARROW = 0x00000100, // fly like an arrow 295 AIMOVE1_STAR = 0x00000200, // fly like a star, subject to ground 296 AIMOVE1_BOMB = 0x00000400, // fly like a bomb, subject to ground/wall etc 297 AIMOVE1_NOMOVE = 0x00000800, // don't move at all 298 AIMOVE1_BOOMERANG = 0x00001000, // boomerang 299 MASK_AIMOVE1 = 0x0000FFFF 300 } e_aimove_1; 301 302 typedef enum 303 { 304 /* 305 A.I move 2 enum: Affect terrain reflect 306 Damon V. Caskey 307 2013-12-27 308 */ 309 310 AIMOVE2_NORMAL, // Current default style 311 AIMOVE2_IGNOREHOLES = 0x00010000, // don't avoid holes 312 AIMOVE2_NOTARGETIDLE = 0x00020000, // don't move when there's no target 313 MASK_AIMOVE2 = 0xFFFF0000 314 } e_aimove_2; 315 316 typedef enum 317 { 318 /* 319 A.I. attack1 enum: Affect attacking style. 320 Damon V. Caskey 321 2013-12-27 322 */ 323 324 AIATTACK1_NORMAL, // Current default style 325 AIATTACK1_LONG = 0x00000001, // Long range first, not used 326 AIATTACK1_MELEE = 0x00000002, // Melee attack first, not used 327 AIATTACK1_NOATTACK = 0x00000004, // dont attack at all 328 AIATTACK1_ALWAYS = 0x00000008, // more aggression than default, useful for traps who don't think 329 MASK_AIATTACK1 = 0x0000FFFF 330 } e_aiattack_1; 331 332 typedef enum 333 { 334 /* 335 A.I. attack1 enum: Affect Defending style. 336 Damon V. Caskey 337 2013-12-27 338 */ 339 340 AIATTACK2_NORMAL, // Current default style, don't dodge at all 341 AIATTACK2_DODGE = 0x00010000, // Use dodge animation to avoid attack 342 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. 343 MASK_AIATTACK2 = 0xFFFF0000 344 } e_aiattack_2; 345 346 typedef enum //Animations 347 { 348 /* 349 Animations enum. 350 Damon V. Caskey 351 2013-12-27 352 */ 353 354 ANI_IDLE, 355 ANI_WALK, 356 ANI_JUMP, 357 ANI_LAND, 358 ANI_PAIN, 359 ANI_FALL, 360 ANI_RISE, 361 ANI_ATTACK, 362 ANI_ATTACK1, 363 ANI_ATTACK2, 364 ANI_ATTACK3, 365 ANI_ATTACK4, // Very important 366 ANI_UPPER, 367 ANI_BLOCK, // New block animation 368 ANI_JUMPATTACK, 369 ANI_JUMPATTACK2, 370 ANI_GET, 371 ANI_GRAB, 372 ANI_GRABATTACK, 373 ANI_GRABATTACK2, 374 ANI_THROW, 375 ANI_SPECIAL, 376 ANI_FREESPECIAL, 377 ANI_SPAWN, // 26-12-2004 new animation added here ani_spawn 378 ANI_DIE, // 29-12-2004 new animation added here ani_die 379 ANI_PICK, // 7-1-2005 used when players select their character at the select screen 380 ANI_FREESPECIAL2, 381 ANI_JUMPATTACK3, 382 ANI_FREESPECIAL3, 383 ANI_UP, // Mar 2, 2005 - Animation for when going up 384 ANI_DOWN, // Mar 2, 2005 - Animation for when going down 385 ANI_SHOCK, // Animation played when knocked down by shock attack 386 ANI_BURN, // Animation played when knocked down by burn attack 387 ANI_SHOCKPAIN, // Animation played when not knocked down by shock attack 388 ANI_BURNPAIN, // Animation played when not knocked down by shock attack 389 ANI_GRABBED, // Animation played when grabbed 390 ANI_SPECIAL2, // Animation played for when pressing forward special 391 ANI_RUN, // Animation played when a player is running 392 ANI_RUNATTACK, // Animation played when a player is running and presses attack 393 ANI_RUNJUMPATTACK, // Animation played when a player is running and jumps and presses attack 394 ANI_ATTACKUP, // u u animation 395 ANI_ATTACKDOWN, // d d animation 396 ANI_ATTACKFORWARD, // f f animation 397 ANI_ATTACKBACKWARD, // Used for attacking backwards 398 ANI_FREESPECIAL4, // More freespecials added 399 ANI_FREESPECIAL5, // More freespecials added 400 ANI_FREESPECIAL6, // More freespecials added 401 ANI_FREESPECIAL7, // More freespecials added 402 ANI_FREESPECIAL8, // More freespecials added 403 ANI_RISEATTACK, // Attack used for enemies when players are crowding around after knocking them down 404 ANI_DODGE, // Used for up up / down down SOR3 dodge moves for players 405 ANI_ATTACKBOTH, // Used for when a player holds down attack and presses jump 406 ANI_GRABFORWARD, // New grab attack for when a player holds down forward/attack 407 ANI_GRABFORWARD2, // New second grab attack for when a player holds down forward/attack 408 ANI_JUMPFORWARD, // Attack when a player is moving and jumps 409 ANI_GRABDOWN, // Attack when a player has grabbed an opponent and presses down/attack 410 ANI_GRABDOWN2, // Attack when a player has grabbed an opponent and presses down/attack 411 ANI_GRABUP, // Attack when a player has grabbed an opponent and presses up/attack 412 ANI_GRABUP2, // Attack when a player has grabbed an opponent and presses up/attack 413 ANI_SELECT, // Animation that is displayed at the select screen 414 ANI_DUCK, // Animation that is played when pressing down in "platform" type levels 415 ANI_FAINT, // Faint animations for players/enemys by tails 416 ANI_CANT, // Can't animation for players(animation when mp is less than mpcost) by tails. 417 ANI_THROWATTACK, // Added for subtype projectile 418 ANI_CHARGEATTACK, // Plays when player releases attack1 after holding >= chargetime. 419 ANI_JUMPCANT, 420 ANI_JUMPSPECIAL, 421 ANI_BURNDIE, 422 ANI_SHOCKDIE, 423 ANI_PAIN2, 424 ANI_PAIN3, 425 ANI_PAIN4, 426 ANI_FALL2, 427 ANI_FALL3, 428 ANI_FALL4, 429 ANI_DIE2, 430 ANI_DIE3, 431 ANI_DIE4, 432 ANI_CHARGE, 433 ANI_BACKWALK, 434 ANI_SLEEP, 435 ANI_FOLLOW1, 436 ANI_FOLLOW2, 437 ANI_FOLLOW3, 438 ANI_FOLLOW4, 439 ANI_PAIN5, 440 ANI_PAIN6, 441 ANI_PAIN7, 442 ANI_PAIN8, 443 ANI_PAIN9, 444 ANI_PAIN10, 445 ANI_FALL5, 446 ANI_FALL6, 447 ANI_FALL7, 448 ANI_FALL8, 449 ANI_FALL9, 450 ANI_FALL10, 451 ANI_DIE5, 452 ANI_DIE6, 453 ANI_DIE7, 454 ANI_DIE8, 455 ANI_DIE9, 456 ANI_DIE10, 457 ANI_TURN, // turn back/flip 458 ANI_RESPAWN, //now spawn works for players 459 ANI_FORWARDJUMP, 460 ANI_RUNJUMP, 461 ANI_JUMPLAND, 462 ANI_JUMPDELAY, 463 ANI_HITOBSTACLE, 464 ANI_HITPLATFORM, 465 ANI_HITWALL, 466 ANI_GRABBACKWARD, 467 ANI_GRABBACKWARD2, 468 ANI_GRABWALK, 469 ANI_GRABBEDWALK, 470 ANI_GRABWALKUP, 471 ANI_GRABBEDWALKUP, 472 ANI_GRABWALKDOWN, 473 ANI_GRABBEDWALKDOWN, 474 ANI_GRABTURN, 475 ANI_GRABBEDTURN, 476 ANI_GRABBACKWALK, 477 ANI_GRABBEDBACKWALK, 478 ANI_SLIDE, //Down + Jump animation. 479 ANI_RUNSLIDE, //Down + Jump while running. 480 ANI_BLOCKPAIN, //If entity has this, it will play in place of "pain" when it's blokcpain is 1 and incomming attack is blocked. 481 ANI_DUCKATTACK, 482 ANI_RISE2, 483 ANI_RISE3, 484 ANI_RISE4, 485 ANI_RISE5, 486 ANI_RISE6, 487 ANI_RISE7, 488 ANI_RISE8, 489 ANI_RISE9, 490 ANI_RISE10, 491 ANI_RISEB, 492 ANI_RISES, 493 ANI_BLOCKPAIN2, 494 ANI_BLOCKPAIN3, 495 ANI_BLOCKPAIN4, 496 ANI_BLOCKPAIN5, 497 ANI_BLOCKPAIN6, 498 ANI_BLOCKPAIN7, 499 ANI_BLOCKPAIN8, 500 ANI_BLOCKPAIN9, 501 ANI_BLOCKPAIN10, 502 ANI_BLOCKPAINB, 503 ANI_BLOCKPAINS, 504 ANI_CHIPDEATH, 505 ANI_GUARDBREAK, 506 ANI_RISEATTACK2, 507 ANI_RISEATTACK3, 508 ANI_RISEATTACK4, 509 ANI_RISEATTACK5, 510 ANI_RISEATTACK6, 511 ANI_RISEATTACK7, 512 ANI_RISEATTACK8, 513 ANI_RISEATTACK9, 514 ANI_RISEATTACK10, 515 ANI_RISEATTACKB, 516 ANI_RISEATTACKS, 517 ANI_WALKOFF, 518 ANI_BACKPAIN, 519 ANI_BACKPAIN2, 520 ANI_BACKPAIN3, 521 ANI_BACKPAIN4, 522 ANI_BACKPAIN5, 523 ANI_BACKPAIN6, 524 ANI_BACKPAIN7, 525 ANI_BACKPAIN8, 526 ANI_BACKPAIN9, 527 ANI_BACKPAIN10, 528 ANI_BACKFALL, 529 ANI_BACKFALL2, 530 ANI_BACKFALL3, 531 ANI_BACKFALL4, 532 ANI_BACKFALL5, 533 ANI_BACKFALL6, 534 ANI_BACKFALL7, 535 ANI_BACKFALL8, 536 ANI_BACKFALL9, 537 ANI_BACKFALL10, 538 ANI_BACKDIE, 539 ANI_BACKDIE2, 540 ANI_BACKDIE3, 541 ANI_BACKDIE4, 542 ANI_BACKDIE5, 543 ANI_BACKDIE6, 544 ANI_BACKDIE7, 545 ANI_BACKDIE8, 546 ANI_BACKDIE9, 547 ANI_BACKDIE10, 548 ANI_BACKRUN, 549 ANI_GETBOOMERANG, 550 ANI_GETBOOMERANGINAIR, 551 MAX_ANIS // Maximum # of animations. This must always be last. 552 } e_animations; 553 554 typedef enum 555 { 556 ANI_PROP_ANIMHITS, // Does the attack need to hit before cancel is allowed? 557 ANI_PROP_ANTIGRAV, // UT: make dive a similar property as antigravity. 558 ANI_PROP_ATTACK, 559 ANI_PROP_COLLISIONONE, // stick on the only one victim 560 ANI_PROP_BODY_COLLISION, 561 ANI_PROP_BOUNCE, //FLOAT -tossv/bounce = new tossv 562 ANI_PROP_CANCEL, // Cancel anims with freespecial 563 ANI_PROP_CHARGETIME, //FLOAT charge time for an animation 564 ANI_PROP_COUNTERRANGE, //SUB Auto counter attack. 2011_04_01, DC: Moved to struct. 565 ANI_PROP_DELAY, 566 ANI_PROP_DRAWMETHODS, 567 ANI_PROP_DROPFRAME, // SUB if tossv < 0, this frame will be set 568 ANI_PROP_DROPV, // SUB if tossv < 0, this frame will be set 569 ANI_PROP_ENERGYCOST, //SUB. 1-10-05 to adjust the amount of energy used for specials. 2011_03_31, DC: Moved to struct. 570 ANI_PROP_FLIPFRAME, // Turns entities around on the desired frame 571 ANI_PROP_FOLLOWUP, // use which FOLLOW anim? 572 ANI_PROP_IDLE, 573 ANI_PROP_IGNOREATTACKID, 574 ANI_PROP_INDEX, //unique id 575 ANI_PROP_JUMPFRAME, //SUB 576 ANI_PROP_LANDFRAME, // SUB Landing behavior. 2011_04_01, DC: Moved to struct. 577 ANI_PROP_LOOP, // Animation looping. 2011_03_31, DC: Moved to struct. 578 ANI_PROP_MODEL_INDEX, 579 ANI_PROP_MOVE, 580 ANI_PROP_NUMFRAMES, //Framecount. 581 ANI_PROP_OFFSET, 582 ANI_PROP_PLATFORM, 583 ANI_PROP_PROJECTILE, 584 ANI_PROP_QUAKEFRAME, // SUB Screen shake effect. 2011_04_01, DC; Moved to struct. 585 ANI_PROP_RANGE, //SUB Verify distance to target, jump landings, etc.. 2011_04_01, DC: Moved to struct. 586 ANI_PROP_SHADOW, 587 ANI_PROP_SIZE, // SUB entity's size (height) during animation 588 ANI_PROP_SOUNDTOPLAY, 589 ANI_PROP_SPAWNFRAME, // SUB Spawn the subentity as its default type. {frame} {x} {z} {a} {relative?} 590 ANI_PROP_SPRITE, 591 ANI_PROP_SPRITEA, 592 ANI_PROP_SUBENTITY, // Store the sub-entity's name for further use 593 ANI_PROP_SUMMONFRAME, // SUB Summon the subentity as an ally, only one though {frame} {x} {z} {a} {relative?} 594 ANI_PROP_SYNC, // sychronize frame to previous animation if they matches 595 ANI_PROP_UNSUMMONFRAME,// SUB Un-summon the entity 596 ANI_PROP_VULNERABLE, 597 ANI_PROP_WEAPONFRAME // SUB Specify with a frame when to switch to a weapon model 598 } e_animation_properties; 599 600 typedef enum 601 { 602 /* 603 Argument type enum. 604 Damon V. Caskey 605 2013-12-27 606 */ 607 608 ARG_FLOAT, 609 ARG_STRING, 610 ARG_INT 611 } e_arg_types; 612 613 typedef enum 614 { 615 /* 616 Attack type enum 617 Damon V. Caskey 618 2013-12-27 619 */ 620 621 ATK_NORMAL, 622 ATK_NORMAL1 = ATK_NORMAL, 623 ATK_NORMAL2, 624 ATK_NORMAL3, 625 ATK_NORMAL4, 626 ATK_BLAST, 627 ATK_BURN, 628 ATK_FREEZE, 629 ATK_SHOCK, 630 ATK_STEAL, 631 ATK_NORMAL5, 632 ATK_NORMAL6, 633 ATK_NORMAL7, 634 ATK_NORMAL8, 635 ATK_NORMAL9, 636 ATK_NORMAL10, 637 ATK_ITEM, 638 ATK_LAND, 639 ATK_PIT, 640 ATK_LIFESPAN, 641 ATK_TIMEOVER, 642 MAX_ATKS, //Default max attack types (must be below all attack types in enum to get correct value) 643 STA_ATKS = (MAX_ATKS-10) 644 } e_attack_types; 645 646 // Attack box properties. 647 // Caskey, Damon V. 648 // 2016-10-26 649 typedef enum 650 { 651 ATTACK_PROP_BLOCK_COST, 652 ATTACK_PROP_BLOCK_PENETRATE, 653 ATTACK_PROP_COUNTER, 654 ATTACK_PROP_DAMAGE_FORCE, 655 ATTACK_PROP_DAMAGE_LAND_FORCE, 656 ATTACK_PROP_DAMAGE_LAND_MODE, 657 ATTACK_PROP_DAMAGE_LETHAL_DISABLE, 658 ATTACK_PROP_DAMAGE_RECURSIVE_FORCE, 659 ATTACK_PROP_DAMAGE_RECURSIVE_INDEX, 660 ATTACK_PROP_DAMAGE_RECURSIVE_MODE, 661 ATTACK_PROP_DAMAGE_RECURSIVE_TIME_RATE, 662 ATTACK_PROP_DAMAGE_RECURSIVE_TIME_EXPIRE, 663 ATTACK_PROP_DAMAGE_STEAL, 664 ATTACK_PROP_DAMAGE_TYPE, 665 ATTACK_PROP_EFFECT_BLOCK_FLASH, 666 ATTACK_PROP_EFFECT_BLOCK_SOUND, 667 ATTACK_PROP_EFFECT_HIT_FLASH, 668 ATTACK_PROP_EFFECT_HIT_FLASH_DISABLE, 669 ATTACK_PROP_EFFECT_HIT_SOUND, 670 ATTACK_PROP_INDEX, 671 ATTACK_PROP_GROUND, 672 ATTACK_PROP_MAP_INDEX, 673 ATTACK_PROP_MAP_TIME, 674 ATTACK_PROP_POSITION_X, 675 ATTACK_PROP_POSITION_Y, 676 ATTACK_PROP_REACTION_FALL_FORCE, 677 ATTACK_PROP_REACTION_FALL_VELOCITY_X, 678 ATTACK_PROP_REACTION_FALL_VELOCITY_Y, 679 ATTACK_PROP_REACTION_FALL_VELOCITY_Z, 680 ATTACK_PROP_REACTION_FREEZE_MODE, 681 ATTACK_PROP_REACTION_FREEZE_TIME, 682 ATTACK_PROP_REACTION_INVINCIBLE_TIME, 683 ATTACK_PROP_REACTION_REPOSITION_DIRECTION, 684 ATTACK_PROP_REACTION_REPOSITION_DISTANCE, 685 ATTACK_PROP_REACTION_REPOSITION_MODE, 686 ATTACK_PROP_REACTION_PAIN_SKIP, 687 ATTACK_PROP_REACTION_PAUSE_TIME, 688 ATTACK_PROP_SEAL_COST, 689 ATTACK_PROP_SEAL_TIME, 690 ATTACK_PROP_SIZE_X, 691 ATTACK_PROP_SIZE_Y, 692 ATTACK_PROP_SIZE_Z_1, 693 ATTACK_PROP_SIZE_Z_2, 694 ATTACK_PROP_STAYDOWN_RISE, 695 ATTACK_PROP_STAYDOWN_RISEATTACK, 696 ATTACK_PROP_TAG 697 } e_attack_properties; 698 699 // Body collision (bbox) properties. 700 // Caskey, Damon V. 701 // 2016-10-31 702 typedef enum 703 { 704 BODY_COLLISION_PROP_DEFENSE, 705 BODY_COLLISION_PROP_POSITION_X, 706 BODY_COLLISION_PROP_POSISTION_Y, 707 BODY_COLLISION_PROP_SIZE_X, 708 BODY_COLLISION_PROP_SIZE_Y, 709 BODY_COLLISION_PROP_SIZE_Z_1, 710 BODY_COLLISION_PROP_SIZE_Z_2, 711 BODY_COLLISION_PROP_TAG 712 } e_body_collision_properties; 713 714 typedef enum 715 { 716 /* 717 Status bar direction enum. 718 Damon V. Caskey 719 2013-12-29 720 */ 721 722 BARSTATUS_DIR_NORMAL, //Left to Right or Up to Down. 723 BARSTATUS_DIR_INVERT //Right to Left or Down to Up. 724 } e_bar_dir; 725 726 typedef enum 727 { 728 HORIZONTALBAR, 729 VERTICALBAR 730 } e_barorient; 731 732 typedef enum 733 { 734 VALUEBAR, 735 PERCENTAGEBAR 736 } e_bartype; 737 738 typedef enum 739 { 740 BGT_BGLAYER, 741 BGT_FGLAYER, 742 BGT_PANEL, 743 BGT_FRONTPANEL, 744 BGT_WATER, 745 BGT_BACKGROUND, 746 BGT_GENERIC 747 } e_bgloldtype; 748 749 typedef enum 750 { 751 /* 752 Blocktype enum. Type of resource drained (if any) when attack is blocked. 753 Damon V. Caskey 754 2013-12-28 755 */ 756 757 BLOCK_TYPE_HP = -1, //HP only. 758 BLOCK_TYPE_MP_FIRST = 1, //MP until MP is exhuasted, then HP. 759 BLOCK_TYPE_BOTH, //Both MP and HP. 760 BLOCK_TYPE_MP_ONLY //Only MP, even if MP is 0. 761 } e_blocktype; 762 763 typedef enum 764 { 765 /* 766 Energy check type enum. 767 Damon V. Caskey 768 2013-12-29 769 */ 770 771 COST_CHECK_HP, 772 COST_CHECK_MP 773 } e_cost_check; 774 775 typedef enum 776 { 777 /* 778 Energycost type enum. 779 Damon V. Caskey 780 2013-12-29 781 */ 782 783 COST_TYPE_MP_THEN_HP, 784 COST_TYPE_MP_ONLY, 785 COST_TYPE_HP_ONLY 786 } e_cost_type; 787 788 typedef enum 789 { 790 /* 791 Energycost value enum. 792 */ 793 794 ENERGYCOST_NOCOST = 0, 795 ENERGYCOST_DEFAULT_COST = 6, 796 } e_cost_value; 797 798 typedef enum 799 { 800 /* 801 Counter action conditionals. 802 2012-12-16 803 Damon V. Caskey 804 */ 805 806 COUNTERACTION_CONDITION_NONE, //No counter. 807 COUNTERACTION_CONDITION_ALWAYS, //Always perform coutner action. 808 COUNTERACTION_CONDITION_HOSTILE, //Only if attacker is hostile entity. 809 COUNTERACTION_CONDITION_HOSTILE_FRONT_NOFREEZE, //Attacker is hostile, strikes from front, and uses non-freeze attack. 810 COUNTERACTION_CONDITION_ALWAYS_RAGE, //Always perform coutner action and if health - attack_damage <= 0, set health to 1 811 } e_counteraction_condition; 812 813 typedef enum 814 { 815 /* 816 Counteraction damage taking modes. 817 2012-12-16 818 Damon V. Caskey 819 */ 820 821 COUNTERACTION_DAMAGE_NONE, //No damage. 822 COUNTERACTION_DAMAGE_NORMAL //Normal damage. 823 } e_counteraction_damage; 824 825 typedef enum 826 { 827 /* 828 Direction (facing) enum. 829 Damon V. Caskey 830 2013-12-16 831 */ 832 833 DIRECTION_LEFT, 834 DIRECTION_RIGHT 835 } e_direction; 836 837 typedef enum 838 { 839 /* 840 Direction adjustment enum. Used for binding and changing direction of defender when hit. 841 Damon V. Caskey 842 2013-12-28 843 */ 844 845 DIRECTION_ADJUST_NONE, //Leave as is. 846 DIRECTION_ADJUST_SAME, //Same as attacker/bind/etc. 847 DIRECTION_ADJUST_OPPOSITE = -1, //Opposite attacker/bind/etc. 848 DIRECTION_ADJUST_RIGHT = 2, //Always right. 849 DIRECTION_ADJUST_LEFT = -2 //Always left. 850 } e_direction_adjust; 851 852 typedef enum 853 { 854 /* 855 Run adjust_grabposition check on dograb or not. 856 Damon V. Caskey 857 2013-12-30 858 */ 859 860 DOGRAB_ADJUSTCHECK_TRUE, 861 DOGRAB_ADJUSTCHECK_FALSE 862 } e_dograb_adjustcheck; 863 864 typedef enum 865 { 866 /* 867 Damage over time mode enum. 868 Damon V. Caskey 869 2013-12-27 870 */ 871 872 DOT_MODE_OFF, //Disable. 873 DOT_MODE_HP, //Drain HP. 874 DOT_MODE_HP_MP, //Drain HP and MP. 875 DOT_MODE_MP, //Drain mp. 876 DOT_MODE_NON_LETHAL_HP, //Drain HP, but do not kill entity. 877 DOT_MODE_NON_LETHAL_HP_MP //Drain HP and MP, but do not kill entity. 878 } e_dot_mode; 879 880 typedef enum 881 { 882 /* 883 Edelay factor modes. 884 2013-12-16 885 Damon V. Caskey 886 */ 887 EDELAY_MODE_ADD, //Factor is added directly to edelay. 888 EDELAY_MODE_MULTIPLY //Orginal delay value is multiplied by factor. 889 } e_edelay_mode; 890 891 typedef enum 892 { 893 /* 894 Facing adjustment enum. 895 Damon V. Caskey 896 2013-12-29 897 */ 898 899 FACING_ADJUST_NONE, //No facing adjustment. 900 FACING_ADJUST_RIGHT, //Always face right. 901 FACING_ADJUST_LEFT, //Always face left. 902 FACING_ADJUST_LEVEL //Face according to level scroll direction. 903 } e_facing_adjust; 904 905 typedef enum 906 { 907 /* 908 Follow up conditional enumerator. 909 Damon V. Caskey 910 2014-01-04 911 */ 912 913 FOLLOW_CONDITION_DISABLED, //No followup (default). 914 FOLLOW_CONDITION_ALWAYS, //Always perform. 915 FOLLOW_CONDITION_HOSTILE, //Perform if target is hostile. 916 FOLLOW_CONDITION_HOSTILE_NOKILL_NOBLOCK, //Perform if target is hostile, will not be killed and didn't block. 917 FOLLOW_CONDITION_HOSTILE_NOKILL_NOBLOCK_NOGRAB, //Perform if target is hostile, will not be killed, didn't block, and cannot be grabbed. 918 FOLLOW_CONDITION_HOSTILE_NOKILL_BLOCK, //Perform if target is hostile, will not be killed and block. 919 } e_follow_condition; 920 921 typedef enum 922 { 923 /* 924 Komap application enum. When to apply KO map to entity. 925 Damon V. Caskey 926 2013-12-28 927 */ 928 929 KOMAP_TYPE_IMMEDIATELY, //Apply instantly. 930 KOMAP_TYPE_LAST_FALL_FRAME //Apply on last frame of fall. 931 } e_komap_type; 932 933 typedef enum 934 { 935 LE_TYPE_NORMAL, 936 LE_TYPE_CUT_SCENE, 937 LE_TYPE_SELECT_SCREEN, 938 LE_TYPE_SKIP_SELECT 939 } e_le_type; 940 941 typedef enum 942 { 943 LS_TYPE_NONE, //No loading screen. 944 LS_TYPE_BOTH, //Background and status bar. 945 LS_TYPE_BACKGROUND, //Background only. 946 LS_TYPE_BAR, //Status bar only. 947 } e_loadingScreenType; 948 949 typedef enum 950 { 951 /* 952 Model copy flag enum. 953 Damon V. Caskey 954 2013-12-28 955 */ 956 957 MODEL_NO_COPY = 0x00000001, //dont copy anything from original model 958 MODEL_NO_WEAPON_COPY = 0x00000002, //dont copy weapon list from original model 959 MODEL_NO_SCRIPT_COPY = 0x00000004 //don't copy scripts 960 } e_model_copy; 961 962 typedef enum 963 { 964 MF_NONE, 965 MF_ANIMLIST, 966 MF_COLOURMAP, 967 MF_PALETTE = 4, 968 MF_WEAPONS = 8, 969 MF_BRANCH = 16, 970 MF_ANIMATION = 32, 971 MF_DEFENSE = 64, 972 MF_OFF_FACTORS = 128, 973 MF_SPECIAL = 256, 974 MF_SMARTBOMB = 512, 975 MF_SCRIPTS = 1024, 976 MF_ALL = 0x7ff 977 } e_ModelFreetype; 978 979 typedef enum 980 { 981 /* 982 Over thr ground enum. Controls ability to hit downed targets. 983 Damon V. Caskey 984 2013-12-28 985 */ 986 987 OTG_NONE, //Cannot hit grounded targets. 988 OTG_BOTH, //Can hit grounded targets. 989 OTG_GROUND_ONLY //Can ONLY hit grounded targets. 990 } e_otg; 991 992 typedef enum 993 { 994 /* 995 Scroll enum. 996 Damon V. Caskey 997 2013-12-28 998 */ 999 1000 SCROLL_RIGHT = 2, 1001 SCROLL_DOWN = 4, 1002 SCROLL_LEFT = 8, 1003 SCROLL_UP = 16, 1004 SCROLL_BACK = 1, 1005 SCROLL_BOTH = (SCROLL_BACK|SCROLL_RIGHT), 1006 SCROLL_RIGHTLEFT = SCROLL_BOTH, 1007 SCROLL_LEFTRIGHT = (SCROLL_LEFT|SCROLL_BACK), 1008 SCROLL_INWARD = 32, 1009 SCROLL_OUTWARD = 64, 1010 SCROLL_OUTIN = (SCROLL_OUTWARD|SCROLL_BACK), 1011 SCROLL_INOUT = (SCROLL_INWARD|SCROLL_BACK), 1012 SCROLL_UPWARD = 128, 1013 SCROLL_DOWNWARD = 256 1014 } e_scroll; 1015 1016 typedef enum 1017 { 1018 /* 1019 Slow motion switch enum. 1020 Damon V. Caskey 1021 2014-01-21 1022 */ 1023 1024 SLOW_MOTION_OFF, 1025 SLOW_MOTION_ON 1026 } e_slow_motion_enable; 1027 1028 typedef enum 1029 { 1030 /* 1031 Weapon loss type enum. 1032 Damon V. Caskey 1033 2013-12-29 1034 */ 1035 1036 WEAPLOSS_TYPE_ANY, //Weapon lost taking any hit. 1037 WEAPLOSS_TYPE_KNOCKDOWN, //Weapon lost on knockdown. 1038 WEAPLOSS_TYPE_DEATH, //Weapon lost on death. 1039 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. 1040 } e_weaploss_type; 1041 1042 //macros for drawing menu text, fits different font size 1043 #define _strmidx(f,s, args...) ((videomodes.hRes-font_string_width((f), s, ##args))/2) 1044 #define _colx(f,c) ((int)(videomodes.hRes/2+(c)*(fontmonowidth((f))+1))) 1045 #define _liney(f,l) ((int)(videomodes.vRes/2+(l)*(fontheight((f))+1))) 1046 #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) 1047 #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) 1048 #define _menutext(f, c, l, s, args...) font_printf(_colx(f,c), _liney(f,l), (f), 0, s, ##args) 1049 #define _menutextshift(f, c, l, shiftx, shifty, s, args...) font_printf(_colx(f,c)+shiftx, _liney(f,l)+shifty, (f), 0, s, ##args) 1050 1051 //string starts with constant, for animation# series 1052 #define strclen(s) (sizeof(s)-1) 1053 #define starts_with(a, b) (strnicmp(a, b, strclen(b))==0) 1054 #define starts_with_num(a, b) (starts_with(a, b) && (!a[strclen(b)] || (a[strclen(b)] >= '1' && a[strclen(b)] <= '9'))) 1055 #define get_tail_number(n, a, b) \ 1056 n = atoi(a+strclen(b)); \ 1057 if(n<1) n = 1; 1058 1059 #define lut_mul ((level && current_palette)?(level->blendings[current_palette-1][BLEND_MULTIPLY]):(blendings[BLEND_MULTIPLY])) 1060 #define lut_screen ((level && current_palette)?(level->blendings[current_palette-1][BLEND_SCREEN]):(blendings[BLEND_SCREEN])) 1061 #define lut_overlay ((level && current_palette)?(level->blendings[current_palette-1][BLEND_OVERLAY]):(blendings[BLEND_OVERLAY])) 1062 #define lut_hl ((level && current_palette)?(level->blendings[current_palette-1][BLEND_HARDLIGHT]):(blendings[BLEND_HARDLIGHT])) 1063 #define lut_dodge ((level && current_palette)?(level->blendings[current_palette-1][BLEND_DODGE]):(blendings[BLEND_DODGE])) 1064 #define lut_half ((level && current_palette)?(level->blendings[current_palette-1][BLEND_HALF]):(blendings[BLEND_HALF])) 1065 #define lut ((level && current_palette)?(level->blendings[current_palette-1]):(blendings)) 1066 1067 #define ABS(x) ((x)>0?(x):(-(x))) 1068 1069 #define set_attacking(e) e->attacking = 1;\ 1070 e->idling = 0; 1071 1072 #define set_jumping(e) e->jumping = 1;\ 1073 e->idling = 0; 1074 1075 #define set_charging(e) e->charging = 1;\ 1076 e->idling = 0; 1077 1078 #define set_getting(e) e->getting = 1;\ 1079 e->idling = 0; 1080 1081 #define set_blocking(e) e->blocking = 1;\ 1082 e->idling = 0; 1083 1084 #define set_turning(e) e->turning = 1;\ 1085 e->idling = 0; 1086 1087 #define is_frozen(e) ((textbox && e->modeldata.type != TYPE_TEXTBOX) || \ 1088 (smartbomber && e != smartbomber && e->modeldata.type != TYPE_TEXTBOX) ||(self->frozen&&self->freezetime>time)) 1089 1090 #define expand_time(e) if(e->stalltime>0) e->stalltime++;\ 1091 if(e->releasetime>0)e->releasetime++;\ 1092 if(e->nextanim>0)e->nextanim++;\ 1093 if(e->nextthink>0)e->nextthink++;\ 1094 if(e->nextmove>0)e->nextmove++;\ 1095 if(e->magictime>0)e->magictime++;\ 1096 if(e->guardtime>0)e->guardtime++;\ 1097 if(e->toss_time>0)e->toss_time++;\ 1098 if(e->freezetime>0 && (textbox || smartbomber))e->freezetime++;\ 1099 if(e->mpchargetime>0)e->mpchargetime++;\ 1100 if(e->invinctime>0) e->invinctime++;\ 1101 if(e->turntime>0) e->turntime++;\ 1102 if(e->sealtime>0) e->sealtime++; 1103 /* if(e->dot_time>0) e->dot_time++;\ 1104 if(e->dot_cnt>0) e->dot_cnt++; 1105 */ 1106 1107 #define freezeall (smartbomber || textbox) 1108 1109 #define is_projectile(e) (e->modeldata.type == TYPE_SHOT || e->model->subtype == SUBTYPE_ARROW || e->model->subtype == SUBTYPE_BOOMERANG || e->owner) 1110 1111 #define screeny (level?((level->scrolldir == SCROLL_UP || level->scrolldir == SCROLL_DOWN )? 0:advancey ):0) 1112 #define screenx (level?advancex:0) 1113 1114 #define check_range(self, target, animnum) \ 1115 ( target && \ 1116 (self->direction == DIRECTION_RIGHT ? \ 1117 (int)target->position.x >= self->position.x+self->modeldata.animation[animnum]->range.min.x &&\ 1118 (int)target->position.x <= self->position.x+self->modeldata.animation[animnum]->range.max.x\ 1119 :\ 1120 (int)target->position.x <= self->position.x-self->modeldata.animation[animnum]->range.min.x &&\ 1121 (int)target->position.x >= self->position.x-self->modeldata.animation[animnum]->range.max.x)\ 1122 && (int)(target->position.z - self->position.z) >= self->modeldata.animation[animnum]->range.min.z \ 1123 && (int)(target->position.z - self->position.z) <= self->modeldata.animation[animnum]->range.max.z \ 1124 && (int)(target->position.y - self->position.y) >= self->modeldata.animation[animnum]->range.min.y \ 1125 && (int)(target->position.y - self->position.y) <= self->modeldata.animation[animnum]->range.max.y \ 1126 && (int)(target->base - self->base) >= self->modeldata.animation[animnum]->range.min.base \ 1127 && (int)(target->base - self->base) <= self->modeldata.animation[animnum]->range.max.base \ 1128 )\ 1129 1130 #define check_range_both(self, target, animnum) \ 1131 ( target && \ 1132 (((int)target->position.x >= self->position.x+self->modeldata.animation[animnum]->range.min.x &&\ 1133 (int)target->position.x <= self->position.x+self->modeldata.animation[animnum]->range.max.x)\ 1134 ||\ 1135 ((int)target->position.x <= self->position.x-self->modeldata.animation[animnum]->range.min.x &&\ 1136 (int)target->position.x >= self->position.x-self->modeldata.animation[animnum]->range.max.x))\ 1137 && (int)(target->position.z - self->position.z) >= self->modeldata.animation[animnum]->range.min.z \ 1138 && (int)(target->position.z - self->position.z) <= self->modeldata.animation[animnum]->range.max.z \ 1139 && (int)(target->position.y - self->position.y) >= self->modeldata.animation[animnum]->range.min.y \ 1140 && (int)(target->position.y - self->position.y) <= self->modeldata.animation[animnum]->range.max.y \ 1141 && (int)(target->base - self->base) >= self->modeldata.animation[animnum]->range.min.base \ 1142 && (int)(target->base - self->base) <= self->modeldata.animation[animnum]->range.max.base \ 1143 )\ 1144 1145 1146 #define tobounce(e) (e->animation->bounce && diff(0, e->velocity.y) > 1.5 && \ 1147 !((autoland == 1 && e->damage_on_landing == -1) ||e->damage_on_landing == -2)) 1148 1149 #define getpal ((current_palette&&level)?(level->palettes[current_palette-1]):pal) 1150 1151 #define canbegrabbed(self, other) \ 1152 (other->animation->vulnerable[other->animpos] && \ 1153 (!self->animation->move || self->animation->move[self->animpos]->x == 0) && \ 1154 (!self->animation->move || self->animation->move[self->animpos]->z == 0 ) && \ 1155 !(other->nograb || other->invincible || other->link || \ 1156 other->model->animal || inair(other) || \ 1157 (self->modeldata.type == TYPE_PLAYER && other->modeldata.type == TYPE_PLAYER && savedata.mode))) 1158 1159 #define cangrab(self, other) \ 1160 ((other->modeldata.antigrab - self->modeldata.grabforce + \ 1161 (other->modeldata.paingrab?(other->modeldata.paingrab-other->inpain):0)<=0) &&\ 1162 canbegrabbed(self, other) && \ 1163 !inair_range(self) && \ 1164 diff(other->position.y, self->position.y) <= T_WALKOFF) 1165 //diff(other->position.y, self->position.y) <= 0.1) 1166 1167 #define unfrozen(e) \ 1168 ent_set_colourmap(e, e->map);\ 1169 e->frozen = 0;\ 1170 e->freezetime = 0; 1171 1172 #define validanim(e, a) ((e)->modeldata.animation[a]&&(e)->modeldata.animation[a]->numframes) 1173 1174 #define inScreen ( selectScreen || titleScreen || hallOfFame || gameOver || showComplete || currentScene || enginecreditsScreen || menuScreen || startgameMenu || \ 1175 newgameMenu || loadgameMenu || optionsMenu || controloptionsMenu || soundoptionsMenu || videooptionsMenu || systemoptionsMenu ) 1176 1177 //#define MAX_MOVES 16 1178 //#define MAX_MOVE_STEPS 16 1179 1180 #pragma pack (4) 1181 1182 typedef struct 1183 { 1184 /* 1185 Axis structure for general coordinates and velocity use. 1186 2013-12-07 1187 Damon Caskey 1188 */ 1189 1190 float x; //Horizontial axis. 1191 float y; //Altitude/Vertical axis (Y). 1192 float z; //Lateral axis. 1193 } s_axis_f; 1194 1195 typedef struct 1196 { 1197 /* 1198 Axis structure for general coordinates and velocity use when only X and Y are needed.. 1199 2014-01-20 1200 Damon Caskey 1201 */ 1202 1203 float x; //Horizontial axis. 1204 float y; //Altitude/Vertical axis. 1205 } s_axis_f_2d; 1206 1207 typedef struct 1208 { 1209 /* 1210 Axis structure for general coordinates and velocity use when floats are not needed. 1211 2013-12-09 1212 Damon Caskey 1213 */ 1214 1215 int x; //Horizontal axis. 1216 int y; //Altitude/Vertical axis. 1217 int z; //Lateral axis. 1218 int base; //Base altitude. 1219 } s_axis_i; 1220 1221 typedef struct 1222 { 1223 /* 1224 Axis structure for general coordinates when only X and Y are needed. 1225 2014-01-04 1226 Damon Caskey 1227 */ 1228 1229 int x; //Horizontal axis. 1230 int y; //Altitude/Vertical axis. 1231 } s_axis_i_2d; 1232 1233 typedef struct 1234 { 1235 /* 1236 Axis structure for general coordinates when only X and Z are needed. 1237 2014-01-20 1238 Damon Caskey 1239 */ 1240 1241 int x; //Horizontal axis. 1242 int z; //Lateral axis. 1243 } s_axis_i_plane; 1244 1245 typedef struct 1246 { 1247 /* 1248 Min/max cap for integer measurements. 1249 2013-12-10 1250 Damon Caskey 1251 */ 1252 1253 int max; //max value. 1254 int min; //min value. 1255 } s_metric_i; 1256 1257 typedef struct 1258 { 1259 /* 1260 Min/current/max cap for integer measurements. 1261 2014-01-20 1262 Damon Caskey 1263 */ 1264 1265 int current; //Current. 1266 int max; //max value. 1267 int min; //min value. 1268 } s_metric_i_current; 1269 1270 typedef struct 1271 { 1272 unsigned compatibleversion; 1273 char dName[MAX_NAME_LEN + 1]; // Difficulty Name 1274 unsigned level; // Level Number 1275 unsigned stage; // Stage 1276 unsigned pLives[MAX_PLAYERS]; // Player Lives Left 1277 unsigned pCredits[MAX_PLAYERS]; // Player Credits Left 1278 unsigned pScores[MAX_PLAYERS]; // Player Scores 1279 unsigned credits; // Number Of Credits 1280 unsigned times_completed; 1281 unsigned which_set; 1282 //-------------------new strict save features----------------------- 1283 int flag; // 0 useless slot 1 only load level number 2 load player info and level 1284 char pName[MAX_PLAYERS][MAX_NAME_LEN + 1]; // player names 1285 int pSpawnhealth[MAX_PLAYERS]; // hit points left 1286 int pSpawnmp[MAX_PLAYERS]; // magic points left 1287 int pWeapnum[MAX_PLAYERS]; // weapon 1288 int pColourmap[MAX_PLAYERS]; // colour map 1289 1290 int selectFlag; // saved a select.txt infos 1291 char allowSelectArgs[MAX_ALLOWSELECT_LEN]; // allowselect arguments 1292 char selectMusic[MAX_ARG_LEN + 1]; // select music arguments 1293 char selectBackground[MAX_ARG_LEN + 1]; // select background arguments 1294 char selectLoad[MAX_SELECT_LOADS][MAX_ARG_LEN + 1]; // select load arguments 1295 int selectLoadCount; 1296 char selectSkipSelect[MAX_ARG_LEN + 1]; // skipselect arguments 1297 } s_savelevel; 1298 1299 typedef struct 1300 { 1301 unsigned compatibleversion; 1302 unsigned highsc[10]; 1303 char hscoren[10][MAX_NAME_LEN + 1]; 1304 } s_savescore; 1305 1306 typedef struct 1307 { 1308 /* 1309 Slow motion struct 1310 Damon V. Caskey 1311 2014-01-21 1312 */ 1313 1314 int duration; 1315 int counter; 1316 int toggle; 1317 } s_slow_motion; 1318 1319 // Caskey, Damon V. 1320 // 2011-04-08 1321 // 1322 // Delay modifiers before rise or 1323 // riseattack can take place. 1324 typedef struct 1325 { 1326 unsigned int rise; // Time modifier before rise. 1327 unsigned int riseattack; // Time modifier before riseattack. 1328 unsigned int riseattack_stall; // Total stalltime before riseattack. 1329 } s_staydown; 1330 1331 // Caskey, Damon V. 1332 // 2016-10-31 1333 // 1334 // Recursive damage structure 1335 // for attack boxes only. 1336 typedef struct 1337 { 1338 int force; // Damage force per tick. 1339 int index; // Index. 1340 e_dot_mode mode; // Mode. 1341 int rate; // Tick delay. 1342 unsigned int time; // Time to expire. 1343 } s_damage_recursive; 1344 1345 typedef struct 1346 { 1347 int x; 1348 int y; 1349 int width; 1350 int height; 1351 int z1; 1352 int z2; 1353 } s_hitbox; 1354 1355 typedef struct 1356 { 1357 float blockpower; // If > unblockable, this attack type is blocked. 1358 float blockthreshold; // Strongest attack from this attack type that can be blocked. 1359 float blockratio; // % of damage still taken from this attack type when blocked. 1360 e_blocktype blocktype; // Resource drained when attack is blocked. 1361 float factor; // basic defense factors: damage = damage*defense 1362 float knockdown; // Knockdowncount (like knockdowncount) for attack type. 1363 float pain; // Pain factor (like nopain) for defense type. 1364 } s_defense; 1365 1366 // Caskey, Damon V. 1367 // 2016-10~ 1368 // 1369 // Collision box for detecting 1370 // attack boxes. 1371 typedef struct 1372 { 1373 s_hitbox *coords; // Collision box dimensions. 1374 s_defense *defense; // Defense properties for this collision box only. 1375 int index; // To enable user tracking of this box's index when multiple instances are in use. 1376 int tag; // User defined tag for scripts. No hard coded purpose. 1377 } s_collision_body; 1378 1379 // Caskey, Damon V. 1380 // 2016-10~ 1381 // 1382 // List of collision body boxes 1383 // per animation frame. 1384 typedef struct 1385 { 1386 s_collision_body **instance; 1387 } s_collision_body_list; 1388 1389 // Collision box for active 1390 // attacks. 1391 typedef struct 1392 { 1393 int attack_drop; // now be a knock-down factor, how many this attack will knock victim down 1394 int attack_force; 1395 int attack_type; // Reaction animation, death, etc. 1396 int blast; // Attack box active on hit opponent's fall animation. 1397 int blockflash; // Custom bflash for each animation, model id 1398 int blocksound; // Custom sound for when an attack is blocked 1399 s_hitbox *coords; // Collision detection coordinates. 1400 int counterattack; // Treat other attack boxes as body box. 1401 int damage_on_landing; // Same as throw damage type 1402 s_axis_f dropv; // Velocity of target if knocked down. 1403 e_direction_adjust force_direction; // Adjust target's direction on hit. 1404 int forcemap; // Set target's palette on hit. 1405 int freeze; // Lock target in place and set freeze time. 1406 unsigned int freezetime; // Time for target to remain frozen. 1407 int grab; // Not a grab as in grapple - behavior on hit for setting target's position 1408 float grab_distance; // Distance used by "grab". 1409 int guardcost; // cost for blocking an attack 1410 int hitflash; // Custom flash for each animation, model id 1411 int hitsound; // Sound effect to be played when attack hits opponent 1412 int ignore_attack_id; // Ignore attack ID to attack in every frame 1413 int index; // Possible future support of multiple boxes - it's doubt even if support is added this property will be needed. 1414 int jugglecost; // cost for juggling a falling ent 1415 unsigned int maptime; // Time for forcemap to remain in effect. 1416 int no_block; // If this is greater than defense block power, make the hit 1417 int no_flash; // Flag to determine if an attack spawns a flash or not 1418 int no_kill; // this attack won't kill target (leave 1 HP) 1419 int no_pain; // No animation reaction on hit. 1420 e_otg otg; // Over The Ground. Gives ground projectiles the ability to hit lying ents. 1421 unsigned int pain_time; // pain invincible time 1422 int pause_add; // Flag to determine if an attack adds a pause before updating the animation 1423 s_damage_recursive *recursive; // Set up recursive damage (dot) on hit. 1424 int seal; // Disable target's animations with energycost > seal. 1425 unsigned int sealtime; // Time for seal to remain in effect. 1426 s_staydown staydown; // Modify victum's stayodwn properties. 1427 int steal; // Add damage to owner's hp. 1428 int tag; // User defined tag for scripts. No hard coded purpose. 1429 } s_collision_attack; 1430 1431 // Caskey, Damon V. 1432 // 2016-10~ 1433 // 1434 // List of collision attack boxes 1435 // per animation frame. 1436 typedef struct 1437 { 1438 s_collision_attack **instance; 1439 } s_collision_attack_list; 1440 1441 // Caskey, Damon V. 1442 // 2013-12-15 1443 // 1444 // Last hit structure. Populated each time a collision is detected. 1445 typedef struct 1446 { 1447 s_collision_attack *attack; // Collision attacking box. 1448 s_collision_body *body; // Collision detect box. 1449 int confirm; // Will engine's default hit handling be used? 1450 s_axis_f position; // X,Y,Z of last hit. 1451 } s_lasthit; 1452 1453 typedef struct 1454 { 1455 /* 1456 Counter action when taking hit. 1457 Damon V. Caskey 1458 2011-04-01 1459 */ 1460 1461 e_counteraction_condition condition; //Counter conditions. 1462 e_counteraction_damage damaged; //Receive damage from attack. 1463 s_metric_i frame; //Frame range. 1464 } s_counterrange; 1465 1466 typedef struct 1467 { 1468 /* 1469 HP and/or MP cost to perform special/freespecials. 1470 Damon V. Caskey 1471 2011-04-01 1472 */ 1473 1474 int cost; //Amount of energy cost. 1475 int disable; //Disable flag. See check_energy function. 1476 e_cost_type mponly; //MPonly type. 0 = MP while available, then HP. 1 = MP only. 2 = HP only. 1477 } s_energycost; 1478 1479 typedef struct 1480 { 1481 /* 1482 On frame movement (slide, jump, dive, etc.) 1483 2011-04-01 1484 Damon V. Caskey 1485 */ 1486 1487 int ent; // Index of entity to spawn. 1488 int frame; // Frame to perform action. 1489 s_axis_f velocity; // x,a,z velocity. 1490 } s_onframe; 1491 1492 typedef struct 1493 { 1494 /* 1495 Animation looping. 1496 Damon V. Caskey 1497 2011-04-01 1498 */ 1499 1500 s_metric_i frame; // max = Frame animation reaches before looping, min = Frame animation loops back to. 1501 int mode; // 0 = No loop, 1 = Loop. Redundant after frame additions, but needed for backward compatibility. 1502 } s_loop; 1503 1504 typedef struct //2011_04_01, DC: Frame based screen shake functionality. 1505 { 1506 int cnt; //Repetition count. 1507 int framestart; //Frame to start quake. 1508 int repeat; //Repetitons. 1509 int v; //Vertical distance of screen movement (in pixels). 1510 } s_quakeframe; 1511 1512 typedef struct 1513 { 1514 /* 1515 Distance to target verification for AI running, jumping, following parent, and combo chains for all entity types. 1516 2011-04-01 1517 Damon V. Caskey 1518 */ 1519 1520 s_axis_i max; //max ranges. 1521 s_axis_i min; //min ranges. 1522 } s_range; 1523 1524 typedef struct 1525 { 1526 /* 1527 Model/entity level delay modifier. 1528 Damon V. Caskey 1529 (unknown date) revised 2013-12-16. 1530 */ 1531 s_metric_i cap; 1532 float factor; 1533 e_edelay_mode mode; 1534 s_metric_i range; 1535 } s_edelay; 1536 1537 typedef struct 1538 { 1539 /* 1540 Follow up animation struct. 1541 Damon V. caskey 1542 2014-01-04 1543 */ 1544 1545 int animation; //Animation to perform. 1546 e_follow_condition condition; //Condition in which follow up will be performed. 1547 } s_follow; 1548 1549 typedef struct 1550 { 1551 /* 1552 Projectile struct 1553 Damon V. Caskey 1554 2014-01-18 1555 */ 1556 1557 int bomb; //custbomb; 1558 int flash; //custpshotno; 1559 int knife; //custknife; 1560 s_axis_i position; //Location at which projectiles are spawned 1561 int star; //custstar; 1562 int shootframe; 1563 int throwframe; 1564 int tossframe; // Frame to toss bomb/grenade 1565 } s_projectile; 1566 1567 typedef struct 1568 { 1569 int animhits; // Does the attack need to hit before cancel is allowed? 1570 int antigrav; // UT: make dive a similar property as antigravity 1571 int attackone; // stick on the only one victim 1572 float bounce; // -tossv/bounce = new tossv 1573 int cancel; // Cancel anims with freespecial 1574 float chargetime; // charge time for an animation 1575 s_collision_attack_list **collision_attack; 1576 s_collision_body_list **collision_body; 1577 s_counterrange *counterrange; // Auto counter attack. 2011_04_01, DC: Moved to struct. 1578 int *delay; 1579 s_drawmethod **drawmethods; 1580 s_onframe *dropframe; // if tossv < 0, this frame will be set 1581 s_energycost *energycost; // 1-10-05 to adjust the amount of energy used for specials. 2011_03_31, DC: Moved to struct. 1582 int flipframe; // Turns entities around on the desired frame 1583 s_follow followup; // Subsequent animation on hit. 1584 unsigned *idle; // Allow free move 1585 int index; // unique id 1586 s_onframe jumpframe; // Jumpframe action. 2011_04_01, DC: moved to struct. 1587 s_onframe landframe; // Landing behavior. 2011_04_01, DC: Moved to struct. 1588 s_loop loop; // Animation looping. 2011_03_31, DC: Moved to struct. 1589 int model_index; 1590 s_axis_i **move; // base = seta, x = move, y = movea, z = movez 1591 int numframes; 1592 s_axis_i_2d **offset; // original sprite offsets 1593 float (*platform)[8]; // Now entities can have others land on them 1594 s_projectile projectile; // Subentity spawn for knives, stars, bombs, hadoken, etc. 1595 s_quakeframe quakeframe; // Screen shake effect. 2011_04_01, DC; Moved to struct. 1596 s_range range; // Verify distance to target, jump landings, etc.. 2011_04_01, DC: Moved to struct. 1597 int *shadow; 1598 int (*shadow_coords)[2]; // x, z offset of shadow 1599 s_axis_i size; // Dimensions (height, width). 1600 int *soundtoplay; // each frame can have a sound 1601 float *spawnframe; // Spawn the subentity as its default type. {frame} {x} {z} {a} {relative?} 1602 int *sprite; // sprite[set][framenumber] 1603 int subentity; // Store the sub-entity's name for further use 1604 float *summonframe; // Summon the subentity as an ally, only one though {frame} {x} {z} {a} {relative?} 1605 int sync; // sychronize frame to previous animation if they matches 1606 int unsummonframe; // Un-summon the entity 1607 int *vulnerable; 1608 int *weaponframe; // Specify with a frame when to switch to a weapon model 1609 } s_anim; 1610 1611 struct animlist 1612 { 1613 s_anim *anim; 1614 struct animlist *next; 1615 }; 1616 typedef struct animlist s_anim_list; 1617 s_anim_list *anim_list; 1618 1619 typedef struct 1620 { 1621 s_axis_i_2d offset; 1622 s_axis_i_2d size; 1623 e_bartype type; 1624 e_barorient orientation; 1625 int noborder; 1626 e_bar_dir direction; 1627 int barlayer; 1628 int backlayer; 1629 int borderlayer; 1630 int shadowlayer; 1631 int (*colourtable)[11]; //0 default backfill 1-10 foreground colours 1632 } s_barstatus; 1633 1634 typedef struct 1635 { 1636 e_loadingScreenType set; //Loading bar mode. 1637 int tf; //Font number for "LOADING" text (last element in command, moved here because of alignment) 1638 s_axis_i_2d bar_position; //Loading bar position. 1639 s_axis_i_2d text_position; //Loading text position. 1640 int bsize; // length of bar in pixels 1641 int refreshMs; // modder defined number of milliseconds in which the screen is updated while loading 1642 } s_loadingbar; 1643 1644 typedef struct 1645 { 1646 Script *animation_script; //system generated script 1647 Script *update_script; //execute when update_ents 1648 Script *think_script; //execute when entity thinks. 1649 Script *takedamage_script; //execute when taking damage. 1650 Script *ondeath_script; //execute when killed in game. 1651 Script *onkill_script; //execute when removed from play. 1652 Script *onpain_script; //Execute when put in pain animation. 1653 Script *onfall_script; //execute when falling. 1654 Script *inhole_script; //execute when yoy're in a hole 1655 Script *onblocks_script; //execute when blocked by screen. 1656 Script *onblockw_script; //execute when blocked by wall. 1657 Script *onblockp_script; //execute when blocked by platform. 1658 Script *onblocko_script; //execute when blocked by obstacle. 1659 Script *onblockz_script; //execute when blocked by Z. 1660 Script *onblocka_script; //execute when "hit head". 1661 Script *onmovex_script; //execute when moving along X axis. 1662 Script *onmovez_script; //execute when moving along Z axis. 1663 Script *onmovea_script; //execute when moving along A axis. 1664 Script *didhit_script; //execute when attack hits another. 1665 Script *onspawn_script; //execute when spawned. 1666 Script *key_script; //execute when entity's player presses a key 1667 Script *didblock_script; //execute when blocking attack. 1668 Script *ondoattack_script; //execute when attack passes do_attack checks. 1669 Script *onmodelcopy_script; //execute when set_model_ex is done 1670 Script *ondraw_script; //when update_ents is called 1671 } s_scripts; 1672 1673 typedef struct 1674 { 1675 /* 1676 In game icons added 2005_01_20. 1677 2011-04-05 1678 Damon V. Caskey 1679 */ 1680 1681 int def; //Default icon. 1682 int die; //Health depleted. 1683 int get; //Retrieving item. 1684 int mphigh; //MP bar icon; at 66% or more (default if other mp icons not used). 1685 int mplow; //MP bar icon; at or between 0% and 32%. 1686 int mpmed; //MP bar icon; at or between 33% and 65%. 1687 int pain; //Taking damage. 1688 int usemap; 1689 int weapon; //Weapon model. 1690 s_axis_i_2d position; 1691 } s_icon; 1692 1693 typedef struct 1694 { 1695 /* 1696 Pre defined color map selections and behavior. 1697 Damon V. Caskey 1698 2011_04_07 1699 */ 1700 1701 int frozen; //Frozen. 1702 int hide_end; //End range for maps hidden during character selection. 1703 int hide_start; //Start range for maps hidden during character selection. 1704 int ko; //Health depleted. 1705 e_komap_type kotype; //KO map application. 1706 } s_maps; 1707 1708 typedef struct 1709 { 1710 /* 1711 Perception distance (range from self AI can detect other entities). 1712 Damon V. Caskey 1713 2013-12-16 1714 */ 1715 1716 s_axis_i max; //Maximum. 1717 s_axis_i min; //Minimum. 1718 } s_sight; 1719 1720 typedef struct 1721 { 1722 signed char detect; //Invisbility penetration. If self's detect >= target's hide, self can "see" target. 1723 signed char hide; //Invisibility to AI. 1724 } s_stealth; //2011_04_05, DC: Invisibility to AI feature added by DC. 1725 1726 1727 // WIP 1728 typedef struct 1729 { 1730 int input[MAX_SPECIAL_INPUTS]; 1731 int steps; 1732 int numkeys; // num keys pressed 1733 int anim; 1734 int cancel; //should be fine to have 0 if idle is not a valid choice 1735 s_metric_i frame; 1736 int hits; 1737 int valid; // should not be global unless nosame is set, but anyway... 1738 //int (*function)(); //reserved 1739 } s_com; 1740 1741 //UT: new bit flags for noquake property 1742 #define NO_QUAKE 1 //do not make screen quake 1743 #define NO_QUAKEN 2 //do not quake with screen 1744 1745 typedef struct 1746 { 1747 /* 1748 Dust struct. "Dust" effect entity spawned during certain actions. 1749 Damon V. Caskey 1750 2013-12-28 1751 */ 1752 1753 int fall_land; //Knockdown landing. 1754 int jump_land; //Jump landing. 1755 int jump_start; //Jump lift off. 1756 } s_dust; 1757 1758 typedef struct 1759 { 1760 int index; 1761 char *name; 1762 char *path; // Path, so scripts can dynamically get files, sprites, sounds, etc. 1763 unsigned score; 1764 float stats[20]; // Parameters that do nothing on their own. 1765 int health; 1766 float scroll; // Autoscroll like panel entity. 1767 unsigned offscreenkill; // for biker, arrow, etc 1768 float offscreen_noatk_factor; 1769 int priority; 1770 //unsigned offscreenkillz; 1771 //unsigned offscreeenkila; 1772 int mp; // mp's variable for mpbar by tails 1773 int counter; // counter of weapons by tails 1774 unsigned shootnum; // counter of shots by tails 1775 unsigned reload; // reload max shots by tails 1776 int reactive; // Used for setting the "a" at which weapons are spawned 1777 int typeshot; // see if weapon is a gun or knife by tails 1778 int animal; // see is the weapon is a animal by tails 1779 int nolife; // Feb 25, 2005 - Variable flag to show life 0 = no, else yes 1780 int makeinv; // Option to spawn player invincible >0 blink <0 noblink 1781 int riseinv; // how many seconds will the character become invincible after rise >0 blink, <0 noblink 1782 int dofreeze; // Flag to freeze all enemies/players while special is executed 1783 int noquake; // Flag to make the screen shake when entity lands 1 = no, else yes 1784 int ground; // Flag to determine if enemy projectiles only hit the enemy when hitting the ground 1785 int multiple; // So you can control how many points are given for hitting opponents 1786 int bounce; // Flag to determine if bounce/quake is to be used. 1787 e_entity_type type; 1788 e_entity_type_sub subtype; 1789 s_icon icon; //In game icons added 2005_01_20. 2011_04_05, DC: Moved to struct. 1790 int parrow[MAX_PLAYERS][3]; // Image to be displayed when player spawns invincible 1791 int setlayer; // Used for forcing enities to be displayed behind 1792 int thold; // The entities threshold for block 1793 s_maps maps; //2011_04_07, DC: Pre defined color map selections and behavior. 1794 int alpha; // New alpha variable to determine if the entity uses alpha transparency 1795 int toflip; // Flag to determine if flashes flip or not 1796 int shadow; 1797 int gfxshadow; // use current frame to create a shadow 1798 int shadowbase; 1799 int aironly; // Used to determine if shadows will be shown when jumping only 1800 int nomove; // Flag for static enemies 1801 int noflip; // Flag to determine if static enemies flip or stay facing the same direction 1802 int nodrop; // Flag to determine if enemies can be knocked down 1803 int nodieblink; // Flag to determine if blinking while playing die animation 1804 int holdblock; // Continue the block animation as long as the player holds the button down 1805 int nopassiveblock; // Don't auto block randomly 1806 int blockback; // Able to block attacks from behind 1807 int blockodds; // Odds that an enemy will block an attack (1 : blockodds) 1808 s_edelay edelay; // Entity level delay adjustment. 1809 float runspeed; // The speed the character runs at 1810 float runjumpheight; // The height the character jumps when running 1811 float runjumpdist; // The distance the character jumps when running 1812 int noatflash; // Flag to determine if attacking characters attack spawns a flash 1813 int runupdown; // Flag to determine if a player will continue to run while pressing up or down 1814 int runhold; // Flag to determine if a player will continue to run if holding down forward when landing 1815 int remove; // Flag to remove a projectile on contact or not 1816 float throwheight; // The height at which an opponent can now be adjusted 1817 float throwdist; // The distance an opponent can now be adjusted 1818 int throwframewait; // The frame victim is thrown during ANIM_THROW, added by kbandressen 10/20/06 1819 s_com *special; // Stores freespecials 1820 int specials_loaded; // Stores how many specials have been loaded 1821 int diesound; 1822 int weapnum; 1823 int secret; 1824 int clearcount; 1825 int weaploss[2]; // Determines possibility of losing weapon. 1826 int ownweapons; // is the weapon list own or share with others 1827 int *weapon; // weapon model list 1828 int numweapons; 1829 1830 // these are model id of various stuff 1831 int project; 1832 int rider; // 7-1-2005 now every "biker" can have a new driver! 1833 int knife; // 7-1-2005 now every enemy can have their own "knife" projectile 1834 int pshotno; // 7-1-2005 now every enemy can have their own "knife" projectile 1835 int star; // 7-1-2005 now every enemy can have their own "ninja star" projectiles 1836 int bomb; // New projectile type for exploding bombs/grenades/dynamite 1837 float boomerang_acc; 1838 float boomerang_distx; 1839 int flash; // Now each entity can have their own flash 1840 int bflash; // Flash that plays when an attack is blocked 1841 s_dust dust; //Spawn entity during certain actions. 1842 s_axis_i_2d size; // Used to set height of player in pixels 1843 float speed; 1844 float grabdistance; // 30-12-2004 grabdistance varirable adder per character 1845 float pathfindstep; // UT: how long each step if the entity is trying to find a way 1846 int grabflip; // Flip target or not, bit0: grabber, bit1: opponent 1847 float jumpspeed; // normal jump foward speed, default to max(1, speed) 1848 float jumpheight; // 28-12-2004 Jump height variable added per character 1849 int jumpmovex; // low byte: 0 default 1 flip in air, 2 move in air, 3 flip and move 1850 int jumpmovez; // 2nd byte: 0 default 1 zjump with flip(not implemented yet) 2 z jump move in air, 3 1+2 1851 int walkoffmovex; // low byte: 0 default 1 flip in air, 2 move in air, 3 flip and move 1852 int walkoffmovez; // 2nd byte: 0 default 1 zjump with flip(not implemented yet) 2 z jump move in air, 3 1+2 1853 int grabfinish; // wait for grab animation to finish before do other actoins 1854 int antigrab; // anti-grab factor 1855 int grabforce; // grab factor, antigrab - grabforce <= 0 means can grab 1856 e_facing_adjust facing; 1857 int grabback; // Flag to determine if entities grab images display behind opponenets 1858 int grabturn; 1859 int paingrab; // Can only be grabbed when in pain 1860 float grabwalkspeed; 1861 int throwdamage; // 1-14-05 adjust throw damage 1862 unsigned char *palette; // original palette for 32/16bit mode 1863 unsigned char **colourmap; 1864 int maps_loaded; // Used for player colourmap selecting 1865 int unload; // Unload model after level completed? 1866 int falldie; // Play die animation? 1867 int globalmap; // use global palette for its colour map in 24bit mode 1868 int nopain; 1869 int summonkill; // kill it's summoned entity when died; 0. dont kill 1. kill summoned only 2. kill all spawned entity 1870 int combostyle; 1871 int blockpain; 1872 int atchain[MAX_ATCHAIN]; 1873 int chainlength; 1874 s_anim **animation; 1875 int credit; 1876 int escapehits; // Escape spammers! 1877 int chargerate; // For the charge animation 1878 int guardrate; // Rate for guardpoints recover. 1879 int mprate; // For time-based mp recovery. 1880 int mpdroprate; // Time based MP loss. 1881 int mpstable; // MP stable type. 1882 int mpstableval; // MP Stable target. 1883 int aggression; // For enemy A.I. 1884 s_staydown risetime; 1885 unsigned sleepwait; 1886 int riseattacktype; 1887 s_metric_i_current jugglepoints; // Juggle points feature by OX. 2011_04_05, DC: Moved to struct. 1888 s_metric_i_current guardpoints; // Guard points feature by OX. 2011_04_05, DC: Moved to struct. 1889 int mpswitch; // switch between reduce or gain mp for mpstabletype 4 1890 int turndelay; // turn delay 1891 int lifespan; // lifespan count down 1892 float knockdowncount; // the knock down count for this entity 1893 float attackthrottle; // how often the enemy refuse to attack 1894 float attackthrottletime; // how long does the throttle status last 1895 s_stealth stealth; // Invisibility to AI feature added by DC. 2011_04_05, DC: Moved to struct. 1896 1897 //---------------new A.I. switches----------- 1898 int hostile; // specify hostile types 1899 int candamage; // specify types that can be damaged by this entity 1900 int projectilehit; // specify types that can be hit by this entity if it is thrown 1901 unsigned aimove; // move style 1902 s_sight sight; // Sight range. 2011_04_05, DC: Moved to struct. 1903 unsigned aiattack; // attack/defend style 1904 1905 //----------------physical system------------------- 1906 float antigravity; //antigravity : gravity * (1- antigravity) 1907 1908 //--------------new property for endlevel item-------- 1909 char *branch; //level branch name 1910 int model_flag; //used to judge some copy method when setting new model to an entity 1911 1912 s_defense *defense; //defense related, make a struct to aid copying 1913 float *offense_factors; //basic offense factors: damage = damage*offense 1914 s_collision_attack *smartbomb; 1915 1916 // e.g., boss 1917 s_barstatus hpbarstatus; 1918 int hpx; 1919 int hpy; 1920 int namex; 1921 int namey; 1922 1923 // movement flags 1924 int subject_to_basemap; 1925 int subject_to_wall; 1926 int subject_to_platform; 1927 int subject_to_obstacle; 1928 int subject_to_hole; 1929 int subject_to_gravity; 1930 int subject_to_screen; 1931 int subject_to_minz; 1932 int subject_to_maxz; 1933 int no_adjust_base; // dont change base to 0 automatically 1934 int instantitemdeath; // no delay before item suicides 1935 int hasPlatforms; 1936 int isSubclassed; 1937 int backpain; 1938 int nohithead; // used to hit or not a platform with head also when you set a height 1939 int hitwalltype; // wall type to toggle hitwall animations 1940 e_ModelFreetype freetypes; 1941 s_scripts *scripts; 1942 } s_model; 1943 1944 typedef struct 1945 { 1946 char *name; 1947 char *path; 1948 s_model *model; 1949 int loadflag; 1950 int selectable; 1951 } s_modelcache; 1952 s_modelcache *model_cache; 1953 1954 typedef struct 1955 { 1956 /* 1957 Jumping parameters struct. 1958 2013-12-08 1959 Damon Caskey 1960 */ 1961 1962 int id; //Jumping ID. 1963 s_axis_f velocity; //x,a,z velocity setting. 1964 } s_jump; 1965 1966 typedef struct 1967 { 1968 /* 1969 Bind struct for linking of entities. 1970 2013-12-17 1971 Damon V. Caskey 1972 */ 1973 1974 int ani_bind; //Animation binding type. 1975 e_direction_adjust direction; //Direction force 1976 struct entity *ent; //Entity to bind. 1977 s_axis_i offset; //x,y,z offset. 1978 s_axis_i offset_flag; //on/off binding on x,y,z 1979 int sortid; //relative binding sortid. default = -1 1980 } s_bind; 1981 1982 typedef struct 1983 { 1984 /* 1985 Rush combo struct. 1986 Damon V. Caskey 1987 2013-12-17 1988 */ 1989 1990 s_metric_i_current count; //Hits counter. 1991 u32 time; //Time to perform combo. 1992 } s_rush; 1993 1994 typedef struct entity 1995 { 1996 int spawntype; // Type of spawn. 1 = Level spawn. 0 for all else (subject to change). 1997 int exists; // flag to determine if it is a valid entity. 1998 int reactive; // Used for setting the "a" at which weapons are spawned 1999 int ptype; 2000 int playerindex; 2001 float stats[20]; // Parameters that do nothing on their own. 2002 int health; // current hp 2003 int mp; // current mp 2004 int oldhealth; 2005 int oldmp; //mp's variable for mp for players by tails 2006 char name[MAX_NAME_LEN + 1]; // this is display name 2007 s_model *defaultmodel; // this is the default model 2008 s_model *model; // current model 2009 s_model modeldata; // model data copyied here 2010 int item; // item model id 2011 int itemmap; // Now items spawned can have their properties changed 2012 int itemtrans; // alpha effect of item 2013 char itemalias[MAX_NAME_LEN + 1]; // Now items spawned can have their properties changed 2014 int itemhealth; // Now items spawned can have their properties changed 2015 int itemplayer_count; 2016 int boss; 2017 int dying; // Coresponds with which remap is to be used for the dying flash 2018 int dying2; // Coresponds with which remap is to be used for the dying flash for per2 2019 unsigned per1; // Used to store at what health value the entity begins to flash 2020 unsigned per2; // Used to store at what health value the entity flashes more rapidly 2021 int boomerang_loop; 2022 e_direction direction; 2023 int nograb; // Some enemies cannot be grabbed (bikes) - now used with cantgrab as well 2024 int nograb_default; // equal to nograb but this is remain the default value setetd in entity txt file (by White Dragon) 2025 int movestep; 2026 s_axis_f position; //x,y,z location. 2027 s_axis_f velocity; //x,y,z movement speed. 2028 float destx; // temporary values for ai functions 2029 float destz; 2030 float movex; 2031 float movez; 2032 float speedmul; 2033 float base; // Default altitude 2034 float altbase; // Altitude affected by movea 2035 s_jump jump; //Jumping velocity and id. 2036 unsigned combostep[MAX_SPECIAL_INPUTS]; // merge into an array to clear up some code 2037 2038 // ---------------------- action times ------------------------------- 2039 u32 lastmove; 2040 u32 lastdir; 2041 u32 timestamp; 2042 u32 releasetime; 2043 u32 toss_time; // Used by gravity code 2044 u32 nextmove; 2045 u32 stalltime; 2046 u32 combotime; // For multiple-hit combo 2047 u32 movetime; // For special move 2048 u32 freezetime; // Used to store at what point the a frozen entity becomes unfrozen 2049 u32 maptime; // used by forcemap 2050 u32 sealtime; // used by seal (stops special moves). 2051 u32 dot_time[MAX_DOTS]; //Dot time to expire. 2052 int dot[MAX_DOTS]; //Dot mode. 2053 int dot_atk[MAX_DOTS]; //Dot attack type. 2054 int dot_force[MAX_DOTS]; //Dot amount. 2055 int dot_rate[MAX_DOTS]; //Dot delay per tick. 2056 int dot_cnt[MAX_DOTS]; //Dot time of next tick. 2057 struct entity *dot_owner[MAX_DOTS]; //Dot owner. 2058 u32 magictime; 2059 u32 guardtime; 2060 u32 nextanim; 2061 u32 nextthink; 2062 u32 nextattack; 2063 u32 pain_time; 2064 u32 pausetime; // 2012/4/30 UT: Remove lastanimpos and add this. Otherwise hit pause is always bound to frame and attack box. 2065 u32 mpchargetime; // For the CHARGE animation 2066 u32 sleeptime; // For the SLEEP animation 2067 u32 knockdowntime; // count knock down hit 2068 u32 invinctime; // Used to set time for invincibility to expire 2069 u32 turntime; 2070 s_staydown staydown; //Delay modifiers before rise or riseattack can take place. 2011_04_08, DC: moved to struct. 2071 // -------------------------end of times ------------------------------ 2072 int update_mark; 2073 2074 //------------------------- a lot of flags --------------------------- 2075 2076 int seal; //1 = No specials. 2077 int dead; 2078 int jumping; // Stuff useful for AI 2079 int idling; 2080 int walking; 2081 int drop; 2082 int attacking; 2083 int getting; 2084 int turning; 2085 int charging; 2086 int blocking; 2087 int falling; 2088 int running; // Flag to determine if a player is running 2089 int grabwalking; // a flag for grabwalk check 2090 int inpain; // playing pain animation 2091 int inbackpain; // playing pain/fall/die animation 2092 int normaldamageflipdir; // used to reset backpain direction 2093 int frozen; // Flag to determine if an entity is frozen 2094 int blink; 2095 int invincible; // Flag used to determine if player is currently invincible 2096 int autokill; // Kill on end animation 2097 int remove_on_attack; 2098 int cantfire; // Flag to determine if another shot can be fired that costs energy 2099 int tocost; // Flag to determine if special costs life if doesn't hit an enemy 2100 int noaicontrol; // pause A.I. control 2101 int projectile; 2102 int toexplode; // Needed to determine if the projectile is a type that will explode (bombs, dynamite, etc) 2103 int animating; // Set by animation code 2104 int arrowon; // Flag to display parrow/parrow2 or not 2105 unsigned pathblocked; 2106 2107 s_axis_f *waypoints; 2108 int numwaypoints; 2109 int animpos; 2110 int animnum; // animation id 2111 s_anim *animation; 2112 float knockdowncount; 2113 int damage_on_landing; 2114 int damagetype; // used for set death animation or pain animation 2115 int map; // Stores the colourmap for restoring purposes 2116 void (*think)(); 2117 void (*takeaction)(); 2118 int (*takedamage)(struct entity *, s_collision_attack *); 2119 int (*trymove)(float, float); 2120 int attack_id; 2121 int hit_by_attack_id; 2122 int hitwall; // == 1 in the instant that hit the wall/platform/obstacle, else == 0 2123 unsigned char *colourmap; 2124 //struct entity *thrower; 2125 struct entity *link; // Used to link 2 entities together. 2126 struct entity *owner; // Added for "hitenemy" flag so projectile recognizes its owner 2127 struct entity *grabbing; // Added for "platform level" layering 2128 struct entity *weapent; 2129 struct entity *parent; //Its spawner 2130 struct entity *subentity; //store the sub entity 2131 struct entity *opponent; 2132 struct entity *custom_target; // target forced by modder via script 2133 struct entity *lasthit; 2134 struct entity *hithead; // when a player jumps and hits head on the bottom of a platform 2135 struct entity *landed_on_platform; 2136 s_bind binding; 2137 int escapecount; // For escapehits 2138 s_rush rush; //Rush combo display. 2139 int lifespancountdown; // life span count down 2140 2141 //------------- copy them from model to avoid global effect ------------- 2142 s_defense *defense; 2143 float *offense_factors; 2144 2145 int idlemode; 2146 int walkmode; 2147 2148 int sortid; // id for sprite queue sort 2149 Varlist *varlist; 2150 s_drawmethod drawmethod; 2151 s_scripts *scripts; 2152 } entity; 2153 2154 2155 typedef struct 2156 { 2157 char name[MAX_NAME_LEN + 1]; 2158 int colourmap; 2159 unsigned score; 2160 unsigned lives; 2161 unsigned credits; 2162 entity *ent; 2163 u32 keys; 2164 u32 newkeys; 2165 u32 playkeys; 2166 u32 releasekeys; 2167 u32 combokey[MAX_SPECIAL_INPUTS]; 2168 u32 inputtime[MAX_SPECIAL_INPUTS]; 2169 u32 disablekeys; 2170 u32 prevkeys; // used for play/rec mode 2171 int combostep; 2172 int spawnhealth; 2173 int spawnmp; 2174 int joining; 2175 int hasplayed; 2176 int weapnum; 2177 } s_player; 2178 2179 typedef struct 2180 { 2181 int at; 2182 int wait; 2183 int nojoin; // dont allow new hero to join 2184 int spawnplayer_count; // spawn this entity according to the amount of players 2185 int palette; //change system palette to ... 2186 int groupmin; 2187 int groupmax; 2188 int scrollminz; // new scroll limit 2189 int scrollmaxz; 2190 int scrollminx; // new scroll limit 2191 int scrollmaxx; 2192 int blockade; //limit how far you can go back 2193 s_axis_i_2d light; // light direction, for gfx shadow 2194 int shadowcolor; // -1 no shadow 2195 int shadowalpha; 2196 int shadowopacity; 2197 char music[128]; 2198 float musicfade; 2199 u32 musicoffset; 2200 char *name; // must be a name in the model list, so just reference 2201 int index; // model id 2202 int itemindex; // item model id 2203 int weaponindex; // the spawned entity with an weapon item, this is the id of the item model 2204 int alpha; // Used for alpha effects 2205 int boss; 2206 int flip; 2207 int itemtrans; 2208 int itemmap; 2209 int colourmap; 2210 int dying; // Used for the dying flash animation 2211 int dying2; // Used for the dying flash animation health 25% (optional) 2212 unsigned per1; // Used to store at what health value the entity begins to flash 2213 unsigned per2; // Used to store at what health value the entity flashes more rapidly 2214 int nolife; // So nolife can be overriden for all characters 2215 int itemplayer_count; // spawn the item according to the amount of players 2216 s_model *itemmodel; 2217 s_model *model; 2218 char alias[MAX_NAME_LEN + 1]; 2219 char *item; // must be a name in the model list, so just reference 2220 char itemalias[MAX_NAME_LEN + 1]; 2221 int itemhealth; 2222 int health[MAX_PLAYERS]; 2223 int mp; // mp's variable for mpbar by tails 2224 unsigned score; // So score can be overridden for enemies/obstacles 2225 int multiple; // So score can be overridden for enemies/obstacles 2226 s_axis_f position; //x, y, z location. 2227 unsigned credit; 2228 int aggression; // For enemy A.I. 2229 int spawntype; // Pass 1 when a level spawn. 2230 int entitytype; // if it's a enemy, player etc.. 2231 entity *parent; 2232 char *weapon; // spawn with a weapon, since it should be in the model list, so the model must be loaded, just reference its name 2233 s_model *weaponmodel; 2234 Script spawnscript; 2235 } s_spawn_entry; 2236 2237 typedef struct 2238 { 2239 char *branchname; // Use a name so we can find this level in branches 2240 char *filename; 2241 e_le_type type; // see e_le_type 2242 int z_coords[3]; // Used for setting custom "z" 2243 int gonext; // 0. dont complete this level and display score, 2244 char *skipselect[MAX_PLAYERS]; // skipselect level based //[MAX_NAME_LEN] 2245 int noselect; 2246 // 1. complete level and display score, 2247 // 2. complete game, show hall of fame 2248 } s_level_entry; 2249 2250 typedef struct 2251 { 2252 char *name; 2253 int maxplayers; 2254 int numlevels; 2255 s_level_entry *levelorder; 2256 int ifcomplete; 2257 int noshowhof; 2258 int noshowgameover; 2259 int lives; 2260 int credits; 2261 int custfade; 2262 int musicoverlap; //** shouldn't it be level based? 2263 int typemp; //** shouldn't it be model based? 2264 int continuescore; 2265 //char *skipselect[MAX_PLAYERS]; //** better if level based // depreciated 2266 int noselect; 2267 int saveflag; 2268 int nosame; 2269 int noshowcomplete; 2270 } s_set_entry; 2271 2272 typedef struct 2273 { 2274 e_bgloldtype oldtype; 2275 int order; //for panel order 2276 gfx_entry gfx; 2277 s_axis_i_2d size; 2278 s_axis_f ratio; //Only x and z. 2279 s_axis_i offset; //Only x and z. 2280 s_axis_i spacing; //Only x and z. 2281 s_drawmethod drawmethod; 2282 float bgspeedratio; 2283 int enabled; 2284 int z; 2285 int quake; 2286 int neon; 2287 } s_layer; 2288 2289 typedef struct 2290 { 2291 /* 2292 Text object (display text on screen) struct 2293 2013-12-07 2294 Damon Caskey (Feature originally added by kbanderson) 2295 */ 2296 2297 int font; //Font index. 2298 s_axis_i position; //x,y,z location on screen. 2299 u32 time; //Time to expire. 2300 char *text; //Text to display. 2301 } s_textobj; 2302 2303 typedef struct 2304 { 2305 int pos; 2306 char *buf; 2307 size_t size; 2308 } s_filestream; 2309 2310 typedef struct 2311 { 2312 s_axis_i position; //only x and z. 2313 s_axis_i size; //Only x and z. 2314 float *map; 2315 } s_basemap; 2316 2317 typedef struct 2318 { 2319 /* 2320 Hole/Wall structure. 2321 2013-12-07 2322 Damon Caskey 2323 */ 2324 float depth; 2325 float height; 2326 float lowerleft; 2327 float lowerright; 2328 float upperleft; 2329 float upperright; 2330 float x; 2331 float z; 2332 int type; 2333 } s_terrain; 2334 2335 typedef struct 2336 { 2337 char *name; 2338 int numspawns; 2339 s_spawn_entry *spawnpoints; 2340 int numlayers; 2341 s_layer *layers; 2342 int numlayersref; 2343 s_layer *layersref; 2344 ////////////////these below are layer reference 2345 ////////////////use them to ease layer finding for script users 2346 s_layer *background; // the bglayer that contains the default background 2347 int numpanels; 2348 s_layer *(*panels)[3]; //normal neon screen 2349 int numfrontpanels; 2350 s_layer **frontpanels; 2351 int numbglayers; 2352 s_layer **bglayers; 2353 int numfglayers; 2354 s_layer **fglayers; 2355 int numgenericlayers; 2356 s_layer **genericlayers; 2357 int numwaters; 2358 s_layer **waters; 2359 ////////////////layer reference ends here 2360 /////////////////////////////////////////////////////////////// 2361 int numtextobjs; 2362 s_textobj *textobjs; 2363 int cameraxoffset; 2364 int camerazoffset; 2365 int numholes; 2366 int numwalls; 2367 int numbasemaps; 2368 s_terrain *holes; 2369 s_terrain *walls; 2370 s_basemap *basemaps; 2371 int scrolldir; 2372 int width; 2373 int rocking; 2374 float bgspeed; // Used to make autoscrolling backgrounds 2375 float vbgspeed; 2376 float scrollspeed; // UT: restore this command 2011/7/8 2377 int bgdir; // Used to set which direction the backgrounds scroll for autoscrolling backgrounds 2378 int mirror; 2379 int bosses; 2380 char bossmusic[256]; 2381 unsigned bossmusic_offset; 2382 int numpalettes; 2383 unsigned char (*palettes)[1024];//dynamic palettes 2384 unsigned char *(*blendings)[MAX_BLENDINGS];//blending tables 2385 int settime; // Set time limit per level 2386 int notime; // Used to specify if the time is displayed 1 = no, else yes 2387 int noreset; // If set, clock will not reset when players spawn/die 2388 int type; // Used to specify which level type (1 = bonus, else regular) 2389 int nospecial; // Used to specify if you can use your special during bonus levels 2390 int nohurt; // Used to specify if you can hurt the other player during bonus levels 2391 int noslow; // Flag so the level doesn't slow down after a boss is defeated 2392 int nohit; // Not able to grab / hit other player on a per level basis 2393 int forcefinishlevel; // flag to forca to finish a level 2394 s_axis_f spawn[MAX_PLAYERS]; // Used to determine the spawn position of players 2395 int setweap; // Levels can now specified which weapon will be used by default 2396 e_facing_adjust facing; // Force the players to face to ... 2397 //--------------------gravity system------------------------- 2398 float maxfallspeed; 2399 float maxtossspeed; 2400 float gravity; 2401 //---------------------scripts------------------------------- 2402 Script update_script; 2403 Script updated_script; 2404 Script key_script; 2405 Script level_script; 2406 Script endlevel_script; 2407 int pos; 2408 u32 advancetime; 2409 u32 quaketime; 2410 int quake; 2411 int waiting; 2412 2413 } s_level; 2414 2415 typedef struct ArgList 2416 { 2417 size_t count; 2418 size_t arglen[MAX_ARG_COUNT]; 2419 char *args[MAX_ARG_COUNT]; 2420 } ArgList; 2421 2422 2423 #define GET_ARG(z) (arglist.count > z ? arglist.args[z] : "") 2424 #define GET_ARG_LEN(z) (arglist.count > z ? arglist.arglen[z] : 0) 2425 #define GET_ARGP(z) (arglist->count > z ? arglist->args[z] : "") 2426 #define GET_ARGP_LEN(z) (arglist->count > z ? arglist->arglen[z] : 0) 2427 #define GET_INT_ARG(z) getValidInt(GET_ARG(z), filename, command) 2428 #define GET_FLOAT_ARG(z) getValidFloat(GET_ARG(z), filename, command) 2429 #define GET_INT_ARGP(z) getValidInt(GET_ARGP(z), filename, command) 2430 #define GET_FLOAT_ARGP(z) getValidFloat(GET_ARGP(z), filename, command) 2431 2432 #define GET_FRAME_ARG(z) (stricmp(GET_ARG(z), "this")==0?newanim->numframes:GET_INT_ARG(z)) 2433 2434 int buffer_pakfile(char *filename, char **pbuffer, size_t *psize); 2435 size_t ParseArgs(ArgList *list, char *input, char *output); 2436 int getsyspropertybyindex(ScriptVariant *var, int index); 2437 int changesyspropertybyindex(int index, ScriptVariant *value); 2438 int load_script(Script *script, char *path); 2439 void init_scripts(); 2440 void load_scripts(); 2441 void execute_animation_script (entity *ent); 2442 void execute_takedamage_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int tag); 2443 void execute_ondeath_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int tag); 2444 void execute_onkill_script (entity *ent); 2445 void execute_onpain_script (entity *ent, int iType, int iReset); 2446 void execute_onfall_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int tag); 2447 void execute_inhole_script (entity *ent, int plane, float height, int index); 2448 void execute_onblocks_script (entity *ent); 2449 void execute_onblockw_script (entity *ent, int plane, float height, int index); 2450 void execute_onblockp_script (entity *ent, int plane, entity *platform); 2451 void execute_onblocko_script (entity *ent, entity *other); 2452 void execute_onblockz_script (entity *ent); 2453 void execute_onblocka_script (entity *ent, entity *other); 2454 void execute_onmovex_script (entity *ent); 2455 void execute_onmovez_script (entity *ent); 2456 void execute_onmovea_script (entity *ent); 2457 void execute_didblock_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int tag); 2458 void execute_ondoattack_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int iWhich, int iAtkID, int tag); 2459 void execute_updateentity_script (entity *ent); 2460 void execute_think_script (entity *ent); 2461 void execute_didhit_script (entity *ent, entity *other, int force, int drop, int type, int noblock, int guardcost, int jugglecost, int pauseadd, int blocked, int tag); 2462 void execute_onspawn_script (entity *ent); 2463 void clearsettings(void); 2464 void savesettings(void); 2465 void saveasdefault(void); 2466 void loadsettings(void); 2467 void loadfromdefault(void); 2468 void clearSavedGame(void); 2469 void clearHighScore(void); 2470 int saveGameFile(void); 2471 int loadGameFile(void); 2472 int saveScriptFile(void); 2473 int loadScriptFile(void); 2474 int saveHighScoreFile(void); 2475 int loadHighScoreFile(void); 2476 int translate_SDID(char *value); 2477 int music(char *filename, int loop, long offset); 2478 int readByte(char* buf); 2479 char *findarg(char *command, int which); 2480 float diff(float a, float b); 2481 int inair(entity *e); 2482 int inair_range(entity *e); 2483 float randf(float max); 2484 int _makecolour(int r, int g, int b); 2485 int load_colourmap(s_model *model, char *image1, char *image2); 2486 int load_palette(unsigned char *pal, char *filename); 2487 void standard_palette(); 2488 void change_system_palette(int palindex); 2489 void unload_background(); 2490 void lifebar_colors(); 2491 void load_background(char *filename, int createtables); 2492 void unload_texture(); 2493 void load_texture(char *filename); 2494 void freepanels(); 2495 s_sprite *loadpanel2(char *filename); 2496 int loadpanel(char *filename_normal, char *filename_neon, char *filename_screen); 2497 int loadfrontpanel(char *filename); 2498 void resourceCleanUp(void); 2499 void freesprites(); 2500 s_sprite *loadsprite2(char *filename, int *width, int *height); 2501 int loadsprite(char *filename, int ofsx, int ofsy, int bmpformat); 2502 void load_special_sprites(); 2503 int load_special_sounds(); 2504 s_model *find_model(char *name); 2505 s_model *nextplayermodel(s_model *current); 2506 s_model *prevplayermodel(s_model *current); 2507 void free_anim(s_anim *anim); 2508 void free_models(); 2509 s_anim *alloc_anim(); 2510 s_collision_attack *collision_alloc_attack_instance(s_collision_attack* properties); 2511 s_collision_attack **collision_alloc_attack_list(); 2512 s_collision_body *collision_alloc_body_instance(s_collision_body *properties); 2513 s_collision_body **collision_alloc_body_list(); 2514 s_hitbox *collision_alloc_coords(s_hitbox *coords); 2515 int addframe(s_anim *a, 2516 int spriteindex, 2517 int framecount, 2518 int delay, 2519 unsigned idle, 2520 s_collision_body *bbox, 2521 s_collision_attack *attack, 2522 s_axis_i *move, 2523 float *platform, 2524 int frameshadow, 2525 int *shadow_coords, 2526 int soundtoplay, 2527 s_drawmethod *drawmethod, 2528 s_axis_i_2d *offset, 2529 s_damage_recursive *recursive, 2530 s_hitbox *attack_coords, 2531 s_hitbox *body_coords); 2532 void cache_model(char *name, char *path, int flag); 2533 void remove_from_cache(char *name); 2534 void free_modelcache(); 2535 int get_cached_model_index(char *name); 2536 char *get_cached_model_path(char *name); 2537 s_model *load_cached_model(char *name, char *owner, char unload); 2538 int is_set(s_model *model, int m); 2539 int load_script_setting(); 2540 int load_models(); 2541 void unload_levelorder(); 2542 void load_levelorder(); 2543 void unload_level(); 2544 void load_level(char *filename); 2545 void drawlifebar(int x, int y, int h, int maxh); 2546 void drawmpbar(int x, int y, int m, int maxm); 2547 void update_loading(s_loadingbar *s, int value, int max); 2548 void spawnplayer(int); 2549 void drop_all_enemies(); 2550 void kill_all_enemies(); 2551 unsigned getFPS(void); 2552 unsigned char *model_get_colourmap(s_model *model, unsigned which); 2553 void ent_set_colourmap(entity *ent, unsigned int which); 2554 void predrawstatus(); 2555 void drawstatus(); 2556 void addscore(int playerindex, int add); 2557 void free_ent(entity *e); 2558 void free_ents(); 2559 int alloc_ents(); 2560 entity *smartspawn(s_spawn_entry *p); 2561 int adjust_grabposition(entity *ent, entity *other, float dist, int grabin); 2562 int player_trymove(float xdir, float zdir); 2563 void toss(entity *ent, float lift); 2564 void player_think(void); 2565 void subtract_shot(void); 2566 void set_model_ex(entity *ent, char *modelname, int index, s_model *newmodel, int flag); 2567 void dropweapon(int flag); 2568 void biker_drive(void); 2569 void trap_think(void); 2570 void steamer_think(void); 2571 void text_think(void); 2572 void anything_walk(void); 2573 void adjust_walk_animation(entity *other); 2574 void kill(entity *); 2575 int player_takedamage(entity *other, s_collision_attack *attack); 2576 int biker_takedamage(entity *other, s_collision_attack *attack); 2577 int obstacle_takedamage(entity *other, s_collision_attack *attack); 2578 void suicide(void); 2579 void player_blink(void); 2580 void common_prejump(); 2581 void common_dot(); 2582 void tryjump(float, float, float, int); 2583 void dojump(float, float, float, int); 2584 void biker_drive(void); 2585 void ent_default_init(entity *e); 2586 void ent_spawn_ent(entity *ent); 2587 void ent_summon_ent(entity *ent); 2588 void ent_set_anim(entity *ent, int aninum, int resetable); 2589 void ent_set_colourmap(entity *ent, unsigned int which); 2590 void ent_set_model(entity *ent, char *modelname, int syncAnim); 2591 entity *spawn(float x, float z, float a, int direction, char *name, int index, s_model *model); 2592 void ent_unlink(entity *e); 2593 void ents_link(entity *e1, entity *e2); 2594 void kill(entity *victim); 2595 void kill_all(); 2596 int checkhit(entity *attacker, entity *target); 2597 int checkhole(float x, float z); 2598 int checkhole_index(float x, float z); 2599 int checkhole_in(float x, float z, float a); 2600 int checkholeindex_in(float x, float z, float a); 2601 int checkhole_between(float x, float z, float a1, float a2); 2602 int testplatform(entity *, float, float, entity *); 2603 int testhole(int, float, float); 2604 int testwall(int, float, float); 2605 int checkwalls(float x, float z, float a1, float a2); 2606 int checkholes(float, float); 2607 int checkwall_below(float x, float z, float a); 2608 int checkwall(float x, float z); 2609 float check_basemap(int x, int z); 2610 int check_basemap_index(int x, int z); 2611 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); 2612 int testmove(entity *, float, float, float, float); 2613 entity *check_platform_below(float x, float z, float a, entity *exclude); 2614 entity *check_platform_above(float x, float z, float a, entity *exclude); 2615 entity *check_platform_between(float x, float z, float amin, float amax, entity *exclude); 2616 entity *check_platform(float x, float z, entity *exclude); 2617 float get_platform_base(entity *); 2618 int is_on_platform(entity *); 2619 entity *get_platform_on(entity *); 2620 void do_attack(entity *e); 2621 void adjust_base(entity *e, entity **pla); 2622 void check_gravity(entity *e); 2623 void update_ents(); 2624 entity *find_ent_here(entity *exclude, float x, float z, int types, int (*test)(entity *, entity *)); 2625 void display_ents(); 2626 void toss(entity *ent, float lift); 2627 entity *findent(int types); 2628 int count_ents(int types); 2629 int set_idle(entity *ent); 2630 int set_death(entity *iDie, int type, int reset); 2631 int set_fall(entity *iFall, int type, int reset, entity *other, int force, int drop, int noblock, int guardcost, int jugglecost, int pauseadd, int tag); 2632 int set_rise(entity *iRise, int type, int reset); 2633 int set_riseattack(entity *iRiseattack, int type, int reset); 2634 int set_blockpain(entity *iBlkpain, int type, int reset); 2635 int set_pain(entity *iPain, int type, int reset); 2636 int reset_backpain(entity *ent); 2637 int check_backpain(entity* attacker, entity* defender); 2638 void set_weapon(entity *ent, int wpnum, int anim_flag); 2639 entity *melee_find_target(); 2640 entity *long_find_target(); 2641 entity *normal_find_target(int anim, int iDetect); 2642 entity *normal_find_item(); 2643 int long_attack(); 2644 int melee_attack(); 2645 void dothrow(); 2646 void doprethrow(); 2647 void dograbattack(int); 2648 int check_special(); 2649 void normal_prepare(); 2650 void common_jump(); 2651 void common_spawn(void); 2652 void common_drop(void); 2653 void common_walkoff(void); 2654 void common_jumpattack(); 2655 void common_turn(); 2656 void common_fall(); 2657 void common_lie(); 2658 void common_rise(); 2659 void common_pain(); 2660 void common_get(); 2661 void common_land(); 2662 void common_grab(void); 2663 void common_grabattack(); 2664 void common_grabbed(); 2665 void common_block(void); 2666 int arrow_takedamage(entity *other, s_collision_attack *attack); 2667 int common_takedamage(entity *other, s_collision_attack *attack); 2668 int normal_attack(); 2669 void common_throw(void); 2670 void common_throw_wait(void); 2671 void common_prethrow(void); 2672 void npc_warp(); 2673 int checkpathblocked(); 2674 int common_trymove(float xdir, float zdir); 2675 void normal_runoff(); 2676 void common_stuck_underneath(); 2677 void common_animation_normal(); 2678 void common_attack_proc(); 2679 void normal_attack_finish(); 2680 entity *common_find_target(); 2681 int common_attack(void); 2682 int common_try_jump(void); 2683 int common_try_pick(entity *other); 2684 int common_try_chase(entity *target, int dox, int doz); 2685 int common_try_follow(entity *target, int dox, int doz); 2686 int common_try_avoid(entity *target, int dox, int doz); 2687 int common_try_wandercompletely(int dox, int doz); 2688 int common_try_wander(entity *target, int dox, int doz); 2689 void common_pickupitem(entity *other); 2690 int common_backwalk_anim(entity *ent); 2691 void draw_position_entity(entity *entity, int offset_z, int color, s_drawmethod *drawmethod); 2692 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); 2693 void draw_visual_debug(); 2694 int bomb_move(void); 2695 int arrow_move(void); 2696 int common_move(void); 2697 void common_think(void); 2698 void suicide(void); 2699 void prethrow(void); 2700 void player_die(); 2701 int player_trymove(float xdir, float zdir); 2702 int check_energy(e_cost_check which, int ani); 2703 int player_preinput(); 2704 int player_check_special(); 2705 void runanimal(void); 2706 void player_blink(void); 2707 int check_combo(); 2708 int check_costmove(int s, int fs, int jumphack); 2709 void didfind_item(entity *other); 2710 void player_think(void); 2711 void subtract_shot(); 2712 void dropweapon(int flag); 2713 void drop_all_enemies(); 2714 void kill_all_enemies(); 2715 void smart_bomb(entity *e, s_collision_attack *attack); 2716 void anything_walk(void); 2717 entity *knife_spawn(char *name, int index, float x, float z, float a, int direction, int type, int map); 2718 entity *bomb_spawn(char *name, int index, float x, float z, float a, int direction, int map); 2719 void bomb_explode(void); 2720 int star_spawn(float x, float z, float a, int direction); 2721 void steam_think(void); 2722 void trap_think(void); 2723 void steam_spawn(float x, float z, float a); 2724 void steamer_think(void); 2725 void text_think(void); 2726 entity *homing_find_target(int type); 2727 void biker_drive(void); 2728 void bike_crash(void); 2729 void obstacle_fall(void); 2730 void obstacle_fly(void); 2731 entity *smartspawn(s_spawn_entry *props); 2732 int is_incam(float x, float z, float a, float threshold); 2733 void spawnplayer(int index); 2734 void time_over(); 2735 void update_scroller(); 2736 void draw_scrolled_bg(); 2737 void update(int ingame, int usevwait); 2738 void fade_out(int type, int speed); 2739 void apply_controls(); 2740 void plan(); 2741 int is_in_backrun(entity*); 2742 int ai_check_warp(); 2743 int ai_check_lie(); 2744 int ai_check_grabbed(); 2745 int ai_check_grab(); 2746 int ai_check_escape(); 2747 int ai_check_busy(); 2748 void display_credits(void); 2749 void shutdown(int status, char *msg, ...); 2750 #ifdef DC 2751 void guistartup(void); 2752 #endif 2753 void startup(void); 2754 int playgif(char *filename, int x, int y, int noskip); 2755 void playscene(char *filename); 2756 void gameover(); 2757 void hallfame(int addtoscore); 2758 void showcomplete(int num); 2759 int playlevel(char *filename); 2760 int selectplayer(int *players, char *filename, int useSavedGame); 2761 void playgame(int *players, unsigned which_set, int useSavedGame); 2762 int load_saved_game(); 2763 void term_videomodes(); 2764 void init_videomodes(int log); 2765 void safe_set(int *arr, int index, int newkey, int oldkey); 2766 2767 void keyboard_setup(int player); 2768 void inputrefresh(); 2769 2770 int menu_difficulty(); 2771 void menu_options(); 2772 void menu_options_config(); 2773 void menu_options_debug(); 2774 void menu_options_input(); 2775 void menu_options_sound(); 2776 void menu_options_soundcard(); 2777 void menu_options_system(); 2778 void menu_options_video(); 2779 2780 void openborMain(int argc, char **argv); 2781 int is_cheat_actived(); 2782 int getValidInt(char *text, char *file, char *cmd); 2783 float getValidFloat(char *text, char *file, char *cmd); 2784 int dograb(entity *attacker, entity *target, e_dograb_adjustcheck adjustcheck); 2785 int stopRecordInputs(void); 2786 int recordInputs(void); 2787 int playRecordedInputs(void); 2788 int freeRecordedInputs(void); 2789 a_playrecstatus* init_input_recorder(void); 2790 void free_input_recorder(void); 2791 void goto_mainmenu(int); 2792 2793 extern s_savelevel *savelevel; 2794 extern s_savescore savescore; 2795 2796 #endif 2797