Skip to content

Commit

Permalink
CVar mp_fadetoblack enhancement (close s1lentq#463) (s1lentq#471)
Browse files Browse the repository at this point in the history
CVar  mp_fadetoblack enhancement
  • Loading branch information
wopox1337 authored and s1lentq committed Jan 15, 2020
1 parent 3498422 commit 2eba3b1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
8 changes: 8 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 48 additions & 0 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand Down

0 comments on commit 2eba3b1

Please sign in to comment.