mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5592
5592: Do not overwrite predicteded CharacterCore with Snap Data r=def- a=C0D3D3V
Reverts this: 320e9e030f
I fist did that change to fix the weapon display in the new HUD. But it turned out that did not fix the Weapon display anyway (only partially on remote server but not local). And since we now have a better fix for the weapon display (by sending the correct weapon) we do no longer need to overwrite the predicted data.
rename ReadCharacterCore back to Read (Since we do not need ReadCharacter that I introduced)
fixes #5309
probably fixes #5559 (I can still not reproduce)
## 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 (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] 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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
commit
067e82057a
|
@ -1134,7 +1134,8 @@ void CGameClient::OnNewSnapshot()
|
|||
CCharacterCore TempCore = CCharacterCore();
|
||||
CTeamsCore TempTeams = CTeamsCore();
|
||||
TempCore.Init(&TempWorld, Collision(), &TempTeams);
|
||||
TempCore.ReadCharacter(pCharacter);
|
||||
TempCore.Read(pCharacter);
|
||||
TempCore.m_ActiveWeapon = pCharacter->m_Weapon;
|
||||
|
||||
while(pCharacter->m_Tick < Tick)
|
||||
{
|
||||
|
@ -1289,7 +1290,6 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_ID);
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_Cur = *((const CNetObj_Character *)pData);
|
||||
m_aClients[Item.m_ID].m_Predicted.ReadCharacter((const CNetObj_Character *)pData);
|
||||
if(pOld)
|
||||
{
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_Active = true;
|
||||
|
@ -1733,11 +1733,13 @@ void CGameClient::OnPredict()
|
|||
{
|
||||
if(m_Snap.m_pLocalCharacter)
|
||||
{
|
||||
m_PredictedChar.ReadCharacter(m_Snap.m_pLocalCharacter);
|
||||
m_PredictedChar.Read(m_Snap.m_pLocalCharacter);
|
||||
m_PredictedChar.m_ActiveWeapon = m_Snap.m_pLocalCharacter->m_Weapon;
|
||||
}
|
||||
if(m_Snap.m_pLocalPrevCharacter)
|
||||
{
|
||||
m_PredictedPrevChar.ReadCharacter(m_Snap.m_pLocalPrevCharacter);
|
||||
m_PredictedPrevChar.Read(m_Snap.m_pLocalPrevCharacter);
|
||||
m_PredictedPrevChar.m_ActiveWeapon = m_Snap.m_pLocalPrevCharacter->m_Weapon;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2521,7 +2523,7 @@ void CGameClient::DetectStrongHook()
|
|||
|
||||
float PredictErr[2];
|
||||
CCharacterCore ToCharCur;
|
||||
ToCharCur.ReadCharacterCore(&m_Snap.m_aCharacters[ToPlayer].m_Cur);
|
||||
ToCharCur.Read(&m_Snap.m_aCharacters[ToPlayer].m_Cur);
|
||||
|
||||
CWorldCore World;
|
||||
World.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
|
||||
|
@ -2531,12 +2533,12 @@ void CGameClient::DetectStrongHook()
|
|||
CCharacterCore ToChar = pFromCharWorld->GetCore();
|
||||
ToChar.Init(&World, Collision(), &m_Teams);
|
||||
World.m_apCharacters[ToPlayer] = &ToChar;
|
||||
ToChar.ReadCharacterCore(&m_Snap.m_aCharacters[ToPlayer].m_Prev);
|
||||
ToChar.Read(&m_Snap.m_aCharacters[ToPlayer].m_Prev);
|
||||
|
||||
CCharacterCore FromChar = pFromCharWorld->GetCore();
|
||||
FromChar.Init(&World, Collision(), &m_Teams);
|
||||
World.m_apCharacters[FromPlayer] = &FromChar;
|
||||
FromChar.ReadCharacterCore(&m_Snap.m_aCharacters[FromPlayer].m_Prev);
|
||||
FromChar.Read(&m_Snap.m_aCharacters[FromPlayer].m_Prev);
|
||||
|
||||
for(int Tick = Client()->PrevGameTick(g_Config.m_ClDummy); Tick < Client()->GameTick(g_Config.m_ClDummy); Tick++)
|
||||
{
|
||||
|
|
|
@ -1186,7 +1186,7 @@ void CCharacter::ResetPrediction()
|
|||
|
||||
void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtended, bool IsLocal)
|
||||
{
|
||||
m_Core.ReadCharacterCore((const CNetObj_CharacterCore *)pChar);
|
||||
m_Core.Read((const CNetObj_CharacterCore *)pChar);
|
||||
m_IsLocal = IsLocal;
|
||||
|
||||
if(pExtended)
|
||||
|
|
|
@ -539,7 +539,7 @@ void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
|
|||
pObjCore->m_Angle = m_Angle;
|
||||
}
|
||||
|
||||
void CCharacterCore::ReadCharacterCore(const CNetObj_CharacterCore *pObjCore)
|
||||
void CCharacterCore::Read(const CNetObj_CharacterCore *pObjCore)
|
||||
{
|
||||
m_Pos.x = pObjCore->m_X;
|
||||
m_Pos.y = pObjCore->m_Y;
|
||||
|
@ -557,11 +557,6 @@ void CCharacterCore::ReadCharacterCore(const CNetObj_CharacterCore *pObjCore)
|
|||
m_Angle = pObjCore->m_Angle;
|
||||
}
|
||||
|
||||
void CCharacterCore::ReadCharacter(const CNetObj_Character *pObjChar)
|
||||
{
|
||||
m_ActiveWeapon = pObjChar->m_Weapon;
|
||||
ReadCharacterCore((const CNetObj_CharacterCore *)pObjChar);
|
||||
}
|
||||
void CCharacterCore::ReadDDNet(const CNetObj_DDNetCharacter *pObjDDNet)
|
||||
{
|
||||
// Collision
|
||||
|
@ -621,7 +616,7 @@ void CCharacterCore::Quantize()
|
|||
{
|
||||
CNetObj_CharacterCore Core;
|
||||
Write(&Core);
|
||||
ReadCharacterCore(&Core);
|
||||
Read(&Core);
|
||||
}
|
||||
|
||||
void CCharacterCore::SetHookedPlayer(int HookedPlayer)
|
||||
|
|
|
@ -272,8 +272,7 @@ public:
|
|||
void Tick(bool UseInput);
|
||||
void Move();
|
||||
|
||||
void ReadCharacterCore(const CNetObj_CharacterCore *pObjCore);
|
||||
void ReadCharacter(const CNetObj_Character *pObjChar);
|
||||
void Read(const CNetObj_CharacterCore *pObjCore);
|
||||
void Write(CNetObj_CharacterCore *pObjCore);
|
||||
void Quantize();
|
||||
|
||||
|
|
Loading…
Reference in a new issue