mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 07:05:38 +03:00
Fix nade drops
Move m_bHasSecondaryAttack to CCSPlayerWeapon
This commit is contained in:
parent
c0edbd551d
commit
10ee63d807
@ -129,7 +129,7 @@ void CTriggerSetOrigin::SetupEntities()
|
|||||||
m_bSetupEntities = false;
|
m_bSetupEntities = false;
|
||||||
m_entityNum = 0;
|
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())
|
if (!m_hCopyPointer.IsValid() && hPrevEnt.IsValid())
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ void CTriggerSetOrigin::SetupEntities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBaseEntity *pEntity = nullptr;
|
CBaseEntity *pEntity = nullptr;
|
||||||
while ((pEntity = UTIL_FindEntityByTargetname(pEntity, STRING(pev->target))))
|
while ((pEntity = UTIL_FindEntityByTargetname(pEntity, pev->target)))
|
||||||
{
|
{
|
||||||
if (m_entityNum > MAX_SETORIGIN_ENTITIES)
|
if (m_entityNum > MAX_SETORIGIN_ENTITIES)
|
||||||
break;
|
break;
|
||||||
|
@ -169,10 +169,6 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
|
|||||||
if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||||
|| (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
|| (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
||||||
|| (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
|| (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
||||||
#ifndef REGAMEDLL_FIXES
|
|
||||||
// TODO: already is checked shotguns!
|
|
||||||
|| (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
|
||||||
#endif
|
|
||||||
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
||||||
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|
||||||
|| (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN)
|
|| (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN)
|
||||||
@ -722,13 +718,6 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
|||||||
|
|
||||||
BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
||||||
{
|
{
|
||||||
#ifndef REGAMEDLL_FIXES
|
|
||||||
if (pPlayer && UTIL_GetLocalPlayer())
|
|
||||||
{
|
|
||||||
UTIL_GetLocalPlayer();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,7 +1298,7 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pPlayer->pev->button & IN_ATTACK) && pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) {
|
if (pItem->m_flStartThrow && pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,7 +795,7 @@ bool CBasePlayerWeapon::HasSecondaryAttack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REGAMEDLL_API
|
#ifdef REGAMEDLL_API
|
||||||
if (CSPlayerItem()->m_bHasSecondaryAttack)
|
if (CSPlayerWeapon()->m_bHasSecondaryAttack)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1092,7 +1092,7 @@ void CBasePlayerWeapon::Spawn()
|
|||||||
CSPlayerItem()->SetItemInfo(&info);
|
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
|
// CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal
|
||||||
|
@ -317,6 +317,7 @@ inline CCSPlayerItem *CBasePlayerItem::CSPlayerItem() const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// inventory items that
|
// inventory items that
|
||||||
|
class CCSPlayerWeapon;
|
||||||
class CBasePlayerWeapon: public CBasePlayerItem
|
class CBasePlayerWeapon: public CBasePlayerItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -375,6 +376,10 @@ public:
|
|||||||
bool ShieldSecondaryFire(int iUpAnim, int iDownAnim);
|
bool ShieldSecondaryFire(int iUpAnim, int iDownAnim);
|
||||||
void InstantReload(bool bCanRefillBPAmmo = false);
|
void InstantReload(bool bCanRefillBPAmmo = false);
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_API
|
||||||
|
CCSPlayerWeapon *CSPlayerWeapon() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TYPEDESCRIPTION m_SaveData[];
|
static TYPEDESCRIPTION m_SaveData[];
|
||||||
|
|
||||||
@ -417,6 +422,13 @@ public:
|
|||||||
float m_flLastFireTime;
|
float m_flLastFireTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_API
|
||||||
|
inline CCSPlayerWeapon *CBasePlayerWeapon::CSPlayerWeapon() const
|
||||||
|
{
|
||||||
|
return reinterpret_cast<CCSPlayerWeapon *>(this->m_pEntity);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class CWeaponBox: public CBaseEntity
|
class CWeaponBox: public CBaseEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -270,10 +270,14 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum)
|
|||||||
|
|
||||||
profile->m_name = CloneString(SharedGetToken());
|
profile->m_name = CloneString(SharedGetToken());
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (RANDOM_LONG(0, 2) == 2)
|
||||||
|
#else
|
||||||
// HACK HACK
|
// HACK HACK
|
||||||
// Until we have a generalized means of storing bot preferences, we're going to hardcode the bot's
|
// 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.
|
// preference towards silencers based on his name.
|
||||||
if (profile->m_name[0] % 2)
|
if (profile->m_name[0] % 2)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
profile->m_prefersSilencer = true;
|
profile->m_prefersSilencer = true;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ class CCSShield: public CCSEntity {};
|
|||||||
class CCSDeadHEV: public CCSMonster {};
|
class CCSDeadHEV: public CCSMonster {};
|
||||||
class CCSSprayCan: public CCSEntity {};
|
class CCSSprayCan: public CCSEntity {};
|
||||||
class CCSBloodSplat: public CCSEntity {};
|
class CCSBloodSplat: public CCSEntity {};
|
||||||
class CCSPlayerWeapon: public CCSPlayerItem {};
|
|
||||||
class CCSWorld: public CCSEntity {};
|
class CCSWorld: public CCSEntity {};
|
||||||
class CCSDecal: public CCSEntity {};
|
class CCSDecal: public CCSEntity {};
|
||||||
class CCSCorpse: public CCSEntity {};
|
class CCSCorpse: public CCSEntity {};
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <API/CSPlayerItem.h>
|
#include <API/CSPlayerItem.h>
|
||||||
|
#include <API/CSPlayerWeapon.h>
|
||||||
|
|
||||||
class CCSPlayer: public CCSMonster {
|
class CCSPlayer: public CCSMonster {
|
||||||
public:
|
public:
|
||||||
|
@ -32,8 +32,7 @@ class CBasePlayerItem;
|
|||||||
class CCSPlayerItem: public CCSAnimating
|
class CCSPlayerItem: public CCSAnimating
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCSPlayerItem() :
|
CCSPlayerItem()
|
||||||
m_bHasSecondaryAttack(false)
|
|
||||||
{
|
{
|
||||||
Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo));
|
Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo));
|
||||||
}
|
}
|
||||||
@ -44,7 +43,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ItemInfo m_ItemInfo;
|
ItemInfo m_ItemInfo;
|
||||||
bool m_bHasSecondaryAttack;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inlines
|
// Inlines
|
||||||
|
50
regamedll/public/regamedll/API/CSPlayerWeapon.h
Normal file
50
regamedll/public/regamedll/API/CSPlayerWeapon.h
Normal file
@ -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<CBasePlayerWeapon *>(this->m_pContainingEntity);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user