Co-authored-by: shel <2@shelru.ru>
This commit is contained in:
shel 2020-06-10 23:20:17 +04:00 committed by GitHub
parent bffb373539
commit 8142303b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 12 deletions

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=17
minorVersion=18
maintenanceVersion=0

View File

@ -1134,6 +1134,11 @@ const float KNIFE_BODYHIT_VOLUME = 128.0f;
const float KNIFE_WALLHIT_VOLUME = 512.0f;
const float KNIFE_MAX_SPEED = 250.0f;
const float KNIFE_MAX_SPEED_SHIELD = 180.0f;
const float KNIFE_STAB_DAMAGE = 65.0f;
const float KNIFE_SWING_DAMAGE = 15.0f;
const float KNIFE_SWING_DAMAGE_FAST = 20.0f;
const float KNIFE_STAB_DISTANCE = 32.0f;
const float KNIFE_SWING_DISTANCE = 48.0f;
enum knife_e
{
@ -1194,9 +1199,17 @@ public:
void SetPlayerShieldAnim();
void ResetPlayerShieldAnim();
public:
private:
TraceResult m_trHit;
unsigned short m_usKnife;
// Extra RegameDLL features
float m_flStabBaseDamage;
float m_flSwingBaseDamage;
float m_flSwingBaseDamage_Fast;
float m_flStabDistance;
float m_flSwingDistance;
};

View File

@ -12,6 +12,13 @@ void CKnife::Spawn()
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_iClip = WEAPON_NOCLIP;
m_flStabBaseDamage = KNIFE_STAB_DAMAGE;
m_flSwingBaseDamage = KNIFE_SWING_DAMAGE;
m_flSwingBaseDamage_Fast = KNIFE_SWING_DAMAGE_FAST;
m_flStabDistance = KNIFE_STAB_DISTANCE;
m_flSwingDistance = KNIFE_SWING_DISTANCE;
// Get ready to fall down
FallInit();
@ -36,6 +43,13 @@ void CKnife::Precache()
PRECACHE_SOUND("weapons/knife_hitwall1.wav");
m_usKnife = PRECACHE_EVENT(1, "events/knife.sc");
m_flStabBaseDamage = KNIFE_STAB_DAMAGE;
m_flSwingBaseDamage = KNIFE_SWING_DAMAGE;
m_flSwingBaseDamage_Fast = KNIFE_SWING_DAMAGE_FAST;
m_flStabDistance = KNIFE_STAB_DISTANCE;
m_flSwingDistance = KNIFE_SWING_DISTANCE;
}
int CKnife::GetItemInfo(ItemInfo *p)
@ -257,7 +271,7 @@ BOOL CKnife::Swing(BOOL fFirst)
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * 48.0f;
vecEnd = vecSrc + gpGlobals->v_forward * m_flSwingDistance;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
@ -355,9 +369,9 @@ BOOL CKnife::Swing(BOOL fFirst)
ClearMultiDamage();
if (m_flNextPrimaryAttack + 0.4f < UTIL_WeaponTimeBase())
pEntity->TraceAttack(m_pPlayer->pev, 20, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
pEntity->TraceAttack(m_pPlayer->pev, m_flSwingBaseDamage_Fast, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
else
pEntity->TraceAttack(m_pPlayer->pev, 15, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
pEntity->TraceAttack(m_pPlayer->pev, m_flSwingBaseDamage, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);
@ -435,7 +449,7 @@ BOOL CKnife::Stab(BOOL fFirst)
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * 32.0f;
vecEnd = vecSrc + gpGlobals->v_forward * m_flStabDistance;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
@ -503,7 +517,7 @@ BOOL CKnife::Stab(BOOL fFirst)
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
float flDamage = 65.0f;
float flDamage = m_flStabBaseDamage;
if (pEntity && pEntity->IsPlayer())
{

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 17
#define REGAMEDLL_API_VERSION_MINOR 18
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;