|
|
1.1 ! root 1: /********************************************************************* ! 2: * ! 3: * WHMENU.C - menu code for Witchaven game ! 4: * ! 5: *********************************************************************/ ! 6: ! 7: #include "icorp.h" ! 8: //#define NOTFIXED return; ! 9: #define NOTFIXED ! 10: #define FULLSCREEN 0 ! 11: ! 12: #define SCOTTSPEED 20L ! 13: ! 14: ! 15: //** Les 01/17/96 - START ! 16: // Raf for swift support extern declarations ! 17: #include "swift.h" ! 18: #include <memcheck.h> ! 19: //** Les 01/17/96 - END ! 20: ! 21: //** Les 01/17/96 - START ! 22: // Raf extern vals from whinp.c ! 23: extern int wingmanflag, ! 24: wingmanyawsens, ! 25: wingmanpitchsens, ! 26: wingmanrollsens, ! 27: wingmanzsens, ! 28: wingmanzreverse; ! 29: ! 30: extern SWIFT_3DStatus wingmaninfo; ! 31: ! 32: extern short wingmankeys[]; ! 33: //** Les 01/17/96 - END ! 34: ! 35: ! 36: int loopinstuff; // here it is ! 37: extern int mousxspeed, ! 38: mousyspeed; ! 39: ! 40: extern int vampiretime; ! 41: extern int musiclevel; ! 42: extern int digilevel; ! 43: ! 44: extern short gbrightness; ! 45: ! 46: //JSA 4_27 cart and elevator sound variables ! 47: extern int cartsnd, ! 48: gratesnd, ! 49: lavasnd, ! 50: batsnd; ! 51: ! 52: extern int gameactivated; ! 53: extern int escapetomenu; ! 54: ! 55: extern int difficulty; ! 56: extern int mapon; ! 57: ! 58: extern int currweapon; ! 59: extern int selectedgun; ! 60: extern int currentpotion; ! 61: extern int helmettime; ! 62: extern int shadowtime; ! 63: extern int nightglowtime; ! 64: extern short brightness; ! 65: extern int strongtime; ! 66: extern int invisibletime; ! 67: extern int manatime; ! 68: extern int thunderflash; ! 69: extern int thundertime; ! 70: extern int currentorb; ! 71: extern int currweaponfired; ! 72: extern int currweaponanim; ! 73: extern int currweaponattackstyle; ! 74: extern int currweaponflip; ! 75: ! 76: int goreon = 1; ! 77: int loadedgame = 0; ! 78: int loadgo = 0; ! 79: int musicoverride = -1; ! 80: ! 81: char typemessage[162], ! 82: typemessageleng = 0, ! 83: typemode = 0; ! 84: ! 85: char scantoasc[128] = { ! 86: 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, ! 87: 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 0, 0, 'a', 's', ! 88: 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', 0, 92, 'z', 'x', 'c', 'v', ! 89: 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, ! 90: 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', ! 91: '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 92: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 93: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 94: }; ! 95: ! 96: char scantoascwithshift[128] = { ! 97: 0, 0, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 0, ! 98: 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 0, 0, 'A', 'S', ! 99: 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', 34, '~', 0, '|', 'Z', 'X', 'C', 'V', ! 100: 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, ! 101: 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', ! 102: '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 103: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 104: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 105: }; ! 106: ! 107: extern int frames; ! 108: #define MAXSAVEDGAMES 8 ! 109: ! 110: struct savedgame { ! 111: char name[20]; ! 112: }; ! 113: ! 114: struct savedgame savedgamenames[MAXSAVEDGAMES]; ! 115: struct savedgame quicksavedgame; ! 116: ! 117: int quicksaveflag; ! 118: ! 119: extern int gameactivated; ! 120: ! 121: void ! 122: loadsavetoscreen(void) ! 123: { ! 124: if (svga == 0) ! 125: permanentwritesprite(0L, 0L, ZLOADSAVE, 0, 0L, 0L, 319L, 199L, 0); ! 126: else { ! 127: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VLOAD, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 128: rotatesprite(0L << 16, 240L << 16, 65536L, 0, VSAVE, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 129: } ! 130: ! 131: } ! 132: ! 133: void ! 134: menutoscreen(void) ! 135: { ! 136: if (svga == 0) ! 137: permanentwritesprite(0L, 0L, THEMAINMENUWITH, 0, 0L, 0L, 319L, 199L, 0); ! 138: else ! 139: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VMAIN, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 140: ! 141: } ! 142: ! 143: void ! 144: menutoscreenblank(void) ! 145: { ! 146: permanentwritesprite(0L, 0L, THEMAINMENU, 0, 0L, 0L, 319L, 199L, 0); ! 147: } ! 148: ! 149: void ! 150: itemtoscreen(long x, long y, short dapic, signed char dashade, char dapal) ! 151: { ! 152: permanentwritesprite(x, y, dapic, dashade, x, y, xdim - 1, ydim - 1, dapal); ! 153: } ! 154: // ! 155: // fancy font ! 156: // ! 157: // to use this function you will need to name the starting letter ! 158: // the function will then scan the string and display its chars ! 159: ! 160: ! 161: char fancy[41] = {'a', 'b', 'c', 'd', 'e', ! 162: 'f', 'g', 'h', 'i', 'j', ! 163: 'k', 'l', 'm', 'n', 'o', ! 164: 'p', 'q', 'r', 's', 't', ! 165: 'u', 'v', 'w', 'x', 'y', ! 166: 'z', '0', '1', '2', '3', ! 167: '4', '5', '6', '7', '8', ! 168: '9', '!', '?', '-', ':', ' '}; ! 169: ! 170: ! 171: void ! 172: fancyfont(long x, long y, short tilenum, char *string, char pal) ! 173: { ! 174: ! 175: int i, ! 176: j; ! 177: int len; ! 178: int incr = 0; ! 179: int exit = 0; ! 180: int number; ! 181: char temp[40]; ! 182: ! 183: strlwr(string); ! 184: len = strlen(string); ! 185: strcpy(temp, string); ! 186: ! 187: for (i = 0; i < len; i++) { ! 188: tempbuf[i] = temp[i]; ! 189: for (j = 0; j < 40; j++) { ! 190: if (tempbuf[i] == fancy[j]) { ! 191: number = j; ! 192: } ! 193: } ! 194: if (i == 0) { ! 195: itemtoscreen(x, y, tilenum + number, 0, pal); ! 196: incr += tilesizx[tilenum + number] + 1; ! 197: } ! 198: else if (tempbuf[i] != ' ') { ! 199: itemtoscreen(x + incr, y, tilenum + number, 0, pal); ! 200: incr += tilesizx[tilenum + number] + 1; ! 201: } ! 202: else { ! 203: incr += 8; ! 204: } ! 205: } ! 206: ! 207: } ! 208: ! 209: ! 210: ! 211: void ! 212: fancyfontscreen(long x, long y, short tilenum, char *string) ! 213: { ! 214: ! 215: int i, ! 216: j; ! 217: int len; ! 218: int incr = 0; ! 219: int exit = 0; ! 220: int number; ! 221: char temp[40]; ! 222: ! 223: strlwr(string); ! 224: len = strlen(string); ! 225: strcpy(temp, string); ! 226: ! 227: for (i = 0; i < len; i++) { ! 228: tempbuf[i] = temp[i]; ! 229: for (j = 0; j < 40; j++) { ! 230: if (tempbuf[i] == fancy[j]) { ! 231: number = j; ! 232: } ! 233: } ! 234: if (i == 0) { ! 235: overwritesprite(x, y, tilenum + number, 0, 0x02, 7); ! 236: incr += tilesizx[tilenum + number] + 1; ! 237: } ! 238: else if (tempbuf[i] != ' ') { ! 239: overwritesprite(x + incr, y, tilenum + number, 0, 0x02, 7); ! 240: incr += tilesizx[tilenum + number] + 1; ! 241: } ! 242: else ! 243: incr += 8; ! 244: } ! 245: ! 246: } ! 247: ! 248: ! 249: int ! 250: menuscreen(struct player * plr) ! 251: { ! 252: ! 253: struct { ! 254: long x; ! 255: long y; ! 256: } redpic[5] = { ! 257: { ! 258: 94, 8 ! 259: }, ! 260: { ! 261: 88, 39 ! 262: }, ! 263: { ! 264: 95, 67 ! 265: }, ! 266: { ! 267: 114, 101 ! 268: }, ! 269: { ! 270: 112, 120 ! 271: } ! 272: }; ! 273: ! 274: struct { ! 275: long x; ! 276: long y; ! 277: } sredpic[5] = { ! 278: { ! 279: 209, 102 ! 280: }, ! 281: { ! 282: 206, 136 ! 283: }, ! 284: { ! 285: 213, 177 ! 286: }, ! 287: { ! 288: 235, 208 ! 289: }, ! 290: { ! 291: 222, 242 ! 292: } ! 293: }; ! 294: ! 295: ! 296: int exit = 0; ! 297: int select = 0; ! 298: short redpicnum; ! 299: long goaltime; ! 300: int i; ! 301: int cnt = 0; ! 302: ! 303: // clearview(0L); //Clear screen to specified color ! 304: ! 305: if (netgame) { ! 306: return (0); ! 307: // netkillme(); ! 308: } ! 309: ! 310: //JSA BLORB ! 311: SND_CheckLoops(); ! 312: ! 313: redpicnum = THENEWGAME; ! 314: ! 315: keystatus[1] = keystatus[0x1c] = keystatus[0x9c] = 0; ! 316: ! 317: goaltime = totalclock + SCOTTSPEED; ! 318: ! 319: if (svga == 1) { ! 320: setview(0L, 0L, 639L, 479L); ! 321: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VMAIN, 0, ! 322: 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 323: } ! 324: ! 325: while (!exit) { ! 326: ! 327: menutoscreen(); ! 328: ! 329: if (select < 5) { ! 330: if (svga == 0) { ! 331: switch (cnt) { ! 332: case 0: ! 333: redpicnum = THENEWGAME + select; ! 334: break; ! 335: case 1: ! 336: redpicnum = ZFLASHER1 + select; ! 337: break; ! 338: case 2: ! 339: redpicnum = ZFLASHER2 + select; ! 340: break; ! 341: } ! 342: itemtoscreen(redpic[select].x, redpic[select].y, redpicnum, 0, 0); ! 343: } ! 344: else { ! 345: switch (cnt) { ! 346: case 0: ! 347: redpicnum = VNEW + select; ! 348: break; ! 349: case 1: ! 350: redpicnum = SFLASH1 + select; ! 351: break; ! 352: case 2: ! 353: redpicnum = SFLASH2 + select; ! 354: break; ! 355: } ! 356: rotatesprite((sredpic[select].x) << 16, (sredpic[select].y) << 16, 65536L, 0, ! 357: redpicnum, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 358: } ! 359: } ! 360: ! 361: nextpage(); ! 362: if (totalclock >= goaltime) { ! 363: goaltime = totalclock + SCOTTSPEED; ! 364: cnt++; ! 365: if (cnt > 2) ! 366: cnt = 0; ! 367: if (keystatus[0xd0] || keystatus[0x50]) { ! 368: TEMPSND(); ! 369: select++; ! 370: if (select > 4) ! 371: select = 0; ! 372: } ! 373: if (keystatus[0xc8] || keystatus[0x48]) { ! 374: TEMPSND(); ! 375: select--; ! 376: if (select < 0) ! 377: select = 4; ! 378: } ! 379: if (keystatus[1] > 0) { ! 380: TEMPSND(); ! 381: if (gameactivated == 1) { ! 382: // select=5; ! 383: lockclock = totalclock; ! 384: exit = 1; ! 385: } ! 386: else ! 387: select = 4; ! 388: keystatus[1] = 0; ! 389: } ! 390: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 391: keystatus[0x1c] = keystatus[0x9c] = 0; ! 392: keystatus[1] = 0; ! 393: switch (select) { ! 394: case 0: // ok ! 395: gameactivated = 0; ! 396: srand(totalclock & 30000); ! 397: // tille maps are finished ! 398: // if(loadedgame == 0 && netgame == 0) ! 399: // mapon=1; ! 400: #if 0 ! 401: if (netgame) { ! 402: netpickmonster(); ! 403: exit = 1; ! 404: break; ! 405: } ! 406: #endif ! 407: SND_Sound(S_WARP); ! 408: startnewgame(plr); ! 409: gameactivated = 1; ! 410: exit = 1; ! 411: keystatus[0x1c] = keystatus[0x9c] = 0; ! 412: keystatus[1] = 0; ! 413: break; ! 414: case 1: ! 415: TEMPSND(); ! 416: loadsave(plr); ! 417: if (loadgo == 1) ! 418: exit = 1; ! 419: loadgo = 0; ! 420: keystatus[0x1c] = keystatus[0x9c] = 0; ! 421: keystatus[1] = 0; ! 422: break; ! 423: case 2: ! 424: TEMPSND(); ! 425: optionspage(); ! 426: keystatus[0x1c] = keystatus[0x9c] = 0; ! 427: keystatus[1] = 0; ! 428: break; ! 429: case 3: ! 430: TEMPSND(); ! 431: help(); ! 432: break; ! 433: case 4: ! 434: TEMPSND(); ! 435: quit(); ! 436: break; ! 437: case 5: ! 438: lockclock = totalclock; ! 439: exit = 1; ! 440: updatepics(); ! 441: break; ! 442: } // switch ! 443: } // if ! 444: } // the delay ! 445: } // while ! 446: ! 447: escapetomenu = 0; ! 448: ! 449: // if (netgame) { ! 450: // netreviveme(); ! 451: // } ! 452: ! 453: return (0); ! 454: } ! 455: ! 456: //JUNE8 ! 457: #define MAXHELPSCREENS 10 ! 458: ! 459: void ! 460: help(void) ! 461: { ! 462: ! 463: int thenames[MAXHELPSCREENS] = { ! 464: ZWEAPON, ! 465: ZSPELL, ! 466: ZPOTION, ! 467: ZMOVE, ! 468: ZMOVE2, ! 469: ZKEN, ! 470: ZCREDITS, ! 471: ZCREDITS2, ! 472: ZARTIST, ! 473: ZCREDITS3 ! 474: }, sthenames[MAXHELPSCREENS] = { ! 475: 1064,1063,1060,1059,1061,VCREDIT1,1057,1062,1056,1058 ! 476: }; ! 477: ! 478: int select = 0; ! 479: long goaltime; ! 480: int exit = 0; ! 481: ! 482: while (!exit) { ! 483: if (totalclock >= goaltime) { ! 484: ! 485: if (svga == 0) { ! 486: menutoscreenblank(); ! 487: itemtoscreen(0L, 0L, thenames[select], 0, 0); ! 488: } ! 489: else { ! 490: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VMAINBLANK, 0, ! 491: 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 492: rotatesprite(0L << 16, 0L << 16, 65536L, 0, ! 493: sthenames[select], 0, 0, 8 + 16, 0L, 0L, ! 494: xdim - 1L, ydim - 1L); ! 495: } ! 496: ! 497: nextpage(); ! 498: goaltime = totalclock + SCOTTSPEED; ! 499: if (keystatus[0xd0] ! 500: || keystatus[keys[KEYRIGHT]] ! 501: || keystatus[RDN] ! 502: || keystatus[keys[KEYBACK]] ! 503: || keystatus[RRIGHT]) { ! 504: TEMPSND(); ! 505: select++; ! 506: if (select > 9) ! 507: select = 9; ! 508: } ! 509: if (keystatus[0xc8] ! 510: || keystatus[keys[KEYLEFT]] ! 511: || keystatus[RUP] ! 512: || keystatus[keys[KEYFWD]] ! 513: || keystatus[RLEFT]) { ! 514: TEMPSND(); ! 515: select--; ! 516: if (select < 0) ! 517: select = 0; ! 518: } ! 519: if (keystatus[1] > 0) { ! 520: exit = 1; ! 521: keystatus[1] = 0; ! 522: } ! 523: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 524: exit = 2; ! 525: keystatus[0x1c] = keystatus[0x9c] = 0; ! 526: } ! 527: } ! 528: } ! 529: keystatus[1] = keystatus[0x1c] = keystatus[0x9c] = 0; ! 530: ! 531: } ! 532: ! 533: //JUNE6 ! 534: void ! 535: loadsave(struct player * plr) ! 536: { ! 537: ! 538: int exit = 0; ! 539: int select = 0; ! 540: long goaltime; ! 541: int cnt = 0; ! 542: short redpicnum; ! 543: ! 544: struct { ! 545: long x; ! 546: long y; ! 547: } spic[2] = {{ ! 548: 229, 152 ! 549: }, ! 550: { ! 551: 233, 190 ! 552: } ! 553: }; ! 554: ! 555: goaltime = totalclock + SCOTTSPEED; ! 556: ! 557: while (!exit) { ! 558: loadsavetoscreen(); ! 559: if (svga == 0) { ! 560: if (select == 0) { ! 561: switch (cnt) { ! 562: case 0: ! 563: itemtoscreen(109L, 46L, DALOAD, 0, 0); ! 564: break; ! 565: case 1: ! 566: itemtoscreen(109L, 46L, ZFLASHER1 + 8, 0, 0); ! 567: break; ! 568: case 2: ! 569: itemtoscreen(109L, 46L, ZFLASHER2 + 8, 0, 0); ! 570: break; ! 571: } ! 572: } ! 573: else { ! 574: switch (cnt) { ! 575: case 0: ! 576: itemtoscreen(112L, 77L, DASAVE, 0, 0); ! 577: break; ! 578: case 1: ! 579: itemtoscreen(112L, 77L, ZFLASHER1 + 9, 0, 0); ! 580: break; ! 581: case 2: ! 582: itemtoscreen(112L, 77L, ZFLASHER2 + 9, 0, 0); ! 583: break; ! 584: } ! 585: } ! 586: } ! 587: else { ! 588: if (select == 0) { ! 589: switch (cnt) { ! 590: case 0: ! 591: redpicnum = SFLASH3 + select; ! 592: break; ! 593: case 1: ! 594: redpicnum = SFLASH1 + 5 + select; ! 595: break; ! 596: case 2: ! 597: redpicnum = SFLASH2 + 5 + select; ! 598: break; ! 599: } ! 600: } ! 601: else { ! 602: switch (cnt) { ! 603: case 0: ! 604: redpicnum = SFLASH3 + select; ! 605: break; ! 606: case 1: ! 607: redpicnum = SFLASH1 + 5 + select; ! 608: break; ! 609: case 2: ! 610: redpicnum = SFLASH2 + 5 + select; ! 611: break; ! 612: } ! 613: } ! 614: rotatesprite((spic[select].x) << 16, (spic[select].y) << 16, 65536L, 0, ! 615: redpicnum, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 616: } ! 617: if (totalclock >= goaltime) { ! 618: goaltime = totalclock + SCOTTSPEED; ! 619: cnt++; ! 620: if (cnt > 2) ! 621: cnt = 0; ! 622: if (keystatus[keys[KEYBACK]] || keystatus[RDN]) { ! 623: TEMPSND(); ! 624: select = 1; ! 625: } ! 626: if (keystatus[keys[KEYFWD]] || keystatus[RUP]) { ! 627: TEMPSND(); ! 628: select = 0; ! 629: } ! 630: if (keystatus[1] > 0) { ! 631: exit = 1; ! 632: keystatus[1] = 0; ! 633: } ! 634: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 635: exit = 2; ! 636: keystatus[0x1c] = keystatus[0x9c] = 0; ! 637: } ! 638: } ! 639: nextpage(); ! 640: } ! 641: ! 642: keystatus[1] = 0; ! 643: ! 644: if (exit == 2) ! 645: switch (select) { ! 646: case 0: // ok ! 647: loadgame(plr); ! 648: break; ! 649: case 1: // ok ! 650: if (gameactivated == 1) ! 651: savegame(plr); ! 652: break; ! 653: } ! 654: ! 655: } ! 656: ! 657: //JUNE6 ! 658: void ! 659: quit(void) ! 660: { ! 661: ! 662: int exit = 0; ! 663: long goaltime; ! 664: char temp[20]; ! 665: ! 666: if (svga == 0) { ! 667: menutoscreenblank(); ! 668: itemtoscreen(102L, 76L, ZSURE, 0, 0); ! 669: } ! 670: else { ! 671: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VMAINBLANK, 0, ! 672: 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 673: itemtoscreen((xdim>>1)-58, (ydim>>1)-24, ZSURE, 0, 0); ! 674: } ! 675: ! 676: nextpage(); ! 677: ! 678: while (!exit) { ! 679: ! 680: if (keystatus[0x9c] > 0 || keystatus[0x1c] > 0 || keystatus[0x15] > 0) { ! 681: exit = 1; ! 682: keystatus[0x1c] = keystatus[0x9c] = 0; ! 683: } ! 684: ! 685: ! 686: if (keystatus[1] > 0 || keystatus[0x31] > 0) { ! 687: exit = 2; ! 688: keystatus[1] = 0; ! 689: } ! 690: } ! 691: ! 692: if (exit == 2) { ! 693: keystatus[1] = 0; ! 694: } ! 695: else { ! 696: if (svga == 1) { ! 697: permanentwritesprite(0, 0, STHEORDER, 0, 0, 0, 639, 239, 0); ! 698: permanentwritesprite(0, 240, STHEORDER + 1, 0, 0, 240, 639, 479, 0); ! 699: nextpage(); ! 700: exit = 0; ! 701: while (!exit) { ! 702: if (keystatus[0x39] > 0 || keystatus[1] > 0) ! 703: exit = 1; ! 704: } ! 705: keystatus[0x39] = 0; ! 706: keystatus[1] = 0; ! 707: } ! 708: else { ! 709: keystatus[0x39] = 0; ! 710: keystatus[1] = 0; ! 711: exit = 0; ! 712: while (!exit) { ! 713: if (keystatus[0x39] > 0 || keystatus[1] > 0) ! 714: exit = 1; ! 715: // overwritesprite(0,0,ORDER1,0,0,0); ! 716: // overwritesprite(0,0,ORDER1,0,4,0); ! 717: itemtoscreen(0L, 0L, THEORDER, 0, 0); ! 718: nextpage(); ! 719: } ! 720: keystatus[0x39] = 0; ! 721: keystatus[1] = 0; ! 722: exit = 0; ! 723: /* while( !exit ){ if(keystatus[0x39] > 0 || keystatus[1] > 0) ! 724: * exit=1; //overwritesprite(0,0,ORDER2,0,0,0); ! 725: * //overwritesprite(0,0,ORDER2,0,4,0); ! 726: * itemtoscreen(0L,0L,ORDER2,0,0); nextpage(); } ! 727: * keystatus[0x39]=0; keystatus[1]=0; exit=0; */ ! 728: } ! 729: shutdown(); ! 730: } ! 731: ! 732: } ! 733: ! 734: void ! 735: thedifficulty(void) ! 736: { ! 737: ! 738: struct { ! 739: int x; ! 740: int y; ! 741: } redpic[4] = { ! 742: { ! 743: 152, 131 + 5 ! 744: }, ! 745: { ! 746: 184, 131 + 5 ! 747: }, ! 748: { ! 749: 219, 129 + 5 ! 750: }, ! 751: { ! 752: 261, 128 + 5 ! 753: } ! 754: }; ! 755: ! 756: ! 757: ! 758: int exit = 0; ! 759: int selected; ! 760: int select; ! 761: int select2 = 0; ! 762: int select3 = goreon; ! 763: int redpicnum; ! 764: int pickone = 0; ! 765: long goaltime; ! 766: int cnt = 0; ! 767: ! 768: struct player *plr; ! 769: ! 770: plr = &player[0]; ! 771: ! 772: select = difficulty - 1; ! 773: keystatus[1] = 0; ! 774: keystatus[0x1c] = 0; ! 775: keystatus[0x9c] = 0; ! 776: ! 777: if (svga == 0) { ! 778: permanentwritesprite(0L, 0L, ZZGORE, 0, 0L, 0L, 319L, 199L, 0); ! 779: itemtoscreen(66L, 9L, ZZBLOOD, 0, 0); ! 780: } ! 781: else { ! 782: permanentwritesprite(0L, 0L, VGOREA, 0, 0L, 0L, xdim-1L, ydim-1L, 0); ! 783: permanentwritesprite(0L, 240L, VGOREB, 0, 0L, 0L, xdim-1L, ydim-1L, 0); ! 784: itemtoscreen((xdim>>1)-160L+37L, (ydim>>1)-100L-1L, 3702, 0, 0); ! 785: } ! 786: ! 787: if (goreon == 1) { ! 788: itemtoscreen((long) ((xdim - tilesizx[NOGORESHADOW]) >> 1), ! 789: (svga == 0) ? (ydim >> 1) - 100L + 72L : ! 790: (ydim >> 1) - 100L + 80L, ! 791: NOGORESHADOW, 0, 0); ! 792: itemtoscreen((long) ((xdim - tilesizx[GORESOLID]) >> 1), ! 793: (svga == 0) ? (ydim >> 1) - 100L + 69L : ! 794: (ydim >> 1) - 100L + 77L, ! 795: GORESOLID, 0, 0); ! 796: } ! 797: else { ! 798: itemtoscreen((long) ((xdim - tilesizx[NOGORESOLID]) >> 1), ! 799: (svga == 0) ? (ydim >> 1) - 100L + 72L : ! 800: (ydim >> 1) - 100L + 80L, ! 801: NOGORESOLID, 0, 0); ! 802: itemtoscreen((long) ((xdim - tilesizx[GORESHADOW]) >> 1), ! 803: (svga == 0) ? (ydim >> 1) - 100L + 69L : ! 804: (ydim >> 1) - 100L + 77L, ! 805: GORESHADOW, 0, 0); ! 806: } ! 807: ! 808: goaltime = totalclock + SCOTTSPEED; ! 809: ! 810: while (!exit) { ! 811: ! 812: if (totalclock >= goaltime) { ! 813: goaltime = totalclock + SCOTTSPEED; ! 814: cnt++; ! 815: if (cnt > 2) ! 816: cnt = 0; ! 817: ! 818: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 819: TEMPSND(); ! 820: select2 = 0; ! 821: } ! 822: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 823: TEMPSND(); ! 824: select2 = 1; ! 825: } ! 826: if (select2 == 0) ! 827: pickone = 0; ! 828: else ! 829: pickone = 1; ! 830: ! 831: redpicnum = HORNYSKULL1 + select; ! 832: ! 833: if (svga == 0) { ! 834: permanentwritesprite(0L, 0L, ZZGORE, 0, ! 835: 0L, 0L, 319L, 199L, 0); ! 836: } ! 837: else { ! 838: permanentwritesprite(0L, 0L, VGOREA, 0, ! 839: 0L, 0L, xdim-1L, ydim-1L, 0); ! 840: permanentwritesprite(0L, 240L, VGOREB, 0, ! 841: 0L, 0L, xdim-1L, ydim-1L, 0); ! 842: } ! 843: ! 844: if (select2 == 0) { ! 845: switch (cnt) { ! 846: case 0: ! 847: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 66L : ! 848: (xdim >> 1) - 160L + 37L, ! 849: (svga == 0) ? (ydim >> 1) - 100L + 9L : ! 850: (ydim >> 1) - 100L - 1L, ! 851: (svga == 0) ? ZZBLOOD : 3690, ! 852: 0, 0); ! 853: break; ! 854: case 1: ! 855: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 66L : ! 856: (xdim >> 1) - 160L + 37L, ! 857: (svga == 0) ? (ydim >> 1) - 100L + 9L : ! 858: (ydim >> 1) - 100L - 1L, ! 859: (svga == 0) ? ZFLASHER1 + 10 : 3702, ! 860: 0, 0); ! 861: break; ! 862: case 2: ! 863: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 66L : ! 864: (xdim >> 1) - 160L + 37L, ! 865: (svga == 0) ? (ydim >> 1) - 100L + 9L : ! 866: (ydim >> 1) - 100L - 1L, ! 867: (svga == 0) ? ZFLASHER2 + 10 : 3709, ! 868: 0, 0); ! 869: break; ! 870: } ! 871: ! 872: } ! 873: else { ! 874: switch (cnt) { ! 875: case 0: ! 876: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 72L : ! 877: (xdim >> 1) - 160L + 48L, ! 878: (svga == 0) ? (ydim >> 1) - 100L + 74L : ! 879: (ydim >> 1) - 100L + 74L, ! 880: (svga == 0) ? ZZDIFFICULTY : 3691, ! 881: 0, 0); ! 882: break; ! 883: case 1: ! 884: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 72L : ! 885: (xdim >> 1) - 160L + 48L, ! 886: (svga == 0) ? (ydim >> 1) - 100L + 74L : ! 887: (ydim >> 1) - 100L + 74L, ! 888: (svga == 0) ? ZFLASHER1 + 11 : 3703, ! 889: 0, 0); ! 890: break; ! 891: case 2: ! 892: itemtoscreen((svga == 0) ? (xdim >> 1) - 160L + 72L : ! 893: (xdim >> 1) - 160L + 48L, ! 894: (svga == 0) ? (ydim >> 1) - 100L + 74L : ! 895: (ydim >> 1) - 100L + 74L, ! 896: (svga == 0) ? ZFLASHER2 + 11 : 3710, ! 897: 0, 0); ! 898: break; ! 899: } ! 900: } ! 901: ! 902: itemtoscreen((long) ((xdim - tilesizx[HORNYBACK]) >> 1), ! 903: (svga == 0) ? (ydim >> 1) - 100L + 136L : ! 904: (ydim >> 1) - 100L + 144L, ! 905: HORNYBACK, 0, 0); ! 906: itemtoscreen((long) (xdim >> 1) - 160L + (redpic[select].x - 64), ! 907: (svga == 0) ? ! 908: (ydim >> 1)-100L+(redpic[select].y+3) : ! 909: (ydim >> 1)-100L+(redpic[select].y+3)+8L, ! 910: redpicnum, 0, 0); ! 911: ! 912: if (goreon == 1) { ! 913: itemtoscreen((long) (xdim >> 1) - 160L + (160 - 64), ! 914: (svga == 0) ? (ydim >> 1)-100L+72L : ! 915: (ydim >> 1)-100L+80L, ! 916: NOGORESHADOW, 0, 0); ! 917: itemtoscreen((long) (xdim >> 1) - 160L + (160 + 32), ! 918: (svga == 0) ? (ydim >> 1)-100L+69L : ! 919: (ydim >> 1)-100L+77L, ! 920: GORESOLID, 0, 0); ! 921: } ! 922: else { ! 923: itemtoscreen((long) (xdim >> 1) - 160L + (160 - 64), ! 924: (svga == 0) ? (ydim >> 1)-100L+72L : ! 925: (ydim >> 1)-100L+80L, ! 926: NOGORESOLID, 0, 0); ! 927: itemtoscreen((long) (xdim >> 1) - 160L + (160 + 32), ! 928: (svga == 0) ? (ydim >> 1)-100L+69L : ! 929: (ydim >> 1)-100L+77L, ! 930: GORESHADOW, 0, 0); ! 931: } ! 932: ! 933: if (pickone == 1) { ! 934: if (keystatus[keys[KEYLEFT]] > 0 || keystatus[RLEFT] > 0) { ! 935: TEMPSND(); ! 936: select--; ! 937: if (select < 0) ! 938: select = 0; ! 939: } ! 940: if (keystatus[keys[KEYRIGHT]] > 0 || keystatus[RRIGHT] > 0) { ! 941: TEMPSND(); ! 942: select++; ! 943: if (select > 3) ! 944: select = 3; ! 945: } ! 946: selected = select; ! 947: } ! 948: else { ! 949: if (keystatus[keys[KEYLEFT]] > 0 || keystatus[RLEFT] > 0) { ! 950: TEMPSND(); ! 951: select3 = 0; ! 952: } ! 953: if (keystatus[keys[KEYRIGHT]] > 0 || keystatus[RRIGHT] > 0) { ! 954: TEMPSND(); ! 955: select3 = 1; ! 956: } ! 957: if (select3 == 0) ! 958: goreon = 0; ! 959: else ! 960: goreon = 1; ! 961: } ! 962: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 963: exit = 1; ! 964: keystatus[0x1c] = keystatus[0x9c] = 0; ! 965: } ! 966: if (keystatus[1] > 0) { ! 967: exit = 2; ! 968: keystatus[1] = 0; ! 969: } ! 970: nextpage(); ! 971: } // IF ! 972: ! 973: } // WHILE ! 974: ! 975: if (exit == 1) { ! 976: switch (selected) { ! 977: case 0: ! 978: difficulty = 1; ! 979: break; ! 980: case 1: ! 981: difficulty = 2; ! 982: break; ! 983: case 2: ! 984: difficulty = 3; ! 985: break; ! 986: case 3: ! 987: difficulty = 4; ! 988: break; ! 989: } ! 990: } ! 991: ! 992: ! 993: } ! 994: ! 995: extern ! 996: int justteleported, ! 997: mapflag, ! 998: nobreakflag, ! 999: show2dobjectsflag, ! 1000: show2dmapflag; ! 1001: ! 1002: void ! 1003: startnewgame(struct player * plr) ! 1004: { ! 1005: ! 1006: char temp[20]; ! 1007: char tempshow2dsector[MAXSECTORS >> 3]; ! 1008: char tempshow2dwall[MAXWALLS >> 3]; ! 1009: char tempshow2dsprite[MAXSPRITES >> 3]; ! 1010: int i; ! 1011: ! 1012: justteleported=0; ! 1013: if (netgame) { ! 1014: // dolevelmusic(0); ! 1015: // SND_StartMusic(mapon-1); ! 1016: goto skip; ! 1017: } ! 1018: if (loadedgame == 0) { ! 1019: if (mapflag == 0) { ! 1020: mapon = 1; ! 1021: } ! 1022: strcpy(boardname, "level"); ! 1023: itoa(mapon, temp, 10); ! 1024: strcat(boardname, temp); ! 1025: strcat(boardname, ".map"); ! 1026: setupboard(boardname); ! 1027: initplayersprite(); ! 1028: cleanup(); ! 1029: if (musicoverride == -1) { ! 1030: dolevelmusic(mapon - 1); ! 1031: } ! 1032: } ! 1033: else if (loadedgame == 1) { ! 1034: setupboard(boardname); ! 1035: loadplayerstuff(); ! 1036: initplayersprite(); ! 1037: #if 0 ! 1038: for (i = 0; i < (MAXSECTORS >> 3); i++) ! 1039: tempshow2dsector[i] = show2dsector[i]; ! 1040: for (i = 0; i < (MAXWALLS >> 3); i++) ! 1041: tempshow2dwall[i] = show2dwall[i]; ! 1042: for (i = 0; i < (MAXSPRITES >> 3); i++) ! 1043: tempshow2dsprite[i] = show2dsprite[i]; ! 1044: for (i = 0; i < (MAXSECTORS >> 3); i++) ! 1045: show2dsector[i] = tempshow2dsector[i]; ! 1046: for (i = 0; i < (MAXWALLS >> 3); i++) ! 1047: show2dwall[i] = tempshow2dwall[i]; ! 1048: for (i = 0; i < (MAXSPRITES >> 3); i++) ! 1049: show2dsprite[i] = tempshow2dsprite[i]; ! 1050: #endif ! 1051: loadedgame = 0; ! 1052: if (musicoverride == -1) { ! 1053: dolevelmusic(mapon - 1); ! 1054: } ! 1055: } ! 1056: skip: ! 1057: godmode=0; ! 1058: nobreakflag=0; ! 1059: show2dobjectsflag=0; ! 1060: show2dmapflag=0; ! 1061: if (plr->screensize < 320) ! 1062: permanentwritesprite(0L, 0L, BACKGROUND, 0, 0L, 0L, 319L, 199L, 0); ! 1063: ! 1064: if (plr->screensize <= 320) { ! 1065: permanentwritesprite(0L, 154L, NEWSTATUSBAR, 0, 0L, 0L, 319L, 199L, 0); ! 1066: } ! 1067: updatepics(); ! 1068: ! 1069: } ! 1070: ! 1071: void ! 1072: loadgame(struct player * plr) ! 1073: { ! 1074: ! 1075: int select = 0; ! 1076: int exit = 0; ! 1077: int gn, ! 1078: i, ! 1079: step = 0; ! 1080: char temp[20]; ! 1081: long goaltime; ! 1082: ! 1083: if (quicksaveflag) { ! 1084: select=10; ! 1085: exit=2; ! 1086: goto quickloadlabel; ! 1087: } ! 1088: ! 1089: goaltime = totalclock + SCOTTSPEED; ! 1090: ! 1091: for (i = 0; i < MAXSAVEDGAMES; i++) ! 1092: if (!savedgamedat(i)) ! 1093: strcpy(savedgamenames[i].name, "empty"); ! 1094: ! 1095: while (!exit) { ! 1096: if (svga == 0) { ! 1097: permanentwritesprite(0L, 0L, ZLOAD, 0, 0L, 0L, 319L, 199L, 0); ! 1098: } ! 1099: else { ! 1100: rotatesprite(0L << 16, 0L << 16, ! 1101: 65536L, 0, VMAINBLANK, 0, 0, 8 + 16, ! 1102: 0L, 0L, xdim - 1L, ydim - 1L); ! 1103: rotatesprite(((xdim>>1)-160L)<<16, ((ydim>>1)-100L)<<16, ! 1104: 65536L, 0, ZLOAD, 0, 0, 1 + 16, ! 1105: (xdim>>1)-160L,(ydim>>1)-100L, ! 1106: (xdim>>1)+160L-1L,(ydim>>1)+100L-1L); ! 1107: } ! 1108: for (i = 0; i < MAXSAVEDGAMES; i++) { ! 1109: if (i == select) { ! 1110: rotatesprite(((xdim>>1)-135L)<<16, ! 1111: (((ydim>>1)-69L)+(i * 19))<<16, ! 1112: 16384L, 0, HELMET + step, ! 1113: 0, 0, 8 + 16, ! 1114: 0L, 0L, xdim-1L, ydim-1L); ! 1115: } ! 1116: fancyfont((xdim>>1)-83, ((ydim>>1)-69)+(i * 19), ! 1117: DAFONT, savedgamenames[i].name, 0); ! 1118: } ! 1119: ! 1120: nextpage(); ! 1121: ! 1122: if (totalclock >= goaltime) { ! 1123: goaltime = totalclock + SCOTTSPEED; ! 1124: step=(step+1)%8; ! 1125: } ! 1126: ! 1127: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 1128: select--; ! 1129: if (select < 0) ! 1130: select = MAXSAVEDGAMES-1; ! 1131: keystatus[keys[KEYFWD]] = 0; ! 1132: keystatus[RUP] = 0; ! 1133: } ! 1134: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 1135: select++; ! 1136: if (select > MAXSAVEDGAMES-1) ! 1137: select = 0; ! 1138: keystatus[keys[KEYBACK]] = 0; ! 1139: keystatus[RDN] = 0; ! 1140: } ! 1141: ! 1142: if (keystatus[1] > 0) { ! 1143: exit = 1; ! 1144: keystatus[1] = 0; ! 1145: } ! 1146: ! 1147: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 1148: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1149: if (strcmp(savedgamenames[select].name, "empty") == 0) ! 1150: exit = 0; ! 1151: else { ! 1152: exit = 2; ! 1153: loadgo = 1; ! 1154: } ! 1155: } ! 1156: } ! 1157: quickloadlabel: ! 1158: if (exit == 2) { ! 1159: keystatus[1] = keystatus[0x1c] = keystatus[0x9c] = 0; ! 1160: strcpy(boardname, "svgm"); ! 1161: itoa(select, temp, 10); ! 1162: strcat(boardname, temp); ! 1163: strcpy(loadgamename, "svgn"); ! 1164: strcat(loadgamename, temp); ! 1165: strcat(loadgamename, ".dat"); ! 1166: strcat(boardname, ".map"); ! 1167: if (access(boardname,F_OK) != 0) { ! 1168: return; ! 1169: } ! 1170: if (access(loadgamename,F_OK) != 0) { ! 1171: return; ! 1172: } ! 1173: loadedgame = 1; ! 1174: gameactivated = 1; ! 1175: startnewgame(plr); ! 1176: } ! 1177: } ! 1178: ! 1179: void ! 1180: savegame(struct player * plr) ! 1181: { ! 1182: ! 1183: int exit = 0; ! 1184: int gn, ! 1185: i, ! 1186: step = 0; ! 1187: int select = 0; ! 1188: char temp[20]; ! 1189: long goaltime; ! 1190: ! 1191: ! 1192: if (quicksaveflag) { ! 1193: strcpy(quicksavedgame.name,"QUICKSAVE"); ! 1194: strcpy(tempbuf,"svgm10.map"); ! 1195: saveboard(tempbuf, &plr->x, &plr->y, &plr->z, &plr->ang, &plr->sector); ! 1196: savedgamename(10); ! 1197: return; ! 1198: } ! 1199: for (i = 0; i < MAXSAVEDGAMES; i++) ! 1200: if (!savedgamedat(i)) ! 1201: strcpy(savedgamenames[i].name, "EMPTY"); ! 1202: ! 1203: goaltime = totalclock + SCOTTSPEED; ! 1204: ! 1205: while (!exit) { ! 1206: if (svga == 0) { ! 1207: permanentwritesprite(0L, 0L, ZSAVE, 0, 0L, 0L, 319L, 199L, 0); ! 1208: } ! 1209: else { ! 1210: rotatesprite(0L << 16, 0L << 16, ! 1211: 65536L, 0, VMAINBLANK, 0, 0, 8 + 16, ! 1212: 0L, 0L, xdim - 1L, ydim - 1L); ! 1213: rotatesprite(((xdim>>1)-160L)<<16, ((ydim>>1)-100L)<<16, ! 1214: 65536L, 0, ZSAVE, 0, 0, 1 + 16, ! 1215: (xdim>>1)-160L,(ydim>>1)-100L, ! 1216: (xdim>>1)+160L-1L,(ydim>>1)+100L-1L); ! 1217: } ! 1218: for (i = 0; i < MAXSAVEDGAMES; i++) { ! 1219: if (i == select) { ! 1220: rotatesprite(((xdim>>1)-135L)<<16, ! 1221: (((ydim>>1)-69L)+(i * 19))<<16, ! 1222: 16384L, 0, HELMET + step, ! 1223: 0, 0, 8 + 16, ! 1224: 0L, 0L, xdim-1L, ydim-1L); ! 1225: } ! 1226: fancyfont((xdim>>1)-83,((ydim>>1)-69)+(i * 19), ! 1227: DAFONT, savedgamenames[i].name, 0); ! 1228: } ! 1229: ! 1230: nextpage(); ! 1231: ! 1232: if (totalclock >= goaltime) { ! 1233: goaltime = totalclock + SCOTTSPEED; ! 1234: ! 1235: step = (step + 1) % 8; ! 1236: } ! 1237: ! 1238: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 1239: select--; ! 1240: if (select < 0) ! 1241: select = MAXSAVEDGAMES-1; ! 1242: keystatus[keys[KEYFWD]] = 0; ! 1243: keystatus[RUP] = 0; ! 1244: } ! 1245: ! 1246: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 1247: select++; ! 1248: if (select > MAXSAVEDGAMES-1) ! 1249: select = 0; ! 1250: keystatus[keys[KEYBACK]] = 0; ! 1251: keystatus[RDN] = 0; ! 1252: } ! 1253: ! 1254: if (keystatus[1] > 0) { ! 1255: exit = 1; ! 1256: keystatus[1] = 0; ! 1257: } ! 1258: ! 1259: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 1260: exit = 2; ! 1261: typemessageleng = 0; ! 1262: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1263: savegametext(select); ! 1264: } ! 1265: } ! 1266: ! 1267: } ! 1268: ! 1269: void ! 1270: savegametext(int select) ! 1271: { ! 1272: ! 1273: struct player *plr; ! 1274: ! 1275: int exit = 0; ! 1276: int i, ! 1277: len, ! 1278: j; ! 1279: char temp[40]; ! 1280: char temp1[40]; ! 1281: char temp2[40]; ! 1282: char temp3[40]; ! 1283: int typemessageleng = 0; ! 1284: ! 1285: plr = &player[pyrn]; ! 1286: ! 1287: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1288: ! 1289: for (i = 0; i < 128; i++) ! 1290: keystatus[i] = 0; ! 1291: ! 1292: if (strcmp(savedgamenames[select].name,"empty") == 0) { ! 1293: strcpy(temp,""); ! 1294: } ! 1295: else { ! 1296: sprintf(temp,"%s",savedgamenames[select].name); ! 1297: } ! 1298: typemessageleng=strlen(temp); ! 1299: ! 1300: while (!exit) { ! 1301: ! 1302: if (svga == 0) { ! 1303: permanentwritesprite(0L, 0L, ZSAVE, 0, 0L, 0L, 319L, 199L, 0); ! 1304: } ! 1305: else { ! 1306: rotatesprite(0L << 16, 0L << 16, ! 1307: 65536L, 0, VMAINBLANK, 0, 0, 8 + 16, ! 1308: 0L, 0L, xdim - 1L, ydim - 1L); ! 1309: rotatesprite(((xdim>>1)-160L)<<16, ((ydim>>1)-100L)<<16, ! 1310: 65536L, 0, ZSAVE, 0, 0, 1 + 16, ! 1311: (xdim>>1)-160L,(ydim>>1)-100L, ! 1312: (xdim>>1)+160L-1L,(ydim>>1)+100L-1L); ! 1313: } ! 1314: for (i = 0; i < MAXSAVEDGAMES; i++) { ! 1315: if (i == select) { ! 1316: fancyfont((xdim>>1)-77, (ydim>>1)-100+31+(i * 19), ! 1317: DAFONT, temp, 7); ! 1318: } ! 1319: else { ! 1320: strcpy(tempbuf, savedgamenames[i].name); ! 1321: fancyfont((xdim>>1)-77, (ydim>>1)-100+31+(i * 19), ! 1322: DAFONT, tempbuf, 0); ! 1323: } ! 1324: } ! 1325: ! 1326: if (keystatus[0xe] > 0) {// backspace ! 1327: if (typemessageleng > 0) { ! 1328: temp[typemessageleng] = '\0'; ! 1329: typemessageleng--; ! 1330: temp[typemessageleng] = '\0'; ! 1331: } ! 1332: else { ! 1333: strcpy(temp, "-"); ! 1334: typemessageleng = 0; ! 1335: } ! 1336: keystatus[0xe] = 0; ! 1337: } ! 1338: ! 1339: ! 1340: ! 1341: ! 1342: if (typemessageleng < 10) { ! 1343: for (i = 0; i < 128; i++) { ! 1344: if (keystatus[i] > 0 ! 1345: && keystatus[0x0e] == 0 // keypressed not ! 1346: && keystatus[1] == 0 // esc ! 1347: && keystatus[0x1c] == 0 // enter l or r ! 1348: && keystatus[0x9c] == 0) { // backspace ! 1349: for (j = 0; j < 41; j++) { ! 1350: if (scantoasc[i] == ' ') { ! 1351: continue; ! 1352: } ! 1353: else if (scantoasc[i] == fancy[j]) { ! 1354: temp[typemessageleng] = fancy[j]; ! 1355: typemessageleng++; ! 1356: temp[typemessageleng] = '\0'; ! 1357: keystatus[i] = 0; ! 1358: } ! 1359: else ! 1360: keystatus[i] = 0; ! 1361: } ! 1362: } ! 1363: } ! 1364: } ! 1365: if (keystatus[1] > 0) { ! 1366: exit = 1; ! 1367: keystatus[1] = 0; ! 1368: } ! 1369: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 1370: if (typemessageleng > 0) { ! 1371: strcpy(savedgamenames[select].name, temp); ! 1372: strcpy(tempbuf, "svgm"); ! 1373: itoa(select, temp2, 10); ! 1374: strcat(tempbuf, temp2); ! 1375: strcat(tempbuf, ".map"); ! 1376: saveboard(tempbuf, &plr->x, &plr->y, &plr->z, &plr->ang, &plr->sector); ! 1377: savedgamename(select); ! 1378: } ! 1379: else { ! 1380: strcpy(tempbuf, "svgm"); ! 1381: itoa(select, temp2, 10); ! 1382: strcat(tempbuf, temp2); ! 1383: strcat(tempbuf, ".map"); ! 1384: saveboard(tempbuf, &plr->x, &plr->y, &plr->z, &plr->ang, &plr->sector); ! 1385: savedgamename(select); ! 1386: } ! 1387: exit = 2; ! 1388: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1389: } ! 1390: nextpage(); ! 1391: } ! 1392: ! 1393: if (exit == 2) { ! 1394: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1395: } ! 1396: ! 1397: } ! 1398: #if 0 ! 1399: void ! 1400: savegametext(int select) ! 1401: { ! 1402: ! 1403: struct player *plr; ! 1404: ! 1405: int exit = 0; ! 1406: int i, ! 1407: len, ! 1408: j; ! 1409: char temp[40]; ! 1410: char temp1[40]; ! 1411: char temp2[40]; ! 1412: ! 1413: int typemessageleng = 0; ! 1414: ! 1415: plr = &player[pyrn]; ! 1416: ! 1417: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1418: ! 1419: for (i = 0; i < 128; i++) ! 1420: keystatus[i] = 0; ! 1421: ! 1422: strcpy(temp, "-"); ! 1423: ! 1424: while (!exit) { ! 1425: ! 1426: permanentwritesprite(0L, 0L, ZSAVE, 0, 0L, 0L, 319L, 199L, 0); ! 1427: ! 1428: for (i = 0; i < MAXSAVEDGAMES; i++) { ! 1429: if (i == select) { ! 1430: strcpy(tempbuf, temp); ! 1431: fancyfont(77, 31 + (i * 19), DAFONT, tempbuf, 7); ! 1432: } ! 1433: else { ! 1434: strcpy(tempbuf, savedgamenames[i].name); ! 1435: fancyfont(77, 31 + (i * 19), DAFONT, tempbuf, 0); ! 1436: } ! 1437: } ! 1438: if (keystatus[0xe] > 0) {// backspace ! 1439: if (typemessageleng > 0) { ! 1440: temp[typemessageleng] = '\0'; ! 1441: typemessageleng--; ! 1442: temp[typemessageleng] = '\0'; ! 1443: } ! 1444: else { ! 1445: strcpy(temp, "-"); ! 1446: typemessageleng = 0; ! 1447: } ! 1448: keystatus[0xe] = 0; ! 1449: } ! 1450: if (typemessageleng < 10) { ! 1451: for (i = 0; i < 128; i++) { ! 1452: if (keystatus[i] > 0 ! 1453: && keystatus[0x0e] == 0 // keypressed not ! 1454: && keystatus[1] == 0 // esc ! 1455: && keystatus[0x1c] == 0 // enter l or r ! 1456: && keystatus[0x9c] == 0) { // backspace ! 1457: ! 1458: for (j = 0; j < 41; j++) { ! 1459: if (scantoasc[i] == ' ') { ! 1460: continue; ! 1461: } ! 1462: else if (scantoasc[i] == fancy[j]) { ! 1463: temp[typemessageleng] = fancy[j]; ! 1464: typemessageleng++; ! 1465: temp[typemessageleng] = '\0'; ! 1466: keystatus[i] = 0; ! 1467: } ! 1468: else ! 1469: keystatus[i] = 0; ! 1470: } ! 1471: } ! 1472: } ! 1473: } ! 1474: if (keystatus[1] > 0) { ! 1475: exit = 1; ! 1476: keystatus[1] = 0; ! 1477: } ! 1478: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 1479: if (typemessageleng > 0) { ! 1480: strcpy(savedgamenames[select].name, temp); ! 1481: strcpy(tempbuf, "svgm"); ! 1482: itoa(select, temp2, 10); ! 1483: strcat(tempbuf, temp2); ! 1484: strcat(tempbuf, ".map"); ! 1485: saveboard(tempbuf, &plr->x, &plr->y, &plr->z, &plr->ang, &plr->sector); ! 1486: savedgamename(select); ! 1487: } ! 1488: else { ! 1489: strcpy(tempbuf, "svgm"); ! 1490: itoa(select, temp2, 10); ! 1491: strcat(tempbuf, temp2); ! 1492: strcat(tempbuf, ".map"); ! 1493: saveboard(tempbuf, &plr->x, &plr->y, &plr->z, &plr->ang, &plr->sector); ! 1494: savedgamename(select); ! 1495: } ! 1496: exit = 2; ! 1497: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1498: } ! 1499: nextpage(); ! 1500: } ! 1501: ! 1502: if (exit == 2) { ! 1503: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1504: } ! 1505: ! 1506: } ! 1507: #endif ! 1508: ! 1509: extern ! 1510: int treasurescnt, ! 1511: treasuresfound, ! 1512: killcnt, ! 1513: kills, ! 1514: expgained; ! 1515: ! 1516: int ! 1517: savedgamename(int gn) ! 1518: { ! 1519: ! 1520: struct player *plr; ! 1521: int file; ! 1522: int i; ! 1523: char temp[3]; ! 1524: ! 1525: plr = &player[0]; ! 1526: ! 1527: if (svga == 1) ! 1528: plr->screensize = 320; ! 1529: else ! 1530: plr->screensize = 320; ! 1531: ! 1532: strcpy(tempbuf, "svgn"); ! 1533: itoa(gn, temp, 10); ! 1534: strcat(tempbuf, temp); ! 1535: strcat(tempbuf, ".dat"); ! 1536: ! 1537: file = open(tempbuf, O_BINARY | O_TRUNC | O_CREAT | O_WRONLY, S_IWRITE); ! 1538: ! 1539: if (file != -1) { ! 1540: if (gn == 10) { ! 1541: write(file, quicksavedgame.name, sizeof(struct savedgame)); ! 1542: } ! 1543: else { ! 1544: write(file, savedgamenames[gn].name, sizeof(struct savedgame)); ! 1545: } ! 1546: write(file, &player[0], sizeof(struct player)); ! 1547: write(file, &currweapon, sizeof(currweapon)); ! 1548: write(file, &selectedgun, sizeof(selectedgun)); ! 1549: write(file, ¤tpotion, sizeof(currentpotion)); ! 1550: write(file, &helmettime, sizeof(helmettime)); ! 1551: write(file, &shadowtime, sizeof(shadowtime)); ! 1552: write(file, &nightglowtime, sizeof(nightglowtime)); ! 1553: write(file, &visibility, sizeof(visibility)); ! 1554: write(file, &brightness, sizeof(brightness)); ! 1555: write(file, &strongtime, sizeof(strongtime)); ! 1556: write(file, &invisibletime, sizeof(invisibletime)); ! 1557: write(file, &manatime, sizeof(manatime)); ! 1558: write(file, &thunderflash, sizeof(thunderflash)); ! 1559: write(file, &thundertime, sizeof(thundertime)); ! 1560: ! 1561: write(file, ¤torb, sizeof(currentorb)); ! 1562: write(file, &currweaponfired, sizeof(currweaponfired)); ! 1563: write(file, &currweaponanim, sizeof(currweaponanim)); ! 1564: write(file, &currweaponattackstyle, sizeof(currweaponattackstyle)); ! 1565: write(file, &currweaponflip, sizeof(currweapon)); ! 1566: write(file, &mapon, sizeof(mapon)); ! 1567: ! 1568: write(file, &totalclock, sizeof(totalclock)); ! 1569: write(file, &lockclock, sizeof(lockclock)); ! 1570: write(file, &synctics, sizeof(synctics)); ! 1571: ! 1572: // Warning: only works if all pointers are in sector structures! ! 1573: for (i = MAXANIMATES - 1; i >= 0; i--) ! 1574: animateptr[i] = (long *) (animateptr[i] - ((long) sector)); ! 1575: ! 1576: write(file, animateptr, MAXANIMATES << 2); ! 1577: ! 1578: for (i = MAXANIMATES - 1; i >= 0; i--) ! 1579: animateptr[i] = (long *) (animateptr[i] + ((long) sector)); ! 1580: ! 1581: write(file, animategoal, MAXANIMATES << 2); ! 1582: write(file, animatevel, MAXANIMATES << 2); ! 1583: write(file, &animatecnt, 4); ! 1584: ! 1585: write(file, show2dsector, MAXSECTORS >> 3); ! 1586: write(file, show2dwall, MAXWALLS >> 3); ! 1587: write(file, show2dsprite, MAXSPRITES >> 3); ! 1588: write(file, &automapping, 1); ! 1589: write(file, &shieldpoints, 2); ! 1590: write(file, &vampiretime, 2); ! 1591: write(file, &poisoned, 2); ! 1592: write(file, &poisontime, 2); ! 1593: ! 1594: write(file, &sparksx, sizeof(sparksx)); ! 1595: write(file, &sparksy, sizeof(sparksy)); ! 1596: write(file, &sparksz, sizeof(sparksz)); ! 1597: ! 1598: write(file, &treasurescnt, sizeof(treasurescnt)); ! 1599: write(file, &treasuresfound, sizeof(treasuresfound)); ! 1600: write(file, &killcnt, sizeof(killcnt)); ! 1601: write(file, &kills, sizeof(kills)); ! 1602: write(file, &expgained, sizeof(expgained)); ! 1603: ! 1604: close(file); ! 1605: return 1; ! 1606: } ! 1607: else ! 1608: return 0; ! 1609: ! 1610: ! 1611: ! 1612: } ! 1613: ! 1614: int ! 1615: savedgamedat(int gn) ! 1616: { ! 1617: ! 1618: int fh = 0, ! 1619: nr = 0; ! 1620: char fname[20]; ! 1621: char fsname[20]; ! 1622: char savedgame[40]; ! 1623: char temp[20]; ! 1624: ! 1625: itoa(gn, temp, 10); ! 1626: strcpy(fname, "svgm"); ! 1627: strcat(fname, temp); ! 1628: strcat(fname, ".map"); ! 1629: ! 1630: itoa(gn, temp, 10); ! 1631: strcpy(fsname, "svgn"); ! 1632: strcat(fsname, temp); ! 1633: strcat(fsname, ".dat"); ! 1634: ! 1635: if (access(fname, F_OK) != 0) ! 1636: return 0; ! 1637: ! 1638: if (access(fsname, F_OK) != 0) ! 1639: return 0; ! 1640: ! 1641: fh = open(fsname, O_RDONLY | O_BINARY); ! 1642: ! 1643: if (fh < 0) ! 1644: return 0; ! 1645: ! 1646: if (gn == 10) { ! 1647: nr = read(fh, quicksavedgame.name, sizeof(struct savedgame)); ! 1648: } ! 1649: else { ! 1650: nr = read(fh, savedgamenames[gn].name, sizeof(struct savedgame)); ! 1651: } ! 1652: ! 1653: close(fh); ! 1654: ! 1655: if (nr != sizeof(struct savedgame)) ! 1656: return 0; ! 1657: ! 1658: return 1; ! 1659: ! 1660: } ! 1661: ! 1662: void ! 1663: loadplayerstuff(void) ! 1664: { ! 1665: ! 1666: int fh; ! 1667: int i; ! 1668: char temp[40]; ! 1669: ! 1670: fh = open(loadgamename, O_RDONLY | O_BINARY); ! 1671: ! 1672: read(fh, savedgamenames[0].name, sizeof(struct savedgame)); ! 1673: read(fh, &player[0], sizeof(struct player)); ! 1674: read(fh, &currweapon, sizeof(currweapon)); ! 1675: read(fh, &selectedgun, sizeof(selectedgun)); ! 1676: read(fh, ¤tpotion, sizeof(currentpotion)); ! 1677: read(fh, &helmettime, sizeof(helmettime)); ! 1678: read(fh, &shadowtime, sizeof(shadowtime)); ! 1679: read(fh, &nightglowtime, sizeof(nightglowtime)); ! 1680: read(fh, &visibility, sizeof(visibility)); ! 1681: read(fh, &brightness, sizeof(brightness)); ! 1682: read(fh, &strongtime, sizeof(strongtime)); ! 1683: read(fh, &invisibletime, sizeof(invisibletime)); ! 1684: read(fh, &manatime, sizeof(manatime)); ! 1685: read(fh, &thunderflash, sizeof(thunderflash)); ! 1686: read(fh, &thundertime, sizeof(thundertime)); ! 1687: ! 1688: read(fh, ¤torb, sizeof(currentorb)); ! 1689: read(fh, &currweaponfired, sizeof(currweaponfired)); ! 1690: read(fh, &currweaponanim, sizeof(currweaponanim)); ! 1691: read(fh, &currweaponattackstyle, sizeof(currweaponattackstyle)); ! 1692: read(fh, &currweaponflip, sizeof(currweaponflip)); ! 1693: read(fh, &mapon, sizeof(mapon)); ! 1694: ! 1695: read(fh, &totalclock, sizeof(totalclock)); ! 1696: read(fh, &lockclock, sizeof(lockclock)); ! 1697: read(fh, &synctics, sizeof(synctics)); ! 1698: ! 1699: // Warning: only works if all pointers are in sector structures! ! 1700: for (i = MAXANIMATES - 1; i >= 0; i--) ! 1701: animateptr[i] = (long *) (animateptr[i] - ((long) sector)); ! 1702: ! 1703: read(fh, animateptr, MAXANIMATES << 2); ! 1704: ! 1705: for (i = MAXANIMATES - 1; i >= 0; i--) ! 1706: animateptr[i] = (long *) (animateptr[i] + ((long) sector)); ! 1707: ! 1708: read(fh, animategoal, MAXANIMATES << 2); ! 1709: read(fh, animatevel, MAXANIMATES << 2); ! 1710: read(fh, &animatecnt, 4); ! 1711: ! 1712: ! 1713: read(fh, show2dsector, MAXSECTORS >> 3); ! 1714: read(fh, show2dwall, MAXWALLS >> 3); ! 1715: read(fh, show2dsprite, MAXSPRITES >> 3); ! 1716: read(fh, &automapping, 1); ! 1717: read(fh, &shieldpoints, 2); ! 1718: read(fh, &vampiretime, 2); ! 1719: read(fh, &poisoned, 2); ! 1720: read(fh, &poisontime, 2); ! 1721: ! 1722: read(fh, &sparksx, sizeof(sparksx)); ! 1723: read(fh, &sparksy, sizeof(sparksy)); ! 1724: read(fh, &sparksz, sizeof(sparksz)); ! 1725: ! 1726: read(fh, &treasurescnt, sizeof(treasurescnt)); ! 1727: read(fh, &treasuresfound, sizeof(treasuresfound)); ! 1728: read(fh, &killcnt, sizeof(killcnt)); ! 1729: read(fh, &kills, sizeof(kills)); ! 1730: read(fh, &expgained, sizeof(expgained)); ! 1731: ! 1732: close(fh); ! 1733: ! 1734: } ! 1735: ! 1736: void ! 1737: optionspage(void) ! 1738: { ! 1739: ! 1740: int which = 0; ! 1741: int exit = 0; ! 1742: int i; ! 1743: long goaltime; ! 1744: int cnt = 0; ! 1745: ! 1746: struct thenames { ! 1747: long x; ! 1748: long y; ! 1749: short thename; ! 1750: } danames[3] = {{ ! 1751: 107L, 35L, DASOUND ! 1752: }, ! 1753: { ! 1754: 97L, 72L, DAGAMEPLAY ! 1755: }, ! 1756: { ! 1757: 101L, 108L, DACONTROLS ! 1758: } ! 1759: }; ! 1760: ! 1761: struct sthenames { ! 1762: long x; ! 1763: long y; ! 1764: short thename; ! 1765: } sdanames[3] = {{ ! 1766: 254, 145, SFLASH4 ! 1767: }, ! 1768: { ! 1769: 235, 183, SFLASH4 + 1 ! 1770: }, ! 1771: { ! 1772: 253, 242, SFLASH4 + 2 ! 1773: } ! 1774: }; ! 1775: ! 1776: goaltime = totalclock + SCOTTSPEED; ! 1777: ! 1778: while (!exit) { ! 1779: ! 1780: if (svga == 0) ! 1781: permanentwritesprite(0L, 0L, ZOPS, 0, 0L, 0L, 319L, 199L, 0); ! 1782: else { ! 1783: rotatesprite(0L << 16, 0L << 16, 65536L, 0, VSOUNDA, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 1784: rotatesprite(0L << 16, 240L << 16, 65536L, 0, VSOUNDB, 0, 0, 8 + 16, 0L, 0L, xdim - 1L, ydim - 1L); ! 1785: } ! 1786: ! 1787: for (i = 0; i < 3; i++) { ! 1788: if (svga == 0) { ! 1789: if (which == i) { ! 1790: switch (cnt) { ! 1791: case 0: ! 1792: itemtoscreen(danames[which].x, danames[which].y, ! 1793: danames[which].thename, 0, 0); ! 1794: break; ! 1795: case 1: ! 1796: itemtoscreen(danames[which].x, danames[which].y, ! 1797: ZFLASHER1 + 5 + which, 0, 0); ! 1798: break; ! 1799: case 2: ! 1800: itemtoscreen(danames[which].x, danames[which].y, ! 1801: ZFLASHER2 + 5 + which, 0, 0); ! 1802: break; ! 1803: } ! 1804: } ! 1805: } ! 1806: else { ! 1807: switch (cnt) { ! 1808: case 0: ! 1809: itemtoscreen(sdanames[which].x, sdanames[which].y, ! 1810: sdanames[which].thename, 0, 0); ! 1811: break; ! 1812: case 1: ! 1813: itemtoscreen(sdanames[which].x, sdanames[which].y, ! 1814: SFLASH1 + 7 + which, 0, 0); ! 1815: break; ! 1816: case 2: ! 1817: itemtoscreen(sdanames[which].x, sdanames[which].y, ! 1818: SFLASH2 + 7 + which, 0, 0); ! 1819: break; ! 1820: } ! 1821: } ! 1822: } ! 1823: ! 1824: nextpage(); ! 1825: ! 1826: if (totalclock >= goaltime) { ! 1827: ! 1828: goaltime = totalclock + SCOTTSPEED; ! 1829: cnt++; ! 1830: if (cnt > 2) ! 1831: cnt = 0; ! 1832: ! 1833: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 1834: which--; ! 1835: if (which < 0) ! 1836: which = 2; ! 1837: } ! 1838: ! 1839: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 1840: which++; ! 1841: if (which > 2) ! 1842: which = 0; ! 1843: } ! 1844: ! 1845: if (keystatus[1] > 0) { ! 1846: exit = 1; ! 1847: keystatus[1] = 0; ! 1848: } ! 1849: ! 1850: if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 1851: keystatus[0x1c] = keystatus[0x9c] = 0; ! 1852: switch (which) { ! 1853: case 0: ! 1854: TEMPSND(); ! 1855: thesound(); ! 1856: break; ! 1857: case 1: ! 1858: TEMPSND(); ! 1859: thedifficulty(); ! 1860: break; ! 1861: case 2: ! 1862: TEMPSND(); ! 1863: thecontrols(); ! 1864: break; ! 1865: } ! 1866: } ! 1867: } ! 1868: } ! 1869: ! 1870: ! 1871: } ! 1872: ! 1873: ! 1874: ! 1875: void ! 1876: thesound(void) ! 1877: { ! 1878: ! 1879: int exit = 0; ! 1880: long goaltime; ! 1881: long bitchtime; ! 1882: long waittime; ! 1883: int which = 0; ! 1884: int musicslider = 0, ! 1885: fxslider = 0, ! 1886: playing = 0, ! 1887: stoped = 0, ! 1888: shuffle = 0; ! 1889: int forward, track = 0; ! 1890: long dax1, dax2; ! 1891: long x1, ! 1892: y1; ! 1893: long cnt = tilesizy[KATIEASS]; ! 1894: long xbase,ybase,xlen,ylen,xoff,yoff; ! 1895: short incr = 0, dapic, pic2; ! 1896: ! 1897: struct template { ! 1898: long x; ! 1899: long y; ! 1900: short daname; ! 1901: } dastuff[22] = {{ ! 1902: 66L, 45L, CDMUVOL ! 1903: }, ! 1904: { ! 1905: 71L, 79L, CDMUVOL + 1 ! 1906: }, ! 1907: { ! 1908: 184L, 23L, CDMUVOL + 2 ! 1909: }, ! 1910: { ! 1911: 229L, 24L, CDMUVOL + 3 ! 1912: }, ! 1913: { ! 1914: 216L, 76L, CDMUVOL + 4 ! 1915: }, ! 1916: { ! 1917: 184L, 40L, CDMUVOL + 5 ! 1918: }, ! 1919: { ! 1920: 225L, 40L, CDMUVOL + 6 ! 1921: }, ! 1922: { ! 1923: 57L, 105L, CDMUVOL + 7 ! 1924: }, ! 1925: { ! 1926: 57L, 117L, CDMUVOL + 8 ! 1927: }, ! 1928: { ! 1929: 57L, 129L, CDMUVOL + 9 ! 1930: }, ! 1931: { ! 1932: 57L, 141L, CDMUVOL + 10 ! 1933: }, ! 1934: { ! 1935: 57L, 153L, CDMUVOL + 11 ! 1936: }, ! 1937: { ! 1938: 142L, 105L, CDMUVOL + 12 ! 1939: }, ! 1940: { ! 1941: 142L, 117L, CDMUVOL + 13 ! 1942: }, ! 1943: { ! 1944: 142L, 129L, CDMUVOL + 14 ! 1945: }, ! 1946: { ! 1947: 142L, 141L, CDMUVOL + 15 ! 1948: }, ! 1949: { ! 1950: 142L, 153L, CDMUVOL + 16 ! 1951: }, ! 1952: { ! 1953: 216L, 105L, CDMUVOL + 17 ! 1954: }, ! 1955: { ! 1956: 216L, 117L, CDMUVOL + 18 ! 1957: }, ! 1958: { ! 1959: 216L, 129L, CDMUVOL + 19 ! 1960: }, ! 1961: { ! 1962: 216L, 141L, CDMUVOL + 20 ! 1963: }, ! 1964: { ! 1965: 216L, 153L, CDMUVOL + 21 ! 1966: } ! 1967: }; ! 1968: ! 1969: musiclevel = (wMIDIVol >> 3); ! 1970: digilevel = (wDIGIVol >> 11); ! 1971: ! 1972: dax2 = (long) (digilevel * 5); ! 1973: dax1 = (long) (musiclevel * 5); ! 1974: ! 1975: goaltime = totalclock + 10L; ! 1976: bitchtime = totalclock + 10L; ! 1977: waittime = totalclock + 720L; ! 1978: ! 1979: dapic = KATIEAT + 2; ! 1980: ! 1981: if (svga == 0) { ! 1982: pic2 = ZCDPLAYER; ! 1983: xlen = tilesizx[ZCDPLAYER]; ! 1984: ylen = tilesizy[ZCDPLAYER]; ! 1985: xoff = 0; ! 1986: yoff = 0; ! 1987: } ! 1988: else { ! 1989: pic2 = 1228; ! 1990: xlen = tilesizx[1228]; ! 1991: ylen = tilesizy[1228]; ! 1992: xoff = -40; ! 1993: yoff = -16; ! 1994: } ! 1995: xbase = (xdim >> 1) - (xlen >> 1); ! 1996: ybase = (ydim >> 1) - (ylen >> 1); ! 1997: ! 1998: while (!exit) { ! 1999: rotatesprite(0L << 16, 240L << 16, 65536L, 0, VSOUNDB, 0, 0, 8 + 16, ! 2000: 0L, 0L, xdim - 1L, ydim - 1L); ! 2001: permanentwritesprite(xbase, ybase, pic2, 0, ! 2002: 0L, 0L, xdim-1L, ydim-1L, 0); ! 2003: itemtoscreen(xbase + dastuff[which].x + xoff, ! 2004: ybase + dastuff[which].y + yoff, ! 2005: dastuff[which].daname, 0, 0); ! 2006: ! 2007: itemtoscreen(xbase + 60L + dax1 + xoff, ! 2008: ybase + 25L + yoff, DASLIDER, 0, 0); ! 2009: itemtoscreen(xbase + 60L + dax2 + xoff, ! 2010: ybase + 60L + yoff, DASLIDER, 0, 0); ! 2011: ! 2012: if (playing) { ! 2013: itemtoscreen(xbase + dastuff[5].x + xoff, ! 2014: ybase + dastuff[5].y + yoff, ! 2015: REDSHUFFLE + 1, 0, 0); ! 2016: } ! 2017: if (stoped) { ! 2018: itemtoscreen(xbase + dastuff[6].x + xoff, ! 2019: ybase + dastuff[6].y + yoff, ! 2020: REDSHUFFLE + 2, 0, 0); ! 2021: } ! 2022: if (shuffle) { ! 2023: itemtoscreen(xbase + dastuff[4].x + xoff, ! 2024: ybase + dastuff[4].y + yoff, ! 2025: REDSHUFFLE, 0, 0); ! 2026: } ! 2027: if (track) { ! 2028: itemtoscreen(xbase + dastuff[track].x + xoff, ! 2029: ybase + dastuff[track].y + yoff, ! 2030: REDSHUFFLE + track - 4, 0, 0); ! 2031: ! 2032: if (cnt) { ! 2033: x1 = (long) (((xdim >> 1) - tilesizx[KATIEASS]) >> 1); ! 2034: y1 = (long) (ydim - tilesizy[KATIEASS]); ! 2035: } ! 2036: else { ! 2037: x1 = (long) (((xdim >> 1) - tilesizx[dapic]) >> 1); ! 2038: y1 = (long) (ydim - tilesizy[dapic]); ! 2039: } ! 2040: ! 2041: if (which == 9 && track == 9) { ! 2042: if (totalclock > waittime) { ! 2043: if (cnt) { ! 2044: rotatesprite(xbase + (x1 << 16) + xoff, ! 2045: ybase + ((y1 + cnt) << 16) + yoff, ! 2046: 65536L, 0, KATIEASS + incr, 0, ! 2047: 0, 8 + 16, ! 2048: 0L, 0L, xdim - 1L, ydim - 1L); ! 2049: cnt--; ! 2050: if (cnt % 8 == 0) { ! 2051: incr++; ! 2052: if (incr == 5) { ! 2053: incr = 0; ! 2054: } ! 2055: } ! 2056: } ! 2057: else { ! 2058: rotatesprite(xbase + (x1 << 16) + xoff, ! 2059: ybase + (y1 << 16) + yoff, ! 2060: 65536L, 0, dapic, 0, ! 2061: 0, 8 + 16, ! 2062: 0L, 0L, xdim - 1L, ydim - 1L); ! 2063: } ! 2064: } ! 2065: } ! 2066: ! 2067: if (totalclock > bitchtime) { ! 2068: bitchtime = totalclock + 10L; ! 2069: if (forward) { ! 2070: if (dapic < KATIEAT + 6) { ! 2071: dapic++; ! 2072: } ! 2073: else { ! 2074: forward = 0; ! 2075: } ! 2076: } ! 2077: else { ! 2078: if (dapic == KATIEAT + 2) { ! 2079: forward = 1; ! 2080: dapic = KATIEAT + 2; ! 2081: } ! 2082: else { ! 2083: dapic--; ! 2084: } ! 2085: } ! 2086: } ! 2087: } ! 2088: ! 2089: if (totalclock > goaltime) { ! 2090: goaltime = totalclock + 10L; ! 2091: ! 2092: switch (which) { ! 2093: case 0: ! 2094: musicslider = 1; ! 2095: fxslider = 0; ! 2096: break; ! 2097: case 1: ! 2098: musicslider = 0; ! 2099: fxslider = 1; ! 2100: break; ! 2101: default: ! 2102: musicslider = 0; ! 2103: fxslider = 0; ! 2104: break; ! 2105: } ! 2106: ! 2107: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 2108: which--; ! 2109: if (which == 5 || which == 6) ! 2110: which = 4; ! 2111: if (which < 0) ! 2112: which = 21; ! 2113: } ! 2114: ! 2115: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 2116: which++; ! 2117: if (which == 5 || which == 6) ! 2118: which = 7; ! 2119: if (which > 21) ! 2120: which = 0; ! 2121: } ! 2122: ! 2123: if (fxslider) { ! 2124: if (keystatus[keys[KEYRIGHT]] > 0) { ! 2125: dax2 += 5L; ! 2126: digilevel++; ! 2127: keystatus[keys[KEYRIGHT]] = 0; ! 2128: if (dax2 > 80L) ! 2129: dax2 = 80L; ! 2130: if (digilevel > 16) ! 2131: digilevel = 16; ! 2132: SND_Mixer(0, digilevel); ! 2133: SND_Sound(S_LOUDCHAINWALK); ! 2134: } ! 2135: if (keystatus[keys[KEYLEFT]] > 0) { ! 2136: dax2 -= 5L; ! 2137: digilevel--; ! 2138: keystatus[keys[KEYLEFT]] = 0; ! 2139: if (dax2 < 0L) ! 2140: dax2 = 0L; ! 2141: if (digilevel < 0) ! 2142: digilevel = 0; ! 2143: SND_Mixer(0, digilevel); ! 2144: SND_Sound(S_LOUDCHAINWALK); ! 2145: } ! 2146: } ! 2147: ! 2148: else if (musicslider) { ! 2149: if (keystatus[keys[KEYRIGHT]] > 0) { ! 2150: dax1 += 5L; ! 2151: musiclevel++; ! 2152: keystatus[keys[KEYRIGHT]] = 0; ! 2153: if (dax1 > 80L) ! 2154: dax1 = 80L; ! 2155: if (musiclevel > 16) ! 2156: musiclevel = 16; ! 2157: SND_Mixer(1, musiclevel); ! 2158: } ! 2159: if (keystatus[keys[KEYLEFT]] > 0) { ! 2160: dax1 -= 5L; ! 2161: musiclevel--; ! 2162: keystatus[keys[KEYLEFT]] = 0; ! 2163: if (dax1 < 0L) ! 2164: dax1 = 0L; ! 2165: if (musiclevel < 0) ! 2166: musiclevel = 0; ! 2167: SND_Mixer(1, musiclevel); ! 2168: } ! 2169: } ! 2170: if (keystatus[1] > 0) { ! 2171: exit = 1; ! 2172: } ! 2173: else if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 2174: keystatus[0x1c] = keystatus[0x9c] = 0; ! 2175: switch (which) { ! 2176: case 2: ! 2177: playing = 1; ! 2178: stoped = 0; ! 2179: shuffle = 0; ! 2180: track = 0; ! 2181: break; ! 2182: case 3: ! 2183: playing = 0; ! 2184: stoped = 1; ! 2185: shuffle = 0; ! 2186: track = 0; ! 2187: musicoverride = -1; ! 2188: break; ! 2189: case 4: ! 2190: playing = 0; ! 2191: stoped = 0; ! 2192: shuffle = 1; ! 2193: track = 0; ! 2194: dolevelmusic(rand() % 10); ! 2195: // SND_StartMusic(rand()%25); ! 2196: break; ! 2197: } ! 2198: if (which > 6 && which < 22) { ! 2199: track = which; ! 2200: dolevelmusic(track - 7); ! 2201: forward = 1; ! 2202: // SND_StartMusic(track); ! 2203: if (which != 9) { ! 2204: waittime = totalclock + 720L; ! 2205: cnt = tilesizy[KATIEASS]; ! 2206: } ! 2207: musicoverride = track - 7; ! 2208: } ! 2209: else { ! 2210: track = 0; ! 2211: musicoverride = -1; ! 2212: } ! 2213: } ! 2214: } ! 2215: nextpage(); ! 2216: } ! 2217: ! 2218: } ! 2219: ! 2220: void ! 2221: thecontrols(void) ! 2222: { ! 2223: int i; ! 2224: int exit = 0; ! 2225: int which = 0; ! 2226: long goaltime; ! 2227: int reverse = 0; ! 2228: ! 2229: struct dastuff { ! 2230: long x; ! 2231: long y; ! 2232: short daname; ! 2233: long val; ! 2234: long off; ! 2235: long off2; ! 2236: } dacontrols[14] = {{ ! 2237: 25L, 36L, ZCONTROLS + 1, 0L, 77L, 77L ! 2238: }, ! 2239: { ! 2240: 25L, 52L, ZCONTROLS + 2, 0L, 77L, 77L ! 2241: }, ! 2242: ! 2243: { ! 2244: 22L, 107L, ZCONTROLS + 3, 0L, 99L, 99L ! 2245: }, ! 2246: { ! 2247: 26L, 124L, ZCONTROLS + 4, 0L, 99L, 99L ! 2248: }, ! 2249: { ! 2250: 27L, 138L, ZCONTROLS + 5, 0L, 99L, 99L ! 2251: }, ! 2252: { ! 2253: 28L, 152L, ZCONTROLS + 6, 0L, 99L, 99L ! 2254: }, ! 2255: { ! 2256: 28L, 166L, ZCONTROLS + 7, 0L, 99L, 99L ! 2257: }, ! 2258: { ! 2259: 28L, 180L, ZCONTROLS + 8, 0L, 99L, 99L ! 2260: }, ! 2261: ! 2262: { ! 2263: 177L, 68L, ZCONTROLS + 9, 0L, 255L, 255L ! 2264: }, ! 2265: { ! 2266: 177L, 81L, ZCONTROLS + 10, 0L, 255L, 255L ! 2267: }, ! 2268: { ! 2269: 177L, 95L, ZCONTROLS + 11, 0L, 255L, 255L ! 2270: }, ! 2271: { ! 2272: 178L, 110L, ZCONTROLS + 12, 0L, 255L, 255L ! 2273: }, ! 2274: { ! 2275: 235L, 125L, ZZON, 0L, 255L, 255L ! 2276: }, ! 2277: { ! 2278: 262L, 125L, ZZOFF, 0L, 255L, 255L ! 2279: } ! 2280: }; ! 2281: ! 2282: goaltime = totalclock + 10L; ! 2283: ! 2284: // set the controls values ! 2285: // for the mouse ! 2286: dacontrols[0].val = mousxspeed; ! 2287: dacontrols[1].val = mousyspeed; ! 2288: // for the avenger ! 2289: ! 2290: // for the wingman ! 2291: if (wingmanflag) { ! 2292: dacontrols[8].val = wingmanyawsens; ! 2293: dacontrols[9].val = wingmanpitchsens; ! 2294: dacontrols[10].val = wingmanrollsens; ! 2295: dacontrols[11].val = wingmanzsens; ! 2296: dacontrols[12].val = wingmanzreverse; ! 2297: } ! 2298: ! 2299: ! 2300: // for the mouse ! 2301: dacontrols[0].off2 = dacontrols[0].off + (dacontrols[0].val * 3); ! 2302: dacontrols[1].off2 = dacontrols[1].off + (dacontrols[1].val * 3); ! 2303: // for the avenger ! 2304: ! 2305: // for the wingman ! 2306: if (wingmanflag) { ! 2307: dacontrols[8].off2 = dacontrols[8].off + (dacontrols[8].val * 3); ! 2308: dacontrols[9].off2 = dacontrols[9].off + (dacontrols[9].val * 3); ! 2309: dacontrols[10].off2 = dacontrols[10].off + (dacontrols[10].val * 3); ! 2310: dacontrols[11].off2 = dacontrols[11].off + (dacontrols[11].val * 3); ! 2311: dacontrols[12].off2 = dacontrols[12].off + (dacontrols[12].val * 3); ! 2312: } ! 2313: ! 2314: while (!exit) { ! 2315: permanentwritesprite((xdim>>1)-160L, (ydim>>1)-100L, ! 2316: ZCONTROLS, 0, ! 2317: (xdim>>1)-160L, (ydim>>1)-100L, ! 2318: (xdim>>1)+160L-1L, (ydim>>1)+100L-1L, 0); ! 2319: for (i = 0; i < 14; i++) { ! 2320: if (i == which) { ! 2321: itemtoscreen((xdim>>1)-160L+dacontrols[i].x, ! 2322: (ydim>>1)-100L+dacontrols[i].y, ! 2323: dacontrols[i].daname, 0, 0); ! 2324: } ! 2325: if (i < 12) { ! 2326: itemtoscreen((xdim>>1)-160L+dacontrols[i].off2, ! 2327: (ydim>>1)-100L+dacontrols[i].y, ! 2328: ZZSLIDER, 0, 0); ! 2329: } ! 2330: #if 0 ! 2331: if (reverse == 0) { ! 2332: itemtoscreen(dacontrols[i].x, dacontrols[i].y, ZZON, 0, 0); ! 2333: } ! 2334: else { ! 2335: itemtoscreen(dacontrols[i].x, dacontrols[i].y, ZZOFF, 0, 0); ! 2336: } ! 2337: #endif ! 2338: } ! 2339: nextpage(); ! 2340: if (totalclock > goaltime) { ! 2341: goaltime = totalclock + 10L; ! 2342: if (keystatus[keys[KEYFWD]] > 0 || keystatus[RUP] > 0) { ! 2343: which--; ! 2344: if (which < 0) ! 2345: which = 13; ! 2346: } ! 2347: if (keystatus[keys[KEYBACK]] > 0 || keystatus[RDN] > 0) { ! 2348: which++; ! 2349: if (which > 13) ! 2350: which = 0; ! 2351: } ! 2352: if (which < 12) { ! 2353: if (keystatus[keys[KEYRIGHT]] > 0) { ! 2354: dacontrols[which].val++; ! 2355: keystatus[keys[KEYRIGHT]] = 0; ! 2356: if (dacontrols[which].val > 10) ! 2357: dacontrols[which].val = 10; ! 2358: } ! 2359: if (keystatus[keys[KEYLEFT]] > 0) { ! 2360: dacontrols[which].val--; ! 2361: keystatus[keys[KEYRIGHT]] = 0; ! 2362: if (dacontrols[which].val < 0) ! 2363: dacontrols[which].val = 0; ! 2364: } ! 2365: } ! 2366: else { ! 2367: if (keystatus[keys[KEYRIGHT]] > 0) { ! 2368: reverse = 1; ! 2369: keystatus[keys[KEYRIGHT]] = 0; ! 2370: } ! 2371: if (keystatus[keys[KEYLEFT]] > 0) { ! 2372: reverse = 0; ! 2373: keystatus[keys[KEYRIGHT]] = 0; ! 2374: } ! 2375: } ! 2376: dacontrols[which].off2 = dacontrols[which].off + (dacontrols[which].val * 3); ! 2377: if (keystatus[1] > 0) { ! 2378: exit = 1; ! 2379: } ! 2380: else if (keystatus[0x1c] > 0 || keystatus[0x9c] > 0) { ! 2381: // exit=2; ! 2382: if (which == 12 || which == 13) { ! 2383: ! 2384: } ! 2385: } ! 2386: } ! 2387: } ! 2388: mousxspeed = dacontrols[0].val; ! 2389: mousyspeed = dacontrols[1].val; ! 2390: ! 2391: if (wingmanflag) { ! 2392: wingmanyawsens = dacontrols[8].val; ! 2393: wingmanpitchsens = dacontrols[9].val; ! 2394: wingmanrollsens = dacontrols[10].val; ! 2395: wingmanzsens = dacontrols[11].val; ! 2396: wingmanzreverse = dacontrols[12].val; ! 2397: } ! 2398: ! 2399: ! 2400: } ! 2401: ! 2402: ! 2403: /*************************************************************************** ! 2404: * TEKERR - crirical error handler for TEKWAR * ! 2405: * * ! 2406: * 12/15/94 Jeff S. * ! 2407: ***************************************************************************/ ! 2408: ! 2409: int criterr_flag; ! 2410: ! 2411: int __far ! 2412: cehndlr(unsigned deverr, unsigned errcode, unsigned far * devhdr) ! 2413: { ! 2414: criterr_flag = errcode; ! 2415: return (_HARDERR_IGNORE); ! 2416: } ! 2417: ! 2418: ! 2419: void ! 2420: installcrerrhndlr(void) ! 2421: { ! 2422: _harderr(cehndlr); ! 2423: ! 2424: return; ! 2425: } ! 2426: ! 2427: ! 2428: ! 2429: /*************************************************************************** ! 2430: * screen effects for TEKWAR follow...fades, palette stuff, etc.. * ! 2431: * * ! 2432: * 12/15/94 Jeff S. * ! 2433: ***************************************************************************/ ! 2434: ! 2435: ! 2436: ! 2437: #define MESSIAHRANDOMKEY 215 ! 2438: #define LEDRANDOMKEY 10 ! 2439: ! 2440: char forcemessiah = 0; ! 2441: long messcnt; ! 2442: long ledcnt; ! 2443: char ledflash; ! 2444: char tremors; ! 2445: char dofadein = 0; ! 2446: ! 2447: #define DEADTIME 2 // # minutes of nothing happening ! 2448: #define FLASHINTERVAL 20 ! 2449: ! 2450: long passlock, ! 2451: lastastep, ! 2452: lastbstep, ! 2453: astep, ! 2454: bstep; ! 2455: ! 2456: extern char pee; ! 2457: extern char flashflag; ! 2458: ! 2459: void ! 2460: screenfx(struct player * plr) ! 2461: { ! 2462: ! 2463: updatepaletteshifts(); ! 2464: ! 2465: return; ! 2466: } ! 2467: ! 2468: ! 2469: #define MAXSTRLEN 30 ! 2470: ! 2471: // ! 2472: // (extern asm template) ! 2473: // ! 2474: // extern int near asm_main (int *parmeter1, int parameter2); ! 2475: // Extern must be EXACT prototype. ! 2476: // ! 2477: // #pragma aux asm_main "*_" /* Define the auxilary function. */ \ ! 2478: // parm caller [eax] [ebx] /* Calling parameters. */ \ ! 2479: // value [eax] /* Return value. */ \ ! 2480: // modify [ecx]; // Non parameter registers that will be altered. ! 2481: ! 2482: extern void near asmwaitvrt(int parm1); ! 2483: #pragma aux asmwaitvrt "*_" \ ! 2484: parm caller[ecx] \ ! 2485: modify[eax edx]; ! 2486: ! 2487: extern void near asmsetpalette(char *pal); ! 2488: #pragma aux asmsetpalette "*_" \ ! 2489: parm caller[esi] \ ! 2490: modify[eax ecx edx]; ! 2491: ! 2492: void ! 2493: clearpal(void) ! 2494: { ! 2495: short i; ! 2496: ! 2497: outp(PEL_WRITE_ADR, 0); ! 2498: for (i = 0; i < 768; i++) ! 2499: outp(PEL_DATA, 0x00); ! 2500: ! 2501: return; ! 2502: } ! 2503: ! 2504: ! 2505: char palette1[256][3], ! 2506: palette2[256][3]; ! 2507: ! 2508: void ! 2509: getpalette(char *palette) ! 2510: { ! 2511: int i; ! 2512: ! 2513: outp(PEL_READ_ADR, 0); ! 2514: for (i = 0; i < 768; i++) ! 2515: *palette++ = inp(PEL_DATA); ! 2516: } ! 2517: ! 2518: void ! 2519: fillpalette(int red, int green, int blue) ! 2520: { ! 2521: int i; ! 2522: ! 2523: outp(PEL_WRITE_ADR, 0); ! 2524: for (i = 0; i < 256; i++) { ! 2525: outp(PEL_DATA, red); ! 2526: outp(PEL_DATA, green); ! 2527: outp(PEL_DATA, blue); ! 2528: } ! 2529: } ! 2530: ! 2531: ! 2532: char foggy = 0; ! 2533: ! 2534: void ! 2535: fadeout(int start, int end, int red, int green, int blue, int steps) ! 2536: { ! 2537: int i, ! 2538: j, ! 2539: orig, ! 2540: delta; ! 2541: char *origptr, ! 2542: *newptr; ! 2543: ! 2544: asmwaitvrt(1); ! 2545: getpalette(&palette1[0][0]); ! 2546: memcpy(palette2, palette1, 768); ! 2547: ! 2548: for (i = 0; i < steps; i++) { ! 2549: origptr = &palette1[start][0]; ! 2550: newptr = &palette2[start][0]; ! 2551: for (j = start; j <= end; j++) { ! 2552: orig = *origptr++; ! 2553: delta = red - orig; ! 2554: *newptr++ = orig + delta * i / steps; ! 2555: orig = *origptr++; ! 2556: delta = green - orig; ! 2557: *newptr++ = orig + delta * i / steps; ! 2558: orig = *origptr++; ! 2559: delta = blue - orig; ! 2560: *newptr++ = orig + delta * i / steps; ! 2561: } ! 2562: ! 2563: asmwaitvrt(1); ! 2564: asmsetpalette(&palette2[0][0]); ! 2565: } ! 2566: ! 2567: if (foggy == 0) ! 2568: fillpalette(red, green, blue); ! 2569: ! 2570: return; ! 2571: } ! 2572: ! 2573: ! 2574: void ! 2575: fadein(int start, int end, int steps) ! 2576: { ! 2577: int i, ! 2578: j, ! 2579: delta; ! 2580: ! 2581: if (steps == 0) { ! 2582: return; ! 2583: } ! 2584: ! 2585: asmwaitvrt(1); ! 2586: getpalette(&palette1[0][0]); ! 2587: memcpy(&palette2[0][0], &palette1[0][0], sizeof(palette1)); ! 2588: ! 2589: start *= 3; ! 2590: end = end * 3 + 2; ! 2591: ! 2592: // fade through intermediate frames ! 2593: for (i = 0; i < steps; i++) { ! 2594: for (j = start; j <= end; j++) { ! 2595: delta = palette[j] - palette1[0][j]; ! 2596: palette2[0][j] = palette1[0][j] + delta * i / steps; ! 2597: } ! 2598: ! 2599: asmwaitvrt(1); ! 2600: asmsetpalette(&palette2[0][0]); ! 2601: } ! 2602: ! 2603: // final color ! 2604: asmsetpalette(palette); ! 2605: ! 2606: dofadein = 0; ! 2607: // clearkeys(); ! 2608: } ! 2609: ! 2610: ! 2611: void ! 2612: fog1(void) ! 2613: { ! 2614: if (foggy == 0) { ! 2615: foggy = 1; ! 2616: fadeout(1, 254, 8, 8, 10, 2); ! 2617: } ! 2618: else { ! 2619: foggy = 0; ! 2620: fadein(0, 255, 2); ! 2621: } ! 2622: } ! 2623: ! 2624: ! 2625: void ! 2626: fog2(void) ! 2627: { ! 2628: char *lookptr; ! 2629: ! 2630: lookptr = palookup[0]; ! 2631: palookup[0] = palookup[1]; ! 2632: palookup[1] = lookptr; ! 2633: } ! 2634: ! 2635: void ! 2636: makefxlookups(void) ! 2637: { ! 2638: char palbuf[256]; ! 2639: short i; ! 2640: ! 2641: for (i = 0; i < 256; i++) ! 2642: palbuf[i] = *(palookup[0] + i); ! 2643: ! 2644: // makepalookup(1, palbuf, 60,60,60,1); ! 2645: makepalookup(1, palbuf, 60, 10, 10, 1); ! 2646: } ! 2647: ! 2648: ! 2649: ! 2650: #define NUMWHITESHIFTS 3 ! 2651: #define WHITESTEPS 20 ! 2652: #define WHITETICS 6 ! 2653: ! 2654: #define NUMREDSHIFTS 4 ! 2655: #define REDSTEPS 8 ! 2656: ! 2657: #define NUMGREENSHIFTS 4 ! 2658: #define GREENSTEPS 8 ! 2659: ! 2660: #define NUMBLUESHIFTS 4 ! 2661: #define BLUESTEPS 8 ! 2662: ! 2663: char whiteshifts[NUMREDSHIFTS][768]; ! 2664: char redshifts[NUMREDSHIFTS][768]; ! 2665: char greenshifts[NUMGREENSHIFTS][768]; ! 2666: char blueshifts[NUMBLUESHIFTS][768]; ! 2667: ! 2668: int redcount, ! 2669: whitecount, ! 2670: greencount, ! 2671: bluecount; ! 2672: char palshifted; ! 2673: ! 2674: extern char palette[]; ! 2675: ! 2676: void ! 2677: initpaletteshifts(void) ! 2678: { ! 2679: char *workptr, ! 2680: *baseptr; ! 2681: int i, ! 2682: j, ! 2683: delta; ! 2684: ! 2685: for (i = 1; i <= NUMREDSHIFTS; i++) { ! 2686: workptr = (char *) &redshifts[i - 1][0]; ! 2687: baseptr = &palette[0]; ! 2688: for (j = 0; j <= 255; j++) { ! 2689: delta = 64 - *baseptr; ! 2690: *workptr++ = *baseptr++ + delta * i / REDSTEPS; ! 2691: delta = -*baseptr; ! 2692: *workptr++ = *baseptr++ + delta * i / REDSTEPS; ! 2693: delta = -*baseptr; ! 2694: *workptr++ = *baseptr++ + delta * i / REDSTEPS; ! 2695: } ! 2696: } ! 2697: ! 2698: for (i = 1; i <= NUMWHITESHIFTS; i++) { ! 2699: workptr = (char *) &whiteshifts[i - 1][0]; ! 2700: baseptr = &palette[0]; ! 2701: for (j = 0; j <= 255; j++) { ! 2702: delta = 64 - *baseptr; ! 2703: *workptr++ = *baseptr++ + delta * i / WHITESTEPS; ! 2704: delta = 62 - *baseptr; ! 2705: *workptr++ = *baseptr++ + delta * i / WHITESTEPS; ! 2706: delta = 0 - *baseptr; ! 2707: *workptr++ = *baseptr++ + delta * i / WHITESTEPS; ! 2708: } ! 2709: } ! 2710: ! 2711: for (i = 1; i <= NUMGREENSHIFTS; i++) { ! 2712: workptr = (char *) &greenshifts[i - 1][0]; ! 2713: baseptr = &palette[0]; ! 2714: for (j = 0; j <= 255; j++) { ! 2715: delta = -*baseptr; ! 2716: *workptr++ = *baseptr++ + delta * i / GREENSTEPS; ! 2717: delta = 64 - *baseptr; ! 2718: *workptr++ = *baseptr++ + delta * i / GREENSTEPS; ! 2719: delta = -*baseptr; ! 2720: *workptr++ = *baseptr++ + delta * i / GREENSTEPS; ! 2721: } ! 2722: } ! 2723: ! 2724: for (i = 1; i <= NUMBLUESHIFTS; i++) { ! 2725: workptr = (char *) &blueshifts[i - 1][0]; ! 2726: baseptr = &palette[0]; ! 2727: for (j = 0; j <= 255; j++) { ! 2728: delta = -*baseptr; ! 2729: *workptr++ = *baseptr++ + delta * i / BLUESTEPS; ! 2730: delta = -*baseptr; ! 2731: *workptr++ = *baseptr++ + delta * i / BLUESTEPS; ! 2732: delta = 64 - *baseptr; ! 2733: *workptr++ = *baseptr++ + delta * i / BLUESTEPS; ! 2734: } ! 2735: } ! 2736: ! 2737: ! 2738: return; ! 2739: } ! 2740: ! 2741: void ! 2742: startgreenflash(int greentime) ! 2743: { ! 2744: greencount = 0; ! 2745: ! 2746: NOTFIXED ! 2747: ! 2748: greencount += greentime; ! 2749: ! 2750: if (greencount < 0) { ! 2751: greencount = 0; ! 2752: } ! 2753: ! 2754: } ! 2755: ! 2756: void ! 2757: startblueflash(int bluetime) ! 2758: { ! 2759: bluecount = 0; ! 2760: ! 2761: NOTFIXED ! 2762: ! 2763: bluecount += bluetime; ! 2764: ! 2765: if (bluecount < 0) { ! 2766: bluecount = 0; ! 2767: } ! 2768: ! 2769: } ! 2770: ! 2771: ! 2772: void ! 2773: startredflash(int damage) ! 2774: { ! 2775: ! 2776: ! 2777: redcount = 0; ! 2778: ! 2779: NOTFIXED ! 2780: ! 2781: redcount += damage; ! 2782: ! 2783: if (redcount < 0) { ! 2784: redcount = 0; ! 2785: } ! 2786: } ! 2787: ! 2788: void ! 2789: startwhiteflash(int bonus) ! 2790: { ! 2791: ! 2792: whitecount = 0; ! 2793: ! 2794: NOTFIXED ! 2795: ! 2796: whitecount += bonus; ! 2797: ! 2798: if (whitecount < 0) { ! 2799: whitecount = 0; ! 2800: } ! 2801: ! 2802: } ! 2803: ! 2804: ! 2805: void ! 2806: updatepaletteshifts(void) ! 2807: { ! 2808: int red, ! 2809: white, ! 2810: green, ! 2811: blue; ! 2812: ! 2813: if (whitecount) { ! 2814: white = whitecount / WHITETICS + 1; ! 2815: if (white > NUMWHITESHIFTS) ! 2816: white = NUMWHITESHIFTS; ! 2817: whitecount -= synctics; ! 2818: if (whitecount < 0) ! 2819: whitecount = 0; ! 2820: } ! 2821: else { ! 2822: white = 0; ! 2823: } ! 2824: ! 2825: if (redcount) { ! 2826: red = redcount / 10 + 1; ! 2827: if (red > NUMREDSHIFTS) ! 2828: red = NUMREDSHIFTS; ! 2829: redcount -= synctics; ! 2830: if (redcount < 0) ! 2831: redcount = 0; ! 2832: } ! 2833: else { ! 2834: red = 0; ! 2835: } ! 2836: ! 2837: if (greencount) { ! 2838: green = greencount / 10 + 1; ! 2839: if (green > NUMGREENSHIFTS) ! 2840: green = NUMGREENSHIFTS; ! 2841: greencount -= synctics; ! 2842: if (greencount < 0) ! 2843: greencount = 0; ! 2844: } ! 2845: else { ! 2846: green = 0; ! 2847: } ! 2848: ! 2849: if (bluecount) { ! 2850: blue = bluecount / 10 + 1; ! 2851: if (blue > NUMBLUESHIFTS) ! 2852: blue = NUMBLUESHIFTS; ! 2853: bluecount -= synctics; ! 2854: if (bluecount < 0) ! 2855: bluecount = 0; ! 2856: } ! 2857: else { ! 2858: blue = 0; ! 2859: } ! 2860: ! 2861: if (red) { ! 2862: asmwaitvrt(1); ! 2863: asmsetpalette(redshifts[red - 1]); ! 2864: palshifted = 1; ! 2865: } ! 2866: else if (white) { ! 2867: asmwaitvrt(1); ! 2868: asmsetpalette(whiteshifts[white - 1]); ! 2869: palshifted = 1; ! 2870: } ! 2871: else if (green) { ! 2872: asmwaitvrt(1); ! 2873: asmsetpalette(greenshifts[green - 1]); ! 2874: palshifted = 1; ! 2875: } ! 2876: else if (blue) { ! 2877: asmwaitvrt(1); ! 2878: asmsetpalette(blueshifts[blue - 1]); ! 2879: palshifted = 1; ! 2880: } ! 2881: ! 2882: else if (palshifted) { ! 2883: asmwaitvrt(1); ! 2884: asmsetpalette(&palette[0]); // back to normal ! 2885: // setbrightness(gbrightness); ! 2886: setbrightness(brightness, (char *) &palette[0]); ! 2887: palshifted = 0; ! 2888: } ! 2889: ! 2890: return; ! 2891: } ! 2892: ! 2893: ! 2894: void ! 2895: finishpaletteshifts(void) ! 2896: { ! 2897: if (palshifted == 1) { ! 2898: palshifted = 0; ! 2899: asmwaitvrt(1); ! 2900: asmsetpalette(&palette[0]); ! 2901: } ! 2902: ! 2903: return; ! 2904: } ! 2905: ! 2906: #if 0 ! 2907: void ! 2908: clearkeys(void) ! 2909: { ! 2910: ! 2911: memset(keystatus, 0, sizeof(keystatus)); ! 2912: ! 2913: // return; ! 2914: } ! 2915: #endif ! 2916: ! 2917: ! 2918: //JUST USING THIS FOR NOW ! 2919: void ! 2920: TEMPSND(void) ! 2921: { ! 2922: SND_Sound(rand() % 145); ! 2923: } ! 2924: ! 2925: void ! 2926: cleanup(void) ! 2927: { ! 2928: ! 2929: currweapon = 4; ! 2930: selectedgun = 4; ! 2931: currentpotion = 0; ! 2932: helmettime = -1; ! 2933: shadowtime = -1; ! 2934: nightglowtime = -1; ! 2935: strongtime = -1; ! 2936: invisibletime = -1; ! 2937: manatime = -1; ! 2938: currentorb = 0; ! 2939: currweaponfired = 3; ! 2940: currweaponanim = 0; ! 2941: currweaponattackstyle = 0; ! 2942: currweaponflip = 0; ! 2943: ! 2944: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.