mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-28 15:45:41 +03:00
Fix: now nades not drop if throws a grenade player.
Rollback: remove virtual destructor in class CBaseEntity Add: Using info about item from table weaponInfo (yet only for hegrenade, flashbang, smokegrenade)
This commit is contained in:
parent
552a1d1bb4
commit
183a9f674c
@ -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
|
||||
}
|
||||
|
@ -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); }
|
||||
|
@ -20,12 +20,6 @@ CMapInfo::CMapInfo()
|
||||
}
|
||||
}
|
||||
|
||||
CMapInfo::~CMapInfo()
|
||||
{
|
||||
if (g_pMapInfo == this)
|
||||
g_pMapInfo = nullptr;
|
||||
}
|
||||
|
||||
void CMapInfo::CheckMapInfo()
|
||||
{
|
||||
bool bCTCantBuy, bTCantBuy;
|
||||
|
@ -32,7 +32,6 @@ class CMapInfo: public CPointEntity
|
||||
{
|
||||
public:
|
||||
CMapInfo();
|
||||
virtual ~CMapInfo();
|
||||
virtual void Spawn();
|
||||
virtual void KeyValue(KeyValueData *pkvd);
|
||||
void CheckMapInfo();
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -31,7 +31,6 @@
|
||||
class CMapInfo: public CPointEntity
|
||||
{
|
||||
public:
|
||||
virtual ~CMapInfo() = 0;
|
||||
virtual void Spawn() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user