aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorwhiterandrek2018-05-11 17:55:08 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commitd83022b60754698054dc8dcb675ceee36f171bf8 (patch)
tree139f0f17a846107272e7107fa553fd63e1ac40bd /engines
parent181b89035a47daec35c1c4f4b565e047c313de7d (diff)
downloadscummvm-rg350-d83022b60754698054dc8dcb675ceee36f171bf8.tar.gz
scummvm-rg350-d83022b60754698054dc8dcb675ceee36f171bf8.tar.bz2
scummvm-rg350-d83022b60754698054dc8dcb675ceee36f171bf8.zip
PINK: added implementation of mini-games (PubPink and ParlSqPink)
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/constants.h17
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp86
-rw-r--r--engines/pink/objects/actors/lead_actor.h17
3 files changed, 119 insertions, 1 deletions
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index b8874df317..8e70f5a86e 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -155,7 +155,6 @@ static const char *kPeril = "peril";
static const char *kUndefined = "UNDEFINED";
-
static const char *kCloseAction = "Close";
static const char *kIdleAction = "Idle";
static const char *kOpenAction = "Open";
@@ -173,6 +172,22 @@ static const char *kCursorNameExitLeft = "ExitLeft";
static const char *kCursorNameExitRight = "ExitRight";
static const char *kCursorNameExitForward = "ExitForward";
+static const char *kClickable = "Clickable";
+static const char *kCursor = "Cursor";
+
+static const char *kFoodPuzzle = "FoodPuzzle";
+static const char *kJackson = "Jackson";
+static const char *kBolted = "Bolted";
+static const char *kDrunkLocation = "DrunkLocation";
+static const char *kDrunk = "Drunk";
+
+static const char *kFirstRound = "15.1";
+static const char *kSecondRound = "15.2";
+static const char *kThirdRound = "15.3";
+
+static const char *kBoy = "Boy";
+static const char *kSirBaldley = "SirBaldley";
+static const char *kBoyBlocked = "BoyBlocked";
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index bf6d330169..8c343543a3 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -319,6 +319,19 @@ void ParlSqPink::toConsole() {
}
}
+WalkLocation *ParlSqPink::getWalkDestination() {
+ if (_recipient->getName() == kBoy &&
+ _page->checkValueOfVariable(kBoyBlocked, kUndefined))
+ {
+ return _walkMgr->findLocation(kSirBaldley);
+ }
+ return LeadActor::getWalkDestination();
+}
+
+PubPink::PubPink() :
+ LeadActor(), _round(0)
+{}
+
void PubPink::toConsole() {
debug("PubPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
@@ -326,4 +339,77 @@ void PubPink::toConsole() {
}
}
+bool PubPink::playingMiniGame() {
+ return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
+}
+
+void PubPink::onClick() {
+ if (!playingMiniGame())
+ LeadActor::onClick();
+}
+
+void PubPink::updateCursor(Common::Point point) {
+ if (playingMiniGame()) {
+ SupportingActor *actor = static_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
+ if (_state == kReady &&
+ actor &&
+ actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
+ {
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ }
+ else LeadActor::updateCursor(point);
+}
+
+WalkLocation *PubPink::getWalkDestination() {
+ if (playingMiniGame())
+ return nullptr;
+
+ if (_recipient->getName() == kJackson &&
+ !_page->checkValueOfVariable(kDrunkLocation, kBolted))
+ {
+ return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
+ }
+
+ return LeadActor::getWalkDestination();
+}
+
+bool PubPink::sendUseClickMessage(SupportingActor *actor) {
+ if (!LeadActor::sendUseClickMessage(actor) &&
+ playingMiniGame()) {
+ _nextState = _state;
+ _state = kInDialog1;
+
+ const char *roundName;
+ switch (_round++ % 3) {
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
+ break;
+ }
+ _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
+ }
+
+ if (playingMiniGame())
+ _isHaveItem = true;
+
+ return true;
+}
+
+void PubPink::onVariableSet() {
+ if (playingMiniGame())
+ _isHaveItem = true;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index fe2b613188..977096bf82 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -32,6 +32,7 @@ namespace Pink {
class CursorMgr;
class WalkMgr;
+class WalkLocation;
class Sequencer;
class SupportingActor;
@@ -70,6 +71,7 @@ public:
void onWalkEnd();
virtual void onClick();
void onInventoryClosed(bool isItemClicked);
+ virtual void onVariableSet() {};
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
@@ -100,12 +102,27 @@ protected:
class ParlSqPink : public LeadActor {
public:
+ virtual WalkLocation *getWalkDestination();
void toConsole();
};
class PubPink : public LeadActor {
public:
+ PubPink();
+
void toConsole();
+
+ virtual void onClick();
+ virtual void onVariableSet();
+
+private:
+ int _round;
+
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ virtual void updateCursor(Common::Point point);
+ virtual WalkLocation *getWalkDestination();
+
+ bool playingMiniGame();
};