| 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 |
// SB_bar.c |
| 18 |
|
| 19 |
#include "doomstat.h" |
| 20 |
#include "m_cheat.h" |
| 21 |
#include "m_menu.h" |
| 22 |
#include "m_random.h" |
| 23 |
#include "v_video.h" |
| 24 |
#include "r_main.h" |
| 25 |
#include "w_wad.h" |
| 26 |
#include "st_stuff.h" |
| 27 |
#include "r_draw.h" |
| 28 |
|
| 29 |
#include "dsda/pause.h" |
| 30 |
#include "dsda/settings.h" |
| 31 |
|
| 32 |
#include "heretic/def.h" |
| 33 |
#include "heretic/dstrings.h" |
| 34 |
|
| 35 |
#include "sb_bar.h" |
| 36 |
|
| 37 |
// Private Functions |
| 38 |
|
| 39 |
static void ShadeLine(int x, int y, int height, int shade); |
| 40 |
static void ShadeChain(void); |
| 41 |
static void DrINumber(signed int val, int x, int y); |
| 42 |
static void DrBNumber(signed int val, int x, int y); |
| 43 |
static void DrawCommonBar(void); |
| 44 |
static void DrawMainBar(void); |
| 45 |
static void DrawInventoryBar(void); |
| 46 |
|
| 47 |
static void Hexen_SB_Init(void); |
| 48 |
static void Hexen_DrINumber(signed int val, int x, int y); |
| 49 |
static void Hexen_DrSmallNumberVPT(int val, int x, int y, int vpt); |
| 50 |
static void DrRedINumber(signed int val, int x, int y); |
| 51 |
static void DrawKeyBar(void); |
| 52 |
static void DrawWeaponPieces(void); |
| 53 |
static void DrawAnimatedIcons(void); |
| 54 |
static void Hexen_DrawMainBar(void); |
| 55 |
|
| 56 |
// Public Data |
| 57 |
|
| 58 |
dboolean inventory; |
| 59 |
int curpos; |
| 60 |
int inv_ptr; |
| 61 |
int ArtifactFlash; |
| 62 |
int SB_state = -1; |
| 63 |
|
| 64 |
// Private Data |
| 65 |
|
| 66 |
static int HealthMarker; |
| 67 |
static int ChainWiggle; |
| 68 |
static player_t *CPlayer; |
| 69 |
|
| 70 |
int LumpLTFACE; |
| 71 |
int LumpRTFACE; |
| 72 |
int LumpBARBACK; |
| 73 |
int LumpCHAIN; |
| 74 |
int LumpSTATBAR; |
| 75 |
int LumpLIFEGEM; |
| 76 |
int LumpLTFCTOP; |
| 77 |
int LumpRTFCTOP; |
| 78 |
int LumpSELECTBOX; |
| 79 |
int LumpINVLFGEM1; |
| 80 |
int LumpINVLFGEM2; |
| 81 |
int LumpINVRTGEM1; |
| 82 |
int LumpINVRTGEM2; |
| 83 |
int LumpINumbers[10]; |
| 84 |
int LumpNEGATIVE; |
| 85 |
int LumpSmNumbers[10]; |
| 86 |
int LumpBLACKSQ; |
| 87 |
int LumpINVBAR; |
| 88 |
int LumpARMCLEAR; |
| 89 |
int LumpCHAINBACK; |
| 90 |
int FontBNumBase; |
| 91 |
int spinbooklump; |
| 92 |
int spinflylump; |
| 93 |
|
| 94 |
static char heretic_namearti[][10] = { |
| 95 |
{"ARTIBOX"}, // none |
| 96 |
{"ARTIINVU"}, // invulnerability |
| 97 |
{"ARTIINVS"}, // invisibility |
| 98 |
{"ARTIPTN2"}, // health |
| 99 |
{"ARTISPHL"}, // superhealth |
| 100 |
{"ARTIPWBK"}, // tomeofpower |
| 101 |
{"ARTITRCH"}, // torch |
| 102 |
{"ARTIFBMB"}, // firebomb |
| 103 |
{"ARTIEGGC"}, // egg |
| 104 |
{"ARTISOAR"}, // fly |
| 105 |
{"ARTIATLP"} // teleport |
| 106 |
}; |
| 107 |
static int heretic_lumparti[11]; |
| 108 |
|
| 109 |
static int SpinMinotaurLump; |
| 110 |
static int SpinSpeedLump; |
| 111 |
static int SpinDefenseLump; |
| 112 |
|
| 113 |
static int LumpH2BAR; |
| 114 |
static int LumpH2TOP; |
| 115 |
static int LumpLFEDGE; |
| 116 |
static int LumpRTEDGE; |
| 117 |
static int LumpARTICLEAR; |
| 118 |
static int LumpMANACLEAR; |
| 119 |
static int LumpKILLS; |
| 120 |
static int LumpMANAVIAL1; |
| 121 |
static int LumpMANAVIAL2; |
| 122 |
static int LumpMANAVIALDIM1; |
| 123 |
static int LumpMANAVIALDIM2; |
| 124 |
static int LumpMANADIM1; |
| 125 |
static int LumpMANADIM2; |
| 126 |
static int LumpMANABRIGHT1; |
| 127 |
static int LumpMANABRIGHT2; |
| 128 |
static int LumpKEYBAR; |
| 129 |
static int LumpWEAPONSLOT; |
| 130 |
static int LumpWEAPONFULL; |
| 131 |
static int LumpPIECE1; |
| 132 |
static int LumpPIECE2; |
| 133 |
static int LumpPIECE3; |
| 134 |
|
| 135 |
static char hexen_namearti[][10] = { |
| 136 |
{"ARTIBOX"}, // none |
| 137 |
{"ARTIINVU"}, // invulnerability |
| 138 |
{"ARTIPTN2"}, // health |
| 139 |
{"ARTISPHL"}, // superhealth |
| 140 |
{"ARTIHRAD"}, // healing radius |
| 141 |
{"ARTISUMN"}, // summon maulator |
| 142 |
{"ARTITRCH"}, // torch |
| 143 |
{"ARTIPORK"}, // egg |
| 144 |
{"ARTISOAR"}, // fly |
| 145 |
{"ARTIBLST"}, // blast radius |
| 146 |
{"ARTIPSBG"}, // poison bag |
| 147 |
{"ARTITELO"}, // teleport other |
| 148 |
{"ARTISPED"}, // speed |
| 149 |
{"ARTIBMAN"}, // boost mana |
| 150 |
{"ARTIBRAC"}, // boost armor |
| 151 |
{"ARTIATLP"}, // teleport |
| 152 |
{"ARTISKLL"}, // hexen_arti_puzzskull |
| 153 |
{"ARTIBGEM"}, // hexen_arti_puzzgembig |
| 154 |
{"ARTIGEMR"}, // hexen_arti_puzzgemred |
| 155 |
{"ARTIGEMG"}, // hexen_arti_puzzgemgreen1 |
| 156 |
{"ARTIGMG2"}, // hexen_arti_puzzgemgreen2 |
| 157 |
{"ARTIGEMB"}, // hexen_arti_puzzgemblue1 |
| 158 |
{"ARTIGMB2"}, // hexen_arti_puzzgemblue2 |
| 159 |
{"ARTIBOK1"}, // hexen_arti_puzzbook1 |
| 160 |
{"ARTIBOK2"}, // hexen_arti_puzzbook2 |
| 161 |
{"ARTISKL2"}, // hexen_arti_puzzskull2 |
| 162 |
{"ARTIFWEP"}, // hexen_arti_puzzfweapon |
| 163 |
{"ARTICWEP"}, // hexen_arti_puzzcweapon |
| 164 |
{"ARTIMWEP"}, // hexen_arti_puzzmweapon |
| 165 |
{"ARTIGEAR"}, // hexen_arti_puzzgear1 |
| 166 |
{"ARTIGER2"}, // hexen_arti_puzzgear2 |
| 167 |
{"ARTIGER3"}, // hexen_arti_puzzgear3 |
| 168 |
{"ARTIGER4"}, // hexen_arti_puzzgear4 |
| 169 |
}; |
| 170 |
static int hexen_lumparti[33]; |
| 171 |
|
| 172 |
static int *lumparti; |
| 173 |
|
| 174 |
// game config |
| 175 |
static int sb_ticker_delta_cap; |
| 176 |
static int sb_icon_y; |
| 177 |
static int sb_inv_bar_x; |
| 178 |
static int sb_inv_bar_y; |
| 179 |
static int sb_inv_arti_y; |
| 180 |
static int sb_inv_arti_count_x; |
| 181 |
static int sb_inv_arti_count_y; |
| 182 |
static int sb_inv_select_y; |
| 183 |
static int sb_inv_gem_x; |
| 184 |
static int sb_inv_gem_y; |
| 185 |
static int sb_full_arti_x; |
| 186 |
static int sb_full_arti_y; |
| 187 |
static int sb_full_arti_count_x; |
| 188 |
static int sb_full_inv_arti_x; |
| 189 |
static int sb_full_inv_arti_y; |
| 190 |
static int sb_full_inv_arti_count_x; |
| 191 |
static int sb_full_inv_arti_count_y; |
| 192 |
static int sb_full_inv_select_y; |
| 193 |
static int sb_full_inv_gem_xl; |
| 194 |
static int sb_full_inv_gem_xr; |
| 195 |
|
| 196 |
void SB_Start(void) |
| 197 |
{ |
| 198 |
SB_state = -1; |
| 199 |
} |
| 200 |
|
| 201 |
//--------------------------------------------------------------------------- |
| 202 |
// |
| 203 |
// PROC SB_Init |
| 204 |
// |
| 205 |
//--------------------------------------------------------------------------- |
| 206 |
|
| 207 |
extern patchnum_t stbarbg; |
| 208 |
extern patchnum_t brdr_b; |
| 209 |
|
| 210 |
void SB_Init(void) |
| 211 |
{ |
| 212 |
int i; |
| 213 |
int startLump; |
| 214 |
|
| 215 |
if (hexen) return Hexen_SB_Init(); |
| 216 |
|
| 217 |
lumparti = heretic_lumparti; |
| 218 |
sb_ticker_delta_cap = 8; |
| 219 |
sb_icon_y = 17; |
| 220 |
sb_inv_bar_x = 34; |
| 221 |
sb_inv_bar_y = 160; |
| 222 |
sb_inv_arti_y = 160; |
| 223 |
sb_inv_arti_count_x = 69; |
| 224 |
sb_inv_arti_count_y = 182; |
| 225 |
sb_inv_select_y = 189; |
| 226 |
sb_inv_gem_x = 38; |
| 227 |
sb_inv_gem_y = 159; |
| 228 |
sb_full_arti_x = 286; |
| 229 |
sb_full_arti_y = 170; |
| 230 |
sb_full_arti_count_x = 307; |
| 231 |
sb_full_inv_arti_x = 50; |
| 232 |
sb_full_inv_arti_y = 168; |
| 233 |
sb_full_inv_arti_count_x = 69; |
| 234 |
sb_full_inv_arti_count_y = 190; |
| 235 |
sb_full_inv_select_y = 197; |
| 236 |
sb_full_inv_gem_xl = 38; |
| 237 |
sb_full_inv_gem_xr = 269; |
| 238 |
|
| 239 |
// magic globals that ends up in the background |
| 240 |
R_SetPatchNum(&brdr_b, "bordb"); |
| 241 |
R_SetPatchNum(&stbarbg, "BARBACK"); |
| 242 |
|
| 243 |
for (i = 0; i < 11; ++i) |
| 244 |
{ |
| 245 |
lumparti[i] = W_CheckNumForName2(heretic_namearti[i], ns_sprites); |
| 246 |
} |
| 247 |
|
| 248 |
LumpLTFACE = W_GetNumForName("LTFACE"); |
| 249 |
LumpRTFACE = W_GetNumForName("RTFACE"); |
| 250 |
LumpBARBACK = W_GetNumForName("BARBACK"); |
| 251 |
LumpINVBAR = W_GetNumForName("INVBAR"); |
| 252 |
LumpCHAIN = W_GetNumForName("CHAIN"); |
| 253 |
if (deathmatch) |
| 254 |
{ |
| 255 |
LumpSTATBAR = W_GetNumForName("STATBAR"); |
| 256 |
} |
| 257 |
else |
| 258 |
{ |
| 259 |
LumpSTATBAR = W_GetNumForName("LIFEBAR"); |
| 260 |
} |
| 261 |
if (!netgame) |
| 262 |
{ // single player game uses red life gem |
| 263 |
LumpLIFEGEM = W_GetNumForName("LIFEGEM2"); |
| 264 |
} |
| 265 |
else |
| 266 |
{ |
| 267 |
LumpLIFEGEM = W_GetNumForName("LIFEGEM0") + consoleplayer; |
| 268 |
} |
| 269 |
LumpLTFCTOP = W_GetNumForName("LTFCTOP"); |
| 270 |
LumpRTFCTOP = W_GetNumForName("RTFCTOP"); |
| 271 |
LumpSELECTBOX = W_GetNumForName("SELECTBOX"); |
| 272 |
LumpINVLFGEM1 = W_GetNumForName("INVGEML1"); |
| 273 |
LumpINVLFGEM2 = W_GetNumForName("INVGEML2"); |
| 274 |
LumpINVRTGEM1 = W_GetNumForName("INVGEMR1"); |
| 275 |
LumpINVRTGEM2 = W_GetNumForName("INVGEMR2"); |
| 276 |
LumpBLACKSQ = W_GetNumForName("BLACKSQ"); |
| 277 |
LumpARMCLEAR = W_GetNumForName("ARMCLEAR"); |
| 278 |
LumpCHAINBACK = W_GetNumForName("CHAINBACK"); |
| 279 |
startLump = W_GetNumForName("IN0"); |
| 280 |
for (i = 0; i < 10; i++) |
| 281 |
{ |
| 282 |
LumpINumbers[i] = startLump + i; |
| 283 |
} |
| 284 |
LumpNEGATIVE = W_GetNumForName("NEGNUM"); |
| 285 |
FontBNumBase = W_GetNumForName("FONTB16"); |
| 286 |
startLump = W_GetNumForName("SMALLIN0"); |
| 287 |
for (i = 0; i < 10; i++) |
| 288 |
{ |
| 289 |
LumpSmNumbers[i] = startLump + i; |
| 290 |
} |
| 291 |
spinbooklump = W_GetNumForName("SPINBK0"); |
| 292 |
spinflylump = W_GetNumForName("SPFLY0"); |
| 293 |
|
| 294 |
// [FG] support widescreen status bar backgrounds |
| 295 |
ST_SetScaledWidth(); |
| 296 |
|
| 297 |
ST_LoadTextColors(); |
| 298 |
} |
| 299 |
|
| 300 |
//--------------------------------------------------------------------------- |
| 301 |
// |
| 302 |
// PROC SB_Ticker |
| 303 |
// |
| 304 |
//--------------------------------------------------------------------------- |
| 305 |
|
| 306 |
void SB_Ticker(void) |
| 307 |
{ |
| 308 |
int delta; |
| 309 |
int curHealth; |
| 310 |
|
| 311 |
if (heretic && leveltime & 1 && !dsda_PausedOutsideDemo()) |
| 312 |
{ |
| 313 |
ChainWiggle = P_Random(pr_heretic) & 1; |
| 314 |
} |
| 315 |
curHealth = players[consoleplayer].mo->health; |
| 316 |
if (curHealth < 0) |
| 317 |
{ |
| 318 |
curHealth = 0; |
| 319 |
} |
| 320 |
if (curHealth < HealthMarker) |
| 321 |
{ |
| 322 |
delta = (HealthMarker - curHealth) >> 2; |
| 323 |
if (delta < 1) |
| 324 |
{ |
| 325 |
delta = 1; |
| 326 |
} |
| 327 |
else if (delta > sb_ticker_delta_cap) |
| 328 |
{ |
| 329 |
delta = sb_ticker_delta_cap; |
| 330 |
} |
| 331 |
HealthMarker -= delta; |
| 332 |
} |
| 333 |
else if (curHealth > HealthMarker) |
| 334 |
{ |
| 335 |
delta = (curHealth - HealthMarker) >> 2; |
| 336 |
if (delta < 1) |
| 337 |
{ |
| 338 |
delta = 1; |
| 339 |
} |
| 340 |
else if (delta > sb_ticker_delta_cap) |
| 341 |
{ |
| 342 |
delta = sb_ticker_delta_cap; |
| 343 |
} |
| 344 |
HealthMarker += delta; |
| 345 |
} |
| 346 |
} |
| 347 |
|
| 348 |
//--------------------------------------------------------------------------- |
| 349 |
// |
| 350 |
// PROC DrINumber |
| 351 |
// |
| 352 |
// Draws a three digit number. |
| 353 |
// |
| 354 |
//--------------------------------------------------------------------------- |
| 355 |
|
| 356 |
static void DrINumber(signed int val, int x, int y) |
| 357 |
{ |
| 358 |
int lump; |
| 359 |
int oldval; |
| 360 |
|
| 361 |
if (hexen) return Hexen_DrINumber(val, x, y); |
| 362 |
|
| 363 |
oldval = val; |
| 364 |
if (val < 0) |
| 365 |
{ |
| 366 |
if (val < -9) |
| 367 |
{ |
| 368 |
V_DrawNamePatch(x + 1, y + 1, 0, "LAME", CR_DEFAULT, VPT_STRETCH); |
| 369 |
} |
| 370 |
else |
| 371 |
{ |
| 372 |
val = -val; |
| 373 |
V_DrawNumPatch(x + 18, y, 0, LumpINumbers[val], CR_DEFAULT, VPT_STRETCH); |
| 374 |
V_DrawNumPatch(x + 9, y, 0, LumpNEGATIVE, CR_DEFAULT, VPT_STRETCH); |
| 375 |
} |
| 376 |
return; |
| 377 |
} |
| 378 |
if (val > 99) |
| 379 |
{ |
| 380 |
lump = LumpINumbers[val / 100]; |
| 381 |
V_DrawNumPatch(x, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 382 |
} |
| 383 |
val = val % 100; |
| 384 |
if (val > 9 || oldval > 99) |
| 385 |
{ |
| 386 |
lump = LumpINumbers[val / 10]; |
| 387 |
V_DrawNumPatch(x + 9, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 388 |
} |
| 389 |
val = val % 10; |
| 390 |
lump = LumpINumbers[val]; |
| 391 |
V_DrawNumPatch(x + 18, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 392 |
} |
| 393 |
|
| 394 |
//--------------------------------------------------------------------------- |
| 395 |
// |
| 396 |
// PROC DrBNumber |
| 397 |
// |
| 398 |
// Draws a three digit number using FontB |
| 399 |
// |
| 400 |
//--------------------------------------------------------------------------- |
| 401 |
|
| 402 |
static void DrBNumber(signed int val, int x, int y) |
| 403 |
{ |
| 404 |
int lump; |
| 405 |
int xpos; |
| 406 |
int oldval; |
| 407 |
|
| 408 |
oldval = val; |
| 409 |
xpos = x; |
| 410 |
if (val < 0) |
| 411 |
{ |
| 412 |
val = 0; |
| 413 |
} |
| 414 |
if (val > 99) |
| 415 |
{ |
| 416 |
lump = FontBNumBase + val / 100; |
| 417 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 418 |
} |
| 419 |
val = val % 100; |
| 420 |
xpos += 12; |
| 421 |
if (val > 9 || oldval > 99) |
| 422 |
{ |
| 423 |
lump = FontBNumBase + val / 10; |
| 424 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 425 |
} |
| 426 |
val = val % 10; |
| 427 |
xpos += 12; |
| 428 |
lump = FontBNumBase + val; |
| 429 |
V_DrawShadowedNumPatch(xpos + 6 - R_NumPatchWidth(lump) / 2, y, lump); |
| 430 |
} |
| 431 |
|
| 432 |
//--------------------------------------------------------------------------- |
| 433 |
// |
| 434 |
// PROC DrSmallNumber |
| 435 |
// |
| 436 |
// Draws a small two digit number. |
| 437 |
// |
| 438 |
//--------------------------------------------------------------------------- |
| 439 |
|
| 440 |
static void DrSmallNumberVPT(int val, int x, int y, int vpt) |
| 441 |
{ |
| 442 |
int lump; |
| 443 |
|
| 444 |
if (hexen) return Hexen_DrSmallNumberVPT(val, x, y, vpt); |
| 445 |
|
| 446 |
if (val == 1) |
| 447 |
{ |
| 448 |
return; |
| 449 |
} |
| 450 |
if (val > 9) |
| 451 |
{ |
| 452 |
lump = LumpSmNumbers[val / 10]; |
| 453 |
V_DrawNumPatch(x, y, 0, lump, CR_DEFAULT, vpt); |
| 454 |
} |
| 455 |
val = val % 10; |
| 456 |
lump = LumpSmNumbers[val]; |
| 457 |
V_DrawNumPatch(x + 4, y, 0, lump, CR_DEFAULT, vpt); |
| 458 |
} |
| 459 |
|
| 460 |
static void DrSmallNumber(int val, int x, int y) |
| 461 |
{ |
| 462 |
DrSmallNumberVPT(val, x, y, VPT_STRETCH); |
| 463 |
} |
| 464 |
|
| 465 |
//--------------------------------------------------------------------------- |
| 466 |
// |
| 467 |
// PROC ShadeLine |
| 468 |
// |
| 469 |
//--------------------------------------------------------------------------- |
| 470 |
|
| 471 |
static void ShadeLine(int x, int y, int height, int shade) |
| 472 |
{ |
| 473 |
// HERETIC_TODO: ShadeLine |
| 474 |
// byte *dest; |
| 475 |
// byte *shades; |
| 476 |
// |
| 477 |
// x <<= crispy->hires; |
| 478 |
// y <<= crispy->hires; |
| 479 |
// height <<= crispy->hires; |
| 480 |
// |
| 481 |
// shades = colormaps + 9 * 256 + shade * 2 * 256; |
| 482 |
// dest = I_VideoBuffer + y * SCREENWIDTH + x; |
| 483 |
// while (height--) |
| 484 |
// { |
| 485 |
// if (crispy->hires) |
| 486 |
// *(dest + 1) = *(shades + *dest); |
| 487 |
// *(dest) = *(shades + *dest); |
| 488 |
// dest += SCREENWIDTH; |
| 489 |
// } |
| 490 |
} |
| 491 |
|
| 492 |
//--------------------------------------------------------------------------- |
| 493 |
// |
| 494 |
// PROC ShadeChain |
| 495 |
// |
| 496 |
//--------------------------------------------------------------------------- |
| 497 |
|
| 498 |
static void ShadeChain(void) |
| 499 |
{ |
| 500 |
int i; |
| 501 |
|
| 502 |
for (i = 0; i < 16; i++) |
| 503 |
{ |
| 504 |
ShadeLine(277 + i, 190, 10, i / 2); |
| 505 |
ShadeLine(19 + i, 190, 10, 7 - (i / 2)); |
| 506 |
} |
| 507 |
} |
| 508 |
|
| 509 |
//--------------------------------------------------------------------------- |
| 510 |
// |
| 511 |
// PROC SB_Drawer |
| 512 |
// |
| 513 |
//--------------------------------------------------------------------------- |
| 514 |
|
| 515 |
char ammopic[][10] = { |
| 516 |
{"INAMGLD"}, |
| 517 |
{"INAMBOW"}, |
| 518 |
{"INAMBST"}, |
| 519 |
{"INAMRAM"}, |
| 520 |
{"INAMPNX"}, |
| 521 |
{"INAMLOB"} |
| 522 |
}; |
| 523 |
|
| 524 |
static int oldarti = 0; |
| 525 |
static int oldartiCount = 0; |
| 526 |
static int oldfrags = -9999; |
| 527 |
static int oldammo = -1; |
| 528 |
static int oldarmor = -1; |
| 529 |
static int oldweapon = -1; |
| 530 |
static int oldhealth = -1; |
| 531 |
static int oldlife = -1; |
| 532 |
static int oldkeys = -1; |
| 533 |
|
| 534 |
static int oldmana1 = -1; |
| 535 |
static int oldmana2 = -1; |
| 536 |
static int oldpieces = -1; |
| 537 |
|
| 538 |
void SB_Drawer(dboolean statusbaron, dboolean refresh) |
| 539 |
{ |
| 540 |
if (refresh || fadeBG() || V_IsOpenGLMode()) SB_state = -1; |
| 541 |
|
| 542 |
if (!statusbaron) |
| 543 |
{ |
| 544 |
SB_PaletteFlash(false); |
| 545 |
if (R_FullView()) |
| 546 |
{ |
| 547 |
DrawAnimatedIcons(); |
| 548 |
} |
| 549 |
return; |
| 550 |
} |
| 551 |
|
| 552 |
CPlayer = &players[consoleplayer]; |
| 553 |
if (SB_state == -1) |
| 554 |
{ |
| 555 |
if (heretic) |
| 556 |
{ |
| 557 |
V_DrawNumPatchFS(0, 158, 0, LumpBARBACK, CR_DEFAULT, VPT_STRETCH); |
| 558 |
if (players[consoleplayer].cheats & CF_GODMODE) |
| 559 |
{ |
| 560 |
V_DrawNamePatch(16, 167, 0, "GOD1", CR_DEFAULT, VPT_STRETCH); |
| 561 |
V_DrawNamePatch(287, 167, 0, "GOD2", CR_DEFAULT, VPT_STRETCH); |
| 562 |
} |
| 563 |
} |
| 564 |
else |
| 565 |
{ |
| 566 |
V_DrawNumPatchFS(0, 134, 0, LumpH2BAR, CR_DEFAULT, VPT_STRETCH); |
| 567 |
} |
| 568 |
|
| 569 |
oldhealth = -1; |
| 570 |
} |
| 571 |
DrawCommonBar(); |
| 572 |
if (!inventory) |
| 573 |
{ |
| 574 |
if (SB_state != 0) |
| 575 |
{ |
| 576 |
// Main interface |
| 577 |
if (heretic) |
| 578 |
{ |
| 579 |
V_DrawNumPatch(34, 160, 0, LumpSTATBAR, CR_DEFAULT, VPT_STRETCH); |
| 580 |
} |
| 581 |
else |
| 582 |
{ |
| 583 |
if (!automap_active) |
| 584 |
{ |
| 585 |
V_DrawNumPatch(38, 162, 0, LumpSTATBAR, CR_DEFAULT, VPT_STRETCH); |
| 586 |
} |
| 587 |
else |
| 588 |
{ |
| 589 |
V_DrawNumPatch(38, 162, 0, LumpKEYBAR, CR_DEFAULT, VPT_STRETCH); |
| 590 |
} |
| 591 |
} |
| 592 |
oldarti = 0; |
| 593 |
oldammo = -1; |
| 594 |
oldmana1 = -1; |
| 595 |
oldmana2 = -1; |
| 596 |
oldarmor = -1; |
| 597 |
oldpieces = -1; |
| 598 |
oldweapon = -1; |
| 599 |
oldfrags = -9999; //can't use -1, 'cuz of negative frags |
| 600 |
oldlife = -1; |
| 601 |
oldkeys = -1; |
| 602 |
} |
| 603 |
if (heretic || !automap_active) |
| 604 |
{ |
| 605 |
DrawMainBar(); |
| 606 |
} |
| 607 |
else if (hexen) |
| 608 |
{ |
| 609 |
DrawKeyBar(); |
| 610 |
} |
| 611 |
SB_state = 0; |
| 612 |
} |
| 613 |
else |
| 614 |
{ |
| 615 |
if (heretic && SB_state != 1) |
| 616 |
{ |
| 617 |
V_DrawNumPatch(34, 160, 0, LumpINVBAR, CR_DEFAULT, VPT_STRETCH); |
| 618 |
} |
| 619 |
DrawInventoryBar(); |
| 620 |
SB_state = 1; |
| 621 |
} |
| 622 |
SB_PaletteFlash(false); |
| 623 |
DrawAnimatedIcons(); |
| 624 |
} |
| 625 |
|
| 626 |
// sets the new palette based upon current values of player->damagecount |
| 627 |
// and player->bonuscount |
| 628 |
void SB_PaletteFlash(dboolean forceChange) |
| 629 |
{ |
| 630 |
static int sb_palette = 0; |
| 631 |
int palette; |
| 632 |
|
| 633 |
if (forceChange) |
| 634 |
{ |
| 635 |
sb_palette = -1; |
| 636 |
} |
| 637 |
|
| 638 |
CPlayer = &players[consoleplayer]; |
| 639 |
|
| 640 |
if (CPlayer->poisoncount) |
| 641 |
{ |
| 642 |
palette = 0; |
| 643 |
palette = (CPlayer->poisoncount + 7) >> 3; |
| 644 |
if (palette >= NUMPOISONPALS) |
| 645 |
{ |
| 646 |
palette = NUMPOISONPALS - 1; |
| 647 |
} |
| 648 |
palette += STARTPOISONPALS; |
| 649 |
} |
| 650 |
else if (CPlayer->damagecount) |
| 651 |
{ |
| 652 |
palette = (CPlayer->damagecount + 7) >> 3; |
| 653 |
if (palette >= NUMREDPALS) |
| 654 |
{ |
| 655 |
palette = NUMREDPALS - 1; |
| 656 |
} |
| 657 |
palette += STARTREDPALS; |
| 658 |
} |
| 659 |
else if (CPlayer->bonuscount) |
| 660 |
{ |
| 661 |
palette = (CPlayer->bonuscount + 7) >> 3; |
| 662 |
if (palette >= NUMBONUSPALS) |
| 663 |
{ |
| 664 |
palette = NUMBONUSPALS - 1; |
| 665 |
} |
| 666 |
palette += STARTBONUSPALS; |
| 667 |
} |
| 668 |
else if (CPlayer->mo->flags2 & MF2_ICEDAMAGE) |
| 669 |
{ // Frozen player |
| 670 |
palette = STARTICEPAL; |
| 671 |
} |
| 672 |
else |
| 673 |
{ |
| 674 |
palette = 0; |
| 675 |
} |
| 676 |
if (palette != sb_palette) |
| 677 |
{ |
| 678 |
SB_state = -1; |
| 679 |
sb_palette = palette; |
| 680 |
V_SetPalette(sb_palette); |
| 681 |
} |
| 682 |
} |
| 683 |
|
| 684 |
//--------------------------------------------------------------------------- |
| 685 |
// |
| 686 |
// PROC DrawCommonBar |
| 687 |
// |
| 688 |
//--------------------------------------------------------------------------- |
| 689 |
|
| 690 |
void DrawCommonBar(void) |
| 691 |
{ |
| 692 |
int healthPos; |
| 693 |
|
| 694 |
if (!dsda_HideHorns()) |
| 695 |
{ |
| 696 |
if (heretic) |
| 697 |
{ |
| 698 |
V_DrawNumPatchFS(0, 148, 0, LumpLTFCTOP, CR_DEFAULT, VPT_STRETCH); |
| 699 |
V_DrawNumPatchFS(290, 148, 0, LumpRTFCTOP, CR_DEFAULT, VPT_STRETCH); |
| 700 |
} |
| 701 |
else |
| 702 |
{ |
| 703 |
V_DrawNumPatchFS(0, 134, 0, LumpH2TOP, CR_DEFAULT, VPT_STRETCH); |
| 704 |
} |
| 705 |
} |
| 706 |
|
| 707 |
if (oldhealth != HealthMarker) |
| 708 |
{ |
| 709 |
oldhealth = HealthMarker; |
| 710 |
healthPos = HealthMarker; |
| 711 |
if (healthPos < 0) |
| 712 |
{ |
| 713 |
healthPos = 0; |
| 714 |
} |
| 715 |
if (healthPos > 100) |
| 716 |
{ |
| 717 |
healthPos = 100; |
| 718 |
} |
| 719 |
|
| 720 |
if (heretic) |
| 721 |
{ |
| 722 |
int chainY; |
| 723 |
|
| 724 |
healthPos = (healthPos * 256) / 100; |
| 725 |
chainY = |
| 726 |
(HealthMarker == CPlayer->mo->health) ? 191 : 191 + ChainWiggle; |
| 727 |
V_DrawNumPatchFS(0, 190, 0, LumpCHAINBACK, CR_DEFAULT, VPT_STRETCH); |
| 728 |
V_DrawNumPatch(2 + (healthPos % 17), chainY, 0, LumpCHAIN, CR_DEFAULT, VPT_STRETCH); |
| 729 |
V_DrawNumPatch(17 + healthPos, chainY, 0, LumpLIFEGEM, CR_DEFAULT, VPT_STRETCH); |
| 730 |
V_DrawNumPatch(0, 190, 0, LumpLTFACE, CR_DEFAULT, VPT_STRETCH); |
| 731 |
V_DrawNumPatch(276, 190, 0, LumpRTFACE, CR_DEFAULT, VPT_STRETCH); |
| 732 |
ShadeChain(); |
| 733 |
} |
| 734 |
else |
| 735 |
{ |
| 736 |
V_DrawNumPatch(28 + (((healthPos * 196) / 100) % 9), 193, 0, LumpCHAIN, CR_DEFAULT, VPT_STRETCH); |
| 737 |
V_DrawNumPatch(7 + ((healthPos * 11) / 5), 193, 0, LumpLIFEGEM, CR_DEFAULT, VPT_STRETCH); |
| 738 |
V_DrawNumPatch(0, 193, 0, LumpLFEDGE, CR_DEFAULT, VPT_STRETCH); |
| 739 |
V_DrawNumPatch(277, 193, 0, LumpRTEDGE, CR_DEFAULT, VPT_STRETCH); |
| 740 |
} |
| 741 |
} |
| 742 |
} |
| 743 |
|
| 744 |
//--------------------------------------------------------------------------- |
| 745 |
// |
| 746 |
// PROC DrawMainBar |
| 747 |
// |
| 748 |
//--------------------------------------------------------------------------- |
| 749 |
|
| 750 |
void DrawMainBar(void) |
| 751 |
{ |
| 752 |
int i; |
| 753 |
int temp; |
| 754 |
|
| 755 |
if (hexen) return Hexen_DrawMainBar(); |
| 756 |
|
| 757 |
// Ready artifact |
| 758 |
if (ArtifactFlash) |
| 759 |
{ |
| 760 |
V_DrawNumPatch(180, 161, 0, LumpBLACKSQ, CR_DEFAULT, VPT_STRETCH); |
| 761 |
|
| 762 |
temp = W_GetNumForName("useartia") + ArtifactFlash - 1; |
| 763 |
|
| 764 |
V_DrawNumPatch(182, 161, 0, temp, CR_DEFAULT, VPT_STRETCH); |
| 765 |
ArtifactFlash--; |
| 766 |
oldarti = -1; // so that the correct artifact fills in after the flash |
| 767 |
} |
| 768 |
else if (oldarti != CPlayer->readyArtifact |
| 769 |
|| oldartiCount != CPlayer->inventory[inv_ptr].count) |
| 770 |
{ |
| 771 |
V_DrawNumPatch(180, 161, 0, LumpBLACKSQ, CR_DEFAULT, VPT_STRETCH); |
| 772 |
if (CPlayer->readyArtifact > 0) |
| 773 |
{ |
| 774 |
V_DrawNumPatch( |
| 775 |
179, 160, 0, lumparti[CPlayer->readyArtifact], CR_DEFAULT, VPT_STRETCH |
| 776 |
); |
| 777 |
|
| 778 |
DrSmallNumber(CPlayer->inventory[inv_ptr].count, 201, 182); |
| 779 |
} |
| 780 |
oldarti = CPlayer->readyArtifact; |
| 781 |
oldartiCount = CPlayer->inventory[inv_ptr].count; |
| 782 |
} |
| 783 |
|
| 784 |
// Frags |
| 785 |
if (deathmatch) |
| 786 |
{ |
| 787 |
temp = 0; |
| 788 |
for (i = 0; i < g_maxplayers; i++) |
| 789 |
{ |
| 790 |
temp += CPlayer->frags[i]; |
| 791 |
} |
| 792 |
if (temp != oldfrags) |
| 793 |
{ |
| 794 |
V_DrawNumPatch(57, 171, 0, LumpARMCLEAR, CR_DEFAULT, VPT_STRETCH); |
| 795 |
DrINumber(temp, 61, 170); |
| 796 |
oldfrags = temp; |
| 797 |
} |
| 798 |
} |
| 799 |
else |
| 800 |
{ |
| 801 |
temp = HealthMarker; |
| 802 |
if (temp < 0) |
| 803 |
{ |
| 804 |
temp = 0; |
| 805 |
} |
| 806 |
else if (temp > 100) |
| 807 |
{ |
| 808 |
temp = 100; |
| 809 |
} |
| 810 |
if (oldlife != temp) |
| 811 |
{ |
| 812 |
oldlife = temp; |
| 813 |
V_DrawNumPatch(57, 171, 0, LumpARMCLEAR, CR_DEFAULT, VPT_STRETCH); |
| 814 |
DrINumber(temp, 61, 170); |
| 815 |
} |
| 816 |
} |
| 817 |
|
| 818 |
// Keys |
| 819 |
if (oldkeys != CPlayer->ravenkeys) |
| 820 |
{ |
| 821 |
if (CPlayer->cards[key_yellow]) |
| 822 |
{ |
| 823 |
V_DrawNamePatch(153, 164, 0, "ykeyicon", CR_DEFAULT, VPT_STRETCH); |
| 824 |
} |
| 825 |
if (CPlayer->cards[key_green]) |
| 826 |
{ |
| 827 |
V_DrawNamePatch(153, 172, 0, "gkeyicon", CR_DEFAULT, VPT_STRETCH); |
| 828 |
} |
| 829 |
if (CPlayer->cards[key_blue]) |
| 830 |
{ |
| 831 |
V_DrawNamePatch(153, 180, 0, "bkeyicon", CR_DEFAULT, VPT_STRETCH); |
| 832 |
} |
| 833 |
oldkeys = CPlayer->ravenkeys; |
| 834 |
} |
| 835 |
// Ammo |
| 836 |
temp = CPlayer->ammo[wpnlev1info[CPlayer->readyweapon].ammo]; |
| 837 |
if (oldammo != temp || oldweapon != CPlayer->readyweapon) |
| 838 |
{ |
| 839 |
V_DrawNumPatch(108, 161, 0, LumpBLACKSQ, CR_DEFAULT, VPT_STRETCH); |
| 840 |
if (temp && CPlayer->readyweapon > 0 && CPlayer->readyweapon < 7) |
| 841 |
{ |
| 842 |
DrINumber(temp, 109, 162); |
| 843 |
V_DrawNamePatch( |
| 844 |
111, 172, 0, ammopic[CPlayer->readyweapon - 1], CR_DEFAULT, VPT_STRETCH |
| 845 |
); |
| 846 |
} |
| 847 |
oldammo = temp; |
| 848 |
oldweapon = CPlayer->readyweapon; |
| 849 |
} |
| 850 |
|
| 851 |
// Armor |
| 852 |
if (oldarmor != CPlayer->armorpoints[ARMOR_ARMOR]) |
| 853 |
{ |
| 854 |
V_DrawNumPatch(224, 171, 0, LumpARMCLEAR, CR_DEFAULT, VPT_STRETCH); |
| 855 |
DrINumber(CPlayer->armorpoints[ARMOR_ARMOR], 228, 170); |
| 856 |
oldarmor = CPlayer->armorpoints[ARMOR_ARMOR]; |
| 857 |
} |
| 858 |
} |
| 859 |
|
| 860 |
//--------------------------------------------------------------------------- |
| 861 |
// |
| 862 |
// PROC DrawInventoryBar |
| 863 |
// |
| 864 |
//--------------------------------------------------------------------------- |
| 865 |
|
| 866 |
void DrawInventoryBar(void) |
| 867 |
{ |
| 868 |
int i; |
| 869 |
int x; |
| 870 |
int lump; |
| 871 |
|
| 872 |
x = inv_ptr - curpos; |
| 873 |
V_DrawNumPatch(sb_inv_bar_x, sb_inv_bar_y, 0, LumpINVBAR, CR_DEFAULT, VPT_STRETCH); |
| 874 |
for (i = 0; i < 7; i++) |
| 875 |
{ |
| 876 |
if (CPlayer->inventorySlotNum > x + i |
| 877 |
&& CPlayer->inventory[x + i].type != arti_none) |
| 878 |
{ |
| 879 |
V_DrawNumPatch( |
| 880 |
50 + i * 31, sb_inv_arti_y, 0, |
| 881 |
lumparti[CPlayer->inventory[x + i].type], CR_DEFAULT, VPT_STRETCH |
| 882 |
); |
| 883 |
DrSmallNumber(CPlayer->inventory[x + i].count, |
| 884 |
sb_inv_arti_count_x + i * 31, sb_inv_arti_count_y); |
| 885 |
} |
| 886 |
} |
| 887 |
V_DrawNumPatch(50 + curpos * 31, sb_inv_select_y, 0, LumpSELECTBOX, CR_DEFAULT, VPT_STRETCH); |
| 888 |
if (x != 0) |
| 889 |
{ |
| 890 |
lump = !(leveltime & 4) ? LumpINVLFGEM1 : LumpINVLFGEM2; |
| 891 |
V_DrawNumPatch(sb_inv_gem_x, sb_inv_gem_y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 892 |
} |
| 893 |
if (CPlayer->inventorySlotNum - x > 7) |
| 894 |
{ |
| 895 |
lump = !(leveltime & 4) ? LumpINVRTGEM1 : LumpINVRTGEM2; |
| 896 |
V_DrawNumPatch(269, sb_inv_gem_y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 897 |
} |
| 898 |
} |
| 899 |
|
| 900 |
void DrawArtifact(int x, int y, int vpt) |
| 901 |
{ |
| 902 |
inventory_t *inv; |
| 903 |
const int delta_x = heretic ? 22 : 19; |
| 904 |
const int delta_y = heretic ? 22 : 21; |
| 905 |
|
| 906 |
inv = &players[displayplayer].inventory[inv_ptr]; |
| 907 |
|
| 908 |
if (inv->type > 0) |
| 909 |
{ |
| 910 |
V_DrawNumPatch(x, y, 0, lumparti[inv->type], CR_DEFAULT, vpt); |
| 911 |
DrSmallNumberVPT(inv->count, x + delta_x, y + delta_y, vpt); |
| 912 |
} |
| 913 |
} |
| 914 |
|
| 915 |
// hexen |
| 916 |
|
| 917 |
static void Hexen_SB_Init(void) |
| 918 |
{ |
| 919 |
int i; |
| 920 |
int startLump; |
| 921 |
|
| 922 |
lumparti = hexen_lumparti; |
| 923 |
sb_ticker_delta_cap = 6; |
| 924 |
sb_icon_y = 19; |
| 925 |
sb_inv_bar_x = 38; |
| 926 |
sb_inv_bar_y = 162; |
| 927 |
sb_inv_arti_y = 163; |
| 928 |
sb_inv_arti_count_x = 68; |
| 929 |
sb_inv_arti_count_y = 185; |
| 930 |
sb_inv_select_y = 163; |
| 931 |
sb_inv_gem_x = 42; |
| 932 |
sb_inv_gem_y = 163; |
| 933 |
sb_full_arti_x = 284; |
| 934 |
sb_full_arti_y = 169; |
| 935 |
sb_full_arti_count_x = 302; |
| 936 |
sb_full_inv_arti_x = 49; |
| 937 |
sb_full_inv_arti_y = 167; |
| 938 |
sb_full_inv_arti_count_x = 66; |
| 939 |
sb_full_inv_arti_count_y = 188; |
| 940 |
sb_full_inv_select_y = 167; |
| 941 |
sb_full_inv_gem_xl = 40; |
| 942 |
sb_full_inv_gem_xr = 268; |
| 943 |
|
| 944 |
// magic globals that ends up in the background |
| 945 |
R_SetPatchNum(&brdr_b, "bordb"); |
| 946 |
R_SetPatchNum(&stbarbg, "H2BAR"); |
| 947 |
|
| 948 |
for (i = 0; i < 33; ++i) |
| 949 |
{ |
| 950 |
lumparti[i] = W_CheckNumForName2(hexen_namearti[i], ns_sprites); |
| 951 |
} |
| 952 |
|
| 953 |
LumpH2BAR = W_GetNumForName("H2BAR"); |
| 954 |
LumpH2TOP = W_GetNumForName("H2TOP"); |
| 955 |
LumpINVBAR = W_GetNumForName("INVBAR"); |
| 956 |
LumpLFEDGE = W_GetNumForName("LFEDGE"); |
| 957 |
LumpRTEDGE = W_GetNumForName("RTEDGE"); |
| 958 |
LumpSTATBAR = W_GetNumForName("STATBAR"); |
| 959 |
LumpKEYBAR = W_GetNumForName("KEYBAR"); |
| 960 |
LumpSELECTBOX = W_GetNumForName("SELECTBOX"); |
| 961 |
LumpARTICLEAR = W_GetNumForName("ARTICLS"); |
| 962 |
LumpARMCLEAR = W_GetNumForName("ARMCLS"); |
| 963 |
LumpMANACLEAR = W_GetNumForName("MANACLS"); |
| 964 |
LumpMANAVIAL1 = W_GetNumForName("MANAVL1"); |
| 965 |
LumpMANAVIAL2 = W_GetNumForName("MANAVL2"); |
| 966 |
LumpMANAVIALDIM1 = W_GetNumForName("MANAVL1D"); |
| 967 |
LumpMANAVIALDIM2 = W_GetNumForName("MANAVL2D"); |
| 968 |
LumpMANADIM1 = W_GetNumForName("MANADIM1"); |
| 969 |
LumpMANADIM2 = W_GetNumForName("MANADIM2"); |
| 970 |
LumpMANABRIGHT1 = W_GetNumForName("MANABRT1"); |
| 971 |
LumpMANABRIGHT2 = W_GetNumForName("MANABRT2"); |
| 972 |
LumpINVLFGEM1 = W_GetNumForName("invgeml1"); |
| 973 |
LumpINVLFGEM2 = W_GetNumForName("invgeml2"); |
| 974 |
LumpINVRTGEM1 = W_GetNumForName("invgemr1"); |
| 975 |
LumpINVRTGEM2 = W_GetNumForName("invgemr2"); |
| 976 |
|
| 977 |
startLump = W_GetNumForName("IN0"); |
| 978 |
for (i = 0; i < 10; i++) |
| 979 |
{ |
| 980 |
LumpINumbers[i] = startLump + i; |
| 981 |
} |
| 982 |
LumpNEGATIVE = W_GetNumForName("NEGNUM"); |
| 983 |
FontBNumBase = W_GetNumForName("FONTB16"); |
| 984 |
startLump = W_GetNumForName("SMALLIN0"); |
| 985 |
for (i = 0; i < 10; i++) |
| 986 |
{ |
| 987 |
LumpSmNumbers[i] = startLump + i; |
| 988 |
} |
| 989 |
spinflylump = W_GetNumForName("SPFLY0"); |
| 990 |
SpinMinotaurLump = W_GetNumForName("SPMINO0"); |
| 991 |
SpinSpeedLump = W_GetNumForName("SPBOOT0"); |
| 992 |
SpinDefenseLump = W_GetNumForName("SPSHLD0"); |
| 993 |
|
| 994 |
if (deathmatch) |
| 995 |
{ |
| 996 |
LumpKILLS = W_GetNumForName("KILLS"); |
| 997 |
} |
| 998 |
SB_SetClassData(); |
| 999 |
|
| 1000 |
// [FG] support widescreen status bar backgrounds |
| 1001 |
ST_SetScaledWidth(); |
| 1002 |
|
| 1003 |
ST_LoadTextColors(); |
| 1004 |
} |
| 1005 |
|
| 1006 |
void SB_SetClassData(void) |
| 1007 |
{ |
| 1008 |
int class; |
| 1009 |
|
| 1010 |
class = PlayerClass[consoleplayer] - 1; // original player class (not pig) |
| 1011 |
LumpWEAPONSLOT = W_GetNumForName("wpslot0") + class; |
| 1012 |
LumpWEAPONFULL = W_GetNumForName("wpfull0") + class; |
| 1013 |
LumpPIECE1 = W_GetNumForName("wpiecef1") + class; |
| 1014 |
LumpPIECE2 = W_GetNumForName("wpiecef2") + class; |
| 1015 |
LumpPIECE3 = W_GetNumForName("wpiecef3") + class; |
| 1016 |
LumpCHAIN = W_GetNumForName("chain") + class; |
| 1017 |
if (!netgame) |
| 1018 |
{ // single player game uses red life gem (the second gem) |
| 1019 |
LumpLIFEGEM = W_GetNumForName("lifegem") + g_maxplayers * class + 1; |
| 1020 |
} |
| 1021 |
else |
| 1022 |
{ |
| 1023 |
LumpLIFEGEM = W_GetNumForName("lifegem") + g_maxplayers * class + consoleplayer; |
| 1024 |
} |
| 1025 |
SB_state = -1; |
| 1026 |
} |
| 1027 |
|
| 1028 |
static void Hexen_DrINumber(signed int val, int x, int y) |
| 1029 |
{ |
| 1030 |
int lump; |
| 1031 |
int oldval; |
| 1032 |
|
| 1033 |
oldval = val; |
| 1034 |
if (val < 0) |
| 1035 |
{ |
| 1036 |
val = -val; |
| 1037 |
if (val > 99) |
| 1038 |
{ |
| 1039 |
val = 99; |
| 1040 |
} |
| 1041 |
if (val > 9) |
| 1042 |
{ |
| 1043 |
lump = LumpINumbers[val / 10]; |
| 1044 |
V_DrawNumPatch(x + 8, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1045 |
V_DrawNumPatch(x, y, 0, LumpNEGATIVE, CR_DEFAULT, VPT_STRETCH); |
| 1046 |
} |
| 1047 |
else |
| 1048 |
{ |
| 1049 |
V_DrawNumPatch(x + 8, y, 0, LumpNEGATIVE, CR_DEFAULT, VPT_STRETCH); |
| 1050 |
} |
| 1051 |
val = val % 10; |
| 1052 |
lump = LumpINumbers[val]; |
| 1053 |
V_DrawNumPatch(x + 16, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1054 |
return; |
| 1055 |
} |
| 1056 |
if (val > 99) |
| 1057 |
{ |
| 1058 |
lump = LumpINumbers[val / 100]; |
| 1059 |
V_DrawNumPatch(x, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1060 |
} |
| 1061 |
val = val % 100; |
| 1062 |
if (val > 9 || oldval > 99) |
| 1063 |
{ |
| 1064 |
lump = LumpINumbers[val / 10]; |
| 1065 |
V_DrawNumPatch(x + 8, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1066 |
} |
| 1067 |
val = val % 10; |
| 1068 |
lump = LumpINumbers[val]; |
| 1069 |
V_DrawNumPatch(x + 16, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1070 |
} |
| 1071 |
|
| 1072 |
static void Hexen_DrSmallNumberVPT(int val, int x, int y, int vpt) |
| 1073 |
{ |
| 1074 |
int lump; |
| 1075 |
|
| 1076 |
if (val <= 0) |
| 1077 |
{ |
| 1078 |
return; |
| 1079 |
} |
| 1080 |
if (val > 999) |
| 1081 |
{ |
| 1082 |
val %= 1000; |
| 1083 |
} |
| 1084 |
if (val > 99) |
| 1085 |
{ |
| 1086 |
lump = LumpSmNumbers[val / 100]; |
| 1087 |
V_DrawNumPatch(x, y, 0, lump, CR_DEFAULT, vpt); |
| 1088 |
lump = LumpSmNumbers[(val % 100) / 10]; |
| 1089 |
V_DrawNumPatch(x + 4, y, 0, lump, CR_DEFAULT, vpt); |
| 1090 |
} |
| 1091 |
else if (val > 9) |
| 1092 |
{ |
| 1093 |
lump = LumpSmNumbers[val / 10]; |
| 1094 |
V_DrawNumPatch(x + 4, y, 0, lump, CR_DEFAULT, vpt); |
| 1095 |
} |
| 1096 |
val %= 10; |
| 1097 |
lump = LumpSmNumbers[val]; |
| 1098 |
V_DrawNumPatch(x + 8, y, 0, lump, CR_DEFAULT, vpt); |
| 1099 |
} |
| 1100 |
|
| 1101 |
static void DrRedINumber(signed int val, int x, int y) |
| 1102 |
{ |
| 1103 |
int lump; |
| 1104 |
int oldval; |
| 1105 |
|
| 1106 |
oldval = val; |
| 1107 |
if (val < 0) |
| 1108 |
{ |
| 1109 |
val = 0; |
| 1110 |
} |
| 1111 |
if (val > 99) |
| 1112 |
{ |
| 1113 |
lump = W_GetNumForName("inred0") + val / 100; |
| 1114 |
V_DrawNumPatch(x, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1115 |
} |
| 1116 |
val = val % 100; |
| 1117 |
if (val > 9 || oldval > 99) |
| 1118 |
{ |
| 1119 |
lump = W_GetNumForName("inred0") + val / 10; |
| 1120 |
V_DrawNumPatch(x + 8, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1121 |
} |
| 1122 |
val = val % 10; |
| 1123 |
lump = W_GetNumForName("inred0") + val; |
| 1124 |
V_DrawNumPatch(x + 16, y, 0, lump, CR_DEFAULT, VPT_STRETCH); |
| 1125 |
} |
| 1126 |
|
| 1127 |
static void DrawAnimatedIcons(void) |
| 1128 |
{ |
| 1129 |
int frame; |
| 1130 |
static dboolean hitCenterFrame; |
| 1131 |
|
| 1132 |
// Flight icons |
| 1133 |
if (CPlayer->powers[pw_flight]) |
| 1134 |
{ |
| 1135 |
if (CPlayer->powers[pw_flight] > BLINKTHRESHOLD |
| 1136 |
|| !(CPlayer->powers[pw_flight] & 16)) |
| 1137 |
{ |
| 1138 |
frame = (leveltime / 3) & 15; |
| 1139 |
if (CPlayer->mo->flags2 & MF2_FLY) |
| 1140 |
{ |
| 1141 |
if (hitCenterFrame && (frame != 15 && frame != 0)) |
| 1142 |
{ |
| 1143 |
V_DrawNumPatch(20, sb_icon_y, 0, spinflylump + 15, CR_DEFAULT, VPT_STRETCH); |
| 1144 |
} |
| 1145 |
else |
| 1146 |
{ |
| 1147 |
V_DrawNumPatch(20, sb_icon_y, 0, spinflylump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1148 |
hitCenterFrame = false; |
| 1149 |
} |
| 1150 |
} |
| 1151 |
else |
| 1152 |
{ |
| 1153 |
if (!hitCenterFrame && (frame != 15 && frame != 0)) |
| 1154 |
{ |
| 1155 |
V_DrawNumPatch(20, sb_icon_y, 0, spinflylump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1156 |
hitCenterFrame = false; |
| 1157 |
} |
| 1158 |
else |
| 1159 |
{ |
| 1160 |
V_DrawNumPatch(20, sb_icon_y, 0, spinflylump + 15, CR_DEFAULT, VPT_STRETCH); |
| 1161 |
hitCenterFrame = true; |
| 1162 |
} |
| 1163 |
} |
| 1164 |
} |
| 1165 |
} |
| 1166 |
|
| 1167 |
if (CPlayer->powers[pw_weaponlevel2] && !CPlayer->chickenTics) |
| 1168 |
{ |
| 1169 |
if (CPlayer->powers[pw_weaponlevel2] > BLINKTHRESHOLD |
| 1170 |
|| !(CPlayer->powers[pw_weaponlevel2] & 16)) |
| 1171 |
{ |
| 1172 |
frame = (leveltime / 3) & 15; |
| 1173 |
V_DrawNumPatch(300, sb_icon_y, 0, spinbooklump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1174 |
} |
| 1175 |
} |
| 1176 |
|
| 1177 |
// Speed Boots |
| 1178 |
if (CPlayer->powers[pw_speed]) |
| 1179 |
{ |
| 1180 |
if (CPlayer->powers[pw_speed] > BLINKTHRESHOLD |
| 1181 |
|| !(CPlayer->powers[pw_speed] & 16)) |
| 1182 |
{ |
| 1183 |
frame = (leveltime / 3) & 15; |
| 1184 |
V_DrawNumPatch(60, sb_icon_y, 0, SpinSpeedLump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1185 |
} |
| 1186 |
} |
| 1187 |
|
| 1188 |
// Defensive power |
| 1189 |
if (hexen && CPlayer->powers[pw_invulnerability]) |
| 1190 |
{ |
| 1191 |
if (CPlayer->powers[pw_invulnerability] > BLINKTHRESHOLD |
| 1192 |
|| !(CPlayer->powers[pw_invulnerability] & 16)) |
| 1193 |
{ |
| 1194 |
frame = (leveltime / 3) & 15; |
| 1195 |
V_DrawNumPatch(260, sb_icon_y, 0, SpinDefenseLump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1196 |
} |
| 1197 |
} |
| 1198 |
|
| 1199 |
// Minotaur Active |
| 1200 |
if (CPlayer->powers[pw_minotaur]) |
| 1201 |
{ |
| 1202 |
if (CPlayer->powers[pw_minotaur] > BLINKTHRESHOLD |
| 1203 |
|| !(CPlayer->powers[pw_minotaur] & 16)) |
| 1204 |
{ |
| 1205 |
frame = (leveltime / 3) & 15; |
| 1206 |
V_DrawNumPatch(300, sb_icon_y, 0, SpinMinotaurLump + frame, CR_DEFAULT, VPT_STRETCH); |
| 1207 |
} |
| 1208 |
} |
| 1209 |
} |
| 1210 |
|
| 1211 |
void DrawKeyBar(void) |
| 1212 |
{ |
| 1213 |
int i; |
| 1214 |
int xPosition; |
| 1215 |
int temp; |
| 1216 |
|
| 1217 |
if (oldkeys != CPlayer->ravenkeys) |
| 1218 |
{ |
| 1219 |
xPosition = 46; |
| 1220 |
for (i = 0; i < NUMCARDS && xPosition <= 126; i++) |
| 1221 |
{ |
| 1222 |
if (CPlayer->ravenkeys & (1 << i)) |
| 1223 |
{ |
| 1224 |
V_DrawNumPatch(xPosition, 164, 0, |
| 1225 |
W_GetNumForName("keyslot1") + i, CR_DEFAULT, VPT_STRETCH); |
| 1226 |
xPosition += 20; |
| 1227 |
} |
| 1228 |
} |
| 1229 |
oldkeys = CPlayer->ravenkeys; |
| 1230 |
} |
| 1231 |
temp = pclass[CPlayer->pclass].auto_armor_save + |
| 1232 |
CPlayer->armorpoints[ARMOR_ARMOR] + |
| 1233 |
CPlayer->armorpoints[ARMOR_SHIELD] + |
| 1234 |
CPlayer->armorpoints[ARMOR_HELMET] + |
| 1235 |
CPlayer->armorpoints[ARMOR_AMULET]; |
| 1236 |
if (oldarmor != temp) |
| 1237 |
{ |
| 1238 |
for (i = 0; i < NUMARMOR; i++) |
| 1239 |
{ |
| 1240 |
if (!CPlayer->armorpoints[i]) |
| 1241 |
{ |
| 1242 |
continue; |
| 1243 |
} |
| 1244 |
if (CPlayer->armorpoints[i] <= (pclass[CPlayer->pclass].armor_increment[i] >> 2)) |
| 1245 |
{ |
| 1246 |
V_DrawTLNumPatch(150 + 31 * i, 164, W_GetNumForName("armslot1") + i); |
| 1247 |
} |
| 1248 |
else if (CPlayer->armorpoints[i] <= (pclass[CPlayer->pclass].armor_increment[i] >> 1)) |
| 1249 |
{ |
| 1250 |
V_DrawAltTLNumPatch(150 + 31 * i, 164, W_GetNumForName("armslot1") + i); |
| 1251 |
} |
| 1252 |
else |
| 1253 |
{ |
| 1254 |
V_DrawNumPatch(150 + 31 * i, 164, 0, |
| 1255 |
W_GetNumForName("armslot1") + i, CR_DEFAULT, VPT_STRETCH); |
| 1256 |
} |
| 1257 |
} |
| 1258 |
oldarmor = temp; |
| 1259 |
} |
| 1260 |
} |
| 1261 |
|
| 1262 |
static int PieceX[NUMCLASSES][3] = { |
| 1263 |
[PCLASS_FIGHTER] = {190, 225, 234}, |
| 1264 |
{190, 213, 226}, |
| 1265 |
{190, 205, 224}, |
| 1266 |
{0, 0, 0} // Pig is never used |
| 1267 |
}; |
| 1268 |
|
| 1269 |
static void DrawWeaponPieces(void) |
| 1270 |
{ |
| 1271 |
if (CPlayer->pieces == 7) |
| 1272 |
{ |
| 1273 |
V_DrawNumPatch(190, 162, 0, LumpWEAPONFULL, CR_DEFAULT, VPT_STRETCH); |
| 1274 |
return; |
| 1275 |
} |
| 1276 |
V_DrawNumPatch(190, 162, 0, LumpWEAPONSLOT, CR_DEFAULT, VPT_STRETCH); |
| 1277 |
if (CPlayer->pieces & WPIECE1) |
| 1278 |
{ |
| 1279 |
V_DrawNumPatch(PieceX[PlayerClass[consoleplayer]][0], 162, 0, LumpPIECE1, CR_DEFAULT, VPT_STRETCH); |
| 1280 |
} |
| 1281 |
if (CPlayer->pieces & WPIECE2) |
| 1282 |
{ |
| 1283 |
V_DrawNumPatch(PieceX[PlayerClass[consoleplayer]][1], 162, 0, LumpPIECE2, CR_DEFAULT, VPT_STRETCH); |
| 1284 |
} |
| 1285 |
if (CPlayer->pieces & WPIECE3) |
| 1286 |
{ |
| 1287 |
V_DrawNumPatch(PieceX[PlayerClass[consoleplayer]][2], 162, 0, LumpPIECE3, CR_DEFAULT, VPT_STRETCH); |
| 1288 |
} |
| 1289 |
} |
| 1290 |
|
| 1291 |
static void Hexen_DrawMainBar(void) |
| 1292 |
{ |
| 1293 |
int i; |
| 1294 |
int temp; |
| 1295 |
int manaLump1, manaLump2; |
| 1296 |
int manaVialLump1, manaVialLump2; |
| 1297 |
|
| 1298 |
manaLump1 = 0; |
| 1299 |
manaLump2 = 0; |
| 1300 |
manaVialLump1 = 0; |
| 1301 |
manaVialLump2 = 0; |
| 1302 |
|
| 1303 |
// Ready artifact |
| 1304 |
if (ArtifactFlash) |
| 1305 |
{ |
| 1306 |
V_DrawNumPatch(144, 160, 0, LumpARTICLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1307 |
V_DrawNumPatch(148, 164, 0, |
| 1308 |
W_GetNumForName("useartia") + ArtifactFlash - 1, CR_DEFAULT, VPT_STRETCH); |
| 1309 |
ArtifactFlash--; |
| 1310 |
oldarti = -1; // so that the correct artifact fills in after the flash |
| 1311 |
} |
| 1312 |
else if (oldarti != CPlayer->readyArtifact |
| 1313 |
|| oldartiCount != CPlayer->inventory[inv_ptr].count) |
| 1314 |
{ |
| 1315 |
V_DrawNumPatch(144, 160, 0, LumpARTICLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1316 |
if (CPlayer->readyArtifact > 0) |
| 1317 |
{ |
| 1318 |
V_DrawNumPatch(143, 163, 0, |
| 1319 |
lumparti[CPlayer->readyArtifact], CR_DEFAULT, VPT_STRETCH); |
| 1320 |
if (CPlayer->inventory[inv_ptr].count > 1) |
| 1321 |
{ |
| 1322 |
DrSmallNumber(CPlayer->inventory[inv_ptr].count, 162, 184); |
| 1323 |
} |
| 1324 |
} |
| 1325 |
oldarti = CPlayer->readyArtifact; |
| 1326 |
oldartiCount = CPlayer->inventory[inv_ptr].count; |
| 1327 |
} |
| 1328 |
|
| 1329 |
// Frags |
| 1330 |
if (deathmatch) |
| 1331 |
{ |
| 1332 |
temp = 0; |
| 1333 |
for (i = 0; i < g_maxplayers; i++) |
| 1334 |
{ |
| 1335 |
temp += CPlayer->frags[i]; |
| 1336 |
} |
| 1337 |
if (temp != oldfrags) |
| 1338 |
{ |
| 1339 |
V_DrawNumPatch(38, 162, 0, LumpKILLS, CR_DEFAULT, VPT_STRETCH); |
| 1340 |
DrINumber(temp, 40, 176); |
| 1341 |
oldfrags = temp; |
| 1342 |
} |
| 1343 |
} |
| 1344 |
else |
| 1345 |
{ |
| 1346 |
temp = HealthMarker; |
| 1347 |
if (temp < 0) |
| 1348 |
{ |
| 1349 |
temp = 0; |
| 1350 |
} |
| 1351 |
else if (temp > 100) |
| 1352 |
{ |
| 1353 |
temp = 100; |
| 1354 |
} |
| 1355 |
if (oldlife != temp) |
| 1356 |
{ |
| 1357 |
oldlife = temp; |
| 1358 |
V_DrawNumPatch(41, 178, 0, LumpARMCLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1359 |
if (temp >= 25) |
| 1360 |
{ |
| 1361 |
DrINumber(temp, 40, 176); |
| 1362 |
} |
| 1363 |
else |
| 1364 |
{ |
| 1365 |
DrRedINumber(temp, 40, 176); |
| 1366 |
} |
| 1367 |
} |
| 1368 |
} |
| 1369 |
// Mana |
| 1370 |
temp = CPlayer->ammo[0]; |
| 1371 |
if (oldmana1 != temp) |
| 1372 |
{ |
| 1373 |
V_DrawNumPatch(77, 178, 0, LumpMANACLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1374 |
DrSmallNumber(temp, 79, 181); |
| 1375 |
manaVialLump1 = -1; // force a vial update |
| 1376 |
if (temp == 0) |
| 1377 |
{ // Draw Dim Mana icon |
| 1378 |
manaLump1 = LumpMANADIM1; |
| 1379 |
} |
| 1380 |
else if (oldmana1 == 0) |
| 1381 |
{ |
| 1382 |
manaLump1 = LumpMANABRIGHT1; |
| 1383 |
} |
| 1384 |
oldmana1 = temp; |
| 1385 |
} |
| 1386 |
temp = CPlayer->ammo[1]; |
| 1387 |
if (oldmana2 != temp) |
| 1388 |
{ |
| 1389 |
V_DrawNumPatch(109, 178, 0, LumpMANACLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1390 |
DrSmallNumber(temp, 111, 181); |
| 1391 |
manaVialLump1 = -1; // force a vial update |
| 1392 |
if (temp == 0) |
| 1393 |
{ // Draw Dim Mana icon |
| 1394 |
manaLump2 = LumpMANADIM2; |
| 1395 |
} |
| 1396 |
else if (oldmana2 == 0) |
| 1397 |
{ |
| 1398 |
manaLump2 = LumpMANABRIGHT2; |
| 1399 |
} |
| 1400 |
oldmana2 = temp; |
| 1401 |
} |
| 1402 |
if (oldweapon != CPlayer->readyweapon || manaLump1 || manaLump2 |
| 1403 |
|| manaVialLump1) |
| 1404 |
{ // Update mana graphics based upon mana count/weapon type |
| 1405 |
if (CPlayer->readyweapon == wp_first) |
| 1406 |
{ |
| 1407 |
manaLump1 = LumpMANADIM1; |
| 1408 |
manaLump2 = LumpMANADIM2; |
| 1409 |
manaVialLump1 = LumpMANAVIALDIM1; |
| 1410 |
manaVialLump2 = LumpMANAVIALDIM2; |
| 1411 |
} |
| 1412 |
else if (CPlayer->readyweapon == wp_second) |
| 1413 |
{ |
| 1414 |
if (!manaLump1) |
| 1415 |
{ |
| 1416 |
manaLump1 = LumpMANABRIGHT1; |
| 1417 |
} |
| 1418 |
manaVialLump1 = LumpMANAVIAL1; |
| 1419 |
manaLump2 = LumpMANADIM2; |
| 1420 |
manaVialLump2 = LumpMANAVIALDIM2; |
| 1421 |
} |
| 1422 |
else if (CPlayer->readyweapon == wp_third) |
| 1423 |
{ |
| 1424 |
manaLump1 = LumpMANADIM1; |
| 1425 |
manaVialLump1 = LumpMANAVIALDIM1; |
| 1426 |
if (!manaLump2) |
| 1427 |
{ |
| 1428 |
manaLump2 = LumpMANABRIGHT2; |
| 1429 |
} |
| 1430 |
manaVialLump2 = LumpMANAVIAL2; |
| 1431 |
} |
| 1432 |
else |
| 1433 |
{ |
| 1434 |
manaVialLump1 = LumpMANAVIAL1; |
| 1435 |
manaVialLump2 = LumpMANAVIAL2; |
| 1436 |
if (!manaLump1) |
| 1437 |
{ |
| 1438 |
manaLump1 = LumpMANABRIGHT1; |
| 1439 |
} |
| 1440 |
if (!manaLump2) |
| 1441 |
{ |
| 1442 |
manaLump2 = LumpMANABRIGHT2; |
| 1443 |
} |
| 1444 |
} |
| 1445 |
V_DrawNumPatch(77, 164, 0, manaLump1, CR_DEFAULT, VPT_STRETCH); |
| 1446 |
V_DrawNumPatch(110, 164, 0, manaLump2, CR_DEFAULT, VPT_STRETCH); |
| 1447 |
|
| 1448 |
V_DrawNumPatch(94, 164, 0, manaVialLump1, CR_DEFAULT, VPT_STRETCH); |
| 1449 |
V_FillRectVPT(0, 95, 165, 3, 22 - (22 * CPlayer->ammo[0]) / MAX_MANA, 0, VPT_STRETCH); |
| 1450 |
|
| 1451 |
V_DrawNumPatch(102, 164, 0, manaVialLump2, CR_DEFAULT, VPT_STRETCH); |
| 1452 |
V_FillRectVPT(0, 103, 165, 3, 22 - (22 * CPlayer->ammo[1]) / MAX_MANA, 0, VPT_STRETCH); |
| 1453 |
|
| 1454 |
oldweapon = CPlayer->readyweapon; |
| 1455 |
} |
| 1456 |
// Armor |
| 1457 |
temp = pclass[CPlayer->pclass].auto_armor_save + |
| 1458 |
CPlayer->armorpoints[ARMOR_ARMOR] + |
| 1459 |
CPlayer->armorpoints[ARMOR_SHIELD] + |
| 1460 |
CPlayer->armorpoints[ARMOR_HELMET] + |
| 1461 |
CPlayer->armorpoints[ARMOR_AMULET]; |
| 1462 |
if (oldarmor != temp) |
| 1463 |
{ |
| 1464 |
oldarmor = temp; |
| 1465 |
V_DrawNumPatch(255, 178, 0, LumpARMCLEAR, CR_DEFAULT, VPT_STRETCH); |
| 1466 |
DrINumber(FixedDiv(temp, 5 * FRACUNIT) >> FRACBITS, 250, 176); |
| 1467 |
} |
| 1468 |
// Weapon Pieces |
| 1469 |
if (oldpieces != CPlayer->pieces) |
| 1470 |
{ |
| 1471 |
DrawWeaponPieces(); |
| 1472 |
oldpieces = CPlayer->pieces; |
| 1473 |
} |
| 1474 |
} |