Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background maps and menu tweaks #888

Merged
merged 10 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions mp/game/neo/resource/ClientScheme.res
Original file line number Diff line number Diff line change
Expand Up @@ -679,23 +679,69 @@ Scheme
{
"1"
{
"name" "neotokyo_press_N" // CSlogo.ttf
"tall" "42" [$WINDOWS]
"tall" "72" [$LINUX]
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "60"
"weight" "0"
"additive" "0"
"antialias" "1"
"custom" "1"
"yres" "1 633"
}
"2"
{
"name" "neotokyo_press_N" // CSlogo.ttf
"tall" "46" [$WINDOWS]
"tall" "76" [$LINUX]
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "100"
"weight" "0"
"additive" "0"
"antialias" "1"
"custom" "1"
"yres" "634 1080"
}
"3"
{
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "127"
"weight" "0"
"additive" "0"
"antialias" "1"
"yres" "1080 10000"
}
// It seems that 127 is the largest a font can be, so we can't make the title any bigger than this
}

ClientTitleFontSmall
{
"1"
{
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "42"
"weight" "0"
"additive" "0"
"antialias" "1"
"custom" "1"
"yres" "1 633"
}
"2"
{
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "72"
"weight" "0"
"additive" "0"
"antialias" "1"
"custom" "1"
"yres" "634 1080"
}
"3"
{
"name" "neotokyo_press_N" // neotokyo_press_n
"tall" "92"
"weight" "0"
"additive" "0"
"antialias" "1"
"yres" "1080 10000"
}
}


"BetaFont"
{
Expand Down
Binary file modified mp/game/neo/resource/neotokyo_press_n.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions mp/game/neo/scripts/ChapterBackgrounds.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"chapters"
{
1 "background01"
2 "background_alley"
3 "background_door"
4 "background_door"
}
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void CNeoLoading::ApplySchemeSettings(vgui::IScheme *pScheme)
SetBgColor(COLOR_TRANSPARENT);

static constexpr const char *FONT_NAMES[NeoUI::FONT__TOTAL] = {
"NeoUINormal", "NHudOCR", "NHudOCRSmallNoAdditive", "ClientTitleFont",
"NeoUINormal", "NHudOCR", "NHudOCRSmallNoAdditive", "ClientTitleFont", "ClientTitleFontSmall",
"NeoUILarge"
};
for (int i = 0; i < NeoUI::FONT__TOTAL; ++i)
Expand Down
122 changes: 78 additions & 44 deletions mp/src/game/client/neo/ui/neo_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ namespace {

int g_iAvatar = 64;
int g_iRootSubPanelWide = 600;
constexpr wchar_t WSZ_GAME_TITLE[] = L"neatbkyoc ue";
constexpr wchar_t WSZ_GAME_TITLE1[] = L"neAtBkyoC";
constexpr wchar_t WSZ_GAME_TITLE1_a[] = L"neAtBkyo";
constexpr wchar_t WSZ_GAME_TITLE1_b[] = L"C";
constexpr wchar_t WSZ_GAME_TITLE2[] = L"Hrebuild";
#define SZ_WEBSITE "https://neotokyorebuild.github.io"

ConCommand neo_toggleconsole("neo_toggleconsole", NeoToggleconsole);
Expand Down Expand Up @@ -292,9 +295,9 @@ void CNeoRoot::UpdateControls()
{
if (m_state == STATE_ROOT)
{
auto hdlFont = g_uiCtx.fonts[NeoUI::FONT_LOGO].hdl;
auto hdlFont = g_uiCtx.fonts[NeoUI::FONT_LOGOSMALL].hdl;
surface()->DrawSetTextFont(hdlFont);
surface()->GetTextSize(hdlFont, WSZ_GAME_TITLE, m_iTitleWidth, m_iTitleHeight);
surface()->GetTextSize(hdlFont, WSZ_GAME_TITLE2, m_iTitleWidth, m_iTitleHeight);
}
g_uiCtx.iActiveDirection = 0;
g_uiCtx.iActive = NeoUI::FOCUSOFF_NUM;
Expand Down Expand Up @@ -334,7 +337,7 @@ void CNeoRoot::ApplySchemeSettings(IScheme *pScheme)
SetBgColor(COLOR_TRANSPARENT);

static constexpr const char *FONT_NAMES[NeoUI::FONT__TOTAL] = {
"NeoUINormal", "NHudOCR", "NHudOCRSmallNoAdditive", "ClientTitleFont",
"NeoUINormal", "NHudOCR", "NHudOCRSmallNoAdditive", "ClientTitleFont", "ClientTitleFontSmall",
"NeoUILarge"
};
for (int i = 0; i < NeoUI::FONT__TOTAL; ++i)
Expand Down Expand Up @@ -473,25 +476,10 @@ void CNeoRoot::OnMainLoop(const NeoUI::Mode eMode)

const RootState ePrevState = m_state;

if (eMode == NeoUI::MODE_PAINT)
{
// Draw version info (bottom left corner) - Always
surface()->DrawSetTextColor(COLOR_NEOPANELTEXTBRIGHT);
int textWidth, textHeight;
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_NTNORMAL].hdl);
surface()->GetTextSize(g_uiCtx.fonts[NeoUI::FONT_NTNORMAL].hdl, BUILD_DISPLAY, textWidth, textHeight);

surface()->DrawSetTextPos(g_uiCtx.iMarginX, tall - textHeight - g_uiCtx.iMarginY);
surface()->DrawPrintText(BUILD_DISPLAY, *BUILD_DISPLAY_SIZE);
}

// Laading screen just overlays over the root, so don't render anything else if so
if (m_bOnLoadingScreen)
if (!m_bOnLoadingScreen)
{
return;
}

static constexpr void (CNeoRoot::*P_FN_MAIN_LOOP[STATE__TOTAL])(const MainLoopParam param) = {
static constexpr void (CNeoRoot:: * P_FN_MAIN_LOOP[STATE__TOTAL])(const MainLoopParam param) = {
&CNeoRoot::MainLoopRoot, // STATE_ROOT
&CNeoRoot::MainLoopSettings, // STATE_SETTINGS
&CNeoRoot::MainLoopNewGame, // STATE_NEWGAME
Expand All @@ -506,31 +494,50 @@ void CNeoRoot::OnMainLoop(const NeoUI::Mode eMode)
&CNeoRoot::MainLoopPopup, // STATE_QUIT
&CNeoRoot::MainLoopPopup, // STATE_SERVERPASSWORD
&CNeoRoot::MainLoopPopup, // STATE_SETTINGSRESETDEFAULT
};
(this->*P_FN_MAIN_LOOP[m_state])(MainLoopParam{.eMode = eMode, .wide = wide, .tall = tall});
};
(this->*P_FN_MAIN_LOOP[m_state])(MainLoopParam{ .eMode = eMode, .wide = wide, .tall = tall });

if (m_state != ePrevState)
{
if (ePrevState == STATE_SETTINGS)
if (m_state != ePrevState)
{
V_memcpy(m_iSavedYOffsets, g_uiCtx.iYOffset, NeoUI::SIZEOF_SECTIONS);
}
UpdateControls();
if (m_state == STATE_SETTINGS && ePrevState >= STATE__POPUPSTART && ePrevState < STATE__TOTAL)
{
V_memcpy(g_uiCtx.iYOffset, m_iSavedYOffsets, NeoUI::SIZEOF_SECTIONS);
if (ePrevState == STATE_SETTINGS)
{
V_memcpy(m_iSavedYOffsets, g_uiCtx.iYOffset, NeoUI::SIZEOF_SECTIONS);
}
UpdateControls();
if (m_state == STATE_SETTINGS && ePrevState >= STATE__POPUPSTART && ePrevState < STATE__TOTAL)
{
V_memcpy(g_uiCtx.iYOffset, m_iSavedYOffsets, NeoUI::SIZEOF_SECTIONS);
}
}
}

if (eMode == NeoUI::MODE_PAINT)
{
// Draw version info (bottom left corner) - Always
surface()->DrawSetTextColor(COLOR_NEOPANELTEXTBRIGHT);
int textWidth, textHeight;
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_NTNORMAL].hdl);
surface()->GetTextSize(g_uiCtx.fonts[NeoUI::FONT_NTNORMAL].hdl, BUILD_DISPLAY, textWidth, textHeight);

surface()->DrawSetTextPos(g_uiCtx.iMarginX, tall - textHeight - g_uiCtx.iMarginY);
surface()->DrawPrintText(BUILD_DISPLAY, *BUILD_DISPLAY_SIZE);
}
}

void CNeoRoot::MainLoopRoot(const MainLoopParam param)
{
const int yTopPos = param.tall / 2 - ((g_uiCtx.iRowTall * BTNS_TOTAL) / 2);
g_uiCtx.dPanel.wide = m_iTitleWidth + (2 * g_uiCtx.iMarginX);
g_uiCtx.dPanel.tall = param.tall - yTopPos;
g_uiCtx.dPanel.x = (param.wide / 4) - (g_uiCtx.dPanel.wide / 2);
g_uiCtx.dPanel.y = yTopPos;
g_uiCtx.bgColor = COLOR_TRANSPARENT;
int iTitleNWidth, iTitleNHeight;
const int iBtnPlaceXMid = (param.wide / 6);
const int iMargin = (6 * g_uiCtx.iMarginX);
const int iMarginHalf = iMargin * 0.5;
const int iTitleMarginTop = (param.tall * 0.2);
surface()->GetTextSize(g_uiCtx.fonts[NeoUI::FONT_LOGO].hdl, L"n", iTitleNWidth, iTitleNHeight);
g_uiCtx.dPanel.wide = (m_iTitleWidth) +iMargin;
g_uiCtx.dPanel.tall = param.tall;
g_uiCtx.dPanel.x = iBtnPlaceXMid - (m_iTitleWidth * 0.5) + (iTitleNWidth * 1.16) - iMarginHalf;
g_uiCtx.dPanel.y = 0;
g_uiCtx.iYOffset[0] = (iTitleMarginTop + (2 * iTitleNHeight)) / -g_uiCtx.iRowTall;
g_uiCtx.bgColor = COLOR_NEOPANELNORMALBG;

NeoUI::BeginContext(&g_uiCtx, param.eMode, nullptr, "CtxRoot");
NeoUI::BeginSection(true);
Expand Down Expand Up @@ -569,21 +576,45 @@ void CNeoRoot::MainLoopRoot(const MainLoopParam param)
}
}
NeoUI::EndSection();
g_uiCtx.bgColor = COLOR_TRANSPARENT;

const int iBtnPlaceXMid = (param.wide / 4);
const int iBtnWide = m_iTitleWidth + (2 * g_uiCtx.iMarginX);
const int iRightXPos = iBtnPlaceXMid + (iBtnWide / 2) + g_uiCtx.iMarginX;
int iRightSideYStart = yTopPos;
const int iBtnWide = m_iTitleWidth + iMargin;
const int iRightXPos = iBtnPlaceXMid + (iBtnWide / 2) + iMarginHalf;
int iRightSideYStart = (iTitleMarginTop + (2 * iTitleNHeight));

// Draw top steam section portion
{
// Draw title
int iFirstWidth, iFirstHeight;
int iDropShadowOffset = MIN(8, param.wide * 0.005);
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_LOGO].hdl);
surface()->GetTextSize(g_uiCtx.fonts[NeoUI::FONT_LOGO].hdl, WSZ_GAME_TITLE1_a, iFirstWidth, iFirstHeight);
surface()->DrawSetTextColor(COLOR_BLACK);
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5) - iDropShadowOffset, iTitleMarginTop + iDropShadowOffset);
surface()->DrawPrintText(WSZ_GAME_TITLE1, SZWSZ_LEN(WSZ_GAME_TITLE1));
surface()->DrawSetTextColor(COLOR_NEOTITLE);
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5), iTitleMarginTop);
surface()->DrawPrintText(WSZ_GAME_TITLE1_a, SZWSZ_LEN(WSZ_GAME_TITLE1_a));
surface()->DrawSetTextColor(COLOR_RED);
surface()->DrawPrintText(WSZ_GAME_TITLE1_b, SZWSZ_LEN(WSZ_GAME_TITLE1_b));

surface()->DrawSetTextColor(COLOR_BLACK);
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5) + (iTitleNWidth * 1.16) - iDropShadowOffset, iTitleMarginTop + m_iTitleHeight + iDropShadowOffset);
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_LOGOSMALL].hdl);
surface()->DrawPrintText(WSZ_GAME_TITLE2, SZWSZ_LEN(WSZ_GAME_TITLE2));
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5) + (iTitleNWidth * 1.16) - iDropShadowOffset, iTitleMarginTop + m_iTitleHeight + iDropShadowOffset);
surface()->DrawPrintText(L"G", SZWSZ_LEN(L"G"));

surface()->DrawSetTextColor(COLOR_NEOTITLE);
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth / 2), yTopPos - m_iTitleHeight);
surface()->DrawPrintText(WSZ_GAME_TITLE, SZWSZ_LEN(WSZ_GAME_TITLE));
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5) + (iTitleNWidth * 1.16), iTitleMarginTop + m_iTitleHeight);
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_LOGOSMALL].hdl);
surface()->DrawPrintText(WSZ_GAME_TITLE2, SZWSZ_LEN(WSZ_GAME_TITLE2));
surface()->DrawSetTextColor(COLOR_RED);
surface()->DrawSetTextPos(iBtnPlaceXMid - (m_iTitleWidth * 0.5) + (iTitleNWidth * 1.16), iTitleMarginTop + m_iTitleHeight);
surface()->DrawPrintText(L"G", SZWSZ_LEN(L"G"));
surface()->DrawSetTextFont(g_uiCtx.fonts[NeoUI::FONT_NTNORMAL].hdl);

#if (0) // NEO TODO (Adam) place the current player info in the top right corner maybe?
surface()->DrawSetTextColor(COLOR_NEOPANELTEXTBRIGHT);
ISteamUser *steamUser = steamapicontext->SteamUser();
ISteamFriends *steamFriends = steamapicontext->SteamFriends();
Expand Down Expand Up @@ -666,8 +697,10 @@ void CNeoRoot::MainLoopRoot(const MainLoopParam param)
const int iTextTotalTall = iMainTextHeight + iStatusTall;
iRightSideYStart += (g_uiCtx.iMarginX * 2) + ((iTextTotalTall > g_iAvatar) ? iTextTotalTall : g_iAvatar);
}
#endif (0)
}

#if (0) // NEO TODO (Adam) some kind of drop down for the news section, better position the current server info etc.
g_uiCtx.dPanel.x = iRightXPos;
g_uiCtx.dPanel.y = iRightSideYStart;
if (IsInGame())
Expand Down Expand Up @@ -719,6 +752,7 @@ void CNeoRoot::MainLoopRoot(const MainLoopParam param)
}
}
NeoUI::EndSection();
#endif (0)
NeoUI::EndContext();
}

Expand Down
3 changes: 3 additions & 0 deletions mp/src/game/client/neo/ui/neo_root_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ void NeoSettingsRestore(NeoSettings *ns, const NeoSettings::Keys::Flags flagsKey
pGeneral->bStreamerMode = cvr->neo_cl_streamermode.GetBool();
pGeneral->bAutoDetectOBS = cvr->neo_cl_streamermode_autodetect_obs.GetBool();
pGeneral->bEnableRangeFinder = cvr->neo_cl_hud_rangefinder_enabled.GetBool();
pGeneral->iBackground = cvr->sv_unlockedchapters.GetInt();
}
{
NeoSettings::Keys *pKeys = &ns->keys;
Expand Down Expand Up @@ -454,6 +455,7 @@ void NeoSettingsSave(const NeoSettings *ns)
cvr->neo_cl_streamermode.SetValue(pGeneral->bStreamerMode);
cvr->neo_cl_streamermode_autodetect_obs.SetValue(pGeneral->bAutoDetectOBS);
cvr->neo_cl_hud_rangefinder_enabled.SetValue(pGeneral->bEnableRangeFinder);
cvr->sv_unlockedchapters.SetValue(pGeneral->iBackground);
}
{
const NeoSettings::Keys *pKeys = &ns->keys;
Expand Down Expand Up @@ -656,6 +658,7 @@ void NeoSettings_General(NeoSettings *ns)
NeoUI::RingBoxBool(L"Auto streamer mode (requires restart)", &pGeneral->bAutoDetectOBS);
NeoUI::Label(L"OBS detection", g_bOBSDetected ? L"OBS detected on startup" : L"Not detected on startup");
NeoUI::RingBoxBool(L"Show rangefinder", &pGeneral->bEnableRangeFinder);
NeoUI::SliderInt(L"Selected Background", &pGeneral->iBackground, 1, 4); // NEO TODO (Adam) switch to RingBox with values read from ChapterBackgrounds.txt
}

void NeoSettings_Keys(NeoSettings *ns)
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/client/neo/ui/neo_root_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct NeoSettings
bool bStreamerMode;
bool bAutoDetectOBS;
bool bEnableRangeFinder;
int iBackground;
};

struct Keys
Expand Down Expand Up @@ -173,6 +174,7 @@ struct NeoSettings
CONVARREF_DEF(neo_cl_streamermode);
CONVARREF_DEF(neo_cl_streamermode_autodetect_obs);
CONVARREF_DEF(neo_cl_hud_rangefinder_enabled);
CONVARREF_DEF(sv_unlockedchapters);

// Multiplayer
CONVARREF_DEF(cl_playerspraydisable);
Expand Down
17 changes: 16 additions & 1 deletion mp/src/game/client/neo/ui/neo_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,11 @@ NeoUI::RetButton Button(const wchar_t *wszLeftLabel, const wchar_t *wszText)

if (wszLeftLabel)
{
if (wdgState.bHot)
{
GCtxDrawFilledRectXtoX(0, g_pCtx->dPanel.wide);
}
InternalLabel(wszLeftLabel, false);
GCtxDrawFilledRectXtoX(g_pCtx->iWgXPos, g_pCtx->dPanel.wide);
const int xMargin = g_pCtx->eButtonTextStyle == TEXTSTYLE_CENTER ?
(((g_pCtx->dPanel.wide - g_pCtx->iWgXPos) / 2) - (iFontWide / 2)) : g_pCtx->iMarginX;
GCtxDrawSetTextPos(g_pCtx->iWgXPos + xMargin,
Expand Down Expand Up @@ -629,6 +632,10 @@ void RingBox(const wchar_t *wszLeftLabel, const wchar_t **wszLabelsList, const i
{
case MODE_PAINT:
{
if (wdgState.bHot)
{
GCtxDrawFilledRectXtoX(0, g_pCtx->dPanel.wide);
}
const auto *pFontI = &g_pCtx->fonts[g_pCtx->eFont];
InternalLabel(wszLeftLabel, false);

Expand Down Expand Up @@ -827,6 +834,10 @@ void Slider(const wchar_t *wszLeftLabel, float *flValue, const float flMin, cons
case MODE_PAINT:
{
const auto *pFontI = &g_pCtx->fonts[g_pCtx->eFont];
if (wdgState.bHot)
{
GCtxDrawFilledRectXtoX(0, g_pCtx->dPanel.wide);
}
InternalLabel(wszLeftLabel, false);

// Background bar
Expand Down Expand Up @@ -1029,6 +1040,10 @@ void TextEdit(const wchar_t *wszLeftLabel, wchar_t *wszText, const int iMaxBytes
{
case MODE_PAINT:
{
if (wdgState.bHot)
{
GCtxDrawFilledRectXtoX(0, g_pCtx->dPanel.wide);
}
const auto *pFontI = &g_pCtx->fonts[g_pCtx->eFont];
InternalLabel(wszLeftLabel, false);
GCtxDrawFilledRectXtoX(g_pCtx->iWgXPos, g_pCtx->dPanel.wide);
Expand Down
Loading