mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Move OnDirectInput functionality into WeaponTick
This commit is contained in:
parent
0d84dcbaef
commit
7bdf2e644f
|
@ -332,7 +332,6 @@ public:
|
||||||
virtual void OnClientPrepareInput(int ClientId, void *pInput) = 0;
|
virtual void OnClientPrepareInput(int ClientId, void *pInput) = 0;
|
||||||
virtual void OnClientFreshInput(int ClientId, void *pInput) = 0;
|
virtual void OnClientFreshInput(int ClientId, void *pInput) = 0;
|
||||||
virtual void OnClientPredictedInput(int ClientId, void *pInput) = 0;
|
virtual void OnClientPredictedInput(int ClientId, void *pInput) = 0;
|
||||||
virtual void OnClientPredictedEarlyInput(int ClientId, void *pInput) = 0;
|
|
||||||
|
|
||||||
virtual bool IsClientReady(int ClientId) const = 0;
|
virtual bool IsClientReady(int ClientId) const = 0;
|
||||||
virtual bool IsClientPlayer(int ClientId) const = 0;
|
virtual bool IsClientPlayer(int ClientId) const = 0;
|
||||||
|
|
|
@ -694,28 +694,6 @@ void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
|
||||||
mem_copy(&m_SavedInput, &m_Input, sizeof(m_SavedInput));
|
mem_copy(&m_SavedInput, &m_Input, sizeof(m_SavedInput));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
|
|
||||||
{
|
|
||||||
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
|
||||||
mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
|
|
||||||
m_NumInputs++;
|
|
||||||
|
|
||||||
// it is not allowed to aim in the center
|
|
||||||
if(m_LatestInput.m_TargetX == 0 && m_LatestInput.m_TargetY == 0)
|
|
||||||
m_LatestInput.m_TargetY = -1;
|
|
||||||
|
|
||||||
Antibot()->OnDirectInput(m_pPlayer->GetCid());
|
|
||||||
|
|
||||||
if(m_NumInputs > 1 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
|
|
||||||
{
|
|
||||||
HandleWeaponSwitch();
|
|
||||||
FireWeapon(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem_copy(&m_LatestPrevPrevInput, &m_LatestPrevInput, sizeof(m_LatestInput));
|
|
||||||
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacter::ReleaseHook()
|
void CCharacter::ReleaseHook()
|
||||||
{
|
{
|
||||||
m_Core.SetHookedPlayer(-1);
|
m_Core.SetHookedPlayer(-1);
|
||||||
|
@ -742,7 +720,24 @@ void CCharacter::ResetInput()
|
||||||
|
|
||||||
void CCharacter::WeaponTick()
|
void CCharacter::WeaponTick()
|
||||||
{
|
{
|
||||||
OnDirectInput(&m_Input);
|
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
||||||
|
mem_copy(&m_LatestInput, &m_Input, sizeof(m_LatestInput));
|
||||||
|
m_NumInputs++;
|
||||||
|
|
||||||
|
// it is not allowed to aim in the center
|
||||||
|
if(m_LatestInput.m_TargetX == 0 && m_LatestInput.m_TargetY == 0)
|
||||||
|
m_LatestInput.m_TargetY = -1;
|
||||||
|
|
||||||
|
Antibot()->OnDirectInput(m_pPlayer->GetCid());
|
||||||
|
|
||||||
|
if(m_NumInputs > 1 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
|
||||||
|
{
|
||||||
|
HandleWeaponSwitch();
|
||||||
|
FireWeapon(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_copy(&m_LatestPrevPrevInput, &m_LatestPrevInput, sizeof(m_LatestInput));
|
||||||
|
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacter::PreTick()
|
void CCharacter::PreTick()
|
||||||
|
|
|
@ -61,7 +61,6 @@ public:
|
||||||
void HandleJetpack();
|
void HandleJetpack();
|
||||||
|
|
||||||
void OnPredictedInput(CNetObj_PlayerInput *pNewInput);
|
void OnPredictedInput(CNetObj_PlayerInput *pNewInput);
|
||||||
void OnDirectInput(CNetObj_PlayerInput *pNewInput);
|
|
||||||
|
|
||||||
void ReleaseHook();
|
void ReleaseHook();
|
||||||
void ResetHook();
|
void ResetHook();
|
||||||
|
|
|
@ -315,7 +315,6 @@ public:
|
||||||
void OnClientPrepareInput(int ClientId, void *pInput) override;
|
void OnClientPrepareInput(int ClientId, void *pInput) override;
|
||||||
void OnClientFreshInput(int ClientId, void *pInput) override;
|
void OnClientFreshInput(int ClientId, void *pInput) override;
|
||||||
void OnClientPredictedInput(int ClientId, void *pInput) override;
|
void OnClientPredictedInput(int ClientId, void *pInput) override;
|
||||||
void OnClientPredictedEarlyInput(int ClientId, void *pInput) override;
|
|
||||||
|
|
||||||
void TeehistorianRecordAntibot(const void *pData, int DataSize) override;
|
void TeehistorianRecordAntibot(const void *pData, int DataSize) override;
|
||||||
void TeehistorianRecordPlayerJoin(int ClientId, bool Sixup) override;
|
void TeehistorianRecordPlayerJoin(int ClientId, bool Sixup) override;
|
||||||
|
|
|
@ -499,7 +499,6 @@ void CPlayer::OnDisconnect()
|
||||||
m_Moderating = false;
|
m_Moderating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a input into the charecters active input to be used during the main phase of the game tick
|
|
||||||
void CPlayer::OnPlayerInput(CNetObj_PlayerInput *pNewInput)
|
void CPlayer::OnPlayerInput(CNetObj_PlayerInput *pNewInput)
|
||||||
{
|
{
|
||||||
m_PlayerFlags = pNewInput->m_PlayerFlags;
|
m_PlayerFlags = pNewInput->m_PlayerFlags;
|
||||||
|
|
Loading…
Reference in a new issue