mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-06-04 01:47:42 +03:00
Added factory for bullet-firing guns
This commit is contained in:
parent
ee46bc4bd1
commit
179b7a5298
@ -6,7 +6,6 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
#pragma region Melee
|
|
||||||
class C_HLCustomWeaponMelee : public C_BaseHLBludgeonWeapon
|
class C_HLCustomWeaponMelee : public C_BaseHLBludgeonWeapon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -31,4 +30,30 @@ C_HLCustomWeaponMelee::C_HLCustomWeaponMelee()
|
|||||||
{
|
{
|
||||||
m_iszWeaponScriptName[0] = '\0';
|
m_iszWeaponScriptName[0] = '\0';
|
||||||
}
|
}
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
class C_HLCustomWeaponGun : public C_BaseHLBludgeonWeapon
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(C_HLCustomWeaponGun, C_BaseHLBludgeonWeapon);
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
DECLARE_PREDICTABLE();
|
||||||
|
|
||||||
|
C_HLCustomWeaponGun();
|
||||||
|
|
||||||
|
virtual const char* GetWeaponScriptName() { return m_iszWeaponScriptName; }
|
||||||
|
private:
|
||||||
|
char m_iszWeaponScriptName[128];
|
||||||
|
};
|
||||||
|
|
||||||
|
STUB_WEAPON_CLASS_IMPLEMENT(weapon_hlcustomgun, C_HLCustomWeaponGun);
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT(C_HLCustomWeaponGun, DT_HLCustomWeaponGun, CHLCustomWeaponGun)
|
||||||
|
RecvPropString(RECVINFO(m_iszWeaponScriptName)),
|
||||||
|
END_RECV_TABLE();
|
||||||
|
|
||||||
|
C_HLCustomWeaponGun::C_HLCustomWeaponGun()
|
||||||
|
{
|
||||||
|
m_iszWeaponScriptName[0] = '\0';
|
||||||
|
}
|
@ -2789,7 +2789,6 @@ Activity CBaseCombatCharacter::Weapon_BackupActivity( Activity activity, bool we
|
|||||||
|
|
||||||
if (pTable && GetModelPtr())
|
if (pTable && GetModelPtr())
|
||||||
{
|
{
|
||||||
int actCount = pWeapon->GetBackupActivityListCount();
|
|
||||||
return Weapon_BackupActivityFromList( this, pTable, actCount, activity, weaponTranslationWasRequired, pWeapon );
|
return Weapon_BackupActivityFromList( this, pTable, actCount, activity, weaponTranslationWasRequired, pWeapon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,33 @@ acttable_t CWeaponAnnabelle::m_acttable[] =
|
|||||||
{ ACT_RELOAD_LOW, ACT_RELOAD_ANNABELLE_LOW, false },
|
{ ACT_RELOAD_LOW, ACT_RELOAD_ANNABELLE_LOW, false },
|
||||||
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_ANNABELLE, false },
|
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_ANNABELLE, false },
|
||||||
|
|
||||||
|
// Readiness activities (not aiming)
|
||||||
|
{ ACT_IDLE_RELAXED, ACT_IDLE_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_IDLE_STIMULATED, ACT_IDLE_AR2_STIMULATED, false },
|
||||||
|
{ ACT_IDLE_AGITATED, ACT_IDLE_ANGRY_AR2, false },//always aims
|
||||||
|
|
||||||
|
{ ACT_WALK_RELAXED, ACT_WALK_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_WALK_STIMULATED, ACT_WALK_AR2_STIMULATED, false },
|
||||||
|
{ ACT_WALK_AGITATED, ACT_WALK_AIM_AR2, false },//always aims
|
||||||
|
|
||||||
|
{ ACT_RUN_RELAXED, ACT_RUN_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_RUN_STIMULATED, ACT_RUN_AR2_STIMULATED, false },
|
||||||
|
{ ACT_RUN_AGITATED, ACT_RUN_AIM_RIFLE, false },//always aims
|
||||||
|
|
||||||
|
// Readiness activities (aiming)
|
||||||
|
{ ACT_IDLE_AIM_RELAXED, ACT_IDLE_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_IDLE_AIM_STIMULATED, ACT_IDLE_AIM_AR2_STIMULATED, false },
|
||||||
|
{ ACT_IDLE_AIM_AGITATED, ACT_IDLE_ANGRY_AR2, false },//always aims
|
||||||
|
|
||||||
|
{ ACT_WALK_AIM_RELAXED, ACT_WALK_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_WALK_AIM_STIMULATED, ACT_WALK_AIM_AR2_STIMULATED, false },
|
||||||
|
{ ACT_WALK_AIM_AGITATED, ACT_WALK_AIM_AR2, false },//always aims
|
||||||
|
|
||||||
|
{ ACT_RUN_AIM_RELAXED, ACT_RUN_AR2_RELAXED, false },//never aims
|
||||||
|
{ ACT_RUN_AIM_STIMULATED, ACT_RUN_AIM_AR2_STIMULATED, false },
|
||||||
|
{ ACT_RUN_AIM_AGITATED, ACT_RUN_AIM_RIFLE, false },//always aims
|
||||||
|
//End readiness activities
|
||||||
|
|
||||||
{ ACT_ARM, ACT_ARM_RIFLE, true },
|
{ ACT_ARM, ACT_ARM_RIFLE, true },
|
||||||
{ ACT_DISARM, ACT_DISARM_RIFLE, true },
|
{ ACT_DISARM, ACT_DISARM_RIFLE, true },
|
||||||
#else
|
#else
|
||||||
@ -143,6 +170,13 @@ acttable_t CWeaponAnnabelle::m_acttable[] =
|
|||||||
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_SMG1, false },
|
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_SMG1, false },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if EXPANDED_HL2_COVER_ACTIVITIES
|
||||||
|
{ ACT_COVER_WALL_R, ACT_COVER_WALL_R_RIFLE, false },
|
||||||
|
{ ACT_COVER_WALL_L, ACT_COVER_WALL_L_RIFLE, false },
|
||||||
|
{ ACT_COVER_WALL_LOW_R, ACT_COVER_WALL_LOW_R_RIFLE, false },
|
||||||
|
{ ACT_COVER_WALL_LOW_L, ACT_COVER_WALL_LOW_L_RIFLE, false },
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
// HL2:DM activities (for third-person animations in SP)
|
// HL2:DM activities (for third-person animations in SP)
|
||||||
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_AR2, false },
|
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_AR2, false },
|
||||||
@ -161,6 +195,18 @@ acttable_t CWeaponAnnabelle::m_acttable[] =
|
|||||||
|
|
||||||
IMPLEMENT_ACTTABLE(CWeaponAnnabelle);
|
IMPLEMENT_ACTTABLE(CWeaponAnnabelle);
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
acttable_t* GetAnnabelleActtable()
|
||||||
|
{
|
||||||
|
return CWeaponAnnabelle::m_acttable;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetAnnabelleActtableCount()
|
||||||
|
{
|
||||||
|
return ARRAYSIZE(CWeaponAnnabelle::m_acttable);
|
||||||
|
}
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
void CWeaponAnnabelle::Precache( void )
|
void CWeaponAnnabelle::Precache( void )
|
||||||
{
|
{
|
||||||
CBaseCombatWeapon::Precache();
|
CBaseCombatWeapon::Precache();
|
||||||
|
@ -762,6 +762,16 @@ acttable_t CWeaponCrossbow::m_acttable[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_ACTTABLE(CWeaponCrossbow);
|
IMPLEMENT_ACTTABLE(CWeaponCrossbow);
|
||||||
|
|
||||||
|
acttable_t* GetCrossbowActtable()
|
||||||
|
{
|
||||||
|
return CWeaponCrossbow::m_acttable;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetCrossbowActtableCount()
|
||||||
|
{
|
||||||
|
return ARRAYSIZE(CWeaponCrossbow::m_acttable);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
extern ConVar mapbase_load_default_manifest;
|
extern ConVar mapbase_load_default_manifest;
|
||||||
|
|
||||||
|
IMPLEMENT_PRIVATE_SYMBOLTYPE(CustomWeaponSymbol);
|
||||||
|
|
||||||
CCustomWeaponSystem::CCustomWeaponSystem() : CAutoGameSystem("CustomWeaponFactorySystem")
|
CCustomWeaponSystem::CCustomWeaponSystem() : CAutoGameSystem("CustomWeaponFactorySystem")
|
||||||
{
|
{
|
||||||
@ -155,6 +155,7 @@ void CCustomWeaponSystem::LevelShutdownPostEntity()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ClassFactories.Purge();
|
m_ClassFactories.Purge();
|
||||||
|
g_CustomWeaponSymbolSymbolTable.RemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCustomWeaponSystem::ParseWeapon(CBaseCombatWeapon* pWeapon, const char* pClassName)
|
void CCustomWeaponSystem::ParseWeapon(CBaseCombatWeapon* pWeapon, const char* pClassName)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "utldict.h"
|
#include "utldict.h"
|
||||||
#include "utlsymbol.h"
|
#include "utlsymbol.h"
|
||||||
|
|
||||||
|
DECLARE_PRIVATE_SYMBOLTYPE(CustomWeaponSymbol);
|
||||||
|
|
||||||
CUtlDict< IEntityFactory*, unsigned short >& CustomWeaponsFactoryDictionary();
|
CUtlDict< IEntityFactory*, unsigned short >& CustomWeaponsFactoryDictionary();
|
||||||
|
|
||||||
class ICustomWeapon
|
class ICustomWeapon
|
||||||
@ -31,7 +33,7 @@ private:
|
|||||||
|
|
||||||
typedef struct CustomClassName_s
|
typedef struct CustomClassName_s
|
||||||
{
|
{
|
||||||
CUtlSymbol sDataFile;
|
CustomWeaponSymbol sDataFile;
|
||||||
IEntityFactory* pNewFactory;
|
IEntityFactory* pNewFactory;
|
||||||
IEntityFactory* pOldFactory;
|
IEntityFactory* pOldFactory;
|
||||||
} CustomClassName_t;
|
} CustomClassName_t;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2888,6 +2888,15 @@ bool CBaseCombatWeapon::IsLocked( CBaseEntity *pAsker )
|
|||||||
return ( m_flUnlockTime > gpGlobals->curtime && m_hLocker != pAsker );
|
return ( m_flUnlockTime > gpGlobals->curtime && m_hLocker != pAsker );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBaseCombatWeapon::CanBePickedUpByNPCs(void)
|
||||||
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
return GetWpnData().m_nWeaponRestriction != WPNRESTRICT_PLAYER_ONLY;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif // MAPBASE
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Input :
|
// Input :
|
||||||
|
@ -390,7 +390,7 @@ public:
|
|||||||
bool IsLocked( CBaseEntity *pAsker );
|
bool IsLocked( CBaseEntity *pAsker );
|
||||||
|
|
||||||
//All weapons can be picked up by NPCs by default
|
//All weapons can be picked up by NPCs by default
|
||||||
virtual bool CanBePickedUpByNPCs( void ) { return true; }
|
virtual bool CanBePickedUpByNPCs(void);
|
||||||
|
|
||||||
virtual int GetSkinOverride() const { return -1; }
|
virtual int GetSkinOverride() const { return -1; }
|
||||||
|
|
||||||
|
@ -408,6 +408,7 @@ FileWeaponInfo_t::FileWeaponInfo_t()
|
|||||||
m_flSwaySpeedScale = 1.0f;
|
m_flSwaySpeedScale = 1.0f;
|
||||||
szDroppedModel[0] = 0;
|
szDroppedModel[0] = 0;
|
||||||
m_bUsesHands = false;
|
m_bUsesHands = false;
|
||||||
|
m_nWeaponRestriction = WPNRESTRICT_NONE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +416,14 @@ FileWeaponInfo_t::FileWeaponInfo_t()
|
|||||||
extern ConVar hud_fastswitch;
|
extern ConVar hud_fastswitch;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
const char* pWeaponRestrictions[NUM_WEAPON_RESTRICTION_TYPES] = {
|
||||||
|
"none",
|
||||||
|
"player_only",
|
||||||
|
"npc_only",
|
||||||
|
};
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
void FileWeaponInfo_t::Parse( KeyValues *pKeyValuesData, const char *szWeaponName )
|
void FileWeaponInfo_t::Parse( KeyValues *pKeyValuesData, const char *szWeaponName )
|
||||||
{
|
{
|
||||||
// Okay, we tried at least once to look this up...
|
// Okay, we tried at least once to look this up...
|
||||||
@ -483,6 +492,19 @@ void FileWeaponInfo_t::Parse( KeyValues *pKeyValuesData, const char *szWeaponNam
|
|||||||
Q_strncpy( szDroppedModel, pKeyValuesData->GetString( "droppedmodel" ), MAX_WEAPON_STRING );
|
Q_strncpy( szDroppedModel, pKeyValuesData->GetString( "droppedmodel" ), MAX_WEAPON_STRING );
|
||||||
|
|
||||||
m_bUsesHands = ( pKeyValuesData->GetInt( "uses_hands", 0 ) != 0 ) ? true : false;
|
m_bUsesHands = ( pKeyValuesData->GetInt( "uses_hands", 0 ) != 0 ) ? true : false;
|
||||||
|
|
||||||
|
const char* pszRestrictString = pKeyValuesData->GetString("usage_restriction", nullptr);
|
||||||
|
if (pszRestrictString)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_WEAPON_RESTRICTION_TYPES; i++)
|
||||||
|
{
|
||||||
|
if (V_stricmp(pszRestrictString, pWeaponRestrictions[i]) == 0)
|
||||||
|
{
|
||||||
|
m_nWeaponRestriction = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAPBASE // Mapbase makes weapons in the same slot & position swap each other out, which is a feature mods can intentionally use.
|
#ifndef MAPBASE // Mapbase makes weapons in the same slot & position swap each other out, which is a feature mods can intentionally use.
|
||||||
|
@ -58,6 +58,17 @@ int GetWeaponSoundFromString( const char *pszString );
|
|||||||
class CHudTexture;
|
class CHudTexture;
|
||||||
class KeyValues;
|
class KeyValues;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
enum WeaponUsageRestricions_e
|
||||||
|
{
|
||||||
|
WPNRESTRICT_NONE = 0,
|
||||||
|
WPNRESTRICT_PLAYER_ONLY,
|
||||||
|
WPNRESTRICT_NPCS_ONLY,
|
||||||
|
|
||||||
|
NUM_WEAPON_RESTRICTION_TYPES
|
||||||
|
};
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Contains the data read from the weapon's script file.
|
// Purpose: Contains the data read from the weapon's script file.
|
||||||
// It's cached so we only read each weapon's script file once.
|
// It's cached so we only read each weapon's script file once.
|
||||||
@ -125,6 +136,8 @@ public:
|
|||||||
char szDroppedModel[MAX_WEAPON_STRING]; // Model of this weapon when dropped on the ground
|
char szDroppedModel[MAX_WEAPON_STRING]; // Model of this weapon when dropped on the ground
|
||||||
|
|
||||||
bool m_bUsesHands;
|
bool m_bUsesHands;
|
||||||
|
|
||||||
|
int m_nWeaponRestriction;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CLIENT DLL
|
// CLIENT DLL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user