mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 14:08:00 +03:00
Fix: CleanUpMap before the players spawn.
Fix: ValveSoftware/halflife#1567
This commit is contained in:
parent
b032bedf95
commit
1423f7e3fa
@ -1940,6 +1940,11 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_DEFAULT];
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// Respawn entities (glass, doors, etc..)
|
||||
CleanUpMap();
|
||||
#endif
|
||||
|
||||
// tell bots that the round is restarting
|
||||
CBaseEntity *pPlayer = NULL;
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")) != NULL)
|
||||
@ -1987,11 +1992,17 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
|
||||
if (player->m_iTeam != UNASSIGNED && player->m_iTeam != SPECTATOR)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// remove the c4 if the player is carrying it
|
||||
if (player->m_bHasC4) {
|
||||
player->RemoveBomb();
|
||||
}
|
||||
#else
|
||||
// drop the c4 if the player is carrying it
|
||||
if (player->m_bHasC4)
|
||||
{
|
||||
if (player->m_bHasC4) {
|
||||
player->DropPlayerItem("weapon_c4");
|
||||
}
|
||||
#endif
|
||||
|
||||
player->RoundRespawn();
|
||||
}
|
||||
@ -2001,8 +2012,10 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
// for EVERY player (regardless of what team they're on)
|
||||
}
|
||||
|
||||
// Respawn entities (glass, doors, etc..)
|
||||
// Moved above the loop spawning the players
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CleanUpMap();
|
||||
#endif
|
||||
|
||||
// Give C4 to the terrorists
|
||||
if (m_bMapHasBombTarget)
|
||||
|
@ -6006,8 +6006,14 @@ void CBasePlayer::FlashlightTurnOff()
|
||||
|
||||
void CBasePlayer::ForceClientDllUpdate()
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// fix for https://github.com/ValveSoftware/halflife/issues/1567
|
||||
m_iClientHideHUD = -1;
|
||||
#endif
|
||||
|
||||
m_iClientHealth = -1;
|
||||
m_iClientBattery = -1;
|
||||
|
||||
m_fWeapon = FALSE;
|
||||
m_fInitHUD = TRUE;
|
||||
m_iTrain |= TRAIN_NEW;
|
||||
@ -6786,6 +6792,17 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(UpdateClientData)()
|
||||
WRITE_SHORT(CSGameRules()->m_iNumTerroristWins);
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// send "flashlight" update message
|
||||
if (FlashlightIsOn())
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgFlashlight, NULL, pev);
|
||||
WRITE_BYTE(1);
|
||||
WRITE_BYTE(m_iFlashBattery);
|
||||
MESSAGE_END();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (m_iHideHUD != m_iClientHideHUD)
|
||||
@ -9442,3 +9459,38 @@ void CBasePlayer::DropPrimary()
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
CBasePlayerItem *CBasePlayer::GetItemOfNamed(const char *pszItemName)
|
||||
{
|
||||
for (auto pItem : m_rgpPlayerItems) {
|
||||
while (pItem) {
|
||||
if (FClassnameIs(pItem->pev, pszItemName))
|
||||
return pItem;
|
||||
|
||||
pItem = pItem->m_pNext;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CBasePlayer::RemoveBomb()
|
||||
{
|
||||
auto pBomb = GetItemOfNamed("weapon_c4");
|
||||
if (!pBomb)
|
||||
return;
|
||||
|
||||
m_bHasC4 = false;
|
||||
pev->body = 0;
|
||||
SetBombIcon(FALSE);
|
||||
SetProgressBarTime(0);
|
||||
|
||||
if (m_pActiveItem == pBomb) {
|
||||
((CBasePlayerWeapon *)pBomb)->RetireWeapon();
|
||||
}
|
||||
|
||||
if (RemovePlayerItem(pBomb)) {
|
||||
pev->weapons &= ~(1 << pBomb->m_iId);
|
||||
pBomb->Kill();
|
||||
}
|
||||
}
|
||||
|
@ -603,6 +603,9 @@ public:
|
||||
void DropSecondary();
|
||||
void DropPrimary();
|
||||
|
||||
void RemoveBomb();
|
||||
CBasePlayerItem *GetItemOfNamed(const char *pszItemName);
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
CCSPlayer *CSPlayer() const;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user