mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
More Target cleanup
This commit is contained in:
parent
28ee13949b
commit
fa8b8b9324
|
@ -1227,8 +1227,8 @@ void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtende
|
||||||
mem_zero(&m_SavedInput, sizeof(m_SavedInput));
|
mem_zero(&m_SavedInput, sizeof(m_SavedInput));
|
||||||
m_Input.m_Direction = m_SavedInput.m_Direction = m_Core.m_Direction;
|
m_Input.m_Direction = m_SavedInput.m_Direction = m_Core.m_Direction;
|
||||||
m_Input.m_Hook = m_SavedInput.m_Hook = (m_Core.m_HookState != HOOK_IDLE);
|
m_Input.m_Hook = m_SavedInput.m_Hook = (m_Core.m_HookState != HOOK_IDLE);
|
||||||
m_Input.m_TargetX = cosf(pChar->m_Angle / 256.0f);
|
m_Input.m_TargetX = m_SavedInput.m_TargetX = cosf(pChar->m_Angle / 256.0f) * 256.0f;
|
||||||
m_Input.m_TargetY = sinf(pChar->m_Angle / 256.0f);
|
m_Input.m_TargetY = m_SavedInput.m_TargetY = sinf(pChar->m_Angle / 256.0f) * 256.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// in most cases the reload timer can be determined from the last attack tick
|
// in most cases the reload timer can be determined from the last attack tick
|
||||||
|
|
|
@ -118,7 +118,15 @@ public:
|
||||||
void SetNinjaActivationTick(int ActivationTick) { m_Ninja.m_ActivationTick = ActivationTick; };
|
void SetNinjaActivationTick(int ActivationTick) { m_Ninja.m_ActivationTick = ActivationTick; };
|
||||||
void SetNinjaCurrentMoveTime(int CurrentMoveTime) { m_Ninja.m_CurrentMoveTime = CurrentMoveTime; };
|
void SetNinjaCurrentMoveTime(int CurrentMoveTime) { m_Ninja.m_CurrentMoveTime = CurrentMoveTime; };
|
||||||
int GetCID() { return m_ID; }
|
int GetCID() { return m_ID; }
|
||||||
void SetInput(CNetObj_PlayerInput *pNewInput) { m_LatestInput = m_Input = *pNewInput; };
|
void SetInput(CNetObj_PlayerInput *pNewInput)
|
||||||
|
{
|
||||||
|
m_LatestInput = m_Input = *pNewInput;
|
||||||
|
// it is not allowed to aim in the center
|
||||||
|
if(m_Input.m_TargetX == 0 && m_Input.m_TargetY == 0)
|
||||||
|
{
|
||||||
|
m_Input.m_TargetY = m_LatestInput.m_TargetY = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
int GetJumped() { return m_Core.m_Jumped; }
|
int GetJumped() { return m_Core.m_Jumped; }
|
||||||
int GetAttackTick() { return m_AttackTick; }
|
int GetAttackTick() { return m_AttackTick; }
|
||||||
int GetStrongWeakID() { return m_StrongWeakID; }
|
int GetStrongWeakID() { return m_StrongWeakID; }
|
||||||
|
|
|
@ -475,6 +475,7 @@ void CGameWorld::NetObjEnd(int LocalID)
|
||||||
pHookedChar->m_Pos = pHookedChar->m_Core.m_Pos = pChar->m_Core.m_HookPos;
|
pHookedChar->m_Pos = pHookedChar->m_Core.m_Pos = pChar->m_Core.m_HookPos;
|
||||||
pHookedChar->m_Core.m_Vel = vec2(0, 0);
|
pHookedChar->m_Core.m_Vel = vec2(0, 0);
|
||||||
mem_zero(&pHookedChar->m_SavedInput, sizeof(pHookedChar->m_SavedInput));
|
mem_zero(&pHookedChar->m_SavedInput, sizeof(pHookedChar->m_SavedInput));
|
||||||
|
pHookedChar->m_SavedInput.m_TargetY = -1;
|
||||||
pHookedChar->m_KeepHooked = true;
|
pHookedChar->m_KeepHooked = true;
|
||||||
pHookedChar->m_MarkedForDestroy = false;
|
pHookedChar->m_MarkedForDestroy = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
||||||
m_Pos = Pos;
|
m_Pos = Pos;
|
||||||
|
|
||||||
mem_zero(&m_LatestPrevPrevInput, sizeof(m_LatestPrevPrevInput));
|
mem_zero(&m_LatestPrevPrevInput, sizeof(m_LatestPrevPrevInput));
|
||||||
|
m_LatestPrevPrevInput.m_TargetY = -1;
|
||||||
m_SpawnTick = Server()->Tick();
|
m_SpawnTick = Server()->Tick();
|
||||||
m_WeaponChangeTick = Server()->Tick();
|
m_WeaponChangeTick = Server()->Tick();
|
||||||
Antibot()->OnSpawn(m_pPlayer->GetCID());
|
Antibot()->OnSpawn(m_pPlayer->GetCID());
|
||||||
|
|
Loading…
Reference in a new issue