Rename GetTunes to GetTuning and return const pointer

No need to copy all tuning parameters. Consistent naming with prediction code where `GetTuning` is also used.
This commit is contained in:
Robert Müller 2023-08-06 11:32:40 +02:00
parent b98d519744
commit 30d3d4f94c
2 changed files with 16 additions and 16 deletions

View file

@ -30,21 +30,21 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
// get positions
float Curvature = 0;
float Speed = 0;
CTuningParams Tuning = GameClient()->GetTunes(pCurrent->m_TuneZone);
const CTuningParams *pTuning = GameClient()->GetTuning(pCurrent->m_TuneZone);
if(CurWeapon == WEAPON_GRENADE)
{
Curvature = Tuning.m_GrenadeCurvature;
Speed = Tuning.m_GrenadeSpeed;
Curvature = pTuning->m_GrenadeCurvature;
Speed = pTuning->m_GrenadeSpeed;
}
else if(CurWeapon == WEAPON_SHOTGUN)
{
Curvature = Tuning.m_ShotgunCurvature;
Speed = Tuning.m_ShotgunSpeed;
Curvature = pTuning->m_ShotgunCurvature;
Speed = pTuning->m_ShotgunSpeed;
}
else if(CurWeapon == WEAPON_GUN)
{
Curvature = Tuning.m_GunCurvature;
Speed = Tuning.m_GunSpeed;
Curvature = pTuning->m_GunCurvature;
Speed = pTuning->m_GunSpeed;
}
bool LocalPlayerInGame = false;
@ -310,7 +310,7 @@ void CItems::RenderLaser(const CLaserData *pCurrent, bool IsPredicted)
else
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 a = Ms / m_pClient->GetTunes(TuneZone).m_LaserBounceDelay;
float a = Ms / m_pClient->GetTuning(TuneZone)->m_LaserBounceDelay;
a = clamp(a, 0.0f, 1.0f);
float Ia = 1 - a;
@ -600,22 +600,22 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
// get positions
float Curvature = 0;
float Speed = 0;
CTuningParams Tuning = GameClient()->GetTunes(pCurrent->m_TuneZone);
const CTuningParams *pTuning = GameClient()->GetTuning(pCurrent->m_TuneZone);
if(pCurrent->m_Type == WEAPON_GRENADE)
{
Curvature = Tuning.m_GrenadeCurvature;
Speed = Tuning.m_GrenadeSpeed;
Curvature = pTuning->m_GrenadeCurvature;
Speed = pTuning->m_GrenadeSpeed;
}
else if(pCurrent->m_Type == WEAPON_SHOTGUN)
{
Curvature = Tuning.m_ShotgunCurvature;
Speed = Tuning.m_ShotgunSpeed;
Curvature = pTuning->m_ShotgunCurvature;
Speed = pTuning->m_ShotgunSpeed;
}
else if(pCurrent->m_Type == WEAPON_GUN)
{
Curvature = Tuning.m_GunCurvature;
Speed = Tuning.m_GunSpeed;
Curvature = pTuning->m_GunCurvature;
Speed = pTuning->m_GunSpeed;
}
float Pt = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)SERVER_TICK_SPEED;

View file

@ -529,7 +529,7 @@ public:
bool AntiPingGunfire() { return AntiPingGrenade() && AntiPingWeapons() && g_Config.m_ClAntiPingGunfire; }
bool Predict() { return g_Config.m_ClPredict && !(m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER) && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && m_Snap.m_pLocalCharacter; }
bool PredictDummy() { return g_Config.m_ClPredictDummy && Client()->DummyConnected() && m_Snap.m_LocalClientID >= 0 && m_PredictedDummyID >= 0 && !m_aClients[m_PredictedDummyID].m_Paused; }
CTuningParams GetTunes(int i) { return m_aTuningList[i]; }
const CTuningParams *GetTuning(int i) { return &m_aTuningList[i]; }
CGameWorld m_GameWorld;
CGameWorld m_PredictedWorld;