Merge pull request #4 from dreamstalker/master

Optimized compilation time on linux
This commit is contained in:
s1lentq 2015-12-07 00:36:06 +03:00
commit ca56b285cb
54 changed files with 5935 additions and 5891 deletions

View File

@ -110,7 +110,7 @@ struct entity_state_s
};/* size: 340, cachelines: 6, members: 62 */
struct clientdata_s
typedef struct clientdata_s
{
Vector origin;
Vector velocity;

View File

@ -22,82 +22,82 @@ LINK_ENTITY_TO_CLASS(item_airtank, CAirtank);
/* <5211> ../cstrike/dlls/airtank.cpp:47 */
IMPLEMENT_SAVERESTORE(CAirtank, CGrenade);
/* <50dd> ../cstrike/dlls/airtank.cpp:50 */
void CAirtank::__MAKE_VHOOK(Spawn)(void)
{
Precache();
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
SET_MODEL(ENT(pev), "models/w_oxygen.mdl");
UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 36));
UTIL_SetOrigin(pev, pev->origin);
SetTouch(&CAirtank::TankTouch);
SetThink(&CAirtank::TankThink);
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_YES;
pev->health = 20;
pev->dmg = 50;
m_state = 1;
}
/* <50dd> ../cstrike/dlls/airtank.cpp:50 */
void CAirtank::__MAKE_VHOOK(Spawn)(void)
{
Precache();
/* <4fef> ../cstrike/dlls/airtank.cpp:71 */
void CAirtank::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/w_oxygen.mdl");
PRECACHE_SOUND("doors/aliendoor3.wav");
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
SET_MODEL(ENT(pev), "models/w_oxygen.mdl");
UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 36));
UTIL_SetOrigin(pev, pev->origin);
SetTouch(&CAirtank::TankTouch);
SetThink(&CAirtank::TankThink);
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_YES;
pev->health = 20;
pev->dmg = 50;
m_state = 1;
}
/* <503d> ../cstrike/dlls/airtank.cpp:78 */
void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
/* <4fef> ../cstrike/dlls/airtank.cpp:71 */
void CAirtank::__MAKE_VHOOK(Precache)(void)
{
pev->owner = ENT(pevAttacker);
// UNDONE: this should make a big bubble cloud, not an explosion
PRECACHE_MODEL("models/w_oxygen.mdl");
PRECACHE_SOUND("doors/aliendoor3.wav");
}
/* <503d> ../cstrike/dlls/airtank.cpp:78 */
void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
pev->owner = ENT(pevAttacker);
// UNDONE: this should make a big bubble cloud, not an explosion
Explode(pev->origin, Vector(0, 0, -1));
}
/* <5016> ../cstrike/dlls/airtank.cpp:88 */
void CAirtank::TankThink(void)
{
// Fire trigger
m_state = 1;
SUB_UseTargets(this, USE_TOGGLE, 0);
/* <5016> ../cstrike/dlls/airtank.cpp:88 */
void CAirtank::TankThink(void)
{
// Fire trigger
m_state = 1;
SUB_UseTargets(this, USE_TOGGLE, 0);
}
/* <525d> ../cstrike/dlls/airtank.cpp:96 */
void CAirtank::TankTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())
{
return;
}
if (!m_state)
{
// "no oxygen" sound
EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim2.wav", VOL_NORM, ATTN_NORM);
return;
}
// give player 12 more seconds of air
pOther->pev->air_finished = gpGlobals->time + 12;
// suit recharge sound
EMIT_SOUND(ENT(pev), CHAN_VOICE, "doors/aliendoor3.wav", VOL_NORM, ATTN_NORM);
// recharge airtank in 30 seconds
pev->nextthink = gpGlobals->time + 30;
m_state = 0;
SUB_UseTargets(this, USE_TOGGLE, 1);
}
#ifdef HOOK_GAMEDLL
/* <525d> ../cstrike/dlls/airtank.cpp:96 */
void CAirtank::TankTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())
{
return;
}
if (!m_state)
{
// "no oxygen" sound
EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim2.wav", VOL_NORM, ATTN_NORM);
return;
}
// give player 12 more seconds of air
pOther->pev->air_finished = gpGlobals->time + 12;
// suit recharge sound
EMIT_SOUND(ENT(pev), CHAN_VOICE, "doors/aliendoor3.wav", VOL_NORM, ATTN_NORM);
// recharge airtank in 30 seconds
pev->nextthink = gpGlobals->time + 30;
m_state = 0;
SUB_UseTargets(this, USE_TOGGLE, 1);
}
#ifdef HOOK_GAMEDLL
void CAirtank::Spawn(void)
{
Spawn_();
@ -121,6 +121,6 @@ int CAirtank::Restore(CRestore &restore)
void CAirtank::Killed(entvars_t *pevAttacker, int iGib)
{
Killed_(pevAttacker, iGib);
}
#endif // HOOK_GAMEDLL
}
#endif // HOOK_GAMEDLL

View File

@ -43,6 +43,10 @@
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
#define FANPITCHMIN 30
#define FANPITCHMAX 100
@ -53,7 +57,7 @@
// This is just a solid wall if not inhibited
/* <1c494> ../cstrike/dlls/bmodels.cpp:53 */
/* <1c494> ../cstrike/dlls/bmodels.cpp:53 */
class CFuncWall: public CBaseEntity
{
public:
@ -75,7 +79,7 @@ public:
};/* size: 152, cachelines: 3, members: 1 */
/* <1c4e1> ../cstrike/dlls/bmodels.cpp:86 */
/* <1c4e1> ../cstrike/dlls/bmodels.cpp:86 */
class CFuncWallToggle: public CFuncWall
{
public:
@ -94,9 +98,9 @@ public:
void TurnOn(void);
BOOL IsOn(void);
};/* size: 152, cachelines: 3, members: 1 */
};/* size: 152, cachelines: 3, members: 1 */
/* <1c52e> ../cstrike/dlls/bmodels.cpp:147 */
/* <1c52e> ../cstrike/dlls/bmodels.cpp:147 */
class CFuncConveyor: public CFuncWall
{
public:
@ -117,7 +121,7 @@ public:
// A simple entity that looks solid but lets you walk through it.
/* <1c65b> ../cstrike/dlls/bmodels.cpp:208 */
/* <1c65b> ../cstrike/dlls/bmodels.cpp:208 */
class CFuncIllusionary: public CBaseToggle
{
public:
@ -140,15 +144,15 @@ public:
};/* size: 312, cachelines: 5, members: 1 */
// Monster only clip brush
//
// This brush will be solid for any entity who has the FL_MONSTERCLIP flag set
// in pev->flags
//
// otherwise it will be invisible and not solid. This can be used to keep
// Monster only clip brush
//
// This brush will be solid for any entity who has the FL_MONSTERCLIP flag set
// in pev->flags
//
// otherwise it will be invisible and not solid. This can be used to keep
// specific monsters out of certain areas
/* <1c6a8> ../cstrike/dlls/bmodels.cpp:255 */
/* <1c6a8> ../cstrike/dlls/bmodels.cpp:255 */
class CFuncMonsterClip: public CFuncWall
{
public:
@ -169,7 +173,7 @@ public:
};/* size: 152, cachelines: 3, members: 1 */
/* <1c6fa> ../cstrike/dlls/bmodels.cpp:274 */
/* <1c6fa> ../cstrike/dlls/bmodels.cpp:274 */
class CFuncRotating: public CBaseEntity
{
public:
@ -216,7 +220,7 @@ public:
};/* size: 172, cachelines: 3, members: 7 */
/* <1c748> ../cstrike/dlls/bmodels.cpp:720 */
/* <1c748> ../cstrike/dlls/bmodels.cpp:720 */
class CPendulum: public CBaseEntity
{
public:
@ -270,12 +274,12 @@ Vector VecBModelOrigin(entvars_t *pevBModel);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_wall(entvars_t *pev);
C_DLLEXPORT void func_wall_toggle(entvars_t *pev);
C_DLLEXPORT void func_conveyor(entvars_t *pev);
C_DLLEXPORT void func_illusionary(entvars_t *pev);
C_DLLEXPORT void func_monsterclip(entvars_t *pev);
C_DLLEXPORT void func_rotating(entvars_t *pev);
C_DLLEXPORT void func_wall(entvars_t *pev);
C_DLLEXPORT void func_wall_toggle(entvars_t *pev);
C_DLLEXPORT void func_conveyor(entvars_t *pev);
C_DLLEXPORT void func_illusionary(entvars_t *pev);
C_DLLEXPORT void func_monsterclip(entvars_t *pev);
C_DLLEXPORT void func_rotating(entvars_t *pev);
C_DLLEXPORT void func_pendulum(entvars_t *pev);
#endif // HOOK_GAMEDLL

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
#include "precompiled.h"
#include "game_shared/perf_counter.h"
/*
* Globals initialization

View File

@ -35,6 +35,7 @@
#include "monsterevent.h"
#include <utlvector.h>
#include "game_shared/perf_counter.h"
#undef CREATE_NAMED_ENTITY
#undef REMOVE_ENTITY

View File

@ -1,5 +1,4 @@
#include "precompiled.h"
#include "entity_state.h"
/*
* Globals initialization

View File

@ -61,24 +61,24 @@ enum BuyItemMenuSlot
#define CS_NUM_SKIN 4
#define CZ_NUM_SKIN 5
#define FIELD_ORIGIN0 0
#define FIELD_ORIGIN1 1
#define FIELD_ORIGIN2 2
#define FIELD_ANGLES0 3
#define FIELD_ANGLES1 4
#define FIELD_ORIGIN0 0
#define FIELD_ORIGIN1 1
#define FIELD_ORIGIN2 2
#define FIELD_ANGLES0 3
#define FIELD_ANGLES1 4
#define FIELD_ANGLES2 5
#define CUSTOMFIELD_ORIGIN0 0
#define CUSTOMFIELD_ORIGIN1 1
#define CUSTOMFIELD_ORIGIN2 2
#define CUSTOMFIELD_ANGLES0 3
#define CUSTOMFIELD_ANGLES1 4
#define CUSTOMFIELD_ANGLES2 5
#define CUSTOMFIELD_SKIN 6
#define CUSTOMFIELD_SEQUENCE 7
#define CUSTOMFIELD_ORIGIN0 0
#define CUSTOMFIELD_ORIGIN1 1
#define CUSTOMFIELD_ORIGIN2 2
#define CUSTOMFIELD_ANGLES0 3
#define CUSTOMFIELD_ANGLES1 4
#define CUSTOMFIELD_ANGLES2 5
#define CUSTOMFIELD_SKIN 6
#define CUSTOMFIELD_SEQUENCE 7
#define CUSTOMFIELD_ANIMTIME 8
typedef struct
@ -98,22 +98,22 @@ typedef struct
} PLAYERPVSSTATUS;
/* size: 5624, cachelines: 88, members: 4 */
typedef struct
{
char name[32];
int field;
typedef struct
{
char name[32];
int field;
} entity_field_alias_t;
/* size: 36, cachelines: 1, members: 2 */
#ifdef HOOK_GAMEDLL
#define g_flTimeLimit (*pg_flTimeLimit)
#define g_flTimeLimit (*pg_flTimeLimit)
#define g_flResetTime (*pg_flResetTime)
#define g_bClientPrintEnable (*pg_bClientPrintEnable)
#define g_PVSStatus (*pg_PVSStatus)
#define m_usResetDecals (*pm_usResetDecals)
#define m_usResetDecals (*pm_usResetDecals)
#define g_iShadowSprite (*pg_iShadowSprite)
#define sPlayerModelFiles (*psPlayerModelFiles)
#define g_skipCareerInitialSpawn (*pg_skipCareerInitialSpawn)
@ -126,7 +126,7 @@ typedef struct
extern PLAYERPVSSTATUS g_PVSStatus[32];
extern float g_flTimeLimit;// exported
extern float g_flTimeLimit;// exported
extern float g_flResetTime;
extern bool g_bClientPrintEnable;
extern bool g_skipCareerInitialSpawn;
@ -138,88 +138,88 @@ extern entity_field_alias_t player_field_alias[3];
extern entity_field_alias_t custom_entity_field_alias[9];
extern int g_serveractive;
extern unsigned short m_usResetDecals;
extern unsigned short m_usResetDecals;
extern unsigned short g_iShadowSprite;
int CMD_ARGC_(void);
const char *CMD_ARGV_(int i);
NOXREF void set_suicide_frame(entvars_t *pev);
void TeamChangeUpdate(CBasePlayer *player, int team_id);
void BlinkAccount(CBasePlayer *player, int numBlinks);
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
void ClientDisconnect(edict_t *pEntity);
void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
void ClientKill(edict_t *pEntity);
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
NOXREF C_DLLEXPORT int CountTeams(void);
void ListPlayers(CBasePlayer *current);
C_DLLEXPORT int CountTeamPlayers(int iTeam);
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
TeamName SelectDefaultTeam(void);
void CheckStartMoney(void);
void ClientPutInServer(edict_t *pEntity);
int Q_strlen_(const char *str);
void Host_Say(edict_t *pEntity, int teamonly);
void DropSecondary(CBasePlayer *pPlayer);
void DropPrimary(CBasePlayer *pPlayer);
bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon);
void BuyPistol(CBasePlayer *pPlayer, int iSlot);
void BuyShotgun(CBasePlayer *pPlayer, int iSlot);
void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID);
void BuyRifle(CBasePlayer *pPlayer, int iSlot);
void BuyMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyItem(CBasePlayer *pPlayer, int iSlot);
void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot);
BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot);
void Radio1(CBasePlayer *player, int slot);
void Radio2(CBasePlayer *player, int slot);
void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID);
NOXREF int CountPlayersInServer(void);
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
void ClientCommand(edict_t *pEntity);
void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);
void ServerDeactivate(void);
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
void PlayerPreThink(edict_t *pEntity);
void PlayerPostThink(edict_t *pEntity);
void ParmsNewLevel(void);
void ParmsChangeLevel(void);
void StartFrame(void);
void ClientPrecache(void);
const char *GetGameDescription(void);
void Sys_Error(const char *error_string);
void PlayerCustomization(edict_t *pEntity, customization_t *pCust);
void SpectatorConnect(edict_t *pEntity);
void SpectatorDisconnect(edict_t *pEntity);
void SpectatorThink(edict_t *pEntity);
void SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas);
void ResetPlayerPVS(edict_t *client, int clientnum);
bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum);
void MarkEntityInPVS(int clientnum, int entitynum, float time, bool inpvs);
bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime);
int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs);
void Entity_FieldInit(struct delta_s *pFields);
void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void Player_FieldInit(struct delta_s *pFields);
void Player_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void Custom_Entity_FieldInit(delta_s *pFields);
void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void RegisterEncoders(void);
int GetWeaponData(edict_s *player, struct weapon_data_s *info);
void UpdateClientData(const edict_s *ent, int sendweapons, clientdata_s *cd);
void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
void CmdEnd(const edict_t *player);
int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);
int GetHullBounds(int hullnumber, float *mins, float *maxs);
void CreateInstancedBaselines(void);
int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message);
int CMD_ARGC_(void);
const char *CMD_ARGV_(int i);
NOXREF void set_suicide_frame(entvars_t *pev);
void TeamChangeUpdate(CBasePlayer *player, int team_id);
void BlinkAccount(CBasePlayer *player, int numBlinks);
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
void ClientDisconnect(edict_t *pEntity);
void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
void ClientKill(edict_t *pEntity);
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
NOXREF C_DLLEXPORT int CountTeams(void);
void ListPlayers(CBasePlayer *current);
C_DLLEXPORT int CountTeamPlayers(int iTeam);
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
TeamName SelectDefaultTeam(void);
void CheckStartMoney(void);
void ClientPutInServer(edict_t *pEntity);
int Q_strlen_(const char *str);
void Host_Say(edict_t *pEntity, int teamonly);
void DropSecondary(CBasePlayer *pPlayer);
void DropPrimary(CBasePlayer *pPlayer);
bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon);
void BuyPistol(CBasePlayer *pPlayer, int iSlot);
void BuyShotgun(CBasePlayer *pPlayer, int iSlot);
void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID);
void BuyRifle(CBasePlayer *pPlayer, int iSlot);
void BuyMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyItem(CBasePlayer *pPlayer, int iSlot);
void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot);
BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot);
void Radio1(CBasePlayer *player, int slot);
void Radio2(CBasePlayer *player, int slot);
void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID);
NOXREF int CountPlayersInServer(void);
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
void ClientCommand(edict_t *pEntity);
void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);
void ServerDeactivate(void);
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
void PlayerPreThink(edict_t *pEntity);
void PlayerPostThink(edict_t *pEntity);
void ParmsNewLevel(void);
void ParmsChangeLevel(void);
void StartFrame(void);
void ClientPrecache(void);
const char *GetGameDescription(void);
void Sys_Error(const char *error_string);
void PlayerCustomization(edict_t *pEntity, customization_t *pCust);
void SpectatorConnect(edict_t *pEntity);
void SpectatorDisconnect(edict_t *pEntity);
void SpectatorThink(edict_t *pEntity);
void SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas);
void ResetPlayerPVS(edict_t *client, int clientnum);
bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum);
void MarkEntityInPVS(int clientnum, int entitynum, float time, bool inpvs);
bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime);
int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs);
void Entity_FieldInit(struct delta_s *pFields);
void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void Player_FieldInit(struct delta_s *pFields);
void Player_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void Custom_Entity_FieldInit(delta_s *pFields);
void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void RegisterEncoders(void);
int GetWeaponData(edict_s *player, struct weapon_data_s *info);
void UpdateClientData(const edict_s *ent, int sendweapons, struct clientdata_s *cd);
void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
void CmdEnd(const edict_t *player);
int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);
int GetHullBounds(int hullnumber, float *mins, float *maxs);
void CreateInstancedBaselines(void);
int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message);
int AllowLagCompensation(void);
#endif // CLIENT_H

View File

@ -1,9 +1,5 @@
#include "precompiled.h"
#define GERMAN_GIB_COUNT 4
#define HUMAN_GIB_COUNT 6
#define ALIEN_GIB_COUNT 4
/* <5f4cb> ../cstrike/dlls/combat.cpp:52 */
void CGib::LimitVelocity(void)
{

View File

@ -1,8 +1,5 @@
#include "precompiled.h"
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover
#define NUM_LATERAL_LOS_CHECKS 6 // how many checks are made on each side of a monster looking for lateral cover
/*
* Globals initialization
*/
@ -19,163 +16,163 @@ BOOL g_fDrawLines;
/* <c08f4> ../cstrike/dlls/h_ai.cpp:47 */
NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize)
{
// don't look through water
if ((pevLooker->waterlevel != 3 && pevTarget->waterlevel == 3) || (pevLooker->waterlevel == 3 && pevTarget->waterlevel == 0))
{
return FALSE;
}
TraceResult tr;
//look through the monster's 'eyes'
Vector vecLookerOrigin = pevLooker->origin + pevLooker->view_ofs;
for (int i = 0; i < 5; i++)
{
Vector vecTarget = pevTarget->origin;
vecTarget.x += RANDOM_FLOAT(pevTarget->mins.x + flSize, pevTarget->maxs.x - flSize);
vecTarget.y += RANDOM_FLOAT(pevTarget->mins.y + flSize, pevTarget->maxs.y - flSize);
vecTarget.z += RANDOM_FLOAT(pevTarget->mins.z + flSize, pevTarget->maxs.z - flSize);
UTIL_TraceLine(vecLookerOrigin, vecTarget, ignore_monsters, ignore_glass, ENT(pevLooker), &tr);
if (tr.flFraction == 1.0f)
{
vecTargetOrigin = vecTarget;
// line of sight is valid.
return TRUE;
}
}
// Line of sight is not established
// don't look through water
if ((pevLooker->waterlevel != 3 && pevTarget->waterlevel == 3) || (pevLooker->waterlevel == 3 && pevTarget->waterlevel == 0))
{
return FALSE;
}
TraceResult tr;
//look through the monster's 'eyes'
Vector vecLookerOrigin = pevLooker->origin + pevLooker->view_ofs;
for (int i = 0; i < 5; i++)
{
Vector vecTarget = pevTarget->origin;
vecTarget.x += RANDOM_FLOAT(pevTarget->mins.x + flSize, pevTarget->maxs.x - flSize);
vecTarget.y += RANDOM_FLOAT(pevTarget->mins.y + flSize, pevTarget->maxs.y - flSize);
vecTarget.z += RANDOM_FLOAT(pevTarget->mins.z + flSize, pevTarget->maxs.z - flSize);
UTIL_TraceLine(vecLookerOrigin, vecTarget, ignore_monsters, ignore_glass, ENT(pevLooker), &tr);
if (tr.flFraction == 1.0f)
{
vecTargetOrigin = vecTarget;
// line of sight is valid.
return TRUE;
}
}
// Line of sight is not established
return FALSE;
}
// VecCheckToss - returns the velocity at which an object should be lobbed from vecspot1 to land near vecspot2.
// VecCheckToss - returns the velocity at which an object should be lobbed from vecspot1 to land near vecspot2.
// returns g_vecZero if toss is not feasible.
/* <c0a19> ../cstrike/dlls/h_ai.cpp:78 */
NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj)
{
TraceResult tr;
Vector vecMidPoint; // halfway point between Spot1 and Spot2
Vector vecApex; // highest point
Vector vecScale;
Vector vecGrenadeVel;
Vector vecTemp;
float flGravity = g_psv_gravity->value * flGravityAdj;
if (vecSpot2.z - vecSpot1.z > 500)
{
// to high, fail
return g_vecZero;
}
UTIL_MakeVectors(pev->angles);
// toss a little bit to the left or right, not right down on the enemy's bean (head).
vecSpot2 = vecSpot2 + gpGlobals->v_right * (RANDOM_FLOAT(-8, 8) + RANDOM_FLOAT(-16, 16));
vecSpot2 = vecSpot2 + gpGlobals->v_forward * (RANDOM_FLOAT(-8, 8) + RANDOM_FLOAT(-16, 16));
// calculate the midpoint and apex of the 'triangle'
// UNDONE: normalize any Z position differences between spot1 and spot2 so that triangle is always RIGHT
// How much time does it take to get there?
// get a rough idea of how high it can be thrown
vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,500), ignore_monsters, ENT(pev), &tr);
vecMidPoint = tr.vecEndPos;
// (subtract 15 so the grenade doesn't hit the ceiling)
vecMidPoint.z -= 15;
if (vecMidPoint.z < vecSpot1.z || vecMidPoint.z < vecSpot2.z)
{
// to not enough space, fail
return g_vecZero;
}
// How high should the grenade travel to reach the apex
float distance1 = (vecMidPoint.z - vecSpot1.z);
float distance2 = (vecMidPoint.z - vecSpot2.z);
// How long will it take for the grenade to travel this distance
float time1 = sqrt(distance1 / (0.5 * flGravity));
float time2 = sqrt(distance2 / (0.5 * flGravity));
if (time1 < 0.1)
{
// too close
return g_vecZero;
}
// how hard to throw sideways to get there in time.
vecGrenadeVel = (vecSpot2 - vecSpot1) / (time1 + time2);
// how hard upwards to reach the apex at the right time.
vecGrenadeVel.z = flGravity * time1;
// find the apex
vecApex = vecSpot1 + vecGrenadeVel * time1;
vecApex.z = vecMidPoint.z;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
// UNDONE: either ignore monsters or change it to not care if we hit our enemy
UTIL_TraceLine(vecSpot2, vecApex, ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0)
{
// fail!
return g_vecZero;
}
TraceResult tr;
Vector vecMidPoint; // halfway point between Spot1 and Spot2
Vector vecApex; // highest point
Vector vecScale;
Vector vecGrenadeVel;
Vector vecTemp;
float flGravity = g_psv_gravity->value * flGravityAdj;
if (vecSpot2.z - vecSpot1.z > 500)
{
// to high, fail
return g_vecZero;
}
UTIL_MakeVectors(pev->angles);
// toss a little bit to the left or right, not right down on the enemy's bean (head).
vecSpot2 = vecSpot2 + gpGlobals->v_right * (RANDOM_FLOAT(-8, 8) + RANDOM_FLOAT(-16, 16));
vecSpot2 = vecSpot2 + gpGlobals->v_forward * (RANDOM_FLOAT(-8, 8) + RANDOM_FLOAT(-16, 16));
// calculate the midpoint and apex of the 'triangle'
// UNDONE: normalize any Z position differences between spot1 and spot2 so that triangle is always RIGHT
// How much time does it take to get there?
// get a rough idea of how high it can be thrown
vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,500), ignore_monsters, ENT(pev), &tr);
vecMidPoint = tr.vecEndPos;
// (subtract 15 so the grenade doesn't hit the ceiling)
vecMidPoint.z -= 15;
if (vecMidPoint.z < vecSpot1.z || vecMidPoint.z < vecSpot2.z)
{
// to not enough space, fail
return g_vecZero;
}
// How high should the grenade travel to reach the apex
float distance1 = (vecMidPoint.z - vecSpot1.z);
float distance2 = (vecMidPoint.z - vecSpot2.z);
// How long will it take for the grenade to travel this distance
float time1 = sqrt(distance1 / (0.5 * flGravity));
float time2 = sqrt(distance2 / (0.5 * flGravity));
if (time1 < 0.1)
{
// too close
return g_vecZero;
}
// how hard to throw sideways to get there in time.
vecGrenadeVel = (vecSpot2 - vecSpot1) / (time1 + time2);
// how hard upwards to reach the apex at the right time.
vecGrenadeVel.z = flGravity * time1;
// find the apex
vecApex = vecSpot1 + vecGrenadeVel * time1;
vecApex.z = vecMidPoint.z;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
// UNDONE: either ignore monsters or change it to not care if we hit our enemy
UTIL_TraceLine(vecSpot2, vecApex, ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0)
{
// fail!
return g_vecZero;
}
return vecGrenadeVel;
}
// VecCheckThrow - returns the velocity vector at which an object should be thrown from vecspot1 to hit vecspot2.
// VecCheckThrow - returns the velocity vector at which an object should be thrown from vecspot1 to hit vecspot2.
// returns g_vecZero if throw is not feasible.
/* <c0d21> ../cstrike/dlls/h_ai.cpp:164 */
NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj)
{
float flGravity = g_psv_gravity->value * flGravityAdj;
Vector vecGrenadeVel = (vecSpot2 - vecSpot1);
// throw at a constant time
float time = vecGrenadeVel.Length() / flSpeed;
vecGrenadeVel = vecGrenadeVel * (1.0 / time);
// adjust upward toss to compensate for gravity loss
vecGrenadeVel.z += flGravity * time * 0.5;
Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5);
TraceResult tr;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
UTIL_TraceLine(vecSpot2, vecApex, ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
float flGravity = g_psv_gravity->value * flGravityAdj;
Vector vecGrenadeVel = (vecSpot2 - vecSpot1);
// throw at a constant time
float time = vecGrenadeVel.Length() / flSpeed;
vecGrenadeVel = vecGrenadeVel * (1.0 / time);
// adjust upward toss to compensate for gravity loss
vecGrenadeVel.z += flGravity * time * 0.5;
Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5);
TraceResult tr;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
UTIL_TraceLine(vecSpot2, vecApex, ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
{
// fail!
return g_vecZero;
}
return vecGrenadeVel;
}

View File

@ -32,6 +32,9 @@
#pragma once
#endif
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover
#define NUM_LATERAL_LOS_CHECKS 6 // how many checks are made on each side of a monster looking for lateral cover
NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize);
NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj);
NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj);

View File

@ -1,8 +1,5 @@
#include "precompiled.h"
#define DEFINE_WEAPON(m_wpnid, m_cost, m_slotnum, m_acost)\
{ m_wpnid, m_cost, 3, m_slotnum, m_acost }
/*
* Globals initialization
*/

View File

@ -50,10 +50,10 @@
#define PLAYER_MAX_SAFE_FALL_SPEED 500.0f
#define PLAYER_SEARCH_RADIUS 64.0f
#define ARMOR_RATIO 0.5 // Armor Takes 50% of the damage
#define ARMOR_RATIO 0.5 // Armor Takes 50% of the damage
#define ARMOR_BONUS 0.5 // Each Point of Armor is work 1/x points of health
#define FLASH_DRAIN_TIME 1.2 // 100 units/3 minutes
#define FLASH_DRAIN_TIME 1.2 // 100 units/3 minutes
#define FLASH_CHARGE_TIME 0.2 // 100 units/20 seconds (seconds per unit)
// damage per unit per second.
@ -122,9 +122,9 @@
#define CHAT_INTERVAL 1.0f
#define CSUITNOREPEAT 32
#define AUTOAIM_2DEGREES 0.0348994967025
#define AUTOAIM_5DEGREES 0.08715574274766
#define AUTOAIM_8DEGREES 0.1391731009601
#define AUTOAIM_2DEGREES 0.0348994967025
#define AUTOAIM_5DEGREES 0.08715574274766
#define AUTOAIM_8DEGREES 0.1391731009601
#define AUTOAIM_10DEGREES 0.1736481776669
#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav"
@ -270,6 +270,9 @@ struct WeaponStruct
};/* size: 20, cachelines: 1, members: 5 */
#define DEFINE_WEAPON(m_wpnid, m_cost, m_slotnum, m_acost)\
{ m_wpnid, m_cost, 3, m_slotnum, m_acost }
#ifdef HOOK_GAMEDLL
#define m_szPoses (*pm_szPoses)

View File

@ -1,5 +1,4 @@
#include "precompiled.h"
#include "talkmonster.h"
#ifndef HOOK_GAMEDLL

View File

@ -1,5 +1,4 @@
#include "precompiled.h"
#include <string>
/*
* Globals initialization

View File

@ -35,28 +35,28 @@
#include "activity.h"
#define _LOG_TRACE\
static int iNumPassed = 0;\
static int iNumPassed = 0;\
printf2(__FUNCTION__":: iNumPassed - %d", iNumPassed++);
#define _LOG_TRACE2\
static int iNumPassedt = 0;\
printf2(__FUNCTION__":: iNumPassed - %d", iNumPassedt++);\
static int iNumPassedt = 0;\
printf2(__FUNCTION__":: iNumPassed - %d", iNumPassedt++);\
_logf(__FUNCTION__":: iNumPassed - %d", iNumPassedt++);
// Makes these more explicit, and easier to find
#ifdef HOOK_GAMEDLL
#define FILE_GLOBAL static
#define FILE_GLOBAL static
#define DLL_GLOBAL
#else
#define FILE_GLOBAL
#define FILE_GLOBAL
#define DLL_GLOBAL
#endif // HOOK_GAMEDLL
#define eoNullEntity 0 // Testing the three types of "entity" for nullity
#define eoNullEntity 0 // Testing the three types of "entity" for nullity
#define iStringNull 0 // Testing strings for nullity
#define cchMapNameMost 32
@ -72,11 +72,11 @@ extern globalvars_t *gpGlobals;
#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset)))
#define MAKE_STRING(str) ((uint64_t)(str) - (uint64_t)(STRING(0)))
// Dot products for view cone checking
#define VIEW_FIELD_FULL -1.0 // +-180 degrees
#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
#define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks
// Dot products for view cone checking
#define VIEW_FIELD_FULL -1.0 // +-180 degrees
#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
#define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks
#define VIEW_FIELD_ULTRA_NARROW 0.9 // +-25 degrees, more narrow check used to set up ranged attacks
#define SND_SPAWNING (1<<8) // duplicated in protocol.h we're spawing, used in some cases for ambients
@ -89,6 +89,10 @@ extern globalvars_t *gpGlobals;
#define BLOOD_COLOR_YELLOW (byte)195
#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW
#define GERMAN_GIB_COUNT 4
#define HUMAN_GIB_COUNT 6
#define ALIEN_GIB_COUNT 4
#define LANGUAGE_ENGLISH 0
#define LANGUAGE_GERMAN 1
#define LANGUAGE_FRENCH 2
@ -100,24 +104,24 @@ extern globalvars_t *gpGlobals;
#define SVC_WEAPONANIM 35
#define SVC_ROOMTYPE 37
#define SVC_DIRECTOR 51
#define SF_TRIG_PUSH_ONCE 1
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4
#define VEC_HULL_MIN_Z Vector(0, 0, -36)
@ -128,24 +132,24 @@ extern globalvars_t *gpGlobals;
#define VEC_VIEW Vector(0, 0, 17)
#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18)
#define VEC_DUCK_HULL_MAX Vector(16, 16, 32)
#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18)
#define VEC_DUCK_HULL_MAX Vector(16, 16, 32)
#define VEC_DUCK_VIEW Vector(0, 0, 12)
#define PLAYBACK_EVENT(flags, who, index)\
PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
#define PLAYBACK_EVENT(flags, who, index)\
PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
#define PLAYBACK_EVENT_DELAY(flags, who, index, delay)\
PLAYBACK_EVENT_FULL(flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
#ifdef HOOK_GAMEDLL
// prefix _
#define __MAKE_VHOOK(fname)\
#define __MAKE_VHOOK(fname)\
fname##_
#else
#define __MAKE_VHOOK(fname)\
#define __MAKE_VHOOK(fname)\
fname
#endif // HOOK_GAMEDLL
@ -291,9 +295,9 @@ inline edict_t *INDEXENT(int iEdictNum)
}
/* <15a45d> ../cstrike/dlls/util.h:193 */
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent)
{
MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent));
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent)
{
MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent));
}
/* <244c4> ../cstrike/dlls/util.h:197 */

View File

@ -1,9 +1,5 @@
#include "precompiled.h"
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
edict_t *g_pBodyQueueHead;
CGlobalState gGlobalState;
float g_flWeaponCheat;

598
regamedll/dlls/wpn_shared.h Normal file
View File

@ -0,0 +1,598 @@
#pragma once
//AK47
#define AK47_MAX_SPEED 221
#define AK47_DAMAGE 36
#define AK47_RANGE_MODIFER 0.98
#define AK47_RELOAD_TIME 2.45
enum ak47_e
{
AK47_IDLE1,
AK47_RELOAD,
AK47_DRAW,
AK47_SHOOT1,
AK47_SHOOT2,
AK47_SHOOT3
};
//AUG
#define AUG_MAX_SPEED 240
#define AUG_DAMAGE 32
#define AUG_RANGE_MODIFER 0.96
#define AUG_RELOAD_TIME 3.3
enum aug_e
{
AUG_IDLE1,
AUG_RELOAD,
AUG_DRAW,
AUG_SHOOT1,
AUG_SHOOT2,
AUG_SHOOT3
};
//AWP
#define AWP_MAX_SPEED 210
#define AWP_MAX_SPEED_ZOOM 150
#define AWP_DAMAGE 115
#define AWP_RANGE_MODIFER 0.99
#define AWP_RELOAD_TIME 2.5
enum awp_e
{
AWP_IDLE,
AWP_SHOOT,
AWP_SHOOT2,
AWP_SHOOT3,
AWP_RELOAD,
AWP_DRAW,
};
//C4
#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
};
//Deagle
#define DEAGLE_MAX_SPEED 250
#define DEAGLE_DAMAGE 54
#define DEAGLE_RANGE_MODIFER 0.81
#define DEAGLE_RELOAD_TIME 2.2
enum deagle_e
{
DEAGLE_IDLE1,
DEAGLE_SHOOT1,
DEAGLE_SHOOT2,
DEAGLE_SHOOT_EMPTY,
DEAGLE_RELOAD,
DEAGLE_DRAW
};
//Elites
#define ELITE_MAX_SPEED 250
#define ELITE_RELOAD_TIME 4.5
#define ELITE_DAMAGE 36
#define ELITE_RANGE_MODIFER 0.75
enum elite_e
{
ELITE_IDLE,
ELITE_IDLE_LEFTEMPTY,
ELITE_SHOOTLEFT1,
ELITE_SHOOTLEFT2,
ELITE_SHOOTLEFT3,
ELITE_SHOOTLEFT4,
ELITE_SHOOTLEFT5,
ELITE_SHOOTLEFTLAST,
ELITE_SHOOTRIGHT1,
ELITE_SHOOTRIGHT2,
ELITE_SHOOTRIGHT3,
ELITE_SHOOTRIGHT4,
ELITE_SHOOTRIGHT5,
ELITE_SHOOTRIGHTLAST,
ELITE_RELOAD,
ELITE_DRAW
};
//Famas
#define FAMAS_MAX_SPEED 240
#define FAMAS_RELOAD_TIME 3.3
#define FAMAS_DAMAGE 30
#define FAMAS_DAMAGE_BURST 34
#define FAMAS_RANGE_MODIFER 0.96
enum famas_e
{
FAMAS_IDLE1,
FAMAS_RELOAD,
FAMAS_DRAW,
FAMAS_SHOOT1,
FAMAS_SHOOT2,
FAMAS_SHOOT3
};
//Fiveseven
#define FIVESEVEN_MAX_SPEED 250
#define FIVESEVEN_DAMAGE 20
#define FIVESEVEN_RANGE_MODIFER 0.885
#define FIVESEVEN_RELOAD_TIME 2.7
enum fiveseven_e
{
FIVESEVEN_IDLE,
FIVESEVEN_SHOOT1,
FIVESEVEN_SHOOT2,
FIVESEVEN_SHOOT_EMPTY,
FIVESEVEN_RELOAD,
FIVESEVEN_DRAW
};
//Flashbang
#define FLASHBANG_MAX_SPEED 250
#define FLASHBANG_MAX_SPEED_SHIELD 180
enum flashbang_e
{
FLASHBANG_IDLE,
FLASHBANG_PULLPIN,
FLASHBANG_THROW,
FLASHBANG_DRAW
};
//g3sg1
#define G3SG1_MAX_SPEED 210
#define G3SG1_MAX_SPEED_ZOOM 150
#define G3SG1_DAMAGE 80
#define G3SG1_RANGE_MODIFER 0.98
#define G3SG1_RELOAD_TIME 3.5
enum g3sg1_e
{
G3SG1_IDLE,
G3SG1_SHOOT,
G3SG1_SHOOT2,
G3SG1_RELOAD,
G3SG1_DRAW
};
//galil
#define GALIL_MAX_SPEED 240
#define GALIL_DAMAGE 30
#define GALIL_RANGE_MODIFER 0.98
#define GALIL_RELOAD_TIME 2.45
enum galil_e
{
GALIL_IDLE1,
GALIL_RELOAD,
GALIL_DRAW,
GALIL_SHOOT1,
GALIL_SHOOT2,
GALIL_SHOOT3
};
//glock18
#define GLOCK18_MAX_SPEED 250
#define GLOCK18_DAMAGE 25
#define GLOCK18_RANGE_MODIFER 0.75
#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
};
//hegrenade
#define HEGRENADE_MAX_SPEED 250
#define HEGRENADE_MAX_SPEED_SHIELD 180
enum hegrenade_e
{
HEGRENADE_IDLE,
HEGRENADE_PULLPIN,
HEGRENADE_THROW,
HEGRENADE_DRAW
};
//knife
#define KNIFE_BODYHIT_VOLUME 128
#define KNIFE_WALLHIT_VOLUME 512
#define KNIFE_MAX_SPEED 250
#define KNIFE_MAX_SPEED_SHIELD 180
enum knife_e
{
KNIFE_IDLE,
KNIFE_ATTACK1HIT,
KNIFE_ATTACK2HIT,
KNIFE_DRAW,
KNIFE_STABHIT,
KNIFE_STABMISS,
KNIFE_MIDATTACK1HIT,
KNIFE_MIDATTACK2HIT
};
enum knife_shield_e
{
KNIFE_SHIELD_IDLE,
KNIFE_SHIELD_SLASH,
KNIFE_SHIELD_ATTACKHIT,
KNIFE_SHIELD_DRAW,
KNIFE_SHIELD_UPIDLE,
KNIFE_SHIELD_UP,
KNIFE_SHIELD_DOWN
};
//m3
#define M3_MAX_SPEED 230
#define M3_CONE_VECTOR Vector(0.0675, 0.0675, 0.0) // special shotgun spreads
enum m3_e
{
M3_IDLE,
M3_FIRE1,
M3_FIRE2,
M3_RELOAD,
M3_PUMP,
M3_START_RELOAD,
M3_DRAW,
M3_HOLSTER
};
//m4a1
#define M4A1_MAX_SPEED 230
#define M4A1_DAMAGE 32
#define M4A1_DAMAGE_SIL 33
#define M4A1_RANGE_MODIFER 0.97
#define M4A1_RANGE_MODIFER_SIL 0.95
#define M4A1_RELOAD_TIME 3.05
enum m4a1_e
{
M4A1_IDLE,
M4A1_SHOOT1,
M4A1_SHOOT2,
M4A1_SHOOT3,
M4A1_RELOAD,
M4A1_DRAW,
M4A1_ATTACH_SILENCER,
M4A1_UNSIL_IDLE,
M4A1_UNSIL_SHOOT1,
M4A1_UNSIL_SHOOT2,
M4A1_UNSIL_SHOOT3,
M4A1_UNSIL_RELOAD,
M4A1_UNSIL_DRAW,
M4A1_DETACH_SILENCER
};
//m249
#define M249_MAX_SPEED 220
#define M249_DAMAGE 32
#define M249_RANGE_MODIFER 0.97
#define M249_RELOAD_TIME 4.7
enum m249_e
{
M249_IDLE1,
M249_SHOOT1,
M249_SHOOT2,
M249_RELOAD,
M249_DRAW
};
//mac10
#define MAC10_MAX_SPEED 250
#define MAC10_DAMAGE 29
#define MAC10_RANGE_MODIFER 0.82
#define MAC10_RELOAD_TIME 3.15
enum mac10_e
{
MAC10_IDLE1,
MAC10_RELOAD,
MAC10_DRAW,
MAC10_SHOOT1,
MAC10_SHOOT2,
MAC10_SHOOT3
};
//mp5navy
#define MP5N_MAX_SPEED 250
#define MP5N_DAMAGE 26
#define MP5N_RANGE_MODIFER 0.84
#define MP5N_RELOAD_TIME 2.63
enum mp5n_e
{
MP5N_IDLE1,
MP5N_RELOAD,
MP5N_DRAW,
MP5N_SHOOT1,
MP5N_SHOOT2,
MP5N_SHOOT3
};
//p90
#define P90_MAX_SPEED 245
#define P90_DAMAGE 21
#define P90_RANGE_MODIFER 0.885
#define P90_RELOAD_TIME 3.4
enum p90_e
{
P90_IDLE1,
P90_RELOAD,
P90_DRAW,
P90_SHOOT1,
P90_SHOOT2,
P90_SHOOT3
};
//p228
#define P228_MAX_SPEED 250
#define P228_DAMAGE 32
#define P228_RANGE_MODIFER 0.8
#define P228_RELOAD_TIME 2.7
enum p228_e
{
P228_IDLE,
P228_SHOOT1,
P228_SHOOT2,
P228_SHOOT3,
P228_SHOOT_EMPTY,
P228_RELOAD,
P228_DRAW
};
enum p228_shield_e
{
P228_SHIELD_IDLE,
P228_SHIELD_SHOOT1,
P228_SHIELD_SHOOT2,
P228_SHIELD_SHOOT_EMPTY,
P228_SHIELD_RELOAD,
P228_SHIELD_DRAW,
P228_SHIELD_IDLE_UP,
P228_SHIELD_UP,
P228_SHIELD_DOWN
};
//scout
#define SCOUT_MAX_SPEED 260
#define SCOUT_MAX_SPEED_ZOOM 220
#define SCOUT_DAMAGE 75
#define SCOUT_RANGE_MODIFER 0.98
#define SCOUT_RELOAD_TIME 2
enum scout_e
{
SCOUT_IDLE,
SCOUT_SHOOT,
SCOUT_SHOOT2,
SCOUT_RELOAD,
SCOUT_DRAW
};
//sg550
#define SG550_MAX_SPEED 210
#define SG550_MAX_SPEED_ZOOM 150
#define SG550_DAMAGE 70
#define SG550_RANGE_MODIFER 0.98
#define SG550_RELOAD_TIME 3.35
enum sg550_e
{
SG550_IDLE,
SG550_SHOOT,
SG550_SHOOT2,
SG550_RELOAD,
SG550_DRAW
};
//sg552
#define SG552_MAX_SPEED 235
#define SG552_MAX_SPEED_ZOOM 200
#define SG552_DAMAGE 33
#define SG552_RANGE_MODIFER 0.955
#define SG552_RELOAD_TIME 3
enum sg552_e
{
SG552_IDLE1,
SG552_RELOAD,
SG552_DRAW,
SG552_SHOOT1,
SG552_SHOOT2,
SG552_SHOOT3
};
//smokegrenade
#define SMOKEGRENADE_MAX_SPEED 250
#define SMOKEGRENADE_MAX_SPEED_SHIELD 180
enum smokegrenade_e
{
SMOKEGRENADE_IDLE,
SMOKEGRENADE_PINPULL,
SMOKEGRENADE_THROW,
SMOKEGRENADE_DRAW
};
//tmp
#define TMP_MAX_SPEED 250
#define TMP_DAMAGE 20
#define TMP_RANGE_MODIFER 0.85
#define TMP_RELOAD_TIME 2.12
enum tmp_e
{
TMP_IDLE1,
TMP_RELOAD,
TMP_DRAW,
TMP_SHOOT1,
TMP_SHOOT2,
TMP_SHOOT3
};
//ump45
#define UMP45_MAX_SPEED 250
#define UMP45_DAMAGE 30
#define UMP45_RANGE_MODIFER 0.82
#define UMP45_RELOAD_TIME 3.5
enum ump45_e
{
UMP45_IDLE1,
UMP45_RELOAD,
UMP45_DRAW,
UMP45_SHOOT1,
UMP45_SHOOT2,
UMP45_SHOOT3
};
//tmp
#define USP_MAX_SPEED 250
#define USP_DAMAGE 34
#define USP_DAMAGE_SIL 30
#define USP_RANGE_MODIFER 0.79
#define USP_RELOAD_TIME 2.7
enum usp_e
{
USP_IDLE,
USP_SHOOT1,
USP_SHOOT2,
USP_SHOOT3,
USP_SHOOT_EMPTY,
USP_RELOAD,
USP_DRAW,
USP_ATTACH_SILENCER,
USP_UNSIL_IDLE,
USP_UNSIL_SHOOT1,
USP_UNSIL_SHOOT2,
USP_UNSIL_SHOOT3,
USP_UNSIL_SHOOT_EMPTY,
USP_UNSIL_RELOAD,
USP_UNSIL_DRAW,
USP_DETACH_SILENCER
};
enum usp_shield_e
{
USP_SHIELD_IDLE,
USP_SHIELD_SHOOT1,
USP_SHIELD_SHOOT2,
USP_SHIELD_SHOOT_EMPTY,
USP_SHIELD_RELOAD,
USP_SHIELD_DRAW,
USP_SHIELD_UP_IDLE,
USP_SHIELD_UP,
USP_SHIELD_DOWN
};
//xm1014
#define XM1014_MAX_SPEED 240
#define XM1014_CONE_VECTOR Vector(0.0725, 0.0725, 0.0) // special shotgun spreads
enum xm1014_e
{
XM1014_IDLE,
XM1014_FIRE1,
XM1014_FIRE2,
XM1014_RELOAD,
XM1014_PUMP,
XM1014_START_RELOAD,
XM1014_DRAW
};

View File

@ -1,80 +1,63 @@
#include "precompiled.h"
#define AK47_MAX_SPEED 221
#define AK47_DAMAGE 36
#define AK47_RANGE_MODIFER 0.98
#define AK47_RELOAD_TIME 2.45
enum ak47_e
{
AK47_IDLE1,
AK47_RELOAD,
AK47_DRAW,
AK47_SHOOT1,
AK47_SHOOT2,
AK47_SHOOT3
};
/* <23556d> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_ak47, CAK47);
/* <235327> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:52 */
void CAK47::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_AK47;
SET_MODEL(edict(), "models/w_ak47.mdl");
m_iDefaultAmmo = AK47_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
Precache();
m_iId = WEAPON_AK47;
SET_MODEL(edict(), "models/w_ak47.mdl");
m_iDefaultAmmo = AK47_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
FallInit();
}
/* <235280> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:66 */
void CAK47::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_ak47.mdl");
PRECACHE_MODEL("models/w_ak47.mdl");
PRECACHE_SOUND("weapons/ak47-1.wav");
PRECACHE_SOUND("weapons/ak47-2.wav");
PRECACHE_SOUND("weapons/ak47_clipout.wav");
PRECACHE_SOUND("weapons/ak47_clipin.wav");
PRECACHE_SOUND("weapons/ak47_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_ak47.mdl");
PRECACHE_MODEL("models/w_ak47.mdl");
PRECACHE_SOUND("weapons/ak47-1.wav");
PRECACHE_SOUND("weapons/ak47-2.wav");
PRECACHE_SOUND("weapons/ak47_clipout.wav");
PRECACHE_SOUND("weapons/ak47_clipin.wav");
PRECACHE_SOUND("weapons/ak47_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireAK47 = PRECACHE_EVENT(1, "events/ak47.sc");
}
/* <2352a7> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:82 */
int CAK47::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = AK47_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 1;
p->iId = m_iId = WEAPON_AK47;
p->iFlags = 0;
p->iWeight = AK47_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = AK47_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 1;
p->iId = m_iId = WEAPON_AK47;
p->iFlags = 0;
p->iWeight = AK47_WEIGHT;
return 1;
}
/* <235300> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:99 */
BOOL CAK47::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
return DefaultDeploy("models/v_ak47.mdl", "models/p_ak47.mdl", AK47_DRAW, "ak47", UseDecrement() != FALSE);
}
@ -87,97 +70,97 @@ void CAK47::__MAKE_VHOOK(SecondaryAttack)(void)
/* <235523> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:112 */
void CAK47::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
AK47Fire(0.04 + (0.4 * m_flAccuracy), 0.0955, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
AK47Fire(0.04 + (0.07 * m_flAccuracy), 0.0955, FALSE);
}
else
{
AK47Fire(0.0275 * m_flAccuracy, 0.0955, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
AK47Fire(0.04 + (0.4 * m_flAccuracy), 0.0955, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
AK47Fire(0.04 + (0.07 * m_flAccuracy), 0.0955, FALSE);
}
else
{
AK47Fire(0.0275 * m_flAccuracy, 0.0955, FALSE);
}
}
/* <235637> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:123 */
void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35;
if (m_flAccuracy > 1.25)
m_flAccuracy = 1.25;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35;
if (m_flAccuracy > 1.25)
m_flAccuracy = 1.25;
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);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_762MM,
AK47_DAMAGE, AK47_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAK47, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_762MM,
AK47_DAMAGE, AK47_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAK47, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9;
if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(1.5, 0.45, 0.225, 0.05, 6.5, 2.5, 7);
}
}
else if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(2.0, 1.0, 0.5, 0.35, 9.0, 6.0, 5);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.9, 0.35, 0.15, 0.025, 5.5, 1.5, 9);
}
}
else
{
{
KickBack(1.0, 0.375, 0.175, 0.0375, 5.75, 1.75, 8);
}
}
@ -187,32 +170,32 @@ void CAK47::__MAKE_VHOOK(Reload)(void)
{
#ifdef REGAMEDLL_FIXES
// to prevent reload if not enough ammo
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, AK47_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, AK47_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
}
}
/* <23539d> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:219 */
void CAK47::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(AK47_IDLE1, UseDecrement() != FALSE);
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(AK47_IDLE1, UseDecrement() != FALSE);
}
}

View File

@ -1,22 +1,5 @@
#include "precompiled.h"
#define AUG_MAX_SPEED 240
#define AUG_DAMAGE 32
#define AUG_RANGE_MODIFER 0.96
#define AUG_RELOAD_TIME 3.3
enum aug_e
{
AUG_IDLE1,
AUG_RELOAD,
AUG_DRAW,
AUG_SHOOT1,
AUG_SHOOT2,
AUG_SHOOT3
};
/* <23a81f> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_aug, CAUG);

View File

@ -1,23 +1,5 @@
#include "precompiled.h"
#define AWP_MAX_SPEED 210
#define AWP_MAX_SPEED_ZOOM 150
#define AWP_DAMAGE 115
#define AWP_RANGE_MODIFER 0.99
#define AWP_RELOAD_TIME 2.5
enum awp_e
{
AWP_IDLE,
AWP_SHOOT,
AWP_SHOOT2,
AWP_SHOOT3,
AWP_RELOAD,
AWP_DRAW,
};
/* <23fdac> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_awp, CAWP);
@ -35,65 +17,65 @@ void CAWP::__MAKE_VHOOK(Spawn)(void)
/* <23fa2c> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:64 */
void CAWP::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_awp.mdl");
PRECACHE_MODEL("models/w_awp.mdl");
PRECACHE_SOUND("weapons/awp1.wav");
PRECACHE_SOUND("weapons/boltpull1.wav");
PRECACHE_SOUND("weapons/boltup.wav");
PRECACHE_SOUND("weapons/boltdown.wav");
PRECACHE_SOUND("weapons/zoom.wav");
PRECACHE_SOUND("weapons/awp_deploy.wav");
PRECACHE_SOUND("weapons/awp_clipin.wav");
PRECACHE_SOUND("weapons/awp_clipout.wav");
m_iShell = PRECACHE_MODEL("models/rshell_big.mdl");
m_iShellId = m_iShell;
PRECACHE_MODEL("models/v_awp.mdl");
PRECACHE_MODEL("models/w_awp.mdl");
PRECACHE_SOUND("weapons/awp1.wav");
PRECACHE_SOUND("weapons/boltpull1.wav");
PRECACHE_SOUND("weapons/boltup.wav");
PRECACHE_SOUND("weapons/boltdown.wav");
PRECACHE_SOUND("weapons/zoom.wav");
PRECACHE_SOUND("weapons/awp_deploy.wav");
PRECACHE_SOUND("weapons/awp_clipin.wav");
PRECACHE_SOUND("weapons/awp_clipout.wav");
m_iShell = PRECACHE_MODEL("models/rshell_big.mdl");
m_iShellId = m_iShell;
m_usFireAWP = PRECACHE_EVENT(1, "events/awp.sc");
}
/* <23fa53> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:83 */
int CAWP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "338Magnum";
p->iMaxAmmo1 = MAX_AMMO_338MAGNUM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = AWP_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 2;
p->iId = m_iId = WEAPON_AWP;
p->iFlags = 0;
p->iWeight = AWP_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "338Magnum";
p->iMaxAmmo1 = MAX_AMMO_338MAGNUM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = AWP_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 2;
p->iId = m_iId = WEAPON_AWP;
p->iFlags = 0;
p->iWeight = AWP_WEIGHT;
return 1;
}
/* <23fc19> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:100 */
BOOL CAWP::__MAKE_VHOOK(Deploy)(void)
{
if (DefaultDeploy("models/v_awp.mdl", "models/p_awp.mdl", AWP_DRAW, "rifle", UseDecrement() != FALSE))
{
m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.45);
m_flNextPrimaryAttack = m_pPlayer->m_flNextAttack;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
return TRUE;
}
if (DefaultDeploy("models/v_awp.mdl", "models/p_awp.mdl", AWP_DRAW, "rifle", UseDecrement() != FALSE))
{
m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.45);
m_flNextPrimaryAttack = m_pPlayer->m_flNextAttack;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
return TRUE;
}
return FALSE;
}
/* <23faac> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:113 */
void CAWP::__MAKE_VHOOK(SecondaryAttack)(void)
{
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 10; break;
default: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 10; break;
default: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
}
if (TheBots != NULL)
@ -110,118 +92,118 @@ void CAWP::__MAKE_VHOOK(SecondaryAttack)(void)
/* <23fd53> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:143 */
void CAWP::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
AWPFire(0.85, 1.45, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
AWPFire(0.25, 1.45, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 10)
{
AWPFire(0.1, 1.45, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
AWPFire(0.0, 1.45, FALSE);
}
else
{
AWPFire(0.001, 1.45, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
AWPFire(0.85, 1.45, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
AWPFire(0.25, 1.45, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 10)
{
AWPFire(0.1, 1.45, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
AWPFire(0.0, 1.45, FALSE);
}
else
{
AWPFire(0.001, 1.45, FALSE);
}
}
/* <23fe76> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:157 */
void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_bResumeZoom = true;
m_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;
// reset a fov
m_pPlayer->m_iFOV = DEFAULT_FOV;
m_pPlayer->pev->fov = DEFAULT_FOV;
}
else
{
flSpread += 0.08;
}
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_flEjectBrass = gpGlobals->time + 0.55;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_338MAG, AWP_DAMAGE, AWP_RANGE_MODIFER, 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_usFireAWP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
{
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_bResumeZoom = true;
m_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;
// reset a fov
m_pPlayer->m_iFOV = DEFAULT_FOV;
m_pPlayer->pev->fov = DEFAULT_FOV;
}
else
{
flSpread += 0.08;
}
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_flEjectBrass = gpGlobals->time + 0.55;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_338MAG, AWP_DAMAGE, AWP_RANGE_MODIFER, 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_usFireAWP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->pev->punchangle.x -= 2;
}
/* <23fbc1> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:239 */
void CAWP::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_338mag <= 0)
{
return;
if (m_pPlayer->ammo_338mag <= 0)
{
return;
}
if (DefaultReload(AWP_MAX_CLIP, AWP_RELOAD, AWP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = 10;
m_pPlayer->pev->fov = 10;
SecondaryAttack();
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = 10;
m_pPlayer->pev->fov = 10;
SecondaryAttack();
}
}
}
@ -229,13 +211,13 @@ void CAWP::__MAKE_VHOOK(Reload)(void)
/* <23fb86> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:265 */
void CAWP::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() && m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(AWP_IDLE, UseDecrement() != FALSE);
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() && m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(AWP_IDLE, UseDecrement() != FALSE);
}
}

View File

@ -1,17 +1,5 @@
#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);

View File

@ -1,107 +1,90 @@
#include "precompiled.h"
#define DEAGLE_MAX_SPEED 250
#define DEAGLE_DAMAGE 54
#define DEAGLE_RANGE_MODIFER 0.81
#define DEAGLE_RELOAD_TIME 2.2
enum deagle_e
{
DEAGLE_IDLE1,
DEAGLE_SHOOT1,
DEAGLE_SHOOT2,
DEAGLE_SHOOT_EMPTY,
DEAGLE_RELOAD,
DEAGLE_DRAW
};
/* <24be52> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:49 */
LINK_ENTITY_TO_CLASS(weapon_deagle, CDEAGLE);
/* <24bbe5> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:51 */
void CDEAGLE::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_DEAGLE;
SET_MODEL(edict(), "models/w_deagle.mdl");
m_iDefaultAmmo = DEAGLE_DEFAULT_GIVE;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_fMaxSpeed = DEAGLE_MAX_SPEED;
m_flAccuracy = 0.9;
Precache();
m_iId = WEAPON_DEAGLE;
SET_MODEL(edict(), "models/w_deagle.mdl");
m_iDefaultAmmo = DEAGLE_DEFAULT_GIVE;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_fMaxSpeed = DEAGLE_MAX_SPEED;
m_flAccuracy = 0.9;
FallInit();
}
/* <24bb64> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:68 */
void CDEAGLE::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_deagle.mdl");
PRECACHE_MODEL("models/shield/v_shield_deagle.mdl");
PRECACHE_MODEL("models/w_deagle.mdl");
PRECACHE_SOUND("weapons/deagle-1.wav");
PRECACHE_SOUND("weapons/deagle-2.wav");
PRECACHE_SOUND("weapons/de_clipout.wav");
PRECACHE_SOUND("weapons/de_clipin.wav");
PRECACHE_SOUND("weapons/de_deploy.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_deagle.mdl");
PRECACHE_MODEL("models/shield/v_shield_deagle.mdl");
PRECACHE_MODEL("models/w_deagle.mdl");
PRECACHE_SOUND("weapons/deagle-1.wav");
PRECACHE_SOUND("weapons/deagle-2.wav");
PRECACHE_SOUND("weapons/de_clipout.wav");
PRECACHE_SOUND("weapons/de_clipin.wav");
PRECACHE_SOUND("weapons/de_deploy.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireDeagle = PRECACHE_EVENT(1, "events/deagle.sc");
}
/* <24bb8b> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:86 */
int CDEAGLE::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "50AE";
p->iMaxAmmo1 = MAX_AMMO_50AE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = DEAGLE_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 1;
p->iId = m_iId = WEAPON_DEAGLE;
p->iFlags = 0;
p->iWeight = DEAGLE_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "50AE";
p->iMaxAmmo1 = MAX_AMMO_50AE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = DEAGLE_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 1;
p->iId = m_iId = WEAPON_DEAGLE;
p->iFlags = 0;
p->iWeight = DEAGLE_WEIGHT;
return 1;
}
/* <24bccf> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:103 */
BOOL CDEAGLE::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.9;
m_fMaxSpeed = DEAGLE_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_deagle.mdl", "models/shield/p_shield_deagle.mdl", DEAGLE_DRAW, "shieldgun", UseDecrement() != FALSE);
else
m_flAccuracy = 0.9;
m_fMaxSpeed = DEAGLE_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_deagle.mdl", "models/shield/p_shield_deagle.mdl", DEAGLE_DRAW, "shieldgun", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_deagle.mdl", "models/p_deagle.mdl", DEAGLE_DRAW, "onehanded", UseDecrement() != FALSE);
}
/* <24be08> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:119 */
void CDEAGLE::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
DEAGLEFire(1.5 * (1 - m_flAccuracy), 0.3, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
DEAGLEFire(0.25 * (1 - m_flAccuracy), 0.3, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
DEAGLEFire(0.115 * (1 - m_flAccuracy), 0.3, FALSE);
}
else
{
DEAGLEFire(0.13 * (1 - m_flAccuracy), 0.3, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
DEAGLEFire(1.5 * (1 - m_flAccuracy), 0.3, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
DEAGLEFire(0.25 * (1 - m_flAccuracy), 0.3, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
DEAGLEFire(0.115 * (1 - m_flAccuracy), 0.3, FALSE);
}
else
{
DEAGLEFire(0.13 * (1 - m_flAccuracy), 0.3, FALSE);
}
}
@ -114,46 +97,46 @@ void CDEAGLE::__MAKE_VHOOK(SecondaryAttack)(void)
/* <24bf1c> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:137 */
void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.075;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.4 - (gpGlobals->time - m_flLastFire)) * 0.35;
if (m_flAccuracy > 0.9)
{
m_flAccuracy = 0.9;
}
else if (m_flAccuracy < 0.55)
{
m_flAccuracy = 0.55;
}
}
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.075;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.4 - (gpGlobals->time - m_flLastFire)) * 0.35;
if (m_flAccuracy > 0.9)
{
m_flAccuracy = 0.9;
}
else if (m_flAccuracy < 0.55)
{
m_flAccuracy = 0.55;
}
}
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--;
@ -163,107 +146,107 @@ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi)
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 2, BULLET_PLAYER_50AE, DEAGLE_DAMAGE, DEAGLE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireDeagle, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireDeagle, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.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() + 1.8;
m_pPlayer->pev->punchangle.x -= 2;
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() + 1.8;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
}
/* <24bc95> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:231 */
void CDEAGLE::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_50ae <= 0)
{
return;
}
if (DefaultReload(DEAGLE_MAX_CLIP, DEAGLE_RELOAD, DEAGLE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;
if (m_pPlayer->ammo_50ae <= 0)
{
return;
}
if (DefaultReload(DEAGLE_MAX_CLIP, DEAGLE_RELOAD, DEAGLE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;
}
}
/* <24bc5b> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:243 */
void CDEAGLE::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (FBitSet(m_iWeaponState, WPNSTATE_SHIELD_DRAWN))
{
SendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
}
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (FBitSet(m_iWeaponState, WPNSTATE_SHIELD_DRAWN))
{
SendWeaponAnim(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
}
}
}
#ifdef HOOK_GAMEDLL
void CDEAGLE::Spawn(void)
{
Spawn_();
}
void CDEAGLE::Precache(void)
{
Precache_();
}
int CDEAGLE::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CDEAGLE::Deploy(void)
{
return Deploy_();
}
void CDEAGLE::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CDEAGLE::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CDEAGLE::Reload(void)
{
Reload_();
}
void CDEAGLE::WeaponIdle(void)
{
WeaponIdle_();
void CDEAGLE::Spawn(void)
{
Spawn_();
}
void CDEAGLE::Precache(void)
{
Precache_();
}
int CDEAGLE::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CDEAGLE::Deploy(void)
{
return Deploy_();
}
void CDEAGLE::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CDEAGLE::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CDEAGLE::Reload(void)
{
Reload_();
}
void CDEAGLE::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,116 +1,90 @@
#include "precompiled.h"
#define ELITE_MAX_SPEED 250
#define ELITE_RELOAD_TIME 4.5
#define ELITE_DAMAGE 36
#define ELITE_RANGE_MODIFER 0.75
enum elite_e
{
ELITE_IDLE,
ELITE_IDLE_LEFTEMPTY,
ELITE_SHOOTLEFT1,
ELITE_SHOOTLEFT2,
ELITE_SHOOTLEFT3,
ELITE_SHOOTLEFT4,
ELITE_SHOOTLEFT5,
ELITE_SHOOTLEFTLAST,
ELITE_SHOOTRIGHT1,
ELITE_SHOOTRIGHT2,
ELITE_SHOOTRIGHT3,
ELITE_SHOOTRIGHT4,
ELITE_SHOOTRIGHT5,
ELITE_SHOOTRIGHTLAST,
ELITE_RELOAD,
ELITE_DRAW
};
/* <25137f> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:52 */
LINK_ENTITY_TO_CLASS(weapon_elite, CELITE);
/* <251034> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:54 */
void CELITE::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_ELITE;
SET_MODEL(edict(), "models/w_elite.mdl");
m_iDefaultAmmo = ELITE_DEFAULT_GIVE;
m_flAccuracy = 0.88;
Precache();
m_iId = WEAPON_ELITE;
SET_MODEL(edict(), "models/w_elite.mdl");
m_iDefaultAmmo = ELITE_DEFAULT_GIVE;
m_flAccuracy = 0.88;
FallInit();
}
/* <250fb3> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:67 */
void CELITE::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_elite.mdl");
PRECACHE_MODEL("models/w_elite.mdl");
PRECACHE_SOUND("weapons/elite_fire.wav");
PRECACHE_SOUND("weapons/elite_reloadstart.wav");
PRECACHE_SOUND("weapons/elite_leftclipin.wav");
PRECACHE_SOUND("weapons/elite_clipout.wav");
PRECACHE_SOUND("weapons/elite_sliderelease.wav");
PRECACHE_SOUND("weapons/elite_rightclipin.wav");
PRECACHE_SOUND("weapons/elite_deploy.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireELITE_LEFT = PRECACHE_EVENT(1, "events/elite_left.sc");
PRECACHE_MODEL("models/v_elite.mdl");
PRECACHE_MODEL("models/w_elite.mdl");
PRECACHE_SOUND("weapons/elite_fire.wav");
PRECACHE_SOUND("weapons/elite_reloadstart.wav");
PRECACHE_SOUND("weapons/elite_leftclipin.wav");
PRECACHE_SOUND("weapons/elite_clipout.wav");
PRECACHE_SOUND("weapons/elite_sliderelease.wav");
PRECACHE_SOUND("weapons/elite_rightclipin.wav");
PRECACHE_SOUND("weapons/elite_deploy.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireELITE_LEFT = PRECACHE_EVENT(1, "events/elite_left.sc");
m_usFireELITE_RIGHT = PRECACHE_EVENT(1, "events/elite_right.sc");
}
/* <250fda> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:86 */
int CELITE::__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 = ELITE_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 5;
p->iId = m_iId = WEAPON_ELITE;
p->iFlags = 0;
p->iWeight = ELITE_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "9mm";
p->iMaxAmmo1 = MAX_AMMO_9MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = ELITE_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 5;
p->iId = m_iId = WEAPON_ELITE;
p->iFlags = 0;
p->iWeight = ELITE_WEIGHT;
return 1;
}
/* <25100d> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:103 */
BOOL CELITE::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.88;
if (!(m_iClip & 1))
{
m_iWeaponState |= WPNSTATE_ELITE_LEFT;
}
m_flAccuracy = 0.88;
if (!(m_iClip & 1))
{
m_iWeaponState |= WPNSTATE_ELITE_LEFT;
}
return DefaultDeploy("models/v_elite.mdl", "models/p_elite.mdl", ELITE_DRAW, "dualpistols", UseDecrement() != FALSE);
}
/* <251335> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:114 */
void CELITE::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
ELITEFire(1.3 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
ELITEFire(0.175 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
ELITEFire(0.08 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
ELITEFire(0.1 * (1 - m_flAccuracy), 0.2, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
ELITEFire(1.3 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
ELITEFire(0.175 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
ELITEFire(0.08 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
ELITEFire(0.1 * (1 - m_flAccuracy), 0.2, FALSE);
}
}
@ -129,110 +103,110 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi)
flCycleTime -= 0.125;
#endif // REGAMEDLL_FIXES
m_iShotsFired++;
if (m_iShotsFired > 1)
{
return;
}
flTimeDiff = gpGlobals->time - m_flLastFire;
if (m_flLastFire)
{
m_flAccuracy -= (0.325 - flTimeDiff) * 0.275;
if (m_flAccuracy > 0.88)
{
m_flAccuracy = 0.88;
}
else if (m_flAccuracy < 0.55)
{
m_flAccuracy = 0.55;
}
m_iShotsFired++;
if (m_iShotsFired > 1)
{
return;
}
flTimeDiff = gpGlobals->time - m_flLastFire;
if (m_flLastFire)
{
m_flAccuracy -= (0.325 - flTimeDiff) * 0.275;
if (m_flAccuracy > 0.88)
{
m_flAccuracy = 0.88;
}
else if (m_flAccuracy < 0.55)
{
m_flAccuracy = 0.55;
}
}
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;
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_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
m_iClip--;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
if (m_iWeaponState & WPNSTATE_ELITE_LEFT)
{
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_iWeaponState &= ~WPNSTATE_ELITE_LEFT;
vecDir = m_pPlayer->FireBullets3(vecSrc - gpGlobals->v_right * 5, vecAiming, flSpread,
8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
if (m_iWeaponState & WPNSTATE_ELITE_LEFT)
{
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_iWeaponState &= ~WPNSTATE_ELITE_LEFT;
vecDir = m_pPlayer->FireBullets3(vecSrc - gpGlobals->v_right * 5, vecAiming, flSpread,
8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_LEFT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x,
(int)(vecDir.y * 100), m_iClip, FALSE, FALSE);
}
else
{
m_pPlayer->SetAnimation(PLAYER_ATTACK2);
m_iWeaponState |= WPNSTATE_ELITE_LEFT;
vecDir = m_pPlayer->FireBullets3(vecSrc + gpGlobals->v_right * 5, vecAiming, flSpread,
8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
(int)(vecDir.y * 100), m_iClip, FALSE, FALSE);
}
else
{
m_pPlayer->SetAnimation(PLAYER_ATTACK2);
m_iWeaponState |= WPNSTATE_ELITE_LEFT;
vecDir = m_pPlayer->FireBullets3(vecSrc + gpGlobals->v_right * 5, vecAiming, flSpread,
8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_RIGHT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x,
(int)(vecDir.y * 100), m_iClip, FALSE, FALSE);
}
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
(int)(vecDir.y * 100), m_iClip, FALSE, FALSE);
}
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_pPlayer->pev->punchangle.x -= 2.0;
}
/* <2510f8> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:239 */
void CELITE::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
if (DefaultReload(ELITE_MAX_CLIP, ELITE_RELOAD, ELITE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.88;
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
if (DefaultReload(ELITE_MAX_CLIP, ELITE_RELOAD, ELITE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.88;
}
}
@ -241,56 +215,56 @@ void CELITE::__MAKE_VHOOK(WeaponIdle)(void)
{
int iAnim;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
if (m_iClip)
{
iAnim = (m_iClip == 1) ? ELITE_IDLE_LEFTEMPTY : ELITE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0;
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
}
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
if (m_iClip)
{
iAnim = (m_iClip == 1) ? ELITE_IDLE_LEFTEMPTY : ELITE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0;
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
}
}
}
#ifdef HOOK_GAMEDLL
void CELITE::Spawn(void)
{
Spawn_();
}
void CELITE::Precache(void)
{
Precache_();
}
int CELITE::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CELITE::Deploy(void)
{
return Deploy_();
}
void CELITE::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CELITE::Reload(void)
{
Reload_();
}
void CELITE::WeaponIdle(void)
{
WeaponIdle_();
void CELITE::Spawn(void)
{
Spawn_();
}
void CELITE::Precache(void)
{
Precache_();
}
int CELITE::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CELITE::Deploy(void)
{
return Deploy_();
}
void CELITE::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CELITE::Reload(void)
{
Reload_();
}
void CELITE::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,23 +1,5 @@
#include "precompiled.h"
enum famas_e
{
FAMAS_IDLE1,
FAMAS_RELOAD,
FAMAS_DRAW,
FAMAS_SHOOT1,
FAMAS_SHOOT2,
FAMAS_SHOOT3
};
#define FAMAS_MAX_SPEED 240
#define FAMAS_RELOAD_TIME 3.3
#define FAMAS_DAMAGE 30
#define FAMAS_DAMAGE_BURST 34
#define FAMAS_RANGE_MODIFER 0.96
/* <2c0549> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_famas, CFamas);

View File

@ -1,106 +1,89 @@
#include "precompiled.h"
#define FIVESEVEN_MAX_SPEED 250
#define FIVESEVEN_DAMAGE 20
#define FIVESEVEN_RANGE_MODIFER 0.885
#define FIVESEVEN_RELOAD_TIME 2.7
enum fiveseven_e
{
FIVESEVEN_IDLE,
FIVESEVEN_SHOOT1,
FIVESEVEN_SHOOT2,
FIVESEVEN_SHOOT_EMPTY,
FIVESEVEN_RELOAD,
FIVESEVEN_DRAW
};
/* <25698d> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:49 */
LINK_ENTITY_TO_CLASS(weapon_fiveseven, CFiveSeven);
/* <256720> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:51 */
void CFiveSeven::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_FIVESEVEN;
SET_MODEL(edict(), "models/w_fiveseven.mdl");
m_iDefaultAmmo = FIVESEVEN_DEFAULT_GIVE;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_flAccuracy = 0.92;
Precache();
m_iId = WEAPON_FIVESEVEN;
SET_MODEL(edict(), "models/w_fiveseven.mdl");
m_iDefaultAmmo = FIVESEVEN_DEFAULT_GIVE;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_flAccuracy = 0.92;
FallInit();
}
/* <25669f> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:66 */
void CFiveSeven::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_fiveseven.mdl");
PRECACHE_MODEL("models/w_fiveseven.mdl");
PRECACHE_MODEL("models/shield/v_shield_fiveseven.mdl");
PRECACHE_SOUND("weapons/fiveseven-1.wav");
PRECACHE_SOUND("weapons/fiveseven_clipout.wav");
PRECACHE_SOUND("weapons/fiveseven_clipin.wav");
PRECACHE_SOUND("weapons/fiveseven_sliderelease.wav");
PRECACHE_SOUND("weapons/fiveseven_slidepull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_fiveseven.mdl");
PRECACHE_MODEL("models/w_fiveseven.mdl");
PRECACHE_MODEL("models/shield/v_shield_fiveseven.mdl");
PRECACHE_SOUND("weapons/fiveseven-1.wav");
PRECACHE_SOUND("weapons/fiveseven_clipout.wav");
PRECACHE_SOUND("weapons/fiveseven_clipin.wav");
PRECACHE_SOUND("weapons/fiveseven_sliderelease.wav");
PRECACHE_SOUND("weapons/fiveseven_slidepull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireFiveSeven = PRECACHE_EVENT(1, "events/fiveseven.sc");
}
/* <2566c6> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:84 */
int CFiveSeven::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "57mm";
p->iMaxAmmo1 = MAX_AMMO_57MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = FIVESEVEN_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 6;
p->iId = m_iId = WEAPON_FIVESEVEN;
p->iFlags = 0;
p->iWeight = FIVESEVEN_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "57mm";
p->iMaxAmmo1 = MAX_AMMO_57MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = FIVESEVEN_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 6;
p->iId = m_iId = WEAPON_FIVESEVEN;
p->iFlags = 0;
p->iWeight = FIVESEVEN_WEIGHT;
return 1;
}
/* <25680a> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:101 */
BOOL CFiveSeven::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.92;
m_fMaxSpeed = FIVESEVEN_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_fiveseven.mdl", "models/shield/p_shield_fiveseven.mdl", FIVESEVEN_DRAW, "shieldgun", UseDecrement() != FALSE);
else
m_flAccuracy = 0.92;
m_fMaxSpeed = FIVESEVEN_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_fiveseven.mdl", "models/shield/p_shield_fiveseven.mdl", FIVESEVEN_DRAW, "shieldgun", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_fiveseven.mdl", "models/p_fiveseven.mdl", FIVESEVEN_DRAW, "onehanded", UseDecrement() != FALSE);
}
/* <256943> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:117 */
void CFiveSeven::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
FiveSevenFire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
FiveSevenFire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
FiveSevenFire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
FiveSevenFire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
FiveSevenFire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
FiveSevenFire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
FiveSevenFire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
FiveSevenFire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);
}
}
@ -112,47 +95,47 @@ void CFiveSeven::__MAKE_VHOOK(SecondaryAttack)(void)
/* <256a57> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:134 */
void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.05;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.275 - (gpGlobals->time - m_flLastFire)) * 0.25;
if (m_flAccuracy > 0.92)
{
m_flAccuracy = 0.92;
}
else if (m_flAccuracy < 0.725)
{
m_flAccuracy = 0.725;
}
}
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;
{
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.05;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.275 - (gpGlobals->time - m_flLastFire)) * 0.25;
if (m_flAccuracy > 0.92)
{
m_flAccuracy = 0.92;
}
else if (m_flAccuracy < 0.725)
{
m_flAccuracy = 0.725;
}
}
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--;
@ -162,118 +145,118 @@ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi)
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_57MM, FIVESEVEN_DAMAGE, FIVESEVEN_RANGE_MODIFER, m_pPlayer->pev, false, // TODO: why fiveseven not is IsPistol?
m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFiveSeven, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFiveSeven, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.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;
m_pPlayer->pev->punchangle.x -= 2;
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;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
}
/* <2567d0> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:225 */
void CFiveSeven::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_57mm <= 0)
{
return;
}
if (DefaultReload(FIVESEVEN_MAX_CLIP, FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.92;
if (m_pPlayer->ammo_57mm <= 0)
{
return;
}
if (DefaultReload(FIVESEVEN_MAX_CLIP, FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.92;
}
}
/* <256796> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:238 */
void CFiveSeven::__MAKE_VHOOK(WeaponIdle)(void)
{
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(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
}
}
else if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625;
SendWeaponAnim(FIVESEVEN_IDLE, UseDecrement() != FALSE);
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(SHIELDGUN_DRAWN_IDLE, UseDecrement() != FALSE);
}
}
else if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625;
SendWeaponAnim(FIVESEVEN_IDLE, UseDecrement() != FALSE);
}
}
#ifdef HOOK_GAMEDLL
void CFiveSeven::Spawn(void)
{
Spawn_();
}
void CFiveSeven::Precache(void)
{
Precache_();
}
int CFiveSeven::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CFiveSeven::Deploy(void)
{
return Deploy_();
}
void CFiveSeven::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CFiveSeven::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CFiveSeven::Reload(void)
{
Reload_();
}
void CFiveSeven::WeaponIdle(void)
{
WeaponIdle_();
void CFiveSeven::Spawn(void)
{
Spawn_();
}
void CFiveSeven::Precache(void)
{
Precache_();
}
int CFiveSeven::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CFiveSeven::Deploy(void)
{
return Deploy_();
}
void CFiveSeven::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CFiveSeven::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CFiveSeven::Reload(void)
{
Reload_();
}
void CFiveSeven::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,111 +1,100 @@
#include "precompiled.h"
#define FLASHBANG_MAX_SPEED 250
#define FLASHBANG_MAX_SPEED_SHIELD 180
enum flashbang_e
{
FLASHBANG_IDLE,
FLASHBANG_PULLPIN,
FLASHBANG_THROW,
FLASHBANG_DRAW
};
/* <25ba9b> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:37 */
LINK_ENTITY_TO_CLASS(weapon_flashbang, CFlashbang);
/* <25b72f> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:39 */
void CFlashbang::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_FLASHBANG;
SET_MODEL(edict(), "models/w_flashbang.mdl");
pev->dmg = 4;
m_iDefaultAmmo = FLASHBANG_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1.0;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
{
Precache();
m_iId = WEAPON_FLASHBANG;
SET_MODEL(edict(), "models/w_flashbang.mdl");
pev->dmg = 4;
m_iDefaultAmmo = FLASHBANG_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1.0;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
FallInit();
}
/* <25b67a> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:58 */
void CFlashbang::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_flashbang.mdl");
PRECACHE_MODEL("models/shield/v_shield_flashbang.mdl");
PRECACHE_SOUND("weapons/flashbang-1.wav");
PRECACHE_SOUND("weapons/flashbang-2.wav");
PRECACHE_MODEL("models/v_flashbang.mdl");
PRECACHE_MODEL("models/shield/v_shield_flashbang.mdl");
PRECACHE_SOUND("weapons/flashbang-1.wav");
PRECACHE_SOUND("weapons/flashbang-2.wav");
PRECACHE_SOUND("weapons/pinpull.wav");
}
/* <25b6a1> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:69 */
int CFlashbang::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "Flashbang";
p->iMaxAmmo1 = MAX_AMMO_FLASHBANG;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 2;
p->iId = m_iId = WEAPON_FLASHBANG;
p->iWeight = FLASHBANG_WEIGHT;
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "Flashbang";
p->iMaxAmmo1 = MAX_AMMO_FLASHBANG;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 2;
p->iId = m_iId = WEAPON_FLASHBANG;
p->iWeight = FLASHBANG_WEIGHT;
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
return 1;
}
/* <25b7df> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:87 */
BOOL CFlashbang::__MAKE_VHOOK(Deploy)(void)
{
m_flReleaseThrow = -1.0;
m_fMaxSpeed = FLASHBANG_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_flashbang.mdl", "models/shield/p_shield_flashbang.mdl", FLASHBANG_DRAW, "shieldgren", UseDecrement() != FALSE);
else
m_flReleaseThrow = -1.0;
m_fMaxSpeed = FLASHBANG_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_flashbang.mdl", "models/shield/p_shield_flashbang.mdl", FLASHBANG_DRAW, "shieldgren", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_flashbang.mdl", "models/p_flashbang.mdl", FLASHBANG_DRAW, "grenade", UseDecrement() != FALSE);
}
/* <25b6fa> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:102 */
void CFlashbang::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
m_pPlayer->pev->weapons &= ~(1 << WEAPON_FLASHBANG);
DestroyItem();
}
m_flStartThrow = 0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
m_pPlayer->pev->weapons &= ~(1 << WEAPON_FLASHBANG);
DestroyItem();
}
m_flStartThrow = 0;
m_flReleaseThrow = -1.0;
}
/* <25b7a5> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:118 */
void CFlashbang::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
return;
}
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(FLASHBANG_PULLPIN, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
return;
}
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(FLASHBANG_PULLPIN, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
}
}
@ -117,34 +106,34 @@ bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
return false;
}
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = FLASHBANG_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = FLASHBANG_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = FLASHBANG_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = FLASHBANG_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
return true;
}
@ -159,22 +148,22 @@ void CFlashbang::SetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
/* <25bbb9> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:187 */
void CFlashbang::ResetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
}
@ -187,15 +176,15 @@ void CFlashbang::__MAKE_VHOOK(WeaponIdle)(void)
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_flStartThrow)
if (m_flStartThrow)
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float_precision flVel = (90.0 - angThrow.x) * 6.0;
@ -224,8 +213,8 @@ void CFlashbang::__MAKE_VHOOK(WeaponIdle)(void)
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
@ -241,39 +230,39 @@ void CFlashbang::__MAKE_VHOOK(WeaponIdle)(void)
}
else if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
int iAnim;
int iAnim;
float flRand = RANDOM_FLOAT(0, 1);
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
if (flRand <= 0.75)
{
iAnim = FLASHBANG_IDLE;
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
else
{
#ifdef REGAMEDLL_FIXES
iAnim = FLASHBANG_IDLE;
#else
// TODO: This is a bug?
iAnim = *(int *)&flRand;
#endif // REGAMEDLL_FIXES
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
if (flRand <= 0.75)
{
iAnim = FLASHBANG_IDLE;
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
else
{
#ifdef REGAMEDLL_FIXES
iAnim = FLASHBANG_IDLE;
#else
// TODO: This is a bug?
iAnim = *(int *)&flRand;
#endif // REGAMEDLL_FIXES
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
}
}
}

View File

@ -1,69 +1,52 @@
#include "precompiled.h"
#define G3SG1_MAX_SPEED 210
#define G3SG1_MAX_SPEED_ZOOM 150
#define G3SG1_DAMAGE 80
#define G3SG1_RANGE_MODIFER 0.98
#define G3SG1_RELOAD_TIME 3.5
enum g3sg1_e
{
G3SG1_IDLE,
G3SG1_SHOOT,
G3SG1_SHOOT2,
G3SG1_RELOAD,
G3SG1_DRAW
};
/* <260ef4> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:48 */
LINK_ENTITY_TO_CLASS(weapon_g3sg1, CG3SG1);
/* <260ca2> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:50 */
void CG3SG1::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_G3SG1;
SET_MODEL(edict(), "models/w_g3sg1.mdl");
m_iDefaultAmmo = G3SG1_DEFAULT_GIVE;
m_flLastFire = 0;
Precache();
m_iId = WEAPON_G3SG1;
SET_MODEL(edict(), "models/w_g3sg1.mdl");
m_iDefaultAmmo = G3SG1_DEFAULT_GIVE;
m_flLastFire = 0;
FallInit();
}
/* <260b97> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:63 */
void CG3SG1::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_g3sg1.mdl");
PRECACHE_MODEL("models/w_g3sg1.mdl");
PRECACHE_SOUND("weapons/g3sg1-1.wav");
PRECACHE_SOUND("weapons/g3sg1_slide.wav");
PRECACHE_SOUND("weapons/g3sg1_clipin.wav");
PRECACHE_SOUND("weapons/g3sg1_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_g3sg1.mdl");
PRECACHE_MODEL("models/w_g3sg1.mdl");
PRECACHE_SOUND("weapons/g3sg1-1.wav");
PRECACHE_SOUND("weapons/g3sg1_slide.wav");
PRECACHE_SOUND("weapons/g3sg1_clipin.wav");
PRECACHE_SOUND("weapons/g3sg1_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireG3SG1 = PRECACHE_EVENT(1, "events/g3sg1.sc");
}
/* <260bbe> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:79 */
int CG3SG1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = G3SG1_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 3;
p->iId = m_iId = WEAPON_G3SG1;
p->iFlags = 0;
p->iWeight = G3SG1_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = G3SG1_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 3;
p->iId = m_iId = WEAPON_G3SG1;
p->iFlags = 0;
p->iWeight = G3SG1_WEIGHT;
return 1;
}
@ -77,16 +60,16 @@ BOOL CG3SG1::__MAKE_VHOOK(Deploy)(void)
/* <260c17> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:102 */
void CG3SG1::__MAKE_VHOOK(SecondaryAttack)(void)
{
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
}
m_pPlayer->ResetMaxSpeed();
@ -103,100 +86,100 @@ void CG3SG1::__MAKE_VHOOK(SecondaryAttack)(void)
/* <260eaa> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:133 */
void CG3SG1::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
G3SG1Fire(0.45, 0.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
G3SG1Fire(0.15, 0.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
G3SG1Fire(0.035, 0.25, FALSE);
}
else
{
G3SG1Fire(0.055, 0.25, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
G3SG1Fire(0.45, 0.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
G3SG1Fire(0.15, 0.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
G3SG1Fire(0.035, 0.25, FALSE);
}
else
{
G3SG1Fire(0.055, 0.25, FALSE);
}
}
/* <260dab> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:145 */
void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
flSpread += 0.025;
}
if (m_flLastFire)
{
m_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.3 + 0.55;
if (m_flAccuracy > 0.98)
{
m_flAccuracy = 0.98;
}
}
else
{
m_flAccuracy = 0.98;
}
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;
if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
flSpread += 0.025;
}
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 = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
if (m_flLastFire)
{
m_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.3 + 0.55;
if (m_flAccuracy > 0.98)
{
m_flAccuracy = 0.98;
}
}
else
{
m_flAccuracy = 0.98;
}
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 = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, (1 - m_flAccuracy) * flSpread, 8192, 3, BULLET_PLAYER_762MM, G3SG1_DAMAGE, G3SG1_RANGE_MODIFER, 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_usFireG3SG1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, (1 - m_flAccuracy) * flSpread, 8192, 3, BULLET_PLAYER_762MM, G3SG1_DAMAGE, G3SG1_RANGE_MODIFER, 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_usFireG3SG1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.75) + m_pPlayer->pev->punchangle.x * 0.25;
m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75);
}
@ -204,37 +187,37 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <260d53> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:234 */
void CG3SG1::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
if (DefaultReload(G3SG1_MAX_CLIP, G3SG1_RELOAD, G3SG1_RELOAD_TIME))
{
m_flAccuracy = 0.2;
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;
SecondaryAttack();
}
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
if (DefaultReload(G3SG1_MAX_CLIP, G3SG1_RELOAD, G3SG1_RELOAD_TIME))
{
m_flAccuracy = 0.2;
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;
SecondaryAttack();
}
}
}
/* <260d18> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:260 */
void CG3SG1::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(G3SG1_IDLE, UseDecrement() != FALSE);
}
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(G3SG1_IDLE, UseDecrement() != FALSE);
}
}
}

View File

@ -1,78 +1,61 @@
#include "precompiled.h"
#define GALIL_MAX_SPEED 240
#define GALIL_DAMAGE 30
#define GALIL_RANGE_MODIFER 0.98
#define GALIL_RELOAD_TIME 2.45
enum galil_e
{
GALIL_IDLE1,
GALIL_RELOAD,
GALIL_DRAW,
GALIL_SHOOT1,
GALIL_SHOOT2,
GALIL_SHOOT3
};
/* <2c5a1c> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_galil, CGalil);
/* <2c57b0> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:52 */
void CGalil::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_GALIL;
SET_MODEL(edict(), "models/w_galil.mdl");
m_iDefaultAmmo = GALIL_DEFAULT_GIVE;
Precache();
m_iId = WEAPON_GALIL;
SET_MODEL(edict(), "models/w_galil.mdl");
m_iDefaultAmmo = GALIL_DEFAULT_GIVE;
FallInit();
}
/* <2c5709> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:65 */
void CGalil::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_galil.mdl");
PRECACHE_MODEL("models/w_galil.mdl");
PRECACHE_SOUND("weapons/galil-1.wav");
PRECACHE_SOUND("weapons/galil-2.wav");
PRECACHE_SOUND("weapons/galil_clipout.wav");
PRECACHE_SOUND("weapons/galil_clipin.wav");
PRECACHE_SOUND("weapons/galil_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_galil.mdl");
PRECACHE_MODEL("models/w_galil.mdl");
PRECACHE_SOUND("weapons/galil-1.wav");
PRECACHE_SOUND("weapons/galil-2.wav");
PRECACHE_SOUND("weapons/galil_clipout.wav");
PRECACHE_SOUND("weapons/galil_clipin.wav");
PRECACHE_SOUND("weapons/galil_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireGalil = PRECACHE_EVENT(1, "events/galil.sc");
}
/* <2c5730> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:81 */
int CGalil::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = GALIL_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 17;
p->iId = m_iId = WEAPON_GALIL;
p->iFlags = 0;
p->iWeight = GALIL_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = GALIL_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 17;
p->iId = m_iId = WEAPON_GALIL;
p->iFlags = 0;
p->iWeight = GALIL_WEIGHT;
return 1;
}
/* <2c5789> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:98 */
BOOL CGalil::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
return DefaultDeploy("models/v_galil.mdl", "models/p_galil.mdl", GALIL_DRAW, "ak47", UseDecrement() != FALSE);
}
@ -85,104 +68,104 @@ void CGalil::__MAKE_VHOOK(SecondaryAttack)(void)
/* <2c59d2> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:111 */
void CGalil::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
}
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
GalilFire(0.04 + (0.3 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
GalilFire(0.04 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
GalilFire(0.0375 * m_flAccuracy, 0.0875, FALSE);
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
}
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
GalilFire(0.04 + (0.3 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
GalilFire(0.04 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
GalilFire(0.0375 * m_flAccuracy, 0.0875, FALSE);
}
}
/* <2c5ae6> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:129 */
void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35;
if (m_flAccuracy > 1.25)
m_flAccuracy = 1.25;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.35;
if (m_flAccuracy > 1.25)
m_flAccuracy = 1.25;
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);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
GALIL_DAMAGE, GALIL_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGalil, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.28;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
GALIL_DAMAGE, GALIL_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGalil, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.28;
if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(1.0, 0.45, 0.28, 0.045, 3.75, 3.0, 7);
}
}
else if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.6, 0.3, 0.2, 0.0125, 3.25, 2.0, 7);
}
}
else
{
{
KickBack(0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);
}
}
@ -192,32 +175,32 @@ void CGalil::__MAKE_VHOOK(Reload)(void)
{
#ifdef REGAMEDLL_FIXES
// to prevent reload if not enough ammo
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(GALIL_MAX_CLIP, GALIL_RELOAD, GALIL_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(GALIL_MAX_CLIP, GALIL_RELOAD, GALIL_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
}
}
/* <2c5826> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:232 */
void CGalil::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(GALIL_IDLE1, UseDecrement() != FALSE);
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(GALIL_IDLE1, UseDecrement() != FALSE);
}
}

View File

@ -1,121 +1,84 @@
#include "precompiled.h"
#define GLOCK18_MAX_SPEED 250
#define GLOCK18_DAMAGE 25
#define GLOCK18_RANGE_MODIFER 0.75
#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 */
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;
{
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 */
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");
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 */
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;
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 */
BOOL CGLOCK18::__MAKE_VHOOK(Deploy)(void)
{
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))
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);
}
@ -126,65 +89,65 @@ BOOL CGLOCK18::__MAKE_VHOOK(Deploy)(void)
/* <266246> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:156 */
void CGLOCK18::__MAKE_VHOOK(SecondaryAttack)(void)
{
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;
}
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 */
void CGLOCK18::__MAKE_VHOOK(PrimaryAttack)(void)
{
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);
}
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);
}
}
}
@ -194,93 +157,93 @@ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst)
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;
}
if (bFireBurst)
{
m_iGlock18ShotsFired = 0;
}
else
{
m_iShotsFired++;
if (m_iShotsFired > 1)
{
return;
}
flCycleTime -= 0.05;
}
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;
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_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();
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();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM, GLOCK18_DAMAGE, GLOCK18_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
#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, vecDir.x, vecDir.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;
}
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();
}
@ -289,22 +252,22 @@ void CGLOCK18::__MAKE_VHOOK(Reload)(void)
{
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;
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;
}
}
@ -314,44 +277,44 @@ void CGLOCK18::__MAKE_VHOOK(WeaponIdle)(void)
int iAnim;
float flRand;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
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);
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);
}
}

View File

@ -1,15 +1,4 @@
#include "precompiled.h"
#define HEGRENADE_MAX_SPEED 250
#define HEGRENADE_MAX_SPEED_SHIELD 180
enum hegrenade_e
{
HEGRENADE_IDLE,
HEGRENADE_PULLPIN,
HEGRENADE_THROW,
HEGRENADE_DRAW
};
/* <26b3cd> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:38 */
LINK_ENTITY_TO_CLASS(weapon_hegrenade, CHEGrenade);
@ -17,135 +6,135 @@ LINK_ENTITY_TO_CLASS(weapon_hegrenade, CHEGrenade);
/* <26b07c> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:40 */
void CHEGrenade::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_HEGRENADE;
SET_MODEL(edict(), "models/w_hegrenade.mdl");
pev->dmg = 4;
m_iDefaultAmmo = HEGRENADE_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
Precache();
m_iId = WEAPON_HEGRENADE;
SET_MODEL(edict(), "models/w_hegrenade.mdl");
pev->dmg = 4;
m_iDefaultAmmo = HEGRENADE_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
FallInit();
}
/* <26afc7> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:59 */
void CHEGrenade::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_hegrenade.mdl");
PRECACHE_MODEL("models/shield/v_shield_hegrenade.mdl");
PRECACHE_SOUND("weapons/hegrenade-1.wav");
PRECACHE_SOUND("weapons/hegrenade-2.wav");
PRECACHE_SOUND("weapons/he_bounce-1.wav");
PRECACHE_SOUND("weapons/pinpull.wav");
PRECACHE_MODEL("models/v_hegrenade.mdl");
PRECACHE_MODEL("models/shield/v_shield_hegrenade.mdl");
PRECACHE_SOUND("weapons/hegrenade-1.wav");
PRECACHE_SOUND("weapons/hegrenade-2.wav");
PRECACHE_SOUND("weapons/he_bounce-1.wav");
PRECACHE_SOUND("weapons/pinpull.wav");
m_usCreateExplosion = PRECACHE_EVENT(1, "events/createexplo.sc");
}
/* <26afee> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:74 */
int CHEGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "HEGrenade";
p->iMaxAmmo1 = MAX_AMMO_HEGRENADE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 1;
p->iId = m_iId = WEAPON_HEGRENADE;
p->iWeight = HEGRENADE_WEIGHT;
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "HEGrenade";
p->iMaxAmmo1 = MAX_AMMO_HEGRENADE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 1;
p->iId = m_iId = WEAPON_HEGRENADE;
p->iWeight = HEGRENADE_WEIGHT;
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
return 1;
}
/* <26b12c> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:92 */
BOOL CHEGrenade::__MAKE_VHOOK(Deploy)(void)
{
m_flReleaseThrow = -1;
m_fMaxSpeed = HEGRENADE_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_hegrenade.mdl", "models/shield/p_shield_hegrenade.mdl", HEGRENADE_DRAW, "shieldgren", UseDecrement() != FALSE);
else
m_flReleaseThrow = -1;
m_fMaxSpeed = HEGRENADE_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_hegrenade.mdl", "models/shield/p_shield_hegrenade.mdl", HEGRENADE_DRAW, "shieldgren", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_hegrenade.mdl", "models/p_hegrenade.mdl", HEGRENADE_DRAW, "grenade", UseDecrement() != FALSE);
}
/* <26b047> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:107 */
void CHEGrenade::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
m_pPlayer->pev->weapons &= ~(1 << WEAPON_HEGRENADE);
DestroyItem();
}
m_flStartThrow = 0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
m_pPlayer->pev->weapons &= ~(1 << WEAPON_HEGRENADE);
DestroyItem();
}
m_flStartThrow = 0;
m_flReleaseThrow = -1;
}
/* <26b0f2> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:123 */
void CHEGrenade::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
return;
}
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(HEGRENADE_PULLPIN, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
return;
}
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(HEGRENADE_PULLPIN, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
}
}
/* <26b497> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:138 */
bool CHEGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
{
if (!m_pPlayer->HasShield() || m_flStartThrow > 0)
{
return false;
}
if (!m_pPlayer->HasShield() || m_flStartThrow > 0)
{
return false;
}
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = HEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = HEGRENADE_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = HEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = HEGRENADE_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
return true;
}
@ -160,115 +149,115 @@ void CHEGrenade::SetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
/* <26b4eb> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:192 */
void CHEGrenade::ResetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
}
/* <26a24e> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:202 */
void CHEGrenade::__MAKE_VHOOK(WeaponIdle)(void)
{
if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)
m_flReleaseThrow = gpGlobals->time;
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_flStartThrow)
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float flVel = (90.0 - angThrow.x) * 6.0;
if (flVel > 750.0f)
flVel = 750.0f;
UTIL_MakeVectors(angThrow);
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
CGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion);
SendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE);
SetPlayerShieldAnim();
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
}
ResetPlayerShieldAnim();
{
if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)
m_flReleaseThrow = gpGlobals->time;
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_flStartThrow)
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float flVel = (90.0 - angThrow.x) * 6.0;
if (flVel > 750.0f)
flVel = 750.0f;
UTIL_MakeVectors(angThrow);
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
CGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion);
SendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE);
SetPlayerShieldAnim();
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
}
ResetPlayerShieldAnim();
}
else if (m_flReleaseThrow > 0)
{
// we've finished the throw, restart.
m_flStartThrow = 0;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim(HEGRENADE_DRAW, UseDecrement() != FALSE);
}
else
{
RetireWeapon();
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
m_flReleaseThrow = -1;
else if (m_flReleaseThrow > 0)
{
// we've finished the throw, restart.
m_flStartThrow = 0;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim(HEGRENADE_DRAW, UseDecrement() != FALSE);
}
else
{
RetireWeapon();
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
m_flReleaseThrow = -1;
}
else if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
SendWeaponAnim(HEGRENADE_IDLE, UseDecrement() != FALSE);
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
{
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
SendWeaponAnim(HEGRENADE_IDLE, UseDecrement() != FALSE);
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
}
}

View File

@ -1,34 +1,5 @@
#include "precompiled.h"
#define KNIFE_BODYHIT_VOLUME 128
#define KNIFE_WALLHIT_VOLUME 512
#define KNIFE_MAX_SPEED 250
#define KNIFE_MAX_SPEED_SHIELD 180
enum knife_e
{
KNIFE_IDLE,
KNIFE_ATTACK1HIT,
KNIFE_ATTACK2HIT,
KNIFE_DRAW,
KNIFE_STABHIT,
KNIFE_STABMISS,
KNIFE_MIDATTACK1HIT,
KNIFE_MIDATTACK2HIT
};
enum knife_shield_e
{
KNIFE_SHIELD_IDLE,
KNIFE_SHIELD_SLASH,
KNIFE_SHIELD_ATTACKHIT,
KNIFE_SHIELD_DRAW,
KNIFE_SHIELD_UPIDLE,
KNIFE_SHIELD_UP,
KNIFE_SHIELD_DOWN
};
/* <270ca6> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:28 */
LINK_ENTITY_TO_CLASS(weapon_knife, CKnife);

View File

@ -1,21 +1,5 @@
#include "precompiled.h"
#define M249_MAX_SPEED 220
#define M249_DAMAGE 32
#define M249_RANGE_MODIFER 0.97
#define M249_RELOAD_TIME 4.7
enum m249_e
{
M249_IDLE1,
M249_SHOOT1,
M249_SHOOT2,
M249_RELOAD,
M249_DRAW
};
/* <276bbd> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:49 */
LINK_ENTITY_TO_CLASS(weapon_m249, CM249);

View File

@ -1,67 +1,52 @@
#include "precompiled.h"
#define M3_MAX_SPEED 230
#define M3_CONE_VECTOR Vector(0.0675, 0.0675, 0.0) // special shotgun spreads
enum m3_e
{
M3_IDLE,
M3_FIRE1,
M3_FIRE2,
M3_RELOAD,
M3_PUMP,
M3_START_RELOAD,
M3_DRAW,
M3_HOLSTER
};
/* <27bf59> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:52 */
LINK_ENTITY_TO_CLASS(weapon_m3, CM3);
/* <27be6d> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:54 */
void CM3::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_M3;
SET_MODEL(edict(), "models/w_m3.mdl");
m_iDefaultAmmo = M3_DEFAULT_GIVE;
Precache();
m_iId = WEAPON_M3;
SET_MODEL(edict(), "models/w_m3.mdl");
m_iDefaultAmmo = M3_DEFAULT_GIVE;
FallInit();
}
/* <27bc83> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:66 */
void CM3::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_m3.mdl");
PRECACHE_MODEL("models/w_m3.mdl");
m_iShellId = m_iShell = PRECACHE_MODEL("models/shotgunshell.mdl");
PRECACHE_SOUND("weapons/m3-1.wav");
PRECACHE_SOUND("weapons/m3_insertshell.wav");
PRECACHE_SOUND("weapons/m3_pump.wav");
PRECACHE_SOUND("weapons/reload1.wav");
PRECACHE_SOUND("weapons/reload3.wav");
PRECACHE_MODEL("models/v_m3.mdl");
PRECACHE_MODEL("models/w_m3.mdl");
m_iShellId = m_iShell = PRECACHE_MODEL("models/shotgunshell.mdl");
PRECACHE_SOUND("weapons/m3-1.wav");
PRECACHE_SOUND("weapons/m3_insertshell.wav");
PRECACHE_SOUND("weapons/m3_pump.wav");
PRECACHE_SOUND("weapons/reload1.wav");
PRECACHE_SOUND("weapons/reload3.wav");
m_usFireM3 = PRECACHE_EVENT(1, "events/m3.sc");
}
/* <27bcaa> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:84 */
int CM3::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "buckshot";
p->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = M3_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 5;
p->iId = m_iId = WEAPON_M3;
p->iFlags = 0;
p->iWeight = M3_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "buckshot";
p->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = M3_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 5;
p->iId = m_iId = WEAPON_M3;
p->iFlags = 0;
p->iWeight = M3_WEIGHT;
return 1;
}
@ -78,29 +63,29 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)(void)
int flag;
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
}
if (m_iClip <= 0)
{
Reload();
if (!m_iClip)
{
PlayEmptySound();
}
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
return;
if (m_iClip <= 0)
{
Reload();
if (!m_iClip)
{
PlayEmptySound();
}
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
return;
}
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
@ -113,34 +98,34 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)(void)
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
m_pPlayer->FireBullets(9, vecSrc, vecAiming, M3_CONE_VECTOR, 3000, BULLET_PLAYER_BUCKSHOT, 0);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM3, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, 0, FALSE, FALSE);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
if (m_iClip != 0)
m_flPumpTime = UTIL_WeaponTimeBase() + 0.5;
m_flNextPrimaryAttack = GetNextAttackDelay(0.875);
m_flNextPrimaryAttack = GetNextAttackDelay(0.875);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.875;
if (m_iClip != 0)
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5;
else
if (m_iClip != 0)
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5;
else
m_flTimeWeaponIdle = 0.875;
m_fInSpecialReload = 0;
@ -156,82 +141,82 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)(void)
/* <27bf1e> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:182 */
void CM3::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == M3_MAX_CLIP)
return;
// don't reload until recoil is done
if (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())
return;
// check to see if we're ready to reload
if (m_fInSpecialReload == 0)
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
SendWeaponAnim(M3_START_RELOAD, UseDecrement() != FALSE);
m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55;
m_flNextPrimaryAttack = GetNextAttackDelay(0.55);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55;
}
else if (m_fInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
SendWeaponAnim(M3_RELOAD, UseDecrement());
m_flNextReload = UTIL_WeaponTimeBase() + 0.45;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.45;
}
else
{
m_iClip++;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;
m_fInSpecialReload = 1;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == M3_MAX_CLIP)
return;
// don't reload until recoil is done
if (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())
return;
// check to see if we're ready to reload
if (m_fInSpecialReload == 0)
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
SendWeaponAnim(M3_START_RELOAD, UseDecrement() != FALSE);
m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55;
m_flNextPrimaryAttack = GetNextAttackDelay(0.55);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55;
}
else if (m_fInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
SendWeaponAnim(M3_RELOAD, UseDecrement());
m_flNextReload = UTIL_WeaponTimeBase() + 0.45;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.45;
}
else
{
m_iClip++;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;
m_fInSpecialReload = 1;
}
}
/* <27bee3> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:228 */
void CM3::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);
if (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())
{
m_flPumpTime = 0;
}
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
{
if (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != M3_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else
{
// reload debounce has timed out
SendWeaponAnim(M3_PUMP, UseDecrement() != FALSE);
m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
}
}
else
{
SendWeaponAnim(M3_IDLE, UseDecrement() != FALSE);
}
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);
if (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())
{
m_flPumpTime = 0;
}
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
{
if (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != M3_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else
{
// reload debounce has timed out
SendWeaponAnim(M3_PUMP, UseDecrement() != FALSE);
m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
}
}
else
{
SendWeaponAnim(M3_IDLE, UseDecrement() != FALSE);
}
}
}

View File

@ -1,32 +1,4 @@
#include "precompiled.h"
#define M4A1_MAX_SPEED 230
#define M4A1_DAMAGE 32
#define M4A1_DAMAGE_SIL 33
#define M4A1_RANGE_MODIFER 0.97
#define M4A1_RANGE_MODIFER_SIL 0.95
#define M4A1_RELOAD_TIME 3.05
enum m4a1_e
{
M4A1_IDLE,
M4A1_SHOOT1,
M4A1_SHOOT2,
M4A1_SHOOT3,
M4A1_RELOAD,
M4A1_DRAW,
M4A1_ATTACH_SILENCER,
M4A1_UNSIL_IDLE,
M4A1_UNSIL_SHOOT1,
M4A1_UNSIL_SHOOT2,
M4A1_UNSIL_SHOOT3,
M4A1_UNSIL_RELOAD,
M4A1_UNSIL_DRAW,
M4A1_DETACH_SILENCER
};
/* <281342> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:60 */
LINK_ENTITY_TO_CLASS(weapon_m4a1, CM4A1);
@ -34,51 +6,51 @@ LINK_ENTITY_TO_CLASS(weapon_m4a1, CM4A1);
/* <281059> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:62 */
void CM4A1::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_M4A1;
SET_MODEL(edict(), "models/w_m4a1.mdl");
m_iDefaultAmmo = M4A1_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = true;
Precache();
m_iId = WEAPON_M4A1;
SET_MODEL(edict(), "models/w_m4a1.mdl");
m_iDefaultAmmo = M4A1_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = true;
FallInit();
}
/* <280fb2> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:77 */
void CM4A1::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_m4a1.mdl");
PRECACHE_MODEL("models/w_m4a1.mdl");
PRECACHE_SOUND("weapons/m4a1-1.wav");
PRECACHE_SOUND("weapons/m4a1_unsil-1.wav");
PRECACHE_SOUND("weapons/m4a1_unsil-2.wav");
PRECACHE_SOUND("weapons/m4a1_clipin.wav");
PRECACHE_SOUND("weapons/m4a1_clipout.wav");
PRECACHE_SOUND("weapons/m4a1_boltpull.wav");
PRECACHE_SOUND("weapons/m4a1_deploy.wav");
PRECACHE_SOUND("weapons/m4a1_silencer_on.wav");
PRECACHE_SOUND("weapons/m4a1_silencer_off.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_m4a1.mdl");
PRECACHE_MODEL("models/w_m4a1.mdl");
PRECACHE_SOUND("weapons/m4a1-1.wav");
PRECACHE_SOUND("weapons/m4a1_unsil-1.wav");
PRECACHE_SOUND("weapons/m4a1_unsil-2.wav");
PRECACHE_SOUND("weapons/m4a1_clipin.wav");
PRECACHE_SOUND("weapons/m4a1_clipout.wav");
PRECACHE_SOUND("weapons/m4a1_boltpull.wav");
PRECACHE_SOUND("weapons/m4a1_deploy.wav");
PRECACHE_SOUND("weapons/m4a1_silencer_on.wav");
PRECACHE_SOUND("weapons/m4a1_silencer_off.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireM4A1 = PRECACHE_EVENT(1, "events/m4a1.sc");
}
/* <280fd9> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:97 */
int CM4A1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = M4A1_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 6;
p->iId = m_iId = WEAPON_M4A1;
p->iFlags = 0;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = M4A1_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 6;
p->iId = m_iId = WEAPON_M4A1;
p->iFlags = 0;
p->iWeight = M4A1_WEIGHT;
return 1;
@ -87,147 +59,147 @@ int CM4A1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
/* <281169> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:114 */
BOOL CM4A1::__MAKE_VHOOK(Deploy)(void)
{
m_bDelayFire = true;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
return DefaultDeploy("models/v_m4a1.mdl", "models/p_m4a1.mdl", M4A1_DRAW, "rifle", UseDecrement() != FALSE);
else
m_bDelayFire = true;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
return DefaultDeploy("models/v_m4a1.mdl", "models/p_m4a1.mdl", M4A1_DRAW, "rifle", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_m4a1.mdl", "models/p_m4a1.mdl", M4A1_UNSIL_DRAW, "rifle", UseDecrement() != FALSE);
}
/* <281032> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:127 */
void CM4A1::__MAKE_VHOOK(SecondaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
m_iWeaponState &= ~WPNSTATE_M4A1_SILENCED;
SendWeaponAnim(M4A1_DETACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "rifle");
}
else
{
m_iWeaponState |= WPNSTATE_M4A1_SILENCED;
SendWeaponAnim(M4A1_ATTACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "rifle");
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
m_iWeaponState &= ~WPNSTATE_M4A1_SILENCED;
SendWeaponAnim(M4A1_DETACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "rifle");
}
else
{
m_iWeaponState |= WPNSTATE_M4A1_SILENCED;
SendWeaponAnim(M4A1_ATTACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "rifle");
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_flNextPrimaryAttack = GetNextAttackDelay(2.0);
}
/* <2812fd> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:149 */
void CM4A1::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
M4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
M4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
M4A1Fire(0.025 * m_flAccuracy, 0.0875, FALSE);
}
}
else
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
M4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
M4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
M4A1Fire(0.02 * m_flAccuracy, 0.0875, FALSE);
}
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
M4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
M4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
M4A1Fire(0.025 * m_flAccuracy, 0.0875, FALSE);
}
}
else
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
M4A1Fire(0.035 + (0.4 * m_flAccuracy), 0.0875, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
M4A1Fire(0.035 + (0.07 * m_flAccuracy), 0.0875, FALSE);
}
else
{
M4A1Fire(0.02 * m_flAccuracy, 0.0875, FALSE);
}
}
}
/* <28140c> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:173 */
void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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->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 = BRIGHT_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
M4A1_DAMAGE_SIL, M4A1_RANGE_MODIFER_SIL, m_pPlayer->pev, false, m_pPlayer->random_seed);
}
else
{
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
M4A1_DAMAGE, M4A1_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
m_pPlayer->ammo_556nato--;
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM4A1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), (m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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->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 = BRIGHT_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
if (m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
M4A1_DAMAGE_SIL, M4A1_RANGE_MODIFER_SIL, m_pPlayer->pev, false, m_pPlayer->random_seed);
}
else
{
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
M4A1_DAMAGE, M4A1_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
m_pPlayer->ammo_556nato--;
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM4A1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), (m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
if (m_pPlayer->pev->velocity.Length2D() > 0)
{
@ -250,31 +222,31 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <28110b> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:257 */
void CM4A1::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(M4A1_MAX_CLIP, ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(M4A1_MAX_CLIP, ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
}
}
/* <2810cf> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:279 */
void CM4A1::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
SendWeaponAnim((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED ? M4A1_IDLE : M4A1_UNSIL_IDLE, UseDecrement() != FALSE);
}

View File

@ -1,172 +1,155 @@
#include "precompiled.h"
#define MAC10_MAX_SPEED 250
#define MAC10_DAMAGE 29
#define MAC10_RANGE_MODIFER 0.82
#define MAC10_RELOAD_TIME 3.15
enum mac10_e
{
MAC10_IDLE1,
MAC10_RELOAD,
MAC10_DRAW,
MAC10_SHOOT1,
MAC10_SHOOT2,
MAC10_SHOOT3
};
/* <2867c0> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_mac10, CMAC10);
/* <28658a> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:52 */
void CMAC10::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_MAC10;
SET_MODEL(edict(), "models/w_mac10.mdl");
m_iDefaultAmmo = MAC10_DEFAULT_GIVE;
m_flAccuracy = 0.15;
m_bDelayFire = false;
Precache();
m_iId = WEAPON_MAC10;
SET_MODEL(edict(), "models/w_mac10.mdl");
m_iDefaultAmmo = MAC10_DEFAULT_GIVE;
m_flAccuracy = 0.15;
m_bDelayFire = false;
FallInit();
}
/* <286509> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:66 */
void CMAC10::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_mac10.mdl");
PRECACHE_MODEL("models/w_mac10.mdl");
PRECACHE_SOUND("weapons/mac10-1.wav");
PRECACHE_SOUND("weapons/mac10_clipout.wav");
PRECACHE_SOUND("weapons/mac10_clipin.wav");
PRECACHE_SOUND("weapons/mac10_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_mac10.mdl");
PRECACHE_MODEL("models/w_mac10.mdl");
PRECACHE_SOUND("weapons/mac10-1.wav");
PRECACHE_SOUND("weapons/mac10_clipout.wav");
PRECACHE_SOUND("weapons/mac10_clipin.wav");
PRECACHE_SOUND("weapons/mac10_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireMAC10 = PRECACHE_EVENT(1, "events/mac10.sc");
}
/* <286530> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:82 */
int CMAC10::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "45acp";
p->iMaxAmmo1 = MAX_AMMO_45ACP;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = MAC10_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 13;
p->iId = m_iId = WEAPON_MAC10;
p->iFlags = 0;
p->iWeight = MAC10_WEIGHT;
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "45acp";
p->iMaxAmmo1 = MAX_AMMO_45ACP;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = MAC10_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 13;
p->iId = m_iId = WEAPON_MAC10;
p->iFlags = 0;
p->iWeight = MAC10_WEIGHT;
return 1;
}
/* <286563> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:99 */
BOOL CMAC10::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.15;
iShellOn = 1;
m_bDelayFire = false;
m_flAccuracy = 0.15;
iShellOn = 1;
m_bDelayFire = false;
return DefaultDeploy("models/v_mac10.mdl", "models/p_mac10.mdl", MAC10_DRAW, "onehanded", UseDecrement() != FALSE);
}
/* <286786> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:108 */
void CMAC10::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
MAC10Fire(0.375 * m_flAccuracy, 0.07, FALSE);
}
else
{
MAC10Fire(0.03 * m_flAccuracy, 0.07, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
MAC10Fire(0.375 * m_flAccuracy, 0.07, FALSE);
}
else
{
MAC10Fire(0.03 * m_flAccuracy, 0.07, FALSE);
}
}
/* <28688a> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:116 */
void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.6;
if (m_flAccuracy > 1.65)
m_flAccuracy = 1.65;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.6;
if (m_flAccuracy > 1.65)
m_flAccuracy = 1.65;
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 = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,
MAC10_DAMAGE, MAC10_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMAC10, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,
MAC10_DAMAGE, MAC10_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMAC10, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(1.3, 0.55, 0.4, 0.05, 4.75, 3.75, 5);
}
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(0.9, 0.45, 0.25, 0.035, 3.5, 2.75, 7);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.75, 0.4, 0.175, 0.03, 2.75, 2.5, 10);
}
}
else
{
{
KickBack(0.775, 0.425, 0.2, 0.03, 3.0, 2.75, 9);
}
}
@ -174,32 +157,32 @@ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <28663b> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:199 */
void CMAC10::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_45acp <= 0)
{
return;
}
if (DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, MAC10_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
if (m_pPlayer->ammo_45acp <= 0)
{
return;
}
if (DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, MAC10_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
}
}
/* <286600> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:213 */
void CMAC10::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(MAC10_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,173 +1,156 @@
#include "precompiled.h"
#define MP5N_MAX_SPEED 250
#define MP5N_DAMAGE 26
#define MP5N_RANGE_MODIFER 0.84
#define MP5N_RELOAD_TIME 2.63
enum mp5n_e
{
MP5N_IDLE1,
MP5N_RELOAD,
MP5N_DRAW,
MP5N_SHOOT1,
MP5N_SHOOT2,
MP5N_SHOOT3
};
/* <28bbf6> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_mp5navy, CMP5N);
/* <28b9c0> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:52 */
void CMP5N::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_MP5N;
SET_MODEL(edict(), "models/w_mp5.mdl");
m_iDefaultAmmo = MP5NAVY_DEFAULT_GIVE;
m_flAccuracy = 0;
m_bDelayFire = false;
Precache();
m_iId = WEAPON_MP5N;
SET_MODEL(edict(), "models/w_mp5.mdl");
m_iDefaultAmmo = MP5NAVY_DEFAULT_GIVE;
m_flAccuracy = 0;
m_bDelayFire = false;
FallInit();
}
/* <28b93f> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:66 */
void CMP5N::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_mp5.mdl");
PRECACHE_MODEL("models/w_mp5.mdl");
PRECACHE_SOUND("weapons/mp5-1.wav");
PRECACHE_SOUND("weapons/mp5-2.wav");
PRECACHE_SOUND("weapons/mp5_clipout.wav");
PRECACHE_SOUND("weapons/mp5_clipin.wav");
PRECACHE_SOUND("weapons/mp5_slideback.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_mp5.mdl");
PRECACHE_MODEL("models/w_mp5.mdl");
PRECACHE_SOUND("weapons/mp5-1.wav");
PRECACHE_SOUND("weapons/mp5-2.wav");
PRECACHE_SOUND("weapons/mp5_clipout.wav");
PRECACHE_SOUND("weapons/mp5_clipin.wav");
PRECACHE_SOUND("weapons/mp5_slideback.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireMP5N = PRECACHE_EVENT(1, "events/mp5n.sc");
}
/* <28b966> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:83 */
int CMP5N::__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 = MP5N_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 7;
p->iId = m_iId = WEAPON_MP5N;
p->iFlags = 0;
p->iWeight = MP5NAVY_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "9mm";
p->iMaxAmmo1 = MAX_AMMO_9MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = MP5N_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 7;
p->iId = m_iId = WEAPON_MP5N;
p->iFlags = 0;
p->iWeight = MP5NAVY_WEIGHT;
return 1;
}
/* <28b999> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:100 */
BOOL CMP5N::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0;
m_bDelayFire = false;
iShellOn = 1;
{
m_flAccuracy = 0;
m_bDelayFire = false;
iShellOn = 1;
return DefaultDeploy("models/v_mp5.mdl", "models/p_mp5.mdl", MP5N_DRAW, "mp5", UseDecrement() != FALSE);
}
/* <28bbbc> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:109 */
void CMP5N::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
MP5NFire(0.2 * m_flAccuracy, 0.075, FALSE);
}
else
{
MP5NFire(0.04 * m_flAccuracy, 0.075, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
MP5NFire(0.2 * m_flAccuracy, 0.075, FALSE);
}
else
{
MP5NFire(0.04 * m_flAccuracy, 0.075, FALSE);
}
}
/* <28bcc0> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:117 */
void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 220.1) + 0.45;
if (m_flAccuracy > 0.75)
m_flAccuracy = 0.75;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 220.1) + 0.45;
if (m_flAccuracy > 0.75)
m_flAccuracy = 0.75;
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);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,
MP5N_DAMAGE, MP5N_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMP5N, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,
MP5N_DAMAGE, MP5N_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMP5N, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(0.9, 0.475, 0.35, 0.0425, 5.0, 3.0, 6);
}
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(0.5, 0.275, 0.2, 0.03, 3.0, 2.0, 10);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.225, 0.15, 0.1, 0.015, 2.0, 1.0, 10);
}
}
else
{
{
KickBack(0.25, 0.175, 0.125, 0.02, 2.25, 1.25, 10);
}
}
@ -175,32 +158,32 @@ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <28ba71> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:201 */
void CMP5N::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
if (DefaultReload(MP5N_MAX_CLIP, MP5N_RELOAD, MP5N_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
if (DefaultReload(MP5N_MAX_CLIP, MP5N_RELOAD, MP5N_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
}
}
/* <28ba36> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:215 */
void CMP5N::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(MP5N_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,120 +1,89 @@
#include "precompiled.h"
#define P228_MAX_SPEED 250
#define P228_DAMAGE 32
#define P228_RANGE_MODIFER 0.8
#define P228_RELOAD_TIME 2.7
enum p228_e
{
P228_IDLE,
P228_SHOOT1,
P228_SHOOT2,
P228_SHOOT3,
P228_SHOOT_EMPTY,
P228_RELOAD,
P228_DRAW
};
enum p228_shield_e
{
P228_SHIELD_IDLE,
P228_SHIELD_SHOOT1,
P228_SHIELD_SHOOT2,
P228_SHIELD_SHOOT_EMPTY,
P228_SHIELD_RELOAD,
P228_SHIELD_DRAW,
P228_SHIELD_IDLE_UP,
P228_SHIELD_UP,
P228_SHIELD_DOWN
};
/* <291149> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:63 */
LINK_ENTITY_TO_CLASS(weapon_p228, CP228);
/* <290eb8> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:65 */
void CP228::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_P228;
SET_MODEL(ENT(pev), "models/w_p228.mdl");
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_iDefaultAmmo = P228_DEFAULT_GIVE;
m_flAccuracy = 0.9;
Precache();
m_iId = WEAPON_P228;
SET_MODEL(ENT(pev), "models/w_p228.mdl");
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_iDefaultAmmo = P228_DEFAULT_GIVE;
m_flAccuracy = 0.9;
FallInit();
}
/* <290e37> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:80 */
void CP228::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_p228.mdl");
PRECACHE_MODEL("models/w_p228.mdl");
PRECACHE_MODEL("models/shield/v_shield_p228.mdl");
PRECACHE_SOUND("weapons/p228-1.wav");
PRECACHE_SOUND("weapons/p228_clipout.wav");
PRECACHE_SOUND("weapons/p228_clipin.wav");
PRECACHE_SOUND("weapons/p228_sliderelease.wav");
PRECACHE_SOUND("weapons/p228_slidepull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_p228.mdl");
PRECACHE_MODEL("models/w_p228.mdl");
PRECACHE_MODEL("models/shield/v_shield_p228.mdl");
PRECACHE_SOUND("weapons/p228-1.wav");
PRECACHE_SOUND("weapons/p228_clipout.wav");
PRECACHE_SOUND("weapons/p228_clipin.wav");
PRECACHE_SOUND("weapons/p228_sliderelease.wav");
PRECACHE_SOUND("weapons/p228_slidepull.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireP228 = PRECACHE_EVENT(1, "events/p228.sc");
}
/* <290e5e> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:98 */
int CP228::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "357SIG";
p->iMaxAmmo1 = MAX_AMMO_357SIG;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = P228_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 3;
p->iId = m_iId = WEAPON_P228;
p->iFlags = 0;
p->iWeight = P228_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "357SIG";
p->iMaxAmmo1 = MAX_AMMO_357SIG;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = P228_MAX_CLIP;
p->iSlot = 1;
p->iPosition = 3;
p->iId = m_iId = WEAPON_P228;
p->iFlags = 0;
p->iWeight = P228_WEIGHT;
return 1;
}
/* <290fc6> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:115 */
BOOL CP228::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.9;
m_fMaxSpeed = P228_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_p228.mdl", "models/shield/p_shield_p228.mdl", P228_SHIELD_DRAW, "shieldgun", UseDecrement() != FALSE);
else
m_flAccuracy = 0.9;
m_fMaxSpeed = P228_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_p228.mdl", "models/shield/p_shield_p228.mdl", P228_SHIELD_DRAW, "shieldgun", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_p228.mdl", "models/p_p228.mdl", P228_DRAW, "onehanded", UseDecrement() != FALSE);
}
/* <2910ff> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:130 */
void CP228::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
P228Fire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
P228Fire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
P228Fire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
P228Fire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
P228Fire(1.5 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
P228Fire(0.255 * (1 - m_flAccuracy), 0.2, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
P228Fire(0.075 * (1 - m_flAccuracy), 0.2, FALSE);
}
else
{
P228Fire(0.15 * (1 - m_flAccuracy), 0.2, FALSE);
}
}
@ -127,46 +96,46 @@ void CP228::__MAKE_VHOOK(SecondaryAttack)(void)
/* <291213> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:147 */
void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.05;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.325 - (gpGlobals->time - m_flLastFire)) * 0.3;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
flCycleTime -= 0.05;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.325 - (gpGlobals->time - m_flLastFire)) * 0.3;
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--;
@ -176,117 +145,117 @@ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi)
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_357SIG, P228_DAMAGE, P228_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP228, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP228, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.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_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;
m_pPlayer->pev->punchangle.x -= 2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
}
/* <290f69> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:241 */
void CP228::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_357sig <= 0)
{
return;
}
if (DefaultReload(P228_MAX_CLIP, m_pPlayer->HasShield() ? P228_SHIELD_RELOAD : P228_RELOAD, P228_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;
if (m_pPlayer->ammo_357sig <= 0)
{
return;
}
if (DefaultReload(P228_MAX_CLIP, m_pPlayer->HasShield() ? P228_SHIELD_RELOAD : P228_RELOAD, P228_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;
}
}
/* <290f2e> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:261 */
void CP228::__MAKE_VHOOK(WeaponIdle)(void)
{
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(P228_SHIELD_IDLE_UP, UseDecrement() != FALSE);
}
}
else if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625;
SendWeaponAnim(P228_IDLE, UseDecrement() != FALSE);
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(P228_SHIELD_IDLE_UP, UseDecrement() != FALSE);
}
}
else if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0625;
SendWeaponAnim(P228_IDLE, UseDecrement() != FALSE);
}
}
#ifdef HOOK_GAMEDLL
void CP228::Spawn(void)
{
Spawn_();
}
void CP228::Precache(void)
{
Precache_();
}
int CP228::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CP228::Deploy(void)
{
return Deploy_();
}
void CP228::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CP228::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CP228::Reload(void)
{
Reload_();
}
void CP228::WeaponIdle(void)
{
WeaponIdle_();
void CP228::Spawn(void)
{
Spawn_();
}
void CP228::Precache(void)
{
Precache_();
}
int CP228::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CP228::Deploy(void)
{
return Deploy_();
}
void CP228::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CP228::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CP228::Reload(void)
{
Reload_();
}
void CP228::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,100 +1,83 @@
#include "precompiled.h"
#define P90_MAX_SPEED 245
#define P90_DAMAGE 21
#define P90_RANGE_MODIFER 0.885
#define P90_RELOAD_TIME 3.4
enum p90_e
{
P90_IDLE1,
P90_RELOAD,
P90_DRAW,
P90_SHOOT1,
P90_SHOOT2,
P90_SHOOT3
};
/* <29657d> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:49 */
LINK_ENTITY_TO_CLASS(weapon_p90, CP90);
/* <296337> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:51 */
void CP90::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_P90;
SET_MODEL(edict(), "models/w_p90.mdl");
m_iDefaultAmmo = P90_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
Precache();
m_iId = WEAPON_P90;
SET_MODEL(edict(), "models/w_p90.mdl");
m_iDefaultAmmo = P90_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
FallInit();
}
/* <2962b6> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:66 */
void CP90::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_p90.mdl");
PRECACHE_MODEL("models/w_p90.mdl");
PRECACHE_SOUND("weapons/p90-1.wav");
PRECACHE_SOUND("weapons/p90_clipout.wav");
PRECACHE_SOUND("weapons/p90_clipin.wav");
PRECACHE_SOUND("weapons/p90_boltpull.wav");
PRECACHE_SOUND("weapons/p90_cliprelease.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_p90.mdl");
PRECACHE_MODEL("models/w_p90.mdl");
PRECACHE_SOUND("weapons/p90-1.wav");
PRECACHE_SOUND("weapons/p90_clipout.wav");
PRECACHE_SOUND("weapons/p90_clipin.wav");
PRECACHE_SOUND("weapons/p90_boltpull.wav");
PRECACHE_SOUND("weapons/p90_cliprelease.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireP90 = PRECACHE_EVENT(1, "events/p90.sc");
}
/* <2962dd> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:83 */
int CP90::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "57mm";
p->iMaxAmmo1 = MAX_AMMO_57MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = P90_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 8;
p->iId = m_iId = WEAPON_P90;
p->iFlags = 0;
p->iWeight = P90_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "57mm";
p->iMaxAmmo1 = MAX_AMMO_57MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = P90_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 8;
p->iId = m_iId = WEAPON_P90;
p->iFlags = 0;
p->iWeight = P90_WEIGHT;
return 1;
}
/* <296310> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:100 */
BOOL CP90::__MAKE_VHOOK(Deploy)(void)
{
m_iShotsFired = 0;
m_bDelayFire = false;
m_flAccuracy = 0.2;
iShellOn = 1;
{
m_iShotsFired = 0;
m_bDelayFire = false;
m_flAccuracy = 0.2;
iShellOn = 1;
return DefaultDeploy("models/v_p90.mdl", "models/p_p90.mdl", P90_DRAW, "carbine", UseDecrement() != FALSE);
}
/* <296533> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:110 */
void CP90::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
P90Fire(0.3 * m_flAccuracy, 0.066, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 170)
{
P90Fire(0.115 * m_flAccuracy, 0.066, FALSE);
}
else
{
P90Fire(0.045 * m_flAccuracy, 0.066, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
P90Fire(0.3 * m_flAccuracy, 0.066, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 170)
{
P90Fire(0.115 * m_flAccuracy, 0.066, FALSE);
}
else
{
P90Fire(0.045 * m_flAccuracy, 0.066, FALSE);
}
}
@ -104,110 +87,110 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = (m_iShotsFired * m_iShotsFired / 175) + 0.45;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = (m_iShotsFired * m_iShotsFired / 175) + 0.45;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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 = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_57MM, P90_DAMAGE, P90_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
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 = DIM_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_57MM, P90_DAMAGE, P90_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP90, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
KickBack(0.9, 0.45, 0.35, 0.04, 5.25, 3.5, 4);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
KickBack(0.45, 0.3, 0.2, 0.0275, 4.0, 2.25, 7);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
KickBack(0.275, 0.2, 0.125, 0.02, 3.0, 1.0, 9);
}
else
{
KickBack(0.3, 0.225, 0.125, 0.02, 3.25, 1.25, 8);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
KickBack(0.9, 0.45, 0.35, 0.04, 5.25, 3.5, 4);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
KickBack(0.45, 0.3, 0.2, 0.0275, 4.0, 2.25, 7);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
KickBack(0.275, 0.2, 0.125, 0.02, 3.0, 1.0, 9);
}
else
{
KickBack(0.3, 0.225, 0.125, 0.02, 3.25, 1.25, 8);
}
}
/* <2963e8> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:202 */
void CP90::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_57mm <= 0)
{
return;
}
if (DefaultReload(P90_MAX_CLIP, P90_RELOAD, P90_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
if (m_pPlayer->ammo_57mm <= 0)
{
return;
}
if (DefaultReload(P90_MAX_CLIP, P90_RELOAD, P90_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
}
}
/* <2963ad> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:216 */
void CP90::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
SendWeaponAnim(P90_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,98 +1,81 @@
#include "precompiled.h"
#define SCOUT_MAX_SPEED 260
#define SCOUT_MAX_SPEED_ZOOM 220
#define SCOUT_DAMAGE 75
#define SCOUT_RANGE_MODIFER 0.98
#define SCOUT_RELOAD_TIME 2
enum scout_e
{
SCOUT_IDLE,
SCOUT_SHOOT,
SCOUT_SHOOT2,
SCOUT_RELOAD,
SCOUT_DRAW
};
/* <29ba7b> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:48 */
LINK_ENTITY_TO_CLASS(weapon_scout, CSCOUT);
/* <29b7ee> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:50 */
void CSCOUT::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_SCOUT;
SET_MODEL(edict(), "models/w_scout.mdl");
m_iDefaultAmmo = SCOUT_DEFAULT_GIVE;
Precache();
m_iId = WEAPON_SCOUT;
SET_MODEL(edict(), "models/w_scout.mdl");
m_iDefaultAmmo = SCOUT_DEFAULT_GIVE;
FallInit();
}
/* <29b70a> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:62 */
void CSCOUT::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_scout.mdl");
PRECACHE_MODEL("models/w_scout.mdl");
PRECACHE_SOUND("weapons/scout_fire-1.wav");
PRECACHE_SOUND("weapons/scout_bolt.wav");
PRECACHE_SOUND("weapons/scout_clipin.wav");
PRECACHE_SOUND("weapons/scout_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell_big.mdl");
PRECACHE_MODEL("models/v_scout.mdl");
PRECACHE_MODEL("models/w_scout.mdl");
PRECACHE_SOUND("weapons/scout_fire-1.wav");
PRECACHE_SOUND("weapons/scout_bolt.wav");
PRECACHE_SOUND("weapons/scout_clipin.wav");
PRECACHE_SOUND("weapons/scout_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell_big.mdl");
m_usFireScout = PRECACHE_EVENT(1, "events/scout.sc");
}
/* <29b731> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:79 */
int CSCOUT::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SCOUT_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 9;
p->iId = m_iId = WEAPON_SCOUT;
p->iFlags = 0;
p->iWeight = SCOUT_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "762Nato";
p->iMaxAmmo1 = MAX_AMMO_762NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SCOUT_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 9;
p->iId = m_iId = WEAPON_SCOUT;
p->iFlags = 0;
p->iWeight = SCOUT_WEIGHT;
return 1;
}
/* <29b8f7> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:96 */
BOOL CSCOUT::__MAKE_VHOOK(Deploy)(void)
{
if (DefaultDeploy("models/v_scout.mdl", "models/p_scout.mdl", SCOUT_DRAW, "rifle", UseDecrement() != FALSE))
{
m_flNextPrimaryAttack = m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.25);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
return TRUE;
}
if (DefaultDeploy("models/v_scout.mdl", "models/p_scout.mdl", SCOUT_DRAW, "rifle", UseDecrement() != FALSE))
{
m_flNextPrimaryAttack = m_pPlayer->m_flNextAttack = GetNextAttackDelay(1.25);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
return TRUE;
}
return FALSE;
}
/* <29b78a> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:109 */
void CSCOUT::__MAKE_VHOOK(SecondaryAttack)(void)
{
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
}
if (TheBots != NULL)
@ -108,93 +91,93 @@ void CSCOUT::__MAKE_VHOOK(SecondaryAttack)(void)
/* <29ba31> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:140 */
void CSCOUT::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SCOUTFire(0.2, 1.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 170)
{
SCOUTFire(0.075, 1.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
SCOUTFire(0, 1.25, FALSE);
}
else
{
SCOUTFire(0.007, 1.25, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SCOUTFire(0.2, 1.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 170)
{
SCOUTFire(0.075, 1.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
SCOUTFire(0, 1.25, FALSE);
}
else
{
SCOUTFire(0.007, 1.25, FALSE);
}
}
/* <29bb45> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:154 */
void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_bResumeZoom = true;
m_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;
// reset a fov
m_pPlayer->m_iFOV = DEFAULT_FOV;
#ifdef REGAMEDLL_FIXES
m_pPlayer->pev->fov = DEFAULT_FOV;
#endif // REGAMEDLL_FIXES
}
else
{
flSpread += 0.025;
}
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_bResumeZoom = true;
m_pPlayer->m_iLastZoom = m_pPlayer->m_iFOV;
// reset a fov
m_pPlayer->m_iFOV = DEFAULT_FOV;
#ifdef REGAMEDLL_FIXES
m_pPlayer->pev->fov = DEFAULT_FOV;
#endif // REGAMEDLL_FIXES
}
else
{
flSpread += 0.025;
}
m_iClip--;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_flEjectBrass = gpGlobals->time + 0.56;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_762MM, SCOUT_DAMAGE, SCOUT_RANGE_MODIFER, 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_usFireScout, 0, (float *)&g_vecZero, (float *)&m_pPlayer->pev->angles, (vecDir.x * 1000), (vecDir.y * 1000),
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
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->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_flEjectBrass = gpGlobals->time + 0.56;
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 3, BULLET_PLAYER_762MM, SCOUT_DAMAGE, SCOUT_RANGE_MODIFER, 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_usFireScout, 0, (float *)&g_vecZero, (float *)&m_pPlayer->pev->angles, (vecDir.x * 1000), (vecDir.y * 1000),
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
m_pPlayer->pev->punchangle.x -= 2;
}
@ -203,39 +186,39 @@ void CSCOUT::__MAKE_VHOOK(Reload)(void)
{
#ifdef REGAMEDLL_FIXES
// to prevent reload if not enough ammo
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(SCOUT_MAX_CLIP, SCOUT_RELOAD, SCOUT_RELOAD_TIME))
{
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15;
SecondaryAttack();
}
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->ammo_762nato <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(SCOUT_MAX_CLIP, SCOUT_RELOAD, SCOUT_RELOAD_TIME))
{
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15;
SecondaryAttack();
}
m_pPlayer->SetAnimation(PLAYER_RELOAD);
}
}
/* <29b864> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:250 */
void CSCOUT::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(SCOUT_IDLE, UseDecrement() != FALSE);
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60;
SendWeaponAnim(SCOUT_IDLE, UseDecrement() != FALSE);
}
}

View File

@ -1,69 +1,52 @@
#include "precompiled.h"
#define SG550_MAX_SPEED 210
#define SG550_MAX_SPEED_ZOOM 150
#define SG550_DAMAGE 70
#define SG550_RANGE_MODIFER 0.98
#define SG550_RELOAD_TIME 3.35
enum sg550_e
{
SG550_IDLE,
SG550_SHOOT,
SG550_SHOOT2,
SG550_RELOAD,
SG550_DRAW
};
/* <2a0f39> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:48 */
LINK_ENTITY_TO_CLASS(weapon_sg550, CSG550);
/* <2a0ce8> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:50 */
void CSG550::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_SG550;
SET_MODEL(edict(), "models/w_sg550.mdl");
m_iDefaultAmmo = SG550_DEFAULT_GIVE;
m_flLastFire = 0;
Precache();
m_iId = WEAPON_SG550;
SET_MODEL(edict(), "models/w_sg550.mdl");
m_iDefaultAmmo = SG550_DEFAULT_GIVE;
m_flLastFire = 0;
FallInit();
}
/* <2a0bdd> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:63 */
void CSG550::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_sg550.mdl");
PRECACHE_MODEL("models/w_sg550.mdl");
PRECACHE_SOUND("weapons/sg550-1.wav");
PRECACHE_SOUND("weapons/sg550_boltpull.wav");
PRECACHE_SOUND("weapons/sg550_clipin.wav");
PRECACHE_SOUND("weapons/sg550_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_sg550.mdl");
PRECACHE_MODEL("models/w_sg550.mdl");
PRECACHE_SOUND("weapons/sg550-1.wav");
PRECACHE_SOUND("weapons/sg550_boltpull.wav");
PRECACHE_SOUND("weapons/sg550_clipin.wav");
PRECACHE_SOUND("weapons/sg550_clipout.wav");
PRECACHE_SOUND("weapons/zoom.wav");
m_iShellId = m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireSG550 = PRECACHE_EVENT(1, "events/sg550.sc");
}
/* <2a0c04> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:79 */
int CSG550::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SG550_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 16;
p->iId = m_iId = WEAPON_SG550;
p->iFlags = 0;
p->iWeight = SG550_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SG550_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 16;
p->iId = m_iId = WEAPON_SG550;
p->iFlags = 0;
p->iWeight = SG550_WEIGHT;
return 1;
}
@ -76,16 +59,16 @@ BOOL CSG550::__MAKE_VHOOK(Deploy)(void)
/* <2a0c5d> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:101 */
void CSG550::__MAKE_VHOOK(SecondaryAttack)(void)
{
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
switch (m_pPlayer->m_iFOV)
{
case 90: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40; break;
case 40: m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15; break;
#ifdef REGAMEDLL_FIXES
default:
#else
case 15:
#endif // REGAMEDLL_FIXES
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break;
}
m_pPlayer->ResetMaxSpeed();
@ -102,96 +85,96 @@ void CSG550::__MAKE_VHOOK(SecondaryAttack)(void)
/* <2a0eef> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:132 */
void CSG550::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SG550Fire(0.45 * (1 - m_flAccuracy), 0.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
SG550Fire(0.15, 0.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
SG550Fire(0.04 * (1 - m_flAccuracy), 0.25, FALSE);
}
else
{
SG550Fire(0.05 * (1 - m_flAccuracy), 0.25, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SG550Fire(0.45 * (1 - m_flAccuracy), 0.25, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
SG550Fire(0.15, 0.25, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
SG550Fire(0.04 * (1 - m_flAccuracy), 0.25, FALSE);
}
else
{
SG550Fire(0.05 * (1 - m_flAccuracy), 0.25, FALSE);
}
}
/* <2a1003> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:144 */
void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
Vector vecAiming, vecSrc, vecDir;
int flag;
if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
flSpread += 0.025;
}
if (m_flLastFire)
{
m_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.35 + 0.65;
if (m_flAccuracy > 0.98)
{
m_flAccuracy = 0.98;
}
}
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;
if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
flSpread += 0.025;
}
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 = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
if (m_flLastFire)
{
m_flAccuracy = (gpGlobals->time - m_flLastFire) * 0.35 + 0.65;
if (m_flAccuracy > 0.98)
{
m_flAccuracy = 0.98;
}
}
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 = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, SG550_DAMAGE, SG550_RANGE_MODIFER, 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_usFireSG550, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, SG550_DAMAGE, SG550_RANGE_MODIFER, 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_usFireSG550, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8;
m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.25) + m_pPlayer->pev->punchangle.x * 0.25;
m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75);
}
@ -199,39 +182,39 @@ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <2a0d98> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:227 */
void CSG550::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
if (DefaultReload(SG550_MAX_CLIP, SG550_RELOAD, SG550_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;
SecondaryAttack();
}
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
if (DefaultReload(SG550_MAX_CLIP, SG550_RELOAD, SG550_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{
m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 15;
SecondaryAttack();
}
}
}
/* <2a0d5e> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:248 */
void CSG550::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0;
SendWeaponAnim(SG550_IDLE, UseDecrement() != FALSE);
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
if (m_iClip)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0;
SendWeaponAnim(SG550_IDLE, UseDecrement() != FALSE);
}
}

View File

@ -1,192 +1,174 @@
#include "precompiled.h"
#define SG552_MAX_SPEED 235
#define SG552_MAX_SPEED_ZOOM 200
#define SG552_DAMAGE 33
#define SG552_RANGE_MODIFER 0.955
#define SG552_RELOAD_TIME 3
enum sg552_e
{
SG552_IDLE1,
SG552_RELOAD,
SG552_DRAW,
SG552_SHOOT1,
SG552_SHOOT2,
SG552_SHOOT3
};
/* <2a61d9> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_sg552, CSG552);
/* <2a60cb> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:52 */
void CSG552::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_SG552;
SET_MODEL(edict(), "models/w_sg552.mdl");
m_iDefaultAmmo = SG552_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
Precache();
m_iId = WEAPON_SG552;
SET_MODEL(edict(), "models/w_sg552.mdl");
m_iDefaultAmmo = SG552_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
FallInit();
}
/* <2a5ffe> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:66 */
void CSG552::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_sg552.mdl");
PRECACHE_MODEL("models/w_sg552.mdl");
PRECACHE_SOUND("weapons/sg552-1.wav");
PRECACHE_SOUND("weapons/sg552-2.wav");
PRECACHE_SOUND("weapons/sg552_clipout.wav");
PRECACHE_SOUND("weapons/sg552_clipin.wav");
PRECACHE_SOUND("weapons/sg552_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
PRECACHE_MODEL("models/v_sg552.mdl");
PRECACHE_MODEL("models/w_sg552.mdl");
PRECACHE_SOUND("weapons/sg552-1.wav");
PRECACHE_SOUND("weapons/sg552-2.wav");
PRECACHE_SOUND("weapons/sg552_clipout.wav");
PRECACHE_SOUND("weapons/sg552_clipin.wav");
PRECACHE_SOUND("weapons/sg552_boltpull.wav");
m_iShell = PRECACHE_MODEL("models/rshell.mdl");
m_usFireSG552 = PRECACHE_EVENT(1, "events/sg552.sc");
}
/* <2a6025> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:83 */
int CSG552::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SG552_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 10;
p->iId = m_iId = WEAPON_SG552;
p->iFlags = 0;
p->iWeight = SG552_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "556Nato";
p->iMaxAmmo1 = MAX_AMMO_556NATO;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = SG552_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 10;
p->iId = m_iId = WEAPON_SG552;
p->iFlags = 0;
p->iWeight = SG552_WEIGHT;
return 1;
}
/* <2a60a4> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:100 */
BOOL CSG552::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
iShellOn = 1;
return DefaultDeploy("models/v_sg552.mdl", "models/p_sg552.mdl", SG552_DRAW, "mp5", UseDecrement() != FALSE);
}
/* <2a6058> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:109 */
void CSG552::__MAKE_VHOOK(SecondaryAttack)(void)
{
if (m_pPlayer->m_iFOV == DEFAULT_FOV)
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55;
else
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90;
if (m_pPlayer->m_iFOV == DEFAULT_FOV)
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55;
else
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;
}
/* <2a63eb> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:130 */
void CSG552::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SG552Fire(0.035 + (0.45 * m_flAccuracy), 0.0825, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
SG552Fire(0.035 + (0.075 * m_flAccuracy), 0.0825, FALSE);
}
else if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
SG552Fire(0.02 * m_flAccuracy, 0.0825, FALSE);
}
else
{
SG552Fire(0.02 * m_flAccuracy, 0.135, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
SG552Fire(0.035 + (0.45 * m_flAccuracy), 0.0825, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 140)
{
SG552Fire(0.035 + (0.075 * m_flAccuracy), 0.0825, FALSE);
}
else if (m_pPlayer->pev->fov == DEFAULT_FOV)
{
SG552Fire(0.02 * m_flAccuracy, 0.0825, FALSE);
}
else
{
SG552Fire(0.02 * m_flAccuracy, 0.135, FALSE);
}
}
/* <2a62a3> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:143 */
void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 220) + 0.3;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
SG552_DAMAGE, SG552_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG552, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
if (m_pPlayer->pev->velocity.Length2D() > 0)
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM,
SG552_DAMAGE, SG552_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG552, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
KickBack(1.0, 0.45, 0.28, 0.04, 4.25, 2.5, 7);
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
else if (!(m_pPlayer->pev->flags & FL_ONGROUND))
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
if (m_pPlayer->pev->velocity.Length2D() > 0)
{
KickBack(1.25, 0.45, 0.22, 0.18, 6.0, 4.0, 5);
KickBack(1.0, 0.45, 0.28, 0.04, 4.25, 2.5, 7);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
else if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
KickBack(0.6, 0.35, 0.2, 0.0125, 3.7, 2.0, 10);
KickBack(1.25, 0.45, 0.22, 0.18, 6.0, 4.0, 5);
}
else
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
KickBack(0.6, 0.35, 0.2, 0.0125, 3.7, 2.0, 10);
}
else
{
KickBack(0.625, 0.375, 0.25, 0.0125, 4.0, 2.25, 9);
}
@ -195,37 +177,37 @@ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <2a617c> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:225 */
void CSG552::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
if (DefaultReload(SG552_MAX_CLIP, SG552_RELOAD, SG552_RELOAD_TIME))
{
if (m_pPlayer->m_iFOV != DEFAULT_FOV)
{
SecondaryAttack();
}
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
if (m_pPlayer->ammo_556nato <= 0)
{
return;
}
if (DefaultReload(SG552_MAX_CLIP, SG552_RELOAD, SG552_RELOAD_TIME))
{
if (m_pPlayer->m_iFOV != DEFAULT_FOV)
{
SecondaryAttack();
}
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
}
}
/* <2a6141> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:244 */
void CSG552::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(SG552_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,15 +1,4 @@
#include "precompiled.h"
#define SMOKEGRENADE_MAX_SPEED 250
#define SMOKEGRENADE_MAX_SPEED_SHIELD 180
enum smokegrenade_e
{
SMOKEGRENADE_IDLE,
SMOKEGRENADE_PINPULL,
SMOKEGRENADE_THROW,
SMOKEGRENADE_DRAW
};
/* <2ab333> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:38 */
LINK_ENTITY_TO_CLASS(weapon_smokegrenade, CSmokeGrenade);
@ -23,41 +12,41 @@ void CSmokeGrenade::__MAKE_VHOOK(Spawn)(void)
SET_MODEL(edict(), "models/w_smokegrenade.mdl");
pev->dmg = 4;
m_iDefaultAmmo = SMOKEGRENADE_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
m_iDefaultAmmo = SMOKEGRENADE_DEFAULT_GIVE;
m_flStartThrow = 0;
m_flReleaseThrow = -1;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
// get ready to fall down.
FallInit();
}
/* <2aaf12> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:59 */
void CSmokeGrenade::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_smokegrenade.mdl");
PRECACHE_MODEL("models/shield/v_shield_smokegrenade.mdl");
PRECACHE_SOUND("weapons/pinpull.wav");
PRECACHE_SOUND("weapons/sg_explode.wav");
PRECACHE_MODEL("models/v_smokegrenade.mdl");
PRECACHE_MODEL("models/shield/v_shield_smokegrenade.mdl");
PRECACHE_SOUND("weapons/pinpull.wav");
PRECACHE_SOUND("weapons/sg_explode.wav");
m_usCreateSmoke = PRECACHE_EVENT(1, "events/createsmoke.sc");
}
/* <2aaf39> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:71 */
int CSmokeGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "SmokeGrenade";
p->iMaxAmmo1 = MAX_AMMO_SMOKEGRENADE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 3;
p->iId = m_iId = WEAPON_SMOKEGRENADE;
p->iWeight = SMOKEGRENADE_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "SmokeGrenade";
p->iMaxAmmo1 = MAX_AMMO_SMOKEGRENADE;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 3;
p->iPosition = 3;
p->iId = m_iId = WEAPON_SMOKEGRENADE;
p->iWeight = SMOKEGRENADE_WEIGHT;
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
return 1;
@ -65,50 +54,50 @@ int CSmokeGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
/* <2ab077> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:89 */
BOOL CSmokeGrenade::__MAKE_VHOOK(Deploy)(void)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_flReleaseThrow = -1;
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_smokegrenade.mdl", "models/shield/p_shield_smokegrenade.mdl", SMOKEGRENADE_DRAW, "shieldgren", UseDecrement() != FALSE);
else
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_flReleaseThrow = -1;
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
return DefaultDeploy("models/shield/v_shield_smokegrenade.mdl", "models/shield/p_shield_smokegrenade.mdl", SMOKEGRENADE_DRAW, "shieldgren", UseDecrement() != FALSE);
else
return DefaultDeploy("models/v_smokegrenade.mdl", "models/p_smokegrenade.mdl", SMOKEGRENADE_DRAW, "grenade", UseDecrement() != FALSE);
}
/* <2aaf92> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:104 */
void CSmokeGrenade::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// no more smokegrenades!
// clear the smokegrenade of bits for HUD
m_pPlayer->pev->weapons &= ~(1 << WEAPON_SMOKEGRENADE);
DestroyItem();
}
m_flStartThrow = 0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// no more smokegrenades!
// clear the smokegrenade of bits for HUD
m_pPlayer->pev->weapons &= ~(1 << WEAPON_SMOKEGRENADE);
DestroyItem();
}
m_flStartThrow = 0;
m_flReleaseThrow = -1;
}
/* <2ab03d> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:120 */
void CSmokeGrenade::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
return;
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(SMOKEGRENADE_PINPULL, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
return;
if (!m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
m_flReleaseThrow = 0;
m_flStartThrow = gpGlobals->time;
SendWeaponAnim(SMOKEGRENADE_PINPULL, UseDecrement() != FALSE);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
}
}
@ -120,34 +109,34 @@ bool CSmokeGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
return false;
}
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = SMOKEGRENADE_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
m_pPlayer->ResetMaxSpeed();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
return true;
}
@ -162,22 +151,22 @@ void CSmokeGrenade::SetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
else
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
/* <2ab451> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:189 */
void CSmokeGrenade::ResetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");
}
}
@ -190,15 +179,15 @@ void CSmokeGrenade::__MAKE_VHOOK(WeaponIdle)(void)
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_flStartThrow)
if (m_flStartThrow)
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float_precision flVel = (90.0 - angThrow.x) * 6.0;
@ -227,8 +216,8 @@ void CSmokeGrenade::__MAKE_VHOOK(WeaponIdle)(void)
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
@ -241,49 +230,49 @@ void CSmokeGrenade::__MAKE_VHOOK(WeaponIdle)(void)
// we've finished the throw, restart.
m_flStartThrow = 0;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim(SMOKEGRENADE_DRAW, UseDecrement() != FALSE);
}
else
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim(SMOKEGRENADE_DRAW, UseDecrement() != FALSE);
}
else
{
RetireWeapon();
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
m_flReleaseThrow = -1;
}
else if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
int iAnim;
int iAnim;
float flRand = RANDOM_FLOAT(0, 1);
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
if (flRand <= 0.75)
{
iAnim = SMOKEGRENADE_IDLE;
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
else
{
iAnim = SMOKEGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
SendWeaponAnim(SHIELDREN_IDLE, UseDecrement() != FALSE);
}
}
else
{
if (flRand <= 0.75)
{
iAnim = SMOKEGRENADE_IDLE;
// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
else
{
iAnim = SMOKEGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim(iAnim, UseDecrement() != FALSE);
}
}
}
@ -296,49 +285,49 @@ BOOL CSmokeGrenade::__MAKE_VHOOK(CanDeploy)(void)
#ifdef HOOK_GAMEDLL
void CSmokeGrenade::Spawn(void)
{
Spawn_();
}
void CSmokeGrenade::Precache(void)
{
Precache_();
}
int CSmokeGrenade::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CSmokeGrenade::CanDeploy(void)
{
return CanDeploy_();
}
BOOL CSmokeGrenade::Deploy(void)
{
return Deploy_();
}
void CSmokeGrenade::Holster(int skiplocal)
{
Holster_(skiplocal);
}
void CSmokeGrenade::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CSmokeGrenade::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CSmokeGrenade::WeaponIdle(void)
{
WeaponIdle_();
}
void CSmokeGrenade::Spawn(void)
{
Spawn_();
}
void CSmokeGrenade::Precache(void)
{
Precache_();
}
int CSmokeGrenade::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CSmokeGrenade::CanDeploy(void)
{
return CanDeploy_();
}
BOOL CSmokeGrenade::Deploy(void)
{
return Deploy_();
}
void CSmokeGrenade::Holster(int skiplocal)
{
Holster_(skiplocal);
}
void CSmokeGrenade::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CSmokeGrenade::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CSmokeGrenade::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,206 +1,189 @@
#include "precompiled.h"
#define TMP_MAX_SPEED 250
#define TMP_DAMAGE 20
#define TMP_RANGE_MODIFER 0.85
#define TMP_RELOAD_TIME 2.12
enum tmp_e
{
TMP_IDLE1,
TMP_RELOAD,
TMP_DRAW,
TMP_SHOOT1,
TMP_SHOOT2,
TMP_SHOOT3
};
/* <2b06f0> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_tmp, CTMP);
/* <2b04ba> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:52 */
void CTMP::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_TMP;
SET_MODEL(edict(), "models/w_tmp.mdl");
m_iDefaultAmmo = TMP_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
Precache();
m_iId = WEAPON_TMP;
SET_MODEL(edict(), "models/w_tmp.mdl");
m_iDefaultAmmo = TMP_DEFAULT_GIVE;
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
FallInit();
}
/* <2b0439> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:67 */
void CTMP::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_tmp.mdl");
PRECACHE_MODEL("models/w_tmp.mdl");
PRECACHE_SOUND("weapons/tmp-1.wav");
PRECACHE_SOUND("weapons/tmp-2.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_tmp.mdl");
PRECACHE_MODEL("models/w_tmp.mdl");
PRECACHE_SOUND("weapons/tmp-1.wav");
PRECACHE_SOUND("weapons/tmp-2.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireTMP = PRECACHE_EVENT(1, "events/tmp.sc");
}
/* <2b0460> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:81 */
int CTMP::__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 = TMP_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 11;
p->iId = m_iId = WEAPON_TMP;
p->iFlags = 0;
p->iWeight = TMP_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "9mm";
p->iMaxAmmo1 = MAX_AMMO_9MM;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = TMP_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 11;
p->iId = m_iId = WEAPON_TMP;
p->iFlags = 0;
p->iWeight = TMP_WEIGHT;
return 1;
}
/* <2b0493> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:98 */
BOOL CTMP::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
{
m_flAccuracy = 0.2;
m_iShotsFired = 0;
m_bDelayFire = false;
iShellOn = 1;
iShellOn = 1;
return DefaultDeploy("models/v_tmp.mdl", "models/p_tmp.mdl", TMP_DRAW, "onehanded", UseDecrement() != FALSE);
}
/* <2b06b6> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:108 */
void CTMP::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
TMPFire(0.25 * m_flAccuracy, 0.07, FALSE);
}
else
{
TMPFire(0.03 * m_flAccuracy, 0.07, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
TMPFire(0.25 * m_flAccuracy, 0.07, FALSE);
}
else
{
TMPFire(0.03 * m_flAccuracy, 0.07, FALSE);
}
}
/* <2b07ba> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:116 */
void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.55;
if (m_flAccuracy > 1.4)
m_flAccuracy = 1.4;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 200) + 0.55;
if (m_flAccuracy > 1.4)
m_flAccuracy = 1.4;
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->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,
TMP_DAMAGE, TMP_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireTMP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_9MM,
TMP_DAMAGE, TMP_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireTMP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(1.1, 0.5, 0.35, 0.045, 4.5, 3.5, 6);
}
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(0.8, 0.4, 0.2, 0.03, 3.0, 2.5, 7);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.7, 0.35, 0.125, 0.025, 2.5, 2.0, 10);
}
}
else
{
{
KickBack(0.725, 0.375, 0.15, 0.025, 2.75, 2.25, 9);
}
}
/* <2b056b> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:197 */
void CTMP::__MAKE_VHOOK(Reload)(void)
{
{
#ifdef REGAMEDLL_FIXES
// to prevent reload if not enough ammo
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(TMP_MAX_CLIP, TMP_RELOAD, TMP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
if (m_pPlayer->ammo_9mm <= 0)
{
return;
}
#endif // REGAMEDLL_FIXES
if (DefaultReload(TMP_MAX_CLIP, TMP_RELOAD, TMP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.2;
m_iShotsFired = 0;
}
}
/* <2b0530> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:211 */
void CTMP::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(TMP_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,176 +1,159 @@
#include "precompiled.h"
#define UMP45_MAX_SPEED 250
#define UMP45_DAMAGE 30
#define UMP45_RANGE_MODIFER 0.82
#define UMP45_RELOAD_TIME 3.5
enum ump45_e
{
UMP45_IDLE1,
UMP45_RELOAD,
UMP45_DRAW,
UMP45_SHOOT1,
UMP45_SHOOT2,
UMP45_SHOOT3
};
/* <2b5b26> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:50 */
LINK_ENTITY_TO_CLASS(weapon_ump45, CUMP45);
/* <2b58f0> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:52 */
void CUMP45::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_UMP45;
SET_MODEL(edict(), "models/w_ump45.mdl");
m_iDefaultAmmo = UMP45_DEFAULT_GIVE;
m_flAccuracy = 0;
m_bDelayFire = false;
Precache();
m_iId = WEAPON_UMP45;
SET_MODEL(edict(), "models/w_ump45.mdl");
m_iDefaultAmmo = UMP45_DEFAULT_GIVE;
m_flAccuracy = 0;
m_bDelayFire = false;
FallInit();
}
/* <2b586f> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:66 */
void CUMP45::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_ump45.mdl");
PRECACHE_MODEL("models/w_ump45.mdl");
PRECACHE_SOUND("weapons/ump45-1.wav");
PRECACHE_SOUND("weapons/ump45_clipout.wav");
PRECACHE_SOUND("weapons/ump45_clipin.wav");
PRECACHE_SOUND("weapons/ump45_boltslap.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
PRECACHE_MODEL("models/v_ump45.mdl");
PRECACHE_MODEL("models/w_ump45.mdl");
PRECACHE_SOUND("weapons/ump45-1.wav");
PRECACHE_SOUND("weapons/ump45_clipout.wav");
PRECACHE_SOUND("weapons/ump45_clipin.wav");
PRECACHE_SOUND("weapons/ump45_boltslap.wav");
m_iShell = PRECACHE_MODEL("models/pshell.mdl");
m_usFireUMP45 = PRECACHE_EVENT(1, "events/ump45.sc");
}
/* <2b5896> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:82 */
int CUMP45::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszName = STRING(pev->classname);
#ifdef REGAMEDLL_FIXES
p->pszAmmo1 = "45acp";
#else
p->pszAmmo1 = "45ACP";
#endif // REGAMEDLL_FIXES
p->iMaxAmmo1 = MAX_AMMO_45ACP;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = UMP45_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 15;
p->iId = m_iId = WEAPON_UMP45;
p->iFlags = 0;
p->iWeight = UMP45_WEIGHT;
#endif // REGAMEDLL_FIXES
p->iMaxAmmo1 = MAX_AMMO_45ACP;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = UMP45_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 15;
p->iId = m_iId = WEAPON_UMP45;
p->iFlags = 0;
p->iWeight = UMP45_WEIGHT;
return 1;
}
/* <2b58c9> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:99 */
BOOL CUMP45::__MAKE_VHOOK(Deploy)(void)
{
m_flAccuracy = 0;
m_bDelayFire = false;
iShellOn = 1;
{
m_flAccuracy = 0;
m_bDelayFire = false;
iShellOn = 1;
return DefaultDeploy("models/v_ump45.mdl", "models/p_ump45.mdl", UMP45_DRAW, "carbine", UseDecrement() != FALSE);
}
/* <2b5aec> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:108 */
void CUMP45::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
UMP45Fire(0.24 * m_flAccuracy, 0.1, FALSE);
}
else
{
UMP45Fire(0.04 * m_flAccuracy, 0.1, FALSE);
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
UMP45Fire(0.24 * m_flAccuracy, 0.1, FALSE);
}
else
{
UMP45Fire(0.04 * m_flAccuracy, 0.1, FALSE);
}
}
/* <2b5bf0> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:116 */
void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 120) + 0.5;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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;
Vector vecAiming, vecSrc, vecDir;
int flag;
m_bDelayFire = true;
m_iShotsFired++;
m_flAccuracy = ((m_iShotsFired * m_iShotsFired) / 120) + 0.5;
if (m_flAccuracy > 1)
m_flAccuracy = 1;
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);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,
UMP45_DAMAGE, UMP45_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
m_iClip--;
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireUMP45, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 1, BULLET_PLAYER_45ACP,
UMP45_DAMAGE, UMP45_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireUMP45, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE);
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
{
KickBack(0.125, 0.65, 0.55, 0.0475, 5.5, 4.0, 10);
}
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
{
KickBack(0.55, 0.3, 0.225, 0.03, 3.5, 2.5, 10);
}
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
{
KickBack(0.25, 0.175, 0.125, 0.02, 2.25, 1.25, 10);
}
}
else
{
{
KickBack(0.275, 0.2, 0.15, 0.0225, 2.5, 1.5, 10);
}
}
@ -178,32 +161,32 @@ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <2b59a1> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:200 */
void CUMP45::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->ammo_45acp <= 0)
{
return;
}
if (DefaultReload(UMP45_MAX_CLIP, UMP45_RELOAD, UMP45_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
if (m_pPlayer->ammo_45acp <= 0)
{
return;
}
if (DefaultReload(UMP45_MAX_CLIP, UMP45_RELOAD, UMP45_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0;
m_iShotsFired = 0;
}
}
/* <2b5966> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:214 */
void CUMP45::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
{
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
SendWeaponAnim(UMP45_IDLE1, UseDecrement() != FALSE);
}

View File

@ -1,47 +1,5 @@
#include "precompiled.h"
#define USP_MAX_SPEED 250
#define USP_DAMAGE 34
#define USP_DAMAGE_SIL 30
#define USP_RANGE_MODIFER 0.79
#define USP_RELOAD_TIME 2.7
enum usp_e
{
USP_IDLE,
USP_SHOOT1,
USP_SHOOT2,
USP_SHOOT3,
USP_SHOOT_EMPTY,
USP_RELOAD,
USP_DRAW,
USP_ATTACH_SILENCER,
USP_UNSIL_IDLE,
USP_UNSIL_SHOOT1,
USP_UNSIL_SHOOT2,
USP_UNSIL_SHOOT3,
USP_UNSIL_SHOOT_EMPTY,
USP_UNSIL_RELOAD,
USP_UNSIL_DRAW,
USP_DETACH_SILENCER
};
enum usp_shield_e
{
USP_SHIELD_IDLE,
USP_SHIELD_SHOOT1,
USP_SHIELD_SHOOT2,
USP_SHIELD_SHOOT_EMPTY,
USP_SHIELD_RELOAD,
USP_SHIELD_DRAW,
USP_SHIELD_UP_IDLE,
USP_SHIELD_UP,
USP_SHIELD_DOWN
};
/* <2bb045> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:68 */
LINK_ENTITY_TO_CLASS(weapon_usp, CUSP);
@ -126,160 +84,160 @@ BOOL CUSP::__MAKE_VHOOK(Deploy)(void)
/* <2bae77> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:147 */
void CUSP::__MAKE_VHOOK(SecondaryAttack)(void)
{
if (ShieldSecondaryFire(USP_SHIELD_UP, USP_SHIELD_DOWN))
{
return;
}
if (m_iWeaponState & WPNSTATE_USP_SILENCED)
{
m_iWeaponState &= ~WPNSTATE_USP_SILENCED;
SendWeaponAnim(USP_DETACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded");
}
else
{
m_iWeaponState |= WPNSTATE_USP_SILENCED;
SendWeaponAnim(USP_ATTACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded");
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0;
if (ShieldSecondaryFire(USP_SHIELD_UP, USP_SHIELD_DOWN))
{
return;
}
if (m_iWeaponState & WPNSTATE_USP_SILENCED)
{
m_iWeaponState &= ~WPNSTATE_USP_SILENCED;
SendWeaponAnim(USP_DETACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded");
}
else
{
m_iWeaponState |= WPNSTATE_USP_SILENCED;
SendWeaponAnim(USP_ATTACH_SILENCER, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded");
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0;
m_flNextPrimaryAttack = GetNextAttackDelay(3.0);
}
/* <2bb000> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:173 */
void CUSP::__MAKE_VHOOK(PrimaryAttack)(void)
{
if (m_iWeaponState & WPNSTATE_USP_SILENCED)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
USPFire(1.3 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
USPFire(0.25 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
USPFire(0.125 * (1 - m_flAccuracy), 0.225, FALSE);
}
else
{
USPFire(0.15 * (1 - m_flAccuracy), 0.225, FALSE);
}
}
else
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
USPFire(1.2 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
USPFire(0.225 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
USPFire(0.08 * (1 - m_flAccuracy), 0.225, FALSE);
}
else
{
USPFire(0.1 * (1 - m_flAccuracy), 0.225, FALSE);
}
if (m_iWeaponState & WPNSTATE_USP_SILENCED)
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
USPFire(1.3 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
USPFire(0.25 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
USPFire(0.125 * (1 - m_flAccuracy), 0.225, FALSE);
}
else
{
USPFire(0.15 * (1 - m_flAccuracy), 0.225, FALSE);
}
}
else
{
if (!(m_pPlayer->pev->flags & FL_ONGROUND))
{
USPFire(1.2 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->velocity.Length2D() > 0)
{
USPFire(0.225 * (1 - m_flAccuracy), 0.225, FALSE);
}
else if (m_pPlayer->pev->flags & FL_DUCKING)
{
USPFire(0.08 * (1 - m_flAccuracy), 0.225, FALSE);
}
else
{
USPFire(0.1 * (1 - m_flAccuracy), 0.225, FALSE);
}
}
}
/* <2bb10f> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:200 */
void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
int flag;
int iDamage;
Vector vecAiming, vecSrc, vecDir;
flCycleTime -= 0.075;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.3 - (gpGlobals->time - m_flLastFire)) * 0.275;
if (m_flAccuracy > 0.92)
{
m_flAccuracy = 0.92;
}
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_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
m_iClip--;
SetPlayerShieldAnim();
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
if (!(m_iWeaponState & WPNSTATE_USP_SILENCED))
{
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
iDamage = (m_iWeaponState & WPNSTATE_USP_SILENCED) ? USP_DAMAGE_SIL : USP_DAMAGE;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_45ACP, iDamage, USP_RANGE_MODIFER, 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_usFireUSP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), 0, m_iClip == 0, (m_iWeaponState & WPNSTATE_USP_SILENCED));
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, FALSE);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi)
{
int flag;
int iDamage;
Vector vecAiming, vecSrc, vecDir;
flCycleTime -= 0.075;
if (++m_iShotsFired > 1)
{
return;
}
if (m_flLastFire != 0.0)
{
m_flAccuracy -= (0.3 - (gpGlobals->time - m_flLastFire)) * 0.275;
if (m_flAccuracy > 0.92)
{
m_flAccuracy = 0.92;
}
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_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime);
m_iClip--;
SetPlayerShieldAnim();
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
if (!(m_iWeaponState & WPNSTATE_USP_SILENCED))
{
m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
iDamage = (m_iWeaponState & WPNSTATE_USP_SILENCED) ? USP_DAMAGE_SIL : USP_DAMAGE;
vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 4096, 1, BULLET_PLAYER_45ACP, iDamage, USP_RANGE_MODIFER, 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_usFireUSP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y,
(int)(m_pPlayer->pev->punchangle.x * 100), 0, m_iClip == 0, (m_iWeaponState & WPNSTATE_USP_SILENCED));
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, FALSE);
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2;
m_pPlayer->pev->punchangle.x -= 2;
ResetPlayerShieldAnim();
}
/* <2bae19> ../cstrike/dlls/wpn_shared/wpn_usp.cpp:297 */
@ -340,44 +298,44 @@ void CUSP::__MAKE_VHOOK(WeaponIdle)(void)
#ifdef HOOK_GAMEDLL
void CUSP::Spawn(void)
{
Spawn_();
}
void CUSP::Precache(void)
{
Precache_();
}
int CUSP::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CUSP::Deploy(void)
{
return Deploy_();
}
void CUSP::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CUSP::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CUSP::Reload(void)
{
Reload_();
}
void CUSP::WeaponIdle(void)
{
WeaponIdle_();
void CUSP::Spawn(void)
{
Spawn_();
}
void CUSP::Precache(void)
{
Precache_();
}
int CUSP::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CUSP::Deploy(void)
{
return Deploy_();
}
void CUSP::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CUSP::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CUSP::Reload(void)
{
Reload_();
}
void CUSP::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -1,65 +1,51 @@
#include "precompiled.h"
#define XM1014_MAX_SPEED 240
#define XM1014_CONE_VECTOR Vector(0.0725, 0.0725, 0.0) // special shotgun spreads
enum xm1014_e
{
XM1014_IDLE,
XM1014_FIRE1,
XM1014_FIRE2,
XM1014_RELOAD,
XM1014_PUMP,
XM1014_START_RELOAD,
XM1014_DRAW
};
/* <2cadb2> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:51 */
LINK_ENTITY_TO_CLASS(weapon_xm1014, CXM1014);
/* <2cacc6> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:53 */
void CXM1014::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_XM1014;
SET_MODEL(edict(), "models/w_xm1014.mdl");
m_iDefaultAmmo = XM1014_DEFAULT_GIVE;
// get ready to fall
Precache();
m_iId = WEAPON_XM1014;
SET_MODEL(edict(), "models/w_xm1014.mdl");
m_iDefaultAmmo = XM1014_DEFAULT_GIVE;
// get ready to fall
FallInit();
}
/* <2caadc> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:65 */
void CXM1014::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_xm1014.mdl");
PRECACHE_MODEL("models/w_xm1014.mdl");
m_iShellId = m_iShell = PRECACHE_MODEL("models/shotgunshell.mdl");
PRECACHE_SOUND("weapons/xm1014-1.wav");
PRECACHE_SOUND("weapons/reload1.wav");
PRECACHE_SOUND("weapons/reload3.wav");
PRECACHE_MODEL("models/v_xm1014.mdl");
PRECACHE_MODEL("models/w_xm1014.mdl");
m_iShellId = m_iShell = PRECACHE_MODEL("models/shotgunshell.mdl");
PRECACHE_SOUND("weapons/xm1014-1.wav");
PRECACHE_SOUND("weapons/reload1.wav");
PRECACHE_SOUND("weapons/reload3.wav");
m_usFireXM1014 = PRECACHE_EVENT(1, "events/xm1014.sc");
}
/* <2cab03> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:81 */
int CXM1014::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "buckshot";
p->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = XM1014_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 12;
p->iId = m_iId = WEAPON_XM1014;
p->iFlags = 0;
p->iWeight = XM1014_WEIGHT;
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "buckshot";
p->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = XM1014_MAX_CLIP;
p->iSlot = 0;
p->iPosition = 12;
p->iId = m_iId = WEAPON_XM1014;
p->iFlags = 0;
p->iWeight = XM1014_WEIGHT;
return 1;
}
@ -76,29 +62,29 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)(void)
int flag;
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.15);
return;
}
if (m_iClip <= 0)
{
Reload();
if (!m_iClip)
{
PlayEmptySound();
}
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
return;
if (m_iClip <= 0)
{
Reload();
if (!m_iClip)
{
PlayEmptySound();
}
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
}
m_flNextPrimaryAttack = GetNextAttackDelay(1);
return;
}
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
@ -111,35 +97,35 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)(void)
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
vecSrc = m_pPlayer->GetGunPosition();
vecAiming = gpGlobals->v_forward;
m_pPlayer->FireBullets(6, vecSrc, vecAiming, XM1014_CONE_VECTOR, 3048, BULLET_PLAYER_BUCKSHOT, 0);
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireXM1014, 0, (float *)&g_vecZero, (float *)&g_vecZero, m_vVecAiming.x, m_vVecAiming.y, 7,
(int)(m_vVecAiming.x * 100), m_iClip == 0, FALSE);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
{
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
if (m_iClip != 0)
m_flPumpTime = UTIL_WeaponTimeBase() + 0.125;
m_flNextPrimaryAttack = GetNextAttackDelay(0.25);
m_flNextPrimaryAttack = GetNextAttackDelay(0.25);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25;
if (m_iClip != 0)
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.25;
else
if (m_iClip != 0)
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.25;
else
m_flTimeWeaponIdle = 0.75;
m_fInSpecialReload = 0;
@ -153,126 +139,126 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)(void)
/* <2cad77> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:182 */
void CXM1014::__MAKE_VHOOK(Reload)(void)
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == XM1014_MAX_CLIP)
return;
// don't reload until recoil is done
if (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())
return;
// check to see if we're ready to reload
if (m_fInSpecialReload == 0)
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
SendWeaponAnim(XM1014_START_RELOAD, UseDecrement() != FALSE);
m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55;
m_flNextPrimaryAttack = GetNextAttackDelay(0.55);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55;
}
else if (m_fInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/reload1.wav", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));
else
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/reload3.wav", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));
SendWeaponAnim(XM1014_RELOAD, UseDecrement());
m_flNextReload = UTIL_WeaponTimeBase() + 0.3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.3;
}
else
{
m_iClip++;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;
m_fInSpecialReload = 1;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == XM1014_MAX_CLIP)
return;
// don't reload until recoil is done
if (m_flNextPrimaryAttack > UTIL_WeaponTimeBase())
return;
// check to see if we're ready to reload
if (m_fInSpecialReload == 0)
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
SendWeaponAnim(XM1014_START_RELOAD, UseDecrement() != FALSE);
m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55;
m_flNextPrimaryAttack = GetNextAttackDelay(0.55);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55;
}
else if (m_fInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/reload1.wav", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));
else
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/reload3.wav", VOL_NORM, ATTN_NORM, 0, 85 + RANDOM_LONG(0, 31));
SendWeaponAnim(XM1014_RELOAD, UseDecrement());
m_flNextReload = UTIL_WeaponTimeBase() + 0.3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.3;
}
else
{
m_iClip++;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;
m_fInSpecialReload = 1;
}
}
/* <2cad3c> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:231 */
void CXM1014::__MAKE_VHOOK(WeaponIdle)(void)
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);
if (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())
{
m_flPumpTime = 0;
}
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
{
if (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != XM1014_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else
{
// reload debounce has timed out
SendWeaponAnim(XM1014_PUMP, UseDecrement() != FALSE);
m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
}
}
else
{
SendWeaponAnim(XM1014_IDLE, UseDecrement() != FALSE);
}
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);
if (m_flPumpTime && m_flPumpTime < UTIL_WeaponTimeBase())
{
m_flPumpTime = 0;
}
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase())
{
if (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != XM1014_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}
else
{
// reload debounce has timed out
SendWeaponAnim(XM1014_PUMP, UseDecrement() != FALSE);
m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
}
}
else
{
SendWeaponAnim(XM1014_IDLE, UseDecrement() != FALSE);
}
}
}
#ifdef HOOK_GAMEDLL
void CXM1014::Spawn(void)
{
Spawn_();
}
void CXM1014::Precache(void)
{
Precache_();
}
int CXM1014::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CXM1014::Deploy(void)
{
return Deploy_();
}
void CXM1014::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CXM1014::Reload(void)
{
Reload_();
}
void CXM1014::WeaponIdle(void)
{
WeaponIdle_();
void CXM1014::Spawn(void)
{
Spawn_();
}
void CXM1014::Precache(void)
{
Precache_();
}
int CXM1014::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CXM1014::Deploy(void)
{
return Deploy_();
}
void CXM1014::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CXM1014::Reload(void)
{
Reload_();
}
void CXM1014::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -200,34 +200,34 @@ int Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out)
}
/* <f3192> ../engine/unicode_strtools.cpp:180 */
int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out)
{
if (uVal <= 0x7F)
{
*pUTF8Out = uVal;
return 1;
}
else if (uVal <= 0x7FF)
{
*pUTF8Out = (uVal >> 6) | 0xC0;
pUTF8Out[1] = uVal & 0x3F | 0x80;
return 2;
}
else if (uVal <= 0xFFFF)
{
*pUTF8Out = (uVal >> 12) | 0xE0;
pUTF8Out[2] = uVal & 0x3F | 0x80;
pUTF8Out[1] = (uVal >> 6) & 0x3F | 0x80;
return 3;
}
else
{
*pUTF8Out = (uVal >> 18) & 7 | 0xF0;
pUTF8Out[1] = (uVal >> 12) & 0x3F | 0x80;
pUTF8Out[3] = uVal & 0x3F | 0x80;
pUTF8Out[2] = (uVal >> 6) & 0x3F | 0x80;
return 4;
}
int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out)
{
if (uVal <= 0x7F)
{
*pUTF8Out = uVal;
return 1;
}
else if (uVal <= 0x7FF)
{
*pUTF8Out = (uVal >> 6) | 0xC0;
pUTF8Out[1] = uVal & 0x3F | 0x80;
return 2;
}
else if (uVal <= 0xFFFF)
{
*pUTF8Out = (uVal >> 12) | 0xE0;
pUTF8Out[2] = uVal & 0x3F | 0x80;
pUTF8Out[1] = (uVal >> 6) & 0x3F | 0x80;
return 3;
}
else
{
*pUTF8Out = (uVal >> 18) & 7 | 0xF0;
pUTF8Out[1] = (uVal >> 12) & 0x3F | 0x80;
pUTF8Out[3] = uVal & 0x3F | 0x80;
pUTF8Out[2] = (uVal >> 6) & 0x3F | 0x80;
return 4;
}
}
/* <f32b4> ../engine/unicode_strtools.cpp:209 */

View File

@ -86,24 +86,24 @@ inline void CPerformanceCounter::InitializePerformanceCounter(void)
{
#ifdef _WIN32
LARGE_INTEGER performanceFreq;
QueryPerformanceFrequency(&performanceFreq);
// get 32 out of the 64 time bits such that we have around
// 1 microsecond resolution
unsigned int lowpart, highpart;
lowpart = (unsigned int)performanceFreq.LowPart;
highpart = (unsigned int)performanceFreq.HighPart;
m_iLowShift = 0;
while (highpart || (lowpart > 2000000.0))
{
m_iLowShift++;
lowpart >>= 1;
lowpart |= (highpart & 1) << 31;
highpart >>= 1;
}
LARGE_INTEGER performanceFreq;
QueryPerformanceFrequency(&performanceFreq);
// get 32 out of the 64 time bits such that we have around
// 1 microsecond resolution
unsigned int lowpart, highpart;
lowpart = (unsigned int)performanceFreq.LowPart;
highpart = (unsigned int)performanceFreq.HighPart;
m_iLowShift = 0;
while (highpart || (lowpart > 2000000.0))
{
m_iLowShift++;
lowpart >>= 1;
lowpart |= (highpart & 1) << 31;
highpart >>= 1;
}
m_flPerfCounterFreq = 1.0 / (double)lowpart;
#endif // _WIN32
@ -114,11 +114,11 @@ inline double CPerformanceCounter::GetCurTime(void)
{
#ifdef _WIN32
static int sametimecount;
static unsigned int oldtime;
static int first = 1;
LARGE_INTEGER PerformanceCount;
unsigned int temp, t2;
static int sametimecount;
static unsigned int oldtime;
static int first = 1;
LARGE_INTEGER PerformanceCount;
unsigned int temp, t2;
double time;
QueryPerformanceCounter(&PerformanceCount);
@ -141,9 +141,9 @@ inline double CPerformanceCounter::GetCurTime(void)
{
// check for turnover or backward time
if ((temp <= oldtime) && ((oldtime - temp) < 0x10000000))
{
// so we can't get stuck
oldtime = temp;
{
// so we can't get stuck
oldtime = temp;
}
else
{
@ -165,8 +165,8 @@ inline double CPerformanceCounter::GetCurTime(void)
}
}
else
{
sametimecount = 0;
{
sametimecount = 0;
}
m_flLastCurrentTime = m_flCurrentTime;

View File

@ -830,6 +830,7 @@
<ClInclude Include="..\dlls\weapons.h" />
<ClInclude Include="..\dlls\weapontype.h" />
<ClInclude Include="..\dlls\world.h" />
<ClInclude Include="..\dlls\wpn_shared.h" />
<ClInclude Include="..\engine\cdll_int.h" />
<ClInclude Include="..\engine\cmd.h" />
<ClInclude Include="..\engine\common.h" />

View File

@ -1118,6 +1118,9 @@
<ClInclude Include="..\dlls\scriptevent.h">
<Filter>dlls</Filter>
</ClInclude>
<ClInclude Include="..\dlls\wpn_shared.h">
<Filter>dlls</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\linux\appversion.sh">

View File

@ -1,27 +1,5 @@
#include "precompiled.h"
#define WJ_HEIGHT 8
#define STOP_EPSILON 0.1
#define MAX_CLIMB_SPEED 200
#define PLAYER_DUCKING_MULTIPLIER 0.333
#define PM_CHECKSTUCK_MINTIME 0.05 // Don't check again too quickly.
// Ducking time
#define TIME_TO_DUCK 0.4
#define STUCK_MOVEUP 1
#define PM_VEC_DUCK_HULL_MIN -18
#define PM_VEC_HULL_MIN -36
#define PM_VEC_DUCK_VIEW 12
#define PM_VEC_VIEW 17
#define PM_PLAYER_MAX_SAFE_FALL_SPEED 580 // approx 20 feet
#define PM_PLAYER_MIN_BOUNCE_SPEED 350
#define PM_PLAYER_FALL_PUNCH_THRESHHOLD 250 // won't punch player's screen/make scrape noise unless player falling at least this fast.
// Only allow bunny jumping up to 1.2x server / player maxspeed setting
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.2f
/*
* Globals initialization
*/

View File

@ -55,6 +55,28 @@
#define STEP_LADDER 8
#define STEP_SNOW 9
#define WJ_HEIGHT 8
#define STOP_EPSILON 0.1
#define MAX_CLIMB_SPEED 200
#define PLAYER_DUCKING_MULTIPLIER 0.333
#define PM_CHECKSTUCK_MINTIME 0.05 // Don't check again too quickly.
// Ducking time
#define TIME_TO_DUCK 0.4
#define STUCK_MOVEUP 1
#define PM_VEC_DUCK_HULL_MIN -18
#define PM_VEC_HULL_MIN -36
#define PM_VEC_DUCK_VIEW 12
#define PM_VEC_VIEW 17
#define PM_PLAYER_MAX_SAFE_FALL_SPEED 580 // approx 20 feet
#define PM_PLAYER_MIN_BOUNCE_SPEED 350
#define PM_PLAYER_FALL_PUNCH_THRESHHOLD 250 // won't punch player's screen/make scrape noise unless player falling at least this fast.
// Only allow bunny jumping up to 1.2x server / player maxspeed setting
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.2f
#ifdef HOOK_GAMEDLL
#define pmove (*pg_ppmove)

View File

@ -34,7 +34,7 @@
#include "archtypes.h"
#include "scriptevent.h"
#include "enginecallback.h"
//#include "entity_state.h"
#include "entity_state.h"
#include "nodes.h"
#include "screenfade.h"
#include "utlvector.h"
@ -95,6 +95,9 @@
#include "plats.h"
#include "buttons.h"
// weapon shared
#include "wpn_shared.h"
// CSBOT and Nav
#include "game_shared/bot/bot_util.h"
#include "game_shared/bot/simple_state_machine.h"