16 std::vector<float> times;
25 int GetValidIndex(
int nPos){
42 times.push_back(fTime);
53 if(nPos<0 || nPos >=
GetSize() )
59 times.insert(times.begin()+nPos, fTime);
60 data.insert(data.begin()+nPos, key);
67 int nEndIndex = times.size()-1;
69 return times[nEndIndex];
80 nIndex = GetValidIndex(nIndex);
81 times[nIndex] = fTime;
91 std::vector<float>::iterator iterFrom, iterTo = times.end();
93 iterFrom = iterTo - nNum;
95 iterFrom = times.begin();
96 times.erase(iterFrom, iterTo);
99 typename std::vector<T>::iterator iterFrom, iterTo = data.end();
101 iterFrom = iterTo - nNum;
103 iterFrom = data.begin();
104 data.erase(iterFrom, iterTo);
109 return data[GetValidIndex(nIndex)];
115 return times[GetValidIndex(nIndex)];
137 return data[GetValidIndex(m_nPos+nShiftPos)];
149 for(
int i=0;i<nLen && !bFound;i++) {
150 float fFrom =
time(nPos-1);
151 float fTo =
time(nPos);
154 if(fFrom<= fTime && fTime<fTo)
162 else if(fFrom>fTime){
192 bool bRewind =
false;
193 for(
int i=0;i<nLen && !bFound;i++) {
194 float fFrom =
time(nPos-1);
195 float fTo =
time(nPos);
198 if(fFrom<= fTimeElapsed && fTimeElapsed<fTo)
200 else if(fTo<=fTimeElapsed){
206 else if(fFrom>fTimeElapsed){
237 return nEndPos - nPos;
246 PosKey(
float x,
float y,
float z,
float facing):vPos(x,y,z), fFacing(facing){};
247 PosKey(
const DVector3& v,
float facing):vPos(v), fFacing(facing){};
267 CameraKey(
float rotY,
float LiftUpAngle,
float Dist):fRotY(rotY), fLiftUpAngle(LiftUpAngle), fDist(Dist){};
278 EffectKey(
int effectid,
const string& target);
279 EffectKey(
int effectid,
const char* target);
291 const static int MAX_ACTIONNAME_LEN = 16;
308 const char* ToString()
const;
316 int ToAnimID()
const;
321 bool IsToggleToWalk()
const;
323 bool IsToggleToRun()
const;
325 bool IsMount()
const;
float time(int nIndex)
get the time.
Definition: KeyFrame.h:114
void SetPos(int nPos)
set the current position.
Definition: KeyFrame.h:126
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
int GetPos()
get the current position.
Definition: KeyFrame.h:121
string sTarget
target name, it can a global biped name or <AttachmentID>.
Definition: KeyFrame.h:276
string sDialog
format: "sentence": speak the sentence in the background "\say sentence": tell the current player to ...
Definition: KeyFrame.h:257
refer to autocamera
Definition: KeyFrame.h:262
key for actions and animations.
Definition: KeyFrame.h:289
int GetSize()
Get the number of key frames.
Definition: KeyFrame.h:131
different physics engine has different winding order.
Definition: EventBinding.h:32
int GetKeyIndexByTime(float fTime)
NOT TESTED: get the index nPos of the key frame, where time[nPos-1]<=fTime<time[nPos] a binary search...
Definition: KeyFrame.h:144
void InsertNewKey(float fTime, const T &key)
NOT TESTED: Insert a new key to the key frame list according to the time.
Definition: KeyFrame.h:50
dialog key for movie
Definition: KeyFrame.h:250
void UpdateKeyFrame(int nIndex, float fTime, const T &key)
update a key frame value is boundary safe.
Definition: KeyFrame.h:78
T & GetRelative(int nShiftPos=0)
get the data at current position + nShiftPos.
Definition: KeyFrame.h:136
int nEffectID
effect ID in the effect database
Definition: KeyFrame.h:273
Definition: KeyFrame.h:242
the missile and magic effect movie key frame.
Definition: KeyFrame.h:270
void PopKeyFrame(int nNum)
pop a specified number of key frames from the end of the key frames
Definition: KeyFrame.h:87
int UpdateTime(float &fTimeElapsed)
update the current time position by a given time in seconds.the current time position may not be the ...
Definition: KeyFrame.h:188
float GetEndingTime()
get the ending time
Definition: KeyFrame.h:65
T & operator[](int nIndex)
indexer
Definition: KeyFrame.h:108
void AppendNewKey(float fTime, const T &key)
append a new key to the end of the key frame list
Definition: KeyFrame.h:40
Generic movie key frame class: T is the data type stored in the key frame.
Definition: KeyFrame.h:13
int TrimToTime(float fTimeElapsed)
trim the key frames to the specified time.
Definition: KeyFrame.h:230