diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 82d305bc..c27e3d4e 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1248,7 +1248,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) bEnoughMoney = true; pPlayer->m_bHasNightVision = true; - pPlayer->AddAccount(-NVG_PRICE); + pPlayer->AddAccount(-NVG_PRICE, RT_PLAYER_BOUGHT_SOMETHING); SendItemStatus(pPlayer); } @@ -1283,7 +1283,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) MESSAGE_END(); pPlayer->pev->body = 1; - pPlayer->AddAccount(-DEFUSEKIT_PRICE); + pPlayer->AddAccount(-DEFUSEKIT_PRICE, RT_PLAYER_BOUGHT_SOMETHING); EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/kevlar.wav", VOL_NORM, ATTN_NORM); SendItemStatus(pPlayer); @@ -1301,7 +1301,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) DropPrimary(pPlayer); pPlayer->GiveShield(true); - pPlayer->AddAccount(-SHIELDGUN_PRICE); + pPlayer->AddAccount(-SHIELDGUN_PRICE, RT_PLAYER_BOUGHT_SOMETHING); EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM); } @@ -1323,7 +1323,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pszItem != NULL) { pPlayer->GiveNamedItem(pszItem); - pPlayer->AddAccount(-iItemPrice); + pPlayer->AddAccount(-iItemPrice, RT_PLAYER_BOUGHT_SOMETHING); } if (TheTutor != NULL) @@ -1365,7 +1365,7 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) } pPlayer->GiveNamedItem(info->entityName); - pPlayer->AddAccount(-info->cost); + pPlayer->AddAccount(-info->cost, RT_PLAYER_BOUGHT_SOMETHING); if (TheTutor != NULL) { @@ -2013,7 +2013,7 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) if (player->m_iAccount >= info->clipCost) { player->GiveNamedItem(info->ammoName); - player->AddAccount(-info->clipCost); + player->AddAccount(-info->clipCost, RT_PLAYER_BOUGHT_SOMETHING); return true; } diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index 011fc23b..b8a5dba6 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -1176,14 +1176,15 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker #endif } +#ifdef REGAMEDLL_FIXES + // not allow inflict to the player damage is less than 1.0f and to entities not less than 0.0f + if ((pEntity->Classify() == CLASS_PLAYER && flAdjustedDamage < 1.0f) || flAdjustedDamage <= 0.0f) + continue; +#else if (flAdjustedDamage < 0) flAdjustedDamage = 0; - -#ifdef REGAMEDLL_FIXES - if (flAdjustedDamage > 0) #endif pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType); - } } } @@ -1198,23 +1199,27 @@ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke if (flRadius) falloff = flDamage / flRadius; else - falloff = 1; + falloff = 1.0; int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER); + // in case grenade is lying on the ground vecSrc.z += 1; if (!pevAttacker) pevAttacker = pevInflictor; + // iterate on all entities in the vicinity. while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)) != NULL) { if (pEntity->pev->takedamage != DAMAGE_NO) { + // UNDONE: this should check a damage mask, not an ignore if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore) continue; - if (bInWater && !pEntity->pev->waterlevel) + // blast's don't tavel into or out of water + if (bInWater && pEntity->pev->waterlevel == 0) continue; if (!bInWater && pEntity->pev->waterlevel == 3) diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index 3a71571b..8ae3ea74 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -128,7 +128,8 @@ enum RewardAccount REWARD_KILLED_VIP = 2500, REWARD_VIP_HAVE_SELF_RESCUED = 2500, - REWARD_TAKEN_HOSTAGE = 1000 + REWARD_TAKEN_HOSTAGE = 1000, + REWARD_TOOK_HOSTAGE = 150 }; diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index 59dbc29f..aebf7a85 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -281,7 +281,7 @@ void CHostage::IdleThink() if (player != NULL) { - player->AddAccount(REWARD_TAKEN_HOSTAGE); + player->AddAccount(REWARD_TAKEN_HOSTAGE, RT_HOSTAGE_RESCUED); UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname), GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); } @@ -453,7 +453,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt if (pAttacker != NULL) { - pAttacker->AddAccount(-20 * int(flActualDamage)); + pAttacker->AddAccount(-20 * int(flActualDamage), RT_HOSTAGE_DAMAGED); if (TheBots != NULL) { @@ -479,7 +479,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt if (pAttacker != NULL) { - pAttacker->AddAccount(20 * (-25 - int(flActualDamage))); + pAttacker->AddAccount(20 * (-25 - int(flActualDamage)), RT_HOSTAGE_KILLED); AnnounceDeath(pAttacker); ApplyHostagePenalty(pAttacker); } @@ -756,7 +756,7 @@ void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) m_bTouched = TRUE; CSGameRules()->m_iAccountCT += 100; - pPlayer->AddAccount(150); + pPlayer->AddAccount(REWARD_TOOK_HOSTAGE, RT_HOSTAGE_TOOK); UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict())); } diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index d3a2221a..bdc02989 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -1927,7 +1927,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (hostage->pev->solid != SOLID_NOT) { - acct_tmp += 150; + acct_tmp += REWARD_TOOK_HOSTAGE; if (hostage->pev->deadflag == DEAD_DEAD) { @@ -2039,7 +2039,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() { if (!player->m_bReceivesNoMoneyNextRound) { - player->AddAccount(m_iAccountCT); + player->AddAccount(m_iAccountCT, RT_ROUND_BONUS); } } else if (player->m_iTeam == TERRORIST) @@ -2049,7 +2049,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (!player->m_bReceivesNoMoneyNextRound) { - player->AddAccount(m_iAccountTerrorist); + player->AddAccount(m_iAccountTerrorist, RT_ROUND_BONUS); } // If it's a prison scenario then remove the Ts guns @@ -3668,7 +3668,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars // if a player dies by from teammate pKiller->frags -= IPointsForKill(peKiller, pVictim); - killer->AddAccount(PAYBACK_FOR_KILLED_TEAMMATES); + killer->AddAccount(PAYBACK_FOR_KILLED_TEAMMATES, RT_TEAMMATES_KILLED); killer->m_iTeamKills++; killer->m_bJustKilledTeammate = true; @@ -3701,7 +3701,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars if (pVictim->m_bIsVIP) { killer->HintMessage("#Hint_reward_for_killing_vip", TRUE); - killer->AddAccount(REWARD_KILLED_VIP); + killer->AddAccount(REWARD_KILLED_VIP, RT_VIP_KILLED); MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); WRITE_BYTE(9); @@ -3714,7 +3714,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Assassinated_The_VIP\"\n", STRING(killer->pev->netname), GETPLAYERUSERID(killer->edict()), GETPLAYERAUTHID(killer->edict())); } else - killer->AddAccount(REWARD_KILLED_ENEMY); + killer->AddAccount(REWARD_KILLED_ENEMY, RT_ENEMY_KILLED); if (!(killer->m_flDisplayHistory & DHF_ENEMY_KILLED)) { diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 504606d4..177b8d16 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3070,9 +3070,9 @@ NOXREF void CBasePlayer::ThrowPrimary() DropShield(); } -LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddAccount, (int amount, bool bTrackChange), amount, bTrackChange); +LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddAccount, (int amount, RewardType type, bool bTrackChange), amount, type, bTrackChange); -void CBasePlayer::__API_HOOK(AddAccount)(int amount, bool bTrackChange) +void CBasePlayer::__API_HOOK(AddAccount)(int amount, RewardType type, bool bTrackChange) { m_iAccount += amount; @@ -3300,7 +3300,7 @@ void CBasePlayer::JoiningThink() { m_iAccount = 0; CheckStartMoney(); - AddAccount(startmoney.value); + AddAccount(startmoney.value, RT_INTO_GAME); } if (g_pGameRules->FPlayerCanRespawn(this)) @@ -5499,7 +5499,7 @@ void CBasePlayer::Reset() RemoveShield(); CheckStartMoney(); - AddAccount(startmoney.value); + AddAccount(startmoney.value, RT_PLAYER_RESET); MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(edict())); diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 3ccb185f..2fae8061 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -140,6 +140,24 @@ #define SOUND_FLASHLIGHT_ON "items/flashlight1.wav" #define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav" +// custom enum +enum RewardType +{ + RT_NONE, + RT_ROUND_BONUS, + RT_PLAYER_RESET, + RT_PLAYER_BOUGHT_SOMETHING, + RT_HOSTAGE_TOOK, + RT_HOSTAGE_RESCUED, + RT_HOSTAGE_DAMAGED, + RT_HOSTAGE_KILLED, + RT_TEAMMATES_KILLED, + RT_ENEMY_KILLED, + RT_INTO_GAME, + RT_VIP_KILLED, + RT_VIP_RESCUED_MYSELF +}; + typedef enum { PLAYER_IDLE, @@ -424,8 +442,8 @@ public: void SmartRadio(); void ThrowWeapon(char *pszItemName); void ThrowPrimary(); - void AddAccount(int amount, bool bTrackChange = true); - void AddAccount_(int amount, bool bTrackChange = true); + void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true); + void AddAccount_(int amount, RewardType type = RT_NONE, bool bTrackChange = true); void Disappear(); void MakeVIP(); bool CanPlayerBuy(bool display = false); diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index 55beadbc..1f26a861 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -1770,7 +1770,7 @@ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther) p->m_bEscaped = true; p->Disappear(); - p->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED); + p->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED, RT_VIP_RESCUED_MYSELF); } } diff --git a/regamedll/extra/cssdk/dlls/player.h b/regamedll/extra/cssdk/dlls/player.h index dd19b9c8..15e57ac9 100644 --- a/regamedll/extra/cssdk/dlls/player.h +++ b/regamedll/extra/cssdk/dlls/player.h @@ -132,6 +132,24 @@ #define SOUND_FLASHLIGHT_ON "items/flashlight1.wav" #define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav" +// custom enum +enum RewardType +{ + RT_NONE, + RT_ROUND_BONUS, + RT_PLAYER_RESET, + RT_PLAYER_BOUGHT_SOMETHING, + RT_HOSTAGE_TOOK, + RT_HOSTAGE_RESCUED, + RT_HOSTAGE_DAMAGED, + RT_HOSTAGE_KILLED, + RT_TEAMMATES_KILLED, + RT_ENEMY_KILLED, + RT_INTO_GAME, + RT_VIP_KILLED, + RT_VIP_RESCUED_MYSELF +}; + typedef enum { PLAYER_IDLE, diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index 70632062..411c5958 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -140,8 +140,8 @@ typedef IVoidHookChain IReGameHook_CBasePlayer_GiveNamedItem; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChain IReGameHook_CBasePlayer_AddAccount; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; +typedef IVoidHookChain IReGameHook_CBasePlayer_AddAccount; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; // CBasePlayer::GiveShield hook typedef IVoidHookChain IReGameHook_CBasePlayer_GiveShield; diff --git a/regamedll/extra/cssdk/dlls/regamedll_interfaces.h b/regamedll/extra/cssdk/dlls/regamedll_interfaces.h index 371725ee..033e6bb8 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_interfaces.h +++ b/regamedll/extra/cssdk/dlls/regamedll_interfaces.h @@ -297,7 +297,7 @@ public: virtual bool IsConnected() const = 0; virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0; - virtual void AddAccount(int amount, bool bTrackChange = true) = 0; + virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) = 0; virtual void GiveNamedItem(const char *pszName) = 0; virtual void GiveNamedItemEx(const char *pszName) = 0; virtual void GiveDefaultItems() = 0; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 70632062..411c5958 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -140,8 +140,8 @@ typedef IVoidHookChain IReGameHook_CBasePlayer_GiveNamedItem; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChain IReGameHook_CBasePlayer_AddAccount; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; +typedef IVoidHookChain IReGameHook_CBasePlayer_AddAccount; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; // CBasePlayer::GiveShield hook typedef IVoidHookChain IReGameHook_CBasePlayer_GiveShield; diff --git a/regamedll/public/regamedll/regamedll_interfaces.h b/regamedll/public/regamedll/regamedll_interfaces.h index 371725ee..033e6bb8 100644 --- a/regamedll/public/regamedll/regamedll_interfaces.h +++ b/regamedll/public/regamedll/regamedll_interfaces.h @@ -297,7 +297,7 @@ public: virtual bool IsConnected() const = 0; virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0; - virtual void AddAccount(int amount, bool bTrackChange = true) = 0; + virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) = 0; virtual void GiveNamedItem(const char *pszName) = 0; virtual void GiveNamedItemEx(const char *pszName) = 0; virtual void GiveDefaultItems() = 0; diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index c0cd8dac..2453317d 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -137,10 +137,10 @@ typedef IVoidHookChainClassImpl CRegameHook_CBasePlay typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_AddAccount; -typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddAccount; +typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_AddAccount; +typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddAccount; -// CBasePlayer::AddAccount hook +// CBasePlayer::GiveShield hook typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_GiveShield; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveShield; diff --git a/regamedll/regamedll/regamedll_interfaces_impl.h b/regamedll/regamedll/regamedll_interfaces_impl.h index 33a1cc1f..90a5281c 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.h +++ b/regamedll/regamedll/regamedll_interfaces_impl.h @@ -341,7 +341,7 @@ public: virtual bool IsConnected() const { return m_pEntity->has_disconnected == false; } virtual void SetAnimation(PLAYER_ANIM playerAnim) { ((CBasePlayer *)m_pEntity)->SetAnimation(playerAnim); } - virtual void AddAccount(int amount, bool bTrackChange = true) { ((CBasePlayer *)m_pEntity)->AddAccount(amount, bTrackChange); } + virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) { ((CBasePlayer *)m_pEntity)->AddAccount(amount, type, bTrackChange); } virtual void GiveNamedItem(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItem(pszName); } virtual void GiveNamedItemEx(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItemEx(pszName); } virtual void GiveDefaultItems() { ((CBasePlayer *)m_pEntity)->GiveDefaultItems(); }