mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 23:25:41 +03:00
Avoid intro camera switching when only 1 trigger_camera available (#873)
* Add UTIL_CountEntities, adjust m_fIntroCamTime assignation * Moved camera count caching to CheckLevelInitialized
This commit is contained in:
parent
193c1ed52a
commit
fba9a335da
@ -673,10 +673,12 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
|
|||||||
CBaseEntity *pTarget = nullptr;
|
CBaseEntity *pTarget = nullptr;
|
||||||
pPlayer->m_pIntroCamera = UTIL_FindEntityByClassname(nullptr, "trigger_camera");
|
pPlayer->m_pIntroCamera = UTIL_FindEntityByClassname(nullptr, "trigger_camera");
|
||||||
|
|
||||||
|
#ifndef REGAMEDLL_FIXES
|
||||||
if (g_pGameRules && g_pGameRules->IsMultiplayer())
|
if (g_pGameRules && g_pGameRules->IsMultiplayer())
|
||||||
{
|
{
|
||||||
CSGameRules()->m_bMapHasCameras = (pPlayer->m_pIntroCamera != nullptr);
|
CSGameRules()->m_bMapHasCameras = (pPlayer->m_pIntroCamera != nullptr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pPlayer->m_pIntroCamera)
|
if (pPlayer->m_pIntroCamera)
|
||||||
{
|
{
|
||||||
@ -694,7 +696,12 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
|
|||||||
pPlayer->pev->angles = CamAngles;
|
pPlayer->pev->angles = CamAngles;
|
||||||
pPlayer->pev->v_angle = pPlayer->pev->angles;
|
pPlayer->pev->v_angle = pPlayer->pev->angles;
|
||||||
|
|
||||||
pPlayer->m_fIntroCamTime = gpGlobals->time + 6;
|
pPlayer->m_fIntroCamTime =
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
(CSGameRules()->m_bMapHasCameras <= 1) ? 0.0 : // no need to refresh cameras if map has only one
|
||||||
|
#endif
|
||||||
|
gpGlobals->time + 6;
|
||||||
|
|
||||||
pPlayer->pev->view_ofs = g_vecZero;
|
pPlayer->pev->view_ofs = g_vecZero;
|
||||||
}
|
}
|
||||||
#ifndef REGAMEDLL_FIXES
|
#ifndef REGAMEDLL_FIXES
|
||||||
|
@ -779,7 +779,7 @@ public:
|
|||||||
bool m_bMapHasEscapeZone;
|
bool m_bMapHasEscapeZone;
|
||||||
|
|
||||||
BOOL m_bMapHasVIPSafetyZone; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
|
BOOL m_bMapHasVIPSafetyZone; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
|
||||||
BOOL m_bMapHasCameras;
|
int m_bMapHasCameras;
|
||||||
int m_iC4Timer;
|
int m_iC4Timer;
|
||||||
int m_iC4Guy; // The current Terrorist who has the C4.
|
int m_iC4Guy; // The current Terrorist who has the C4.
|
||||||
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
|
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
|
||||||
|
@ -382,7 +382,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
|||||||
m_iNumTerrorist = 0;
|
m_iNumTerrorist = 0;
|
||||||
m_iNumSpawnableCT = 0;
|
m_iNumSpawnableCT = 0;
|
||||||
m_iNumSpawnableTerrorist = 0;
|
m_iNumSpawnableTerrorist = 0;
|
||||||
m_bMapHasCameras = FALSE;
|
m_bMapHasCameras = -1;
|
||||||
|
|
||||||
m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_DEFAULT];
|
m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_DEFAULT];
|
||||||
m_iNumConsecutiveCTLoses = 0;
|
m_iNumConsecutiveCTLoses = 0;
|
||||||
@ -3086,17 +3086,11 @@ void CHalfLifeMultiplay::CheckLevelInitialized()
|
|||||||
{
|
{
|
||||||
// Count the number of spawn points for each team
|
// Count the number of spawn points for each team
|
||||||
// This determines the maximum number of players allowed on each
|
// This determines the maximum number of players allowed on each
|
||||||
CBaseEntity *pEnt = nullptr;
|
m_iSpawnPointCount_Terrorist = UTIL_CountEntities("info_player_deathmatch");
|
||||||
|
m_iSpawnPointCount_CT = UTIL_CountEntities("info_player_start");
|
||||||
m_iSpawnPointCount_Terrorist = 0;
|
#ifdef REGAMEDLL_FIXES
|
||||||
m_iSpawnPointCount_CT = 0;
|
m_bMapHasCameras = UTIL_CountEntities("trigger_camera");
|
||||||
|
#endif
|
||||||
while ((pEnt = UTIL_FindEntityByClassname(pEnt, "info_player_deathmatch")))
|
|
||||||
m_iSpawnPointCount_Terrorist++;
|
|
||||||
|
|
||||||
while ((pEnt = UTIL_FindEntityByClassname(pEnt, "info_player_start")))
|
|
||||||
m_iSpawnPointCount_CT++;
|
|
||||||
|
|
||||||
m_bLevelInitialized = true;
|
m_bLevelInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3666,7 +3666,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(JoiningThink)()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pIntroCamera && gpGlobals->time >= m_fIntroCamTime)
|
if (m_pIntroCamera && gpGlobals->time >= m_fIntroCamTime
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
&& m_fIntroCamTime > 0.0 // update only if cameras are available
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// find the next another camera
|
// find the next another camera
|
||||||
m_pIntroCamera = UTIL_FindEntityByClassname(m_pIntroCamera, "trigger_camera");
|
m_pIntroCamera = UTIL_FindEntityByClassname(m_pIntroCamera, "trigger_camera");
|
||||||
|
@ -1758,6 +1758,17 @@ int UTIL_GetNumPlayers()
|
|||||||
return nNumPlayers;
|
return nNumPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int UTIL_CountEntities(const char *szName)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
CBaseEntity *pEnt = nullptr;
|
||||||
|
|
||||||
|
while ((pEnt = UTIL_FindEntityByClassname(pEnt, szName)))
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot)
|
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot)
|
||||||
{
|
{
|
||||||
if (!pSpot)
|
if (!pSpot)
|
||||||
|
@ -297,6 +297,7 @@ bool UTIL_AreBotsAllowed();
|
|||||||
bool UTIL_IsBeta();
|
bool UTIL_IsBeta();
|
||||||
bool UTIL_AreHostagesImprov();
|
bool UTIL_AreHostagesImprov();
|
||||||
int UTIL_GetNumPlayers();
|
int UTIL_GetNumPlayers();
|
||||||
|
int UTIL_CountEntities(const char *szName);
|
||||||
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot);
|
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot);
|
||||||
void MAKE_STRING_CLASS(const char *str, entvars_t *pev);
|
void MAKE_STRING_CLASS(const char *str, entvars_t *pev);
|
||||||
void NORETURN Sys_Error(const char *error, ...);
|
void NORETURN Sys_Error(const char *error, ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user