diff --git a/regamedll/dlls/addons/trigger_setorigin.cpp b/regamedll/dlls/addons/trigger_setorigin.cpp index 2c709272..d7d3c6f1 100644 --- a/regamedll/dlls/addons/trigger_setorigin.cpp +++ b/regamedll/dlls/addons/trigger_setorigin.cpp @@ -129,7 +129,7 @@ void CTriggerSetOrigin::SetupEntities() m_bSetupEntities = false; m_entityNum = 0; - m_hCopyPointer = UTIL_FindEntityByTargetname(m_hCopyPointer, STRING(m_copyPointer)); + m_hCopyPointer = UTIL_FindEntityByTargetname(m_hCopyPointer, m_copyPointer); if (!m_hCopyPointer.IsValid() && hPrevEnt.IsValid()) { @@ -137,7 +137,7 @@ void CTriggerSetOrigin::SetupEntities() } CBaseEntity *pEntity = nullptr; - while ((pEntity = UTIL_FindEntityByTargetname(pEntity, STRING(pev->target)))) + while ((pEntity = UTIL_FindEntityByTargetname(pEntity, pev->target))) { if (m_entityNum > MAX_SETORIGIN_ENTITIES) break; diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 664e14f6..f766c906 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -169,10 +169,6 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) || (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN) || (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE) -#ifndef REGAMEDLL_FIXES - // TODO: already is checked shotguns! - || (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) -#endif || (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE) || (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN) || (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN) @@ -722,13 +718,6 @@ void CCSBotManager::ServerCommand(const char *pcmd) BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd) { -#ifndef REGAMEDLL_FIXES - if (pPlayer && UTIL_GetLocalPlayer()) - { - UTIL_GetLocalPlayer(); - } -#endif - return FALSE; } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 3f2d4e8b..50ab110a 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1298,7 +1298,7 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) break; } - if ((pPlayer->pev->button & IN_ATTACK) && pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) { + if (pItem->m_flStartThrow && pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) { return; } diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 006ffc66..73ff6055 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -795,7 +795,7 @@ bool CBasePlayerWeapon::HasSecondaryAttack() } #ifdef REGAMEDLL_API - if (CSPlayerItem()->m_bHasSecondaryAttack) + if (CSPlayerWeapon()->m_bHasSecondaryAttack) { return true; } @@ -1092,7 +1092,7 @@ void CBasePlayerWeapon::Spawn() CSPlayerItem()->SetItemInfo(&info); } - CSPlayerItem()->m_bHasSecondaryAttack = HasSecondaryAttack(); + CSPlayerWeapon()->m_bHasSecondaryAttack = HasSecondaryAttack(); } // CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 393abaeb..4f97b8b2 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -317,6 +317,7 @@ inline CCSPlayerItem *CBasePlayerItem::CSPlayerItem() const #endif // inventory items that +class CCSPlayerWeapon; class CBasePlayerWeapon: public CBasePlayerItem { public: @@ -375,6 +376,10 @@ public: bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); void InstantReload(bool bCanRefillBPAmmo = false); +#ifdef REGAMEDLL_API + CCSPlayerWeapon *CSPlayerWeapon() const; +#endif + public: static TYPEDESCRIPTION m_SaveData[]; @@ -417,6 +422,13 @@ public: float m_flLastFireTime; }; +#ifdef REGAMEDLL_API +inline CCSPlayerWeapon *CBasePlayerWeapon::CSPlayerWeapon() const +{ + return reinterpret_cast(this->m_pEntity); +} +#endif + class CWeaponBox: public CBaseEntity { public: diff --git a/regamedll/game_shared/bot/bot_profile.cpp b/regamedll/game_shared/bot/bot_profile.cpp index 1cc77181..c025f903 100644 --- a/regamedll/game_shared/bot/bot_profile.cpp +++ b/regamedll/game_shared/bot/bot_profile.cpp @@ -270,10 +270,14 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) profile->m_name = CloneString(SharedGetToken()); +#ifdef REGAMEDLL_FIXES + if (RANDOM_LONG(0, 2) == 2) +#else // HACK HACK // Until we have a generalized means of storing bot preferences, we're going to hardcode the bot's // preference towards silencers based on his name. if (profile->m_name[0] % 2) +#endif { profile->m_prefersSilencer = true; } diff --git a/regamedll/public/regamedll/API/CSInterfaces.h b/regamedll/public/regamedll/API/CSInterfaces.h index ffef85c7..74c541e4 100644 --- a/regamedll/public/regamedll/API/CSInterfaces.h +++ b/regamedll/public/regamedll/API/CSInterfaces.h @@ -39,7 +39,6 @@ class CCSShield: public CCSEntity {}; class CCSDeadHEV: public CCSMonster {}; class CCSSprayCan: public CCSEntity {}; class CCSBloodSplat: public CCSEntity {}; -class CCSPlayerWeapon: public CCSPlayerItem {}; class CCSWorld: public CCSEntity {}; class CCSDecal: public CCSEntity {}; class CCSCorpse: public CCSEntity {}; diff --git a/regamedll/public/regamedll/API/CSPlayer.h b/regamedll/public/regamedll/API/CSPlayer.h index f306b1c7..7b9b1fb8 100644 --- a/regamedll/public/regamedll/API/CSPlayer.h +++ b/regamedll/public/regamedll/API/CSPlayer.h @@ -29,6 +29,7 @@ #pragma once #include +#include class CCSPlayer: public CCSMonster { public: diff --git a/regamedll/public/regamedll/API/CSPlayerItem.h b/regamedll/public/regamedll/API/CSPlayerItem.h index 3cc56f0a..8c47d6e5 100644 --- a/regamedll/public/regamedll/API/CSPlayerItem.h +++ b/regamedll/public/regamedll/API/CSPlayerItem.h @@ -32,8 +32,7 @@ class CBasePlayerItem; class CCSPlayerItem: public CCSAnimating { public: - CCSPlayerItem() : - m_bHasSecondaryAttack(false) + CCSPlayerItem() { Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo)); } @@ -44,7 +43,6 @@ public: public: ItemInfo m_ItemInfo; - bool m_bHasSecondaryAttack; }; // Inlines diff --git a/regamedll/public/regamedll/API/CSPlayerWeapon.h b/regamedll/public/regamedll/API/CSPlayerWeapon.h new file mode 100644 index 00000000..32e32f90 --- /dev/null +++ b/regamedll/public/regamedll/API/CSPlayerWeapon.h @@ -0,0 +1,50 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ + +#pragma once + +class CBasePlayerWeapon; +class CCSPlayerWeapon: public CCSPlayerItem +{ +public: + CCSPlayerWeapon() : + m_bHasSecondaryAttack(false) + { + } + + CBasePlayerWeapon *BasePlayerWeapon() const; + +public: + bool m_bHasSecondaryAttack; +}; + +// Inlines +inline CBasePlayerWeapon *CCSPlayerWeapon::BasePlayerWeapon() const +{ + return reinterpret_cast(this->m_pContainingEntity); +}