[Scummvm-git-logs] scummvm master -> 38360e51c47b351b6e0026ee7482c86218f7d90c

mgerhardy martin.gerhardy at gmail.com
Sat Jan 2 09:21:13 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
38360e51c4 TWINE: allow to continue running after jump animation finished


Commit: 38360e51c47b351b6e0026ee7482c86218f7d90c
    https://github.com/scummvm/scummvm/commit/38360e51c47b351b6e0026ee7482c86218f7d90c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T10:21:04+01:00

Commit Message:
TWINE: allow to continue running after jump animation finished

https://bugs.scummvm.org/ticket/12004

Changed paths:
    engines/twine/input.cpp
    engines/twine/input.h
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/movements.cpp


diff --git a/engines/twine/input.cpp b/engines/twine/input.cpp
index 60f86b3195..7e9b9baf2b 100644
--- a/engines/twine/input.cpp
+++ b/engines/twine/input.cpp
@@ -48,13 +48,6 @@ ScopedKeyMap::~ScopedKeyMap() {
 
 Input::Input(TwinEEngine *engine) : _engine(engine) {}
 
-void Input::toggleMovementActions() {
-	actionStates[TwinEActionType::MoveForward] = 0;
-	actionStates[TwinEActionType::MoveBackward] = 0;
-	actionStates[TwinEActionType::TurnRight] = 0;
-	actionStates[TwinEActionType::TurnLeft] = 0;
-}
-
 bool Input::isActionActive(TwinEActionType actionType, bool onlyFirstTime) const {
 	if (onlyFirstTime) {
 		return actionStates[actionType] == 1;
diff --git a/engines/twine/input.h b/engines/twine/input.h
index d6350d8a5d..f135e4e512 100644
--- a/engines/twine/input.h
+++ b/engines/twine/input.h
@@ -135,11 +135,6 @@ public:
 	 */
 	bool isActionActive(TwinEActionType actionType, bool onlyFirstTime = true) const;
 
-	/**
-	 * @brief Reset and active move state. This is used in situtation where the hero is switching animations but any active
-	 * move state would switch back to the related move animation.
-	 */
-	void toggleMovementActions();
 	bool isMouseHovering(const Common::Rect &rect) const;
 
 	/**
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 65592c220c..54164193f9 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -535,4 +535,8 @@ bool ActorStruct::isAttackAnimationActive() const {
 	return anim == AnimationTypes::kRightPunch || anim == AnimationTypes::kLeftPunch || anim == AnimationTypes::kKick;
 }
 
+bool ActorStruct::isJumpAnimationActive() const {
+	return anim == AnimationTypes::kJump;
+}
+
 } // namespace TwinE
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 1e81a6d08e..49a5143d55 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -185,6 +185,7 @@ public:
 	int32 entityDataSize = 0;
 
 	bool isAttackAnimationActive() const;
+	bool isJumpAnimationActive() const;
 
 	int32 x = 0;
 	int32 y = 0;
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 5b77ede90a..2fbb3d1331 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -225,7 +225,6 @@ bool Movements::processBehaviourExecution(int actorIdx) {
 		break;
 	case HeroBehaviourType::kAthletic:
 		_engine->_animations->initAnim(AnimationTypes::kJump, 1, AnimationTypes::kStanding, actorIdx);
-		_engine->_input->toggleMovementActions();
 		break;
 	case HeroBehaviourType::kAggressive:
 		if (_engine->_actor->autoAgressive) {
@@ -296,6 +295,9 @@ void Movements::processMovementExecution(int actorIdx) {
 	if (_engine->_actor->autoAgressive && actor->isAttackAnimationActive()) {
 		return;
 	}
+	if (actor->isJumpAnimationActive()) {
+		return;
+	}
 	if (!changedCursorKeys || heroAction) {
 		// if walking should get stopped
 		if (!_engine->_input->isActionActive(TwinEActionType::MoveForward) && !_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
@@ -343,6 +345,9 @@ void Movements::processRotationExecution(int actorIdx) {
 	if (_engine->_actor->autoAgressive && actor->isAttackAnimationActive()) {
 		return;
 	}
+	if (actor->isJumpAnimationActive()) {
+		return;
+	}
 	int16 tempAngle;
 	if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
 		tempAngle = ANGLE_90;




More information about the Scummvm-git-logs mailing list