aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Prykhodko2018-06-30 20:04:11 +0300
committerAndrei Prykhodko2018-06-30 20:04:11 +0300
commit4f13195e8c4f5301ec07b62de33ab23d2e7243d5 (patch)
treea7953287c685870eb9fb2ea6ed0325ef78eaa0a3
parent5294c8d25236472ac941d29e4f41310ebdaae0f5 (diff)
downloadscummvm-rg350-4f13195e8c4f5301ec07b62de33ab23d2e7243d5.tar.gz
scummvm-rg350-4f13195e8c4f5301ec07b62de33ab23d2e7243d5.tar.bz2
scummvm-rg350-4f13195e8c4f5301ec07b62de33ab23d2e7243d5.zip
PINK: added PDA rightHand movement
-rw-r--r--engines/pink/constants.h3
-rw-r--r--engines/pink/objects/actions/action_loop.cpp8
-rw-r--r--engines/pink/objects/actions/action_play.cpp2
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.cpp2
-rw-r--r--engines/pink/objects/actions/action_still.cpp8
-rw-r--r--engines/pink/objects/actions/action_still.h2
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp5
-rw-r--r--engines/pink/objects/actors/lead_actor.h1
-rw-r--r--engines/pink/pda_mgr.cpp11
-rw-r--r--engines/pink/pda_mgr.h1
-rw-r--r--engines/pink/pink.cpp2
11 files changed, 36 insertions, 9 deletions
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index ce0e6a9988..574f66df2a 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -208,6 +208,9 @@ static const char * const kNavigatePage = "NAVIGATE";
static const char * const kSfx = "SFX";
+static const char * const kRightHand = "RightHand";
+static const char * const kLeftHand = "LeftHand";
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 500a001b4c..ca649b2caf 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -71,12 +71,12 @@ void ActionLoop::update() {
decodeNext();
} else {
_forward = false;
- setFrame(_stopFrame - 1);
+ ActionCEL::setFrame(_stopFrame - 1);
decodeNext();
}
} else {
if (frame > (int)_startFrame) {
- setFrame(frame - 1);
+ ActionCEL::setFrame(frame - 1);
} else {
_forward = true;
}
@@ -85,13 +85,13 @@ void ActionLoop::update() {
break;
case kRandom: {
Common::RandomSource &rnd = _actor->getPage()->getGame()->getRnd();
- setFrame(rnd.getRandomNumberRng(_startFrame, _stopFrame));
+ ActionCEL::setFrame(rnd.getRandomNumberRng(_startFrame, _stopFrame));
decodeNext();
break;
}
case kForward:
if (frame == _stopFrame) {
- setFrame(_startFrame);
+ ActionCEL::setFrame(_startFrame);
}
decodeNext();
break;
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index e86ff55c21..6d23a8accd 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -64,7 +64,7 @@ void ActionPlay::onStart() {
if (_stopFrame == -1 || _stopFrame >= frameCount)
_stopFrame = frameCount - 1;
assert(_startFrame < _decoder.getFrameCount());
- setFrame(_startFrame);
+ ActionCEL::setFrame(_startFrame);
// doesn't need to decode startFrame here. Update method will decode
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index be3f0cae7c..78c302208d 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -52,7 +52,7 @@ void ActionPlayWithSfx::toConsole() {
void ActionPlayWithSfx::update() {
int currFrame = _decoder.getCurFrame();
if (_isLoop && currFrame == _stopFrame) {
- setFrame(_startFrame);
+ ActionCEL::setFrame(_startFrame);
decodeNext();
} else
ActionPlay::update();
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 5bd645b3cc..9c1ba083c9 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -52,8 +52,7 @@ void ActionStill::onStart() {
if (_startFrame >= _decoder.getFrameCount())
_startFrame = 0;
- setFrame(_startFrame); // seek to frame before startFrame
- decodeNext(); // decode startFrame
+ setFrame(_startFrame);
_decoder.setEndOfTrack();
assert(!_decoder.needsUpdate());
@@ -61,4 +60,9 @@ void ActionStill::onStart() {
_actor->endAction();
}
+void ActionStill::setFrame(uint frame) {
+ ActionCEL::setFrame(frame);
+ decodeNext();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index a9b2d5209c..e3fb386c26 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -37,6 +37,8 @@ public:
void pause(bool paused) override;
+ void setFrame(uint frame);
+
protected:
void onStart() override;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 0ce5a5af1e..e74434a67c 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -244,6 +244,11 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
}
}
+void LeadActor::onLeftButtonUp(const Common::Point point) {
+ if (_state == kPDA)
+ _page->getGame()->getPdaMgr().onLeftButtonUp(point);
+}
+
void LeadActor::onRightButtonClick(const Common::Point point) {
if (_state == kReady || _state == kMoving) {
Actor *clickedActor = getActorByPoint(point);
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index ff38ef9bf4..543ee3f89b 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -70,6 +70,7 @@ public:
void onKeyboardButtonClick(Common::KeyCode code);
void onLeftButtonClick(const Common::Point point);
+ void onLeftButtonUp(const Common::Point point);
void onRightButtonClick(const Common::Point point);
void onMouseMove(const Common::Point point);
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 9b856da348..2728ac1638 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -25,7 +25,7 @@
#include "pink/objects/actors/pda_button_actor.h"
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/pda_page.h"
-#include "pink/objects/actions/action_cel.h"
+#include "pink/objects/actions/action_still.h"
namespace Pink {
@@ -115,11 +115,20 @@ void PDAMgr::goToPage(const Common::String &pageName) {
}
void PDAMgr::onLeftButtonClick(Common::Point point) {
+ Actor* _rightHand = _globalPage->findActor(kRightHand);
+ if (_rightHand)
+ static_cast<ActionStill*>(_rightHand->getAction())->setFrame(1);
Actor *actor = _game->getDirector()->getActorByPoint(point);
if (actor)
actor->onLeftClickMessage();
}
+void PDAMgr::onLeftButtonUp(Common::Point point) {
+ Actor* _rightHand = _globalPage->findActor(kRightHand);
+ if (_rightHand)
+ static_cast<ActionStill*>(_rightHand->getAction())->setFrame(0);
+}
+
void PDAMgr::onMouseMove(Common::Point point) {
Actor *actor = _game->getDirector()->getActorByPoint(point);
if (actor && dynamic_cast<PDAButtonActor *>(actor))
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index f2344071c9..19df2c9334 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -51,6 +51,7 @@ public:
void update() { _cursorMgr.update(); }
void onLeftButtonClick(Common::Point point);
+ void onLeftButtonUp(Common::Point point);
void onMouseMove(Common::Point point);
PinkEngine *getGame() const { return _game; }
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index c023fe6fb2..fc135a1477 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -120,6 +120,8 @@ Common::Error Pink::PinkEngine::run() {
case Common::EVENT_LBUTTONDOWN:
_actor->onLeftButtonClick(event.mouse);
break;
+ case Common::EVENT_LBUTTONUP:
+ _actor->onLeftButtonUp(event.mouse);
case Common::EVENT_RBUTTONDOWN:
if (isPeril())
_actor->onRightButtonClick(event.mouse);