Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
CCmpPosition Class Reference

Basic ICmpPosition implementation. More...

Inheritance diagram for CCmpPosition:
ICmpPosition IComponent

Public Types

enum  { UPRIGHT = 0, PITCH = 1, PITCH_ROLL = 2, ROLL =3 }
 

Public Member Functions

virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual bool IsInWorld ()
 Returns true if the entity currently exists at a defined position in the world. More...
 
virtual void MoveOutOfWorld ()
 Causes IsInWorld to return false. More...
 
virtual void MoveTo (entity_pos_t x, entity_pos_t z)
 Move smoothly to the given location. More...
 
virtual void JumpTo (entity_pos_t x, entity_pos_t z)
 Move immediately to the given location, with no interpolation. More...
 
virtual void SetHeightOffset (entity_pos_t dy)
 Set the vertical offset above the terrain/water surface. More...
 
virtual entity_pos_t GetHeightOffset ()
 Returns the current vertical offset above the terrain/water surface. More...
 
virtual void SetHeightFixed (entity_pos_t y)
 Set the vertical position as a fixed, absolute value. More...
 
virtual bool IsFloating ()
 Returns whether the entity floats on water. More...
 
virtual CFixedVector3D GetPosition ()
 Returns the current x,y,z position (no interpolation). More...
 
virtual CFixedVector2D GetPosition2D ()
 Returns the current x,z position (no interpolation). More...
 
virtual CFixedVector3D GetPreviousPosition ()
 Returns the previous turn's x,y,z position (no interpolation). More...
 
virtual CFixedVector2D GetPreviousPosition2D ()
 Returns the previous turn's x,z position (no interpolation). More...
 
virtual void TurnTo (entity_angle_t y)
 Rotate smoothly to the given angle around the upwards axis. More...
 
virtual void SetYRotation (entity_angle_t y)
 Rotate immediately to the given angle around the upwards axis. More...
 
virtual void SetXZRotation (entity_angle_t x, entity_angle_t z)
 Rotate immediately to the given angles around the X (pitch) and Z (roll) axes. More...
 
virtual CFixedVector3D GetRotation ()
 Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll. More...
 
virtual fixed GetDistanceTravelled ()
 Returns the distance that the unit will be interpolated over, i.e. More...
 
virtual void GetInterpolatedPosition2D (float frameOffset, float &x, float &z, float &rotY)
 Get the current interpolated 2D position and orientation, for rendering. More...
 
virtual CMatrix3D GetInterpolatedTransform (float frameOffset, bool forceFloating)
 Get the current interpolated transform matrix, for rendering. More...
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual JSClass * GetJSClass () const
 
virtual jsval GetJSInstance () const
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (ScriptInterface &, jsval)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Public Attributes

enum CCmpPosition:: { ... }  m_AnchorType
 
bool m_Floating
 
float m_RotYSpeed
 
bool m_InWorld
 
entity_pos_t m_X
 
entity_pos_t m_Z
 
entity_pos_t m_LastX
 
entity_pos_t m_LastZ
 
entity_pos_t m_PrevX
 
entity_pos_t m_PrevZ
 
entity_pos_t m_YOffset
 
entity_pos_t m_LastYOffset
 
bool m_RelativeToGround
 
entity_angle_t m_RotX
 
entity_angle_t m_RotY
 
entity_angle_t m_RotZ
 
float m_InterpolatedRotX
 
float m_InterpolatedRotY
 
float m_InterpolatedRotZ
 
float m_LastInterpolatedRotX
 
float m_LastInterpolatedRotZ
 
bool m_NeedInitialXZRotation
 

Private Member Functions

void AdvertisePositionChanges ()
 
void UpdateXZRotation ()
 

Detailed Description

Basic ICmpPosition implementation.

Definition at line 39 of file CCmpPosition.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
UPRIGHT 
PITCH 
PITCH_ROLL 
ROLL 

Definition at line 57 of file CCmpPosition.cpp.

Member Function Documentation

void CCmpPosition::AdvertisePositionChanges ( )
inlineprivate

Definition at line 548 of file CCmpPosition.cpp.

static IComponent* CCmpPosition::Allocate ( ScriptInterface ,
jsval   
)
inlinestatic

Definition at line 53 of file CCmpPosition.cpp.

static void CCmpPosition::ClassInit ( CComponentManager componentManager)
inlinestatic

Definition at line 42 of file CCmpPosition.cpp.

static void CCmpPosition::Deallocate ( IComponent cmp)
inlinestatic

Definition at line 53 of file CCmpPosition.cpp.

virtual void CCmpPosition::Deinit ( )
inlinevirtual

Implements IComponent.

Definition at line 141 of file CCmpPosition.cpp.

virtual void CCmpPosition::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlinevirtual

Implements IComponent.

Definition at line 188 of file CCmpPosition.cpp.

virtual fixed CCmpPosition::GetDistanceTravelled ( )
inlinevirtual

Returns the distance that the unit will be interpolated over, i.e.

the distance travelled since the start of the turn.

Implements ICmpPosition.

Definition at line 414 of file CCmpPosition.cpp.

virtual entity_pos_t CCmpPosition::GetHeightOffset ( )
inlinevirtual

Returns the current vertical offset above the terrain/water surface.

Implements ICmpPosition.

Definition at line 272 of file CCmpPosition.cpp.

virtual void CCmpPosition::GetInterpolatedPosition2D ( float  frameOffset,
float &  x,
float &  z,
float &  rotY 
)
inlinevirtual

Get the current interpolated 2D position and orientation, for rendering.

Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 425 of file CCmpPosition.cpp.

virtual CMatrix3D CCmpPosition::GetInterpolatedTransform ( float  frameOffset,
bool  forceFloating 
)
inlinevirtual

Get the current interpolated transform matrix, for rendering.

Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 439 of file CCmpPosition.cpp.

virtual CFixedVector3D CCmpPosition::GetPosition ( )
inlinevirtual

Returns the current x,y,z position (no interpolation).

Depends on the current terrain heightmap. Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 296 of file CCmpPosition.cpp.

virtual CFixedVector2D CCmpPosition::GetPosition2D ( )
inlinevirtual

Returns the current x,z position (no interpolation).

Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 322 of file CCmpPosition.cpp.

virtual CFixedVector3D CCmpPosition::GetPreviousPosition ( )
inlinevirtual

Returns the previous turn's x,y,z position (no interpolation).

Depends on the current terrain heightmap. Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 333 of file CCmpPosition.cpp.

virtual CFixedVector2D CCmpPosition::GetPreviousPosition2D ( )
inlinevirtual

Returns the previous turn's x,z position (no interpolation).

Must not be called unless IsInWorld is true.

Implements ICmpPosition.

Definition at line 359 of file CCmpPosition.cpp.

virtual CFixedVector3D CCmpPosition::GetRotation ( )
inlinevirtual

Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll.

(TODO: is that the right way round?)

Implements ICmpPosition.

Definition at line 409 of file CCmpPosition.cpp.

static std::string CCmpPosition::GetSchema ( )
inlinestatic

Definition at line 85 of file CCmpPosition.cpp.

virtual void CCmpPosition::HandleMessage ( const CMessage msg,
bool  global 
)
inlinevirtual

Reimplemented from IComponent.

Definition at line 482 of file CCmpPosition.cpp.

virtual void CCmpPosition::Init ( const CParamNode paramNode)
inlinevirtual

Implements IComponent.

Definition at line 114 of file CCmpPosition.cpp.

virtual bool CCmpPosition::IsFloating ( )
inlinevirtual

Returns whether the entity floats on water.

Implements ICmpPosition.

Definition at line 291 of file CCmpPosition.cpp.

virtual bool CCmpPosition::IsInWorld ( )
inlinevirtual

Returns true if the entity currently exists at a defined position in the world.

Implements ICmpPosition.

Definition at line 214 of file CCmpPosition.cpp.

virtual void CCmpPosition::JumpTo ( entity_pos_t  x,
entity_pos_t  z 
)
inlinevirtual

Move immediately to the given location, with no interpolation.

Implements ICmpPosition.

Definition at line 242 of file CCmpPosition.cpp.

virtual void CCmpPosition::MoveOutOfWorld ( )
inlinevirtual

Causes IsInWorld to return false.

(Use MoveTo() or JumpTo() to move back into the world.)

Implements ICmpPosition.

Definition at line 219 of file CCmpPosition.cpp.

virtual void CCmpPosition::MoveTo ( entity_pos_t  x,
entity_pos_t  z 
)
inlinevirtual

Move smoothly to the given location.

Implements ICmpPosition.

Definition at line 226 of file CCmpPosition.cpp.

virtual void CCmpPosition::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

Definition at line 145 of file CCmpPosition.cpp.

virtual void CCmpPosition::SetHeightFixed ( entity_pos_t  y)
inlinevirtual

Set the vertical position as a fixed, absolute value.

Will stay at this height until the next call to SetHeightFixed or SetHeightOffset.

Implements ICmpPosition.

Definition at line 277 of file CCmpPosition.cpp.

virtual void CCmpPosition::SetHeightOffset ( entity_pos_t  dy)
inlinevirtual

Set the vertical offset above the terrain/water surface.

Implements ICmpPosition.

Definition at line 256 of file CCmpPosition.cpp.

virtual void CCmpPosition::SetXZRotation ( entity_angle_t  x,
entity_angle_t  z 
)
inlinevirtual

Rotate immediately to the given angles around the X (pitch) and Z (roll) axes.

Parameters
xradians around the X axis. (TODO: in which direction?)
zradians around the Z axis.
Note
if either x or z is non-zero, it will override terrain conformance mode

Implements ICmpPosition.

Definition at line 393 of file CCmpPosition.cpp.

virtual void CCmpPosition::SetYRotation ( entity_angle_t  y)
inlinevirtual

Rotate immediately to the given angle around the upwards axis.

Parameters
yclockwise radians from the +Z axis.

Implements ICmpPosition.

Definition at line 377 of file CCmpPosition.cpp.

virtual void CCmpPosition::TurnTo ( entity_angle_t  y)
inlinevirtual

Rotate smoothly to the given angle around the upwards axis.

Parameters
yclockwise radians from the +Z axis.

Implements ICmpPosition.

Definition at line 370 of file CCmpPosition.cpp.

void CCmpPosition::UpdateXZRotation ( )
inlineprivate

Definition at line 562 of file CCmpPosition.cpp.

Member Data Documentation

enum { ... } CCmpPosition::m_AnchorType
bool CCmpPosition::m_Floating

Definition at line 65 of file CCmpPosition.cpp.

float CCmpPosition::m_InterpolatedRotX

Definition at line 80 of file CCmpPosition.cpp.

float CCmpPosition::m_InterpolatedRotY

Definition at line 80 of file CCmpPosition.cpp.

float CCmpPosition::m_InterpolatedRotZ

Definition at line 80 of file CCmpPosition.cpp.

bool CCmpPosition::m_InWorld

Definition at line 70 of file CCmpPosition.cpp.

float CCmpPosition::m_LastInterpolatedRotX

Definition at line 81 of file CCmpPosition.cpp.

float CCmpPosition::m_LastInterpolatedRotZ

Definition at line 81 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_LastX

Definition at line 73 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_LastYOffset

Definition at line 74 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_LastZ

Definition at line 73 of file CCmpPosition.cpp.

bool CCmpPosition::m_NeedInitialXZRotation

Definition at line 83 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_PrevX

Definition at line 73 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_PrevZ

Definition at line 73 of file CCmpPosition.cpp.

bool CCmpPosition::m_RelativeToGround

Definition at line 75 of file CCmpPosition.cpp.

entity_angle_t CCmpPosition::m_RotX

Definition at line 77 of file CCmpPosition.cpp.

entity_angle_t CCmpPosition::m_RotY

Definition at line 77 of file CCmpPosition.cpp.

float CCmpPosition::m_RotYSpeed

Definition at line 66 of file CCmpPosition.cpp.

entity_angle_t CCmpPosition::m_RotZ

Definition at line 77 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_X

Definition at line 73 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_YOffset

Definition at line 74 of file CCmpPosition.cpp.

entity_pos_t CCmpPosition::m_Z

Definition at line 73 of file CCmpPosition.cpp.


The documentation for this class was generated from the following file: