Skip to content

Commit

Permalink
fix cvar dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wopox1337 committed Jul 14, 2023
1 parent 66c6fb8 commit d7edd67
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions regamedll/dlls/API/CSPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
pPlayer->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles);

// do we have fadetoblack on? (need to fade their screen back in)
#ifndef REGAMEDLL_ADD
if (fadetoblack.value)
#else
if ((int)fadetoblack.value == 1)
#endif
{
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN);
}
Expand Down
4 changes: 4 additions & 0 deletions regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,11 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *pPlayer, int slot)
MESSAGE_END();
#endif
// do we have fadetoblack on? (need to fade their screen back in)
#ifndef REGAMEDLL_ADD
if (fadetoblack.value)
#else
if ((int)fadetoblack.value == 1)
#endif
{
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN);
}
Expand Down
4 changes: 4 additions & 0 deletions regamedll/dlls/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ void PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAt
{
UTIL_ScreenFade(pPlayer, color, fadeTime, fadeHold, alpha, 0);

#ifndef REGAMEDLL_ADD
if (!fadetoblack.value)
#else
if ((int)fadetoblack.value != 1)
#endif
{
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
Expand Down
12 changes: 12 additions & 0 deletions regamedll/dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,11 @@ void CHalfLifeMultiplay::Think()
MESSAGE_BEGIN(MSG_ALL, gmsgForceCam);
WRITE_BYTE(forcecamera.value != 0);
WRITE_BYTE(forcechasecam.value != 0);
#ifndef REGAMEDLL_ADD
WRITE_BYTE(fadetoblack.value != 0);
#else
WRITE_BYTE((int)fadetoblack.value == 1);
#endif
MESSAGE_END();

m_flForceCameraValue = forcecamera.value;
Expand Down Expand Up @@ -3456,7 +3460,11 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)
MESSAGE_BEGIN(MSG_ONE, gmsgForceCam, nullptr, pl->edict());
WRITE_BYTE(forcecamera.value != 0);
WRITE_BYTE(forcechasecam.value != 0);
#ifndef REGAMEDLL_ADD
WRITE_BYTE(fadetoblack.value != 0);
#else
WRITE_BYTE((int)fadetoblack.value == 1);
#endif
MESSAGE_END();

if (m_bGameOver)
Expand Down Expand Up @@ -3874,7 +3882,11 @@ BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(FPlayerCanRespawn)(CBasePlayer *pPl
{
// If this player just connected and fadetoblack is on, then maybe
// the server admin doesn't want him peeking around.
#ifndef REGAMEDLL_ADD
if (fadetoblack.value != 0.0f)
#else
if ((int)fadetoblack.value == 1)
#endif
{
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 3, 3, 255, (FFADE_OUT | FFADE_STAYOUT));
}
Expand Down
8 changes: 8 additions & 0 deletions regamedll/dlls/observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ int __API_HOOK(GetForceCamera)(CBasePlayer *pObserver)
{
int retVal;

#ifndef REGAMEDLL_ADD
if (!fadetoblack.value)
#else
if ((int)fadetoblack.value == 1)
#endif
{
retVal = int(CVAR_GET_FLOAT("mp_forcechasecam"));

Expand Down Expand Up @@ -51,7 +55,11 @@ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode)
{
bool clearProgress = false;
bool clearBlindness = false;
#ifndef REGAMEDLL_ADD
bool blindnessOk = (fadetoblack.value == 0);
#else
bool blindnessOk = ((int)fadetoblack.value != 1);
#endif
bool clearNightvision = false;

if (pObserver->GetObserverMode() == OBS_IN_EYE)
Expand Down

0 comments on commit d7edd67

Please sign in to comment.