aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/pink/constants.h5
-rw-r--r--engines/pink/objects/actions/action_cel.h2
-rw-r--r--engines/pink/objects/actions/action_still.cpp5
-rw-r--r--engines/pink/objects/actions/action_still.h2
-rw-r--r--engines/pink/pda_mgr.cpp37
-rw-r--r--engines/pink/pda_mgr.h12
6 files changed, 58 insertions, 5 deletions
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 574f66df2a..18d994f0f5 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -211,6 +211,11 @@ static const char * const kSfx = "SFX";
static const char * const kRightHand = "RightHand";
static const char * const kLeftHand = "LeftHand";
+static const char * const kLeft1Name = "Left1";
+static const char * const kLeft2Name = "Left2";
+static const char * const kLeft3Name = "Left3";
+static const char * const kLeft4Name = "Left4";
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 2a88350458..729ad69af7 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -57,8 +57,8 @@ public:
protected:
virtual void onStart() = 0;
- void setFrame(uint frame);
void decodeNext();
+ void setFrame(uint frame);
void loadDecoder();
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 9c1ba083c9..d0b27586d4 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -65,4 +65,9 @@ void ActionStill::setFrame(uint frame) {
decodeNext();
}
+void ActionStill::nextFrameLooped() {
+ assert(_decoder.getCurFrame() != -1);
+ setFrame((_decoder.getCurFrame() + 1) % _decoder.getFrameCount());
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index e3fb386c26..f43c2b08bd 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -39,6 +39,8 @@ public:
void setFrame(uint frame);
+ void nextFrameLooped();
+
protected:
void onStart() override;
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 2728ac1638..49b43cba76 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -34,7 +34,8 @@ static const char * const g_domains[] = {"NAT", "CLO", "HIS", "REL", "PLA", "ART
PDAMgr::PDAMgr(Pink::PinkEngine *game)
: _game(game), _page(nullptr), _globalPage(nullptr),
- _cursorMgr(game, nullptr), _countryIndex(0), _domainIndex(0) {}
+ _cursorMgr(game, nullptr), _countryIndex(0), _domainIndex(0),
+ _iteration(0), _handFrame(0), _leftHandAction(kLeft1) {}
PDAMgr::~PDAMgr() {
delete _globalPage;
@@ -111,7 +112,6 @@ void PDAMgr::goToPage(const Common::String &pageName) {
initPerilButtons();
_cursorMgr.setPage(_page);
-
}
void PDAMgr::onLeftButtonClick(Common::Point point) {
@@ -135,6 +135,39 @@ void PDAMgr::onMouseMove(Common::Point point) {
actor->onMouseOver(point, &_cursorMgr);
else
_cursorMgr.setCursor(kPDADefaultCursor, point, Common::String());
+
+ if (!_game->isPeril())
+ return;
+
+ float k = (float)point.x / (480 - point.y);
+ Actor *leftHand = _globalPage->findActor(kLeftHand);
+ if (k > 0.5) {
+ if (k > 1) {
+ if (k > 1.5 && _leftHandAction != kLeft4) {
+ leftHand->setAction(kLeft4Name);
+ static_cast<ActionStill*>(leftHand->getAction())->setFrame(_handFrame + 1);
+ _leftHandAction = kLeft4;
+ } else if (_leftHandAction != kLeft3) {
+ leftHand->setAction(kLeft3Name);
+ static_cast<ActionStill*>(leftHand->getAction())->setFrame(_handFrame + 1);
+ _leftHandAction = kLeft3;
+ }
+ } else if (_leftHandAction != kLeft2) {
+ leftHand->setAction(kLeft2Name);
+ static_cast<ActionStill*>(leftHand->getAction())->setFrame(_handFrame + 1);
+ _leftHandAction = kLeft2;
+ }
+ } else if (_leftHandAction != kLeft1) {
+ leftHand->setAction(kLeft1Name);
+ static_cast<ActionStill*>(leftHand->getAction())->setFrame(_handFrame + 1);
+ _leftHandAction = kLeft1;
+ }
+
+ if (_iteration == 0) {
+ _handFrame = (_handFrame + 1) % 4;
+ static_cast<ActionStill*>(leftHand->getAction())->nextFrameLooped();
+ }
+ _iteration = (_iteration + 1) % 4;
}
void PDAMgr::close() {
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index 19df2c9334..92ebcf165f 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -79,8 +79,16 @@ private:
CursorMgr _cursorMgr;
Common::String _savedPage;
Common::Stack<Common::String> _previousPages;
- uint _countryIndex;
- uint _domainIndex;
+ uint16 _countryIndex;
+ uint16 _domainIndex;
+ uint16 _iteration;
+ uint16 _handFrame;
+ enum LeftHandAction {
+ kLeft1,
+ kLeft2,
+ kLeft3,
+ kLeft4
+ } _leftHandAction;
};
} // End of namespace Pink