CVar mp_fadetoblack enhancement (close #463) (#471)

CVar  mp_fadetoblack enhancement
This commit is contained in:
Shorohov Sergey 2020-01-15 19:49:45 +03:00 committed by Dmitry Novikov
parent 3498422bb9
commit 2eba3b1186
3 changed files with 57 additions and 0 deletions

View File

@ -88,6 +88,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_buy_anywhere | 0 | 0 | 3 | When set, players can buy anywhere, not only in buyzones.<br/> `0` disabled.<br/>`1` both teams <br/>`2` only Terrorists team <br/>`3` only CT team |
| mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.<br/> `0` disabled<br/>`1` enabled |
| mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.<br/> `0` hide all map weapons.<br/>`1` enabled<br/>`NOTE`: Effect will work after round restart. |
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
</details>
## How to install zBot for CS 1.6?

8
dist/game.cfg vendored
View File

@ -374,3 +374,11 @@ mp_give_player_c4 1
//
// Default value: "1"
mp_weapons_allow_map_placed 1
// Observer's screen will fade to black on kill event or permanent.
// 0 - No fade
// 1 - Fade to black and won't be able to watch anybody
// 2 - fade to black only on kill moment.
//
// Default value: "0"
mp_fadetoblack 0

View File

@ -2063,6 +2063,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
pev->effects &= ~EF_DIMLIGHT;
#endif
#ifndef REGAMEDLL_ADD
if (fadetoblack.value == 0.0)
{
pev->iuser1 = OBS_CHASE_FREE;
@ -2078,6 +2079,53 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
UTIL_ScreenFade(this, Vector(0, 0, 0), 3, 3, 255, (FFADE_OUT | FFADE_STAYOUT));
}
#else
switch ((int)fadetoblack.value)
{
default:
{
pev->iuser1 = OBS_CHASE_FREE;
pev->iuser2 = ENTINDEX(edict());
pev->iuser3 = ENTINDEX(ENT(pevAttacker));
m_hObserverTarget = UTIL_PlayerByIndexSafe(pev->iuser3);
MESSAGE_BEGIN(MSG_ONE, gmsgADStop, nullptr, pev);
MESSAGE_END();
break;
}
case 1:
{
UTIL_ScreenFade(this, Vector(0, 0, 0), 3, 3, 255, (FFADE_OUT | FFADE_STAYOUT));
break;
}
case 2:
{
pev->iuser1 = OBS_CHASE_FREE;
pev->iuser2 = ENTINDEX(edict());
pev->iuser3 = ENTINDEX(ENT(pevAttacker));
m_hObserverTarget = UTIL_PlayerByIndexSafe(pev->iuser3);
MESSAGE_BEGIN(MSG_ONE, gmsgADStop, nullptr, pev);
MESSAGE_END();
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
CBasePlayer* pObserver = UTIL_PlayerByIndex(i);
if (pObserver == this || pObserver && pObserver->IsObservingPlayer(this))
{
UTIL_ScreenFade(pObserver, Vector(0, 0, 0), 1, 4, 255, (FFADE_OUT));
}
}
break;
}
}
#endif // REGAMEDLL_ADD
SetScoreboardAttributes();