blob: 73d29c528b7b2332d33d18473c8934153a0ad35a (
plain) (
blame)
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "func_ladder.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: A transient entity used to construct a true CFuncLadder
// FIXME: THIS ENTITY IS OBSOLETE NOW, SHOULD BE REMOVED FROM HERE AND .FGD AT SOME POINT!!!
//-----------------------------------------------------------------------------
class CFuncLadderEndPoint : public CBaseEntity
{
public:
DECLARE_CLASS( CFuncLadderEndPoint, CBaseEntity );
virtual void Activate();
private:
bool Validate();
};
LINK_ENTITY_TO_CLASS( func_ladderendpoint, CFuncLadderEndPoint );
void CFuncLadderEndPoint::Activate()
{
BaseClass::Activate();
if ( IsMarkedForDeletion() )
return;
Validate();
}
bool CFuncLadderEndPoint::Validate()
{
// Find the the other end
Vector startPos = GetAbsOrigin();
CFuncLadderEndPoint *other = dynamic_cast< CFuncLadderEndPoint * >( GetNextTarget() );
if ( !other )
{
DevMsg( 1, "func_ladderendpoint(%s) without matching target\n", GetEntityName().ToCStr() );
return false;
}
Vector endPos = other->GetAbsOrigin();
CFuncLadder *ladder = ( CFuncLadder * )CreateEntityByName( "func_useableladder" );
if ( ladder )
{
ladder->SetEndPoints( startPos, endPos );
ladder->SetAbsOrigin( GetAbsOrigin() );
ladder->SetParent( GetParent() );
ladder->SetName( GetEntityName() );
ladder->Spawn();
}
// Delete both endpoints
UTIL_Remove( other );
UTIL_Remove( this );
return true;
}
|