My Project
BipedObject.h
1 #pragma once
2 #include "IGameObject.h"
3 #include "ShadowVolume.h"
4 #include "BipedWayPoint.h"
5 
6 namespace ParaEngine
7 {
8  struct IParaPhysicsActor;
9 
61  {
62  public:
64 
65  virtual std::string ToString(DWORD nMethod);
66  virtual CBaseObject::_SceneObjectType GetType(){ return CBaseObject::BipedObject; };
67 
68  typedef std::list<BipedWayPoint> WayPointList_type;
69 
72  {
86  };
87 
90  {
97  };
98 
99 
101  static const float SPEED_TURN;
103  static const float SPEED_WALK;
105  static const float SPEED_NORM_TURN;
106 
107  public:
108  CBipedObject(void);
109  virtual ~CBipedObject(void);
110 
111  public:
113  // implementation of IAttributeFields
114 
116  virtual int GetAttributeClassID(){ return ATTRIBUTE_CLASSID_CBipedObject; }
118  virtual const char* GetAttributeClassName(){ static const char name[] = "CBipedObject"; return name; }
120  virtual const char* GetAttributeClassDescription(){ static const char desc[] = ""; return desc; }
122  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
123 
125  virtual IAttributeFields* GetChildAttributeObject(const std::string& sName);
127  virtual int GetChildAttributeObjectCount(int nColumnIndex = 0);
129  virtual int GetChildAttributeColumnCount();
130  virtual IAttributeFields* GetChildAttributeObject(int nRowIndex, int nColumnIndex = 0);
131 
132  ATTRIBUTE_METHOD1(CBipedObject, GetPhysicsRadius_s, float*) { *p1 = cls->GetPhysicsRadius(); return S_OK; }
133  ATTRIBUTE_METHOD1(CBipedObject, SetPhysicsRadius_s, float) { cls->SetPhysicsRadius(p1); return S_OK; }
134 
135  ATTRIBUTE_METHOD1(CBipedObject, GetPhysicsHeight_s, float*) { *p1 = cls->GetPhysicsHeight(); return S_OK; }
136  ATTRIBUTE_METHOD1(CBipedObject, SetPhysicsHeight_s, float) { cls->SetPhysicsHeight(p1); return S_OK; }
137 
138  ATTRIBUTE_METHOD1(CBipedObject, GetSizeScale_s, float*) { *p1 = cls->GetSizeScale(); return S_OK; }
139  ATTRIBUTE_METHOD1(CBipedObject, SetSizeScale_s, float) { cls->SetSizeScale(p1); return S_OK; }
140 
141  ATTRIBUTE_METHOD1(CBipedObject, GetDensity_s, float*) { *p1 = cls->GetDensity(); return S_OK; }
142  ATTRIBUTE_METHOD1(CBipedObject, SetDensity_s, float) { cls->SetDensity(p1); return S_OK; }
143 
144  ATTRIBUTE_METHOD1(CBipedObject, GetSpeedScale_s, float*) { *p1 = cls->GetSpeedScale(); return S_OK; }
145  ATTRIBUTE_METHOD1(CBipedObject, SetSpeedScale_s, float) { cls->SetSpeedScale(p1); return S_OK; }
146 
147  ATTRIBUTE_METHOD1(CBipedObject, GetCurrentAnimation_s, int*) { *p1 = cls->GetCurrentAnimation(); return S_OK; }
148  ATTRIBUTE_METHOD1(CBipedObject, PlayAnimation_s, int) { cls->PlayAnimation(p1); return S_OK; }
149  ATTRIBUTE_METHOD(CBipedObject, DumpBVHAnimations_s) { cls->DumpBVHAnimations(); return S_OK; }
150 
151  ATTRIBUTE_METHOD1(CBipedObject, GetHeadTurningAngle_s, float*) { *p1 = cls->GetHeadTurningAngle(); return S_OK; }
152  ATTRIBUTE_METHOD1(CBipedObject, SetHeadTurningAngle_s, float) { cls->SetHeadTurningAngle(p1); return S_OK; }
153 
154  ATTRIBUTE_METHOD1(CBipedObject, GetHeadUpdownAngle_s, float*) { *p1 = cls->GetHeadUpdownAngle(); return S_OK; }
155  ATTRIBUTE_METHOD1(CBipedObject, SetHeadUpdownAngle_s, float) { cls->SetHeadUpdownAngle(p1); return S_OK; }
156 
157  ATTRIBUTE_METHOD1(CBipedObject, GetBootHeight_s, float*) { *p1 = cls->GetBootHeight(); return S_OK; }
158  ATTRIBUTE_METHOD1(CBipedObject, SetBootHeight_s, float) { cls->SetBootHeight(p1); return S_OK; }
159 
160  ATTRIBUTE_METHOD1(CBipedObject, GetMovementStyle_s, int*) { *p1 = cls->GetMovementStyle(); return S_OK; }
161  ATTRIBUTE_METHOD1(CBipedObject, SetMovementStyle_s, int) { cls->SetMovementStyle((PhysicsMoveStyle)p1); return S_OK; }
162 
163  ATTRIBUTE_METHOD1(CBipedObject, GetSpeed_s, float*) { *p1 = cls->GetSpeed(); return S_OK; }
164  ATTRIBUTE_METHOD1(CBipedObject, SetSpeed_s, float) { cls->SetSpeed(p1); return S_OK; }
165 
166  ATTRIBUTE_METHOD1(CBipedObject, GetLastSpeed_s, float*) { *p1 = cls->GetLastSpeed(); return S_OK; }
167  ATTRIBUTE_METHOD1(CBipedObject, SetLastSpeed_s, float) { cls->SetLastSpeed(p1); return S_OK; }
168 
169  ATTRIBUTE_METHOD1(CBipedObject, GetAccelerationDist_s, float*) { *p1 = cls->GetAccelerationDist(); return S_OK; }
170  ATTRIBUTE_METHOD1(CBipedObject, SetAccelerationDist_s, float) { cls->SetAccelerationDist(p1); return S_OK; }
171 
172  ATTRIBUTE_METHOD1(CBipedObject, GetVerticalSpeed_s, float*) { *p1 = cls->GetVerticalSpeed(); return S_OK; }
173  ATTRIBUTE_METHOD1(CBipedObject, SetVerticalSpeed_s, float) { cls->SetVerticalSpeed(p1); return S_OK; }
174 
175  ATTRIBUTE_METHOD1(CBipedObject, GetPhysicsGroupSensorMask_s, DWORD*) { *p1 = cls->GetPhysicsGroupMask(); return S_OK; }
176  ATTRIBUTE_METHOD1(CBipedObject, SetPhysicsGroupSensorMask_s, DWORD) { cls->SetPhysicsGroupMask(p1); return S_OK; }
177 
178  ATTRIBUTE_METHOD1(CBipedObject, GetMaxSpeed_s, float*) { *p1 = cls->GetMaxSpeed(); return S_OK; }
179 
180  ATTRIBUTE_METHOD(CBipedObject, ForceStop_s) { cls->ForceStop(); return S_OK; }
181 
182  ATTRIBUTE_METHOD(CBipedObject, ForceMove_s) { cls->ForceMove(); return S_OK; }
183 
184  ATTRIBUTE_METHOD1(CBipedObject, GetIsAlwaysAboveTerrain_s, bool*) { *p1 = cls->GetIsAlwaysAboveTerrain(); return S_OK; }
185  ATTRIBUTE_METHOD1(CBipedObject, SetIsAlwaysAboveTerrain_s, bool) { cls->SetIsAlwaysAboveTerrain(p1); return S_OK; }
186 
187  ATTRIBUTE_METHOD1(CBipedObject, GetIsAnimPaused_s, bool*) { *p1 = cls->GetIsAnimPaused(); return S_OK; }
188  ATTRIBUTE_METHOD1(CBipedObject, SetIsAnimPaused_s, bool) { cls->SetIsAnimPaused(p1); return S_OK; }
189 
190  ATTRIBUTE_METHOD1(CBipedObject, SetBlendingFactor_s, float) { cls->SetBlendingFactor(p1); return S_OK; }
191 
192 
193  ATTRIBUTE_METHOD1(CBipedObject, GetLastWayPointType_s, int*) { *p1 = cls->GetLastWayPoint().GetPointType(); return S_OK; }
194  ATTRIBUTE_METHOD1(CBipedObject, GetLastWayPointPos_s, Vector3*) { *p1 = cls->GetLastWayPoint().GetPosition(); return S_OK; }
195 
196  ATTRIBUTE_METHOD1(CBipedObject, GetGravity_s, float*) { *p1 = cls->GetGravity(); return S_OK; }
197  ATTRIBUTE_METHOD1(CBipedObject, SetGravity_s, float) { cls->SetGravity(p1); return S_OK; }
198 
199  ATTRIBUTE_METHOD1(CBipedObject, GetIgnoreSlopeCollision_s, bool*) { *p1 = cls->GetIgnoreSlopeCollision(); return S_OK; }
200  ATTRIBUTE_METHOD1(CBipedObject, SetIgnoreSlopeCollision_s, bool) { cls->SetIgnoreSlopeCollision(p1); return S_OK; }
201 
202  ATTRIBUTE_METHOD1(CBipedObject, GetCanFly_s, bool*) { *p1 = cls->GetCanFly(); return S_OK; }
203  ATTRIBUTE_METHOD1(CBipedObject, SetCanFly_s, bool) { cls->SetCanFly(p1); return S_OK; }
204 
205  ATTRIBUTE_METHOD1(CBipedObject, GetAlwaysFlying_s, bool*) { *p1 = cls->GetAlwaysFlying(); return S_OK; }
206  ATTRIBUTE_METHOD1(CBipedObject, SetAlwaysFlying_s, bool) { cls->SetAlwaysFlying(p1); return S_OK; }
207 
208  ATTRIBUTE_METHOD1(CBipedObject, GetIsFlying_s, bool*) { *p1 = cls->GetIsFlying(); return S_OK; }
209 
210  ATTRIBUTE_METHOD1(CBipedObject, GetFlyUsingCameraDir_s, bool*) { *p1 = cls->GetFlyUsingCameraDir(); return S_OK; }
211  ATTRIBUTE_METHOD1(CBipedObject, SetFlyUsingCameraDir_s, bool) { cls->SetFlyUsingCameraDir(p1); return S_OK; }
212 
213  ATTRIBUTE_METHOD1(CBipedObject, IsAutoWalkupBlock_s, bool*) { *p1 = cls->IsAutoWalkupBlock(); return S_OK; }
214  ATTRIBUTE_METHOD1(CBipedObject, SetAutoWalkupBlock_s, bool) { cls->SetAutoWalkupBlock(p1); return S_OK; }
215 
216  ATTRIBUTE_METHOD1(CBipedObject, IsControlledExternally_s, bool*) { *p1 = cls->IsControlledExternally(); return S_OK; }
217  ATTRIBUTE_METHOD1(CBipedObject, SetIsControlledExternally_s, bool) { cls->SetIsControlledExternally(p1); return S_OK; }
218 
219  protected:
227  bool MoveTowards(double dTimeDelta, const DVector3& vPosTarget, float fStopDistance, bool * pIsSlidingWall = NULL);
228 
233  bool MoveTowards_OPC(double dTimeDelta, const DVector3& vPosTarget, float fQuickMoveDistance = 15.f);
234 
238  bool MoveTowards_Linear(double dTimeDelta, const DVector3& vPosTarget);
239 
246  bool CheckBlockWorld(DVector3& vMovePos, Vector3& vMinPos, Vector3& vMaxPos, bool& bUseGlobalTerrainNorm, bool& bReachPos, Vector3& vBipedFacing, float fDeltaTime);
247 
248  bool FacingTowards(double dTimeDelta, float fTargetFacing);
250  void UpdateState(float fTimeDelta);
251 
253  bool SetParamsFromAsset();
254 
256  void SetIsAlwaysAboveTerrain(bool bEnable) { m_bIsAlwaysAboveTerrain = bEnable; }
258  bool GetIsAlwaysAboveTerrain() { return m_bIsAlwaysAboveTerrain; }
259 
261  void SetIsAnimPaused(bool bPaused) { m_bPauseAnimation = bPaused; }
263  bool GetIsAnimPaused() { return m_bPauseAnimation; }
264 
268  void SetBlendingFactor(float fBlendingFactor);
269 
270  bool FlyTowards(double dTimeDelta, const DVector3& vPosTarget, float fStopDistance, bool * pIsSlidingWall);
271  public:
273  void SetMovementStyle(PhysicsMoveStyle nValue){ m_nMovementStyle = nValue; };
274 
276  PhysicsMoveStyle GetMovementStyle(){ return m_nMovementStyle; };
277 
278  bool CanAnimOpacity() const;
279 
283  virtual Matrix4* GetRenderMatrix(Matrix4& pOut, int nRenderNumber = 0);
284 
291  virtual Matrix4* GetAttachmentMatrix(Matrix4& pOut, int nAttachmentID = 0, int nRenderNumber = 0);
292 
296  virtual bool HasAttachmentPoint(int nAttachmentID = 0);
297 
299  virtual bool ViewTouch();
300 
302  virtual int ProcessObjectEvent(const ObjectEvent& event);
310  virtual void SetPrimaryTechniqueHandle(int nHandle);
311 
312  virtual void SetPosition(const DVector3& v);
316  HRESULT InitObject(AssetEntity* pMAE);
320  void DeleteAnimInstance();
321  virtual void Cleanup();
329 
331  bool DumpBVHAnimations();
332 
340 
341  //-- virtual function from baseObject
342  virtual HRESULT Draw(SceneState * sceneState);
343  virtual void Animate(double dTimeDelta, int nRenderNumber = 0);
344 
345 
347  virtual AssetEntity* GetPrimaryAsset();
348 
349  virtual void SetNormal(const Vector3 & pNorm);
350  virtual Vector3 GetNormal();
351 
354  virtual void SetScaling(float s);
355 
357  virtual float GetScaling();
358 
360  virtual void SetLocalTransform(const Matrix4& mXForm);
362  virtual void GetLocalTransform(Matrix4* localTransform);
363 
364  virtual void GetOBB(CShapeOBB* obb);
365 
367  virtual void Reset();
368 
370  virtual void PathFinding(double dTimeDelta);
371 
374  virtual void AnimateBiped(double dTimeDelta, bool bSharpTurning = false /*reserved*/);
375 
377  virtual void SetAssetFileName(const std::string& sFilename);
378 
386  virtual int GetNumReplaceableTextures();
387 
394  virtual TextureEntity* GetDefaultReplaceableTexture(int ReplaceableTextureID);
395 
404  virtual TextureEntity* GetReplaceableTexture(int ReplaceableTextureID);
405 
415  virtual bool SetReplaceableTexture(int ReplaceableTextureID, TextureEntity* pTextureEntity);
416 
417  void OneObstaclePathFinding(CBaseObject* pSolid);
418 
424  virtual void PushParam();
430  virtual void PopParam();
431 
435  virtual bool HasAlphaBlendedObjects();
436 
437  bool GetWayPoint(BipedWayPoint* pOut);
441 
442  void AddWayPoint(const BipedWayPoint& pt);
443  void RemoveWayPoint();
446 
447 
448  virtual void SetUserControl();
449  virtual void ChooseNewLocation(Vector3 *pV);
450 
451  /* Low level events(LLE) replacement to low level command*/
452 
454  void ReplaceAIModule(CAIBase* pNew);
456  virtual CAIBase* GetAIModule();
464  CAIBase* UseAIModule(const string& sAIType);
465 
469  void FacingTarget(const Vector3 *pV);
471  void FacingTarget(float fTargetFacing);
472 
473 
476  virtual float GetRoll();
477  virtual void SetRoll(float fValue);
478 
481  virtual float GetPitch();
482  virtual void SetPitch(float fValue);
483 
485  virtual void SetYaw(float fFacing);
486 
488  virtual void UpdateGeometry();
489 
493  void SetHeadTurningAngle(float fFacing);
495  float GetHeadTurningAngle();
496 
500  void SetHeadUpdownAngle(float fFacing);
502  float GetHeadUpdownAngle();
503 
505  float GetHeadFacing();
506 
507  virtual void SetOpacity(float fOpacity);
508 
514  void GetSpeedDirection(Vector3 *pV);
519  void SetSpeedAngle(float fSpeedAngle);
521  float GetSpeedAngle();
523  float GetSpeed();
524 
526  float GetLastSpeed();
527  void SetLastSpeed(float fSpeed);
528 
532  float GetAccelerationDist();
533  void SetAccelerationDist(float fAccelerationDist = 0.f);
534 
535 
537  float GetAbsoluteSpeed();
539  void SetSpeed(float fSpeed);
541  float GetMaxSpeed();
543  virtual void SetSpeedScale(float dScale);
545  virtual float GetSpeedScale();
547  virtual void SetSizeScale(float dScale);
549  virtual float GetSizeScale();
550 
552  void SetBootHeight(float fBootHeight);
554  float GetBootHeight();
555 
566  void SetDensity(float fDensity);
568  float GetDensity();
569 
570  void SetGravity(float gravity);
571  float GetGravity();
572 
573  void SetIgnoreSlopeCollision(bool ignoreSlope);
574  bool GetIgnoreSlopeCollision();
575 
576  void SetCanFly(bool canFly);
577  bool GetCanFly();
578 
579  bool GetAlwaysFlying() const;
580  void SetAlwaysFlying(bool val);
581 
582  bool GetFlyUsingCameraDir() const;
583  void SetFlyUsingCameraDir(bool val);
584 
585  bool GetIsFlying();
586 
587  void SetFlyingDirection(const Vector3 *dir);
588 
590  void SetAutoWalkupBlock(bool bAutoWalkup);
592  bool IsAutoWalkupBlock();
593 
595  bool IsControlledExternally() const;
596  void SetIsControlledExternally(bool val);
597 
601  void FallDown();
602 
603  virtual bool IsStanding();
604  bool IsStandingIntentioned();
606  void SetStandingState();
607  bool IsBipedBlocked();
608 
612  void SetWalkingState(const char* sName = NULL);
613 
619  virtual CBipedStateManager* GetBipedStateManager(bool bCreateOnDemand = true);
620 
622  virtual void SetOnAssetLoaded(const char* sCallbackScript);
623 
632  void PlayAnimation(DWORD nIndex, bool bUpdateSpeed = true, bool bAppend = false);
633 
642  void PlayAnimation(const char* sName, bool bUpdateSpeed = true, bool bAppend = false);
644  int GetCurrentAnimation();
645 
646 
649  virtual void SetAnimation(int nAnimID);
650 
652  virtual int GetAnimation();
653 
657  virtual bool HasAnimation(int nAnimID);
658 
662  virtual void SetAnimFrame(int nFrame);
663 
665  virtual int GetAnimFrame();
666 
668  virtual void EnableAnim(bool bAnimated);
669  virtual bool IsAnimEnabled();
670 
672  virtual int GetTime();
673  virtual void SetTime(int nTime);
674 
680  virtual void SetUseGlobalTime(bool bUseGlobalTime);
681 
687  virtual bool IsUseGlobalTime();
688 
693  bool MountOn(CBaseObject* pTarget, int nMountID = -1);
694 
698  void UpdateSpeed(float fSpeed);
699 
701  float GetVerticalSpeed();
703  void SetVerticalSpeed(float fSpeed);
704 
708  void UseSpeedFromAnimation(int nIndex);
712  void UseSpeedFromAnimation(const char* sName);
713 
715  bool HasAnimId(int nAnimID);
716 
717  void PlayDeathDecayAnim();
718 
719  void SetNextTargetPosition(const DVector3 &pV, bool bIgnoreHeight = true);
725  void WalkTo(const DVector3& pV, bool bIgnoreHeight = true);
730  void ForceMove();
734  void ForceStop();
742  void JumpUpward(float fVerticalSpeed, bool bJumpFromGround);
743 
746  virtual float GetPhysicsRadius();
749  void SetPhysicsRadius(float fR);
752  float GetPhysicsHeight();
755  void SetPhysicsHeight(float fH);
757  float GetAssetHeight();
758 
759  void ResetBipedPosition(const Vector3 *pV, bool bIgnoreHeight = true);
760 
761  virtual void Rotate(float x, float y, float z);
762 
767  virtual void SetPhysicsGroupMask(DWORD dwValue);
768 
773  virtual DWORD GetPhysicsGroupMask();
774 
775  public:
776  /* advanced character control functions.*/
777 
786  void ResetBaseModel(AssetEntity* assetCharBaseModel);
794  void LoadStoredModel(int nModelSetID);
795 
796  public:
797  virtual bool IsShadowEnabled(){ return m_bIsShadowEnabled; };
798  virtual void BuildShadowVolume(SceneState * sceneState, ShadowVolume * pShadowVolume, LightParams* pLight);
799 
801  virtual IGameObject* QueryIGameObject();
802 
805  virtual int On_EnterSentientArea();
808  virtual int On_LeaveSentientArea();
809 
812  virtual int On_Click(DWORD nMouseKey, DWORD dwParam1, DWORD dwParam2);
813 
815  virtual int On_Event(DWORD nEventType, DWORD dwParam1, DWORD dwParam2);
816 
819  virtual int On_Perception();
822  virtual int On_FrameMove();
826  virtual int On_Net_Send(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2);
830  virtual int On_Net_Receive(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2);
831 
833  virtual bool CanHasPhysics();
834  virtual void LoadPhysics();
835  virtual void UnloadPhysics();
836  virtual void SetPhysicsGroup(int nGroup);
837  virtual int GetPhysicsGroup();
838  virtual void EnablePhysics(bool bEnable);
839  virtual bool IsPhysicsEnabled();
841  int GetStaticActorCount();
842 
843  protected:
844  void AnimateIdle(double dTimeDelta);
845  void AnimateMoving(double dTimeDelta, bool bSharpTurning = false);
846 
847  void AnimateUserControl(double dTimeDelta);
848 
851  private:
852  // -- data structuring
853  asset_ptr<AssetEntity> m_pMultiAnimationEntity;
856 
857 
859  PhysicsMoveStyle m_nMovementStyle;
860 
862  float m_fPhysicsRadius;
863 
864  /* physical height. this value will restrict the biped's vertical movement.
865  if there is no head attachment, the GetPhysicsHeight is used to for character head on position instead.
866  If m_fPhysicsHeight is never set, it is always 4*m_fPhysicsRadius. However, if it is set, its value are maintained.
867  */
868  float m_fPhysicsHeight;
869 
870  // the biped state manager
871  CBipedStateManager* m_pBipedStateManager;
872 
874  CAIBase* m_pAIModule;
875 
877  float m_fSpeed;
879  float m_fLastSpeed;
883  float m_fAccelerationDist;
885  float m_fSpeedAngle;
889  float m_fSpeedVertical;
890 
893  Vector3 m_vNorm;
895  Vector3 m_vNormTarget;
896 
898  float m_fRoll;
900  float m_fPitch;
901 
903  WayPointList_type m_vPosTarget;
904 
906  // float m_fFacing; // it is already defined in base object class
908  float m_fFacingTarget;
909 
911  float m_fBootHeight;
912 
914  float m_fLastBlockLight;
916  DWORD m_dwLastBlockHash;
917 
927  float m_fDensity;
928 
929  //default to 9.18
930  float m_gravity;
931 
933  float m_fSizeScale;
934 
936  float m_fSpeedScale;
938  float m_fAssetHeight;
939  Vector3 m_flyingDir;
940 
943  DWORD m_dwPhysicsGroupSensorMask;
944 
946  DWORD m_dwPhysicsGroupMask;
947 
949  vector<IParaPhysicsActor*> m_staticActors;
950  // any bit wise combination of PHYSICS_METHOD
951  DWORD m_dwPhysicsMethod;
952  uint32 m_nPhysicsGroup;
953 
955  bool m_bIgnoreFacingTarget : 1;
956  bool m_bIsShadowEnabled : 1;
957  bool m_bIsAlwaysAboveTerrain : 1;
959  bool m_bPauseAnimation : 1;
960 
961  bool m_ignoreSlopeCollision : 1;
962  bool m_isFlying : 1;
963  bool m_canFly : 1;
964  bool m_isAlwaysFlying : 1;
965  bool m_isFlyUsingCameraDir : 1;
966  bool m_readyToLanding : 1;
967  bool m_bAutoWalkupBlock : 1;
969  bool m_bIsControlledExternally : 1;
970  bool m_bCanAnimOpacity : 1;
971 
972  };
973 
974 }
void WalkTo(const DVector3 &pV, bool bIgnoreHeight=true)
force the biped to walk to a position.
Definition: BipedObject.cpp:5131
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: BipedObject.h:120
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
bool HasAnimId(int nAnimID)
check to see if the underlying model has a given animation id.
Definition: BipedObject.cpp:4910
virtual int ProcessObjectEvent(const ObjectEvent &event)
this function is only used to backward compatibility of ParaObject:AddEvent() function.
Definition: BipedObject.cpp:4986
void PlayDeathDecayAnim()
TODO: may a movie track should be used.
Definition: BipedObject.cpp:4541
void SetHeadUpdownAngle(float fFacing)
set the facing of model&#39;s head.
Definition: BipedObject.cpp:4334
void SetStandingState()
add the standing state action to its action manager
Definition: BipedObject.cpp:4547
bool IsStandingIntentioned()
return true, if the biped is not only standing now, but also intends to remain standing for the next ...
Definition: BipedObject.cpp:522
bool DumpBVHAnimations()
dump BVH animations of the main character asset
Definition: BipedObject.cpp:5350
virtual void Cleanup()
clean up the object.
Definition: BipedObject.cpp:275
virtual int On_Event(DWORD nEventType, DWORD dwParam1, DWORD dwParam2)
TODO: Some game defined events, such as user attack, etc.
Definition: BipedObject.cpp:5310
RenderSelectionStyle
how to render a selected object
Definition: BipedObject.h:89
bool GetIsAnimPaused()
true to pause animation.
Definition: BipedObject.h:263
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
void ForceStop()
stop the biped by removing all of its targeting way points.
Definition: BipedObject.cpp:5156
OPC is the default for remote player agent.
Definition: BipedObject.h:85
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual IGameObject * QueryIGameObject()
this may return NULL, if the object does not implement the IGameObject interface. ...
Definition: BipedObject.cpp:5281
virtual CAIBase * GetAIModule()
Get the AI module that is dynamically associated with this object.
Definition: BipedObject.cpp:300
virtual void GetOBB(CShapeOBB *obb)
get the oriented bounding box in world space.
Definition: BipedObject.cpp:5274
PhysicsMoveStyle
how the character reacts to physics in the MoveTowards() functions
Definition: BipedObject.h:71
void FacingTarget(const Vector3 *pV)
facing the target right away provided that the biped is not moving
Definition: BipedObject.cpp:4367
ShadowVolume is a structure for storing shadow volume geometries.
Definition: ShadowVolume.h:39
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
virtual AssetEntity * GetPrimaryAsset()
used as KEY for batch rendering
Definition: BipedObject.cpp:5209
event that can be passed to scene object
Definition: ObjectEvent.h:6
virtual bool HasAnimation(int nAnimID)
whether an animation id exist.
Definition: BipedObject.cpp:4629
CAnimInstanceBase * GetAnimInstance()
get the animation instance.
Definition: BipedObject.cpp:322
virtual float GetRoll()
get object roll: is facing the positive x axis, if yaw is 0.
Definition: BipedObject.cpp:4227
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: BipedObject.cpp:5508
virtual Matrix4 * GetAttachmentMatrix(Matrix4 &pOut, int nAttachmentID=0, int nRenderNumber=0)
Get the specified attachment matrix of the current model.
Definition: BipedObject.cpp:992
float GetAbsoluteSpeed()
get the magnitude of the current speed of the character.
Definition: BipedObject.cpp:4401
abstract class for all animation instance implementation.
Definition: AnimInstanceBase.h:66
virtual void PushParam()
Usually, this is used in canvas drawing.
Definition: BipedObject.cpp:891
virtual bool HasAlphaBlendedObjects()
return true if the object contains alpha blended render pass.
Definition: BipedObject.cpp:4639
virtual DWORD GetPhysicsGroupMask()
get groups Mask used to filter physics objects, default to 0xffffffff.
Definition: BipedObject.cpp:4686
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: BipedObject.h:116
bool FacingTowards(double dTimeDelta, float fTargetFacing)
fFacingTarget: it must be in the range [0, 2*pi]
Definition: BipedObject.cpp:4185
void SetBootHeight(float fBootHeight)
set boot height, default to 0.f meters.
Definition: BipedObject.cpp:4871
float GetMaxSpeed()
get the maximum speed of the character.
Definition: BipedObject.cpp:4413
virtual void UpdateGeometry()
update the local transform from size, roll, pitch, yaw, etc.
Definition: BipedObject.cpp:4262
float GetHeadTurningAngle()
get the head facing.It is relative to the model facing.
Definition: BipedObject.cpp:4325
void SetDensity(float fDensity)
body density.
Definition: BipedObject.cpp:4376
bool MoveTowards_Linear(double dTimeDelta, const DVector3 &vPosTarget)
move as an OPC.
Definition: BipedObject.cpp:1885
virtual void SetScaling(float s)
set the scale of the object.
Definition: BipedObject.cpp:4451
virtual TextureEntity * GetDefaultReplaceableTexture(int ReplaceableTextureID)
get the default replaceable texture by its ID.
Definition: BipedObject.cpp:4649
virtual float GetSizeScale()
Definition: BipedObject.cpp:4442
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: BipedObject.cpp:4944
virtual void Animate(double dTimeDelta, int nRenderNumber=0)
animate the model by a given delta time.
Definition: BipedObject.cpp:908
void SetAutoWalkupBlock(bool bAutoWalkup)
whether automatically walk up block that is 1 block high in front of us.
Definition: BipedObject.cpp:4816
different physics engine has different winding order.
Definition: EventBinding.h:32
bool CheckBlockWorld(DVector3 &vMovePos, Vector3 &vMinPos, Vector3 &vMaxPos, bool &bUseGlobalTerrainNorm, bool &bReachPos, Vector3 &vBipedFacing, float fDeltaTime)
vMovePos is new tentative position that the player is moving towards.
Definition: BipedObject.cpp:2875
bool FlyTowards(double dTimeDelta, const DVector3 &vPosTarget, float fStopDistance, bool *pIsSlidingWall)
Definition: BipedObject.cpp:3402
Biped way point: see CBipedObject::m_vPosTarget.
Definition: BipedWayPoint.h:6
void SetPhysicsRadius(float fR)
the biped is modeled as a cylinder or sphere during rough physics calculation.
Definition: BipedObject.cpp:4494
void SetWalkingState(const char *sName=NULL)
Walk using specified animation.
Definition: BipedObject.cpp:4518
virtual void AnimateBiped(double dTimeDelta, bool bSharpTurning=false)
animate biped according to its current waypoint lists and speed.
Definition: BipedObject.cpp:873
character animation instance: it includes both the animation and model display information.
Definition: CustomCharModelInstance.h:17
virtual Matrix4 * GetRenderMatrix(Matrix4 &pOut, int nRenderNumber=0)
get the world transformation matrix for the current object.
Definition: BipedObject.cpp:1081
bool IsBipedBlocked()
If the biped is currently blocked.
Definition: BipedObject.cpp:4534
float GetHeadUpdownAngle()
get the head facing.It is relative to the model facing.
Definition: BipedObject.cpp:4343
virtual int GetPhysicsGroup()
Get the physics group ID to which this object belongs to default to 0, must be smaller than 32...
Definition: BipedObject.cpp:4748
float GetLastSpeed()
this is not used, unless, speed acceleration is positive.
Definition: BipedObject.cpp:4797
virtual int On_Click(DWORD nMouseKey, DWORD dwParam1, DWORD dwParam2)
when the player clicked on this object.
Definition: BipedObject.cpp:5302
virtual int GetNumReplaceableTextures()
get the total number of replaceable textures, which is the largest replaceable texture ID...
Definition: BipedObject.cpp:4644
virtual void SetOnAssetLoaded(const char *sCallbackScript)
set the callback scipt whenever the primary asset is successfully loaded.
Definition: BipedObject.cpp:1196
void SetVerticalSpeed(float fSpeed)
Set the vertical speed of the character.
Definition: BipedObject.cpp:5195
The following shadow interface should be implemented for any shadow caster entity in the game engine...
Definition: ShadowVolume.h:27
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
virtual void SetSpeedScale(float dScale)
set the animation instance&#39;s speed to dScale times of its original speed
Definition: BipedObject.cpp:4432
virtual int On_Perception()
when other game objects of a different type entered the perceptive area of this object.
Definition: BipedObject.cpp:5318
just appear brighter without applying light effect and diffuse color is 1.
Definition: BipedObject.h:92
void SetIsAlwaysAboveTerrain(bool bEnable)
set whether character should always above terrain during movement.
Definition: BipedObject.h:256
float GetDensity()
get body density
Definition: BipedObject.cpp:4381
void OneObstaclePathFinding(CBaseObject *pSolid)
give a precise solution, in which the biped is guaranteed to be approaching the destination point...
Definition: BipedObject.cpp:678
virtual float GetScaling()
get scaling
Definition: BipedObject.cpp:4461
virtual int On_FrameMove()
called every frame move when this character is sentient.
Definition: BipedObject.cpp:5326
LightParams is a structure for which a shadow volume is built.
Definition: ShadowVolume.h:8
only care about the terrain(and model) height before its feet
Definition: BipedObject.h:76
virtual void SetYaw(float fFacing)
set model facing to the specified value.
Definition: BipedObject.cpp:4217
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object&#39;s name
Definition: BipedObject.h:118
a yellow border around the biped.
Definition: BipedObject.h:94
virtual void EnableAnim(bool bAnimated)
whether animation is enabled.
Definition: BipedObject.cpp:5398
virtual CBipedStateManager * GetBipedStateManager(bool bCreateOnDemand=true)
get biped state manager
Definition: BipedObject.cpp:282
virtual int GetAnimFrame()
get the current animation frame number relative to the beginning of current animation.
Definition: BipedObject.cpp:5378
int GetStaticActorCount()
get the number of physics actors.
Definition: BipedObject.cpp:4772
void FallDown()
if the biped is in air, it will fall down.
Definition: BipedObject.cpp:5166
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: BipedObject.cpp:4981
PhysicsMoveStyle GetMovementStyle()
how the character reacts to physics in the MoveTowards() functions
Definition: BipedObject.h:276
MyType
Definition: BipedWayPoint.h:10
virtual void SetLocalTransform(const Matrix4 &mXForm)
set local transform directly
Definition: BipedObject.cpp:1006
void SetHeadTurningAngle(float fFacing)
set the facing of model&#39;s head.
Definition: BipedObject.cpp:4316
virtual bool HasAttachmentPoint(int nAttachmentID=0)
whether it has an attachment point
Definition: BipedObject.cpp:982
bool IsControlledExternally() const
we will not simulate or changing the character&#39;s animation, etc, since the biped is controlled extern...
Definition: BipedObject.cpp:4881
void GetSpeedDirection(Vector3 *pV)
get the direction vector according to speed angle of current biped.
Definition: BipedObject.cpp:4110
no physics are applied, and make the character above terrain.
Definition: BipedObject.h:78
weak reference ptr use in a class like this: weak_ptr<CRefCounted> p; e.g.
Definition: PERef.h:105
virtual bool ViewTouch()
this function is called, when the object is in view range.
Definition: BipedObject.cpp:1267
virtual void SetUserControl()
Desc: Specifies whether this instance of CBipedObject is controlled by the user or the program...
Definition: BipedObject.cpp:1565
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: BipedObject.cpp:4968
virtual int GetTime()
get the current local time in case it is animated in milli seconds frames.
Definition: BipedObject.cpp:5414
void SetBlendingFactor(float fBlendingFactor)
set the blending factor between the current and blend animation.
Definition: BipedObject.cpp:4901
float GetAssetHeight()
get asset height.
Definition: BipedObject.cpp:4255
void UseSpeedFromAnimation(int nIndex)
use the speed defined in a specified animation by its animation index.
Definition: BipedObject.cpp:4572
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
bool GetIsAlwaysAboveTerrain()
get whether character should always above terrain during movement.
Definition: BipedObject.h:258
this is an interface class for game objects, such as NPC, OPC and players.
Definition: IGameObject.h:15
float GetBootHeight()
get boot height, default to 0.f meters.
Definition: BipedObject.cpp:4876
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
Definition: ParaXEntity.h:9
virtual void SetPosition(const DVector3 &v)
always bottom center of the bounding shape
Definition: BipedObject.cpp:1222
float GetVerticalSpeed()
get the vertical speed of the character.
Definition: BipedObject.cpp:5190
void RemoveWayPointByType(BipedWayPoint::MyType nType=BipedWayPoint::COMMAND_POINT)
remove all way points that matches a given type
Definition: BipedObject.cpp:505
virtual void Reset()
reset the object to its default settings.
Definition: BipedObject.cpp:4466
void SetPhysicsHeight(float fH)
the biped is modeled as a cylinder or sphere during rough physics calculation.
Definition: BipedObject.cpp:4504
float GetPhysicsHeight()
the biped is modeled as a cylinder or sphere during rough physics calculation.
Definition: BipedObject.cpp:4499
virtual int On_Net_Receive(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
when the network module receives packages from the network and it is about a certain game object...
Definition: BipedObject.cpp:5342
void DeleteAnimInstance()
delete the animation instance associated with this model.
Definition: BipedObject.cpp:263
character will slide along the wall infinitely.
Definition: BipedObject.h:74
virtual void SetPrimaryTechniqueHandle(int nHandle)
Set a new render technique handle.
Definition: BipedObject.cpp:1208
A common interface for all classes implementing IAttributeFields By implementing this class&#39;s virtual...
Definition: IAttributeFields.h:59
void SetSpeed(float fSpeed)
set the magnitude of the current speed of the character.
Definition: BipedObject.cpp:4408
float GetSpeed()
get the magnitude of the current speed of the character.
Definition: BipedObject.cpp:4397
virtual float GetSpeedScale()
Definition: BipedObject.cpp:4423
just linear interpolate from current pos to target pos, without using any physics.
Definition: BipedObject.h:80
virtual int On_EnterSentientArea()
when other game objects of a different type entered the sentient area of this object.
Definition: BipedObject.cpp:5286
virtual void LoadPhysics()
load the physics objects.
Definition: BipedObject.cpp:4696
BipedWayPoint & GetLastWayPoint()
get the last way point.
Definition: BipedObject.cpp:484
virtual void SetPhysicsGroupMask(DWORD dwValue)
set groups Mask used to filter physics objects, default to 0xffffffff.
Definition: BipedObject.cpp:4787
virtual void SetAssetFileName(const std::string &sFilename)
set asset file name
Definition: BipedObject.cpp:5240
AABB with orientation by a matrix.
Definition: ShapeOBB.h:11
virtual void SetUseGlobalTime(bool bUseGlobalTime)
whether to use global time to sync animation.
Definition: BipedObject.cpp:176
virtual int On_Net_Send(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
during the execution of this object, it may send various network commands to the server or client...
Definition: BipedObject.cpp:5334
base class for all AI objects
Definition: AIBase.h:9
virtual void UnloadPhysics()
load the physics object
Definition: BipedObject.cpp:4725
virtual int GetAnimation()
get the scaling.
Definition: BipedObject.cpp:4623
CBaseObject * GetPhysicsBBObj()
get a base object containing the bounding box of the physical biped.
Definition: BipedObject.cpp:4509
virtual float GetPitch()
get object pitch: is facing the positive x axis, if yaw is 0.
Definition: BipedObject.cpp:4241
void SetIsAnimPaused(bool bPaused)
true to pause animation.
Definition: BipedObject.h:261
virtual bool CanHasPhysics()
if the object may contain physics
Definition: BipedObject.cpp:4691
CharModelInstance * GetCharModelInstance()
get the character model instance.
Definition: BipedObject.cpp:362
bool IsAutoWalkupBlock()
whether automatically walk up block that is 1 block high in front of us.
Definition: BipedObject.cpp:4821
virtual void Rotate(float x, float y, float z)
Rotate the object.This only takes effects on objects having 3D orientation, such as static mesh and p...
Definition: BipedObject.cpp:4456
flashing the biped. Not implemented.
Definition: BipedObject.h:96
virtual void SetSizeScale(float dScale)
set the size of the object to dScale times of its original size.
Definition: BipedObject.cpp:4472
managing biped state
Definition: BipedStateManager.h:11
ParaXEntity * GetParaXEntity()
get parax asset entity if its type is ParaX model.
Definition: BipedObject.cpp:4777
bool MountOn(CBaseObject *pTarget, int nMountID=-1)
mount the current character on the target
Definition: BipedObject.cpp:5427
virtual void SetPhysicsGroup(int nGroup)
set the physics group ID to which this object belongs to default to 0, must be smaller than 32...
Definition: BipedObject.cpp:4738
float GetAccelerationDist()
when m_fSpeed is set, this acceleration is used on m_fLastSpeed, before it reach m_fSpeed.
Definition: BipedObject.cpp:4811
virtual HRESULT Draw(SceneState *sceneState)
Desc: Render this CBipedObject instance using the current animation frames.
Definition: BipedObject.cpp:1338
virtual void GetLocalTransform(Matrix4 *localTransform)
get local transform
Definition: BipedObject.cpp:1011
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
the player must arrive at this point, before proceeding to the next way point when in this mode...
Definition: BipedWayPoint.h:15
void ResetBaseModel(AssetEntity *assetCharBaseModel)
Reset base model.
Definition: BipedObject.cpp:5214
virtual std::string ToString(DWORD nMethod)
convert the object to an NPL string by which this object may be created or deleted.
Definition: BipedObject.cpp:195
void AnimateUserControl(double dTimeDelta)
Desc: Reads user input and update Tiny&#39;s state and animation accordingly.
Definition: BipedObject.cpp:1586
HRESULT InitObject(AssetEntity *pMAE)
Set the base character model.
Definition: BipedObject.cpp:382
void JumpUpward(float fVerticalSpeed, bool bJumpFromGround)
jump up.
Definition: BipedObject.cpp:5174
void UpdateSpeed(float fSpeed)
update the biped&#39;s speed.
Definition: BipedObject.cpp:4554
bool MoveTowards_OPC(double dTimeDelta, const DVector3 &vPosTarget, float fQuickMoveDistance=15.f)
move as an OPC.
Definition: BipedObject.cpp:1842
void ForceMove()
Command the biped to move using its current facing (orientation).
Definition: BipedObject.cpp:5142
void UpdateState(float fTimeDelta)
this function is only called by the AnimateBiped() to update states for active bipeds.
Definition: BipedObject.cpp:884
void AnimateIdle(double dTimeDelta)
Desc: Checks if Tiny has been idle for long enough.
Definition: BipedObject.cpp:1599
CAIBase * UseAIModule(const string &sAIType)
use a specified AI object.
Definition: BipedObject.cpp:305
bool MoveTowards(double dTimeDelta, const DVector3 &vPosTarget, float fStopDistance, bool *pIsSlidingWall=NULL)
Move the biped in the physical scene.move the biped towards the target using its current speed and fa...
Definition: BipedObject.cpp:1928
int GetCurrentAnimation()
get the ID of the current animation.
Definition: BipedObject.cpp:4608
void ReplaceAIModule(CAIBase *pNew)
replace the current AI module with a new one.
Definition: BipedObject.cpp:292
virtual bool SetReplaceableTexture(int ReplaceableTextureID, TextureEntity *pTextureEntity)
set the replaceable texture at the given index with a new texture.
Definition: BipedObject.cpp:4664
this is primary animation instance used for normal animated character or advanced customizable charac...
Definition: ParaXAnimInstance.h:13
void AnimateMoving(double dTimeDelta, bool bSharpTurning=false)
Desc: Here we try to figure out if we&#39;re moving and can keep moving, or if we&#39;re waiting / blocked an...
Definition: BipedObject.cpp:3914
void SetMovementStyle(PhysicsMoveStyle nValue)
how the character reacts to physics in the MoveTowards() functions
Definition: BipedObject.h:273
virtual void SetAnimFrame(int nFrame)
set the current animation frame number relative to the beginning of current animation.
Definition: BipedObject.cpp:5388
void SetSpeedAngle(float fSpeedAngle)
set the current speed angle.
Definition: BipedObject.cpp:4386
virtual void PathFinding(double dTimeDelta)
environment simulator call these functions
Definition: BipedObject.cpp:542
virtual void EnablePhysics(bool bEnable)
this function will turn on or off the physics of the object.
Definition: BipedObject.cpp:4753
virtual TextureEntity * GetReplaceableTexture(int ReplaceableTextureID)
get the current replaceable texture by its ID.
Definition: BipedObject.cpp:4654
void LoadStoredModel(int nModelSetID)
Load a stored model in data base by the model set ID.
Definition: BipedObject.cpp:5265
It can be used to represent biped object(like human, re spawning monsters) in the scene without inher...
Definition: BipedObject.h:60
virtual int On_LeaveSentientArea()
when no other game objects of different type is in the sentient area of this object.
Definition: BipedObject.cpp:5294
virtual void PopParam()
Usually, this is used in canvas drawing.
Definition: BipedObject.cpp:900
virtual void ChooseNewLocation(Vector3 *pV)
Desc: Determine a new location for this character to move to.
Definition: BipedObject.cpp:1574
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
void FacingTargetImmediately()
facing the target immediately.
Definition: BipedObject.cpp:4355
float GetSpeedAngle()
get the speed direction for physics.
Definition: BipedObject.cpp:4391
bool SetParamsFromAsset()
set params from asset when the asset is available (async asset loading)
Definition: BipedObject.cpp:1231
CParaXAnimInstance * GetParaXAnimInstance()
get the ParaX animation instance.
Definition: BipedObject.cpp:349
virtual float GetPhysicsRadius()
the biped is modeled as a cylinder or sphere during rough physics calculation.
Definition: BipedObject.cpp:4490
virtual bool IsUseGlobalTime()
whether to use global time to sync animation.
Definition: BipedObject.cpp:185
virtual void SetAnimation(int nAnimID)
Set the current animation id.
Definition: BipedObject.cpp:4618
float GetHeadFacing()
this is the same as GetFacing()+GetHeadTurningAngle();
Definition: BipedObject.cpp:4351
void PlayAnimation(DWORD nIndex, bool bUpdateSpeed=true, bool bAppend=false)
Plat a specified animation by its animation index.
Definition: BipedObject.cpp:4586