⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wi_stuff.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 4 页
字号:
// Emacs style mode select   -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: wi_stuff.c,v 1.11 2001/03/03 06:17:34 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: wi_stuff.c,v $// Revision 1.11  2001/03/03 06:17:34  bpereira// no message//// Revision 1.10  2001/02/24 13:35:21  bpereira// no message//// Revision 1.9  2001/02/10 12:27:14  bpereira// no message//// Revision 1.8  2001/01/27 11:02:36  bpereira// no message//// Revision 1.7  2001/01/25 22:15:44  bpereira// added heretic support//// Revision 1.6  2000/11/02 17:50:10  stroggonmeth// Big 3Dfloors & FraggleScript commit!!//// Revision 1.5  2000/09/21 16:45:09  bpereira// no message//// Revision 1.4  2000/08/31 14:30:56  bpereira// no message//// Revision 1.3  2000/04/16 18:38:07  bpereira// no message//// Revision 1.2  2000/02/27 00:42:11  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://      Intermission screens.////-----------------------------------------------------------------------------#include "doomdef.h"#include "wi_stuff.h"#include "g_game.h"#include "hu_stuff.h"#include "m_random.h"#include "r_local.h"#include "s_sound.h"#include "st_stuff.h"#include "i_video.h"#include "v_video.h"#include "z_zone.h"#include "console.h"#include "p_info.h"//// Data needed to add patches to full screen intermission pics.// Patches are statistics messages, and animations.// Loads of by-pixel layout and placement, offsets etc.////// Different vetween registered DOOM (1994) and//  Ultimate DOOM - Final edition (retail, 1995?).// This is supposedly ignored for commercial//  release (aka DOOM II), which had 34 maps//  in one episode. So there.#define NUMEPISODES     4#define NUMMAPS         9// GLOBAL LOCATIONS#define WI_TITLEY               2#define WI_SPACINGY             16 //TODO: was 33// SINGPLE-PLAYER STUFF#define SP_STATSX               50#define SP_STATSY               50#define SP_TIMEX                16#define SP_TIMEY                (BASEVIDHEIGHT-32)// NET GAME STUFF#define NG_STATSY               50#define NG_STATSX               (32 + SHORT(star->width)/2 + 32*!dofrags)#define NG_SPACINGX             64// DEATHMATCH STUFF#define DM_MATRIXX              16#define DM_MATRIXY              24#define DM_SPACINGX             32#define DM_TOTALSX              269#define DM_KILLERSX             0#define DM_KILLERSY             100#define DM_VICTIMSX             5#define DM_VICTIMSY             50// in sec#define DM_WAIT                 20typedef enum{    ANIM_ALWAYS,    ANIM_RANDOM,    ANIM_LEVEL} animenum_t;typedef struct{    int         x;    int         y;} point_t;//// Animation.// There is another anim_t used in p_spec.//typedef struct{    animenum_t  type;    // period in tics between animations    int         period;    // number of animation frames    int         nanims;    // location of animation    point_t     loc;    // ALWAYS: n/a,    // RANDOM: period deviation (<256),    // LEVEL: level    int         data1;    // ALWAYS: n/a,    // RANDOM: random base period,    // LEVEL: n/a    int         data2;    // actual graphics for frames of animations    patch_t*    p[3];    // following must be initialized to zero before use!    // next value of bcnt (used in conjunction with period)    int         nexttic;    // last drawn animation frame    int         lastdrawn;    // next frame number to animate    int         ctr;    // used by RANDOM and LEVEL when animating    int         state;} anim_t;static point_t doomlnodes[NUMEPISODES][NUMMAPS] ={    // Episode 0 World Map    {        { 185, 164 },   // location of level 0 (CJ)        { 148, 143 },   // location of level 1 (CJ)        { 69, 122 },    // location of level 2 (CJ)        { 209, 102 },   // location of level 3 (CJ)        { 116, 89 },    // location of level 4 (CJ)        { 166, 55 },    // location of level 5 (CJ)        { 71, 56 },     // location of level 6 (CJ)        { 135, 29 },    // location of level 7 (CJ)        { 71, 24 }      // location of level 8 (CJ)    },    // Episode 1 World Map should go here    {        { 254, 25 },    // location of level 0 (CJ)        { 97, 50 },     // location of level 1 (CJ)        { 188, 64 },    // location of level 2 (CJ)        { 128, 78 },    // location of level 3 (CJ)        { 214, 92 },    // location of level 4 (CJ)        { 133, 130 },   // location of level 5 (CJ)        { 208, 136 },   // location of level 6 (CJ)        { 148, 140 },   // location of level 7 (CJ)        { 235, 158 }    // location of level 8 (CJ)    },    // Episode 2 World Map should go here    {        { 156, 168 },   // location of level 0 (CJ)        { 48, 154 },    // location of level 1 (CJ)        { 174, 95 },    // location of level 2 (CJ)        { 265, 75 },    // location of level 3 (CJ)        { 130, 48 },    // location of level 4 (CJ)        { 279, 23 },    // location of level 5 (CJ)        { 198, 48 },    // location of level 6 (CJ)        { 140, 25 },    // location of level 7 (CJ)        { 281, 136 }    // location of level 8 (CJ)    }};static point_t YAHspot[3][9] ={    {        { 172, 78 },        { 86, 90 },        { 73, 66 },        { 159, 95 },        { 148, 126 },        { 132, 54 },        { 131, 74 },        { 208, 138 },        { 52, 101 }    },    {        { 218, 57 },        { 137, 81 },        { 155, 124 },        { 171, 68 },        { 250, 86 },        { 136, 98 },        { 203, 90 },        { 220, 140 },        { 279, 106 }    },    {        { 86, 99 },        { 124, 103 },        { 154, 79 },        { 202, 83 },        { 178, 59 },        { 142, 58 },        { 219, 66 },        { 247, 57 },        { 107, 80 }    }};//// Animation locations for episode 0 (1).// Using patches saves a lot of space,//  as they replace 320x200 full screen frames.//static anim_t epsd0animinfo[] ={    { ANIM_ALWAYS, TICRATE/3, 3, { 224, 104 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 184, 160 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 112, 136 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 72, 112 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 88, 96 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 64, 48 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 192, 40 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 136, 16 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 80, 16 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 64, 24 } }};static anim_t epsd1animinfo[] ={    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 1 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 2 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 3 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 4 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 5 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 6 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 7 },    { ANIM_LEVEL, TICRATE/3, 3, { 192, 144 }, 8 },    { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 8 }};static anim_t epsd2animinfo[] ={    { ANIM_ALWAYS, TICRATE/3, 3, { 104, 168 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 40, 136 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 160, 96 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 104, 80 } },    { ANIM_ALWAYS, TICRATE/3, 3, { 120, 32 } },    { ANIM_ALWAYS, TICRATE/4, 3, { 40, 0 } }};static int NUMANIMS[NUMEPISODES] ={    sizeof(epsd0animinfo)/sizeof(anim_t),    sizeof(epsd1animinfo)/sizeof(anim_t),    sizeof(epsd2animinfo)/sizeof(anim_t)};static anim_t *anims[NUMEPISODES] ={    epsd0animinfo,    epsd1animinfo,    epsd2animinfo};//// GENERAL DATA////// Locally used stuff.//#define FB 0// States for the intermissiontypedef enum{    NoState = -1,    StatCount,    ShowNextLoc} stateenum_t;// States for single-player#define SP_KILLS                0#define SP_ITEMS                2#define SP_SECRET               4#define SP_FRAGS                6#define SP_TIME                 8#define SP_PAR                  ST_TIME#define SP_PAUSE                1// in seconds#define SHOWNEXTLOCDELAY        4//#define SHOWLASTLOCDELAY      SHOWNEXTLOCDELAY// used to accelerate or skip a stagestatic int              acceleratestage;// wbs->pnumstatic int              me; // specifies current statestatic stateenum_t      state;// contains information passed into intermissionstatic wbstartstruct_t* wbs;static wbplayerstruct_t* plrs;  // wbs->plyr[]// used for general timingstatic int              cnt;// used for timing of background animationstatic int              bcnt;// signals to refresh everything for one framestatic int              firstrefresh;static int              cnt_kills[MAXPLAYERS];static int              cnt_items[MAXPLAYERS];static int              cnt_secret[MAXPLAYERS];static int              cnt_time;static int              cnt_par;static int              cnt_pause;// # of commercial levelsstatic int              NUMCMAPS;////      GRAPHICS//// background (map of levels).//static patch_t*       bg;static char             bgname[9];// You Are Here graphicstatic patch_t*         yah[2];// splatstatic patch_t*         splat;// %, : graphicsstatic patch_t*         percent;static patch_t*         colon;// 0-9 graphicstatic patch_t*         num[10];// minus signstatic patch_t*         wiminus;// "Finished!" graphicsstatic patch_t*         finished;// "Entering" graphicstatic patch_t*         entering;// "secret"static patch_t*         sp_secret; // "Kills", "Scrt", "Items", "Frags"static patch_t*         kills;static patch_t*         secret;static patch_t*         items;static patch_t*         frags;// Time sucks.static patch_t*         timePatch;static patch_t*         par;static patch_t*         sucks;// "killers", "victims"static patch_t*         killers;static patch_t*         victims;// "Total", your face, your dead facestatic patch_t*         total;static patch_t*         star;static patch_t*         bstar;//added:08-02-98: use STPB0 for all players, but translate the colorsstatic patch_t*         stpb;// Name graphics of each level (centered)static patch_t**        lnames;//// CODE//// slam background// UNUSED static unsigned char *background=0;static void WI_slamBackground(void){    if( gamemode == heretic && state == StatCount)        V_DrawFlatFill( 0, 0, vid.width/vid.dupx, vid.height/vid.dupy, W_CheckNumForName("FLOOR16"));    else    if (rendermode==render_soft)     {        memcpy(screens[0], screens[1], vid.width * vid.height);        V_MarkRect (0, 0, vid.width, vid.height);    }    else         V_DrawScaledPatch(0, 0, 1+V_NOSCALESTART, W_CachePatchName(bgname, PU_CACHE));}// The ticker is used to detect keys//  because of timing issues in netgames.boolean WI_Responder(event_t* ev){    return false;}// Draws "<Levelname> Finished!"static void WI_drawLF(void){    int y = WI_TITLEY;    // draw <LevelName>    if( FontBBaseLump )    {        V_DrawTextB(P_LevelName(), (BASEVIDWIDTH - V_TextBWidth(P_LevelName()))/2, y);        y += (5*V_TextBHeight(P_LevelName()))/4;        V_DrawTextB("Finished", (BASEVIDWIDTH - V_TextBWidth("Finished"))/2, y);    }    else    {        V_DrawScaledPatch ((BASEVIDWIDTH - (lnames[wbs->last]->width))/2,                            y, FB, lnames[wbs->last]);        y += (5*(lnames[wbs->last]->height))/4;        // draw "Finished!"        V_DrawScaledPatch ((BASEVIDWIDTH - (finished->width))/2,                            y, FB, finished);    }}// Draws "Entering <LevelName>"static void WI_drawEL(void){    int y = WI_TITLEY;    // draw "Entering"    if( FontBBaseLump )    {        V_DrawTextB("Entering", (BASEVIDWIDTH - V_TextBWidth("Entering"))/2, y);        y += (5*V_TextBHeight("Entering"))/4;        V_DrawTextB(P_LevelName(), (BASEVIDWIDTH - V_TextBWidth(P_LevelName()))/2, y);    }    else    {        V_DrawScaledPatch((BASEVIDWIDTH - (entering->width))/2,                          y, FB, entering);        // draw level        y += (5*SHORT(lnames[wbs->next]->height))/4;        V_DrawScaledPatch((BASEVIDWIDTH - (lnames[wbs->next]->width))/2,                           y, FB, lnames[wbs->next]);    }}static void WI_drawOnLnode ( int           n,                             patch_t*      c[] ){    int         i;    int         left;    int         top;    int         right;    int         bottom;    boolean     fits = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -