always use inferred tuning instead of current one

This commit is contained in:
Freddie Wang 2021-04-23 13:53:54 +08:00
parent f18a47ae30
commit b1051d2398
2 changed files with 9 additions and 8 deletions

View file

@ -29,7 +29,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
// get positions
float Curvature = 0;
float Speed = 0;
CTuningParams Tuning = pCurrent->m_TuneZone ? GameClient()->GetTunes(pCurrent->m_TuneZone) : m_pClient->m_Tuning[g_Config.m_ClDummy];
CTuningParams Tuning = GameClient()->GetTunes(pCurrent->m_TuneZone);
if(CurWeapon == WEAPON_GRENADE)
{
Curvature = Tuning.m_GrenadeCurvature;
@ -236,6 +236,8 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent, bool IsPredicted)
RGB = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClLaserInnerColor));
ColorRGBA InnerColor(RGB.r, RGB.g, RGB.b, 1.0f);
int TuneZone = GameClient()->m_GameWorld.m_WorldConfig.m_UseTuneZones ? Collision()->IsTune(Collision()->GetMapIndex(From)) : 0;
vec2 Dir;
if(Len > 0)
{
@ -247,7 +249,7 @@ void CItems::RenderLaser(const struct CNetObj_Laser *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->m_Tuning[g_Config.m_ClDummy].m_LaserBounceDelay;
float a = Ms / m_pClient->GetTunes(TuneZone).m_LaserBounceDelay;
a = clamp(a, 0.0f, 1.0f);
float Ia = 1 - a;
@ -503,7 +505,7 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
// get positions
float Curvature = 0;
float Speed = 0;
CTuningParams Tuning = pCurrent->m_TuneZone ? GameClient()->GetTunes(pCurrent->m_TuneZone) : m_pClient->m_Tuning[g_Config.m_ClDummy];
CTuningParams Tuning = GameClient()->GetTunes(pCurrent->m_TuneZone);
if(pCurrent->m_Type == WEAPON_GRENADE)
{

View file

@ -2222,11 +2222,10 @@ void CGameClient::UpdatePrediction()
m_GameWorld.m_WorldConfig.m_IsSolo = !m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData && !m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && !m_Tuning[g_Config.m_ClDummy].m_PlayerHooking;
// update the tuning/tunezone at the local character position with the latest tunings received before the new snapshot
int TuneZone = Collision()->IsTune(Collision()->GetMapIndex(vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y)));
if(!TuneZone || !m_GameWorld.m_WorldConfig.m_UseTuneZones)
m_GameWorld.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
else
m_GameWorld.TuningList()[TuneZone] = m_GameWorld.m_Core.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
int TuneZone = 0;
if(m_GameWorld.m_WorldConfig.m_UseTuneZones)
TuneZone = Collision()->IsTune(Collision()->GetMapIndex(vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y)));
m_GameWorld.TuningList()[TuneZone] = m_GameWorld.m_Core.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
// if ddnetcharacter is available, ignore server-wide tunings for hook and collision
if(m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData)