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 db8ff0b commit e74819c
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 95 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;
}
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 @@ -640,7 +636,7 @@ void CHud::RenderTextInfo()
}
}

//Notify when last
// Notify when last
if(g_Config.m_ClNotifyWhenLast)
{
if(NumInTeam > 1 && NumInTeam - NumFrozen == 1)
Expand All @@ -652,7 +648,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 @@ -661,9 +657,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 @@ -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
11 changes: 5 additions & 6 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 @@ -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 @@ -3568,7 +3568,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 +4042,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;
}
}
}
22 changes: 7 additions & 15 deletions src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ void CGameClient::OnPredict()
{
m_PredictedChar = pLocalChar->GetCore();
}
if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0))
if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0))
{
for(int i = 0; i < MAX_CLIENTS; i++)
if(CCharacter *pChar = m_PredictedWorld.GetCharacterById(i))
Expand Down Expand Up @@ -2325,10 +2325,8 @@ void CGameClient::OnPredict()
// Remove other tees to reduce lag and because they aren't really important in this case
for(int i = 0; i < MAX_CLIENTS; i++)
if(i != m_Snap.m_LocalClientId)
if (CCharacter* pDelChar = m_ExtraPredictedWorld.GetCharacterById(i))
if(CCharacter *pDelChar = m_ExtraPredictedWorld.GetCharacterById(i))
pDelChar->Destroy();



CCharacter *pExtraChar = m_ExtraPredictedWorld.GetCharacterById(m_Snap.m_LocalClientId);
if(pExtraChar)
Expand All @@ -2351,7 +2349,7 @@ void CGameClient::OnPredict()
m_ExtraPredictedWorld.m_GameTick++;
m_ExtraPredictedWorld.Tick();
}
else
else
{
pExtraChar->m_AliveAccumulation = std::max(pExtraChar->m_AliveAccumulation, 1);
pExtraChar->m_AliveAccumulation = std::min(pExtraChar->m_AliveAccumulation + 1, g_Config.m_ClUnfreezeLagDelayTicks);
Expand Down Expand Up @@ -3288,7 +3286,7 @@ vec2 CGameClient::GetSmoothPos(int ClientId)
Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount);

if(ClientId != m_Snap.m_LocalClientId && !g_Config.m_ClFastInputOthers && g_Config.m_ClFastInput)
SmoothTick -= 1;
SmoothTick -= 1;

if(SmoothTick > 0 && m_aClients[ClientId].m_aPredTick[(SmoothTick - 1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientId].m_aPredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy))
Pos[i] = mix(m_aClients[ClientId].m_aPredPos[(SmoothTick - 1) % 200][i], m_aClients[ClientId].m_aPredPos[SmoothTick % 200][i], SmoothIntra);
Expand All @@ -3306,8 +3304,8 @@ vec2 CGameClient::GetFreezePos(int ClientId)

for(int i = 0; i < 2; i++)
{
//int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq());
//int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i];
// int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq());
// int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i];
float MixAmount = 0.0f;
int SmoothTick;
float SmoothIntra;
Expand All @@ -3327,17 +3325,11 @@ vec2 CGameClient::GetFreezePos(int ClientId)
AdjustTicks = std::min(FreezeTime, AdjustTicks);
}
if(g_Config.m_ClRemoveAnti && pChar && AdjustTicks > 0 && FreezeTime > 0)
{
MixAmount = mix(0.0f, 1.0f, 1.0f - AdjustTicks / (float)DelayTicks);
}
//else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId)
//{
// else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId)
// MixAmount = 1.f - std::pow(1.f - TimePassed / (float)Len, 1.2f);
//}
else // our tee when not frozen
{
MixAmount = 1.f;
}

Client()->GetSmoothFreezeTick(&SmoothTick, &SmoothIntra, MixAmount);

Expand Down
Loading

0 comments on commit e74819c

Please sign in to comment.