[Scummvm-git-logs] scummvm master -> 1645c4b38e5fc1105a44be29008cc9969580d6a4
sev-
noreply at scummvm.org
Sat Apr 29 10:11:21 UTC 2023
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:
1645c4b38e PINK: Handle animations with non standard start frame (#4942)
Commit: 1645c4b38e5fc1105a44be29008cc9969580d6a4
https://github.com/scummvm/scummvm/commit/1645c4b38e5fc1105a44be29008cc9969580d6a4
Author: Athanasios Antoniou (a.antoniou79 at gmail.com)
Date: 2023-04-29T12:11:17+02:00
Commit Message:
PINK: Handle animations with non standard start frame (#4942)
There are a few animations with start frame >= 0 and also >= framecount
It seems that for such animations, the decoder is supposed to start at 0 and play framecount number of frames.
So for these cases we deduct a _startFrame ammount before sending them to decoder.
This addresses crash bug #14438 PINK: Crash in Egypt when using the digger on the characters for Passport to Peril
Also, set startFrame to 0 for non-standard animations
Changed paths:
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actors/actor.cpp
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 17146e1d325..d3e2b78c24c 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -54,10 +54,10 @@ void ActionLoop::toConsole() const {
}
void ActionLoop::update() {
- int frame = _decoder.getCurFrame();
+ int32 frame = _decoder.getCurFrame();
if (!_inLoop) {
- if (frame < (int)_startFrame) {
+ if (frame < (int32)_startFrame) {
decodeNext();
return;
} else
@@ -75,7 +75,7 @@ void ActionLoop::update() {
decodeNext();
}
} else {
- if (frame > (int)_startFrame) {
+ if (frame > (int32)_startFrame) {
ActionCEL::setFrame(frame - 1);
} else {
_forward = true;
@@ -83,18 +83,21 @@ void ActionLoop::update() {
decodeNext();
}
break;
+
case kRandom: {
Common::RandomSource &rnd = _actor->getPage()->getGame()->getRnd();
ActionCEL::setFrame(rnd.getRandomNumberRng(_startFrame, _stopFrame));
decodeNext();
break;
}
+
case kForward:
if (frame == _stopFrame) {
ActionCEL::setFrame(_startFrame);
}
decodeNext();
break;
+
default:
break;
}
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index bdf4aa7d7fa..69b50edb92c 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -60,13 +60,14 @@ void ActionPlay::pause(bool paused) {
void ActionPlay::onStart() {
debugC(6, kPinkDebugActions, "Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- int frameCount = _decoder.getFrameCount();
- if (_stopFrame == -1 || _stopFrame >= frameCount)
- _stopFrame = frameCount - 1;
+ int32 frameCount = _decoder.getFrameCount();
- if (_startFrame >= _decoder.getFrameCount()) {
- _actor->endAction();
- return;
+ if ((int32)_startFrame >= frameCount) {
+ _startFrame = 0;
+ }
+
+ if (_stopFrame == -1 || _stopFrame >= frameCount) {
+ _stopFrame = frameCount - 1;
}
ActionCEL::setFrame(_startFrame);
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 676eb43679a..cee588620a0 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -31,7 +31,7 @@ namespace Pink {
Actor::Actor()
: _page(nullptr), _action(nullptr),
- _isActionEnded(1) {}
+ _isActionEnded(true) {}
Actor::~Actor() {
for (uint i = 0; i < _actions.size(); ++i) {
@@ -63,9 +63,9 @@ void Actor::init(bool paused) {
_action = findAction(kIdleAction);
if (!_action) {
- _isActionEnded = 1;
+ _isActionEnded = true;
} else {
- _isActionEnded = 0;
+ _isActionEnded = false;
_action->start();
_action->pause(paused);
}
@@ -113,19 +113,19 @@ Common::String Actor::getLocation() const {
void Actor::setAction(Action *newAction) {
if (_action) {
- _isActionEnded = 1;
+ _isActionEnded = true;
_action->end();
}
_action = newAction;
if (newAction) {
- _isActionEnded = 0;
+ _isActionEnded = false;
_action->start();
}
}
void Actor::setAction(Action *newAction, bool loadingSave) {
if (loadingSave) {
- _isActionEnded = 1;
+ _isActionEnded = true;
_action = newAction;
} else {
setAction(newAction);
More information about the Scummvm-git-logs
mailing list