Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SollyBunny committed Nov 20, 2024
1 parent 61d3b2f commit 3d5b996
Show file tree
Hide file tree
Showing 19 changed files with 516 additions and 705 deletions.
8 changes: 4 additions & 4 deletions src/engine/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class IClient : public IInterface
};

/**
* More precise state for @see STATE_LOADING
* Sets what is actually happening in the client right now
*/
* More precise state for @see STATE_LOADING
* Sets what is actually happening in the client right now
*/
enum ELoadingStateDetail
{
LOADING_STATE_DETAIL_INITIAL,
Expand Down Expand Up @@ -268,7 +268,7 @@ class IClient : public IInterface

virtual IGraphics::CTextureHandle GetDebugFont() const = 0; // TODO: remove this function

//DDRace
// DDRace

virtual const char *GetCurrentMap() const = 0;
virtual const char *GetCurrentMapPath() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class CClient : public IClient, public CDemoPlayer::IListener

IFriends *Foes() override { return &m_Foes; }

void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;

void AddWarning(const SWarning &Warning) override;
Expand Down
10 changes: 4 additions & 6 deletions src/engine/shared/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void CConfigManager::Init()
{ \
const size_t HelpSize = (size_t)str_length(Desc) + 32; \
char *pHelp = static_cast<char *>(m_ConfigHeap.Allocate(HelpSize)); \
const bool Alpha = ((Flags)&CFGFLAG_COLALPHA) != 0; \
const bool Alpha = ((Flags) & CFGFLAG_COLALPHA) != 0; \
str_format(pHelp, HelpSize, "%s (default: $%0*X)", Desc, Alpha ? 8 : 6, color_cast<ColorRGBA>(ColorHSLA(Def, Alpha)).Pack(Alpha)); \
AddVariable(m_ConfigHeap.Allocate<SColorConfigVariable>(m_pConsole, #ScriptName, SConfigVariable::VAR_COLOR, Flags, pHelp, &g_Config.m_##Name, Def)); \
}
Expand Down Expand Up @@ -455,19 +455,19 @@ bool CConfigManager::TSave()
char aEscapeBuf[1024 * 2];

#define MACRO_CONFIG_INT(Name, ScriptName, def, min, max, flags, desc) \
if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \
if((flags) & CFGFLAG_SAVE && g_Config.m_##Name != def) \
{ \
str_format(aLineBuf, sizeof(aLineBuf), "%s %i", #ScriptName, g_Config.m_##Name); \
WriteLine(aLineBuf); \
}
#define MACRO_CONFIG_COL(Name, ScriptName, def, flags, desc) \
if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \
if((flags) & CFGFLAG_SAVE && g_Config.m_##Name != def) \
{ \
str_format(aLineBuf, sizeof(aLineBuf), "%s %u", #ScriptName, g_Config.m_##Name); \
WriteLine(aLineBuf); \
}
#define MACRO_CONFIG_STR(Name, ScriptName, len, def, flags, desc) \
if((flags)&CFGFLAG_SAVE && str_comp(g_Config.m_##Name, def) != 0) \
if((flags) & CFGFLAG_SAVE && str_comp(g_Config.m_##Name, def) != 0) \
{ \
EscapeParam(aEscapeBuf, g_Config.m_##Name, sizeof(aEscapeBuf)); \
str_format(aLineBuf, sizeof(aLineBuf), "%s \"%s\"", #ScriptName, aEscapeBuf); \
Expand All @@ -485,7 +485,6 @@ bool CConfigManager::TSave()
Callback.m_pfnFunc(this, Callback.m_pUserData);
}


if(io_sync(m_ConfigFile) != 0)
{
m_Failed = true;
Expand Down Expand Up @@ -522,7 +521,6 @@ void CConfigManager::RegisterTCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData
m_vTCallbacks.emplace_back(pfnFunc, pUserData);
}


void CConfigManager::WriteLine(const char *pLine)
{
if(!m_ConfigFile ||
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/binds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void CBinds::SetDefaults()
Bind(KEY_MOUSE_1, "+fire");
Bind(KEY_MOUSE_2, "+hook");
Bind(KEY_LSHIFT, "+emote");
Bind(KEY_Q, "+bindwheel");
Bind(KEY_Q, "+bindwheel");
Bind(KEY_RETURN, "+show_chat; chat all");
Bind(KEY_RIGHT, "spectate_next");
Bind(KEY_LEFT, "spectate_previous");
Expand Down
6 changes: 2 additions & 4 deletions src/game/client/components/bindwheel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class IConfigManager;

class CBindWheel : public CComponent
{
void DrawCircle(float x, float y, float r, int Segments);
void DrawCircle(float x, float y, float r, int Segments);

bool m_WasActive;
bool m_Active;
Expand All @@ -30,7 +30,6 @@ class CBindWheel : public CComponent
};
SClientBindWheel m_BindWheelList[NUM_BINDWHEEL];


CBindWheel();
virtual int Sizeof() const override { return sizeof(*this); }

Expand All @@ -40,10 +39,9 @@ class CBindWheel : public CComponent
virtual void OnRelease() override;
virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override;
static void ConchainBindwheel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);

void updateBinds(int Bindpos, char *Description, char *Command);
void Binwheel(int Bind);

};

#endif
6 changes: 1 addition & 5 deletions src/game/client/components/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,5 @@ bool CControls::CheckNewInput()

m_FastInput = TestInput;

if (NewInput)
{
return true;
}
return false;
return NewInput;
}
31 changes: 13 additions & 18 deletions src/game/client/components/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,7 @@ void CHud::RenderScoreHud()

if(GameFlags & GAMEFLAG_FLAGS)
{
int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 &&
(Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ?
10 :
20;
int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 && (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ? 10 : 20;
if(aFlagCarrier[t] == FLAG_ATSTAND || (aFlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy) / BlinkTimer) & 1)))
{
// draw flag
Expand Down Expand Up @@ -304,7 +301,6 @@ void CHud::RenderScoreHud()
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[Id].m_RenderInfo;
TeeInfo.m_Size = ScoreSingleBoxHeight;


const CAnimState *pIdleState = CAnimState::GetIdle();
vec2 OffsetToMid;
CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
Expand Down Expand Up @@ -618,7 +614,7 @@ void CHud::RenderTextInfo()
}
}

//render team in freeze text and last notify
// render team in freeze text and last notify
if((g_Config.m_ClShowFrozenText > 0 || g_Config.m_ClShowFrozenHud > 0 || g_Config.m_ClNotifyWhenLast) && GameClient()->m_GameInfo.m_EntitiesDDRace)
{
int NumInTeam = 0;
Expand All @@ -640,30 +636,30 @@ void CHud::RenderTextInfo()
}
}

//Notify when last
// Notify when last
if(g_Config.m_ClNotifyWhenLast)
{
if(NumInTeam > 1 && NumInTeam - NumFrozen == 1)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s", g_Config.m_ClNotifyWhenLastText);
TextRender()->TextColor(color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClNotifyWhenLastColor)));
TextRender()->Text(170, 4, 14, aBuf, -1.0f);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
const float Size = 11.0f;
CUIRect BoundingBox{m_Width / 4.0f - m_Width / 8.0f, 2.0f, m_Width / 4.0f, Size};
TextRender()->TextColor(color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClNotifyWhenLastColor)));
Ui()->DoLabel(&BoundingBox, g_Config.m_ClNotifyWhenLastText, Size, TEXTALIGN_CENTER);
TextRender()->TextColor(TextRender()->DefaultTextColor());
}
}
//Show freeze text
// Show freeze text
char aBuf[64];
if(g_Config.m_ClShowFrozenText == 1)
str_format(aBuf, sizeof(aBuf), "%d / %d", NumInTeam - NumFrozen, NumInTeam);
else if(g_Config.m_ClShowFrozenText == 2)
str_format(aBuf, sizeof(aBuf), "%d / %d", NumFrozen, NumInTeam);
if(g_Config.m_ClShowFrozenText > 0)
TextRender()->Text(m_Width / 2 - TextRender()->TextWidth(10, aBuf, -1, -1.0f) / 2, 12, 10, aBuf, -1.0f);
TextRender()->Text(m_Width / 2.0f - TextRender()->TextWidth(10.f, aBuf) / 2.0f, 12.0f, 10.0f, aBuf);

//str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd);
//str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing);
//TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f);
// str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd);
// str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing);
// TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f);

if(g_Config.m_ClShowFrozenHud > 0 && !m_pClient->m_Scoreboard.Active() && !(LocalTeamID == 0 && g_Config.m_ClFrozenHudTeamOnly))
{
Expand All @@ -676,7 +672,6 @@ void CHud::RenderTextInfo()
FreezeInfo.m_ColorBody = ColorRGBA(1, 1, 1);
FreezeInfo.m_ColorFeet = ColorRGBA(1, 1, 1);
FreezeInfo.m_CustomColoredSkin = false;


float progressiveOffset = 0.0f;
float TeeSize = g_Config.m_ClFrozenHudTeeSize;
Expand Down
1 change: 0 additions & 1 deletion src/game/client/components/maplayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class CMapLayers : public CComponent
public:
bool m_OnlineOnly;


enum
{
TYPE_BACKGROUND = 0,
Expand Down
1 change: 1 addition & 0 deletions src/game/client/components/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ class CMenus : public CComponent
void PopupConfirmSwitchServer();
void RenderServerbrowserFilters(CUIRect View);
void ResetServerbrowserFilters();
void OpenTClientDiscord();
void RenderServerbrowserDDNetFilter(CUIRect View,
IFilterList &Filter,
float ItemHeight, int MaxItems, int ItemsPerRow,
Expand Down
Loading

0 comments on commit 3d5b996

Please sign in to comment.