/* F_finale.c */ #include "doomdef.h" #include "soundst.h" #include #ifdef GL_HERETIC #include "gl_struct.h" #endif int finalestage; /* 0 = text, 1 = art screen */ int finalecount; #define TEXTSPEED 3 #define TEXTWAIT 250 char *e1text = E1TEXT; char *e2text = E2TEXT; char *e3text = E3TEXT; char *e4text = E4TEXT; char *e5text = E5TEXT; char *finaletext; char *finaleflat; int FontABaseLump; extern boolean automapactive; extern boolean viewactive; extern void D_StartTitle(void); /* ======================= = = F_StartFinale = ======================= */ void F_StartFinale (void) { gameaction = ga_nothing; gamestate = GS_FINALE; viewactive = false; automapactive = false; players[consoleplayer].messageTics = 1; players[consoleplayer].message = NULL; switch(gameepisode) { case 1: finaleflat = "FLOOR25"; finaletext = e1text; break; case 2: finaleflat = "FLATHUH1"; finaletext = e2text; break; case 3: finaleflat = "FLTWAWA2"; finaletext = e3text; break; case 4: finaleflat = "FLOOR28"; finaletext = e4text; break; case 5: finaleflat = "FLOOR08"; finaletext = e5text; break; } finalestage = 0; finalecount = 0; FontABaseLump = W_GetNumForName("FONTA_S")+1; S_ChangeMusic(mus_cptd, true); } boolean F_Responder (event_t *event) { if(event->type != ev_keydown) { return false; } if(finalestage == 1 && gameepisode == 2) { /* we're showing the water pic, make any key kick to demo mode */ finalestage++; memset(screen, 0, screenwidth*screenheight); I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); return true; } return false; } /* ======================= = = F_Ticker = ======================= */ void F_Ticker (void) { finalecount++; if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT) { finalecount = 0; if(!finalestage) { finalestage = 1; } /* wipegamestate = -1; force a wipe */ /* if (gameepisode == 3) S_StartMusic (mus_bunny); */ } } /* ======================= = = F_TextWrite = ======================= */ /* #include "HU_stuff.h" */ /* extern patch_t *hu_font[HU_FONTSIZE]; */ #ifdef GL_HERETIC extern int GL_DrawLetterA(int x,int y,int lump); #endif void F_TextWrite (void) { #ifndef GL_HERETIC byte *src, *dest; int x,y; #endif int count; char *ch; int c; int cx, cy; #ifndef GL_HERETIC patch_t *w; #else int w; #define MNU_X(x) (int)((float)(x)*screenwidth/320.0f) #define MNU_Y(y) (int)((float)(y)*screenheight/200.0f) #endif /* * erase the entire screen to a tiled background */ #ifndef GL_HERETIC src = W_CacheLumpName(finaleflat, PU_CACHE); dest = screen; for (y=0 ; ywidth) > screenwidth) break; V_DrawPatch(cx, cy, w); cx += SHORT(w->width); #else w=GL_DrawLetterA(MNU_X(cx), MNU_Y(cy), c-33); if (cx+w > screenwidth) break; cx += w-1; #endif } } #if 0 /* ======================= = = F_Cast = ======================= */ void F_Cast (void) { byte *src, *dest; int x,y,w; int count; char *ch; int c; int cx, cy; /* * erase the entire screen to a tiled background */ src = W_CacheLumpName ( "FWATER1" , PU_CACHE); dest = screen; for (y=0 ; ycolumnofs[col])); desttop = screen+x; /* step through the posts in a column */ while (column->topdelta != 0xff ) { source = (byte *)column + 3; dest = desttop + column->topdelta*screenwidth; count = column->length; while (count--) { *dest = *source++; dest += screenwidth; } column = (column_t *)( (byte *)column + column->length+ 4 ); } } /* ================== = = F_DemonScroll = ================== */ void F_DemonScroll(void) /* whether it would work ??? */ { byte *p1, *p2; static int yval = 0; static int nextscroll = 0; if(finalecount < nextscroll) { return; } p1 = W_CacheLumpName("FINAL1", PU_LEVEL); p2 = W_CacheLumpName("FINAL2", PU_LEVEL); if(finalecount < 70) { memcpy(screen, p1, screenheight*screenwidth); nextscroll = finalecount; return; } if(yval < screenwidth*screenheight) { memcpy(screen, p2+screenheight*screenwidth-yval, yval); memcpy(screen+yval, p1, screenheight*screenwidth-yval); yval += screenwidth; nextscroll = finalecount+3; } else { /* else, we'll just sit here and wait, for now */ memcpy(screen, p2, screenwidth*screenheight); } } /* ================== = = F_DrawUnderwater = ================== */ void F_DrawUnderwater(void) { static boolean underwawa; extern boolean MenuActive; extern boolean askforquit; switch(finalestage) { case 1: if(!underwawa) { underwawa = true; memset(screen, 0, screenwidth*screenheight); I_SetPalette(W_CacheLumpName("E2PAL", PU_CACHE)); memcpy(screen, W_CacheLumpName("E2END", PU_CACHE), screenwidth*screenheight); } paused = false; MenuActive = false; askforquit = false; break; case 2: memcpy(screen, W_CacheLumpName("TITLE", PU_CACHE), screenwidth*screenheight); /* D_StartTitle(); go to intro/demo mode. */ } } #if 0 /* ================== = = F_BunnyScroll = ================== */ void F_BunnyScroll (void) { int scrolled, x; patch_t *p1, *p2; char name[10]; int stage; static int laststage; p1 = W_CacheLumpName ("PFUB2", PU_LEVEL); p2 = W_CacheLumpName ("PFUB1", PU_LEVEL); V_MarkRect (0, 0, screenwidth, screenheight); scrolled = 320 - (finalecount-230)/2; if (scrolled > 320) scrolled = 320; if (scrolled < 0) scrolled = 0; for ( x=0 ; x 6) stage = 6; if (stage > laststage) { S_StartSound (NULL, sfx_pistol); laststage = stage; } sprintf (name,"END%i",stage); V_DrawPatch ((screenwidth-13*8)/2, (screenheight-8*8)/2, W_CacheLumpName (name,PU_CACHE)); } #endif /* ======================= = = F_Drawer = ======================= */ void F_Drawer(void) { /* UpdateState |= I_FULLSCRN; */ if (!finalestage) F_TextWrite (); else { switch (gameepisode) { case 1: if(shareware) { #ifndef GL_HERETIC V_DrawRawScreen(W_CacheLumpName("ORDER", PU_CACHE)); #else GLDrawScreenFromName("ORDER"); #endif } else { #ifndef GL_HERETIC V_DrawRawScreen(W_CacheLumpName("CREDIT", PU_CACHE)); #else GLDrawScreenFromName("CREDIT"); #endif } break; case 2: F_DrawUnderwater(); break; case 3: F_DemonScroll(); break; case 4: /* Just show credits screen for extended episodes */ case 5: #ifndef GL_HERETIC V_DrawRawScreen(W_CacheLumpName("CREDIT", PU_CACHE)); #else GLDrawScreenFromName("CREDIT"); #endif break; } } }