-
Notifications
You must be signed in to change notification settings - Fork 195
/
weapons.h
2184 lines (1911 loc) · 50.7 KB
/
weapons.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CBasePlayer;
const float MAX_NORMAL_BATTERY = 100.0f;
const float MAX_DIST_RELOAD_SOUND = 512.0f;
#define MAX_WEAPONS 32
#define ITEM_FLAG_SELECTONEMPTY BIT(0)
#define ITEM_FLAG_NOAUTORELOAD BIT(1)
#define ITEM_FLAG_NOAUTOSWITCHEMPTY BIT(2)
#define ITEM_FLAG_LIMITINWORLD BIT(3)
#define ITEM_FLAG_EXHAUSTIBLE BIT(4) // A player can totally exhaust their ammo supply and lose this weapon
#define ITEM_FLAG_NOFIREUNDERWATER BIT(5)
#define ITEM_FLAG_EXHAUST_SECONDARYAMMO BIT(6) // A player will exhaust weapon's secondary ammo supply if dropped (ITEM_FLAG_EXHAUSTIBLE does both)
// if someone has an idea for another flag pack it here, so client prediction will not be screwed (or something) if PLAY_GAMEDLL is defined
#define ITEM_FLAG_CUSTOM (ITEM_FLAG_NOFIREUNDERWATER | ITEM_FLAG_EXHAUST_SECONDARYAMMO)
#define WEAPON_IS_ONTARGET 0x40
// the maximum amount of ammo each weapon's clip can hold
#define WEAPON_NOCLIP -1
#define LOUD_GUN_VOLUME 1000
#define NORMAL_GUN_VOLUME 600
#define QUIET_GUN_VOLUME 200
#define BRIGHT_GUN_FLASH 512
#define NORMAL_GUN_FLASH 256
#define DIM_GUN_FLASH 128
#define BIG_EXPLOSION_VOLUME 2048
#define NORMAL_EXPLOSION_VOLUME 1024
#define SMALL_EXPLOSION_VOLUME 512
#define WEAPON_ACTIVITY_VOLUME 64
// spawn flags
#define SF_DETONATE BIT(0) // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges
// custom enum
enum ArmorType
{
ARMOR_NONE, // No armor
ARMOR_KEVLAR, // Body vest only
ARMOR_VESTHELM, // Vest and helmet
};
enum ArmouryItemPack
{
ARMOURY_MP5NAVY,
ARMOURY_TMP,
ARMOURY_P90,
ARMOURY_MAC10,
ARMOURY_AK47,
ARMOURY_SG552,
ARMOURY_M4A1,
ARMOURY_AUG,
ARMOURY_SCOUT,
ARMOURY_G3SG1,
ARMOURY_AWP,
ARMOURY_M3,
ARMOURY_XM1014,
ARMOURY_M249,
ARMOURY_FLASHBANG,
ARMOURY_HEGRENADE,
ARMOURY_KEVLAR,
ARMOURY_ASSAULT,
ARMOURY_SMOKEGRENADE,
ARMOURY_SHIELD,
ARMOURY_FAMAS,
ARMOURY_SG550,
ARMOURY_GALIL,
ARMOURY_UMP45,
ARMOURY_GLOCK18,
ARMOURY_USP,
ARMOURY_ELITE,
ARMOURY_FIVESEVEN,
ARMOURY_P228,
ARMOURY_DEAGLE,
};
struct ItemInfo
{
int iSlot;
int iPosition;
const char *pszAmmo1;
int iMaxAmmo1;
const char *pszAmmo2;
int iMaxAmmo2;
const char *pszName;
int iMaxClip;
int iId;
int iFlags;
int iWeight;
};
struct AmmoInfo
{
const char *pszName;
int iId;
};
struct MULTIDAMAGE
{
EntityHandle<CBaseEntity> hEntity;
float amount;
int type;
};
#include "weapontype.h"
#include "items.h"
class CArmoury: public CBaseEntity
{
public:
virtual void Spawn();
virtual void Precache();
virtual void Restart();
virtual void KeyValue(KeyValueData *pkvd);
#ifdef REGAMEDLL_FIXES
virtual void SetObjectCollisionBox();
#endif
public:
void EXPORT ArmouryTouch(CBaseEntity *pOther);
private:
void Draw();
void Hide();
public:
static char *m_ItemModels[];
ArmouryItemPack m_iItem;
int m_iCount;
int m_iInitialCount;
bool m_bAlreadyCounted;
};
class CGrenade: public CBaseMonster
{
public:
virtual void Spawn();
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return m_bIsC4 ? FCAP_CONTINUOUS_USE : 0; }
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual int BloodColor() { return DONT_BLEED; }
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual void BounceSound();
public:
enum SATCHELCODE
{
SATCHEL_DETONATE,
SATCHEL_RELEASE,
};
public:
void DefuseBombStart(CBasePlayer *pPlayer);
void DefuseBombEnd(CBasePlayer *pPlayer, bool bDefused);
static CGrenade *ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time);
static CGrenade *ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent);
static CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity);
static CGrenade *ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent);
static CGrenade *ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity);
static void UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code);
public:
void Explode(Vector vecSrc, Vector vecAim);
void Explode(TraceResult *pTrace, int bitsDamageType);
void Explode2(TraceResult *pTrace, int bitsDamageType);
void Explode3(TraceResult *pTrace, int bitsDamageType);
void SG_Explode(TraceResult *pTrace, int bitsDamageType);
#ifdef REGAMEDLL_API
static CGrenade *ShootTimed_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time);
static CGrenade *ShootTimed2_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, int iTeam, unsigned short usEvent);
static CGrenade *ShootSmokeGrenade_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, unsigned short usEvent);
static CGrenade *ShootSatchelCharge_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity);
void DefuseBombStart_OrigFunc(CBasePlayer *pPlayer);
void DefuseBombEnd_OrigFunc(CBasePlayer *pPlayer, bool bDefused);
void Explode_OrigFunc(TraceResult *pTrace, int bitsDamageType);
void Explode3_OrigFunc(TraceResult *pTrace, int bitsDamageType);
void Explode2_OrigFunc(TraceResult *pTrace, int bitsDamageType);
void SG_Detonate_OrigFunc();
#endif
void EXPORT Smoke();
void EXPORT Smoke2();
void EXPORT Smoke3_A();
void EXPORT Smoke3_B();
void EXPORT Smoke3_C();
void EXPORT SG_Smoke();
void EXPORT BounceTouch(CBaseEntity *pOther);
void EXPORT SlideTouch(CBaseEntity *pOther);
void EXPORT C4Touch(CBaseEntity *pOther);
void EXPORT ExplodeTouch(CBaseEntity *pOther);
void EXPORT DangerSoundThink();
void EXPORT PreDetonate();
void EXPORT Detonate();
void EXPORT SG_Detonate();
void EXPORT Detonate2();
void EXPORT Detonate3();
void EXPORT DetonateUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void EXPORT TumbleThink();
void EXPORT SG_TumbleThink();
void EXPORT C4Think();
public:
static TYPEDESCRIPTION m_SaveData[];
bool m_bStartDefuse;
bool m_bIsC4;
EntityHandle<CBasePlayer> m_pBombDefuser;
float m_flDefuseCountDown;
float m_flC4Blow;
float m_flNextFreqInterval;
float m_flNextBeep;
float m_flNextFreq;
char *m_sBeepName;
float m_fAttenu;
float m_flNextBlink;
float m_fNextDefuse;
bool m_bJustBlew;
int m_iTeam;
int m_iCurWave;
edict_t *m_pentCurBombTarget;
int m_SGSmoke;
int m_angle;
unsigned short m_usEvent;
bool m_bLightSmoke;
bool m_bDetonated;
Vector m_vSmokeDetonate;
int m_iBounceCount;
BOOL m_fRegisteredSound;
};
// Items that the player has in their inventory that they can use
class CCSPlayerItem;
class CBasePlayerItem: public CBaseAnimating
{
public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual void SetObjectCollisionBox();
virtual CBaseEntity *Respawn();
virtual int AddToPlayer(CBasePlayer *pPlayer); // return TRUE if the item you want the item added to the player inventory
virtual int AddDuplicate(CBasePlayerItem *pItem) { return FALSE; } // return TRUE if you want your duplicate removed from world
virtual int GetItemInfo(ItemInfo *p) { return 0; } // returns 0 if struct not filled out
virtual BOOL CanDeploy() { return TRUE; }
virtual BOOL CanDrop() { return TRUE; } // returns is deploy was successful
virtual BOOL Deploy() { return TRUE; }
virtual BOOL IsWeapon() { return FALSE; }
virtual BOOL CanHolster() { return TRUE; } // can this weapon be put away right now?
virtual void Holster(int skiplocal = 0);
virtual void UpdateItemInfo() {}
virtual void ItemPreFrame() {} // called each frame by the player PreThink
virtual void ItemPostFrame() {} // called each frame by the player PostThink
virtual void Drop();
virtual void Kill();
virtual void AttachToPlayer(CBasePlayer *pPlayer);
virtual int PrimaryAmmoIndex() { return -1; }
virtual int SecondaryAmmoIndex() { return -1; }
virtual int UpdateClientData(CBasePlayer *pPlayer) { return 0; }
virtual CBasePlayerItem *GetWeaponPtr() { return nullptr; }
virtual float GetMaxSpeed() { return 260.0f; }
virtual int iItemSlot() { return 0; } // return 0 to MAX_ITEMS_SLOTS, used in hud
public:
bool EXPORT DestroyItem();
void EXPORT DefaultTouch(CBaseEntity *pOther);
void EXPORT FallThink();
void EXPORT Materialize();
void EXPORT AttemptToMaterialize();
void FallInit();
void CheckRespawn();
public:
#ifdef REGAMEDLL_API
CCSPlayerItem *CSPlayerItem() const;
#endif
const char *pszAmmo1() const;
int iMaxAmmo1() const;
const char *pszAmmo2() const;
int iMaxAmmo2() const;
const char *pszName() const;
int iMaxClip() const;
int iWeight() const;
int iFlags() const;
public:
static TYPEDESCRIPTION m_SaveData[];
static ItemInfo m_ItemInfoArray[MAX_WEAPONS];
static AmmoInfo m_AmmoInfoArray[MAX_AMMO_SLOTS];
CBasePlayer *m_pPlayer;
CBasePlayerItem *m_pNext;
int m_iId; // WEAPON_???
};
#ifdef REGAMEDLL_API
inline CCSPlayerItem *CBasePlayerItem::CSPlayerItem() const
{
return reinterpret_cast<CCSPlayerItem *>(this->m_pEntity);
}
#endif
// inventory items that
class CCSPlayerWeapon;
class CBasePlayerWeapon: public CBasePlayerItem
{
public:
virtual void Spawn();
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
// generic weapon versions of CBasePlayerItem calls
virtual int AddToPlayer(CBasePlayer *pPlayer);
virtual int AddDuplicate(CBasePlayerItem *pItem);
virtual BOOL CanDeploy();
virtual BOOL IsWeapon() { return TRUE; }
virtual void Holster(int skiplocal = 0);
virtual void UpdateItemInfo() {};
virtual void ItemPostFrame();
virtual int PrimaryAmmoIndex();
virtual int SecondaryAmmoIndex();
virtual int UpdateClientData(CBasePlayer *pPlayer);
virtual CBasePlayerItem *GetWeaponPtr() { return (CBasePlayerItem *)this; }
virtual int ExtractAmmo(CBasePlayerWeapon *pWeapon);
virtual int ExtractClipAmmo(CBasePlayerWeapon *pWeapon);
virtual int AddWeapon()
{
ExtractAmmo(this);
return 1;
}
virtual BOOL PlayEmptySound();
virtual void ResetEmptySound();
virtual void SendWeaponAnim(int iAnim, int skiplocal = 0);
virtual BOOL IsUseable();
virtual void PrimaryAttack() {};
virtual void SecondaryAttack() {};
virtual void Reload() {};
virtual void WeaponIdle() {};
virtual void RetireWeapon();
virtual BOOL ShouldWeaponIdle() { return FALSE; }
virtual BOOL UseDecrement() { return FALSE; }
public:
BOOL AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, int iMaxCarry);
BOOL AddSecondaryAmmo(int iCount, char *szName, int iMaxCarry);
BOOL DefaultDeploy(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal = 0);
int DefaultReload(int iClipSize, int iAnim, float fDelay);
void FireRemaining(int &shotsFired, float &shootTime, BOOL isGlock18);
void KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change);
void EjectBrassLate();
void MakeBeam();
void BeamUpdate();
void ReloadSound();
float GetNextAttackDelay(float delay);
float GetNextAttackDelay2(float delay);
bool HasSecondaryAttack();
BOOL IsPistol() { return (m_iId == WEAPON_USP || m_iId == WEAPON_GLOCK18 || m_iId == WEAPON_P228 || m_iId == WEAPON_DEAGLE || m_iId == WEAPON_ELITE || m_iId == WEAPON_FIVESEVEN); }
void SetPlayerShieldAnim();
void ResetPlayerShieldAnim();
bool ShieldSecondaryFire(int iUpAnim, int iDownAnim);
void HandleInfiniteAmmo();
void InstantReload(bool bCanRefillBPAmmo = false);
bool DefaultShotgunReload(int iAnim, int iStartAnim, float fDelay, float fStartDelay, const char *pszReloadSound1 = nullptr, const char *pszReloadSound2 = nullptr);
#ifdef REGAMEDLL_API
BOOL CanDeploy_OrigFunc();
BOOL DefaultDeploy_OrigFunc(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal);
BOOL DefaultReload_OrigFunc(int iClipSize, int iAnim, float fDelay);
bool DefaultShotgunReload_OrigFunc(int iAnim, int iStartAnim, float fDelay, float fStartDelay, const char *pszReloadSound1, const char *pszReloadSound2);
void KickBack_OrigFunc(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change);
void SendWeaponAnim_OrigFunc(int iAnim, int skiplocal);
void ItemPostFrame_OrigFunc();
CCSPlayerWeapon *CSPlayerWeapon() const;
#endif
public:
static TYPEDESCRIPTION m_SaveData[];
int m_iPlayEmptySound;
int m_fFireOnEmpty;
float m_flNextPrimaryAttack; // soonest time ItemPostFrame will call PrimaryAttack
float m_flNextSecondaryAttack; // soonest time ItemPostFrame will call SecondaryAttack
float m_flTimeWeaponIdle; // soonest time ItemPostFrame will call WeaponIdle
int m_iPrimaryAmmoType; // "primary" ammo index into players m_rgAmmo[]
int m_iSecondaryAmmoType; // "secondary" ammo index into players m_rgAmmo[]
int m_iClip; // number of shots left in the primary weapon clip, -1 it not used
int m_iClientClip; // the last version of m_iClip sent to hud dll
int m_iClientWeaponState; // the last version of the weapon state sent to hud dll (is current weapon, is on target)
int m_fInReload; // Are we in the middle of a reload;
int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns
int m_iDefaultAmmo; // how much ammo you get when you pick up this weapon as placed by a level designer.
int m_iShellId;
float m_fMaxSpeed;
bool m_bDelayFire;
BOOL m_iDirection;
bool m_bSecondarySilencerOn;
float m_flAccuracy;
float m_flLastFire;
int m_iShotsFired;
Vector m_vVecAiming;
string_t model_name;
float m_flGlock18Shoot; // time to shoot the remaining bullets of the glock18 burst fire
int m_iGlock18ShotsFired; // used to keep track of the shots fired during the Glock18 burst fire mode.
float m_flFamasShoot;
int m_iFamasShotsFired;
float m_fBurstSpread;
int m_iWeaponState;
float m_flNextReload;
float m_flDecreaseShotsFired;
unsigned short m_usFireGlock18;
unsigned short m_usFireFamas;
// hle time creep vars
float m_flPrevPrimaryAttack;
float m_flLastFireTime;
};
#ifdef REGAMEDLL_API
inline CCSPlayerWeapon *CBasePlayerWeapon::CSPlayerWeapon() const
{
return reinterpret_cast<CCSPlayerWeapon *>(this->m_pEntity);
}
#endif
class CWeaponBox: public CBaseEntity
{
public:
virtual void Spawn();
virtual void Precache();
virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual void SetObjectCollisionBox();
virtual void Touch(CBaseEntity *pOther);
public:
BOOL IsEmpty();
int GiveAmmo(int iCount, char *szName, int iMax, int *pIndex = nullptr);
int GetAmmoIndex(const char *psz) const;
bool GiveAmmoToPlayer(CBasePlayer *pPlayer, CBasePlayerWeapon *pWeapon,
int iCurrentAmmo, const char *pszAmmo, int iMaxAmmo, CBasePlayerItem **pGivenItem = NULL);
void EXPORT Kill();
void EXPORT BombThink();
void SetModel(const char *pszModelName);
BOOL HasWeapon(CBasePlayerItem *pCheckItem);
BOOL PackWeapon(CBasePlayerItem *pWeapon);
BOOL PackAmmo(string_t iszName, int iCount);
#ifdef REGAMEDLL_API
void SetModel_OrigFunc(const char *pszModelName);
#endif
public:
static TYPEDESCRIPTION m_SaveData[];
CBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES];
string_t m_rgiszAmmo[MAX_AMMO_SLOTS];
int m_rgAmmo[MAX_AMMO_SLOTS];
int m_cAmmoTypes;
bool m_bIsBomb;
};
const float USP_MAX_SPEED = 250.0f;
const float USP_DAMAGE = 34.0f;
const float USP_DAMAGE_SIL = 30.0f;
const float USP_RANGE_MODIFER = 0.79f;
const float USP_RELOAD_TIME = 2.7f;
#ifdef REGAMEDLL_FIXES
const float USP_ADJUST_SIL_TIME = 3.13f;
#else
const float USP_ADJUST_SIL_TIME = 3.0f;
#endif
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_IDLE_UP,
USP_SHIELD_UP,
USP_SHIELD_DOWN,
};
class CUSP: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed() { return m_fMaxSpeed; }
virtual int iItemSlot() { return PISTOL_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
virtual BOOL IsPistol() { return TRUE; }
public:
void USPFire(float flSpread, float flCycleTime, BOOL fUseSemi);
void MakeBeam();
void BeamUpdate();
int m_iShell;
private:
unsigned short m_usFireUSP;
#ifdef REGAMEDLL_API
float m_flBaseDamageSil;
#endif
};
const float MP5N_MAX_SPEED = 250.0f;
const float MP5N_DAMAGE = 26.0f;
const float MP5N_RANGE_MODIFER = 0.84f;
const float MP5N_RELOAD_TIME = 2.63f;
#ifdef REGAMEDLL_FIXES
const float MP5N_ACCURACY_DIVISOR = 220.1f;
#else
const double MP5N_ACCURACY_DIVISOR = 220.1;
#endif
enum mp5n_e
{
MP5N_IDLE1,
MP5N_RELOAD,
MP5N_DRAW,
MP5N_SHOOT1,
MP5N_SHOOT2,
MP5N_SHOOT3,
};
class CMP5N: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed() { return MP5N_MAX_SPEED; }
virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; }
virtual void PrimaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
void MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
int m_iShell;
int iShellOn;
private:
unsigned short m_usFireMP5N;
};
const float SG552_MAX_SPEED = 235.0f;
const float SG552_MAX_SPEED_ZOOM = 200.0f;
const float SG552_DAMAGE = 33.0f;
const float SG552_RANGE_MODIFER = 0.955f;
const float SG552_RELOAD_TIME = 3.0f;
#ifdef REGAMEDLL_FIXES
const float SG552_ACCURACY_DIVISOR = 220.0f;
#else
const int SG552_ACCURACY_DIVISOR = 220;
#endif
enum sg552_e
{
SG552_IDLE1,
SG552_RELOAD,
SG552_DRAW,
SG552_SHOOT1,
SG552_SHOOT2,
SG552_SHOOT3,
};
class CSG552: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed();
virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
void SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
int m_iShell;
int iShellOn;
private:
unsigned short m_usFireSG552;
};
const float AK47_MAX_SPEED = 221.0f;
const float AK47_DAMAGE = 36.0f;
const float AK47_RANGE_MODIFER = 0.98f;
const float AK47_RELOAD_TIME = 2.45f;
#ifdef REGAMEDLL_FIXES
const float AK47_ACCURACY_DIVISOR = 200.0f;
#else
const int AK47_ACCURACY_DIVISOR = 200;
#endif
enum ak47_e
{
AK47_IDLE1,
AK47_RELOAD,
AK47_DRAW,
AK47_SHOOT1,
AK47_SHOOT2,
AK47_SHOOT3,
};
class CAK47: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed() { return AK47_MAX_SPEED; }
virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
void AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
int m_iShell;
int iShellOn;
private:
unsigned short m_usFireAK47;
};
const float AUG_MAX_SPEED = 240.0f;
const float AUG_DAMAGE = 32.0f;
const float AUG_RANGE_MODIFER = 0.96f;
const float AUG_RELOAD_TIME = 3.3f;
#ifdef REGAMEDLL_FIXES
const float AUG_ACCURACY_DIVISOR = 215.0f;
#else
const int AUG_ACCURACY_DIVISOR = 215;
#endif
enum aug_e
{
AUG_IDLE1,
AUG_RELOAD,
AUG_DRAW,
AUG_SHOOT1,
AUG_SHOOT2,
AUG_SHOOT3,
};
class CAUG: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed() { return AUG_MAX_SPEED; }
virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
void AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
int m_iShell;
int iShellOn;
private:
unsigned short m_usFireAug;
};
const float AWP_MAX_SPEED = 210.0f;
const float AWP_MAX_SPEED_ZOOM = 150.0f;
const float AWP_DAMAGE = 115.0f;
const float AWP_RANGE_MODIFER = 0.99f;
const float AWP_RELOAD_TIME = 2.5f;
enum awp_e
{
AWP_IDLE,
AWP_SHOOT,
AWP_SHOOT2,
AWP_SHOOT3,
AWP_RELOAD,
AWP_DRAW,
};
class CAWP: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed();
virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
void AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
int m_iShell;
private:
unsigned short m_usFireAWP;
};
// for usermsg BombDrop
#define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect
#define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar.
const float C4_MAX_SPEED = 250.0f;
const float C4_ARMING_ON_TIME = 3.0f;
enum c4_e
{
C4_IDLE1,
C4_DRAW,
C4_DROP,
C4_ARM,
};
class CC4: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual void KeyValue(KeyValueData *pkvd);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual void Holster(int skiplocal);
virtual float GetMaxSpeed();
virtual int iItemSlot() { return C4_SLOT; }
virtual void PrimaryAttack();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
public:
bool m_bStartedArming;
bool m_bBombPlacedAnimation;
float m_fArmedTime;
private:
bool m_bHasShield;
};
const float DEAGLE_MAX_SPEED = 250.0f;
const float DEAGLE_DAMAGE = 54.0f;
const float DEAGLE_RANGE_MODIFER = 0.81f;
const float DEAGLE_RELOAD_TIME = 2.2f;
enum deagle_e
{
DEAGLE_IDLE1,
DEAGLE_SHOOT1,
DEAGLE_SHOOT2,
DEAGLE_SHOOT_EMPTY,
DEAGLE_RELOAD,
DEAGLE_DRAW,
};
enum deagle_shield_e
{
DEAGLE_SHIELD_IDLE1,
DEAGLE_SHIELD_SHOOT,
DEAGLE_SHIELD_SHOOT2,
DEAGLE_SHIELD_SHOOT_EMPTY,
DEAGLE_SHIELD_RELOAD,
DEAGLE_SHIELD_DRAW,
DEAGLE_SHIELD_IDLE_UP,
DEAGLE_SHIELD_UP,
DEAGLE_SHIELD_DOWN,
};
class CDEAGLE: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL Deploy();
virtual float GetMaxSpeed() { return m_fMaxSpeed; }
virtual int iItemSlot() { return PISTOL_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void Reload();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
virtual BOOL IsPistol() { return TRUE; }
public:
void DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi);
int m_iShell;
private:
unsigned short m_usFireDeagle;
};
const float FLASHBANG_MAX_SPEED = 250.0f;
const float FLASHBANG_MAX_SPEED_SHIELD = 180.0f;
enum flashbang_e
{
FLASHBANG_IDLE,
FLASHBANG_PULLPIN,
FLASHBANG_THROW,
FLASHBANG_DRAW,
};
class CFlashbang: public CBasePlayerWeapon
{
public:
virtual void Spawn();
virtual void Precache();
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL CanDeploy();
virtual BOOL CanDrop() { return FALSE; }
virtual BOOL Deploy();
virtual void Holster(int skiplocal);
virtual float GetMaxSpeed() { return m_fMaxSpeed; }
virtual int iItemSlot() { return GRENADE_SLOT; }
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void WeaponIdle();
virtual BOOL UseDecrement()
{
#ifdef CLIENT_WEAPONS
return TRUE;
#else
return FALSE;
#endif
}
virtual BOOL IsPistol()
{
#ifdef REGAMEDLL_FIXES
return FALSE;
#else
// TODO: why the object flashbang is IsPistol?
return TRUE;
#endif