diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index 12629d33..d41c86e6 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1089,7 +1089,8 @@ void OnFreeEntPrivateData(edict_t *pEnt) pEntity->m_pEntity = nullptr; } - // entities can have a own destructor - pEntity->~CBaseEntity(); + if (g_pMapInfo == pEntity) + g_pMapInfo = nullptr; + #endif } diff --git a/regamedll/dlls/cbase.h b/regamedll/dlls/cbase.h index 1e483b58..ec3052dc 100644 --- a/regamedll/dlls/cbase.h +++ b/regamedll/dlls/cbase.h @@ -275,13 +275,8 @@ public: virtual void Blocked(CBaseEntity *pOther) { if (m_pfnBlocked) (this->*m_pfnBlocked)(pOther); } virtual CBaseEntity *Respawn() { return NULL; } -#ifndef REGAMEDLL_ADD // used by monsters that are created by the MonsterMaker virtual void UpdateOwner() {} -#else - virtual ~CBaseEntity() {} -#endif - virtual BOOL FBecomeProne() { return FALSE; } virtual Vector Center() { return (pev->absmax + pev->absmin) * 0.5f; } virtual Vector EyePosition() { return (pev->origin + pev->view_ofs); } diff --git a/regamedll/dlls/mapinfo.cpp b/regamedll/dlls/mapinfo.cpp index 577add50..98b41c2f 100644 --- a/regamedll/dlls/mapinfo.cpp +++ b/regamedll/dlls/mapinfo.cpp @@ -20,12 +20,6 @@ CMapInfo::CMapInfo() } } -CMapInfo::~CMapInfo() -{ - if (g_pMapInfo == this) - g_pMapInfo = nullptr; -} - void CMapInfo::CheckMapInfo() { bool bCTCantBuy, bTCantBuy; diff --git a/regamedll/dlls/mapinfo.h b/regamedll/dlls/mapinfo.h index 2021be1d..b46e0e2a 100644 --- a/regamedll/dlls/mapinfo.h +++ b/regamedll/dlls/mapinfo.h @@ -32,7 +32,6 @@ class CMapInfo: public CPointEntity { public: CMapInfo(); - virtual ~CMapInfo(); virtual void Spawn(); virtual void KeyValue(KeyValueData *pkvd); void CheckMapInfo(); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 8d4f1886..c3062707 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3588,7 +3588,6 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Banned_For_Killing_Teamates"); int iUserID = GETPLAYERUSERID(killer->edict()); - if (iUserID != -1) { SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iUserID)); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 02ea50fd..52d9725b 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1455,14 +1455,16 @@ void packPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) break; } - if (pItem->m_flStartThrow != 0.0f) + auto& ammoNades = pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ]; + if (pItem->m_flStartThrow != 0) { - auto& ammoNades = pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ]; if (ammoNades < 2) return; ammoNades--; } + else if (pItem->m_flReleaseThrow > 0 && ammoNades < 1) + return; Vector vecAngles = pPlayer->pev->angles; Vector dir(Q_cos(vecAngles.y) * flOffset, Q_sin(vecAngles.y) * flOffset, 0.0f); diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index 894c178e..a2fc0dcf 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -256,9 +256,9 @@ WeaponInfoStruct weaponInfo_default[] = #ifdef REGAMEDLL_ADD { WEAPON_C4, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_c4", nullptr }, { WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr }, - { WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, 1, AMMO_NONE, "weapon_hegrenade", nullptr }, - { WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, 1, AMMO_NONE, "weapon_smokegrenade", nullptr }, - { WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, 2, AMMO_NONE, "weapon_flashbang", nullptr }, + { WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_HEGRENADE, AMMO_NONE, "weapon_hegrenade", nullptr }, + { WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_SMOKEGRENADE, AMMO_NONE, "weapon_smokegrenade", nullptr }, + { WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_NONE, "weapon_flashbang", nullptr }, #endif { WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr }, @@ -436,6 +436,7 @@ WeaponInfoStruct* GetWeaponInfo(const char* weaponName) return &info; } } + return nullptr; } diff --git a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp index f3a96b6c..90c41708 100644 --- a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp +++ b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp @@ -32,12 +32,16 @@ void CFlashbang::__MAKE_VHOOK(Precache)() int CFlashbang::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { + auto info = GetWeaponInfo(WEAPON_FLASHBANG); + p->pszName = STRING(pev->classname); p->pszAmmo1 = "Flashbang"; - p->iMaxAmmo1 = MAX_AMMO_FLASHBANG; + + p->iMaxAmmo1 = info ? info->maxRounds : MAX_AMMO_FLASHBANG; + p->iMaxClip = info ? info->gunClipSize : WEAPON_NOCLIP; + p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; - p->iMaxClip = WEAPON_NOCLIP; p->iSlot = 3; p->iPosition = 2; p->iId = m_iId = WEAPON_FLASHBANG; diff --git a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp index 7450d498..f57e0d7f 100644 --- a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp @@ -35,12 +35,16 @@ void CHEGrenade::__MAKE_VHOOK(Precache)() int CHEGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { + auto info = GetWeaponInfo(WEAPON_HEGRENADE); + p->pszName = STRING(pev->classname); p->pszAmmo1 = "HEGrenade"; - p->iMaxAmmo1 = MAX_AMMO_HEGRENADE; + + p->iMaxAmmo1 = info ? info->maxRounds : MAX_AMMO_HEGRENADE; + p->iMaxClip = info ? info->gunClipSize : WEAPON_NOCLIP; + p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; - p->iMaxClip = WEAPON_NOCLIP; p->iSlot = 3; p->iPosition = 1; p->iId = m_iId = WEAPON_HEGRENADE; diff --git a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp index c877f32d..de797e46 100644 --- a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp @@ -33,12 +33,16 @@ void CSmokeGrenade::__MAKE_VHOOK(Precache)() int CSmokeGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { + auto info = GetWeaponInfo(WEAPON_SMOKEGRENADE); + p->pszName = STRING(pev->classname); p->pszAmmo1 = "SmokeGrenade"; - p->iMaxAmmo1 = MAX_AMMO_SMOKEGRENADE; + + p->iMaxAmmo1 = info ? info->maxRounds : MAX_AMMO_SMOKEGRENADE; + p->iMaxClip = info ? info->gunClipSize : WEAPON_NOCLIP; + p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; - p->iMaxClip = WEAPON_NOCLIP; p->iSlot = 3; p->iPosition = 3; p->iId = m_iId = WEAPON_SMOKEGRENADE; diff --git a/regamedll/extra/cssdk/dlls/cbase.h b/regamedll/extra/cssdk/dlls/cbase.h index a421343f..1329520f 100644 --- a/regamedll/extra/cssdk/dlls/cbase.h +++ b/regamedll/extra/cssdk/dlls/cbase.h @@ -116,7 +116,7 @@ public: virtual void Blocked(CBaseEntity *pOther) = 0; virtual CBaseEntity *Respawn() = 0; - virtual ~CBaseEntity() = 0; // NOTE: it was replaced on function "virtual void UpdateOwner() {}" which is not used. + virtual void UpdateOwner() = 0; virtual BOOL FBecomeProne() = 0; virtual Vector Center() = 0; // center point of entity diff --git a/regamedll/extra/cssdk/dlls/mapinfo.h b/regamedll/extra/cssdk/dlls/mapinfo.h index eda3aec2..8e3c2deb 100644 --- a/regamedll/extra/cssdk/dlls/mapinfo.h +++ b/regamedll/extra/cssdk/dlls/mapinfo.h @@ -31,7 +31,6 @@ class CMapInfo: public CPointEntity { public: - virtual ~CMapInfo() = 0; virtual void Spawn() = 0; virtual void KeyValue(KeyValueData *pkvd) = 0;