Fixed m_bDrawPlayerModelExternally drawing the weapon's viewmodel instead of its worldmodel

This commit is contained in:
Blixibon 2021-11-14 11:58:11 -06:00
parent 1c3b374d9e
commit 61bbe331dd

View File

@ -502,25 +502,44 @@ int C_BaseCombatWeapon::DrawModel( int flags )
// check if local player chases owner of this weapon in first person // check if local player chases owner of this weapon in first person
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer(); C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
if ( localplayer && localplayer->IsObserver() && GetOwner() ) if ( localplayer )
{ {
#ifdef MAPBASE #ifdef MAPBASE
if (localplayer->m_bDrawPlayerModelExternally) if (localplayer->m_bDrawPlayerModelExternally)
{ {
// If this isn't the main view, draw the weapon. // If this isn't the main view, draw the weapon.
view_id_t viewID = CurrentViewID(); view_id_t viewID = CurrentViewID();
if (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA) if (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA && (viewID != VIEW_SHADOW_DEPTH_TEXTURE || !localplayer->IsEffectActive(EF_DIMLIGHT)))
return BaseClass::DrawModel( flags ); {
// TODO: Is this inefficient?
int nModelIndex = GetModelIndex();
int nWorldModelIndex = GetWorldModelIndex();
if (nModelIndex != nWorldModelIndex)
{
SetModelIndex(nWorldModelIndex);
}
int iDraw = BaseClass::DrawModel(flags);
if (nModelIndex != nWorldModelIndex)
{
SetModelIndex(nModelIndex);
}
return iDraw;
}
} }
#endif #endif
if ( localplayer->IsObserver() && GetOwner() )
// don't draw weapon if chasing this guy as spectator {
// we don't check that in ShouldDraw() since this may change // don't draw weapon if chasing this guy as spectator
// without notification // we don't check that in ShouldDraw() since this may change
// without notification
if ( localplayer->GetObserverMode() == OBS_MODE_IN_EYE && if ( localplayer->GetObserverMode() == OBS_MODE_IN_EYE &&
localplayer->GetObserverTarget() == GetOwner() ) localplayer->GetObserverTarget() == GetOwner() )
return false; return false;
}
} }
return BaseClass::DrawModel( flags ); return BaseClass::DrawModel( flags );