WL_DEF.H (27948B)
1 //#define BETA 2 #define YEAR 1992 3 #define MONTH 9 4 #define DAY 30 5 6 #include "ID_HEADS.H" 7 #include <MATH.H> 8 #include <VALUES.H> 9 10 #include "WL_MENU.H" 11 12 #ifdef SPANISH 13 #include "SPANISH.H" 14 #else 15 #include "FOREIGN.H" 16 #endif 17 18 #ifdef SPEAR 19 #include "F_SPEAR.H" 20 #endif 21 22 /* 23 ============================================================================= 24 25 MACROS 26 27 ============================================================================= 28 */ 29 30 31 #define COLORBORDER(color) asm{mov dx,STATUS_REGISTER_1;in al,dx;\ 32 mov dx,ATR_INDEX;mov al,ATR_OVERSCAN;out dx,al;mov al,color;out dx,al;\ 33 mov al,32;out dx,al}; 34 35 #define MAPSPOT(x,y,plane) (*(mapsegs[plane]+farmapylookup[y]+x)) 36 37 #define SIGN(x) ((x)>0?1:-1) 38 #define ABS(x) ((int)(x)>0?(x):-(x)) 39 #define LABS(x) ((long)(x)>0?(x):-(x)) 40 41 /* 42 ============================================================================= 43 44 GLOBAL CONSTANTS 45 46 ============================================================================= 47 */ 48 49 #define MAXACTORS 150 // max number of nazis, etc / map 50 #define MAXSTATS 400 // max number of lamps, bonus, etc 51 #define MAXDOORS 64 // max number of sliding doors 52 #define MAXWALLTILES 64 // max number of wall tiles 53 54 // 55 // tile constants 56 // 57 58 #define ICONARROWS 90 59 #define PUSHABLETILE 98 60 #define EXITTILE 99 // at end of castle 61 #define AREATILE 107 // first of NUMAREAS floor tiles 62 #define NUMAREAS 37 63 #define ELEVATORTILE 21 64 #define AMBUSHTILE 106 65 #define ALTELEVATORTILE 107 66 67 #define NUMBERCHARS 9 68 69 70 //---------------- 71 72 #define EXTRAPOINTS 40000 73 74 #define PLAYERSPEED 3000 75 #define RUNSPEED 6000 76 77 #define SCREENSEG 0xa000 78 79 #define SCREENBWIDE 80 80 81 #define HEIGHTRATIO 0.50 // also defined in id_mm.c 82 83 #define BORDERCOLOR 3 84 #define FLASHCOLOR 5 85 #define FLASHTICS 4 86 87 88 #define PLAYERSIZE MINDIST // player radius 89 #define MINACTORDIST 0x10000l // minimum dist from player center 90 // to any actor center 91 92 #define NUMLATCHPICS 100 93 94 95 #define PI 3.141592657 96 97 #define GLOBAL1 (1l<<16) 98 #define TILEGLOBAL GLOBAL1 99 #define PIXGLOBAL (GLOBAL1/64) 100 #define TILESHIFT 16l 101 #define UNSIGNEDSHIFT 8 102 103 #define ANGLES 360 // must be divisable by 4 104 #define ANGLEQUAD (ANGLES/4) 105 #define FINEANGLES 3600 106 #define ANG90 (FINEANGLES/4) 107 #define ANG180 (ANG90*2) 108 #define ANG270 (ANG90*3) 109 #define ANG360 (ANG90*4) 110 #define VANG90 (ANGLES/4) 111 #define VANG180 (VANG90*2) 112 #define VANG270 (VANG90*3) 113 #define VANG360 (VANG90*4) 114 115 #define MINDIST (0x5800l) 116 117 118 #define MAXSCALEHEIGHT 256 // largest scale on largest view 119 120 #define MAXVIEWWIDTH 320 121 122 #define MAPSIZE 64 // maps are 64*64 max 123 #define NORTH 0 124 #define EAST 1 125 #define SOUTH 2 126 #define WEST 3 127 128 129 #define STATUSLINES 40 130 131 #define SCREENSIZE (SCREENBWIDE*208) 132 #define PAGE1START 0 133 #define PAGE2START (SCREENSIZE) 134 #define PAGE3START (SCREENSIZE*2u) 135 #define FREESTART (SCREENSIZE*3u) 136 137 138 #define PIXRADIUS 512 139 140 #define STARTAMMO 8 141 142 143 // object flag values 144 145 #define FL_SHOOTABLE 1 146 #define FL_BONUS 2 147 #define FL_NEVERMARK 4 148 #define FL_VISABLE 8 149 #define FL_ATTACKMODE 16 150 #define FL_FIRSTATTACK 32 151 #define FL_AMBUSH 64 152 #define FL_NONMARK 128 153 154 155 // 156 // sprite constants 157 // 158 159 enum { 160 SPR_DEMO, 161 SPR_DEATHCAM, 162 // 163 // static sprites 164 // 165 SPR_STAT_0,SPR_STAT_1,SPR_STAT_2,SPR_STAT_3, 166 SPR_STAT_4,SPR_STAT_5,SPR_STAT_6,SPR_STAT_7, 167 168 SPR_STAT_8,SPR_STAT_9,SPR_STAT_10,SPR_STAT_11, 169 SPR_STAT_12,SPR_STAT_13,SPR_STAT_14,SPR_STAT_15, 170 171 SPR_STAT_16,SPR_STAT_17,SPR_STAT_18,SPR_STAT_19, 172 SPR_STAT_20,SPR_STAT_21,SPR_STAT_22,SPR_STAT_23, 173 174 SPR_STAT_24,SPR_STAT_25,SPR_STAT_26,SPR_STAT_27, 175 SPR_STAT_28,SPR_STAT_29,SPR_STAT_30,SPR_STAT_31, 176 177 SPR_STAT_32,SPR_STAT_33,SPR_STAT_34,SPR_STAT_35, 178 SPR_STAT_36,SPR_STAT_37,SPR_STAT_38,SPR_STAT_39, 179 180 SPR_STAT_40,SPR_STAT_41,SPR_STAT_42,SPR_STAT_43, 181 SPR_STAT_44,SPR_STAT_45,SPR_STAT_46,SPR_STAT_47, 182 183 #ifdef SPEAR 184 SPR_STAT_48,SPR_STAT_49,SPR_STAT_50,SPR_STAT_51, 185 #endif 186 187 // 188 // guard 189 // 190 SPR_GRD_S_1,SPR_GRD_S_2,SPR_GRD_S_3,SPR_GRD_S_4, 191 SPR_GRD_S_5,SPR_GRD_S_6,SPR_GRD_S_7,SPR_GRD_S_8, 192 193 SPR_GRD_W1_1,SPR_GRD_W1_2,SPR_GRD_W1_3,SPR_GRD_W1_4, 194 SPR_GRD_W1_5,SPR_GRD_W1_6,SPR_GRD_W1_7,SPR_GRD_W1_8, 195 196 SPR_GRD_W2_1,SPR_GRD_W2_2,SPR_GRD_W2_3,SPR_GRD_W2_4, 197 SPR_GRD_W2_5,SPR_GRD_W2_6,SPR_GRD_W2_7,SPR_GRD_W2_8, 198 199 SPR_GRD_W3_1,SPR_GRD_W3_2,SPR_GRD_W3_3,SPR_GRD_W3_4, 200 SPR_GRD_W3_5,SPR_GRD_W3_6,SPR_GRD_W3_7,SPR_GRD_W3_8, 201 202 SPR_GRD_W4_1,SPR_GRD_W4_2,SPR_GRD_W4_3,SPR_GRD_W4_4, 203 SPR_GRD_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 272 SPR_MUT_PAIN_2,SPR_MUT_DIE_4,SPR_MUT_DEAD, 273 274 SPR_MUT_SHOOT1,SPR_MUT_SHOOT2,SPR_MUT_SHOOT3,SPR_MUT_SHOOT4, 275 276 // 277 // officer 278 // 279 SPR_OFC_S_1,SPR_OFC_S_2,SPR_OFC_S_3,SPR_OFC_S_4, 280 SPR_OFC_S_5,SPR_OFC_S_6,SPR_OFC_S_7,SPR_OFC_S_8, 281 282 SPR_OFC_W1_1,SPR_OFC_W1_2,SPR_OFC_W1_3,SPR_OFC_W1_4, 283 SPR_OFC_W1_5,SPR_OFC_W1_6,SPR_OFC_W1_7,SPR_OFC_W1_8, 284 285 SPR_OFC_W2_1,SPR_OFC_W2_2,SPR_OFC_W2_3,SPR_OFC_W2_4, 286 SPR_OFC_W2_5,SPR_OFC_W2_6,SPR_OFC_W2_7,SPR_OFC_W2_8, 287 288 SPR_OFC_W3_1,SPR_OFC_W3_2,SPR_OFC_W3_3,SPR_OFC_W3_4, 289 SPR_OFC_W3_5,SPR_OFC_W3_6,SPR_OFC_W3_7,SPR_OFC_W3_8, 290 291 SPR_OFC_W4_1,SPR_OFC_W4_2,SPR_OFC_W4_3,SPR_OFC_W4_4, 292 SPR_OFC_W4_5,SPR_OFC_W4_6,SPR_OFC_W4_7,SPR_OFC_W4_8, 293 294 SPR_OFC_PAIN_1,SPR_OFC_DIE_1,SPR_OFC_DIE_2,SPR_OFC_DIE_3, 295 SPR_OFC_PAIN_2,SPR_OFC_DIE_4,SPR_OFC_DEAD, 296 297 SPR_OFC_SHOOT1,SPR_OFC_SHOOT2,SPR_OFC_SHOOT3, 298 299 #ifndef SPEAR 300 // 301 // ghosts 302 // 303 SPR_BLINKY_W1,SPR_BLINKY_W2,SPR_PINKY_W1,SPR_PINKY_W2, 304 SPR_CLYDE_W1,SPR_CLYDE_W2,SPR_INKY_W1,SPR_INKY_W2, 305 306 // 307 // hans 308 // 309 SPR_BOSS_W1,SPR_BOSS_W2,SPR_BOSS_W3,SPR_BOSS_W4, 310 SPR_BOSS_SHOOT1,SPR_BOSS_SHOOT2,SPR_BOSS_SHOOT3,SPR_BOSS_DEAD, 311 312 SPR_BOSS_DIE1,SPR_BOSS_DIE2,SPR_BOSS_DIE3, 313 314 // 315 // schabbs 316 // 317 SPR_SCHABB_W1,SPR_SCHABB_W2,SPR_SCHABB_W3,SPR_SCHABB_W4, 318 SPR_SCHABB_SHOOT1,SPR_SCHABB_SHOOT2, 319 320 SPR_SCHABB_DIE1,SPR_SCHABB_DIE2,SPR_SCHABB_DIE3,SPR_SCHABB_DEAD, 321 SPR_HYPO1,SPR_HYPO2,SPR_HYPO3,SPR_HYPO4, 322 323 // 324 // fake 325 // 326 SPR_FAKE_W1,SPR_FAKE_W2,SPR_FAKE_W3,SPR_FAKE_W4, 327 SPR_FAKE_SHOOT,SPR_FIRE1,SPR_FIRE2, 328 329 SPR_FAKE_DIE1,SPR_FAKE_DIE2,SPR_FAKE_DIE3,SPR_FAKE_DIE4, 330 SPR_FAKE_DIE5,SPR_FAKE_DEAD, 331 332 // 333 // hitler 334 // 335 SPR_MECHA_W1,SPR_MECHA_W2,SPR_MECHA_W3,SPR_MECHA_W4, 336 SPR_MECHA_SHOOT1,SPR_MECHA_SHOOT2,SPR_MECHA_SHOOT3,SPR_MECHA_DEAD, 337 338 SPR_MECHA_DIE1,SPR_MECHA_DIE2,SPR_MECHA_DIE3, 339 340 SPR_HITLER_W1,SPR_HITLER_W2,SPR_HITLER_W3,SPR_HITLER_W4, 341 SPR_HITLER_SHOOT1,SPR_HITLER_SHOOT2,SPR_HITLER_SHOOT3,SPR_HITLER_DEAD, 342 343 SPR_HITLER_DIE1,SPR_HITLER_DIE2,SPR_HITLER_DIE3,SPR_HITLER_DIE4, 344 SPR_HITLER_DIE5,SPR_HITLER_DIE6,SPR_HITLER_DIE7, 345 346 // 347 // giftmacher 348 // 349 SPR_GIFT_W1,SPR_GIFT_W2,SPR_GIFT_W3,SPR_GIFT_W4, 350 SPR_GIFT_SHOOT1,SPR_GIFT_SHOOT2, 351 352 SPR_GIFT_DIE1,SPR_GIFT_DIE2,SPR_GIFT_DIE3,SPR_GIFT_DEAD, 353 #endif 354 // 355 // Rocket, smoke and small explosion 356 // 357 SPR_ROCKET_1,SPR_ROCKET_2,SPR_ROCKET_3,SPR_ROCKET_4, 358 SPR_ROCKET_5,SPR_ROCKET_6,SPR_ROCKET_7,SPR_ROCKET_8, 359 360 SPR_SMOKE_1,SPR_SMOKE_2,SPR_SMOKE_3,SPR_SMOKE_4, 361 SPR_BOOM_1,SPR_BOOM_2,SPR_BOOM_3, 362 363 // 364 // Angel of Death's DeathSparks(tm) 365 // 366 #ifdef SPEAR 367 SPR_HROCKET_1,SPR_HROCKET_2,SPR_HROCKET_3,SPR_HROCKET_4, 368 SPR_HROCKET_5,SPR_HROCKET_6,SPR_HROCKET_7,SPR_HROCKET_8, 369 370 SPR_HSMOKE_1,SPR_HSMOKE_2,SPR_HSMOKE_3,SPR_HSMOKE_4, 371 SPR_HBOOM_1,SPR_HBOOM_2,SPR_HBOOM_3, 372 373 SPR_SPARK1,SPR_SPARK2,SPR_SPARK3,SPR_SPARK4, 374 #endif 375 376 #ifndef SPEAR 377 // 378 // gretel 379 // 380 SPR_GRETEL_W1,SPR_GRETEL_W2,SPR_GRETEL_W3,SPR_GRETEL_W4, 381 SPR_GRETEL_SHOOT1,SPR_GRETEL_SHOOT2,SPR_GRETEL_SHOOT3,SPR_GRETEL_DEAD, 382 383 SPR_GRETEL_DIE1,SPR_GRETEL_DIE2,SPR_GRETEL_DIE3, 384 385 // 386 // fat face 387 // 388 SPR_FAT_W1,SPR_FAT_W2,SPR_FAT_W3,SPR_FAT_W4, 389 SPR_FAT_SHOOT1,SPR_FAT_SHOOT2,SPR_FAT_SHOOT3,SPR_FAT_SHOOT4, 390 391 SPR_FAT_DIE1,SPR_FAT_DIE2,SPR_FAT_DIE3,SPR_FAT_DEAD, 392 393 // 394 // bj 395 // 396 SPR_BJ_W1,SPR_BJ_W2,SPR_BJ_W3,SPR_BJ_W4, 397 SPR_BJ_JUMP1,SPR_BJ_JUMP2,SPR_BJ_JUMP3,SPR_BJ_JUMP4, 398 #else 399 // 400 // THESE ARE FOR 'SPEAR OF DESTINY' 401 // 402 403 // 404 // Trans Grosse 405 // 406 SPR_TRANS_W1,SPR_TRANS_W2,SPR_TRANS_W3,SPR_TRANS_W4, 407 SPR_TRANS_SHOOT1,SPR_TRANS_SHOOT2,SPR_TRANS_SHOOT3,SPR_TRANS_DEAD, 408 409 SPR_TRANS_DIE1,SPR_TRANS_DIE2,SPR_TRANS_DIE3, 410 411 // 412 // Wilhelm 413 // 414 SPR_WILL_W1,SPR_WILL_W2,SPR_WILL_W3,SPR_WILL_W4, 415 SPR_WILL_SHOOT1,SPR_WILL_SHOOT2,SPR_WILL_SHOOT3,SPR_WILL_SHOOT4, 416 417 SPR_WILL_DIE1,SPR_WILL_DIE2,SPR_WILL_DIE3,SPR_WILL_DEAD, 418 419 // 420 // UberMutant 421 // 422 SPR_UBER_W1,SPR_UBER_W2,SPR_UBER_W3,SPR_UBER_W4, 423 SPR_UBER_SHOOT1,SPR_UBER_SHOOT2,SPR_UBER_SHOOT3,SPR_UBER_SHOOT4, 424 425 SPR_UBER_DIE1,SPR_UBER_DIE2,SPR_UBER_DIE3,SPR_UBER_DIE4, 426 SPR_UBER_DEAD, 427 428 // 429 // Death Knight 430 // 431 SPR_DEATH_W1,SPR_DEATH_W2,SPR_DEATH_W3,SPR_DEATH_W4, 432 SPR_DEATH_SHOOT1,SPR_DEATH_SHOOT2,SPR_DEATH_SHOOT3,SPR_DEATH_SHOOT4, 433 434 SPR_DEATH_DIE1,SPR_DEATH_DIE2,SPR_DEATH_DIE3,SPR_DEATH_DIE4, 435 SPR_DEATH_DIE5,SPR_DEATH_DIE6,SPR_DEATH_DEAD, 436 437 // 438 // Ghost 439 // 440 SPR_SPECTRE_W1,SPR_SPECTRE_W2,SPR_SPECTRE_W3,SPR_SPECTRE_W4, 441 SPR_SPECTRE_F1,SPR_SPECTRE_F2,SPR_SPECTRE_F3,SPR_SPECTRE_F4, 442 443 // 444 // Angel of Death 445 // 446 SPR_ANGEL_W1,SPR_ANGEL_W2,SPR_ANGEL_W3,SPR_ANGEL_W4, 447 SPR_ANGEL_SHOOT1,SPR_ANGEL_SHOOT2,SPR_ANGEL_TIRED1,SPR_ANGEL_TIRED2, 448 449 SPR_ANGEL_DIE1,SPR_ANGEL_DIE2,SPR_ANGEL_DIE3,SPR_ANGEL_DIE4, 450 SPR_ANGEL_DIE5,SPR_ANGEL_DIE6,SPR_ANGEL_DIE7,SPR_ANGEL_DEAD, 451 452 #endif 453 454 // 455 // player attack frames 456 // 457 SPR_KNIFEREADY,SPR_KNIFEATK1,SPR_KNIFEATK2,SPR_KNIFEATK3, 458 SPR_KNIFEATK4, 459 460 SPR_PISTOLREADY,SPR_PISTOLATK1,SPR_PISTOLATK2,SPR_PISTOLATK3, 461 SPR_PISTOLATK4, 462 463 SPR_MACHINEGUNREADY,SPR_MACHINEGUNATK1,SPR_MACHINEGUNATK2,MACHINEGUNATK3, 464 SPR_MACHINEGUNATK4, 465 466 SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3, 467 SPR_CHAINATK4, 468 469 }; 470 471 472 /* 473 ============================================================================= 474 475 GLOBAL TYPES 476 477 ============================================================================= 478 */ 479 480 typedef long fixed; 481 482 typedef enum { 483 di_north, 484 di_east, 485 di_south, 486 di_west 487 } controldir_t; 488 489 typedef enum { 490 dr_normal, 491 dr_lock1, 492 dr_lock2, 493 dr_lock3, 494 dr_lock4, 495 dr_elevator 496 } door_t; 497 498 typedef enum { 499 ac_badobject = -1, 500 ac_no, 501 ac_yes, 502 ac_allways 503 } activetype; 504 505 typedef enum { 506 nothing, 507 playerobj, 508 inertobj, 509 guardobj, 510 officerobj, 511 ssobj, 512 dogobj, 513 bossobj, 514 schabbobj, 515 fakeobj, 516 mechahitlerobj, 517 mutantobj, 518 needleobj, 519 fireobj, 520 bjobj, 521 ghostobj, 522 realhitlerobj, 523 gretelobj, 524 giftobj, 525 fatobj, 526 rocketobj, 527 528 spectreobj, 529 angelobj, 530 transobj, 531 uberobj, 532 willobj, 533 deathobj, 534 hrocketobj, 535 sparkobj 536 } classtype; 537 538 typedef enum { 539 dressing, 540 block, 541 bo_gibs, 542 bo_alpo, 543 bo_firstaid, 544 bo_key1, 545 bo_key2, 546 bo_key3, 547 bo_key4, 548 bo_cross, 549 bo_chalice, 550 bo_bible, 551 bo_crown, 552 bo_clip, 553 bo_clip2, 554 bo_machinegun, 555 bo_chaingun, 556 bo_food, 557 bo_fullheal, 558 bo_25clip, 559 bo_spear 560 } stat_t; 561 562 typedef enum { 563 east, 564 northeast, 565 north, 566 northwest, 567 west, 568 southwest, 569 south, 570 southeast, 571 nodir 572 } dirtype; 573 574 575 #define NUMENEMIES 22 576 typedef enum { 577 en_guard, 578 en_officer, 579 en_ss, 580 en_dog, 581 en_boss, 582 en_schabbs, 583 en_fake, 584 en_hitler, 585 en_mutant, 586 en_blinky, 587 en_clyde, 588 en_pinky, 589 en_inky, 590 en_gretel, 591 en_gift, 592 en_fat, 593 en_spectre, 594 en_angel, 595 en_trans, 596 en_uber, 597 en_will, 598 en_death 599 } enemy_t; 600 601 602 typedef struct statestruct 603 { 604 boolean rotate; 605 int shapenum; // a shapenum of -1 means get from ob->temp1 606 int tictime; 607 void (*think) (),(*action) (); 608 struct statestruct *next; 609 } statetype; 610 611 612 //--------------------- 613 // 614 // trivial actor structure 615 // 616 //--------------------- 617 618 typedef struct statstruct 619 { 620 byte tilex,tiley; 621 byte *visspot; 622 int shapenum; // if shapenum == -1 the obj has been removed 623 byte flags; 624 byte itemnumber; 625 } statobj_t; 626 627 628 //--------------------- 629 // 630 // door actor structure 631 // 632 //--------------------- 633 634 typedef struct doorstruct 635 { 636 byte tilex,tiley; 637 boolean vertical; 638 byte lock; 639 enum {dr_open,dr_closed,dr_opening,dr_closing} action; 640 int ticcount; 641 } doorobj_t; 642 643 644 //-------------------- 645 // 646 // thinking actor structure 647 // 648 //-------------------- 649 650 typedef struct objstruct 651 { 652 activetype active; 653 int ticcount; 654 classtype obclass; 655 statetype *state; 656 657 byte flags; // FL_SHOOTABLE, etc 658 659 long distance; // if negative, wait for that door to open 660 dirtype dir; 661 662 fixed x,y; 663 unsigned tilex,tiley; 664 byte areanumber; 665 666 int viewx; 667 unsigned viewheight; 668 fixed transx,transy; // in global coord 669 670 int angle; 671 int hitpoints; 672 long speed; 673 674 int temp1,temp2,temp3; 675 struct objstruct *next,*prev; 676 } objtype; 677 678 679 #define NUMBUTTONS 8 680 enum { 681 bt_nobutton=-1, 682 bt_attack=0, 683 bt_strafe, 684 bt_run, 685 bt_use, 686 bt_readyknife, 687 bt_readypistol, 688 bt_readymachinegun, 689 bt_readychaingun 690 }; 691 692 693 #define NUMWEAPONS 5 694 typedef enum { 695 wp_knife, 696 wp_pistol, 697 wp_machinegun, 698 wp_chaingun 699 } weapontype; 700 701 702 typedef enum { 703 gd_baby, 704 gd_easy, 705 gd_medium, 706 gd_hard 707 }; 708 709 //--------------- 710 // 711 // gamestate structure 712 // 713 //--------------- 714 715 typedef struct 716 { 717 int difficulty; 718 int mapon; 719 long oldscore,score,nextextra; 720 int lives; 721 int health; 722 int ammo; 723 int keys; 724 weapontype bestweapon,weapon,chosenweapon; 725 726 int faceframe; 727 int attackframe,attackcount,weaponframe; 728 729 int episode,secretcount,treasurecount,killcount, 730 secrettotal,treasuretotal,killtotal; 731 long TimeCount; 732 long killx,killy; 733 boolean victoryflag; // set during victory animations 734 } gametype; 735 736 737 typedef enum { 738 ex_stillplaying, 739 ex_completed, 740 ex_died, 741 ex_warped, 742 ex_resetgame, 743 ex_loadedgame, 744 ex_victorious, 745 ex_abort, 746 ex_demodone, 747 ex_secretlevel 748 } exit_t; 749 750 751 /* 752 ============================================================================= 753 754 WL_MAIN DEFINITIONS 755 756 ============================================================================= 757 */ 758 759 extern boolean MS_CheckParm (char far *string); 760 761 extern char str[80],str2[20]; 762 extern int tedlevelnum; 763 extern boolean tedlevel; 764 extern boolean nospr; 765 extern boolean IsA386; 766 767 extern byte far *scalermemory; 768 769 extern fixed focallength; 770 extern unsigned viewangles; 771 extern unsigned screenofs; 772 extern int viewwidth; 773 extern int viewheight; 774 extern int centerx; 775 extern int shootdelta; 776 777 extern int dirangle[9]; 778 779 extern boolean startgame,loadedgame,virtualreality; 780 extern int mouseadjustment; 781 // 782 // math tables 783 // 784 extern int pixelangle[MAXVIEWWIDTH]; 785 extern long far finetangent[FINEANGLES/4]; 786 extern fixed far sintable[],far *costable; 787 788 // 789 // derived constants 790 // 791 extern fixed scale,maxslope; 792 extern long heightnumerator; 793 extern int minheightdiv; 794 795 extern char configname[13]; 796 797 798 799 void HelpScreens (void); 800 void OrderingInfo (void); 801 void TEDDeath(void); 802 void Quit (char *error); 803 void CalcProjection (long focal); 804 boolean SetViewSize (unsigned width, unsigned height); 805 void NewGame (int difficulty,int episode); 806 void NewViewSize (int width); 807 boolean LoadTheGame(int file,int x,int y); 808 boolean SaveTheGame(int file,int x,int y); 809 void ShowViewSize (int width); 810 void ShutdownId (void); 811 812 813 /* 814 ============================================================================= 815 816 WL_GAME DEFINITIONS 817 818 ============================================================================= 819 */ 820 821 822 extern boolean ingame,fizzlein; 823 extern unsigned latchpics[NUMLATCHPICS]; 824 extern gametype gamestate; 825 extern int doornum; 826 827 extern char demoname[13]; 828 829 extern long spearx,speary; 830 extern unsigned spearangle; 831 extern boolean spearflag; 832 833 834 void DrawPlayBorder (void); 835 void ScanInfoPlane (void); 836 void SetupGameLevel (void); 837 void NormalScreen (void); 838 void DrawPlayScreen (void); 839 void FizzleOut (void); 840 void GameLoop (void); 841 void ClearMemory (void); 842 void PlayDemo (int demonumber); 843 void RecordDemo (void); 844 void DrawAllPlayBorder (void); 845 void DrawHighScores(void); 846 void DrawAllPlayBorderSides (void); 847 848 849 // JAB 850 #define PlaySoundLocTile(s,tx,ty) PlaySoundLocGlobal(s,(((long)(tx) << TILESHIFT) + (1L << (TILESHIFT - 1))),(((long)ty << TILESHIFT) + (1L << (TILESHIFT - 1)))) 851 #define PlaySoundLocActor(s,ob) PlaySoundLocGlobal(s,(ob)->x,(ob)->y) 852 void PlaySoundLocGlobal(word s,fixed gx,fixed gy); 853 void UpdateSoundLoc(void); 854 855 856 /* 857 ============================================================================= 858 859 WL_PLAY DEFINITIONS 860 861 ============================================================================= 862 */ 863 864 #ifdef SPEAR 865 extern long funnyticount; // FOR FUNNY BJ FACE 866 #endif 867 868 extern exit_t playstate; 869 870 extern boolean madenoise; 871 872 extern objtype objlist[MAXACTORS],*new,*obj,*player,*lastobj, 873 *objfreelist,*killerobj; 874 extern statobj_t statobjlist[MAXSTATS],*laststatobj; 875 extern doorobj_t doorobjlist[MAXDOORS],*lastdoorobj; 876 877 extern unsigned farmapylookup[MAPSIZE]; 878 extern byte *nearmapylookup[MAPSIZE]; 879 880 extern byte tilemap[MAPSIZE][MAPSIZE]; // wall values only 881 extern byte spotvis[MAPSIZE][MAPSIZE]; 882 extern objtype *actorat[MAPSIZE][MAPSIZE]; 883 884 #define UPDATESIZE (UPDATEWIDE*UPDATEHIGH) 885 extern byte update[UPDATESIZE]; 886 887 extern boolean singlestep,godmode,noclip; 888 extern int extravbls; 889 890 // 891 // control info 892 // 893 extern boolean mouseenabled,joystickenabled,joypadenabled,joystickprogressive; 894 extern int joystickport; 895 extern int dirscan[4]; 896 extern int buttonscan[NUMBUTTONS]; 897 extern int buttonmouse[4]; 898 extern int buttonjoy[4]; 899 900 extern boolean buttonheld[NUMBUTTONS]; 901 902 extern int viewsize; 903 904 // 905 // curent user input 906 // 907 extern int controlx,controly; // range from -100 to 100 908 extern boolean buttonstate[NUMBUTTONS]; 909 910 extern boolean demorecord,demoplayback; 911 extern char far *demoptr, far *lastdemoptr; 912 extern memptr demobuffer; 913 914 915 916 void InitRedShifts (void); 917 void FinishPaletteShifts (void); 918 919 void CenterWindow(word w,word h); 920 void InitActorList (void); 921 void GetNewActor (void); 922 void RemoveObj (objtype *gone); 923 void PollControls (void); 924 void StopMusic(void); 925 void StartMusic(void); 926 void PlayLoop (void); 927 void StartDamageFlash (int damage); 928 void StartBonusFlash (void); 929 930 /* 931 ============================================================================= 932 933 WL_INTER 934 935 ============================================================================= 936 */ 937 938 void IntroScreen (void); 939 void PreloadGraphics(void); 940 void LevelCompleted (void); 941 void CheckHighScore (long score,word other); 942 void Victory (void); 943 void ClearSplitVWB (void); 944 945 946 /* 947 ============================================================================= 948 949 WL_DEBUG 950 951 ============================================================================= 952 */ 953 954 int DebugKeys (void); 955 void PicturePause (void); 956 957 958 /* 959 ============================================================================= 960 961 WL_DRAW DEFINITIONS 962 963 ============================================================================= 964 */ 965 966 extern unsigned screenloc[3]; 967 extern unsigned freelatch; 968 969 extern long lasttimecount; 970 extern long frameon; 971 extern boolean fizzlein; 972 973 extern unsigned wallheight[MAXVIEWWIDTH]; 974 975 extern fixed tileglobal; 976 extern fixed focallength; 977 extern fixed mindist; 978 979 // 980 // math tables 981 // 982 extern int pixelangle[MAXVIEWWIDTH]; 983 extern long far finetangent[FINEANGLES/4]; 984 extern fixed far sintable[],far *costable; 985 986 // 987 // derived constants 988 // 989 extern fixed scale; 990 extern long heightnumerator,mindist; 991 992 // 993 // refresh variables 994 // 995 extern fixed viewx,viewy; // the focal point 996 extern int viewangle; 997 extern fixed viewsin,viewcos; 998 999 extern long postsource; 1000 extern unsigned postx; 1001 extern unsigned postwidth; 1002 1003 1004 extern int horizwall[],vertwall[]; 1005 1006 extern unsigned pwallpos; 1007 1008 1009 fixed FixedByFrac (fixed a, fixed b); 1010 void TransformActor (objtype *ob); 1011 void BuildTables (void); 1012 void ClearScreen (void); 1013 int CalcRotate (objtype *ob); 1014 void DrawScaleds (void); 1015 void CalcTics (void); 1016 void FixOfs (void); 1017 void ThreeDRefresh (void); 1018 void FarScalePost (void); 1019 1020 /* 1021 ============================================================================= 1022 1023 WL_STATE DEFINITIONS 1024 1025 ============================================================================= 1026 */ 1027 #define TURNTICS 10 1028 #define SPDPATROL 512 1029 #define SPDDOG 1500 1030 1031 1032 extern dirtype opposite[9]; 1033 extern dirtype diagonal[9][9]; 1034 1035 1036 void InitHitRect (objtype *ob, unsigned radius); 1037 void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state); 1038 void NewState (objtype *ob, statetype *state); 1039 1040 boolean TryWalk (objtype *ob); 1041 void SelectChaseDir (objtype *ob); 1042 void SelectDodgeDir (objtype *ob); 1043 void SelectRunDir (objtype *ob); 1044 void MoveObj (objtype *ob, long move); 1045 boolean SightPlayer (objtype *ob); 1046 1047 void KillActor (objtype *ob); 1048 void DamageActor (objtype *ob, unsigned damage); 1049 1050 boolean CheckLine (objtype *ob); 1051 boolean CheckSight (objtype *ob); 1052 1053 1054 /* 1055 ============================================================================= 1056 1057 WL_SCALE DEFINITIONS 1058 1059 ============================================================================= 1060 */ 1061 1062 1063 #define COMPSCALECODESTART (65*4) // offset to start of code in comp scaler 1064 1065 typedef struct 1066 { 1067 unsigned codeofs[65]; 1068 unsigned width[65]; 1069 byte code[]; 1070 } t_compscale; 1071 1072 typedef struct 1073 { 1074 unsigned leftpix,rightpix; 1075 unsigned dataofs[64]; 1076 // table data after dataofs[rightpix-leftpix+1] 1077 } t_compshape; 1078 1079 1080 extern t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; 1081 extern long fullscalefarcall[MAXSCALEHEIGHT+1]; 1082 1083 extern byte bitmasks1[8][8]; 1084 extern byte bitmasks2[8][8]; 1085 extern unsigned wordmasks[8][8]; 1086 1087 extern byte mapmasks1[4][8]; 1088 extern byte mapmasks2[4][8]; 1089 extern byte mapmasks3[4][8]; 1090 1091 extern int maxscale,maxscaleshl2; 1092 1093 extern boolean insetupscaling; 1094 1095 void SetupScaling (int maxscaleheight); 1096 void ScaleShape (int xcenter, int shapenum, unsigned height); 1097 void SimpleScaleShape (int xcenter, int shapenum, unsigned height); 1098 1099 /* 1100 ============================================================================= 1101 1102 WL_AGENT DEFINITIONS 1103 1104 ============================================================================= 1105 */ 1106 1107 // 1108 // player state info 1109 // 1110 extern boolean running; 1111 extern long thrustspeed; 1112 extern unsigned plux,pluy; // player coordinates scaled to unsigned 1113 1114 extern int anglefrac; 1115 extern int facecount; 1116 1117 void SpawnPlayer (int tilex, int tiley, int dir); 1118 void DrawFace (void); 1119 void DrawHealth (void); 1120 void TakeDamage (int points,objtype *attacker); 1121 void HealSelf (int points); 1122 void DrawLevel (void); 1123 void DrawLives (void); 1124 void GiveExtraMan (void); 1125 void DrawScore (void); 1126 void GivePoints (long points); 1127 void DrawWeapon (void); 1128 void DrawKeys (void); 1129 void GiveWeapon (int weapon); 1130 void DrawAmmo (void); 1131 void GiveAmmo (int ammo); 1132 void GiveKey (int key); 1133 void GetBonus (statobj_t *check); 1134 1135 void Thrust (int angle, long speed); 1136 1137 /* 1138 ============================================================================= 1139 1140 WL_ACT1 DEFINITIONS 1141 1142 ============================================================================= 1143 */ 1144 1145 extern doorobj_t doorobjlist[MAXDOORS],*lastdoorobj; 1146 extern int doornum; 1147 1148 extern unsigned doorposition[MAXDOORS],pwallstate; 1149 1150 extern byte far areaconnect[NUMAREAS][NUMAREAS]; 1151 1152 extern boolean areabyplayer[NUMAREAS]; 1153 1154 extern unsigned pwallstate; 1155 extern unsigned pwallpos; // amount a pushable wall has been moved (0-63) 1156 extern unsigned pwallx,pwally; 1157 extern int pwalldir; 1158 1159 1160 void InitDoorList (void); 1161 void InitStaticList (void); 1162 void SpawnStatic (int tilex, int tiley, int type); 1163 void SpawnDoor (int tilex, int tiley, boolean vertical, int lock); 1164 void MoveDoors (void); 1165 void MovePWalls (void); 1166 void OpenDoor (int door); 1167 void PlaceItemType (int itemtype, int tilex, int tiley); 1168 void PushWall (int checkx, int checky, int dir); 1169 void OperateDoor (int door); 1170 void InitAreas (void); 1171 1172 /* 1173 ============================================================================= 1174 1175 WL_ACT2 DEFINITIONS 1176 1177 ============================================================================= 1178 */ 1179 1180 #define s_nakedbody s_static10 1181 1182 extern statetype s_grddie1; 1183 extern statetype s_dogdie1; 1184 extern statetype s_ofcdie1; 1185 extern statetype s_mutdie1; 1186 extern statetype s_ssdie1; 1187 extern statetype s_bossdie1; 1188 extern statetype s_schabbdie1; 1189 extern statetype s_fakedie1; 1190 extern statetype s_mechadie1; 1191 extern statetype s_hitlerdie1; 1192 extern statetype s_greteldie1; 1193 extern statetype s_giftdie1; 1194 extern statetype s_fatdie1; 1195 1196 extern statetype s_spectredie1; 1197 extern statetype s_angeldie1; 1198 extern statetype s_transdie0; 1199 extern statetype s_uberdie0; 1200 extern statetype s_willdie1; 1201 extern statetype s_deathdie1; 1202 1203 1204 extern statetype s_grdchase1; 1205 extern statetype s_dogchase1; 1206 extern statetype s_ofcchase1; 1207 extern statetype s_sschase1; 1208 extern statetype s_mutchase1; 1209 extern statetype s_bosschase1; 1210 extern statetype s_schabbchase1; 1211 extern statetype s_fakechase1; 1212 extern statetype s_mechachase1; 1213 extern statetype s_gretelchase1; 1214 extern statetype s_giftchase1; 1215 extern statetype s_fatchase1; 1216 1217 extern statetype s_spectrechase1; 1218 extern statetype s_angelchase1; 1219 extern statetype s_transchase1; 1220 extern statetype s_uberchase1; 1221 extern statetype s_willchase1; 1222 extern statetype s_deathchase1; 1223 1224 extern statetype s_blinkychase1; 1225 extern statetype s_hitlerchase1; 1226 1227 extern statetype s_grdpain; 1228 extern statetype s_grdpain1; 1229 extern statetype s_ofcpain; 1230 extern statetype s_ofcpain1; 1231 extern statetype s_sspain; 1232 extern statetype s_sspain1; 1233 extern statetype s_mutpain; 1234 extern statetype s_mutpain1; 1235 1236 extern statetype s_deathcam; 1237 1238 extern statetype s_schabbdeathcam2; 1239 extern statetype s_hitlerdeathcam2; 1240 extern statetype s_giftdeathcam2; 1241 extern statetype s_fatdeathcam2; 1242 1243 void SpawnStand (enemy_t which, int tilex, int tiley, int dir); 1244 void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir); 1245 void KillActor (objtype *ob); 1246 1247 void US_ControlPanel(byte); 1248 1249 void SpawnDeadGuard (int tilex, int tiley); 1250 void SpawnBoss (int tilex, int tiley); 1251 void SpawnGretel (int tilex, int tiley); 1252 void SpawnTrans (int tilex, int tiley); 1253 void SpawnUber (int tilex, int tiley); 1254 void SpawnWill (int tilex, int tiley); 1255 void SpawnDeath (int tilex, int tiley); 1256 void SpawnAngel (int tilex, int tiley); 1257 void SpawnSpectre (int tilex, int tiley); 1258 void SpawnGhosts (int which, int tilex, int tiley); 1259 void SpawnSchabbs (int tilex, int tiley); 1260 void SpawnGift (int tilex, int tiley); 1261 void SpawnFat (int tilex, int tiley); 1262 void SpawnFakeHitler (int tilex, int tiley); 1263 void SpawnHitler (int tilex, int tiley); 1264 1265 /* 1266 ============================================================================= 1267 1268 WL_TEXT DEFINITIONS 1269 1270 ============================================================================= 1271 */ 1272 1273 extern char helpfilename[],endfilename[]; 1274 1275 extern void HelpScreens(void); 1276 extern void EndText(void);