diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index c8ea5afb..9e78132a 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1447,6 +1447,7 @@ void OnFreeEntPrivateData(edict_t *pEnt) pEntity->OnDestroy(); #endif + pEntity->UpdateOnRemove(); RemoveEntityHashValue(pEntity->pev, STRING(pEntity->pev->classname), CLASSNAME); #ifdef REGAMEDLL_API @@ -1466,10 +1467,11 @@ void OnFreeEntPrivateData(edict_t *pEnt) #ifdef REGAMEDLL_API void CBaseEntity::OnCreate() { + ; } void CBaseEntity::OnDestroy() { - UpdateOnRemove(); + ; } #endif diff --git a/regamedll/dlls/mapinfo.cpp b/regamedll/dlls/mapinfo.cpp index b9160e38..48200b6f 100644 --- a/regamedll/dlls/mapinfo.cpp +++ b/regamedll/dlls/mapinfo.cpp @@ -2,7 +2,7 @@ CMapInfo *g_pMapInfo = nullptr; -CMapInfo::CMapInfo() +void CMapInfo::OnCreate() { m_flBombRadius = 500.0f; m_iBuyingStatus = BUYING_EVERYONE; @@ -20,6 +20,11 @@ CMapInfo::CMapInfo() } } +void CMapInfo::OnDestroy() +{ + g_pMapInfo = nullptr; +} + void CMapInfo::CheckMapInfo() { bool bCTCantBuy, bTCantBuy; @@ -85,9 +90,4 @@ void CMapInfo::Spawn() pev->effects |= EF_NODRAW; } -void CMapInfo::UpdateOnRemove() -{ - g_pMapInfo = nullptr; -} - LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo, CCSMapInfo) diff --git a/regamedll/dlls/mapinfo.h b/regamedll/dlls/mapinfo.h index bae405c1..eb7572eb 100644 --- a/regamedll/dlls/mapinfo.h +++ b/regamedll/dlls/mapinfo.h @@ -33,10 +33,11 @@ const float MAX_BOMB_RADIUS = 2048.0f; class CMapInfo: public CPointEntity { public: - CMapInfo(); virtual void Spawn(); + virtual void OnCreate(); + virtual void OnDestroy(); virtual void KeyValue(KeyValueData *pkvd); - virtual void UpdateOnRemove(); + void CheckMapInfo(); public: diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index ade05a16..42772915 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3454,7 +3454,7 @@ void CHalfLifeMultiplay::ClientDisconnected(edict_t *pClient) if (pPlayer->m_iMapVote) { - --m_iMapVotes[pPlayer->m_iMapVote]; + m_iMapVotes[pPlayer->m_iMapVote]--; if (m_iMapVotes[pPlayer->m_iMapVote] < 0) { @@ -3493,22 +3493,22 @@ void CHalfLifeMultiplay::ClientDisconnected(edict_t *pClient) pPlayer->m_pObserver->SUB_Remove(); } - CBasePlayer *client = nullptr; - while ((client = (CBasePlayer *)UTIL_FindEntityByClassname(client, "player"))) + CBasePlayer *pClient = nullptr; + while ((pClient = UTIL_FindEntityByClassname(pClient, "player"))) { - if (FNullEnt(client->edict())) + if (FNullEnt(pClient->edict())) break; - if (!client->pev || client == pPlayer) + if (!pClient->pev || pClient == pPlayer) continue; // If a spectator was chasing this player, move him/her onto the next player - if (client->m_hObserverTarget == pPlayer) + if (pClient->m_hObserverTarget == pPlayer) { - int iMode = client->pev->iuser1; + int iMode = pClient->pev->iuser1; - client->pev->iuser1 = OBS_NONE; - client->Observer_SetMode(iMode); + pClient->pev->iuser1 = OBS_NONE; + pClient->Observer_SetMode(iMode); } } } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index fd3251bc..3f2d4e8b 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -87,6 +87,22 @@ entvars_t *g_pevLastInflictor; LINK_ENTITY_TO_CLASS(player, CBasePlayer, CCSPlayer) +#ifdef REGAMEDLL_API +void CBasePlayer::OnCreate() +{ + ; +} + +void CBasePlayer::OnDestroy() +{ + if (m_rebuyString) + { + delete[] m_rebuyString; + m_rebuyString = nullptr; + } +} +#endif + void CBasePlayer::SendItemStatus() { int itemStatus = 0; @@ -9296,17 +9312,6 @@ void CBasePlayer::Disconnect() SetThink(nullptr); } -#ifdef REGAMEDLL_FIXES -void CBasePlayer::UpdateOnRemove() -{ - if (m_rebuyString) - { - delete[] m_rebuyString; - m_rebuyString = nullptr; - } -} -#endif - LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, OnSpawnEquip, (bool addDefault, bool equipGame), addDefault, equipGame) void EXT_FUNC CBasePlayer::__API_HOOK(OnSpawnEquip)(bool addDefault, bool equipGame) diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index c4f4dbc7..d2a9fc09 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -343,12 +343,14 @@ public: virtual BOOL AddPlayerItem(CBasePlayerItem *pItem); virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem); virtual int GiveAmmo(int iAmount, const char *szName, int iMax = -1); - virtual void StartSneaking() { m_tSneaking = gpGlobals->time - 1; } -#ifndef REGAMEDLL_FIXES +#ifndef REGAMEDLL_API + virtual void StartSneaking() { m_tSneaking = gpGlobals->time - 1; } virtual void StopSneaking() { m_tSneaking = gpGlobals->time + 30; } #else - virtual void UpdateOnRemove(); + virtual void OnCreate(); + virtual void OnDestroy(); + void StartSneaking() { m_tSneaking = gpGlobals->time - 1; }; #endif virtual BOOL IsSneaking() { return m_tSneaking <= gpGlobals->time; } diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index 7d521029..9cd0a9a3 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -369,7 +369,7 @@ void CRenderFxManager::Spawn() #ifdef REGAMEDLL_FIXES -void CRenderFxManager::UpdateOnRemove() +void CRenderFxManager::OnDestroy() { m_RenderGroups.RemoveAll(); } diff --git a/regamedll/dlls/triggers.h b/regamedll/dlls/triggers.h index dfbfa30b..cf8ca0b1 100644 --- a/regamedll/dlls/triggers.h +++ b/regamedll/dlls/triggers.h @@ -168,7 +168,7 @@ public: #ifdef REGAMEDLL_FIXES virtual void Restart(); - virtual void UpdateOnRemove(); + virtual void OnDestroy(); public: struct RenderGroup_t diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index ecd6f6dd..fb199acf 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -23,8 +23,6 @@ unsigned int seed_table[256] = 25678U, 18555U, 13256U, 23316U, 22407U, 16727U, 991U, 9236U, 5373U, 29402U, 6117U, 15241U, 27715U, 19291U, 19888U, 19847U }; - - int g_groupmask = 0; int g_groupop = 0;