mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
rename ReadCharacterCore back to Read; Do not overwrite predicted
CharacterCore with Snap Data
This commit is contained in:
parent
f6febca706
commit
1dacb3366b
|
@ -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