| 1 |
// |
| 2 |
// Copyright(C) 1993-1996 Id Software, Inc. |
| 3 |
// Copyright(C) 1993-2008 Raven Software |
| 4 |
// Copyright(C) 2005-2014 Simon Howard |
| 5 |
// |
| 6 |
// This program is free software; you can redistribute it and/or |
| 7 |
// modify it under the terms of the GNU General Public License |
| 8 |
// as published by the Free Software Foundation; either version 2 |
| 9 |
// of the License, or (at your option) any later version. |
| 10 |
// |
| 11 |
// This program is distributed in the hope that it will be useful, |
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
// GNU General Public License for more details. |
| 15 |
// |
| 16 |
/* |
| 17 |
======================== |
| 18 |
= |
| 19 |
= IN_lude.c |
| 20 |
= |
| 21 |
======================== |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "am_map.h" |
| 25 |
#include "doomstat.h" |
| 26 |
#include "d_event.h" |
| 27 |
#include "s_sound.h" |
| 28 |
#include "sounds.h" |
| 29 |
#include "i_system.h" |
| 30 |
#include "i_video.h" |
| 31 |
#include "v_video.h" |
| 32 |
#include "lprintf.h" |
| 33 |
#include "w_wad.h" |
| 34 |
#include "g_game.h" |
| 35 |
|
| 36 |
#include "dsda/exhud.h" |
| 37 |
|
| 38 |
#include "heretic/def.h" |
| 39 |
#include "heretic/dstrings.h" |
| 40 |
#include "heretic/mn_menu.h" |
| 41 |
#include "heretic/sb_bar.h" |
| 42 |
|
| 43 |
#include "in_lude.h" |
| 44 |
|
| 45 |
extern dboolean BorderNeedRefresh; |
| 46 |
|
| 47 |
typedef enum |
| 48 |
{ |
| 49 |
SINGLE, |
| 50 |
COOPERATIVE, |
| 51 |
DEATHMATCH |
| 52 |
} gametype_t; |
| 53 |
|
| 54 |
static void IN_WaitStop(void); |
| 55 |
static void IN_Stop(void); |
| 56 |
static void IN_CheckForSkip(void); |
| 57 |
static void IN_InitStats(void); |
| 58 |
static void IN_DrawOldLevel(void); |
| 59 |
static void IN_DrawYAH(void); |
| 60 |
static void IN_DrawStatBack(void); |
| 61 |
static void IN_DrawSingleStats(void); |
| 62 |
static void IN_DrawCoopStats(void); |
| 63 |
static void IN_DrawDMStats(void); |
| 64 |
static void IN_DrawNumber(int val, int x, int y, int digits); |
| 65 |
static void IN_DrawTime(int x, int y, int h, int m, int s); |
| 66 |
static void IN_DrTextB(const char *text, int x, int y); |
| 67 |
|
| 68 |
// contains information passed into intermission |
| 69 |
static wbstartstruct_t* wbs; |
| 70 |
|
| 71 |
static int prevmap; |
| 72 |
static int nextmap; |
| 73 |
static dboolean intermission; |
| 74 |
static dboolean skipintermission; |
| 75 |
static dboolean finalintermission; |
| 76 |
static int interstate = 0; |
| 77 |
static int intertime = -1; |
| 78 |
static int oldintertime = 0; |
| 79 |
static gametype_t gametype; |
| 80 |
|
| 81 |
static int cnt; |
| 82 |
|
| 83 |
static int hours; |
| 84 |
static int minutes; |
| 85 |
static int seconds; |
| 86 |
|
| 87 |
// [crispy] Show total time on intermission |
| 88 |
static int totalHours; |
| 89 |
static int totalMinutes; |
| 90 |
static int totalSeconds; |
| 91 |
|
| 92 |
static int slaughterboy; // in DM, the player with the most kills |
| 93 |
|
| 94 |
static int killPercent[MAX_MAXPLAYERS]; |
| 95 |
static int bonusPercent[MAX_MAXPLAYERS]; |
| 96 |
static int secretPercent[MAX_MAXPLAYERS]; |
| 97 |
|
| 98 |
static int FontBNumbers[10]; |
| 99 |
|
| 100 |
static int FontBLump; |
| 101 |
static int patchFaceOkayBase; |
| 102 |
static int patchFaceDeadBase; |
| 103 |
|
| 104 |
static signed int totalFrags[MAX_MAXPLAYERS]; |
| 105 |
static fixed_t dSlideX[MAX_MAXPLAYERS]; |
| 106 |
static fixed_t dSlideY[MAX_MAXPLAYERS]; |
| 107 |
|
| 108 |
static const char *KillersText[] = { "K", "I", "L", "L", "E", "R", "S" }; |
| 109 |
|
| 110 |
extern const char *LevelNames[]; |
| 111 |
|
| 112 |
typedef struct |
| 113 |
{ |
| 114 |
int x; |
| 115 |
int y; |
| 116 |
} yahpt_t; |
| 117 |
|
| 118 |
static yahpt_t YAHspot[3][9] = { |
| 119 |
{ |
| 120 |
{172, 78}, |
| 121 |
{86, 90}, |
| 122 |
{73, 66}, |
| 123 |
{159, 95}, |
| 124 |
{148, 126}, |
| 125 |
{132, 54}, |
| 126 |
{131, 74}, |
| 127 |
{208, 138}, |
| 128 |
{52, 101} |
| 129 |
}, |
| 130 |
{ |
| 131 |
{218, 57}, |
| 132 |
{137, 81}, |
| 133 |
{155, 124}, |
| 134 |
{171, 68}, |
| 135 |
{250, 86}, |
| 136 |
{136, 98}, |
| 137 |
{203, 90}, |
| 138 |
{220, 140}, |
| 139 |
{279, 106} |
| 140 |
}, |
| 141 |
{ |
| 142 |
{86, 99}, |
| 143 |
{124, 103}, |
| 144 |
{154, 79}, |
| 145 |
{202, 83}, |
| 146 |
{178, 59}, |
| 147 |
{142, 58}, |
| 148 |
{219, 66}, |
| 149 |
{247, 57}, |
| 150 |
{107, 80} |
| 151 |
} |
| 152 |
}; |
| 153 |
|
| 154 |
static const char *NameForMap(int map) |
| 155 |
{ |
| 156 |
const char *name = LevelNames[(gameepisode - 1) * 9 + map - 1]; |
| 157 |
|
| 158 |
if (strlen(name) < 7) |
| 159 |
{ |
| 160 |
return ""; |
| 161 |
} |
| 162 |
return name + 7; |
| 163 |
} |
| 164 |
|
| 165 |
static void IN_DrawInterpic(void) |
| 166 |
{ |
| 167 |
char name[9]; |
| 168 |
|
| 169 |
if (gameepisode < 1 || gameepisode > 3) return; |
| 170 |
|
| 171 |
snprintf(name, sizeof(name), "MAPE%d", gameepisode); |
| 172 |
|
| 173 |
// e6y: wide-res |
| 174 |
V_ClearBorder(); |
| 175 |
V_DrawNamePatchFS(0, 0, 0, name, CR_DEFAULT, VPT_STRETCH); |
| 176 |
} |
| 177 |
|
| 178 |
static void IN_DrawBeenThere(int i) |
| 179 |
{ |
| 180 |
V_DrawNamePatch( |
| 181 |
YAHspot[gameepisode - 1][i].x, YAHspot[gameepisode - 1][i].y, 0, |
| 182 |
"IN_X", CR_DEFAULT, VPT_STRETCH |
| 183 |
); |
| 184 |
} |
| 185 |
|
| 186 |
static void IN_DrawGoingThere(int i) |
| 187 |
{ |
| 188 |
V_DrawNamePatch( |
| 189 |
YAHspot[gameepisode - 1][i].x, YAHspot[gameepisode - 1][i].y, 0, |
| 190 |
"IN_YAH", CR_DEFAULT, VPT_STRETCH |
| 191 |
); |
| 192 |
} |
| 193 |
|
| 194 |
static void IN_InitLumps(void) |
| 195 |
{ |
| 196 |
int i, base; |
| 197 |
|
| 198 |
base = W_GetNumForName("FONTB16"); |
| 199 |
for (i = 0; i < 10; i++) |
| 200 |
{ |
| 201 |
FontBNumbers[i] = base + i; |
| 202 |
} |
| 203 |
|
| 204 |
FontBLump = W_GetNumForName("FONTB_S") + 1; |
| 205 |
patchFaceOkayBase = W_GetNumForName("FACEA0"); |
| 206 |
patchFaceDeadBase = W_GetNumForName("FACEB0"); |
| 207 |
} |
| 208 |
|
| 209 |
static void IN_InitVariables(wbstartstruct_t* wbstartstruct) |
| 210 |
{ |
| 211 |
wbs = wbstartstruct; |
| 212 |
prevmap = wbs->last + 1; |
| 213 |
nextmap = wbs->next + 1; |
| 214 |
|
| 215 |
finalintermission = (prevmap == 8); |
| 216 |
} |
| 217 |
|
| 218 |
//======================================================================== |
| 219 |
// |
| 220 |
// IN_Start |
| 221 |
// |
| 222 |
//======================================================================== |
| 223 |
|
| 224 |
void IN_Start(wbstartstruct_t* wbstartstruct) |
| 225 |
{ |
| 226 |
V_SetPalette(0); |
| 227 |
IN_InitVariables(wbstartstruct); |
| 228 |
IN_InitLumps(); |
| 229 |
IN_InitStats(); |
| 230 |
intermission = true; |
| 231 |
interstate = -1; |
| 232 |
skipintermission = false; |
| 233 |
intertime = 0; |
| 234 |
oldintertime = 0; |
| 235 |
AM_Stop(false); |
| 236 |
S_ChangeMusic(heretic_mus_intr, true); |
| 237 |
} |
| 238 |
|
| 239 |
//======================================================================== |
| 240 |
// |
| 241 |
// IN_WaitStop |
| 242 |
// |
| 243 |
//======================================================================== |
| 244 |
|
| 245 |
void IN_WaitStop(void) |
| 246 |
{ |
| 247 |
if (!--cnt) |
| 248 |
{ |
| 249 |
IN_Stop(); |
| 250 |
G_WorldDone(); |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
//======================================================================== |
| 255 |
// |
| 256 |
// IN_Stop |
| 257 |
// |
| 258 |
//======================================================================== |
| 259 |
|
| 260 |
void IN_Stop(void) |
| 261 |
{ |
| 262 |
intermission = false; |
| 263 |
SB_Start(); |
| 264 |
BorderNeedRefresh = true; |
| 265 |
} |
| 266 |
|
| 267 |
//======================================================================== |
| 268 |
// |
| 269 |
// IN_InitStats |
| 270 |
// |
| 271 |
// Initializes the stats for single player mode |
| 272 |
//======================================================================== |
| 273 |
|
| 274 |
void IN_InitStats(void) |
| 275 |
{ |
| 276 |
int i; |
| 277 |
int j; |
| 278 |
signed int slaughterfrags; |
| 279 |
int posnum; |
| 280 |
int slaughtercount; |
| 281 |
int playercount; |
| 282 |
int count; |
| 283 |
|
| 284 |
if (!netgame) |
| 285 |
{ |
| 286 |
gametype = SINGLE; |
| 287 |
count = leveltime / 35; |
| 288 |
hours = count / 3600; |
| 289 |
count -= hours * 3600; |
| 290 |
minutes = count / 60; |
| 291 |
count -= minutes * 60; |
| 292 |
seconds = count; |
| 293 |
|
| 294 |
// [crispy] Show total time on intermission |
| 295 |
count = wbs->totaltimes / 35; |
| 296 |
totalHours = count / 3600; |
| 297 |
count -= totalHours * 3600; |
| 298 |
totalMinutes = count / 60; |
| 299 |
count -= totalMinutes * 60; |
| 300 |
totalSeconds = count; |
| 301 |
} |
| 302 |
else if (netgame && !deathmatch) |
| 303 |
{ |
| 304 |
gametype = COOPERATIVE; |
| 305 |
memset(killPercent, 0, MAX_MAXPLAYERS * sizeof(int)); |
| 306 |
memset(bonusPercent, 0, MAX_MAXPLAYERS * sizeof(int)); |
| 307 |
memset(secretPercent, 0, MAX_MAXPLAYERS * sizeof(int)); |
| 308 |
for (i = 0; i < g_maxplayers; i++) |
| 309 |
{ |
| 310 |
if (playeringame[i]) |
| 311 |
{ |
| 312 |
if (totalkills) |
| 313 |
{ |
| 314 |
killPercent[i] = players[i].killcount * 100 / totalkills; |
| 315 |
} |
| 316 |
if (totalitems) |
| 317 |
{ |
| 318 |
bonusPercent[i] = players[i].itemcount * 100 / totalitems; |
| 319 |
} |
| 320 |
if (totalsecret) |
| 321 |
{ |
| 322 |
secretPercent[i] = |
| 323 |
players[i].secretcount * 100 / totalsecret; |
| 324 |
} |
| 325 |
} |
| 326 |
} |
| 327 |
} |
| 328 |
else |
| 329 |
{ |
| 330 |
gametype = DEATHMATCH; |
| 331 |
slaughterboy = 0; |
| 332 |
slaughterfrags = -9999; |
| 333 |
posnum = 0; |
| 334 |
playercount = 0; |
| 335 |
slaughtercount = 0; |
| 336 |
for (i = 0; i < g_maxplayers; i++) |
| 337 |
{ |
| 338 |
totalFrags[i] = 0; |
| 339 |
if (playeringame[i]) |
| 340 |
{ |
| 341 |
playercount++; |
| 342 |
for (j = 0; j < g_maxplayers; j++) |
| 343 |
{ |
| 344 |
if (playeringame[j]) |
| 345 |
{ |
| 346 |
totalFrags[i] += players[i].frags[j]; |
| 347 |
} |
| 348 |
} |
| 349 |
dSlideX[i] = (43 * posnum * FRACUNIT) / 20; |
| 350 |
dSlideY[i] = (36 * posnum * FRACUNIT) / 20; |
| 351 |
posnum++; |
| 352 |
} |
| 353 |
if (totalFrags[i] > slaughterfrags) |
| 354 |
{ |
| 355 |
slaughterboy = 1 << i; |
| 356 |
slaughterfrags = totalFrags[i]; |
| 357 |
slaughtercount = 1; |
| 358 |
} |
| 359 |
else if (totalFrags[i] == slaughterfrags) |
| 360 |
{ |
| 361 |
slaughterboy |= 1 << i; |
| 362 |
slaughtercount++; |
| 363 |
} |
| 364 |
} |
| 365 |
if (playercount == slaughtercount) |
| 366 |
{ // don't do the slaughter stuff if everyone is equal |
| 367 |
slaughterboy = 0; |
| 368 |
} |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
//======================================================================== |
| 373 |
// |
| 374 |
// IN_Ticker |
| 375 |
// |
| 376 |
//======================================================================== |
| 377 |
|
| 378 |
void IN_Ticker(void) |
| 379 |
{ |
| 380 |
if (!intermission) |
| 381 |
{ |
| 382 |
return; |
| 383 |
} |
| 384 |
if (interstate == 3) |
| 385 |
{ |
| 386 |
IN_WaitStop(); |
| 387 |
return; |
| 388 |
} |
| 389 |
IN_CheckForSkip(); |
| 390 |
intertime++; |
| 391 |
if (oldintertime < intertime) |
| 392 |
{ |
| 393 |
interstate++; |
| 394 |
|
| 395 |
// [crispy] skip "now entering" if it's the final intermission |
| 396 |
if (interstate >= 1 && finalintermission) |
| 397 |
{ |
| 398 |
IN_Stop(); |
| 399 |
G_WorldDone(); |
| 400 |
return; |
| 401 |
} |
| 402 |
|
| 403 |
if (gameepisode > 3 && interstate >= 1) |
| 404 |
{ // Extended Wad levels: skip directly to the next level |
| 405 |
interstate = 3; |
| 406 |
} |
| 407 |
switch (interstate) |
| 408 |
{ |
| 409 |
case 0: |
| 410 |
oldintertime = intertime + 300; |
| 411 |
if (gameepisode > 3) |
| 412 |
{ |
| 413 |
oldintertime = intertime + 1200; |
| 414 |
} |
| 415 |
break; |
| 416 |
case 1: |
| 417 |
oldintertime = intertime + 200; |
| 418 |
break; |
| 419 |
case 2: |
| 420 |
oldintertime = INT_MAX; |
| 421 |
break; |
| 422 |
case 3: |
| 423 |
cnt = 10; |
| 424 |
break; |
| 425 |
default: |
| 426 |
break; |
| 427 |
} |
| 428 |
} |
| 429 |
if (skipintermission) |
| 430 |
{ |
| 431 |
if (interstate == 0 && intertime < 150) |
| 432 |
{ |
| 433 |
intertime = 150; |
| 434 |
skipintermission = false; |
| 435 |
return; |
| 436 |
} |
| 437 |
// [crispy] skip "now entering" if it's the final intermission |
| 438 |
else if (finalintermission) |
| 439 |
{ |
| 440 |
IN_Stop(); |
| 441 |
G_WorldDone(); |
| 442 |
return; |
| 443 |
} |
| 444 |
else if (interstate < 2 && gameepisode < 4) |
| 445 |
{ |
| 446 |
interstate = 2; |
| 447 |
skipintermission = false; |
| 448 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 449 |
return; |
| 450 |
} |
| 451 |
interstate = 3; |
| 452 |
cnt = 10; |
| 453 |
skipintermission = false; |
| 454 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 455 |
} |
| 456 |
} |
| 457 |
|
| 458 |
//======================================================================== |
| 459 |
// |
| 460 |
// IN_CheckForSkip |
| 461 |
// |
| 462 |
// Check to see if any player hit a key |
| 463 |
//======================================================================== |
| 464 |
|
| 465 |
void IN_CheckForSkip(void) |
| 466 |
{ |
| 467 |
int i; |
| 468 |
player_t *player; |
| 469 |
|
| 470 |
for (i = 0, player = players; i < g_maxplayers; i++, player++) |
| 471 |
{ |
| 472 |
if (playeringame[i]) |
| 473 |
{ |
| 474 |
if (player->cmd.buttons & BT_ATTACK) |
| 475 |
{ |
| 476 |
if (!player->attackdown) |
| 477 |
{ |
| 478 |
skipintermission = 1; |
| 479 |
} |
| 480 |
player->attackdown = true; |
| 481 |
} |
| 482 |
else |
| 483 |
{ |
| 484 |
player->attackdown = false; |
| 485 |
} |
| 486 |
if (player->cmd.buttons & BT_USE) |
| 487 |
{ |
| 488 |
if (!player->usedown) |
| 489 |
{ |
| 490 |
skipintermission = 1; |
| 491 |
} |
| 492 |
player->usedown = true; |
| 493 |
} |
| 494 |
else |
| 495 |
{ |
| 496 |
player->usedown = false; |
| 497 |
} |
| 498 |
} |
| 499 |
} |
| 500 |
} |
| 501 |
|
| 502 |
//======================================================================== |
| 503 |
// |
| 504 |
// IN_Drawer |
| 505 |
// |
| 506 |
//======================================================================== |
| 507 |
|
| 508 |
void IN_Drawer(void) |
| 509 |
{ |
| 510 |
static int oldinterstate; |
| 511 |
|
| 512 |
if (!intermission) |
| 513 |
{ |
| 514 |
return; |
| 515 |
} |
| 516 |
if (interstate == 3) |
| 517 |
{ |
| 518 |
return; |
| 519 |
} |
| 520 |
|
| 521 |
if (oldinterstate != 2 && interstate == 2) |
| 522 |
{ |
| 523 |
S_StartVoidSound(heretic_sfx_pstop); |
| 524 |
} |
| 525 |
oldinterstate = interstate; |
| 526 |
switch (interstate) |
| 527 |
{ |
| 528 |
case -1: |
| 529 |
case 0: // draw stats |
| 530 |
IN_DrawStatBack(); |
| 531 |
switch (gametype) |
| 532 |
{ |
| 533 |
case SINGLE: |
| 534 |
IN_DrawSingleStats(); |
| 535 |
break; |
| 536 |
case COOPERATIVE: |
| 537 |
IN_DrawCoopStats(); |
| 538 |
break; |
| 539 |
case DEATHMATCH: |
| 540 |
IN_DrawDMStats(); |
| 541 |
break; |
| 542 |
} |
| 543 |
break; |
| 544 |
case 1: // leaving old level |
| 545 |
if (gameepisode < 4) |
| 546 |
{ |
| 547 |
IN_DrawInterpic(); |
| 548 |
IN_DrawOldLevel(); |
| 549 |
} |
| 550 |
break; |
| 551 |
case 2: // going to the next level |
| 552 |
if (gameepisode < 4) |
| 553 |
{ |
| 554 |
IN_DrawInterpic(); |
| 555 |
IN_DrawYAH(); |
| 556 |
} |
| 557 |
break; |
| 558 |
case 3: // waiting before going to the next level |
| 559 |
if (gameepisode < 4) |
| 560 |
{ |
| 561 |
IN_DrawInterpic(); |
| 562 |
} |
| 563 |
break; |
| 564 |
default: |
| 565 |
I_Error("IN_lude: Intermission state out of range.\n"); |
| 566 |
break; |
| 567 |
} |
| 568 |
} |
| 569 |
|
| 570 |
//======================================================================== |
| 571 |
// |
| 572 |
// IN_DrawStatBack |
| 573 |
// |
| 574 |
//======================================================================== |
| 575 |
|
| 576 |
void IN_DrawStatBack(void) |
| 577 |
{ |
| 578 |
// e6y: wide-res |
| 579 |
V_ClearBorder(); |
| 580 |
V_DrawBackground("FLOOR16", 0); |
| 581 |
} |
| 582 |
|
| 583 |
//======================================================================== |
| 584 |
// |
| 585 |
// IN_DrawOldLevel |
| 586 |
// |
| 587 |
//======================================================================== |
| 588 |
|
| 589 |
void IN_DrawOldLevel(void) |
| 590 |
{ |
| 591 |
const char *level_name = NameForMap(prevmap); |
| 592 |
int i; |
| 593 |
int x; |
| 594 |
|
| 595 |
x = 160 - MN_TextBWidth(level_name) / 2; |
| 596 |
IN_DrTextB(level_name, x, 3); |
| 597 |
x = 160 - MN_TextAWidth("FINISHED") / 2; |
| 598 |
MN_DrTextA("FINISHED", x, 25); |
| 599 |
|
| 600 |
if (prevmap == 9) |
| 601 |
{ |
| 602 |
for (i = 0; i < nextmap - 1; i++) |
| 603 |
{ |
| 604 |
IN_DrawBeenThere(i); |
| 605 |
} |
| 606 |
if (!(intertime & 16)) |
| 607 |
{ |
| 608 |
IN_DrawBeenThere(8); |
| 609 |
} |
| 610 |
} |
| 611 |
else |
| 612 |
{ |
| 613 |
for (i = 0; i < prevmap - 1; i++) |
| 614 |
{ |
| 615 |
IN_DrawBeenThere(i); |
| 616 |
} |
| 617 |
if (players[consoleplayer].didsecret) |
| 618 |
{ |
| 619 |
IN_DrawBeenThere(8); |
| 620 |
} |
| 621 |
if (!(intertime & 16)) |
| 622 |
{ |
| 623 |
IN_DrawBeenThere(prevmap - 1); |
| 624 |
} |
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
//======================================================================== |
| 629 |
// |
| 630 |
// IN_DrawYAH |
| 631 |
// |
| 632 |
//======================================================================== |
| 633 |
|
| 634 |
void IN_DrawYAH(void) |
| 635 |
{ |
| 636 |
const char *level_name = NameForMap(nextmap); |
| 637 |
int i; |
| 638 |
int x; |
| 639 |
|
| 640 |
x = 160 - MN_TextAWidth("NOW ENTERING:") / 2; |
| 641 |
MN_DrTextA("NOW ENTERING:", x, 10); |
| 642 |
x = 160 - MN_TextBWidth(level_name) / 2; |
| 643 |
IN_DrTextB(level_name, x, 20); |
| 644 |
|
| 645 |
if (prevmap == 9) |
| 646 |
{ |
| 647 |
prevmap = nextmap - 1; |
| 648 |
} |
| 649 |
for (i = 0; i < prevmap; i++) |
| 650 |
{ |
| 651 |
IN_DrawBeenThere(i); |
| 652 |
} |
| 653 |
if (players[consoleplayer].didsecret) |
| 654 |
{ |
| 655 |
IN_DrawBeenThere(8); |
| 656 |
} |
| 657 |
if (!(intertime & 16) || interstate == 3) |
| 658 |
{ // draw the destination 'X' |
| 659 |
IN_DrawGoingThere(nextmap - 1); |
| 660 |
} |
| 661 |
} |
| 662 |
|
| 663 |
//======================================================================== |
| 664 |
// |
| 665 |
// IN_DrawSingleStats |
| 666 |
// |
| 667 |
//======================================================================== |
| 668 |
|
| 669 |
void IN_DrawSingleStats(void) |
| 670 |
{ |
| 671 |
const char *prev_level_name = NameForMap(prevmap); |
| 672 |
const char *next_level_name = NameForMap(nextmap); |
| 673 |
int x; |
| 674 |
static int sounds; |
| 675 |
|
| 676 |
// [crispy] offset the stats for Ep.4 and up, to make room for level time |
| 677 |
int yoffset = 0; |
| 678 |
if (gamemode == retail && gameepisode > 3) |
| 679 |
{ |
| 680 |
yoffset = 20; |
| 681 |
} |
| 682 |
|
| 683 |
IN_DrTextB("KILLS", 50, 65 - yoffset); |
| 684 |
IN_DrTextB("ITEMS", 50, 90 - yoffset); |
| 685 |
IN_DrTextB("SECRETS", 50, 115 - yoffset); |
| 686 |
|
| 687 |
x = 160 - MN_TextBWidth(prev_level_name) / 2; |
| 688 |
IN_DrTextB(prev_level_name, x, 3); |
| 689 |
x = 160 - MN_TextAWidth("FINISHED") / 2; |
| 690 |
MN_DrTextA("FINISHED", x, 25); |
| 691 |
|
| 692 |
dsda_DrawExIntermission(); |
| 693 |
|
| 694 |
if (intertime < 30) |
| 695 |
{ |
| 696 |
sounds = 0; |
| 697 |
return; |
| 698 |
} |
| 699 |
if (sounds < 1 && intertime >= 30) |
| 700 |
{ |
| 701 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 702 |
sounds++; |
| 703 |
} |
| 704 |
IN_DrawNumber(players[consoleplayer].killcount, 200, 65 - yoffset, 3); |
| 705 |
V_DrawShadowedNamePatch(237, 65 - yoffset, "FONTB15"); |
| 706 |
IN_DrawNumber(totalkills, 248, 65 - yoffset, 3); |
| 707 |
if (intertime < 60) |
| 708 |
{ |
| 709 |
return; |
| 710 |
} |
| 711 |
if (sounds < 2 && intertime >= 60) |
| 712 |
{ |
| 713 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 714 |
sounds++; |
| 715 |
} |
| 716 |
IN_DrawNumber(players[consoleplayer].itemcount, 200, 90 - yoffset, 3); |
| 717 |
V_DrawShadowedNamePatch(237, 90 - yoffset, "FONTB15"); |
| 718 |
IN_DrawNumber(totalitems, 248, 90 - yoffset, 3); |
| 719 |
if (intertime < 90) |
| 720 |
{ |
| 721 |
return; |
| 722 |
} |
| 723 |
if (sounds < 3 && intertime >= 90) |
| 724 |
{ |
| 725 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 726 |
sounds++; |
| 727 |
} |
| 728 |
IN_DrawNumber(players[consoleplayer].secretcount, 200, 115 - yoffset, 3); |
| 729 |
V_DrawShadowedNamePatch(237, 115 - yoffset, "FONTB15"); |
| 730 |
IN_DrawNumber(totalsecret, 248, 115 - yoffset, 3); |
| 731 |
if (intertime < 150) |
| 732 |
{ |
| 733 |
return; |
| 734 |
} |
| 735 |
if (sounds < 4 && intertime >= 150) |
| 736 |
{ |
| 737 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 738 |
sounds++; |
| 739 |
} |
| 740 |
|
| 741 |
// [crispy] ignore "now entering" if it's the final intermission |
| 742 |
if (gamemode != retail || gameepisode <= 3 || finalintermission) |
| 743 |
{ |
| 744 |
IN_DrTextB("TIME", 85, 150); |
| 745 |
IN_DrawTime(155, 150, hours, minutes, seconds); |
| 746 |
|
| 747 |
// [crispy] Show total time on intermission |
| 748 |
IN_DrTextB("TOTAL", 85, 170); |
| 749 |
IN_DrawTime(155, 170, totalHours, totalMinutes, totalSeconds); |
| 750 |
} |
| 751 |
else |
| 752 |
{ |
| 753 |
// [crispy] show the level time for Ep.4 and up |
| 754 |
IN_DrTextB("TIME", 85, 120); |
| 755 |
IN_DrawTime(155, 120, hours, minutes, seconds); |
| 756 |
|
| 757 |
// [crispy] Show total time on intermission |
| 758 |
IN_DrTextB("TOTAL", 85, 140); |
| 759 |
IN_DrawTime(155, 140, totalHours, totalMinutes, totalSeconds); |
| 760 |
|
| 761 |
x = 160 - MN_TextAWidth("NOW ENTERING:") / 2; |
| 762 |
MN_DrTextA("NOW ENTERING:", x, 160); |
| 763 |
x = 160 - MN_TextBWidth(next_level_name) / 2; |
| 764 |
IN_DrTextB(next_level_name, x, 170); |
| 765 |
skipintermission = false; |
| 766 |
} |
| 767 |
} |
| 768 |
|
| 769 |
//======================================================================== |
| 770 |
// |
| 771 |
// IN_DrawCoopStats |
| 772 |
// |
| 773 |
//======================================================================== |
| 774 |
|
| 775 |
void IN_DrawCoopStats(void) |
| 776 |
{ |
| 777 |
const char *level_name = NameForMap(prevmap); |
| 778 |
int i; |
| 779 |
int x; |
| 780 |
int ypos; |
| 781 |
|
| 782 |
static int sounds; |
| 783 |
|
| 784 |
IN_DrTextB("KILLS", 95, 35); |
| 785 |
IN_DrTextB("BONUS", 155, 35); |
| 786 |
IN_DrTextB("SECRET", 232, 35); |
| 787 |
x = 160 - MN_TextBWidth(level_name) / 2; |
| 788 |
IN_DrTextB(level_name, x, 3); |
| 789 |
x = 160 - MN_TextAWidth("FINISHED") / 2; |
| 790 |
MN_DrTextA("FINISHED", x, 25); |
| 791 |
|
| 792 |
ypos = 50; |
| 793 |
for (i = 0; i < g_maxplayers; i++) |
| 794 |
{ |
| 795 |
if (playeringame[i]) |
| 796 |
{ |
| 797 |
V_DrawShadowedNumPatch(25, ypos, patchFaceOkayBase + i); |
| 798 |
if (intertime < 40) |
| 799 |
{ |
| 800 |
sounds = 0; |
| 801 |
ypos += 37; |
| 802 |
continue; |
| 803 |
} |
| 804 |
else if (intertime >= 40 && sounds < 1) |
| 805 |
{ |
| 806 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 807 |
sounds++; |
| 808 |
} |
| 809 |
IN_DrawNumber(killPercent[i], 85, ypos + 10, 3); |
| 810 |
V_DrawShadowedNamePatch(121, ypos + 10, "FONTB05"); |
| 811 |
IN_DrawNumber(bonusPercent[i], 160, ypos + 10, 3); |
| 812 |
V_DrawShadowedNamePatch(196, ypos + 10, "FONTB05"); |
| 813 |
IN_DrawNumber(secretPercent[i], 237, ypos + 10, 3); |
| 814 |
V_DrawShadowedNamePatch(273, ypos + 10, "FONTB05"); |
| 815 |
ypos += 37; |
| 816 |
} |
| 817 |
} |
| 818 |
} |
| 819 |
|
| 820 |
//======================================================================== |
| 821 |
// |
| 822 |
// IN_DrawDMStats |
| 823 |
// |
| 824 |
//======================================================================== |
| 825 |
|
| 826 |
void IN_DrawDMStats(void) |
| 827 |
{ |
| 828 |
int i; |
| 829 |
int j; |
| 830 |
int ypos; |
| 831 |
int xpos; |
| 832 |
int kpos; |
| 833 |
|
| 834 |
static int sounds; |
| 835 |
|
| 836 |
xpos = 90; |
| 837 |
ypos = 55; |
| 838 |
|
| 839 |
IN_DrTextB("TOTAL", 265, 30); |
| 840 |
MN_DrTextA("VICTIMS", 140, 8); |
| 841 |
for (i = 0; i < 7; i++) |
| 842 |
{ |
| 843 |
MN_DrTextA(KillersText[i], 10, 80 + 9 * i); |
| 844 |
} |
| 845 |
if (intertime < 20) |
| 846 |
{ |
| 847 |
for (i = 0; i < g_maxplayers; i++) |
| 848 |
{ |
| 849 |
if (playeringame[i]) |
| 850 |
{ |
| 851 |
V_DrawShadowedNumPatch( |
| 852 |
40, |
| 853 |
((ypos << FRACBITS) + dSlideY[i] * intertime) >> FRACBITS, |
| 854 |
patchFaceOkayBase + i |
| 855 |
); |
| 856 |
V_DrawShadowedNumPatch( |
| 857 |
((xpos << FRACBITS) + dSlideX[i] * intertime) >> FRACBITS, |
| 858 |
18, |
| 859 |
patchFaceDeadBase + i |
| 860 |
); |
| 861 |
} |
| 862 |
} |
| 863 |
sounds = 0; |
| 864 |
return; |
| 865 |
} |
| 866 |
if (intertime >= 20 && sounds < 1) |
| 867 |
{ |
| 868 |
S_StartVoidSound(heretic_sfx_dorcls); |
| 869 |
sounds++; |
| 870 |
} |
| 871 |
if (intertime >= 100 && slaughterboy && sounds < 2) |
| 872 |
{ |
| 873 |
S_StartVoidSound(heretic_sfx_wpnup); |
| 874 |
sounds++; |
| 875 |
} |
| 876 |
for (i = 0; i < g_maxplayers; i++) |
| 877 |
{ |
| 878 |
if (playeringame[i]) |
| 879 |
{ |
| 880 |
if (intertime < 100 || i == consoleplayer) |
| 881 |
{ |
| 882 |
V_DrawShadowedNumPatch(40, ypos, patchFaceOkayBase + i); |
| 883 |
V_DrawShadowedNumPatch(xpos, 18, patchFaceDeadBase + i); |
| 884 |
} |
| 885 |
else |
| 886 |
{ |
| 887 |
V_DrawTLNumPatch(40, ypos, patchFaceOkayBase + i); |
| 888 |
V_DrawTLNumPatch(xpos, 18, patchFaceDeadBase + i); |
| 889 |
} |
| 890 |
kpos = 86; |
| 891 |
for (j = 0; j < g_maxplayers; j++) |
| 892 |
{ |
| 893 |
if (playeringame[j]) |
| 894 |
{ |
| 895 |
IN_DrawNumber(players[i].frags[j], kpos, ypos + 10, 3); |
| 896 |
kpos += 43; |
| 897 |
} |
| 898 |
} |
| 899 |
if (slaughterboy & (1 << i)) |
| 900 |
{ |
| 901 |
if (!(intertime & 16)) |
| 902 |
{ |
| 903 |
IN_DrawNumber(totalFrags[i], 263, ypos + 10, 3); |
| 904 |
} |
| 905 |
} |
| 906 |
else |
| 907 |
{ |
| 908 |
IN_DrawNumber(totalFrags[i], 263, ypos + 10, 3); |
| 909 |
} |
| 910 |
ypos += 36; |
| 911 |
xpos += 43; |
| 912 |
} |
| 913 |
} |
| 914 |
} |
| 915 |
|
| 916 |
//======================================================================== |
| 917 |
// |
| 918 |
// IN_DrawTime |
| 919 |
// |
| 920 |
//======================================================================== |
| 921 |
|
| 922 |
// [crispy] always draw seconds; don't 0-pad minutes with no hour |
| 923 |
void IN_DrawTime(int x, int y, int h, int m, int s) |
| 924 |
{ |
| 925 |
if (h) |
| 926 |
{ |
| 927 |
IN_DrawNumber(h, x, y, 2); |
| 928 |
IN_DrTextB(":", x + 26, y); |
| 929 |
} |
| 930 |
x += 34; |
| 931 |
if (h || m > 9) |
| 932 |
{ |
| 933 |
IN_DrawNumber(m, x, y, 2); |
| 934 |
} |
| 935 |
else if (m) |
| 936 |
{ |
| 937 |
IN_DrawNumber(m, x + 12, y, 1); |
| 938 |
} |
| 939 |
x += 34; |
| 940 |
{ |
| 941 |
IN_DrTextB(":", x - 8, y); |
| 942 |
IN_DrawNumber(s, x, y, 2); |
| 943 |
} |
| 944 |
} |
| 945 |
|
| 946 |
//======================================================================== |
| 947 |
// |
| 948 |
// IN_DrawNumber |
| 949 |
// |
| 950 |
//======================================================================== |
| 951 |
|
| 952 |
void IN_DrawNumber(int val, int x, int y, int digits) |
| 953 |
{ |
| 954 |
int lump; |
| 955 |
int xpos; |
| 956 |
int oldval; |
| 957 |
int realdigits; |
| 958 |
dboolean neg; |
| 959 |
|
| 960 |
oldval = val; |
| 961 |
xpos = x; |
| 962 |
neg = false; |
| 963 |
realdigits = 1; |
| 964 |
|
| 965 |
if (val < 0) |
| 966 |
{ //...this should reflect negative frags |
| 967 |
val = -val; |
| 968 |
neg = true; |
| 969 |
if (val > 99) |
| 970 |
{ |
| 971 |
val = 99; |
| 972 |
} |
| 973 |
} |
| 974 |
if (val > 9) |
| 975 |
{ |
| 976 |
realdigits++; |
| 977 |
if (digits < realdigits) |
| 978 |
{ |
| 979 |
realdigits = digits; |
| 980 |
val = 9; |
| 981 |
} |
| 982 |
} |
| 983 |
if (val > 99) |
| 984 |
{ |
| 985 |
realdigits++; |
| 986 |
if (digits < realdigits) |
| 987 |
{ |
| 988 |
realdigits = digits; |
| 989 |
val = 99; |
| 990 |
} |
| 991 |
} |
| 992 |
if (val > 999) |
| 993 |
{ |
| 994 |
realdigits++; |
| 995 |
if (digits < realdigits) |
| 996 |
{ |
| 997 |
realdigits = digits; |
| 998 |
val = 999; |
| 999 |
} |
| 1000 |
} |
| 1001 |
if (digits == 4) |
| 1002 |
{ |
| 1003 |
lump = FontBNumbers[val / 1000]; |
| 1004 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2 - 12, y, lump); |
| 1005 |
} |
| 1006 |
if (digits > 2) |
| 1007 |
{ |
| 1008 |
if (realdigits > 2) |
| 1009 |
{ |
| 1010 |
lump = FontBNumbers[val / 100]; |
| 1011 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 1012 |
} |
| 1013 |
xpos += 12; |
| 1014 |
} |
| 1015 |
val = val % 100; |
| 1016 |
if (digits > 1) |
| 1017 |
{ |
| 1018 |
if (val > 9) |
| 1019 |
{ |
| 1020 |
lump = FontBNumbers[val / 10]; |
| 1021 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 1022 |
} |
| 1023 |
else if (digits == 2 || oldval > 99) |
| 1024 |
{ |
| 1025 |
V_DrawShadowedNumPatch(xpos, y, FontBNumbers[0]); |
| 1026 |
} |
| 1027 |
xpos += 12; |
| 1028 |
} |
| 1029 |
val = val % 10; |
| 1030 |
lump = FontBNumbers[val]; |
| 1031 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 1032 |
if (neg) |
| 1033 |
{ |
| 1034 |
V_DrawShadowedNamePatch( |
| 1035 |
xpos + 6 - R_NamePatchWidth("FONTB13") / 2 - 12 * (realdigits), |
| 1036 |
y, |
| 1037 |
"FONTB13" |
| 1038 |
); |
| 1039 |
} |
| 1040 |
} |
| 1041 |
|
| 1042 |
//======================================================================== |
| 1043 |
// |
| 1044 |
// IN_DrTextB |
| 1045 |
// |
| 1046 |
//======================================================================== |
| 1047 |
|
| 1048 |
void IN_DrTextB(const char *text, int x, int y) |
| 1049 |
{ |
| 1050 |
char c; |
| 1051 |
|
| 1052 |
while ((c = *text++) != 0) |
| 1053 |
{ |
| 1054 |
if (c < 33) |
| 1055 |
{ |
| 1056 |
x += 8; |
| 1057 |
} |
| 1058 |
else |
| 1059 |
{ |
| 1060 |
int lump = FontBLump + c - 33; |
| 1061 |
V_DrawShadowedNumPatch(x, y, lump); |
| 1062 |
x += R_NumPatchWidth(lump) - 1; |
| 1063 |
} |
| 1064 |
} |
| 1065 |
} |