3952: Remove global components and global gameclient instance r=heinrich5991 a=Jupeyy

Prevents global constructors/destructors and is a bit of cleanup

would also fix the issue from #3948

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2021-07-25 09:49:08 +00:00 committed by GitHub
commit b98263bfdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 543 additions and 449 deletions

View file

@ -1750,6 +1750,7 @@ if(CLIENT)
set_src(GAME_CLIENT GLOB_RECURSE src/game/client set_src(GAME_CLIENT GLOB_RECURSE src/game/client
animstate.cpp animstate.cpp
animstate.h animstate.h
component.cpp
component.h component.h
components/background.cpp components/background.cpp
components/background.h components/background.h

View file

@ -4344,7 +4344,7 @@ int main(int argc, const char **argv) // ignore_convention
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMap *>(pEngineMap), false); RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMap *>(pEngineMap), false);
RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateEditor(), false); RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateEditor(), false);
RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateGameClient(), false); RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateGameClient());
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pStorage); RegisterFail = RegisterFail || !pKernel->RegisterInterface(pStorage);
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pDiscord); RegisterFail = RegisterFail || !pKernel->RegisterInterface(pDiscord);
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pSteam); RegisterFail = RegisterFail || !pKernel->RegisterInterface(pSteam);

View file

@ -0,0 +1,39 @@
#include "component.h"
#include "gameclient.h"
class IKernel *CComponent::Kernel() const { return m_pClient->Kernel(); }
class IGraphics *CComponent::Graphics() const { return m_pClient->Graphics(); }
class ITextRender *CComponent::TextRender() const { return m_pClient->TextRender(); }
class IInput *CComponent::Input() const { return m_pClient->Input(); }
class IStorage *CComponent::Storage() const { return m_pClient->Storage(); }
class CUI *CComponent::UI() const { return m_pClient->UI(); }
class ISound *CComponent::Sound() const { return m_pClient->Sound(); }
class CRenderTools *CComponent::RenderTools() const { return m_pClient->RenderTools(); }
class CConfig *CComponent::Config() const { return m_pClient->Config(); }
class IConsole *CComponent::Console() const { return m_pClient->Console(); }
class IDemoPlayer *CComponent::DemoPlayer() const { return m_pClient->DemoPlayer(); }
class IDemoRecorder *CComponent::DemoRecorder(int Recorder) const { return m_pClient->DemoRecorder(Recorder); }
class IServerBrowser *CComponent::ServerBrowser() const { return m_pClient->ServerBrowser(); }
class CLayers *CComponent::Layers() const { return m_pClient->Layers(); }
class CCollision *CComponent::Collision() const { return m_pClient->Collision(); }
#if defined(CONF_AUTOUPDATE)
class IUpdater *CComponent::Updater() const
{
return m_pClient->Updater();
}
#endif
float CComponent::LocalTime() const
{
#if defined(CONF_VIDEORECORDER)
return IVideo::Current() ? IVideo::LocalTime() : Client()->LocalTime();
#else
return Client()->LocalTime();
#endif
}
class IClient *CComponent::Client() const
{
return m_pClient->Client();
}

View file

@ -7,9 +7,17 @@
#include <engine/shared/video.h> #include <engine/shared/video.h>
#endif #endif
#include "gameclient.h" #include <base/color.h>
#include <engine/input.h> #include <engine/input.h>
#include <engine/client.h>
#include <engine/console.h>
#include <game/localization.h>
#include <engine/config.h>
class CGameClient;
class CComponent class CComponent
{ {
protected: protected:
@ -18,26 +26,23 @@ protected:
CGameClient *m_pClient; CGameClient *m_pClient;
// perhaps propagte pointers for these as well // perhaps propagte pointers for these as well
class IKernel *Kernel() const { return m_pClient->Kernel(); } class IKernel *Kernel() const;
class IGraphics *Graphics() const { return m_pClient->Graphics(); } class IGraphics *Graphics() const;
class ITextRender *TextRender() const { return m_pClient->TextRender(); } class ITextRender *TextRender() const;
class IInput *Input() const { return m_pClient->Input(); } class IInput *Input() const;
class IStorage *Storage() const { return m_pClient->Storage(); } class IStorage *Storage() const;
class CUI *UI() const { return m_pClient->UI(); } class CUI *UI() const;
class ISound *Sound() const { return m_pClient->Sound(); } class ISound *Sound() const;
class CRenderTools *RenderTools() const { return m_pClient->RenderTools(); } class CRenderTools *RenderTools() const;
class CConfig *Config() const { return m_pClient->Config(); } class CConfig *Config() const;
class IConsole *Console() const { return m_pClient->Console(); } class IConsole *Console() const;
class IDemoPlayer *DemoPlayer() const { return m_pClient->DemoPlayer(); } class IDemoPlayer *DemoPlayer() const;
class IDemoRecorder *DemoRecorder(int Recorder) const { return m_pClient->DemoRecorder(Recorder); } class IDemoRecorder *DemoRecorder(int Recorder) const;
class IServerBrowser *ServerBrowser() const { return m_pClient->ServerBrowser(); } class IServerBrowser *ServerBrowser() const;
class CLayers *Layers() const { return m_pClient->Layers(); } class CLayers *Layers() const;
class CCollision *Collision() const { return m_pClient->Collision(); } class CCollision *Collision() const;
#if defined(CONF_AUTOUPDATE) #if defined(CONF_AUTOUPDATE)
class IUpdater *Updater() const class IUpdater *Updater() const;
{
return m_pClient->Updater();
}
#endif #endif
#if defined(CONF_VIDEORECORDER) #if defined(CONF_VIDEORECORDER)
@ -45,19 +50,18 @@ protected:
{ {
return IVideo::Current() ? IVideo::Time() : time_get(); return IVideo::Current() ? IVideo::Time() : time_get();
} }
float LocalTime() const { return IVideo::Current() ? IVideo::LocalTime() : Client()->LocalTime(); }
#else #else
int64_t time() const int64_t time() const
{ {
return time_get(); return time_get();
} }
float LocalTime() const { return Client()->LocalTime(); }
#endif #endif
float LocalTime() const;
public: public:
virtual ~CComponent() {} virtual ~CComponent() {}
class CGameClient *GameClient() const { return m_pClient; } class CGameClient *GameClient() const { return m_pClient; }
class IClient *Client() const { return m_pClient->Client(); } class IClient *Client() const;
virtual void OnStateChange(int NewState, int OldState){}; virtual void OnStateChange(int NewState, int OldState){};
virtual void OnConsoleInit(){}; virtual void OnConsoleInit(){};

View file

@ -8,6 +8,9 @@
#include <game/client/components/mapimages.h> #include <game/client/components/mapimages.h>
#include <game/client/components/maplayers.h> #include <game/client/components/maplayers.h>
#include <game/client/gameclient.h>
#include <game/layers.h>
#include "background.h" #include "background.h"
CBackground::CBackground(int MapType, bool OnlineOnly) : CBackground::CBackground(int MapType, bool OnlineOnly) :
@ -68,7 +71,7 @@ void CBackground::LoadBackground()
if(m_pMap->IsLoaded()) if(m_pMap->IsLoaded())
{ {
m_pLayers = GameClient()->Layers(); m_pLayers = GameClient()->Layers();
m_pImages = GameClient()->m_pMapimages; m_pImages = &GameClient()->m_MapImages;
m_Loaded = true; m_Loaded = true;
} }
} }

View file

@ -5,6 +5,10 @@
#include <engine/keys.h> #include <engine/keys.h>
#include <game/client/component.h> #include <game/client/component.h>
#include "console.h"
class IConfigManager;
class CBinds : public CComponent class CBinds : public CComponent
{ {
int GetKeyID(const char *pKeyName); int GetKeyID(const char *pKeyName);

View file

@ -20,7 +20,7 @@ void CBroadcast::OnReset()
void CBroadcast::OnRender() 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; return;
Graphics()->MapScreen(0, 0, 300 * Graphics()->ScreenAspect(), 300); Graphics()->MapScreen(0, 0, 300 * Graphics()->ScreenAspect(), 300);

View file

@ -107,22 +107,22 @@ void CCamera::OnRender()
{ {
if(m_CamType != CAMTYPE_SPEC) if(m_CamType != CAMTYPE_SPEC)
{ {
m_LastPos[g_Config.m_ClDummy] = m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy]; m_LastPos[g_Config.m_ClDummy] = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] = m_PrevCenter; m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_PrevCenter;
m_pClient->m_pControls->ClampMousePos(); m_pClient->m_Controls.ClampMousePos();
m_CamType = CAMTYPE_SPEC; 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 else
{ {
if(m_CamType != CAMTYPE_PLAYER) 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)) 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 else
m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy] = m_LastPos[g_Config.m_ClDummy]; m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_LastPos[g_Config.m_ClDummy];
m_pClient->m_pControls->ClampMousePos(); m_pClient->m_Controls.ClampMousePos();
m_CamType = CAMTYPE_PLAYER; m_CamType = CAMTYPE_PLAYER;
} }
@ -139,7 +139,7 @@ void CCamera::OnRender()
s_SpeedBias += CameraSpeed * DeltaTime; s_SpeedBias += CameraSpeed * DeltaTime;
if(g_Config.m_ClDyncam) 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); s_SpeedBias = clamp(s_SpeedBias, 0.5f, CameraSpeed);
} }
else else
@ -149,7 +149,7 @@ void CCamera::OnRender()
} }
vec2 TargetCameraOffset(0, 0); 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); float l = length(s_LastMousePos);
if(l > 0.0001f) // make sure that this isn't 0 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 FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f;
float OffsetAmount = maximum(l - DeadZone, 0.0f) * FollowFactor; 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) if(g_Config.m_ClDyncamSmoothness > 0)
@ -173,7 +173,7 @@ void CCamera::OnRender()
if(m_ForceFreeviewPos != vec2(-1, -1) && m_CamType == CAMTYPE_SPEC) 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_ForceFreeviewPos = vec2(-1, -1);
} }
m_PrevCenter = m_Center; 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) 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; m_aLastSoundPlayed[CHAT_SERVER] = Now;
} }
} }
@ -871,7 +871,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
Client()->Notify("DDNet Chat", aBuf); Client()->Notify("DDNet Chat", aBuf);
if(g_Config.m_SndHighlight) 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; 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)) 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; m_aLastSoundPlayed[CHAT_CLIENT] = Now;
} }
} }
@ -900,7 +900,7 @@ void CChat::RefindSkins()
{ {
if(Line.m_HasRenderTee) 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) if(Line.m_CustomColoredSkin)
Line.m_RenderSkin = pSkin->m_ColorableSkin; Line.m_RenderSkin = pSkin->m_ColorableSkin;
else else
@ -919,7 +919,7 @@ void CChat::OnPrepareLines()
float ScreenRatio = Graphics()->ScreenAspect(); 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 ForceRecreate = IsScoreBoardOpen != m_PrevScoreBoardShowed;
bool ShowLargeArea = m_Show || g_Config.m_ClShowChat == 2; bool ShowLargeArea = m_Show || g_Config.m_ClShowChat == 2;
@ -1239,7 +1239,7 @@ void CChat::OnRender()
Marker.m_X -= MarkerOffset; Marker.m_X -= MarkerOffset;
TextRender()->TextEx(&Marker, "|", -1); TextRender()->TextEx(&Marker, "|", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString(Editing) + m_Input.GetCursorOffset(Editing), -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); Input()->SetEditingPosition(Marker.m_X, Marker.m_Y + Marker.m_FontSize);
} }
@ -1255,7 +1255,7 @@ void CChat::OnRender()
OnPrepareLines(); OnPrepareLines();
float ScreenRatio = Graphics()->ScreenAspect(); 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(); int64_t Now = time();
float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f; float HeightLimit = IsScoreBoardOpen ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;

View file

@ -7,6 +7,8 @@
#include <game/client/component.h> #include <game/client/component.h>
#include <game/client/lineinput.h> #include <game/client/lineinput.h>
#include <game/client/skin.h>
class CChat : public CComponent class CChat : public CComponent
{ {
CLineInput m_Input; CLineInput m_Input;

View file

@ -31,6 +31,8 @@
#include <game/client/lineinput.h> #include <game/client/lineinput.h>
#include <game/client/render.h> #include <game/client/render.h>
#include <game/client/gameclient.h>
#include "console.h" #include "console.h"
CGameConsole::CInstance::CInstance(int Type) CGameConsole::CInstance::CInstance(int Type)
@ -750,17 +752,17 @@ void CGameConsole::Toggle(int Type)
if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_CLOSING) if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_CLOSING)
{ {
/*Input()->MouseModeAbsolute();*/ /*Input()->MouseModeAbsolute();*/
m_pClient->m_pMenus->UseMouseButtons(false); m_pClient->m_Menus.UseMouseButtons(false);
m_ConsoleState = CONSOLE_OPENING; m_ConsoleState = CONSOLE_OPENING;
/*// reset controls /*// reset controls
m_pClient->m_pControls->OnReset();*/ m_pClient->m_Controls.OnReset();*/
Input()->SetIMEState(true); Input()->SetIMEState(true);
} }
else else
{ {
Input()->MouseModeRelative(); Input()->MouseModeRelative();
m_pClient->m_pMenus->UseMouseButtons(true); m_pClient->m_Menus.UseMouseButtons(true);
m_pClient->OnRelease(); m_pClient->OnRelease();
m_ConsoleState = CONSOLE_CLOSING; m_ConsoleState = CONSOLE_CLOSING;

View file

@ -6,6 +6,8 @@
#include <game/client/component.h> #include <game/client/component.h>
#include <game/client/lineinput.h> #include <game/client/lineinput.h>
#include <engine/console.h>
enum enum
{ {
CONSOLE_CLOSED, CONSOLE_CLOSED,

View file

@ -250,9 +250,9 @@ int CControls::SnapInput(int *pData)
bool Send = false; bool Send = false;
// update player state // 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; 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; m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_IN_MENU;
else else
{ {
@ -264,13 +264,13 @@ int CControls::SnapInput(int *pData)
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING; 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; m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD;
if(m_InputData[g_Config.m_ClDummy].m_PlayerFlags != PLAYERFLAG_PLAYING) if(m_InputData[g_Config.m_ClDummy].m_PlayerFlags != PLAYERFLAG_PLAYING)
m_JoystickTapTime = 0; // Do not launch hook on first tap 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; 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) 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) 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; x = x * m_pClient->m_Camera.m_Zoom;
y = y * m_pClient->m_pCamera->m_Zoom; y = y * m_pClient->m_Camera.m_Zoom;
} }
m_MousePos[g_Config.m_ClDummy] += vec2(x, y); // TODO: ugly m_MousePos[g_Config.m_ClDummy] += vec2(x, y); // TODO: ugly

View file

@ -7,6 +7,8 @@
#include <base/vmath.h> #include <base/vmath.h>
#include <game/client/component.h> #include <game/client/component.h>
#include <game/generated/protocol.h>
class CControls : public CComponent class CControls : public CComponent
{ {
public: public:

View file

@ -9,6 +9,8 @@
#include <game/client/render.h> #include <game/client/render.h>
#include <game/client/ui.h> #include <game/client/ui.h>
#include <game/client/gameclient.h>
CDamageInd::CDamageInd() CDamageInd::CDamageInd()
{ {
m_Lastupdate = 0; m_Lastupdate = 0;

View file

@ -42,23 +42,23 @@ void CEffects::AirJump(vec2 Pos)
p.m_Gravity = 500; p.m_Gravity = 500;
p.m_Friction = 0.7f; p.m_Friction = 0.7f;
p.m_FlowAffected = 0.0f; 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); 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) 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) void CEffects::DamageIndicator(vec2 Pos, vec2 Dir)
{ {
m_pClient->m_pDamageind->Create(Pos, Dir); m_pClient->m_DamageInd.Create(Pos, Dir);
} }
void CEffects::ResetDamageIndicator() void CEffects::ResetDamageIndicator()
{ {
m_pClient->m_pDamageind->Reset(); m_pClient->m_DamageInd.Reset();
} }
void CEffects::PowerupShine(vec2 Pos, vec2 size) void CEffects::PowerupShine(vec2 Pos, vec2 size)
@ -79,7 +79,7 @@ void CEffects::PowerupShine(vec2 Pos, vec2 size)
p.m_Gravity = 500; p.m_Gravity = 500;
p.m_Friction = 0.9f; p.m_Friction = 0.9f;
p.m_FlowAffected = 0.0f; 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) 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_Friction = 0.7f;
p.m_Gravity = frandom() * -500.0f; p.m_Gravity = frandom() * -500.0f;
p.m_Color.a *= Alpha; 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) 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_Friction = 0.7f;
p.m_Gravity = frandom() * -500.0f; p.m_Gravity = frandom() * -500.0f;
p.m_Color = ColorRGBA(0.75f, 0.75f, 0.75f, 1.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) 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_EndSize = 0;
p.m_Friction = 0.7f; p.m_Friction = 0.7f;
p.m_Color.a *= Alpha; 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) void CEffects::PlayerSpawn(vec2 Pos)
@ -154,10 +154,10 @@ void CEffects::PlayerSpawn(vec2 Pos)
p.m_Gravity = frandom() * -400.0f; p.m_Gravity = frandom() * -400.0f;
p.m_Friction = 0.7f; p.m_Friction = 0.7f;
p.m_Color = ColorRGBA(0xb5 / 255.0f, 0x50 / 255.0f, 0xcb / 255.0f, 1.0f); 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) 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) void CEffects::PlayerDeath(vec2 Pos, int ClientID)
@ -190,7 +190,7 @@ void CEffects::PlayerDeath(vec2 Pos, int ClientID)
p.m_Friction = 0.8f; p.m_Friction = 0.8f;
ColorRGBA c = BloodColor.v4() * (0.75f + frandom() * 0.25f); ColorRGBA c = BloodColor.v4() * (0.75f + frandom() * 0.25f);
p.m_Color = ColorRGBA(c.r, c.g, c.b, 0.75f); 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; continue;
float a = 1 - (length(vec2(x, y)) / length(vec2(8, 8))); 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 // add the explosion
@ -216,7 +216,7 @@ void CEffects::Explosion(vec2 Pos)
p.m_StartSize = 150.0f; p.m_StartSize = 150.0f;
p.m_EndSize = 0; p.m_EndSize = 0;
p.m_Rot = frandom() * pi * 2; 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 // add the smoke
for(int i = 0; i < 24; i++) for(int i = 0; i < 24; i++)
@ -232,7 +232,7 @@ void CEffects::Explosion(vec2 Pos)
p.m_Gravity = frandom() * -800.0f; p.m_Gravity = frandom() * -800.0f;
p.m_Friction = 0.4f; 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()); 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_StartSize = 120.0f;
p.m_EndSize = 0; p.m_EndSize = 0;
p.m_Rot = frandom() * pi * 2; 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) 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() void CEffects::OnRender()
@ -278,7 +278,7 @@ void CEffects::OnRender()
m_Add50hz = false; m_Add50hz = false;
if(m_Add50hz) if(m_Add50hz)
m_pClient->m_pFlow->Update(); m_pClient->m_Flow.Update();
return; return;
} }
@ -300,5 +300,5 @@ void CEffects::OnRender()
m_Add50hz = false; m_Add50hz = false;
if(m_Add50hz) if(m_Add50hz)
m_pClient->m_pFlow->Update(); m_pClient->m_Flow.Update();
} }

View file

@ -13,6 +13,8 @@
#include <game/client/ui.h> #include <game/client/ui.h>
#include <game/gamecore.h> // get_angle #include <game/gamecore.h> // get_angle
#include <game/client/gameclient.h>
CEmoticon::CEmoticon() CEmoticon::CEmoticon()
{ {
OnReset(); OnReset();
@ -217,5 +219,5 @@ void CEmoticon::EyeEmote(int Emote)
str_format(aBuf, sizeof(aBuf), "/emote blink %d", g_Config.m_ClEyeDuration); str_format(aBuf, sizeof(aBuf), "/emote blink %d", g_Config.m_ClEyeDuration);
break; break;
} }
GameClient()->m_pChat->Say(0, aBuf); GameClient()->m_Chat.Say(0, aBuf);
} }

View file

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

View file

@ -6,6 +6,10 @@
#include <game/client/component.h> #include <game/client/component.h>
#include <game/client/components/menus.h> #include <game/client/components/menus.h>
#include <game/client/render.h>
struct CNetObj_Character;
enum enum
{ {
GHOSTDATA_TYPE_SKIN = 0, GHOSTDATA_TYPE_SKIN = 0,

View file

@ -605,7 +605,7 @@ void CHud::RenderTeambalanceWarning()
void CHud::RenderVoting() 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; return;
Graphics()->TextureClear(); Graphics()->TextureClear();
@ -619,7 +619,7 @@ void CHud::RenderVoting()
CTextCursor Cursor; CTextCursor Cursor;
char aBuf[512]; 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); 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()->SetCursor(&Cursor, 5.0f + 100.0f - tw, 60.0f, 6.0f, TEXTFLAG_RENDER);
TextRender()->TextEx(&Cursor, aBuf, -1); TextRender()->TextEx(&Cursor, aBuf, -1);
@ -627,26 +627,26 @@ void CHud::RenderVoting()
TextRender()->SetCursor(&Cursor, 5.0f, 60.0f, 6.0f, TEXTFLAG_RENDER); TextRender()->SetCursor(&Cursor, 5.0f, 60.0f, 6.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = 100.0f - tw; Cursor.m_LineWidth = 100.0f - tw;
Cursor.m_MaxLines = 3; Cursor.m_MaxLines = 3;
TextRender()->TextEx(&Cursor, m_pClient->m_pVoting->VoteDescription(), -1); TextRender()->TextEx(&Cursor, m_pClient->m_Voting.VoteDescription(), -1);
// reason // 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); TextRender()->SetCursor(&Cursor, 5.0f, 79.0f, 6.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = 100.0f; Cursor.m_LineWidth = 100.0f;
TextRender()->TextEx(&Cursor, aBuf, -1); TextRender()->TextEx(&Cursor, aBuf, -1);
CUIRect Base = {5, 88, 100, 4}; CUIRect Base = {5, 88, 100, 4};
m_pClient->m_pVoting->RenderBars(Base, false); m_pClient->m_Voting.RenderBars(Base, false);
char aKey[64]; 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")); str_format(aBuf, sizeof(aBuf), "%s - %s", aKey, Localize("Vote yes"));
Base.y += Base.h; Base.y += Base.h;
Base.h = 11.f; Base.h = 11.f;
UI()->DoLabel(&Base, aBuf, 6.0f, -1); 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); str_format(aBuf, sizeof(aBuf), "%s - %s", Localize("Vote no"), aKey);
UI()->DoLabel(&Base, aBuf, 6.0f, 1); 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) if(!m_pClient->m_Snap.m_pLocalCharacter || Client()->State() == IClient::STATE_DEMOPLAYBACK)
return; 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; int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS;
@ -665,7 +665,7 @@ void CHud::RenderCursor()
// render cursor // render cursor
int QuadOffset = NUM_WEAPONS * 10 * 2 + 40 * 2 + (CurWeapon); int QuadOffset = NUM_WEAPONS * 10 * 2 + 40 * 2 + (CurWeapon);
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f); 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() void CHud::PrepareHealthAmoQuads()
@ -805,7 +805,7 @@ void CHud::RenderSpectatorHud()
void CHud::RenderLocalTime(float x) 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; return;
//draw the box //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 // 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) 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_Time = 0.0f;
static float s_LastLocalTime = LocalTime(); static float s_LastLocalTime = LocalTime();
@ -101,7 +101,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
} }
else else
{ {
m_pClient->m_pEffects->BulletTrail(Pos, Alpha); m_pClient->m_Effects.BulletTrail(Pos, Alpha);
if(length(Vel) > 0.00001f) if(length(Vel) > 0.00001f)
Graphics()->QuadsSetRotation(angle(Vel)); 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) if(c[pCurrent->m_Type] == SPRITE_PICKUP_NINJA)
{ {
QuadOffset = 2 + 8 - 1; // ninja is the last weapon 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; 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); TimePassed = minimum(TimePassed, (TimePassed - MinTrailSpan) / (Pt - MinTrailSpan) * (MinTrailSpan * 0.5f) + MinTrailSpan);
// add particle for this projectile // add particle for this projectile
if(pCurrent->m_Type == WEAPON_GRENADE) 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 else
m_pClient->m_pEffects->BulletTrail(Pos, Alpha, TimePassed); m_pClient->m_Effects.BulletTrail(Pos, Alpha, TimePassed);
} }
} }

View file

@ -4,6 +4,8 @@
#define GAME_CLIENT_COMPONENTS_KILLMESSAGES_H #define GAME_CLIENT_COMPONENTS_KILLMESSAGES_H
#include <game/client/component.h> #include <game/client/component.h>
#include <game/client/render.h>
class CKillMessages : public CComponent class CKillMessages : public CComponent
{ {
int m_SpriteQuadContainerIndex; int m_SpriteQuadContainerIndex;

View file

@ -8,8 +8,12 @@
#include <game/client/component.h> #include <game/client/component.h>
#include <game/mapitems.h> #include <game/mapitems.h>
#include <game/layers.h>
#include "mapimages.h" #include "mapimages.h"
#include <game/client/gameclient.h>
CMapImages::CMapImages() : CMapImages::CMapImages() :
CMapImages(100) CMapImages(100)
{ {

View file

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

View file

@ -4,6 +4,8 @@
#define GAME_CLIENT_COMPONENTS_MAPLAYERS_H #define GAME_CLIENT_COMPONENTS_MAPLAYERS_H
#include <game/client/component.h> #include <game/client/component.h>
#include <base/color.h>
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>
@ -15,6 +17,10 @@ typedef char *offset_ptr_size;
typedef uintptr_t offset_ptr; typedef uintptr_t offset_ptr;
typedef unsigned int offset_ptr32; typedef unsigned int offset_ptr32;
struct CMapItemGroup;
struct CMapItemLayerTilemap;
struct CMapItemLayerQuads;
class CMapLayers : public CComponent class CMapLayers : public CComponent
{ {
friend class CBackground; friend class CBackground;

View file

@ -6,6 +6,10 @@
#include <game/client/components/maplayers.h> // envelope #include <game/client/components/maplayers.h> // envelope
#include <game/client/components/sounds.h> #include <game/client/components/sounds.h>
#include <game/client/gameclient.h>
#include <game/layers.h>
#include "mapsounds.h" #include "mapsounds.h"
CMapSounds::CMapSounds() CMapSounds::CMapSounds()
@ -128,7 +132,7 @@ void CMapSounds::OnRender()
if(!pSource->m_pSource->m_Pan) if(!pSource->m_pSource->m_Pan)
Flags |= ISound::FLAG_NO_PANNING; 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()->SetVoiceTimeOffset(pSource->m_Voice, Offset);
Sound()->SetVoiceFalloff(pSource->m_Voice, pSource->m_pSource->m_Falloff / 255.0f); Sound()->SetVoiceFalloff(pSource->m_Voice, pSource->m_pSource->m_Falloff / 255.0f);
switch(pSource->m_pSource->m_Shape.m_Type) switch(pSource->m_pSource->m_Shape.m_Type)
@ -155,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++) for(int g = 0; g < Layers()->NumGroups(); g++)
{ {
CMapItemGroup *pGroup = Layers()->GetGroup(g); CMapItemGroup *pGroup = Layers()->GetGroup(g);
@ -199,7 +203,7 @@ void CMapSounds::OnRender()
if(pVoice->m_pSource->m_PosEnv >= 0) if(pVoice->m_pSource->m_PosEnv >= 0)
{ {
float aChannels[4]; 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]; OffsetX = aChannels[0];
OffsetY = aChannels[1]; OffsetY = aChannels[1];
} }
@ -218,7 +222,7 @@ void CMapSounds::OnRender()
if(pVoice->m_pSource->m_SoundEnv >= 0) if(pVoice->m_pSource->m_SoundEnv >= 0)
{ {
float aChannels[4]; 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); float Volume = clamp(aChannels[0], 0.0f, 1.0f);
Sound()->SetVoiceVolume(pVoice->m_Voice, Volume); Sound()->SetVoiceVolume(pVoice->m_Voice, Volume);

View file

@ -7,6 +7,8 @@
#include <game/client/component.h> #include <game/client/component.h>
struct CSoundSource;
class CMapSounds : public CComponent class CMapSounds : public CComponent
{ {
int m_aSounds[64]; int m_aSounds[64];

View file

@ -10,6 +10,10 @@
#include <game/client/components/mapimages.h> #include <game/client/components/mapimages.h>
#include <game/client/components/maplayers.h> #include <game/client/components/maplayers.h>
#include <game/layers.h>
#include <game/client/render.h>
#include "menu_background.h" #include "menu_background.h"
CMenuBackground::CMenuBackground() : CMenuBackground::CMenuBackground() :

View file

@ -1463,7 +1463,7 @@ int CMenus::Render()
} }
else if(s_Frame == 1) 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++; s_Frame++;
m_DoubleClickIndex = -1; m_DoubleClickIndex = -1;
@ -2001,11 +2001,11 @@ int CMenus::Render()
ActSelection = g_Config.m_BrFilterCountryIndex; ActSelection = g_Config.m_BrFilterCountryIndex;
static float s_ScrollValue = 0.0f; static float s_ScrollValue = 0.0f;
int OldSelected = -1; 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) if(pEntry->m_CountryCode == ActSelection)
OldSelected = i; OldSelected = i;
@ -2019,14 +2019,14 @@ int CMenus::Render()
Item.m_Rect.w = Item.m_Rect.h * 2; Item.m_Rect.w = Item.m_Rect.h * 2;
Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f; Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.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); UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
} }
} }
const int NewSelected = UiDoListboxEnd(&s_ScrollValue, 0); const int NewSelected = UiDoListboxEnd(&s_ScrollValue, 0);
if(OldSelected != NewSelected) 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); Part.VMargin(120.0f, &Part);
@ -2612,7 +2612,7 @@ void CMenus::OnStateChange(int NewState, int OldState)
if(NewState == IClient::STATE_OFFLINE) if(NewState == IClient::STATE_OFFLINE)
{ {
if(OldState >= IClient::STATE_ONLINE && NewState < IClient::STATE_QUITTING) 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; m_Popup = POPUP_NONE;
if(Client()->ErrorString() && Client()->ErrorString()[0] != 0) if(Client()->ErrorString() && Client()->ErrorString()[0] != 0)
{ {
@ -2803,7 +2803,7 @@ bool CMenus::CheckHotKey(int Key) const
{ {
return m_Popup == POPUP_NONE && 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_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) int CMenus::DoButton_CheckBox_DontCare(const void *pID, const char *pText, int Checked, const CUIRect *pRect)

View file

@ -18,6 +18,8 @@
#include <game/client/ui_ex.h> #include <game/client/ui_ex.h>
#include <game/voting.h> #include <game/voting.h>
#include <game/client/render.h>
struct CServerProcess struct CServerProcess
{ {
PROCESS Process; PROCESS Process;

View file

@ -19,6 +19,8 @@
#include <game/localization.h> #include <game/localization.h>
#include <game/version.h> #include <game/version.h>
#include <game/client/gameclient.h>
#include "menus.h" #include "menus.h"
static const int g_OffsetColFlagLock = 2; static const int g_OffsetColFlagLock = 2;
@ -191,7 +193,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
s_ScrollValue = DoScrollbarV(&s_ScrollBar, &Scroll, s_ScrollValue); 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)) if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
g_Config.m_UiToolboxPage = (g_Config.m_UiToolboxPage + 3 - 1) % 3; g_Config.m_UiToolboxPage = (g_Config.m_UiToolboxPage + 3 - 1) % 3;
@ -758,7 +760,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
Rect.w = Rect.h * 2; Rect.w = Rect.h * 2;
Rect.x += (OldWidth - Rect.w) / 2.0f; Rect.x += (OldWidth - Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, g_Config.m_BrFilterCountry ? 1.0f : 0.5f); 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)) if(g_Config.m_BrFilterCountry && UI()->DoButtonLogic(&g_Config.m_BrFilterCountryIndex, "", 0, &Rect))
m_Popup = POPUP_COUNTRY; m_Popup = POPUP_COUNTRY;
@ -973,7 +975,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
} }
ColorRGBA Color(1.0f, 1.0f, 1.0f, Active ? 1.0f : 0.2f); 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);
} }
} }
} }
@ -1209,7 +1211,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
// flag // flag
ColorRGBA FColor(1.0f, 1.0f, 1.0f, 0.5f); 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); UiDoListboxEnd(&s_ScrollValue, 0);

View file

@ -166,7 +166,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
} }
// handle keyboard shortcuts independent of active menu // 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 // increase/decrease speed
if(!Input()->KeyIsPressed(KEY_LSHIFT) && !Input()->KeyIsPressed(KEY_RSHIFT)) if(!Input()->KeyIsPressed(KEY_LSHIFT) && !Input()->KeyIsPressed(KEY_RSHIFT))
@ -351,8 +351,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
m_pClient->m_SuppressEvents = true; m_pClient->m_SuppressEvents = true;
DemoPlayer()->SeekPercent(Amount); DemoPlayer()->SeekPercent(Amount);
m_pClient->m_SuppressEvents = false; m_pClient->m_SuppressEvents = false;
m_pClient->m_pMapLayersBackGround->EnvelopeUpdate(); m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate(); m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
} }
} }
else else
@ -363,8 +363,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
m_pClient->m_SuppressEvents = true; m_pClient->m_SuppressEvents = true;
DemoPlayer()->SeekPercent(Amount); DemoPlayer()->SeekPercent(Amount);
m_pClient->m_SuppressEvents = false; m_pClient->m_SuppressEvents = false;
m_pClient->m_pMapLayersBackGround->EnvelopeUpdate(); m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate(); m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
} }
} }
} }
@ -464,7 +464,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
// close button // close button
ButtonBar.VSplitRight(ButtonbarHeight * 3, &ButtonBar, &Button); ButtonBar.VSplitRight(ButtonbarHeight * 3, &ButtonBar, &Button);
static int s_ExitButton = 0; 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(); Client()->Disconnect();
DemolistOnUpdate(false); DemolistOnUpdate(false);
@ -1220,7 +1220,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
} }
static int s_PlayButton = 0; 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) if(m_DemolistSelectedIndex >= 0)
{ {
@ -1271,7 +1271,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
if(!m_DemolistSelectedIsDir) if(!m_DemolistSelectedIsDir)
{ {
static int s_DeleteButton = 0; 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) if(m_DemolistSelectedIndex >= 0)
{ {
@ -1295,7 +1295,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
#if defined(CONF_VIDEORECORDER) #if defined(CONF_VIDEORECORDER)
static int s_RenderButton = 0; 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) 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); //TextRender()->SetCursor(&Cursor, Button2.x,Button2.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
//Cursor.m_LineWidth = Button.w; //Cursor.m_LineWidth = Button.w;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f); 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); 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 // ignore chat button
@ -516,7 +516,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f; x = 5.0f;
TextRender()->Text(0, Motd.x + x, Motd.y + y, 32, Localize("MOTD"), -1.0f); TextRender()->Text(0, Motd.x + x, Motd.y + y, 32, Localize("MOTD"), -1.0f);
y += 32.0f + 5.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) bool CMenus::RenderServerControlServer(CUIRect MainView)
@ -524,13 +524,13 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
static int s_VoteList = 0; static int s_VoteList = 0;
static float s_ScrollValue = 0; static float s_ScrollValue = 0;
CUIRect List = MainView; CUIRect List = MainView;
int Total = m_pClient->m_pVoting->m_NumVoteOptions; int Total = m_pClient->m_Voting.m_NumVoteOptions;
int NumVoteOptions = 0; int NumVoteOptions = 0;
int aIndices[MAX_VOTE_OPTIONS]; int aIndices[MAX_VOTE_OPTIONS];
static int s_CurVoteOption = 0; static int s_CurVoteOption = 0;
int TotalShown = 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)) if(m_aFilterString[0] != '\0' && !str_utf8_find_nocase(pOption->m_aDescription, m_aFilterString))
continue; continue;
@ -540,7 +540,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
UiDoListboxStart(&s_VoteList, &List, 19.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue); UiDoListboxStart(&s_VoteList, &List, 19.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue);
int i = -1; 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++; i++;
if(m_aFilterString[0] != '\0' && !str_utf8_find_nocase(pOption->m_aDescription, m_aFilterString)) 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) 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) if(g_Config.m_UiCloseWindowAfterChangingSetting)
SetActive(false); SetActive(false);
} }
@ -708,7 +708,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) 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); SetActive(false);
} }
} }
@ -717,7 +717,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) 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); SetActive(false);
} }
} }
@ -754,13 +754,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button)) if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button))
{ {
if(s_ControlPage == 0) 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) else if(s_ControlPage == 1)
{ {
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) 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); SetActive(false);
} }
} }
@ -769,7 +769,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) 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); SetActive(false);
} }
} }
@ -783,7 +783,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
Bottom.VSplitRight(120.0f, 0, &Button); Bottom.VSplitRight(120.0f, 0, &Button);
static int s_RemoveVoteButton = 0; static int s_RemoveVoteButton = 0;
if(DoButton_Menu(&s_RemoveVoteButton, Localize("Remove"), 0, &Button)) 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 // add vote
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension); RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
@ -802,7 +802,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
static int s_AddVoteButton = 0; static int s_AddVoteButton = 0;
if(DoButton_Menu(&s_AddVoteButton, Localize("Add"), 0, &Button)) if(DoButton_Menu(&s_AddVoteButton, Localize("Add"), 0, &Button))
if(s_aVoteDescription[0] != 0 && s_aVoteCommand[0] != 0) 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(5.0f, 0, &Bottom);
Bottom.VSplitLeft(250.0f, &Button, &Bottom); Bottom.VSplitLeft(250.0f, &Button, &Bottom);
@ -900,10 +900,10 @@ int CMenus::GhostlistFetchCallback(const char *pName, int IsDir, int StorageType
return 0; return 0;
char aFilename[256]; 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; 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; return 0;
CGhostItem Item; CGhostItem Item;
@ -919,7 +919,7 @@ void CMenus::GhostlistPopulate()
{ {
CGhostItem *pOwnGhost = 0; CGhostItem *pOwnGhost = 0;
m_lGhosts.clear(); 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++) for(int i = 0; i < m_lGhosts.size(); i++)
{ {
@ -930,7 +930,7 @@ void CMenus::GhostlistPopulate()
if(pOwnGhost) if(pOwnGhost)
{ {
pOwnGhost->m_Own = true; 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; static int s_ReloadButton = 0;
if(DoButton_Menu(&s_ReloadButton, Localize("Reload"), 0, &Button) || Input()->KeyPress(KEY_F5)) if(DoButton_Menu(&s_ReloadButton, Localize("Reload"), 0, &Button) || Input()->KeyPress(KEY_F5))
{ {
m_pClient->m_pGhost->UnloadAll(); m_pClient->m_Ghost.UnloadAll();
GhostlistPopulate(); GhostlistPopulate();
} }
@ -1162,7 +1162,7 @@ void CMenus::RenderGhost(CUIRect MainView)
CGhostItem *pOwnGhost = GetOwnGhost(); CGhostItem *pOwnGhost = GetOwnGhost();
int ReservedSlots = !pGhost->m_Own && !(pOwnGhost && pOwnGhost->Active()); 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); Status.VSplitRight(120.0f, &Status, &Button);
@ -1172,11 +1172,11 @@ void CMenus::RenderGhost(CUIRect MainView)
{ {
if(pGhost->Active()) if(pGhost->Active())
{ {
m_pClient->m_pGhost->Unload(pGhost->m_Slot); m_pClient->m_Ghost.Unload(pGhost->m_Slot);
pGhost->m_Slot = -1; pGhost->m_Slot = -1;
} }
else 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); 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(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &Button))
{ {
if(pGhost->Active()) if(pGhost->Active())
m_pClient->m_pGhost->Unload(pGhost->m_Slot); m_pClient->m_Ghost.Unload(pGhost->m_Slot);
DeleteGhostItem(s_SelectedIndex); DeleteGhostItem(s_SelectedIndex);
} }
Status.VSplitRight(5.0f, &Status, 0); 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()) if(!pGhost->HasFile() && !Recording && pGhost->Active())
{ {
static int s_SaveButton = 0; static int s_SaveButton = 0;
Status.VSplitRight(120.0f, &Status, &Button); Status.VSplitRight(120.0f, &Status, &Button);
if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &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); MainView.HSplitTop(20.0f, 0, &MainView);
static float s_ScrollValue = 0.0f; static float s_ScrollValue = 0.0f;
int OldSelected = -1; 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) if(pEntry->m_CountryCode == *pCountry)
OldSelected = i; OldSelected = i;
@ -425,7 +425,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Item.m_Rect.w = Item.m_Rect.h * 2; Item.m_Rect.w = Item.m_Rect.h * 2;
Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f; Item.m_Rect.x += (OldWidth - Item.m_Rect.w) / 2.0f;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.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) if(pEntry->m_Texture != -1)
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0); UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
} }
@ -438,7 +438,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(OldSelected != NewSelected) if(OldSelected != NewSelected)
{ {
*pCountry = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode; *pCountry = m_pClient->m_CountryFlags.GetByIndex(NewSelected)->m_CountryCode;
SetNeedSendInfo(); SetNeedSendInfo();
} }
} }
@ -482,7 +482,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
// skin info // skin info
CTeeRenderInfo OwnSkinInfo; 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_OriginalRenderSkin = pSkin->m_OriginalSkin;
OwnSkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin; OwnSkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
OwnSkinInfo.m_SkinMetrics = pSkin->m_Metrics; OwnSkinInfo.m_SkinMetrics = pSkin->m_Metrics;
@ -626,12 +626,12 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static sorted_array<CUISkin> s_paSkinList; static sorted_array<CUISkin> s_paSkinList;
static int s_SkinCount = 0; static int s_SkinCount = 0;
static float s_ScrollValue = 0.0f; 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(); 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 // filter quick search
if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_utf8_find_nocase(s->m_aName, g_Config.m_ClSkinFilterString)) 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_paSkinList.add(CUISkin(s));
} }
s_InitSkinlist = false; s_InitSkinlist = false;
s_SkinCount = m_pClient->m_pSkins->Num(); s_SkinCount = m_pClient->m_Skins.Num();
} }
int OldSelected = -1; int OldSelected = -1;
@ -758,7 +758,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static int s_SkinRefreshButtonID = 0; 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)) 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; s_InitSkinlist = true;
if(Client()->State() >= IClient::STATE_ONLINE) 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(NewId != OldId || NewModifier != OldModifier)
{ {
if(OldId != 0 || NewId == 0) if(OldId != 0 || NewId == 0)
m_pClient->m_pBinds->Bind(OldId, "", false, OldModifier); m_pClient->m_Binds.Bind(OldId, "", false, OldModifier);
if(NewId != 0) 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++) 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]) if(!pBind[0])
continue; continue;
@ -976,7 +976,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
ResetButton.HSplitTop(20.0f, &ResetButton, 0); ResetButton.HSplitTop(20.0f, &ResetButton, 0);
static int s_DefaultButton = 0; static int s_DefaultButton = 0;
if(DoButton_Menu((void *)&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton)) if(DoButton_Menu((void *)&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
m_pClient->m_pBinds->SetDefaults(); m_pClient->m_Binds.SetDefaults();
} }
// voting settings // voting settings
@ -1290,10 +1290,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
if(g_Config.m_SndEnable) if(g_Config.m_SndEnable)
{ {
if(g_Config.m_SndMusic && Client()->State() == IClient::STATE_OFFLINE) 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 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); 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(Client()->State() == IClient::STATE_OFFLINE)
{ {
if(g_Config.m_SndMusic) 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 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.VMargin(6.0f, &Rect);
Rect.HMargin(3.0f, &Rect); Rect.HMargin(3.0f, &Rect);
ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); 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); Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect);
UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1); UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
} }
@ -2102,7 +2102,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// ***** Chat ***** // // ***** Chat ***** //
if(DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatOld, Localize("Use old chat style"), &g_Config.m_ClChatOld, &Chat, LineMargin)) 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); Chat.HSplitTop(30.0f, 0x0, &Chat);
@ -2222,7 +2222,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
// Load skins // Load skins
int DefaultInd = GameClient()->m_pSkins->Find("default"); int DefaultInd = GameClient()->m_Skins.Find("default");
for(auto &i : RenderInfo) for(auto &i : RenderInfo)
{ {
@ -2233,10 +2233,10 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
int ind = -1; int ind = -1;
int i = 0; int i = 0;
RenderInfo[i++].m_OriginalRenderSkin = GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin; RenderInfo[i++].m_OriginalRenderSkin = GameClient()->m_Skins.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_Skins.Find("pinky")) != -1 ? GameClient()->m_Skins.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_Skins.Find("cammostripes")) != -1 ? GameClient()->m_Skins.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 = (ind = GameClient()->m_Skins.Find("beast")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
} }
// System // System

View file

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

@ -13,6 +13,10 @@
#include <game/editor/editor.h> #include <game/editor/editor.h>
#include <game/version.h> #include <game/version.h>
#include <game/generated/client_data.h>
#include <game/client/gameclient.h>
#include "menus.h" #include "menus.h"
void CMenus::RenderStartMenu(CUIRect MainView) void CMenus::RenderStartMenu(CUIRect MainView)

View file

@ -55,7 +55,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
{ {
float a = 1; float a = 1;
if(g_Config.m_ClNameplatesAlways == 0) 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; 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) 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 // create nameplates at standard zoom
float ScreenX0, ScreenY0, ScreenX1, ScreenY1; float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
Graphics()->GetScreen(&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); 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 // create nameplates at standard zoom
float ScreenX0, ScreenY0, ScreenX1, ScreenY1; float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
Graphics()->GetScreen(&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); m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1, -1.0f);

View file

@ -3,6 +3,11 @@
#ifndef GAME_CLIENT_COMPONENTS_NAMEPLATES_H #ifndef GAME_CLIENT_COMPONENTS_NAMEPLATES_H
#define GAME_CLIENT_COMPONENTS_NAMEPLATES_H #define GAME_CLIENT_COMPONENTS_NAMEPLATES_H
#include <game/client/component.h> #include <game/client/component.h>
struct CNetObj_Character;
struct CNetObj_PlayerInfo;
struct CMapItemGroup;
struct SPlayerNamePlate struct SPlayerNamePlate
{ {
SPlayerNamePlate() SPlayerNamePlate()

View file

@ -9,6 +9,8 @@
#include <game/gamecore.h> #include <game/gamecore.h>
#include <game/generated/client_data.h> #include <game/generated/client_data.h>
#include <game/client/gameclient.h>
CParticles::CParticles() CParticles::CParticles()
{ {
OnReset(); OnReset();

View file

@ -206,7 +206,7 @@ void CPlayers::RenderPlayer(
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK) if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{ {
// just use the direct input if it's the local player we are rendering // 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 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); 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; RenderInfo.m_GotAirJump = Player.m_Jumped & 2 ? 0 : 1;
@ -266,11 +266,11 @@ void CPlayers::RenderPlayer(
if(time() - SkidSoundTime > time_freq() / 10) if(time() - SkidSoundTime > time_freq() / 10)
{ {
if(g_Config.m_SndGame) 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(); SkidSoundTime = time();
} }
m_pClient->m_pEffects->SkidTrail( m_pClient->m_Effects.SkidTrail(
Position + vec2(-Player.m_Direction * 6, 12), Position + vec2(-Player.m_Direction * 6, 12),
vec2(-Player.m_Direction * 100 * length(Vel), -50)); vec2(-Player.m_Direction * 100 * length(Vel), -50));
} }
@ -288,7 +288,7 @@ void CPlayers::RenderPlayer(
vec2 ExDirection = Direction; vec2 ExDirection = Direction;
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK) 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(); Graphics()->TextureClear();
vec2 InitPos = Position; vec2 InitPos = Position;
@ -399,12 +399,12 @@ void CPlayers::RenderPlayer(
{ {
Graphics()->QuadsSetRotation(-pi / 2 - State.GetAttach()->m_Angle * pi * 2); Graphics()->QuadsSetRotation(-pi / 2 - State.GetAttach()->m_Angle * pi * 2);
p.x -= g_pData->m_Weapons.m_aId[iw].m_Offsetx; 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 else
{ {
Graphics()->QuadsSetRotation(-pi / 2 + State.GetAttach()->m_Angle * pi * 2); 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); 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) 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 // 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) 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_OriginalRenderSkin = pSkin->m_OriginalSkin;
m_aRenderInfo[i].m_ColorableRenderSkin = pSkin->m_ColorableSkin; m_aRenderInfo[i].m_ColorableRenderSkin = pSkin->m_ColorableSkin;
m_aRenderInfo[i].m_BloodColor = pSkin->m_BloodColor; m_aRenderInfo[i].m_BloodColor = pSkin->m_BloodColor;
@ -664,8 +664,8 @@ void CPlayers::OnRender()
} }
} }
} }
int Skin = m_pClient->m_pSkins->Find("x_spec"); int Skin = m_pClient->m_Skins.Find("x_spec");
const CSkin *pSkin = m_pClient->m_pSkins->Get(Skin); const CSkin *pSkin = m_pClient->m_Skins.Get(Skin);
m_RenderInfoSpec.m_OriginalRenderSkin = pSkin->m_OriginalSkin; m_RenderInfoSpec.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
m_RenderInfoSpec.m_ColorableRenderSkin = pSkin->m_ColorableSkin; m_RenderInfoSpec.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
m_RenderInfoSpec.m_BloodColor = pSkin->m_BloodColor; m_RenderInfoSpec.m_BloodColor = pSkin->m_BloodColor;

View file

@ -4,6 +4,9 @@
#define GAME_CLIENT_COMPONENTS_PLAYERS_H #define GAME_CLIENT_COMPONENTS_PLAYERS_H
#include <game/client/component.h> #include <game/client/component.h>
#include <game/client/render.h>
#include <game/generated/protocol.h>
class CPlayers : public CComponent class CPlayers : public CComponent
{ {
friend class CGhost; friend class CGhost;

View file

@ -11,6 +11,8 @@
#include "race_demo.h" #include "race_demo.h"
#include <game/client/gameclient.h>
const char *CRaceDemo::ms_pRaceDemoDir = "demos/auto/race"; const char *CRaceDemo::ms_pRaceDemoDir = "demos/auto/race";
struct CDemoItem struct CDemoItem

View file

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

View file

@ -11,6 +11,10 @@
#include <engine/shared/config.h> #include <engine/shared/config.h>
#include <engine/storage.h> #include <engine/storage.h>
#include <game/generated/client_data.h>
#include <game/client/gameclient.h>
#include "skins.h" #include "skins.h"
static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear", static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear",

View file

@ -29,7 +29,7 @@ void CSoundLoading::Run()
} }
if(m_Render) if(m_Render)
m_pGameClient->m_pMenus->RenderLoading(); m_pGameClient->m_Menus.RenderLoading();
} }
} }
@ -114,7 +114,7 @@ void CSounds::OnRender()
} }
// set listener pos // 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 // update volume
float NewGuiSoundVol = g_Config.m_SndChatSoundVolume / 100.0f; float NewGuiSoundVol = g_Config.m_SndChatSoundVolume / 100.0f;

View file

@ -17,6 +17,8 @@
#include "camera.h" #include "camera.h"
#include "spectator.h" #include "spectator.h"
#include <game/client/gameclient.h>
bool CSpectator::CanChangeSpectator() bool CSpectator::CanChangeSpectator()
{ {
// Don't change SpectatorID when not spectating // Don't change SpectatorID when not spectating
@ -123,7 +125,7 @@ void CSpectator::ConSpectateClosest(IConsole::IResult *pResult, void *pUserData)
int NewSpectatorID = -1; 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) if(SpectatorID != SPEC_FREEVIEW)
{ {
const CNetObj_Character &CurCharacter = Snap.m_aCharacters[SpectatorID].m_Cur; const CNetObj_Character &CurCharacter = Snap.m_aCharacters[SpectatorID].m_Cur;

View file

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

View file

@ -8,6 +8,8 @@
#include <game/client/render.h> #include <game/client/render.h>
#include <game/generated/protocol.h> #include <game/generated/protocol.h>
#include <game/client/gameclient.h>
void CVoting::ConCallvote(IConsole::IResult *pResult, void *pUserData) void CVoting::ConCallvote(IConsole::IResult *pResult, void *pUserData)
{ {
CVoting *pSelf = (CVoting *)pUserData; CVoting *pSelf = (CVoting *)pUserData;
@ -201,7 +203,7 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
char aBuf[512]; char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s (%s)", m_aDescription, m_aReason); str_format(aBuf, sizeof(aBuf), "%s (%s)", m_aDescription, m_aReason);
Client()->Notify("DDNet Vote", aBuf); 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

@ -67,48 +67,6 @@
#include "components/race_demo.h" #include "components/race_demo.h"
#include <base/system.h> #include <base/system.h>
CGameClient g_GameClient;
// instantiate all systems
static CKillMessages gs_KillMessages;
static CCamera gs_Camera;
static CChat gs_Chat;
static CMotd gs_Motd;
static CBroadcast gs_Broadcast;
static CGameConsole gs_GameConsole;
static CBinds gs_Binds;
static CParticles gs_Particles;
static CMenus gs_Menus;
static CSkins gs_Skins;
static CCountryFlags gs_CountryFlags;
static CFlow gs_Flow;
static CHud gs_Hud;
static CDebugHud gs_DebugHud;
static CControls gs_Controls;
static CEffects gs_Effects;
static CScoreboard gs_Scoreboard;
static CStatboard gs_Statboard;
static CSounds gs_Sounds;
static CEmoticon gs_Emoticon;
static CDamageInd gsDamageInd;
static CVoting gs_Voting;
static CSpectator gs_Spectator;
static CPlayers gs_Players;
static CNamePlates gs_NamePlates;
static CItems gs_Items;
static CMapImages gs_MapImages;
static CMapLayers gs_MapLayersBackGround(CMapLayers::TYPE_BACKGROUND);
static CMapLayers gs_MapLayersForeGround(CMapLayers::TYPE_FOREGROUND);
static CBackground gs_BackGround;
static CMenuBackground gs_MenuBackground;
static CMapSounds gs_MapSounds;
static CRaceDemo gs_RaceDemo;
static CGhost gs_Ghost;
CGameClient::CStack::CStack() { m_Num = 0; } CGameClient::CStack::CStack() { m_Num = 0; }
void CGameClient::CStack::Add(class CComponent *pComponent) { m_paComponents[m_Num++] = pComponent; } void CGameClient::CStack::Add(class CComponent *pComponent) { m_paComponents[m_Num++] = pComponent; }
@ -136,94 +94,63 @@ void CGameClient::OnConsoleInit()
m_pUpdater = Kernel()->RequestInterface<IUpdater>(); m_pUpdater = Kernel()->RequestInterface<IUpdater>();
#endif #endif
// setup pointers m_Menus.SetMenuBackground(&m_MenuBackground);
m_pMenuBackground = &::gs_MenuBackground;
m_pBinds = &::gs_Binds;
m_pGameConsole = &::gs_GameConsole;
m_pParticles = &::gs_Particles;
m_pMenus = &::gs_Menus;
m_pSkins = &::gs_Skins;
m_pCountryFlags = &::gs_CountryFlags;
m_pChat = &::gs_Chat;
m_pFlow = &::gs_Flow;
m_pCamera = &::gs_Camera;
m_pControls = &::gs_Controls;
m_pEffects = &::gs_Effects;
m_pSounds = &::gs_Sounds;
m_pMotd = &::gs_Motd;
m_pDamageind = &::gsDamageInd;
m_pMapimages = &::gs_MapImages;
m_pVoting = &::gs_Voting;
m_pScoreboard = &::gs_Scoreboard;
m_pStatboard = &::gs_Statboard;
m_pItems = &::gs_Items;
m_pMapLayersBackGround = &::gs_MapLayersBackGround;
m_pMapLayersForeGround = &::gs_MapLayersForeGround;
m_pBackGround = &::gs_BackGround;
m_pMapSounds = &::gs_MapSounds; m_NamePlates.SetPlayers(&m_Players);
m_pPlayers = &::gs_Players;
m_pRaceDemo = &::gs_RaceDemo;
m_pGhost = &::gs_Ghost;
m_pMenus->SetMenuBackground(m_pMenuBackground);
gs_NamePlates.SetPlayers(m_pPlayers);
// make a list of all the systems, make sure to add them in the correct render order // 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_Skins);
m_All.Add(m_pCountryFlags); m_All.Add(&m_CountryFlags);
m_All.Add(m_pMapimages); m_All.Add(&m_MapImages);
m_All.Add(m_pEffects); // doesn't render anything, just updates effects m_All.Add(&m_Effects); // doesn't render anything, just updates effects
m_All.Add(m_pBinds); m_All.Add(&m_Binds);
m_All.Add(&m_pBinds->m_SpecialBinds); m_All.Add(&m_Binds.m_SpecialBinds);
m_All.Add(m_pControls); m_All.Add(&m_Controls);
m_All.Add(m_pCamera); m_All.Add(&m_Camera);
m_All.Add(m_pSounds); m_All.Add(&m_Sounds);
m_All.Add(m_pVoting); m_All.Add(&m_Voting);
m_All.Add(m_pParticles); // doesn't render anything, just updates all the particles m_All.Add(&m_Particles); // doesn't render anything, just updates all the particles
m_All.Add(m_pRaceDemo); m_All.Add(&m_RaceDemo);
m_All.Add(m_pMapSounds); m_All.Add(&m_MapSounds);
m_All.Add(&gs_BackGround); //render instead of gs_MapLayersBackGround when g_Config.m_ClOverlayEntities == 100 m_All.Add(&m_BackGround); //render instead of m_MapLayersBackGround when g_Config.m_ClOverlayEntities == 100
m_All.Add(&gs_MapLayersBackGround); // first to render m_All.Add(&m_MapLayersBackGround); // first to render
m_All.Add(&m_pParticles->m_RenderTrail); m_All.Add(&m_Particles.m_RenderTrail);
m_All.Add(m_pItems); m_All.Add(&m_Items);
m_All.Add(m_pPlayers); m_All.Add(&m_Players);
m_All.Add(m_pGhost); m_All.Add(&m_Ghost);
m_All.Add(&gs_MapLayersForeGround); m_All.Add(&m_MapLayersForeGround);
m_All.Add(&m_pParticles->m_RenderExplosions); m_All.Add(&m_Particles.m_RenderExplosions);
m_All.Add(&gs_NamePlates); m_All.Add(&m_NamePlates);
m_All.Add(&m_pParticles->m_RenderGeneral); m_All.Add(&m_Particles.m_RenderGeneral);
m_All.Add(m_pDamageind); m_All.Add(&m_DamageInd);
m_All.Add(&gs_Hud); m_All.Add(&m_Hud);
m_All.Add(&gs_Spectator); m_All.Add(&m_Spectator);
m_All.Add(&gs_Emoticon); m_All.Add(&m_Emoticon);
m_All.Add(&gs_KillMessages); m_All.Add(&m_KillMessages);
m_All.Add(m_pChat); m_All.Add(&m_Chat);
m_All.Add(&gs_Broadcast); m_All.Add(&m_Broadcast);
m_All.Add(&gs_DebugHud); m_All.Add(&m_DebugHud);
m_All.Add(&gs_Scoreboard); m_All.Add(&m_Scoreboard);
m_All.Add(&gs_Statboard); m_All.Add(&m_Statboard);
m_All.Add(m_pMotd); m_All.Add(&m_Motd);
m_All.Add(m_pMenus); m_All.Add(&m_Menus);
m_All.Add(&m_pMenus->m_Binder); m_All.Add(&m_Menus.m_Binder);
m_All.Add(m_pGameConsole); m_All.Add(&m_GameConsole);
m_All.Add(m_pMenuBackground); m_All.Add(&m_MenuBackground);
// build the input stack // 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_Menus.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_Binds.m_SpecialBinds);
m_Input.Add(m_pGameConsole); m_Input.Add(&m_GameConsole);
m_Input.Add(m_pChat); // chat has higher prio due to tha you can quit it by pressing esc m_Input.Add(&m_Chat); // 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_Motd); // for pressing esc to remove it
m_Input.Add(m_pMenus); m_Input.Add(&m_Menus);
m_Input.Add(&gs_Spectator); m_Input.Add(&m_Spectator);
m_Input.Add(&gs_Emoticon); m_Input.Add(&m_Emoticon);
m_Input.Add(m_pControls); m_Input.Add(&m_Controls);
m_Input.Add(m_pBinds); m_Input.Add(&m_Binds);
// add the some console commands // add the some console commands
Console()->Register("team", "i[team-id]", CFGFLAG_CLIENT, ConTeam, this, "Switch team"); Console()->Register("team", "i[team-id]", CFGFLAG_CLIENT, ConTeam, this, "Switch team");
@ -337,7 +264,7 @@ void CGameClient::OnInit()
LoadParticlesSkin(g_Config.m_ClAssetParticles); LoadParticlesSkin(g_Config.m_ClAssetParticles);
else 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_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++) for(int i = 0; i < m_All.m_Num; i++)
@ -355,7 +282,7 @@ void CGameClient::OnInit()
m_LastDummyConnected = false; m_LastDummyConnected = false;
// Set free binds to DDRace binds if it's active // Set free binds to DDRace binds if it's active
gs_Binds.SetDDRaceBinds(true); m_Binds.SetDDRaceBinds(true);
if(g_Config.m_ClTimeoutCode[0] == '\0' || str_comp(g_Config.m_ClTimeoutCode, "hGuEYnfxicsXGwFq") == 0) if(g_Config.m_ClTimeoutCode[0] == '\0' || str_comp(g_Config.m_ClTimeoutCode, "hGuEYnfxicsXGwFq") == 0)
{ {
@ -387,7 +314,7 @@ void CGameClient::OnInit()
m_GameWorld.m_pCollision = Collision(); m_GameWorld.m_pCollision = Collision();
m_GameWorld.m_pTuningList = m_aTuningList; 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 // Agressively try to grab window again since some Windows users report
// window not being focussed after starting client. // window not being focussed after starting client.
@ -428,12 +355,12 @@ void CGameClient::OnDummySwap()
if(g_Config.m_ClDummyResetOnSwitch) if(g_Config.m_ClDummyResetOnSwitch)
{ {
int PlayerOrDummy = (g_Config.m_ClDummyResetOnSwitch == 2) ? g_Config.m_ClDummy : (!g_Config.m_ClDummy); int PlayerOrDummy = (g_Config.m_ClDummyResetOnSwitch == 2) ? g_Config.m_ClDummy : (!g_Config.m_ClDummy);
m_pControls->ResetInput(PlayerOrDummy); m_Controls.ResetInput(PlayerOrDummy);
m_pControls->m_InputData[PlayerOrDummy].m_Hook = 0; m_Controls.m_InputData[PlayerOrDummy].m_Hook = 0;
} }
int tmp = m_DummyInput.m_Fire; int tmp = m_DummyInput.m_Fire;
m_DummyInput = m_pControls->m_InputData[!g_Config.m_ClDummy]; m_DummyInput = m_Controls.m_InputData[!g_Config.m_ClDummy];
m_pControls->m_InputData[g_Config.m_ClDummy].m_Fire = tmp; m_Controls.m_InputData[g_Config.m_ClDummy].m_Fire = tmp;
m_IsDummySwapping = 1; m_IsDummySwapping = 1;
} }
@ -441,7 +368,7 @@ int CGameClient::OnSnapInput(int *pData, bool Dummy, bool Force)
{ {
if(!Dummy) if(!Dummy)
{ {
return m_pControls->SnapInput(pData); return m_Controls.SnapInput(pData);
} }
if(!g_Config.m_ClDummyHammer) if(!g_Config.m_ClDummyHammer)
@ -635,28 +562,6 @@ void CGameClient::UpdatePositions()
UpdateRenderedCharacters(); UpdateRenderedCharacters();
} }
static void Evolve(CNetObj_Character *pCharacter, int Tick)
{
CWorldCore TempWorld;
CCharacterCore TempCore;
CTeamsCore TempTeams;
mem_zero(&TempCore, sizeof(TempCore));
mem_zero(&TempTeams, sizeof(TempTeams));
TempCore.Init(&TempWorld, g_GameClient.Collision(), &TempTeams);
TempCore.Read(pCharacter);
TempCore.m_ActiveWeapon = pCharacter->m_Weapon;
while(pCharacter->m_Tick < Tick)
{
pCharacter->m_Tick++;
TempCore.Tick(false);
TempCore.Move();
TempCore.Quantize();
}
TempCore.Write(pCharacter);
}
void CGameClient::OnRender() void CGameClient::OnRender()
{ {
// update the local character and spectate position // update the local character and spectate position
@ -665,9 +570,9 @@ void CGameClient::OnRender()
// display gfx & client warnings // display gfx & client warnings
for(SWarning *pWarning : {Graphics()->GetCurWarning(), Client()->GetCurWarning()}) 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; pWarning->m_WasShown = true;
} }
} }
@ -687,7 +592,7 @@ void CGameClient::OnRender()
g_Config.m_ClDummy = 0; g_Config.m_ClDummy = 0;
// resend player and dummy info if it was filtered by server // 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) if(m_CheckInfo[0] == 0)
{ {
@ -740,7 +645,7 @@ void CGameClient::OnDummyDisconnect()
int CGameClient::GetLastRaceTick() int CGameClient::GetLastRaceTick()
{ {
return m_pGhost->GetLastRaceTick(); return m_Ghost.GetLastRaceTick();
} }
void CGameClient::OnRelease() void CGameClient::OnRelease()
@ -766,7 +671,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
if(pUnpacker->Error()) if(pUnpacker->Error())
return; return;
g_GameClient.m_pItems->AddExtraProjectile(&Proj); m_Items.AddExtraProjectile(&Proj);
} }
return; return;
@ -814,7 +719,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) 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 return; // no need of all that stuff for the dummy
@ -848,12 +753,12 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
pMsg->m_SoundID == SOUND_CTF_GRAB_PL) pMsg->m_SoundID == SOUND_CTF_GRAB_PL)
{ {
if(g_Config.m_SndGame) 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 else
{ {
if(g_Config.m_SndGame) 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) else if(MsgId == NETMSGTYPE_SV_TEAMSSTATE || MsgId == NETMSGTYPE_SV_TEAMSSTATELEGACY)
@ -883,8 +788,8 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
if(i <= 16) if(i <= 16)
m_Teams.m_IsDDRace16 = true; m_Teams.m_IsDDRace16 = true;
m_pGhost->m_AllowRestart = true; m_Ghost.m_AllowRestart = true;
m_pRaceDemo->m_AllowRestart = true; m_RaceDemo.m_AllowRestart = true;
} }
else if(MsgId == NETMSGTYPE_SV_KILLMSG) else if(MsgId == NETMSGTYPE_SV_KILLMSG)
{ {
@ -914,14 +819,14 @@ void CGameClient::OnStateChange(int NewState, int OldState)
void CGameClient::OnShutdown() void CGameClient::OnShutdown()
{ {
m_pMenus->KillServer(); m_Menus.KillServer();
m_pRaceDemo->OnReset(); m_RaceDemo.OnReset();
m_pGhost->OnReset(); m_Ghost.OnReset();
} }
void CGameClient::OnEnterGame() void CGameClient::OnEnterGame()
{ {
g_GameClient.m_pEffects->ResetDamageIndicator(); m_Effects.ResetDamageIndicator();
} }
void CGameClient::OnGameOver() void CGameClient::OnGameOver()
@ -934,7 +839,7 @@ void CGameClient::OnStartGame()
{ {
if(Client()->State() != IClient::STATE_DEMOPLAYBACK && !g_Config.m_ClAutoDemoOnConnect) if(Client()->State() != IClient::STATE_DEMOPLAYBACK && !g_Config.m_ClAutoDemoOnConnect)
Client()->DemoRecorder_HandleAutoStart(); Client()->DemoRecorder_HandleAutoStart();
m_pStatboard->OnReset(); m_Statboard.OnReset();
} }
void CGameClient::OnFlagGrab(int TeamID) void CGameClient::OnFlagGrab(int TeamID)
@ -967,12 +872,12 @@ void CGameClient::OnLanguageChange()
void CGameClient::OnRconType(bool UsernameReq) void CGameClient::OnRconType(bool UsernameReq)
{ {
m_pGameConsole->RequireUsername(UsernameReq); m_GameConsole.RequireUsername(UsernameReq);
} }
void CGameClient::OnRconLine(const char *pLine) void CGameClient::OnRconLine(const char *pLine)
{ {
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine); m_GameConsole.PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
} }
void CGameClient::ProcessEvents() void CGameClient::ProcessEvents()
@ -990,33 +895,33 @@ void CGameClient::ProcessEvents()
if(Item.m_Type == NETEVENTTYPE_DAMAGEIND) if(Item.m_Type == NETEVENTTYPE_DAMAGEIND)
{ {
CNetEvent_DamageInd *ev = (CNetEvent_DamageInd *)pData; 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) else if(Item.m_Type == NETEVENTTYPE_EXPLOSION)
{ {
CNetEvent_Explosion *ev = (CNetEvent_Explosion *)pData; 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) else if(Item.m_Type == NETEVENTTYPE_HAMMERHIT)
{ {
CNetEvent_HammerHit *ev = (CNetEvent_HammerHit *)pData; 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) else if(Item.m_Type == NETEVENTTYPE_SPAWN)
{ {
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)pData; 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) else if(Item.m_Type == NETEVENTTYPE_DEATH)
{ {
CNetEvent_Death *ev = (CNetEvent_Death *)pData; 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) else if(Item.m_Type == NETEVENTTYPE_SOUNDWORLD)
{ {
CNetEvent_SoundWorld *ev = (CNetEvent_SoundWorld *)pData; 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)) 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));
} }
} }
} }
@ -1165,12 +1070,33 @@ static CGameInfo GetGameInfo(const CNetObj_GameInfoEx *pInfoEx, int InfoExSize,
void CGameClient::InvalidateSnapshot() void CGameClient::InvalidateSnapshot()
{ {
// clear all pointers // 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; m_Snap.m_LocalClientID = -1;
} }
void CGameClient::OnNewSnapshot() void CGameClient::OnNewSnapshot()
{ {
auto &&Evolve = [=](CNetObj_Character *pCharacter, int Tick) {
CWorldCore TempWorld;
CCharacterCore TempCore;
CTeamsCore TempTeams;
mem_zero(&TempCore, sizeof(TempCore));
mem_zero(&TempTeams, sizeof(TempTeams));
TempCore.Init(&TempWorld, Collision(), &TempTeams);
TempCore.Read(pCharacter);
TempCore.m_ActiveWeapon = pCharacter->m_Weapon;
while(pCharacter->m_Tick < Tick)
{
pCharacter->m_Tick++;
TempCore.Tick(false);
TempCore.Move();
TempCore.Quantize();
}
TempCore.Write(pCharacter);
};
InvalidateSnapshot(); InvalidateSnapshot();
m_NewTick = true; m_NewTick = true;
@ -1259,7 +1185,7 @@ void CGameClient::OnNewSnapshot()
pClient->m_SkinInfo.m_Size = 64; pClient->m_SkinInfo.m_Size = 64;
// find new skin // 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_OriginalRenderSkin = pSkin->m_OriginalSkin;
pClient->m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin; pClient->m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
pClient->m_SkinInfo.m_SkinMetrics = pSkin->m_Metrics; pClient->m_SkinInfo.m_SkinMetrics = pSkin->m_Metrics;
@ -1272,7 +1198,7 @@ void CGameClient::OnNewSnapshot()
pClient->m_SkinInfo.m_ColorFeet = ColorRGBA(1, 1, 1); pClient->m_SkinInfo.m_ColorFeet = ColorRGBA(1, 1, 1);
} }
pClient->UpdateRenderInfo(); pClient->UpdateRenderInfo(IsTeamPlay());
} }
} }
else if(Item.m_Type == NETOBJTYPE_PLAYERINFO) else if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
@ -1427,7 +1353,7 @@ void CGameClient::OnNewSnapshot()
// hence no need to reset stats until player leaves GameOver // hence no need to reset stats until player leaves GameOver
// and it would be a mistake to reset stats after or during the pause // 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)) && !(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; m_LastRoundStartTick = m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_GameOver = CurrentTickGameOver; s_GameOver = CurrentTickGameOver;
s_GamePaused = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED); s_GamePaused = (bool)(m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED);
@ -1499,7 +1425,7 @@ void CGameClient::OnNewSnapshot()
else if(Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, m_Snap.m_LocalClientID)) else if(Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, m_Snap.m_LocalClientID))
{ {
// player died // player died
m_pControls->OnPlayerDeath(); m_Controls.OnPlayerDeath();
} }
} }
if(Client()->State() == IClient::STATE_DEMOPLAYBACK) if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
@ -1639,12 +1565,12 @@ void CGameClient::OnNewSnapshot()
m_ShowOthers[g_Config.m_ClDummy] = g_Config.m_ClShowOthers; m_ShowOthers[g_Config.m_ClDummy] = g_Config.m_ClShowOthers;
} }
float ZoomToSend = m_pCamera->m_Zoom; float ZoomToSend = m_Camera.m_Zoom;
if(m_pCamera->m_ZoomSmoothingTarget != .0) if(m_Camera.m_ZoomSmoothingTarget != .0)
{ {
if(m_pCamera->m_ZoomSmoothingTarget > m_pCamera->m_Zoom) // Zooming out if(m_Camera.m_ZoomSmoothingTarget > m_Camera.m_Zoom) // Zooming out
ZoomToSend = m_pCamera->m_ZoomSmoothingTarget; ZoomToSend = m_Camera.m_ZoomSmoothingTarget;
else if(m_pCamera->m_ZoomSmoothingTarget < m_pCamera->m_Zoom && m_LastZoom > 0) // Zooming in else if(m_Camera.m_ZoomSmoothingTarget < m_Camera.m_Zoom && m_LastZoom > 0) // Zooming in
ZoomToSend = m_LastZoom; ZoomToSend = m_LastZoom;
} }
@ -1666,8 +1592,8 @@ void CGameClient::OnNewSnapshot()
} }
m_LastDummyConnected = Client()->DummyConnected(); m_LastDummyConnected = Client()->DummyConnected();
m_pGhost->OnNewSnapshot(); m_Ghost.OnNewSnapshot();
m_pRaceDemo->OnNewSnapshot(); m_RaceDemo.OnNewSnapshot();
// detect air jump for other players // detect air jump for other players
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
@ -1677,7 +1603,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 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), 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)); Client()->IntraGameTick(g_Config.m_ClDummy));
m_pEffects->AirJump(Pos); m_Effects.AirJump(Pos);
} }
static int PrevLocalID = -1; static int PrevLocalID = -1;
@ -1806,15 +1732,15 @@ void CGameClient::OnPredict()
int Events = pLocalChar->Core()->m_TriggeredEvents; int Events = pLocalChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict) if(g_Config.m_ClPredict)
if(Events & COREEVENT_AIR_JUMP) if(Events & COREEVENT_AIR_JUMP)
m_pEffects->AirJump(Pos); m_Effects.AirJump(Pos);
if(g_Config.m_SndGame) if(g_Config.m_SndGame)
{ {
if(Events & COREEVENT_GROUND_JUMP) 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) 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) 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);
} }
} }
@ -1826,7 +1752,7 @@ void CGameClient::OnPredict()
int Events = pDummyChar->Core()->m_TriggeredEvents; int Events = pDummyChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict) if(g_Config.m_ClPredict)
if(Events & COREEVENT_AIR_JUMP) if(Events & COREEVENT_AIR_JUMP)
m_pEffects->AirJump(Pos); m_Effects.AirJump(Pos);
} }
} }
@ -1925,7 +1851,7 @@ void CGameClient::OnPredict()
m_PredictedTick = Client()->PredGameTick(g_Config.m_ClDummy); m_PredictedTick = Client()->PredGameTick(g_Config.m_ClDummy);
if(m_NewPredictedTick) if(m_NewPredictedTick)
m_pGhost->OnNewPredictedSnapshot(); m_Ghost.OnNewPredictedSnapshot();
} }
void CGameClient::OnActivateEditor() void CGameClient::OnActivateEditor()
@ -1957,12 +1883,12 @@ void CGameClient::CClientStats::Reset()
m_FlagCaptures = 0; m_FlagCaptures = 0;
} }
void CGameClient::CClientData::UpdateRenderInfo() void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay)
{ {
m_RenderInfo = m_SkinInfo; m_RenderInfo = m_SkinInfo;
// force team colors // force team colors
if(g_GameClient.m_Snap.m_pGameInfoObj && g_GameClient.m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS) if(IsTeamPlay)
{ {
m_RenderInfo.m_CustomColoredSkin = true; m_RenderInfo.m_CustomColoredSkin = true;
const int TeamColors[2] = {65461, 10223541}; const int TeamColors[2] = {65461, 10223541};
@ -2027,7 +1953,7 @@ void CGameClient::CClientData::Reset()
m_SpecChar = vec2(0, 0); m_SpecChar = vec2(0, 0);
m_SpecCharPresent = false; m_SpecCharPresent = false;
UpdateRenderInfo(); UpdateRenderInfo(false);
} }
void CGameClient::SendSwitchTeam(int Team) void CGameClient::SendSwitchTeam(int Team)
@ -2037,7 +1963,7 @@ void CGameClient::SendSwitchTeam(int Team)
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
if(Team != TEAM_SPECTATORS) if(Team != TEAM_SPECTATORS)
m_pCamera->OnReset(); m_Camera.OnReset();
} }
void CGameClient::SendInfo(bool Start) void CGameClient::SendInfo(bool Start)
@ -2159,13 +2085,13 @@ void CGameClient::ConchainClTextEntitiesSize(IConsole::IResult *pResult, void *p
if(pResult->NumArguments()) if(pResult->NumArguments())
{ {
CGameClient *pGameClient = (CGameClient *)pUserData; CGameClient *pGameClient = (CGameClient *)pUserData;
pGameClient->m_pMapimages->SetTextureScale(g_Config.m_ClTextEntitiesSize); pGameClient->m_MapImages.SetTextureScale(g_Config.m_ClTextEntitiesSize);
} }
} }
IGameClient *CreateGameClient() IGameClient *CreateGameClient()
{ {
return &g_GameClient; return new CGameClient();
} }
int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int ownID) int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int ownID)
@ -2601,7 +2527,7 @@ vec2 CGameClient::GetSmoothPos(int ClientID)
void CGameClient::Echo(const char *pString) void CGameClient::Echo(const char *pString)
{ {
m_pChat->Echo(pString); m_Chat.Echo(pString);
} }
bool CGameClient::IsOtherTeam(int ClientID) bool CGameClient::IsOtherTeam(int ClientID)
@ -2983,15 +2909,15 @@ void CGameClient::RefindSkins()
Client.m_SkinInfo.m_ColorableRenderSkin.Reset(); Client.m_SkinInfo.m_ColorableRenderSkin.Reset();
if(Client.m_aSkinName[0] != '\0') 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_OriginalRenderSkin = pSkin->m_OriginalSkin;
Client.m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin; Client.m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
Client.UpdateRenderInfo(); Client.UpdateRenderInfo(IsTeamPlay());
} }
} }
m_pGhost->RefindSkin(); m_Ghost.RefindSkin();
m_pChat->RefindSkins(); m_Chat.RefindSkins();
gs_KillMessages.RefindSkins(); m_KillMessages.RefindSkins();
} }
void CGameClient::LoadMapSettings() void CGameClient::LoadMapSettings()
@ -3059,7 +2985,7 @@ void CGameClient::ConchainMenuMap(IConsole::IResult *pResult, void *pUserData, I
if(str_comp(g_Config.m_ClMenuMap, pResult->GetString(0)) != 0) 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)); str_format(g_Config.m_ClMenuMap, sizeof(g_Config.m_ClMenuMap), "%s", pResult->GetString(0));
pSelf->m_pMenuBackground->LoadMenuBackground(); pSelf->m_MenuBackground.LoadMenuBackground();
} }
} }
else else
@ -3074,19 +3000,19 @@ void CGameClient::DummyResetInput()
if((m_DummyInput.m_Fire & 1) != 0) if((m_DummyInput.m_Fire & 1) != 0)
m_DummyInput.m_Fire++; m_DummyInput.m_Fire++;
m_pControls->ResetInput(!g_Config.m_ClDummy); m_Controls.ResetInput(!g_Config.m_ClDummy);
m_pControls->m_InputData[!g_Config.m_ClDummy].m_Hook = 0; m_Controls.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.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() bool CGameClient::CanDisplayWarning()
{ {
return m_pMenus->CanDisplayWarning(); return m_Menus.CanDisplayWarning();
} }
bool CGameClient::IsDisplayingWarning() bool CGameClient::IsDisplayingWarning()
{ {
return m_pMenus->GetCurPopup() == CMenus::POPUP_WARNING; return m_Menus.GetCurPopup() == CMenus::POPUP_WARNING;
} }

View file

@ -20,6 +20,41 @@
#include <game/client/prediction/entities/pickup.h> #include <game/client/prediction/entities/pickup.h>
#include <game/client/prediction/gameworld.h> #include <game/client/prediction/gameworld.h>
// components
#include "components/background.h"
#include "components/binds.h"
#include "components/broadcast.h"
#include "components/camera.h"
#include "components/chat.h"
#include "components/console.h"
#include "components/controls.h"
#include "components/countryflags.h"
#include "components/damageind.h"
#include "components/debughud.h"
#include "components/effects.h"
#include "components/emoticon.h"
#include "components/flow.h"
#include "components/ghost.h"
#include "components/hud.h"
#include "components/items.h"
#include "components/killmessages.h"
#include "components/mapimages.h"
#include "components/maplayers.h"
#include "components/mapsounds.h"
#include "components/menu_background.h"
#include "components/menus.h"
#include "components/motd.h"
#include "components/nameplates.h"
#include "components/particles.h"
#include "components/players.h"
#include "components/race_demo.h"
#include "components/scoreboard.h"
#include "components/skins.h"
#include "components/sounds.h"
#include "components/spectator.h"
#include "components/statboard.h"
#include "components/voting.h"
class CGameInfo class CGameInfo
{ {
public: public:
@ -59,6 +94,48 @@ public:
class CGameClient : public IGameClient class CGameClient : public IGameClient
{ {
public:
// all components
CKillMessages m_KillMessages;
CCamera m_Camera;
CChat m_Chat;
CMotd m_Motd;
CBroadcast m_Broadcast;
CGameConsole m_GameConsole;
CBinds m_Binds;
CParticles m_Particles;
CMenus m_Menus;
CSkins m_Skins;
CCountryFlags m_CountryFlags;
CFlow m_Flow;
CHud m_Hud;
CDebugHud m_DebugHud;
CControls m_Controls;
CEffects m_Effects;
CScoreboard m_Scoreboard;
CStatboard m_Statboard;
CSounds m_Sounds;
CEmoticon m_Emoticon;
CDamageInd m_DamageInd;
CVoting m_Voting;
CSpectator m_Spectator;
CPlayers m_Players;
CNamePlates m_NamePlates;
CItems m_Items;
CMapImages m_MapImages;
CMapLayers m_MapLayersBackGround = CMapLayers{CMapLayers::TYPE_BACKGROUND};
CMapLayers m_MapLayersForeGround = CMapLayers{CMapLayers::TYPE_FOREGROUND};
CBackground m_BackGround;
CMenuBackground m_MenuBackground;
CMapSounds m_MapSounds;
CRaceDemo m_RaceDemo;
CGhost m_Ghost;
private:
class CStack class CStack
{ {
public: public:
@ -296,7 +373,7 @@ public:
CNetObj_Character m_Snapped; CNetObj_Character m_Snapped;
CNetObj_Character m_Evolved; CNetObj_Character m_Evolved;
void UpdateRenderInfo(); void UpdateRenderInfo(bool IsTeamPlay);
void Reset(); void Reset();
// rendered characters // rendered characters
@ -400,34 +477,6 @@ public:
virtual void SendDummyInfo(bool Start); virtual void SendDummyInfo(bool Start);
void SendKill(int ClientID); 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 // DDRace
int m_LocalIDs[NUM_DUMMIES]; int m_LocalIDs[NUM_DUMMIES];
@ -436,14 +485,14 @@ public:
int m_DummyFire; int m_DummyFire;
bool m_ReceivedDDNetPlayer; bool m_ReceivedDDNetPlayer;
class CRaceDemo *m_pRaceDemo;
class CGhost *m_pGhost;
class CTeamsCore m_Teams; class CTeamsCore m_Teams;
int IntersectCharacter(vec2 Pos0, vec2 Pos1, vec2 &NewPos, int ownID); int IntersectCharacter(vec2 Pos0, vec2 Pos1, vec2 &NewPos, int ownID);
virtual int GetLastRaceTick(); virtual int GetLastRaceTick();
bool IsTeamPlay() { return m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS; }
bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking); } bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking); }
bool AntiPingGrenade() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingGrenade && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; } bool AntiPingGrenade() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingGrenade && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }
bool AntiPingWeapons() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingWeapons && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; } bool AntiPingWeapons() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingWeapons && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }

View file

@ -6387,7 +6387,7 @@ void CEditor::LoadCurrentMap()
m_ValidSaveFilename = true; m_ValidSaveFilename = true;
CGameClient *pGameClient = (CGameClient *)Kernel()->RequestInterface<IGameClient>(); 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_WorldOffsetX = Center.x;
m_WorldOffsetY = Center.y; m_WorldOffsetY = Center.y;