2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/motion/motschem.h,v 1.6 2000/01/31 09:51:03 adurant Exp $
10 // This header contains class interface for motion schemas and
11 // motion schema sets.
13 // They are the return values from queries to the motion database, and can
14 // be used to generate motion plans.
24 #include <motset.h> // for sMotStuff
29 #define kMotSchemaID_Invalid -1
31 #define kMSchFlag_ArchObjSwizzle 0x1
32 #define kMSchFlag_FixedDuration 0x2
33 #define kMSchFlag_TimeWarp 0x4
34 #define kMSchFlag_Stretch 0x8
35 #define kMSchFlag_FixedDist 0x10
37 // these are the atomic units of the motion database, and the thing from
38 // which the motion system builds its plans.
39 // It's up to the app to associate data with the schema's archetype, and
40 // to know how to access that data
49 // returns motion handle for a random motion in schema
50 BOOL
GetRandomMotion(int *pMotID
) const;
51 BOOL
GetRandomMotionInRange(int min
, int max
, int *pMotID
) const;
52 BOOL
GetMotion(int offset
, int *pMotID
) const;
54 void SetDuration(float duration
);
55 void SetTimeWarp(float timeWarp
);
56 void SetDistance(float distance
);
57 void SetStretch(float timeWarp
);
58 BOOL
GetDuration(float *pDuration
) const;
59 BOOL
GetTimeWarp(float *pTimeWarp
) const;
60 BOOL
GetDistance(float *pDist
) const;
61 BOOL
GetStretch(float *pStretch
) const;
63 int NumMotions() const { return m_MotRunHandleList
.Size(); }
65 ObjID
GetArchetype() const { return m_ArchObj
; }
67 int GetIndex() const { return m_ArchIndex
; }
69 int GetSchemaID() const { return m_SchemaID
; }
70 void SetSchemaID(int id
) { m_SchemaID
= id
; }
72 ulong
GetFlags() const { return m_Flags
; }
73 void SetFlags(ulong flags
) { m_Flags
=flags
; }
76 BOOL
Save(ITagFile
*pFile
);
77 BOOL
Load(ITagFile
*pFile
, cNameMap
*pNameMap
);
78 void SetupRunTimeData(cNameMap
*pNameMap
);
81 void AddMotion(const Label
*name
, const sMotStuff
*pStuff
);
82 void SetArchetype(int index
); // index into name map provided by EndBuild and Load
91 cDynArray
<int> m_MotIndexList
;
92 cDynArray
<int> m_MotRunHandleList
;
95 inline void cMotionSchema::SetDuration(float duration
)
97 if(m_Flags
&kMSchFlag_TimeWarp
)
98 m_Flags
&=(~kMSchFlag_TimeWarp
);
99 m_Flags
|=kMSchFlag_FixedDuration
;
100 m_TimeModifier
=duration
;
103 inline void cMotionSchema::SetTimeWarp(float timeWarp
)
105 if(m_Flags
&kMSchFlag_FixedDuration
)
106 m_Flags
&=(~kMSchFlag_FixedDuration
);
107 m_Flags
|=kMSchFlag_TimeWarp
;
108 m_TimeModifier
=timeWarp
;
111 inline void cMotionSchema::SetDistance(float dist
)
113 if(m_Flags
&kMSchFlag_Stretch
)
114 m_Flags
&=(~kMSchFlag_Stretch
);
115 m_Flags
|=kMSchFlag_FixedDist
;
119 inline void cMotionSchema::SetStretch(float stretch
)
121 if(m_Flags
&kMSchFlag_FixedDist
)
122 m_Flags
&=(~kMSchFlag_FixedDist
);
123 m_Flags
|=kMSchFlag_Stretch
;
124 m_DistModifier
=stretch
;
127 inline BOOL
cMotionSchema::GetDuration(float *pDuration
) const
129 if(m_Flags
&kMSchFlag_FixedDuration
)
131 *pDuration
=m_TimeModifier
;
137 inline BOOL
cMotionSchema::GetTimeWarp(float *pTimeWarp
) const
139 if(m_Flags
&kMSchFlag_TimeWarp
&& !(m_Flags
&kMSchFlag_FixedDuration
))
141 *pTimeWarp
=m_TimeModifier
;
147 inline BOOL
cMotionSchema::GetDistance(float *pDist
) const
149 if(m_Flags
&kMSchFlag_FixedDist
)
151 *pDist
=m_DistModifier
;
157 inline BOOL
cMotionSchema::GetStretch(float *pStretch
) const
159 if(m_Flags
&kMSchFlag_Stretch
&& !(m_Flags
&kMSchFlag_FixedDist
))
161 *pStretch
=m_DistModifier
;
167 typedef cDynClassArray
<cMotionSchema
> cMotionSchemaSet
;
169 typedef cDynArray
<cMotionSchema
*> cMotionSchemaPtrList
;