Remove components pointers

This commit is contained in:
Jupeyy 2021-07-12 11:43:56 +02:00
parent 8451775821
commit 26c5332dc6
29 changed files with 277 additions and 338 deletions

View file

@ -71,7 +71,7 @@ void CBackground::LoadBackground()
if(m_pMap->IsLoaded())
{
m_pLayers = GameClient()->Layers();
m_pImages = GameClient()->m_pMapimages;
m_pImages = &GameClient()->m_MapImages;
m_Loaded = true;
}
}

View file

@ -20,7 +20,7 @@ void CBroadcast::OnReset()
void CBroadcast::OnRender()
{
if(m_pClient->m_pScoreboard->Active() || m_pClient->m_pMotd->IsActive() || !g_Config.m_ClShowBroadcasts)
if(m_pClient->m_Scoreboard.Active() || m_pClient->m_Motd.IsActive() || !g_Config.m_ClShowBroadcasts)
return;
Graphics()->MapScreen(0, 0, 300 * Graphics()->ScreenAspect(), 300);

View file

@ -107,22 +107,22 @@ void CCamera::OnRender()
{
if(m_CamType != CAMTYPE_SPEC)
{
m_LastPos[g_Config.m_ClDummy] = m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy];
m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] = m_PrevCenter;
m_pClient->m_pControls->ClampMousePos();
m_LastPos[g_Config.m_ClDummy] = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_PrevCenter;
m_pClient->m_Controls.ClampMousePos();
m_CamType = CAMTYPE_SPEC;
}
m_Center = m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy];
m_Center = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
}
else
{
if(m_CamType != CAMTYPE_PLAYER)
{
if((m_LastPos[g_Config.m_ClDummy].x < g_Config.m_ClMouseMinDistance) || (m_LastPos[g_Config.m_ClDummy].x < g_Config.m_ClDyncamMinDistance))
m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy].x = m_LastPos[g_Config.m_ClDummy].x + g_Config.m_ClMouseMinDistance + g_Config.m_ClDyncamMinDistance;
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x = m_LastPos[g_Config.m_ClDummy].x + g_Config.m_ClMouseMinDistance + g_Config.m_ClDyncamMinDistance;
else
m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] = m_LastPos[g_Config.m_ClDummy];
m_pClient->m_pControls->ClampMousePos();
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_LastPos[g_Config.m_ClDummy];
m_pClient->m_Controls.ClampMousePos();
m_CamType = CAMTYPE_PLAYER;
}
@ -139,7 +139,7 @@ void CCamera::OnRender()
s_SpeedBias += CameraSpeed * DeltaTime;
if(g_Config.m_ClDyncam)
{
s_SpeedBias -= length(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] - s_LastMousePos) * log10f(CameraStabilizingFactor) * 0.02f;
s_SpeedBias -= length(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] - s_LastMousePos) * log10f(CameraStabilizingFactor) * 0.02f;
s_SpeedBias = clamp(s_SpeedBias, 0.5f, CameraSpeed);
}
else
@ -149,7 +149,7 @@ void CCamera::OnRender()
}
vec2 TargetCameraOffset(0, 0);
s_LastMousePos = m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy];
s_LastMousePos = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
float l = length(s_LastMousePos);
if(l > 0.0001f) // make sure that this isn't 0
{
@ -157,7 +157,7 @@ void CCamera::OnRender()
float FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f;
float OffsetAmount = maximum(l - DeadZone, 0.0f) * FollowFactor;
TargetCameraOffset = normalize(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy]) * OffsetAmount;
TargetCameraOffset = normalize(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy]) * OffsetAmount;
}
if(g_Config.m_ClDyncamSmoothness > 0)
@ -173,7 +173,7 @@ void CCamera::OnRender()
if(m_ForceFreeviewPos != vec2(-1, -1) && m_CamType == CAMTYPE_SPEC)
{
m_Center = m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] = m_ForceFreeviewPos;
m_Center = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_ForceFreeviewPos;
m_ForceFreeviewPos = vec2(-1, -1);
}
m_PrevCenter = m_Center;

View file

@ -853,7 +853,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
{
if(g_Config.m_SndServerMessage)
{
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_SERVER, 0);
m_pClient->m_Sounds.Play(CSounds::CHN_GUI, SOUND_CHAT_SERVER, 0);
m_aLastSoundPlayed[CHAT_SERVER] = Now;
}
}
@ -871,7 +871,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
Client()->Notify("DDNet Chat", aBuf);
if(g_Config.m_SndHighlight)
{
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
m_pClient->m_Sounds.Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
m_aLastSoundPlayed[CHAT_HIGHLIGHT] = Now;
}
@ -887,7 +887,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
{
if((g_Config.m_SndTeamChat || !m_aLines[m_CurrentLine].m_Team) && (g_Config.m_SndChat || m_aLines[m_CurrentLine].m_Team))
{
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_CLIENT, 0);
m_pClient->m_Sounds.Play(CSounds::CHN_GUI, SOUND_CHAT_CLIENT, 0);
m_aLastSoundPlayed[CHAT_CLIENT] = Now;
}
}
@ -900,7 +900,7 @@ void CChat::RefindSkins()
{
if(Line.m_HasRenderTee)
{
const CSkin *pSkin = m_pClient->m_pSkins->Get(m_pClient->m_pSkins->Find(Line.m_aSkinName));
const CSkin *pSkin = m_pClient->m_Skins.Get(m_pClient->m_Skins.Find(Line.m_aSkinName));
if(Line.m_CustomColoredSkin)
Line.m_RenderSkin = pSkin->m_ColorableSkin;
else
@ -919,7 +919,7 @@ void CChat::OnPrepareLines()
float ScreenRatio = Graphics()->ScreenAspect();
bool IsScoreBoardOpen = m_pClient->m_pScoreboard->Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9)
bool IsScoreBoardOpen = m_pClient->m_Scoreboard.Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9)
bool ForceRecreate = IsScoreBoardOpen != m_PrevScoreBoardShowed;
bool ShowLargeArea = m_Show || g_Config.m_ClShowChat == 2;
@ -1239,7 +1239,7 @@ void CChat::OnRender()
Marker.m_X -= MarkerOffset;
TextRender()->TextEx(&Marker, "|", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString(Editing) + m_Input.GetCursorOffset(Editing), -1);
if(m_pClient->m_pGameConsole->IsClosed())
if(m_pClient->m_GameConsole.IsClosed())
Input()->SetEditingPosition(Marker.m_X, Marker.m_Y + Marker.m_FontSize);
}
@ -1255,7 +1255,7 @@ void CChat::OnRender()
OnPrepareLines();
float ScreenRatio = Graphics()->ScreenAspect();
bool IsScoreBoardOpen = m_pClient->m_pScoreboard->Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9)
bool IsScoreBoardOpen = m_pClient->m_Scoreboard.Active() && (ScreenRatio > 1.7f); // only assume scoreboard when screen ratio is widescreen(something around 16:9)
int64_t Now = time();
float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;

View file

@ -752,17 +752,17 @@ void CGameConsole::Toggle(int Type)
if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_CLOSING)
{
/*Input()->MouseModeAbsolute();*/
m_pClient->m_pMenus->UseMouseButtons(false);
m_pClient->m_Menus.UseMouseButtons(false);
m_ConsoleState = CONSOLE_OPENING;
/*// reset controls
m_pClient->m_pControls->OnReset();*/
m_pClient->m_Controls.OnReset();*/
Input()->SetIMEState(true);
}
else
{
Input()->MouseModeRelative();
m_pClient->m_pMenus->UseMouseButtons(true);
m_pClient->m_Menus.UseMouseButtons(true);
m_pClient->OnRelease();
m_ConsoleState = CONSOLE_CLOSING;

View file

@ -250,9 +250,9 @@ int CControls::SnapInput(int *pData)
bool Send = false;
// update player state
if(m_pClient->m_pChat->IsActive())
if(m_pClient->m_Chat.IsActive())
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_CHATTING;
else if(m_pClient->m_pMenus->IsActive())
else if(m_pClient->m_Menus.IsActive())
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_IN_MENU;
else
{
@ -264,13 +264,13 @@ int CControls::SnapInput(int *pData)
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING;
}
if(m_pClient->m_pScoreboard->Active())
if(m_pClient->m_Scoreboard.Active())
m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD;
if(m_InputData[g_Config.m_ClDummy].m_PlayerFlags != PLAYERFLAG_PLAYING)
m_JoystickTapTime = 0; // Do not launch hook on first tap
if(m_pClient->m_pControls->m_ShowHookColl[g_Config.m_ClDummy])
if(m_pClient->m_Controls.m_ShowHookColl[g_Config.m_ClDummy])
m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_AIM;
if(m_LastData[g_Config.m_ClDummy].m_PlayerFlags != m_InputData[g_Config.m_ClDummy].m_PlayerFlags)
@ -547,8 +547,8 @@ bool CControls::OnMouseMove(float x, float y)
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID < 0)
{
x = x * m_pClient->m_pCamera->m_Zoom;
y = y * m_pClient->m_pCamera->m_Zoom;
x = x * m_pClient->m_Camera.m_Zoom;
y = y * m_pClient->m_Camera.m_Zoom;
}
m_MousePos[g_Config.m_ClDummy] += vec2(x, y); // TODO: ugly

View file

@ -42,23 +42,23 @@ void CEffects::AirJump(vec2 Pos)
p.m_Gravity = 500;
p.m_Friction = 0.7f;
p.m_FlowAffected = 0.0f;
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
p.m_Pos = Pos + vec2(6.0f, 16.0f);
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
if(g_Config.m_SndGame)
m_pClient->m_pSounds->PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_AIRJUMP, 1.0f, Pos);
m_pClient->m_Sounds.PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_AIRJUMP, 1.0f, Pos);
}
void CEffects::DamageIndicator(vec2 Pos, vec2 Dir)
{
m_pClient->m_pDamageind->Create(Pos, Dir);
m_pClient->m_DamageInd.Create(Pos, Dir);
}
void CEffects::ResetDamageIndicator()
{
m_pClient->m_pDamageind->Reset();
m_pClient->m_DamageInd.Reset();
}
void CEffects::PowerupShine(vec2 Pos, vec2 size)
@ -79,7 +79,7 @@ void CEffects::PowerupShine(vec2 Pos, vec2 size)
p.m_Gravity = 500;
p.m_Friction = 0.9f;
p.m_FlowAffected = 0.0f;
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
}
void CEffects::SmokeTrail(vec2 Pos, vec2 Vel, float Alpha, float TimePassed)
@ -98,7 +98,7 @@ void CEffects::SmokeTrail(vec2 Pos, vec2 Vel, float Alpha, float TimePassed)
p.m_Friction = 0.7f;
p.m_Gravity = frandom() * -500.0f;
p.m_Color.a *= Alpha;
m_pClient->m_pParticles->Add(CParticles::GROUP_PROJECTILE_TRAIL, &p, TimePassed);
m_pClient->m_Particles.Add(CParticles::GROUP_PROJECTILE_TRAIL, &p, TimePassed);
}
void CEffects::SkidTrail(vec2 Pos, vec2 Vel)
@ -117,7 +117,7 @@ void CEffects::SkidTrail(vec2 Pos, vec2 Vel)
p.m_Friction = 0.7f;
p.m_Gravity = frandom() * -500.0f;
p.m_Color = ColorRGBA(0.75f, 0.75f, 0.75f, 1.0f);
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
}
void CEffects::BulletTrail(vec2 Pos, float Alpha, float TimePassed)
@ -134,7 +134,7 @@ void CEffects::BulletTrail(vec2 Pos, float Alpha, float TimePassed)
p.m_EndSize = 0;
p.m_Friction = 0.7f;
p.m_Color.a *= Alpha;
m_pClient->m_pParticles->Add(CParticles::GROUP_PROJECTILE_TRAIL, &p, TimePassed);
m_pClient->m_Particles.Add(CParticles::GROUP_PROJECTILE_TRAIL, &p, TimePassed);
}
void CEffects::PlayerSpawn(vec2 Pos)
@ -154,10 +154,10 @@ void CEffects::PlayerSpawn(vec2 Pos)
p.m_Gravity = frandom() * -400.0f;
p.m_Friction = 0.7f;
p.m_Color = ColorRGBA(0xb5 / 255.0f, 0x50 / 255.0f, 0xcb / 255.0f, 1.0f);
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
}
if(g_Config.m_SndGame)
m_pClient->m_pSounds->PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_SPAWN, 1.0f, Pos);
m_pClient->m_Sounds.PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_SPAWN, 1.0f, Pos);
}
void CEffects::PlayerDeath(vec2 Pos, int ClientID)
@ -190,7 +190,7 @@ void CEffects::PlayerDeath(vec2 Pos, int ClientID)
p.m_Friction = 0.8f;
ColorRGBA c = BloodColor.v4() * (0.75f + frandom() * 0.25f);
p.m_Color = ColorRGBA(c.r, c.g, c.b, 0.75f);
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
}
}
@ -204,7 +204,7 @@ void CEffects::Explosion(vec2 Pos)
continue;
float a = 1 - (length(vec2(x, y)) / length(vec2(8, 8)));
m_pClient->m_pFlow->Add(Pos + vec2(x, y) * 16, normalize(vec2(x, y)) * 5000.0f * a, 10.0f);
m_pClient->m_Flow.Add(Pos + vec2(x, y) * 16, normalize(vec2(x, y)) * 5000.0f * a, 10.0f);
}
// add the explosion
@ -216,7 +216,7 @@ void CEffects::Explosion(vec2 Pos)
p.m_StartSize = 150.0f;
p.m_EndSize = 0;
p.m_Rot = frandom() * pi * 2;
m_pClient->m_pParticles->Add(CParticles::GROUP_EXPLOSIONS, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_EXPLOSIONS, &p);
// add the smoke
for(int i = 0; i < 24; i++)
@ -232,7 +232,7 @@ void CEffects::Explosion(vec2 Pos)
p.m_Gravity = frandom() * -800.0f;
p.m_Friction = 0.4f;
p.m_Color = mix(vec4(0.75f, 0.75f, 0.75f, 1.0f), vec4(0.5f, 0.5f, 0.5f, 1.0f), frandom());
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_GENERAL, &p);
}
}
@ -247,9 +247,9 @@ void CEffects::HammerHit(vec2 Pos)
p.m_StartSize = 120.0f;
p.m_EndSize = 0;
p.m_Rot = frandom() * pi * 2;
m_pClient->m_pParticles->Add(CParticles::GROUP_EXPLOSIONS, &p);
m_pClient->m_Particles.Add(CParticles::GROUP_EXPLOSIONS, &p);
if(g_Config.m_SndGame)
m_pClient->m_pSounds->PlayAt(CSounds::CHN_WORLD, SOUND_HAMMER_HIT, 1.0f, Pos);
m_pClient->m_Sounds.PlayAt(CSounds::CHN_WORLD, SOUND_HAMMER_HIT, 1.0f, Pos);
}
void CEffects::OnRender()
@ -278,7 +278,7 @@ void CEffects::OnRender()
m_Add50hz = false;
if(m_Add50hz)
m_pClient->m_pFlow->Update();
m_pClient->m_Flow.Update();
return;
}
@ -300,5 +300,5 @@ void CEffects::OnRender()
m_Add50hz = false;
if(m_Add50hz)
m_pClient->m_pFlow->Update();
m_pClient->m_Flow.Update();
}

View file

@ -219,5 +219,5 @@ void CEmoticon::EyeEmote(int Emote)
str_format(aBuf, sizeof(aBuf), "/emote blink %d", g_Config.m_ClEyeDuration);
break;
}
GameClient()->m_pChat->Say(0, aBuf);
GameClient()->m_Chat.Say(0, aBuf);
}

View file

@ -343,8 +343,8 @@ void CGhost::OnRender()
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
m_pClient->m_Players.RenderHook(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
m_pClient->m_Players.RenderPlayer(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
}
}
@ -354,8 +354,8 @@ void CGhost::InitRenderInfos(CGhostItem *pGhost)
IntsToStr(&pGhost->m_Skin.m_Skin0, 6, aSkinName);
CTeeRenderInfo *pRenderInfo = &pGhost->m_RenderInfo;
int SkinId = m_pClient->m_pSkins->Find(aSkinName);
const CSkin *pSkin = m_pClient->m_pSkins->Get(SkinId);
int SkinId = m_pClient->m_Skins.Find(aSkinName);
const CSkin *pSkin = m_pClient->m_Skins.Get(SkinId);
pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin;
pRenderInfo->m_ColorableRenderSkin = pSkin->m_ColorableSkin;
pRenderInfo->m_BloodColor = pSkin->m_BloodColor;
@ -395,7 +395,7 @@ void CGhost::StopRecord(int Time)
if(RecordingToFile)
GhostRecorder()->Stop(m_CurGhost.m_Path.Size(), Time);
CMenus::CGhostItem *pOwnGhost = m_pClient->m_pMenus->GetOwnGhost();
CMenus::CGhostItem *pOwnGhost = m_pClient->m_Menus.GetOwnGhost();
if(Time > 0 && (!pOwnGhost || Time < pOwnGhost->m_Time))
{
if(pOwnGhost && pOwnGhost->Active())
@ -419,7 +419,7 @@ void CGhost::StopRecord(int Time)
Storage()->RenameFile(m_aTmpFilename, Item.m_aFilename, IStorage::TYPE_SAVE);
// add item to menu list
m_pClient->m_pMenus->UpdateOwnGhost(Item);
m_pClient->m_Menus.UpdateOwnGhost(Item);
}
else if(RecordingToFile) // no new record
Storage()->RemoveFile(m_aTmpFilename, IStorage::TYPE_SAVE);
@ -622,7 +622,7 @@ void CGhost::OnMapLoad()
{
OnReset();
UnloadAll();
m_pClient->m_pMenus->GhostlistPopulate();
m_pClient->m_Menus.GhostlistPopulate();
m_AllowRestart = false;
}
@ -641,8 +641,8 @@ void CGhost::RefindSkin()
{
CTeeRenderInfo *pRenderInfo = &Ghost.m_RenderInfo;
int SkinId = m_pClient->m_pSkins->Find(aSkinName);
const CSkin *pSkin = m_pClient->m_pSkins->Get(SkinId);
int SkinId = m_pClient->m_Skins.Find(aSkinName);
const CSkin *pSkin = m_pClient->m_Skins.Get(SkinId);
pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin;
pRenderInfo->m_ColorableRenderSkin = pSkin->m_ColorableSkin;
pRenderInfo->m_SkinMetrics = pSkin->m_Metrics;
@ -653,8 +653,8 @@ void CGhost::RefindSkin()
{
CTeeRenderInfo *pRenderInfo = &m_CurGhost.m_RenderInfo;
int SkinId = m_pClient->m_pSkins->Find(aSkinName);
const CSkin *pSkin = m_pClient->m_pSkins->Get(SkinId);
int SkinId = m_pClient->m_Skins.Find(aSkinName);
const CSkin *pSkin = m_pClient->m_Skins.Get(SkinId);
pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin;
pRenderInfo->m_ColorableRenderSkin = pSkin->m_ColorableSkin;
pRenderInfo->m_SkinMetrics = pSkin->m_Metrics;

View file

@ -605,7 +605,7 @@ void CHud::RenderTeambalanceWarning()
void CHud::RenderVoting()
{
if((!g_Config.m_ClShowVotesAfterVoting && !m_pClient->m_pScoreboard->Active() && m_pClient->m_pVoting->TakenChoice()) || !m_pClient->m_pVoting->IsVoting() || Client()->State() == IClient::STATE_DEMOPLAYBACK)
if((!g_Config.m_ClShowVotesAfterVoting && !m_pClient->m_Scoreboard.Active() && m_pClient->m_Voting.TakenChoice()) || !m_pClient->m_Voting.IsVoting() || Client()->State() == IClient::STATE_DEMOPLAYBACK)
return;
Graphics()->TextureClear();
@ -619,7 +619,7 @@ void CHud::RenderVoting()
CTextCursor Cursor;
char aBuf[512];
str_format(aBuf, sizeof(aBuf), Localize("%ds left"), m_pClient->m_pVoting->SecondsLeft());
str_format(aBuf, sizeof(aBuf), Localize("%ds left"), m_pClient->m_Voting.SecondsLeft());
float tw = TextRender()->TextWidth(0x0, 6, aBuf, -1, -1.0f);
TextRender()->SetCursor(&Cursor, 5.0f + 100.0f - tw, 60.0f, 6.0f, TEXTFLAG_RENDER);
TextRender()->TextEx(&Cursor, aBuf, -1);
@ -627,26 +627,26 @@ void CHud::RenderVoting()
TextRender()->SetCursor(&Cursor, 5.0f, 60.0f, 6.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = 100.0f - tw;
Cursor.m_MaxLines = 3;
TextRender()->TextEx(&Cursor, m_pClient->m_pVoting->VoteDescription(), -1);
TextRender()->TextEx(&Cursor, m_pClient->m_Voting.VoteDescription(), -1);
// reason
str_format(aBuf, sizeof(aBuf), "%s %s", Localize("Reason:"), m_pClient->m_pVoting->VoteReason());
str_format(aBuf, sizeof(aBuf), "%s %s", Localize("Reason:"), m_pClient->m_Voting.VoteReason());
TextRender()->SetCursor(&Cursor, 5.0f, 79.0f, 6.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = 100.0f;
TextRender()->TextEx(&Cursor, aBuf, -1);
CUIRect Base = {5, 88, 100, 4};
m_pClient->m_pVoting->RenderBars(Base, false);
m_pClient->m_Voting.RenderBars(Base, false);
char aKey[64];
m_pClient->m_pBinds->GetKey("vote yes", aKey, sizeof(aKey));
m_pClient->m_Binds.GetKey("vote yes", aKey, sizeof(aKey));
str_format(aBuf, sizeof(aBuf), "%s - %s", aKey, Localize("Vote yes"));
Base.y += Base.h;
Base.h = 11.f;
UI()->DoLabel(&Base, aBuf, 6.0f, -1);
m_pClient->m_pBinds->GetKey("vote no", aKey, sizeof(aKey));
m_pClient->m_Binds.GetKey("vote no", aKey, sizeof(aKey));
str_format(aBuf, sizeof(aBuf), "%s - %s", Localize("Vote no"), aKey);
UI()->DoLabel(&Base, aBuf, 6.0f, 1);
}
@ -656,7 +656,7 @@ void CHud::RenderCursor()
if(!m_pClient->m_Snap.m_pLocalCharacter || Client()->State() == IClient::STATE_DEMOPLAYBACK)
return;
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup());
int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS;
@ -665,7 +665,7 @@ void CHud::RenderCursor()
// render cursor
int QuadOffset = NUM_WEAPONS * 10 * 2 + 40 * 2 + (CurWeapon);
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, QuadOffset, m_pClient->m_pControls->m_TargetPos[g_Config.m_ClDummy].x, m_pClient->m_pControls->m_TargetPos[g_Config.m_ClDummy].y);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, QuadOffset, m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].y);
}
void CHud::PrepareHealthAmoQuads()
@ -805,7 +805,7 @@ void CHud::RenderSpectatorHud()
void CHud::RenderLocalTime(float x)
{
if(!g_Config.m_ClShowLocalTimeAlways && !m_pClient->m_pScoreboard->Active())
if(!g_Config.m_ClShowLocalTimeAlways && !m_pClient->m_Scoreboard.Active())
return;
//draw the box

View file

@ -80,7 +80,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
// don't check for validity of the projectile for the current weapon here, so particle effects are rendered for mod compability
if(CurWeapon == WEAPON_GRENADE)
{
m_pClient->m_pEffects->SmokeTrail(Pos, Vel * -1, Alpha);
m_pClient->m_Effects.SmokeTrail(Pos, Vel * -1, Alpha);
static float s_Time = 0.0f;
static float s_LastLocalTime = LocalTime();
@ -101,7 +101,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
}
else
{
m_pClient->m_pEffects->BulletTrail(Pos, Alpha);
m_pClient->m_Effects.BulletTrail(Pos, Alpha);
if(length(Vel) > 0.00001f)
Graphics()->QuadsSetRotation(angle(Vel));
@ -160,7 +160,7 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
if(c[pCurrent->m_Type] == SPRITE_PICKUP_NINJA)
{
QuadOffset = 2 + 8 - 1; // ninja is the last weapon
m_pClient->m_pEffects->PowerupShine(Pos, vec2(96, 18));
m_pClient->m_Effects.PowerupShine(Pos, vec2(96, 18));
Pos.x -= 10.0f;
}
}
@ -559,8 +559,8 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
TimePassed = minimum(TimePassed, (TimePassed - MinTrailSpan) / (Pt - MinTrailSpan) * (MinTrailSpan * 0.5f) + MinTrailSpan);
// add particle for this projectile
if(pCurrent->m_Type == WEAPON_GRENADE)
m_pClient->m_pEffects->SmokeTrail(Pos, Vel * -1, Alpha, TimePassed);
m_pClient->m_Effects.SmokeTrail(Pos, Vel * -1, Alpha, TimePassed);
else
m_pClient->m_pEffects->BulletTrail(Pos, Alpha, TimePassed);
m_pClient->m_Effects.BulletTrail(Pos, Alpha, TimePassed);
}
}

View file

@ -32,12 +32,12 @@ CMapLayers::CMapLayers(int t, bool OnlineOnly)
void CMapLayers::OnInit()
{
m_pLayers = Layers();
m_pImages = m_pClient->m_pMapimages;
m_pImages = &m_pClient->m_MapImages;
}
CCamera *CMapLayers::GetCurCamera()
{
return m_pClient->m_pCamera;
return &m_pClient->m_Camera;
}
void CMapLayers::EnvelopeUpdate()

View file

@ -132,7 +132,7 @@ void CMapSounds::OnRender()
if(!pSource->m_pSource->m_Pan)
Flags |= ISound::FLAG_NO_PANNING;
pSource->m_Voice = m_pClient->m_pSounds->PlaySampleAt(CSounds::CHN_MAPSOUND, m_aSounds[pSource->m_Sound], 1.0f, vec2(fx2f(pSource->m_pSource->m_Position.x), fx2f(pSource->m_pSource->m_Position.y)), Flags);
pSource->m_Voice = m_pClient->m_Sounds.PlaySampleAt(CSounds::CHN_MAPSOUND, m_aSounds[pSource->m_Sound], 1.0f, vec2(fx2f(pSource->m_pSource->m_Position.x), fx2f(pSource->m_pSource->m_Position.y)), Flags);
Sound()->SetVoiceTimeOffset(pSource->m_Voice, Offset);
Sound()->SetVoiceFalloff(pSource->m_Voice, pSource->m_pSource->m_Falloff / 255.0f);
switch(pSource->m_pSource->m_Shape.m_Type)
@ -159,7 +159,7 @@ void CMapSounds::OnRender()
}
}
vec2 Center = m_pClient->m_pCamera->m_Center;
vec2 Center = m_pClient->m_Camera.m_Center;
for(int g = 0; g < Layers()->NumGroups(); g++)
{
CMapItemGroup *pGroup = Layers()->GetGroup(g);
@ -203,7 +203,7 @@ void CMapSounds::OnRender()
if(pVoice->m_pSource->m_PosEnv >= 0)
{
float aChannels[4];
CMapLayers::EnvelopeEval(pVoice->m_pSource->m_PosEnvOffset, pVoice->m_pSource->m_PosEnv, aChannels, m_pClient->m_pMapLayersBackGround);
CMapLayers::EnvelopeEval(pVoice->m_pSource->m_PosEnvOffset, pVoice->m_pSource->m_PosEnv, aChannels, &m_pClient->m_MapLayersBackGround);
OffsetX = aChannels[0];
OffsetY = aChannels[1];
}
@ -222,7 +222,7 @@ void CMapSounds::OnRender()
if(pVoice->m_pSource->m_SoundEnv >= 0)
{
float aChannels[4];
CMapLayers::EnvelopeEval(pVoice->m_pSource->m_SoundEnvOffset, pVoice->m_pSource->m_SoundEnv, aChannels, m_pClient->m_pMapLayersBackGround);
CMapLayers::EnvelopeEval(pVoice->m_pSource->m_SoundEnvOffset, pVoice->m_pSource->m_SoundEnv, aChannels, &m_pClient->m_MapLayersBackGround);
float Volume = clamp(aChannels[0], 0.0f, 1.0f);
Sound()->SetVoiceVolume(pVoice->m_Voice, Volume);

View file

@ -1465,7 +1465,7 @@ int CMenus::Render()
}
else if(s_Frame == 1)
{
m_pClient->m_pSounds->Enqueue(CSounds::CHN_MUSIC, SOUND_MENU);
m_pClient->m_Sounds.Enqueue(CSounds::CHN_MUSIC, SOUND_MENU);
s_Frame++;
m_DoubleClickIndex = -1;
@ -2003,11 +2003,11 @@ int CMenus::Render()
ActSelection = g_Config.m_BrFilterCountryIndex;
static float s_ScrollValue = 0.0f;
int OldSelected = -1;
UiDoListboxStart(&s_ScrollValue, &Box, 50.0f, Localize("Country / Region"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue);
UiDoListboxStart(&s_ScrollValue, &Box, 50.0f, Localize("Country / Region"), "", m_pClient->m_CountryFlags.Num(), 6, OldSelected, s_ScrollValue);
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
for(int i = 0; i < m_pClient->m_CountryFlags.Num(); ++i)
{
const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_pCountryFlags->GetByIndex(i);
const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_CountryFlags.GetByIndex(i);
if(pEntry->m_CountryCode == ActSelection)
OldSelected = i;
@ -2021,14 +2021,14 @@ int CMenus::Render()
Item.m_Rect.w = Item.m_Rect.h * 2;
Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_pCountryFlags->Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
m_pClient->m_CountryFlags.Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
}
}
const int NewSelected = UiDoListboxEnd(&s_ScrollValue, 0);
if(OldSelected != NewSelected)
ActSelection = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
ActSelection = m_pClient->m_CountryFlags.GetByIndex(NewSelected)->m_CountryCode;
Part.VMargin(120.0f, &Part);
@ -2618,7 +2618,7 @@ void CMenus::OnStateChange(int NewState, int OldState)
if(NewState == IClient::STATE_OFFLINE)
{
if(OldState >= IClient::STATE_ONLINE && NewState < IClient::STATE_QUITTING)
m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
m_pClient->m_Sounds.Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
m_Popup = POPUP_NONE;
if(Client()->ErrorString() && Client()->ErrorString()[0] != 0)
{
@ -2809,7 +2809,7 @@ bool CMenus::CheckHotKey(int Key) const
{
return m_Popup == POPUP_NONE &&
!Input()->KeyIsPressed(KEY_LSHIFT) && !Input()->KeyIsPressed(KEY_RSHIFT) && !Input()->KeyIsPressed(KEY_LCTRL) && !Input()->KeyIsPressed(KEY_RCTRL) && !Input()->KeyIsPressed(KEY_LALT) && // no modifier
Input()->KeyIsPressed(Key) && m_pClient->m_pGameConsole->IsClosed();
Input()->KeyIsPressed(Key) && m_pClient->m_GameConsole.IsClosed();
}
int CMenus::DoButton_CheckBox_DontCare(const void *pID, const char *pText, int Checked, const CUIRect *pRect)

View file

@ -193,7 +193,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
s_ScrollValue = DoScrollbarV(&s_ScrollBar, &Scroll, s_ScrollValue);
if(Input()->KeyPress(KEY_TAB) && m_pClient->m_pGameConsole->IsClosed())
if(Input()->KeyPress(KEY_TAB) && m_pClient->m_GameConsole.IsClosed())
{
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
g_Config.m_UiToolboxPage = (g_Config.m_UiToolboxPage + 3 - 1) % 3;
@ -760,7 +760,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
Rect.w = Rect.h * 2;
Rect.x += (OldWidth - Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, g_Config.m_BrFilterCountry ? 1.0f : 0.5f);
m_pClient->m_pCountryFlags->Render(g_Config.m_BrFilterCountryIndex, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
m_pClient->m_CountryFlags.Render(g_Config.m_BrFilterCountryIndex, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
if(g_Config.m_BrFilterCountry && UI()->DoButtonLogic(&g_Config.m_BrFilterCountryIndex, "", 0, &Rect))
m_Popup = POPUP_COUNTRY;
@ -975,7 +975,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
}
ColorRGBA Color(1.0f, 1.0f, 1.0f, Active ? 1.0f : 0.2f);
m_pClient->m_pCountryFlags->Render(FlagID, &Color, Pos.x, Pos.y, FlagWidth, FlagHeight);
m_pClient->m_CountryFlags.Render(FlagID, &Color, Pos.x, Pos.y, FlagWidth, FlagHeight);
}
}
}
@ -1211,7 +1211,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
// flag
ColorRGBA FColor(1.0f, 1.0f, 1.0f, 0.5f);
m_pClient->m_pCountryFlags->Render(pSelectedServer->m_aClients[i].m_Country, &FColor, Flag.x, Flag.y, Flag.w, Flag.h);
m_pClient->m_CountryFlags.Render(pSelectedServer->m_aClients[i].m_Country, &FColor, Flag.x, Flag.y, Flag.w, Flag.h);
}
UiDoListboxEnd(&s_ScrollValue, 0);

View file

@ -166,7 +166,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
}
// handle keyboard shortcuts independent of active menu
if(m_pClient->m_pGameConsole->IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE && g_Config.m_ClDemoKeyboardShortcuts)
if(m_pClient->m_GameConsole.IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE && g_Config.m_ClDemoKeyboardShortcuts)
{
// increase/decrease speed
if(!Input()->KeyIsPressed(KEY_LSHIFT) && !Input()->KeyIsPressed(KEY_RSHIFT))
@ -351,8 +351,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
m_pClient->m_SuppressEvents = true;
DemoPlayer()->SeekPercent(Amount);
m_pClient->m_SuppressEvents = false;
m_pClient->m_pMapLayersBackGround->EnvelopeUpdate();
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate();
m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
}
}
else
@ -363,8 +363,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
m_pClient->m_SuppressEvents = true;
DemoPlayer()->SeekPercent(Amount);
m_pClient->m_SuppressEvents = false;
m_pClient->m_pMapLayersBackGround->EnvelopeUpdate();
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate();
m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
}
}
}
@ -464,7 +464,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
// close button
ButtonBar.VSplitRight(ButtonbarHeight * 3, &ButtonBar, &Button);
static int s_ExitButton = 0;
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button) || (Input()->KeyPress(KEY_C) && m_pClient->m_pGameConsole->IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button) || (Input()->KeyPress(KEY_C) && m_pClient->m_GameConsole.IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
{
Client()->Disconnect();
DemolistOnUpdate(false);
@ -1220,7 +1220,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
}
static int s_PlayButton = 0;
if(DoButton_Menu(&s_PlayButton, m_DemolistSelectedIsDir ? Localize("Open") : Localize("Play", "Demo browser"), 0, &PlayRect) || Activated || (Input()->KeyPress(KEY_P) && m_pClient->m_pGameConsole->IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
if(DoButton_Menu(&s_PlayButton, m_DemolistSelectedIsDir ? Localize("Open") : Localize("Play", "Demo browser"), 0, &PlayRect) || Activated || (Input()->KeyPress(KEY_P) && m_pClient->m_GameConsole.IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
{
if(m_DemolistSelectedIndex >= 0)
{
@ -1271,7 +1271,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
if(!m_DemolistSelectedIsDir)
{
static int s_DeleteButton = 0;
if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &DeleteRect) || m_DeletePressed || (Input()->KeyPress(KEY_D) && m_pClient->m_pGameConsole->IsClosed()))
if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &DeleteRect) || m_DeletePressed || (Input()->KeyPress(KEY_D) && m_pClient->m_GameConsole.IsClosed()))
{
if(m_DemolistSelectedIndex >= 0)
{
@ -1295,7 +1295,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
#if defined(CONF_VIDEORECORDER)
static int s_RenderButton = 0;
if(DoButton_Menu(&s_RenderButton, Localize("Render"), 0, &RenderRect) || (Input()->KeyPress(KEY_R) && m_pClient->m_pGameConsole->IsClosed()))
if(DoButton_Menu(&s_RenderButton, Localize("Render"), 0, &RenderRect) || (Input()->KeyPress(KEY_R) && m_pClient->m_GameConsole.IsClosed()))
{
if(m_DemolistSelectedIndex >= 0)
{

View file

@ -319,7 +319,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
//TextRender()->SetCursor(&Cursor, Button2.x,Button2.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
//Cursor.m_LineWidth = Button.w;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f);
m_pClient->m_pCountryFlags->Render(m_pClient->m_aClients[Index].m_Country, &Color,
m_pClient->m_CountryFlags.Render(m_pClient->m_aClients[Index].m_Country, &Color,
Button2.x, Button2.y + Button2.h / 2.0f - 0.75 * Button2.h / 2.0f, 1.5f * Button2.h, 0.75f * Button2.h);
// ignore chat button
@ -516,7 +516,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f;
TextRender()->Text(0, Motd.x + x, Motd.y + y, 32, Localize("MOTD"), -1.0f);
y += 32.0f + 5.0f;
TextRender()->Text(0, Motd.x + x, Motd.y + y, 16, m_pClient->m_pMotd->m_aServerMotd, Motd.w);
TextRender()->Text(0, Motd.x + x, Motd.y + y, 16, m_pClient->m_Motd.m_aServerMotd, Motd.w);
}
bool CMenus::RenderServerControlServer(CUIRect MainView)
@ -524,13 +524,13 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
static int s_VoteList = 0;
static float s_ScrollValue = 0;
CUIRect List = MainView;
int Total = m_pClient->m_pVoting->m_NumVoteOptions;
int Total = m_pClient->m_Voting.m_NumVoteOptions;
int NumVoteOptions = 0;
int aIndices[MAX_VOTE_OPTIONS];
static int s_CurVoteOption = 0;
int TotalShown = 0;
for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext)
for(CVoteOptionClient *pOption = m_pClient->m_Voting.m_pFirst; pOption; pOption = pOption->m_pNext)
{
if(m_aFilterString[0] != '\0' && !str_utf8_find_nocase(pOption->m_aDescription, m_aFilterString))
continue;
@ -540,7 +540,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
UiDoListboxStart(&s_VoteList, &List, 19.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue);
int i = -1;
for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext)
for(CVoteOptionClient *pOption = m_pClient->m_Voting.m_pFirst; pOption; pOption = pOption->m_pNext)
{
i++;
if(m_aFilterString[0] != '\0' && !str_utf8_find_nocase(pOption->m_aDescription, m_aFilterString))
@ -699,7 +699,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
{
if(s_ControlPage == 0)
{
m_pClient->m_pVoting->CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason);
m_pClient->m_Voting.CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason);
if(g_Config.m_UiCloseWindowAfterChangingSetting)
SetActive(false);
}
@ -708,7 +708,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_pClient->m_Voting.CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
SetActive(false);
}
}
@ -717,7 +717,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_pClient->m_Voting.CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason);
SetActive(false);
}
}
@ -754,13 +754,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button))
{
if(s_ControlPage == 0)
m_pClient->m_pVoting->CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason, true);
m_pClient->m_Voting.CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason, true);
else if(s_ControlPage == 1)
{
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
m_pClient->m_Voting.CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
SetActive(false);
}
}
@ -769,7 +769,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
m_pClient->m_Voting.CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
SetActive(false);
}
}
@ -783,7 +783,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
Bottom.VSplitRight(120.0f, 0, &Button);
static int s_RemoveVoteButton = 0;
if(DoButton_Menu(&s_RemoveVoteButton, Localize("Remove"), 0, &Button))
m_pClient->m_pVoting->RemovevoteOption(m_CallvoteSelectedOption);
m_pClient->m_Voting.RemovevoteOption(m_CallvoteSelectedOption);
// add vote
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
@ -802,7 +802,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
static int s_AddVoteButton = 0;
if(DoButton_Menu(&s_AddVoteButton, Localize("Add"), 0, &Button))
if(s_aVoteDescription[0] != 0 && s_aVoteCommand[0] != 0)
m_pClient->m_pVoting->AddvoteOption(s_aVoteDescription, s_aVoteCommand);
m_pClient->m_Voting.AddvoteOption(s_aVoteDescription, s_aVoteCommand);
Bottom.VSplitLeft(5.0f, 0, &Bottom);
Bottom.VSplitLeft(250.0f, &Button, &Bottom);
@ -900,10 +900,10 @@ int CMenus::GhostlistFetchCallback(const char *pName, int IsDir, int StorageType
return 0;
char aFilename[256];
str_format(aFilename, sizeof(aFilename), "%s/%s", pSelf->m_pClient->m_pGhost->GetGhostDir(), pName);
str_format(aFilename, sizeof(aFilename), "%s/%s", pSelf->m_pClient->m_Ghost.GetGhostDir(), pName);
CGhostInfo Info;
if(!pSelf->m_pClient->m_pGhost->GhostLoader()->GetGhostInfo(aFilename, &Info, pMap, pSelf->Client()->GetCurrentMapSha256(), pSelf->Client()->GetCurrentMapCrc()))
if(!pSelf->m_pClient->m_Ghost.GhostLoader()->GetGhostInfo(aFilename, &Info, pMap, pSelf->Client()->GetCurrentMapSha256(), pSelf->Client()->GetCurrentMapCrc()))
return 0;
CGhostItem Item;
@ -919,7 +919,7 @@ void CMenus::GhostlistPopulate()
{
CGhostItem *pOwnGhost = 0;
m_lGhosts.clear();
Storage()->ListDirectory(IStorage::TYPE_ALL, m_pClient->m_pGhost->GetGhostDir(), GhostlistFetchCallback, this);
Storage()->ListDirectory(IStorage::TYPE_ALL, m_pClient->m_Ghost.GetGhostDir(), GhostlistFetchCallback, this);
for(int i = 0; i < m_lGhosts.size(); i++)
{
@ -930,7 +930,7 @@ void CMenus::GhostlistPopulate()
if(pOwnGhost)
{
pOwnGhost->m_Own = true;
pOwnGhost->m_Slot = m_pClient->m_pGhost->Load(pOwnGhost->m_aFilename);
pOwnGhost->m_Slot = m_pClient->m_Ghost.Load(pOwnGhost->m_aFilename);
}
}
@ -1151,7 +1151,7 @@ void CMenus::RenderGhost(CUIRect MainView)
static int s_ReloadButton = 0;
if(DoButton_Menu(&s_ReloadButton, Localize("Reload"), 0, &Button) || Input()->KeyPress(KEY_F5))
{
m_pClient->m_pGhost->UnloadAll();
m_pClient->m_Ghost.UnloadAll();
GhostlistPopulate();
}
@ -1162,7 +1162,7 @@ void CMenus::RenderGhost(CUIRect MainView)
CGhostItem *pOwnGhost = GetOwnGhost();
int ReservedSlots = !pGhost->m_Own && !(pOwnGhost && pOwnGhost->Active());
if(pGhost->HasFile() && (pGhost->Active() || m_pClient->m_pGhost->FreeSlots() > ReservedSlots))
if(pGhost->HasFile() && (pGhost->Active() || m_pClient->m_Ghost.FreeSlots() > ReservedSlots))
{
Status.VSplitRight(120.0f, &Status, &Button);
@ -1172,11 +1172,11 @@ void CMenus::RenderGhost(CUIRect MainView)
{
if(pGhost->Active())
{
m_pClient->m_pGhost->Unload(pGhost->m_Slot);
m_pClient->m_Ghost.Unload(pGhost->m_Slot);
pGhost->m_Slot = -1;
}
else
pGhost->m_Slot = m_pClient->m_pGhost->Load(pGhost->m_aFilename);
pGhost->m_Slot = m_pClient->m_Ghost.Load(pGhost->m_aFilename);
}
Status.VSplitRight(5.0f, &Status, 0);
@ -1188,18 +1188,18 @@ void CMenus::RenderGhost(CUIRect MainView)
if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &Button))
{
if(pGhost->Active())
m_pClient->m_pGhost->Unload(pGhost->m_Slot);
m_pClient->m_Ghost.Unload(pGhost->m_Slot);
DeleteGhostItem(s_SelectedIndex);
}
Status.VSplitRight(5.0f, &Status, 0);
bool Recording = m_pClient->m_pGhost->GhostRecorder()->IsRecording();
bool Recording = m_pClient->m_Ghost.GhostRecorder()->IsRecording();
if(!pGhost->HasFile() && !Recording && pGhost->Active())
{
static int s_SaveButton = 0;
Status.VSplitRight(120.0f, &Status, &Button);
if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &Button))
m_pClient->m_pGhost->SaveGhost(pGhost);
m_pClient->m_Ghost.SaveGhost(pGhost);
}
}

View file

@ -407,11 +407,11 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
MainView.HSplitTop(20.0f, 0, &MainView);
static float s_ScrollValue = 0.0f;
int OldSelected = -1;
UiDoListboxStart(&s_ScrollValue, &MainView, 50.0f, Localize("Country / Region"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue);
UiDoListboxStart(&s_ScrollValue, &MainView, 50.0f, Localize("Country / Region"), "", m_pClient->m_CountryFlags.Num(), 6, OldSelected, s_ScrollValue);
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
for(int i = 0; i < m_pClient->m_CountryFlags.Num(); ++i)
{
const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_pCountryFlags->GetByIndex(i);
const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_CountryFlags.GetByIndex(i);
if(pEntry->m_CountryCode == *pCountry)
OldSelected = i;
@ -425,7 +425,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Item.m_Rect.w = Item.m_Rect.h * 2;
Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_pCountryFlags->Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
m_pClient->m_CountryFlags.Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
if(pEntry->m_Texture != -1)
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
}
@ -438,7 +438,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(OldSelected != NewSelected)
{
*pCountry = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
*pCountry = m_pClient->m_CountryFlags.GetByIndex(NewSelected)->m_CountryCode;
SetNeedSendInfo();
}
}
@ -482,7 +482,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
// skin info
CTeeRenderInfo OwnSkinInfo;
const CSkin *pSkin = m_pClient->m_pSkins->Get(m_pClient->m_pSkins->Find(Skin));
const CSkin *pSkin = m_pClient->m_Skins.Get(m_pClient->m_Skins.Find(Skin));
OwnSkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
OwnSkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
OwnSkinInfo.m_SkinMetrics = pSkin->m_Metrics;
@ -626,12 +626,12 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static sorted_array<CUISkin> s_paSkinList;
static int s_SkinCount = 0;
static float s_ScrollValue = 0.0f;
if(s_InitSkinlist || m_pClient->m_pSkins->Num() != s_SkinCount)
if(s_InitSkinlist || m_pClient->m_Skins.Num() != s_SkinCount)
{
s_paSkinList.clear();
for(int i = 0; i < m_pClient->m_pSkins->Num(); ++i)
for(int i = 0; i < m_pClient->m_Skins.Num(); ++i)
{
const CSkin *s = m_pClient->m_pSkins->Get(i);
const CSkin *s = m_pClient->m_Skins.Get(i);
// filter quick search
if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_utf8_find_nocase(s->m_aName, g_Config.m_ClSkinFilterString))
@ -651,7 +651,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
s_paSkinList.add(CUISkin(s));
}
s_InitSkinlist = false;
s_SkinCount = m_pClient->m_pSkins->Num();
s_SkinCount = m_pClient->m_Skins.Num();
}
int OldSelected = -1;
@ -758,7 +758,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static int s_SkinRefreshButtonID = 0;
if(DoButton_Menu(&s_SkinRefreshButtonID, "\xEE\x97\x95", 0, &RefreshButton, NULL, 15, 5, 0, vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4(1, 1, 1, 0.5f), 0))
{
m_pClient->m_pSkins->Refresh();
m_pClient->m_Skins.Refresh();
s_InitSkinlist = true;
if(Client()->State() >= IClient::STATE_ONLINE)
{
@ -863,9 +863,9 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View, CUIRect ScopeView
if(NewId != OldId || NewModifier != OldModifier)
{
if(OldId != 0 || NewId == 0)
m_pClient->m_pBinds->Bind(OldId, "", false, OldModifier);
m_pClient->m_Binds.Bind(OldId, "", false, OldModifier);
if(NewId != 0)
m_pClient->m_pBinds->Bind(NewId, gs_aKeys[i].m_pCommand, false, NewModifier);
m_pClient->m_Binds.Bind(NewId, gs_aKeys[i].m_pCommand, false, NewModifier);
}
}
@ -885,7 +885,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
{
for(int KeyId = 0; KeyId < KEY_LAST; KeyId++)
{
const char *pBind = m_pClient->m_pBinds->Get(KeyId, Mod);
const char *pBind = m_pClient->m_Binds.Get(KeyId, Mod);
if(!pBind[0])
continue;
@ -976,7 +976,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
ResetButton.HSplitTop(20.0f, &ResetButton, 0);
static int s_DefaultButton = 0;
if(DoButton_Menu((void *)&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
m_pClient->m_pBinds->SetDefaults();
m_pClient->m_Binds.SetDefaults();
}
// voting settings
@ -1290,10 +1290,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
if(g_Config.m_SndEnable)
{
if(g_Config.m_SndMusic && Client()->State() == IClient::STATE_OFFLINE)
m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
m_pClient->m_Sounds.Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
}
else
m_pClient->m_pSounds->Stop(SOUND_MENU);
m_pClient->m_Sounds.Stop(SOUND_MENU);
m_NeedRestartSound = g_Config.m_SndEnable && (!s_SndEnable || s_SndRate != g_Config.m_SndRate);
}
@ -1307,9 +1307,9 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
if(Client()->State() == IClient::STATE_OFFLINE)
{
if(g_Config.m_SndMusic)
m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
m_pClient->m_Sounds.Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
else
m_pClient->m_pSounds->Stop(SOUND_MENU);
m_pClient->m_Sounds.Stop(SOUND_MENU);
}
}
@ -1526,7 +1526,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
Rect.VMargin(6.0f, &Rect);
Rect.HMargin(3.0f, &Rect);
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f);
m_pClient->m_pCountryFlags->Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
m_pClient->m_CountryFlags.Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect);
UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
}
@ -2102,7 +2102,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// ***** Chat ***** //
if(DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatOld, Localize("Use old chat style"), &g_Config.m_ClChatOld, &Chat, LineMargin))
GameClient()->m_pChat->RebuildChat();
GameClient()->m_Chat.RebuildChat();
Chat.HSplitTop(30.0f, 0x0, &Chat);
@ -2222,7 +2222,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// Load skins
int DefaultInd = GameClient()->m_pSkins->Find("default");
int DefaultInd = GameClient()->m_Skins.Find("default");
for(auto &i : RenderInfo)
{
@ -2233,10 +2233,10 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
int ind = -1;
int i = 0;
RenderInfo[i++].m_OriginalRenderSkin = GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("pinky")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("cammostripes")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("beast")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
RenderInfo[i++].m_OriginalRenderSkin = GameClient()->m_Skins.Get(DefaultInd)->m_OriginalSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("pinky")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("cammostripes")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("beast")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
}
// System

View file

@ -251,7 +251,7 @@ void CMenus::ClearCustomItems(int CurTab)
m_EntitiesList.clear();
// reload current entities
m_pClient->m_pMapimages->ChangeEntitiesPath(g_Config.m_ClAssetsEntites);
m_pClient->m_MapImages.ChangeEntitiesPath(g_Config.m_ClAssetsEntites);
}
else if(CurTab == 1)
{
@ -484,7 +484,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
if(s_CurCustomTab == 0)
{
str_copy(g_Config.m_ClAssetsEntites, GetCustomItem(s_CurCustomTab, NewSelected)->m_aName, sizeof(g_Config.m_ClAssetsEntites));
m_pClient->m_pMapimages->ChangeEntitiesPath(GetCustomItem(s_CurCustomTab, NewSelected)->m_aName);
m_pClient->m_MapImages.ChangeEntitiesPath(GetCustomItem(s_CurCustomTab, NewSelected)->m_aName);
}
else if(s_CurCustomTab == 1)
{
@ -573,7 +573,7 @@ void CMenus::ConchainAssetsEntities(IConsole::IResult *pResult, void *pUserData,
const char *pArg = pResult->GetString(0);
if(str_comp(pArg, g_Config.m_ClAssetsEntites) != 0)
{
pThis->m_pClient->m_pMapimages->ChangeEntitiesPath(pArg);
pThis->m_pClient->m_MapImages.ChangeEntitiesPath(pArg);
}
}

View file

@ -55,7 +55,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
{
float a = 1;
if(g_Config.m_ClNameplatesAlways == 0)
a = clamp(1 - powf(distance(m_pClient->m_pControls->m_TargetPos[g_Config.m_ClDummy], Position) / 200.0f, 16.0f), 0.0f, 1.0f);
a = clamp(1 - powf(distance(m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy], Position) / 200.0f, 16.0f), 0.0f, 1.0f);
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aName;
if(str_comp(pName, m_aNamePlates[ClientID].m_aName) != 0 || FontSize != m_aNamePlates[ClientID].m_NameTextFontSize)
@ -73,7 +73,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
// create nameplates at standard zoom
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup());
m_aNamePlates[ClientID].m_NameTextWidth = TextRender()->TextWidth(0, FontSize, pName, -1, -1.0f);
@ -99,7 +99,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
// create nameplates at standard zoom
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup());
m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1, -1.0f);

View file

@ -206,7 +206,7 @@ void CPlayers::RenderPlayer(
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{
// just use the direct input if it's the local player we are rendering
Angle = angle(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy]);
Angle = angle(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy]);
}
else
{
@ -234,7 +234,7 @@ void CPlayers::RenderPlayer(
vec2 Vel = mix(vec2(Prev.m_VelX / 256.0f, Prev.m_VelY / 256.0f), vec2(Player.m_VelX / 256.0f, Player.m_VelY / 256.0f), IntraTick);
m_pClient->m_pFlow->Add(Position, Vel * 100.0f, 10.0f);
m_pClient->m_Flow.Add(Position, Vel * 100.0f, 10.0f);
RenderInfo.m_GotAirJump = Player.m_Jumped & 2 ? 0 : 1;
@ -266,11 +266,11 @@ void CPlayers::RenderPlayer(
if(time() - SkidSoundTime > time_freq() / 10)
{
if(g_Config.m_SndGame)
m_pClient->m_pSounds->PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_SKID, 0.25f, Position);
m_pClient->m_Sounds.PlayAt(CSounds::CHN_WORLD, SOUND_PLAYER_SKID, 0.25f, Position);
SkidSoundTime = time();
}
m_pClient->m_pEffects->SkidTrail(
m_pClient->m_Effects.SkidTrail(
Position + vec2(-Player.m_Direction * 6, 12),
vec2(-Player.m_Direction * 100 * length(Vel), -50));
}
@ -288,7 +288,7 @@ void CPlayers::RenderPlayer(
vec2 ExDirection = Direction;
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
ExDirection = normalize(vec2(m_pClient->m_pControls->m_InputData[g_Config.m_ClDummy].m_TargetX, m_pClient->m_pControls->m_InputData[g_Config.m_ClDummy].m_TargetY));
ExDirection = normalize(vec2(m_pClient->m_Controls.m_InputData[g_Config.m_ClDummy].m_TargetX, m_pClient->m_Controls.m_InputData[g_Config.m_ClDummy].m_TargetY));
Graphics()->TextureClear();
vec2 InitPos = Position;
@ -399,12 +399,12 @@ void CPlayers::RenderPlayer(
{
Graphics()->QuadsSetRotation(-pi / 2 - State.GetAttach()->m_Angle * pi * 2);
p.x -= g_pData->m_Weapons.m_aId[iw].m_Offsetx;
m_pClient->m_pEffects->PowerupShine(p + vec2(32, 0), vec2(32, 12));
m_pClient->m_Effects.PowerupShine(p + vec2(32, 0), vec2(32, 12));
}
else
{
Graphics()->QuadsSetRotation(-pi / 2 + State.GetAttach()->m_Angle * pi * 2);
m_pClient->m_pEffects->PowerupShine(p - vec2(32, 0), vec2(32, 12));
m_pClient->m_Effects.PowerupShine(p - vec2(32, 0), vec2(32, 12));
}
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, p.x, p.y);
@ -647,10 +647,10 @@ void CPlayers::OnRender()
if(m_pClient->m_Snap.m_aCharacters[i].m_Cur.m_Weapon == WEAPON_NINJA && g_Config.m_ClShowNinja)
{
// change the skin for the player to the ninja
int Skin = m_pClient->m_pSkins->Find("x_ninja");
int Skin = m_pClient->m_Skins.Find("x_ninja");
if(Skin != -1)
{
const CSkin *pSkin = m_pClient->m_pSkins->Get(Skin);
const CSkin *pSkin = m_pClient->m_Skins.Get(Skin);
m_aRenderInfo[i].m_OriginalRenderSkin = pSkin->m_OriginalSkin;
m_aRenderInfo[i].m_ColorableRenderSkin = pSkin->m_ColorableSkin;
m_aRenderInfo[i].m_BloodColor = pSkin->m_BloodColor;
@ -664,8 +664,8 @@ void CPlayers::OnRender()
}
}
}
int Skin = m_pClient->m_pSkins->Find("x_spec");
const CSkin *pSkin = m_pClient->m_pSkins->Get(Skin);
int Skin = m_pClient->m_Skins.Find("x_spec");
const CSkin *pSkin = m_pClient->m_Skins.Get(Skin);
m_RenderInfoSpec.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
m_RenderInfoSpec.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
m_RenderInfoSpec.m_BloodColor = pSkin->m_BloodColor;

View file

@ -512,7 +512,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
// country flag
ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f);
m_pClient->m_pCountryFlags->Render(m_pClient->m_aClients[pInfo->m_ClientID].m_Country, &Color,
m_pClient->m_CountryFlags.Render(m_pClient->m_aClients[pInfo->m_ClientID].m_Country, &Color,
CountryOffset, y + (Spacing + TeeSizeMod * 5.0f) / 2.0f, CountryLength, LineHeight - Spacing - TeeSizeMod * 5.0f);
// ping
@ -613,8 +613,8 @@ void CScoreboard::OnRender()
return;
// if the score board is active, then we should clear the motd message as well
if(m_pClient->m_pMotd->IsActive())
m_pClient->m_pMotd->Clear();
if(m_pClient->m_Motd.IsActive())
m_pClient->m_Motd.Clear();
float Width = 400 * 3.0f * Graphics()->ScreenAspect();
float Height = 400 * 3.0f;
@ -695,7 +695,7 @@ void CScoreboard::OnRender()
bool CScoreboard::Active()
{
// if statboard is active don't show scoreboard
if(m_pClient->m_pStatboard->IsActive())
if(m_pClient->m_Statboard.IsActive())
return false;
if(m_Active)

View file

@ -29,7 +29,7 @@ void CSoundLoading::Run()
}
if(m_Render)
m_pGameClient->m_pMenus->RenderLoading();
m_pGameClient->m_Menus.RenderLoading();
}
}
@ -114,7 +114,7 @@ void CSounds::OnRender()
}
// set listener pos
Sound()->SetListenerPos(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y);
Sound()->SetListenerPos(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y);
// update volume
float NewGuiSoundVol = g_Config.m_SndChatSoundVolume / 100.0f;

View file

@ -125,7 +125,7 @@ void CSpectator::ConSpectateClosest(IConsole::IResult *pResult, void *pUserData)
int NewSpectatorID = -1;
vec2 CurPosition(pSelf->m_pClient->m_pCamera->m_Center);
vec2 CurPosition(pSelf->m_pClient->m_Camera.m_Center);
if(SpectatorID != SPEC_FREEVIEW)
{
const CNetObj_Character &CurCharacter = Snap.m_aCharacters[SpectatorID].m_Cur;

View file

@ -162,8 +162,8 @@ void CStatboard::RenderGlobalStats()
return;
//clear motd if it is active
if(m_pClient->m_pMotd->IsActive())
m_pClient->m_pMotd->Clear();
if(m_pClient->m_Motd.IsActive())
m_pClient->m_Motd.Clear();
bool GameWithFlags = m_pClient->m_Snap.m_pGameInfoObj &&
m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_FLAGS;

View file

@ -203,7 +203,7 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s (%s)", m_aDescription, m_aReason);
Client()->Notify("DDNet Vote", aBuf);
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
m_pClient->m_Sounds.Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
}
}
}

View file

@ -96,94 +96,63 @@ void CGameClient::OnConsoleInit()
m_pUpdater = Kernel()->RequestInterface<IUpdater>();
#endif
// setup pointers
m_pMenuBackground = &m_MenuBackground;
m_pBinds = &m_Binds;
m_pGameConsole = &m_GameConsole;
m_pParticles = &m_Particles;
m_pMenus = &m_Menus;
m_pSkins = &m_Skins;
m_pCountryFlags = &m_CountryFlags;
m_pChat = &m_Chat;
m_pFlow = &m_Flow;
m_pCamera = &m_Camera;
m_pControls = &m_Controls;
m_pEffects = &m_Effects;
m_pSounds = &m_Sounds;
m_pMotd = &m_Motd;
m_pDamageind = &m_DamageInd;
m_pMapimages = &m_MapImages;
m_pVoting = &m_Voting;
m_pScoreboard = &m_Scoreboard;
m_pStatboard = &m_Statboard;
m_pItems = &m_Items;
m_pMapLayersBackGround = &m_MapLayersBackGround;
m_pMapLayersForeGround = &m_MapLayersForeGround;
m_pBackGround = &m_BackGround;
m_Menus.SetMenuBackground(&m_MenuBackground);
m_pMapSounds = &m_MapSounds;
m_pPlayers = &m_Players;
m_pRaceDemo = &m_RaceDemo;
m_pGhost = &m_Ghost;
m_pMenus->SetMenuBackground(m_pMenuBackground);
m_NamePlates.SetPlayers(m_pPlayers);
m_NamePlates.SetPlayers(&m_Players);
// make a list of all the systems, make sure to add them in the correct render order
m_All.Add(m_pSkins);
m_All.Add(m_pCountryFlags);
m_All.Add(m_pMapimages);
m_All.Add(m_pEffects); // doesn't render anything, just updates effects
m_All.Add(m_pBinds);
m_All.Add(&m_pBinds->m_SpecialBinds);
m_All.Add(m_pControls);
m_All.Add(m_pCamera);
m_All.Add(m_pSounds);
m_All.Add(m_pVoting);
m_All.Add(m_pParticles); // doesn't render anything, just updates all the particles
m_All.Add(m_pRaceDemo);
m_All.Add(m_pMapSounds);
m_All.Add(&m_Skins);
m_All.Add(&m_CountryFlags);
m_All.Add(&m_MapImages);
m_All.Add(&m_Effects); // doesn't render anything, just updates effects
m_All.Add(&m_Binds);
m_All.Add(&m_Binds.m_SpecialBinds);
m_All.Add(&m_Controls);
m_All.Add(&m_Camera);
m_All.Add(&m_Sounds);
m_All.Add(&m_Voting);
m_All.Add(&m_Particles); // doesn't render anything, just updates all the particles
m_All.Add(&m_RaceDemo);
m_All.Add(&m_MapSounds);
m_All.Add(&m_BackGround); //render instead of m_MapLayersBackGround when g_Config.m_ClOverlayEntities == 100
m_All.Add(&m_MapLayersBackGround); // first to render
m_All.Add(&m_pParticles->m_RenderTrail);
m_All.Add(m_pItems);
m_All.Add(m_pPlayers);
m_All.Add(m_pGhost);
m_All.Add(&m_Particles.m_RenderTrail);
m_All.Add(&m_Items);
m_All.Add(&m_Players);
m_All.Add(&m_Ghost);
m_All.Add(&m_MapLayersForeGround);
m_All.Add(&m_pParticles->m_RenderExplosions);
m_All.Add(&m_Particles.m_RenderExplosions);
m_All.Add(&m_NamePlates);
m_All.Add(&m_pParticles->m_RenderGeneral);
m_All.Add(m_pDamageind);
m_All.Add(&m_Particles.m_RenderGeneral);
m_All.Add(&m_DamageInd);
m_All.Add(&m_Hud);
m_All.Add(&m_Spectator);
m_All.Add(&m_Emoticon);
m_All.Add(&m_KillMessages);
m_All.Add(m_pChat);
m_All.Add(&m_Chat);
m_All.Add(&m_Broadcast);
m_All.Add(&m_DebugHud);
m_All.Add(&m_Scoreboard);
m_All.Add(&m_Statboard);
m_All.Add(m_pMotd);
m_All.Add(m_pMenus);
m_All.Add(&m_pMenus->m_Binder);
m_All.Add(m_pGameConsole);
m_All.Add(&m_Motd);
m_All.Add(&m_Menus);
m_All.Add(&m_Menus.m_Binder);
m_All.Add(&m_GameConsole);
m_All.Add(m_pMenuBackground);
m_All.Add(&m_MenuBackground);
// build the input stack
m_Input.Add(&m_pMenus->m_Binder); // this will take over all input when we want to bind a key
m_Input.Add(&m_pBinds->m_SpecialBinds);
m_Input.Add(m_pGameConsole);
m_Input.Add(m_pChat); // chat has higher prio due to tha you can quit it by pressing esc
m_Input.Add(m_pMotd); // for pressing esc to remove it
m_Input.Add(m_pMenus);
m_Input.Add(&m_Menus.m_Binder); // this will take over all input when we want to bind a key
m_Input.Add(&m_Binds.m_SpecialBinds);
m_Input.Add(&m_GameConsole);
m_Input.Add(&m_Chat); // chat has higher prio due to tha you can quit it by pressing esc
m_Input.Add(&m_Motd); // for pressing esc to remove it
m_Input.Add(&m_Menus);
m_Input.Add(&m_Spectator);
m_Input.Add(&m_Emoticon);
m_Input.Add(m_pControls);
m_Input.Add(m_pBinds);
m_Input.Add(&m_Controls);
m_Input.Add(&m_Binds);
// add the some console commands
Console()->Register("team", "i[team-id]", CFGFLAG_CLIENT, ConTeam, this, "Switch team");
@ -297,7 +266,7 @@ void CGameClient::OnInit()
LoadParticlesSkin(g_Config.m_ClAssetParticles);
else
g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
g_GameClient.m_pMenus->RenderLoading();
m_Menus.RenderLoading();
}
for(int i = 0; i < m_All.m_Num; i++)
@ -347,7 +316,7 @@ void CGameClient::OnInit()
m_GameWorld.m_pCollision = Collision();
m_GameWorld.m_pTuningList = m_aTuningList;
m_pMapimages->SetTextureScale(g_Config.m_ClTextEntitiesSize);
m_MapImages.SetTextureScale(g_Config.m_ClTextEntitiesSize);
// Agressively try to grab window again since some Windows users report
// window not being focussed after starting client.
@ -388,12 +357,12 @@ void CGameClient::OnDummySwap()
if(g_Config.m_ClDummyResetOnSwitch)
{
int PlayerOrDummy = (g_Config.m_ClDummyResetOnSwitch == 2) ? g_Config.m_ClDummy : (!g_Config.m_ClDummy);
m_pControls->ResetInput(PlayerOrDummy);
m_pControls->m_InputData[PlayerOrDummy].m_Hook = 0;
m_Controls.ResetInput(PlayerOrDummy);
m_Controls.m_InputData[PlayerOrDummy].m_Hook = 0;
}
int tmp = m_DummyInput.m_Fire;
m_DummyInput = m_pControls->m_InputData[!g_Config.m_ClDummy];
m_pControls->m_InputData[g_Config.m_ClDummy].m_Fire = tmp;
m_DummyInput = m_Controls.m_InputData[!g_Config.m_ClDummy];
m_Controls.m_InputData[g_Config.m_ClDummy].m_Fire = tmp;
m_IsDummySwapping = 1;
}
@ -401,7 +370,7 @@ int CGameClient::OnSnapInput(int *pData, bool Dummy, bool Force)
{
if(!Dummy)
{
return m_pControls->SnapInput(pData);
return m_Controls.SnapInput(pData);
}
if(!g_Config.m_ClDummyHammer)
@ -625,9 +594,9 @@ void CGameClient::OnRender()
// display gfx & client warnings
for(SWarning *pWarning : {Graphics()->GetCurWarning(), Client()->GetCurWarning()})
{
if(pWarning != NULL && m_pMenus->CanDisplayWarning())
if(pWarning != NULL && m_Menus.CanDisplayWarning())
{
m_pMenus->PopupWarning(Localize("Warning"), pWarning->m_aWarningMsg, "Ok", 10000000);
m_Menus.PopupWarning(Localize("Warning"), pWarning->m_aWarningMsg, "Ok", 10000000);
pWarning->m_WasShown = true;
}
}
@ -647,7 +616,7 @@ void CGameClient::OnRender()
g_Config.m_ClDummy = 0;
// resend player and dummy info if it was filtered by server
if(Client()->State() == IClient::STATE_ONLINE && !m_pMenus->IsActive())
if(Client()->State() == IClient::STATE_ONLINE && !m_Menus.IsActive())
{
if(m_CheckInfo[0] == 0)
{
@ -700,7 +669,7 @@ void CGameClient::OnDummyDisconnect()
int CGameClient::GetLastRaceTick()
{
return m_pGhost->GetLastRaceTick();
return m_Ghost.GetLastRaceTick();
}
void CGameClient::OnRelease()
@ -726,7 +695,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
if(pUnpacker->Error())
return;
g_GameClient.m_pItems->AddExtraProjectile(&Proj);
m_Items.AddExtraProjectile(&Proj);
}
return;
@ -774,7 +743,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
if((pMsg->m_Team == 1 && (m_aClients[m_LocalIDs[0]].m_Team != m_aClients[m_LocalIDs[1]].m_Team || m_Teams.Team(m_LocalIDs[0]) != m_Teams.Team(m_LocalIDs[1]))) || pMsg->m_Team > 1)
{
m_pChat->OnMessage(MsgId, pRawMsg);
m_Chat.OnMessage(MsgId, pRawMsg);
}
}
return; // no need of all that stuff for the dummy
@ -808,12 +777,12 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
pMsg->m_SoundID == SOUND_CTF_GRAB_PL)
{
if(g_Config.m_SndGame)
g_GameClient.m_pSounds->Enqueue(CSounds::CHN_GLOBAL, pMsg->m_SoundID);
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, pMsg->m_SoundID);
}
else
{
if(g_Config.m_SndGame)
g_GameClient.m_pSounds->Play(CSounds::CHN_GLOBAL, pMsg->m_SoundID, 1.0f);
m_Sounds.Play(CSounds::CHN_GLOBAL, pMsg->m_SoundID, 1.0f);
}
}
else if(MsgId == NETMSGTYPE_SV_TEAMSSTATE || MsgId == NETMSGTYPE_SV_TEAMSSTATELEGACY)
@ -843,8 +812,8 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
if(i <= 16)
m_Teams.m_IsDDRace16 = true;
m_pGhost->m_AllowRestart = true;
m_pRaceDemo->m_AllowRestart = true;
m_Ghost.m_AllowRestart = true;
m_RaceDemo.m_AllowRestart = true;
}
else if(MsgId == NETMSGTYPE_SV_KILLMSG)
{
@ -874,14 +843,14 @@ void CGameClient::OnStateChange(int NewState, int OldState)
void CGameClient::OnShutdown()
{
m_pMenus->KillServer();
m_pRaceDemo->OnReset();
m_pGhost->OnReset();
m_Menus.KillServer();
m_RaceDemo.OnReset();
m_Ghost.OnReset();
}
void CGameClient::OnEnterGame()
{
g_GameClient.m_pEffects->ResetDamageIndicator();
m_Effects.ResetDamageIndicator();
}
void CGameClient::OnGameOver()
@ -894,7 +863,7 @@ void CGameClient::OnStartGame()
{
if(Client()->State() != IClient::STATE_DEMOPLAYBACK && !g_Config.m_ClAutoDemoOnConnect)
Client()->DemoRecorder_HandleAutoStart();
m_pStatboard->OnReset();
m_Statboard.OnReset();
}
void CGameClient::OnFlagGrab(int TeamID)
@ -927,12 +896,12 @@ void CGameClient::OnLanguageChange()
void CGameClient::OnRconType(bool UsernameReq)
{
m_pGameConsole->RequireUsername(UsernameReq);
m_GameConsole.RequireUsername(UsernameReq);
}
void CGameClient::OnRconLine(const char *pLine)
{
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
m_GameConsole.PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
}
void CGameClient::ProcessEvents()
@ -950,33 +919,33 @@ void CGameClient::ProcessEvents()
if(Item.m_Type == NETEVENTTYPE_DAMAGEIND)
{
CNetEvent_DamageInd *ev = (CNetEvent_DamageInd *)pData;
g_GameClient.m_pEffects->DamageIndicator(vec2(ev->m_X, ev->m_Y), direction(ev->m_Angle / 256.0f));
m_Effects.DamageIndicator(vec2(ev->m_X, ev->m_Y), direction(ev->m_Angle / 256.0f));
}
else if(Item.m_Type == NETEVENTTYPE_EXPLOSION)
{
CNetEvent_Explosion *ev = (CNetEvent_Explosion *)pData;
g_GameClient.m_pEffects->Explosion(vec2(ev->m_X, ev->m_Y));
m_Effects.Explosion(vec2(ev->m_X, ev->m_Y));
}
else if(Item.m_Type == NETEVENTTYPE_HAMMERHIT)
{
CNetEvent_HammerHit *ev = (CNetEvent_HammerHit *)pData;
g_GameClient.m_pEffects->HammerHit(vec2(ev->m_X, ev->m_Y));
m_Effects.HammerHit(vec2(ev->m_X, ev->m_Y));
}
else if(Item.m_Type == NETEVENTTYPE_SPAWN)
{
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)pData;
g_GameClient.m_pEffects->PlayerSpawn(vec2(ev->m_X, ev->m_Y));
m_Effects.PlayerSpawn(vec2(ev->m_X, ev->m_Y));
}
else if(Item.m_Type == NETEVENTTYPE_DEATH)
{
CNetEvent_Death *ev = (CNetEvent_Death *)pData;
g_GameClient.m_pEffects->PlayerDeath(vec2(ev->m_X, ev->m_Y), ev->m_ClientID);
m_Effects.PlayerDeath(vec2(ev->m_X, ev->m_Y), ev->m_ClientID);
}
else if(Item.m_Type == NETEVENTTYPE_SOUNDWORLD)
{
CNetEvent_SoundWorld *ev = (CNetEvent_SoundWorld *)pData;
if(g_Config.m_SndGame && (ev->m_SoundID != SOUND_GUN_FIRE || g_Config.m_SndGun) && (ev->m_SoundID != SOUND_PLAYER_PAIN_LONG || g_Config.m_SndLongPain))
g_GameClient.m_pSounds->PlayAt(CSounds::CHN_WORLD, ev->m_SoundID, 1.0f, vec2(ev->m_X, ev->m_Y));
m_Sounds.PlayAt(CSounds::CHN_WORLD, ev->m_SoundID, 1.0f, vec2(ev->m_X, ev->m_Y));
}
}
}
@ -1125,7 +1094,7 @@ static CGameInfo GetGameInfo(const CNetObj_GameInfoEx *pInfoEx, int InfoExSize,
void CGameClient::InvalidateSnapshot()
{
// clear all pointers
mem_zero(&g_GameClient.m_Snap, sizeof(g_GameClient.m_Snap));
mem_zero(&m_Snap, sizeof(m_Snap));
m_Snap.m_LocalClientID = -1;
}
@ -1219,7 +1188,7 @@ void CGameClient::OnNewSnapshot()
pClient->m_SkinInfo.m_Size = 64;
// find new skin
const CSkin *pSkin = m_pSkins->Get(m_pSkins->Find(pClient->m_aSkinName));
const CSkin *pSkin = m_Skins.Get(m_Skins.Find(pClient->m_aSkinName));
pClient->m_SkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
pClient->m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
pClient->m_SkinInfo.m_SkinMetrics = pSkin->m_Metrics;
@ -1387,7 +1356,7 @@ void CGameClient::OnNewSnapshot()
// hence no need to reset stats until player leaves GameOver
// and it would be a mistake to reset stats after or during the pause
&& !(CurrentTickGameOver || m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED || s_GamePaused))
m_pStatboard->OnReset();
m_Statboard.OnReset();
m_LastRoundStartTick = m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_GameOver = CurrentTickGameOver;
s_GamePaused = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED);
@ -1459,7 +1428,7 @@ void CGameClient::OnNewSnapshot()
else if(Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, m_Snap.m_LocalClientID))
{
// player died
m_pControls->OnPlayerDeath();
m_Controls.OnPlayerDeath();
}
}
if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
@ -1599,12 +1568,12 @@ void CGameClient::OnNewSnapshot()
m_ShowOthers[g_Config.m_ClDummy] = g_Config.m_ClShowOthers;
}
float ZoomToSend = m_pCamera->m_Zoom;
if(m_pCamera->m_ZoomSmoothingTarget != .0)
float ZoomToSend = m_Camera.m_Zoom;
if(m_Camera.m_ZoomSmoothingTarget != .0)
{
if(m_pCamera->m_ZoomSmoothingTarget > m_pCamera->m_Zoom) // Zooming out
ZoomToSend = m_pCamera->m_ZoomSmoothingTarget;
else if(m_pCamera->m_ZoomSmoothingTarget < m_pCamera->m_Zoom && m_LastZoom > 0) // Zooming in
if(m_Camera.m_ZoomSmoothingTarget > m_Camera.m_Zoom) // Zooming out
ZoomToSend = m_Camera.m_ZoomSmoothingTarget;
else if(m_Camera.m_ZoomSmoothingTarget < m_Camera.m_Zoom && m_LastZoom > 0) // Zooming in
ZoomToSend = m_LastZoom;
}
@ -1626,8 +1595,8 @@ void CGameClient::OnNewSnapshot()
}
m_LastDummyConnected = Client()->DummyConnected();
m_pGhost->OnNewSnapshot();
m_pRaceDemo->OnNewSnapshot();
m_Ghost.OnNewSnapshot();
m_RaceDemo.OnNewSnapshot();
// detect air jump for other players
for(int i = 0; i < MAX_CLIENTS; i++)
@ -1637,7 +1606,7 @@ void CGameClient::OnNewSnapshot()
vec2 Pos = mix(vec2(m_Snap.m_aCharacters[i].m_Prev.m_X, m_Snap.m_aCharacters[i].m_Prev.m_Y),
vec2(m_Snap.m_aCharacters[i].m_Cur.m_X, m_Snap.m_aCharacters[i].m_Cur.m_Y),
Client()->IntraGameTick(g_Config.m_ClDummy));
m_pEffects->AirJump(Pos);
m_Effects.AirJump(Pos);
}
static int PrevLocalID = -1;
@ -1766,15 +1735,15 @@ void CGameClient::OnPredict()
int Events = pLocalChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict)
if(Events & COREEVENT_AIR_JUMP)
m_pEffects->AirJump(Pos);
m_Effects.AirJump(Pos);
if(g_Config.m_SndGame)
{
if(Events & COREEVENT_GROUND_JUMP)
m_pSounds->PlayAndRecord(CSounds::CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, Pos);
m_Sounds.PlayAndRecord(CSounds::CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, Pos);
if(Events & COREEVENT_HOOK_ATTACH_GROUND)
m_pSounds->PlayAndRecord(CSounds::CHN_WORLD, SOUND_HOOK_ATTACH_GROUND, 1.0f, Pos);
m_Sounds.PlayAndRecord(CSounds::CHN_WORLD, SOUND_HOOK_ATTACH_GROUND, 1.0f, Pos);
if(Events & COREEVENT_HOOK_HIT_NOHOOK)
m_pSounds->PlayAndRecord(CSounds::CHN_WORLD, SOUND_HOOK_NOATTACH, 1.0f, Pos);
m_Sounds.PlayAndRecord(CSounds::CHN_WORLD, SOUND_HOOK_NOATTACH, 1.0f, Pos);
}
}
@ -1786,7 +1755,7 @@ void CGameClient::OnPredict()
int Events = pDummyChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict)
if(Events & COREEVENT_AIR_JUMP)
m_pEffects->AirJump(Pos);
m_Effects.AirJump(Pos);
}
}
@ -1885,7 +1854,7 @@ void CGameClient::OnPredict()
m_PredictedTick = Client()->PredGameTick(g_Config.m_ClDummy);
if(m_NewPredictedTick)
m_pGhost->OnNewPredictedSnapshot();
m_Ghost.OnNewPredictedSnapshot();
}
void CGameClient::OnActivateEditor()
@ -1997,7 +1966,7 @@ void CGameClient::SendSwitchTeam(int Team)
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
if(Team != TEAM_SPECTATORS)
m_pCamera->OnReset();
m_Camera.OnReset();
}
void CGameClient::SendInfo(bool Start)
@ -2119,7 +2088,7 @@ void CGameClient::ConchainClTextEntitiesSize(IConsole::IResult *pResult, void *p
if(pResult->NumArguments())
{
CGameClient *pGameClient = (CGameClient *)pUserData;
pGameClient->m_pMapimages->SetTextureScale(g_Config.m_ClTextEntitiesSize);
pGameClient->m_MapImages.SetTextureScale(g_Config.m_ClTextEntitiesSize);
}
}
@ -2561,7 +2530,7 @@ vec2 CGameClient::GetSmoothPos(int ClientID)
void CGameClient::Echo(const char *pString)
{
m_pChat->Echo(pString);
m_Chat.Echo(pString);
}
bool CGameClient::IsOtherTeam(int ClientID)
@ -2943,14 +2912,14 @@ void CGameClient::RefindSkins()
Client.m_SkinInfo.m_ColorableRenderSkin.Reset();
if(Client.m_aSkinName[0] != '\0')
{
const CSkin *pSkin = m_pSkins->Get(m_pSkins->Find(Client.m_aSkinName));
const CSkin *pSkin = m_Skins.Get(m_Skins.Find(Client.m_aSkinName));
Client.m_SkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
Client.m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
Client.UpdateRenderInfo();
}
}
m_pGhost->RefindSkin();
m_pChat->RefindSkins();
m_Ghost.RefindSkin();
m_Chat.RefindSkins();
m_KillMessages.RefindSkins();
}
@ -3019,7 +2988,7 @@ void CGameClient::ConchainMenuMap(IConsole::IResult *pResult, void *pUserData, I
if(str_comp(g_Config.m_ClMenuMap, pResult->GetString(0)) != 0)
{
str_format(g_Config.m_ClMenuMap, sizeof(g_Config.m_ClMenuMap), "%s", pResult->GetString(0));
pSelf->m_pMenuBackground->LoadMenuBackground();
pSelf->m_MenuBackground.LoadMenuBackground();
}
}
else
@ -3034,19 +3003,19 @@ void CGameClient::DummyResetInput()
if((m_DummyInput.m_Fire & 1) != 0)
m_DummyInput.m_Fire++;
m_pControls->ResetInput(!g_Config.m_ClDummy);
m_pControls->m_InputData[!g_Config.m_ClDummy].m_Hook = 0;
m_pControls->m_InputData[!g_Config.m_ClDummy].m_Fire = m_DummyInput.m_Fire;
m_Controls.ResetInput(!g_Config.m_ClDummy);
m_Controls.m_InputData[!g_Config.m_ClDummy].m_Hook = 0;
m_Controls.m_InputData[!g_Config.m_ClDummy].m_Fire = m_DummyInput.m_Fire;
m_DummyInput = m_pControls->m_InputData[!g_Config.m_ClDummy];
m_DummyInput = m_Controls.m_InputData[!g_Config.m_ClDummy];
}
bool CGameClient::CanDisplayWarning()
{
return m_pMenus->CanDisplayWarning();
return m_Menus.CanDisplayWarning();
}
bool CGameClient::IsDisplayingWarning()
{
return m_pMenus->GetCurPopup() == CMenus::POPUP_WARNING;
return m_Menus.GetCurPopup() == CMenus::POPUP_WARNING;
}

View file

@ -477,34 +477,6 @@ public:
virtual void SendDummyInfo(bool Start);
void SendKill(int ClientID);
// pointers to all systems
class CMenuBackground *m_pMenuBackground;
class CGameConsole *m_pGameConsole;
class CBinds *m_pBinds;
class CParticles *m_pParticles;
class CMenus *m_pMenus;
class CSkins *m_pSkins;
class CCountryFlags *m_pCountryFlags;
class CFlow *m_pFlow;
class CChat *m_pChat;
class CDamageInd *m_pDamageind;
class CCamera *m_pCamera;
class CControls *m_pControls;
class CEffects *m_pEffects;
class CSounds *m_pSounds;
class CMotd *m_pMotd;
class CMapImages *m_pMapimages;
class CVoting *m_pVoting;
class CScoreboard *m_pScoreboard;
class CStatboard *m_pStatboard;
class CItems *m_pItems;
class CMapLayers *m_pMapLayersBackGround;
class CMapLayers *m_pMapLayersForeGround;
class CBackground *m_pBackGround;
class CMapSounds *m_pMapSounds;
class CPlayers *m_pPlayers;
// DDRace
int m_LocalIDs[NUM_DUMMIES];
@ -513,8 +485,6 @@ public:
int m_DummyFire;
bool m_ReceivedDDNetPlayer;
class CRaceDemo *m_pRaceDemo;
class CGhost *m_pGhost;
class CTeamsCore m_Teams;
int IntersectCharacter(vec2 Pos0, vec2 Pos1, vec2 &NewPos, int ownID);

View file

@ -6385,7 +6385,7 @@ void CEditor::LoadCurrentMap()
m_ValidSaveFilename = true;
CGameClient *pGameClient = (CGameClient *)Kernel()->RequestInterface<IGameClient>();
vec2 Center = pGameClient->m_pCamera->m_Center;
vec2 Center = pGameClient->m_Camera.m_Center;
m_WorldOffsetX = Center.x;
m_WorldOffsetY = Center.y;