2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_MENUS_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_MENUS_H
|
|
|
|
|
2022-05-23 18:16:18 +00:00
|
|
|
#include <base/types.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <base/vmath.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-05-18 16:00:05 +00:00
|
|
|
#include <chrono>
|
2022-10-04 16:40:24 +00:00
|
|
|
#include <unordered_set>
|
2022-05-23 18:18:32 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2022-05-29 16:33:38 +00:00
|
|
|
#include <engine/console.h>
|
2011-03-13 09:41:10 +00:00
|
|
|
#include <engine/demo.h>
|
2011-06-26 15:10:13 +00:00
|
|
|
#include <engine/friends.h>
|
2020-02-19 10:24:58 +00:00
|
|
|
#include <engine/shared/config.h>
|
2020-09-03 12:08:26 +00:00
|
|
|
#include <engine/shared/linereader.h>
|
2020-10-12 10:29:47 +00:00
|
|
|
#include <engine/textrender.h>
|
2020-09-26 07:37:35 +00:00
|
|
|
#include <game/client/components/mapimages.h>
|
2011-03-13 09:41:10 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/client/component.h>
|
|
|
|
#include <game/client/ui.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <game/voting.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2021-07-12 09:29:59 +00:00
|
|
|
#include <game/client/render.h>
|
|
|
|
|
2020-09-03 12:08:26 +00:00
|
|
|
struct CServerProcess
|
|
|
|
{
|
2020-09-05 22:38:35 +00:00
|
|
|
PROCESS Process;
|
2020-09-03 12:08:26 +00:00
|
|
|
bool Initialized;
|
|
|
|
CLineReader LineReader;
|
|
|
|
};
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-10-28 02:59:50 +00:00
|
|
|
struct SColorPicker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const float ms_Width = 160.0f;
|
2020-12-14 00:51:31 +00:00
|
|
|
const float ms_Height = 186.0f;
|
2020-10-28 02:59:50 +00:00
|
|
|
|
|
|
|
float m_X;
|
|
|
|
float m_Y;
|
|
|
|
|
|
|
|
bool m_Active;
|
|
|
|
|
|
|
|
CUIRect m_AttachedRect;
|
|
|
|
unsigned int *m_pColor;
|
2020-12-14 00:51:31 +00:00
|
|
|
unsigned int m_HSVColor;
|
2020-10-28 02:59:50 +00:00
|
|
|
};
|
|
|
|
|
2022-10-25 16:51:56 +00:00
|
|
|
// component to fetch keypresses, override all other input
|
2010-05-29 07:25:38 +00:00
|
|
|
class CMenusKeyBinder : public CComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool m_TakeKey;
|
|
|
|
bool m_GotKey;
|
|
|
|
IInput::CEvent m_Key;
|
2022-02-06 22:14:26 +00:00
|
|
|
int m_ModifierCombination;
|
2010-05-29 07:25:38 +00:00
|
|
|
CMenusKeyBinder();
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual bool OnInput(IInput::CEvent Event) override;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CMenus : public CComponent
|
2011-04-13 18:37:12 +00:00
|
|
|
{
|
2019-04-26 21:47:34 +00:00
|
|
|
static ColorRGBA ms_GuiColor;
|
|
|
|
static ColorRGBA ms_ColorTabbarInactiveOutgame;
|
|
|
|
static ColorRGBA ms_ColorTabbarActiveOutgame;
|
2020-09-16 01:30:03 +00:00
|
|
|
static ColorRGBA ms_ColorTabbarHoverOutgame;
|
2019-04-26 21:47:34 +00:00
|
|
|
static ColorRGBA ms_ColorTabbarInactiveIngame;
|
|
|
|
static ColorRGBA ms_ColorTabbarActiveIngame;
|
2020-09-16 01:30:03 +00:00
|
|
|
static ColorRGBA ms_ColorTabbarHoverIngame;
|
2019-04-26 21:47:34 +00:00
|
|
|
static ColorRGBA ms_ColorTabbarInactive;
|
|
|
|
static ColorRGBA ms_ColorTabbarActive;
|
2020-09-16 01:30:03 +00:00
|
|
|
static ColorRGBA ms_ColorTabbarHover;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-10-28 02:59:50 +00:00
|
|
|
static SColorPicker ms_ColorPicker;
|
2020-12-14 00:51:31 +00:00
|
|
|
static bool ms_ValueSelectorTextMode;
|
2020-10-28 02:59:50 +00:00
|
|
|
|
2020-10-12 10:29:47 +00:00
|
|
|
char m_aLocalStringHelper[1024];
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
2022-08-19 05:05:02 +00:00
|
|
|
int DoButton_FontIcon(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, bool Enabled = true);
|
2012-01-10 22:03:23 +00:00
|
|
|
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
2022-07-26 19:17:29 +00:00
|
|
|
int DoButton_Menu(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName = nullptr, int Corners = IGraphics::CORNER_ALL, float r = 5.0f, float FontFactor = 0.0f, vec4 ColorHot = vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4 Color = vec4(1, 1, 1, 0.5f), int AlignVertically = 1, bool CheckForActiveColorPicker = false);
|
2022-07-16 13:32:06 +00:00
|
|
|
int DoButton_MenuTab(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, SUIAnimator *pAnimator = nullptr, const ColorRGBA *pDefaultColor = nullptr, const ColorRGBA *pActiveColor = nullptr, const ColorRGBA *pHoverColor = nullptr, float EdgeRounding = 10, int AlignVertically = 1);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
int DoButton_CheckBox_Common(const void *pID, const char *pText, const char *pBoxText, const CUIRect *pRect);
|
|
|
|
int DoButton_CheckBox(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
2020-10-29 00:55:01 +00:00
|
|
|
int DoButton_CheckBoxAutoVMarginAndSet(const void *pID, const char *pText, int *pValue, CUIRect *pRect, float VMargin);
|
2010-05-29 07:25:38 +00:00
|
|
|
int DoButton_CheckBox_Number(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
2022-07-27 01:58:16 +00:00
|
|
|
|
2022-07-16 13:32:06 +00:00
|
|
|
ColorHSLA DoLine_ColorPicker(CButtonContainer *pResetID, float LineSize, float WantedPickerPosition, float LabelSize, float BottomMargin, CUIRect *pMainRect, const char *pText, unsigned int *pColorValue, ColorRGBA DefaultColor, bool CheckBoxSpacing = true, bool UseCheckBox = false, int *pCheckBoxValue = nullptr);
|
2022-07-27 01:58:16 +00:00
|
|
|
void DoLaserPreview(const CUIRect *pRect, ColorHSLA OutlineColor, ColorHSLA InnerColor, const int LaserType);
|
2022-06-30 22:36:32 +00:00
|
|
|
int DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool UseScroll, int Current, int Min, int Max, int Step, float Scale, bool IsHex, float Round, ColorRGBA *pColor);
|
2010-05-29 07:25:38 +00:00
|
|
|
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
|
|
|
|
2022-11-29 21:23:58 +00:00
|
|
|
void DoButton_KeySelect(const void *pID, const char *pText, const CUIRect *pRect);
|
2022-06-30 22:36:32 +00:00
|
|
|
int DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *pNewModifierCombination);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-06-07 19:37:43 +00:00
|
|
|
void DoSettingsControlsButtons(int Start, int Stop, CUIRect View);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-06-07 21:11:13 +00:00
|
|
|
float RenderSettingsControlsJoystick(CUIRect View);
|
|
|
|
void DoJoystickAxisPicker(CUIRect View);
|
|
|
|
void DoJoystickBar(const CUIRect *pRect, float Current, float Tolerance, bool Active);
|
|
|
|
|
2020-10-28 02:59:50 +00:00
|
|
|
void RenderColorPicker();
|
|
|
|
|
2022-08-20 11:39:51 +00:00
|
|
|
void RefreshSkins();
|
|
|
|
|
2020-10-12 10:29:47 +00:00
|
|
|
// new gui with gui elements
|
|
|
|
template<typename T>
|
2022-07-26 19:17:29 +00:00
|
|
|
int DoButtonMenu(CUIElement &UIElement, const void *pID, T &&GetTextLambda, int Checked, const CUIRect *pRect, bool HintRequiresStringCheck, bool HintCanChangePositionOrSize = false, int Corners = IGraphics::CORNER_ALL, float r = 5.0f, float FontFactor = 0.0f, vec4 ColorHot = vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4 Color = vec4(1, 1, 1, 0.5f), int AlignVertically = 1)
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
|
|
|
CUIRect Text = *pRect;
|
|
|
|
Text.HMargin(pRect->h >= 20.0f ? 2.0f : 1.0f, &Text);
|
|
|
|
Text.HMargin((Text.h * FontFactor) / 2.0f, &Text);
|
|
|
|
|
2022-08-13 09:40:04 +00:00
|
|
|
if(!UIElement.AreRectsInit() || HintRequiresStringCheck || HintCanChangePositionOrSize || UIElement.Rect(0)->m_UITextContainer == -1)
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
2022-08-13 09:40:04 +00:00
|
|
|
bool NeedsRecalc = !UIElement.AreRectsInit() || UIElement.Rect(0)->m_UITextContainer == -1;
|
2020-10-12 10:29:47 +00:00
|
|
|
if(HintCanChangePositionOrSize)
|
|
|
|
{
|
2021-09-13 21:48:10 +00:00
|
|
|
if(UIElement.AreRectsInit())
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
2022-08-13 09:40:04 +00:00
|
|
|
if(UIElement.Rect(0)->m_X != pRect->x || UIElement.Rect(0)->m_Y != pRect->y || UIElement.Rect(0)->m_Width != pRect->w || UIElement.Rect(0)->m_Y != pRect->h)
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
|
|
|
NeedsRecalc = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-13 16:28:13 +00:00
|
|
|
const char *pText = nullptr;
|
2020-10-12 10:29:47 +00:00
|
|
|
if(HintRequiresStringCheck)
|
|
|
|
{
|
2021-09-13 21:48:10 +00:00
|
|
|
if(UIElement.AreRectsInit())
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
|
|
|
pText = GetTextLambda();
|
2022-08-13 09:40:04 +00:00
|
|
|
if(str_comp(UIElement.Rect(0)->m_Text.c_str(), pText) != 0)
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
|
|
|
NeedsRecalc = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(NeedsRecalc)
|
|
|
|
{
|
2021-09-13 21:48:10 +00:00
|
|
|
if(!UIElement.AreRectsInit())
|
2020-10-12 10:29:47 +00:00
|
|
|
{
|
2021-09-13 21:48:10 +00:00
|
|
|
UIElement.InitRects(3);
|
2020-10-12 10:29:47 +00:00
|
|
|
}
|
2021-09-13 21:48:10 +00:00
|
|
|
UI()->ResetUIElement(UIElement);
|
2020-10-12 10:29:47 +00:00
|
|
|
|
|
|
|
vec4 RealColor = Color;
|
|
|
|
for(int i = 0; i < 3; ++i)
|
|
|
|
{
|
|
|
|
Color.a = RealColor.a;
|
|
|
|
if(i == 0)
|
2021-11-26 20:55:31 +00:00
|
|
|
Color.a *= UI()->ButtonColorMulActive();
|
2020-10-12 10:29:47 +00:00
|
|
|
else if(i == 1)
|
2021-11-26 20:55:31 +00:00
|
|
|
Color.a *= UI()->ButtonColorMulHot();
|
2020-10-12 10:29:47 +00:00
|
|
|
else if(i == 2)
|
2021-11-26 20:55:31 +00:00
|
|
|
Color.a *= UI()->ButtonColorMulDefault();
|
2020-10-12 10:29:47 +00:00
|
|
|
Graphics()->SetColor(Color);
|
|
|
|
|
2022-08-13 09:40:04 +00:00
|
|
|
CUIElement::SUIElementRect &NewRect = *UIElement.Rect(i);
|
2022-07-09 20:27:35 +00:00
|
|
|
NewRect.m_UIRectQuadContainer = Graphics()->CreateRectQuadContainer(pRect->x, pRect->y, pRect->w, pRect->h, r, Corners);
|
2020-10-12 10:29:47 +00:00
|
|
|
|
|
|
|
NewRect.m_X = pRect->x;
|
|
|
|
NewRect.m_Y = pRect->y;
|
|
|
|
NewRect.m_Width = pRect->w;
|
|
|
|
NewRect.m_Height = pRect->h;
|
|
|
|
if(i == 0)
|
|
|
|
{
|
2022-06-13 16:28:13 +00:00
|
|
|
if(pText == nullptr)
|
2020-10-12 10:29:47 +00:00
|
|
|
pText = GetTextLambda();
|
|
|
|
NewRect.m_Text = pText;
|
2022-03-11 16:34:48 +00:00
|
|
|
SLabelProperties Props;
|
|
|
|
Props.m_AlignVertically = AlignVertically;
|
|
|
|
UI()->DoLabel(NewRect, &Text, pText, Text.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, Props);
|
2020-10-12 10:29:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Graphics()->SetColor(1, 1, 1, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// render
|
|
|
|
size_t Index = 2;
|
2022-05-27 08:55:32 +00:00
|
|
|
if(UI()->CheckActiveItem(pID))
|
2020-10-12 10:29:47 +00:00
|
|
|
Index = 0;
|
|
|
|
else if(UI()->HotItem() == pID)
|
|
|
|
Index = 1;
|
|
|
|
Graphics()->TextureClear();
|
2022-08-13 09:40:04 +00:00
|
|
|
Graphics()->RenderQuadContainer(UIElement.Rect(Index)->m_UIRectQuadContainer, -1);
|
2022-07-01 04:42:36 +00:00
|
|
|
ColorRGBA ColorText(TextRender()->DefaultTextColor());
|
|
|
|
ColorRGBA ColorTextOutline(TextRender()->DefaultTextOutlineColor());
|
2022-08-13 09:40:04 +00:00
|
|
|
if(UIElement.Rect(0)->m_UITextContainer != -1)
|
|
|
|
TextRender()->RenderTextContainer(UIElement.Rect(0)->m_UITextContainer, ColorText, ColorTextOutline);
|
2020-10-12 10:29:47 +00:00
|
|
|
return UI()->DoButtonLogic(pID, Checked, pRect);
|
|
|
|
}
|
|
|
|
|
2022-02-14 08:57:14 +00:00
|
|
|
/**
|
|
|
|
* Places and renders a tooltip near pNearRect.
|
|
|
|
* For now only works correctly with single line tooltips, since Text width calculation gets broken when there are multiple lines.
|
|
|
|
*
|
2022-04-07 07:46:02 +00:00
|
|
|
* @param pID The ID of the tooltip. Usually a reference to some g_Config value.
|
2022-02-14 08:57:14 +00:00
|
|
|
* @param pNearTo Place the tooltip near this rect.
|
|
|
|
* @param pText The text to display in the tooltip
|
|
|
|
*/
|
2022-04-07 07:46:02 +00:00
|
|
|
void DoToolTip(const void *pID, const CUIRect *pNearRect, const char *pText, float WidthHint = -1.0f);
|
2020-09-26 07:37:35 +00:00
|
|
|
// menus_settings_assets.cpp
|
|
|
|
public:
|
|
|
|
struct SCustomItem
|
|
|
|
{
|
|
|
|
IGraphics::CTextureHandle m_RenderTexture;
|
|
|
|
|
|
|
|
char m_aName[50];
|
|
|
|
|
|
|
|
bool operator<(const SCustomItem &Other) const { return str_comp(m_aName, Other.m_aName) < 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCustomEntities : public SCustomItem
|
|
|
|
{
|
|
|
|
struct SEntitiesImage
|
|
|
|
{
|
|
|
|
IGraphics::CTextureHandle m_Texture;
|
|
|
|
};
|
|
|
|
SEntitiesImage m_aImages[MAP_IMAGE_MOD_TYPE_COUNT];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCustomGame : public SCustomItem
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCustomEmoticon : public SCustomItem
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCustomParticle : public SCustomItem
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2022-03-15 15:52:41 +00:00
|
|
|
struct SCustomHud : public SCustomItem
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2022-06-14 17:28:51 +00:00
|
|
|
struct SCustomExtras : public SCustomItem
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
protected:
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<SCustomEntities> m_vEntitiesList;
|
|
|
|
std::vector<SCustomGame> m_vGameList;
|
|
|
|
std::vector<SCustomEmoticon> m_vEmoticonList;
|
|
|
|
std::vector<SCustomParticle> m_vParticlesList;
|
|
|
|
std::vector<SCustomHud> m_vHudList;
|
2022-06-14 17:28:51 +00:00
|
|
|
std::vector<SCustomExtras> m_vExtrasList;
|
2020-09-26 07:37:35 +00:00
|
|
|
|
2022-04-02 11:37:59 +00:00
|
|
|
bool m_IsInit = false;
|
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
static void LoadEntities(struct SCustomEntities *pEntitiesItem, void *pUser);
|
|
|
|
static int EntitiesScan(const char *pName, int IsDir, int DirType, void *pUser);
|
|
|
|
|
|
|
|
static int GameScan(const char *pName, int IsDir, int DirType, void *pUser);
|
|
|
|
static int EmoticonsScan(const char *pName, int IsDir, int DirType, void *pUser);
|
|
|
|
static int ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser);
|
2022-03-15 15:52:41 +00:00
|
|
|
static int HudScan(const char *pName, int IsDir, int DirType, void *pUser);
|
2022-06-14 17:28:51 +00:00
|
|
|
static int ExtrasScan(const char *pName, int IsDir, int DirType, void *pUser);
|
2020-09-26 07:37:35 +00:00
|
|
|
|
2021-04-11 12:34:08 +00:00
|
|
|
static void ConchainAssetsEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
|
|
|
static void ConchainAssetGame(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
|
|
|
static void ConchainAssetParticles(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
|
|
|
static void ConchainAssetEmoticons(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2022-03-15 15:52:41 +00:00
|
|
|
static void ConchainAssetHud(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2022-06-14 17:28:51 +00:00
|
|
|
static void ConchainAssetExtras(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2021-04-11 12:34:08 +00:00
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
void ClearCustomItems(int CurTab);
|
|
|
|
|
2020-09-03 12:08:26 +00:00
|
|
|
int m_MenuPage;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_GamePage;
|
|
|
|
int m_Popup;
|
|
|
|
int m_ActivePage;
|
2020-09-03 12:08:26 +00:00
|
|
|
bool m_ShowStart;
|
2010-05-29 07:25:38 +00:00
|
|
|
bool m_MenuActive;
|
|
|
|
vec2 m_MousePos;
|
2022-02-21 00:04:49 +00:00
|
|
|
bool m_JoinTutorial;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2021-06-26 11:39:14 +00:00
|
|
|
char m_aNextServer[256];
|
|
|
|
|
2020-09-03 12:08:26 +00:00
|
|
|
// images
|
|
|
|
struct CMenuImage
|
|
|
|
{
|
|
|
|
char m_aName[64];
|
|
|
|
IGraphics::CTextureHandle m_OrgTexture;
|
|
|
|
IGraphics::CTextureHandle m_GreyTexture;
|
|
|
|
};
|
2022-05-23 20:48:56 +00:00
|
|
|
std::vector<CMenuImage> m_vMenuImages;
|
2020-09-03 12:08:26 +00:00
|
|
|
|
|
|
|
static int MenuImageScan(const char *pName, int IsDir, int DirType, void *pUser);
|
|
|
|
|
2020-09-10 18:14:47 +00:00
|
|
|
const CMenuImage *FindMenuImage(const char *pName);
|
2020-09-03 12:08:26 +00:00
|
|
|
|
2011-02-27 16:56:03 +00:00
|
|
|
// loading
|
|
|
|
int m_LoadCurrent;
|
|
|
|
int m_LoadTotal;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
char m_aMessageTopic[512];
|
|
|
|
char m_aMessageBody[512];
|
|
|
|
char m_aMessageButton[512];
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-10-12 10:29:47 +00:00
|
|
|
CUIElement m_RefreshButton;
|
|
|
|
CUIElement m_ConnectButton;
|
|
|
|
|
2022-11-30 21:26:40 +00:00
|
|
|
// generic popups
|
|
|
|
typedef void (CMenus::*FPopupButtonCallback)();
|
|
|
|
void DefaultButtonCallback()
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
BUTTON_CONFIRM = 0, // confirm / yes / close / ok
|
|
|
|
BUTTON_CANCEL, // cancel / no
|
|
|
|
NUM_BUTTONS
|
|
|
|
};
|
|
|
|
char m_aPopupTitle[128];
|
|
|
|
char m_aPopupMessage[256];
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char m_aLabel[64];
|
|
|
|
int m_NextPopup;
|
|
|
|
FPopupButtonCallback m_pfnCallback;
|
|
|
|
} m_aPopupButtons[NUM_BUTTONS];
|
|
|
|
|
|
|
|
void PopupMessage(const char *pTitle, const char *pMessage,
|
|
|
|
const char *pButtonLabel, int NextPopup = POPUP_NONE, FPopupButtonCallback pfnButtonCallback = &CMenus::DefaultButtonCallback);
|
|
|
|
void PopupConfirm(const char *pTitle, const char *pMessage,
|
|
|
|
const char *pConfirmButtonLabel, const char *pCancelButtonLabel,
|
|
|
|
FPopupButtonCallback pfnConfirmButtonCallback = &CMenus::DefaultButtonCallback, int ConfirmNextPopup = POPUP_NONE,
|
|
|
|
FPopupButtonCallback pfnCancelButtonCallback = &CMenus::DefaultButtonCallback, int CancelNextPopup = POPUP_NONE);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2011-04-13 18:37:12 +00:00
|
|
|
// TODO: this is a bit ugly but.. well.. yeah
|
2020-09-26 19:41:58 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_INPUTEVENTS = 32
|
|
|
|
};
|
2010-05-29 07:25:38 +00:00
|
|
|
static IInput::CEvent m_aInputEvents[MAX_INPUTEVENTS];
|
|
|
|
static int m_NumInputEvents;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// some settings
|
|
|
|
static float ms_ButtonHeight;
|
|
|
|
static float ms_ListheaderHeight;
|
2014-06-16 11:29:18 +00:00
|
|
|
static float ms_ListitemAdditionalHeight;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-10-16 09:24:42 +00:00
|
|
|
// for settings
|
2019-07-18 23:53:27 +00:00
|
|
|
bool m_NeedRestartGeneral;
|
2014-08-17 03:34:16 +00:00
|
|
|
bool m_NeedRestartSkins;
|
2010-10-16 09:24:42 +00:00
|
|
|
bool m_NeedRestartGraphics;
|
|
|
|
bool m_NeedRestartSound;
|
2015-03-08 17:51:13 +00:00
|
|
|
bool m_NeedRestartUpdate;
|
2016-05-07 13:59:13 +00:00
|
|
|
bool m_NeedRestartDDNet;
|
2010-05-29 07:25:38 +00:00
|
|
|
bool m_NeedSendinfo;
|
2014-04-28 13:19:57 +00:00
|
|
|
bool m_NeedSendDummyinfo;
|
2011-03-16 20:31:55 +00:00
|
|
|
int m_SettingPlayerPage;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-12-16 00:52:29 +00:00
|
|
|
// for map download popup
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_DownloadLastCheckTime;
|
2010-12-16 00:52:29 +00:00
|
|
|
int m_DownloadLastCheckSize;
|
|
|
|
float m_DownloadSpeed;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// for call vote
|
|
|
|
int m_CallvoteSelectedOption;
|
|
|
|
int m_CallvoteSelectedPlayer;
|
2011-03-26 16:44:34 +00:00
|
|
|
char m_aCallvoteReason[VOTE_REASON_LENGTH];
|
2015-03-13 15:44:05 +00:00
|
|
|
char m_aFilterString[25];
|
2021-03-14 18:57:21 +00:00
|
|
|
bool m_ControlPageOpening;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// demo
|
2019-01-08 19:12:21 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
SORT_DEMONAME = 0,
|
2019-01-08 19:12:21 +00:00
|
|
|
SORT_MARKERS,
|
|
|
|
SORT_LENGTH,
|
|
|
|
SORT_DATE,
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
struct CDemoItem
|
|
|
|
{
|
2021-09-13 08:06:34 +00:00
|
|
|
char m_aFilename[IO_MAX_PATH_LENGTH];
|
2022-10-24 18:17:11 +00:00
|
|
|
char m_aName[IO_MAX_PATH_LENGTH];
|
2010-09-28 22:53:53 +00:00
|
|
|
bool m_IsDir;
|
2010-10-06 21:07:35 +00:00
|
|
|
int m_StorageType;
|
2015-08-27 12:57:56 +00:00
|
|
|
time_t m_Date;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-11-20 13:45:09 +00:00
|
|
|
bool m_InfosLoaded;
|
2010-10-09 11:27:21 +00:00
|
|
|
bool m_Valid;
|
2011-03-13 09:41:10 +00:00
|
|
|
CDemoHeader m_Info;
|
2019-01-08 19:12:21 +00:00
|
|
|
CTimelineMarkers m_TimelineMarkers;
|
2019-10-14 00:27:08 +00:00
|
|
|
CMapInfo m_MapInfo;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2019-01-08 19:12:21 +00:00
|
|
|
int NumMarkers() const
|
2015-08-27 12:57:56 +00:00
|
|
|
{
|
2023-02-04 00:02:11 +00:00
|
|
|
return clamp<int>(bytes_be_to_uint(m_TimelineMarkers.m_aNumTimelineMarkers), 0, MAX_TIMELINE_MARKERS);
|
2019-01-08 19:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int Length() const
|
|
|
|
{
|
2023-02-04 00:02:11 +00:00
|
|
|
return bytes_be_to_uint(m_Info.m_aLength);
|
2021-11-08 19:21:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned Size() const
|
|
|
|
{
|
|
|
|
return bytes_be_to_uint(m_Info.m_aMapSize);
|
2019-01-08 19:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<(const CDemoItem &Other) const
|
|
|
|
{
|
|
|
|
if(!str_comp(m_aFilename, ".."))
|
|
|
|
return true;
|
|
|
|
if(!str_comp(Other.m_aFilename, ".."))
|
|
|
|
return false;
|
|
|
|
if(m_IsDir && !Other.m_IsDir)
|
|
|
|
return true;
|
|
|
|
if(!m_IsDir && Other.m_IsDir)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const CDemoItem &Left = g_Config.m_BrDemoSortOrder ? Other : *this;
|
|
|
|
const CDemoItem &Right = g_Config.m_BrDemoSortOrder ? *this : Other;
|
|
|
|
|
|
|
|
if(g_Config.m_BrDemoSort == SORT_DEMONAME)
|
2022-09-28 21:53:17 +00:00
|
|
|
return str_comp_filenames(Left.m_aFilename, Right.m_aFilename) < 0;
|
2019-01-08 19:12:21 +00:00
|
|
|
if(g_Config.m_BrDemoSort == SORT_DATE)
|
|
|
|
return Left.m_Date < Right.m_Date;
|
|
|
|
|
|
|
|
if(!Other.m_InfosLoaded)
|
|
|
|
return m_InfosLoaded;
|
|
|
|
if(!m_InfosLoaded)
|
|
|
|
return !Other.m_InfosLoaded;
|
|
|
|
|
|
|
|
if(g_Config.m_BrDemoSort == SORT_MARKERS)
|
|
|
|
return Left.NumMarkers() < Right.NumMarkers();
|
|
|
|
if(g_Config.m_BrDemoSort == SORT_LENGTH)
|
|
|
|
return Left.Length() < Right.Length();
|
|
|
|
|
|
|
|
// Unknown sort
|
|
|
|
return true;
|
2015-08-27 12:57:56 +00:00
|
|
|
}
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-10-24 18:17:11 +00:00
|
|
|
char m_aCurrentDemoFolder[IO_MAX_PATH_LENGTH];
|
|
|
|
char m_aCurrentDemoFile[IO_MAX_PATH_LENGTH];
|
2010-09-28 22:53:53 +00:00
|
|
|
int m_DemolistSelectedIndex;
|
|
|
|
bool m_DemolistSelectedIsDir;
|
2010-10-07 22:13:05 +00:00
|
|
|
int m_DemolistStorageType;
|
2019-09-28 04:18:38 +00:00
|
|
|
int m_Speed = 4;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-05-18 16:00:05 +00:00
|
|
|
std::chrono::nanoseconds m_DemoPopulateStartTime{0};
|
2022-04-02 11:37:59 +00:00
|
|
|
|
2010-09-28 22:53:53 +00:00
|
|
|
void DemolistOnUpdate(bool Reset);
|
2021-08-23 10:49:15 +00:00
|
|
|
static int DemolistFetchCallback(const CFsFileInfo *pInfo, int IsDir, int StorageType, void *pUser);
|
2011-03-23 12:06:35 +00:00
|
|
|
|
2011-06-26 15:10:13 +00:00
|
|
|
// friends
|
|
|
|
struct CFriendItem
|
|
|
|
{
|
|
|
|
const CFriendInfo *m_pFriendInfo;
|
|
|
|
int m_NumFound;
|
|
|
|
|
2022-05-24 19:20:04 +00:00
|
|
|
CFriendItem() {}
|
|
|
|
CFriendItem(const CFriendInfo *pFriendInfo) :
|
|
|
|
m_pFriendInfo(pFriendInfo), m_NumFound(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const CFriendItem &Other) const
|
2011-06-26 15:10:13 +00:00
|
|
|
{
|
|
|
|
if(m_NumFound && !Other.m_NumFound)
|
|
|
|
return true;
|
|
|
|
else if(!m_NumFound && Other.m_NumFound)
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int Result = str_comp(m_pFriendInfo->m_aName, Other.m_pFriendInfo->m_aName);
|
|
|
|
if(Result)
|
|
|
|
return Result < 0;
|
|
|
|
else
|
|
|
|
return str_comp(m_pFriendInfo->m_aClan, Other.m_pFriendInfo->m_aClan) < 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<CFriendItem> m_vFriends;
|
2011-03-23 12:06:35 +00:00
|
|
|
int m_FriendlistSelectedIndex;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-06-26 15:10:13 +00:00
|
|
|
void FriendlistOnUpdate();
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// found in menus.cpp
|
|
|
|
int Render();
|
2022-11-30 22:21:36 +00:00
|
|
|
#if defined(CONF_VIDEORECORDER)
|
|
|
|
void PopupConfirmDemoReplaceVideo();
|
|
|
|
#endif
|
2010-05-29 07:25:38 +00:00
|
|
|
int RenderMenubar(CUIRect r);
|
|
|
|
void RenderNews(CUIRect MainView);
|
2022-06-26 20:07:10 +00:00
|
|
|
static void ConchainUpdateMusicState(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
|
|
|
void UpdateMusicState();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// found in menus_demo.cpp
|
2017-02-28 09:08:14 +00:00
|
|
|
static bool DemoFilterChat(const void *pData, int Size, void *pUser);
|
2019-01-08 19:12:21 +00:00
|
|
|
bool FetchHeader(CDemoItem &Item);
|
2019-03-19 17:28:09 +00:00
|
|
|
void FetchAllHeaders();
|
2022-08-28 10:23:03 +00:00
|
|
|
void HandleDemoSeeking(float PositionToSeek, float TimeToSeek);
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderDemoPlayer(CUIRect MainView);
|
|
|
|
void RenderDemoList(CUIRect MainView);
|
2022-11-30 21:38:18 +00:00
|
|
|
void PopupConfirmDeleteDemo();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-03 12:08:26 +00:00
|
|
|
// found in menus_start.cpp
|
|
|
|
void RenderStartMenu(CUIRect MainView);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// found in menus_ingame.cpp
|
|
|
|
void RenderGame(CUIRect MainView);
|
2022-11-30 22:06:44 +00:00
|
|
|
void PopupConfirmDisconnect();
|
|
|
|
void PopupConfirmDisconnectDummy();
|
2011-04-06 18:18:31 +00:00
|
|
|
void RenderPlayers(CUIRect MainView);
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderServerInfo(CUIRect MainView);
|
|
|
|
void RenderServerControl(CUIRect MainView);
|
2016-04-27 18:04:31 +00:00
|
|
|
bool RenderServerControlKick(CUIRect MainView, bool FilterSpectators);
|
|
|
|
bool RenderServerControlServer(CUIRect MainView);
|
2022-10-02 22:11:01 +00:00
|
|
|
void RenderIngameHint();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// found in menus_browser.cpp
|
|
|
|
int m_SelectedIndex;
|
|
|
|
void RenderServerbrowserServerList(CUIRect View);
|
2022-11-30 22:41:32 +00:00
|
|
|
void Connect(const char *pAddress);
|
|
|
|
void PopupConfirmSwitchServer();
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderServerbrowserServerDetail(CUIRect View);
|
|
|
|
void RenderServerbrowserFilters(CUIRect View);
|
2011-03-23 12:06:35 +00:00
|
|
|
void RenderServerbrowserFriends(CUIRect View);
|
2022-11-30 21:50:51 +00:00
|
|
|
void PopupConfirmRemoveFriend();
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderServerbrowser(CUIRect MainView);
|
2022-12-23 22:23:44 +00:00
|
|
|
template<typename F>
|
|
|
|
bool PrintHighlighted(const char *pName, F &&PrintFn);
|
2011-06-26 15:10:13 +00:00
|
|
|
static void ConchainFriendlistUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2010-07-04 14:10:00 +00:00
|
|
|
static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-10-04 16:40:24 +00:00
|
|
|
// skin favorite list
|
|
|
|
bool m_SkinFavoritesChanged = false;
|
|
|
|
std::unordered_set<std::string> m_SkinFavorites;
|
|
|
|
static void Con_AddFavoriteSkin(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void Con_RemFavoriteSkin(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserData);
|
|
|
|
void OnConfigSave(IConfigManager *pConfigManager);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// found in menus_settings.cpp
|
2023-01-05 11:21:10 +00:00
|
|
|
bool RenderLanguageSelection(CUIRect MainView);
|
|
|
|
void RenderThemeSelection(CUIRect MainView);
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderSettingsGeneral(CUIRect MainView);
|
|
|
|
void RenderSettingsPlayer(CUIRect MainView);
|
2014-04-26 18:29:42 +00:00
|
|
|
void RenderSettingsDummyPlayer(CUIRect MainView);
|
2011-04-01 17:36:44 +00:00
|
|
|
void RenderSettingsTee(CUIRect MainView);
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderSettingsControls(CUIRect MainView);
|
2022-11-30 21:56:17 +00:00
|
|
|
void ResetSettingsControls();
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderSettingsGraphics(CUIRect MainView);
|
|
|
|
void RenderSettingsSound(CUIRect MainView);
|
|
|
|
void RenderSettings(CUIRect MainView);
|
2020-09-26 07:37:35 +00:00
|
|
|
void RenderSettingsCustom(CUIRect MainView);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-28 22:19:03 +00:00
|
|
|
void SetNeedSendInfo();
|
2010-05-29 07:25:38 +00:00
|
|
|
void SetActive(bool Active);
|
2012-08-12 10:41:50 +00:00
|
|
|
|
|
|
|
IGraphics::CTextureHandle m_TextureBlob;
|
2020-09-03 12:08:26 +00:00
|
|
|
|
|
|
|
bool CheckHotKey(int Key) const;
|
|
|
|
|
2020-09-18 16:45:42 +00:00
|
|
|
class CMenuBackground *m_pBackground;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
void RenderBackground();
|
|
|
|
|
2020-09-18 16:45:42 +00:00
|
|
|
void SetMenuBackground(class CMenuBackground *pBackground) { m_pBackground = pBackground; }
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
static CMenusKeyBinder m_Binder;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CMenus();
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-06-23 17:59:38 +00:00
|
|
|
void RenderLoading(const char *pCaption, const char *pContent, int IncreaseCounter, bool RenderLoadingBar = true, bool RenderMenuBackgroundMap = true);
|
2022-04-02 11:37:59 +00:00
|
|
|
|
|
|
|
bool IsInit() { return m_IsInit; }
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
bool IsActive() const { return m_MenuActive; }
|
2020-09-17 22:30:29 +00:00
|
|
|
void KillServer();
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnInit() override;
|
2022-10-04 16:40:24 +00:00
|
|
|
void OnConsoleInit() override;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnStateChange(int NewState, int OldState) override;
|
|
|
|
virtual void OnReset() override;
|
|
|
|
virtual void OnRender() override;
|
|
|
|
virtual bool OnInput(IInput::CEvent Event) override;
|
2022-06-06 20:03:24 +00:00
|
|
|
virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override;
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnShutdown() override;
|
2011-01-30 16:21:41 +00:00
|
|
|
|
2014-06-05 10:11:41 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
PAGE_NEWS = 1,
|
2014-06-05 10:11:41 +00:00
|
|
|
PAGE_GAME,
|
|
|
|
PAGE_PLAYERS,
|
|
|
|
PAGE_SERVER_INFO,
|
|
|
|
PAGE_CALLVOTE,
|
|
|
|
PAGE_INTERNET,
|
|
|
|
PAGE_LAN,
|
|
|
|
PAGE_FAVORITES,
|
2014-09-13 14:36:25 +00:00
|
|
|
PAGE_DDNET,
|
2019-03-24 22:15:38 +00:00
|
|
|
PAGE_KOG,
|
2014-06-05 10:11:41 +00:00
|
|
|
PAGE_DEMOS,
|
|
|
|
PAGE_SETTINGS,
|
|
|
|
PAGE_SYSTEM,
|
2016-04-27 18:14:03 +00:00
|
|
|
PAGE_NETWORK,
|
2019-11-17 17:11:33 +00:00
|
|
|
PAGE_GHOST,
|
|
|
|
|
2020-10-26 02:48:05 +00:00
|
|
|
PAGE_LENGTH,
|
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
SETTINGS_LANGUAGE = 0,
|
2019-11-17 17:11:33 +00:00
|
|
|
SETTINGS_GENERAL,
|
|
|
|
SETTINGS_PLAYER,
|
|
|
|
SETTINGS_TEE,
|
2022-06-26 22:38:49 +00:00
|
|
|
SETTINGS_APPEARANCE,
|
2019-11-17 17:11:33 +00:00
|
|
|
SETTINGS_CONTROLS,
|
|
|
|
SETTINGS_GRAPHICS,
|
|
|
|
SETTINGS_SOUND,
|
|
|
|
SETTINGS_DDNET,
|
2020-09-26 07:37:35 +00:00
|
|
|
SETTINGS_ASSETS,
|
2020-10-26 02:48:05 +00:00
|
|
|
|
|
|
|
SETTINGS_LENGTH,
|
|
|
|
|
|
|
|
BIG_TAB_NEWS = 0,
|
|
|
|
BIG_TAB_INTERNET,
|
|
|
|
BIG_TAB_LAN,
|
|
|
|
BIG_TAB_FAVORITES,
|
|
|
|
BIG_TAB_DDNET,
|
|
|
|
BIG_TAB_KOG,
|
|
|
|
BIG_TAB_DEMOS,
|
|
|
|
|
|
|
|
BIG_TAB_LENGTH,
|
|
|
|
|
|
|
|
SMALL_TAB_HOME = 0,
|
|
|
|
SMALL_TAB_QUIT,
|
|
|
|
SMALL_TAB_SETTINGS,
|
|
|
|
SMALL_TAB_EDITOR,
|
|
|
|
SMALL_TAB_DEMOBUTTON,
|
|
|
|
SMALL_TAB_SERVER,
|
|
|
|
|
|
|
|
SMALL_TAB_LENGTH,
|
2014-06-05 10:11:41 +00:00
|
|
|
};
|
|
|
|
|
2020-10-26 02:48:05 +00:00
|
|
|
SUIAnimator m_aAnimatorsBigPage[BIG_TAB_LENGTH];
|
|
|
|
SUIAnimator m_aAnimatorsSmallPage[SMALL_TAB_LENGTH];
|
|
|
|
SUIAnimator m_aAnimatorsSettingsTab[SETTINGS_LENGTH];
|
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
2022-05-23 18:16:18 +00:00
|
|
|
int DoButton_CheckBox_Tristate(const void *pID, const char *pText, TRISTATE Checked, const CUIRect *pRect);
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<CDemoItem> m_vDemos;
|
2011-02-04 17:25:04 +00:00
|
|
|
void DemolistPopulate();
|
2022-08-28 15:52:49 +00:00
|
|
|
void DemoSeekTick(IDemoPlayer::ETickOffset TickOffset);
|
2015-08-28 18:44:07 +00:00
|
|
|
bool m_Dummy;
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2017-09-09 21:10:42 +00:00
|
|
|
const char *GetCurrentDemoFolder() const { return m_aCurrentDemoFolder; }
|
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// Ghost
|
2011-02-04 17:25:04 +00:00
|
|
|
struct CGhostItem
|
|
|
|
{
|
2021-09-13 08:06:34 +00:00
|
|
|
char m_aFilename[IO_MAX_PATH_LENGTH];
|
2011-02-04 17:25:04 +00:00
|
|
|
char m_aPlayer[MAX_NAME_LENGTH];
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2017-08-30 23:59:22 +00:00
|
|
|
int m_Time;
|
2017-09-09 16:25:32 +00:00
|
|
|
int m_Slot;
|
|
|
|
bool m_Own;
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
CGhostItem() :
|
|
|
|
m_Slot(-1), m_Own(false) { m_aFilename[0] = 0; }
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const CGhostItem &Other) const { return m_Time < Other.m_Time; }
|
2019-04-28 17:22:19 +00:00
|
|
|
|
2017-09-09 16:25:32 +00:00
|
|
|
bool Active() const { return m_Slot != -1; }
|
|
|
|
bool HasFile() const { return m_aFilename[0]; }
|
2011-02-04 17:25:04 +00:00
|
|
|
};
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<CGhostItem> m_vGhosts;
|
2017-09-09 16:25:32 +00:00
|
|
|
|
2022-05-18 16:00:05 +00:00
|
|
|
std::chrono::nanoseconds m_GhostPopulateStartTime{0};
|
2022-04-02 11:37:59 +00:00
|
|
|
|
2011-02-04 17:25:04 +00:00
|
|
|
void GhostlistPopulate();
|
2017-09-09 16:25:32 +00:00
|
|
|
CGhostItem *GetOwnGhost();
|
2017-09-10 01:48:22 +00:00
|
|
|
void UpdateOwnGhost(CGhostItem Item);
|
|
|
|
void DeleteGhostItem(int Index);
|
2017-09-09 16:25:32 +00:00
|
|
|
|
2014-05-17 12:28:50 +00:00
|
|
|
void setPopup(int Popup) { m_Popup = Popup; }
|
2020-08-29 10:49:45 +00:00
|
|
|
int GetCurPopup() { return m_Popup; }
|
|
|
|
bool CanDisplayWarning();
|
|
|
|
|
2022-05-18 16:00:05 +00:00
|
|
|
void PopupWarning(const char *pTopic, const char *pBody, const char *pButton, std::chrono::nanoseconds Duration);
|
2020-08-29 10:49:45 +00:00
|
|
|
|
2022-05-18 16:00:05 +00:00
|
|
|
std::chrono::nanoseconds m_PopupWarningLastTime;
|
|
|
|
std::chrono::nanoseconds m_PopupWarningDuration;
|
2014-05-17 12:28:50 +00:00
|
|
|
|
2014-08-23 15:48:04 +00:00
|
|
|
int m_DemoPlayerState;
|
2014-08-25 09:19:00 +00:00
|
|
|
char m_aDemoPlayerPopupHint[256];
|
2014-08-23 15:48:04 +00:00
|
|
|
|
2014-05-17 12:28:50 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
POPUP_NONE = 0,
|
2022-11-30 21:26:40 +00:00
|
|
|
POPUP_MESSAGE, // generic message popup (one button)
|
|
|
|
POPUP_CONFIRM, // generic confirmation popup (two buttons)
|
2014-05-17 12:28:50 +00:00
|
|
|
POPUP_FIRST_LAUNCH,
|
2020-10-23 21:25:58 +00:00
|
|
|
POPUP_POINTS,
|
2014-05-17 12:28:50 +00:00
|
|
|
POPUP_CONNECTING,
|
|
|
|
POPUP_DISCONNECTED,
|
|
|
|
POPUP_LANGUAGE,
|
|
|
|
POPUP_COUNTRY,
|
|
|
|
POPUP_RENAME_DEMO,
|
2019-09-26 15:28:29 +00:00
|
|
|
POPUP_RENDER_DEMO,
|
2014-05-17 12:28:50 +00:00
|
|
|
POPUP_PASSWORD,
|
|
|
|
POPUP_QUIT,
|
2020-08-29 10:49:45 +00:00
|
|
|
POPUP_WARNING,
|
2014-08-23 15:48:04 +00:00
|
|
|
|
|
|
|
// demo player states
|
2020-09-26 19:41:58 +00:00
|
|
|
DEMOPLAYER_NONE = 0,
|
2014-08-23 15:48:04 +00:00
|
|
|
DEMOPLAYER_SLICE_SAVE,
|
2014-05-17 12:28:50 +00:00
|
|
|
};
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static int GhostlistFetchCallback(const char *pName, int IsDir, int StorageType, void *pUser);
|
2020-09-03 12:08:26 +00:00
|
|
|
void SetMenuPage(int NewPage);
|
2022-09-23 17:59:18 +00:00
|
|
|
void RefreshBrowserTab(int UiPage);
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
// found in menus_ingame.cpp
|
2016-04-27 18:14:03 +00:00
|
|
|
void RenderInGameNetwork(CUIRect MainView);
|
2011-04-09 06:41:31 +00:00
|
|
|
void RenderGhost(CUIRect MainView);
|
|
|
|
|
|
|
|
// found in menus_settings.cpp
|
2016-05-07 13:59:13 +00:00
|
|
|
void RenderSettingsDDNet(CUIRect MainView);
|
2022-06-26 22:38:49 +00:00
|
|
|
void RenderSettingsAppearance(CUIRect MainView);
|
2020-10-29 00:55:01 +00:00
|
|
|
ColorHSLA RenderHSLColorPicker(const CUIRect *pRect, unsigned int *pColor, bool Alpha);
|
2021-05-03 03:59:50 +00:00
|
|
|
ColorHSLA RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool Alpha = false, bool ClampedLight = false);
|
2020-09-03 12:08:26 +00:00
|
|
|
|
2022-07-16 13:32:06 +00:00
|
|
|
int RenderDropDown(int &CurDropDownState, CUIRect *pRect, int CurSelection, const void **pIDs, const char **pStr, int PickNum, CButtonContainer *pButtonContainer, float &ScrollVal);
|
2021-01-31 20:54:04 +00:00
|
|
|
|
2020-09-03 12:08:26 +00:00
|
|
|
CServerProcess m_ServerProcess;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
#endif
|