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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "basetfplayer_shared.h"
#include "in_buttons.h"
#include "tf_shareddefs.h"
#include "basegrenade_shared.h"
#include "basetfcombatweapon_shared.h"
#include "weapon_limpetmine.h"
#include "IEffects.h"
#include "engine/IEngineSound.h"
#include "weapon_grenade_rocket.h"
#include "beam_shared.h"
#include "tf_gamerules.h"
#if defined( CLIENT_DLL )
#else
#include "grenade_limpetmine.h"
#include "tf_obj_sentrygun.h"
#include "ai_network.h"
#include "tf_team.h"
#endif
// Damage CVars
ConVar weapon_laserdesignator_range( "weapon_laserdesignator_range","2048", FCVAR_REPLICATED, "Laser Designator maximum range" );
ConVar weapon_limpetmine_max_deployed( "weapon_limpetmine_max_deployed","0", FCVAR_REPLICATED, "Maximum number of Limpet Mines that can be deployed at a single time" );
ConVar weapon_limpetmine_max_distance_off_trace( "weapon_limpetmine_max_distance_off_trace","25", FCVAR_REPLICATED, "Maximum distance off of the trace that a limpet can be." );
IMPLEMENT_NETWORKCLASS_ALIASED( WeaponLimpetmine, DT_WeaponLimpetmine )
BEGIN_NETWORK_TABLE( CWeaponLimpetmine, DT_WeaponLimpetmine )
#if !defined( CLIENT_DLL )
SendPropInt( SENDINFO( m_iDeployedLimpets ), 5, SPROP_UNSIGNED ),
SendPropEHandle( SENDINFO( m_hDesignatedEntity ) ),
#else
RecvPropInt( RECVINFO( m_iDeployedLimpets ) ),
RecvPropEHandle( RECVINFO(m_hDesignatedEntity) ),
#endif
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( CWeaponLimpetmine )
DEFINE_PRED_FIELD( m_iDeployedLimpets, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_FIELD( m_hDesignatedEntity, FIELD_EHANDLE, FTYPEDESC_INSENDTABLE ),
END_PREDICTION_DATA()
LINK_ENTITY_TO_CLASS( weapon_limpetmine, CWeaponLimpetmine );
PRECACHE_WEAPON_REGISTER(weapon_limpetmine);
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CWeaponLimpetmine::CWeaponLimpetmine( void )
{
SetPredictionEligible( true );
m_hDesignatedEntity = NULL;
m_flNextBuzzTime = 0;
m_iDeployedLimpets = 0;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::Precache( void )
{
BaseClass::Precache();
#ifndef CLIENT_DLL
UTIL_PrecacheOther( "grenade_limpetmine" );
#endif
PrecacheScriptSound( "WeaponLimpetmine.Deny" );
PrecacheModel( "sprites/laserbeam.vmt" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::UpdateOnRemove( void )
{
#ifndef CLIENT_DLL
RemoveDeployedLimpets();
if ( m_hLaserDesignation )
{
UTIL_Remove( m_hLaserDesignation );
}
#endif
// Chain at end to mimic destructor unwind order
BaseClass::UpdateOnRemove();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::CleanupOnActStart( void )
{
#ifndef CLIENT_DLL
RemoveDeployedLimpets();
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CWeaponLimpetmine::GetFireRate( void )
{
return 0.5;
}
//-----------------------------------------------------------------------------
// Purpose: Limpetmine considers itself as having ammo at all times, because it contains the designator
//-----------------------------------------------------------------------------
bool CWeaponLimpetmine::HasAnyAmmo( void )
{
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Stop thinking and holster
//-----------------------------------------------------------------------------
bool CWeaponLimpetmine::Holster( CBaseCombatWeapon *pSwitchingTo )
{
StopDesignating();
return BaseClass::Holster(pSwitchingTo);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::ItemPostFrame( void )
{
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( !pPlayer )
return;
#ifndef CLIENT_DLL
// If we don't have a laser designator yet, create one
if ( !m_hLaserDesignation )
{
m_hLaserDesignation = CEnvLaserDesignation::Create( pPlayer );
}
#endif
// Is the player trying to designate?
if ( pPlayer->m_nButtons & IN_ATTACK )
{
if ( m_bDesignating )
{
#ifndef CLIENT_DLL
ActivateBeam();
#endif
}
else if ( m_flNextPrimaryAttack <= gpGlobals->curtime )
{
StartDesignating();
#ifndef CLIENT_DLL
ActivateBeam();
#endif
}
}
else if ( m_bDesignating )
{
StopDesignating();
}
else if ( (pPlayer->m_nButtons & IN_ATTACK2) && !m_flStartedLaunchingAt && (m_flNextPrimaryAttack <= gpGlobals->curtime) )
{
m_flStartedLaunchingAt = gpGlobals->curtime;
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
}
else if ( (pPlayer->m_afButtonReleased & IN_ATTACK2) && (m_flNextPrimaryAttack <= gpGlobals->curtime) && m_flStartedLaunchingAt )
{
m_flNextPrimaryAttack = gpGlobals->curtime;
PrimaryAttack();
m_flStartedLaunchingAt = 0;
}
UpdateBeamTarget();
// Always idle
WeaponIdle();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::PrimaryAttack( void )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
// Don't allow anymore limpets to be placed if we've reached the max
if ( m_iDeployedLimpets >= weapon_limpetmine_max_deployed.GetInt() )
{
#ifdef CLIENT_DLL
// We should flash the limpet mine count on the weapon at this point
CLocalPlayerFilter filter;
EmitSound( filter, entindex(), "WeaponLimpetmine.Deny" );
m_flNextBuzzTime = gpGlobals->curtime + 0.5f; // only buzz every so often.
#endif
return;
}
if ( IsOwnerEMPed() )
return;
trace_t tr;
// Get an aim vector. Don't use GetAimVector() because we don't want autoaiming.
Vector vecSrc = pPlayer->Weapon_ShootPosition( );
Vector vecAiming;
pPlayer->EyeVectors( &vecAiming );
// Calculate launch velocity (3 seconds for max distance)
float flThrowTime = MIN( (gpGlobals->curtime - m_flStartedLaunchingAt), 3.0 );
float flSpeed = 600 + (300 * flThrowTime);
vecAiming *= flSpeed;
WeaponSound( WPN_DOUBLE );
#ifndef CLIENT_DLL
ThrowLimpet( pPlayer, vecSrc, vecAiming );
#endif
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
m_flNextPrimaryAttack = gpGlobals->curtime + GetFireRate();
m_flNextSecondaryAttack = gpGlobals->curtime + GetFireRate();
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
}
#if !defined( CLIENT_DLL )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::ThrowLimpet( CBasePlayer *pPlayer, Vector vecSrc, Vector vecAiming )
{
CLimpetMine *pLimpet = CLimpetMine::Create(vecSrc, vecAiming, pPlayer);
pLimpet->SetLauncher( this );
// Increase the limpet count
m_iDeployedLimpets += 1;
}
//-----------------------------------------------------------------------------
// Purpose: Detonates all deployed limpets for this weapon
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::DetonateDeployedLimpets( void )
{
CBaseEntity *pEntity = NULL;
while ((pEntity = gEntList.FindEntityByClassname( pEntity, "grenade_limpetmine" )) != NULL)
{
CLimpetMine* pLimpet = (CLimpetMine*)pEntity;
if ( pLimpet->IsLive() && pLimpet->GetThrower() == GetOwner() )
{
pLimpet->Use( GetOwner(), this, USE_ON, 0 );
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Quietly removes all deployed limpets for this weapon
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::RemoveDeployedLimpets( void )
{
CBaseEntity *pEntity = NULL;
while ((pEntity = gEntList.FindEntityByClassname( pEntity, "grenade_limpetmine" )) != NULL)
{
CLimpetMine* pLimpet = (CLimpetMine*)pEntity;
if ( pLimpet->GetThrower() == GetOwner() )
{
pLimpet->Use( GetOwner(), this, USE_SET, 0 );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::ActivateBeam( void )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
Assert( m_pBeam );
if( m_hDesignatedEntity != NULL )
{
CBaseEntity* pEntity = m_hDesignatedEntity.Get();
// If we hit a player, and it's an enemy, tell my sentryguns to attack it
if ( pEntity->IsPlayer() && !pPlayer->InSameTeam(pEntity) )
{
DesignateSentriesToAttack( pEntity );
}
else if ( pEntity->GetFlags() & FL_NPC )
{
// If it's an enemy NPC, tell my sentryguns to attack it
if ( !pPlayer->InSameTeam( pEntity ) )
{
DesignateSentriesToAttack( pEntity );
}
}
else
{
// Is it a sentrygun? If so, tell it to toggle it's sunken state.
if ( pEntity->Classify() == CLASS_MILITARY )
{
CObjectSentrygun *pSentry = dynamic_cast<CObjectSentrygun *>(pEntity);
if ( pSentry && pSentry->GetBuilder() == pPlayer )
{
pSentry->ToggleTurtle();
return;
}
else
{
// If it's an enemy object, tell my sentryguns to attack it
if ( !pPlayer->InSameTeam( pEntity ) )
{
DesignateSentriesToAttack( pEntity );
return;
}
}
}
// Is it a limpet mine? If so, detonate it
CLimpetMine *pLimpet = dynamic_cast<CLimpetMine *>(pEntity);
if ( pLimpet && pLimpet->IsLive() && pLimpet->GetThrower() == pPlayer )
{
pLimpet->Use( pPlayer, this, USE_ON, 0 );
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Return true if the specified entity is a valid one for designation
//-----------------------------------------------------------------------------
bool CWeaponLimpetmine::ValidDesignationTarget( CBaseEntity *pEntity )
{
if( !pEntity )
return false;
// Ignore the world
if ((!pEntity) || ( pEntity->entindex() == 0 ))
return false;
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
Assert(pPlayer);
if(!pPlayer)
return false;
// Ignore players on my team
if ( pEntity->IsPlayer() )
{
if( pEntity->InSameTeam(GetOwner()) )
return false;
else
return true;
}
// can either target my own sentry guns to turtle, or enemy buildings to target for sentries:
if ( pEntity->Classify() == CLASS_MILITARY )
{
// Is it a sentry gun I built?
if ( dynamic_cast<CObjectSentrygun *>(pEntity) && ((CObjectSentrygun*)pEntity)->GetBuilder() == pPlayer )
{
return true;
}
// Is it an enemy object?
else if ( !pPlayer->InSameTeam( pEntity ) )
{
return true;
}
}
// My limpet mines are valid
CLimpetMine *pLimpet = dynamic_cast<CLimpetMine *>(pEntity);
if ( pLimpet && pLimpet->IsLive() && pLimpet->GetThrower() == GetOwner() )
return true;
// NPCs are valid
if ( pEntity->GetFlags() & FL_NPC )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Set the player's sentryguns to all attack the specified target
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::DesignateSentriesToAttack( CBaseEntity *pEntity )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
// Tell all this player's sentryguns
for ( int i = 0; i < pPlayer->GetObjectCount(); i++ )
{
CBaseObject *pObj = pPlayer->GetObject(i);
if ( !pObj )
continue;
if ( pObj->IsSentrygun() )
{
CObjectSentrygun *pSentry = static_cast<CObjectSentrygun *>(pObj);
pSentry->DesignateTarget( pEntity );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseEntity* CWeaponLimpetmine::GetDesignatedEntity( CBaseTFPlayer *pPlayer )
{
// Construct the start and end vectors.
Vector vecSrc = pPlayer->Weapon_ShootPosition( );
Vector vecAiming;
pPlayer->EyeVectors( &vecAiming );
Vector vecEnd = vecSrc + vecAiming * weapon_laserdesignator_range.GetFloat();
float fBestDistanceSq = FLT_MAX;
CBaseEntity* pBestEntity = NULL;
float fMaxDist = weapon_limpetmine_max_distance_off_trace.GetFloat();
float fMaxDistSq = fMaxDist * fMaxDist;
// Check all limpets against a cylinder:
if( CLimpetMine::allLimpets )
{
for ( CLimpetMine *pLimpet = CLimpetMine::allLimpets ;pLimpet; pLimpet = pLimpet->nextLimpet)
{
// Find the closest limpet to the center of the cylinder:
if( pLimpet->IsLive() && pLimpet->GetThrower() != NULL && pLimpet->GetThrower() == pPlayer )
{
Vector vecNearestPoint = PointOnLineNearestPoint( vecSrc, vecEnd, pLimpet->GetAbsOrigin() );
float fDistSq = ( pLimpet->GetAbsOrigin() - vecNearestPoint ).LengthSqr();
if (( fDistSq > fMaxDistSq ) || ( fDistSq >= fBestDistanceSq ))
continue;
if (TFGameRules()->IsBlockedByEnemyShields( vecSrc, pLimpet->GetAbsOrigin(), GetOwner()->GetTeamNumber() ))
continue;
pBestEntity = pLimpet;
fBestDistanceSq = fDistSq;
}
}
if( pBestEntity )
return pBestEntity;
}
// Check to see if we are designating a combat object:
for ( int i = 0; i < pPlayer->GetObjectCount(); i++ )
{
CBaseObject *pObj = pPlayer->GetObject(i);
if ( !pObj || !pObj->IsSentrygun() )
continue;
Vector vecObjCenter = pObj->WorldSpaceCenter();
Vector vecNearestPoint = PointOnLineNearestPoint( vecSrc, vecEnd, vecObjCenter );
float fDistSq = ( vecObjCenter - vecNearestPoint ).LengthSqr();
if (( fDistSq > fMaxDistSq ) || ( fDistSq >= fBestDistanceSq ))
continue;
if (TFGameRules()->IsBlockedByEnemyShields( vecSrc, vecObjCenter, GetOwner()->GetTeamNumber() ))
continue;
pBestEntity = pObj;
fBestDistanceSq = fDistSq;
}
// Valid or NULL
return pBestEntity;
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::WeaponIdle( void )
{
if ( HasWeaponIdleTimeElapsed() )
{
if ( m_bDesignating || m_flStartedLaunchingAt )
{
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
}
else
{
SendWeaponAnim( ACT_VM_IDLE );
}
SetWeaponIdleTime( gpGlobals->curtime + 0.2 );
}
}
//-----------------------------------------------------------------------------
// Purpose: Start designating with the laser
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::StartDesignating( void )
{
m_bDesignating = true;
// Add myself to the designated target list
Vector vecOrigin(0,0,0);
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
#ifndef CLIENT_DLL
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
if ( !m_pBeam )
{
m_pBeam = CBeam::BeamCreate( "sprites/laserbeam.vmt", 5 );
m_pBeam->PointEntInit( vec3_origin, this );
m_pBeam->SetEndAttachment( 1 );
m_pBeam->SetColor( 255, 32, 32 );
m_pBeam->SetBrightness( 255 );
m_pBeam->SetNoise( 0 );
m_pBeam->SetWidth( 0.5 );
m_pBeam->SetEndWidth( 0.5 );
}
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Stop designating with the laser
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::StopDesignating( void )
{
SendWeaponAnim( ACT_VM_IDLE );
m_bDesignating = false;
#ifndef CLIENT_DLL
if ( m_pBeam )
{
UTIL_Remove( m_pBeam );
m_pBeam = NULL;
}
if ( m_hLaserDesignation )
{
m_hLaserDesignation->SetActive( false );
}
// Remove any designated target:
m_hDesignatedEntity.Set( NULL );
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Update the beam position and do designator functions
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::UpdateBeamTarget()
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
// "Fire" the designator beam
Vector vecSrc = pPlayer->Weapon_ShootPosition( );
Vector vecAiming;
pPlayer->EyeVectors( &vecAiming );
Vector vecEnd = vecSrc + vecAiming * weapon_laserdesignator_range.GetFloat();
trace_t tr;
TFGameRules()->WeaponTraceLine(vecSrc, vecEnd, MASK_SHOT, pPlayer, DMG_PROBE, &tr);
// Only update our designated target point if we hit something
#ifndef CLIENT_DLL
if ( tr.fraction != 1.0 && m_bDesignating )
{
m_hLaserDesignation->SetActive( true );
m_hLaserDesignation->SetAbsOrigin( tr.endpos );
}
else
{
m_hLaserDesignation->SetActive( false );
}
// Update beam visual
if( m_pBeam )
{
m_pBeam->SetStartPos( tr.endpos );
m_pBeam->RelinkBeam();
}
CBaseEntity* pEntity= NULL;
// Perform designator functions
// Did we hit something?
//pEntity = CBaseEntity::Instance( tr.u.ent );
// If we hit a target we don't care about, try and grab the nearest valid target to our crosshair
//if ( !ValidDesignationTarget( pEntity ) )
{
// Get the designated entity, ignoring trace information:
pEntity = GetDesignatedEntity( pPlayer );
if( !ValidDesignationTarget( pEntity ) )
{
m_hDesignatedEntity.Set( NULL );
return;
}
}
// We have a valid entity, light it up.
m_hDesignatedEntity.Set( pEntity );
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponLimpetmine::DecrementLimpets( void )
{
#ifndef CLIENT_DLL
if ( m_iDeployedLimpets )
{
m_iDeployedLimpets -= 1;
}
#endif
}
#ifdef CLIENT_DLL
//-----------------------------------------------------------------------------
// Purpose: Limpet mine's always selectable, because the laser designator can always fire
//-----------------------------------------------------------------------------
bool C_WeaponLimpetmine::CanBeSelected( void )
{
return true;
}
void C_WeaponLimpetmine::PreDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PreDataUpdate( updateType );
m_hOldDesignatedEntity = m_hDesignatedEntity;
}
void C_WeaponLimpetmine::PostDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PostDataUpdate( updateType );
if ( GetOwner() == C_BaseTFPlayer::GetLocalPlayer() )
{
// Old target isn't valid anymore, so reset it's render properties
if ( m_hOldDesignatedEntity.Get() && m_hOldDesignatedEntity != m_hDesignatedEntity )
{
m_hOldDesignatedEntity->m_nRenderFX = m_eDesignatedEntityOriginalRenderFx;
m_hOldDesignatedEntity->SetRenderMode( (RenderMode_t)m_eDesignatedEntityOriginalRenderMode );
}
// New target? Set it's render properties
if ( m_hDesignatedEntity != NULL && m_hOldDesignatedEntity != m_hDesignatedEntity )
{
// Store off original info for designated entity
m_eDesignatedEntityOriginalRenderFx = m_hDesignatedEntity->m_nRenderFX;
m_eDesignatedEntityOriginalRenderMode = m_hDesignatedEntity->GetRenderMode();
// Set up alpha blended pulsefast renderer
m_hDesignatedEntity->m_nRenderFX = kRenderFxPulseFastWider;
m_hDesignatedEntity->SetRenderMode( kRenderTransAlpha );
}
}
}
#endif
|