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 1b3463f commit ed3c549
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 123 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
3 changes: 1 addition & 2 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3371,8 +3371,7 @@ bool CClient::InitNetworkClient(char *pError, size_t ErrorSize)
BindAddr.type = NETTYPE_ALL;
for(unsigned int i = 0; i < std::size(m_aNetClient); i++)
{
int &PortRef = i == CONN_MAIN ? g_Config.m_ClPort : i == CONN_DUMMY ? g_Config.m_ClDummyPort :
g_Config.m_ClContactPort;
int &PortRef = i == CONN_MAIN ? g_Config.m_ClPort : i == CONN_DUMMY ? g_Config.m_ClDummyPort : g_Config.m_ClContactPort;
if(PortRef < 1024) // Reject users setting ports that we don't want to use
{
PortRef = 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
4 changes: 1 addition & 3 deletions src/engine/shared/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ bool CConfigManager::TSave()
WriteLine(aLineBuf); \
}

#include "././game/tater_variables.h"
#include "game/tater_variables.h"

#undef MACRO_CONFIG_INT
#undef MACRO_CONFIG_COL
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
1 change: 0 additions & 1 deletion src/engine/shared/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ class CConfigManager : public IConfigManager
static void Con_Toggle(IConsole::IResult *pResult, void *pUserData);
static void Con_ToggleStroke(IConsole::IResult *pResult, void *pUserData);


public:
CConfigManager();

Expand Down
2 changes: 1 addition & 1 deletion src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define MACRO_CONFIG_STR(Name, ScriptName, Len, Def, Save, Desc) ;
#endif

#include "././game/tater_variables.h"
#include "game/tater_variables.h"

// client
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict client movements")
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
10 changes: 4 additions & 6 deletions src/game/client/components/bindwheel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#ifndef GAME_CLIENT_COMPONENTS_BIND_WHEEL_H
#define GAME_CLIENT_COMPONENTS_BIND_WHEEL_H
#ifndef GAME_CLIENT_COMPONENTS_BINDWHEEL_H
#define GAME_CLIENT_COMPONENTS_BINDWHEEL_H
#include <game/client/component.h>
class IConfigManager;

Expand All @@ -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;
}
19 changes: 7 additions & 12 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 @@ -644,7 +640,7 @@ void CHud::RenderTextInfo()
}
}

//Notify when last
// Notify when last
if(g_Config.m_ClNotifyWhenLast)
{
if(NumInTeam > 1 && NumInTeam - NumFrozen == 1)
Expand All @@ -656,7 +652,7 @@ void CHud::RenderTextInfo()
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);
Expand All @@ -665,9 +661,9 @@ void CHud::RenderTextInfo()
if(g_Config.m_ClShowFrozenText > 0)
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 @@ -680,7 +676,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
30 changes: 14 additions & 16 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static CButtonContainer s_RandomizeColors;
if(*pUseCustomColor)
{
//RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0);
// RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0);
if(DoButton_Menu(&s_RandomizeColors, "Random Colors", 0, &RandomColorsButton, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0, 0, 0, 0.5f)))
{
if(m_Dummy)
Expand Down Expand Up @@ -1749,7 +1749,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)

char aCurDeviceName[256 + 4];

int OldSelectedGpu = -1;
int RainbowSelectedOldGpu = -1;
for(size_t i = 0; i < GpuCount; ++i)
{
if(i == 0)
Expand All @@ -1758,35 +1758,35 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
s_vpGpuIdNames[i] = aCurDeviceName;
if(str_comp("auto", g_Config.m_GfxGpuName) == 0)
{
OldSelectedGpu = 0;
RainbowSelectedOldGpu = 0;
}
}
else
{
s_vpGpuIdNames[i] = GpuList.m_vGpus[i - 1].m_aName;
if(str_comp(GpuList.m_vGpus[i - 1].m_aName, g_Config.m_GfxGpuName) == 0)
{
OldSelectedGpu = i;
RainbowSelectedOldGpu = i;
}
}
}

static int s_OldSelectedGpu = -1;
if(s_OldSelectedGpu == -1)
s_OldSelectedGpu = OldSelectedGpu;
static int s_RainbowSelectedOldGpu = -1;
if(s_RainbowSelectedOldGpu == -1)
s_RainbowSelectedOldGpu = RainbowSelectedOldGpu;

static CUi::SDropDownState s_GpuDropDownState;
static CScrollRegion s_GpuDropDownScrollRegion;
s_GpuDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_GpuDropDownScrollRegion;
const int NewGpu = Ui()->DoDropDown(&GpuDropDown, OldSelectedGpu, s_vpGpuIdNames.data(), GpuCount, s_GpuDropDownState);
if(OldSelectedGpu != NewGpu)
const int NewGpu = Ui()->DoDropDown(&GpuDropDown, RainbowSelectedOldGpu, s_vpGpuIdNames.data(), GpuCount, s_GpuDropDownState);
if(RainbowSelectedOldGpu != NewGpu)
{
if(NewGpu == 0)
str_copy(g_Config.m_GfxGpuName, "auto");
else
str_copy(g_Config.m_GfxGpuName, GpuList.m_vGpus[NewGpu - 1].m_aName);
CheckSettings = true;
s_GfxGpuChanged = NewGpu != s_OldSelectedGpu;
s_GfxGpuChanged = NewGpu != s_RainbowSelectedOldGpu;
}
}

Expand Down Expand Up @@ -3400,7 +3400,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
DoLine_ColorPicker(&OutlineColorSolidID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Walls Outline Color"), &g_Config.m_ClOutlineColorSolid, ColorRGBA(0.0f, 0.0f, 0.0f), false);
DoLine_ColorPicker(&OutlineColorTeleID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Teleporter Outline Color"), &g_Config.m_ClOutlineColorTele, ColorRGBA(0.0f, 0.0f, 0.0f), false);
DoLine_ColorPicker(&OutlineColorUnfreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Unfreeze Outline Color"), &g_Config.m_ClOutlineColorUnfreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false);

RightView.HSplitTop(MarginSmall, nullptr, &RightView);
RightView.HSplitTop(HeadlineHeight, &Label, &RightView);
Ui()->DoLabel(&Label, Localize("Input"), HeadlineFontSize, TEXTALIGN_ML);
Expand Down Expand Up @@ -3490,11 +3490,11 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)

// A bit jank, but it works
MainView.y = maximum(LeftView.y, RightView.y) + MarginSmall;

MainView.HSplitTop(HeadlineHeight, &Label, &MainView);
Ui()->DoLabel(&Label, Localize("Miscellaneous"), HeadlineFontSize, TEXTALIGN_MIDDLE);
MainView.HSplitTop(MarginSmall, nullptr, &MainView);

MainView.VSplitMid(&LeftView, &RightView, MarginBetweenViews);

// ***** Miscellaneous Left ***** //
Expand Down Expand Up @@ -3542,7 +3542,6 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
dbg_msg("menus", "couldn't open link");
}

DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHammerRotatesWithCursor, Localize("Make hammer rotate with cursor"), &g_Config.m_ClHammerRotatesWithCursor, &RightView, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderNameplateSpec, Localize("Hide nameplates in spec"), &g_Config.m_ClRenderNameplateSpec, &RightView, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderCursorSpec, Localize("Show your cursor when in free spectate"), &g_Config.m_ClRenderCursorSpec, &RightView, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowSkinName, Localize("Show skin names in nameplate"), &g_Config.m_ClShowSkinName, &RightView, LineSize);
Expand All @@ -3568,7 +3567,6 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
ScrollRegion.h = 0.0f;
s_ScrollRegion.AddRect(ScrollRegion);
s_ScrollRegion.End();

}

if(s_CurCustomTab == TCLIENT_TAB_BINDWHEEL)
Expand Down Expand Up @@ -4043,7 +4041,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView)
Item.m_Rect.VSplitLeft(60.0f, nullptr, &Item.m_Rect);
CUIRect PlayerRect, ClanRect, FeetColorSquare, BodyColorSquare;

Item.m_Rect.VSplitLeft(60.0f, nullptr, &BodyColorSquare); //Delete this maybe
Item.m_Rect.VSplitLeft(60.0f, nullptr, &BodyColorSquare); // Delete this maybe

Item.m_Rect.VSplitRight(60.0f, &BodyColorSquare, &FlagRect);
BodyColorSquare.x -= 11.0f;
Expand Down
7 changes: 3 additions & 4 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void CPlayers::RenderPlayer(

bool Local = m_pClient->m_Snap.m_LocalClientId == ClientId;
bool OtherTeam = m_pClient->IsOtherTeam(ClientId);
//float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
// float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active;

float Alpha = 1.0f;
Expand Down Expand Up @@ -614,7 +614,7 @@ void CPlayers::RenderPlayer(
if(g_Config.m_ClHammerRotatesWithCursor)
{
QuadsRotation += Angle;
if (Direction.x < 0)
if(Direction.x < 0)
QuadsRotation += pi;
}
else if(Inactive && LastAttackTime > m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon))
Expand Down Expand Up @@ -884,7 +884,6 @@ void CPlayers::RenderPlayerGhost(
if(!OtherTeam && FrozenSwappingHide)
Alpha = 1.0f;


// set size
RenderInfo.m_Size = 64.0f;

Expand Down Expand Up @@ -1413,7 +1412,7 @@ void CPlayers::OnRender()

bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active;

//If we are frozen and hiding frozen ghosts and not swapping render only the regular player
// If we are frozen and hiding frozen ghosts and not swapping render only the regular player
if(RenderGhost && g_Config.m_ClShowOthersGhosts && !Spec && Client()->State() != IClient::STATE_DEMOPLAYBACK)
RenderPlayerGhost(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId);

Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/skinprofiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ class CSkinProfiles : public CComponent
virtual int Sizeof() const override { return sizeof(*this); }
virtual void OnInit() override;
};
#endif
#endif
2 changes: 1 addition & 1 deletion src/game/client/components/tater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ void CTater::RandomFlag(void *pUserData)

// set the flag code as number
g_Config.m_PlayerCountry = pFlag->m_CountryCode;
}
}
2 changes: 1 addition & 1 deletion src/game/client/components/verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ void CVerify::OnRender()
}
return;
}
}
}
Loading

0 comments on commit ed3c549

Please sign in to comment.