|
|
1.1 ! root 1: // F_finale.c ! 2: ! 3: #include "DoomDef.h" ! 4: #include "soundst.h" ! 5: #include <ctype.h> ! 6: ! 7: int finalestage; // 0 = text, 1 = art screen ! 8: int finalecount; ! 9: ! 10: #define TEXTSPEED 3 ! 11: #define TEXTWAIT 250 ! 12: ! 13: char *e1text = E1TEXT; ! 14: char *e2text = E2TEXT; ! 15: char *e3text = E3TEXT; ! 16: char *e4text = E4TEXT; ! 17: char *e5text = E5TEXT; ! 18: char *finaletext; ! 19: char *finaleflat; ! 20: ! 21: int FontABaseLump; ! 22: ! 23: extern boolean automapactive; ! 24: extern boolean viewactive; ! 25: ! 26: extern void D_StartTitle(void); ! 27: ! 28: /* ! 29: ======================= ! 30: = ! 31: = F_StartFinale ! 32: = ! 33: ======================= ! 34: */ ! 35: ! 36: void F_StartFinale (void) ! 37: { ! 38: gameaction = ga_nothing; ! 39: gamestate = GS_FINALE; ! 40: viewactive = false; ! 41: automapactive = false; ! 42: players[consoleplayer].messageTics = 1; ! 43: players[consoleplayer].message = NULL; ! 44: ! 45: switch(gameepisode) ! 46: { ! 47: case 1: ! 48: finaleflat = "FLOOR25"; ! 49: finaletext = e1text; ! 50: break; ! 51: case 2: ! 52: finaleflat = "FLATHUH1"; ! 53: finaletext = e2text; ! 54: break; ! 55: case 3: ! 56: finaleflat = "FLTWAWA2"; ! 57: finaletext = e3text; ! 58: break; ! 59: case 4: ! 60: finaleflat = "FLOOR28"; ! 61: finaletext = e4text; ! 62: break; ! 63: case 5: ! 64: finaleflat = "FLOOR08"; ! 65: finaletext = e5text; ! 66: break; ! 67: } ! 68: ! 69: finalestage = 0; ! 70: finalecount = 0; ! 71: FontABaseLump = W_GetNumForName("FONTA_S")+1; ! 72: ! 73: // S_ChangeMusic(mus_victor, true); ! 74: S_StartSong(mus_cptd, true); ! 75: } ! 76: ! 77: ! 78: ! 79: boolean F_Responder (event_t *event) ! 80: { ! 81: if(event->type != ev_keydown) ! 82: { ! 83: return false; ! 84: } ! 85: if(finalestage == 1 && gameepisode == 2) ! 86: { // we're showing the water pic, make any key kick to demo mode ! 87: finalestage++; ! 88: memset((byte *)0xa0000, 0, SCREENWIDTH*SCREENHEIGHT); ! 89: memset(screen, 0, SCREENWIDTH*SCREENHEIGHT); ! 90: I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); ! 91: return true; ! 92: } ! 93: return false; ! 94: } ! 95: ! 96: ! 97: /* ! 98: ======================= ! 99: = ! 100: = F_Ticker ! 101: = ! 102: ======================= ! 103: */ ! 104: ! 105: void F_Ticker (void) ! 106: { ! 107: finalecount++; ! 108: if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT) ! 109: { ! 110: finalecount = 0; ! 111: if(!finalestage) ! 112: { ! 113: finalestage = 1; ! 114: } ! 115: ! 116: // wipegamestate = -1; // force a wipe ! 117: /* ! 118: if (gameepisode == 3) ! 119: S_StartMusic (mus_bunny); ! 120: */ ! 121: } ! 122: } ! 123: ! 124: ! 125: /* ! 126: ======================= ! 127: = ! 128: = F_TextWrite ! 129: = ! 130: ======================= ! 131: */ ! 132: ! 133: //#include "HU_stuff.h" ! 134: //extern patch_t *hu_font[HU_FONTSIZE]; ! 135: ! 136: void F_TextWrite (void) ! 137: { ! 138: byte *src, *dest; ! 139: int x,y; ! 140: int count; ! 141: char *ch; ! 142: int c; ! 143: int cx, cy; ! 144: patch_t *w; ! 145: ! 146: // ! 147: // erase the entire screen to a tiled background ! 148: // ! 149: src = W_CacheLumpName(finaleflat, PU_CACHE); ! 150: dest = screen; ! 151: for (y=0 ; y<SCREENHEIGHT ; y++) ! 152: { ! 153: for (x=0 ; x<SCREENWIDTH/64 ; x++) ! 154: { ! 155: memcpy (dest, src+((y&63)<<6), 64); ! 156: dest += 64; ! 157: } ! 158: if (SCREENWIDTH&63) ! 159: { ! 160: memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63); ! 161: dest += (SCREENWIDTH&63); ! 162: } ! 163: } ! 164: ! 165: // V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); ! 166: ! 167: // ! 168: // draw some of the text onto the screen ! 169: // ! 170: cx = 20; ! 171: cy = 5; ! 172: ch = finaletext; ! 173: ! 174: count = (finalecount - 10)/TEXTSPEED; ! 175: if (count < 0) ! 176: count = 0; ! 177: for ( ; count ; count-- ) ! 178: { ! 179: c = *ch++; ! 180: if (!c) ! 181: break; ! 182: if (c == '\n') ! 183: { ! 184: cx = 20; ! 185: cy += 9; ! 186: continue; ! 187: } ! 188: ! 189: c = toupper(c); ! 190: if (c < 33) ! 191: { ! 192: cx += 5; ! 193: continue; ! 194: } ! 195: ! 196: w = W_CacheLumpNum(FontABaseLump+c-33, PU_CACHE); ! 197: if (cx+w->width > SCREENWIDTH) ! 198: break; ! 199: V_DrawPatch(cx, cy, w); ! 200: cx += w->width; ! 201: } ! 202: ! 203: } ! 204: ! 205: ! 206: #if 0 ! 207: /* ! 208: ======================= ! 209: = ! 210: = F_Cast ! 211: = ! 212: ======================= ! 213: */ ! 214: ! 215: void F_Cast (void) ! 216: { ! 217: byte *src, *dest; ! 218: int x,y,w; ! 219: int count; ! 220: char *ch; ! 221: int c; ! 222: int cx, cy; ! 223: ! 224: // ! 225: // erase the entire screen to a tiled background ! 226: // ! 227: src = W_CacheLumpName ( "FWATER1" , PU_CACHE); ! 228: dest = screen; ! 229: ! 230: for (y=0 ; y<SCREENHEIGHT ; y++) ! 231: { ! 232: for (x=0 ; x<SCREENWIDTH/64 ; x++) ! 233: { ! 234: memcpy (dest, src+((y&63)<<6), 64); ! 235: dest += 64; ! 236: } ! 237: if (SCREENWIDTH&63) ! 238: { ! 239: memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63); ! 240: dest += (SCREENWIDTH&63); ! 241: } ! 242: } ! 243: ! 244: V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); ! 245: ! 246: V_DrawPatch (105,21,0, W_CacheLumpName ( " ! 247: } ! 248: #endif ! 249: ! 250: ! 251: void F_DrawPatchCol (int x, patch_t *patch, int col) ! 252: { ! 253: column_t *column; ! 254: byte *source, *dest, *desttop; ! 255: int count; ! 256: ! 257: column = (column_t *)((byte *)patch + LONG(patch->columnofs[col])); ! 258: desttop = screen+x; ! 259: ! 260: // step through the posts in a column ! 261: ! 262: while (column->topdelta != 0xff ) ! 263: { ! 264: source = (byte *)column + 3; ! 265: dest = desttop + column->topdelta*SCREENWIDTH; ! 266: count = column->length; ! 267: ! 268: while (count--) ! 269: { ! 270: *dest = *source++; ! 271: dest += SCREENWIDTH; ! 272: } ! 273: column = (column_t *)( (byte *)column + column->length+ 4 ); ! 274: } ! 275: } ! 276: ! 277: /* ! 278: ================== ! 279: = ! 280: = F_DemonScroll ! 281: = ! 282: ================== ! 283: */ ! 284: ! 285: void F_DemonScroll(void) ! 286: { ! 287: byte *p1, *p2; ! 288: static int yval = 0; ! 289: static int nextscroll = 0; ! 290: ! 291: if(finalecount < nextscroll) ! 292: { ! 293: return; ! 294: } ! 295: p1 = W_CacheLumpName("FINAL1", PU_LEVEL); ! 296: p2 = W_CacheLumpName("FINAL2", PU_LEVEL); ! 297: if(finalecount < 70) ! 298: { ! 299: memcpy(screen, p1, SCREENHEIGHT*SCREENWIDTH); ! 300: nextscroll = finalecount; ! 301: return; ! 302: } ! 303: if(yval < 64000) ! 304: { ! 305: memcpy(screen, p2+SCREENHEIGHT*SCREENWIDTH-yval, yval); ! 306: memcpy(screen+yval, p1, SCREENHEIGHT*SCREENWIDTH-yval); ! 307: yval += SCREENWIDTH; ! 308: nextscroll = finalecount+3; ! 309: } ! 310: else ! 311: { //else, we'll just sit here and wait, for now ! 312: memcpy(screen, p2, SCREENWIDTH*SCREENHEIGHT); ! 313: } ! 314: } ! 315: ! 316: /* ! 317: ================== ! 318: = ! 319: = F_DrawUnderwater ! 320: = ! 321: ================== ! 322: */ ! 323: ! 324: void F_DrawUnderwater(void) ! 325: { ! 326: static boolean underwawa; ! 327: extern boolean MenuActive; ! 328: extern boolean askforquit; ! 329: ! 330: switch(finalestage) ! 331: { ! 332: case 1: ! 333: if(!underwawa) ! 334: { ! 335: underwawa = true; ! 336: memset((byte *)0xa0000, 0, SCREENWIDTH*SCREENHEIGHT); ! 337: I_SetPalette(W_CacheLumpName("E2PAL", PU_CACHE)); ! 338: memcpy(screen, W_CacheLumpName("E2END", PU_CACHE), ! 339: SCREENWIDTH*SCREENHEIGHT); ! 340: } ! 341: paused = false; ! 342: MenuActive = false; ! 343: askforquit = false; ! 344: ! 345: break; ! 346: case 2: ! 347: memcpy(screen, W_CacheLumpName("TITLE", PU_CACHE), ! 348: SCREENWIDTH*SCREENHEIGHT); ! 349: //D_StartTitle(); // go to intro/demo mode. ! 350: } ! 351: } ! 352: ! 353: ! 354: #if 0 ! 355: /* ! 356: ================== ! 357: = ! 358: = F_BunnyScroll ! 359: = ! 360: ================== ! 361: */ ! 362: ! 363: void F_BunnyScroll (void) ! 364: { ! 365: int scrolled, x; ! 366: patch_t *p1, *p2; ! 367: char name[10]; ! 368: int stage; ! 369: static int laststage; ! 370: ! 371: p1 = W_CacheLumpName ("PFUB2", PU_LEVEL); ! 372: p2 = W_CacheLumpName ("PFUB1", PU_LEVEL); ! 373: ! 374: V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); ! 375: ! 376: scrolled = 320 - (finalecount-230)/2; ! 377: if (scrolled > 320) ! 378: scrolled = 320; ! 379: if (scrolled < 0) ! 380: scrolled = 0; ! 381: ! 382: for ( x=0 ; x<SCREENWIDTH ; x++) ! 383: { ! 384: if (x+scrolled < 320) ! 385: F_DrawPatchCol (x, p1, x+scrolled); ! 386: else ! 387: F_DrawPatchCol (x, p2, x+scrolled - 320); ! 388: } ! 389: ! 390: if (finalecount < 1130) ! 391: return; ! 392: if (finalecount < 1180) ! 393: { ! 394: V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName ("END0",PU_CACHE)); ! 395: laststage = 0; ! 396: return; ! 397: } ! 398: ! 399: stage = (finalecount-1180) / 5; ! 400: if (stage > 6) ! 401: stage = 6; ! 402: if (stage > laststage) ! 403: { ! 404: S_StartSound (NULL, sfx_pistol); ! 405: laststage = stage; ! 406: } ! 407: ! 408: sprintf (name,"END%i",stage); ! 409: V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2, W_CacheLumpName (name,PU_CACHE)); ! 410: } ! 411: #endif ! 412: ! 413: /* ! 414: ======================= ! 415: = ! 416: = F_Drawer ! 417: = ! 418: ======================= ! 419: */ ! 420: ! 421: void F_Drawer(void) ! 422: { ! 423: UpdateState |= I_FULLSCRN; ! 424: if (!finalestage) ! 425: F_TextWrite (); ! 426: else ! 427: { ! 428: switch (gameepisode) ! 429: { ! 430: case 1: ! 431: if(shareware) ! 432: { ! 433: V_DrawRawScreen(W_CacheLumpName("ORDER", PU_CACHE)); ! 434: } ! 435: else ! 436: { ! 437: V_DrawRawScreen(W_CacheLumpName("CREDIT", PU_CACHE)); ! 438: } ! 439: break; ! 440: case 2: ! 441: F_DrawUnderwater(); ! 442: break; ! 443: case 3: ! 444: F_DemonScroll(); ! 445: break; ! 446: case 4: // Just show credits screen for extended episodes ! 447: case 5: ! 448: V_DrawRawScreen(W_CacheLumpName("CREDIT", PU_CACHE)); ! 449: break; ! 450: } ! 451: } ! 452: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.