WIP: reversed weapons CC4, CGLOCK18

This commit is contained in:
s1lentq 2015-09-28 06:13:39 +06:00
parent 8508f2d517
commit 0aa8ac73a6
12 changed files with 937 additions and 267 deletions

View File

@ -310,7 +310,7 @@ void CWeaponCycler::__MAKE_VHOOK(Spawn)(void)
BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)(void)
{
m_pPlayer->pev->viewmodel = m_iszModel;
m_pPlayer->m_flNextAttack = WEAPON_TIMEBASED + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
SendWeaponAnim(0);
m_iClip = 0;
@ -321,7 +321,7 @@ BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)(void)
/* <ccaa3> ../cstrike/dlls/h_cycler.cpp:388 */
void CWeaponCycler::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = WEAPON_TIMEBASED + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
}
/* <ccad8> ../cstrike/dlls/h_cycler.cpp:394 */

View File

@ -150,6 +150,15 @@ const int gSizes[18];
#endif //HOOK_GAMEDLL
float UTIL_WeaponTimeBase(void)
{
#ifdef CLIENT_WEAPONS
return 0.0;
#else
return gpGlobals->time;
#endif // CLIENT_WEAPONS
}
/* <1ac4be> ../cstrike/dlls/util.cpp:59 */
unsigned int U_Random(void)
{

View File

@ -64,12 +64,6 @@
#define CBSENTENCENAME_MAX 16
#define CVOXFILESENTENCEMAX 1536 // max number of sentences in game. NOTE: this must match CVOXFILESENTENCEMAX in engine\sound.h!!!
#ifdef CLIENT_WEAPONS
#define WEAPON_TIMEBASED 0.0f
#else
#define WEAPON_TIMEBASED gpGlobals->time
#endif // CLIENT_WEAPONS
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
@ -384,6 +378,7 @@ extern int g_groupmask;
extern int g_groupop;
extern const int gSizes[18];
float UTIL_WeaponTimeBase(void);
unsigned int U_Random(void);
void U_Srand(unsigned int seed);
int UTIL_SharedRandomLong(unsigned int seed, int low, int high);

View File

@ -945,7 +945,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
FireRemaining(m_iFamasShotsFired, m_flFamasShoot, FALSE);
}
if (m_flNextPrimaryAttack <= WEAPON_TIMEBASED)
if (m_flNextPrimaryAttack <= UTIL_WeaponTimeBase())
{
if (m_pPlayer->m_bResumeZoom)
{
@ -977,11 +977,11 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
m_fInReload = FALSE;
m_pPlayer->m_flNextAttack = WEAPON_TIMEBASED;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase();
}
}
if (m_fInReload && m_pPlayer->m_flNextAttack <= WEAPON_TIMEBASED)
if (m_fInReload && m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase())
{
// complete the reload.
int j = Q_min(iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
@ -993,7 +993,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
m_fInReload = FALSE;
}
if ((usableButtons & IN_ATTACK2) && CanAttack(m_flNextSecondaryAttack, WEAPON_TIMEBASED, UseDecrement()))
if ((usableButtons & IN_ATTACK2) && CanAttack(m_flNextSecondaryAttack, UTIL_WeaponTimeBase(), UseDecrement()))
{
if (pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()])
{
@ -1003,7 +1003,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
else if ((m_pPlayer->pev->button & IN_ATTACK) && CanAttack(m_flNextPrimaryAttack, WEAPON_TIMEBASED, UseDecrement()))
else if ((m_pPlayer->pev->button & IN_ATTACK) && CanAttack(m_flNextPrimaryAttack, UTIL_WeaponTimeBase(), UseDecrement()))
{
if ((m_iClip == 0 && pszAmmo1()) || (iMaxClip() == WEAPON_NOCLIP && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()]))
{
@ -1017,7 +1017,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
PrimaryAttack();
}
}
else if ((m_pPlayer->pev->button & IN_RELOAD) && iMaxClip() != WEAPON_NOCLIP && !m_fInReload && m_flNextPrimaryAttack < WEAPON_TIMEBASED)
else if ((m_pPlayer->pev->button & IN_RELOAD) && iMaxClip() != WEAPON_NOCLIP && !m_fInReload && m_flNextPrimaryAttack < UTIL_WeaponTimeBase())
{
if (m_flFamasShoot == 0 && m_flGlock18Shoot == 0)
{
@ -1056,13 +1056,13 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
else
m_iShotsFired = 0;
if (!IsUseable() && m_flNextPrimaryAttack < WEAPON_TIMEBASED)
if (!IsUseable() && m_flNextPrimaryAttack < UTIL_WeaponTimeBase())
{
#if 0
// weapon isn't useable, switch.
if (!(iFlags() & ITEM_FLAG_NOAUTOSWITCHEMPTY) && g_pGameRules->GetNextBestWeapon(m_pPlayer, this))
{
m_flNextPrimaryAttack = WEAPON_TIMEBASED + 0.3;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3;
return;
}
#endif
@ -1072,7 +1072,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)(void)
if (!(m_iWeaponState & WPNSTATE_SHIELD_DRAWN))
{
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if (!m_iClip && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < WEAPON_TIMEBASED)
if (!m_iClip && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < UTIL_WeaponTimeBase())
{
if (m_flFamasShoot == 0 && m_flGlock18Shoot == 0)
{
@ -1636,9 +1636,9 @@ float CBasePlayerWeapon::GetNextAttackDelay(float delay)
flCreep = flTimeBetweenFires - m_flPrevPrimaryAttack;
}
float flNextAttack = WEAPON_TIMEBASED + delay - flCreep;
float flNextAttack = UTIL_WeaponTimeBase() + delay - flCreep;
#else
float flNextAttack = WEAPON_TIMEBASED + delay;
float flNextAttack = UTIL_WeaponTimeBase() + delay;
#endif // REGAMEDLL_BUILD_6153
// save the last fire time
@ -1646,7 +1646,7 @@ float CBasePlayerWeapon::GetNextAttackDelay(float delay)
// we need to remember what the m_flNextPrimaryAttack time is set to for each shot,
// store it as m_flPrevPrimaryAttack.
m_flPrevPrimaryAttack = flNextAttack - WEAPON_TIMEBASED;
m_flPrevPrimaryAttack = flNextAttack - UTIL_WeaponTimeBase();
return flNextAttack;
}

View File

@ -904,33 +904,45 @@ private:
class CC4: public CBasePlayerWeapon
{
public:
NOBODY virtual void Spawn(void);
NOBODY virtual void Precache(void);
NOBODY virtual void KeyValue(KeyValueData *pkvd);
NOBODY virtual void Use(CBaseEntity *pActivator,CBaseEntity *pCaller,USE_TYPE useType,float value);
NOBODY virtual int GetItemInfo(ItemInfo *p);
NOBODY virtual BOOL Deploy(void);
NOBODY virtual void Holster(int skiplocal);
virtual float GetMaxSpeed(void)
{
return 250.0f;
}
virtual void Spawn(void);
virtual void Precache(void);
virtual void KeyValue(KeyValueData *pkvd);
virtual void Use(CBaseEntity *pActivator,CBaseEntity *pCaller,USE_TYPE useType,float value);
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy(void);
virtual void Holster(int skiplocal);
virtual float GetMaxSpeed(void);
virtual int iItemSlot(void)
{
return C4_SLOT;
}
NOBODY virtual void PrimaryAttack(void);
NOBODY virtual void WeaponIdle(void);
virtual void PrimaryAttack(void);
virtual void WeaponIdle(void);
virtual BOOL UseDecrement(void)
{
return TRUE;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void Precache_(void);
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int GetItemInfo_(ItemInfo *p);
BOOL Deploy_(void);
void Holster_(int skiplocal);
void PrimaryAttack_(void);
void WeaponIdle_(void);
#endif // HOOK_GAMEDLL
public:
bool m_bStartedArming;
bool m_bBombPlacedAnimation;
float m_fArmedTime;
private:
bool m_bHasShield;
};/* size: 348, cachelines: 6, members: 5 */
/* <24afee> ../cstrike/dlls/weapons.h:750 */
@ -1041,10 +1053,10 @@ private:
class CGLOCK18: public CBasePlayerWeapon
{
public:
NOBODY virtual void Spawn(void);
NOBODY virtual void Precache(void);
NOBODY virtual int GetItemInfo(ItemInfo *p);
NOBODY virtual BOOL Deploy(void);
virtual void Spawn(void);
virtual void Precache(void);
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy(void);
virtual float GetMaxSpeed(void)
{
return m_fMaxSpeed;
@ -1053,10 +1065,10 @@ public:
{
return PISTOL_SLOT;
}
NOBODY virtual void PrimaryAttack(void);
NOBODY virtual void SecondaryAttack(void);
NOBODY virtual void Reload(void);
NOBODY virtual void WeaponIdle(void);
virtual void PrimaryAttack(void);
virtual void SecondaryAttack(void);
virtual void Reload(void);
virtual void WeaponIdle(void);
virtual BOOL UseDecrement(void)
{
return TRUE;
@ -1065,11 +1077,26 @@ public:
{
return TRUE;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void Precache_(void);
int GetItemInfo_(ItemInfo *p);
BOOL Deploy_(void);
void PrimaryAttack_(void);
void SecondaryAttack_(void);
void Reload_(void);
void WeaponIdle_(void);
#endif // HOOK_GAMEDLL
public:
NOBODY void GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst);
void GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst);
public:
int m_iShell;
bool m_bBurstFire;
};/* size: 344, cachelines: 6, members: 3 */
/* <26a48a> ../cstrike/dlls/weapons.h:852 */
@ -1772,9 +1799,12 @@ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted);
// linked object
C_DLLEXPORT void weapon_knife(entvars_t *pev);
C_DLLEXPORT void weapon_usp(entvars_t *pev);
C_DLLEXPORT void weapon_glock18(entvars_t *pev);
C_DLLEXPORT void weapon_c4(entvars_t *pev);
C_DLLEXPORT void weapon_awp(entvars_t *pev);
C_DLLEXPORT void armoury_entity(entvars_t *pev);
C_DLLEXPORT void weaponbox(entvars_t *pev);
C_DLLEXPORT void weapon_p90(entvars_t *pev);
C_DLLEXPORT void armoury_entity(entvars_t *pev);
C_DLLEXPORT void weaponbox(entvars_t *pev);
#endif // WEAPONS_H

View File

@ -59,10 +59,7 @@ int CAWP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
p->iMaxClip = AWP_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 2;
m_iId = WEAPON_AWP;
p->iId = WEAPON_AWP;
p->iId = m_iId = WEAPON_AWP;
p->iFlags = 0;
p->iWeight = AWP_WEIGHT;
@ -77,7 +74,7 @@ BOOL CAWP::__MAKE_VHOOK(Deploy)(void)
m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.45);
m_flNextPrimaryAttack = m_pPlayer->m_flNextAttack;
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
return TRUE;
}
@ -103,7 +100,7 @@ void CAWP::__MAKE_VHOOK(SecondaryAttack)(void)
m_pPlayer->ResetMaxSpeed();
EMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, "weapons/zoom.wav", 0.2, 2.4);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.3;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;
}
/* <23fd53> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:143 */
@ -134,9 +131,7 @@ void CAWP::__MAKE_VHOOK(PrimaryAttack)(void)
/* <23fe76> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:157 */
void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming;
Vector vecSrc;
Vector vecDir;
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov != DEFAULT_FOV)
@ -194,7 +189,7 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
115,
0.99,
m_pPlayer->pev,
true,
true, // TODO: why awp is have bPistol set true?
m_pPlayer->random_seed
);
@ -228,7 +223,7 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_pPlayer->pev->punchangle.x -= 2;
}
@ -264,9 +259,9 @@ void CAWP::__MAKE_VHOOK(WeaponIdle)(void)
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= WEAPON_TIMEBASED && m_iClip)
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() && m_iClip)
{
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 60;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(AWP_IDLE, UseDecrement() != FALSE);
}
}

View File

@ -1,102 +1,401 @@
#include "precompiled.h"
/* <246a03> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:48 */
LINK_ENTITY_TO_CLASS(weapon_c4, CC4);
/* <2469b9> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:50 */
NOBODY void CC4::Spawn(void)
{
// Spawn(CC4 *const this); // 50
}
/* <246418> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:80 */
NOBODY void CC4::Precache(void)
{
}
/* <24643f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:88 */
NOBODY int CC4::GetItemInfo(ItemInfo *p)
{
}
/* <2466d5> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:105 */
NOBODY BOOL CC4::Deploy(void)
{
}
/* <2466fc> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:123 */
NOBODY void CC4::Holster(int skiplocal)
{
// Holster(CC4 *const this,
// int skiplocal); // 123
}
/* <2464e8> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:152 */
NOBODY void CC4::PrimaryAttack(void)
{
// {
// BOOL PlaceBomb; // 154
// class CGrenade *pBomb; // 155
// int onGround; // 161
// int inBombZone; // 164
// {
// class CBaseEntity *pEntity; // 288
// class CBasePlayer *pTempPlayer; // 289
// Vector(Vector *const this,
// float X,
// float Y,
// float Z); // 277
// Vector(Vector *const this,
// const Vector &v); // 277
// MESSAGE_BEGIN(int msg_dest,
// int msg_type,
// const float *pOrigin,
// edict_t *ed); // 280
// edict(CBaseEntity *const this); // 283
// ENTINDEX(edict_t *pEdict); // 283
// MESSAGE_BEGIN(int msg_dest,
// int msg_type,
// const float *pOrigin,
// edict_t *ed); // 293
// edict(CBaseEntity *const this); // 315
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 319
// edict(CBaseEntity *const this); // 315
// }
// }
}
/* <2464c1> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:358 */
NOBODY void CC4::WeaponIdle(void)
{
}
/* <24674f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:419 */
NOBODY void CC4::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// {
// class CBasePlayer *pPlayer; // 423
// edict_t *m_pentOldCurBombTarget; // 426
// class CGrenade *pC4; // 435
// }
// Use(CC4 *const this,
// class CBaseEntity *pActivator,
// class CBaseEntity *pCaller,
// USE_TYPE useType,
// float value); // 419
}
/* <2468b7> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:399 */
NOBODY void CC4::KeyValue(KeyValueData *pkvd)
{
// FStrEq(const char *sz1,
// const char *sz2); // 401
// FStrEq(const char *sz1,
// const char *sz2); // 406
// KeyValue(CC4 *const this,
// KeyValueData *pkvd); // 399
// atof(const char *__nptr); // 403
}
#include "precompiled.h"
#define C4_MAX_AMMO 1
#define C4_MAX_SPEED 250.0
#define C4_ARMING_ON_TIME 3.0
enum c4_e
{
C4_IDLE1,
C4_DRAW,
C4_DROP,
C4_ARM
};
/* <246a03> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:48 */
LINK_ENTITY_TO_CLASS(weapon_c4, CC4);
/* <2469b9> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:50 */
void CC4::__MAKE_VHOOK(Spawn)(void)
{
SET_MODEL(edict(), "models/w_backpack.mdl");
pev->frame = 0;
pev->body = 3;
pev->sequence = 0;
pev->framerate = 0;
m_iId = WEAPON_C4;
m_iDefaultAmmo = C4_DEFAULT_GIVE;
m_bStartedArming = false;
m_fArmedTime = 0;
if (!FStringNull(pev->targetname))
{
pev->effects |= EF_NODRAW;
DROP_TO_FLOOR(edict());
return;
}
FallInit();
SetThink(&CBasePlayerItem::FallThink);
pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
}
/* <246418> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:80 */
void CC4::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_c4.mdl");
PRECACHE_MODEL("models/w_backpack.mdl");
PRECACHE_SOUND("weapons/c4_click.wav");
}
/* <24643f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:88 */
int CC4::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "C4";
p->iMaxAmmo1 = C4_MAX_AMMO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 4;
p->iPosition = 3;
p->iId = m_iId = WEAPON_C4;
p->iWeight = C4_WEIGHT;
p->iFlags = (ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE);
return 1;
}
/* <2466d5> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:105 */
BOOL CC4::__MAKE_VHOOK(Deploy)(void)
{
pev->body = 0;
m_bStartedArming = false;
m_fArmedTime = 0;
if (m_pPlayer->HasShield())
{
m_bHasShield = true;
m_pPlayer->pev->gamestate = 1;
}
return DefaultDeploy("models/v_c4.mdl", "models/p_c4.mdl", C4_DRAW, "c4", UseDecrement() != FALSE);
}
/* <2466fc> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:123 */
void CC4::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_bStartedArming = false;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
m_pPlayer->pev->weapons &= ~(1 << WEAPON_C4);
DestroyItem();
}
if (m_bHasShield)
{
m_pPlayer->pev->gamestate = 0;
m_bHasShield = false;
}
}
/* <2464e8> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:152 */
void CC4::__MAKE_VHOOK(PrimaryAttack)(void)
{
BOOL PlaceBomb;
int inBombZone, onGround;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
return;
}
inBombZone = (m_pPlayer->m_signals.GetState() & SIGNAL_BOMB) == SIGNAL_BOMB;
onGround = (m_pPlayer->pev->flags & FL_ONGROUND) == FL_ONGROUND;
PlaceBomb = (onGround && inBombZone);
if (!m_bStartedArming)
{
if (!inBombZone)
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#C4_Plant_At_Bomb_Spot");
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
return;
}
if (!onGround)
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#C4_Plant_Must_Be_On_Ground");
m_flNextPrimaryAttack = GetNextAttackDelay(1);
return;
}
m_bStartedArming = true;
m_bBombPlacedAnimation = false;
m_fArmedTime = gpGlobals->time + C4_ARMING_ON_TIME;
SendWeaponAnim(C4_ARM, UseDecrement() != FALSE);
SET_CLIENT_MAXSPEED(m_pPlayer->edict(), 1.0);
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_pPlayer->SetProgressBarTime(C4_ARMING_ON_TIME);
}
else
{
if (PlaceBomb)
{
CBaseEntity *pEntity = NULL;
CBasePlayer *pTempPlayer = NULL;
if (m_fArmedTime <= gpGlobals->time)
{
if (m_bStartedArming)
{
m_bStartedArming = false;
m_fArmedTime = 0;
Broadcast("BOMBPL");
m_pPlayer->m_bHasC4 = false;
if (pev->speed != 0 && g_pGameRules != NULL)
{
g_pGameRules->m_iC4Timer = (int)pev->speed;
}
CGrenade *pBomb = CGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0));
MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);
WRITE_BYTE(9);
WRITE_BYTE(DRC_CMD_EVENT);
WRITE_SHORT(m_pPlayer->entindex());
WRITE_SHORT(0);
WRITE_LONG(DRC_FLAG_FACEPLAYER | 11);
MESSAGE_END();
MESSAGE_BEGIN(MSG_ALL, gmsgBombDrop);
WRITE_COORD(pBomb->pev->origin.x);
WRITE_COORD(pBomb->pev->origin.y);
WRITE_COORD(pBomb->pev->origin.z);
WRITE_BYTE(1);
MESSAGE_END();
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Bomb_Planted");
TheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb);
if (g_pGameRules->IsCareer() && !m_pPlayer->IsBot())
{
TheCareerTasks->HandleEvent(EVENT_BOMB_PLANTED, m_pPlayer);
}
UTIL_LogPrintf
(
"\"%s<%i><%s><TERRORIST>\" triggered \"Planted_The_Bomb\"\n",
STRING(m_pPlayer->pev->netname),
GETPLAYERUSERID(m_pPlayer->edict()),
GETPLAYERAUTHID(m_pPlayer->edict())
);
g_pGameRules->m_bBombDropped = FALSE;
EMIT_SOUND(edict(), CHAN_WEAPON, "weapons/c4_plant.wav", VOL_NORM, ATTN_NORM);
m_pPlayer->pev->body = 0;
m_pPlayer->ResetMaxSpeed();
m_pPlayer->SetBombIcon(FALSE);
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
RetireWeapon();
return;
}
}
}
else
{
if (m_fArmedTime - 0.75 <= gpGlobals->time && !m_bBombPlacedAnimation)
{
m_bBombPlacedAnimation = true;
SendWeaponAnim(C4_DROP, UseDecrement() != FALSE);
m_pPlayer->SetAnimation(PLAYER_HOLDBOMB);
}
}
}
else
{
if (inBombZone)
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#C4_Plant_Must_Be_On_Ground");
else
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#C4_Arming_Cancelled");
m_bStartedArming = false;
m_flNextPrimaryAttack = GetNextAttackDelay(1.5);
m_pPlayer->ResetMaxSpeed();
m_pPlayer->SetProgressBarTime(0);
m_pPlayer->SetAnimation(PLAYER_HOLDBOMB);
SendWeaponAnim(m_bBombPlacedAnimation ? C4_DRAW : C4_IDLE1, UseDecrement() != FALSE);
return;
}
}
m_flNextPrimaryAttack = GetNextAttackDelay(0.3);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
/* <2464c1> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:358 */
void CC4::__MAKE_VHOOK(WeaponIdle)(void)
{
if (m_bStartedArming)
{
m_bStartedArming = false;
m_pPlayer->ResetMaxSpeed();
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_pPlayer->SetProgressBarTime(0);
SendWeaponAnim(m_bBombPlacedAnimation ? C4_DRAW : C4_IDLE1, UseDecrement() != FALSE);
}
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
RetireWeapon();
return;
}
SendWeaponAnim(C4_DRAW, UseDecrement() != FALSE);
SendWeaponAnim(C4_IDLE1, UseDecrement() != FALSE);
}
}
/* <2468b7> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:399 */
void CC4::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "detonatedelay"))
{
pev->speed = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "detonatetarget"))
{
pev->noise1 = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "defusetarget"))
{
pev->target = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
{
CBaseEntity::KeyValue(pkvd);
}
}
/* <24674f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:419 */
void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (m_pPlayer != NULL)
{
return;
}
CBasePlayer *pPlayer = reinterpret_cast<CBasePlayer *>(UTIL_PlayerByIndex(1));
if (pPlayer != NULL)
{
edict_t *m_pentOldCurBombTarget = pPlayer->m_pentCurBombTarget;
pPlayer->m_pentCurBombTarget = NULL;
if (pev->speed != 0 && g_pGameRules)
{
g_pGameRules->m_iC4Timer = (int)pev->speed;
}
EMIT_SOUND(edict(), CHAN_WEAPON, "weapons/c4_plant.wav", VOL_NORM, ATTN_NORM);
CGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0));
CGrenade *pC4 = NULL;
while ((pC4 = (CGrenade *)UTIL_FindEntityByClassname(pC4, "grenade")) != NULL)
{
if (pC4->m_bIsC4 && pC4->m_flNextFreq == gpGlobals->time)
{
pC4->pev->target = pev->target;
pC4->pev->noise1 = pev->noise1;
break;
}
}
pPlayer->m_pentCurBombTarget = m_pentOldCurBombTarget;
SUB_Remove();
}
}
/* <2463cc> ../cstrike/dlls/weapons.h:732 */
float CC4::GetMaxSpeed(void)
{
return C4_MAX_SPEED;
}
#ifdef HOOK_GAMEDLL
void CC4::Spawn(void)
{
Spawn_();
}
void CC4::Precache(void)
{
Precache_();
}
void CC4::KeyValue(KeyValueData *pkvd)
{
KeyValue_(pkvd);
}
void CC4::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
Use_(pActivator, pCaller, useType, value);
}
int CC4::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CC4::Deploy(void)
{
return Deploy_();
}
void CC4::Holster(int skiplocal)
{
Holster_(skiplocal);
}
void CC4::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CC4::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,73 +1,422 @@
#include "precompiled.h"
#define GLOCK18_MAX_SPEED 250
#define GLOCK18_RELOAD_TIME 2.2
enum glock18_e
{
GLOCK18_IDLE1,
GLOCK18_IDLE2,
GLOCK18_IDLE3,
GLOCK18_SHOOT,
GLOCK18_SHOOT2,
GLOCK18_SHOOT3,
GLOCK18_SHOOT_EMPTY,
GLOCK18_RELOAD,
GLOCK18_DRAW,
GLOCK18_HOLSTER,
GLOCK18_ADD_SILENCER,
GLOCK18_DRAW2,
GLOCK18_RELOAD2
};
enum glock18_shield_e
{
GLOCK18_SHIELD_IDLE1,
GLOCK18_SHIELD_SHOOT,
GLOCK18_SHIELD_SHOOT2,
GLOCK18_SHIELD_SHOOT_EMPTY,
GLOCK18_SHIELD_RELOAD,
GLOCK18_SHIELD_DRAW,
GLOCK18_SHIELD_IDLE,
GLOCK18_SHIELD_UP,
GLOCK18_SHIELD_DOWN
};
/* <2662bb> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:68 */
LINK_ENTITY_TO_CLASS(weapon_glock18, CGLOCK18);
/* <26611a> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:70 */
NOBODY void CGLOCK18::Spawn(void)
{
void CGLOCK18::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_GLOCK18;
SET_MODEL(edict(), "models/w_glock18.mdl");
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_iDefaultAmmo = GLOCK18_DEFAULT_GIVE;
m_bBurstFire = false;
m_iGlock18ShotsFired = 0;
m_flGlock18Shoot = 0;
m_flAccuracy = 0.9;
FallInit();
}
/* <2660c0> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:88 */
NOBODY void CGLOCK18::Precache(void)
void CGLOCK18::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_glock18.mdl");
PRECACHE_MODEL("models/w_glock18.mdl");
PRECACHE_MODEL("models/shield/v_shield_glock18.mdl");
PRECACHE_SOUND("weapons/glock18-1.wav");
PRECACHE_SOUND("weapons/glock18-2.wav");
PRECACHE_SOUND("weapons/clipout1.wav");
PRECACHE_SOUND("weapons/clipin1.wav");
PRECACHE_SOUND("weapons/sliderelease1.wav");
PRECACHE_SOUND("weapons/slideback1.wav");
PRECACHE_SOUND("weapons/357_cock1.wav");
PRECACHE_SOUND("weapons/de_clipin.wav");
PRECACHE_SOUND("weapons/de_clipout.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireGlock18 = PRECACHE_EVENT(1, "events/glock18.sc");
}
/* <2660e7> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:112 */
NOBODY int CGLOCK18::GetItemInfo(ItemInfo *p)
int CGLOCK18::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "9mm";
p->iMaxAmmo1 = MAX_AMMO_9MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = GLOCK18_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 2;
p->iId = m_iId = WEAPON_GLOCK18;
p->iFlags = 0;
p->iWeight = GLOCK18_WEIGHT;
return 1;
}
/* <266281> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:129 */
NOBODY BOOL CGLOCK18::Deploy(void)
BOOL CGLOCK18::__MAKE_VHOOK(Deploy)(void)
{
// Deploy(CGLOCK18 *const this); // 129
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_bBurstFire = false;
m_iGlock18ShotsFired = 0;
m_flGlock18Shoot = 0;
m_flAccuracy = 0.9;
m_fMaxSpeed = GLOCK18_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
{
m_iWeaponState &= ~WPNSTATE_GLOCK18_BURST_MODE;
return DefaultDeploy("models/shield/v_shield_glock18.mdl", "models/shield/p_shield_glock18.mdl", GLOCK18_SHIELD_DRAW, "shieldgun", UseDecrement() != FALSE);
}
else if (RANDOM_LONG(0, 1))
{
return DefaultDeploy("models/v_glock18.mdl", "models/p_glock18.mdl", GLOCK18_DRAW, "onehanded", UseDecrement() != FALSE);
}
return DefaultDeploy("models/v_glock18.mdl", "models/p_glock18.mdl", GLOCK18_DRAW2, "onehanded", UseDecrement() != FALSE);
}
/* <266246> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:156 */
NOBODY void CGLOCK18::SecondaryAttack(void)
void CGLOCK18::__MAKE_VHOOK(SecondaryAttack)(void)
{
// SecondaryAttack(CGLOCK18 *const this); // 156
if (ShieldSecondaryFire(GLOCK18_SHIELD_UP, GLOCK18_SHIELD_DOWN))
{
return;
}
if (m_iWeaponState & WPNSTATE_GLOCK18_BURST_MODE)
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_SemiAuto");
m_iWeaponState &= ~WPNSTATE_GLOCK18_BURST_MODE;
}
else
{
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire");
m_iWeaponState |= WPNSTATE_GLOCK18_BURST_MODE;
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;
}
/* <2664c3> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:175 */
NOBODY void CGLOCK18::PrimaryAttack(void)
void CGLOCK18::__MAKE_VHOOK(PrimaryAttack)(void)
{
// Length2D(const Vector *const this); // 181
// Length2D(const Vector *const this); // 192
if (m_iWeaponState & WPNSTATE_GLOCK18_BURST_MODE)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
GLOCK18Fire(1.2 * (1 - m_flAccuracy), 0.5, TRUE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
GLOCK18Fire(0.185 * (1 - m_flAccuracy), 0.5, TRUE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
GLOCK18Fire(0.095 * (1 - m_flAccuracy), 0.5, TRUE);
}
else
{
GLOCK18Fire(0.3 * (1 - m_flAccuracy), 0.5, TRUE);
}
}
else
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
GLOCK18Fire(1.0 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
GLOCK18Fire(0.165 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
GLOCK18Fire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
GLOCK18Fire(0.1 * (1 - m_flAccuracy), 0.2, FALSE);
}
}
}
/* <266385> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:201 */
NOBODY void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst)
void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst)
{
// {
// Vector vecAiming; // 264
// Vector vecSrc; // 266
// Vector vecDir; // 268
// int flag; // 272
// operator+(const Vector *const this,
// const Vector &v); // 257
// Vector(Vector *const this,
// const Vector &v); // 269
// Vector(Vector *const this,
// const Vector &v); // 269
// }
Vector vecAiming, vecSrc, vecDir;
int flag;
if (bFireBurst)
{
m_iGlock18ShotsFired = 0;
}
else
{
m_iShotsFired++;
if (m_iShotsFired > 1)
{
return;
}
flCycleTime -= 0.05;
}
if (m_flLastFire)
{
m_flAccuracy -= (0.325 - (gpGlobals->time - m_flLastFire)) * 0.275;
if (m_flAccuracy > 0.9)
{
m_flAccuracy = 0.9;
}
else if (m_flAccuracy < 0.6)
{
m_flAccuracy = 0.6;
}
}
m_flLastFire = gpGlobals->time;
if (m_iClip <= 0)
{
if (m_fFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.2);
}
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
return;
}
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecDir = gpGlobals->v_forward;
vecAiming = m_pPlayer->FireBullets3
(
vecSrc,
vecDir,
flSpread,
8192,
1,
BULLET_PLAYER_9MM,
25,
0.75,
m_pPlayer->pev,
true,
m_pPlayer->random_seed
);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL
(
flag,
m_pPlayer->edict(),
m_usFireGlock18,
0,
(float *)&g_vecZero,
(float *)&g_vecZero,
vecAiming.x,
vecAiming.y,
(int)(m_pPlayer->pev->punchangle.x * 100),
(int)(m_pPlayer->pev->punchangle.y * 100),
m_iClip == 0,
FALSE
);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, FALSE);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5;
if (bFireBurst)
{
m_iGlock18ShotsFired++;
m_flGlock18Shoot = gpGlobals->time + 0.1;
}
ResetPlayerShieldAnim();
}
/* <2661e8> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:307 */
NOBODY void CGLOCK18::Reload(void)
void CGLOCK18::__MAKE_VHOOK(Reload)(void)
{
// {
// int iResult; // 312
// }
// Reload(CGLOCK18 *const this); // 307
int iResult;
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
if (m_pPlayer->HasShield())
iResult = GLOCK18_SHIELD_RELOAD;
else if (RANDOM_LONG(0, 1))
iResult = GLOCK18_RELOAD;
else
iResult = GLOCK18_RELOAD2;
if (DefaultReload(GLOCK18_MAX_CLIP, iResult, GLOCK18_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;
}
}
/* <266190> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:329 */
NOBODY void CGLOCK18::WeaponIdle(void)
void CGLOCK18::__MAKE_VHOOK(WeaponIdle)(void)
{
// {
// int iAnim; // 350
// float flRand; // 351
// }
int iAnim;
float flRand;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(GLOCK18_SHIELD_IDLE, UseDecrement() != FALSE);
}
}
else if (m_iClip)
{
flRand = RANDOM_FLOAT(0, 1);
if (flRand <= 0.3)
{
iAnim = GLOCK18_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625;
}
else if (flRand <= 0.6)
{
iAnim = GLOCK18_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.75;
}
else
{
iAnim = GLOCK18_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5;
}
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
}
}
#ifdef HOOK_GAMEDLL
void CGLOCK18::Spawn(void)
{
Spawn_();
}
void CGLOCK18::Precache(void)
{
Precache_();
}
int CGLOCK18::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CGLOCK18::Deploy(void)
{
return Deploy_();
}
void CGLOCK18::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CGLOCK18::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CGLOCK18::Reload(void)
{
Reload_();
}
void CGLOCK18::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -75,8 +75,11 @@ int CKnife::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 2;
p->iPosition = 1;
p->iId = WEAPON_KNIFE;
//p->iFlags = 0;
p->iId = WEAPON_KNIFE;
// TODO: it is not being used
//p->iFlags = 0;
p->iWeight = KNIFE_WEIGHT;
return 1;
@ -104,7 +107,7 @@ BOOL CKnife::__MAKE_VHOOK(Deploy)(void)
/* <27052b> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:119 */
void CKnife::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = WEAPON_TIMEBASED + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
}
/* <270d70> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:124 */
@ -248,8 +251,8 @@ bool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
m_pPlayer->ResetMaxSpeed();
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.4;
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 0.6;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
return true;
}
@ -260,7 +263,7 @@ void CKnife::__MAKE_VHOOK(SecondaryAttack)(void)
if (!ShieldSecondaryFire(KNIFE_SHIELD_UP, KNIFE_SHIELD_DOWN))
{
Stab(TRUE);
pev->nextthink = WEAPON_TIMEBASED + 0.35;
pev->nextthink = UTIL_WeaponTimeBase() + 0.35;
}
}
@ -282,14 +285,14 @@ void CKnife::__MAKE_VHOOK(WeaponIdle)(void)
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > WEAPON_TIMEBASED)
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (!m_pPlayer->m_bShieldDrawn)
{
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 20.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
SendWeaponAnim(KNIFE_IDLE, UseDecrement() != FALSE);
}
}
@ -338,17 +341,17 @@ int CKnife::Swing(int fFirst)
}
m_flNextPrimaryAttack = GetNextAttackDelay(0.35);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.5;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
}
else
{
SendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.2;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.2;
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash1.wav", VOL_NORM, ATTN_NORM, 0, 94);
@ -371,17 +374,17 @@ int CKnife::Swing(int fFirst)
}
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.5;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
}
else
{
SendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.2;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.2;
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
SetPlayerShieldAnim();
@ -389,7 +392,7 @@ int CKnife::Swing(int fFirst)
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
ClearMultiDamage();
if (m_flNextPrimaryAttack + 0.4 < WEAPON_TIMEBASED)
if (m_flNextPrimaryAttack + 0.4 < UTIL_WeaponTimeBase())
pEntity->TraceAttack(m_pPlayer->pev, 20, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
else
pEntity->TraceAttack(m_pPlayer->pev, 15, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
@ -435,7 +438,7 @@ int CKnife::Swing(int fFirst)
m_trHit = tr;
SetThink(&CKnife::Smack);
pev->nextthink = 0.2;
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME);
ResetPlayerShieldAnim();
@ -488,7 +491,7 @@ int CKnife::Stab(int fFirst)
SendWeaponAnim(KNIFE_STABMISS, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash1.wav", VOL_NORM, ATTN_NORM, 0, 94);
@ -505,7 +508,7 @@ int CKnife::Stab(int fFirst)
SendWeaponAnim(KNIFE_STABHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.1);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.1;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.1;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
@ -571,7 +574,7 @@ int CKnife::Stab(int fFirst)
m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME);
SetThink(&CKnife::Smack);
pev->nextthink = 0.2;
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
ResetPlayerShieldAnim();
}

View File

@ -58,10 +58,7 @@ int CP90::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
p->iMaxClip = P90_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 8;
m_iId = WEAPON_P90;
p->iId = WEAPON_P90;
p->iId = m_iId = WEAPON_P90;
p->iFlags = 0;
p->iWeight = P90_WEIGHT;
@ -100,9 +97,7 @@ void CP90::__MAKE_VHOOK(PrimaryAttack)(void)
/* <296647> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:120 */
void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming;
Vector vecSrc;
Vector vecDir;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
@ -186,7 +181,7 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
@ -229,12 +224,12 @@ void CP90::__MAKE_VHOOK(WeaponIdle)(void)
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > WEAPON_TIMEBASED)
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 20.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
SendWeaponAnim(P90_IDLE1, UseDecrement() != FALSE);
}

View File

@ -77,19 +77,16 @@ void CUSP::__MAKE_VHOOK(Precache)(void)
/* <2bacfb> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:107 */
int CUSP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "45ACP";
p->iMaxAmmo1 = MAX_AMMO_45ACP;
p->pszName = STRING(pev->classname);
p->pszAmmo2 = 0;
p->iMaxAmmo2 = -1;
p->iMaxClip = USP_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 4;
p->iFlags = 0;
m_iId = WEAPON_USP;
p->iId = WEAPON_USP;
p->iId = m_iId = WEAPON_USP;
p->iWeight = USP_WEIGHT;
return 1;
@ -138,10 +135,9 @@ void CUSP::__MAKE_VHOOK(SecondaryAttack)(void)
SendWeaponAnim(USP_ATTACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded");
}
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 3.0;
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 3.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0;
m_flNextPrimaryAttack = GetNextAttackDelay(3.0);
}
@ -193,9 +189,7 @@ void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
int flag;
int iDamage;
Vector vecAiming;
Vector vecSrc;
Vector vecDir;
Vector vecAiming, vecSrc, vecDir;
flCycleTime -= 0.075;
@ -300,7 +294,7 @@ void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi)
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, FALSE);
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
}
@ -345,7 +339,7 @@ void CUSP::__MAKE_VHOOK(WeaponIdle)(void)
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 20.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
@ -356,7 +350,7 @@ void CUSP::__MAKE_VHOOK(WeaponIdle)(void)
{
int iAnim = (~m_iWeaponState & WPNSTATE_USP_SILENCED) ? USP_UNSIL_IDLE: USP_IDLE;
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 60.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0;
SendWeaponAnim(iAnim, UseDecrement());
}
}

View File

@ -3104,20 +3104,20 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D02BF0, "_ZN4CAWP7AWPFireEffi", mfunc_ptr_cast(&CAWP::AWPFire) },
//CC4
//virtual func
//{ 0x0, "_ZN3CC45SpawnEv", mfunc_ptr_cast(&CC4::Spawn) },
//{ 0x0, "_ZN3CC48PrecacheEv", mfunc_ptr_cast(&CC4::Precache) },
//{ 0x0, "_ZN3CC48KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CC4::KeyValue) },
//{ 0x0, "_ZN3CC43UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CC4::Use) },
//{ 0x0, "_ZN3CC411GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CC4::GetItemInfo) },
//{ 0x0, "_ZN3CC46DeployEv", mfunc_ptr_cast(&CC4::Deploy) },
//{ 0x0, "_ZN3CC47HolsterEi", mfunc_ptr_cast(&CC4::Holster) },
//{ 0x0, "_ZN3CC411GetMaxSpeedEv", mfunc_ptr_cast(&CC4::GetMaxSpeed) },
//{ 0x0, "_ZN3CC49iItemSlotEv", mfunc_ptr_cast(&CC4::iItemSlot) },
//{ 0x0, "_ZN3CC413PrimaryAttackEv", mfunc_ptr_cast(&CC4::PrimaryAttack) },
//{ 0x0, "_ZN3CC410WeaponIdleEv", mfunc_ptr_cast(&CC4::WeaponIdle) },
//{ 0x0, "_ZN3CC412UseDecrementEv", mfunc_ptr_cast(&CC4::UseDecrement) },
{ 0x01D03030, "_ZN3CC45SpawnEv", mfunc_ptr_cast(&CC4::Spawn_) },
{ 0x01D030F0, "_ZN3CC48PrecacheEv", mfunc_ptr_cast(&CC4::Precache_) },
{ 0x01D03840, "_ZN3CC48KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CC4::KeyValue_) },
{ 0x01D03900, "_ZN3CC43UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CC4::Use_) },
{ 0x01D03120, "_ZN3CC411GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CC4::GetItemInfo_) },
{ 0x01D03190, "_ZN3CC46DeployEv", mfunc_ptr_cast(&CC4::Deploy_) },
{ 0x01D03200, "_ZN3CC47HolsterEi", mfunc_ptr_cast(&CC4::Holster_) },
//{ 0x01D03A80, "_ZN3CC411GetMaxSpeedEv", mfunc_ptr_cast(&CC4::GetMaxSpeed_) }, // DEFAULT
//{ 0x01D03A70, "_ZN3CC49iItemSlotEv", mfunc_ptr_cast(&CC4::iItemSlot_) }, // DEFAULT
{ 0x01D03280, "_ZN3CC413PrimaryAttackEv", mfunc_ptr_cast(&CC4::PrimaryAttack_) },
{ 0x01D03750, "_ZN3CC410WeaponIdleEv", mfunc_ptr_cast(&CC4::WeaponIdle_) },
//{ 0x01D03A90, "_ZN3CC412UseDecrementEv", mfunc_ptr_cast(&CC4::UseDecrement_) }, // DEFAULT
//non-virtual func
//{ 0x0, "weapon_c4", (size_t)&weapon_c4 },
{ 0x01D02FE0, "weapon_c4", (size_t)&weapon_c4 },
//CDEAGLE
//virtual func
//{ 0x0, "_ZN7CDEAGLE5SpawnEv", mfunc_ptr_cast(&CDEAGLE::Spawn) },
@ -3174,21 +3174,21 @@ FunctionHook g_FunctionHooks[] =
//{ 0x0, "_ZN6CG3SG19G3SG1FireEffi", mfunc_ptr_cast(&CG3SG1::G3SG1Fire) },
//CGLOCK18
//virtual func
//{ 0x0, "_ZN8CGLOCK185SpawnEv", mfunc_ptr_cast(&CGLOCK18::Spawn) },
//{ 0x0, "_ZN8CGLOCK188PrecacheEv", mfunc_ptr_cast(&CGLOCK18::Precache) },
//{ 0x0, "_ZN8CGLOCK1811GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CGLOCK18::GetItemInfo) },
//{ 0x0, "_ZN8CGLOCK186DeployEv", mfunc_ptr_cast(&CGLOCK18::Deploy) },
//{ 0x0, "_ZN8CGLOCK1811GetMaxSpeedEv", mfunc_ptr_cast(&CGLOCK18::GetMaxSpeed) },
//{ 0x0, "_ZN8CGLOCK189iItemSlotEv", mfunc_ptr_cast(&CGLOCK18::iItemSlot) },
//{ 0x0, "_ZN8CGLOCK1813PrimaryAttackEv", mfunc_ptr_cast(&CGLOCK18::PrimaryAttack) },
//{ 0x0, "_ZN8CGLOCK1815SecondaryAttackEv", mfunc_ptr_cast(&CGLOCK18::SecondaryAttack) },
//{ 0x0, "_ZN8CGLOCK186ReloadEv", mfunc_ptr_cast(&CGLOCK18::Reload) },
//{ 0x0, "_ZN8CGLOCK1810WeaponIdleEv", mfunc_ptr_cast(&CGLOCK18::WeaponIdle) },
//{ 0x0, "_ZN8CGLOCK1812UseDecrementEv", mfunc_ptr_cast(&CGLOCK18::UseDecrement) },
//{ 0x0, "_ZN8CGLOCK188IsPistolEv", mfunc_ptr_cast(&CGLOCK18::IsPistol) },
{ 0x01D071E0, "_ZN8CGLOCK185SpawnEv", mfunc_ptr_cast(&CGLOCK18::Spawn_) },
{ 0x01D07250, "_ZN8CGLOCK188PrecacheEv", mfunc_ptr_cast(&CGLOCK18::Precache_) },
{ 0x01D07310, "_ZN8CGLOCK1811GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CGLOCK18::GetItemInfo_) },
{ 0x01D07380, "_ZN8CGLOCK186DeployEv", mfunc_ptr_cast(&CGLOCK18::Deploy_) },
//{ 0x01D07B10, "_ZN8CGLOCK1811GetMaxSpeedEv", mfunc_ptr_cast(&CGLOCK18::GetMaxSpeed_) }, // DEFAULT
//{ 0x01D07B00, "_ZN8CGLOCK189iItemSlotEv", mfunc_ptr_cast(&CGLOCK18::iItemSlot_) }, // DEFAULT
{ 0x01D07510, "_ZN8CGLOCK1813PrimaryAttackEv", mfunc_ptr_cast(&CGLOCK18::PrimaryAttack_) },
{ 0x01D07480, "_ZN8CGLOCK1815SecondaryAttackEv", mfunc_ptr_cast(&CGLOCK18::SecondaryAttack_) },
{ 0x01D07980, "_ZN8CGLOCK186ReloadEv", mfunc_ptr_cast(&CGLOCK18::Reload_) },
{ 0x01D079F0, "_ZN8CGLOCK1810WeaponIdleEv", mfunc_ptr_cast(&CGLOCK18::WeaponIdle_) },
//{ 0x01D07B20, "_ZN8CGLOCK1812UseDecrementEv", mfunc_ptr_cast(&CGLOCK18::UseDecrement_) }, // DEFAULT
//{ 0x01D07B30, "_ZN8CGLOCK188IsPistolEv", mfunc_ptr_cast(&CGLOCK18::IsPistol_) }, // DEFAULT
//non-virtual func
//{ 0x0, "weapon_glock18", (size_t)&weapon_glock18 },
//{ 0x0, "_ZN6CG3SG19G3SG1FireEffi", mfunc_ptr_cast(&CG3SG1::GLOCK18Fire) },
{ 0x01D07190, "weapon_glock18", (size_t)&weapon_glock18 },
{ 0x01D07670, "_ZN8CGLOCK1811GLOCK18FireEffi", mfunc_ptr_cast(&CGLOCK18::GLOCK18Fire) },
//CHEGrenade
//virtual func
//{ 0x0, "_ZN10CHEGrenade5SpawnEv", mfunc_ptr_cast(&CHEGrenade::Spawn) },
@ -5332,6 +5332,11 @@ VirtualTableRef g_TableRefs[] =
{ 0x01DF46BC, "CKnife", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF34E4, "CAWP", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF51AC, "CP90", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF4394, "CGLOCK18", 95 },
{ 0x01DF5C6C, "CUSP", 95 },
{ 0x01DF368C, "CC4", CWEAPON_VIRTUAL_COUNT },
{ 0x01DFD984, "CWShield", CBASE_VIRTUAL_COUNT },
// CBaseEntity
{ 0x01DF8A94, "CGib", CBASE_VIRTUAL_COUNT },
@ -5514,10 +5519,6 @@ VirtualTableRef g_TableRefs[] =
{ 0x01E01000, "CCSTutorBuyMenuState", 3 },
{ 0x01E01010, "CCSTutorWaitingForStartState", 3 },
// Weapons vtable
{ 0x01DF5C6C, "CUSP", 95 },
{ 0x01DFD984, "CWShield", CBASE_VIRTUAL_COUNT },
{ NULL, NULL } // BaseClass__for_vtbl
};