convert line ends
[canaan.git] / prj / cam / src / ai / aiactinv.h
blobf6d35f5be63d417ac5ad8959d856bd60afe333a8
1 /*
2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
4 */
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/ai/aiactinv.h,v 1.8 1999/11/29 12:27:12 BFarquha Exp $
8 //
9 //
11 #ifndef __AIACTINV_H
12 #define __AIACTINV_H
14 #include <aiactloc.h>
15 #include <aibasact.h>
16 #include <aiutils.h>
18 #pragma once
19 #pragma pack(4)
21 class cAIMotionAction;
22 class cAILocoAction;
23 class cAIOrientAction;
24 class cAIWanderAction;
26 ///////////////////////////////////////////////////////////////////////////////
28 // CLASS: cAIInvestAction
31 #define kAIIA_InfiniteDur INT_MAX
33 enum eAIInvestStyleFlags
35 kAIIS_InitOrient = 0x01,
36 kAIIS_InitScan = 0x02,
37 kAIIS_EndWander = 0x04,
38 kAIIS_VarSpeed = 0x08,
40 kAIAF_All = 0xffffffff
43 ///////////////////////////////////////
45 class cAIInvestAction : public cAIAction
47 public:
48 cAIInvestAction(IAIActor * pOwner, DWORD data = 0);
49 ~cAIInvestAction();
52 // Investigate a point, using an object as a hint for determining
53 // the destination cell
55 void Set(const cMxsVector & dest,
56 ObjID hintObject,
57 eAISpeed speed = kAIS_Num, // defaults based on distance
58 float accuracySq = kAILA_DefaultAccuracy,
59 float accuracyZ = kAILA_DefaultAccuracyZ);
62 // Investigate an object
64 void Set(ObjID object,
65 eAISpeed speed = kAIS_Num, // defaults based on distance
66 float accuracySq = kAILA_DefaultAccuracy,
67 float accuracyZ = kAILA_DefaultAccuracyZ);
70 // Investigate a point
72 void Set(const cMxsVector & dest,
73 eAISpeed speed = kAIS_Num, // defaults based on distance
74 float accuracySq = kAILA_DefaultAccuracy,
75 float accuracyZ = kAILA_DefaultAccuracyZ);
78 // Path near object if actually can't path to. Should occur before Set.
79 void SetNearPath(BOOL bPathNear, float fDist);
81 void SetCheckPathDist(BOOL bCheck);
84 // Flags
86 void SetStyle(unsigned flags);
87 void SetDuration(unsigned time); // set to kAIIA_InfiniteDur if want to never expire
90 // Scan settings
92 void SetScan(unsigned minScanDelay,
93 unsigned maxScanDelay);
94 void ResetScan();
95 void ForceScan();
97 BOOL IsScanning() const;
98 BOOL ReachedPoint() const;
100 const mxs_vector & GetDest() const;
102 float ComputePathDist();
104 // Update the action
105 STDMETHOD_(eAIResult, Update)();
107 // Start the action. Instantaneous actions will return result
108 STDMETHOD_(eAIResult, Enact)(ulong deltaTime);
110 private:
111 enum eState
113 kNotStarted,
114 kInitOrient,
115 kEnRoute,
116 kScanEnRoute,
117 kScanAtLoc,
119 kIntMax = 0xffffffff
122 cAILocoAction * m_pLocoAction;
123 cAIMotionAction * m_pMotionAction;
124 cAIOrientAction * m_pOrientAction;
125 cAIWanderAction * m_pWanderAction;
127 cAITimer m_expiration;
128 unsigned m_StyleFlags;
129 cAIRandomTimer m_ScanTimer;
130 cAITimer m_CheckDistTimer;
132 eState m_state;
134 float fPathNearDist;
135 BOOL m_bDoCheckDist;
138 ///////////////////////////////////////
140 // Path near object if actually can't path to.
141 inline void cAIInvestAction::SetNearPath(BOOL bPathNear, float fDist)
143 if (bPathNear)
144 fPathNearDist = fDist;
145 else
146 fPathNearDist = -1;
150 inline void cAIInvestAction::SetCheckPathDist(BOOL bCheck)
152 m_bDoCheckDist = bCheck;
156 ///////////////////////////////////////
158 inline BOOL cAIInvestAction::IsScanning() const
160 return !!m_pMotionAction;
163 ///////////////////////////////////////
165 inline BOOL cAIInvestAction::ReachedPoint() const
167 return (m_state == kScanAtLoc);
170 ///////////////////////////////////////
172 inline void cAIInvestAction::SetStyle(unsigned flags)
174 m_StyleFlags |= flags;
177 ///////////////////////////////////////
179 inline void cAIInvestAction::SetDuration(unsigned time)
181 m_expiration.Set(AICustomTime(time));
184 ///////////////////////////////////////////////////////////////////////////////
186 #pragma pack()
188 #endif /* !__AIACTINV_H */