/
c_ff_player.cpp
3633 lines (2960 loc) · 117 KB
/
c_ff_player.cpp
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
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "input.h"
#include "c_ff_player.h"
#include "ff_weapon_base.h"
#include "ff_playerclass_parse.h"
#include "ff_grenade_parse.h" //for parseing ff gren txts
#include "c_basetempentity.h"
#include "ff_buildableobjects_shared.h"
#include "ff_utils.h"
#include "engine/IEngineSound.h"
#include "in_buttons.h"
#include "filesystem.h"
#include "materialsystem/IMaterialSystem.h"
#include "materialsystem/IMesh.h"
#include "ClientEffectPrecacheSystem.h"
#include "iviewrender_beams.h"
#include "r_efx.h"
#include "dlight.h"
#include "beamdraw.h"
#include "fx.h"
#include "decals.h"
#include "c_te_effect_dispatch.h"
#include "view.h"
#include "iviewrender.h"
#include "ff_hud_grenade1timer.h"
#include "ff_hud_grenade2timer.h"
#include "ff_gamerules.h"
#include "ff_vieweffects.h"
#include "c_fire_smoke.h"
#include "c_playerresource.h"
#include "flashlighteffect.h"
#include "model_types.h"
#include "ff_hud_chat.h"
#include "collisionutils.h" // hlstriker: For player avoidance
#include "history_resource.h" // squeek: For adding grens to the ammo pickups on the right
#include "ff_mathackman.h" // squeek: For mathack manager update in ClientThink
#include "ff_discordman.h" // for discord rich integration
#if defined( CFFPlayer )
#undef CFFPlayer
#endif
extern CHudGrenade1Timer *g_pGrenade1Timer;
extern CHudGrenade2Timer *g_pGrenade2Timer;
// dlight scale
extern ConVar cl_ffdlight_flashlight;
#include "c_gib.h"
#include "c_ff_timers.h"
#include "c_ff_hint_timers.h"
#include "vguicenterprint.h"
#include "ff_fx_bloodstream.h"
// --> Mirv: Conc stuff
//static ConVar horiz_speed( "ffdev_concuss_hspeed", "2.0", 0, "Horizontal speed" );
#define CONC_HORIZ_SPEED 2.0f
//static ConVar horiz_mag( "ffdev_concuss_hmag", "2.0", 0, "Horizontal magnitude" );
#define CONC_HORIZ_MAG 2.0f
//static ConVar vert_speed( "ffdev_concuss_vspeed", "1.0", 0, "Vertical speed" );
#define CONC_VERT_SPEED 1.0f
//static ConVar vert_mag( "ffdev_concuss_vmag", "2.0", 0, "Vertical magnitude" );
#define CONC_VERT_MAG 2.0f
//static ConVar conc_test( "ffdev_concuss_test", "0", 0, "Show conced decals" );
// <-- Mirv: Conc stuff
//static ConVar render_mode( "ffdev_rendermode", "0", FCVAR_CLIENTDLL | FCVAR_CHEAT );
static ConVar decap_test("ffdev_decaptest", "0", FCVAR_CLIENTDLL | FCVAR_CHEAT );
//Jimmyleg convars
ConVar cl_jimmyleg_cap( "cl_jimmyleg_cap", "1.4", FCVAR_ARCHIVE | FCVAR_USERINFO, "Percentage speed needed to NOT jump." );
ConVar cl_jimmyleg_mode( "cl_jimmyleg_mode", "0", FCVAR_ARCHIVE | FCVAR_USERINFO, "Mode to display jimmylegs. 0 is default. 1 is speed conditional jimmyleg. 2 is full blown jimmyleg." );
// ELMO *** Concussion icon (above player head) 1 of 2
static ConVar cl_tranq("cl_tranq", "1", FCVAR_ARCHIVE | FCVAR_USERINFO, "Show tranq Zs above tranquilized players' heads? (boolean 0 or 1)");
static ConVar cl_concuss("cl_concuss", "1", FCVAR_ARCHIVE | FCVAR_USERINFO, "Show concussion stars above concussed players' heads? (boolean 0 or 1)");
static ConVar concuss_spriteSize("cl_concuss_spriteSize", "3.0", FCVAR_ARCHIVE | FCVAR_USERINFO, "Size of sprite.", true, 0.0f, true, 8.0f );
static ConVar concuss_spriteNum("cl_concuss_spriteNum", "5", FCVAR_ARCHIVE | FCVAR_USERINFO, "Number of sprites.");
static ConVar concuss_color_r("cl_concuss_color_r", "255", FCVAR_ARCHIVE | FCVAR_USERINFO, "Red Component.");
static ConVar concuss_color_g("cl_concuss_color_g", "255", FCVAR_ARCHIVE | FCVAR_USERINFO, "Green Component.");
static ConVar concuss_color_b("cl_concuss_color_b", "255", FCVAR_ARCHIVE | FCVAR_USERINFO, "Blue Component.");
static ConVar concuss_color_a("cl_concuss_color_a", "128", FCVAR_ARCHIVE | FCVAR_USERINFO, "Alpha Component.");
static ConVar concuss_verticalDistance("cl_concuss_verticalDistance", "2.5", FCVAR_ARCHIVE | FCVAR_USERINFO, "Distance the sprite travels from the origin (positive and negative).", true, 0.0f, true, 8.0f);
static ConVar concuss_verticalSpeed("cl_concuss_verticalSpeed", "200", FCVAR_ARCHIVE | FCVAR_USERINFO, "Time taken for the sprite to loop up and down." );
static ConVar concuss_spinSpeed("cl_concuss_spinSpeed", "25", FCVAR_ARCHIVE | FCVAR_USERINFO, "The speed at which the sprites spin." );
static ConVar concuss_radius("cl_concuss_radius", "8", FCVAR_ARCHIVE | FCVAR_USERINFO, "Distance the sprite should be drawn from the origin.", true, 0.0f, true, 16.0f );
static ConVar concuss_height("cl_concuss_height", "36", FCVAR_ARCHIVE | FCVAR_USERINFO, "Height at which the sprite is drawn from the origin.", true, 0.0f, true, 36.0f );
static ConVar cl_tranq_alwaysOn("cl_tranq_alwaysOn", "0", FCVAR_CLIENTDLL | FCVAR_CHEAT, "Status always on? (boolean 0 or 1)");
static ConVar concuss_alwaysOn("cl_concuss_alwaysOn", "0", FCVAR_CLIENTDLL | FCVAR_CHEAT, "Status always on? (boolean 0 or 1)");
//extern ConVar ffdev_softclip_asdisguisedteam;
#define SOFTCLIP_ASDISGUISEDTEAM false // in util_shared.cpp
ConVar ff_defaultweapon_scout("cl_spawnweapon_scout", "jumpgun", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Scout spawn.");
ConVar ff_defaultweapon_sniper("cl_spawnweapon_sniper", "sniperrifle", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Sniper spawn.");
ConVar ff_defaultweapon_soldier("cl_spawnweapon_soldier", "rpg", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Soldier spawn.");
ConVar ff_defaultweapon_demoman("cl_spawnweapon_demoman", "grenadelauncher", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Demo-man spawn.");
ConVar ff_defaultweapon_medic("cl_spawnweapon_medic", "supernailgun", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Medic.");
ConVar ff_defaultweapon_hwguy("cl_spawnweapon_hwguy", "assaultcannon", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on HwGuy.");
ConVar ff_defaultweapon_pyro("cl_spawnweapon_pyro", "flamethrower", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Pyro.");
ConVar ff_defaultweapon_engineer("cl_spawnweapon_engineer", "railgun", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Engineer.");
ConVar ff_defaultweapon_spy("cl_spawnweapon_spy", "knife", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Spy.");
ConVar ff_defaultweapon_civy("cl_spawnweapon_civilian", "umbrella", FCVAR_USERINFO | FCVAR_ARCHIVE, "Default weapon on Civilian.");
// *** ELMO
// gib settings
ConVar cl_gib_count("cl_gib_count", "6", FCVAR_ARCHIVE, "Number of gibs to spawn");
ConVar cl_gib_force_scale("cl_gib_force_scale", "1", FCVAR_ARCHIVE);
ConVar cl_gib_force_randomness("cl_gib_force_randomness", "300", FCVAR_ARCHIVE);
ConVar cl_gib_lifetime("cl_gib_lifetime", "4", FCVAR_ARCHIVE);
// gib blood settings
ConVar cl_gib_blood_scale("cl_gib_blood_scale", "20", FCVAR_ARCHIVE);
ConVar cl_gib_blood_force_scale("cl_gib_blood_force_scale", ".1", FCVAR_ARCHIVE);
ConVar cl_gib_blood_count("cl_gib_blood_count", "3", FCVAR_ARCHIVE);
ConVar cl_gib_blood_force_randomness("cl_gib_blood_force_randomness", "1", FCVAR_ARCHIVE);
// rampslide effect settings
ConVar cl_rampslidefx("cl_rampslidefx", "1", FCVAR_ARCHIVE, "Enables/disables rampslide particle effects");
ConVar cl_rampslidefx_interval("cl_rampslidefx_interval", "0", FCVAR_ARCHIVE, "Time between spawning rampslide particles");
ConVar cl_rampslidefx_offset("cl_rampslidefx_offset", "8", FCVAR_ARCHIVE, "Maximum random horizontal offset from the feet of the player to spawn rampsliding effects");
ConVar cl_rampslidefx_offset_vertical("cl_rampslidefx_offset_vertical", "0", FCVAR_ARCHIVE, "Vertical offset from the feet of the player to spawn rampsliding effects", true, -4.0f, true, 32.0f);
ConVar cl_rampslidefx_spark_length("cl_rampslidefx_spark_length", "1", FCVAR_ARCHIVE, "Length of the sparks");
ConVar cl_rampslidefx_dust_size("cl_rampslidefx_dust_size", "4", FCVAR_ARCHIVE, "The number of dust particles spawned");
ConVar cl_rampslidefx_debug("cl_rampslidefx_alwayson", "0", FCVAR_CLIENTDLL | FCVAR_CHEAT, "If 1, spawns ramspliding particles regardless of whether or not player are actually rampsliding");
ConVar r_selfshadows( "r_selfshadows", "0", FCVAR_CLIENTDLL, "Toggles player & player carried objects' shadows", true, 0, true, 1 );
static ConVar cl_classautokill( "cl_classautokill", "0", FCVAR_USERINFO | FCVAR_ARCHIVE, "Change class instantly");
static char g_szTimerFile[MAX_PATH];
void TimerChange_Callback(ConVar *var, char const *pOldString);
ConVar cl_timerwav("cl_grenadetimer", "default", FCVAR_ARCHIVE, "Timer file to use", TimerChange_Callback);
static char g_szKillBeepFile[MAX_PATH];
void KillBeepChange_Callback(ConVar *var, char const *pOldString);
ConVar cl_killbeepwav("cl_killbeepsound", "deathbeep1", FCVAR_ARCHIVE, "Death beep file to use", KillBeepChange_Callback);
ConVar hud_grenadetimers("hud_grenadetimers", "1", FCVAR_ARCHIVE, "Turns visual grenade timers on or off");
// For decrementing infection effect particles -squeek
extern ConVar ffdev_infection_startingparticles;
//extern ConVar ffdev_infect_numticks; // in ff_player_shared.cpp
#define FFDEV_INFECT_NUMTICKS 10
// Get around the ambiguous symbol problem
extern IFileSystem **pFilesystem;
// Need this to remove the HUD context menus on spawn
extern void HudContextForceClose();
// #0000331: impulse 81 not working (weapon_cubemap)
#include "../c_weapon__stubs.h"
#include "ff_weapon_base.h"
STUB_WEAPON_CLASS( weapon_cubemap, WeaponCubemap, C_BaseCombatWeapon );
CLIENTEFFECT_REGISTER_BEGIN( PrecacheTranquilizedSprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_tranquilized" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheConcussedSprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_concussed" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheSpySprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_spy" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheSaveMeSprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_saveme" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheEngyMeSprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_engyme" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheAmmoMeSprite )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_ammome" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecacheTeamMate )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_teammate" )
CLIENTEFFECT_REGISTER_END()
CLIENTEFFECT_REGISTER_BEGIN( PrecachePlayerCloakMaterial )
CLIENTEFFECT_MATERIAL( FF_CLOAK_MATERIAL )
CLIENTEFFECT_REGISTER_END()
bool g_StealMouseForAimSentry = false;
void SetStealMouseForAimSentry( bool bValue )
{
g_StealMouseForAimSentry = bValue;
}
bool CanStealMouseForAimSentry( void )
{
return g_StealMouseForAimSentry;
}
//bool g_StealMouseForCloak = false;
//void SetStealMouseForCloak( bool bValue )
//{
// g_StealMouseForCloak = bValue;
//}
//bool CanStealMouseForCloak( void )
//{
// return g_StealMouseForCloak;
//}
//void OnTimerExpired(C_FFTimer *pTimer)
//{
// string name = pTimer->GetTimerName();
// //DevMsg("OnTimerExpired(%s)\n",name.c_str());
// char buf[256];
// sprintf(buf,"OnTimerExpired(%s)\n",name.c_str());
// internalCenterPrint->SetTextColor( 255, 255, 255, 255 );
// internalCenterPrint->Print( buf );
//}
// Jiggles: Called 7 seconds after the first time the player spawns as a class, when
// a player has logged 10 minutes (total) as a Soldier, and when a player has
// logged 5 minutes (total) as a Pyro
void OnHintTimerExpired( C_FFHintTimer *pHintTimer )
{
std::string name = pHintTimer->GetTimerName();
if ( name == "RJHint" ) // Player logged 10 minutes as a Soldier
FF_SendHint( SOLDIER_PLAYTIME, 1, PRIORITY_NORMAL, "#FF_HINT_SOLDIER_PLAYTIME" );
else if ( name == "MedHint" ) // Player logged 10 mintes as a Medic
FF_SendHint( MEDIC_PLAYTIME, 1, PRIORITY_NORMAL, "#FF_HINT_MEDIC_PLAYTIME" );
else if ( name == "ICJHint" ) // Player logged 5 minutes as a Pyro
FF_SendHint( PYRO_PLAYTIME, 1, PRIORITY_NORMAL, "#FF_HINT_PYRO_PLAYTIME" );
else if ( name == "scoutSpawn" )
FF_SendHint( SCOUT_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_SCOUT_SPAWN" );
else if ( name == "sniperSpawn" )
FF_SendHint( SNIPER_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_SNIPER_SPAWN" );
else if ( name == "soldierSpawn" )
FF_SendHint( SOLDIER_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_SOLDIER_SPAWN" );
else if ( name == "demomanSpawn" )
FF_SendHint( DEMOMAN_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_DEMOMAN_SPAWN" );
else if ( name == "medicSpawn" )
FF_SendHint( MEDIC_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_MEDIC_SPAWN" );
else if ( name == "hwguySpawn" )
FF_SendHint( HWGUY_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_HWGUY_SPAWN" );
else if ( name == "pyroSpawn" )
FF_SendHint( PYRO_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_PYRO_SPAWN" );
else if ( name == "spySpawn" )
FF_SendHint( SPY_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_SPY_SPAWN" );
else if ( name == "engineerSpawn" )
FF_SendHint( ENGY_SPAWN, 1, PRIORITY_NORMAL, "#FF_HINT_ENGY_SPAWN" );
}
// Jiggles: I figure there are enough compares already in the above function
void OnDisguiseHintTimerExpired( C_FFHintTimer *pHintTimer )
{
FF_SendHint( SPY_NODISGUISE, 5, PRIORITY_NORMAL, "#FF_HINT_SPY_NODISGUISE" );
}
void OnLastInvHintTimerExpired( C_FFHintTimer *pHintTimer )
{
FF_SendHint( GLOBAL_NOLASTINV, 5, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_NOLASTINV" );
}
void OnIntroHintTimerExpired( C_FFHintTimer *pHintTimer )
{
FF_SendHint( INTRO_HINT, 1, PRIORITY_HIGH, "#FF_HINT_INTRO_HINT" );
}
void OnMapHintTimerExpired( C_FFHintTimer *pHintTimer )
{
FF_SendHint( GLOBAL_MAP, 1, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_MAP" );
}
void OnChangeToCTimerExpired( C_FFHintTimer *pHintTimer )
{
FF_SendHint( GLOBAL_CTOC, 1, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_CTOC" );
}
// --> Mirv: Toggle grenades (requested by defrag)
void CC_ToggleOne()
{
if (!engine->IsConnected() || !engine->IsInGame())
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if (pLocalPlayer->m_iGrenadeState != 0)
{
CC_ThrowGren();
pLocalPlayer->m_iUnthrownGrenCount = 0;
pLocalPlayer->m_bLastPrimed = false;
}
else
{
CC_PrimeOne();
// Hint Code: Check for 2 consecutive unthrown grenades (player got blowed up!)
if (pLocalPlayer->m_bLastPrimed == true)
{
pLocalPlayer->m_iUnthrownGrenCount++;
if (pLocalPlayer->m_iUnthrownGrenCount > 1)
{
FF_SendHint( GLOBAL_NOPRIME2, 2, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_NOPRIME2" );
pLocalPlayer->m_iUnthrownGrenCount = 0;
pLocalPlayer->m_bLastPrimed = false;
}
}
else
pLocalPlayer->m_bLastPrimed = true;
}
}
void CC_ToggleTwo()
{
if (!engine->IsConnected() || !engine->IsInGame())
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if (pLocalPlayer->m_iGrenadeState != 0)
{
CC_ThrowGren();
pLocalPlayer->m_iUnthrownGrenCount = 0;
pLocalPlayer->m_bLastPrimed = false;
}
else
{
CC_PrimeTwo();
// Hint Code: Check for 2 consecutive unthrown grenades (player got blowed up!)
if (pLocalPlayer->m_bLastPrimed == true)
{
pLocalPlayer->m_iUnthrownGrenCount++;
if (pLocalPlayer->m_iUnthrownGrenCount > 1)
{
FF_SendHint( GLOBAL_NOPRIME2, 2, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_NOPRIME2" );
pLocalPlayer->m_iUnthrownGrenCount = 0;
pLocalPlayer->m_bLastPrimed = false;
}
}
else
pLocalPlayer->m_bLastPrimed = true;
}
}
// <-- Mirv: Toggle grenades (requested by defrag)
void CC_PrimeOne( void )
{
if(!engine->IsConnected() || !engine->IsInGame())
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
// Don't want timers going when frozen
if( pLocalPlayer->GetFlags() & FL_FROZEN )
return;
if( pLocalPlayer->IsStaticBuilding() )
return;
// Bug #0000176: Sniper gren2 shouldn't trigger timer.wav
// Bug #0000064: Civilian has primary & secondary grenade.
if(pLocalPlayer->m_iPrimary <= 0)
{
//DevMsg("[Grenades] You are out of primary grenades!\n");
return;
}
// Bug #0000169: Grenade timer is played when player is dead and primes a grenade
if (!pLocalPlayer->IsAlive() || pLocalPlayer->GetTeamNumber() < TEAM_BLUE)
return;
// Bug #0000170: Grenade timer plays on gren2 command if the player is already priming a gren1
// 0000818: Grenade timer not playing on second of double primes
if ((pLocalPlayer->m_iGrenadeState != FF_GREN_NONE) &&
(pLocalPlayer->m_flLastServerPrimeTime >= pLocalPlayer->m_flServerPrimeTime))
return;
// Bug #0001308: Holding +gren1 then pressing +gren2 produces a new timer, without priming the 2nd gren
if (pLocalPlayer->m_iGrenadeState == FF_GREN_PRIMETWO)
return;
// Bug #0000366: Spy's cloaking & grenade quirks
// Spy shouldn't be able to prime grenades when feigned
//if (pLocalPlayer->GetEffects() & EF_NODRAW)
if( pLocalPlayer->IsCloaked() )
return;
// Make sure we can't insta-prime on the client either
// This can be anything really so long as it's less than the real delay
// This should be okay up to about ~400ms for the moment
if (engine->Time() < pLocalPlayer->m_flPrimeTime + 0.4f)
return;
// 0000818: Grenade timer not playing on second of double primes
pLocalPlayer->m_flLastServerPrimeTime = pLocalPlayer->m_flServerPrimeTime;
pLocalPlayer->m_flPrimeTime = engine->Time();
// dexter: uncomment this timer - use to to manage our number of active grenade sounds fuck
/* JUST KIDDING IT DOESNT WORK
C_FFTimer *pTimer = g_FFTimers.Create("PrimeGren", 3.81f);
if (pTimer)
{
pTimer->m_bRemoveWhenExpired = true;
pTimer->SetExpiredCallback(&C_FFPlayer::AGrenadeTimerExpired, true);
pTimer->StartTimer();
}*/
//pLocalPlayer->EmitSound( "Grenade.Timer" );
// dexter: if g_szTimerFile hasnt been set yet, force update to default. this happens first run of a new install etc
if (Q_strlen(g_szTimerFile) < 1)
TimerChange_Callback(&cl_timerwav, NULL);
pLocalPlayer->EmitSound("Grenade.Prime");
CPASAttenuationFilter filter(pLocalPlayer, g_szTimerFile);
EmitSound_t params;
params.m_pSoundName = g_szTimerFile;
params.m_flSoundTime = 0.0f;
params.m_pflSoundDuration = NULL;
params.m_bWarnOnDirectWaveReference = false;
pLocalPlayer->EmitSound(filter, pLocalPlayer->entindex(), params);
Assert (g_pGrenade1Timer);
g_pGrenade1Timer->SetTimer(3.81f);
// dexter: increase their active nade sound
//pLocalPlayer->m_iActiveGrenTimers++;
// Tracks gren prime time to see if a player released the grenade right away (unprimed)
pLocalPlayer->m_flGrenPrimeTime = gpGlobals->curtime;
}
void CC_PrimeTwo( void )
{
if(!engine->IsConnected() || !engine->IsInGame())
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
// Don't want timers going when frozen
if( pLocalPlayer->GetFlags() & FL_FROZEN )
return;
if( pLocalPlayer->IsStaticBuilding() )
return;
// Bug #0000176: Sniper gren2 shouldn't trigger timer.wav
// Bug #0000064: Civilian has primary & secondary grenade.
if(pLocalPlayer->m_iSecondary <= 0)
{
//DevMsg("[Grenades] You are out of secondary grenades!\n");
return;
}
// Bug #0000169: Grenade timer is played when player is dead and primes a grenade
if (!pLocalPlayer->IsAlive() || pLocalPlayer->GetTeamNumber() < TEAM_BLUE)
return;
// Bug #0000170: Grenade timer plays on gren2 command if the player is already priming a gren1
// 0000818: Grenade timer not playing on second of double primes
if ((pLocalPlayer->m_iGrenadeState != FF_GREN_NONE) &&
(pLocalPlayer->m_flLastServerPrimeTime >= pLocalPlayer->m_flServerPrimeTime))
return;
// Bug #0001308: Holding +gren1 then pressing +gren2 produces a new timer, without priming the 2nd gren
if (pLocalPlayer->m_iGrenadeState == FF_GREN_PRIMEONE)
return;
// Bug #0000366: Spy's cloaking & grenade quirks
// Spy shouldn't be able to prime grenades when feigned
//if (pLocalPlayer->GetEffects() & EF_NODRAW)
if( pLocalPlayer->IsCloaked() )
return;
// Make sure we can't insta-prime on the client either
// This can be anything really so long as it's less than the real delay
// This should be okay up to about ~400ms for the moment
if (engine->Time() < pLocalPlayer->m_flPrimeTime + 0.4f)
return;
// 0000818: Grenade timer not playing on second of double primes
pLocalPlayer->m_flLastServerPrimeTime = pLocalPlayer->m_flServerPrimeTime;
pLocalPlayer->m_flPrimeTime = engine->Time();
/*C_FFTimer *pTimer = g_FFTimers.Create("PrimeGren", 4.0f);
if (pTimer)
{
pTimer->m_bRemoveWhenExpired = true;
pTimer->StartTimer();
}*/
//pLocalPlayer->EmitSound( "Grenade.Timer" );
// dexter: if g_szTimerFile hasnt been set yet, force update to default. this happens first run of a new install etc
if (Q_strlen(g_szTimerFile) < 1)
TimerChange_Callback(&cl_timerwav, NULL);
pLocalPlayer->EmitSound("Grenade.Prime");
CPASAttenuationFilter filter(pLocalPlayer, g_szTimerFile);
EmitSound_t params;
params.m_pSoundName = g_szTimerFile;
params.m_flSoundTime = 0.0f;
params.m_pflSoundDuration = NULL;
params.m_bWarnOnDirectWaveReference = false;
pLocalPlayer->EmitSound(filter, pLocalPlayer->entindex(), params);
Assert (g_pGrenade2Timer);
g_pGrenade2Timer->SetTimer(3.81f);
// Tracks gren prime time to see if a player released the grenade right away (unprimed)
pLocalPlayer->m_flGrenPrimeTime = gpGlobals->curtime;
}
void CC_ThrowGren( void )
{
if(!engine->IsConnected() || !engine->IsInGame())
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if(
((pLocalPlayer->m_iGrenadeState == FF_GREN_PRIMEONE) && (pLocalPlayer->m_iPrimary == 0))
||
((pLocalPlayer->m_iGrenadeState == FF_GREN_PRIMETWO) && (pLocalPlayer->m_iSecondary == 0))
)
{
return;
}
// Jiggles: Hint Code
// Let's see if the player is throwing an "unprimed" grenade
if( ( gpGlobals->curtime - pLocalPlayer->m_flGrenPrimeTime ) < 0.5f )
{
pLocalPlayer->m_iUnprimedGrenCount++;
// Event: 2 consecutive unprimed grenades thrown
if ( pLocalPlayer->m_iUnprimedGrenCount > 1 )
{
FF_SendHint( GLOBAL_NOPRIME1, 4, PRIORITY_NORMAL, "#FF_HINT_GLOBAL_NOPRIME1" );
pLocalPlayer->m_iUnprimedGrenCount = 0;
}
}
else // Not an "unprimed" grenade -- the time between priming and throwing was > 0.5 seconds
pLocalPlayer->m_iUnprimedGrenCount = 0;
// End hint code
pLocalPlayer->m_iGrenadeState = 0;
}
/* Jiggles: Doesn't seem to be used for anything
void CC_TestTimers( void )
{
//DevMsg("[L0ki] CC_TestTimers\n");
if(!engine->IsConnected() || !engine->IsInGame())
{
//DevMsg("[L0ki] \tNOT connected or NOT active!\n");
return;
}
C_FFTimer *pTimer = g_FFTimers.Create("ClientTimer0", 3.0f);
if(pTimer)
{
pTimer->SetExpiredCallback(OnTimerExpired, true);
pTimer->StartTimer();
}
}
ConCommand testtimers("cc_test_timers",CC_TestTimers,"Tests the basic timer classes.");
*/
void CC_SpyCloak( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
if( pLocalPlayer->GetClassSlot() != CLASS_SPY )
return;
pLocalPlayer->Command_SpyCloak();
}
void CC_SpySilentCloak( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
if( pLocalPlayer->GetClassSlot() != CLASS_SPY )
return;
pLocalPlayer->Command_SpySilentCloak();
}
void CC_SpySmartCloak( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
if( pLocalPlayer->GetClassSlot() != CLASS_SPY )
return;
pLocalPlayer->Command_SpySmartCloak();
}
void CC_EngyMe( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
pLocalPlayer->Command_EngyMe();
}
void CC_SaveMe( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
pLocalPlayer->Command_SaveMe();
}
void CC_AmmoMe( void )
{
if( !engine->IsConnected() || !engine->IsInGame() )
return;
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if( !pLocalPlayer )
return;
if( !pLocalPlayer->IsAlive() )
return;
pLocalPlayer->Command_AmmoMe();
}
#define FF_PLAYER_MODEL "models/player/terror.mdl"
// -------------------------------------------------------------------------------- //
// Player animation event. Sent to the client when a player fires, jumps, reloads, etc..
// -------------------------------------------------------------------------------- //
class C_TEPlayerAnimEvent : public C_BaseTempEntity
{
public:
DECLARE_CLASS( C_TEPlayerAnimEvent, C_BaseTempEntity );
DECLARE_CLIENTCLASS();
virtual void PostDataUpdate( DataUpdateType_t updateType )
{
// Create the effect.
C_FFPlayer *pPlayer = dynamic_cast< C_FFPlayer* >( m_hPlayer.Get() );
if ( pPlayer && !pPlayer->IsDormant() )
{
//Check when the event is jump, depending on the jimmyleg mode or cap, whether to animate a jump or not -GreenMushy
if( cl_jimmyleg_mode.GetInt() != 0 && (PlayerAnimEvent_t)m_iEvent.Get() == PLAYERANIMEVENT_JUMP )
{
//check convars and speed
Vector vecVelocity = pPlayer->GetAbsVelocity();
int nSpeed = (int) FastSqrt( vecVelocity.x * vecVelocity.x + vecVelocity.y * vecVelocity.y );
switch( cl_jimmyleg_mode.GetInt() )
{
case 1:
case 2:
//If the player is below their (specified) bunnyhop cap, do a jump animation.
if( (float)nSpeed < ( pPlayer->MaxSpeed() * cl_jimmyleg_cap.GetFloat() ) )
{
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get() );
}
break;
default:
//Always do the animation event if previous stuff wasnt hit
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get() );
break;
}
}
else
{
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get() );
}
}
}
public:
CNetworkHandle( CBasePlayer, m_hPlayer );
CNetworkVar( int, m_iEvent );
};
IMPLEMENT_CLIENTCLASS_EVENT( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent, CTEPlayerAnimEvent );
BEGIN_RECV_TABLE_NOBASE( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent )
RecvPropEHandle( RECVINFO( m_hPlayer ) ),
RecvPropInt( RECVINFO( m_iEvent ) )
END_RECV_TABLE()
void RecvProxy_PrimeTime( const CRecvProxyData *pData, void *pStruct, void *pOut )
{
// Unpack the data.
if(!engine->IsConnected() || !engine->IsInGame())
{
return;
}
C_FFPlayer *pLocalPlayer = C_FFPlayer::GetLocalFFPlayer();
if(pLocalPlayer)
{
pLocalPlayer->m_flServerPrimeTime = pData->m_Value.m_Float;
if(pLocalPlayer->m_flServerPrimeTime != 0.0f)
pLocalPlayer->m_flLatency = engine->Time() - pLocalPlayer->m_flPrimeTime;
}
}
BEGIN_RECV_TABLE_NOBASE( C_FFPlayer, DT_FFLocalPlayerExclusive )
#ifdef EXTRA_LOCAL_ORIGIN_ACCURACY
RecvPropVector(RECVINFO_NAME(m_vecNetworkOrigin, m_vecOrigin)),
#endif
RecvPropInt( RECVINFO( m_iShotsFired ) ),
// Beg: Added by Mulchman for building objects and such
RecvPropEHandle( RECVINFO( m_hDispenser ) ),
RecvPropEHandle( RECVINFO( m_hSentryGun ) ),
RecvPropEHandle( RECVINFO( m_hDetpack ) ),
RecvPropEHandle( RECVINFO( m_hManCannon ) ),
RecvPropBool( RECVINFO( m_bStaticBuilding ) ),
RecvPropBool( RECVINFO( m_bBuilding ) ),
RecvPropInt( RECVINFO( m_iCurBuild ) ),
// End: Added by Mulchman for building objects and such
// ---> added by billdoor
// ---> added by defrag
RecvPropBool( RECVINFO( m_fRandomPC ) ),
RecvPropInt(RECVINFO(m_iSkiState)),
// ---> end
RecvPropInt( RECVINFO( m_iLastSpyDisguise ) ),
// Beg: Added by L0ki - Grenade related
RecvPropInt( RECVINFO( m_iPrimary ) ),
RecvPropInt( RECVINFO( m_iSecondary ) ),
RecvPropInt( RECVINFO( m_iGrenadeState ) ),
RecvPropFloat( RECVINFO( m_flServerPrimeTime ), 0, RecvProxy_PrimeTime ),
// End: Added by L0ki
RecvPropEHandle( RECVINFO( m_hNextMapGuide ) ),
RecvPropEHandle( RECVINFO( m_hLastMapGuide ) ),
RecvPropFloat( RECVINFO( m_flNextMapGuideTime ) ),
RecvPropFloat(RECVINFO(m_flSlidingTime)),
RecvPropFloat(RECVINFO(m_flSpeedModifier)),
RecvPropInt( RECVINFO( m_iSpyDisguising ) ),
// Radiotag information the local client needs to know
RecvPropEHandle( RECVINFO( m_hRadioTagData ) ),
RecvPropBool( RECVINFO( m_bCloakable ) ),
RecvPropBool( RECVINFO( m_bDisguisable ) ),
RecvPropQAngles( RECVINFO( m_vecInfoIntermission ) ),
// Entity at player's current objective (set by Lua)
RecvPropEHandle( RECVINFO( m_hObjectiveEntity ) ),
// Location of player's current objective (also set by Lua)
RecvPropVector( RECVINFO( m_vecObjectiveOrigin ) ),
END_RECV_TABLE( )
BEGIN_RECV_TABLE_NOBASE( C_FFPlayer, DT_FFNonLocalPlayerExclusive )
RecvPropBool( RECVINFO( m_bJetpacking ) ),
END_RECV_TABLE( )
#ifdef EXTRA_LOCAL_ORIGIN_ACCURACY
BEGIN_RECV_TABLE_NOBASE(C_FFPlayer, DT_NonLocalOrigin)
RecvPropVector(RECVINFO_NAME(m_vecNetworkOrigin, m_vecOrigin)),
END_RECV_TABLE()
#endif
BEGIN_RECV_TABLE_NOBASE( C_FFPlayer, DT_FFPlayerObserver )
RecvPropFloat(RECVINFO(m_flNextClassSpecificSkill)),
RecvPropFloat(RECVINFO(m_flJetpackFuel)),
RecvPropFloat(RECVINFO(m_flTrueAimTime)),
RecvPropFloat(RECVINFO(m_flHitTime)),
RecvPropInt(RECVINFO(m_nButtons)),
END_RECV_TABLE()
IMPLEMENT_CLIENTCLASS_DT( C_FFPlayer, DT_FFPlayer, CFFPlayer )
RecvPropDataTable( "fflocaldata", 0, 0, &REFERENCE_RECV_TABLE(DT_FFLocalPlayerExclusive) ),
// Data that only gets sent to the other players.
RecvPropDataTable( "ffnonlocaldata", 0, 0, &REFERENCE_RECV_TABLE(DT_FFNonLocalPlayerExclusive) ),
#ifdef EXTRA_LOCAL_ORIGIN_ACCURACY
RecvPropDataTable("fforigin", 0, 0, &REFERENCE_RECV_TABLE(DT_NonLocalOrigin)),
#endif
// Data that only gets sent to the player as well as observers of the player
RecvPropDataTable( "ffplayerobserverdata", 0, 0, &REFERENCE_RECV_TABLE(DT_FFPlayerObserver) ),
RecvPropFloat( RECVINFO( m_angEyeAngles[0] ) ),
RecvPropFloat( RECVINFO( m_angEyeAngles[1] ) ),
RecvPropEHandle( RECVINFO( m_hRagdoll ) ),
RecvPropInt( RECVINFO( m_iClassStatus ) ),
RecvPropInt( RECVINFO( m_iSpyDisguise ) ),
RecvPropFloat(RECVINFO(m_flConcTime)),
RecvPropInt(RECVINFO(m_iSpawnInterpCounter)),
RecvPropBool( RECVINFO( m_bSaveMe ) ),
RecvPropBool( RECVINFO( m_bEngyMe ) ),
RecvPropBool( RECVINFO( m_bAmmoMe ) ),
RecvPropBool( RECVINFO( m_bConcussed ) ),
RecvPropBool( RECVINFO( m_bTranqed ) ),
RecvPropBool( RECVINFO( m_bSliding ) ),
RecvPropBool( RECVINFO( m_bIsRampsliding ) ),
RecvPropEHandle( RECVINFO( m_hActiveSlowfield ) ),
RecvPropBool( RECVINFO( m_bInfected ) ),
RecvPropBool( RECVINFO( m_bImmune ) ),
RecvPropInt( RECVINFO( m_iInfectTick ) ),
RecvPropInt( RECVINFO( m_iCloaked ) ),
//RecvPropFloat( RECVINFO( m_flCloakSpeed ) ),
RecvPropInt( RECVINFO( m_iActiveSabotages ) ),
END_RECV_TABLE( )
BEGIN_PREDICTION_DATA( C_FFPlayer )
DEFINE_PRED_FIELD( m_flCycle, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
DEFINE_PRED_FIELD( m_iShotsFired, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
END_PREDICTION_DATA()
class C_FFRagdoll : public C_BaseAnimatingOverlay
{
public:
DECLARE_CLASS( C_FFRagdoll, C_BaseAnimatingOverlay );
DECLARE_CLIENTCLASS();
C_FFRagdoll();
~C_FFRagdoll();
virtual void OnDataChanged( DataUpdateType_t type );
// HACKHACK: Fix to allow laser beam to shine off ragdolls
virtual CollideType_t ShouldCollide()
{
return ENTITY_SHOULD_COLLIDE_RESPOND;
}
virtual int BloodColor() { return BLOOD_COLOR_RED; }
int GetPlayerEntIndex() const;
IRagdoll* GetIRagdoll() const;
void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName );
void ClientThink();
private:
C_FFRagdoll( const C_FFRagdoll & ) {}
void Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity );
void CreateRagdoll();
private:
EHANDLE m_hPlayer;
CNetworkVector( m_vecRagdollVelocity );
CNetworkVector( m_vecRagdollOrigin );
CSmartPtr<CBloodStream> m_pBloodStreamEmitter;
int m_fBodygroupState;
int m_nSkinIndex;
};
IMPLEMENT_CLIENTCLASS_DT_NOBASE( C_FFRagdoll, DT_FFRagdoll, CFFRagdoll )
RecvPropVector( RECVINFO(m_vecRagdollOrigin) ),
RecvPropEHandle( RECVINFO( m_hPlayer ) ),
RecvPropInt( RECVINFO( m_nModelIndex ) ),
RecvPropInt( RECVINFO(m_nForceBone) ),
RecvPropVector( RECVINFO(m_vecForce) ),
RecvPropVector( RECVINFO( m_vecRagdollVelocity ) ),
RecvPropInt(RECVINFO(m_fBodygroupState)),
RecvPropInt(RECVINFO(m_nSkinIndex)),
END_RECV_TABLE()
C_FFRagdoll::C_FFRagdoll()
{
m_pBloodStreamEmitter = NULL;
}
C_FFRagdoll::~C_FFRagdoll()
{
PhysCleanupFrictionSounds( this );
}
void C_FFRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
{
if ( !pSourceEntity )
return;
VarMapping_t *pSrc = pSourceEntity->GetVarMapping();
VarMapping_t *pDest = GetVarMapping();
// Find all the VarMapEntry_t's that represent the same variable.
for ( int i = 0; i < pDest->m_Entries.Count(); i++ )
{
VarMapEntry_t *pDestEntry = &pDest->m_Entries[i];
for ( int j=0; j < pSrc->m_Entries.Count(); j++ )
{
VarMapEntry_t *pSrcEntry = &pSrc->m_Entries[j];
if ( !Q_strcmp( pSrcEntry->watcher->GetDebugName(),
pDestEntry->watcher->GetDebugName() ) )
{
pDestEntry->watcher->Copy( pSrcEntry->watcher );
break;
}
}
}
}
void C_FFRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
if( !pPhysicsObject )
return;
// --> Mirv: [TODO] Return on impact to invisible bodygroup
// This will need to wait until the #s of the hitgroups are finalised
// <-- Mirv: [TODO] Return on impact to invisible bodygroup
Vector dir = pTrace->endpos - pTrace->startpos;
Vector hitpos;
VectorMA(pTrace->startpos, pTrace->fraction, dir, hitpos);
VectorNormalize(dir);
UTIL_BloodDrips(pTrace->endpos, dir, BLOOD_COLOR_RED, 20);