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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// nav.h
// Data structures and constants for the Navigation Mesh system
// Author: Michael S. Booth ([email protected]), January 2003
#ifndef _CS_NAV_H_
#define _CS_NAV_H_
#include "nav.h"
/**
* Below are several constants used by the navigation system.
* @todo Move these into TheNavMesh singleton.
*/
const float BotRadius = 10.0f; ///< circular extent that contains bot
class CNavArea;
class CSNavNode;
#if 0
//--------------------------------------------------------------------------------------------------------------
/**
* Return true if given entity can be ignored when moving
*/
#define WALK_THRU_DOORS 0x01
#define WALK_THRU_BREAKABLES 0x02
#define WALK_THRU_TOGGLE_BRUSHES 0x04
#define WALK_THRU_EVERYTHING (WALK_THRU_DOORS | WALK_THRU_BREAKABLES | WALK_THRU_TOGGLE_BRUSHES)
inline bool IsEntityWalkable( CBaseEntity *entity, unsigned int flags )
{
if (FClassnameIs( entity, "worldspawn" ))
return false;
if (FClassnameIs( entity, "player" ))
return false;
// if we hit a door, assume its walkable because it will open when we touch it
if (FClassnameIs( entity, "prop_door*" ) || FClassnameIs( entity, "func_door*" ))
return (flags & WALK_THRU_DOORS) ? true : false;
// if we hit a clip brush, ignore it if it is not BRUSHSOLID_ALWAYS
if (FClassnameIs( entity, "func_brush" ))
{
CFuncBrush *brush = (CFuncBrush *)entity;
switch ( brush->m_iSolidity )
{
case CFuncBrush::BRUSHSOLID_ALWAYS:
return false;
case CFuncBrush::BRUSHSOLID_NEVER:
return true;
case CFuncBrush::BRUSHSOLID_TOGGLE:
return (flags & WALK_THRU_TOGGLE_BRUSHES) ? true : false;
}
}
// if we hit a breakable object, assume its walkable because we will shoot it when we touch it
if (FClassnameIs( entity, "func_breakable" ) && entity->GetHealth() && entity->m_takedamage == DAMAGE_YES)
return (flags & WALK_THRU_BREAKABLES) ? true : false;
if (FClassnameIs( entity, "func_breakable_surf" ) && entity->m_takedamage == DAMAGE_YES)
return (flags & WALK_THRU_BREAKABLES) ? true : false;
return false;
}
#endif
#endif // _CS_NAV_H_
|