Optimize PlayerBlind (#171)

* Optimize PlayerBlind
This commit is contained in:
In-line 2017-07-06 21:37:44 +04:00 committed by Dmitry Novikov
parent 721624bf92
commit 09e714e339

View File

@ -902,17 +902,17 @@ void EXT_FUNC PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars
{ {
UTIL_ScreenFade(pPlayer, color, fadeTime, fadeHold, alpha, 0); UTIL_ScreenFade(pPlayer, color, fadeTime, fadeHold, alpha, 0);
if (!fadetoblack.value)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i) for (int i = 1; i <= gpGlobals->maxClients; ++i)
{ {
CBasePlayer *pObserver = UTIL_PlayerByIndex(i); CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
if (!pObserver || !pObserver->IsObservingPlayer(pPlayer)) if (pObserver && pObserver->IsObservingPlayer(pPlayer))
continue;
if (!fadetoblack.value)
{ {
UTIL_ScreenFade(pObserver, color, fadeTime, fadeHold, alpha, 0); UTIL_ScreenFade(pObserver, color, fadeTime, fadeHold, alpha, 0);
} }
} }
}
pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha); pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha);