[Scummvm-git-logs] scummvm master -> 1fddaefa2b6d31e3a1cf165cbe74ef1051029fa2

mgerhardy martin.gerhardy at gmail.com
Fri Jan 1 14:51:08 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:
1fddaefa2b TWINE: allow to execute the jump action while running


Commit: 1fddaefa2b6d31e3a1cf165cbe74ef1051029fa2
    https://github.com/scummvm/scummvm/commit/1fddaefa2b6d31e3a1cf165cbe74ef1051029fa2
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-01T15:50:51+01:00

Commit Message:
TWINE: allow to execute the jump action while running

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

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


diff --git a/engines/twine/input.cpp b/engines/twine/input.cpp
index 7e9b9baf2b..60f86b3195 100644
--- a/engines/twine/input.cpp
+++ b/engines/twine/input.cpp
@@ -48,6 +48,13 @@ 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 f135e4e512..d6350d8a5d 100644
--- a/engines/twine/input.h
+++ b/engines/twine/input.h
@@ -135,6 +135,11 @@ 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.h b/engines/twine/scene/actor.h
index a7d4f1e698..307d33367c 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -230,8 +230,7 @@ public:
 	int32 previousAnimIdx = 0;
 	int32 doorStatus = 0;
 	int32 animPosition = 0;
-	// 0 == loop
-	int32 animType = 0;   // field_78
+	int32 animType = kAnimationTypeLoop;   // field_78
 	int32 brickSound = 0; // field_7A
 
 	ZVBox boudingBox;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 6056308a75..64a908b482 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -652,7 +652,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
 				if (numKeyframe == getNumKeyframes(animPtr)) {
 					actor->dynamicFlags.bIsHitting = 0;
 
-					if (actor->animType == 0) {
+					if (actor->animType == kAnimationTypeLoop) {
 						actor->animPosition = getStartKeyframe(animPtr);
 					} else {
 						actor->anim = (AnimationTypes)actor->animExtra;
@@ -665,7 +665,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
 
 						actor->animExtraPtr = currentActorAnimExtraPtr;
 
-						actor->animType = 0;
+						actor->animType = kAnimationTypeLoop;
 						actor->animPosition = 0;
 						actor->strengthOfHit = 0;
 					}
diff --git a/engines/twine/scene/animations.h b/engines/twine/scene/animations.h
index dab05e546a..13e269637e 100644
--- a/engines/twine/scene/animations.h
+++ b/engines/twine/scene/animations.h
@@ -29,6 +29,8 @@
 
 namespace TwinE {
 
+#define kAnimationTypeLoop 0
+
 class TwinEEngine;
 
 class Animations {
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 8f9544122e..1354bab303 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -225,6 +225,7 @@ 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) {
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index af64ddd7c8..7d8ecb0618 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -322,6 +322,7 @@ static int32 mGOTO_POINT_3D(TwinEEngine *engine, MoveScriptContext &ctx) {
 	engine->_renderer->destZ = sp.z;
 
 	ctx.actor->angle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->x, ctx.actor->z, sp.x, sp.z);
+	// TODO: this adds an angle to the animType value
 	ctx.actor->animType = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->y, 0, sp.y, engine->_movements->targetActorDistance);
 
 	if (engine->_movements->targetActorDistance > 100) {




More information about the Scummvm-git-logs mailing list