28#elif defined(CGAME_DLL)
29# include "script/canimate.h"
34extern Event EV_SetAnim;
35extern Event EV_SetSyncTime;
39#define ANIM_FINISHED 4
41#define ANIM_NODELTA 16
43#define ANIM_NOACTION 64
45#define MINIMUM_DELTA_MOVEMENT 8
46#define MINIMUM_DELTA_MOVEMENT_PER_FRAME (MINIMUM_DELTA_MOVEMENT / 20.0f)
48#define FLAGGED_ANIMATE_SLOT 20
54class Animate :
public Entity
57 int animFlags[MAX_FRAMEINFOS];
64 Event *doneEvents[MAX_FRAMEINFOS];
66 float animtimes[MAX_FRAMEINFOS];
67 float frametimes[MAX_FRAMEINFOS];
74 CLASS_PROTOTYPE(Animate);
79 void NewAnim(
int animnum,
int slot = 0,
float weight = 1.0f);
80 void NewAnim(
int animnum,
Event *endevent,
int slot = 0,
float weight = 1.0f);
81 void NewAnim(
int animnum,
Event &endevent,
int slot = 0,
float weight = 1.0f);
82 void NewAnim(
const char *animname,
int slot = 0,
float weight = 1.0f);
83 void NewAnim(
const char *animname,
Event *endevent,
int slot = 0,
float weight = 1.0f);
84 void NewAnim(
const char *animname,
Event &endevent,
int slot = 0,
float weight = 1.0f);
86 qboolean HasAnim(
const char *animname);
87 Event *AnimDoneEvent(
int slot = 0);
88 void SetAnimDoneEvent(
Event &event,
int slot = 0);
89 void SetAnimDoneEvent(
Event *event,
int slot = 0);
91 const char *AnimName(
int slot = 0);
92 float AnimTime(
int slot = 0);
94 int CurrentAnim(
int slot = 0)
const override;
95 float CurrentTime(
int slot = 0)
const override;
97 void Archive(
Archiver &arc)
override;
98 virtual void AnimFinished(
int slot = 0);
100 void PreAnimate(
void)
override;
101 void PostAnimate(
void)
override;
102 void SetTime(
int slot = 0,
float time = 0.0f);
103 void SetNormalTime(
int slot = 0,
float normal = 1.0f);
104 float GetTime(
int slot = 0);
105 float GetNormalTime(
int slot = 0);
106 void SetWeight(
int slot = 0,
float weight = 1.0f);
107 float GetWeight(
int slot = 0);
108 void SetRepeatType(
int slot = 0);
109 void SetOnceType(
int slot = 0);
110 bool IsRepeatType(
int slot);
111 void Pause(
int slot = 0,
int pause = 1);
112 void StopAnimating(
int slot = 0);
113 void UseSyncTime(
int slot,
int sync);
114 void SetSyncTime(
float s);
116 void SetSyncRate(
float rate);
119 void PauseSyncTime(
int pause);
120 float GetYawOffset();
121 float GetCrossTime(
int slot);
123 void DoExitCommands(
int slot = 0);
124 void ForwardExec(
Event *ev);
125 void EventSetSyncTime(
Event *ev);
126 void EventIsLoopingAnim(
Event *ev);
127 void EventSetYawFromBone(
Event *ev);
128 void EventPlayerSpawn(
Event *ev);
129 void EventPlayerSpawnUtility(
Event *ev);
130 void EventPauseAnim(
Event *ev);
131 virtual void DumpAnimInfo();
132 void SlotChanged(
int slot);
134 void ClientSound(
Event *ev);
137 int NumFrames(
int slot = 0);
140inline void Animate::SetWeight(
int slot,
float weight)
142 edict->s.frameInfo[slot].weight = weight;
145inline float Animate::GetWeight(
int slot)
147 return edict->s.frameInfo[slot].weight;
150inline bool Animate::IsRepeatType(
int slot)
152 return (animFlags[slot] & ANIM_LOOP) != 0;
155inline float Animate::GetSyncTime()
160inline float Animate::GetSyncRate()
165inline void Animate::PauseSyncTime(
int pause)
167 pauseSyncTime = pause;
170inline void Animate::Archive(
Archiver& arc)
174 Entity::Archive(arc);
176 for (i = 0; i < MAX_FRAMEINFOS; i++) {
177 arc.ArchiveInteger(&animFlags[i]);
179 arc.ArchiveFloat(&syncTime);
180 arc.ArchiveFloat(&syncRate);
181 arc.ArchiveInteger(&pauseSyncTime);
182 arc.ArchiveBool(&is_paused);
183 for (i = 0; i < MAX_FRAMEINFOS; i++) {
184 arc.ArchiveEventPointer(&doneEvents[i]);
186 for (i = 0; i < MAX_FRAMEINFOS; i++) {
187 arc.ArchiveFloat(&animtimes[i]);
189 for (i = 0; i < MAX_FRAMEINFOS; i++) {
190 arc.ArchiveFloat(&frametimes[i]);
192 arc.ArchiveVector(&frame_delta);
193 arc.ArchiveFloat(&angular_delta);
196inline void Animate::SlotChanged(
int slot)
198 animFlags[slot] = (animFlags[slot] | ANIM_NODELTA) & ~ANIM_FINISHED;
201inline float Animate::CurrentTime(
int slot)
const
203 return edict->s.frameInfo[slot].time;
206inline Event *Animate::AnimDoneEvent(
int slot)
208 return doneEvents[slot];
211inline int Animate::NumFrames(
int slot)
213 return gi.Anim_NumFrames(edict->tiki, edict->s.frameInfo[slot].index);
Definition listener.h:246