persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
MovementComponent Class Reference

#include <MovementComponent.hpp>

Inheritance diagram for MovementComponent:
Collaboration diagram for MovementComponent:

Public Member Functions

void init () override
void destroy () override
void update (ae::q20_12_t) override
 Core update loop that calculates the character & camera movement.
ae::ComponentTypeID getType () const override
void configureMovement (const MovementConfig &config)
 Configure the movement system.
void start ()
 Start the update(ae::q20_12_t) loop by setting active to true.
void stop ()
 Stop the update(ae::q20_12_t) loop by setting active to false.
CharacterPosition isCharacterAt ()
 Get the current character position.
TileType isTileAt ()
 Get the tile value at the current character position.

Static Public Attributes

static constexpr ae::ComponentTypeID TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Movement)

Protected Member Functions

void submitToManager () override

Private Member Functions

ae::q20_12_t getGroundHeight (ae::q20_12_t x, ae::q20_12_t z) const
TileType isTileAt (int tileX, int tileY)
 Get the tile value at the given position.
bool isTileWalkable (ae::q20_12_t worldX, ae::q20_12_t worldZ)
 Checks for collision at the given position.

Private Attributes

MathManager & math = MathManager::getInstance()
AnimationController * animationCtrl = AnimationController::getInstance()
MovementConfig config
CameraMode cameraMode = CameraMode::Static
int walkAnim
int idleAnim

Detailed Description

Definition at line 21 of file MovementComponent.hpp.

Member Function Documentation

◆ configureMovement()

void MovementComponent::configureMovement ( const MovementConfig & config)

Configure the movement system.

Required to call before calling start().

Parameters
configThe struct containing the movement configuration to apply.

Definition at line 127 of file MovementComponent.cpp.

◆ destroy()

void MovementComponent::destroy ( )
override

Definition at line 18 of file MovementComponent.cpp.

◆ getGroundHeight()

ae::q20_12_t MovementComponent::getGroundHeight ( ae::q20_12_t x,
ae::q20_12_t z ) const
private

Definition at line 225 of file MovementComponent.cpp.

Here is the caller graph for this function:

◆ getType()

ae::ComponentTypeID MovementComponent::getType ( ) const
inlineoverride

Definition at line 36 of file MovementComponent.hpp.

◆ init()

void MovementComponent::init ( )
override

Definition at line 11 of file MovementComponent.cpp.

◆ isCharacterAt()

CharacterPosition MovementComponent::isCharacterAt ( )

Get the current character position.

Returns
the character position & facing angle in 3D space

Definition at line 142 of file MovementComponent.cpp.

Here is the caller graph for this function:

◆ isTileAt() [1/2]

TileType MovementComponent::isTileAt ( )

Get the tile value at the current character position.

Wrapper function for private isTileAt(int tileX, int tileY) function. Tiles are invisible triggers in 3D space.

Returns
the TileType at the current character position in 3D space

Definition at line 154 of file MovementComponent.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTileAt() [2/2]

TileType MovementComponent::isTileAt ( int tileX,
int tileY )
private

Get the tile value at the given position.

If a TileType is not defined for the given position, TileType defaults to TileType::NO_COLLISION.

Returns
the TileType at the given position in 3D space

Definition at line 163 of file MovementComponent.cpp.

◆ isTileWalkable()

bool MovementComponent::isTileWalkable ( ae::q20_12_t worldX,
ae::q20_12_t worldZ )
private

Checks for collision at the given position.

Collision is TileType::COLLISION

Returns
true if there is collision at the given position in 3D space, otherwise false

Definition at line 176 of file MovementComponent.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void MovementComponent::start ( )

Start the update(ae::q20_12_t) loop by setting active to true.

Movement must be set by configureMovement() before start() can be called

Definition at line 132 of file MovementComponent.cpp.

◆ stop()

void MovementComponent::stop ( )

Stop the update(ae::q20_12_t) loop by setting active to false.

Definition at line 137 of file MovementComponent.cpp.

◆ submitToManager()

void MovementComponent::submitToManager ( )
inlineoverrideprotected

Definition at line 80 of file MovementComponent.hpp.

◆ update()

void MovementComponent::update ( ae::q20_12_t )
override

Core update loop that calculates the character & camera movement.

Parameters
dtFixed-point delta time passed from the aegis engine loop (currently unused).

Definition at line 23 of file MovementComponent.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ animationCtrl

AnimationController* MovementComponent::animationCtrl = AnimationController::getInstance()
private

Definition at line 88 of file MovementComponent.hpp.

◆ cameraMode

CameraMode MovementComponent::cameraMode = CameraMode::Static
private

Definition at line 91 of file MovementComponent.hpp.

◆ config

MovementConfig MovementComponent::config
private

Definition at line 90 of file MovementComponent.hpp.

◆ idleAnim

int MovementComponent::idleAnim
private

Definition at line 93 of file MovementComponent.hpp.

◆ math

MathManager& MovementComponent::math = MathManager::getInstance()
private

Definition at line 87 of file MovementComponent.hpp.

◆ TYPE_ID

ae::ComponentTypeID MovementComponent::TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Movement)
staticconstexpr

Definition at line 24 of file MovementComponent.hpp.

◆ walkAnim

int MovementComponent::walkAnim
private

Definition at line 92 of file MovementComponent.hpp.


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