mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-28 15:45:41 +03:00
Reduce code redundancy in observer.cpp (#872)
This commit is contained in:
parent
2f50f5ab9d
commit
e422a37d8b
@ -478,10 +478,19 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Observer_SetMode)(int iMode)
|
||||
// verify observer target again
|
||||
if (m_hObserverTarget)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
m_hObserverTarget = Observer_IsValidTarget( ENTINDEX(m_hObserverTarget->edict()), forcecamera != CAMERA_MODE_SPEC_ANYONE );
|
||||
#else
|
||||
CBasePlayer *pTarget = m_hObserverTarget;
|
||||
|
||||
if (pTarget == this || !pTarget || pTarget->has_disconnected || pTarget->GetObserverMode() != OBS_NONE || (pTarget->pev->effects & EF_NODRAW) || (forcecamera != CAMERA_MODE_SPEC_ANYONE && pTarget->m_iTeam != m_iTeam))
|
||||
if (pTarget == this
|
||||
|| !pTarget
|
||||
|| pTarget->has_disconnected
|
||||
|| pTarget->GetObserverMode() != OBS_NONE
|
||||
|| (pTarget->pev->effects & EF_NODRAW)
|
||||
|| (forcecamera != CAMERA_MODE_SPEC_ANYONE && pTarget->m_iTeam != m_iTeam))
|
||||
m_hObserverTarget = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
// set spectator mode
|
||||
|
Loading…
Reference in New Issue
Block a user