From 15058330fa045c7255b53b3e3f9af2571e2e9ca2 Mon Sep 17 00:00:00 2001 From: Learath Date: Sat, 27 Apr 2019 00:47:34 +0300 Subject: [PATCH] Don't inherit from vector, more cleanup --- src/base/color.h | 57 ++++++++++--- src/game/client/components/countryflags.cpp | 2 +- src/game/client/components/countryflags.h | 2 +- src/game/client/components/effects.cpp | 8 +- src/game/client/components/menus.cpp | 81 +++++++++--------- src/game/client/components/menus.h | 18 ++-- src/game/client/components/menus_browser.cpp | 50 +++++------ src/game/client/components/menus_demo.cpp | 24 +++--- src/game/client/components/menus_ingame.cpp | 20 ++--- src/game/client/components/menus_settings.cpp | 18 ++-- src/game/client/components/particles.h | 4 +- src/game/client/components/scoreboard.cpp | 2 +- src/game/client/components/voting.cpp | 8 +- src/game/editor/editor.cpp | 82 +++++++++---------- src/game/editor/editor.h | 8 +- src/game/editor/popups.cpp | 22 ++--- 16 files changed, 221 insertions(+), 185 deletions(-) diff --git a/src/base/color.h b/src/base/color.h index 6c32f244c..6c3743103 100644 --- a/src/base/color.h +++ b/src/base/color.h @@ -12,32 +12,34 @@ Function: RgbToHue Determines the hue from RGB values */ -inline float RgbToHue(vec3 rgb) +inline float RgbToHue(float r, float g, float b) { - float h_min = minimum(rgb.r, rgb.g, rgb.b); - float h_max = maximum(rgb.r, rgb.g, rgb.b); + float h_min = minimum(r, g, b); + float h_max = maximum(r, g, b); float hue = 0.0f; if(h_max != h_min) { float c = h_max - h_min; - if(h_max == rgb.r) - hue = (rgb.g - rgb.b) / c + (rgb.g < rgb.b ? 6 : 0); - else if(h_max == rgb.g) - hue = (rgb.b - rgb.r) / c + 2; + if(h_max == r) + hue = (g - b) / c + (g < b ? 6 : 0); + else if(h_max == g) + hue = (b - r) / c + 2; else - hue = (rgb.r - rgb.g) / c + 4; + hue = (r - g) / c + 4; } return hue / 6.0f; } -class color4_base : public vector3_base +class color4_base { public: - float a; + union { float x, r, h; }; + union { float y, g, s; }; + union { float z, b, l, v; }; + union { float w, a; }; - using vector3_base::vector3_base; color4_base() {} color4_base(const vec4 &v4) @@ -64,6 +66,14 @@ public: a = na; } + color4_base(float nx, float ny, float nz) + { + x = nx; + y = ny; + z = nz; + a = 1.0f; + } + color4_base(unsigned col) { a = ((col >> 24) & 0xFF) / 255.0f; @@ -72,16 +82,29 @@ public: z = ((col >> 0) & 0xFF) / 255.0f; } + vec4 v4() { return vec4(x, y, z, a); }; + unsigned Pack() { return ((unsigned)(a * 255.0f) << 24) + ((unsigned)(x * 255.0f) << 16) + ((unsigned)(y * 255.0f) << 8) + (unsigned)(z * 255.0f); } + + color4_base SetAlpha(float alpha) + { + color4_base col; + col = *this; + col.a = alpha; + return col; + } + }; class ColorHSLA : public color4_base { public: using color4_base::color4_base; + ColorHSLA(color4_base b): color4_base(b) {}; + ColorHSLA Lighten() { ColorHSLA col = *this; @@ -92,12 +115,16 @@ public: class ColorHSVA : public color4_base { +public: using color4_base::color4_base; + ColorHSVA(color4_base b): color4_base(b) {}; }; class ColorRGBA : public color4_base { +public: using color4_base::color4_base; + ColorRGBA(color4_base b): color4_base(b) {}; }; template T color_cast(const F &f) = delete; @@ -109,7 +136,7 @@ inline ColorHSLA color_cast(const ColorRGBA &rgb) float Max = maximum(rgb.r, rgb.g, rgb.b); float c = Max - Min; - float h = RgbToHue(rgb); + float h = RgbToHue(rgb.r, rgb.g, rgb.b); float l = 0.5f * (Max + Min); float s = (Max != 0.0f && Min != 1.0f) ? (c/(1 - (absolute(2 * l - 1)))) : 0; @@ -177,4 +204,10 @@ inline ColorHSVA color_cast(const ColorRGBA &rgb) return color_cast(color_cast(rgb)); } +template +T color_scale(const color4_base &col, float s) +{ + return T(col.x * s, col.y * s, col.z * s, col.a * s); +} + #endif diff --git a/src/game/client/components/countryflags.cpp b/src/game/client/components/countryflags.cpp index 391f7dd32..66675a291 100644 --- a/src/game/client/components/countryflags.cpp +++ b/src/game/client/components/countryflags.cpp @@ -142,7 +142,7 @@ const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(int Index) const return &m_aCountryFlags[maximum(0, Index%m_aCountryFlags.size())]; } -void CCountryFlags::Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h) +void CCountryFlags::Render(int CountryCode, const ColorRGBA *pColor, float x, float y, float w, float h) { const CCountryFlag *pFlag = GetByCountryCode(CountryCode); if(pFlag->m_Texture != -1) diff --git a/src/game/client/components/countryflags.h b/src/game/client/components/countryflags.h index df9348218..92bff2317 100644 --- a/src/game/client/components/countryflags.h +++ b/src/game/client/components/countryflags.h @@ -23,7 +23,7 @@ public: int Num() const; const CCountryFlag *GetByCountryCode(int CountryCode) const; const CCountryFlag *GetByIndex(int Index) const; - void Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h); + void Render(int CountryCode, const ColorRGBA *pColor, float x, float y, float w, float h); private: enum diff --git a/src/game/client/components/effects.cpp b/src/game/client/components/effects.cpp index 70ff39bbd..49c4bfaaf 100644 --- a/src/game/client/components/effects.cpp +++ b/src/game/client/components/effects.cpp @@ -116,7 +116,7 @@ void CEffects::SkidTrail(vec2 Pos, vec2 Vel) p.m_EndSize = 0; p.m_Friction = 0.7f; p.m_Gravity = frandom()*-500.0f; - p.m_Color = vec4(0.75f,0.75f,0.75f,1.0f); + p.m_Color = ColorRGBA(0.75f,0.75f,0.75f,1.0f); m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p); } @@ -152,7 +152,7 @@ void CEffects::PlayerSpawn(vec2 Pos) p.m_Rotspeed = frandom(); p.m_Gravity = frandom()*-400.0f; p.m_Friction = 0.7f; - p.m_Color = vec4(0xb5/255.0f, 0x50/255.0f, 0xcb/255.0f, 1.0f); + p.m_Color = ColorRGBA(0xb5/255.0f, 0x50/255.0f, 0xcb/255.0f, 1.0f); m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p); } @@ -190,8 +190,8 @@ void CEffects::PlayerDeath(vec2 Pos, int ClientID) p.m_Rotspeed = (frandom()-0.5f) * pi; p.m_Gravity = 800.0f; p.m_Friction = 0.8f; - vec3 c = BloodColor * (0.75f + frandom()*0.25f); - p.m_Color = vec4(c.r, c.g, c.b, 0.75f); + ColorRGBA c = BloodColor.v4() * (0.75f + frandom()*0.25f); + p.m_Color = ColorRGBA(c.r, c.g, c.b, 0.75f); m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p); } } diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 47241cc95..6677fcb11 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -37,13 +37,13 @@ #include "skins.h" #include "controls.h" -vec4 CMenus::ms_GuiColor; -vec4 CMenus::ms_ColorTabbarInactiveOutgame; -vec4 CMenus::ms_ColorTabbarActiveOutgame; -vec4 CMenus::ms_ColorTabbarInactive; -vec4 CMenus::ms_ColorTabbarActive = vec4(0,0,0,0.5f); -vec4 CMenus::ms_ColorTabbarInactiveIngame; -vec4 CMenus::ms_ColorTabbarActiveIngame; +ColorRGBA CMenus::ms_GuiColor; +ColorRGBA CMenus::ms_ColorTabbarInactiveOutgame; +ColorRGBA CMenus::ms_ColorTabbarActiveOutgame; +ColorRGBA CMenus::ms_ColorTabbarInactive; +ColorRGBA CMenus::ms_ColorTabbarActive = ColorRGBA(0,0,0,0.5f); +ColorRGBA CMenus::ms_ColorTabbarInactiveIngame; +ColorRGBA CMenus::ms_ColorTabbarActiveIngame; float CMenus::ms_ButtonHeight = 25.0f; float CMenus::ms_ListheaderHeight = 17.0f; @@ -84,13 +84,13 @@ CMenus::CMenus() m_Dummy = false; } -vec4 CMenus::ButtonColorMul(const void *pID) +float CMenus::ButtonColorMul(const void *pID) { if(UI()->ActiveItem() == pID) - return vec4(1,1,1,0.5f); + return 0.5f; else if(UI()->HotItem() == pID) - return vec4(1,1,1,1.5f); - return vec4(1,1,1,1); + return 1.5f; + return 1; } int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect) @@ -145,7 +145,7 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect) { - RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(pRect, ColorRGBA(1,1,1,0.5f * ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f); CUIRect Temp; pRect->HMargin(pRect->h>=20.0f?2.0f:1.0f, &Temp); UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0); @@ -154,7 +154,7 @@ int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const void CMenus::DoButton_KeySelect(const void *pID, const char *pText, int Checked, const CUIRect *pRect) { - RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(pRect, ColorRGBA(1,1,1,0.5f * ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f); CUIRect Temp; pRect->HMargin(1.0f, &Temp); UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0); @@ -176,7 +176,7 @@ int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, co int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect) { if(Checked) - RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect(pRect, ColorRGBA(1,1,1,0.5f), CUI::CORNER_T, 5.0f); CUIRect t; pRect->VSplitLeft(5.0f, 0, &t); UI()->DoLabel(&t, pText, pRect->h*ms_FontmodHeight, -1); @@ -193,7 +193,7 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c t.VSplitLeft(5.0f, 0, &t); c.Margin(2.0f, &c); - RenderTools()->DrawUIRect(&c, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 3.0f); + RenderTools()->DrawUIRect(&c, ColorRGBA(1,1,1,0.25f * ButtonColorMul(pID)), CUI::CORNER_ALL, 3.0f); TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT); bool CheckAble = *pBoxText == 'X'; @@ -336,7 +336,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS } CUIRect Textbox = *pRect; - RenderTools()->DrawUIRect(&Textbox, vec4(1, 1, 1, 0.5f), Corners, 3.0f); + RenderTools()->DrawUIRect(&Textbox, ColorRGBA(1, 1, 1, 0.5f), Corners, 3.0f); Textbox.VMargin(2.0f, &Textbox); Textbox.HMargin(2.0f, &Textbox); @@ -452,7 +452,7 @@ int CMenus::DoClearableEditBox(void *pID, void *pClearID, const CUIRect *pRect, ReturnValue = true; } - RenderTools()->DrawUIRect(&ClearButton, vec4(1, 1, 1, 0.33f) * ButtonColorMul(pClearID), Corners&~CUI::CORNER_L, 3.0f); + RenderTools()->DrawUIRect(&ClearButton, ColorRGBA(1, 1, 1, 0.33f * ButtonColorMul(pID)), Corners&~CUI::CORNER_L, 3.0f); UI()->DoLabel(&ClearButton, "×", ClearButton.h * ms_FontmodHeight, 0); if(UI()->DoButtonLogic(pClearID, "×", 0, &ClearButton)) { @@ -505,17 +505,17 @@ float CMenus::DoScrollbarV(const void *pID, const CUIRect *pRect, float Current) // render CUIRect Rail; pRect->VMargin(5.0f, &Rail); - RenderTools()->DrawUIRect(&Rail, vec4(1,1,1,0.25f), 0, 0.0f); + RenderTools()->DrawUIRect(&Rail, ColorRGBA(1,1,1,0.25f), 0, 0.0f); CUIRect Slider = Handle; Slider.w = Rail.x-Slider.x; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_L, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_L, 2.5f); Slider.x = Rail.x+Rail.w; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_R, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_R, 2.5f); Slider = Handle; Slider.Margin(5.0f, &Slider); - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f*ButtonColorMul(pID)), CUI::CORNER_ALL, 2.5f); return ReturnValue; } @@ -564,17 +564,17 @@ float CMenus::DoScrollbarH(const void *pID, const CUIRect *pRect, float Current) // render CUIRect Rail; pRect->HMargin(5.0f, &Rail); - RenderTools()->DrawUIRect(&Rail, vec4(1,1,1,0.25f), 0, 0.0f); + RenderTools()->DrawUIRect(&Rail, ColorRGBA(1,1,1,0.25f), 0, 0.0f); CUIRect Slider = Handle; Slider.h = Rail.y-Slider.y; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_T, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 2.5f); Slider.y = Rail.y+Rail.h; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_B, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_B, 2.5f); Slider = Handle; Slider.Margin(5.0f, &Slider); - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f * ButtonColorMul(pID)), CUI::CORNER_ALL, 2.5f); return ReturnValue; } @@ -840,8 +840,9 @@ void CMenus::RenderLoading() LastLoadRender = time_get(); // need up date this here to get correct - ColorRGBA Rgb = color_cast(ColorHSLA(g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, g_Config.m_UiColorLht/255.0f)); - ms_GuiColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_UiColorAlpha/255.0f); + ms_GuiColor = color_cast(ColorHSLA( + g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, + g_Config.m_UiColorLht/255.0f, g_Config.m_UiColorAlpha/255.0f)); CUIRect Screen = *UI()->Screen(); Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h); @@ -1154,7 +1155,7 @@ int CMenus::Render() Box.HMargin(150.0f/UI()->Scale(), &Box); // render the box - RenderTools()->DrawUIRect(&Box, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); + RenderTools()->DrawUIRect(&Box, ColorRGBA(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box); Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box); @@ -1345,9 +1346,9 @@ int CMenus::Render() Box.HSplitTop(20.f, 0, &Box); Box.HSplitTop(24.f, &Part, &Box); Part.VMargin(40.0f, &Part); - RenderTools()->DrawUIRect(&Part, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&Part, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 5.0f); Part.w = maximum(10.0f, (Part.w*Client()->MapDownloadAmount())/Client()->MapDownloadTotalsize()); - RenderTools()->DrawUIRect(&Part, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&Part, ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 5.0f); } } else if(m_Popup == POPUP_LANGUAGE) @@ -1400,7 +1401,7 @@ int CMenus::Render() float OldWidth = Item.m_Rect.w; Item.m_Rect.w = Item.m_Rect.h*2; Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f; - vec4 Color(1.0f, 1.0f, 1.0f, 1.0f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); m_pClient->m_pCountryFlags->Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h); UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0); } @@ -1759,21 +1760,22 @@ void CMenus::OnRender() } // update colors - ColorRGBA Rgb = color_cast(ColorHSLA(g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, g_Config.m_UiColorLht/255.0f)); - ms_GuiColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_UiColorAlpha/255.0f); + ms_GuiColor = color_cast(ColorHSLA( + g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, + g_Config.m_UiColorLht/255.0f, g_Config.m_UiColorAlpha/255.0f)); - ms_ColorTabbarInactiveOutgame = vec4(0,0,0,0.25f); - ms_ColorTabbarActiveOutgame = vec4(0,0,0,0.5f); + ms_ColorTabbarInactiveOutgame = ColorRGBA(0,0,0,0.25f); + ms_ColorTabbarActiveOutgame = ColorRGBA(0,0,0,0.5f); float ColorIngameScaleI = 0.5f; float ColorIngameAcaleA = 0.2f; - ms_ColorTabbarInactiveIngame = vec4( + ms_ColorTabbarInactiveIngame = ColorRGBA( ms_GuiColor.r*ColorIngameScaleI, ms_GuiColor.g*ColorIngameScaleI, ms_GuiColor.b*ColorIngameScaleI, ms_GuiColor.a*0.8f); - ms_ColorTabbarActiveIngame = vec4( + ms_ColorTabbarActiveIngame = ColorRGBA( ms_GuiColor.r*ColorIngameAcaleA, ms_GuiColor.g*ColorIngameAcaleA, ms_GuiColor.b*ColorIngameAcaleA, @@ -1904,8 +1906,9 @@ void CMenus::RenderUpdating(const char *pCaption, int current, int total) LastLoadRender = time_get(); // need up date this here to get correct - ColorRGBA Rgb = color_cast(ColorHSLA(g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, g_Config.m_UiColorLht/255.0f)); - ms_GuiColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_UiColorAlpha/255.0f); + ms_GuiColor = color_cast(ColorHSLA( + g_Config.m_UiColorHue/255.0f, g_Config.m_UiColorSat/255.0f, + g_Config.m_UiColorLht/255.0f, g_Config.m_UiColorAlpha/255.0f)); CUIRect Screen = *UI()->Screen(); Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h); diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index c8cee17e5..fed185af9 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -27,15 +27,15 @@ public: class CMenus : public CComponent { - static vec4 ms_GuiColor; - static vec4 ms_ColorTabbarInactiveOutgame; - static vec4 ms_ColorTabbarActiveOutgame; - static vec4 ms_ColorTabbarInactiveIngame; - static vec4 ms_ColorTabbarActiveIngame; - static vec4 ms_ColorTabbarInactive; - static vec4 ms_ColorTabbarActive; + static ColorRGBA ms_GuiColor; + static ColorRGBA ms_ColorTabbarInactiveOutgame; + static ColorRGBA ms_ColorTabbarActiveOutgame; + static ColorRGBA ms_ColorTabbarInactiveIngame; + static ColorRGBA ms_ColorTabbarActiveIngame; + static ColorRGBA ms_ColorTabbarInactive; + static ColorRGBA ms_ColorTabbarActive; - vec4 ButtonColorMul(const void *pID); + float ButtonColorMul(const void *pID); int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect); @@ -366,7 +366,7 @@ public: CGhostItem() : m_Slot(-1), m_Own(false) { m_aFilename[0] = 0; } bool operator<(const CGhostItem &Other) { return m_Time < Other.m_Time; } - + bool Active() const { return m_Slot != -1; } bool HasFile() const { return m_aFilename[0]; } }; diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 6b3bee5cd..6c4acbfe6 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -31,7 +31,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) View.HSplitBottom(28.0f, &View, &Status); // split of the scrollbar - RenderTools()->DrawUIRect(&Headers, vec4(1,1,1,0.25f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect(&Headers, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 5.0f); Headers.VSplitRight(20.0f, &Headers, 0); struct CColumn @@ -125,7 +125,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) } } - RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.15f), 0, 0); + RenderTools()->DrawUIRect(&View, ColorRGBA(0,0,0,0.15f), 0, 0); CUIRect Scroll; View.VSplitRight(15, &View, &Scroll); @@ -280,7 +280,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) { CUIRect r = Row; r.Margin(0.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); } // clip the selection @@ -478,7 +478,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) Client()->Connect(g_Config.m_UiServerAddress); } - RenderTools()->DrawUIRect(&Status, vec4(1,1,1,0.25f), CUI::CORNER_B, 5.0f); + RenderTools()->DrawUIRect(&Status, ColorRGBA(1,1,1,0.25f), CUI::CORNER_B, 5.0f); Status.Margin(5.0f, &Status); CUIRect QuickSearch, QuickExclude, Button, Status2, Status3; @@ -540,8 +540,8 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) // server filter ServerFilter.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFilter); - RenderTools()->DrawUIRect(&FilterHeader, vec4(1,1,1,0.25f), CUI::CORNER_T, 4.0f); - RenderTools()->DrawUIRect(&ServerFilter, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f); + RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 4.0f); + RenderTools()->DrawUIRect(&ServerFilter, ColorRGBA(0,0,0,0.15f), CUI::CORNER_B, 4.0f); UI()->DoLabelScaled(&FilterHeader, Localize("Server filter"), FontSize+2.0f, 0); CUIRect Button, Button2; @@ -631,7 +631,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) float OldWidth = Rect.w; Rect.w = Rect.h*2; Rect.x += (OldWidth-Rect.w)/2.0f; - vec4 Color(1.0f, 1.0f, 1.0f, g_Config.m_BrFilterCountry?1.0f: 0.5f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, g_Config.m_BrFilterCountry?1.0f: 0.5f); m_pClient->m_pCountryFlags->Render(g_Config.m_BrFilterCountryIndex, &Color, Rect.x, Rect.y, Rect.w, Rect.h); if(g_Config.m_BrFilterCountry && UI()->DoButtonLogic(&g_Config.m_BrFilterCountryIndex, "", 0, &Rect)) @@ -844,7 +844,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) ServerBrowser()->Refresh(ServerBrowser()->GetCurrentType()); } - vec4 Color(1.0f, 1.0f, 1.0f, 1.0f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); if(!Active) Color.a = 0.2f; @@ -897,8 +897,8 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View) CTextCursor Cursor; const float FontSize = 12.0f; ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails); - RenderTools()->DrawUIRect(&ServerHeader, vec4(1,1,1,0.25f), CUI::CORNER_T, 4.0f); - RenderTools()->DrawUIRect(&ServerDetails, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f); + RenderTools()->DrawUIRect(&ServerHeader, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 4.0f); + RenderTools()->DrawUIRect(&ServerDetails, ColorRGBA(0,0,0,0.15f), CUI::CORNER_B, 4.0f); UI()->DoLabelScaled(&ServerHeader, Localize("Server details"), FontSize+2.0f, 0); if(pSelectedServer) @@ -986,10 +986,10 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View) Client()->ServerBrowserUpdate(); } - vec4 Colour = pSelectedServer->m_aClients[i].m_FriendState == IFriends::FRIEND_NO ? - vec4(1.0f, 1.0f, 1.0f, (i%2+1)*0.05f) : - vec4(0.5f, 1.0f, 0.5f, 0.15f+(i%2+1)*0.05f); - RenderTools()->DrawUIRect(&Name, Colour, CUI::CORNER_ALL, 4.0f); + ColorRGBA Color = pSelectedServer->m_aClients[i].m_FriendState == IFriends::FRIEND_NO ? + ColorRGBA(1.0f, 1.0f, 1.0f, (i%2+1)*0.05f) : + ColorRGBA(0.5f, 1.0f, 0.5f, 0.15f+(i%2+1)*0.05f); + RenderTools()->DrawUIRect(&Name, Color, CUI::CORNER_ALL, 4.0f); Name.VSplitLeft(5.0f, 0, &Name); Name.VSplitLeft(34.0f, &Score, &Name); Name.VSplitRight(34.0f, &Name, &Flag); @@ -1065,8 +1065,8 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View) TextRender()->TextEx(&Cursor, pClan, -1); // flag - vec4 Color(1.0f, 1.0f, 1.0f, 0.5f); - m_pClient->m_pCountryFlags->Render(pSelectedServer->m_aClients[i].m_Country, &Color, Flag.x, Flag.y, Flag.w, Flag.h); + ColorRGBA FColor(1.0f, 1.0f, 1.0f, 0.5f); + m_pClient->m_pCountryFlags->Render(pSelectedServer->m_aClients[i].m_Country, &FColor, Flag.x, Flag.y, Flag.w, Flag.h); } UiDoListboxEnd(&s_ScrollValue, 0); @@ -1100,8 +1100,8 @@ void CMenus::RenderServerbrowserFriends(CUIRect View) // header ServerFriends.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFriends); - RenderTools()->DrawUIRect(&FilterHeader, vec4(1,1,1,0.25f), CUI::CORNER_T, 4.0f); - RenderTools()->DrawUIRect(&ServerFriends, vec4(0,0,0,0.15f), 0, 4.0f); + RenderTools()->DrawUIRect(&FilterHeader, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 4.0f); + RenderTools()->DrawUIRect(&ServerFriends, ColorRGBA(0,0,0,0.15f), 0, 4.0f); UI()->DoLabelScaled(&FilterHeader, Localize("Friends"), FontSize+4.0f, 0); CUIRect Button, List; @@ -1125,14 +1125,14 @@ void CMenus::RenderServerbrowserFriends(CUIRect View) Item.m_Rect.Margin(1.5f, &Item.m_Rect); CUIRect OnState; Item.m_Rect.VSplitRight(30.0f, &Item.m_Rect, &OnState); - RenderTools()->DrawUIRect(&Item.m_Rect, vec4(1.0f, 1.0f, 1.0f, 0.1f), CUI::CORNER_L, 4.0f); + RenderTools()->DrawUIRect(&Item.m_Rect, ColorRGBA(1.0f, 1.0f, 1.0f, 0.1f), CUI::CORNER_L, 4.0f); Item.m_Rect.VMargin(2.5f, &Item.m_Rect); Item.m_Rect.HSplitTop(12.0f, &Item.m_Rect, &Button); UI()->DoLabelScaled(&Item.m_Rect, m_lFriends[i].m_pFriendInfo->m_aName, FontSize, -1); UI()->DoLabelScaled(&Button, m_lFriends[i].m_pFriendInfo->m_aClan, FontSize, -1); - RenderTools()->DrawUIRect(&OnState, m_lFriends[i].m_NumFound ? vec4(0.0f, 1.0f, 0.0f, 0.25f) : vec4(1.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_R, 4.0f); + RenderTools()->DrawUIRect(&OnState, m_lFriends[i].m_NumFound ? ColorRGBA(0.0f, 1.0f, 0.0f, 0.25f) : ColorRGBA(1.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_R, 4.0f); OnState.HMargin((OnState.h-FontSize)/3, &OnState); OnState.VMargin(5.0f, &OnState); char aBuf[64]; @@ -1256,10 +1256,10 @@ void CMenus::RenderServerbrowser(CUIRect MainView) TabBar.HSplitTop(20.0f, &TabButton1, &TabBar); TabBar.HSplitTop(2.5f, 0, &TabBar); TabBar.HSplitTop(20.0f, &TabButton2, 0); - vec4 Active = ms_ColorTabbarActive; - vec4 InActive = ms_ColorTabbarInactive; - ms_ColorTabbarActive = vec4(0.0f, 0.0f, 0.0f, 0.3f); - ms_ColorTabbarInactive = vec4(0.0f, 0.0f, 0.0f, 0.15f); + ColorRGBA Active = ms_ColorTabbarActive; + ColorRGBA InActive = ms_ColorTabbarInactive; + ms_ColorTabbarActive = ColorRGBA(0.0f, 0.0f, 0.0f, 0.3f); + ms_ColorTabbarInactive = ColorRGBA(0.0f, 0.0f, 0.0f, 0.15f); static int s_FiltersTab = 0; if(DoButton_MenuTab(&s_FiltersTab, Localize("Filter"), ToolboxPage==0, &TabButton0, CUI::CORNER_L)) @@ -1280,7 +1280,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView) // tool box { - RenderTools()->DrawUIRect(&ToolBox, vec4(0.0f, 0.0f, 0.0f, 0.15f), CUI::CORNER_T, 4.0f); + RenderTools()->DrawUIRect(&ToolBox, ColorRGBA(0.0f, 0.0f, 0.0f, 0.15f), CUI::CORNER_T, 4.0f); if(ToolboxPage == 0) diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index f6361c4a6..7cdfdf482 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -25,14 +25,14 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect) { - RenderTools()->DrawUIRect(pRect, vec4(1,1,1, Checked ? 0.10f : 0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(pRect, ColorRGBA(1,1,1, (Checked ? 0.10f : 0.5f)*ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f); UI()->DoLabel(pRect, pText, 14.0f, 0); return UI()->DoButtonLogic(pID, pText, Checked, pRect); } int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners) { - RenderTools()->DrawUIRect(pRect, Checked ? vec4(1.0f, 1.0f, 1.0f, 0.10f) : vec4(1.0f, 1.0f, 1.0f, 0.5f)*ButtonColorMul(pID), Corners, 5.0f); + RenderTools()->DrawUIRect(pRect, ColorRGBA(1.0f, 1.0f, 1.0f, (Checked ? 0.10f : 0.5f)*ButtonColorMul(pID)), Corners, 5.0f); Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id); Graphics()->QuadsBegin(); if(!Checked) @@ -84,7 +84,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) Box.HMargin(150.0f/UI()->Scale(), &Box); // render the box - RenderTools()->DrawUIRect(&Box, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); + RenderTools()->DrawUIRect(&Box, ColorRGBA(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box); Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box); @@ -271,13 +271,13 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) char aBuffer[128]; // draw seek bar - RenderTools()->DrawUIRect(&SeekBar, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&SeekBar, ColorRGBA(0,0,0,0.5f), CUI::CORNER_ALL, 5.0f); // draw filled bar float Amount = CurrentTick/(float)TotalTicks; CUIRect FilledBar = SeekBar; FilledBar.w = 10.0f + (FilledBar.w-10.0f)*Amount; - RenderTools()->DrawUIRect(&FilledBar, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&FilledBar, ColorRGBA(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f); // draw markers for(int i = 0; i < pInfo->m_NumTimelineMarkers; i++) @@ -511,17 +511,17 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe // draw header View.HSplitTop(ms_ListheaderHeight, &Header, &View); - RenderTools()->DrawUIRect(&Header, vec4(1,1,1,0.25f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect(&Header, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 5.0f); UI()->DoLabel(&Header, pTitle, Header.h*ms_FontmodHeight, 0); // draw footers View.HSplitBottom(ms_ListheaderHeight, &View, &Footer); - RenderTools()->DrawUIRect(&Footer, vec4(1,1,1,0.25f), CUI::CORNER_B, 5.0f); + RenderTools()->DrawUIRect(&Footer, ColorRGBA(1,1,1,0.25f), CUI::CORNER_B, 5.0f); Footer.VSplitLeft(10.0f, 0, &Footer); UI()->DoLabel(&Footer, pBottomText, Header.h*ms_FontmodHeight, 0); // background - RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.15f), 0, 0); + RenderTools()->DrawUIRect(&View, ColorRGBA(0,0,0,0.15f), 0, 0); // prepare the scroll View.VSplitRight(15, &View, &Scroll); @@ -698,7 +698,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected, //selected_index = i; CUIRect r = Item.m_Rect; r.Margin(1.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); } return Item; @@ -856,7 +856,7 @@ void CMenus::RenderDemoList(CUIRect MainView) // render demo info MainView.VMargin(5.0f, &MainView); MainView.HSplitBottom(5.0f, &MainView, 0); - RenderTools()->DrawUIRect(&MainView, vec4(0,0,0,0.15f), CUI::CORNER_B, 4.0f); + RenderTools()->DrawUIRect(&MainView, ColorRGBA(0,0,0,0.15f), CUI::CORNER_B, 4.0f); if(!m_DemolistSelectedIsDir && m_DemolistSelectedIndex >= 0 && m_lDemos[m_DemolistSelectedIndex].m_Valid) { CUIRect Left, Right, Labels; @@ -967,7 +967,7 @@ void CMenus::RenderDemoList(CUIRect MainView) {COL_DATE, SORT_DATE, Localize("Date"), 1, 160.0f, 1, {0}, {0}}, }; - RenderTools()->DrawUIRect(&Headers, vec4(0.0f,0,0,0.15f), 0, 0); + RenderTools()->DrawUIRect(&Headers, ColorRGBA(0.0f,0,0,0.15f), 0, 0); int NumCols = sizeof(s_aCols)/sizeof(CColumn); @@ -1120,7 +1120,7 @@ void CMenus::RenderDemoList(CUIRect MainView) { CUIRect r = Row; r.Margin(1.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); } // clip the selection diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 582e66f1c..729d0760c 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -163,7 +163,7 @@ void CMenus::RenderPlayers(CUIRect MainView) // player options MainView.Margin(10.0f, &Options); - RenderTools()->DrawUIRect(&Options, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&Options, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); Options.Margin(10.0f, &Options); Options.HSplitTop(50.0f, &Button, &Options); UI()->DoLabelScaled(&Button, Localize("Player options"), 34.0f, -1); @@ -234,7 +234,7 @@ void CMenus::RenderPlayers(CUIRect MainView) continue; if(Count%2 == 1) - RenderTools()->DrawUIRect(&Item.m_Rect, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&Item.m_Rect, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); Item.m_Rect.VSplitRight(300.0f, &Player, &Item.m_Rect); // player info @@ -257,7 +257,7 @@ void CMenus::RenderPlayers(CUIRect MainView) //TextRender()->SetCursor(&Cursor, Button2.x,Button2.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); //Cursor.m_LineWidth = Button.w; - vec4 Color(1.0f, 1.0f, 1.0f, 0.5f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f); m_pClient->m_pCountryFlags->Render(m_pClient->m_aClients[Index].m_Country, &Color, Button2.x, Button2.y + Button2.h/2.0f - 0.75*Button2.h/2.0f, 1.5f*Button2.h, 0.75f*Button2.h); @@ -364,7 +364,7 @@ void CMenus::RenderServerInfo(CUIRect MainView) // serverinfo View.HSplitTop(View.h/2/UI()->Scale()-5.0f, &ServerInfo, &Motd); ServerInfo.VSplitLeft(View.w/2/UI()->Scale()-5.0f, &ServerInfo, &GameInfo); - RenderTools()->DrawUIRect(&ServerInfo, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&ServerInfo, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); ServerInfo.Margin(5.0f, &ServerInfo); @@ -408,7 +408,7 @@ void CMenus::RenderServerInfo(CUIRect MainView) // gameinfo GameInfo.VSplitLeft(10.0f, 0x0, &GameInfo); - RenderTools()->DrawUIRect(&GameInfo, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&GameInfo, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); GameInfo.Margin(5.0f, &GameInfo); @@ -442,7 +442,7 @@ void CMenus::RenderServerInfo(CUIRect MainView) // motd Motd.HSplitTop(10.0f, 0, &Motd); - RenderTools()->DrawUIRect(&Motd, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&Motd, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); Motd.Margin(5.0f, &Motd); y = 0.0f; x = 5.0f; @@ -906,7 +906,7 @@ void CMenus::RenderGhost(CUIRect MainView) View.HSplitBottom(28.0f, &View, &Status); // split of the scrollbar - RenderTools()->DrawUIRect(&Headers, vec4(1,1,1,0.25f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect(&Headers, ColorRGBA(1,1,1,0.25f), CUI::CORNER_T, 5.0f); Headers.VSplitRight(20.0f, &Headers, 0); struct CColumn @@ -947,7 +947,7 @@ void CMenus::RenderGhost(CUIRect MainView) for(int i = 0; i < NumCols; i++) DoButton_GridHeader(s_aCols[i].m_Caption, s_aCols[i].m_Caption, 0, &s_aCols[i].m_Rect); - RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.15f), 0, 0); + RenderTools()->DrawUIRect(&View, ColorRGBA(0,0,0,0.15f), 0, 0); CUIRect Scroll; View.VSplitRight(15, &View, &Scroll); @@ -1031,7 +1031,7 @@ void CMenus::RenderGhost(CUIRect MainView) { CUIRect r = Row; r.Margin(1.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); } // clip the selection @@ -1106,7 +1106,7 @@ void CMenus::RenderGhost(CUIRect MainView) if(NewSelected != -1) s_SelectedIndex = NewSelected; - RenderTools()->DrawUIRect(&Status, vec4(1,1,1,0.25f), CUI::CORNER_B, 5.0f); + RenderTools()->DrawUIRect(&Status, ColorRGBA(1,1,1,0.25f), CUI::CORNER_B, 5.0f); Status.Margin(5.0f, &Status); CUIRect Button; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index ccdca6209..a50f915cf 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -341,7 +341,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) float OldWidth = Item.m_Rect.w; Item.m_Rect.w = Item.m_Rect.h*2; Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f; - vec4 Color(1.0f, 1.0f, 1.0f, 1.0f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); m_pClient->m_pCountryFlags->Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h); if(pEntry->m_Texture != -1) UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0); @@ -462,7 +462,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) MainView.HSplitTop(50.0f, &Label, &MainView); Label.VSplitLeft(230.0f, &Label, 0); - RenderTools()->DrawUIRect(&Label, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&Label, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->RenderTee(CAnimState::GetIdle(), &OwnSkinInfo, 0, vec2(1, 0), vec2(Label.x+30.0f, Label.y+28.0f)); Label.VSplitLeft(70.0f, 0, &Label); UI()->DoLabelScaled(&Label, Skin, 14.0f, -1, 150.0f); @@ -787,7 +787,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { MovementSettings.VMargin(5.0f, &MovementSettings); MovementSettings.HSplitTop(515.0f, &MovementSettings, &WeaponSettings); - RenderTools()->DrawUIRect(&MovementSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); MovementSettings.VMargin(10.0f, &MovementSettings); TextRender()->Text(0, MovementSettings.x, MovementSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Movement"), -1); @@ -828,7 +828,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { WeaponSettings.HSplitTop(10.0f, 0, &WeaponSettings); WeaponSettings.HSplitTop(190.0f, &WeaponSettings, &ResetButton); - RenderTools()->DrawUIRect(&WeaponSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&WeaponSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); WeaponSettings.VMargin(10.0f, &WeaponSettings); TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Weapon"), -1); @@ -841,7 +841,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { ResetButton.HSplitTop(10.0f, 0, &ResetButton); ResetButton.HSplitTop(40.0f, &ResetButton, 0); - RenderTools()->DrawUIRect(&ResetButton, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&ResetButton, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); ResetButton.HMargin(10.0f, &ResetButton); ResetButton.VMargin(30.0f, &ResetButton); ResetButton.HSplitTop(20.0f, &ResetButton, 0); @@ -854,7 +854,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { VotingSettings.VMargin(5.0f, &VotingSettings); VotingSettings.HSplitTop(80.0f, &VotingSettings, &ChatSettings); - RenderTools()->DrawUIRect(&VotingSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&VotingSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); VotingSettings.VMargin(10.0f, &VotingSettings); TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Voting"), -1); @@ -867,7 +867,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { ChatSettings.HSplitTop(10.0f, 0, &ChatSettings); ChatSettings.HSplitTop(125.0f, &ChatSettings, &MiscSettings); - RenderTools()->DrawUIRect(&ChatSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&ChatSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); ChatSettings.VMargin(10.0f, &ChatSettings); TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Chat"), -1); @@ -880,7 +880,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView) { MiscSettings.HSplitTop(10.0f, 0, &MiscSettings); MiscSettings.HSplitTop(300.0f, &MiscSettings, 0); - RenderTools()->DrawUIRect(&MiscSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); + RenderTools()->DrawUIRect(&MiscSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); MiscSettings.VMargin(10.0f, &MiscSettings); TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1); @@ -1329,7 +1329,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView) Item.m_Rect.VSplitLeft(Item.m_Rect.h*2.0f, &Rect, &Item.m_Rect); Rect.VMargin(6.0f, &Rect); Rect.HMargin(3.0f, &Rect); - vec4 Color(1.0f, 1.0f, 1.0f, 1.0f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); m_pClient->m_pCountryFlags->Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h); Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect); UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1); diff --git a/src/game/client/components/particles.h b/src/game/client/components/particles.h index 40a9c9bd6..b20a6013d 100644 --- a/src/game/client/components/particles.h +++ b/src/game/client/components/particles.h @@ -19,7 +19,7 @@ struct CParticle m_Gravity = 0; m_Friction = 0; m_FlowAffected = 1.0f; - m_Color = vec4(1,1,1,1); + m_Color = ColorRGBA(1,1,1,1); } vec2 m_Pos; @@ -40,7 +40,7 @@ struct CParticle float m_Gravity; float m_Friction; - vec4 m_Color; + ColorRGBA m_Color; // set by the particle system float m_Life; diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index cf973d535..d76532cf3 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -492,7 +492,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); // country flag - vec4 Color(1.0f, 1.0f, 1.0f, 0.5f); + ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f); m_pClient->m_pCountryFlags->Render(m_pClient->m_aClients[pInfo->m_ClientID].m_Country, &Color, CountryOffset, y+(Spacing+TeeSizeMod*5.0f)/2.0f, CountryLength, LineHeight-Spacing-TeeSizeMod*5.0f); diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index 92a19bc14..6472ab4d5 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -282,13 +282,13 @@ void CVoting::OnRender() void CVoting::RenderBars(CUIRect Bars, bool Text) { - RenderTools()->DrawUIRect(&Bars, vec4(0.8f,0.8f,0.8f,0.5f), CUI::CORNER_ALL, Bars.h/3); + RenderTools()->DrawUIRect(&Bars, ColorRGBA(0.8f,0.8f,0.8f,0.5f), CUI::CORNER_ALL, Bars.h/3); CUIRect Splitter = Bars; Splitter.x = Splitter.x+Splitter.w/2; Splitter.w = Splitter.h/2.0f; Splitter.x -= Splitter.w/2; - RenderTools()->DrawUIRect(&Splitter, vec4(0.4f,0.4f,0.4f,0.5f), CUI::CORNER_ALL, Splitter.h/4); + RenderTools()->DrawUIRect(&Splitter, ColorRGBA(0.4f,0.4f,0.4f,0.5f), CUI::CORNER_ALL, Splitter.h/4); if(m_Total) { @@ -297,7 +297,7 @@ void CVoting::RenderBars(CUIRect Bars, bool Text) { CUIRect YesArea = Bars; YesArea.w *= m_Yes/(float)m_Total; - RenderTools()->DrawUIRect(&YesArea, vec4(0.2f,0.9f,0.2f,0.85f), CUI::CORNER_ALL, Bars.h/3); + RenderTools()->DrawUIRect(&YesArea, ColorRGBA(0.2f,0.9f,0.2f,0.85f), CUI::CORNER_ALL, Bars.h/3); if(Text) { @@ -315,7 +315,7 @@ void CVoting::RenderBars(CUIRect Bars, bool Text) CUIRect NoArea = Bars; NoArea.w *= m_No/(float)m_Total; NoArea.x = (Bars.x + Bars.w)-NoArea.w; - RenderTools()->DrawUIRect(&NoArea, vec4(0.9f,0.2f,0.2f,0.85f), CUI::CORNER_ALL, Bars.h/3); + RenderTools()->DrawUIRect(&NoArea, ColorRGBA(0.9f,0.2f,0.2f,0.85f), CUI::CORNER_ALL, Bars.h/3); if(Text) { diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 51dddb1d4..f8e7c9c3e 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -436,7 +436,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str UI()->SetHotItem(pID); CUIRect Textbox = *pRect; - RenderTools()->DrawUIRect(&Textbox, vec4(1, 1, 1, 0.5f), Corners, 3.0f); + RenderTools()->DrawUIRect(&Textbox, ColorRGBA(1, 1, 1, 0.5f), Corners, 3.0f); Textbox.VMargin(2.0f, &Textbox); const char *pDisplayStr = pStr; @@ -498,13 +498,13 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str return ReturnValue; } -vec4 CEditor::ButtonColorMul(const void *pID) +float CEditor::ButtonColorMul(const void *pID) { if(UI()->ActiveItem() == pID) - return vec4(1,1,1,0.5f); + return 0.5f; else if(UI()->HotItem() == pID) - return vec4(1,1,1,1.5f); - return vec4(1,1,1,1); + return 1.5f; + return 1.0f; } float CEditor::UiDoScrollbarV(const void *pID, const CUIRect *pRect, float Current) @@ -546,67 +546,67 @@ float CEditor::UiDoScrollbarV(const void *pID, const CUIRect *pRect, float Curre // render CUIRect Rail; pRect->VMargin(5.0f, &Rail); - RenderTools()->DrawUIRect(&Rail, vec4(1,1,1,0.25f), 0, 0.0f); + RenderTools()->DrawUIRect(&Rail, ColorRGBA(1,1,1,0.25f), 0, 0.0f); CUIRect Slider = Handle; Slider.w = Rail.x-Slider.x; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_L, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_L, 2.5f); Slider.x = Rail.x+Rail.w; - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f), CUI::CORNER_R, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f), CUI::CORNER_R, 2.5f); Slider = Handle; Slider.Margin(5.0f, &Slider); - RenderTools()->DrawUIRect(&Slider, vec4(1,1,1,0.25f)*ButtonColorMul(pID), CUI::CORNER_ALL, 2.5f); + RenderTools()->DrawUIRect(&Slider, ColorRGBA(1,1,1,0.25f * ButtonColorMul(pID)), CUI::CORNER_ALL, 2.5f); return Ret; } -vec4 CEditor::GetButtonColor(const void *pID, int Checked) +ColorRGBA CEditor::GetButtonColor(const void *pID, int Checked) { if(Checked < 0) - return vec4(0,0,0,0.5f); + return ColorRGBA(0,0,0,0.5f); switch(Checked) { case 7: // selected + game layers if(UI()->HotItem() == pID) - return vec4(1,0,0,0.4f); - return vec4(1,0,0,0.2f); + return ColorRGBA(1,0,0,0.4f); + return ColorRGBA(1,0,0,0.2f); case 6: // game layers if(UI()->HotItem() == pID) - return vec4(1,1,1,0.4f); - return vec4(1,1,1,0.2f); + return ColorRGBA(1,1,1,0.4f); + return ColorRGBA(1,1,1,0.2f); case 5: // selected + image/sound should be embedded if(UI()->HotItem() == pID) - return vec4(1,0,0,0.75f); - return vec4(1,0,0,0.5f); + return ColorRGBA(1,0,0,0.75f); + return ColorRGBA(1,0,0,0.5f); case 4: // image/sound should be embedded if(UI()->HotItem() == pID) - return vec4(1,0,0,1.0f); - return vec4(1,0,0,0.875f); + return ColorRGBA(1,0,0,1.0f); + return ColorRGBA(1,0,0,0.875f); case 3: // selected + unused image/sound if(UI()->HotItem() == pID) - return vec4(1,0,1,0.75f); - return vec4(1,0,1,0.5f); + return ColorRGBA(1,0,1,0.75f); + return ColorRGBA(1,0,1,0.5f); case 2: // unused image/sound if(UI()->HotItem() == pID) - return vec4(0,0,1,0.75f); - return vec4(0,0,1,0.5f); + return ColorRGBA(0,0,1,0.75f); + return ColorRGBA(0,0,1,0.5f); case 1: // selected if(UI()->HotItem() == pID) - return vec4(1,0,0,0.75f); - return vec4(1,0,0,0.5f); + return ColorRGBA(1,0,0,0.75f); + return ColorRGBA(1,0,0,0.5f); default: // regular if(UI()->HotItem() == pID) - return vec4(1,1,1,0.75f); - return vec4(1,1,1,0.5f); + return ColorRGBA(1,1,1,0.75f); + return ColorRGBA(1,1,1,0.5f); } } @@ -643,7 +643,7 @@ int CEditor::DoButton_Env(const void *pID, const char *pText, int Checked, const { float Bright = Checked ? 1.0f : 0.5f; float Alpha = UI()->HotItem() == pID ? 1.0f : 0.75f; - vec4 Color = vec4(BaseColor.r*Bright, BaseColor.g*Bright, BaseColor.b*Bright, Alpha); + ColorRGBA Color = ColorRGBA(BaseColor.r*Bright, BaseColor.g*Bright, BaseColor.b*Bright, Alpha); RenderTools()->DrawUIRect(pRect, Color, CUI::CORNER_ALL, 3.0f); UI()->DoLabel(pRect, pText, 10.f, 0, -1); @@ -665,7 +665,7 @@ int CEditor::DoButton_File(const void *pID, const char *pText, int Checked, cons int CEditor::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip) { CUIRect r = *pRect; - RenderTools()->DrawUIRect(&r, vec4(0.5f, 0.5f, 0.5f, 1.0f), CUI::CORNER_T, 3.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f), CUI::CORNER_T, 3.0f); r = *pRect; r.VMargin(5.0f, &r); @@ -775,7 +775,7 @@ void CEditor::RenderBackground(CUIRect View, int Texture, float Size, float Brig Graphics()->QuadsEnd(); } -int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree, bool IsHex, int Corners, vec4* Color) +int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree, bool IsHex, int Corners, ColorRGBA* Color) { // logic static float s_Value; @@ -2998,7 +2998,7 @@ void CEditor::DoMapEditor(CUIRect View) } -int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *pNewVal, vec4 Color) +int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *pNewVal, ColorRGBA Color) { int Change = -1; @@ -3196,11 +3196,11 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int * Up.VSplitLeft(1.0f, 0, &Up); Left.VSplitLeft(10.0f, &Left, &Shifter); Shifter.VSplitRight(10.0f, &Shifter, &Right); - RenderTools()->DrawUIRect(&Shifter, vec4(1,1,1,0.5f), 0, 0.0f); + RenderTools()->DrawUIRect(&Shifter, ColorRGBA(1,1,1,0.5f), 0, 0.0f); UI()->DoLabel(&Shifter, "X", 10.0f, 0, -1); Up.VSplitLeft(10.0f, &Up, &Shifter); Shifter.VSplitRight(10.0f, &Shifter, &Down); - RenderTools()->DrawUIRect(&Shifter, vec4(1,1,1,0.5f), 0, 0.0f); + RenderTools()->DrawUIRect(&Shifter, ColorRGBA(1,1,1,0.5f), 0, 0.0f); UI()->DoLabel(&Shifter, "Y", 10.0f, 0, -1); if(DoButton_ButtonDec(&pIDs[i], "-", 0, &Left, 0, "Left")) { @@ -4182,10 +4182,10 @@ void CEditor::RenderFileDialog() CUIRect Preview; float Width = View.w, Height = View.h; - RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.25f), 0, 0); + RenderTools()->DrawUIRect(&View, ColorRGBA(0,0,0,0.25f), 0, 0); View.VMargin(150.0f, &View); View.HMargin(50.0f, &View); - RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.75f), CUI::CORNER_ALL, 5.0f); + RenderTools()->DrawUIRect(&View, ColorRGBA(0,0,0,0.75f), CUI::CORNER_ALL, 5.0f); View.Margin(10.0f, &View); CUIRect Title, FileBox, FileBoxLabel, ButtonBar, Scroll, PathBox; @@ -4203,7 +4203,7 @@ void CEditor::RenderFileDialog() View.VSplitRight(15.0f, &View, &Scroll); // title - RenderTools()->DrawUIRect(&Title, vec4(1, 1, 1, 0.25f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&Title, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 4.0f); Title.VMargin(10.0f, &Title); UI()->DoLabel(&Title, m_pFileDialogTitle, 12.0f, -1, -1); @@ -4245,7 +4245,7 @@ void CEditor::RenderFileDialog() // clearSearchbox button { static int s_ClearButton = 0; - RenderTools()->DrawUIRect(&ClearBox, vec4(1, 1, 1, 0.33f)*ButtonColorMul(&s_ClearButton), CUI::CORNER_R, 3.0f); + RenderTools()->DrawUIRect(&ClearBox, ColorRGBA(1, 1, 1, 0.33f*ButtonColorMul(&s_ClearButton)), CUI::CORNER_R, 3.0f); UI()->DoLabel(&ClearBox, "×", 10.0f, 0); if(UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox)) { @@ -4843,12 +4843,12 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) char aBuf[512]; str_format(aBuf, sizeof(aBuf),"%d/%d", m_SelectedEnvelope+1, m_Map.m_lEnvelopes.size()); - vec4 EnvColor = vec4(1, 1, 1, 0.5f); + ColorRGBA EnvColor = ColorRGBA(1, 1, 1, 0.5f); if(m_Map.m_lEnvelopes.size()) { EnvColor = IsEnvelopeUsed(m_SelectedEnvelope) ? - vec4(1, 0.7f, 0.7f, 0.5f) : - vec4(0.7f, 1, 0.7f, 0.5f); + ColorRGBA(1, 0.7f, 0.7f, 0.5f) : + ColorRGBA(0.7f, 1, 0.7f, 0.5f); } RenderTools()->DrawUIRect(&Shifter, EnvColor, 0, 0.0f); @@ -6093,7 +6093,7 @@ void CEditor::Init() m_Map.m_UndoModified = 0; m_LastUndoUpdateTime = time_get(); - ms_PickerColor = vec3(1.0f, 0.0f, 0.0f); + ms_PickerColor = ColorHSVA(1.0f, 0.0f, 0.0f); } void CEditor::DoMapBorder() diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h index 14dedc66e..041cc355c 100644 --- a/src/game/editor/editor.h +++ b/src/game/editor/editor.h @@ -788,7 +788,7 @@ public: bool IsQuadSelected(int Index); int FindSelectedQuadIndex(int Index); - int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIDs, int *pNewVal, vec4 Color = vec4(1,1,1,0.5f)); + int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIDs, int *pNewVal, ColorRGBA Color = ColorRGBA(1,1,1,0.5f)); int m_Mode; int m_Dialog; @@ -959,7 +959,7 @@ public: void UiInvokePopupMenu(void *pID, int Flags, float X, float Y, float W, float H, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra=0); void UiDoPopupMenu(); - int UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree=false, bool IsHex=false, int corners=CUI::CORNER_ALL, vec4* Color=0); + int UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree=false, bool IsHex=false, int corners=CUI::CORNER_ALL, ColorRGBA* Color=0); static int PopupGroup(CEditor *pEditor, CUIRect View); static int PopupLayer(CEditor *pEditor, CUIRect View); @@ -996,7 +996,7 @@ public: void PopupSelectSoundInvoke(int Current, float x, float y); int PopupSelectSoundResult(); - vec4 ButtonColorMul(const void *pID); + float ButtonColorMul(const void *pID); void DoQuadEnvelopes(const array &m_lQuads, int TexID = -1); void DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int pIndex); @@ -1008,7 +1008,7 @@ public: void DoToolbar(CUIRect Toolbar); void DoQuad(CQuad *pQuad, int Index); float UiDoScrollbarV(const void *pID, const CUIRect *pRect, float Current); - vec4 GetButtonColor(const void *pID, int Checked); + ColorRGBA GetButtonColor(const void *pID, int Checked); static void ReplaceImage(const char *pFilename, int StorageType, void *pUser); static void ReplaceSound(const char *pFileName, int StorageType, void *pUser); diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index f4b7cad84..c646a3ced 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -75,9 +75,9 @@ void CEditor::UiDoPopupMenu() Corners = CUI::CORNER_R|CUI::CORNER_B; CUIRect r = s_UiPopups[i].m_Rect; - RenderTools()->DrawUIRect(&r, vec4(0.5f,0.5f,0.5f,0.75f), Corners, 3.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(0.5f,0.5f,0.5f,0.75f), Corners, 3.0f); r.Margin(1.0f, &r); - RenderTools()->DrawUIRect(&r, vec4(0,0,0,0.75f), Corners, 3.0f); + RenderTools()->DrawUIRect(&r, ColorRGBA(0,0,0,0.75f), Corners, 3.0f); r.Margin(4.0f, &r); if(s_UiPopups[i].m_pfnFunc(this, r)) @@ -1434,7 +1434,7 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View) static int s_aIds[NUM_PROPS] = {0}; int NewVal = 0; - static vec4 s_color = vec4(1,1,1,0.5f); + static ColorRGBA s_color = ColorRGBA(1,1,1,0.5f); int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal, s_color); @@ -1449,13 +1449,13 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View) { if(gl->m_pTeleTile[y*gl->m_Width+x].m_Number == NewVal) { - s_color = vec4(1,0.5f,0.5f,0.5f); + s_color = ColorRGBA(1,0.5f,0.5f,0.5f); goto done; } } } - s_color = vec4(0.5f,1,0.5f,0.5f); + s_color = ColorRGBA(0.5f,1,0.5f,0.5f); done: pEditor->m_TeleNumber = NewVal; @@ -1518,7 +1518,7 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View) static int s_aIds[NUM_PROPS] = {0}; int NewVal = 0; - static vec4 s_color = vec4(1,1,1,0.5f); + static ColorRGBA s_color = ColorRGBA(1,1,1,0.5f); int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal, s_color); if(Prop == PROP_SwitchNumber) @@ -1532,13 +1532,13 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View) { if(gl->m_pSwitchTile[y*gl->m_Width+x].m_Number == NewVal) { - s_color = vec4(1,0.5f,0.5f,0.5f); + s_color = ColorRGBA(1,0.5f,0.5f,0.5f); goto done; } } } - s_color = vec4(0.5f,1,0.5f,0.5f); + s_color = ColorRGBA(0.5f,1,0.5f,0.5f); done: pEditor->m_SwitchNum = NewVal; @@ -1644,12 +1644,12 @@ int CEditor::PopupColorPicker(CEditor *pEditor, CUIRect View) }; pEditor->Graphics()->QuadsBegin(); - vec4 ColorTop, ColorBottom; + ColorRGBA ColorTop, ColorBottom; float Offset = HuePicker.h/6.0f; for(int j = 0; j < 6; j++) { - ColorTop = vec4(s_aColorIndices[j][0], s_aColorIndices[j][1], s_aColorIndices[j][2], 1.0f); - ColorBottom = vec4(s_aColorIndices[j+1][0], s_aColorIndices[j+1][1], s_aColorIndices[j+1][2], 1.0f); + ColorTop = ColorRGBA(s_aColorIndices[j][0], s_aColorIndices[j][1], s_aColorIndices[j][2], 1.0f); + ColorBottom = ColorRGBA(s_aColorIndices[j+1][0], s_aColorIndices[j+1][1], s_aColorIndices[j+1][2], 1.0f); ColorArray[0] = IGraphics::CColorVertex(0, ColorTop.r, ColorTop.g, ColorTop.b, ColorTop.a); ColorArray[1] = IGraphics::CColorVertex(1, ColorTop.r, ColorTop.g, ColorTop.b, ColorTop.a);