Move global configuration out of client interface

This commit is contained in:
ChillerDragon 2020-02-19 11:24:58 +01:00
parent 7691227f24
commit 9e0f6d2ce0
16 changed files with 131 additions and 130 deletions

View file

@ -7,7 +7,6 @@
#include "message.h" #include "message.h"
#include "graphics.h" #include "graphics.h"
#include <engine/friends.h> #include <engine/friends.h>
#include <engine/shared/config.h>
enum enum
{ {
@ -78,12 +77,12 @@ public:
inline int State() const { return m_State; } inline int State() const { return m_State; }
// tick time access // tick time access
inline int PrevGameTick() const { return m_PrevGameTick[g_Config.m_ClDummy]; } inline int PrevGameTick(int Dummy) const { return m_PrevGameTick[Dummy]; }
inline int GameTick() const { return m_CurGameTick[g_Config.m_ClDummy]; } inline int GameTick(int Dummy) const { return m_CurGameTick[Dummy]; }
inline int PredGameTick() const { return m_PredTick[g_Config.m_ClDummy]; } inline int PredGameTick(int Dummy) const { return m_PredTick[Dummy]; }
inline float IntraGameTick() const { return m_GameIntraTick[g_Config.m_ClDummy]; } inline float IntraGameTick(int Dummy) const { return m_GameIntraTick[Dummy]; }
inline float PredIntraGameTick() const { return m_PredIntraTick[g_Config.m_ClDummy]; } inline float PredIntraGameTick(int Dummy) const { return m_PredIntraTick[Dummy]; }
inline float GameTickTime() const { return m_GameTickTime[g_Config.m_ClDummy]; } inline float GameTickTime(int Dummy) const { return m_GameTickTime[Dummy]; }
inline int GameTickSpeed() const { return m_GameTickSpeed; } inline int GameTickSpeed() const { return m_GameTickSpeed; }
// other time access // other time access

View file

@ -781,12 +781,12 @@ bool CClient::DummyConnected()
bool CClient::DummyConnecting() bool CClient::DummyConnecting()
{ {
return !m_DummyConnected && m_LastDummyConnectTime > 0 && m_LastDummyConnectTime + GameTickSpeed() * 5 > GameTick(); return !m_DummyConnected && m_LastDummyConnectTime > 0 && m_LastDummyConnectTime + GameTickSpeed() * 5 > GameTick(g_Config.m_ClDummy);
} }
void CClient::DummyConnect() void CClient::DummyConnect()
{ {
if(m_LastDummyConnectTime > 0 && m_LastDummyConnectTime + GameTickSpeed() * 5 > GameTick()) if(m_LastDummyConnectTime > 0 && m_LastDummyConnectTime + GameTickSpeed() * 5 > GameTick(g_Config.m_ClDummy))
return; return;
if(m_NetClient[CLIENT_MAIN].State() != NET_CONNSTATE_ONLINE && m_NetClient[CLIENT_MAIN].State() != NET_CONNSTATE_PENDING) if(m_NetClient[CLIENT_MAIN].State() != NET_CONNSTATE_ONLINE && m_NetClient[CLIENT_MAIN].State() != NET_CONNSTATE_PENDING)
@ -795,7 +795,7 @@ void CClient::DummyConnect()
if(m_DummyConnected) if(m_DummyConnected)
return; return;
m_LastDummyConnectTime = GameTick(); m_LastDummyConnectTime = GameTick(g_Config.m_ClDummy);
m_RconAuthed[1] = 0; m_RconAuthed[1] = 0;
@ -824,7 +824,7 @@ int CClient::GetCurrentRaceTime()
{ {
if(GameClient()->GetLastRaceTick() < 0) if(GameClient()->GetLastRaceTick() < 0)
return 0; return 0;
return (GameTick() - GameClient()->GetLastRaceTick()) / 50; return (GameTick(g_Config.m_ClDummy) - GameClient()->GetLastRaceTick()) / 50;
} }
int CClient::SendMsgY(CMsgPacker *pMsg, int Flags, int NetClient) int CClient::SendMsgY(CMsgPacker *pMsg, int Flags, int NetClient)
@ -3443,7 +3443,7 @@ void CClient::SaveReplay(const int Length)
char *pSrc = (&m_DemoRecorder[RECORDER_REPLAYS])->GetCurrentFilename(); char *pSrc = (&m_DemoRecorder[RECORDER_REPLAYS])->GetCurrentFilename();
// Slice the demo to get only the last cl_replay_length seconds // Slice the demo to get only the last cl_replay_length seconds
const int EndTick = GameTick(); const int EndTick = GameTick(g_Config.m_ClDummy);
const int StartTick = EndTick - Length * GameTickSpeed(); const int StartTick = EndTick - Length * GameTickSpeed();
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "replay", "Saving replay..."); m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "replay", "Saving replay...");

View file

@ -25,7 +25,7 @@ void CBroadcast::OnRender()
Graphics()->MapScreen(0, 0, 300*Graphics()->ScreenAspect(), 300); Graphics()->MapScreen(0, 0, 300*Graphics()->ScreenAspect(), 300);
if(Client()->GameTick() < m_BroadcastTick) if(Client()->GameTick(g_Config.m_ClDummy) < m_BroadcastTick)
{ {
CTextCursor Cursor; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, m_BroadcastRenderOffset, 40.0f, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); TextRender()->SetCursor(&Cursor, m_BroadcastRenderOffset, 40.0f, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
@ -45,7 +45,7 @@ void CBroadcast::OnMessage(int MsgType, void *pRawMsg)
Cursor.m_LineWidth = 300*Graphics()->ScreenAspect(); Cursor.m_LineWidth = 300*Graphics()->ScreenAspect();
TextRender()->TextEx(&Cursor, m_aBroadcastText, -1); TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
m_BroadcastRenderOffset = 150*Graphics()->ScreenAspect()-Cursor.m_X/2; m_BroadcastRenderOffset = 150*Graphics()->ScreenAspect()-Cursor.m_X/2;
m_BroadcastTick = Client()->GameTick()+Client()->GameTickSpeed()*10; m_BroadcastTick = Client()->GameTick(g_Config.m_ClDummy)+Client()->GameTickSpeed()*10;
if (g_Config.m_ClPrintBroadcasts) if (g_Config.m_ClPrintBroadcasts)
{ {
char aBuf[1024]; char aBuf[1024];

View file

@ -175,7 +175,7 @@ void CGhost::CheckStart()
int RaceTick = -m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer; int RaceTick = -m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer;
int RenderTick = m_NewRenderTick; int RenderTick = m_NewRenderTick;
if(m_LastRaceTick != RaceTick && Client()->GameTick() - RaceTick < Client()->GameTickSpeed()) if(m_LastRaceTick != RaceTick && Client()->GameTick(g_Config.m_ClDummy) - RaceTick < Client()->GameTickSpeed())
{ {
if(m_Rendering && m_RenderingStartedByServer) // race restarted: stop rendering if(m_Rendering && m_RenderingStartedByServer) // race restarted: stop rendering
StopRender(); StopRender();
@ -208,7 +208,7 @@ void CGhost::CheckStartLocal(bool Predicted)
{ {
if(m_Rendering && !m_RenderingStartedByServer) // race restarted: stop rendering if(m_Rendering && !m_RenderingStartedByServer) // race restarted: stop rendering
StopRender(); StopRender();
RenderTick = Client()->PredGameTick(); RenderTick = Client()->PredGameTick(g_Config.m_ClDummy);
} }
TryRenderStart(RenderTick, false); TryRenderStart(RenderTick, false);
@ -303,7 +303,7 @@ void CGhost::OnRender()
if(!m_Rendering || !g_Config.m_ClRaceShowGhost) if(!m_Rendering || !g_Config.m_ClRaceShowGhost)
return; return;
int PlaybackTick = Client()->PredGameTick() - m_StartRenderTick; int PlaybackTick = Client()->PredGameTick(g_Config.m_ClDummy) - m_StartRenderTick;
for(int i = 0; i < MAX_ACTIVE_GHOSTS; i++) for(int i = 0; i < MAX_ACTIVE_GHOSTS; i++)
{ {
@ -335,9 +335,9 @@ void CGhost::OnRender()
int TickDiff = Player.m_Tick - Prev.m_Tick; int TickDiff = Player.m_Tick - Prev.m_Tick;
float IntraTick = 0.f; float IntraTick = 0.f;
if(TickDiff > 0) if(TickDiff > 0)
IntraTick = (GhostTick - Prev.m_Tick - 1 + Client()->PredIntraGameTick()) / TickDiff; IntraTick = (GhostTick - Prev.m_Tick - 1 + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / TickDiff;
Player.m_AttackTick += Client()->GameTick() - GhostTick; Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &pGhost->m_RenderInfo , -2, IntraTick); m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &pGhost->m_RenderInfo , -2, IntraTick);
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &pGhost->m_RenderInfo, -2, IntraTick); m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &pGhost->m_RenderInfo, -2, IntraTick);
@ -562,7 +562,7 @@ void CGhost::SaveGhost(CMenus::CGhostItem *pItem)
void CGhost::ConGPlay(IConsole::IResult *pResult, void *pUserData) void CGhost::ConGPlay(IConsole::IResult *pResult, void *pUserData)
{ {
CGhost *pGhost = (CGhost *)pUserData; CGhost *pGhost = (CGhost *)pUserData;
pGhost->StartRender(pGhost->Client()->PredGameTick()); pGhost->StartRender(pGhost->Client()->PredGameTick(g_Config.m_ClDummy));
} }
void CGhost::OnConsoleInit() void CGhost::OnConsoleInit()
@ -584,7 +584,7 @@ void CGhost::OnMessage(int MsgType, void *pRawMsg)
if(m_Recording) if(m_Recording)
StopRecord(); StopRecord();
StopRender(); StopRender();
m_LastDeathTick = Client()->GameTick(); m_LastDeathTick = Client()->GameTick(g_Config.m_ClDummy);
} }
} }
else if(MsgType == NETMSGTYPE_SV_CHAT) else if(MsgType == NETMSGTYPE_SV_CHAT)

View file

@ -109,7 +109,7 @@ void CHud::RenderGameTimer()
int Time = 0; int Time = 0;
if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit && (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer <= 0)) if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit && (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer <= 0))
{ {
Time = m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit*60 - ((Client()->GameTick()-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick)/Client()->GameTickSpeed()); Time = m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit*60 - ((Client()->GameTick(g_Config.m_ClDummy)-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick)/Client()->GameTickSpeed());
if(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER) if(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER)
Time = 0; Time = 0;
@ -117,10 +117,10 @@ void CHud::RenderGameTimer()
else if(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_RACETIME) else if(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_RACETIME)
{ {
//The Warmup timer is negative in this case to make sure that incompatible clients will not see a warmup timer //The Warmup timer is negative in this case to make sure that incompatible clients will not see a warmup timer
Time = (Client()->GameTick()+m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer)/Client()->GameTickSpeed(); Time = (Client()->GameTick(g_Config.m_ClDummy)+m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer)/Client()->GameTickSpeed();
} }
else else
Time = (Client()->GameTick()-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick)/Client()->GameTickSpeed(); Time = (Client()->GameTick(g_Config.m_ClDummy)-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick)/Client()->GameTickSpeed();
if(Time <= 0 && g_Config.m_ClShowDecisecs) if(Time <= 0 && g_Config.m_ClShowDecisecs)
str_format(aBuf, sizeof(aBuf), "00:00.0"); str_format(aBuf, sizeof(aBuf), "00:00.0");
@ -251,8 +251,8 @@ void CHud::RenderScoreHud()
if(GameFlags&GAMEFLAG_FLAGS) if(GameFlags&GAMEFLAG_FLAGS)
{ {
int BlinkTimer = (m_pClient->m_FlagDropTick[t] != 0 && int BlinkTimer = (m_pClient->m_FlagDropTick[t] != 0 &&
(Client()->GameTick()-m_pClient->m_FlagDropTick[t])/Client()->GameTickSpeed() >= 25) ? 10 : 20; (Client()->GameTick(g_Config.m_ClDummy)-m_pClient->m_FlagDropTick[t])/Client()->GameTickSpeed() >= 25) ? 10 : 20;
if(FlagCarrier[t] == FLAG_ATSTAND || (FlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick()/BlinkTimer)&1))) if(FlagCarrier[t] == FLAG_ATSTAND || (FlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy)/BlinkTimer)&1)))
{ {
// draw flag // draw flag
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
@ -809,10 +809,10 @@ void CHud::OnRender()
static int LastChangeTick = 0; static int LastChangeTick = 0;
if (LastChangeTick != Client()->PredGameTick()) if (LastChangeTick != Client()->PredGameTick(g_Config.m_ClDummy))
{ {
m_DDRaceTick += 100 / Client()->GameTickSpeed(); m_DDRaceTick += 100 / Client()->GameTickSpeed();
LastChangeTick = Client()->PredGameTick(); LastChangeTick = Client()->PredGameTick(g_Config.m_ClDummy);
} }
if (m_DDRaceTick >= 100) if (m_DDRaceTick >= 100)
@ -830,14 +830,14 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
m_DDRaceTime = pMsg->m_Time; m_DDRaceTime = pMsg->m_Time;
m_DDRaceTick = 0; m_DDRaceTick = 0;
m_LastReceivedTimeTick = Client()->GameTick(); m_LastReceivedTimeTick = Client()->GameTick(g_Config.m_ClDummy);
m_FinishTime = pMsg->m_Finish ? true : false; m_FinishTime = pMsg->m_Finish ? true : false;
if(pMsg->m_Check) if(pMsg->m_Check)
{ {
m_CheckpointDiff = (float)pMsg->m_Check/100; m_CheckpointDiff = (float)pMsg->m_Check/100;
m_CheckpointTick = Client()->GameTick(); m_CheckpointTick = Client()->GameTick(g_Config.m_ClDummy);
} }
} }
else if(MsgType == NETMSGTYPE_SV_KILLMSG) else if(MsgType == NETMSGTYPE_SV_KILLMSG)
@ -861,12 +861,12 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
m_DDRaceTime = pMsg->m_ServerTimeBest; // First value: m_Time m_DDRaceTime = pMsg->m_ServerTimeBest; // First value: m_Time
m_DDRaceTick = 0; m_DDRaceTick = 0;
m_LastReceivedTimeTick = Client()->GameTick(); m_LastReceivedTimeTick = Client()->GameTick(g_Config.m_ClDummy);
if(pMsg->m_PlayerTimeBest) // Second value: m_Check if(pMsg->m_PlayerTimeBest) // Second value: m_Check
{ {
m_CheckpointDiff = (float)pMsg->m_PlayerTimeBest/100; m_CheckpointDiff = (float)pMsg->m_PlayerTimeBest/100;
m_CheckpointTick = Client()->GameTick(); m_CheckpointTick = Client()->GameTick(g_Config.m_ClDummy);
} }
} }
else if(GameClient()->m_GameInfo.m_RaceRecordMessage) else if(GameClient()->m_GameInfo.m_RaceRecordMessage)
@ -880,7 +880,7 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
void CHud::RenderDDRaceEffects() void CHud::RenderDDRaceEffects()
{ {
// check racestate // check racestate
if(m_FinishTime && m_LastReceivedTimeTick + Client()->GameTickSpeed()*2 < Client()->GameTick()) if(m_FinishTime && m_LastReceivedTimeTick + Client()->GameTickSpeed()*2 < Client()->GameTick(g_Config.m_ClDummy))
{ {
m_FinishTime = false; m_FinishTime = false;
m_DDRaceTimeReceived = false; m_DDRaceTimeReceived = false;
@ -895,16 +895,16 @@ void CHud::RenderDDRaceEffects()
str_format(aBuf, sizeof(aBuf), "Finish time: %02d:%02d.%02d", m_DDRaceTime/6000, m_DDRaceTime/100-m_DDRaceTime/6000 * 60, m_DDRaceTime % 100); str_format(aBuf, sizeof(aBuf), "Finish time: %02d:%02d.%02d", m_DDRaceTime/6000, m_DDRaceTime/100-m_DDRaceTime/6000 * 60, m_DDRaceTime % 100);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0,12,aBuf,-1)/2, 20, 12, aBuf, -1); TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0,12,aBuf,-1)/2, 20, 12, aBuf, -1);
} }
else if(m_CheckpointTick + Client()->GameTickSpeed()*6 > Client()->GameTick()) else if(m_CheckpointTick + Client()->GameTickSpeed()*6 > Client()->GameTick(g_Config.m_ClDummy))
{ {
str_format(aBuf, sizeof(aBuf), "%+5.2f", m_CheckpointDiff); str_format(aBuf, sizeof(aBuf), "%+5.2f", m_CheckpointDiff);
// calculate alpha (4 sec 1 than get lower the next 2 sec) // calculate alpha (4 sec 1 than get lower the next 2 sec)
float a = 1.0f; float a = 1.0f;
if(m_CheckpointTick+Client()->GameTickSpeed()*4 < Client()->GameTick() && m_CheckpointTick+Client()->GameTickSpeed()*6 > Client()->GameTick()) if(m_CheckpointTick+Client()->GameTickSpeed()*4 < Client()->GameTick(g_Config.m_ClDummy) && m_CheckpointTick+Client()->GameTickSpeed()*6 > Client()->GameTick(g_Config.m_ClDummy))
{ {
// lower the alpha slowly to blend text out // lower the alpha slowly to blend text out
a = ((float)(m_CheckpointTick+Client()->GameTickSpeed()*6) - (float)Client()->GameTick()) / (float)(Client()->GameTickSpeed()*2); a = ((float)(m_CheckpointTick+Client()->GameTickSpeed()*6) - (float)Client()->GameTick(g_Config.m_ClDummy)) / (float)(Client()->GameTickSpeed()*2);
} }
if(m_CheckpointDiff > 0) if(m_CheckpointDiff > 0)

View file

@ -47,15 +47,15 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
if(m_pClient->m_Snap.m_pLocalInfo) if(m_pClient->m_Snap.m_pLocalInfo)
LocalPlayerInGame = m_pClient->m_aClients[m_pClient->m_Snap.m_pLocalInfo->m_ClientID].m_Team != -1; LocalPlayerInGame = m_pClient->m_aClients[m_pClient->m_Snap.m_pLocalInfo->m_ClientID].m_Team != -1;
static float s_LastGameTickTime = Client()->GameTickTime(); static float s_LastGameTickTime = Client()->GameTickTime(g_Config.m_ClDummy);
if(m_pClient->m_Snap.m_pGameInfoObj && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED)) if(m_pClient->m_Snap.m_pGameInfoObj && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED))
s_LastGameTickTime = Client()->GameTickTime(); s_LastGameTickTime = Client()->GameTickTime(g_Config.m_ClDummy);
float Ct; float Ct;
if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !(Client()->State() == IClient::STATE_DEMOPLAYBACK)) if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !(Client()->State() == IClient::STATE_DEMOPLAYBACK))
Ct = ((float)(Client()->PredGameTick() - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick())/(float)SERVER_TICK_SPEED; Ct = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy))/(float)SERVER_TICK_SPEED;
else else
Ct = (Client()->PrevGameTick() - pCurrent->m_StartTick)/(float)SERVER_TICK_SPEED + s_LastGameTickTime; Ct = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick)/(float)SERVER_TICK_SPEED + s_LastGameTickTime;
if(Ct < 0) if(Ct < 0)
return; // projectile haven't been shot yet return; // projectile haven't been shot yet
@ -82,7 +82,7 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
int QuadOffset = 2 + 4 + NUM_WEAPONS + clamp(pCurrent->m_Type, 0, NUM_WEAPONS - 1); int QuadOffset = 2 + 4 + NUM_WEAPONS + clamp(pCurrent->m_Type, 0, NUM_WEAPONS - 1);
vec2 Vel = Pos-PrevPos; vec2 Vel = Pos-PrevPos;
//vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), Client()->IntraGameTick()); //vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), Client()->IntraGameTick(g_Config.m_ClDummy));
// add particle for this projectile // add particle for this projectile
if(pCurrent->m_Type == WEAPON_GRENADE) if(pCurrent->m_Type == WEAPON_GRENADE)
@ -128,7 +128,7 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
int QuadOffset = 2; int QuadOffset = 2;
float IntraTick = IsPredicted ? Client()->PredIntraGameTick() : Client()->IntraGameTick(); float IntraTick = IsPredicted ? Client()->PredIntraGameTick(g_Config.m_ClDummy) : Client()->IntraGameTick(g_Config.m_ClDummy);
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), IntraTick); vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), IntraTick);
float Angle = 0.0f; float Angle = 0.0f;
if(pCurrent->m_Type == POWERUP_WEAPON) if(pCurrent->m_Type == POWERUP_WEAPON)
@ -191,7 +191,7 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent,
Graphics()->QuadsSetRotation(Angle); Graphics()->QuadsSetRotation(Angle);
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick()); vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
if(pCurGameData) if(pCurGameData)
{ {
@ -220,9 +220,9 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent, bool IsPredicted)
float Ticks; float Ticks;
if(IsPredicted) if(IsPredicted)
Ticks = (float)(Client()->PredGameTick() - pCurrent->m_StartTick) + Client()->PredIntraGameTick(); Ticks = (float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy);
else else
Ticks = (float)(Client()->GameTick() - pCurrent->m_StartTick) + Client()->IntraGameTick(); Ticks = (float)(Client()->GameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->IntraGameTick(g_Config.m_ClDummy);
float Ms = (Ticks/50.0f) * 1000.0f; float Ms = (Ticks/50.0f) * 1000.0f;
float a = Ms / m_pClient->m_Tuning[g_Config.m_ClDummy].m_LaserBounceDelay; float a = Ms / m_pClient->m_Tuning[g_Config.m_ClDummy].m_LaserBounceDelay;
a = clamp(a, 0.0f, 1.0f); a = clamp(a, 0.0f, 1.0f);
@ -263,10 +263,10 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent, bool IsPredicted)
// render head // render head
{ {
int QuadOffset = 2 + 4 + NUM_WEAPONS * 2 + (Client()->GameTick() % 3); int QuadOffset = 2 + 4 + NUM_WEAPONS * 2 + (Client()->GameTick(g_Config.m_ClDummy) % 3);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
Graphics()->QuadsSetRotation(Client()->GameTick()); Graphics()->QuadsSetRotation(Client()->GameTick(g_Config.m_ClDummy));
Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y); Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y);
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
@ -331,7 +331,7 @@ void CItems::OnRender()
{ {
ReconstructSmokeTrail((const CNetObj_Projectile *)pData, Item.m_ID, pProj->m_DestroyTick, pProj->m_LifeSpan); ReconstructSmokeTrail((const CNetObj_Projectile *)pData, Item.m_ID, pProj->m_DestroyTick, pProj->m_LifeSpan);
} }
pProj->m_LastRenderTick = Client()->GameTick(); pProj->m_LastRenderTick = Client()->GameTick(g_Config.m_ClDummy);
continue; continue;
} }
} }
@ -378,7 +378,7 @@ void CItems::OnRender()
// render extra projectiles // render extra projectiles
for(int i = 0; i < m_NumExtraProjectiles; i++) for(int i = 0; i < m_NumExtraProjectiles; i++)
{ {
if(m_aExtraProjectiles[i].m_StartTick < Client()->GameTick()) if(m_aExtraProjectiles[i].m_StartTick < Client()->GameTick(g_Config.m_ClDummy))
{ {
m_aExtraProjectiles[i] = m_aExtraProjectiles[m_NumExtraProjectiles-1]; m_aExtraProjectiles[i] = m_aExtraProjectiles[m_NumExtraProjectiles-1];
m_NumExtraProjectiles--; m_NumExtraProjectiles--;
@ -450,7 +450,7 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
LocalPlayerInGame = m_pClient->m_aClients[m_pClient->m_Snap.m_pLocalInfo->m_ClientID].m_Team != -1; LocalPlayerInGame = m_pClient->m_aClients[m_pClient->m_Snap.m_pLocalInfo->m_ClientID].m_Team != -1;
if(!m_pClient->AntiPingGunfire() || !LocalPlayerInGame) if(!m_pClient->AntiPingGunfire() || !LocalPlayerInGame)
return; return;
if(Client()->PredGameTick() == pCurrent->m_StartTick) if(Client()->PredGameTick(g_Config.m_ClDummy) == pCurrent->m_StartTick)
return; return;
// get positions // get positions
@ -472,11 +472,11 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunSpeed; Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunSpeed;
} }
float Pt = ((float)(Client()->PredGameTick() - pCurrent->m_StartTick) + Client()->PredIntraGameTick())/(float)SERVER_TICK_SPEED; float Pt = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy))/(float)SERVER_TICK_SPEED;
if(Pt < 0) if(Pt < 0)
return; // projectile haven't been shot yet return; // projectile haven't been shot yet
float Gt = (Client()->PrevGameTick() - pCurrent->m_StartTick)/(float)SERVER_TICK_SPEED + Client()->GameTickTime(); float Gt = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick)/(float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
vec2 StartPos; vec2 StartPos;
vec2 StartVel; vec2 StartVel;
@ -494,7 +494,7 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
float T = Pt; float T = Pt;
if(DestroyTick >= 0) if(DestroyTick >= 0)
T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick())/(float)SERVER_TICK_SPEED); T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy))/(float)SERVER_TICK_SPEED);
T = minimum(T, LifeSpan/(float)SERVER_TICK_SPEED); T = minimum(T, LifeSpan/(float)SERVER_TICK_SPEED);
float MinTrailSpan = 0.4f * ((pCurrent->m_Type == WEAPON_GRENADE) ? 0.5f : 0.25f); float MinTrailSpan = 0.4f * ((pCurrent->m_Type == WEAPON_GRENADE) ? 0.5f : 0.25f);

View file

@ -83,7 +83,7 @@ void CKillMessages::OnMessage(int MsgType, void *pRawMsg)
Kill.m_Weapon = pMsg->m_Weapon; Kill.m_Weapon = pMsg->m_Weapon;
Kill.m_ModeSpecial = pMsg->m_ModeSpecial; Kill.m_ModeSpecial = pMsg->m_ModeSpecial;
Kill.m_Tick = Client()->GameTick(); Kill.m_Tick = Client()->GameTick(g_Config.m_ClDummy);
Kill.m_FlagCarrierBlue = m_pClient->m_Snap.m_pGameDataObj ? m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue : -1; Kill.m_FlagCarrierBlue = m_pClient->m_Snap.m_pGameDataObj ? m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue : -1;
@ -153,7 +153,7 @@ void CKillMessages::OnRender()
for(int i = 1; i <= MAX_KILLMSGS; i++) for(int i = 1; i <= MAX_KILLMSGS; i++)
{ {
int r = (m_KillmsgCurrent+i)%MAX_KILLMSGS; int r = (m_KillmsgCurrent+i)%MAX_KILLMSGS;
if(Client()->GameTick() > m_aKillmsgs[r].m_Tick+50*10) if(Client()->GameTick(g_Config.m_ClDummy) > m_aKillmsgs[r].m_Tick+50*10)
continue; continue;
float x = StartX; float x = StartX;

View file

@ -94,15 +94,15 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void
} }
if(pItem->m_Version < 2 || pItem->m_Synchronized) if(pItem->m_Version < 2 || pItem->m_Synchronized)
{ {
s_Time = mix((pThis->Client()->PrevGameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), s_Time = mix((pThis->Client()->PrevGameTick(g_Config.m_ClDummy)-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(),
(pThis->Client()->GameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), (pThis->Client()->GameTick(g_Config.m_ClDummy)-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(),
pThis->Client()->IntraGameTick()); pThis->Client()->IntraGameTick(g_Config.m_ClDummy));
} }
else else
{ {
s_Time = mix(pThis->m_LastLocalTick / (float)pThis->Client()->GameTickSpeed(), s_Time = mix(pThis->m_LastLocalTick / (float)pThis->Client()->GameTickSpeed(),
pThis->m_CurrentLocalTick / (float)pThis->Client()->GameTickSpeed(), pThis->m_CurrentLocalTick / (float)pThis->Client()->GameTickSpeed(),
pThis->Client()->IntraGameTick()); pThis->Client()->IntraGameTick(g_Config.m_ClDummy));
} }
} }
pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time+TimeOffset, pChannels); pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, s_Time+TimeOffset, pChannels);
@ -113,9 +113,9 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void
{ {
if(pItem->m_Version < 2 || pItem->m_Synchronized) if(pItem->m_Version < 2 || pItem->m_Synchronized)
{ {
s_Time = mix((pThis->Client()->PrevGameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), s_Time = mix((pThis->Client()->PrevGameTick(g_Config.m_ClDummy)-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(),
(pThis->Client()->GameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), (pThis->Client()->GameTick(g_Config.m_ClDummy)-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(),
pThis->Client()->IntraGameTick()); pThis->Client()->IntraGameTick(g_Config.m_ClDummy));
} }
else else
s_Time += pThis->LocalTime()-s_LastLocalTime; s_Time += pThis->LocalTime()-s_LastLocalTime;

View file

@ -103,9 +103,9 @@ void CMapSounds::OnRender()
static float s_Time = 0.0f; static float s_Time = 0.0f;
if(m_pClient->m_Snap.m_pGameInfoObj) // && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED)) if(m_pClient->m_Snap.m_pGameInfoObj) // && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED))
{ {
s_Time = mix((Client()->PrevGameTick()-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)Client()->GameTickSpeed(), s_Time = mix((Client()->PrevGameTick(g_Config.m_ClDummy)-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)Client()->GameTickSpeed(),
(Client()->GameTick()-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)Client()->GameTickSpeed(), (Client()->GameTick(g_Config.m_ClDummy)-m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)Client()->GameTickSpeed(),
Client()->IntraGameTick()); Client()->IntraGameTick(g_Config.m_ClDummy));
} }
float Offset = s_Time-pSource->m_pSource->m_TimeDelay; float Offset = s_Time-pSource->m_pSource->m_TimeDelay;
if(Offset >= 0.0f && g_Config.m_SndEnable && (g_Config.m_GfxHighDetail || !pSource->m_HighDetail)) if(Offset >= 0.0f && g_Config.m_SndEnable && (g_Config.m_GfxHighDetail || !pSource->m_HighDetail))

View file

@ -8,6 +8,7 @@
#include <engine/demo.h> #include <engine/demo.h>
#include <engine/friends.h> #include <engine/friends.h>
#include <engine/shared/config.h>
#include <game/voting.h> #include <game/voting.h>
#include <game/client/component.h> #include <game/client/component.h>

View file

@ -33,7 +33,7 @@ void CNamePlates::RenderNameplate(
if(ClientID >= 0 && ClientID < MAX_CLIENTS) if(ClientID >= 0 && ClientID < MAX_CLIENTS)
Position = m_pClient->m_aClients[ClientID].m_RenderPos; Position = m_pClient->m_aClients[ClientID].m_RenderPos;
else else
Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick()); Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
bool OtherTeam = m_pClient->IsOtherTeam(ClientID); bool OtherTeam = m_pClient->IsOtherTeam(ClientID);

View file

@ -97,7 +97,7 @@ void CPlayers::RenderHook(
float IntraTick = Intra; float IntraTick = Intra;
if(ClientID >= 0) if(ClientID >= 0)
IntraTick = (m_pClient->m_aClients[ClientID].m_IsPredicted) ? Client()->PredIntraGameTick() : Client()->IntraGameTick(); IntraTick = (m_pClient->m_aClients[ClientID].m_IsPredicted) ? Client()->PredIntraGameTick(g_Config.m_ClDummy) : Client()->IntraGameTick(g_Config.m_ClDummy);
bool OtherTeam = m_pClient->IsOtherTeam(ClientID); bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
@ -183,24 +183,24 @@ void CPlayers::RenderPlayer(
float IntraTick = Intra; float IntraTick = Intra;
if(ClientID >= 0) if(ClientID >= 0)
IntraTick = m_pClient->m_aClients[ClientID].m_IsPredicted ? Client()->PredIntraGameTick() : Client()->IntraGameTick(); IntraTick = m_pClient->m_aClients[ClientID].m_IsPredicted ? Client()->PredIntraGameTick(g_Config.m_ClDummy) : Client()->IntraGameTick(g_Config.m_ClDummy);
static float s_LastGameTickTime = Client()->GameTickTime(); static float s_LastGameTickTime = Client()->GameTickTime(g_Config.m_ClDummy);
static float s_LastPredIntraTick = Client()->PredIntraGameTick(); static float s_LastPredIntraTick = Client()->PredIntraGameTick(g_Config.m_ClDummy);
if(m_pClient->m_Snap.m_pGameInfoObj && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED)) if(m_pClient->m_Snap.m_pGameInfoObj && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED))
{ {
s_LastGameTickTime = Client()->GameTickTime(); s_LastGameTickTime = Client()->GameTickTime(g_Config.m_ClDummy);
s_LastPredIntraTick = Client()->PredIntraGameTick(); s_LastPredIntraTick = Client()->PredIntraGameTick(g_Config.m_ClDummy);
} }
bool PredictLocalWeapons = false; bool PredictLocalWeapons = false;
float AttackTime = (Client()->PrevGameTick() - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(); float AttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
float LastAttackTime = (Client()->PrevGameTick() - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime; float LastAttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime;
if(m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire()) if(m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire())
{ {
PredictLocalWeapons = true; PredictLocalWeapons = true;
AttackTime = (Client()->PredIntraGameTick() + (Client()->PredGameTick() - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED; AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
LastAttackTime = (s_LastPredIntraTick + (Client()->PredGameTick() - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED; LastAttackTime = (s_LastPredIntraTick + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
} }
float AttackTicksPassed = AttackTime*SERVER_TICK_SPEED; float AttackTicksPassed = AttackTime*SERVER_TICK_SPEED;
@ -215,7 +215,7 @@ void CPlayers::RenderPlayer(
float AngleIntraTick = IntraTick; float AngleIntraTick = IntraTick;
// using unpredicted angle when rendering other players in-game // using unpredicted angle when rendering other players in-game
if(ClientID >= 0) if(ClientID >= 0)
AngleIntraTick = Client()->IntraGameTick(); AngleIntraTick = Client()->IntraGameTick(g_Config.m_ClDummy);
// If the player moves their weapon through top, then change // If the player moves their weapon through top, then change
// the end angle by 2*Pi, so that the mix function will use the // the end angle by 2*Pi, so that the mix function will use the
// short path and not the long one. // short path and not the long one.
@ -522,7 +522,7 @@ void CPlayers::RenderPlayer(
GhostPosition = mix( GhostPosition = mix(
vec2(m_pClient->m_Snap.m_aCharacters[ClientID].m_Prev.m_X, m_pClient->m_Snap.m_aCharacters[ClientID].m_Prev.m_Y), vec2(m_pClient->m_Snap.m_aCharacters[ClientID].m_Prev.m_X, m_pClient->m_Snap.m_aCharacters[ClientID].m_Prev.m_Y),
vec2(m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_X, m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Y), vec2(m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_X, m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur.m_Y),
Client()->IntraGameTick()); Client()->IntraGameTick(g_Config.m_ClDummy));
CTeeRenderInfo Ghost = RenderInfo; CTeeRenderInfo Ghost = RenderInfo;
RenderTools()->RenderTee(&State, &Ghost, Player.m_Emote, Direction, GhostPosition, 0.5f); // render ghost RenderTools()->RenderTee(&State, &Ghost, Player.m_Emote, Direction, GhostPosition, 0.5f); // render ghost
@ -590,12 +590,12 @@ void CPlayers::RenderPlayer(
Graphics()->QuadsSetRotation(0); Graphics()->QuadsSetRotation(0);
} }
if(g_Config.m_ClShowEmotes && m_pClient->m_aClients[ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[ClientID].m_EmoticonStart <= Client()->GameTick() && m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick()) if(g_Config.m_ClShowEmotes && m_pClient->m_aClients[ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[ClientID].m_EmoticonStart <= Client()->GameTick(g_Config.m_ClDummy) && m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick(g_Config.m_ClDummy))
{ {
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id);
int SinceStart = Client()->GameTick() - m_pClient->m_aClients[ClientID].m_EmoticonStart; int SinceStart = Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aClients[ClientID].m_EmoticonStart;
int FromEnd = m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() - Client()->GameTick(); int FromEnd = m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() - Client()->GameTick(g_Config.m_ClDummy);
float a = 1; float a = 1;

View file

@ -64,8 +64,8 @@ void CRaceDemo::OnNewSnapshot()
int RaceTick = -m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer; int RaceTick = -m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer;
// start the demo // start the demo
bool ForceStart = ServerControl && s_LastRaceTick != RaceTick && Client()->GameTick() - RaceTick < Client()->GameTickSpeed(); bool ForceStart = ServerControl && s_LastRaceTick != RaceTick && Client()->GameTick(g_Config.m_ClDummy) - RaceTick < Client()->GameTickSpeed();
bool AllowRestart = (m_AllowRestart || ForceStart) && m_RaceStartTick + 10 * Client()->GameTickSpeed() < Client()->GameTick(); bool AllowRestart = (m_AllowRestart || ForceStart) && m_RaceStartTick + 10 * Client()->GameTickSpeed() < Client()->GameTick(g_Config.m_ClDummy);
if(m_RaceState == RACE_IDLE || m_RaceState == RACE_PREPARE || (m_RaceState == RACE_STARTED && AllowRestart)) if(m_RaceState == RACE_IDLE || m_RaceState == RACE_PREPARE || (m_RaceState == RACE_STARTED && AllowRestart))
{ {
vec2 PrevPos = vec2(m_pClient->m_Snap.m_pLocalPrevCharacter->m_X, m_pClient->m_Snap.m_pLocalPrevCharacter->m_Y); vec2 PrevPos = vec2(m_pClient->m_Snap.m_pLocalPrevCharacter->m_X, m_pClient->m_Snap.m_pLocalPrevCharacter->m_Y);
@ -80,7 +80,7 @@ void CRaceDemo::OnNewSnapshot()
GetPath(m_aTmpFilename, sizeof(m_aTmpFilename)); GetPath(m_aTmpFilename, sizeof(m_aTmpFilename));
Client()->RaceRecord_Start(m_aTmpFilename); Client()->RaceRecord_Start(m_aTmpFilename);
} }
m_RaceStartTick = Client()->GameTick(); m_RaceStartTick = Client()->GameTick(g_Config.m_ClDummy);
m_RaceState = RACE_STARTED; m_RaceState = RACE_STARTED;
} }
} }
@ -90,19 +90,19 @@ void CRaceDemo::OnNewSnapshot()
{ {
GetPath(m_aTmpFilename, sizeof(m_aTmpFilename)); GetPath(m_aTmpFilename, sizeof(m_aTmpFilename));
Client()->RaceRecord_Start(m_aTmpFilename); Client()->RaceRecord_Start(m_aTmpFilename);
m_RaceStartTick = Client()->GameTick(); m_RaceStartTick = Client()->GameTick(g_Config.m_ClDummy);
m_RaceState = RACE_PREPARE; m_RaceState = RACE_PREPARE;
} }
// stop recording if the player did not pass the start line after 20 seconds // stop recording if the player did not pass the start line after 20 seconds
if(m_RaceState == RACE_PREPARE && Client()->GameTick() - m_RaceStartTick >= Client()->GameTickSpeed() * 20) if(m_RaceState == RACE_PREPARE && Client()->GameTick(g_Config.m_ClDummy) - m_RaceStartTick >= Client()->GameTickSpeed() * 20)
{ {
StopRecord(); StopRecord();
m_RaceState = RACE_IDLE; m_RaceState = RACE_IDLE;
} }
// stop the demo // stop the demo
if(m_RaceState == RACE_FINISHED && m_RecordStopTick <= Client()->GameTick()) if(m_RaceState == RACE_FINISHED && m_RecordStopTick <= Client()->GameTick(g_Config.m_ClDummy))
StopRecord(m_Time); StopRecord(m_Time);
s_LastRaceTick = RaceFlag ? RaceTick : -1; s_LastRaceTick = RaceFlag ? RaceTick : -1;
@ -132,7 +132,7 @@ void CRaceDemo::OnMessage(int MsgType, void *pRawMsg)
if(Time > 0 && str_comp(aName, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName) == 0) if(Time > 0 && str_comp(aName, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName) == 0)
{ {
m_RaceState = RACE_FINISHED; m_RaceState = RACE_FINISHED;
m_RecordStopTick = Client()->GameTick() + Client()->GameTickSpeed(); m_RecordStopTick = Client()->GameTick(g_Config.m_ClDummy) + Client()->GameTickSpeed();
m_Time = Time; m_Time = Time;
} }
} }

View file

@ -333,7 +333,7 @@ void CStatboard::RenderGlobalStats()
} }
// FPM // FPM
{ {
float Fpm = pStats->GetFPM(Client()->GameTick(), Client()->GameTickSpeed()); float Fpm = pStats->GetFPM(Client()->GameTick(g_Config.m_ClDummy), Client()->GameTickSpeed());
str_format(aBuf, sizeof(aBuf), "%.1f", Fpm); str_format(aBuf, sizeof(aBuf), "%.1f", Fpm);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1); tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
@ -521,7 +521,7 @@ void CStatboard::FormatStats()
pStats->m_Suicides, // Suicides pStats->m_Suicides, // Suicides
fdratio, // fdratio fdratio, // fdratio
pStats->m_Frags - pStats->m_Deaths, // Net pStats->m_Frags - pStats->m_Deaths, // Net
pStats->GetFPM(Client()->GameTick(), Client()->GameTickSpeed()), // FPM pStats->GetFPM(Client()->GameTick(g_Config.m_ClDummy), Client()->GameTickSpeed()), // FPM
pStats->m_CurrentSpree, // CurSpree pStats->m_CurrentSpree, // CurSpree
pStats->m_BestSpree, // BestSpree pStats->m_BestSpree, // BestSpree
aWeaponFD, // WeaponFD aWeaponFD, // WeaponFD

View file

@ -536,24 +536,24 @@ void CGameClient::UpdatePositions()
// don't use predicted // don't use predicted
} }
else else
m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick()); m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
} }
else else
{ {
if(!(m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER)) if(!(m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER))
{ {
if(m_Snap.m_pLocalCharacter) if(m_Snap.m_pLocalCharacter)
m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick()); m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
} }
// else // else
// m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick()); // m_LocalCharacterPos = mix(m_PredictedPrevChar.m_Pos, m_PredictedChar.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
} }
} }
else if(m_Snap.m_pLocalCharacter && m_Snap.m_pLocalPrevCharacter) else if(m_Snap.m_pLocalCharacter && m_Snap.m_pLocalPrevCharacter)
{ {
m_LocalCharacterPos = mix( m_LocalCharacterPos = mix(
vec2(m_Snap.m_pLocalPrevCharacter->m_X, m_Snap.m_pLocalPrevCharacter->m_Y), vec2(m_Snap.m_pLocalPrevCharacter->m_X, m_Snap.m_pLocalPrevCharacter->m_Y),
vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y), Client()->IntraGameTick()); vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
} }
// spectator position // spectator position
@ -564,14 +564,14 @@ void CGameClient::UpdatePositions()
m_Snap.m_SpecInfo.m_Position = mix( m_Snap.m_SpecInfo.m_Position = mix(
vec2(m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Prev.m_X, m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Prev.m_Y), vec2(m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Prev.m_X, m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Prev.m_Y),
vec2(m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Cur.m_X, m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Cur.m_Y), vec2(m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Cur.m_X, m_Snap.m_aCharacters[m_Snap.m_SpecInfo.m_SpectatorID].m_Cur.m_Y),
Client()->IntraGameTick()); Client()->IntraGameTick(g_Config.m_ClDummy));
m_Snap.m_SpecInfo.m_UsePosition = true; m_Snap.m_SpecInfo.m_UsePosition = true;
} }
else if(m_Snap.m_pSpectatorInfo && ((Client()->State() == IClient::STATE_DEMOPLAYBACK && m_DemoSpecID == SPEC_FOLLOW) || (Client()->State() != IClient::STATE_DEMOPLAYBACK && m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW))) else if(m_Snap.m_pSpectatorInfo && ((Client()->State() == IClient::STATE_DEMOPLAYBACK && m_DemoSpecID == SPEC_FOLLOW) || (Client()->State() != IClient::STATE_DEMOPLAYBACK && m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW)))
{ {
if(m_Snap.m_pPrevSpectatorInfo) if(m_Snap.m_pPrevSpectatorInfo)
m_Snap.m_SpecInfo.m_Position = mix(vec2(m_Snap.m_pPrevSpectatorInfo->m_X, m_Snap.m_pPrevSpectatorInfo->m_Y), m_Snap.m_SpecInfo.m_Position = mix(vec2(m_Snap.m_pPrevSpectatorInfo->m_X, m_Snap.m_pPrevSpectatorInfo->m_Y),
vec2(m_Snap.m_pSpectatorInfo->m_X, m_Snap.m_pSpectatorInfo->m_Y), Client()->IntraGameTick()); vec2(m_Snap.m_pSpectatorInfo->m_X, m_Snap.m_pSpectatorInfo->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
else else
m_Snap.m_SpecInfo.m_Position = vec2(m_Snap.m_pSpectatorInfo->m_X, m_Snap.m_pSpectatorInfo->m_Y); m_Snap.m_SpecInfo.m_Position = vec2(m_Snap.m_pSpectatorInfo->m_X, m_Snap.m_pSpectatorInfo->m_Y);
m_Snap.m_SpecInfo.m_UsePosition = true; m_Snap.m_SpecInfo.m_UsePosition = true;
@ -772,7 +772,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, bool IsDummy)
// apply // apply
m_aClients[pMsg->m_ClientID].m_Emoticon = pMsg->m_Emoticon; m_aClients[pMsg->m_ClientID].m_Emoticon = pMsg->m_Emoticon;
m_aClients[pMsg->m_ClientID].m_EmoticonStart = Client()->GameTick(); m_aClients[pMsg->m_ClientID].m_EmoticonStart = Client()->GameTick(g_Config.m_ClDummy);
} }
else if(MsgId == NETMSGTYPE_SV_SOUNDGLOBAL) else if(MsgId == NETMSGTYPE_SV_SOUNDGLOBAL)
{ {
@ -1101,7 +1101,7 @@ void CGameClient::OnNewSnapshot()
#ifdef CONF_DEBUG #ifdef CONF_DEBUG
if(g_Config.m_DbgStress) if(g_Config.m_DbgStress)
{ {
if((Client()->GameTick()%100) == 0) if((Client()->GameTick(g_Config.m_ClDummy)%100) == 0)
{ {
char aMessage[64]; char aMessage[64];
int MsgLen = rand()%(sizeof(aMessage)-1); int MsgLen = rand()%(sizeof(aMessage)-1);
@ -1191,10 +1191,10 @@ void CGameClient::OnNewSnapshot()
{ {
m_Snap.m_aTeamSize[pInfo->m_Team]++; m_Snap.m_aTeamSize[pInfo->m_Team]++;
if(!m_aStats[pInfo->m_ClientID].IsActive()) if(!m_aStats[pInfo->m_ClientID].IsActive())
m_aStats[pInfo->m_ClientID].JoinGame(Client()->GameTick()); m_aStats[pInfo->m_ClientID].JoinGame(Client()->GameTick(g_Config.m_ClDummy));
} }
else if(m_aStats[pInfo->m_ClientID].IsActive()) else if(m_aStats[pInfo->m_ClientID].IsActive())
m_aStats[pInfo->m_ClientID].JoinSpec(Client()->GameTick()); m_aStats[pInfo->m_ClientID].JoinSpec(Client()->GameTick(g_Config.m_ClDummy));
} }
else if(Item.m_Type == NETOBJTYPE_DDNETPLAYER) else if(Item.m_Type == NETOBJTYPE_DDNETPLAYER)
@ -1215,7 +1215,7 @@ void CGameClient::OnNewSnapshot()
m_Snap.m_aCharacters[Item.m_ID].m_Prev = *((const CNetObj_Character *)pOld); m_Snap.m_aCharacters[Item.m_ID].m_Prev = *((const CNetObj_Character *)pOld);
// reuse the result from the previous evolve if the snapped character didn't change since the previous snapshot // reuse the result from the previous evolve if the snapped character didn't change since the previous snapshot
if(m_aClients[Item.m_ID].m_Evolved.m_Tick == Client()->PrevGameTick()) if(m_aClients[Item.m_ID].m_Evolved.m_Tick == Client()->PrevGameTick(g_Config.m_ClDummy))
{ {
if(mem_comp(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, &m_aClients[Item.m_ID].m_Snapped, sizeof(CNetObj_Character)) == 0) if(mem_comp(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, &m_aClients[Item.m_ID].m_Snapped, sizeof(CNetObj_Character)) == 0)
m_Snap.m_aCharacters[Item.m_ID].m_Prev = m_aClients[Item.m_ID].m_Evolved; m_Snap.m_aCharacters[Item.m_ID].m_Prev = m_aClients[Item.m_ID].m_Evolved;
@ -1224,9 +1224,9 @@ void CGameClient::OnNewSnapshot()
} }
if(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick) if(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick)
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, Client()->PrevGameTick()); Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, Client()->PrevGameTick(g_Config.m_ClDummy));
if(m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick) if(m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick)
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Cur, Client()->GameTick()); Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Cur, Client()->GameTick(g_Config.m_ClDummy));
m_aClients[Item.m_ID].m_Snapped = *((const CNetObj_Character *)pData); m_aClients[Item.m_ID].m_Snapped = *((const CNetObj_Character *)pData);
m_aClients[Item.m_ID].m_Evolved = m_Snap.m_aCharacters[Item.m_ID].m_Cur; m_aClients[Item.m_ID].m_Evolved = m_Snap.m_aCharacters[Item.m_ID].m_Cur;
@ -1315,14 +1315,14 @@ void CGameClient::OnNewSnapshot()
if(m_Snap.m_pGameDataObj->m_FlagCarrierRed == FLAG_TAKEN) if(m_Snap.m_pGameDataObj->m_FlagCarrierRed == FLAG_TAKEN)
{ {
if(m_FlagDropTick[TEAM_RED] == 0) if(m_FlagDropTick[TEAM_RED] == 0)
m_FlagDropTick[TEAM_RED] = Client()->GameTick(); m_FlagDropTick[TEAM_RED] = Client()->GameTick(g_Config.m_ClDummy);
} }
else if(m_FlagDropTick[TEAM_RED] != 0) else if(m_FlagDropTick[TEAM_RED] != 0)
m_FlagDropTick[TEAM_RED] = 0; m_FlagDropTick[TEAM_RED] = 0;
if(m_Snap.m_pGameDataObj->m_FlagCarrierBlue == FLAG_TAKEN) if(m_Snap.m_pGameDataObj->m_FlagCarrierBlue == FLAG_TAKEN)
{ {
if(m_FlagDropTick[TEAM_BLUE] == 0) if(m_FlagDropTick[TEAM_BLUE] == 0)
m_FlagDropTick[TEAM_BLUE] = Client()->GameTick(); m_FlagDropTick[TEAM_BLUE] = Client()->GameTick(g_Config.m_ClDummy);
} }
else if(m_FlagDropTick[TEAM_BLUE] != 0) else if(m_FlagDropTick[TEAM_BLUE] != 0)
m_FlagDropTick[TEAM_BLUE] = 0; m_FlagDropTick[TEAM_BLUE] = 0;
@ -1509,7 +1509,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()); Client()->IntraGameTick(g_Config.m_ClDummy));
m_pEffects->AirJump(Pos); m_pEffects->AirJump(Pos);
} }
@ -1562,10 +1562,10 @@ void CGameClient::OnPredict()
return; return;
// predict // predict
for(int Tick = Client()->GameTick() + 1; Tick <= Client()->PredGameTick(); Tick++) for(int Tick = Client()->GameTick(g_Config.m_ClDummy) + 1; Tick <= Client()->PredGameTick(g_Config.m_ClDummy); Tick++)
{ {
// fetch the previous characters // fetch the previous characters
if(Tick == Client()->PredGameTick()) if(Tick == Client()->PredGameTick(g_Config.m_ClDummy))
{ {
m_PrevPredictedWorld.CopyWorld(&m_PredictedWorld); m_PrevPredictedWorld.CopyWorld(&m_PredictedWorld);
m_PredictedPrevChar = pLocalChar->GetCore(); m_PredictedPrevChar = pLocalChar->GetCore();
@ -1575,7 +1575,7 @@ void CGameClient::OnPredict()
} }
// optionally allow some movement in freeze by not predicting freeze the last one to two ticks // optionally allow some movement in freeze by not predicting freeze the last one to two ticks
if(g_Config.m_ClPredictFreeze == 2 && Client()->PredGameTick() - 1 - Client()->PredGameTick()%2 <= Tick) if(g_Config.m_ClPredictFreeze == 2 && Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Client()->PredGameTick(g_Config.m_ClDummy)%2 <= Tick)
pLocalChar->m_CanMoveInFreeze = true; pLocalChar->m_CanMoveInFreeze = true;
// apply inputs and tick // apply inputs and tick
@ -1588,7 +1588,7 @@ void CGameClient::OnPredict()
m_PredictedWorld.Tick(); m_PredictedWorld.Tick();
// fetch the current characters // fetch the current characters
if(Tick == Client()->PredGameTick()) if(Tick == Client()->PredGameTick(g_Config.m_ClDummy))
{ {
m_PredictedChar = pLocalChar->GetCore(); m_PredictedChar = pLocalChar->GetCore();
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
@ -1629,7 +1629,7 @@ void CGameClient::OnPredict()
static vec2 s_aLastPos[MAX_CLIENTS] = {{0,0}}; static vec2 s_aLastPos[MAX_CLIENTS] = {{0,0}};
static bool s_aLastActive[MAX_CLIENTS] = {0}; static bool s_aLastActive[MAX_CLIENTS] = {0};
if(g_Config.m_ClAntiPingSmooth && Predict() && AntiPingPlayers() && m_NewTick && abs(m_PredictedTick - Client()->PredGameTick()) <= 1 && abs(Client()->GameTick() - Client()->PrevGameTick()) <= 2) if(g_Config.m_ClAntiPingSmooth && Predict() && AntiPingPlayers() && m_NewTick && abs(m_PredictedTick - Client()->PredGameTick(g_Config.m_ClDummy)) <= 1 && abs(Client()->GameTick(g_Config.m_ClDummy) - Client()->PrevGameTick(g_Config.m_ClDummy)) <= 2)
{ {
int PredTime = clamp(Client()->GetPredictionTime(), 0, 800); int PredTime = clamp(Client()->GetPredictionTime(), 0, 800);
float SmoothPace = 4 - 1.5f * PredTime/800.f; // smoothing pace (a lower value will make the smoothing quicker) float SmoothPace = 4 - 1.5f * PredTime/800.f; // smoothing pace (a lower value will make the smoothing quicker)
@ -1639,15 +1639,15 @@ void CGameClient::OnPredict()
{ {
if(!m_Snap.m_aCharacters[i].m_Active || i == m_Snap.m_LocalClientID || !s_aLastActive[i]) if(!m_Snap.m_aCharacters[i].m_Active || i == m_Snap.m_LocalClientID || !s_aLastActive[i])
continue; continue;
vec2 NewPos = (m_PredictedTick == Client()->PredGameTick()) ? m_aClients[i].m_Predicted.m_Pos : m_aClients[i].m_PrevPredicted.m_Pos; vec2 NewPos = (m_PredictedTick == Client()->PredGameTick(g_Config.m_ClDummy)) ? m_aClients[i].m_Predicted.m_Pos : m_aClients[i].m_PrevPredicted.m_Pos;
vec2 PredErr = (s_aLastPos[i] - NewPos)/(float)minimum(Client()->GetPredictionTime(), 200); vec2 PredErr = (s_aLastPos[i] - NewPos)/(float)minimum(Client()->GetPredictionTime(), 200);
if(in_range(length(PredErr), 0.05f, 5.f)) if(in_range(length(PredErr), 0.05f, 5.f))
{ {
vec2 PredPos = mix(m_aClients[i].m_PrevPredicted.m_Pos, m_aClients[i].m_Predicted.m_Pos, Client()->PredIntraGameTick()); vec2 PredPos = mix(m_aClients[i].m_PrevPredicted.m_Pos, m_aClients[i].m_Predicted.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
vec2 CurPos = mix( vec2 CurPos = 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_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()); Client()->IntraGameTick(g_Config.m_ClDummy));
vec2 RenderDiff = PredPos - aBeforeRender[i]; vec2 RenderDiff = PredPos - aBeforeRender[i];
vec2 PredDiff = PredPos - CurPos; vec2 PredDiff = PredPos - CurPos;
@ -1697,7 +1697,7 @@ void CGameClient::OnPredict()
s_aLastActive[i] = false; s_aLastActive[i] = false;
} }
if(g_Config.m_Debug && g_Config.m_ClPredict && m_PredictedTick == Client()->PredGameTick()) if(g_Config.m_Debug && g_Config.m_ClPredict && m_PredictedTick == Client()->PredGameTick(g_Config.m_ClDummy))
{ {
CNetObj_CharacterCore Before = {0}, Now = {0}, BeforePrev = {0}, NowPrev = {0}; CNetObj_CharacterCore Before = {0}, Now = {0}, BeforePrev = {0}, NowPrev = {0};
BeforeChar.Write(&Before); BeforeChar.Write(&Before);
@ -1718,7 +1718,7 @@ void CGameClient::OnPredict()
} }
} }
m_PredictedTick = Client()->PredGameTick(); m_PredictedTick = Client()->PredGameTick(g_Config.m_ClDummy);
if(m_NewPredictedTick) if(m_NewPredictedTick)
m_pGhost->OnNewPredictedSnapshot(); m_pGhost->OnNewPredictedSnapshot();
@ -1978,7 +1978,7 @@ int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2& NewPos2, in
CNetObj_Character Prev = m_Snap.m_aCharacters[i].m_Prev; CNetObj_Character Prev = m_Snap.m_aCharacters[i].m_Prev;
CNetObj_Character Player = m_Snap.m_aCharacters[i].m_Cur; CNetObj_Character Player = m_Snap.m_aCharacters[i].m_Cur;
vec2 Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), Client()->IntraGameTick()); vec2 Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
bool IsOneSuper = cData.m_Super || OwnClientData.m_Super; bool IsOneSuper = cData.m_Super || OwnClientData.m_Super;
bool IsOneSolo = cData.m_Solo || OwnClientData.m_Solo; bool IsOneSolo = cData.m_Solo || OwnClientData.m_Solo;
@ -2081,9 +2081,9 @@ void CGameClient::UpdatePrediction()
} }
// advance the gameworld to the current gametick // advance the gameworld to the current gametick
if(pLocalChar && abs(m_GameWorld.GameTick() - Client()->GameTick()) < SERVER_TICK_SPEED) if(pLocalChar && abs(m_GameWorld.GameTick() - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED)
{ {
for(int Tick = m_GameWorld.GameTick() + 1; Tick <= Client()->GameTick(); Tick++) for(int Tick = m_GameWorld.GameTick() + 1; Tick <= Client()->GameTick(g_Config.m_ClDummy); Tick++)
{ {
CNetObj_PlayerInput *pInput = (CNetObj_PlayerInput*) Client()->GetDirectInput(Tick); CNetObj_PlayerInput *pInput = (CNetObj_PlayerInput*) Client()->GetDirectInput(Tick);
if(pInput) if(pInput)
@ -2104,17 +2104,17 @@ void CGameClient::UpdatePrediction()
else else
{ {
// skip to current gametick // skip to current gametick
m_GameWorld.m_GameTick = Client()->GameTick(); m_GameWorld.m_GameTick = Client()->GameTick(g_Config.m_ClDummy);
if(pLocalChar) if(pLocalChar)
if(CNetObj_PlayerInput *pInput = (CNetObj_PlayerInput*) Client()->GetInput(Client()->GameTick())) if(CNetObj_PlayerInput *pInput = (CNetObj_PlayerInput*) Client()->GetInput(Client()->GameTick(g_Config.m_ClDummy)))
pLocalChar->SetInput(pInput); pLocalChar->SetInput(pInput);
} }
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i)) if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
{ {
m_aClients[i].m_PredPos[Client()->GameTick() % 200] = pChar->Core()->m_Pos; m_aClients[i].m_PredPos[Client()->GameTick(g_Config.m_ClDummy) % 200] = pChar->Core()->m_Pos;
m_aClients[i].m_PredTick[Client()->GameTick() % 200] = Client()->GameTick(); m_aClients[i].m_PredTick[Client()->GameTick(g_Config.m_ClDummy) % 200] = Client()->GameTick(g_Config.m_ClDummy);
} }
// update the local gameworld with the new snapshot // update the local gameworld with the new snapshot
@ -2161,7 +2161,7 @@ void CGameClient::UpdateRenderedCharacters()
vec2 UnpredPos = mix( vec2 UnpredPos = 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_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()); Client()->IntraGameTick(g_Config.m_ClDummy));
vec2 Pos = UnpredPos; vec2 Pos = UnpredPos;
if(Predict() && (i == m_Snap.m_LocalClientID || AntiPingPlayers())) if(Predict() && (i == m_Snap.m_LocalClientID || AntiPingPlayers()))
@ -2174,7 +2174,7 @@ void CGameClient::UpdateRenderedCharacters()
Pos = mix( Pos = mix(
vec2(m_aClients[i].m_RenderPrev.m_X, m_aClients[i].m_RenderPrev.m_Y), vec2(m_aClients[i].m_RenderPrev.m_X, m_aClients[i].m_RenderPrev.m_Y),
vec2(m_aClients[i].m_RenderCur.m_X, m_aClients[i].m_RenderCur.m_Y), vec2(m_aClients[i].m_RenderCur.m_X, m_aClients[i].m_RenderCur.m_Y),
m_aClients[i].m_IsPredicted ? Client()->PredIntraGameTick() : Client()->IntraGameTick()); m_aClients[i].m_IsPredicted ? Client()->PredIntraGameTick(g_Config.m_ClDummy) : Client()->IntraGameTick(g_Config.m_ClDummy));
if(i == m_Snap.m_LocalClientID) if(i == m_Snap.m_LocalClientID)
{ {
@ -2216,7 +2216,7 @@ void CGameClient::DetectStrongHook()
int ToPlayer = m_Snap.m_aCharacters[FromPlayer].m_Prev.m_HookedPlayer; int ToPlayer = m_Snap.m_aCharacters[FromPlayer].m_Prev.m_HookedPlayer;
if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer) if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer)
continue; continue;
if(abs(minimum(s_LastUpdateTick[ToPlayer], s_LastUpdateTick[FromPlayer]) - Client()->GameTick()) < SERVER_TICK_SPEED/4) if(abs(minimum(s_LastUpdateTick[ToPlayer], s_LastUpdateTick[FromPlayer]) - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED/4)
continue; continue;
if(m_Snap.m_aCharacters[FromPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_Direction if(m_Snap.m_aCharacters[FromPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_Direction
|| m_Snap.m_aCharacters[ToPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[ToPlayer].m_Cur.m_Direction) || m_Snap.m_aCharacters[ToPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[ToPlayer].m_Cur.m_Direction)
@ -2227,7 +2227,7 @@ void CGameClient::DetectStrongHook()
if(!pFromCharWorld || !pToCharWorld) if(!pFromCharWorld || !pToCharWorld)
continue; continue;
s_LastUpdateTick[ToPlayer] = s_LastUpdateTick[FromPlayer] = Client()->GameTick(); s_LastUpdateTick[ToPlayer] = s_LastUpdateTick[FromPlayer] = Client()->GameTick(g_Config.m_ClDummy);
float PredictErr[2]; float PredictErr[2];
CCharacterCore ToCharCur; CCharacterCore ToCharCur;
@ -2248,7 +2248,7 @@ void CGameClient::DetectStrongHook()
World.m_apCharacters[FromPlayer] = &FromChar; World.m_apCharacters[FromPlayer] = &FromChar;
FromChar.Read(&m_Snap.m_aCharacters[FromPlayer].m_Prev); FromChar.Read(&m_Snap.m_aCharacters[FromPlayer].m_Prev);
for(int Tick = Client()->PrevGameTick(); Tick < Client()->GameTick(); Tick++) for(int Tick = Client()->PrevGameTick(g_Config.m_ClDummy); Tick < Client()->GameTick(g_Config.m_ClDummy); Tick++)
{ {
if(dir == 0) if(dir == 0)
{ {
@ -2294,7 +2294,7 @@ void CGameClient::DetectStrongHook()
vec2 CGameClient::GetSmoothPos(int ClientID) vec2 CGameClient::GetSmoothPos(int ClientID)
{ {
vec2 Pos = mix(m_aClients[ClientID].m_PrevPredicted.m_Pos, m_aClients[ClientID].m_Predicted.m_Pos, Client()->PredIntraGameTick()); vec2 Pos = mix(m_aClients[ClientID].m_PrevPredicted.m_Pos, m_aClients[ClientID].m_Predicted.m_Pos, Client()->PredIntraGameTick(g_Config.m_ClDummy));
int64 Now = time_get(); int64 Now = time_get();
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
{ {
@ -2306,7 +2306,7 @@ vec2 CGameClient::GetSmoothPos(int ClientID)
int SmoothTick; int SmoothTick;
float SmoothIntra; float SmoothIntra;
Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount); Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount);
if(SmoothTick > 0 && m_aClients[ClientID].m_PredTick[(SmoothTick-1) % 200] >= Client()->PrevGameTick() && m_aClients[ClientID].m_PredTick[SmoothTick % 200] <= Client()->PredGameTick()) if(SmoothTick > 0 && m_aClients[ClientID].m_PredTick[(SmoothTick-1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientID].m_PredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy))
Pos[i] = mix(m_aClients[ClientID].m_PredPos[(SmoothTick-1) % 200][i], m_aClients[ClientID].m_PredPos[SmoothTick % 200][i], SmoothIntra); Pos[i] = mix(m_aClients[ClientID].m_PredPos[(SmoothTick-1) % 200][i], m_aClients[ClientID].m_PredPos[SmoothTick % 200][i], SmoothIntra);
} }
} }

View file

@ -7,6 +7,7 @@
#include <base/vmath.h> #include <base/vmath.h>
#include <engine/client.h> #include <engine/client.h>
#include <engine/console.h> #include <engine/console.h>
#include <engine/shared/config.h>
#include <game/layers.h> #include <game/layers.h>
#include <game/localization.h> #include <game/localization.h>
#include <game/gamecore.h> #include <game/gamecore.h>