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

Formatting #24

Merged
merged 1 commit into from
Nov 22, 2024
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,7 @@ set_src(ENGINE_SHARED GLOB_RECURSE src/engine/shared
storage.cpp
stun.cpp
stun.h
tater_variables.h
teehistorian_ex.cpp
teehistorian_ex.h
teehistorian_ex_chunks.h
Expand Down Expand Up @@ -2171,7 +2172,6 @@ set_src(GAME_SHARED GLOB src/game
mapitems_ex_types.h
prng.cpp
prng.h
tater_variables.h
teamscore.cpp
teamscore.h
tuning.h
Expand Down
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
5 changes: 2 additions & 3 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
char aBufTO[256];
str_format(aBufTO, sizeof(aBufTO), "/timeout %s", m_aTimeoutCodes[Conn]);
TOMsgp.m_pMessage = aBufTO;
CMsgPacker PackerTO(TOMsgp.ms_MsgId, false);
CMsgPacker PackerTO(CNetMsg_Cl_Say::ms_MsgId, false);
TOMsgp.Pack(&PackerTO);
SendMsg(Conn, &PackerTO, MSGFLAG_VITAL);

Expand Down 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 "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 "tater_variables.h"

// client
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict client movements")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file can be included several times.

#ifndef MACRO_CONFIG_INT
#error "The config macros must be defined"
Expand Down Expand Up @@ -129,4 +130,4 @@ MACRO_CONFIG_INT(ClRainbowOthers, tc_rainbow_others, 0, 0, 1, CFGFLAG_CLIENT | C
MACRO_CONFIG_INT(ClRainbowMode, tc_rainbow_mode, 1, 1, 4, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow mode (1: rainbow, 2: pulse, 3: darkness)")

// AAAAAAA
MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "")
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
2 changes: 1 addition & 1 deletion src/game/client/components/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */

#include <engine/editor.h>
#include <engine/external/remimu.h>
#include <engine/graphics.h>
#include <engine/keys.h>
#include <engine/shared/config.h>
Expand All @@ -19,7 +20,6 @@
#include <game/localization.h>

#include "chat.h"
#include "engine/external/remimu.h"

char CChat::ms_aDisplayText[MAX_LINE_LENGTH] = {'\0'};

Expand Down
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;
}
79 changes: 37 additions & 42 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 @@ -575,19 +571,19 @@ void CHud::RenderTextInfo()

if(g_Config.m_ClMiniDebug)
{
float FontSize = 8;
float TextHeight = 11;
float FontSize = 8.0f;
float TextHeight = 11.0f;
char aBuf[64];
float yOff = 3;
float OffsetY = 3.0f;

int PlayerId = m_pClient->m_Snap.m_LocalClientId;
if(m_pClient->m_Snap.m_SpecInfo.m_Active)
PlayerId = m_pClient->m_Snap.m_SpecInfo.m_SpectatorId;

if(g_Config.m_ClShowhudDDRace && m_pClient->m_Snap.m_aCharacters[PlayerId].m_HasExtendedData && m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW)
yOff += 50;
OffsetY += 50.0f;
else if(g_Config.m_ClShowhudHealthAmmo && m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW)
yOff += 27;
OffsetY += 27.0f;

vec2 Pos;
if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorId == SPEC_FREEVIEW)
Expand All @@ -596,29 +592,29 @@ void CHud::RenderTextInfo()
Pos = m_pClient->m_aClients[PlayerId].m_RenderPos;

str_format(aBuf, sizeof(aBuf), "X: %.2f", Pos.x / 32.0f);
TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f);
TextRender()->Text(4, OffsetY, FontSize, aBuf, -1.0f);

yOff += TextHeight;
OffsetY += TextHeight;
str_format(aBuf, sizeof(aBuf), "Y: %.2f", Pos.y / 32.0f);
TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f);
TextRender()->Text(4, OffsetY, FontSize, aBuf, -1.0f);
if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW)
{
yOff += TextHeight;
OffsetY += TextHeight;
str_format(aBuf, sizeof(aBuf), "Angle: %d", m_pClient->m_aClients[PlayerId].m_RenderCur.m_Angle);
TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f);
TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f);

yOff += TextHeight;
str_format(aBuf, sizeof(aBuf), "VelY: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelY / 256.0f * 50.0 / 32.0f);
TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f);
OffsetY += TextHeight;
str_format(aBuf, sizeof(aBuf), "VelY: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelY / 256.0f * 50.0f / 32.0f);
TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f);

yOff += TextHeight;
OffsetY += TextHeight;

str_format(aBuf, sizeof(aBuf), "VelX: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelX / 256.0f * 50.0 / 32.0f);
TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f);
str_format(aBuf, sizeof(aBuf), "VelX: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelX / 256.0f * 50.0f / 32.0f);
TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f);
}
}

//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,18 +652,18 @@ 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);
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.0f - TextRender()->TextWidth(10.f, aBuf) / 2.0f, 12.0f, 10.0f, aBuf);
TextRender()->Text(m_Width / 2.0f - TextRender()->TextWidth(10.0f, 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 @@ -677,24 +673,23 @@ void CHud::RenderTextInfo()
FreezeInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
FreezeInfo.m_BloodColor = pSkin->m_BloodColor;
FreezeInfo.m_SkinMetrics = pSkin->m_Metrics;
FreezeInfo.m_ColorBody = ColorRGBA(1, 1, 1);
FreezeInfo.m_ColorFeet = ColorRGBA(1, 1, 1);
FreezeInfo.m_ColorBody = ColorRGBA(1.0f, 1.0f, 1.0f);
FreezeInfo.m_ColorFeet = ColorRGBA(1.0f, 1.0f, 1.0f);
FreezeInfo.m_CustomColoredSkin = false;


float progressiveOffset = 0.0f;
float TeeSize = g_Config.m_ClFrozenHudTeeSize;
int MaxTees = (int)(8.3 * (m_Width / m_Height) * 13.0f / TeeSize);
int MaxTees = (int)(8.3f * (m_Width / m_Height) * 13.0f / TeeSize);
if(!g_Config.m_ClShowfps && !g_Config.m_ClShowpred)
MaxTees = (int)(9.5 * (m_Width / m_Height) * 13.0f / TeeSize);
MaxTees = (int)(9.5f * (m_Width / m_Height) * 13.0f / TeeSize);
int MaxRows = g_Config.m_ClFrozenMaxRows;
float StartPos = m_Width / 2 + 38.0f * (m_Width / m_Height) / 1.78;
float StartPos = m_Width / 2.0f + 38.0f * (m_Width / m_Height) / 1.78f;

int TotalRows = std::min(MaxRows, (NumInTeam + MaxTees - 1) / MaxTees);
Graphics()->TextureClear();
Graphics()->QuadsBegin();
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.4f);
Graphics()->DrawRectExt(StartPos - TeeSize / 2, 0.0f, TeeSize * std::min(NumInTeam, MaxTees), TeeSize + 3.0f + (TotalRows - 1) * TeeSize, 5.0f, IGraphics::CORNER_B);
Graphics()->DrawRectExt(StartPos - TeeSize / 2.0f, 0.0f, TeeSize * std::min(NumInTeam, MaxTees), TeeSize + 3.0f + (TotalRows - 1) * TeeSize, 5.0f, IGraphics::CORNER_B);
Graphics()->QuadsEnd();

bool Overflow = NumInTeam > MaxTees * MaxRows;
Expand Down Expand Up @@ -737,19 +732,19 @@ void CHud::RenderTextInfo()
TeeInfo.m_Size = TeeSize;
const CAnimState *pIdleState = CAnimState::GetIdle();
vec2 OffsetToMid;
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
vec2 TeeRenderPos(StartPos + progressiveOffset, TeeSize * (0.7f) + CurrentRow * TeeSize);
float Alpha = 1.0f;
CNetObj_Character CurChar = m_pClient->m_aClients[i].m_RenderCur;
if(g_Config.m_ClShowFrozenHudSkins && Frozen)
{
Alpha = 0.6f;
TeeInfo.m_ColorBody.r *= 0.4;
TeeInfo.m_ColorBody.g *= 0.4;
TeeInfo.m_ColorBody.b *= 0.4;
TeeInfo.m_ColorFeet.r *= 0.4;
TeeInfo.m_ColorFeet.g *= 0.4;
TeeInfo.m_ColorFeet.b *= 0.4;
TeeInfo.m_ColorBody.r *= 0.4f;
TeeInfo.m_ColorBody.g *= 0.4f;
TeeInfo.m_ColorBody.b *= 0.4f;
TeeInfo.m_ColorFeet.r *= 0.4f;
TeeInfo.m_ColorFeet.g *= 0.4f;
TeeInfo.m_ColorFeet.b *= 0.4f;
}
if(Frozen)
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_PAIN, vec2(1.0f, 0.0f), TeeRenderPos, Alpha);
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
5 changes: 2 additions & 3 deletions src/game/client/components/outlines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ void COutlines::OnRender()
if(!pTiles)
return;
unsigned int Size = GameClient()->Layers()->Map()->GetDataSize(pTMap->m_Data);
if(IsGameLayer)
pGameTiles = pTiles;
pGameTiles = pTiles;
if((g_Config.m_ClOutlineFreeze || g_Config.m_ClOutlineSolid || g_Config.m_ClOutlineUnFreeze) && IsGameLayer && Size >= (size_t)pTMap->m_Width * pTMap->m_Height * sizeof(CTile))
{
if(g_Config.m_ClOutlineUnFreeze)
Expand All @@ -72,7 +71,7 @@ void COutlines::OnRender()
return;
if(IsGameLayer)
pGameTiles = pTiles;
if(g_Config.m_ClOutlineTele && IsTeleLayer)
if(g_Config.m_ClOutlineTele)
{
CTeleTile *pTeleTiles = (CTeleTile *)GameClient()->Layers()->Map()->GetData(pTMap->m_Tele);
unsigned int TeleSize = GameClient()->Layers()->Map()->GetDataSize(pTMap->m_Tele);
Expand Down
Loading
Loading