[Scummvm-git-logs] scummvm master -> 4c25dad11a5db1604a5d5aecdf1a9cc2c0da3f2e
mgerhardy
martin.gerhardy at gmail.com
Mon Nov 1 17:12:12 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2649654485 TWINE: the demo of lba1 has three scenes
4c25dad11a TWINE: updated collision code to be closer to the original source code
Commit: 2649654485bffbf3696d210922f9272aef71815f
https://github.com/scummvm/scummvm/commit/2649654485bffbf3696d210922f9272aef71815f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-11-01T18:08:39+01:00
Commit Message:
TWINE: the demo of lba1 has three scenes
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 1dce5bb85b..3c19a72d81 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -722,8 +722,12 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
if (_scene->_needChangeScene > -1) {
if (!isMod() && isDemo() && isLBA1()) {
- // the demo only has these two scenes
- if (_scene->_needChangeScene != LBA1SceneId::Citadel_Island_Prison && _scene->_needChangeScene != LBA1SceneId::Citadel_Island_outside_the_citadel) {
+ // the demo only has these scenes
+ if (_scene->_needChangeScene != LBA1SceneId::Citadel_Island_Prison
+ && _scene->_needChangeScene != LBA1SceneId::Citadel_Island_outside_the_citadel
+ && _scene->_needChangeScene != LBA1SceneId::Citadel_Island_near_the_tavern) {
+ // TODO: PlayMidiFile(6);
+ // TODO: Credits();
return 1;
}
}
Commit: 4c25dad11a5db1604a5d5aecdf1a9cc2c0da3f2e
https://github.com/scummvm/scummvm/commit/4c25dad11a5db1604a5d5aecdf1a9cc2c0da3f2e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-11-01T18:08:40+01:00
Commit Message:
TWINE: updated collision code to be closer to the original source code
Changed paths:
engines/twine/scene/actor.h
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index a8edb49e78..a6dfc64870 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -91,22 +91,22 @@ struct StaticFlagsStruct {
/** Actors dynamic flags structure */
struct DynamicFlagsStruct {
- uint16 bWaitHitFrame : 1; // 0x0001 wait for hit frame
- uint16 bIsHitting : 1; // 0x0002 hit frame anim
- uint16 bAnimEnded : 1; // 0x0004 anim ended in the current loop (will be looped in the next engine loop)
- uint16 bAnimFrameReached : 1; // 0x0008 new frame anim reached
- uint16 bIsVisible : 1; // 0x0010 actor has been drawn in this loop
- uint16 bIsDead : 1; // 0x0020 is dead
- uint16 bIsSpriteMoving : 1; // 0x0040 door is opening or closing (wait to reach the destination position)
- uint16 bIsRotationByAnim : 1; // 0x0080 actor rotation is managed by its animaation not by the engine
- uint16 bIsFalling : 1; // 0x0100 is falling on scene
- uint16 bUnk0200 : 1; // 0x0200 unused
- uint16 bUnk0400 : 1; // 0x0400 unused
- uint16 bUnk0800 : 1; // 0x0800 unused
- uint16 bUnk1000 : 1; // 0x1000 unused
- uint16 bUnk2000 : 1; // 0x2000 unused
- uint16 bUnk4000 : 1; // 0x4000 unused
- uint16 bUnk8000 : 1; // 0x8000 unused
+ uint16 bWaitHitFrame : 1; // 0x0001 wait for hit frame
+ uint16 bIsHitting : 1; // 0x0002 hit frame anim
+ uint16 bAnimEnded : 1; // 0x0004 anim ended in the current loop (will be looped in the next engine loop)
+ uint16 bAnimFrameReached : 1; // 0x0008 new frame anim reached
+ uint16 bIsVisible : 1; // 0x0010 actor has been drawn in this loop
+ uint16 bIsDead : 1; // 0x0020 is dead
+ uint16 bIsSpriteMoving : 1; // 0x0040 door is opening or closing (wait to reach the destination position)
+ uint16 bIsRotationByAnim : 1; // 0x0080 actor rotation is managed by its animaation not by the engine
+ uint16 bIsFalling : 1; // 0x0100 is falling on scene
+ uint16 bIsTargetable : 1; // 0x0200
+ uint16 bIsBlinking : 1; // 0x0400
+ uint16 bWasWalkingBeforeFalling : 1; // 0x0800
+ uint16 bUnk1000 : 1; // 0x1000
+ uint16 bUnk2000 : 1; // 0x2000
+ uint16 bUnk4000 : 1; // 0x4000
+ uint16 bUnk8000 : 1; // 0x8000
};
/**
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index af6baf0637..f481af79b7 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -763,9 +763,23 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (IS_HERO(actorIdx) && _engine->_scene->_heroYBeforeFall == 0) {
_engine->_scene->_heroYBeforeFall = processActor.y;
- }
- initAnim(AnimationTypes::kFall, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
+ int32 y = processActor.y - 1 - BRICK_HEIGHT;
+ while (y > 0 && ShapeType::kNone == _engine->_grid->getBrickShape(processActor.x, y, processActor.z)) {
+ y -= BRICK_HEIGHT;
+ }
+
+ y = (y + BRICK_HEIGHT) & ~(BRICK_HEIGHT - 1);
+ int32 fallHeight = processActor.y - y;
+
+ if (fallHeight <= (2 * BRICK_HEIGHT) && actor->_anim == AnimationTypes::kForward) {
+ actor->_dynamicFlags.bWasWalkingBeforeFalling = 1;
+ } else {
+ initAnim(AnimationTypes::kFall, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
+ }
+ } else {
+ initAnim(AnimationTypes::kFall, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
+ }
}
}
}
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 714c7e4a53..7e2fb0857c 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -384,10 +384,15 @@ void Collision::stopFalling() { // ReceptionObj()
_engine->_actor->_processActorPtr->addLife(-1);
}
_engine->_animations->initAnim(AnimationTypes::kLandingHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
- } else if (fall > 10) {
+ } else if (fall > 2 * BRICK_HEIGHT) {
_engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
} else {
- _engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
+ if (_engine->_actor->_processActorPtr->_dynamicFlags.bWasWalkingBeforeFalling) {
+ // try to not interrupt walk animation if Twinsen falls down from small height
+ _engine->_animations->initAnim(AnimationTypes::kForward, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
+ } else {
+ _engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
+ }
}
_engine->_scene->_heroYBeforeFall = 0;
@@ -396,6 +401,7 @@ void Collision::stopFalling() { // ReceptionObj()
}
_engine->_actor->_processActorPtr->_dynamicFlags.bIsFalling = 0;
+ _engine->_actor->_processActorPtr->_dynamicFlags.bWasWalkingBeforeFalling = 0;
}
int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 actorIdx) {
More information about the Scummvm-git-logs
mailing list