-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaiactlch.h
162 lines (118 loc) · 3.86 KB
/
aiactlch.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
/*
@Copyright Looking Glass Studios, Inc.
1996,1997,1998,1999,2000 Unpublished Work.
*/
///////////////////////////////////////////////////////////////////////////////
// $Header: r:/t2repos/thief2/src/ai/aiactlch.h,v 1.10 1999/06/10 16:24:55 JON Exp $
//
// AI Action - launch a projectile
//
#ifndef __AIACTLCH_H
#define __AIACTLCH_H
#include <aiapiiai.h>
#include <aibasact.h>
#pragma once
#pragma pack(4)
///////////////////////////////////////////////////////////////////////////////
//
// CLASS: cAILaunchAction
//
// Launch a projectile from an AI
//
typedef int eAILaunchActionFlags;
enum eAILaunchActionFlags_ {kAILA_HeadingTolerance = 0x0001,};
class cAILaunchAction : public cAIAction
{
public:
cAILaunchAction(IAIActor * pOwner, DWORD data = 0);
cAILaunchAction(IAI *pAI, void *netmsg);
~cAILaunchAction();
void Set(ObjID target, ObjID projectile, BOOL lead_target, int accuracy,
int launch_count, int launch_joint);
void Set(const cMxsVector &target, ObjID projectile, int accuracy,
int launch_count, int launch_joint);
void Set(ObjID target, int targetSubModel, ObjID projectile, BOOL lead_target, int accuracy,
int launch_count, int launch_joint);
void SetProjectile(ObjID projectile);
void SetHeadingTolerance(floatang epsilon);
// Accessors to paramters
ObjID GetTargetObj() const;
const cMxsVector * GetTargetLoc() const;
ObjID GetProjectile() const;
BOOL DoLeadTarget() const;
int GetAccuracy() const;
int GetLaunchCount() const;
// Enact firing in a network proxy (no action exists).
static void EnactFire(IAI *pAI, void *pMsg);
// Update the action
STDMETHOD_(eAIResult, Update)();
// Start the action
STDMETHOD_(eAIResult, Enact)(ulong deltaTime);
private:
// Called by Enact & EnactFire. Doesn't require that a launch action exist.
static void Fire(ObjID AIObj, mxs_vector start_loc, mxs_vector dir, ObjID projectile);
void BroadcastAction(mxs_vector start_loc, mxs_vector dir);
eAILaunchActionFlags m_flags;
ObjID m_targetObj;
int m_targetSubModel;
cMxsVector m_targetLoc;
ObjID m_projectile;
BOOL m_leadTarget;
int m_accuracy;
int m_launchCount;
int m_launchJoint;
floatang m_headingEpsilon;
};
////////////////////////////////////////
inline cAILaunchAction::cAILaunchAction(IAIActor * pOwner, DWORD data)
: cAIAction(kAIAT_Launch, pOwner, data),
m_targetObj(OBJ_NULL),
m_targetLoc(0, 0, 0),
m_projectile(OBJ_NULL),
m_leadTarget(FALSE),
m_flags(0)
{
}
////////////////////////////////////////
inline void cAILaunchAction::SetProjectile(ObjID projectile)
{
m_projectile = projectile;
}
////////////////////////////////////////
inline void cAILaunchAction::SetHeadingTolerance(floatang epsilon)
{
m_flags |= kAILA_HeadingTolerance;
m_headingEpsilon = epsilon;
}
////////////////////////////////////////
inline ObjID cAILaunchAction::GetTargetObj() const
{
return m_targetObj;
}
////////////////////////////////////////
inline const cMxsVector * cAILaunchAction::GetTargetLoc() const
{
return &m_targetLoc;
}
////////////////////////////////////////
inline ObjID cAILaunchAction::GetProjectile() const
{
return m_projectile;
}
////////////////////////////////////////
inline BOOL cAILaunchAction::DoLeadTarget() const
{
return m_leadTarget;
}
////////////////////////////////////////
inline int cAILaunchAction::GetAccuracy() const
{
return m_accuracy;
}
////////////////////////////////////////
inline int cAILaunchAction::GetLaunchCount() const
{
return m_launchCount;
}
#pragma pack()
#endif /* !__AIACTLCH */