| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Intermission screens. |
| 31 |
* |
| 32 |
*----------------------------------------------------------------------------- |
| 33 |
*/ |
| 34 |
|
| 35 |
#include "doomstat.h" |
| 36 |
#include "m_random.h" |
| 37 |
#include "w_wad.h" |
| 38 |
#include "f_finale.h" |
| 39 |
#include "g_game.h" |
| 40 |
#include "r_main.h" |
| 41 |
#include "v_video.h" |
| 42 |
#include "wi_stuff.h" |
| 43 |
#include "s_sound.h" |
| 44 |
#include "sounds.h" |
| 45 |
#include "lprintf.h" // jff 08/03/98 - declaration of lprintf |
| 46 |
#include "r_draw.h" |
| 47 |
#include "hu_stuff.h" |
| 48 |
|
| 49 |
#include "dsda/exhud.h" |
| 50 |
#include "dsda/font.h" |
| 51 |
#include "dsda/mapinfo.h" |
| 52 |
|
| 53 |
#include "heretic/in_lude.h" |
| 54 |
#include "hexen/in_lude.h" |
| 55 |
|
| 56 |
// Ty 03/17/98: flag that new par times have been loaded in d_deh |
| 57 |
extern dboolean deh_pars; |
| 58 |
|
| 59 |
// |
| 60 |
// Data needed to add patches to full screen intermission pics. |
| 61 |
// Patches are statistics messages, and animations. |
| 62 |
// Loads of by-pixel layout and placement, offsets etc. |
| 63 |
// |
| 64 |
|
| 65 |
// |
| 66 |
// Different vetween registered DOOM (1994) and |
| 67 |
// Ultimate DOOM - Final edition (retail, 1995?). |
| 68 |
// This is supposedly ignored for commercial |
| 69 |
// release (aka DOOM II), which had 34 maps |
| 70 |
// in one episode. So there. |
| 71 |
#define NUMEPISODES 4 |
| 72 |
#define NUMMAPS 9 |
| 73 |
|
| 74 |
|
| 75 |
// Not used |
| 76 |
// in tics |
| 77 |
//U #define PAUSELEN (TICRATE*2) |
| 78 |
//U #define SCORESTEP 100 |
| 79 |
//U #define ANIMPERIOD 32 |
| 80 |
// pixel distance from "(YOU)" to "PLAYER N" |
| 81 |
//U #define STARDIST 10 |
| 82 |
//U #define WK 1 |
| 83 |
|
| 84 |
|
| 85 |
// GLOBAL LOCATIONS |
| 86 |
#define WI_TITLEY 2 |
| 87 |
#define WI_SPACINGY 33 |
| 88 |
|
| 89 |
// SINGLE-PLAYER STUFF |
| 90 |
#define SP_STATSX 50 |
| 91 |
#define SP_STATSY 50 |
| 92 |
|
| 93 |
#define SP_TIMEX 8 |
| 94 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 95 |
#define SP_TIMEY 160 |
| 96 |
//#define SP_TIMEY (SCREENHEIGHT-32) |
| 97 |
|
| 98 |
|
| 99 |
// NET GAME STUFF |
| 100 |
#define NG_STATSY 50 |
| 101 |
#define NG_STATSX (32 + V_NamePatchWidth(star)/2 + 32*!dofrags) |
| 102 |
|
| 103 |
#define NG_SPACINGX 64 |
| 104 |
|
| 105 |
|
| 106 |
// Used to display the frags matrix at endgame |
| 107 |
// DEATHMATCH STUFF |
| 108 |
#define DM_MATRIXX 42 |
| 109 |
#define DM_MATRIXY 68 |
| 110 |
|
| 111 |
#define DM_SPACINGX 40 |
| 112 |
|
| 113 |
#define DM_TOTALSX 269 |
| 114 |
|
| 115 |
#define DM_KILLERSX 10 |
| 116 |
#define DM_KILLERSY 100 |
| 117 |
#define DM_VICTIMSX 5 |
| 118 |
#define DM_VICTIMSY 50 |
| 119 |
|
| 120 |
|
| 121 |
// These animation variables, structures, etc. are used for the |
| 122 |
// DOOM/Ultimate DOOM intermission screen animations. This is |
| 123 |
// totally different from any sprite or texture/flat animations |
| 124 |
typedef enum |
| 125 |
{ |
| 126 |
ANIM_ALWAYS, // determined by patch entry |
| 127 |
ANIM_RANDOM, // occasional |
| 128 |
ANIM_LEVEL // continuous |
| 129 |
} animenum_t; |
| 130 |
|
| 131 |
typedef struct |
| 132 |
{ |
| 133 |
int x; // x/y coordinate pair structure |
| 134 |
int y; |
| 135 |
} point_t; |
| 136 |
|
| 137 |
|
| 138 |
// |
| 139 |
// Animation. |
| 140 |
// |
| 141 |
typedef struct |
| 142 |
{ |
| 143 |
animenum_t type; |
| 144 |
|
| 145 |
// period in tics between animations |
| 146 |
int period; |
| 147 |
|
| 148 |
// number of animation frames |
| 149 |
int nanims; |
| 150 |
|
| 151 |
// location of animation |
| 152 |
point_t loc; |
| 153 |
|
| 154 |
// ALWAYS: n/a, |
| 155 |
// RANDOM: period deviation (<256), |
| 156 |
// LEVEL: level |
| 157 |
int data1; |
| 158 |
|
| 159 |
// ALWAYS: n/a, |
| 160 |
// RANDOM: random base period, |
| 161 |
// LEVEL: n/a |
| 162 |
int data2; |
| 163 |
|
| 164 |
/* actual graphics for frames of animations |
| 165 |
* cphipps - const |
| 166 |
*/ |
| 167 |
patchnum_t p[3]; |
| 168 |
|
| 169 |
// following must be initialized to zero before use! |
| 170 |
|
| 171 |
// next value of bcnt (used in conjunction with period) |
| 172 |
int nexttic; |
| 173 |
|
| 174 |
// last drawn animation frame |
| 175 |
int lastdrawn; |
| 176 |
|
| 177 |
// next frame number to animate |
| 178 |
int ctr; |
| 179 |
|
| 180 |
// used by RANDOM and LEVEL when animating |
| 181 |
int state; |
| 182 |
} wi_anim_t; |
| 183 |
|
| 184 |
|
| 185 |
static point_t lnodes[NUMEPISODES][NUMMAPS] = |
| 186 |
{ |
| 187 |
// Episode 0 World Map |
| 188 |
{ |
| 189 |
{ 185, 164 }, // location of level 0 (CJ) |
| 190 |
{ 148, 143 }, // location of level 1 (CJ) |
| 191 |
{ 69, 122 }, // location of level 2 (CJ) |
| 192 |
{ 209, 102 }, // location of level 3 (CJ) |
| 193 |
{ 116, 89 }, // location of level 4 (CJ) |
| 194 |
{ 166, 55 }, // location of level 5 (CJ) |
| 195 |
{ 71, 56 }, // location of level 6 (CJ) |
| 196 |
{ 135, 29 }, // location of level 7 (CJ) |
| 197 |
{ 71, 24 } // location of level 8 (CJ) |
| 198 |
}, |
| 199 |
|
| 200 |
// Episode 1 World Map should go here |
| 201 |
{ |
| 202 |
{ 254, 25 }, // location of level 0 (CJ) |
| 203 |
{ 97, 50 }, // location of level 1 (CJ) |
| 204 |
{ 188, 64 }, // location of level 2 (CJ) |
| 205 |
{ 128, 78 }, // location of level 3 (CJ) |
| 206 |
{ 214, 92 }, // location of level 4 (CJ) |
| 207 |
{ 133, 130 }, // location of level 5 (CJ) |
| 208 |
{ 208, 136 }, // location of level 6 (CJ) |
| 209 |
{ 148, 140 }, // location of level 7 (CJ) |
| 210 |
{ 235, 158 } // location of level 8 (CJ) |
| 211 |
}, |
| 212 |
|
| 213 |
// Episode 2 World Map should go here |
| 214 |
{ |
| 215 |
{ 156, 168 }, // location of level 0 (CJ) |
| 216 |
{ 48, 154 }, // location of level 1 (CJ) |
| 217 |
{ 174, 95 }, // location of level 2 (CJ) |
| 218 |
{ 265, 75 }, // location of level 3 (CJ) |
| 219 |
{ 130, 48 }, // location of level 4 (CJ) |
| 220 |
{ 279, 23 }, // location of level 5 (CJ) |
| 221 |
{ 198, 48 }, // location of level 6 (CJ) |
| 222 |
{ 140, 25 }, // location of level 7 (CJ) |
| 223 |
{ 281, 136 } // location of level 8 (CJ) |
| 224 |
} |
| 225 |
}; |
| 226 |
|
| 227 |
|
| 228 |
// |
| 229 |
// Animation locations for episode 0 (1). |
| 230 |
// Using patches saves a lot of space, |
| 231 |
// as they replace 320x200 full screen frames. |
| 232 |
// |
| 233 |
static wi_anim_t epsd0animinfo[] = |
| 234 |
{ |
| 235 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 224, 104 } }, |
| 236 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 184, 160 } }, |
| 237 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 112, 136 } }, |
| 238 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 72, 112 } }, |
| 239 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 88, 96 } }, |
| 240 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 64, 48 } }, |
| 241 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 192, 40 } }, |
| 242 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 136, 16 } }, |
| 243 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 80, 16 } }, |
| 244 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 64, 24 } } |
| 245 |
}; |
| 246 |
|
| 247 |
static wi_anim_t epsd1animinfo[] = |
| 248 |
{ |
| 249 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 1 }, |
| 250 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 2 }, |
| 251 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 3 }, |
| 252 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 4 }, |
| 253 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 5 }, |
| 254 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 6 }, |
| 255 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 7 }, |
| 256 |
{ ANIM_LEVEL, TICRATE/3, 3, { 192, 144 }, 8 }, |
| 257 |
{ ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 8 } |
| 258 |
}; |
| 259 |
|
| 260 |
static wi_anim_t epsd2animinfo[] = |
| 261 |
{ |
| 262 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 104, 168 } }, |
| 263 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 40, 136 } }, |
| 264 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 160, 96 } }, |
| 265 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 104, 80 } }, |
| 266 |
{ ANIM_ALWAYS, TICRATE/3, 3, { 120, 32 } }, |
| 267 |
{ ANIM_ALWAYS, TICRATE/4, 3, { 40, 0 } } |
| 268 |
}; |
| 269 |
|
| 270 |
static int NUMANIMS[NUMEPISODES] = |
| 271 |
{ |
| 272 |
sizeof(epsd0animinfo)/sizeof(wi_anim_t), |
| 273 |
sizeof(epsd1animinfo)/sizeof(wi_anim_t), |
| 274 |
sizeof(epsd2animinfo)/sizeof(wi_anim_t) |
| 275 |
}; |
| 276 |
|
| 277 |
static wi_anim_t *anims[NUMEPISODES] = |
| 278 |
{ |
| 279 |
epsd0animinfo, |
| 280 |
epsd1animinfo, |
| 281 |
epsd2animinfo |
| 282 |
}; |
| 283 |
|
| 284 |
|
| 285 |
// |
| 286 |
// GENERAL DATA |
| 287 |
// |
| 288 |
|
| 289 |
// |
| 290 |
// Locally used stuff. |
| 291 |
// |
| 292 |
#define FB 0 |
| 293 |
|
| 294 |
|
| 295 |
// States for single-player |
| 296 |
#define SP_KILLS 0 |
| 297 |
#define SP_ITEMS 2 |
| 298 |
#define SP_SECRET 4 |
| 299 |
#define SP_FRAGS 6 |
| 300 |
#define SP_TIME 8 |
| 301 |
#define SP_PAR ST_TIME |
| 302 |
|
| 303 |
#define SP_PAUSE 1 |
| 304 |
|
| 305 |
// in seconds |
| 306 |
#define SHOWNEXTLOCDELAY 4 |
| 307 |
//#define SHOWLASTLOCDELAY SHOWNEXTLOCDELAY |
| 308 |
|
| 309 |
|
| 310 |
// used to accelerate or skip a stage |
| 311 |
int acceleratestage; // killough 3/28/98: made global |
| 312 |
|
| 313 |
// wbs->pnum |
| 314 |
static int me; |
| 315 |
|
| 316 |
// specifies current state |
| 317 |
static stateenum_t state; |
| 318 |
|
| 319 |
// contains information passed into intermission |
| 320 |
static wbstartstruct_t* wbs; |
| 321 |
|
| 322 |
static wbplayerstruct_t* plrs; // wbs->plyr[] |
| 323 |
|
| 324 |
// used for general timing |
| 325 |
static int cnt; |
| 326 |
|
| 327 |
// used for timing of background animation |
| 328 |
static int bcnt; |
| 329 |
|
| 330 |
// signals to refresh everything for one frame |
| 331 |
static int firstrefresh; |
| 332 |
|
| 333 |
static int cnt_time; |
| 334 |
static int cnt_total_time; |
| 335 |
static int cnt_par; |
| 336 |
static int cnt_pause; |
| 337 |
|
| 338 |
// |
| 339 |
// GRAPHICS |
| 340 |
// |
| 341 |
|
| 342 |
// You Are Here graphic |
| 343 |
static const char* yah[3] = { "WIURH0", "WIURH1", 0 }; |
| 344 |
|
| 345 |
// splat |
| 346 |
static const char* splat[2] = {"WISPLAT", 0}; |
| 347 |
|
| 348 |
// %, : graphics |
| 349 |
static const char percent[] = {"WIPCNT"}; |
| 350 |
static const char colon[] = {"WICOLON"}; |
| 351 |
|
| 352 |
// 0-9 graphic |
| 353 |
static patchnum_t num[10]; |
| 354 |
|
| 355 |
// minus sign |
| 356 |
static const char wiminus[] = {"WIMINUS"}; |
| 357 |
|
| 358 |
// "Finished!" graphics |
| 359 |
static const char finished[] = {"WIF"}; |
| 360 |
|
| 361 |
// "Entering" graphic |
| 362 |
static const char entering[] = {"WIENTER"}; |
| 363 |
|
| 364 |
// "secret" |
| 365 |
static const char sp_secret[] = {"WISCRT2"}; |
| 366 |
|
| 367 |
// "Kills", "Scrt", "Items", "Frags" |
| 368 |
static const char kills[] = {"WIOSTK"}; |
| 369 |
static const char secret[] = {"WIOSTS"}; |
| 370 |
static const char items[] = {"WIOSTI"}; |
| 371 |
static const char frags[] = {"WIFRGS"}; |
| 372 |
|
| 373 |
// Time sucks. |
| 374 |
static const char time1[] = {"WITIME"}; |
| 375 |
static const char par[] = {"WIPAR"}; |
| 376 |
static const char sucks[] = {"WISUCKS"}; |
| 377 |
|
| 378 |
// "killers", "victims" |
| 379 |
static const char killers[] = {"WIKILRS"}; |
| 380 |
static const char victims[] = {"WIVCTMS"}; |
| 381 |
|
| 382 |
// "Total", your face, your dead face |
| 383 |
static const char total[] = {"WIMSTT"}; |
| 384 |
static const char star[] = {"STFST01"}; |
| 385 |
static const char bstar[] = {"STFDEAD0"}; |
| 386 |
|
| 387 |
// "red P[1..g_maxplayers]" |
| 388 |
static const char facebackp[] = {"STPB0"}; |
| 389 |
|
| 390 |
static const char *exitpic, *enterpic; |
| 391 |
|
| 392 |
// |
| 393 |
// CODE |
| 394 |
// |
| 395 |
|
| 396 |
static void WI_endDeathmatchStats(void); |
| 397 |
static void WI_endNetgameStats(void); |
| 398 |
#define WI_endStats WI_endNetgameStats |
| 399 |
|
| 400 |
/* ==================================================================== |
| 401 |
* WI_levelNameLump |
| 402 |
* Purpore: Returns the name of the graphic lump containing the name of |
| 403 |
* the given level. |
| 404 |
* Args: Episode and level, and buffer (must by 9 chars) to write to |
| 405 |
* Returns: void |
| 406 |
*/ |
| 407 |
void WI_levelNameLump(int epis, int map, char* buf) |
| 408 |
{ |
| 409 |
if (gamemode == commercial) { |
| 410 |
snprintf(buf, 9, "CWILV%2.2d", map); |
| 411 |
} else { |
| 412 |
snprintf(buf, 9, "WILV%d%d", epis, map); |
| 413 |
} |
| 414 |
} |
| 415 |
|
| 416 |
static int WI_killPercent(int i) |
| 417 |
{ |
| 418 |
return wbs->maxkills ? (plrs[i].skills * 100) / wbs->maxkills |
| 419 |
: MAX(1, plrs[i].skills) * 100; |
| 420 |
} |
| 421 |
|
| 422 |
static int WI_killLimit(int i) |
| 423 |
{ |
| 424 |
return wbs->maxkills ? (plrs[i].skills * 100) / wbs->maxkills |
| 425 |
: (plrs[i].skills * 100); |
| 426 |
|
| 427 |
} |
| 428 |
|
| 429 |
static int WI_itemPercent(int i) |
| 430 |
{ |
| 431 |
return wbs->maxitems ? (plrs[i].sitems * 100) / wbs->maxitems : 100; |
| 432 |
} |
| 433 |
|
| 434 |
static int WI_itemLimit(int i) |
| 435 |
{ |
| 436 |
return wbs->maxitems ? (plrs[i].sitems * 100) / wbs->maxitems |
| 437 |
: (plrs[i].sitems * 100); |
| 438 |
|
| 439 |
} |
| 440 |
|
| 441 |
static int WI_secretPercent(int i) |
| 442 |
{ |
| 443 |
return wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : 100; |
| 444 |
} |
| 445 |
|
| 446 |
static int WI_secretLimit(int i) |
| 447 |
{ |
| 448 |
return wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret |
| 449 |
: compatibility_level < lxdoom_1_compatibility ? 0 : 100; |
| 450 |
} |
| 451 |
|
| 452 |
// ==================================================================== |
| 453 |
// WI_slamBackground |
| 454 |
// Purpose: Put the full-screen background up prior to patches |
| 455 |
// Args: none |
| 456 |
// Returns: void |
| 457 |
// |
| 458 |
static void WI_slamBackground(void) |
| 459 |
{ |
| 460 |
char name[9]; // limited to 8 characters |
| 461 |
|
| 462 |
if (state != StatCount && enterpic) strcpy(name, enterpic); |
| 463 |
else if (exitpic) strcpy(name, exitpic); |
| 464 |
else if (gamemode == commercial || wbs->epsd < 0 || (gamemode == retail && wbs->epsd >= 3)) |
| 465 |
strcpy(name, "INTERPIC"); |
| 466 |
else |
| 467 |
snprintf(name, sizeof(name), "WIMAP%d", wbs->epsd); |
| 468 |
|
| 469 |
// e6y: wide-res |
| 470 |
V_ClearBorder(); |
| 471 |
|
| 472 |
// background |
| 473 |
V_DrawNamePatchFS(0, 0, FB, name, CR_DEFAULT, VPT_STRETCH); |
| 474 |
} |
| 475 |
|
| 476 |
#define SPACEWIDTH 4 |
| 477 |
|
| 478 |
static void WI_DrawString(int cx, int cy, const char* ch) |
| 479 |
{ |
| 480 |
int w; |
| 481 |
int c; |
| 482 |
const char *cc = ch; |
| 483 |
int width = 0; |
| 484 |
|
| 485 |
// center the text. |
| 486 |
while (*cc) { |
| 487 |
c = *cc++; // get next char |
| 488 |
c = toupper(c) - HU_FONTSTART; |
| 489 |
if (c < 0 || c> HU_FONTSIZE) |
| 490 |
{ |
| 491 |
width += SPACEWIDTH; // space |
| 492 |
continue; |
| 493 |
} |
| 494 |
width += hud_font.font[c].width; |
| 495 |
} |
| 496 |
cx -= width / 2; |
| 497 |
if (cx < 0) cx = 0; |
| 498 |
|
| 499 |
|
| 500 |
while (*ch) { |
| 501 |
c = *ch++; // get next char |
| 502 |
c = toupper(c) - HU_FONTSTART; |
| 503 |
if (c < 0 || c> HU_FONTSIZE) |
| 504 |
{ |
| 505 |
cx += SPACEWIDTH; // space |
| 506 |
continue; |
| 507 |
} |
| 508 |
w = hud_font.font[c].width; |
| 509 |
if (cx + w > 320) |
| 510 |
break; |
| 511 |
|
| 512 |
V_DrawNumPatch(cx, cy, 0, hud_font.font[c].lumpnum, CR_GRAY, VPT_STRETCH | VPT_TRANS); |
| 513 |
cx += w; |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
// ==================================================================== |
| 518 |
// WI_drawLF |
| 519 |
// Purpose: Draw the "Finished" level name before showing stats |
| 520 |
// Args: none |
| 521 |
// Returns: void |
| 522 |
// |
| 523 |
const char *lf_levelname; |
| 524 |
const char *lf_levelpic; |
| 525 |
const char *lf_author; |
| 526 |
|
| 527 |
void WI_drawLF(void) |
| 528 |
{ |
| 529 |
int y = WI_TITLEY; |
| 530 |
char lname[9]; |
| 531 |
|
| 532 |
dsda_PrepareFinished(); |
| 533 |
|
| 534 |
if (lf_levelname) |
| 535 |
{ |
| 536 |
// The level defines a new name but no texture for the name. |
| 537 |
WI_DrawString(160, y, lf_levelname); |
| 538 |
|
| 539 |
y += (5 * hud_font.height / 4); |
| 540 |
} |
| 541 |
else |
| 542 |
{ |
| 543 |
// draw <LevelName> |
| 544 |
/* cph - get the graphic lump name and use it */ |
| 545 |
if (lf_levelpic) |
| 546 |
strcpy(lname, lf_levelpic); |
| 547 |
else |
| 548 |
WI_levelNameLump(wbs->epsd, wbs->last, lname); |
| 549 |
|
| 550 |
if (!W_LumpNameExists(lname)) |
| 551 |
return; |
| 552 |
|
| 553 |
// CPhipps - patch drawing updated |
| 554 |
V_DrawNamePatchFS((320 - V_NamePatchWidth(lname)) / 2, y, |
| 555 |
FB, lname, CR_DEFAULT, VPT_STRETCH); |
| 556 |
|
| 557 |
y += (5 * V_NamePatchHeight(lname)) / 4; |
| 558 |
} |
| 559 |
|
| 560 |
if (lf_author) |
| 561 |
{ |
| 562 |
WI_DrawString(160, y, lf_author); |
| 563 |
|
| 564 |
y += (5 * hud_font.height / 4); |
| 565 |
} |
| 566 |
|
| 567 |
// CPhipps - patch drawing updated |
| 568 |
// draw "Finished!" |
| 569 |
V_DrawNamePatch((320 - V_NamePatchWidth(finished))/2, y, |
| 570 |
FB, finished, CR_DEFAULT, VPT_STRETCH); |
| 571 |
} |
| 572 |
|
| 573 |
|
| 574 |
// ==================================================================== |
| 575 |
// WI_drawEL |
| 576 |
// Purpose: Draw introductory "Entering" and level name |
| 577 |
// Args: none |
| 578 |
// Returns: void |
| 579 |
// |
| 580 |
const char *el_levelname; |
| 581 |
const char *el_levelpic; |
| 582 |
const char *el_author; |
| 583 |
|
| 584 |
void WI_drawEL(void) |
| 585 |
{ |
| 586 |
int y = WI_TITLEY; |
| 587 |
char lname[9]; |
| 588 |
|
| 589 |
// draw "Entering" |
| 590 |
// CPhipps - patch drawing updated |
| 591 |
V_DrawNamePatch((320 - V_NamePatchWidth(entering)) / 2, |
| 592 |
y, FB, entering, CR_DEFAULT, VPT_STRETCH); |
| 593 |
|
| 594 |
y += (5 * V_NamePatchHeight(entering)) / 4; |
| 595 |
|
| 596 |
dsda_PrepareEntering(); |
| 597 |
|
| 598 |
if (el_levelname) |
| 599 |
{ |
| 600 |
// The level defines a new name but no texture for the name. |
| 601 |
WI_DrawString(160, y, el_levelname); |
| 602 |
|
| 603 |
y += (5 * hud_font.height / 4); |
| 604 |
} |
| 605 |
else |
| 606 |
{ |
| 607 |
/* cph - get the graphic lump name */ |
| 608 |
if (el_levelpic) |
| 609 |
strcpy(lname, el_levelpic); |
| 610 |
else |
| 611 |
WI_levelNameLump(wbs->nextep, wbs->next, lname); |
| 612 |
|
| 613 |
if (!W_LumpNameExists(lname)) |
| 614 |
return; |
| 615 |
|
| 616 |
// fullscreen cwilv graphic |
| 617 |
if (V_NamePatchHeight(lname) == 200) |
| 618 |
y = WI_TITLEY; |
| 619 |
|
| 620 |
// CPhipps - patch drawing updated |
| 621 |
// draw level |
| 622 |
V_DrawNamePatchFS((320 - V_NamePatchWidth(lname)) / 2, y, FB, |
| 623 |
lname, CR_DEFAULT, VPT_STRETCH); |
| 624 |
|
| 625 |
y += (5 * V_NamePatchHeight(lname)) / 4; |
| 626 |
} |
| 627 |
|
| 628 |
if (el_author) |
| 629 |
{ |
| 630 |
WI_DrawString(160, y, el_author); |
| 631 |
|
| 632 |
y += (5 * hud_font.height / 4); |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
/* ==================================================================== |
| 637 |
* WI_drawOnLnode |
| 638 |
* Purpose: Draw patches at a location based on episode/map |
| 639 |
* Args: n -- index to map# within episode |
| 640 |
* c[] -- array of names of patches to be drawn |
| 641 |
* Returns: void |
| 642 |
*/ |
| 643 |
void |
| 644 |
WI_drawOnLnode // draw stuff at a location by episode/map# |
| 645 |
( int n, |
| 646 |
const char* const c[] ) |
| 647 |
{ |
| 648 |
int i; |
| 649 |
dboolean fits = false; |
| 650 |
|
| 651 |
i = 0; |
| 652 |
do |
| 653 |
{ |
| 654 |
int left; |
| 655 |
int top; |
| 656 |
int right; |
| 657 |
int bottom; |
| 658 |
const rpatch_t* patch = R_PatchByName(c[i]); |
| 659 |
|
| 660 |
left = lnodes[wbs->epsd][n].x - patch->leftoffset; |
| 661 |
top = lnodes[wbs->epsd][n].y - patch->topoffset; |
| 662 |
right = left + patch->width; |
| 663 |
bottom = top + patch->height; |
| 664 |
|
| 665 |
if (left >= 0 |
| 666 |
&& right < 320 |
| 667 |
&& top >= 0 |
| 668 |
&& bottom < 200) |
| 669 |
{ |
| 670 |
fits = true; |
| 671 |
} |
| 672 |
else |
| 673 |
{ |
| 674 |
i++; |
| 675 |
} |
| 676 |
} while (!fits && i!=2 && c[i]); |
| 677 |
|
| 678 |
if (fits && i<2) |
| 679 |
{ |
| 680 |
// CPhipps - patch drawing updated |
| 681 |
V_DrawNamePatch(lnodes[wbs->epsd][n].x, lnodes[wbs->epsd][n].y, |
| 682 |
FB, c[i], CR_DEFAULT, VPT_STRETCH); |
| 683 |
} |
| 684 |
else |
| 685 |
{ |
| 686 |
// DEBUG |
| 687 |
//jff 8/3/98 use logical output routine |
| 688 |
lprintf(LO_DEBUG,"Could not place patch on level %d\n", n+1); |
| 689 |
} |
| 690 |
} |
| 691 |
|
| 692 |
|
| 693 |
// ==================================================================== |
| 694 |
// WI_initAnimatedBack |
| 695 |
// Purpose: Initialize pointers and styles for background animation |
| 696 |
// Args: none |
| 697 |
// Returns: void |
| 698 |
// |
| 699 |
void WI_initAnimatedBack(int entering) |
| 700 |
{ |
| 701 |
int i; |
| 702 |
wi_anim_t* a; |
| 703 |
|
| 704 |
if (exitpic) return; |
| 705 |
if (enterpic && entering) return; |
| 706 |
|
| 707 |
if (gamemode == commercial) // no animation for DOOM2 |
| 708 |
return; |
| 709 |
|
| 710 |
if (wbs->epsd < 0 || wbs->epsd > 2) |
| 711 |
return; |
| 712 |
|
| 713 |
|
| 714 |
for (i=0;i<NUMANIMS[wbs->epsd];i++) |
| 715 |
{ |
| 716 |
a = &anims[wbs->epsd][i]; |
| 717 |
|
| 718 |
// init variables |
| 719 |
// [crispy] Do not reset animation timers upon switching to "Entering" state |
| 720 |
// via WI_initShowNextLoc. Fixes notable blinking of Tower of Babel drawing |
| 721 |
// and the rest of animations from being restarted. |
| 722 |
if (!entering) |
| 723 |
a->ctr = -1; |
| 724 |
|
| 725 |
// specify the next time to draw it |
| 726 |
if (a->type == ANIM_ALWAYS) |
| 727 |
a->nexttic = bcnt + 1 + (M_Random()%a->period); |
| 728 |
else |
| 729 |
if (a->type == ANIM_RANDOM) |
| 730 |
a->nexttic = bcnt + 1 + a->data2+(M_Random()%a->data1); |
| 731 |
else |
| 732 |
if (a->type == ANIM_LEVEL) |
| 733 |
a->nexttic = bcnt + 1; |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
|
| 738 |
// ==================================================================== |
| 739 |
// WI_updateAnimatedBack |
| 740 |
// Purpose: Figure out what animation we do on this iteration |
| 741 |
// Args: none |
| 742 |
// Returns: void |
| 743 |
// |
| 744 |
void WI_updateAnimatedBack(void) |
| 745 |
{ |
| 746 |
int i; |
| 747 |
wi_anim_t* a; |
| 748 |
|
| 749 |
if (exitpic) return; |
| 750 |
if (enterpic && state != StatCount) return; |
| 751 |
|
| 752 |
if (gamemode == commercial) |
| 753 |
return; |
| 754 |
|
| 755 |
if (wbs->epsd < 0 || wbs->epsd > 2) |
| 756 |
return; |
| 757 |
|
| 758 |
for (i=0;i<NUMANIMS[wbs->epsd];i++) |
| 759 |
{ |
| 760 |
a = &anims[wbs->epsd][i]; |
| 761 |
|
| 762 |
if (bcnt == a->nexttic) |
| 763 |
{ |
| 764 |
switch (a->type) |
| 765 |
{ |
| 766 |
case ANIM_ALWAYS: |
| 767 |
if (++a->ctr >= a->nanims) a->ctr = 0; |
| 768 |
a->nexttic = bcnt + a->period; |
| 769 |
break; |
| 770 |
|
| 771 |
case ANIM_RANDOM: |
| 772 |
a->ctr++; |
| 773 |
if (a->ctr == a->nanims) |
| 774 |
{ |
| 775 |
a->ctr = -1; |
| 776 |
a->nexttic = bcnt+a->data2+(M_Random()%a->data1); |
| 777 |
} |
| 778 |
else |
| 779 |
a->nexttic = bcnt + a->period; |
| 780 |
break; |
| 781 |
|
| 782 |
case ANIM_LEVEL: |
| 783 |
// gawd-awful hack for level anims |
| 784 |
if (!(state == StatCount && i == 7) |
| 785 |
&& wbs->next == a->data1) |
| 786 |
{ |
| 787 |
a->ctr++; |
| 788 |
if (a->ctr == a->nanims) a->ctr--; |
| 789 |
a->nexttic = bcnt + a->period; |
| 790 |
} |
| 791 |
break; |
| 792 |
} |
| 793 |
} |
| 794 |
} |
| 795 |
} |
| 796 |
|
| 797 |
|
| 798 |
// ==================================================================== |
| 799 |
// WI_drawAnimatedBack |
| 800 |
// Purpose: Actually do the animation (whew!) |
| 801 |
// Args: none |
| 802 |
// Returns: void |
| 803 |
// |
| 804 |
void WI_drawAnimatedBack(void) |
| 805 |
{ |
| 806 |
int i; |
| 807 |
wi_anim_t* a; |
| 808 |
|
| 809 |
if (exitpic) return; |
| 810 |
if (enterpic && state != StatCount) return; |
| 811 |
|
| 812 |
if (gamemode==commercial) //jff 4/25/98 Someone forgot commercial an enum |
| 813 |
return; |
| 814 |
|
| 815 |
if (wbs->epsd < 0 || wbs->epsd > 2) |
| 816 |
return; |
| 817 |
|
| 818 |
// [crispy] show Fortress of Mystery if it has been completed |
| 819 |
if (wbs->epsd == 1 && wbs->didsecret) |
| 820 |
{ |
| 821 |
a = &anims[1][7]; |
| 822 |
|
| 823 |
V_DrawNumPatch(a->loc.x, a->loc.y, FB, a->p[2].lumpnum, CR_DEFAULT, VPT_STRETCH); |
| 824 |
} |
| 825 |
|
| 826 |
for (i=0 ; i<NUMANIMS[wbs->epsd] ; i++) |
| 827 |
{ |
| 828 |
a = &anims[wbs->epsd][i]; |
| 829 |
|
| 830 |
if (a->ctr >= 0) |
| 831 |
// CPhipps - patch drawing updated |
| 832 |
V_DrawNumPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr].lumpnum, CR_DEFAULT, VPT_STRETCH); |
| 833 |
} |
| 834 |
} |
| 835 |
|
| 836 |
|
| 837 |
// ==================================================================== |
| 838 |
// WI_drawNum |
| 839 |
// Purpose: Draws a number. If digits > 0, then use that many digits |
| 840 |
// minimum, otherwise only use as many as necessary |
| 841 |
// Args: x, y -- location |
| 842 |
// n -- the number to be drawn |
| 843 |
// digits -- number of digits minimum or zero |
| 844 |
// Returns: new x position after drawing (note we are going to the left) |
| 845 |
// CPhipps - static |
| 846 |
static int WI_drawNum (int x, int y, int n, int digits) |
| 847 |
{ |
| 848 |
int fontwidth = num[0].width; |
| 849 |
int neg; |
| 850 |
int temp; |
| 851 |
|
| 852 |
if (digits < 0) |
| 853 |
{ |
| 854 |
if (!n) |
| 855 |
{ |
| 856 |
// make variable-length zeros 1 digit long |
| 857 |
digits = 1; |
| 858 |
} |
| 859 |
else |
| 860 |
{ |
| 861 |
// figure out # of digits in # |
| 862 |
digits = 0; |
| 863 |
temp = n; |
| 864 |
|
| 865 |
while (temp) |
| 866 |
{ |
| 867 |
temp /= 10; |
| 868 |
digits++; |
| 869 |
} |
| 870 |
} |
| 871 |
} |
| 872 |
|
| 873 |
neg = n < 0; |
| 874 |
if (neg) |
| 875 |
n = -n; |
| 876 |
|
| 877 |
// if non-number, do not draw it |
| 878 |
if (n == 1994) |
| 879 |
return 0; |
| 880 |
|
| 881 |
// draw the new number |
| 882 |
while (digits--) |
| 883 |
{ |
| 884 |
x -= fontwidth; |
| 885 |
// CPhipps - patch drawing updated |
| 886 |
V_DrawNumPatch(x, y, FB, num[ n % 10 ].lumpnum, CR_DEFAULT, VPT_STRETCH); |
| 887 |
n /= 10; |
| 888 |
} |
| 889 |
|
| 890 |
// draw a minus sign if necessary |
| 891 |
if (neg) |
| 892 |
// CPhipps - patch drawing updated |
| 893 |
V_DrawNamePatch(x-=8, y, FB, wiminus, CR_DEFAULT, VPT_STRETCH); |
| 894 |
|
| 895 |
return x; |
| 896 |
} |
| 897 |
|
| 898 |
|
| 899 |
// ==================================================================== |
| 900 |
// WI_drawPercent |
| 901 |
// Purpose: Draws a percentage, really just a call to WI_drawNum |
| 902 |
// after putting a percent sign out there |
| 903 |
// Args: x, y -- location |
| 904 |
// p -- the percentage value to be drawn, no negatives |
| 905 |
// Returns: void |
| 906 |
// CPhipps - static |
| 907 |
static void WI_drawPercent(int x, int y, int p) |
| 908 |
{ |
| 909 |
if (p < 0) |
| 910 |
return; |
| 911 |
|
| 912 |
// CPhipps - patch drawing updated |
| 913 |
V_DrawNamePatch(x, y, FB, percent, CR_DEFAULT, VPT_STRETCH); |
| 914 |
WI_drawNum(x, y, p, -1); |
| 915 |
} |
| 916 |
|
| 917 |
|
| 918 |
// ==================================================================== |
| 919 |
// WI_drawTime |
| 920 |
// Purpose: Draws the level completion time or par time, or "Sucks" |
| 921 |
// if 1 hour or more |
| 922 |
// Args: x, y -- location |
| 923 |
// t -- the time value to be drawn |
| 924 |
// Returns: void |
| 925 |
// |
| 926 |
// CPhipps - static |
| 927 |
// - largely rewritten to display hours and use slightly better algorithm |
| 928 |
|
| 929 |
static void WI_drawTime(int x, int y, int t) |
| 930 |
{ |
| 931 |
int n; |
| 932 |
|
| 933 |
if (t<0) |
| 934 |
return; |
| 935 |
|
| 936 |
if (t < 100*60*60) |
| 937 |
for(;;) { |
| 938 |
n = t % 60; |
| 939 |
t /= 60; |
| 940 |
x = WI_drawNum(x, y, n, (t || n>9) ? 2 : 1) - V_NamePatchWidth(colon); |
| 941 |
|
| 942 |
// draw |
| 943 |
if (t) |
| 944 |
// CPhipps - patch drawing updated |
| 945 |
V_DrawNamePatch(x, y, FB, colon, CR_DEFAULT, VPT_STRETCH); |
| 946 |
else break; |
| 947 |
} |
| 948 |
else // "sucks" (maybe should be "addicted", even I've never had a 100 hour game ;) |
| 949 |
V_DrawNamePatch(x - V_NamePatchWidth(sucks), |
| 950 |
y, FB, sucks, CR_DEFAULT, VPT_STRETCH); |
| 951 |
} |
| 952 |
|
| 953 |
|
| 954 |
// ==================================================================== |
| 955 |
// WI_End |
| 956 |
// Purpose: Unloads data structures (inverse of WI_Start) |
| 957 |
// Args: none |
| 958 |
// Returns: void |
| 959 |
// |
| 960 |
void WI_End(void) |
| 961 |
{ |
| 962 |
if (heretic) return; |
| 963 |
|
| 964 |
if (deathmatch) |
| 965 |
WI_endDeathmatchStats(); |
| 966 |
else if (netgame) |
| 967 |
WI_endNetgameStats(); |
| 968 |
else |
| 969 |
WI_endStats(); |
| 970 |
} |
| 971 |
|
| 972 |
#define WI_LONGER_NOW_ENTERING (allow_incompatibility && gamemode == commercial && !netgame) |
| 973 |
|
| 974 |
void WI_wait(void) |
| 975 |
{ |
| 976 |
if (WI_LONGER_NOW_ENTERING && !F_ShowCast()) |
| 977 |
cnt = TICRATE + 10; |
| 978 |
else |
| 979 |
cnt = 10; |
| 980 |
} |
| 981 |
|
| 982 |
// ==================================================================== |
| 983 |
// WI_initNoState |
| 984 |
// Purpose: Clear state, ready for end of level activity |
| 985 |
// Args: none |
| 986 |
// Returns: void |
| 987 |
// |
| 988 |
void WI_initNoState(void) |
| 989 |
{ |
| 990 |
state = NoState; |
| 991 |
acceleratestage = 0; |
| 992 |
WI_wait(); |
| 993 |
} |
| 994 |
|
| 995 |
|
| 996 |
// ==================================================================== |
| 997 |
// WI_drawTimeStats |
| 998 |
// Purpose: Put the times on the screen |
| 999 |
// Args: time, total time, par time, in seconds |
| 1000 |
// Returns: void |
| 1001 |
// |
| 1002 |
// cph - pulled from WI_drawStats below |
| 1003 |
|
| 1004 |
static void WI_drawTimeStats(int cnt_time, int cnt_total_time, int cnt_par) |
| 1005 |
{ |
| 1006 |
V_DrawNamePatch(SP_TIMEX, SP_TIMEY, FB, time1, CR_DEFAULT, VPT_STRETCH); |
| 1007 |
WI_drawTime(320/2 - SP_TIMEX, SP_TIMEY, cnt_time); |
| 1008 |
|
| 1009 |
V_DrawNamePatch(SP_TIMEX, (SP_TIMEY+200)/2, FB, total, CR_DEFAULT, VPT_STRETCH); |
| 1010 |
WI_drawTime(320/2 - SP_TIMEX, (SP_TIMEY+200)/2, cnt_total_time); |
| 1011 |
|
| 1012 |
// Ty 04/11/98: redid logic: should skip only if with pwad but |
| 1013 |
// without deh patch |
| 1014 |
// killough 2/22/98: skip drawing par times on pwads |
| 1015 |
// Ty 03/17/98: unless pars changed with deh patch |
| 1016 |
|
| 1017 |
if ( |
| 1018 |
!(modifiedgame && !wbs->modified_partime) |
| 1019 |
|| (gamemission == pack_nerve && allow_incompatibility) |
| 1020 |
) |
| 1021 |
{ |
| 1022 |
if (wbs->epsd < 4 || wbs->modified_partime) |
| 1023 |
{ |
| 1024 |
int display_count; |
| 1025 |
|
| 1026 |
display_count = |
| 1027 |
wbs->fake_partime && cnt_par >= 0 ? wbs->fake_partime / TICRATE : cnt_par; |
| 1028 |
|
| 1029 |
V_DrawNamePatch(320/2 + SP_TIMEX, SP_TIMEY, FB, par, CR_DEFAULT, VPT_STRETCH); |
| 1030 |
WI_drawTime(320 - SP_TIMEX, SP_TIMEY, display_count); |
| 1031 |
} |
| 1032 |
} |
| 1033 |
|
| 1034 |
dsda_DrawExIntermission(); |
| 1035 |
} |
| 1036 |
|
| 1037 |
// ==================================================================== |
| 1038 |
// WI_updateNoState |
| 1039 |
// Purpose: Cycle until end of level activity is done |
| 1040 |
// Args: none |
| 1041 |
// Returns: void |
| 1042 |
// |
| 1043 |
void WI_updateNoState(void) |
| 1044 |
{ |
| 1045 |
WI_updateAnimatedBack(); |
| 1046 |
|
| 1047 |
if (!--cnt || (WI_LONGER_NOW_ENTERING && acceleratestage)) |
| 1048 |
G_WorldDone(); |
| 1049 |
} |
| 1050 |
|
| 1051 |
static dboolean snl_pointeron = false; |
| 1052 |
|
| 1053 |
|
| 1054 |
// ==================================================================== |
| 1055 |
// WI_initShowNextLoc |
| 1056 |
// Purpose: Prepare to show the next level's location |
| 1057 |
// Args: none |
| 1058 |
// Returns: void |
| 1059 |
// |
| 1060 |
void WI_initShowNextLoc(void) |
| 1061 |
{ |
| 1062 |
int behaviour; |
| 1063 |
|
| 1064 |
dsda_ShowNextLocBehaviour(&behaviour); |
| 1065 |
|
| 1066 |
if (behaviour & WI_SHOW_NEXT_DONE) |
| 1067 |
{ |
| 1068 |
G_WorldDone(); |
| 1069 |
return; |
| 1070 |
} |
| 1071 |
|
| 1072 |
if (behaviour & WI_SHOW_NEXT_LOC) |
| 1073 |
{ |
| 1074 |
state = ShowNextLoc; |
| 1075 |
} |
| 1076 |
|
| 1077 |
if (behaviour & WI_SHOW_NEXT_EPISODAL) |
| 1078 |
{ |
| 1079 |
// episode change possible |
| 1080 |
if (wbs->epsd != wbs->nextep) |
| 1081 |
{ |
| 1082 |
void WI_loadData(void); |
| 1083 |
|
| 1084 |
wbs->epsd = wbs->nextep; |
| 1085 |
wbs->last = wbs->next - 1; |
| 1086 |
WI_loadData(); |
| 1087 |
} |
| 1088 |
} |
| 1089 |
|
| 1090 |
acceleratestage = 0; |
| 1091 |
|
| 1092 |
// e6y: That was pretty easy - only a HEX editor and luck |
| 1093 |
// There is no more desync on ddt-tas.zip\e4tux231.lmp |
| 1094 |
// --------- tasdoom.idb --------- |
| 1095 |
// .text:00031194 loc_31194: ; CODE XREF: WI_updateStats+3A9j |
| 1096 |
// .text:00031194 mov ds:state, 1 |
| 1097 |
// .text:0003119E mov ds:acceleratestage, 0 |
| 1098 |
// .text:000311A8 mov ds:cnt, 3Ch |
| 1099 |
// nowhere no hide |
| 1100 |
if (compatibility_level == tasdoom_compatibility) |
| 1101 |
cnt = 60; |
| 1102 |
else |
| 1103 |
cnt = SHOWNEXTLOCDELAY * TICRATE; |
| 1104 |
|
| 1105 |
WI_initAnimatedBack(true); |
| 1106 |
} |
| 1107 |
|
| 1108 |
|
| 1109 |
// ==================================================================== |
| 1110 |
// WI_updateShowNextLoc |
| 1111 |
// Purpose: Prepare to show the next level's location |
| 1112 |
// Args: none |
| 1113 |
// Returns: void |
| 1114 |
// |
| 1115 |
void WI_updateShowNextLoc(void) |
| 1116 |
{ |
| 1117 |
WI_updateAnimatedBack(); |
| 1118 |
|
| 1119 |
if (!--cnt || acceleratestage) |
| 1120 |
WI_initNoState(); |
| 1121 |
else |
| 1122 |
snl_pointeron = (cnt & 31) < 20; |
| 1123 |
} |
| 1124 |
|
| 1125 |
|
| 1126 |
// ==================================================================== |
| 1127 |
// WI_drawShowNextLoc |
| 1128 |
// Purpose: Show the next level's location on animated backgrounds |
| 1129 |
// Args: none |
| 1130 |
// Returns: void |
| 1131 |
// |
| 1132 |
void WI_drawShowNextLoc(void) |
| 1133 |
{ |
| 1134 |
int i; |
| 1135 |
int last; |
| 1136 |
|
| 1137 |
if (dsda_SkipDrawShowNextLoc()) |
| 1138 |
{ |
| 1139 |
return; |
| 1140 |
} |
| 1141 |
|
| 1142 |
WI_slamBackground(); |
| 1143 |
|
| 1144 |
// draw animated background |
| 1145 |
WI_drawAnimatedBack(); |
| 1146 |
|
| 1147 |
// custom interpic. |
| 1148 |
if (exitpic || (enterpic && state != StatCount)) |
| 1149 |
{ |
| 1150 |
WI_drawEL(); |
| 1151 |
return; |
| 1152 |
} |
| 1153 |
|
| 1154 |
if ( gamemode != commercial) |
| 1155 |
{ |
| 1156 |
if (wbs->epsd < 0 || wbs->epsd > 2) |
| 1157 |
{ |
| 1158 |
WI_drawEL(); // "Entering..." if not E1 or E2 |
| 1159 |
return; |
| 1160 |
} |
| 1161 |
|
| 1162 |
last = (wbs->last == 8) ? wbs->next - 1 : wbs->last; |
| 1163 |
|
| 1164 |
// draw a splat on taken cities. |
| 1165 |
for (i=0 ; i<=last ; i++) |
| 1166 |
WI_drawOnLnode(i, splat); |
| 1167 |
|
| 1168 |
// splat the secret level? |
| 1169 |
if (wbs->didsecret) |
| 1170 |
WI_drawOnLnode(8, splat); |
| 1171 |
|
| 1172 |
// draw flashing ptr |
| 1173 |
if (snl_pointeron) |
| 1174 |
WI_drawOnLnode(wbs->next, yah); |
| 1175 |
} |
| 1176 |
|
| 1177 |
if (gamemission == pack_nerve && allow_incompatibility && wbs->last == 7) |
| 1178 |
return; // MAP08 end game |
| 1179 |
|
| 1180 |
// draws which level you are entering.. |
| 1181 |
if ( (gamemode != commercial) || (gamemap != 30) ) // allows for MAP31 entering screen, if not MAP30 |
| 1182 |
WI_drawEL(); |
| 1183 |
} |
| 1184 |
|
| 1185 |
// ==================================================================== |
| 1186 |
// WI_drawNoState |
| 1187 |
// Purpose: Draw the pointer and next location |
| 1188 |
// Args: none |
| 1189 |
// Returns: void |
| 1190 |
// |
| 1191 |
void WI_drawNoState(void) |
| 1192 |
{ |
| 1193 |
snl_pointeron = true; |
| 1194 |
WI_drawShowNextLoc(); |
| 1195 |
} |
| 1196 |
|
| 1197 |
// ==================================================================== |
| 1198 |
// WI_fragSum |
| 1199 |
// Purpose: Calculate frags for this player based on the current totals |
| 1200 |
// of all the other players. Subtract self-frags. |
| 1201 |
// Args: playernum -- the player to be calculated |
| 1202 |
// Returns: the total frags for this player |
| 1203 |
// |
| 1204 |
int WI_fragSum(int playernum) |
| 1205 |
{ |
| 1206 |
int i; |
| 1207 |
int frags = 0; |
| 1208 |
|
| 1209 |
for (i = 0; i < g_maxplayers; i++) |
| 1210 |
{ |
| 1211 |
if (playeringame[i] // is this player playing? |
| 1212 |
&& i!=playernum) // and it's not the player we're calculating |
| 1213 |
{ |
| 1214 |
frags += plrs[playernum].frags[i]; |
| 1215 |
} |
| 1216 |
} |
| 1217 |
|
| 1218 |
|
| 1219 |
// JDC hack - negative frags. |
| 1220 |
frags -= plrs[playernum].frags[playernum]; |
| 1221 |
|
| 1222 |
return frags; |
| 1223 |
} |
| 1224 |
|
| 1225 |
static int dm_state; |
| 1226 |
// CPhipps - short, dynamically allocated |
| 1227 |
static short int **dm_frags; // frags matrix |
| 1228 |
static short int *dm_totals; // totals by player |
| 1229 |
|
| 1230 |
// ==================================================================== |
| 1231 |
// WI_initDeathmatchStats |
| 1232 |
// Purpose: Set up to display DM stats at end of level. Calculate |
| 1233 |
// frags for all players. |
| 1234 |
// Args: none |
| 1235 |
// Returns: void |
| 1236 |
// |
| 1237 |
void WI_initDeathmatchStats(void) |
| 1238 |
{ |
| 1239 |
int i; // looping variables |
| 1240 |
|
| 1241 |
// CPhipps - allocate data structures needed |
| 1242 |
dm_frags = Z_Calloc(g_maxplayers, sizeof(*dm_frags)); |
| 1243 |
dm_totals = Z_Calloc(g_maxplayers, sizeof(*dm_totals)); |
| 1244 |
|
| 1245 |
state = StatCount; // We're doing stats |
| 1246 |
acceleratestage = 0; |
| 1247 |
dm_state = 1; // count how many times we've done a complete stat |
| 1248 |
|
| 1249 |
cnt_pause = TICRATE; |
| 1250 |
|
| 1251 |
for (i = 0 ;i < g_maxplayers; i++) |
| 1252 |
{ |
| 1253 |
if (playeringame[i]) |
| 1254 |
{ |
| 1255 |
// CPhipps - allocate frags line |
| 1256 |
dm_frags[i] = Z_Calloc(g_maxplayers, sizeof(**dm_frags)); // set all counts to zero |
| 1257 |
|
| 1258 |
dm_totals[i] = 0; |
| 1259 |
} |
| 1260 |
} |
| 1261 |
WI_initAnimatedBack(false); |
| 1262 |
} |
| 1263 |
|
| 1264 |
// ==================================================================== |
| 1265 |
// CPhipps - WI_endDeathmatchStats |
| 1266 |
// Purpose: Deallocate dynamically allocated DM stats data |
| 1267 |
// Args: none |
| 1268 |
// Returns: void |
| 1269 |
// |
| 1270 |
|
| 1271 |
void WI_endDeathmatchStats(void) |
| 1272 |
{ |
| 1273 |
int i; |
| 1274 |
for (i = 0; i < g_maxplayers; i++) |
| 1275 |
Z_Free(dm_frags[i]); |
| 1276 |
|
| 1277 |
Z_Free(dm_frags); Z_Free(dm_totals); |
| 1278 |
} |
| 1279 |
|
| 1280 |
// ==================================================================== |
| 1281 |
// WI_updateDeathmatchStats |
| 1282 |
// Purpose: Advance Deathmatch stats screen animation. Calculate |
| 1283 |
// frags for all players. Lots of noise and drama around |
| 1284 |
// the presentation. |
| 1285 |
// Args: none |
| 1286 |
// Returns: void |
| 1287 |
// |
| 1288 |
void WI_updateDeathmatchStats(void) |
| 1289 |
{ |
| 1290 |
int i; |
| 1291 |
int j; |
| 1292 |
|
| 1293 |
dboolean stillticking; |
| 1294 |
|
| 1295 |
WI_updateAnimatedBack(); |
| 1296 |
|
| 1297 |
if (acceleratestage && dm_state != 4) // still ticking |
| 1298 |
{ |
| 1299 |
acceleratestage = 0; |
| 1300 |
|
| 1301 |
for (i = 0; i < g_maxplayers; i++) |
| 1302 |
{ |
| 1303 |
if (playeringame[i]) |
| 1304 |
{ |
| 1305 |
for (j = 0; j < g_maxplayers; j++) |
| 1306 |
if (playeringame[j]) |
| 1307 |
dm_frags[i][j] = plrs[i].frags[j]; |
| 1308 |
|
| 1309 |
dm_totals[i] = WI_fragSum(i); |
| 1310 |
} |
| 1311 |
} |
| 1312 |
|
| 1313 |
|
| 1314 |
S_StartVoidSound(sfx_barexp); // bang |
| 1315 |
dm_state = 4; // we're done with all 4 (or all we have to do) |
| 1316 |
} |
| 1317 |
|
| 1318 |
|
| 1319 |
if (dm_state == 2) |
| 1320 |
{ |
| 1321 |
if (!(bcnt&3)) |
| 1322 |
S_StartVoidSound(sfx_pistol); // noise while counting |
| 1323 |
|
| 1324 |
stillticking = false; |
| 1325 |
|
| 1326 |
for (i = 0; i < g_maxplayers; i++) |
| 1327 |
{ |
| 1328 |
if (playeringame[i]) |
| 1329 |
{ |
| 1330 |
for (j = 0; j < g_maxplayers; j++) |
| 1331 |
{ |
| 1332 |
if (playeringame[j] |
| 1333 |
&& dm_frags[i][j] != plrs[i].frags[j]) |
| 1334 |
{ |
| 1335 |
if (plrs[i].frags[j] < 0) |
| 1336 |
dm_frags[i][j]--; |
| 1337 |
else |
| 1338 |
dm_frags[i][j]++; |
| 1339 |
|
| 1340 |
if (dm_frags[i][j] > 999) // Ty 03/17/98 3-digit frag count |
| 1341 |
dm_frags[i][j] = 999; |
| 1342 |
|
| 1343 |
if (dm_frags[i][j] < -999) |
| 1344 |
dm_frags[i][j] = -999; |
| 1345 |
|
| 1346 |
stillticking = true; |
| 1347 |
} |
| 1348 |
} |
| 1349 |
dm_totals[i] = WI_fragSum(i); |
| 1350 |
|
| 1351 |
if (dm_totals[i] > 999) |
| 1352 |
dm_totals[i] = 999; |
| 1353 |
|
| 1354 |
if (dm_totals[i] < -999) |
| 1355 |
dm_totals[i] = -999; // Ty 03/17/98 end 3-digit frag count |
| 1356 |
} |
| 1357 |
} |
| 1358 |
|
| 1359 |
if (!stillticking) |
| 1360 |
{ |
| 1361 |
S_StartVoidSound(sfx_barexp); |
| 1362 |
dm_state++; |
| 1363 |
} |
| 1364 |
} |
| 1365 |
else if (dm_state == 4) |
| 1366 |
{ |
| 1367 |
if (acceleratestage) |
| 1368 |
{ |
| 1369 |
S_StartVoidSound(sfx_slop); |
| 1370 |
|
| 1371 |
if ( gamemode == commercial) |
| 1372 |
WI_initNoState(); |
| 1373 |
else |
| 1374 |
WI_initShowNextLoc(); |
| 1375 |
} |
| 1376 |
} |
| 1377 |
else if (dm_state & 1) |
| 1378 |
{ |
| 1379 |
if (!--cnt_pause) |
| 1380 |
{ |
| 1381 |
dm_state++; |
| 1382 |
cnt_pause = TICRATE; |
| 1383 |
} |
| 1384 |
} |
| 1385 |
} |
| 1386 |
|
| 1387 |
|
| 1388 |
// ==================================================================== |
| 1389 |
// WI_drawDeathmatchStats |
| 1390 |
// Purpose: Draw the stats on the screen in a matrix |
| 1391 |
// Args: none |
| 1392 |
// Returns: void |
| 1393 |
// |
| 1394 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 1395 |
// CPhipps - patch drawing updated |
| 1396 |
void WI_drawDeathmatchStats(void) |
| 1397 |
{ |
| 1398 |
int i; |
| 1399 |
int j; |
| 1400 |
int x; |
| 1401 |
int y; |
| 1402 |
int w; |
| 1403 |
|
| 1404 |
int halfface = V_NamePatchWidth(facebackp)/2; |
| 1405 |
|
| 1406 |
WI_slamBackground(); |
| 1407 |
|
| 1408 |
// draw animated background |
| 1409 |
WI_drawAnimatedBack(); |
| 1410 |
WI_drawLF(); |
| 1411 |
|
| 1412 |
// draw stat titles (top line) |
| 1413 |
V_DrawNamePatch(DM_TOTALSX-V_NamePatchWidth(total)/2, |
| 1414 |
DM_MATRIXY-WI_SPACINGY+10, FB, total, CR_DEFAULT, VPT_STRETCH); |
| 1415 |
|
| 1416 |
V_DrawNamePatch(DM_KILLERSX, DM_KILLERSY, FB, killers, CR_DEFAULT, VPT_STRETCH); |
| 1417 |
V_DrawNamePatch(DM_VICTIMSX, DM_VICTIMSY, FB, victims, CR_DEFAULT, VPT_STRETCH); |
| 1418 |
|
| 1419 |
// draw P? |
| 1420 |
x = DM_MATRIXX + DM_SPACINGX; |
| 1421 |
y = DM_MATRIXY; |
| 1422 |
|
| 1423 |
for (i = 0; i < g_maxplayers; i++) |
| 1424 |
{ |
| 1425 |
if (playeringame[i]) { |
| 1426 |
//int trans = playernumtotrans[i]; |
| 1427 |
V_DrawNamePatch(x-halfface, DM_MATRIXY - WI_SPACINGY, |
| 1428 |
FB, facebackp, i ? CR_LIMIT+i : CR_DEFAULT, |
| 1429 |
VPT_STRETCH | (i ? VPT_TRANS : 0)); |
| 1430 |
V_DrawNamePatch(DM_MATRIXX-halfface, y, |
| 1431 |
FB, facebackp, i ? CR_LIMIT+i : CR_DEFAULT, |
| 1432 |
VPT_STRETCH | (i ? VPT_TRANS : 0)); |
| 1433 |
|
| 1434 |
if (i == me) |
| 1435 |
{ |
| 1436 |
V_DrawNamePatch(x-halfface, DM_MATRIXY - WI_SPACINGY, |
| 1437 |
FB, bstar, CR_DEFAULT, VPT_STRETCH); |
| 1438 |
V_DrawNamePatch(DM_MATRIXX-halfface, y, |
| 1439 |
FB, star, CR_DEFAULT, VPT_STRETCH); |
| 1440 |
} |
| 1441 |
} |
| 1442 |
x += DM_SPACINGX; |
| 1443 |
y += WI_SPACINGY; |
| 1444 |
} |
| 1445 |
|
| 1446 |
// draw stats |
| 1447 |
y = DM_MATRIXY+10; |
| 1448 |
w = num[0].width; |
| 1449 |
|
| 1450 |
for (i = 0; i < g_maxplayers; i++) |
| 1451 |
{ |
| 1452 |
x = DM_MATRIXX + DM_SPACINGX; |
| 1453 |
|
| 1454 |
if (playeringame[i]) |
| 1455 |
{ |
| 1456 |
for (j = 0; j < g_maxplayers; j++) |
| 1457 |
{ |
| 1458 |
if (playeringame[j]) |
| 1459 |
WI_drawNum(x+w, y, dm_frags[i][j], 2); |
| 1460 |
|
| 1461 |
x += DM_SPACINGX; |
| 1462 |
} |
| 1463 |
WI_drawNum(DM_TOTALSX+w, y, dm_totals[i], 2); |
| 1464 |
} |
| 1465 |
y += WI_SPACINGY; |
| 1466 |
} |
| 1467 |
} |
| 1468 |
|
| 1469 |
|
| 1470 |
// |
| 1471 |
// Note: The term "Netgame" means a coop game |
| 1472 |
// |
| 1473 |
|
| 1474 |
static int *cnt_kills; |
| 1475 |
static int *cnt_items; |
| 1476 |
static int *cnt_secret; |
| 1477 |
static int *cnt_frags; |
| 1478 |
static int dofrags; |
| 1479 |
static int ng_state; |
| 1480 |
|
| 1481 |
// ==================================================================== |
| 1482 |
// CPhipps - WI_endNetgameStats |
| 1483 |
// Purpose: Clean up coop game stats |
| 1484 |
// Args: none |
| 1485 |
// Returns: void |
| 1486 |
// |
| 1487 |
static void WI_endNetgameStats(void) |
| 1488 |
{ |
| 1489 |
Z_Free(cnt_frags); cnt_frags = NULL; |
| 1490 |
Z_Free(cnt_secret); cnt_secret = NULL; |
| 1491 |
Z_Free(cnt_items); cnt_items = NULL; |
| 1492 |
Z_Free(cnt_kills); cnt_kills = NULL; |
| 1493 |
} |
| 1494 |
|
| 1495 |
// ==================================================================== |
| 1496 |
// WI_initNetgameStats |
| 1497 |
// Purpose: Prepare for coop game stats |
| 1498 |
// Args: none |
| 1499 |
// Returns: void |
| 1500 |
// |
| 1501 |
void WI_initNetgameStats(void) |
| 1502 |
{ |
| 1503 |
int i; |
| 1504 |
|
| 1505 |
state = StatCount; |
| 1506 |
acceleratestage = 0; |
| 1507 |
ng_state = 1; |
| 1508 |
|
| 1509 |
cnt_pause = TICRATE; |
| 1510 |
|
| 1511 |
// CPhipps - allocate these dynamically, blank with calloc |
| 1512 |
cnt_kills = Z_Calloc(g_maxplayers, sizeof(*cnt_kills)); |
| 1513 |
cnt_items = Z_Calloc(g_maxplayers, sizeof(*cnt_items)); |
| 1514 |
cnt_secret= Z_Calloc(g_maxplayers, sizeof(*cnt_secret)); |
| 1515 |
cnt_frags = Z_Calloc(g_maxplayers, sizeof(*cnt_frags)); |
| 1516 |
|
| 1517 |
for (i = 0; i < g_maxplayers; i++) |
| 1518 |
if (playeringame[i]) |
| 1519 |
dofrags += WI_fragSum(i); |
| 1520 |
|
| 1521 |
dofrags = !!dofrags; // set to true or false - did we have frags? |
| 1522 |
|
| 1523 |
WI_initAnimatedBack(false); |
| 1524 |
} |
| 1525 |
|
| 1526 |
|
| 1527 |
// ==================================================================== |
| 1528 |
// WI_updateNetgameStats |
| 1529 |
// Purpose: Calculate coop stats as we display them with noise and fury |
| 1530 |
// Args: none |
| 1531 |
// Returns: void |
| 1532 |
// Comment: This stuff sure is complicated for what it does |
| 1533 |
// |
| 1534 |
void WI_updateNetgameStats(void) |
| 1535 |
{ |
| 1536 |
int i; |
| 1537 |
int fsum; |
| 1538 |
|
| 1539 |
dboolean stillticking; |
| 1540 |
|
| 1541 |
WI_updateAnimatedBack(); |
| 1542 |
|
| 1543 |
if (acceleratestage && ng_state != 10) |
| 1544 |
{ |
| 1545 |
acceleratestage = 0; |
| 1546 |
|
| 1547 |
for (i = 0; i < g_maxplayers; i++) |
| 1548 |
{ |
| 1549 |
if (!playeringame[i]) |
| 1550 |
continue; |
| 1551 |
|
| 1552 |
cnt_kills[i] = WI_killPercent(i); |
| 1553 |
cnt_items[i] = WI_itemPercent(i); |
| 1554 |
cnt_secret[i] = WI_secretPercent(i); |
| 1555 |
|
| 1556 |
if (dofrags) |
| 1557 |
cnt_frags[i] = WI_fragSum(i); // we had frags |
| 1558 |
} |
| 1559 |
S_StartVoidSound(sfx_barexp); // bang |
| 1560 |
ng_state = 10; |
| 1561 |
} |
| 1562 |
|
| 1563 |
if (ng_state == 2) |
| 1564 |
{ |
| 1565 |
if (!(bcnt&3)) |
| 1566 |
S_StartVoidSound(sfx_pistol); // pop |
| 1567 |
|
| 1568 |
stillticking = false; |
| 1569 |
|
| 1570 |
for (i = 0; i < g_maxplayers; i++) |
| 1571 |
{ |
| 1572 |
if (!playeringame[i]) |
| 1573 |
continue; |
| 1574 |
|
| 1575 |
cnt_kills[i] += 2; |
| 1576 |
|
| 1577 |
if (cnt_kills[i] >= WI_killLimit(i)) |
| 1578 |
cnt_kills[i] = WI_killPercent(i); |
| 1579 |
else |
| 1580 |
stillticking = true; // still got stuff to tally |
| 1581 |
} |
| 1582 |
|
| 1583 |
if (!stillticking) |
| 1584 |
{ |
| 1585 |
S_StartVoidSound(sfx_barexp); |
| 1586 |
ng_state++; |
| 1587 |
} |
| 1588 |
} |
| 1589 |
else if (ng_state == 4) |
| 1590 |
{ |
| 1591 |
if (!(bcnt&3)) |
| 1592 |
S_StartVoidSound(sfx_pistol); |
| 1593 |
|
| 1594 |
stillticking = false; |
| 1595 |
|
| 1596 |
for (i = 0; i < g_maxplayers; i++) |
| 1597 |
{ |
| 1598 |
if (!playeringame[i]) |
| 1599 |
continue; |
| 1600 |
|
| 1601 |
cnt_items[i] += 2; |
| 1602 |
if (cnt_items[i] >= WI_itemLimit(i)) |
| 1603 |
cnt_items[i] = WI_itemPercent(i); |
| 1604 |
else |
| 1605 |
stillticking = true; |
| 1606 |
} |
| 1607 |
|
| 1608 |
if (!stillticking) |
| 1609 |
{ |
| 1610 |
S_StartVoidSound(sfx_barexp); |
| 1611 |
ng_state++; |
| 1612 |
} |
| 1613 |
} |
| 1614 |
else if (ng_state == 6) |
| 1615 |
{ |
| 1616 |
if (!(bcnt&3)) |
| 1617 |
S_StartVoidSound(sfx_pistol); |
| 1618 |
|
| 1619 |
stillticking = false; |
| 1620 |
|
| 1621 |
for (i = 0; i < g_maxplayers; i++) |
| 1622 |
{ |
| 1623 |
if (!playeringame[i]) |
| 1624 |
continue; |
| 1625 |
|
| 1626 |
cnt_secret[i] += 2; |
| 1627 |
|
| 1628 |
if (cnt_secret[i] >= WI_secretLimit(i)) |
| 1629 |
cnt_secret[i] = WI_secretPercent(i); |
| 1630 |
else |
| 1631 |
stillticking = true; |
| 1632 |
} |
| 1633 |
|
| 1634 |
if (!stillticking) |
| 1635 |
{ |
| 1636 |
S_StartVoidSound(sfx_barexp); |
| 1637 |
ng_state += 1 + 2*!dofrags; |
| 1638 |
} |
| 1639 |
} |
| 1640 |
else if (ng_state == 8) |
| 1641 |
{ |
| 1642 |
if (!(bcnt&3)) |
| 1643 |
S_StartVoidSound(sfx_pistol); |
| 1644 |
|
| 1645 |
stillticking = false; |
| 1646 |
|
| 1647 |
for (i = 0; i < g_maxplayers; i++) |
| 1648 |
{ |
| 1649 |
if (!playeringame[i]) |
| 1650 |
continue; |
| 1651 |
|
| 1652 |
cnt_frags[i] += 1; |
| 1653 |
|
| 1654 |
if (cnt_frags[i] >= (fsum = WI_fragSum(i))) |
| 1655 |
cnt_frags[i] = fsum; |
| 1656 |
else |
| 1657 |
stillticking = true; |
| 1658 |
} |
| 1659 |
|
| 1660 |
if (!stillticking) |
| 1661 |
{ |
| 1662 |
S_StartVoidSound(sfx_pldeth); |
| 1663 |
ng_state++; |
| 1664 |
} |
| 1665 |
} |
| 1666 |
else if (ng_state == 10) |
| 1667 |
{ |
| 1668 |
if (acceleratestage) |
| 1669 |
{ |
| 1670 |
S_StartVoidSound(sfx_sgcock); |
| 1671 |
if ( gamemode == commercial ) |
| 1672 |
WI_initNoState(); |
| 1673 |
else |
| 1674 |
WI_initShowNextLoc(); |
| 1675 |
} |
| 1676 |
} |
| 1677 |
else if (ng_state & 1) |
| 1678 |
{ |
| 1679 |
if (!--cnt_pause) |
| 1680 |
{ |
| 1681 |
ng_state++; |
| 1682 |
cnt_pause = TICRATE; |
| 1683 |
} |
| 1684 |
} |
| 1685 |
} |
| 1686 |
|
| 1687 |
|
| 1688 |
// ==================================================================== |
| 1689 |
// WI_drawNetgameStats |
| 1690 |
// Purpose: Put the coop stats on the screen |
| 1691 |
// Args: none |
| 1692 |
// Returns: void |
| 1693 |
// |
| 1694 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 1695 |
// CPhipps - patch drawing updated |
| 1696 |
void WI_drawNetgameStats(void) |
| 1697 |
{ |
| 1698 |
int i; |
| 1699 |
int x; |
| 1700 |
int y; |
| 1701 |
int pwidth = V_NamePatchWidth(percent); |
| 1702 |
int fwidth = V_NamePatchWidth(facebackp); |
| 1703 |
|
| 1704 |
WI_slamBackground(); |
| 1705 |
|
| 1706 |
// draw animated background |
| 1707 |
WI_drawAnimatedBack(); |
| 1708 |
|
| 1709 |
WI_drawLF(); |
| 1710 |
|
| 1711 |
// draw stat titles (top line) |
| 1712 |
V_DrawNamePatch(NG_STATSX+NG_SPACINGX-V_NamePatchWidth(kills), |
| 1713 |
NG_STATSY, FB, kills, CR_DEFAULT, VPT_STRETCH); |
| 1714 |
|
| 1715 |
V_DrawNamePatch(NG_STATSX+2*NG_SPACINGX-V_NamePatchWidth(items), |
| 1716 |
NG_STATSY, FB, items, CR_DEFAULT, VPT_STRETCH); |
| 1717 |
|
| 1718 |
V_DrawNamePatch(NG_STATSX+3*NG_SPACINGX-V_NamePatchWidth(secret), |
| 1719 |
NG_STATSY, FB, secret, CR_DEFAULT, VPT_STRETCH); |
| 1720 |
|
| 1721 |
if (dofrags) |
| 1722 |
V_DrawNamePatch(NG_STATSX+4*NG_SPACINGX-V_NamePatchWidth(frags), |
| 1723 |
NG_STATSY, FB, frags, CR_DEFAULT, VPT_STRETCH); |
| 1724 |
|
| 1725 |
// draw stats |
| 1726 |
y = NG_STATSY + V_NamePatchHeight(kills); |
| 1727 |
|
| 1728 |
for (i = 0; i < g_maxplayers; i++) |
| 1729 |
{ |
| 1730 |
//int trans = playernumtotrans[i]; |
| 1731 |
if (!playeringame[i]) |
| 1732 |
continue; |
| 1733 |
|
| 1734 |
x = NG_STATSX; |
| 1735 |
V_DrawNamePatch(x-fwidth, y, FB, facebackp, |
| 1736 |
i ? CR_LIMIT+i : CR_DEFAULT, |
| 1737 |
VPT_STRETCH | (i ? VPT_TRANS : 0)); |
| 1738 |
|
| 1739 |
if (i == me) |
| 1740 |
V_DrawNamePatch(x-fwidth, y, FB, star, CR_DEFAULT, VPT_STRETCH); |
| 1741 |
|
| 1742 |
x += NG_SPACINGX; |
| 1743 |
if (cnt_kills) |
| 1744 |
WI_drawPercent(x-pwidth, y+10, cnt_kills[i]); |
| 1745 |
x += NG_SPACINGX; |
| 1746 |
if (cnt_items) |
| 1747 |
WI_drawPercent(x-pwidth, y+10, cnt_items[i]); |
| 1748 |
x += NG_SPACINGX; |
| 1749 |
if (cnt_secret) |
| 1750 |
WI_drawPercent(x-pwidth, y+10, cnt_secret[i]); |
| 1751 |
x += NG_SPACINGX; |
| 1752 |
|
| 1753 |
if (dofrags && cnt_frags) |
| 1754 |
WI_drawNum(x, y+10, cnt_frags[i], -1); |
| 1755 |
|
| 1756 |
y += WI_SPACINGY; |
| 1757 |
} |
| 1758 |
|
| 1759 |
if (y <= SP_TIMEY) |
| 1760 |
// cph - show times in coop on the entering screen |
| 1761 |
WI_drawTimeStats(plrs[me].stime / TICRATE, wbs->totaltimes / TICRATE, wbs->partime / TICRATE); |
| 1762 |
} |
| 1763 |
|
| 1764 |
static int sp_state; |
| 1765 |
|
| 1766 |
// ==================================================================== |
| 1767 |
// WI_initStats |
| 1768 |
// Purpose: Get ready for single player stats |
| 1769 |
// Args: none |
| 1770 |
// Returns: void |
| 1771 |
// Comment: Seems like we could do all these stats in a more generic |
| 1772 |
// set of routines that weren't duplicated for dm, coop, sp |
| 1773 |
// |
| 1774 |
void WI_initStats(void) |
| 1775 |
{ |
| 1776 |
state = StatCount; |
| 1777 |
acceleratestage = 0; |
| 1778 |
sp_state = 1; |
| 1779 |
|
| 1780 |
// CPhipps - allocate (awful code, I know, but saves changing it all) and initialise |
| 1781 |
*(cnt_kills = Z_Malloc(sizeof(*cnt_kills))) = |
| 1782 |
*(cnt_items = Z_Malloc(sizeof(*cnt_items))) = |
| 1783 |
*(cnt_secret= Z_Malloc(sizeof(*cnt_secret))) = -1; |
| 1784 |
cnt_time = cnt_par = cnt_total_time = -1; |
| 1785 |
cnt_pause = TICRATE; |
| 1786 |
|
| 1787 |
WI_initAnimatedBack(false); |
| 1788 |
} |
| 1789 |
|
| 1790 |
// ==================================================================== |
| 1791 |
// WI_updateStats |
| 1792 |
// Purpose: Calculate solo stats |
| 1793 |
// Args: none |
| 1794 |
// Returns: void |
| 1795 |
// |
| 1796 |
void WI_updateStats(void) |
| 1797 |
{ |
| 1798 |
//e6y |
| 1799 |
static dboolean play_early_explosion = true; |
| 1800 |
|
| 1801 |
WI_updateAnimatedBack(); |
| 1802 |
|
| 1803 |
if (acceleratestage && sp_state != 10) |
| 1804 |
{ |
| 1805 |
acceleratestage = 0; |
| 1806 |
cnt_kills[0] = WI_killPercent(me); |
| 1807 |
cnt_items[0] = WI_itemPercent(me); |
| 1808 |
cnt_secret[0] = WI_secretPercent(me); |
| 1809 |
|
| 1810 |
cnt_total_time = wbs->totaltimes / TICRATE; |
| 1811 |
cnt_time = plrs[me].stime / TICRATE; |
| 1812 |
cnt_par = wbs->partime / TICRATE; |
| 1813 |
S_StartVoidSound(sfx_barexp); |
| 1814 |
sp_state = 10; |
| 1815 |
} |
| 1816 |
|
| 1817 |
if (sp_state == 2) |
| 1818 |
{ |
| 1819 |
cnt_kills[0] += 2; |
| 1820 |
|
| 1821 |
if (!(bcnt&3)) |
| 1822 |
S_StartVoidSound(sfx_pistol); |
| 1823 |
|
| 1824 |
if (cnt_kills[0] >= WI_killLimit(me)) |
| 1825 |
{ |
| 1826 |
cnt_kills[0] = WI_killPercent(me); |
| 1827 |
S_StartVoidSound(sfx_barexp); |
| 1828 |
sp_state++; |
| 1829 |
} |
| 1830 |
} |
| 1831 |
else if (sp_state == 4) |
| 1832 |
{ |
| 1833 |
cnt_items[0] += 2; |
| 1834 |
|
| 1835 |
if (!(bcnt&3)) |
| 1836 |
S_StartVoidSound(sfx_pistol); |
| 1837 |
|
| 1838 |
if (cnt_items[0] >= WI_itemLimit(me)) |
| 1839 |
{ |
| 1840 |
cnt_items[0] = WI_itemPercent(me); |
| 1841 |
S_StartVoidSound(sfx_barexp); |
| 1842 |
sp_state++; |
| 1843 |
} |
| 1844 |
} |
| 1845 |
else if (sp_state == 6) |
| 1846 |
{ |
| 1847 |
cnt_secret[0] += 2; |
| 1848 |
|
| 1849 |
if (!(bcnt&3)) |
| 1850 |
S_StartVoidSound(sfx_pistol); |
| 1851 |
|
| 1852 |
if (cnt_secret[0] >= WI_secretLimit(me)) |
| 1853 |
{ |
| 1854 |
cnt_secret[0] = WI_secretPercent(me); |
| 1855 |
S_StartVoidSound(sfx_barexp); |
| 1856 |
sp_state++; |
| 1857 |
} |
| 1858 |
} |
| 1859 |
else if (sp_state == 8) |
| 1860 |
{ |
| 1861 |
if (!(bcnt&3) && play_early_explosion) //e6y: do not play count sound after explosion sound |
| 1862 |
S_StartVoidSound(sfx_pistol); |
| 1863 |
|
| 1864 |
cnt_time += 3; |
| 1865 |
|
| 1866 |
if (cnt_time >= plrs[me].stime / TICRATE) |
| 1867 |
cnt_time = plrs[me].stime / TICRATE; |
| 1868 |
|
| 1869 |
cnt_total_time += 3; |
| 1870 |
|
| 1871 |
if (cnt_total_time >= wbs->totaltimes / TICRATE) |
| 1872 |
cnt_total_time = wbs->totaltimes / TICRATE; |
| 1873 |
|
| 1874 |
cnt_par += 3; |
| 1875 |
|
| 1876 |
// e6y |
| 1877 |
// if par time is hidden (if modifiedgame is true) |
| 1878 |
// the game should play explosion sound immediately after |
| 1879 |
// the counter will reach level time instead of par time |
| 1880 |
if (modifiedgame && play_early_explosion) |
| 1881 |
{ |
| 1882 |
if ((cnt_time >= plrs[me].stime / TICRATE) && (compatibility_level < lxdoom_1_compatibility || cnt_total_time >= wbs->totaltimes / TICRATE)) |
| 1883 |
{ |
| 1884 |
// for ExM8 levels if the player won't have pressed <Use> |
| 1885 |
if (compatibility_level < lxdoom_1_compatibility) |
| 1886 |
cnt_total_time = wbs->totaltimes / TICRATE; |
| 1887 |
|
| 1888 |
S_StartVoidSound(sfx_barexp); |
| 1889 |
play_early_explosion = false; // do not play it twice or more |
| 1890 |
} |
| 1891 |
} |
| 1892 |
|
| 1893 |
if (cnt_par >= wbs->partime / TICRATE) |
| 1894 |
{ |
| 1895 |
cnt_par = wbs->partime / TICRATE; |
| 1896 |
|
| 1897 |
if ((cnt_time >= plrs[me].stime / TICRATE) && (compatibility_level < lxdoom_1_compatibility || cnt_total_time >= wbs->totaltimes / TICRATE)) |
| 1898 |
{ |
| 1899 |
//e6y: for ExM8 levels |
| 1900 |
if (compatibility_level < lxdoom_1_compatibility) |
| 1901 |
cnt_total_time = wbs->totaltimes / TICRATE; |
| 1902 |
|
| 1903 |
if (!modifiedgame) //e6y: do not play explosion sound if it was already played |
| 1904 |
S_StartVoidSound(sfx_barexp); |
| 1905 |
sp_state++; |
| 1906 |
} |
| 1907 |
} |
| 1908 |
} |
| 1909 |
else if (sp_state == 10) |
| 1910 |
{ |
| 1911 |
if (acceleratestage) |
| 1912 |
{ |
| 1913 |
S_StartVoidSound(sfx_sgcock); |
| 1914 |
|
| 1915 |
if (gamemode == commercial) |
| 1916 |
WI_initNoState(); |
| 1917 |
else |
| 1918 |
WI_initShowNextLoc(); |
| 1919 |
} |
| 1920 |
} |
| 1921 |
else if (sp_state & 1) |
| 1922 |
{ |
| 1923 |
play_early_explosion = true; //e6y |
| 1924 |
if (!--cnt_pause) |
| 1925 |
{ |
| 1926 |
sp_state++; |
| 1927 |
cnt_pause = TICRATE; |
| 1928 |
} |
| 1929 |
} |
| 1930 |
} |
| 1931 |
|
| 1932 |
// ==================================================================== |
| 1933 |
// WI_drawStats |
| 1934 |
// Purpose: Put the solo stats on the screen |
| 1935 |
// Args: none |
| 1936 |
// Returns: void |
| 1937 |
// |
| 1938 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 1939 |
// CPhipps - patch drawing updated |
| 1940 |
void WI_drawStats(void) |
| 1941 |
{ |
| 1942 |
// line height |
| 1943 |
int lh; |
| 1944 |
|
| 1945 |
lh = (3*num[0].height)/2; |
| 1946 |
|
| 1947 |
WI_slamBackground(); |
| 1948 |
|
| 1949 |
// draw animated background |
| 1950 |
WI_drawAnimatedBack(); |
| 1951 |
|
| 1952 |
WI_drawLF(); |
| 1953 |
|
| 1954 |
V_DrawNamePatch(SP_STATSX, SP_STATSY, FB, kills, CR_DEFAULT, VPT_STRETCH); |
| 1955 |
if (cnt_kills) |
| 1956 |
WI_drawPercent(320 - SP_STATSX, SP_STATSY, cnt_kills[0]); |
| 1957 |
|
| 1958 |
V_DrawNamePatch(SP_STATSX, SP_STATSY+lh, FB, items, CR_DEFAULT, VPT_STRETCH); |
| 1959 |
if (cnt_items) |
| 1960 |
WI_drawPercent(320 - SP_STATSX, SP_STATSY+lh, cnt_items[0]); |
| 1961 |
|
| 1962 |
V_DrawNamePatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret, CR_DEFAULT, VPT_STRETCH); |
| 1963 |
if (cnt_secret) |
| 1964 |
WI_drawPercent(320 - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]); |
| 1965 |
|
| 1966 |
WI_drawTimeStats(cnt_time, cnt_total_time, cnt_par); |
| 1967 |
} |
| 1968 |
|
| 1969 |
// ==================================================================== |
| 1970 |
// WI_checkForAccelerate |
| 1971 |
// Purpose: See if the player has hit either the attack or use key |
| 1972 |
// or mouse button. If so we set acceleratestage to 1 and |
| 1973 |
// all those display routines above jump right to the end. |
| 1974 |
// Args: none |
| 1975 |
// Returns: void |
| 1976 |
// |
| 1977 |
void WI_checkForAccelerate(void) |
| 1978 |
{ |
| 1979 |
int i; |
| 1980 |
player_t *player; |
| 1981 |
|
| 1982 |
// check for button presses to skip delays |
| 1983 |
for (i = 0, player = players; i < g_maxplayers; i++, player++) |
| 1984 |
{ |
| 1985 |
if (playeringame[i]) |
| 1986 |
{ |
| 1987 |
if (player->cmd.buttons & BT_ATTACK) |
| 1988 |
{ |
| 1989 |
if (!player->attackdown) |
| 1990 |
acceleratestage = 1; |
| 1991 |
player->attackdown = true; |
| 1992 |
} |
| 1993 |
else |
| 1994 |
player->attackdown = false; |
| 1995 |
|
| 1996 |
if (player->cmd.buttons & BT_USE) |
| 1997 |
{ |
| 1998 |
if (!player->usedown) |
| 1999 |
acceleratestage = 1; |
| 2000 |
player->usedown = true; |
| 2001 |
} |
| 2002 |
else |
| 2003 |
player->usedown = false; |
| 2004 |
} |
| 2005 |
} |
| 2006 |
} |
| 2007 |
|
| 2008 |
// ==================================================================== |
| 2009 |
// WI_Ticker |
| 2010 |
// Purpose: Do various updates every gametic, for stats, animation, |
| 2011 |
// checking that intermission music is running, etc. |
| 2012 |
// Args: none |
| 2013 |
// Returns: void |
| 2014 |
// |
| 2015 |
void WI_Ticker(void) |
| 2016 |
{ |
| 2017 |
if (heretic) return IN_Ticker(); |
| 2018 |
if (hexen) return Hexen_IN_Ticker(); |
| 2019 |
|
| 2020 |
// counter for general background animation |
| 2021 |
bcnt++; |
| 2022 |
|
| 2023 |
if (bcnt == 1) |
| 2024 |
{ |
| 2025 |
int mnum; |
| 2026 |
int muslump; |
| 2027 |
|
| 2028 |
dsda_IntermissionMusic(&mnum, &muslump); |
| 2029 |
|
| 2030 |
if (muslump >= 0) |
| 2031 |
{ |
| 2032 |
S_ChangeMusInfoMusic(muslump, true); |
| 2033 |
} |
| 2034 |
else |
| 2035 |
{ |
| 2036 |
S_ChangeMusic(mnum, true); |
| 2037 |
} |
| 2038 |
} |
| 2039 |
|
| 2040 |
WI_checkForAccelerate(); |
| 2041 |
|
| 2042 |
switch (state) |
| 2043 |
{ |
| 2044 |
case StatCount: |
| 2045 |
if (deathmatch) WI_updateDeathmatchStats(); |
| 2046 |
else if (netgame) WI_updateNetgameStats(); |
| 2047 |
else WI_updateStats(); |
| 2048 |
break; |
| 2049 |
|
| 2050 |
case ShowNextLoc: |
| 2051 |
WI_updateShowNextLoc(); |
| 2052 |
break; |
| 2053 |
|
| 2054 |
case NoState: |
| 2055 |
WI_updateNoState(); |
| 2056 |
break; |
| 2057 |
} |
| 2058 |
} |
| 2059 |
|
| 2060 |
/* ==================================================================== |
| 2061 |
* WI_loadData |
| 2062 |
* Purpose: Initialize intermission data such as background graphics, |
| 2063 |
* patches, map names, etc. |
| 2064 |
* Args: none |
| 2065 |
* Returns: void |
| 2066 |
* |
| 2067 |
* CPhipps - modified for new wad lump handling. |
| 2068 |
* - no longer preload most graphics, other funcs can use |
| 2069 |
* them by name |
| 2070 |
*/ |
| 2071 |
|
| 2072 |
void WI_loadData(void) |
| 2073 |
{ |
| 2074 |
int i; |
| 2075 |
int j; |
| 2076 |
char name[9]; // limited to 8 characters |
| 2077 |
wi_anim_t* a; |
| 2078 |
|
| 2079 |
if (gamemode != commercial) |
| 2080 |
{ |
| 2081 |
if (wbs->epsd < 3) |
| 2082 |
{ |
| 2083 |
for (j=0;j<NUMANIMS[wbs->epsd];j++) |
| 2084 |
{ |
| 2085 |
a = &anims[wbs->epsd][j]; |
| 2086 |
for (i=0;i<a->nanims;i++) |
| 2087 |
{ |
| 2088 |
// MONDO HACK! |
| 2089 |
if (wbs->epsd != 1 || j != 8) |
| 2090 |
{ |
| 2091 |
// animations |
| 2092 |
snprintf(name, sizeof(name), "WIA%d%.2d%.2d", wbs->epsd, j, i); |
| 2093 |
R_SetPatchNum(&a->p[i], name); |
| 2094 |
} |
| 2095 |
else |
| 2096 |
{ |
| 2097 |
// HACK ALERT! |
| 2098 |
if ( gamemap == 8 ) |
| 2099 |
a->p[i] = anims[1][6].p[i]; // if map is E2M8, use E2M7 data |
| 2100 |
else |
| 2101 |
a->p[i] = anims[1][4].p[i]; // E2M5 data (for E2M9) |
| 2102 |
} |
| 2103 |
} |
| 2104 |
} |
| 2105 |
} |
| 2106 |
} |
| 2107 |
|
| 2108 |
for (i=0;i<10;i++) |
| 2109 |
{ |
| 2110 |
// numbers 0-9 |
| 2111 |
snprintf(name, sizeof(name), "WINUM%d", i); |
| 2112 |
R_SetPatchNum(&num[i], name); |
| 2113 |
} |
| 2114 |
} |
| 2115 |
|
| 2116 |
|
| 2117 |
// ==================================================================== |
| 2118 |
// WI_Drawer |
| 2119 |
// Purpose: Call the appropriate stats drawing routine depending on |
| 2120 |
// what kind of game is being played (DM, coop, solo) |
| 2121 |
// Args: none |
| 2122 |
// Returns: void |
| 2123 |
// |
| 2124 |
void WI_Drawer (void) |
| 2125 |
{ |
| 2126 |
if (heretic) return IN_Drawer(); |
| 2127 |
if (hexen) return Hexen_IN_Drawer(); |
| 2128 |
|
| 2129 |
switch (state) |
| 2130 |
{ |
| 2131 |
case StatCount: |
| 2132 |
if (deathmatch) |
| 2133 |
WI_drawDeathmatchStats(); |
| 2134 |
else if (netgame) |
| 2135 |
WI_drawNetgameStats(); |
| 2136 |
else |
| 2137 |
WI_drawStats(); |
| 2138 |
break; |
| 2139 |
|
| 2140 |
case ShowNextLoc: |
| 2141 |
WI_drawShowNextLoc(); |
| 2142 |
break; |
| 2143 |
|
| 2144 |
case NoState: |
| 2145 |
WI_drawNoState(); |
| 2146 |
break; |
| 2147 |
} |
| 2148 |
} |
| 2149 |
|
| 2150 |
|
| 2151 |
// ==================================================================== |
| 2152 |
// WI_initVariables |
| 2153 |
// Purpose: Initialize the intermission information structure |
| 2154 |
// Note: wbstartstruct_t is defined in d_player.h |
| 2155 |
// Args: wbstartstruct -- pointer to the structure with the data |
| 2156 |
// Returns: void |
| 2157 |
// |
| 2158 |
void WI_initVariables(wbstartstruct_t* wbstartstruct) |
| 2159 |
{ |
| 2160 |
|
| 2161 |
wbs = wbstartstruct; |
| 2162 |
|
| 2163 |
#ifdef RANGECHECKING |
| 2164 |
if (gamemode != commercial) |
| 2165 |
{ |
| 2166 |
if ( gamemode == retail ) |
| 2167 |
RNGCHECK(wbs->epsd, 0, 3); |
| 2168 |
else |
| 2169 |
RNGCHECK(wbs->epsd, 0, 2); |
| 2170 |
} |
| 2171 |
else |
| 2172 |
{ |
| 2173 |
RNGCHECK(wbs->last, 0, 8); |
| 2174 |
RNGCHECK(wbs->next, 0, 8); |
| 2175 |
} |
| 2176 |
RNGCHECK(wbs->pnum, 0, g_maxplayers); |
| 2177 |
RNGCHECK(wbs->pnum, 0, g_maxplayers); |
| 2178 |
#endif |
| 2179 |
|
| 2180 |
acceleratestage = 0; |
| 2181 |
cnt = bcnt = 0; |
| 2182 |
firstrefresh = 1; |
| 2183 |
me = wbs->pnum; |
| 2184 |
plrs = wbs->plyr; |
| 2185 |
|
| 2186 |
if ( gamemode != retail ) |
| 2187 |
if (wbs->epsd > 2) |
| 2188 |
wbs->epsd -= 3; |
| 2189 |
} |
| 2190 |
|
| 2191 |
// ==================================================================== |
| 2192 |
// WI_Start |
| 2193 |
// Purpose: Call the various init routines |
| 2194 |
// Note: wbstartstruct_t is defined in d_player.h |
| 2195 |
// Args: wbstartstruct -- pointer to the structure with the |
| 2196 |
// intermission data |
| 2197 |
// Returns: void |
| 2198 |
// |
| 2199 |
void WI_Start(wbstartstruct_t* wbstartstruct) |
| 2200 |
{ |
| 2201 |
if (heretic) return IN_Start(wbstartstruct); |
| 2202 |
if (hexen) return Hexen_IN_Start(wbstartstruct); |
| 2203 |
|
| 2204 |
WI_initVariables(wbstartstruct); |
| 2205 |
WI_loadData(); |
| 2206 |
|
| 2207 |
exitpic = dsda_ExitPic(); |
| 2208 |
enterpic = dsda_EnterPic(); |
| 2209 |
|
| 2210 |
if (deathmatch) |
| 2211 |
WI_initDeathmatchStats(); |
| 2212 |
else if (netgame) |
| 2213 |
WI_initNetgameStats(); |
| 2214 |
else |
| 2215 |
WI_initStats(); |
| 2216 |
} |