Added hook api CanBuyItemThis
Use BOOL for TakeDamage/TakeHealth because should return TRUE/FALSE
This commit is contained in:
s1lentq 2016-06-18 21:48:19 +07:00
parent 21b0689030
commit f071682392
42 changed files with 619 additions and 270 deletions

View File

@ -54,8 +54,8 @@ class CBaseMonster: public CBaseToggle
public:
virtual void KeyValue(KeyValueData *pkvd);
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int TakeHealth(float flHealth, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeHealth(float flHealth, int bitsDamageType);
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual int BloodColor() { return m_bloodColor; }
virtual BOOL IsAlive() { return (pev->deadflag != DEAD_DEAD); }
@ -81,8 +81,8 @@ public:
void KeyValue_(KeyValueData *pkvd);
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int TakeHealth_(float flHealth, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeHealth_(float flHealth, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
float ChangeYaw_(int speed);
BOOL HasHumanGibs_();
@ -107,7 +107,7 @@ public:
BOOL ShouldGibMonster(int iGib);
void CallGibMonster();
BOOL FCheckAITrigger();
int DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
float DamageForce(float damage);
void RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);

View File

@ -70,7 +70,7 @@ bool CCSBot::__MAKE_VHOOK(Jump)(bool mustJump)
// Invoked when injured by something
// NOTE: We dont want to directly call Attack() here, or the bots will have super-human reaction times when injured
int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
CBaseEntity *attacker = GetClassPtr<CCSEntity>((CBaseEntity *)pevInflictor);
@ -104,12 +104,12 @@ int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtta
// being hurt by an enemy we can't see causes panic
if (!IsVisible(enemy, CHECK_FOV))
{
bool panic = false;
bool bPanic = false;
// if not attacking anything, look around to try to find attacker
if (!IsAttacking())
{
panic = true;
bPanic = true;
}
else
{
@ -117,22 +117,22 @@ int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtta
if (!IsEnemyVisible())
{
// can't see our current enemy, panic to acquire new attacker
panic = true;
bPanic = true;
}
}
if (!panic)
if (!bPanic)
{
float invSkill = 1.0f - GetProfile()->GetSkill();
float panicChance = invSkill * invSkill * 50.0f;
if (panicChance > RANDOM_FLOAT(0, 100))
{
panic = true;
bPanic = true;
}
}
if (panic != false)
if (bPanic)
{
// can't see our current enemy, panic to acquire new attacker
Panic(m_attacker);

View File

@ -421,7 +421,7 @@ class CCSBot: public CBot
{
public:
CCSBot(); // constructor initializes all values to zero
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual void Killed(entvars_t *pevAttacker, int iGib); // invoked when killed (EXTEND)
virtual void RoundRespawn();
virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255); // player blinded by a flashbang
@ -453,7 +453,7 @@ public:
void Walk_();
bool Jump_(bool mustJump);
void Blind_(float duration, float holdTime, float fadeTime, int alpha);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
void OnTouchingWeapon_(CWeaponBox *box);
void OnEvent_(GameEventType event, CBaseEntity *entity, CBaseEntity *other);

View File

@ -372,13 +372,13 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
// ButtonShot
int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
BUTTON_CODE code = ButtonResponseToTouch();
if (code == BUTTON_NOTHING)
{
return 0;
return FALSE;
}
// Temporarily disable the touch function, until movement is finished.
@ -386,7 +386,7 @@ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
m_hActivator = CBaseEntity::Instance(pevAttacker);
if (m_hActivator == NULL)
return 0;
return FALSE;
if (code == BUTTON_RETURN)
{
@ -406,7 +406,7 @@ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
ButtonActivate();
}
return 0;
return FALSE;
}
// QUAKED func_button (0 .5 .8) ?
@ -1195,8 +1195,8 @@ int CButtonTarget::__MAKE_VHOOK(ObjectCaps)()
return caps;
}
int CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Use(Instance(pevAttacker), this, USE_TOGGLE, 0);
return 1;
return TRUE;
}

View File

@ -178,14 +178,14 @@ class CButtonTarget: public CBaseEntity
public:
virtual void Spawn();
virtual int ObjectCaps();
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef HOOK_GAMEDLL
void Spawn_();
int ObjectCaps_();
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif

View File

@ -785,13 +785,13 @@ CBaseEntity *EHANDLE::operator->()
return (CBaseEntity *)GET_PRIVATE(Get());
}
int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
BOOL CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{
if (pev->takedamage == DAMAGE_NO)
return 0;
return FALSE;
if (pev->health >= pev->max_health)
return 0;
return FALSE;
pev->health += flHealth;
@ -800,15 +800,15 @@ int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
pev->health = pev->max_health;
}
return 1;
return TRUE;
}
int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Vector vecTemp;
if (pev->takedamage == DAMAGE_NO)
return 0;
return FALSE;
// UNDONE: some entity types may be immune or resistant to some bitsDamageType
// if Attacker == Inflictor, the attack was a melee or other instant-hit attack.
@ -848,10 +848,10 @@ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
if (pev->health <= 0)
{
Killed(pevAttacker, GIB_NORMAL);
return 0;
return FALSE;
}
return 1;
return TRUE;
}
void CBaseEntity::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)

View File

@ -237,8 +237,8 @@ public:
virtual int Classify() { return CLASS_NONE; }
virtual void DeathNotice(entvars_t *pevChild) {}
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int TakeHealth(float flHealth, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeHealth(float flHealth, int bitsDamageType);
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual int BloodColor() { return DONT_BLEED; }
virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
@ -294,8 +294,8 @@ public:
int Restore_(CRestore &restore);
void SetObjectCollisionBox_();
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int TakeHealth_(float flHealth, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeHealth_(float flHealth, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
void TraceBleed_(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int DamageDecal_(int bitsDamageType);
@ -596,7 +596,7 @@ public:
virtual void Spawn();
virtual void Precache();
virtual void KeyValue(KeyValueData *pkvd);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps()
@ -614,7 +614,7 @@ public:
void Spawn_();
void Precache_();
void KeyValue_(KeyValueData *pkvd);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int Save_(CSave &save);
int Restore_(CRestore &restore);

View File

@ -1007,6 +1007,12 @@ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot)
BuyWeaponByWeaponID(pPlayer, WEAPON_M249);
}
#ifdef REGAMEDLL_ADD
bool EXT_FUNC CanBuyThisItem_hook(CBasePlayer *pPlayer, BuyItemID item) {
return true;
}
#endif
void BuyItem(CBasePlayer *pPlayer, int iSlot)
{
int iItemPrice = 0;
@ -1034,6 +1040,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
{
case MENU_SLOT_ITEM_VEST:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_VEST))
return;
#endif
if (fullArmor)
{
if (g_bClientPrintEnable)
@ -1059,6 +1070,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_VESTHELM:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_VESTHELM))
return;
#endif
if (fullArmor)
{
if (bHasHelmet)
@ -1114,6 +1130,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_FLASHGREN:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_FLASHGREN))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang"))
{
if (g_bClientPrintEnable)
@ -1135,6 +1156,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_HEGREN:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_HEGREN))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade"))
{
if (g_bClientPrintEnable)
@ -1155,6 +1181,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_SMOKEGREN:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_SMOKEGREN))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade"))
{
if (g_bClientPrintEnable)
@ -1175,6 +1206,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_NVG:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_NVG))
return;
#endif
if (pPlayer->m_bHasNightVision)
{
if (g_bClientPrintEnable)
@ -1204,6 +1240,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
case MENU_SLOT_ITEM_DEFUSEKIT:
{
#ifdef REGAMEDLL_ADD
if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_DEFUSEKIT))
return;
#endif
if (pPlayer->m_iTeam != CT || !CSGameRules()->m_bMapHasBombTarget)
return;

View File

@ -58,6 +58,17 @@ enum BuyItemMenuSlot
MENU_SLOT_ITEM_SHIELD,
};
enum BuyItemID
{
BUY_ITEM_VEST = 1,
BUY_ITEM_VESTHELM,
BUY_ITEM_FLASHGREN,
BUY_ITEM_HEGREN,
BUY_ITEM_SMOKEGREN,
BUY_ITEM_NVG,
BUY_ITEM_DEFUSEKIT
};
#define CS_NUM_SKIN 4
#define CZ_NUM_SKIN 5

View File

@ -711,10 +711,10 @@ void CGib::Spawn(const char *szGibModel)
m_cBloodDecals = 5;
}
int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
BOOL CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{
if (pev->takedamage == DAMAGE_NO)
return 0;
return FALSE;
// clear out any damage types we healed.
// UNDONE: generic health should not heal any
@ -730,10 +730,10 @@ int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
//
// Time-based damage: only occurs while the monster is within the trigger_hurt.
// When a monster is poisoned via an arrow etc it takes all the poison damage at once.
int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (pev->takedamage == DAMAGE_NO)
return 0;
return FALSE;
if (!IsAlive())
{
@ -791,7 +791,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
if (m_MonsterState == MONSTERSTATE_SCRIPT)
{
SetConditions(bits_COND_LIGHT_DAMAGE);
return 0;
return FALSE;
}
if (pev->health <= 0.0f)
@ -807,7 +807,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
Killed(pevAttacker, GIB_NORMAL);
g_pevLastInflictor = NULL;
return 0;
return FALSE;
}
if ((pev->flags & FL_MONSTER) && !FNullEnt(pevAttacker))
{
@ -837,11 +837,11 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
}
}
return 1;
return TRUE;
}
// DeadTakeDamage - takedamage function called when a monster's corpse is damaged.
int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
// grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit).
Vector vecDir(0, 0, 0);
@ -877,14 +877,14 @@ int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker
{
pev->health = -50;
Killed(pevAttacker, GIB_ALWAYS);
return 0;
return FALSE;
}
// Accumulate corpse gibbing damage, so you can gib with multiple hits
pev->health -= flDamage * 0.1;
}
return 1;
return TRUE;
}
float CBaseMonster::DamageForce(float damage)

View File

@ -580,7 +580,7 @@ void CBreakable::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
// Special takedamage for func_breakable. Allows us to make
// exceptions that are breakable-specific
// bitsDamageType indicates the type of damage sustained ie: DMG_CRUSH
int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Vector vecTemp;
@ -603,7 +603,7 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
}
if (!IsBreakable())
return 0;
return FALSE;
// Breakables take double damage from the crowbar
if (bitsDamageType & DMG_CLUB)
@ -638,13 +638,13 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
}
pev->nextthink = pev->ltime + m_flDelay;
return 0;
return FALSE;
}
// Make a shard noise each time func breakable is hit.
// Don't play shard noise if cbreakable actually died.
DamageSound();
return 1;
return TRUE;
}
void CBreakable::Die()
@ -1038,12 +1038,12 @@ void CPushable::Move(CBaseEntity *pOther, int push)
}
}
int CPushable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CPushable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (pev->spawnflags & SF_PUSH_BREAKABLE)
{
return CBreakable::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}
return 1;
return TRUE;
}

View File

@ -83,7 +83,7 @@ public:
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
// breakables use an overridden takedamage
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int DamageDecal(int bitsDamageType);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -97,7 +97,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int DamageDecal_(int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -149,7 +149,7 @@ public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE; }
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -160,7 +160,7 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Touch_(CBaseEntity *pOther);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);

View File

@ -66,6 +66,12 @@
#define WINNER_NONE 0
#define WINNER_DRAW 1
#if defined(REGAMEDLL_ADD) && !defined(HOOK_GAMEDLL)
#define VFUNC virtual
#else
#define VFUNC
#endif
enum
{
WINSTATUS_CTS = 1,
@ -175,18 +181,24 @@ enum InfoMapBuyParam
BUYING_NO_ONE,
};
// weapon respawning return codes
enum
{
GR_NONE = 0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
@ -204,6 +216,7 @@ enum
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE = 0,
@ -220,65 +233,103 @@ class CGameRules
public:
CGameRules();
virtual ~CGameRules();
virtual void RefreshSkillData();
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsTeamplay() { return FALSE; }
virtual BOOL IsCoOp() = 0;
virtual const char *GetGameDescription(); // this is the game name that gets seen in the server browser
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
virtual void ClientDisconnected(edict_t *pClient) = 0;
virtual void UpdateGameMode(CBasePlayer *pPlayer) {};
virtual void RefreshSkillData(); // fill skill data struct with proper values
virtual void Think() = 0; // runs every server frame, should handle any timer tasks, periodic events, etc.
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; // Can this item spawn (eg monsters don't spawn in deathmatch).
virtual BOOL FAllowFlashlight() = 0; // Are players allowed to switch on their flashlight?
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // should the player switch to this weapon?
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; // I can't use this weapon anymore, get me the next best one.
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer() = 0; // is this a multiplayer game? (either coop or deathmatch)
virtual BOOL IsDeathmatch() = 0; // is this a deathmatch game?
virtual BOOL IsTeamplay() { return FALSE; } // is this deathmatch game being played with team rules?
virtual BOOL IsCoOp() = 0; // is this a coop game?
virtual const char *GetGameDescription(); // this is the game name that gets seen in the server browser
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0; // a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient) = 0; // a client just disconnected from the server
virtual void UpdateGameMode(CBasePlayer *pPlayer) {}; // the client needs to be informed of the current game mode
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) { return TRUE; }
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) { return TRUE; } // can this player take damage from this attacker?
virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) { return TRUE; }
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; // is this player allowed to respawn now?
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; // When in the future will this player be able to spawn?
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer); // Place this player on their spawnspot and face them the proper direction.
virtual BOOL AllowAutoTargetCrosshair() { return TRUE; }
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; }
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; }
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) {};
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0;
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem);
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry);
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlHealthChargerRechargeTime() = 0;
virtual float FlHEVChargerRechargeTime() { return 0.0f; }
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; } // handles the user commands; returns TRUE if command handled properly
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) {}; // the player has changed userinfo; can change it now
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; // how many points do I award whoever kills this player?
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; // Called each time a player dies
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0; // Call this from within a GameRules class to report an obituary.
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem); // The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; // should this weapon respawn?
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; // when may this weapon respawn?
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; // where in the world should this weapon respawn?
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // is this player allowed to take this item?
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0; // Should this item respawn?
virtual float FlItemRespawnTime(CItem *pItem) = 0; // when may this item respawn?
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; // where in the world should this item respawn?
// Ammo retrieval
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry); // can this player take more of this ammo?
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; // called each time a player picks up some ammo in the world
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; // should this ammo item respawn?
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; // when should this ammo item respawn?
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; // where in the world should this ammo item respawn?
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
virtual float FlHEVChargerRechargeTime() { return 0.0f; } // how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; // what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; // Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; // what team is this entity on?
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; // What is the player's relationship with this entity?
virtual int GetTeamIndex(const char *pTeamName) { return -1; }
virtual const char *GetIndexedTeamName(int teamIndex) { return ""; }
virtual BOOL IsValidTeam(const char *pTeamName) { return TRUE; }
virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) {};
virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) { return ""; }
// Sounds
virtual BOOL PlayTextureSounds() { return TRUE; }
virtual BOOL FAllowMonsters() = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0; // are monsters allowed
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() {};
// Stuff that is shared between client and server.
@ -303,6 +354,7 @@ public:
char *m_GameDesc;
};
// CHalfLifeRules - rules for the single player Half-Life game.
class CHalfLifeRules: public CGameRules
{
public:
@ -312,43 +364,77 @@ public:
virtual void Think();
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity);
virtual BOOL FAllowFlashlight() { return TRUE; }
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer();
virtual BOOL IsDeathmatch();
virtual BOOL IsCoOp();
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
virtual void InitHUD(CBasePlayer *pl);
virtual void InitHUD(CBasePlayer *pl); // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient);
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer);
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer);
virtual void PlayerThink(CBasePlayer *pPlayer);
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer);
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer);
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);
virtual BOOL AllowAutoTargetCrosshair();
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled);
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
// Weapon retrieval
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon);
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon);
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon);
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon);
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem);
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem);
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem);
virtual float FlItemRespawnTime(CItem *pItem);
virtual Vector VecItemRespawnSpot(CItem *pItem);
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount);
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo);
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo);
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo);
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime();
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer);
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer);
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) { return ""; };
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget);
// Monsters
virtual BOOL FAllowMonsters();
#ifdef HOOK_GAMEDLL
@ -396,12 +482,7 @@ public:
#endif // HOOK_GAMEDLL
};
#if defined(REGAMEDLL_ADD) && !defined(HOOK_GAMEDLL)
#define VFUNC virtual
#else
#define VFUNC
#endif
// CHalfLifeMultiplay - rules for the basic half life multiplayer competition
class CHalfLifeMultiplay: public CGameRules
{
public:
@ -412,54 +493,90 @@ public:
virtual void Think();
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity);
virtual BOOL FAllowFlashlight();
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
virtual BOOL IsMultiplayer();
virtual BOOL IsDeathmatch();
virtual BOOL IsCoOp();
// Client connection/disconnection
// If ClientConnected returns FALSE, the connection is rejected and the user is provided the reason specified in szRejectReason
// Only the client's name and remote address are provided to the dll for verification.
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
virtual void InitHUD(CBasePlayer *pl);
virtual void InitHUD(CBasePlayer *pl); // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient);
virtual void UpdateGameMode(CBasePlayer *pPlayer);
virtual void UpdateGameMode(CBasePlayer *pPlayer); // the client needs to be informed of the current game mode
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer);
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker);
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer);
virtual void PlayerThink(CBasePlayer *pPlayer);
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer);
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer);
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);
virtual BOOL AllowAutoTargetCrosshair();
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd);
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd);
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer);
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled);
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
// Death notices
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor);
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon); // The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon);
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon);
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon);
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon);
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem);
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem);
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem);
virtual float FlItemRespawnTime(CItem *pItem);
virtual Vector VecItemRespawnSpot(CItem *pItem);
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount);
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo);
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo);
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo);
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime();
virtual float FlHEVChargerRechargeTime();
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer);
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer);
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) { return ""; }
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget);
virtual BOOL PlayTextureSounds() { return FALSE; }
// Monsters
virtual BOOL FAllowMonsters();
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() { GoToIntermission(); }
virtual void ServerDeactivate();
virtual void CheckMapConditions();
@ -468,7 +585,6 @@ public:
// then remove everything else except the players.
// Also get rid of all world decals.
virtual void CleanUpMap();
virtual void RestartRound();
// check if the scenario has been won/lost

View File

@ -134,7 +134,7 @@ void CCycler::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, U
}
// CyclerPain , changes sequences when shot
int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (m_animate)
{
@ -158,7 +158,7 @@ int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtt
ALERT(at_console, "sequence: %d, frame %.0f\n", pev->sequence, pev->frame);
}
return 0;
return FALSE;
}
LINK_ENTITY_TO_CLASS(cycler_sprite, CCyclerSprite, CCSCyclerSprite);
@ -222,14 +222,14 @@ void CCyclerSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
ALERT(at_console, "Sprite: %s\n", STRING(pev->model));
}
int CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (m_maxFrame > 1.0)
{
Animate(1.0);
}
return 1;
return TRUE;
}
void CCyclerSprite::Animate(float frames)

View File

@ -39,7 +39,7 @@ public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE); }
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
// Don't treat as a live target
virtual BOOL IsAlive() { return FALSE; }
@ -51,7 +51,7 @@ public:
void Spawn_();
int Save_(CSave &save);
int Restore_(CRestore &restore);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -102,7 +102,7 @@ public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() | FCAP_DONT_SAVE | FCAP_IMPULSE_USE); }
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Think();
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -112,7 +112,7 @@ public:
void Restart_();
int Save_(CSave &save);
int Restore_(CRestore &restore);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);

View File

@ -564,7 +564,7 @@ void CHostage::RePosition()
m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
}
int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
float flActualDamage;
CBasePlayer *pAttacker = NULL;
@ -624,7 +624,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
pAttacker->m_flDisplayHistory |= DHF_HOSTAGE_INJURED;
}
return 1;
return TRUE;
}
}
else
@ -664,7 +664,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
SetThink(&CHostage::Remove);
}
return 0;
return FALSE;
}
float CHostage::GetModifiedDamage(float flDamage, int nHitGroup)

View File

@ -94,7 +94,7 @@ public:
virtual void Precache();
virtual int ObjectCaps(); // make hostage "useable"
virtual int Classify() { return CLASS_HUMAN_PASSIVE; }
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor() { return BLOOD_COLOR_RED; }
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -104,7 +104,7 @@ public:
void Spawn_();
void Precache_();
int ObjectCaps_();
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Touch_(CBaseEntity *pOther);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);

View File

@ -423,6 +423,13 @@ void CHalfLifeMultiplay::ReadMultiplayCvars()
CVAR_SET_FLOAT("mp_limitteams", 0);
m_iLimitTeams = 0;
}
// auto-disable ff
if (friendlyfire.value)
{
CVAR_SET_FLOAT("mp_friendlyfire", 0);
}
#endif
}
@ -601,6 +608,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
sv_clienttrace = CVAR_GET_POINTER("sv_clienttrace");
InstallTutor(CVAR_GET_FLOAT("tutor_enable") != 0.0f);
m_bSkipShowMenu = false;
m_bNeededPlayers = false;
m_flEscapeRatio = 0.0f;
@ -4082,6 +4090,13 @@ edict_t *CHalfLifeMultiplay::__API_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlaye
int CHalfLifeMultiplay::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, CBaseEntity *pTarget)
{
#ifdef REGAMEDLL_ADD
if (IsFreeForAll())
{
return GR_NOTTEAMMATE;
}
#endif
if (!pPlayer || !pTarget)
{
return GR_NOTTEAMMATE;

View File

@ -2125,7 +2125,7 @@ void CGunTarget::Stop()
pev->takedamage = DAMAGE_NO;
}
int CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
BOOL CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (pev->health > 0)
{
@ -2143,7 +2143,7 @@ int CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
}
}
return 0;
return FALSE;
}
void CGunTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)

View File

@ -307,7 +307,7 @@ public:
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); }
virtual void Activate();
virtual int Classify() { return CLASS_MACHINE; }
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor() { return DONT_BLEED; }
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual Vector BodyTarget(const Vector &posSrc) { return pev->origin; }
@ -318,7 +318,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
void Activate_();
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif

View File

@ -722,11 +722,11 @@ void CBasePlayer::DeathSound()
}
}
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, TakeHealth, (float flHealth, int bitsDamageType), flHealth, bitsDamageType);
LINK_HOOK_CLASS_CHAIN(BOOL, CBasePlayer, TakeHealth, (float flHealth, int bitsDamageType), flHealth, bitsDamageType);
// override takehealth
// bitsDamageType indicates type of damage healed.
int CBasePlayer::__API_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
BOOL CBasePlayer::__API_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{
return CBaseMonster::TakeHealth(flHealth, bitsDamageType);
}
@ -759,8 +759,13 @@ void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
bool bHitShield = IsHittingShield(vecDir, ptr);
CBasePlayer *pAttacker = CBasePlayer::Instance(pevAttacker);
#ifdef REGAMEDLL_ADD
if (pAttacker && pAttacker->IsPlayer() && !CSGameRules()->FPlayerCanTakeDamage(this, pAttacker))
bShouldBleed = false;
#else
if (pAttacker && pAttacker->IsPlayer() && m_iTeam == pAttacker->m_iTeam && CVAR_GET_FLOAT("mp_friendlyfire") == 0)
bShouldBleed = false;
#endif
if (pev->takedamage == DAMAGE_NO)
return;
@ -971,15 +976,16 @@ void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int
}
}
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, TakeDamage, (entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType), pevInflictor, pevAttacker, flDamage, bitsDamageType);
LINK_HOOK_CLASS_CHAIN(BOOL, CBasePlayer, TakeDamage, (entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType), pevInflictor, pevAttacker, flDamage, bitsDamageType);
// Take some damage.
// RETURN: TRUE took damage, FALSE otherwise
// NOTE: each call to TakeDamage with bitsDamageType set to a time-based damage
// type will cause the damage time countdown to be reset. Thus the ongoing effects of poison, radiation
// etc are implemented with subsequent calls to TakeDamage using DMG_GENERIC.
int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, FloatRef flDamage, int bitsDamageType)
BOOL CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, FloatRef flDamage, int bitsDamageType)
{
int fTookDamage;
BOOL bTookDamage;
float flRatio = ARMOR_RATIO;
float flBonus = ARMOR_BONUS;
int iGunType = 0;
@ -993,7 +999,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
m_LastHitGroup = HITGROUP_GENERIC;
else if (m_LastHitGroup == HITGROUP_SHIELD && (bitsDamageType & DMG_BULLET))
return 0;
return FALSE;
if (HasShield())
flShieldRatio = 0.2;
@ -1004,7 +1010,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
if (bitsDamageType & (DMG_EXPLOSION | DMG_BLAST))
{
if (!IsAlive())
return 0;
return FALSE;
if (bitsDamageType & DMG_EXPLOSION)
{
@ -1016,14 +1022,14 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
if (CVAR_GET_FLOAT("mp_friendlyfire"))
{
if (!CSGameRules()->IsFreeForAll() && pGrenade->m_iTeam == m_iTeam)
if (pGrenade->m_iTeam == m_iTeam)
bTeamAttack = TRUE;
pAttack = CBasePlayer::Instance(pevAttacker);
}
else if (pGrenade->m_iTeam == m_iTeam && (&edict()->v != pevAttacker))
{
return 0;
return FALSE;
}
}
}
@ -1081,9 +1087,9 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
}
LogAttack(pAttack, this, bTeamAttack, int(flDamage), armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker));
fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType);
bTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType);
if (fTookDamage > 0)
if (bTookDamage)
{
if (TheBots != NULL)
{
@ -1147,7 +1153,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
MESSAGE_END();
}
return fTookDamage;
return bTookDamage;
}
pAttacker = CBaseEntity::Instance(pevAttacker);
@ -1155,7 +1161,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && Q_strcmp("grenade", STRING(pevInflictor->classname)) != 0)
{
// Refuse the damage
return 0;
return FALSE;
}
if (bitsDamageType & DMG_BLAST && g_pGameRules->IsMultiplayer())
@ -1166,7 +1172,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
// Already dead
if (!IsAlive())
return 0;
return FALSE;
pAttacker = GetClassPtr<CCSEntity>((CBaseEntity *)pevAttacker);
@ -1177,7 +1183,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
bool bAttackFFA = CSGameRules()->IsFreeForAll();
// warn about team attacks
if (pAttack != this && pAttack->m_iTeam == m_iTeam && !bAttackFFA)
if (!bAttackFFA && pAttack != this && pAttack->m_iTeam == m_iTeam)
{
#ifndef REGAMEDLL_FIXES
// TODO: this->m_flDisplayHistory!
@ -1215,7 +1221,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
}
}
if (pAttack->m_iTeam == m_iTeam && !bAttackFFA)
if (!bAttackFFA && pAttack->m_iTeam == m_iTeam)
{
// bullets hurt teammates less
flDamage *= 0.35;
@ -1318,9 +1324,9 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
// this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that
// as an int (zero) and think the player is dead! (this will incite a clientside screentilt, etc)
fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType);
bTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType);
if (fTookDamage > 0)
if (bTookDamage)
{
if (TheBots != NULL)
{
@ -1393,7 +1399,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
// make sure the damage bits get resent
m_bitsDamageType |= bitsDamageType;
return fTookDamage;
return bTookDamage;
}
void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo)

View File

@ -354,8 +354,8 @@ public:
virtual int ObjectCaps();
virtual int Classify();
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int TakeHealth(float flHealth, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual BOOL TakeHealth(float flHealth, int bitsDamageType);
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual void AddPoints(int score, BOOL bAllowNegativeScore);
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore);
@ -395,8 +395,8 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
void TraceAttack_(entvars_t *pevAttacker, float flDamage, VectorRef vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, FloatRef flDamage, int bitsDamageType);
int TakeHealth_(float flHealth, int bitsDamageType);
BOOL TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, FloatRef flDamage, int bitsDamageType);
BOOL TakeHealth_(float flHealth, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
void AddPoints_(int score, BOOL bAllowNegativeScore);
void AddPointsToTeam_(int score, BOOL bAllowNegativeScore);

View File

@ -49,8 +49,8 @@ class CBaseMonster: public CBaseToggle {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual BOOL IsAlive() = 0;

View File

@ -281,7 +281,7 @@ private:
// The Counter-strike Bot
class CCSBot: public CBot {
public:
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; // invoked when killed (EXTEND)
virtual void RoundRespawn() = 0;
virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; // player blinded by a flashbang

View File

@ -99,6 +99,6 @@ class CButtonTarget: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};

View File

@ -68,8 +68,8 @@ public:
virtual void DeathNotice(entvars_t *pevChild) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
@ -268,7 +268,7 @@ public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0; // Buttons that don't take damage can be IMPULSE used

View File

@ -53,6 +53,17 @@ enum BuyItemMenuSlot
MENU_SLOT_ITEM_SHIELD,
};
enum BuyItemID
{
BUY_ITEM_VEST = 1,
BUY_ITEM_VESTHELM,
BUY_ITEM_FLASHGREN,
BUY_ITEM_HEGREN,
BUY_ITEM_SMOKEGREN,
BUY_ITEM_NVG,
BUY_ITEM_DEFUSEKIT
};
#define CS_NUM_SKIN 4
#define CZ_NUM_SKIN 5

View File

@ -77,7 +77,7 @@ public:
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
// breakables use an overridden takedamage
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int DamageDecal(int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
@ -105,7 +105,7 @@ public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;

View File

@ -168,18 +168,24 @@ enum InfoMapBuyParam
BUYING_NO_ONE,
};
// weapon respawning return codes
enum
{
GR_NONE = 0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
@ -197,6 +203,7 @@ enum
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE = 0,
@ -212,67 +219,103 @@ class CGameRules {
protected:
virtual ~CGameRules() {};
public:
virtual void RefreshSkillData() = 0;
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsTeamplay() = 0;
virtual BOOL IsCoOp() = 0;
virtual void RefreshSkillData() = 0; // fill skill data struct with proper values
virtual void Think() = 0; // runs every server frame, should handle any timer tasks, periodic events, etc.
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; // Can this item spawn (eg monsters don't spawn in deathmatch).
// this is the game name that gets seen in the server browser
virtual const char *GetGameDescription() = 0;
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
virtual void ClientDisconnected(edict_t *pClient) = 0;
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0;
virtual BOOL FAllowFlashlight() = 0; // Are players allowed to switch on their flashlight?
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // should the player switch to this weapon?
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; // I can't use this weapon anymore, get me the next best one.
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer() = 0; // is this a multiplayer game? (either coop or deathmatch)
virtual BOOL IsDeathmatch() = 0; // is this a deathmatch game?
virtual BOOL IsTeamplay() = 0; // is this deathmatch game being played with team rules?
virtual BOOL IsCoOp() = 0; // is this a coop game?
virtual const char *GetGameDescription() = 0; // this is the game name that gets seen in the server browser
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0; // a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient) = 0; // a client just disconnected from the server
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0; // the client needs to be informed of the current game mode
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0; // can this player take damage from this attacker?
virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) = 0;
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; // is this player allowed to respawn now?
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; // When in the future will this player be able to spawn?
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; // Place this player on their spawnspot and face them the proper direction.
virtual BOOL AllowAutoTargetCrosshair() = 0;
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0;
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0;
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0;
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0;
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlHealthChargerRechargeTime() = 0;
virtual float FlHEVChargerRechargeTime() = 0;
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; // handles the user commands; returns TRUE if command handled properly
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0; // the player has changed userinfo; can change it now
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; // how many points do I award whoever kills this player?
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; // Called each time a player dies
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0; // Call this from within a GameRules class to report an obituary.
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0; // The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; // should this weapon respawn?
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; // when may this weapon respawn?
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; // where in the world should this weapon respawn?
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // is this player allowed to take this item?
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0; // Should this item respawn?
virtual float FlItemRespawnTime(CItem *pItem) = 0; // when may this item respawn?
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; // where in the world should this item respawn?
// Ammo retrieval
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0; // can this player take more of this ammo?
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; // called each time a player picks up some ammo in the world
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; // should this ammo item respawn?
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; // when should this ammo item respawn?
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; // where in the world should this ammo item respawn?
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
virtual float FlHEVChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; // what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; // Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; // what team is this entity on?
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; // What is the player's relationship with this entity?
virtual int GetTeamIndex(const char *pTeamName) = 0;
virtual const char *GetIndexedTeamName(int teamIndex) = 0;
virtual BOOL IsValidTeam(const char *pTeamName) = 0;
virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) = 0;
virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) = 0;
// Sounds
virtual BOOL PlayTextureSounds() = 0;
virtual BOOL FAllowMonsters() = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0; // are monsters allowed
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() = 0;
// Stuff that is shared between client and server.
@ -287,6 +330,7 @@ public:
char *m_GameDesc;
};
// CHalfLifeRules - rules for the single player Half-Life game.
class CHalfLifeRules: public CGameRules {
protected:
virtual ~CHalfLifeRules() {};
@ -294,46 +338,81 @@ public:
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsCoOp() = 0;
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient) = 0;
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
virtual BOOL AllowAutoTargetCrosshair() = 0;
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
// Weapon retrieval
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0;
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0;
};
// CHalfLifeMultiplay - rules for the basic half life multiplayer competition
class CHalfLifeMultiplay: public CGameRules {
protected:
virtual ~CHalfLifeMultiplay() {};
@ -342,54 +421,91 @@ public:
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsCoOp() = 0;
// Client connection/disconnection
// If ClientConnected returns FALSE, the connection is rejected and the user is provided the reason specified in szRejectReason
// Only the client's name and remote address are provided to the dll for verification.
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
virtual void ClientDisconnected(edict_t *pClient) = 0;
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0;
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
virtual BOOL AllowAutoTargetCrosshair() = 0;
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0;
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
// Death notices
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0;
virtual float FlHEVChargerRechargeTime() = 0;
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
virtual BOOL PlayTextureSounds() = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0;
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() = 0;
virtual void ServerDeactivate() = 0;
virtual void CheckMapConditions() = 0;

View File

@ -33,7 +33,7 @@ public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
// Don't treat as a live target
virtual BOOL IsAlive() = 0;
@ -62,7 +62,7 @@ public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Think() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:

View File

@ -85,7 +85,7 @@ public:
virtual void Precache() = 0;
virtual int ObjectCaps() = 0; // make hostage "useable"
virtual int Classify() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int BloodColor() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;

View File

@ -169,7 +169,7 @@ public:
virtual int ObjectCaps() = 0;
virtual void Activate() = 0;
virtual int Classify() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int BloodColor() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual Vector BodyTarget(const Vector &posSrc) = 0;

View File

@ -309,8 +309,8 @@ public:
virtual int ObjectCaps() = 0;
virtual int Classify() = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0;
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;

View File

@ -57,12 +57,12 @@ typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, float, Vector
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
// CBasePlayer::TakeDamage hook
typedef IHookChainClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
typedef IHookChainClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
// CBasePlayer::TakeHealth hook
typedef IHookChainClass<int, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClass<int, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
typedef IHookChainClass<BOOL, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
// CBasePlayer::Killed hook
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
@ -301,6 +301,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
// CanBuyThisItem hook
typedef IHookChain<bool, class CBasePlayer *, BuyItemID> IReGameHook_CanBuyThisItem;
typedef IHookChainRegistry<bool, class CBasePlayer *, BuyItemID> IReGameHookRegistry_CanBuyThisItem;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -374,25 +378,24 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0;
};
struct ReGameFuncs_t {
class CBasePlayer *(*UTIL_PlayerByIndex)(int playerIndex);
struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass);
void (*ChangeString)(char *&dest, const char *source);
void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
void (*ClearMultiDamage)();
void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker);
void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
};
class IReGameApi {
public:
virtual ~IReGameApi() { }
virtual ~IReGameApi() {}
virtual int GetMajorVersion() = 0;
virtual int GetMinorVersion() = 0;
@ -405,7 +408,6 @@ public:
virtual struct playermove_s* GetPlayerMove() = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0;
};
#define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001"

View File

@ -78,7 +78,14 @@ public:
virtual void SetBombIcon(bool bFlash = false);
virtual void SetScoreAttrib(CBasePlayer *dest);
virtual void SendItemStatus();
virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr);
virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false);
virtual void Observer_SetMode(int iMode);
virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
virtual bool SwitchWeapon(CBasePlayerItem *pWeapon);
virtual void SwitchTeam();
virtual bool JoinTeam(TeamName team);
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
virtual void TeamChangeUpdate();
CBasePlayer *BasePlayer() const;
public:

View File

@ -31,13 +31,15 @@
// operations that are treated as planar rather than 3d.
class Vector2D {
public:
inline Vector2D() : x(0.0), y(0.0) {}
inline Vector2D(float X, float Y) : x(0.0), y(0.0) { x = X; y = Y; }
inline Vector2D() : x(), y() {}
inline Vector2D(float X, float Y) : x(X), y(Y) {}
inline Vector2D(const Vector2D &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; }
inline Vector2D operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); }
inline Vector2D operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); }
inline Vector2D operator*(float fl) const { return Vector2D(x * fl, y * fl); }
inline Vector2D operator/(float fl) const { return Vector2D(x / fl, y / fl); }
inline Vector2D operator/=(float fl) const { return Vector2D(x / fl, y / fl); }
inline float Length() const { return sqrt(x * x + y * y); }
inline float LengthSquared() const { return (x * x + y * y); }
@ -89,11 +91,10 @@ inline Vector2D operator*(float fl, const Vector2D &v) { return v * fl; }
class Vector {
public:
// Construction/destruction
inline Vector() : x(0.0), y(0.0), z(0.0) {}
inline Vector(float X, float Y, float Z) : x(0.0), y(0.0), z(0.0) { x = X; y = Y; z = Z; }
inline Vector(const Vector &v) : x(0.0), y(0.0), z(0.0) { x = v.x; y = v.y; z = v.z; }
inline Vector(const float rgfl[3]) : x(0.0), y(0.0), z(0.0) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
inline Vector() : x(), y(), z() {}
inline Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {}
inline Vector(const Vector &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; *(int*)&z = *(int*)&v.z; }
inline Vector(const float rgfl[3]) { *(int*)&x = *(int*)&rgfl[0]; *(int*)&y = *(int*)&rgfl[1]; *(int*)&z = *(int*)&rgfl[2]; }
// Operators
inline Vector operator-() const { return Vector(-x, -y, -z); }
@ -106,7 +107,7 @@ public:
inline Vector operator/=(float fl) const{ return Vector(x / fl, y / fl, z / fl); }
// Methods
inline void CopyToArray(float *rgfl) const { rgfl[0] = x; rgfl[1] = y; rgfl[2] = z; }
inline void CopyToArray(float *rgfl) const { *(int*)&rgfl[0] = *(int*)&x; *(int*)&rgfl[1] = *(int*)&y; *(int*)&rgfl[2] = *(int*)&z; }
inline float Length() const { return sqrt(x * x + y * y + z * z); }
inline float LengthSquared() const { return (x * x + y * y + z * z); }
@ -122,7 +123,14 @@ public:
flLen = 1 / flLen;
return Vector(x * flLen, y * flLen, z * flLen);
}
inline Vector2D Make2D() const { return Vector2D(x, y); }
inline Vector2D Make2D() const
{
Vector2D Vec2;
*(int*)&Vec2.x = *(int*)&x;
*(int*)&Vec2.y = *(int*)&y;
return Vec2;
}
inline float Length2D() const { return sqrt(x * x + y * y); }
inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); }

View File

@ -35,7 +35,7 @@ public:
virtual void Spawn() = 0;
// invoked when injured by something
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
// invoked when killed
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;

View File

@ -76,7 +76,7 @@ public:
virtual void Spawn();
// invoked when injured by something
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
return CBasePlayer::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}

View File

@ -715,7 +715,7 @@ void CPendulum::Blocked(CBaseEntity *pOther) { Blocked_(pOther); }
void CBaseButton::Spawn() { Spawn_(); }
void CBaseButton::Precache() { Precache_(); }
void CBaseButton::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
int CBaseButton::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CBaseButton::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
int CBaseButton::Save(CSave &save) { return Save_(save); }
int CBaseButton::Restore(CRestore &restore) { return Restore_(restore); }
@ -748,7 +748,7 @@ int CEnvSpark::Restore(CRestore &restore) { return Restore_(restore); }
void CButtonTarget::Spawn() { Spawn_(); }
int CButtonTarget::ObjectCaps() { return ObjectCaps_(); }
int CButtonTarget::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CButtonTarget::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
void CButtonTarget::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
// career
@ -763,8 +763,8 @@ int CBaseEntity::Save(CSave &save) { return Save_(save); }
int CBaseEntity::Restore(CRestore &restore) { return Restore_(restore); }
void CBaseEntity::SetObjectCollisionBox() { SetObjectCollisionBox_(); }
void CBaseEntity::TraceAttack(entvars_t *pevAttacker,float flDamage,Vector vecDir,TraceResult *ptr,int bitsDamageType) { TraceAttack_(pevAttacker,flDamage,vecDir,ptr,bitsDamageType); }
int CBaseEntity::TakeDamage(entvars_t *pevInflictor,entvars_t *pevAttacker,float flDamage,int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
int CBaseEntity::TakeHealth(float flHealth,int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
BOOL CBaseEntity::TakeDamage(entvars_t *pevInflictor,entvars_t *pevAttacker,float flDamage,int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
BOOL CBaseEntity::TakeHealth(float flHealth,int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
void CBaseEntity::Killed(entvars_t *pevAttacker,int iGib) { Killed_(pevAttacker,iGib); }
void CBaseEntity::TraceBleed(float flDamage,Vector vecDir,TraceResult *ptr,int bitsDamageType) { TraceBleed_(flDamage,vecDir,ptr,bitsDamageType); }
int CBaseEntity::DamageDecal(int bitsDamageType) { return DamageDecal_(bitsDamageType); }
@ -776,8 +776,8 @@ BOOL CBaseEntity::FVisible(const Vector &vecOrigin) { return FVisible_(vecOrigin
// combat
void CBaseMonster::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
void CBaseMonster::TraceAttack(entvars_t *pevAttacker,float flDamage,Vector vecDir,TraceResult *ptr,int bitsDamageType) { TraceAttack_(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); }
int CBaseMonster::TakeDamage(entvars_t *pevInflictor,entvars_t *pevAttacker,float flDamage,int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
int CBaseMonster::TakeHealth(float flHealth,int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
BOOL CBaseMonster::TakeDamage(entvars_t *pevInflictor,entvars_t *pevAttacker,float flDamage,int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CBaseMonster::TakeHealth(float flHealth,int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
void CBaseMonster::Killed(entvars_t *pevAttacker,int iGib) { Killed_(pevAttacker, iGib); }
float CBaseMonster::ChangeYaw(int speed) { return ChangeYaw_(speed); }
BOOL CBaseMonster::HasHumanGibs() { return HasHumanGibs_(); }
@ -917,7 +917,7 @@ void CBreakable::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
int CBreakable::Save(CSave &save) { return Save_(save); }
int CBreakable::Restore(CRestore &restore) { return Restore_(restore); }
void CBreakable::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { TraceAttack_(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); }
int CBreakable::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CBreakable::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
int CBreakable::DamageDecal(int bitsDamageType) { return DamageDecal_(bitsDamageType); }
void CBreakable::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
@ -926,7 +926,7 @@ void CPushable::Precache() { Precache_(); }
void CPushable::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
int CPushable::Save(CSave &save) { return Save_(save); }
int CPushable::Restore(CRestore &restore) { return Restore_(restore); }
int CPushable::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CPushable::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
void CPushable::Touch(CBaseEntity *pOther) { Touch_(pOther); }
void CPushable::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
@ -1001,14 +1001,14 @@ void CCyclerSprite::Spawn() { Spawn_(); }
void CCyclerSprite::Restart() { Restart_(); }
int CCyclerSprite::Save(CSave &save) { return Save_(save); }
int CCyclerSprite::Restore(CRestore &restore) { return Restore_(restore); }
int CCyclerSprite::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
BOOL CCyclerSprite::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
void CCyclerSprite::Think() { Think_(); }
void CCyclerSprite::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator,pCaller,useType,value); }
void CCycler::Spawn() { Spawn_(); }
int CCycler::Save(CSave &save) { return Save_(save); }
int CCycler::Restore(CRestore &restore) { return Restore_(restore); }
int CCycler::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
BOOL CCycler::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor,pevAttacker,flDamage,bitsDamageType); }
void CCycler::Think() { Think_(); }
void CCycler::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator,pCaller,useType,value); }
@ -1281,7 +1281,7 @@ void CGunTarget::Spawn() { Spawn_(); }
int CGunTarget::Save(CSave &save) { return Save_(save); }
int CGunTarget::Restore(CRestore &restore) { return Restore_(restore); }
void CGunTarget::Activate() { Activate_(); }
int CGunTarget::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CGunTarget::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
void CGunTarget::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
// player
@ -1292,8 +1292,8 @@ int CBasePlayer::ObjectCaps() { return ObjectCaps_(); }
int CBasePlayer::Restore(CRestore &restore) { return Restore_(restore); }
int CBasePlayer::Classify() { return Classify_(); }
void CBasePlayer::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { TraceAttack_(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); }
int CBasePlayer::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
int CBasePlayer::TakeHealth(float flHealth, int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
BOOL CBasePlayer::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CBasePlayer::TakeHealth(float flHealth, int bitsDamageType) { return TakeHealth_(flHealth, bitsDamageType); }
void CBasePlayer::Killed(entvars_t *pevAttacker, int iGib) { Killed_(pevAttacker, iGib); }
void CBasePlayer::AddPoints(int score, BOOL bAllowNegativeScore) { AddPoints_(score, bAllowNegativeScore); }
void CBasePlayer::AddPointsToTeam(int score, BOOL bAllowNegativeScore) { AddPointsToTeam_(score, bAllowNegativeScore); }
@ -1943,7 +1943,7 @@ void CXM1014::WeaponIdle() { WeaponIdle_(); }
void CHostage::Spawn() { Spawn_(); }
void CHostage::Precache() { Precache_(); }
int CHostage::ObjectCaps() { return ObjectCaps_(); }
int CHostage::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CHostage::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
void CHostage::Touch(CBaseEntity *pOther) { Touch_(pOther); }
void CHostage::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
@ -2032,7 +2032,7 @@ void HostageRetreatState::OnExit(CHostageImprov *improv) { OnExit_(improv); }
// cs_bot
void CCSBot::Walk() { Walk_(); }
bool CCSBot::Jump(bool mustJump) { return Jump_(mustJump); }
int CCSBot::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
BOOL CCSBot::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { return TakeDamage_(pevInflictor, pevAttacker, flDamage, bitsDamageType); }
void CCSBot::Killed(entvars_t *pevAttacker, int iGib) { Killed_(pevAttacker, iGib); }
// cs_bot_chatter

View File

@ -57,12 +57,12 @@ typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, float, Vector
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
// CBasePlayer::TakeDamage hook
typedef IHookChainClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
typedef IHookChainClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
// CBasePlayer::TakeHealth hook
typedef IHookChainClass<int, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClass<int, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
typedef IHookChainClass<BOOL, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
// CBasePlayer::Killed hook
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
@ -301,6 +301,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
// CanBuyThisItem hook
typedef IHookChain<bool, class CBasePlayer *, BuyItemID> IReGameHook_CanBuyThisItem;
typedef IHookChainRegistry<bool, class CBasePlayer *, BuyItemID> IReGameHookRegistry_CanBuyThisItem;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -374,6 +378,8 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0;
};
struct ReGameFuncs_t {

View File

@ -114,6 +114,8 @@ IReGameHookRegistry_CSGameRules_ChangeLevel* CReGameHookchains::CSGameRules_Chan
IReGameHookRegistry_CSGameRules_GoToIntermission* CReGameHookchains::CSGameRules_GoToIntermission() { return &m_CSGameRules_GoToIntermission; }
IReGameHookRegistry_CSGameRules_BalanceTeams* CReGameHookchains::CSGameRules_BalanceTeams() { return &m_CSGameRules_BalanceTeams; }
IReGameHookRegistry_CanBuyThisItem* CReGameHookchains::CanBuyThisItem() { return &m_CanBuyThisItem; }
int CReGameApi::GetMajorVersion()
{
return REGAMEDLL_API_VERSION_MAJOR;

View File

@ -52,12 +52,12 @@ typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, float, Vector &, Trace
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, entvars_t *, float, Vector &, TraceResult *, int> CReGameHookRegistry_CBasePlayer_TraceAttack;
// CBasePlayer::TakeDamage hook
typedef IHookChainClassImpl<int, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClassImpl<int, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHookRegistry_CBasePlayer_TakeDamage;
typedef IHookChainClassImpl<BOOL, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHookRegistry_CBasePlayer_TakeDamage;
// CBasePlayer::TakeHealth hook
typedef IHookChainClassImpl<int, CBasePlayer, float, int> CReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClassImpl<int, CBasePlayer, float, int> CReGameHookRegistry_CBasePlayer_TakeHealth;
typedef IHookChainClassImpl<BOOL, CBasePlayer, float, int> CReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, float, int> CReGameHookRegistry_CBasePlayer_TakeHealth;
// CBasePlayer::Killed hook
typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, int> CReGameHook_CBasePlayer_Killed;
@ -296,6 +296,10 @@ typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHo
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_BalanceTeams;
// CanBuyThisItem hook
typedef IHookChainImpl<bool, class CBasePlayer *, BuyItemID> CReGameHook_CanBuyThisItem;
typedef IHookChainRegistryImpl<bool, class CBasePlayer *, BuyItemID> CReGameHookRegistry_CanBuyThisItem;
class CReGameHookchains: public IReGameHookchains {
public:
// CBasePlayer virtual
@ -369,6 +373,8 @@ public:
CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission;
CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams;
CReGameHookRegistry_CanBuyThisItem m_CanBuyThisItem;
public:
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn();
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache();
@ -439,6 +445,8 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel();
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission();
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams();
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem();
};
extern CReGameHookchains g_ReGameHookchains;