From d7686d0c26204497f32cc1f3920db6d7bca1c768 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Wed, 2 Jun 2010 20:26:27 +0000 Subject: [PATCH] - Added optional offset parameters to the drawshadow flag. - Added character alignment parameter to font monospacing. - Fixed: character shadows were not scaled. - Heretic keys now have an icon associated with them so that they can be drawn through drawkeybar. - Replaced the built in Heretic and Hexen status bars with SBarInfo equivalents. SVN r2353 (trunk) --- src/CMakeLists.txt | 2 - src/g_heretic/heretic_sbar.cpp | 795 ------------ src/g_hexen/hexen_sbar.cpp | 1194 ------------------ src/g_level.cpp | 20 +- src/g_shared/sbar.h | 2 - src/g_shared/sbarinfo.cpp | 51 +- src/g_shared/sbarinfo.h | 8 + src/g_shared/sbarinfo_commands.cpp | 31 +- wadsrc/static/actors/heretic/heretickeys.txt | 3 + wadsrc/static/animdefs.txt | 6 + wadsrc/static/mapinfo/heretic.txt | 2 +- wadsrc/static/mapinfo/hexen.txt | 2 +- wadsrc/static/sbarinfo/heretic.txt | 123 ++ wadsrc/static/sbarinfo/hexen.txt | 259 ++++ 14 files changed, 478 insertions(+), 2020 deletions(-) delete mode 100644 src/g_heretic/heretic_sbar.cpp delete mode 100644 src/g_hexen/hexen_sbar.cpp create mode 100755 wadsrc/static/sbarinfo/heretic.txt create mode 100755 wadsrc/static/sbarinfo/hexen.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b81095f3..31b3e1414 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -664,9 +664,7 @@ add_executable( zdoom WIN32 zstring.cpp g_doom/a_doommisc.cpp g_heretic/a_hereticmisc.cpp - g_heretic/heretic_sbar.cpp g_hexen/a_hexenmisc.cpp - g_hexen/hexen_sbar.cpp g_raven/a_artitele.cpp g_raven/a_minotaur.cpp g_strife/a_strifestuff.cpp diff --git a/src/g_heretic/heretic_sbar.cpp b/src/g_heretic/heretic_sbar.cpp deleted file mode 100644 index d9cabf2d5..000000000 --- a/src/g_heretic/heretic_sbar.cpp +++ /dev/null @@ -1,795 +0,0 @@ -#include - -#include "doomtype.h" -#include "doomstat.h" -#include "v_font.h" -#include "sbar.h" -#include "r_defs.h" -#include "w_wad.h" -#include "m_random.h" -#include "d_player.h" -#include "st_stuff.h" -#include "v_video.h" -#include "r_draw.h" -#include "templates.h" -#include "a_keys.h" -#include "r_translate.h" -#include "g_level.h" -#include "v_palette.h" - - -static FRandom pr_chainwiggle; - -// This texture is used to shade each end of the health chain -class FHereticShader : public FTexture -{ -public: - FHereticShader (); - - const BYTE *GetColumn (unsigned int column, const Span **spans_out); - const BYTE *GetPixels (); - void Unload (); - -private: - static const BYTE Pixels[10*16]; - static const Span DummySpan[2]; -}; - -static FHereticShader ChainShade; - -const FTexture::Span FHereticShader::DummySpan[2] = { { 0, 10 }, { 0, 0 } }; -const BYTE FHereticShader::Pixels[10*16] = -{ - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, - 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -}; - -FHereticShader::FHereticShader () -{ - Width = 16; - Height = 10; - WidthBits = 4; - HeightBits = 4; - WidthMask = 15; -} - -void FHereticShader::Unload () -{ -} - -const BYTE *FHereticShader::GetColumn (unsigned int column, const Span **spans_out) -{ - if (spans_out != NULL) - { - *spans_out = DummySpan; - } - return Pixels + 10*(column & 15); -} - -const BYTE *FHereticShader::GetPixels () -{ - return Pixels; -} - - -class DHereticStatusBar : public DBaseStatusBar -{ - DECLARE_CLASS(DHereticStatusBar, DBaseStatusBar) - HAS_OBJECT_POINTERS -public: - DHereticStatusBar () : DBaseStatusBar (42) - { - static const char *hereticLumpNames[NUM_HERETICSB_IMAGES] = - { - "LTFACE", "RTFACE", "BARBACK", "INVBAR", "CHAIN", - NULL, "LIFEGEM2", "LTFCTOP", "RTFCTOP", "SELECTBO", - "INVGEML1", "INVGEML2", "INVGEMR1", "INVGEMR2", "BLACKSQ", - "ARMCLEAR", "CHAINBACK","GOD1", "GOD2", "USEARTIA", - "USEARTIB", "USEARTIC", "USEARTID", "YKEYICON", "GKEYICON", - "BKEYICON", "ARTIBOX", "PTN1A0", "PTN1B0", "PTN1C0" - }; - static const char *sharedLumpNames[] = - { - "LAME", "NEGNUM", "IN0", "IN1", "IN2", - "IN3", "IN4", "IN5", "IN6", "IN7", - "IN8", "IN9", "FONTB13", "FONTB16", "FONTB17", - "FONTB18", "FONTB19", "FONTB20", "FONTB21", "FONTB22", - "FONTB23", "FONTB24", "FONTB25", "SMALLIN0", "SMALLIN1", - "SMALLIN2", "SMALLIN3", "SMALLIN4", "SMALLIN5", "SMALLIN6", - "SMALLIN7", "SMALLIN8", "SMALLIN9" - }; - - if (deathmatch) - { - hereticLumpNames[5] = "STATBAR"; - } - else - { - hereticLumpNames[5] = "LIFEBAR"; - } - - DBaseStatusBar::Images.Init (sharedLumpNames, NUM_BASESB_IMAGES); - Images.Init (hereticLumpNames, NUM_HERETICSB_IMAGES); - - oldarti = NULL; - oldammo1 = oldammo2 = NULL; - oldammocount1 = oldammocount2 = -1; - oldartiCount = 0; - oldfrags = -9999; - oldarmor = -1; - oldhealth = -1; - oldlife = -1; - oldkeys = -1; - - HealthMarker = 0; - ChainWiggle = 0; - ArtifactFlash = 0; - } - - ~DHereticStatusBar () - { - } - - void Tick () - { - int curHealth; - - DBaseStatusBar::Tick (); - if (level.time & 1) - { - ChainWiggle = pr_chainwiggle() & 1; - } - curHealth = CPlayer->health; - if (curHealth < 0) - { - curHealth = 0; - } - if (curHealth < HealthMarker) - { - HealthMarker -= clamp ((HealthMarker - curHealth) >> 2, 1, 8); - } - else if (curHealth > HealthMarker) - { - HealthMarker += clamp ((curHealth - HealthMarker) >> 2, 1, 8); - } - - if (ArtifactFlash > 0) - { - if (--ArtifactFlash == 0) - { - ArtiRefresh = screen->GetPageCount (); - } - } - } - - void Draw (EHudState state) - { - DBaseStatusBar::Draw (state); - - if (state == HUD_Fullscreen) - { - DrawFullScreenStuff (); - SB_state = screen->GetPageCount (); - } - else if (state == HUD_StatusBar) - { - if (SB_state > 0) - { - DrawImage (Images[imgBARBACK], 0, 0); - if (CPlayer->cheats&CF_GODMODE) - { - DrawImage (Images[imgGOD1], 16, 9); - DrawImage (Images[imgGOD2], 287, 9); - } - oldhealth = -1; - } - DrawCommonBar (); - if (CPlayer->inventorytics == 0) - { - if (SB_state < 0) - { - SB_state = screen->GetPageCount (); - } - if (SB_state != 0) - { - // Main interface - SB_state--; - DrawImage (Images[imgSTATBAR], 34, 2); - oldarti = NULL; - oldammo1 = oldammo2 = NULL; - oldammocount1 = oldammocount2 = -1; - oldarmor = -1; - oldfrags = -9999; //can't use -1, 'cuz of negative frags - oldlife = -1; - oldkeys = -1; - oldhealth = -1; - ArtiRefresh = 0; - } - DrawMainBar (); - } - else - { - if (SB_state > -1) - { - SB_state = -screen->GetPageCount () - 1; - } - if (SB_state < -1) - { - SB_state++; - DrawImage (Images[imgINVBAR], 34, 2); - } - DrawInventoryBar (); - } - } - } - -private: -//--------------------------------------------------------------------------- -// -// PROC DrawCommonBar -// -//--------------------------------------------------------------------------- - - void DrawCommonBar () - { - int chainY; - int healthPos; - - DrawImage (Images[imgLTFCTOP], 0, -10); - //DrawImage (Images[imgRTFCTOP], 290, -10); - screen->DrawTexture (Images[imgRTFCTOP], ST_X+290, ST_Y, - DTA_Bottom320x200, Scaled, - DTA_TopOffset, Images[imgRTFCTOP]->GetHeight(), - TAG_DONE); - - if (oldhealth != HealthMarker) - { - oldhealth = HealthMarker; - HealthRefresh = screen->GetPageCount (); - } - if (HealthRefresh) - { - HealthRefresh--; - healthPos = HealthMarker; - if (healthPos < 0) - { - healthPos = 0; - } - if (healthPos > 100) - { - healthPos = 100; - } - healthPos = (healthPos * 256) / 100; - chainY = (HealthMarker == (CPlayer->health > 0 ? CPlayer->health : 0)) ? 33 : 33 + ChainWiggle; - DrawImage (Images[imgCHAINBACK], 0, 32); - DrawImage (Images[imgCHAIN], 2+(healthPos%17), chainY); - DrawImage (Images[imgLIFEGEM], 17+healthPos, chainY, multiplayer ? - translationtables[TRANSLATION_PlayersExtra][int(CPlayer - players)] : NULL); - DrawImage (Images[imgLTFACE], 0, 32); - DrawImage (Images[imgRTFACE], 276, 32); - screen->DrawTexture (&ChainShade, ST_X+19, ST_Y+32, - DTA_Bottom320x200, Scaled, - DTA_AlphaChannel, true, - DTA_FillColor, 0, - TAG_DONE); - screen->DrawTexture (&ChainShade, ST_X+277, ST_Y+32, - DTA_Bottom320x200, Scaled, - DTA_AlphaChannel, true, - DTA_FillColor, 0, - DTA_FlipX, true, - TAG_DONE); - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawMainBar -// -//--------------------------------------------------------------------------- - - void DrawMainBar () - { - AInventory *item; - AAmmo *ammo1, *ammo2; - int ammocount1, ammocount2; - int temp; - int playerkeys; - - // Ready artifact - if (ArtifactFlash) - { - DrawImage (Images[imgBLACKSQ], 180, 3); - DrawImage (Images[imgUSEARTIA + ArtifactFlash], 182, 3); - oldarti = NULL; // so that the correct artifact fills in after the flash - } - else if (oldarti != CPlayer->mo->InvSel - || (oldarti != NULL && oldartiCount != oldarti->Amount)) - { - oldarti = CPlayer->mo->InvSel; - GC::WriteBarrier(this, oldarti); - oldartiCount = oldarti != NULL ? oldarti->Amount : 0; - ArtiRefresh = screen->GetPageCount (); - } - if (ArtiRefresh) - { - ArtiRefresh--; - DrawImage (Images[imgBLACKSQ], 180, 3); - if (oldarti != NULL) - { - DrawDimImage (TexMan(oldarti->Icon), 179, 2, oldarti->Amount <= 0); - if (oldartiCount != 1) - { - DrSmallNumber (oldartiCount, 197, 24); - } - } - } - - // Frags - if (deathmatch) - { - temp = CPlayer->fragcount; - if (temp != oldfrags) - { - oldfrags = temp; - FragHealthRefresh = screen->GetPageCount (); - } - if (FragHealthRefresh) - { - FragHealthRefresh--; - DrawImage (Images[imgARMCLEAR], 57, 13); - DrINumber (temp, 61, 12); - } - } - else - { - temp = MAX(0, HealthMarker); - if (oldlife != temp) - { - oldlife = temp; - FragHealthRefresh = screen->GetPageCount (); - } - if (FragHealthRefresh) - { - FragHealthRefresh--; - DrawImage (Images[imgARMCLEAR], 57, 13); - DrINumber (temp, 61, 12); - } - } - - // Keys - playerkeys = 0; - - for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) - { - if (item->IsKindOf (RUNTIME_CLASS(AKey))) - { - int keynum = static_cast(item)->KeyNumber; - if (keynum >= 1 && keynum <= 3) - { - playerkeys |= 1 << (keynum-1); - } - } - } - if (oldkeys != playerkeys) - { - oldkeys = playerkeys; - KeysRefresh = screen->GetPageCount (); - } - if (KeysRefresh) - { - KeysRefresh--; - // [RH] Erase the key images so the player can drop keys - // and see the status update. - screen->DrawTexture (Images[imgSTATBAR], ST_X+34, ST_Y+2, - DTA_WindowLeft, 119, - DTA_WindowRight, 129, - DTA_Bottom320x200, Scaled, - TAG_DONE); - if (playerkeys & 4) - { - DrawImage (Images[imgYKEYICON], 153, 6); - } - if (playerkeys & 1) - { - DrawImage (Images[imgGKEYICON], 153, 14); - } - if (playerkeys & 2) - { - DrawImage (Images[imgBKEYICON], 153, 22); - } - } - - // Ammo - GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2); - if (ammo1 == ammo2) - { - // Don't show the same ammo twice. - ammo2 = NULL; - } - if (oldammo1 != ammo1 || oldammo2 != ammo2 || - oldammocount1 != ammocount1 || oldammocount2 != ammocount2) - { - oldammo1 = ammo1; - oldammo2 = ammo2; - oldammocount1 = ammocount1; - oldammocount2 = ammocount2; - GC::WriteBarrier(this, ammo1); - GC::WriteBarrier(this, ammo2); - AmmoRefresh = screen->GetPageCount (); - } - if (AmmoRefresh) - { - AmmoRefresh--; - DrawImage (Images[imgBLACKSQ], 108, 3); - if (ammo2 != NULL) - { // Draw both ammos - screen->DrawTexture (TexMan[ammo1->Icon], 115+ST_X, 11+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, Scaled, - TAG_DONE); - DrSmallNumber (ammo1->Amount, 124, 7); - screen->DrawTexture (TexMan[ammo2->Icon], 115+ST_X, 22+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, Scaled, - TAG_DONE); - DrSmallNumber (ammo2->Amount, 124, 19); - } - else if (ammo1 != NULL) - { // Draw just one ammo - DrINumber (ammo1->Amount, 109, 4); - screen->DrawTexture (TexMan[ammo1->Icon], 123+ST_X, 22+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, Scaled, - TAG_DONE); - } - } - - // Armor - AInventory *armor = CPlayer->mo->FindInventory(); - int armorpoints = armor != NULL ? armor->Amount : 0; - if (oldarmor != armorpoints) - { - oldarmor = armorpoints; - ArmorRefresh = screen->GetPageCount (); - } - if (ArmorRefresh) - { - ArmorRefresh--; - DrawImage (Images[imgARMCLEAR], 224, 13); - DrINumber (armorpoints, 228, 12); - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawInventoryBar -// -//--------------------------------------------------------------------------- - - void DrawInventoryBar () - { - AInventory *item; - int i; - - DrawImage (Images[imgINVBAR], 34, 2); - CPlayer->mo->InvFirst = ValidateInvFirst (7); - if (CPlayer->mo->InvFirst != NULL) - { - for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i) - { - DrawDimImage (TexMan(item->Icon), 50+i*31, 2, item->Amount <= 0); - if (item->Amount != 1) - { - DrSmallNumber (item->Amount, 65+i*31, 24); - } - if (item == CPlayer->mo->InvSel) - { - DrawImage (Images[imgSELECTBOX], 50+i*31, 31); - } - } - // Is there something to the left? - if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) - { - DrawImage (Images[!(gametic & 4) ? - imgINVLFGEM1 : imgINVLFGEM2], 38, 1); - } - // Is there something to the right? - if (item != NULL) - { - DrawImage (Images[!(gametic & 4) ? - imgINVRTGEM1 : imgINVRTGEM2], 269, 1); - } - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawFullScreenStuff -// -//--------------------------------------------------------------------------- - - void DrawFullScreenStuff () - { - AInventory *item; - FTexture *pic; - int i; - - // Draw health - if (CPlayer->mo->health > 0) - { - pic = Images[imgPTN1 + gametic/3%3]; - screen->DrawTexture (pic, 48, -3, - DTA_HUDRules, HUD_Normal, - DTA_LeftOffset, pic->GetWidth()/2, - DTA_TopOffset, pic->GetHeight(), - TAG_DONE); - DrBNumberOuter (CPlayer->mo->health, 5, -21); - } - else - { - DrBNumberOuter (0, 5, -20); - } - - // Draw armor - ABasicArmor *armor = CPlayer->mo->FindInventory(); - if (armor != NULL && armor->Amount != 0) - { - pic = TexMan(armor->Icon); - if (pic != NULL) - { - screen->DrawTexture (pic, 56, -24, - DTA_HUDRules, HUD_Normal, - DTA_LeftOffset, pic->GetWidth()/2, - DTA_TopOffset, pic->GetHeight(), - TAG_DONE); - } - DrBNumberOuter (armor->Amount, 5, -43); - } - - if (deathmatch) - { - // Draw frag count - DrINumberOuter (CPlayer->fragcount, 45, -16); - } - else - { - // Draw keys - int playerkeys = 0; - - for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) - { - if (item->IsKindOf (RUNTIME_CLASS(AKey))) - { - int keynum = static_cast(item)->KeyNumber; - if (keynum >= 1 && keynum <= 3) - { - playerkeys |= 1 << (keynum-1); - } - } - } - i = -7; - if (playerkeys & 2) - { - screen->DrawTexture (Images[imgBKEYICON], 54, i, - DTA_HUDRules, HUD_Normal, - TAG_DONE); - i -= 8; - } - if (playerkeys & 1) - { - screen->DrawTexture (Images[imgGKEYICON], 54, i, - DTA_HUDRules, HUD_Normal, - TAG_DONE); - i -= 8; - } - if (playerkeys & 4) - { - screen->DrawTexture (Images[imgYKEYICON], 54, i, - DTA_HUDRules, HUD_Normal, - TAG_DONE); - } - } - - // Draw ammo - AAmmo *ammo1, *ammo2; - int ammocount1, ammocount2; - - GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2); - if (ammo1 != NULL) - { - // Draw primary ammo in the bottom-right corner - DrINumberOuter (ammo1->Amount, -29, -15); - screen->DrawTexture (TexMan(ammo1->Icon), -14, -22, - DTA_HUDRules, HUD_Normal, - DTA_CenterBottomOffset, true, - TAG_DONE); - if (ammo2 != NULL && ammo2!=ammo1) - { - // Draw secondary ammo just above the primary ammo - DrINumberOuter (ammo2->Amount, -29, -56); - screen->DrawTexture (TexMan(ammo2->Icon), -14, -63, - DTA_HUDRules, HUD_Normal, - DTA_CenterBottomOffset, true, - TAG_DONE); - } - } - - // Draw inventory - if (CPlayer->inventorytics == 0) - { - if (ArtifactFlash) - { - screen->DrawTexture (Images[imgARTIBOX], -61, -31, - DTA_HUDRules, HUD_Normal, - DTA_Alpha, TRANSLUC50, - TAG_DONE); - screen->DrawTexture (Images[imgUSEARTIA + ArtifactFlash], -61, -31, - DTA_HUDRules, HUD_Normal, - TAG_DONE); - } - else if (CPlayer->mo->InvSel != NULL) - { - screen->DrawTexture (Images[imgARTIBOX], -61, -31, - DTA_HUDRules, HUD_Normal, - DTA_Alpha, TRANSLUC50, - TAG_DONE); - screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -61, -31, - DTA_HUDRules, HUD_Normal, - DTA_ColorOverlay, CPlayer->mo->InvSel->Amount > 0 ? 0 : DIM_OVERLAY, - TAG_DONE); - if (CPlayer->mo->InvSel->Amount != 1) - { - DrSmallNumberOuter (CPlayer->mo->InvSel->Amount, -46, -9, false); - } - } - } - else - { - CPlayer->mo->InvFirst = ValidateInvFirst (7); - i = 0; - if (CPlayer->mo->InvFirst != NULL) - { - for (item = CPlayer->mo->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i) - { - screen->DrawTexture (Images[imgARTIBOX], -100+i*31, -32, - DTA_HUDRules, HUD_HorizCenter, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - screen->DrawTexture (TexMan(item->Icon), -100+i*31, -32, - DTA_HUDRules, HUD_HorizCenter, - DTA_ColorOverlay, item->Amount > 0 ? 0 : DIM_OVERLAY, - TAG_DONE); - if (item->Amount != 1) - { - DrSmallNumberOuter (item->Amount, -84+i*31, -10, true); - } - if (item == CPlayer->mo->InvSel) - { - screen->DrawTexture (Images[imgSELECTBOX], -100+i*31, -3, - DTA_HUDRules, HUD_HorizCenter, - TAG_DONE); - } - } - // Is there something to the left? - if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) - { - screen->DrawTexture (Images[!(gametic & 4) ? - imgINVLFGEM1 : imgINVLFGEM2], -112, -33, - DTA_HUDRules, HUD_HorizCenter, TAG_DONE); - } - // Is there something to the right? - if (item != NULL) - { - screen->DrawTexture (Images[!(gametic & 4) ? - imgINVRTGEM1 : imgINVRTGEM2], 119, -33, - DTA_HUDRules, HUD_HorizCenter, TAG_DONE); - } - } - for (; i < 7; i++) - { - screen->DrawTexture (Images[imgARTIBOX], -100+i*31, -32, - DTA_HUDRules, HUD_HorizCenter, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - } - } - } - -//--------------------------------------------------------------------------- -// -// PROC FlashItem -// -//--------------------------------------------------------------------------- - - void FlashItem (const PClass *itemtype) - { - ArtifactFlash = 4; - } - - static const char patcharti[][10]; - static const char ammopic[][10]; - - TObjPtr oldarti; - TObjPtr oldammo1, oldammo2; - int oldammocount1, oldammocount2; - int oldartiCount; - int oldfrags; - int oldarmor; - int oldhealth; - int oldlife; - int oldkeys; - - enum - { - imgLTFACE, - imgRTFACE, - imgBARBACK, - imgINVBAR, - imgCHAIN, - imgSTATBAR, - imgLIFEGEM, - imgLTFCTOP, - imgRTFCTOP, - imgSELECTBOX, - imgINVLFGEM1, - imgINVLFGEM2, - imgINVRTGEM1, - imgINVRTGEM2, - imgBLACKSQ, - imgARMCLEAR, - imgCHAINBACK, - imgGOD1, - imgGOD2, - imgUSEARTIA, - imgUSEARTIB, - imgUSEARTIC, - imgUSEARTID, - imgYKEYICON, - imgGKEYICON, - imgBKEYICON, - imgARTIBOX, - imgPTN1, - imgPTN2, - imgPTN3, - - NUM_HERETICSB_IMAGES - }; - - FImageCollection Images; - - int HealthMarker; - int ChainWiggle; - int ArtifactFlash; - - char HealthRefresh; - char ArtiRefresh; - char FragHealthRefresh; - char KeysRefresh; - char AmmoRefresh; - char ArmorRefresh; -}; - -IMPLEMENT_POINTY_CLASS(DHereticStatusBar) - DECLARE_POINTER(oldarti) - DECLARE_POINTER(oldammo1) - DECLARE_POINTER(oldammo2) -END_POINTERS - -DBaseStatusBar *CreateHereticStatusBar () -{ - return new DHereticStatusBar; -} diff --git a/src/g_hexen/hexen_sbar.cpp b/src/g_hexen/hexen_sbar.cpp deleted file mode 100644 index 787b8f8d9..000000000 --- a/src/g_hexen/hexen_sbar.cpp +++ /dev/null @@ -1,1194 +0,0 @@ -#include - -#include "doomtype.h" -#include "doomstat.h" -#include "v_font.h" -#include "sbar.h" -#include "r_defs.h" -#include "w_wad.h" -#include "m_random.h" -#include "d_player.h" -#include "st_stuff.h" -#include "v_video.h" -#include "r_draw.h" -#include "templates.h" -#include "a_hexenglobal.h" -#include "a_keys.h" -#include "r_translate.h" -#include "a_weaponpiece.h" -#include "v_palette.h" - - -class FManaBar : public FTexture -{ -public: - FManaBar (); - - const BYTE *GetColumn (unsigned int column, const Span **spans_out); - const BYTE *GetPixels (); - void Unload (); - bool CheckModified (); - - void SetVial (FTexture *pic, AActor *actor, const PClass *manaType); - -protected: - BYTE Pixels[5*24]; - static const Span DummySpan[2]; - - FTexture *VialPic; - int VialLevel; - bool NeedRefresh; - - void MakeTexture (); -}; - -const FTexture::Span FManaBar::DummySpan[2] = { { 0, 24 }, { 0, 0 } }; - -FManaBar::FManaBar () -: VialPic(0), VialLevel(0), NeedRefresh(false) -{ - Width = 5; - Height = 24; - WidthBits = 2; - HeightBits = 5; - WidthMask = 3; -} - -void FManaBar::Unload () -{ - if (VialPic != 0) - { - VialPic->Unload (); - } -} - -bool FManaBar::CheckModified () -{ - return NeedRefresh; -} - -const BYTE *FManaBar::GetColumn (unsigned int column, const Span **spans_out) -{ - if (NeedRefresh) - { - MakeTexture (); - } - if (column > 4) - { - column = 4; - } - if (spans_out != NULL) - { - *spans_out = DummySpan; - } - return Pixels + column*24; -} - -const BYTE *FManaBar::GetPixels () -{ - if (NeedRefresh) - { - MakeTexture (); - } - return Pixels; -} - -void FManaBar::SetVial (FTexture *pic, AActor *actor, const PClass *manaType) -{ - int level, max; - AInventory *ammo; - - ammo = actor->FindInventory (manaType); - level = 0; max = 200; - if (ammo != NULL) - { - level = ammo->Amount; - max = ammo->MaxAmount; - if (!max) max = 1; - } - level = MIN (22*level/max, 22); - if (VialPic != pic || VialLevel != level) - { - VialPic = pic; - VialLevel = level; - NeedRefresh = true; - } -} - -void FManaBar::MakeTexture () -{ - int run = 22 - VialLevel; - BYTE color0 = GPalette.Remap[0]; - - NeedRefresh = false; - VialPic->CopyToBlock (Pixels, 5, 24, 0, 0); - memset (Pixels + 25, color0, run); - memset (Pixels + 25+24, color0, run); - memset (Pixels + 25+24+24, color0, run); -} - -class DHexenStatusBar : public DBaseStatusBar -{ - DECLARE_CLASS(DHexenStatusBar, DBaseStatusBar) - HAS_OBJECT_POINTERS -public: - DHexenStatusBar () : DBaseStatusBar (38) - { - static const char *hexenLumpNames[NUM_HEXENSB_IMAGES] = - { - "H2BAR", "H2TOP", "INVBAR", "LFEDGE", "RTEDGE", - "STATBAR", "KEYBAR", "SELECTBO", "ARTICLS", "ARMCLS", - "MANACLS", "MANAVL1", "MANAVL2", "MANAVL1D", "MANAVL2D", - "MANADIM1", "MANADIM2", "MANABRT1", "MANABRT2", "INVGEML1", - "INVGEML2", "INVGEMR1", "INVGEMR2", "KILLS", "USEARTIA", - "USEARTIB", "USEARTIC", "USEARTID", "USEARTIE", "KEYSLOT1", - "KEYSLOT2", "KEYSLOT3", "KEYSLOT4", "KEYSLOT5", "KEYSLOT6", - "KEYSLOT7", "KEYSLOT8", "KEYSLOT9", "KEYSLOTA", "KEYSLOTB", - "ARMSLOT1", "ARMSLOT2", "ARMSLOT3", "ARMSLOT4", "ARTIBOX", - "HAMOBACK" - }; - static const char *classLumpNames[3][NUM_HEXENCLASSSB_IMAGES] = - { - { - "WPSLOT0", "WPFULL0", "WPIECEF1", "WPIECEF2", - "WPIECEF3", "CHAIN", "LIFEGMF2" - }, - { - "WPSLOT1", "WPFULL1", "WPIECEC1", "WPIECEC2", - "WPIECEC3", "CHAIN2", "LIFEGMC2" - }, - { - "WPSLOT2", "WPFULL2", "WPIECEM1", "WPIECEM2", - "WPIECEM3", "CHAIN3", "LIFEGMM2" - } - }; - static const char *sharedLumpNames[] = - { - "LAME", "NEGNUM", "IN0", "IN1", "IN2", - "IN3", "IN4", "IN5", "IN6", "IN7", - "IN8", "IN9", "FONTB13", "FONTB16", "FONTB17", - "FONTB18", "FONTB19", "FONTB20", "FONTB21", "FONTB22", - "FONTB23", "FONTB24", "FONTB25", "SMALLIN0", "SMALLIN1", - "SMALLIN2", "SMALLIN3", "SMALLIN4", "SMALLIN5", "SMALLIN6", - "SMALLIN7", "SMALLIN8", "SMALLIN9", - - "INRED0", "INRED1", "INRED2", "INRED3", "INRED4", - "INRED5", "INRED6", "INRED7", "INRED8", "INRED9" - }; - - DBaseStatusBar::Images.Init (sharedLumpNames, NUM_BASESB_IMAGES + 10); - Images.Init (hexenLumpNames, NUM_HEXENSB_IMAGES); - ClassImages[0].Init (classLumpNames[0], NUM_HEXENCLASSSB_IMAGES); - ClassImages[1].Init (classLumpNames[1], NUM_HEXENCLASSSB_IMAGES); - ClassImages[2].Init (classLumpNames[2], NUM_HEXENCLASSSB_IMAGES); - - oldarti = NULL; - oldartiCount = 0; - oldammo1 = oldammo2 = NULL; - oldammocount1 = oldammocount2 = -1; - oldfrags = -9999; - oldmana1 = -1; - oldmana2 = -1; - oldusemana1 = -1; - oldusemana2 = -1; - olddrawbars = -1; - oldarmor = -1; - oldhealth = -1; - oldlife = -1; - oldpieces = -1; - oldkeys[0] = oldkeys[1] = oldkeys[2] = oldkeys[3] = oldkeys[4] = NULL; - - HealthMarker = 0; - ArtifactFlash = 0; - - ArtiRefresh = 0; - FragHealthRefresh = 0; - KeysRefresh = 0; - ArmorRefresh = 0; - HealthRefresh = 0; - Mana1Refresh = 0; - Mana2Refresh = 0; - AmmoRefresh = 0; - } - - ~DHexenStatusBar () - { - } - - void Tick () - { - int curHealth; - - DBaseStatusBar::Tick (); - if (CPlayer->mo == NULL) - { - curHealth = 0; - } - else - { - curHealth = CPlayer->mo->health; - } - if (curHealth < 0) - { - curHealth = 0; - } - if (curHealth < HealthMarker) - { - HealthMarker -= clamp ((HealthMarker - curHealth) >> 2, 1, 6); - } - else if (curHealth > HealthMarker) - { - HealthMarker += clamp ((curHealth - HealthMarker) >> 2, 1, 6); - } - - if (ArtifactFlash > 0) - { - if (--ArtifactFlash == 0) - { - ArtiRefresh = screen->GetPageCount (); - } - } - } - - void Draw (EHudState state) - { - DBaseStatusBar::Draw (state); - - if (state == HUD_Fullscreen) - { - DrawFullScreenStuff (); - SB_state = screen->GetPageCount (); - } - else if (state == HUD_StatusBar) - { - if (SB_state > 0) - { - DrawImage (Images[imgH2BAR], 0, -27); - oldhealth = -1; - } - DrawCommonBar (); - if (CPlayer->inventorytics == 0) - { - if (SB_state < 0) - { - SB_state = screen->GetPageCount (); - } - if (SB_state != 0) - { - // Main interface - SB_state--; - DrawImage (Images[!automapactive ? imgSTATBAR : imgKEYBAR], 38, 0); - oldarti = NULL; - oldammo1 = oldammo2 = NULL; - oldmana1 = -1; - oldmana2 = -1; - oldusemana1 = -1; - oldusemana2 = -1; - olddrawbars = -1; - oldarmor = -1; - oldpieces = -1; - oldfrags = -9999; //can't use -1, 'cuz of negative frags - oldlife = -1; - oldkeys[0] = oldkeys[1] = oldkeys[2] = oldkeys[3] = oldkeys[4] = NULL; - ArtiRefresh = 0; - //oldhealth = -1; - } - if (!automapactive) - { - DrawMainBar (); - } - else - { - DrawKeyBar (); - } - } - else - { - if (SB_state > -1) - { - SB_state = -screen->GetPageCount () - 1; - } - if (SB_state < -1) - { - SB_state++; - } - DrawInventoryBar (); - } - } - } - - void AttachToPlayer (player_t *player) - { - DBaseStatusBar::AttachToPlayer (player); - if (player->mo != NULL) - { - if (player->mo->IsKindOf (PClass::FindClass(NAME_MagePlayer))) - { - FourthWeaponClass = 2; - LifeBarClass = 2; - } - else if (player->mo->IsKindOf (PClass::FindClass(NAME_ClericPlayer))) - { - FourthWeaponClass = 1; - LifeBarClass = 1; - } - else - { - FourthWeaponClass = 0; - LifeBarClass = 0; - } - } - } - -private: -//--------------------------------------------------------------------------- -// -// PROC DrawCommonBar -// -//--------------------------------------------------------------------------- - - void DrawCommonBar () - { - int healthPos; - - DrawImage (Images[imgH2TOP], 0, -27); - - if (oldhealth != HealthMarker) - { - oldhealth = HealthMarker; - HealthRefresh = screen->GetPageCount (); - } - if (HealthRefresh) - { - int lifeClass = LifeBarClass; - - HealthRefresh--; - healthPos = clamp (HealthMarker, 0, 100); - DrawImage (ClassImages[lifeClass][imgCHAIN], 35+((healthPos*196/100)%9), 31); - DrawImage (ClassImages[lifeClass][imgLIFEGEM], 7+(healthPos*11/5), 31, multiplayer ? - translationtables[TRANSLATION_PlayersExtra][int(CPlayer - players)] : NULL); - DrawImage (Images[imgLFEDGE], 0, 31); - DrawImage (Images[imgRTEDGE], 277, 31); - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawMainBar -// -//--------------------------------------------------------------------------- - - void DrawMainBar () - { - int temp; - - // Ready artifact - if (ArtifactFlash) - { - DrawImage (Images[imgARTICLEAR], 144, -1); - DrawImage (Images[imgUSEARTIA + ArtifactFlash], 148, 2); - oldarti = NULL; // so that the correct artifact fills in after the flash - } - else if (oldarti != CPlayer->mo->InvSel - || (oldarti != NULL && oldartiCount != oldarti->Amount)) - { - oldarti = CPlayer->mo->InvSel; - GC::WriteBarrier(this, oldarti); - oldartiCount = oldarti != NULL ? oldarti->Amount : 0; - ArtiRefresh = screen->GetPageCount (); - } - if (ArtiRefresh) - { - ArtiRefresh--; - DrawImage (Images[imgARTICLEAR], 144, -1); - if (oldarti != NULL) - { - DrawDimImage (TexMan(oldarti->Icon), 143, 2, oldarti->Amount <= 0); - if (oldartiCount != 1) - { - DrSmallNumber (oldartiCount, 162, 23); - } - } - } - - // Frags - if (deathmatch) - { - temp = CPlayer->fragcount; - if (temp != oldfrags) - { - oldfrags = temp; - FragHealthRefresh = screen->GetPageCount (); - } - if (FragHealthRefresh) - { - FragHealthRefresh--; - DrawImage (Images[imgKILLS], 38, 1); - DrINumber (temp, 40, 15); - } - } - else - { - temp = MAX (0, HealthMarker); - if (oldlife != temp) - { - oldlife = temp; - FragHealthRefresh = screen->GetPageCount (); - } - if (FragHealthRefresh) - { - FragHealthRefresh--; - DrawImage (Images[imgARMCLEAR], 41, 16); - DrINumber (temp, 40, 14, temp >= 25 ? imgINumbers : NUM_BASESB_IMAGES); - } - } - - // Mana - AAmmo *ammo1, *ammo2; - int ammocount1, ammocount2; - int drawbar; - - GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2); - if (ammo1==ammo2) - { - // Don't show the same ammo twice. - ammo2=NULL; - } - - // If the weapon uses some ammo that is not mana, do not draw - // the mana bars; draw the specific used ammo instead. - const PClass *mana1 = PClass::FindClass(NAME_Mana1); - const PClass *mana2 = PClass::FindClass(NAME_Mana2); - - drawbar = !((ammo1 != NULL && ammo1->GetClass() != mana1 && ammo1->GetClass() != mana2) || - (ammo2 != NULL && ammo2->GetClass() != mana1 && ammo2->GetClass() != mana2)); - - if (drawbar != olddrawbars) - { - AmmoRefresh = screen->GetPageCount (); - olddrawbars = drawbar; - oldmana1 = -1; - oldmana2 = -1; - } - if (drawbar && oldammo2 != ammo2) - { - AmmoRefresh = screen->GetPageCount (); - } - if (drawbar) - { - DrawManaBars (ammo1, ammo2, mana1, mana2); - } - else - { - DrawMainAltAmmo (ammo1, ammo2, ammocount1, ammocount2); - } - - // Armor - temp = GetArmorPercent (NULL); - if (oldarmor != temp) - { - oldarmor = temp; - ArmorRefresh = screen->GetPageCount (); - } - if (ArmorRefresh) - { - ArmorRefresh--; - DrawImage (Images[imgARMCLEAR], 255, 16); - DrINumber (temp / (5*FRACUNIT), 250, 14); - } - - // Weapon Pieces - DrawWeaponPieces(); - } - -//--------------------------------------------------------------------------- -// -// PROC DrawMainAltAmmo -// -// Draw a generic ammo readout on the main bar, instead of the mana bars. -// -//--------------------------------------------------------------------------- - - void DrawMainAltAmmo (AAmmo *ammo1, AAmmo *ammo2, int ammocount1, int ammocount2) - { - if (ammo1 != oldammo1 || ammocount1 != oldammocount1) - { - AmmoRefresh = screen->GetPageCount (); - oldammo1 = ammo1; - oldammocount1 = ammocount1; - GC::WriteBarrier(this, ammo1); - } - if (ammo2 != oldammo2 || ammocount2 != oldammocount2) - { - AmmoRefresh = screen->GetPageCount (); - oldammo2 = ammo2; - oldammocount2 = ammocount2; - GC::WriteBarrier(this, ammo2); - } - - if (AmmoRefresh) - { - AmmoRefresh--; - DrawImage (Images[imgAMMOBACK], 77, 2); - if (ammo2 != NULL) - { // Draw both ammos - AmmoRefresh--; - screen->DrawTexture (TexMan[ammo1->Icon], 89+ST_X, 10+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, true, - TAG_DONE); - DrSmallNumber (ammo1->Amount, 86, 20); - - screen->DrawTexture (TexMan[ammo2->Icon], 113+ST_X, 10+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, true, - TAG_DONE); - DrSmallNumber (ammo2->Amount, 110, 20); - } - else - { // Draw one ammo - screen->DrawTexture (TexMan[ammo1->Icon], 100+ST_X, 10+ST_Y, - DTA_CenterOffset, true, - DTA_Bottom320x200, true, - TAG_DONE); - DrSmallNumber (ammo1->Amount, 97, 20); - } - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawManaBars -// -// Draws the mana bars on the main status bar -// -//--------------------------------------------------------------------------- - - void DrawManaBars (AAmmo *ammo1, AAmmo *ammo2, const PClass *manatype1, const PClass *manatype2) - { - AAmmo *mana1 = NULL, *mana2 = NULL; - int usemana1 = false, usemana2 = false; - int manacount1, manacount2; - int manaPatch1, manaPatch2; - int manaVialPatch1, manaVialPatch2; - - manaPatch1 = 0; - manaPatch2 = 0; - manaVialPatch1 = 0; - manaVialPatch2 = 0; - - if (AmmoRefresh) - { - Mana1Refresh = MAX(AmmoRefresh, Mana1Refresh); - Mana2Refresh = MAX(AmmoRefresh, Mana2Refresh); - AmmoRefresh--; - screen->DrawTexture (Images[imgSTATBAR], ST_X+38, ST_Y, - DTA_WindowLeft, 39, - DTA_WindowRight, 87, - DTA_Bottom320x200, Scaled, - TAG_DONE); - } - - // Locate Mana1 and Mana2 in the inventory, and decide which ones are used. - if (ammo1 == NULL) - { - } - else if (ammo1->GetClass() == manatype1) - { - mana1 = ammo1; - usemana1 = true; - } - else if (ammo1->GetClass() == manatype2) - { - mana2 = ammo1; - usemana2 = true; - } - if (ammo2 == NULL) - { - } - else if (ammo2->GetClass() == manatype1) - { - mana1 = ammo2; - usemana1 = true; - } - else if (ammo2->GetClass() == manatype2) - { - mana2 = ammo2; - usemana2 = true; - } - if (mana1 == NULL) - { - mana1 = static_cast(CPlayer->mo->FindInventory(manatype1)); - } - if (mana2 == NULL) - { - mana2 = static_cast(CPlayer->mo->FindInventory(manatype2)); - } - manacount1 = mana1 != NULL ? mana1->Amount : 0; - manacount2 = mana2 != NULL ? mana2->Amount : 0; - - // Has Mana1 changed since last time? - if (oldmana1 != manacount1 || oldusemana1 != usemana1) - { - oldmana1 = manacount1; - oldusemana1 = usemana1; - Mana1Refresh = screen->GetPageCount (); - } - - // Has Mana2 changed since last time? - if (oldmana2 != manacount2 || oldusemana2 != usemana2) - { - oldmana2 = manacount2; - oldusemana2 = usemana2; - Mana2Refresh = screen->GetPageCount (); - } - // Decide what to draw for vial 1 - if (Mana1Refresh) - { - Mana1Refresh--; - DrawImage (Images[imgMANACLEAR], 77, 16); - DrSmallNumber (manacount1, 79, 19); - if (!usemana1) - { // Draw Dim Mana icon - manaPatch1 = imgMANADIM1; - manaVialPatch1 = imgMANAVIALDIM1; - } - else - { - manaPatch1 = imgMANABRIGHT1; - manaVialPatch1 = manacount1 ? imgMANAVIAL1 : imgMANAVIALDIM1; - } - } - // Decide what to draw for vial 2 - if (Mana2Refresh) - { - Mana2Refresh--; - DrawImage (Images[imgMANACLEAR], 109, 16); - DrSmallNumber (manacount2, 111, 19); - if (!usemana2) - { // Draw Dim Mana icon - manaPatch2 = imgMANADIM2; - manaVialPatch2 = imgMANAVIALDIM2; - } - else - { - manaPatch2 = imgMANABRIGHT2; - manaVialPatch2 = manacount2 ? imgMANAVIAL2 : imgMANAVIALDIM2; - } - } - // Update mana graphics - if (manaPatch1 || manaPatch2 || manaVialPatch1) - { - if (manaVialPatch1) - { - DrawImage (Images[manaPatch1], 77, 2); - ManaVial1Pic.SetVial (Images[manaVialPatch1], CPlayer->mo, manatype1); - DrawImage (&ManaVial1Pic, 94, 2); - } - if (manaVialPatch2) - { - DrawImage (Images[manaPatch2], 110, 2); - ManaVial2Pic.SetVial (Images[manaVialPatch2], CPlayer->mo, manatype2); - DrawImage (&ManaVial2Pic, 102, 2); - } - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawInventoryBar -// -//--------------------------------------------------------------------------- - - void DrawInventoryBar () - { - AInventory *item; - int i; - - DrawImage (Images[imgINVBAR], 38, 0); - CPlayer->mo->InvFirst = ValidateInvFirst (7); - if (CPlayer->mo->InvFirst != NULL) - { - for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i) - { - DrawDimImage (TexMan(item->Icon), 50+i*31, 1, item->Amount <= 0); - if (item->Amount != 1) - { - DrSmallNumber (item->Amount, 68+i*31, 23); - } - if (item == CPlayer->mo->InvSel) - { - DrawImage (Images[imgSELECTBOX], 51+i*31, 1); - } - } - // Is there something to the left? - if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) - { - DrawImage (Images[!(gametic & 4) ? - imgINVLFGEM1 : imgINVLFGEM2], 42, 1); - } - // Is there something to the right? - if (item != NULL) - { - DrawImage (Images[!(gametic & 4) ? - imgINVRTGEM1 : imgINVRTGEM2], 269, 1); - } - } - } - -//========================================================================== -// -// DrawKeyBar -// -//========================================================================== - - void DrawKeyBar () - { - AInventory *item; - AHexenArmor *armor; - AKey *keys[5]; - int i; - int temp; - bool different; - - keys[0] = keys[1] = keys[2] = keys[3] = keys[4] = NULL; - for (item = CPlayer->mo->Inventory, i = 0; - item != NULL && i < 5; - item = item->Inventory) - { - if (item->Icon.isValid() && - item->IsKindOf (RUNTIME_CLASS(AKey)) && - item->GetClass() != RUNTIME_CLASS(AKey)) - { - keys[i++] = static_cast(item); - } - } - different = false; - for (i = 0; i < 5; ++i) - { - if (keys[i] != oldkeys[i]) - { - oldkeys[i] = keys[i]; - GC::WriteBarrier(this, keys[i]); - different = true; - } - } - if (different) - { - KeysRefresh = screen->GetPageCount (); - } - if (KeysRefresh) - { - KeysRefresh--; - for (i = 0; i < 5 && keys[i] != NULL; i++) - { - DrawImage (TexMan[keys[i]->Icon], 46 + i*20, 2); - } - } - - temp = GetArmorPercent (&armor); - if (oldarmor != temp && armor != NULL) - { - for (i = 0; i < 4; i++) - { - if (armor->Slots[i] > 0 && armor->SlotsIncrement[i] > 0) - { - DrawFadedImage (Images[imgARMSLOT1+i], 150+31*i, 2, - MIN (OPAQUE, Scale (armor->Slots[i], OPAQUE, - armor->SlotsIncrement[i]))); - } - } - oldarmor = temp; - } - } - -//========================================================================== -// -// GetArmorPercent -// -//========================================================================== - - fixed_t GetArmorPercent (AHexenArmor **armorp) - { - AHexenArmor *harmor = CPlayer->mo->FindInventory(); - fixed_t amount = 0; - if (harmor != NULL) - { - amount = harmor->Slots[0] - + harmor->Slots[1] - + harmor->Slots[2] - + harmor->Slots[3] - + harmor->Slots[4]; - } - // [RH] Count basic armor too. - ABasicArmor *barmor = CPlayer->mo->FindInventory(); - if (barmor != NULL) - { - amount += barmor->SavePercent; - } - if (armorp != NULL) - { - *armorp = harmor; - } - return amount; - } - -//========================================================================== -// -// DrawWeaponPieces -// -//========================================================================== - - void DrawWeaponPieces () - { - static ENamedName FourthWeaponNames[] = { NAME_FWeapQuietus, NAME_CWeapWraithverge, NAME_MWeapBloodscourge }; - - for(AInventory *inv = CPlayer->mo->Inventory; inv != NULL; inv = inv->Inventory) - { - if (inv->IsA(RUNTIME_CLASS(AWeaponHolder))) - { - AWeaponHolder *hold = static_cast(inv); - - if (hold->PieceWeapon->TypeName == FourthWeaponNames[(int)FourthWeaponClass]) - { - // Weapon Pieces - if (oldpieces != hold->PieceMask) - { - oldpieces = hold->PieceMask; - - static int PieceX[3][3] = - { - { 190, 225, 234 }, - { 190, 212, 225 }, - { 190, 205, 224 }, - }; - int pieces = oldpieces; - int weapClass = FourthWeaponClass; - - if (pieces == 7) - { - DrawImage (ClassImages[weapClass][imgWEAPONFULL], 190, 0); - return; - } - DrawImage (ClassImages[weapClass][imgWEAPONSLOT], 190, 0); - if (pieces & WPIECE1) - { - DrawImage (ClassImages[weapClass][imgPIECE1], PieceX[weapClass][0], 0); - } - if (pieces & WPIECE2) - { - DrawImage (ClassImages[weapClass][imgPIECE2], PieceX[weapClass][1], 0); - } - if (pieces & WPIECE3) - { - DrawImage (ClassImages[weapClass][imgPIECE3], PieceX[weapClass][2], 0); - } - } - return; - } - } - } - if (oldpieces != 0) - { - DrawImage (ClassImages[(int)FourthWeaponClass][imgWEAPONSLOT], 190, 0); - oldpieces = 0; - } - } - -//--------------------------------------------------------------------------- -// -// PROC DrawFullScreenStuff -// -//--------------------------------------------------------------------------- - - void DrawFullScreenStuff () - { - AInventory *item; - int i; - - // Health - DrBNumberOuter (MAX (0, CPlayer->mo->health), 5, -20); - - // Frags - if (deathmatch) - { - DrINumberOuter (CPlayer->fragcount, 45, -15); - } - - // Inventory - if (CPlayer->inventorytics == 0) - { - if (ArtifactFlash) - { - screen->DrawTexture (Images[imgARTIBOX], -80, -30, - DTA_HUDRules, HUD_Normal, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - screen->DrawTexture (Images[imgUSEARTIA + ArtifactFlash], -76, -26, - DTA_HUDRules, HUD_Normal, - TAG_DONE); - } - else if (CPlayer->mo->InvSel != NULL) - { - screen->DrawTexture (Images[imgARTIBOX], -80, -30, - DTA_HUDRules, HUD_Normal, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -82, -31, - DTA_HUDRules, HUD_Normal, - DTA_ColorOverlay, CPlayer->mo->InvSel->Amount > 0 ? 0 : DIM_OVERLAY, - TAG_DONE); - if (CPlayer->mo->InvSel->Amount != 1) - { - DrSmallNumberOuter (CPlayer->mo->InvSel->Amount, -64, -8, false); - } - } - } - else - { - CPlayer->mo->InvFirst = ValidateInvFirst (7); - i = 0; - if (CPlayer->mo->InvFirst != NULL) - { - for (item = CPlayer->mo->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i) - { - screen->DrawTexture (Images[imgARTIBOX], -106+i*31, -32, - DTA_HUDRules, HUD_HorizCenter, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - screen->DrawTexture (TexMan(item->Icon), -108+i*31, -33, - DTA_HUDRules, HUD_HorizCenter, - DTA_ColorOverlay, item->Amount > 0 ? 0 : DIM_OVERLAY, - TAG_DONE); - if (item->Amount != 1) - { - DrSmallNumberOuter (item->Amount, -90+i*31, -11, true); - } - if (item == CPlayer->mo->InvSel) - { - screen->DrawTexture (Images[imgSELECTBOX], -107+i*31, -33, - DTA_HUDRules, HUD_HorizCenter, - TAG_DONE); - } - } - // Is there something to the left? - if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) - { - screen->DrawTexture (Images[!(gametic & 4) ? - imgINVLFGEM1 : imgINVLFGEM2], -118, -33, - DTA_HUDRules, HUD_HorizCenter, TAG_DONE); - } - // Is there something to the right? - if (item != NULL) - { - screen->DrawTexture (Images[!(gametic & 4) ? - imgINVRTGEM1 : imgINVRTGEM2], 113, -33, - DTA_HUDRules, HUD_HorizCenter, TAG_DONE); - } - } - for (; i < 7; i++) - { - screen->DrawTexture (Images[imgARTIBOX], -106+i*31, -32, - DTA_HUDRules, HUD_HorizCenter, - DTA_Alpha, HX_SHADOW, - TAG_DONE); - } - } - - // Mana - AAmmo *ammo1, *ammo2; - int ammocount1, ammocount2; - bool drawmana; - - GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2); - - // If the weapon uses some ammo that is not mana, do not draw - // the mana blocks; draw the specific used ammo instead. - const PClass *mana1 = PClass::FindClass(NAME_Mana1); - const PClass *mana2 = PClass::FindClass(NAME_Mana2); - - drawmana = !((ammo1 != NULL && ammo1->GetClass() != mana1 && ammo1->GetClass() != mana2) || - (ammo2 != NULL && ammo2->GetClass() != mana1 && ammo2->GetClass() != mana2)); - - if (drawmana) - { - int manaImage; - int ammo = 0; - - if (CPlayer->ReadyWeapon != NULL) - { - if (CPlayer->ReadyWeapon->Ammo1 != NULL) - { - if (CPlayer->ReadyWeapon->Ammo1->GetClass() == mana1) - { - ammo |= 1; - } - else if (CPlayer->ReadyWeapon->Ammo1->GetClass() == mana2) - { - ammo |= 2; - } - } - if (CPlayer->ReadyWeapon->Ammo2 != NULL) - { - if (CPlayer->ReadyWeapon->Ammo2->GetClass() == mana1) - { - ammo |= 1; - } - else if (CPlayer->ReadyWeapon->Ammo2->GetClass() == mana2) - { - ammo |= 2; - } - } - } - - item = CPlayer->mo->FindInventory (mana1); - i = item != NULL ? item->Amount : 0; - manaImage = ((ammo & 1) && i > 0) ? imgMANABRIGHT1 : imgMANADIM1; - screen->DrawTexture (Images[manaImage], -17, -30, - DTA_HUDRules, HUD_Normal, TAG_DONE); - DrINumberOuter (i, -47, -30); - - item = CPlayer->mo->FindInventory (mana2); - i = item != NULL ? item->Amount : 0; - manaImage = ((ammo & 2) && i > 0) ? imgMANABRIGHT2 : imgMANADIM2; - screen->DrawTexture (Images[manaImage], -17, -15, - DTA_HUDRules, HUD_Normal, TAG_DONE); - DrINumberOuter (i, -47, -15); - } - else - { - } - } - -//--------------------------------------------------------------------------- -// -// PROC FlashItem -// -//--------------------------------------------------------------------------- - - void FlashItem (const PClass *itemtype) - { - ArtifactFlash = 4; - } - - static const char patcharti[][10]; - static const char ammopic[][10]; - - TObjPtr oldarti; - TObjPtr oldammo1, oldammo2; - TObjPtr oldkeys[5]; - int oldammocount1, oldammocount2; - int oldartiCount; - int oldfrags; - int oldmana1; - int oldmana2; - int oldusemana1; - int oldusemana2; - int olddrawbars; - int oldarmor; - int oldhealth; - int oldlife; - int oldpieces; - - enum - { - imgH2BAR, - imgH2TOP, - imgINVBAR, - imgLFEDGE, - imgRTEDGE, - imgSTATBAR, - imgKEYBAR, - imgSELECTBOX, - imgARTICLEAR, - imgARMCLEAR, - imgMANACLEAR, - imgMANAVIAL1, - imgMANAVIAL2, - imgMANAVIALDIM1, - imgMANAVIALDIM2, - imgMANADIM1, - imgMANADIM2, - imgMANABRIGHT1, - imgMANABRIGHT2, - imgINVLFGEM1, - imgINVLFGEM2, - imgINVRTGEM1, - imgINVRTGEM2, - imgKILLS, - imgUSEARTIA, - imgUSEARTIB, - imgUSEARTIC, - imgUSEARTID, - imgUSEARTIE, - imgKEYSLOT1, - imgKEYSLOT2, - imgKEYSLOT3, - imgKEYSLOT4, - imgKEYSLOT5, - imgKEYSLOT6, - imgKEYSLOT7, - imgKEYSLOT8, - imgKEYSLOT9, - imgKEYSLOTA, - imgKEYSLOTB, - imgARMSLOT1, - imgARMSLOT2, - imgARMSLOT3, - imgARMSLOT4, - imgARTIBOX, - imgAMMOBACK, - - NUM_HEXENSB_IMAGES - }; - - enum - { - imgWEAPONSLOT, - imgWEAPONFULL, - imgPIECE1, - imgPIECE2, - imgPIECE3, - imgCHAIN, - imgLIFEGEM, - - NUM_HEXENCLASSSB_IMAGES - }; - - FImageCollection Images; - FImageCollection ClassImages[3]; - - int HealthMarker; - char ArtifactFlash; - - char FourthWeaponClass; - char LifeBarClass; - - char ArtiRefresh; - char FragHealthRefresh; - char KeysRefresh; - char ArmorRefresh; - char HealthRefresh; - char Mana1Refresh; - char Mana2Refresh; - char AmmoRefresh; - - FManaBar ManaVial1Pic; - FManaBar ManaVial2Pic; -}; - -IMPLEMENT_POINTY_CLASS(DHexenStatusBar) - DECLARE_POINTER(oldarti) - DECLARE_POINTER(oldammo1) - DECLARE_POINTER(oldammo2) - DECLARE_POINTER(oldkeys[0]) - DECLARE_POINTER(oldkeys[1]) - DECLARE_POINTER(oldkeys[2]) - DECLARE_POINTER(oldkeys[3]) - DECLARE_POINTER(oldkeys[4]) -END_POINTERS - -DBaseStatusBar *CreateHexenStatusBar () -{ - return new DHexenStatusBar; -} diff --git a/src/g_level.cpp b/src/g_level.cpp index 1fd0130dc..fbefb011d 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -419,15 +419,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel) int cstype = SBarInfoScript[SCRIPT_CUSTOM]->GetGameType(); //Did the user specify a "base" - if(cstype == GAME_Heretic) - { - StatusBar = CreateHereticStatusBar(); - } - else if(cstype == GAME_Hexen) - { - StatusBar = CreateHexenStatusBar(); - } - else if(cstype == GAME_Strife) + if(cstype == GAME_Strife) { StatusBar = CreateStrifeStatusBar(); } @@ -442,18 +434,10 @@ void G_InitNew (const char *mapname, bool bTitleLevel) } if (StatusBar == NULL) { - if (gameinfo.gametype & GAME_DoomChex) + if (gameinfo.gametype & (GAME_DoomChex|GAME_Heretic|GAME_Hexen)) { StatusBar = CreateCustomStatusBar (SCRIPT_DEFAULT); } - else if (gameinfo.gametype == GAME_Heretic) - { - StatusBar = CreateHereticStatusBar (); - } - else if (gameinfo.gametype == GAME_Hexen) - { - StatusBar = CreateHexenStatusBar (); - } else if (gameinfo.gametype == GAME_Strife) { StatusBar = CreateStrifeStatusBar (); diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 440de41dd..295e0e4e1 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -376,8 +376,6 @@ extern DBaseStatusBar *StatusBar; // Status bar factories ----------------------------------------------------- -DBaseStatusBar *CreateHereticStatusBar(); -DBaseStatusBar *CreateHexenStatusBar(); DBaseStatusBar *CreateStrifeStatusBar(); DBaseStatusBar *CreateCustomStatusBar(int script=0); diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index bbd1f6c57..3a1462eb0 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -483,9 +483,19 @@ void SBarInfo::ParseSBarInfo(int lump) ParseSBarInfo(lump); } else if(sc.Compare("Heretic")) - gameType = GAME_Heretic; + { + int lump = Wads.CheckNumForFullName("sbarinfo/heretic.txt", true); + if(lump == -1) + sc.ScriptError("Standard Heretic Status Bar not found."); + ParseSBarInfo(lump); + } else if(sc.Compare("Hexen")) - gameType = GAME_Hexen; + { + int lump = Wads.CheckNumForFullName("sbarinfo/hexen.txt", true); + if(lump == -1) + sc.ScriptError("Standard Hexen Status Bar not found."); + ParseSBarInfo(lump); + } else if(sc.Compare("Strife")) gameType = GAME_Strife; else if(sc.Compare("None")) @@ -559,6 +569,19 @@ void SBarInfo::ParseSBarInfo(int lump) sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); //Don't tell anyone we're just ignoring this ;) } + if(sc.CheckToken(',')) + { + // Character alignment + sc.MustGetToken(TK_Identifier); + if(sc.Compare("left")) + spacingAlignment = ALIGN_LEFT; + else if(sc.Compare("center")) + spacingAlignment = ALIGN_CENTER; + else if(sc.Compare("right")) + spacingAlignment = ALIGN_RIGHT; + else + sc.ScriptError("Unknown alignment '%s'.", sc.String); + } sc.MustGetToken(';'); break; case SBARINFO_LOWERHEALTHCAP: @@ -763,6 +786,7 @@ void SBarInfo::Init() armorInterpolationSpeed = 8; height = 0; spacingCharacter = '\0'; + spacingAlignment = ALIGN_CENTER; resW = 320; resH = 200; @@ -1295,7 +1319,7 @@ public: } } - void DrawString(FFont *font, const char* str, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0, bool drawshadow=false) const + void DrawString(FFont *font, const char* str, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0, bool drawshadow=false, int shadowX=2, int shadowY=2) const { x += spacing; double ax = *x; @@ -1340,6 +1364,23 @@ public: ry = ay + yOffset; rw = character->GetScaledWidthDouble(); rh = character->GetScaledHeightDouble(); + + if(script->spacingCharacter != '\0') + { + double spacingSize = font->GetCharWidth((int) script->spacingCharacter); + switch(script->spacingAlignment) + { + default: + break; + case SBarInfo::ALIGN_CENTER: + rx += (spacingSize/2)-(rw/2); + break; + case SBarInfo::ALIGN_RIGHT: + rx += spacingSize-rw; + break; + } + } + if(!fullScreenOffsets) { rx += ST_X; @@ -1374,7 +1415,9 @@ public: if(drawshadow) { int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT); - screen->DrawTexture(character, rx+2, ry+2, + double srx = rx + (shadowX*xScale); + double sry = ry + (shadowY*yScale); + screen->DrawTexture(character, srx, sry, DTA_DestWidthF, rw, DTA_DestHeightF, rh, DTA_Alpha, salpha, diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index 9952e21a8..d2d81f1f7 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -84,6 +84,13 @@ struct Popup struct SBarInfo { + enum MonospaceAlignment + { + ALIGN_LEFT, + ALIGN_CENTER, + ALIGN_RIGHT + }; + TArray Images; SBarInfoMainBlock *huds[NUMHUDS]; Popup popups[NUMPOPUPS]; @@ -93,6 +100,7 @@ struct SBarInfo bool completeBorder; bool lowerHealthCap; char spacingCharacter; + MonospaceAlignment spacingAlignment; int interpolationSpeed; int armorInterpolationSpeed; int height; diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index 13263a831..91e7aa06c 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -514,14 +514,15 @@ class CommandDrawString : public SBarInfoCommand { public: CommandDrawString(SBarInfo *script) : SBarInfoCommand(script), - shadow(false), spacing(0), font(NULL), translation(CR_UNTRANSLATED), - cache(-1), strValue(CONSTANT), valueArgument(0) + shadow(false), shadowX(2), shadowY(2), spacing(0), font(NULL), + translation(CR_UNTRANSLATED), cache(-1), strValue(CONSTANT), + valueArgument(0) { } void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar) { - statusBar->DrawString(font, str.GetChars(), x, y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), translation, spacing, shadow); + statusBar->DrawString(font, str.GetChars(), x, y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), translation, spacing, shadow, shadowX, shadowY); } void Parse(FScanner &sc, bool fullScreenOffsets) { @@ -695,6 +696,8 @@ class CommandDrawString : public SBarInfoCommand }; bool shadow; + int shadowX; + int shadowY; int spacing; FFont *font; EColorRange translation; @@ -850,7 +853,18 @@ class CommandDrawNumber : public CommandDrawString else if(sc.Compare("whennotzero")) whenNotZero = true; else if(sc.Compare("drawshadow")) + { + if(sc.CheckToken('(')) + { + sc.MustGetToken(TK_IntConst); + shadowX = sc.Number; + sc.MustGetToken(','); + sc.MustGetToken(TK_IntConst); + shadowY = sc.Number; + sc.MustGetToken(')'); + } shadow = true; + } else if(sc.Compare("interpolate")) { sc.MustGetToken('('); @@ -1236,7 +1250,18 @@ class CommandDrawSelectedInventory : public SBarInfoCommandFlowControl, private else if(sc.Compare("centerbottom")) offset = static_cast (HMIDDLE|BOTTOM); else if(sc.Compare("drawshadow")) + { + if(sc.CheckToken('(')) + { + sc.MustGetToken(TK_IntConst); + shadowX = sc.Number; + sc.MustGetToken(','); + sc.MustGetToken(TK_IntConst); + shadowY = sc.Number; + sc.MustGetToken(')'); + } shadow = true; + } else { font = V_GetFont(sc.String); diff --git a/wadsrc/static/actors/heretic/heretickeys.txt b/wadsrc/static/actors/heretic/heretickeys.txt index 774629866..71beab253 100644 --- a/wadsrc/static/actors/heretic/heretickeys.txt +++ b/wadsrc/static/actors/heretic/heretickeys.txt @@ -13,6 +13,7 @@ ACTOR KeyGreen : HereticKey 73 Game Heretic SpawnID 86 Inventory.PickupMessage "$TXT_GOTGREENKEY" + Inventory.Icon "GKEYICON" States { Spawn: @@ -28,6 +29,7 @@ ACTOR KeyBlue : HereticKey 79 Game Heretic SpawnID 85 Inventory.PickupMessage "$TXT_GOTBLUEKEY" + Inventory.Icon "BKEYICON" States { Spawn: @@ -43,6 +45,7 @@ ACTOR KeyYellow : HereticKey 80 Game Heretic SpawnID 87 Inventory.PickupMessage "$TXT_GOTYELLOWKEY" + Inventory.Icon "YKEYICON" States { Spawn: diff --git a/wadsrc/static/animdefs.txt b/wadsrc/static/animdefs.txt index f4b33eaab..a2a4498e2 100644 --- a/wadsrc/static/animdefs.txt +++ b/wadsrc/static/animdefs.txt @@ -95,6 +95,12 @@ pic SPMINO13 tics 3 pic SPMINO14 tics 3 pic SPMINO15 tics 3 +// Animate health vial for Heretic fullscreen HUD +texture optional PTN1A0 +pic PTN1A0 tics 3 +pic PTN1B0 tics 3 +pic PTN1C0 tics 3 + // The Wings of Wrath are not included, because they stop spinning when // you stop flying, so they can't be a simple animation. diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 1d3d63fd2..0c78f1184 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -24,7 +24,7 @@ gameinfo defaultbloodparticlecolor = "ff 00 00" backpacktype = "BagOfHolding" armoricons = "SHLDA0", 0.75, "SHD2A0" - statusbar = "" + statusbar = "sbarinfo/heretic.txt" intermissionmusic = "mus_intr" intermissioncounter = false weaponslot = 1, "Staff", "Gauntlets" diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index cdababe39..344f4eb41 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -26,7 +26,7 @@ gameinfo defaultbloodcolor = "68 00 00" defaultbloodparticlecolor = "ff 00 00" backpacktype = "BagOfHolding" // Hexen doesn't have a backpack so use Heretic's. - statusbar = "" + statusbar = "sbarinfo/hexen.txt" intermissionmusic = "hub" intermissioncounter = false weaponslot = 1, "FWeapFist", "CWeapMace", "MWeapWand" diff --git a/wadsrc/static/sbarinfo/heretic.txt b/wadsrc/static/sbarinfo/heretic.txt new file mode 100755 index 000000000..c5b22f6b3 --- /dev/null +++ b/wadsrc/static/sbarinfo/heretic.txt @@ -0,0 +1,123 @@ +/******************************************************************************* + * DEFAULT HERETIC STATUS BAR + ******************************************************************************* + * If you wish to include this file into a custom status bar please use the + * following command: + * + * base Heretic; + * + * Using #include "sbarinfo/heretic.txt" will not be supported. + ******************************************************************************/ + +height 42; +monospacefonts true, "0", center; + +statusbar fullscreen, fullscreenoffsets +{ + //health + drawimage "PTN1A0", 48, -3, centerbottom; + drawnumber 2147483647, BIGFONT, untranslated, health, drawshadow, interpolate(8), 41, -21, 1; + + //armor + drawimage armoricon, 56, -24, centerbottom; + drawnumber 2147483647, BIGFONT, untranslated, armor, drawshadow, whennotzero, 41, -43, 1; + + //frags/keys + gamemode deathmatch + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, frags, drawshadow, 70, -16, 1; + else + drawkeybar 100, vertical, reverse, 8, 54, -7, 0, 3, auto; + + //ammo + drawimage ammoicon1, -14, -22, centerbottom; + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo1, drawshadow(1, 1), -3, -15, 1; + //secondary ammo + usessecondaryammo + { + drawimage ammoicon2, -14, -63, centerbottom; + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo2, drawshadow(1, 1), -3, -56, 1; + } + + inventorybarnotvisible + { + drawselectedinventory alternateonempty, artiflash, INDEXFONT_RAVEN, -61, -31, -34, -9, untranslated + { + } + else + { + alpha 0.6 + drawimage "ARTIBOX", -61, -31; + } + } +} + +statusbar normal +{ + drawimage "BARBACK", 0, 158; + drawimage "LTFCTOP", 0, 148; + drawimage "RTFCTOP", 290, 148; + + //god mode + drawswitchableimage invulnerable, "GOD1", "nullimage", 16, 167; + drawswitchableimage invulnerable, "GOD2", "nullimage", 287, 167; + + //health + drawimage "CHAINBAC", 0, 190; + gamemode singleplayer + drawgem wiggle, interpolate(8), "CHAIN", "LIFEGEM2", 15, 25, 16, 2, 191; + else + drawgem wiggle, interpolate(8), translatable, "CHAIN", "LIFEGEM2", 15, 25, 16, 2, 191; + drawimage "LTFACE", 0, 190; + drawimage "RTFACE", 276, 190; + drawshader 16, 10, horizontal, 19, 190; + drawshader 16, 10, horizontal, reverse, 278, 190; + + //statbar + gamemode singleplayer, cooperative + { + drawimage "LIFEBAR", 34, 160; + drawimage "ARMCLEAR", 57, 171; + drawnumber 3, HUDFONT_RAVEN, untranslated, health, interpolate(8), 87, 170, 1; + } + else + { + drawimage "STATBAR", 34, 160; + drawimage "ARMCLEAR", 57, 171; + drawnumber 3, HUDFONT_RAVEN, untranslated, frags, 87, 170, 1; + } + drawimage "ARMCLEAR", 224, 171; + drawnumber 3, HUDFONT_RAVEN, untranslated, armor, 254, 170, 1; + + //ammo + usessecondaryammo not + { + drawnumber 3, HUDFONT_RAVEN, untranslated, ammo1, 135, 162, 1; + drawimage ammoicon1, 123, 180, center; + } + else + { + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo1, 137, 165; + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo2, 137, 177; + drawimage ammoicon1, 115, 169, center; + drawimage ammoicon2, 115, 180, center; + } + + //keys + drawswitchableimage keyslot 3, "nullimage", "YKEYICON", 153, 164; + drawswitchableimage keyslot 1, "nullimage", "GKEYICON", 153, 172; + drawswitchableimage keyslot 2, "nullimage", "BKEYICON", 153, 180; + + //inventory box + drawselectedinventory artiflash, INDEXFONT_RAVEN, 179, 160, 209, 182, untranslated; +} + +statusbar inventory +{ + drawimage "INVBAR", 34, 160; + drawinventorybar Heretic, noartibox, 7, INDEXFONT_RAVEN, 50, 160, 77, 182, untranslated; +} + +statusbar inventoryfullscreen, fullscreenoffsets // ZDoom HUD overlay. +{ + drawinventorybar Heretic, translucent, 7, INDEXFONT_RAVEN, -106+center, -31, -78+center, -9, untranslated; +} diff --git a/wadsrc/static/sbarinfo/hexen.txt b/wadsrc/static/sbarinfo/hexen.txt new file mode 100755 index 000000000..3dc900e98 --- /dev/null +++ b/wadsrc/static/sbarinfo/hexen.txt @@ -0,0 +1,259 @@ +/******************************************************************************* + * DEFAULT HEXEN STATUS BAR + ******************************************************************************* + * If you wish to include this file into a custom status bar please use the + * following command: + * + * base Hexen; + * + * Using #include "sbarinfo/hexen.txt" will not be supported. + ******************************************************************************/ + +height 38; +monospacefonts true, "0", center; + +statusbar fullscreen, fullscreenoffsets +{ + //health + drawnumber 2147483647, BIGFONT, untranslated, health, drawshadow, interpolate(8), 40, -20, 1; + + //frags + gamemode deathmatch + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, frags, drawshadow(1, 1), 70, -15, 1; + + inventorybarnotvisible + { + drawselectedinventory alternateonempty, artiflash, INDEXFONT_RAVEN, -82, -31, -52, -8, untranslated + { + } + else + { + alpha 0.6 + drawimage "ARTIBOX", -80, -30; + } + } + + // Mana + weaponammo Mana1 && Mana2 + { + weaponammo Mana1 + drawimage "MANABRT1", -17, -30; + else + drawimage "MANADIM1", -17, -30; + weaponammo Mana2 + drawimage "MANABRT2", -17, -15; + else + drawimage "MANADIM2", -17, -15; + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo Mana1, drawshadow(1, 1), -21, -30, 1; + drawnumber 2147483647, HUDFONT_RAVEN, untranslated, ammo Mana2, drawshadow(1, 1), -21, -15, 1; + } +} + +statusbar Normal +{ + drawimage "H2BAR", 0, 135; + drawimage "STATBAR", 38, 162; + + drawselectedinventory artiflash, INDEXFONT_RAVEN, 143, 163, 174, 184, untranslated; + + gamemode deathmatch, teamgame + { + drawimage "KILLS", 38, 163; + drawnumber 3, HUDFONT_RAVEN, untranslated, frags, 58, 163, 1; + } + else + { + drawimage "ARMCLS", 41, 178; + drawnumber 3, HUDFONT_RAVEN, untranslated, health, interpolate(6), 65, 176, 1, red, 25; + } + + //mana bars + weaponammo Mana1 && Mana2 + { + weaponammo Mana1 + { + drawimage "MANABRT1", 77, 164; + drawbar "MANAVL1", "nullimage", ammo Mana1, vertical, 94, 164, 1; + } + else + { + drawimage "MANADIM1", 77, 164; + drawbar "MANAVL1D", "nullimage", ammo Mana1, vertical, 94, 164, 1; + } + weaponammo Mana2 + { + drawimage "MANABRT2", 110, 164; + drawbar "MANAVL2", "nullimage", ammo Mana2, vertical, 102, 164, 1; + } + else + { + drawimage "MANADIM2", 110, 164; + drawbar "MANAVL2D", "nullimage", ammo Mana2, vertical, 102, 164, 1; + } + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo Mana1, 91, 181; + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo Mana2, 123, 181; + } + else //Weapon doesn't use ammo draw an alternative + { + drawimage "HAMOBACK", 77, 164; + usessecondaryammo + { + drawimage ammoicon1, 89, 172, center; + drawimage ammoicon2, 113, 172, center; + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo1, 98, 182; + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo2, 122, 182; + } + else + { + drawimage ammoicon1, 100, 172, center; + drawnumber 3, INDEXFONT_RAVEN, untranslated, ammo1, 109, 182; + } + } + + //armor + drawimage "ARMCLS", 255, 178; + drawnumber 2, HUDFONT_RAVEN, untranslated, armorclass, 275, 176, 1; + + playerclass Fighter + { + drawimage "WPSLOT0", 190, 162; + hasweaponpiece FWeapQuietus, 1 + { + drawimage "WPIECEF1", 190, 162; + } + hasweaponpiece FWeapQuietus, 2 + { + drawimage "WPIECEF2", 225, 162; + } + hasweaponpiece FWeapQuietus, 3 + { + drawimage "WPIECEF3", 234, 162; + } + hasweaponpiece FWeapQuietus, 1 + { + hasweaponpiece FWeapQuietus, 2 + { + hasweaponpiece FWeapQuietus, 3 + { + drawimage "WPFULL0", 190, 162; + } + } + } + + gamemode singleplayer + drawgem interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; + } + else playerclass Cleric + { + drawimage "WPSLOT1", 190, 162; + hasweaponpiece CWeapWraithverge, 1 + { + drawimage "WPIECEC1", 190, 162; + } + hasweaponpiece CWeapWraithverge, 2 + { + drawimage "WPIECEC2", 212, 162; + } + hasweaponpiece CWeapWraithverge, 3 + { + drawimage "WPIECEC3", 225, 162; + } + hasweaponpiece CWeapWraithverge, 1 + { + hasweaponpiece CWeapWraithverge, 2 + { + hasweaponpiece CWeapWraithverge, 3 + { + drawimage "WPFULL1", 190, 162; + } + } + } + + gamemode singleplayer + drawgem interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; + } + else playerclass Mage + { + drawimage "WPSLOT2", 190, 162; + hasweaponpiece MWeapBloodscourge, 1 + { + drawimage "WPIECEM1", 190, 162; + } + hasweaponpiece MWeapBloodscourge, 2 + { + drawimage "WPIECEM2", 205, 162; + } + hasweaponpiece MWeapBloodscourge, 3 + { + drawimage "WPIECEM3", 224, 162; + } + hasweaponpiece MWeapBloodscourge, 1 + { + hasweaponpiece MWeapBloodscourge, 2 + { + hasweaponpiece MWeapBloodscourge, 3 + { + drawimage "WPFULL2", 190, 162; + } + } + } + + gamemode singleplayer + drawgem interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193; + } + drawimage "LFEDGE", 0, 193; + drawimage "RTEDGE", 277, 193; +} + +statusbar Automap +{ + drawimage "H2BAR", 0, 135; + drawimage "KEYBAR", 38, 162; + drawkeybar 5, horizontal, 20, 46, 164; + drawimage hexenarmor armor, "ARMSLOT1", 150, 164; + drawimage hexenarmor shield, "ARMSLOT2", 181, 164; + drawimage hexenarmor helm, "ARMSLOT3", 212, 164; + drawimage hexenarmor amulet, "ARMSLOT4", 243, 164; + + // Also draw the life gem here + playerclass Fighter + { + gamemode singleplayer + drawgem interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; + } + else playerclass Cleric + { + gamemode singleplayer + drawgem interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; + } + else playerclass Mage + { + gamemode singleplayer + drawgem interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193; + else + drawgem translatable, interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193; + } + drawimage "LFEDGE", 0, 193; + drawimage "RTEDGE", 277, 193; +} + +statusbar inventory +{ + drawimage "INVBAR", 38, 162; + drawinventorybar HexenStrict, noartibox, 7, INDEXFONT_RAVEN, 52, 164, 80, 185, untranslated; +} + +statusbar inventoryfullscreen, fullscreenoffsets // ZDoom HUD overlay. +{ + drawinventorybar HexenStrict, translucent, 7, INDEXFONT_RAVEN, -106+center, -31, -78+center, -10, untranslated; +}