From 5b793d6db2225dcef245f17037f8f342ddf326a0 Mon Sep 17 00:00:00 2001 From: Saint Wish Date: Wed, 11 Oct 2023 16:20:30 -0600 Subject: [PATCH] manually merge "Option to enable retro MSC HUD" thanks git for being stupid. --- game/client/client.vpc | 3 +- game/client/ms/hudmisc.cpp | 4 +- game/client/ui/ms/vgui_health.h | 69 +++---- game/client/ui/ms/vgui_health2.h | 302 +++++++++++++++++++++++++++++ game/client/ui/ms/vgui_hud.cpp | 53 ++--- game/client/ui/ms/vgui_quickslot.h | 3 +- game/client/ui/vgui_status.h | 12 +- 7 files changed, 368 insertions(+), 78 deletions(-) create mode 100644 game/client/ui/ms/vgui_health2.h diff --git a/game/client/client.vpc b/game/client/client.vpc index ece71229..a5ca5e0f 100644 --- a/game/client/client.vpc +++ b/game/client/client.vpc @@ -149,6 +149,7 @@ $Project "Client" $File "ui\ms\vgui_containerlist.cpp" $File "ui\ms\vgui_eventconsole.h" $File "ui\ms\vgui_health.h" + $File "ui\ms\vgui_health2.h" $File "ui\ms\vgui_hud.cpp" $File "ui\ms\vgui_id.h" $File "ui\ms\vgui_infowin.h" @@ -421,4 +422,4 @@ $Project "Client" $ImpLib steam_api $ImpLib fmod_vc } -} +} \ No newline at end of file diff --git a/game/client/ms/hudmisc.cpp b/game/client/ms/hudmisc.cpp index 5af64f8e..439bc5c1 100644 --- a/game/client/ms/hudmisc.cpp +++ b/game/client/ms/hudmisc.cpp @@ -55,6 +55,8 @@ int CHudMisc::Init(void) HOOK_COMMAND("accept", Accept); //HOOK_COMMAND("listskills", ListSkills); + CVAR_CREATE("cl_retrohud", "0", FCVAR_ARCHIVE); + CVAR_CREATE("cl_crosshair_draw", "1", FCVAR_ARCHIVE); CVAR_CREATE("cl_crosshair_type", "0", FCVAR_ARCHIVE); @@ -385,4 +387,4 @@ void CHudMisc ::UserCmd_Accept(void) //if( player.Class && player.Class->id == CLASS_ROGUE ) // gHUD.m_Menu->ShowMenu( 1, "Use skill:\n\n1. Shadow Stealth\n", MENU_LISTSKILLS ); -}*/ +}*/ \ No newline at end of file diff --git a/game/client/ui/ms/vgui_health.h b/game/client/ui/ms/vgui_health.h index 69be24f7..86c86019 100644 --- a/game/client/ui/ms/vgui_health.h +++ b/game/client/ui/ms/vgui_health.h @@ -4,22 +4,16 @@ #include -static COLOR Color_Text_LowHealth(250, 0, 0, 10), - Color_Charge_Lvl1(128, 128, 128, 128), Color_Charge_Lvl2(255, 100, 100, 128), - Color_Charge_Lvl3(100, 230, 30, 128), - Color_Charge_BG(128, 128, 128, 100); -static COLOR HighColor(0, 255, 0, 128), MedColor(255, 255, 0, 128), LowColor(255, 0, 0, 128); - //Scales flasks down to only 40% wide of the screen if sprites are too big -#define FLASK_SCALE (1.0f - ((730 - (ScreenWidth * 0.40f)) / ScreenWidth)) +#define BAR_SCALE (1.0f - ((730 - (ScreenWidth * 0.40f)) / ScreenWidth)) -//Dimensions of the "Flask" sprites -#define FLASK_W (320 * FLASK_SCALE) -#define FLASK_H (40 * FLASK_SCALE) +//Dimensions of the "Bar" sprites +#define BAR_W (320 * BAR_SCALE) +#define BAR_H (40 * BAR_SCALE) -#define EMBLEM_SIZE (90 * FLASK_SCALE) +#define EMBLEM_SIZE (90 * BAR_SCALE) -class VGUI_Flask : public Panel +class VGUI_Bar : public Panel { public: VGUI_Image3D m_Image; @@ -27,7 +21,7 @@ class VGUI_Flask : public Panel int m_Type; float m_CurrentAmt; - VGUI_Flask(Panel *pParent, int Type, int x, int y) : Panel(x, y, FLASK_W, FLASK_H) + VGUI_Bar(Panel *pParent, int Type, int x, int y) : Panel(x, y, BAR_W, BAR_H) { setParent(pParent); setBgColor(0, 0, 0, 255); @@ -60,16 +54,20 @@ class VGUI_Flask : public Panel float Amt, MaxAmt; switch (m_Type) { - case 0: Amt = player.m_HP; + case 0: + Amt = player.m_HP; MaxAmt = player.MaxHP(); break; - case 1: Amt = player.m_MP; + case 1: + Amt = player.m_MP; MaxAmt = player.MaxMP(); break; - case 2: Amt = player.Weight(); + case 2: + Amt = player.Weight(); MaxAmt = player.Volume(); break; - case 3: Amt = player.Stamina; + case 3: + Amt = player.Stamina; MaxAmt = player.MaxStamina(); break; } @@ -109,10 +107,13 @@ class VGUI_Flask : public Panel m_Image.SetFrame(frame); m_Label->setText(UTIL_VarArgs("%i/%i ", (int)m_CurrentAmt, (int)MaxAmt)); //the space is intentional - if (m_CurrentAmt > MaxAmt / 4.0f) - m_Label->SetFGColorRGB(Color_Text_White); - else - m_Label->SetFGColorRGB(Color_Text_LowHealth); + m_Label->SetFGColorRGB(COLOR(255, 255, 255, 10)); + if (m_Type != 2) { + if (m_CurrentAmt > MaxAmt / 4.0f) + m_Label->SetFGColorRGB(COLOR(255, 255, 255, 10)); + else + m_Label->SetFGColorRGB(COLOR(250, 0, 0, 10)); + } setVisible(ShowHealth()); } @@ -128,7 +129,7 @@ class VGUI_Health : public Panel, public IHUD_Interface int vCurChargeLevel = 0; public: - class VGUI_Flask *m_Flask[4]; + class VGUI_Bar *m_Bar[4]; CStatusBar *m_Charge[2]; MSLabel *m_ChargeLbl[2]; @@ -139,37 +140,33 @@ class VGUI_Health : public Panel, public IHUD_Interface //Main HUD Image VGUI_Health(Panel* pParent) : Panel(0, 0, ScreenWidth, ScreenHeight) { - startdbg; - dbg("Begin"); setParent(pParent); SetBGColorRGB(Color_Transparent); - - //Point defines where status bars are positioned relative to and the max screen space its allowed to take before scaling float coords[2]; coords[0] = 10; //x - coords[1] = (ScreenHeight - (2 * FLASK_H) - 10); //y, from the bottom of the screen, as high as the sprites are + coords[1] = (ScreenHeight - (2 * BAR_H) - 10); //y, from the bottom of the screen, as high as the sprites are // Status Bars //Health bar - m_Flask[0] = new VGUI_Flask(this, 0, coords[0], coords[1]); + m_Bar[0] = new VGUI_Bar(this, 0, coords[0], coords[1]); //weight bar - m_Flask[2] = new VGUI_Flask(this, 2, coords[0], coords[1] + FLASK_H); + m_Bar[2] = new VGUI_Bar(this, 2, coords[0], coords[1] + BAR_H); //Mana bar - m_Flask[1] = new VGUI_Flask(this, 1, coords[0] + FLASK_W + EMBLEM_SIZE - 1, coords[1]); + m_Bar[1] = new VGUI_Bar(this, 1, coords[0] + BAR_W + EMBLEM_SIZE - 1, coords[1]); //stam bar - m_Flask[3] = new VGUI_Flask(this, 3, coords[0] + FLASK_W + EMBLEM_SIZE - 1, coords[1] + FLASK_H); + m_Bar[3] = new VGUI_Bar(this, 3, coords[0] + BAR_W + EMBLEM_SIZE - 1, coords[1] + BAR_H); m_HUDImage.setParent(this); m_HUDImage.LoadImg("hud_main", true, false); m_HUDImage.setSize(EMBLEM_SIZE, EMBLEM_SIZE); - m_HUDImage.setPos(coords[0] + FLASK_W, coords[1] - (7 * FLASK_SCALE)); + m_HUDImage.setPos(coords[0] + BAR_W, coords[1] - (7 * BAR_SCALE)); //Charge system #define CHARGE_W XRES(30) @@ -177,20 +174,17 @@ class VGUI_Health : public Panel, public IHUD_Interface #define CHARGE_SPACER_W XRES(2) //#define CHARGE_X XRES(320) - CHARGE_W/2 - dbg("Setup m_Charge[0] & m_Charge[1]"); for (int i = 0; i < 2; i++) { int Multiplier = (i == 0) ? -1 : 1; float OffsetW = CHARGE_SPACER_W + (i == 0) ? CHARGE_W : 0; m_Charge[i] = new CStatusBar(this, XRES(304) + OffsetW * Multiplier, YRES(408), CHARGE_W, CHARGE_H); - m_Charge[i]->SetBGColorRGB(Color_Charge_BG); + m_Charge[i]->SetBGColorRGB(COLOR(128, 128, 128, 100)); //m_Charge[i]->m_fBorder = false; m_Charge[i]->setVisible(false); m_ChargeLbl[i] = new MSLabel(this, "0/0", XRES(304) + OffsetW * Multiplier, YRES(408), CHARGE_W, CHARGE_H, MSLabel::a_center); m_ChargeLbl[i]->setVisible(false); } - - enddbg; } //MiB NOV2007a - Moar Charge Colors! @@ -198,7 +192,7 @@ class VGUI_Health : public Panel, public IHUD_Interface { //Update flasks for (int i = 0; i < 4; i++) - m_Flask[i]->Update(); + m_Bar[i]->Update(); bool bShowHealth = ShowHealth(); @@ -239,7 +233,6 @@ class VGUI_Health : public Panel, public IHUD_Interface if (Item->Attack_IsCharging() && (vCurChargeAmt = Item->Attack_Charge()) > 0) { - ChargeBar.setVisible(bShowHealth); bool notDone = true; diff --git a/game/client/ui/ms/vgui_health2.h b/game/client/ui/ms/vgui_health2.h new file mode 100644 index 00000000..3bd54384 --- /dev/null +++ b/game/client/ui/ms/vgui_health2.h @@ -0,0 +1,302 @@ +// +// This should only be included by vgui_HUD.cpp +// + +#include + +static COLOR HighColor(0, 255, 0, 128), MedColor(255, 255, 0, 128), LowColor(255, 0, 0, 128); + +#define FLASK_W XRES(64 * 0.625) //I want 64x104 in 1024x768 res, and smaller in lower res +#define FLASK_H YRES(104 * 0.625) +#define FLASK_SPACER XRES(10) + +class VGUI_Flask : public Panel +{ +public: + VGUI_Image3D m_Image; + MSLabel *m_Label; + int m_Type; + float m_CurrentAmt; + + VGUI_Flask(Panel *pParent, int Type, int x, int y) : Panel(x, y, FLASK_W, FLASK_H) + { + setParent(pParent); + setBgColor(0, 0, 0, 255); + m_Type = Type; + + m_Image.setParent(this); + + switch(Type) { + case 0: + m_Image.LoadImg("hud/healthflask", false, false); + break; + case 1: + m_Image.LoadImg("hud/manaflask", false, false); + break; + } + + m_Image.setFgColor(255, 255, 255, 255); + m_Image.setSize(getWide(), getTall()); + m_Label = new MSLabel(this, "0/0", 0, getTall()/1.5, getWide(), YRES(8), MSLabel::a_center); + } + + void Update() + { + float Amt = !m_Type ? player.m_HP : player.m_MP; + float MaxAmt = !m_Type ? player.MaxHP() : player.MaxMP(); + int LastFrame = m_Image.GetMaxFrames() - 1; + + //thothie attempting to fix scrolling flasks + int AccelFlasks = 10; + AccelFlasks = 15 * (MaxAmt / 100); + if (AccelFlasks < 40) + AccelFlasks = 40; + if (AccelFlasks > MaxAmt) + AccelFlasks = MaxAmt - 1; + if (fabs(m_CurrentAmt - Amt) > 200) + AccelFlasks = 1000; + + float MaxChange = gpGlobals->frametime * AccelFlasks; //original line: float MaxChange = gpGlobals->frametime * 40; + + if (m_CurrentAmt < 0) + m_CurrentAmt = 0.0; + if (m_CurrentAmt > 3000) + m_CurrentAmt = 3000.0; + //[/Thothie] + + if (m_CurrentAmt < Amt) + m_CurrentAmt += min(MaxChange, Amt - m_CurrentAmt); + else if (m_CurrentAmt > Amt) + m_CurrentAmt -= min(MaxChange, m_CurrentAmt - Amt); + + float frame = (m_CurrentAmt / MaxAmt) * LastFrame; + if (frame > 0 && frame < 1) + frame = 1; //Cap at 1, unless dead + if (frame > LastFrame) + frame = LastFrame; + frame = max(frame, 0); + + m_Image.SetFrame(frame); + + m_Label->setText(UTIL_VarArgs("%i/%i ", (int)m_CurrentAmt, (int)MaxAmt)); //the space is intentional + if (m_CurrentAmt > MaxAmt / 4.0f) + m_Label->SetFGColorRGB(COLOR(255, 255, 255, 10)); + else + m_Label->SetFGColorRGB(COLOR(250, 0, 0, 10)); //low health text colour + + setVisible(ShowHealth()); + } +}; + +class VGUI_Health2 : public Panel, public IHUD_Interface +{ +protected: + float vChargeLevelAmt = 0; + float vCurChargeAmt = 0; + float vDisplayChargeLevel = 0; + int mCurChargeLevel = 1; + int vCurChargeLevel = 0; + +public: + class VGUI_Flask *m_Flask[2]; + + //Stamina --------------------------- + CStatusBar *m_pStamina; + + //Weight ---------------------------- + CStatusBar *m_pWeight; + CStatusBar *m_Charge[2]; + MSLabel *m_ChargeLbl[2]; + + //Main HUD Image + VGUI_Image3D m_HUDImage; + + VGUI_Health2(Panel *pParent) : Panel(0, 0, ScreenWidth, ScreenHeight) + { + setParent(pParent); + SetBGColorRGB(Color_Transparent); + + m_HUDImage.setParent(this); + m_HUDImage.LoadImg("hud_main2", true, false); + //m_HUDImage.setFgColor( 255, 255, 255, 255 ); + m_HUDImage.setSize(getWide(), getTall()); + +//Health and mana flasks +#define FLASK_START_X XRES(30) +#define FLASK_START_Y YRES(480) - YRES(30) - FLASK_H +#define MANA_FLASK_X FLASK_START_X + FLASK_W + FLASK_SPACER + m_Flask[0] = new VGUI_Flask(this, 0, FLASK_START_X, FLASK_START_Y); + m_Flask[1] = new VGUI_Flask(this, 1, MANA_FLASK_X, FLASK_START_Y); + + //Stamina and weight bars + +#define STAMINA_X FLASK_START_X +#define STAMINA_Y YRES(453) +#define STAMINA_SIZE_X FLASK_W + FLASK_SPACER + FLASK_W +#define STAMINA_SIZE_Y YRES(12) + + m_pStamina = new CStatusBar(this, STAMINA_X, STAMINA_Y, STAMINA_SIZE_X, STAMINA_SIZE_Y); + m_pStamina->m_fBorder = false; + //m_pStamina->SetBGColorRGB( BorderColor ); + //m_pStamina->SetBGColorRGB( Color_Transparent ); + +#define STAMINA_LBL_SIZE_Y YRES(10) + + MSLabel *pLabel = new MSLabel(m_pStamina, Localized("#STAMINA"), 0, (STAMINA_SIZE_Y / 2.0f) - (STAMINA_LBL_SIZE_Y / 2.0f), STAMINA_SIZE_X, STAMINA_LBL_SIZE_Y, MSLabel::a_center); + pLabel->SetFGColorRGB(Color_Text_White); + +#define WEIGHT_SIZE_Y YRES(10) + + COLOR WeightColor(250, 150, 0, 100); + + m_pWeight = new CStatusBar(this, STAMINA_X, STAMINA_Y + STAMINA_SIZE_Y, STAMINA_SIZE_X, WEIGHT_SIZE_Y); + m_pWeight->m_fBorder = false; + m_pWeight->SetFGColorRGB(WeightColor); + +#define WEIGHT_LBL_SIZE_Y WEIGHT_SIZE_Y + + pLabel = new MSLabel(m_pWeight, Localized("#WEIGHT"), 0, (WEIGHT_SIZE_Y / 2.0f) - (WEIGHT_LBL_SIZE_Y / 2.0f), STAMINA_SIZE_X, WEIGHT_LBL_SIZE_Y, MSLabel::a_center); + //pLabel->setFgColor( 255, 255, 255, 64 ); + pLabel->SetFGColorRGB(Color_Text_White); + +//Charge system +#define CHARGE_W XRES(30) +#define CHARGE_H YRES(6) +#define CHARGE_SPACER_W XRES(2) + //#define CHARGE_X XRES(320) - CHARGE_W/2 + + for (int i = 0; i < 2; i++) + { + int Multiplier = (i == 0) ? -1 : 1; + float OffsetW = CHARGE_SPACER_W + (i == 0) ? CHARGE_W : 0; + m_Charge[i] = new CStatusBar(this, XRES(320) + OffsetW * Multiplier, STAMINA_Y, CHARGE_W, CHARGE_H); + m_Charge[i]->SetBGColorRGB(COLOR(128, 128, 128, 100)); + //m_Charge[i]->m_fBorder = false; + m_Charge[i]->setVisible(false); + m_ChargeLbl[i] = new MSLabel(this, "0/0", XRES(320) + OffsetW * Multiplier, STAMINA_Y, CHARGE_W, CHARGE_H, MSLabel::a_center); + m_ChargeLbl[i]->setVisible(false); + } + } + + //MiB NOV2007a - Moar Charge Colors! + void Update() + { + //Update Health & Mana flasks + for (int i = 0; i < 2; i++) + m_Flask[i]->Update(); + + bool bShowHealth = ShowHealth(); + + m_pStamina->setVisible(bShowHealth); + m_pWeight->setVisible(bShowHealth); + m_HUDImage.setVisible(bShowHealth); + + //Update stamina, weight + float flStaminaPercent = player.Stamina / player.MaxStamina(); + m_pStamina->Set(flStaminaPercent * 100.0f); + if (flStaminaPercent < 0.15) + m_pStamina->SetFGColorRGB(LowColor); + else if (flStaminaPercent <= 0.85f) + m_pStamina->SetFGColorRGB(MedColor); + else + m_pStamina->SetFGColorRGB(HighColor); + + m_pWeight->Set(player.Weight(), player.Volume()); + + for (int i = 0; i < 2; i++) + { + m_Charge[i]->setVisible(false); + m_ChargeLbl[i]->setVisible(false); + } + + //second attempt to fix phantom charge bar + std::vector *vHandsItems = new std::vector; + + //get all hands items + for (int i = 0; i < player.Gear.size(); i++) + { + CGenericItem* Item = player.Gear[i]; + if (Item->m_Location != ITEMPOS_HANDS) + continue; + + vHandsItems->push_back(Item); + } + + for (int i = 0; i < vHandsItems->size(); i++) + { + CGenericItem* Item = vHandsItems->at(i); + + //if we have more than one item in our hand ignore playerhands. + if (vHandsItems->size() > 1 && Item->m_Hand == HAND_PLAYERHANDS) + { + continue; + } + + int Bar = Item->m_Hand < 2 ? Item->m_Hand : 1; + CStatusBar &ChargeBar = *m_Charge[Bar]; + MSLabel &ChargeLbl = *m_ChargeLbl[Bar]; + + if (Item->Attack_IsCharging() && (vCurChargeAmt = Item->Attack_Charge()) > 0) + { + + ChargeBar.setVisible(bShowHealth); + bool notDone = true; + + int vChargeLevel = 1; + int vChargeR = 0; + int vChargeG = 0; + int vChargeB = 0; + + while (notDone) + { + vChargeLevelAmt = GET_CHARGE_FROM_TIME(vChargeLevel); + + if (vCurChargeAmt <= vChargeLevelAmt) + { + notDone = false; + ChargeBar.SetFGColorRGB(COLOR(vChargeR, vChargeG, vChargeB, 128)); + + if (vChargeLevel != 1) + { + vCurChargeAmt -= GET_CHARGE_FROM_TIME(vChargeLevel - 1); + vCurChargeAmt /= (GET_CHARGE_FROM_TIME(vChargeLevel) - GET_CHARGE_FROM_TIME(vChargeLevel - 1)); + } + } + + vChargeR += 100; + if (vChargeR > 255) + { + vChargeR -= 255; + vChargeG += 100; + if (vChargeG > 255) + { + vChargeG -= 255; + vChargeB += 100; + if (vChargeB > 255) + vChargeB -= 255; + } + } + + vChargeLevel++; + } + + vCurChargeLevel = (int)((vChargeLevel - 1) + vCurChargeAmt); + vDisplayChargeLevel = vCurChargeLevel - 1; + + if(vCurChargeLevel > mCurChargeLevel) + PlayHUDSound(gEngfuncs.pfnGetCvarString("ms_chargebar_sound"), gEngfuncs.pfnGetCvarFloat("ms_chargebar_volume")); + + mCurChargeLevel = vCurChargeLevel; + + if (vDisplayChargeLevel) + ChargeLbl.setText(msstring() + vDisplayChargeLevel); + else + ChargeLbl.setText(" "); + + ChargeLbl.setVisible(bShowHealth); + ChargeBar.Set(vCurChargeAmt * 100); + } + } + delete vHandsItems; + } +}; \ No newline at end of file diff --git a/game/client/ui/ms/vgui_hud.cpp b/game/client/ui/ms/vgui_hud.cpp index 0f2b4adc..ba505c34 100644 --- a/game/client/ui/ms/vgui_hud.cpp +++ b/game/client/ui/ms/vgui_hud.cpp @@ -76,6 +76,7 @@ #include "vgui_eventconsole.h" #include "vgui_id.h" #include "vgui_health.h" +#include "vgui_health2.h" #include "vgui_vote.h" #include "vgui_quickslot.h" @@ -97,7 +98,7 @@ class CHUDPanel : public VGUI_MainPanel //Voting ---------------------------- VGUI_VoteInfo* m_VoteInfo; - //Health & Mana --------------------- + VGUI_Health2* m_RetroHealth; VGUI_Health* m_Health; //Status Icons ---------------------- @@ -204,28 +205,30 @@ void CHUDPanel::PrintSayText(Color color, msstring_ref Text) // ----------------- CHUDPanel::CHUDPanel(Panel* pParent) : VGUI_MainPanel(0, 0, 0, ScreenWidth, ScreenHeight) { - startdbg; - dbg("Begin"); setParent(pParent); - - //Health - dbg("Create Health"); + + m_HUDElements.add(m_RetroHealth = new VGUI_Health2(this)); m_HUDElements.add(m_Health = new VGUI_Health(this)); + if (CVAR_GET_FLOAT("cl_retrohud") > 0) + { + m_RetroHealth->setVisible(true); + m_Health->setVisible(false); + }else{ + m_RetroHealth->setVisible(false); + m_Health->setVisible(true); + } + //Status Icons - dbg("Create StatusIcons"); m_HUDElements.add(m_Status = new VGUI_Status(this)); //Drigien MAY2008 //ID Panel - dbg("Create ID"); m_ID = new VGUI_ID(this, ID_X, ID_Y); //Vote Info Panel - dbg("Create Vote"); m_HUDElements.add(m_VoteInfo = new VGUI_VoteInfo(this)); //Event Console - dbg("Create Event Console"); #define EVENTCON_SIZE_X XRES(230) #define EVENTCON_X XRES(640) - EVENTCON_SIZE_X - XRES(20) #define EVENTCON_Y (YRES(480) - YRES(10)) //Starts here, and moves upward as it grows @@ -240,7 +243,6 @@ CHUDPanel::CHUDPanel(Panel* pParent) : VGUI_MainPanel(0, 0, 0, ScreenWidth, Scre m_Consoles.add(m_ActiveConsole = new VGUI_EventConsole(this, EVENTCON_X, EVENTCON_Y, EVENTCON_SIZE_X, EVENTCON_SIZE_Y, Prefs)); //SayText Console - dbg("Create SayText Console"); #define SAYTEXTCON_X XRES(10) //thothie was 220, moving to 180 #define SAYTEXTCON_Y YRES(180) //Starts here, and moves upward as it grows @@ -254,26 +256,19 @@ CHUDPanel::CHUDPanel(Panel* pParent) : VGUI_MainPanel(0, 0, 0, ScreenWidth, Scre m_Consoles.add(new VGUI_EventConsole(this, SAYTEXTCON_X, SAYTEXTCON_Y, SAYTEXTCON_SIZE_X, EVENTCON_SIZE_Y, Prefs, true, g_FontID)); //Start Say text panel - dbg("Create SayText Typing Panel"); m_StartSayText = new VGUI_SendTextPanel(this, XRES(100), YRES(300), XRES(640) - XRES(100), YRES(16)); //Debug Text - dbg("Create Debug label"); m_DebugText = new MSLabel(this, "", 0, YRES(16)); //Quick Slot Text - dbg("Create Quickslot Text"); m_HUDElements.add(m_QuickSlot = new VGUI_QuickSlot(this)); - - enddbg; } // Update void CHUDPanel::Think() { - startdbg; //Update ID - dbg("m_ID->Update( );"); m_ID->Update(); //Update HUD Elements @@ -281,13 +276,21 @@ void CHUDPanel::Think() { msstring d = "HUD Elements loop: "; d += i; - dbg(d); m_HUDElements[i]->Update(); } - dbg("Update InfoWindows"); + if ((CVAR_GET_FLOAT("cl_retrohud") > 0) && m_Health->isVisible()) + { + m_RetroHealth->setVisible(true); + m_Health->setVisible(false); + } + + if ((CVAR_GET_FLOAT("cl_retrohud") == 0) && m_RetroHealth->isVisible()) { + m_RetroHealth->setVisible(false); + m_Health->setVisible(true); + } + UpdateInfoWindows(InfoWindows); //Update Info windows - dbg("Update HelpWindows"); UpdateInfoWindows(HelpWindows); //Update Help windows //Update Text Consoles @@ -295,14 +298,11 @@ void CHUDPanel::Think() { msstring d = "Text Consoles: "; d += i; - dbg(d); m_Consoles[i]->Update(); } //Update Start Say Text - dbg("Start saytext"); m_StartSayText->Update(); - enddbg; } void CHUDPanel::UpdateInfoWindows(mslist& Windows) @@ -319,6 +319,7 @@ void CHUDPanel::UpdateInfoWindows(mslist& Windows) RemoveInfoWindow(Windows, i); } } + void CHUDPanel::RemoveInfoWindow(mslist& Windows, int idx) { CInfoWindow* pInfoWin = Windows[idx]; @@ -326,9 +327,11 @@ void CHUDPanel::RemoveInfoWindow(mslist& Windows, int idx) removeChild(pInfoWin); pInfoWin->Remove(); } + void CHUDPanel::Close(void) { } + //====================================== // Key inputs for the Class Menu bool CHUDPanel::SlotInput(int iSlot) @@ -564,4 +567,4 @@ void dbgtxt(msstring_ref Text) if (!gViewPort || !gViewPort->m_pHUDPanel) return; ((CHUDPanel*)gViewPort->m_pHUDPanel)->m_DebugText->setText(Text); -} +} \ No newline at end of file diff --git a/game/client/ui/ms/vgui_quickslot.h b/game/client/ui/ms/vgui_quickslot.h index 70407c3a..5abfa228 100644 --- a/game/client/ui/ms/vgui_quickslot.h +++ b/game/client/ui/ms/vgui_quickslot.h @@ -7,7 +7,6 @@ static COLOR Color_Text_QuickSlot_Weapon(255, 255, 255, 0); static COLOR Color_Text_QuickSlot_Spell(120, 255, 255, 0); static COLOR Color_Text_QuickSlot_Arrow(0, 255, 128, 0); -//static COLOR HighColor( 0, 255, 0, 128), MedColor( 255, 255, 0, 128), LowColor( 255, 0, 0, 128); #define QUICKSLOT_PREF_TIMEOUT m_CVARTimeout->value #define QUICKSLOT_WEAPON "weapon" @@ -371,4 +370,4 @@ class VGUI_QuickSlot : public Panel, public IHUD_Interface if (MSCLGlobals::DefaultHUDSounds.QuickSlot_Select) PlayHUDSound(MSCLGlobals::DefaultHUDSounds.QuickSlot_Select, 1.0f); } -}; +}; \ No newline at end of file diff --git a/game/client/ui/vgui_status.h b/game/client/ui/vgui_status.h index 36894b1b..dc8d995a 100644 --- a/game/client/ui/vgui_status.h +++ b/game/client/ui/vgui_status.h @@ -71,16 +71,6 @@ class VGUI_StatusIcon : public Panel float flPercent = 1.0 - (gpGlobals->time - m_Time) / m_Dur; m_pBar->Set(flPercent * 100.0f); m_pBar->SetFGColorRGB(DurColor); - - /* - // Use Different Colors for % left - if( flPercent < 0.15 ) - m_pBar->SetFGColorRGB( LowColor ); - else if( flPercent <= 0.85f ) - m_pBar->SetFGColorRGB( MedColor ); - else - m_pBar->SetFGColorRGB( HighColor ); - */ } // MiB FEB2019_22 - Update duration and reset start time @@ -433,4 +423,4 @@ int __MsgFunc_StatusIcons(const char *pszName, int iSize, void *pbuf) enddbg; return 0; -} +} \ No newline at end of file