2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/ai/aimovsug.h,v 1.4 1998/10/03 10:30:40 TOML Exp $
9 // Movement suggestions: the heart of the locomotion movement suggestion
22 struct sAIMoveSuggestion
;
24 ///////////////////////////////////////////////////////////////////////////////
29 enum eAIMoveSuggKindEnum
31 // Suggestion is an idle action
34 // Suggestion is a normal locomotion
37 // Suggestion is a combat maneuver
40 // Suggestion is an object avoidance/attraction
43 // Suggestion is an danger avoidance
46 kAIMS_InMax
= 0xffffffff
49 typedef unsigned eAIMoveSuggKind
;
51 ///////////////////////////////////////
58 // Face direction of movement
61 // Face the ultimate destination
64 // Face an alternative position
67 // Face a specific direction
70 kAIF_TypeMax
=0xffffffff // force it use an int
73 ///////////////////////////////////////
75 enum eAISuggestionFlags
77 // Is it a regulation suggestion, as opposed to a positive ability-driven one?
78 kAISF_IsRegulation
= 0x01,
81 ///////////////////////////////////////////////////////////////////////////////
83 // FUNCTION: AIComputeWeightedBias
85 // For any given suggestion, the creator assigns a 0-100 rating
86 // indicating confidence about the NEED for the suggestion. This function
87 // weighs the suggestion relative to other suggestions, based on
88 // the kind of suggestion it is
91 int AIComputeWeightedBias(eAIMoveSuggKind kind
, int baseBias
);
93 ///////////////////////////////////////////////////////////////////////////////
95 // CLASS: cAIMoveSuggestions
97 // @Note (toml 03-31-98): Suggestions are always owned and cleaned up by suggestor
100 class cAIMoveSuggestions
: public cDynArray_
<sAIMoveSuggestion
*, 2>
103 cAIMoveSuggestions();
105 void Add(const cAIMoveSuggestions
&);
110 ///////////////////////////////////////////////////////////////////////////////
120 float ang
; // if kAIF_SpecificDir
121 mxs_vector pos
; // if kAIF_AltPos
125 ///////////////////////////////////////////////////////////////////////////////
127 // STRUCT: sAIMoveGoal
129 // This is the lowest-level instantaneous movement goal of an AI in motion,
130 // the result of boiling down of numerous movement suggestions
137 // The goal direction, 0 = east
140 // The final goal of the movement process, if any
143 // Facing requirements
146 // How fast should we move
149 // @TBD (toml 03-26-98): Tags?
152 ///////////////////////////////////////////////////////////////////////////////
154 // STRUCT: sAIMoveSuggestion
157 struct sAIMoveSuggestion
160 sAIMoveSuggestion(const sAIMoveSuggestion
&);
162 // Set the kind and weighted bias
163 void SetWeightedBias(eAIMoveSuggKind newKind
, int newBias
);
165 // The kind of the suggestion
166 eAIMoveSuggKind kind
;
168 // Suggestion bias (-100%..+100%)
174 // The goal direction, 0 = east
177 // The final goal of the movement process, if any
180 // Facing requirements
183 // How fast should we move
186 // @TBD (toml 03-26-98): Tags?
189 ///////////////////////////////////////////////////////////////////////////////
191 inline cAIMoveSuggestions::cAIMoveSuggestions()
195 ///////////////////////////////////////
197 inline void cAIMoveSuggestions::Add(const cAIMoveSuggestions
& from
)
201 const int oldSize
= Size();
203 memcpy(AsPointer() + oldSize
, from
.AsPointer(), sizeof(sAIMoveSuggestion
*) * from
.Size());
207 ///////////////////////////////////////
209 inline void cAIMoveSuggestions::DestroyAll()
211 for (int i
= 0; i
< Size(); i
++)
213 delete (AsPointer()[i
]);
218 ///////////////////////////////////////////////////////////////////////////////
220 inline sAIMoveGoal::sAIMoveGoal()
222 memset(this, 0, sizeof(sAIMoveGoal
));
225 ///////////////////////////////////////////////////////////////////////////////
227 inline sAIMoveSuggestion::sAIMoveSuggestion()
229 memset(this, 0, sizeof(sAIMoveSuggestion
));
232 ///////////////////////////////////////
234 inline sAIMoveSuggestion::sAIMoveSuggestion(const sAIMoveSuggestion
&from
)
236 memcpy(this, &from
, sizeof(sAIMoveSuggestion
));
239 ///////////////////////////////////////
241 inline void sAIMoveSuggestion::SetWeightedBias(eAIMoveSuggKind newKind
, int newBias
)
244 bias
= AIComputeWeightedBias(kind
, newBias
);
247 ///////////////////////////////////////////////////////////////////////////////
251 #endif /* !__AIMOVSUG_H */