Skip to content

Commit

Permalink
Player reset zoom & speed. (#541)
Browse files Browse the repository at this point in the history
* RemoveAllItems: reset (update) player speed.
* RemoveAllItems: reset player zoom.
* RemovePlayerItem: reset player zoom & speed
* CFuncTank->StartControl: fully reset zoom.
  • Loading branch information
Vaqtincha authored May 27, 2020
1 parent 0dd9b97 commit 27c15c3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion regamedll/dlls/func_tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController)
#endif

#ifdef REGAMEDLL_FIXES
m_pController->m_iFOV = DEFAULT_FOV;
// if (m_pController->m_iFOV != DEFAULT_FOV)
{
m_pController->pev->fov = m_pController->m_iFOV = m_pController->m_iLastZoom = DEFAULT_FOV;
m_pController->m_bResumeZoom = false;
}
#endif
}

Expand Down
21 changes: 21 additions & 0 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,14 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit)
pev->viewmodel = 0;
pev->weaponmodel = 0;

#ifdef REGAMEDLL_FIXES
// if (m_iFOV != DEFAULT_FOV)
{
pev->fov = m_iFOV = m_iLastZoom = DEFAULT_FOV;
m_bResumeZoom = false;
}
#endif

if (removeSuit)
pev->weapons = 0;
else
Expand All @@ -1611,6 +1619,8 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit)

m_bHasNightVision = false;
SendItemStatus();

ResetMaxSpeed();
#endif

// send Selected Weapon Message to our client
Expand Down Expand Up @@ -6669,6 +6679,17 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(RemovePlayerItem)(CBasePlayerItem *pItem)
if (m_pActiveItem == pItem)
{
ResetAutoaim();

#ifdef REGAMEDLL_FIXES
// if (m_iFOV != DEFAULT_FOV)
{
pev->fov = m_iFOV = m_iLastZoom = DEFAULT_FOV;
m_bResumeZoom = false;

ResetMaxSpeed();
}
#endif

pItem->pev->nextthink = 0;

pItem->SetThink(nullptr);
Expand Down

0 comments on commit 27c15c3

Please sign in to comment.