📄 f_finale.c
字号:
// Emacs style mode select -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: f_finale.c,v 1.9 2001/04/01 17:35:06 bpereira Exp $//// Copyright (C) 1993-1996 by id Software, Inc.// Portions Copyright (C) 1998-2000 by DooM Legacy Team.//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.////// $Log: f_finale.c,v $// Revision 1.9 2001/04/01 17:35:06 bpereira// no message//// Revision 1.8 2001/03/21 18:24:38 stroggonmeth// Misc changes and fixes. Code cleanup//// Revision 1.7 2001/03/03 11:11:49 hurdler// I hate warnigs ;)//// Revision 1.6 2001/02/24 13:35:19 bpereira// no message//// Revision 1.5 2001/02/10 13:05:45 hurdler// no message//// Revision 1.4 2001/01/25 22:15:41 bpereira// added heretic support//// Revision 1.3 2000/08/03 17:57:41 bpereira// no message//// Revision 1.2 2000/02/27 00:42:10 hurdler// fix CR+LF problem//// Revision 1.1.1.1 2000/02/22 20:32:32 hurdler// Initial import into CVS (v1.29 pr3)////// DESCRIPTION:// Game completion, final screen animation.////-----------------------------------------------------------------------------#include "doomdef.h"#include "doomstat.h"#include "am_map.h"#include "dstrings.h"#include "d_main.h"#include "f_finale.h"#include "g_game.h"#include "hu_stuff.h"#include "r_local.h"#include "s_sound.h"#include "i_video.h"#include "v_video.h"#include "w_wad.h"#include "z_zone.h"#include "p_info.h"// Stage of animation:// 0 = text, 1 = art screen, 2 = character castint finalestage;int finalecount;#define TEXTSPEED 3#define TEXTWAIT 250char* finaletext;char* finaleflat;void F_StartCast (void);void F_CastTicker (void);boolean F_CastResponder (event_t *ev);void F_CastDrawer (void);//// F_StartFinale//void F_StartFinale (void){ gamestate = GS_FINALE; if(info_intertext) { //SoM: Use FS level info intermission. finaletext = info_intertext; if(info_backdrop) finaleflat = info_backdrop; else finaleflat = text[FLOOR4_8_NUM]; CONS_Printf("using intertext from info\n"); finalestage = 0; finalecount = 0; return; } // Okay - IWAD dependend stuff. // This has been changed severly, and // some stuff might have changed in the process. switch ( gamemode ) { // DOOM 1 - E1, E3 or E4, but each nine missions case shareware: case registered: case retail: { S_ChangeMusic(mus_victor, true); switch (gameepisode) { case 1: finaleflat = text[FLOOR4_8_NUM]; finaletext = E1TEXT; break; case 2: finaleflat = text[SFLR6_1_NUM]; finaletext = E2TEXT; break; case 3: finaleflat = text[MFLR8_4_NUM]; finaletext = E3TEXT; break; case 4: finaleflat = text[MFLR8_3_NUM]; finaletext = E4TEXT; break; default: // Ouch. break; } break; } // DOOM II and missions packs with E1, M34 case commercial: { S_ChangeMusic(mus_read_m, true); switch (gamemap) { case 6: finaleflat = text[SLIME16_NUM]; finaletext = C1TEXT; break; case 11: finaleflat = text[RROCK14_NUM]; finaletext = C2TEXT; break; case 20: finaleflat = text[RROCK07_NUM]; finaletext = C3TEXT; break; case 30: finaleflat = text[RROCK17_NUM]; finaletext = C4TEXT; break; case 15: finaleflat = text[RROCK13_NUM]; finaletext = C5TEXT; break; case 31: finaleflat = text[RROCK19_NUM]; finaletext = C6TEXT; break; default: // Ouch. break; } break; } case heretic : S_ChangeMusic(mus_hcptd, true); switch(gameepisode) { case 1: finaleflat = "FLOOR25"; finaletext = text[HERETIC_E1TEXT]; break; case 2: finaleflat = "FLATHUH1"; finaletext = text[HERETIC_E2TEXT]; break; case 3: finaleflat = "FLTWAWA2"; finaletext = text[HERETIC_E3TEXT]; break; case 4: finaleflat = "FLOOR28"; finaletext = text[HERETIC_E4TEXT]; break; case 5: finaleflat = "FLOOR08"; finaletext = text[HERETIC_E5TEXT]; break; } break; // Indeterminate. default: S_ChangeMusic(mus_read_m, true); finaleflat = "F_SKY1"; // Not used anywhere else. finaletext = C1TEXT; // FIXME - other text, music? break; } finalestage = 0; finalecount = 0;}boolean F_Responder (event_t *event){ if (finalestage == 2) return F_CastResponder (event); return false;}//// F_Ticker//void F_Ticker (void){ int i; // check for skipping if ( (gamemode == commercial) && ( finalecount > 50) ) { // go on to the next level for (i=0 ; i<MAXPLAYERS ; i++) if (players[i].cmd.buttons) break; if (i < MAXPLAYERS) { if (gamemap == 30) F_StartCast (); else { gameaction = ga_worlddone; finalecount = MININT; // wait until map is lunched } } } // advance animation finalecount++; if (finalestage == 2) { F_CastTicker (); return; } if ( gamemode == commercial) return; if (!finalestage && (unsigned)finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT) { finalecount = 0; finalestage = 1; wipegamestate = -1; // force a wipe if (gameepisode == 3) S_StartMusic (mus_bunny); }}//// F_TextWrite//void F_TextWrite (void){ int w; int count; char* ch; int c; int cx; int cy; // erase the entire screen to a tiled background V_DrawFlatFill(0,0,vid.width,vid.height,W_GetNumForName(finaleflat)); V_MarkRect (0, 0, vid.width, vid.height); // draw some of the text onto the screen if( raven ) { cx = 20; cy = 5; } else { cx = 10; cy = 10; } ch = finaletext; count = (finalecount - 10)/TEXTSPEED; if (count < 0) count = 0; for ( ; count ; count-- ) { c = *ch++; if (!c) break; if (c == '\n') { cx = raven ? 20 : 10; cy += raven ? 9 : 11; continue; } c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { cx += 4; continue; } w = (hu_font[c]->width); if (cx+w > vid.width) break; V_DrawPatch(cx, cy, 0, hu_font[c]); cx+=w; }}//// Final DOOM 2 animation// Casting by id Software.// in order of appearance//typedef struct{ char *name; mobjtype_t type;} castinfo_t;castinfo_t castorder[] = { {NULL, MT_POSSESSED}, {NULL, MT_SHOTGUY}, {NULL, MT_CHAINGUY}, {NULL, MT_TROOP}, {NULL, MT_SERGEANT}, {NULL, MT_SKULL}, {NULL, MT_HEAD}, {NULL, MT_KNIGHT}, {NULL, MT_BRUISER}, {NULL, MT_BABY}, {NULL, MT_PAIN}, {NULL, MT_UNDEAD}, {NULL, MT_FATSO}, {NULL, MT_VILE}, {NULL, MT_SPIDER}, {NULL, MT_CYBORG}, {NULL, MT_PLAYER}, {NULL,0}};int castnum;int casttics;state_t* caststate;boolean castdeath;int castframes;int castonmelee;boolean castattacking;//// F_StartCast//void F_StartCast (void){ int i; for(i=0;i<17;i++) castorder[i].name = text[CC_ZOMBIE_NUM+i]; wipegamestate = -1; // force a screen wipe castnum = 0; caststate = &states[mobjinfo[castorder[castnum].type].seestate]; casttics = caststate->tics; castdeath = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -