diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index 97d79f55e..dec09fcc3 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -36,56 +36,7 @@ void MNU_DrawString(int x, int y, const char* string, int shade, int pal, int al void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, int align = -1, double alpha = 1); void MNU_DrawStringLarge(int x, int y, const char* string, int shade = 0, int align = -1); -#define pic_none 0 -#define pic_radiobuttn1 2816 -#define pic_radiobuttn2 2817 -#define pic_newgame 2819 -#define pic_load 2820 -#define pic_save 2821 -#define pic_options 2822 -#define pic_orderinfo 2823 -#define pic_todemo 2824 -#define pic_togame 2825 -#define pic_quit 2826 -#define pic_newgametitl 2827 -#define pic_training 2828 -#define pic_easy 2829 -#define pic_normal 2830 -#define pic_hard 2831 -#define pic_impossible 2832 -#define pic_optionstitl 2833 -#define pic_endgame 2834 -#define pic_detail 2835 -#define pic_high 2836 -#define pic_low 2837 -#define pic_mousesense 2838 -#define pic_soundvol 2839 -#define pic_toggles 2845 -#define pic_togglestitl 2844 -#define pic_mousenable 2840 -#define pic_joyenable 2841 -#define pic_bobbing 2842 -#define pic_slidelend 2846 -#define pic_slidebar 2847 -#define pic_sliderend 2848 -#define pic_sliderknob 2849 -#define pic_shuriken1 2850 #define pic_yinyang 2870 -#define pic_soundtitl 2870 -#define pic_sndfxvol 2871 -#define pic_musicvol 2872 -#define pic_episode1 2873 -#define pic_episode2 2874 -#define pic_episode3 2875 -#define pic_modem 2876 -#define pic_scrsize 2877 -#define pic_loadsavecursor 2918 -#define pic_loadgame 2915 -#define pic_savegame 2916 -#define pic_loading 2917 -#define pic_loadsavescreen 2919 -#define pic_loadsavescreenbak 2922 -#define pic_savedescr 2924 #define pic_shadow_warrior 2366 #define m_defshade 2 diff --git a/source/sw/src/sbar.cpp b/source/sw/src/sbar.cpp index df3dc6553..f295edebb 100644 --- a/source/sw/src/sbar.cpp +++ b/source/sw/src/sbar.cpp @@ -67,7 +67,7 @@ static const short icons[] = { class DSWStatusBar : public DBaseStatusBar { - DHUDFont miniFont; + DHUDFont miniFont, numberFont; enum { @@ -145,6 +145,7 @@ class DSWStatusBar : public DBaseStatusBar public: DSWStatusBar() { + numberFont = { BigFont, 0, Off, 1, 1 }; miniFont = { SmallFont2, 0, Off, 1, 1 }; } @@ -424,7 +425,7 @@ private: // //--------------------------------------------------------------------------- - void DisplayKeys(PLAYERp pp) + void DisplayKeys(PLAYERp pp, double xs, double ys) { double x, y; int row, col; @@ -453,8 +454,8 @@ private: { if (pp->HasKey[i]) { - x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize); - y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize); + x = xs + PANEL_KEYS_XOFF + (row * xsize); + y = ys + PANEL_KEYS_YOFF + (col * ysize); DrawGraphic(tileGetTexture(StatusKeyPics[i]), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); } i++; @@ -469,8 +470,8 @@ private: { if (pp->HasKey[i + 4]) { - x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize); - y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize); + x = xs + PANEL_KEYS_XOFF + (row * xsize); + y = ys + PANEL_KEYS_YOFF + (col * ysize); DrawGraphic(tileGetTexture(StatusKeyPics[i + 4]), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); } i++; @@ -523,13 +524,13 @@ private: // //--------------------------------------------------------------------------- - void PlayerUpdateInventoryState(PLAYERp pp, int InventoryBoxX, int InventoryBoxY, int InventoryXoff, int InventoryYoff) + void PlayerUpdateInventoryState(PLAYERp pp, double InventoryBoxX, double InventoryBoxY, int InventoryXoff, int InventoryYoff) { char ds[32]; INVENTORY_DATAp id = &InventoryData[pp->InventoryNum]; - int x = InventoryBoxX + INVENTORY_STATE_XOFF + InventoryXoff; - int y = InventoryBoxY + INVENTORY_STATE_YOFF + InventoryYoff; + double x = InventoryBoxX + INVENTORY_STATE_XOFF + InventoryXoff; + double y = InventoryBoxY + INVENTORY_STATE_YOFF + InventoryYoff; if (TEST(id->Flags, INVF_AUTO_USE)) { @@ -671,7 +672,7 @@ private: DisplayPanelNumber(PANEL_AMMO_BOX_X + PANEL_AMMO_XOFF, PANEL_BOX_Y + PANEL_AMMO_YOFF, pp->WpnAmmo[u->WeaponNum]); PlayerUpdateWeaponSummaryAll(pp); if (gNet.MultiGameType != MULTI_GAME_COMMBAT) - DisplayKeys(pp); + DisplayKeys(pp, PANEL_KEYS_BOX_X, PANEL_BOX_Y); else if (gNet.TimeLimit) DisplayTimeLimit(pp); DisplayBarInventory(pp); @@ -745,6 +746,92 @@ private: DisplayMinibarInventory(pp); } + //========================================================================== + // + // Fullscreen HUD variant #1 + // + //========================================================================== + + void DrawHUD2() + { + BeginHUD(320, 200, 1); + const int HEALTH = 0, SHIELD = 0; + + auto pp = Player + screenpeek; + USERp u = User[pp->PlayerSprite]; + + double imgScale = (numberFont.mFont->GetHeight()) * 0.7; + + // + // Health + // + auto imgHealth = tileGetTexture(HEALTH); + auto healthScale = imgScale / imgHealth->GetDisplayHeight(); + DrawGraphic(imgHealth, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, healthScale, healthScale); + + FString format; + if (!althud_flashing || u->Health > (u->MaxHealth >> 2) || ((int)totalclock & 32)) + { + int s = -8; + if (althud_flashing && u->Health > u->MaxHealth) + s += (sintable[((int)totalclock << 5) & 2047] >> 10); + int intens = clamp(255 - 4 * s, 0, 255); + auto pe = PalEntry(255, intens, intens, intens); + format.Format("%d", u->Health); + SBar_DrawString(this, &numberFont, format, 25, -numberFont.mFont->GetHeight(), DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + } + + // + // Armor + // + auto imgArmor = tileGetTexture(SHIELD); + auto armorScale = imgScale / imgArmor->GetDisplayHeight(); + DrawGraphic(imgArmor, 77.375, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, armorScale, armorScale); + + format.Format("%d", pp->Armor); + SBar_DrawString(this, &numberFont, format, 95, -numberFont.mFont->GetHeight(), DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + + // + // Weapon + // + int weapon = u->WeaponNum; + + if (u->WeaponNum != WPN_SWORD && u->WeaponNum != WPN_FIST && (!althud_flashing || (int)totalclock & 32 || pp->WpnAmmo[weapon] > (DamageData[weapon].max_ammo / 10))) + { + format.Format("%d", pp->WpnAmmo[weapon]); + SBar_DrawString(this, &numberFont, format, -3, -numberFont.mFont->GetHeight(), DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + + int wicon = 0;// ammo_sprites[weapon]; + //if (wicon > 0) + { + auto imgWeap = tileGetTexture(wicon); + auto weapScale = imgScale / imgWeap->GetDisplayHeight(); + auto imgX = 20.; + auto strlen = format.Len(); + if (strlen > 1) + { + auto scaler = strlen - 1; + imgX += ((imgX / 2.) * scaler) + ((imgX / (10.)) * scaler); + } + DrawGraphic(imgWeap, -imgX, -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, weapScale, weapScale); + } + } + + // + // Selected inventory item + // + + PlayerUpdateInventoryPic(pp, 148, -21.5, 1, 1); + PlayerUpdateInventoryState(pp, 148, -21.5, 1, 1); + PlayerUpdateInventoryPercent(pp, 148, -21.5, 1, 1); + + // + // keys + // + DisplayKeys(pp, -80, -20); + } + + //--------------------------------------------------------------------------- // // @@ -852,7 +939,7 @@ public: align = DI_SCREEN_CENTER_TOP; inv_x = -80 * hud_scale / 100.; inv_y = -70 * hud_scale / 100.; - DrawHUD1(); // todo: Implement a proper view for this + DrawHUD2(); // todo: Implement a proper view for this } else if (hud_size == Hud_Mini) {