My Project
ParaScriptingCharacter.h
1 #pragma once
2 
3 #include "ParaScriptingCommon.h"
4 #include "ParaScriptingGlobal.h"
5 #include "BipedObject.h"
6 
7 namespace ParaEngine{
8  class CBaseObject;
9  class CMovieCtrler;
10  class CSequenceCtler;
11  class CFaceTrackingCtrler;
12 }
13 namespace luabind
14 {
15  namespace adl{
16  class object;
17  }
18  using adl::object;
19 }
20 namespace ParaScripting
21 {
22  using namespace std;
23  using namespace luabind;
24  using namespace ParaEngine;
25  class ParaObject;
26 
32  class PE_CORE_DECL ParaMovieCtrler
33  {
34  public:
35  CMovieCtrler* m_pMovieCtrler; // a pointer to the object
36 
40  bool IsValid(){return m_pMovieCtrler!=NULL;}
41  public:
42  ParaMovieCtrler():m_pMovieCtrler(NULL){};
43  ParaMovieCtrler(CMovieCtrler* pObj):m_pMovieCtrler(pObj){};
44  ~ParaMovieCtrler(){};
45  public:
58  string GetTime(const char* sFormat);
62  void SetTime(float fTime);
64  void Suspend();
66  void Resume();
68  void Play();
72  void Record();
73 
75  void RecordNewDialog(const char* sDialog);
77  bool RecordNewAction(const char* sActionName);
79  bool RecordNewAction_(const char* sActionName, float fTime);
81  void RecordNewEffect(int effectID, const char* sTarget);
82 
87  void GetOffsetPosition(float *x, float *y, float *z);
89  void SetOffsetPosition(float x, float y, float z);
90 
94  void SaveMovie(const char* filename);
98  void LoadMovie(const char* filename);
99  };
106  class PE_CORE_DECL ParaSeqCtrler
107  {
108  public:
109  CSequenceCtler* m_pSequenceCtrler; // a pointer to the object
110 
114  bool IsValid(){return m_pSequenceCtrler!=NULL;}
115  public:
116  ParaSeqCtrler():m_pSequenceCtrler(NULL){};
117  ParaSeqCtrler(CSequenceCtler* pObj):m_pSequenceCtrler(pObj){};
118  ~ParaSeqCtrler(){};
119  public:
120  bool Save(bool bOverride);
121  bool LoadByID(int nSequenceID);
122  bool LoadFromFile(const char* fileName);
123  int Create(const char* name, const char* description, const char* pData,bool bInMemory);
124  string ToString();
125 
127  int GetKeyPos();
129  void SetKeyPos(int nPos);
130 
132  int GetTotalKeys();
137  int AdvanceKey(int nOffset);
139  void BeginAddKeys();
141  void EndAddKeys();
142 
143  int GetSequenceID();
147  bool DeleteKeysRange(int nFrom, int nTo);
148 
150  bool GetPlayDirection();
152  void SetPlayDirection(bool bForward);
153 
155  float GetInterval();
157  void SetInterval(float fInterval);
158 
160  void GetStartPos(float& x, float& y, float&z);
162  void SetStartPos(float x, float y, float z);
163 
165  float GetStartFacing();
167  void SetStartFacing(float facing);
168 
170  int GetPlayMode();
172  void SetPlayMode(int mode);
173 
176  float GetMovingTimeout();
179  void SetMovingTimeout(float fTimeout);
180 
182  void Suspend();
184  void Resume();
186  // commands:
187  public:
188 
189  void RunTo(float x,float y,float z);
190  void WalkTo(float x,float y,float z);
191  void MoveTo(float x,float y,float z);
192  void MoveAndTurn(float x,float y,float z,float facing);
193  void PlayAnim(const char* sAnim);
194  void PlayAnim1(int nAnimID);
195  void Wait(float fSeconds);
196  void Exec(const char* sCmd);
197  void Pause();
198  void Turn(float fAngleAbsolute);
199  void MoveForward(float fDistance);
200  void MoveBack(float fDistance);
201  void MoveLeft(float fDistance);
202  void MoveRight(float fDistance);
203  void Jump();
204  void Goto(int nOffset);
205  void Goto1(const char* sLable);
206  void Lable(const char* sLable);
207  };
208 
214  class PE_CORE_DECL ParaFaceTrackingCtrler
215  {
216  public:
217  CFaceTrackingCtrler* m_pFaceTrackingCtrler; // a pointer to the object
218 
222  bool IsValid(){return m_pFaceTrackingCtrler!=NULL;}
223  public:
224  ParaFaceTrackingCtrler():m_pFaceTrackingCtrler(NULL){};
225  ParaFaceTrackingCtrler(CFaceTrackingCtrler* pObj):m_pFaceTrackingCtrler(pObj){};
227  public:
233  void FaceTarget(float x, float y, float z, float fDuration);
234  };
235 
241  class PE_CORE_DECL ParaCharacter
242  {
243  public:
244  CBipedObject::WeakPtr_type m_pCharacter; // a pointer to the object
245 
249  bool IsValid();
250  public:
251  ParaCharacter();
252  ParaCharacter(CBaseObject* pObj);
253  ~ParaCharacter();
254 
258  void SetSpeedScale(float fSpeedScale);
259  float GetSpeedScale();
260 
264  void FallDown();
265 
270  void SetSizeScale(float fScale);
271  float GetSizeScale();
272 
276  void SetFocus();
277 
284  void AddAction2(int nAction, const object& param);
285  void AddAction(int nAction);
286 
288  bool WalkingOrRunning();
289 
293  bool HasAnimation(int nAnimID);
294 
298  bool IsCustomModel();
299 
308  void ResetBaseModel(ParaAssetObject assetCharBaseModel);
309 
315  void SetSkin(int nIndex);
316 
318  int GetSkin();
319 
327  void LoadStoredModel(int nModelSetID);
328 
336  void PlayAnimation(const object& anims);
337 
338 
343  int GetAnimID();
344 
347  const char* GetAnimFileName();
348 
352  void EnableAnimIDMap(bool bEnable);
353 
357  bool IsAnimIDMapEnabled();
358 
368  bool AddAnimIDMap(int nFromID, int nToID);
369 
371  void ClearAllAnimIDMap();
372 
373 
377  bool HasMountPoint(int nMountPointID);
378 
380  bool IsMounted();
381 
385  void MountOn_(const char* sTarget);
386 
391  void MountOn(ParaObject& target);
392 
398  void MountOn2(ParaObject& target, int nMountID);
399 
404  void UnMount();
405 
414  void SetBodyParams(int skinColor, int faceType, int hairColor, int hairStyle, int facialHair);
415 
425  int GetBodyParams(int type);
426 
431  void SetDisplayOptions(int bShowUnderwear, int bShowEars, int bShowHair);
432 
440  bool GetDisplayOptions(int type);
441 
474  void SetCharacterSlot(int nSlotID, int nItemID);
475 
480  int GetCharacterSlotItemID(int nSlotID);
481 
482 
486  void LoadFromFile(const char* filename);
488  void SaveToFile(const char* filename);
489 
492  void RefreshModel();
493 
500  void UseAIModule(const char* sAIType );
501 
532  void AssignAIController(const char* sAICtrlerName, const char* sParam1);
537  bool IsAIControllerEnabled(const char* sAICtrlerName);
538 
542  ParaMovieCtrler GetMovieController();
543 
547  ParaSeqCtrler GetSeqController();
548 
552  ParaFaceTrackingCtrler GetFaceTrackingController();
553 
558  void CastEffect(int nEffectID);
575  void CastEffect2(int nEffectID, const char* sTarget);
576 
602  void AddAttachment(ParaAssetObject ModelAsset, int nAttachmentID);
603  void AddAttachment3(ParaAssetObject ModelAsset, int nAttachmentID, int nSlotID);
604  void AddAttachment4(ParaAssetObject ModelAsset, int nAttachmentID, int nSlotID, float fScaling);
605  void AddAttachment5(ParaAssetObject ModelAsset, int nAttachmentID, int nSlotID, float fScaling, ParaAssetObject ReplaceableTexture);
606 
608  ParaAttributeObject GetAttachmentAttObj(int nAttachmentID);
609 
615  void RemoveAttachment(int nAttachmentID);
616  void RemoveAttachment2(int nAttachmentID, int nSlotID);
617 
619  void Stop();
621  void MoveTo(double x, double y, double z);
623  void MoveAndTurn(double x, double y, double z, float facing);
624 
626  //
627  // cartoon face functions
628  //
630 
655  double GetCartoonFaceComponent(int nComponentID, int SubType);
667  string GetCartoonFaceComponentCode(int nComponentID, int SubType);
668 
671  void SetCartoonFaceComponent(int nComponentID, int SubType, double value);
672 
675  void SetCartoonFaceComponentCode(int nComponentID, int SubType, const char * color);
676 
678  bool IsSupportCartoonFace();
679 
685  void SetSkinColorMask(const char * strColor);
686 
692  string GetSkinColorMask();
693 
694 
697  int GetGender();
698 
701  int GetRaceID();
702 
703  };
704 }
bool IsValid()
check if the object is valid
Definition: ParaScriptingCharacter.h:40
ParaSeqCtrler object: A sequence controller is a biped controller which moves the biped according to ...
Definition: ParaScriptingCharacter.h:106
Definition: combase.h:159
different physics engine has different winding order.
Definition: EventBinding.h:32
ParaFaceTrackingCtrler object: it will allow the biped to always face to a given target or another bi...
Definition: ParaScriptingCharacter.h:214
bool IsValid()
check if the object is valid
Definition: ParaScriptingCharacter.h:222
ParaObject class: it is used to control game scene objects from scripts.
Definition: ParaScriptingScene.h:56
ParaObject class: it is used to control game scene objects from scripts.
Definition: ParaScriptingCharacter.h:241
a movie controller it will control the biped to follow a path defined in a movie file or record the b...
Definition: MovieCtrlers.h:12
weak reference ptr use in a class like this: weak_ptr<CRefCounted> p; e.g.
Definition: PERef.h:105
ParaMovieCtrler object: it is used to control time based movie of character object.
Definition: ParaScriptingCharacter.h:32
Definition: PEtypes.h:507
Definition: enum_maker.hpp:46
it represents an attribute object associated with an object.
Definition: ParaScriptingGlobal.h:458
a facing tracking controller it will allow the biped to always face to a given target or another bipe...
Definition: FaceTrackingCtrler.h:12
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
for luabind, The main drawback of this approach is that the compilation time will increase for the fi...
Definition: luaSQLite.cpp:1971
A sequence controller is a biped controller which moves the biped according to some predefined sequen...
Definition: SequenceCtler.h:11
it represents an asset entity.
Definition: ParaScriptingCommon.h:85
bool IsValid()
check if the object is valid
Definition: ParaScriptingCharacter.h:114