Skip to content

Commit

Permalink
ddnet change fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Sep 29, 2023
1 parent 3bfa2d3 commit 608d5d4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
38 changes: 21 additions & 17 deletions src/game/client/components/menus_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,23 +519,27 @@ void CMenus::RenderServerbrowserStatusBox(CUIRect StatusBox, bool WasListboxItem
}

// render status
char aBufSvr[128];
char aBufPyr[128];
if(ServerBrowser()->NumServers() != 1)
str_format(aBufSvr, sizeof(aBufSvr), Localize("%d of %d servers"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers());
else
str_format(aBufSvr, sizeof(aBufSvr), Localize("%d of %d server"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers());
if(NumPlayers != 1)
str_format(aBufPyr, sizeof(aBufPyr), Localize("%d players"), NumPlayers);
else
str_format(aBufPyr, sizeof(aBufPyr), Localize("%d player"), NumPlayers);

CUIRect SvrsOnline, PlysOnline;
Status3.HSplitTop(20.f, &PlysOnline, &SvrsOnline);
PlysOnline.VSplitRight(TextRender()->TextWidth(12.0f, aBufPyr, -1, -1.0f), 0, &PlysOnline);
UI()->DoLabel(&PlysOnline, aBufPyr, 12.0f, TEXTALIGN_LEFT);
SvrsOnline.VSplitRight(TextRender()->TextWidth(12.0f, aBufSvr, -1, -1.0f), 0, &SvrsOnline);
UI()->DoLabel(&SvrsOnline, aBufSvr, 12.0f, TEXTALIGN_LEFT);
{
CUIRect ServersOnline, PlayersOnline;
ServersPlayersOnline.HSplitMid(&PlayersOnline, &ServersOnline);

char aBuf[128];
if(ServerBrowser()->NumServers() != 1)
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers());
else
str_format(aBuf, sizeof(aBuf), Localize("%d of %d server"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers());
UI()->DoLabel(&ServersOnline, aBuf, 12.0f, TEXTALIGN_MR);

int NumPlayers = 0;
for(int i = 0; i < ServerBrowser()->NumSortedServers(); i++)
NumPlayers += ServerBrowser()->SortedGet(i)->m_NumFilteredPlayers;

if(NumPlayers != 1)
str_format(aBuf, sizeof(aBuf), Localize("%d players"), NumPlayers);
else
str_format(aBuf, sizeof(aBuf), Localize("%d player"), NumPlayers);
UI()->DoLabel(&PlayersOnline, aBuf, 12.0f, TEXTALIGN_MR);
}

// status box
{
Expand Down
8 changes: 4 additions & 4 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3477,11 +3477,11 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Button.VSplitLeft(120.0f, &KeyLabel, &Button);
Button.VSplitLeft(100, &Button, 0);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name));
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_pName));

UI()->DoLabel(&KeyLabel, aBuf, 20.0f, TEXTALIGN_LEFT);
int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination;
int NewId = DoKeyReader((void *)&Key.m_Name, &Button, OldId, OldModifierCombination, &NewModifierCombination);
int NewId = DoKeyReader((void *)&Key.m_pName, &Button, OldId, OldModifierCombination, &NewModifierCombination);
if(NewId != OldId || NewModifierCombination != OldModifierCombination)
{
if(OldId != 0 || NewId == 0)
Expand Down Expand Up @@ -3612,11 +3612,11 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Button.VSplitLeft(120.0f, &KeyLabel, &Button);
Button.VSplitLeft(100, &Button, 0);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_Name));
str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_pName));

UI()->DoLabel(&KeyLabel, aBuf, 13.0f, TEXTALIGN_LEFT);
int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination;
int NewId = DoKeyReader((void *)&Key.m_Name, &Button, OldId, OldModifierCombination, &NewModifierCombination);
int NewId = DoKeyReader((void *)&Key.m_pName, &Button, OldId, OldModifierCombination, &NewModifierCombination);
if(NewId != OldId || NewModifierCombination != OldModifierCombination)
{
if(OldId != 0 || NewId == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/outlines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

void COutlines::OnRender()
{
if(GameClient()->m_MapLayersBackGround.m_OnlineOnly && Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
if(GameClient()->m_MapLayersBackground.m_OnlineOnly && Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!g_Config.m_ClOverlayEntities && g_Config.m_ClOutlineEntities)
return;
Expand Down
5 changes: 3 additions & 2 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,9 @@ void CPlayers::OnRender()
m_aRenderInfo[i].m_TeeRenderFlags |= TEE_EFFECT_FROZEN;

const CGameClient::CSnapState::CCharacterInfo &CharacterInfo = m_pClient->m_Snap.m_aCharacters[i];
if (((CharacterInfo.m_Cur.m_Weapon == WEAPON_NINJA || Frozen) && g_Config.m_ClShowNinja) || (g_Config.m_ClAmIFrozen && g_Config.m_ClFreezeUpdateFix
&& m_pClient->m_Snap.m_LocalClientID == i && g_Config.m_ClShowNinja) || (Frozen && !m_pClient->m_GameInfo.m_NoSkinChangeForFrozen && g_Config.m_ClShowNinja))
const bool Frozen = CharacterInfo.m_HasExtendedData && CharacterInfo.m_ExtendedData.m_FreezeEnd != 0;

if(((CharacterInfo.m_Cur.m_Weapon == WEAPON_NINJA || Frozen) && g_Config.m_ClShowNinja) || (g_Config.m_ClAmIFrozen && g_Config.m_ClFreezeUpdateFix && m_pClient->m_Snap.m_LocalClientID == i && g_Config.m_ClShowNinja) || (Frozen && !m_pClient->m_GameInfo.m_NoSkinChangeForFrozen && g_Config.m_ClShowNinja))
{
// change the skin for the player to the ninja
const auto *pSkin = m_pClient->m_Skins.FindOrNullptr("x_ninja");
Expand Down

0 comments on commit 608d5d4

Please sign in to comment.