diff --git a/dGame/dBehaviors/MovementSwitchBehavior.cpp b/dGame/dBehaviors/MovementSwitchBehavior.cpp index c893e6e1..cb293692 100644 --- a/dGame/dBehaviors/MovementSwitchBehavior.cpp +++ b/dGame/dBehaviors/MovementSwitchBehavior.cpp @@ -18,42 +18,47 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* Game::logger->Log("MovementSwitchBehavior", "Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits()); return; }; - + Game::logger->LogDebug("MovementSwitchBehavior", "Movement type %i", movementType); switch (movementType) { case 1: + case 3: this->m_groundAction->Handle(context, bitStream, branch); break; case 2: this->m_jumpAction->Handle(context, bitStream, branch); break; - case 3: - this->m_fallingAction->Handle(context, bitStream, branch); - break; case 4: this->m_doubleJumpAction->Handle(context, bitStream, branch); break; case 5: - this->m_airAction->Handle(context, bitStream, branch); + this->m_fallingAction->Handle(context, bitStream, branch); break; case 6: this->m_jetpackAction->Handle(context, bitStream, branch); break; default: - Game::logger->Log("MovementSwitchBehavior", "Invalid movement behavior type (%i)!", movementType); - break; + this->m_groundAction->Handle(context, bitStream, branch); } } void MovementSwitchBehavior::Load() { - this->m_airAction = GetAction("air_action"); - - this->m_doubleJumpAction = GetAction("double_jump_action"); - - this->m_fallingAction = GetAction("falling_action"); - this->m_groundAction = GetAction("ground_action"); + this->m_airAction = GetAction("air_action"); + if (!this->m_airAction) this->m_airAction = this->m_groundAction; + + this->m_doubleJumpAction = GetAction("double_jump_action"); + if (!this->m_doubleJumpAction) this->m_airAction = this->m_groundAction; + + this->m_fallingAction = GetAction("falling_action"); + if (!this->m_fallingAction) this->m_airAction = this->m_groundAction; + this->m_jetpackAction = GetAction("jetpack_action"); + if (!this->m_jetpackAction) this->m_airAction = this->m_groundAction; this->m_jumpAction = GetAction("jump_action"); + if (!this->m_jumpAction) this->m_airAction = this->m_groundAction; + + this->m_movingAction = GetAction("moving_action"); + if (!this->m_movingAction) this->m_airAction = this->m_groundAction; } diff --git a/dGame/dBehaviors/MovementSwitchBehavior.h b/dGame/dBehaviors/MovementSwitchBehavior.h index 82e1a9e9..1d9544d5 100644 --- a/dGame/dBehaviors/MovementSwitchBehavior.h +++ b/dGame/dBehaviors/MovementSwitchBehavior.h @@ -19,6 +19,8 @@ public: Behavior* m_jumpAction; + Behavior* m_movingAction; + /* * Inherited */