aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/myst_stacks
diff options
context:
space:
mode:
authordafioram2018-04-25 12:46:50 -0400
committerBastien Bouclet2018-04-25 18:46:50 +0200
commit519e02da47ff972776350fa77ad1e6876a714106 (patch)
treed3c8233cc2f667d607fca0be2c36b9d8c07938ad /engines/mohawk/myst_stacks
parent09dbb50ee4a48bd3b6ab075c09d92f0a8ac2e77a (diff)
downloadscummvm-rg350-519e02da47ff972776350fa77ad1e6876a714106.tar.gz
scummvm-rg350-519e02da47ff972776350fa77ad1e6876a714106.tar.bz2
scummvm-rg350-519e02da47ff972776350fa77ad1e6876a714106.zip
MOHAWK: MYST: Turn held page state into an enum
Previously, the held page stage was an unsigned int 16 with values 0-13. The enum will make its state more clear.
Diffstat (limited to 'engines/mohawk/myst_stacks')
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp16
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp6
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp20
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp74
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp16
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp16
6 files changed, 73 insertions, 75 deletions
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 8d95be0f79..d0b3d2a2da 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -187,7 +187,7 @@ uint16 Channelwood::getVar(uint16 var) {
}
case 102: // Sirrus's Desk Drawer / Red Page State
if (_siriusDrawerState) {
- if(!(_globals.redPagesInBook & 16) && (_globals.heldPage != 11))
+ if(!(_globals.redPagesInBook & 16) && (_globals.heldPage != kRedChannelwoodPage))
return 2; // Drawer Open, Red Page Present
else
return 1; // Drawer Open, Red Page Taken
@@ -195,7 +195,7 @@ uint16 Channelwood::getVar(uint16 var) {
return 0; // Drawer Closed
}
case 103: // Blue Page Present
- return !(_globals.bluePagesInBook & 16) && (_globals.heldPage != 5);
+ return !(_globals.bluePagesInBook & 16) && (_globals.heldPage != kBlueChannelwoodPage);
default:
return MystScriptParser::getVar(var);
}
@@ -214,18 +214,18 @@ void Channelwood::toggleVar(uint16 var) {
break;
case 102: // Red page
if (!(_globals.redPagesInBook & 16)) {
- if (_globals.heldPage == 11)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedChannelwoodPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 11;
+ _globals.heldPage = kRedChannelwoodPage;
}
break;
case 103: // Blue page
if (!(_globals.bluePagesInBook & 16)) {
- if (_globals.heldPage == 5)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueChannelwoodPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 5;
+ _globals.heldPage = kBlueChannelwoodPage;
}
break;
default:
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index 7c226ede40..6d8dd484f6 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -89,7 +89,7 @@ uint16 Dni::getVar(uint16 var) {
case 2: // Music Type
if (_notSeenAtrus) {
_notSeenAtrus = false;
- return _globals.ending != 4 && _globals.heldPage != 13;
+ return _globals.ending != 4 && _globals.heldPage != kWhitePage;
} else
return 2;
default:
@@ -106,7 +106,7 @@ void Dni::o_handPage(uint16 var, const ArgumentsArray &args) {
// Good ending and Atrus asked to give page
if (_globals.ending == 1 && atrus && atrus->getTime() > (uint)Audio::Timestamp(0, 6801, 600).msecs()) {
_globals.ending = 2;
- _globals.heldPage = 0;
+ _globals.heldPage = kNoPage;
_vm->setMainCursor(kDefaultMystCursor);
// Play movie end (atrus leaving)
@@ -166,7 +166,7 @@ void Dni::atrus_run() {
atrus->setBounds(Audio::Timestamp(0, 7388, 600), Audio::Timestamp(0, 14700, 600));
}
} else if (_globals.ending != 3 && _globals.ending != 4) {
- if (_globals.heldPage == 13) {
+ if (_globals.heldPage == kWhitePage) {
_video = "atr1page";
_videoPos = Common::Point(215, 76);
VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 5e920f91bc..a58e278590 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -170,12 +170,12 @@ uint16 Mechanical::getVar(uint16 var) {
return _state.sirrusPanelState;
case 2: // Achenar's Secret Room Crate Lid Open and Blue Page Present
if (_state.achenarCrateOpened) {
- if (_globals.bluePagesInBook & 4 || _globals.heldPage == 3)
+ if (_globals.bluePagesInBook & 4 || _globals.heldPage == kBlueMechanicalPage)
return 2;
else
return 3;
} else {
- return _globals.bluePagesInBook & 4 || _globals.heldPage == 3;
+ return _globals.bluePagesInBook & 4 || _globals.heldPage == kBlueMechanicalPage;
}
case 3: // Achenar's Secret Room Crate State
return _state.achenarCrateOpened;
@@ -223,9 +223,9 @@ uint16 Mechanical::getVar(uint16 var) {
case 22: // Crystal Lit Flag - Red
return _crystalLit == 2;
case 102: // Red page
- return !(_globals.redPagesInBook & 4) && (_globals.heldPage != 9);
+ return !(_globals.redPagesInBook & 4) && (_globals.heldPage != kRedMechanicalPage);
case 103: // Blue page
- return !(_globals.bluePagesInBook & 4) && (_globals.heldPage != 3);
+ return !(_globals.bluePagesInBook & 4) && (_globals.heldPage != kBlueMechanicalPage);
default:
return MystScriptParser::getVar(var);
}
@@ -259,18 +259,18 @@ void Mechanical::toggleVar(uint16 var) {
break;
case 102: // Red page
if (!(_globals.redPagesInBook & 4)) {
- if (_globals.heldPage == 9)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedMechanicalPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 9;
+ _globals.heldPage = kRedMechanicalPage;
}
break;
case 103: // Blue page
if (!(_globals.bluePagesInBook & 4)) {
- if (_globals.heldPage == 3)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueMechanicalPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 3;
+ _globals.heldPage = kBlueMechanicalPage;
}
break;
default:
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 114c9c9165..ebcdd17cc0 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -488,12 +488,12 @@ uint16 Myst::getVar(uint16 var) {
&& _fireplaceLines[5] == 250;
case 24: // Fireplace Blue Page Present
if (_globals.ending != 4)
- return !(_globals.bluePagesInBook & 32) && (_globals.heldPage != 6);
+ return !(_globals.bluePagesInBook & 32) && (_globals.heldPage != kBlueFirePlacePage);
else
return 0;
case 25: // Fireplace Red Page Present
if (_globals.ending != 4)
- return !(_globals.redPagesInBook & 32) && (_globals.heldPage != 12);
+ return !(_globals.redPagesInBook & 32) && (_globals.heldPage != kRedFirePlacePage);
else
return 0;
case 26: // Courtyard Image Box - Cross
@@ -707,12 +707,12 @@ uint16 Myst::getVar(uint16 var) {
return _state.cabinValvePosition % 6;
case 102: // Red page
if (_globals.ending != 4)
- return !(_globals.redPagesInBook & 1) && (_globals.heldPage != 7);
+ return !(_globals.redPagesInBook & 1) && (_globals.heldPage != kRedLibraryPage);
else
return 0;
case 103: // Blue page
if (_globals.ending != 4)
- return !(_globals.bluePagesInBook & 1) && (_globals.heldPage != 1);
+ return !(_globals.bluePagesInBook & 1) && (_globals.heldPage != kBlueLibraryPage);
else
return 0;
case 300: // Rocket Ship Music Puzzle Slider State
@@ -771,18 +771,18 @@ void Myst::toggleVar(uint16 var) {
break;
case 24: // Fireplace Blue Page
if (_globals.ending != 4 && !(_globals.bluePagesInBook & 32)) {
- if (_globals.heldPage == 6)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueFirePlacePage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 6;
+ _globals.heldPage = kBlueFirePlacePage;
}
break;
case 25: // Fireplace Red page
if (_globals.ending != 4 && !(_globals.redPagesInBook & 32)) {
- if (_globals.heldPage == 12)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedFirePlacePage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 12;
+ _globals.heldPage = kRedFirePlacePage;
}
break;
case 26: // Courtyard Image Box - Cross
@@ -805,27 +805,27 @@ void Myst::toggleVar(uint16 var) {
if (_globals.ending != 4) {
if (_dockVaultState == 1) {
_dockVaultState = 2;
- _globals.heldPage = 0;
+ _globals.heldPage = kNoPage;
} else if (_dockVaultState == 2) {
_dockVaultState = 1;
- _globals.heldPage = 13;
+ _globals.heldPage = kWhitePage;
}
}
break;
case 102: // Red page
if (_globals.ending != 4 && !(_globals.redPagesInBook & 1)) {
- if (_globals.heldPage == 7)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedLibraryPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 7;
+ _globals.heldPage = kRedLibraryPage;
}
break;
case 103: // Blue page
if (_globals.ending != 4 && !(_globals.bluePagesInBook & 1)) {
- if (_globals.heldPage == 1)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueLibraryPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 1;
+ _globals.heldPage = kBlueLibraryPage;
}
break;
default:
@@ -1095,7 +1095,7 @@ void Myst::o_dockVaultOpen(uint16 var, const ArgumentsArray &args) {
(_state.observatoryMarkerSwitch == 1) &&
(_state.poolMarkerSwitch == 1) &&
(_state.rocketshipMarkerSwitch == 1)) {
- if (_globals.heldPage != 13 && _globals.ending != 4)
+ if (_globals.heldPage != kWhitePage && _globals.ending != 4)
_dockVaultState = 2;
else
_dockVaultState = 1;
@@ -1138,50 +1138,48 @@ void Myst::o_bookGivePage(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Card Id (Book Cover): %d", cardIdBookCover);
debugC(kDebugScript, "SoundId (Add Page): %d", soundIdAddPage);
- // No page or white page
- if (!_globals.heldPage || _globals.heldPage == 13) {
- _vm->changeToCard(cardIdBookCover, kTransitionDissolve);
- return;
- }
-
uint16 bookVar = 101;
uint16 mask = 0;
switch (_globals.heldPage) {
- case 7:
+ case kNoPage:
+ case kWhitePage:
+ _vm->changeToCard(cardIdBookCover, kTransitionDissolve);
+ return;
+ case kRedLibraryPage:
bookVar = 100;
// fallthrough
- case 1:
+ case kBlueLibraryPage:
mask = 1;
break;
- case 8:
+ case kRedSeleniticPage:
bookVar = 100;
// fallthrough
- case 2:
+ case kBlueSeleniticPage:
mask = 2;
break;
- case 9:
+ case kRedMechanicalPage:
bookVar = 100;
// fallthrough
- case 3:
+ case kBlueMechanicalPage:
mask = 4;
break;
- case 10:
+ case kRedStoneshipPage:
bookVar = 100;
// fallthrough
- case 4:
+ case kBlueStoneshipPage:
mask = 8;
break;
- case 11:
+ case kRedChannelwoodPage:
bookVar = 100;
// fallthrough
- case 5:
+ case kBlueChannelwoodPage:
mask = 16;
break;
- case 12:
+ case kRedFirePlacePage:
bookVar = 100;
// fallthrough
- case 6:
+ case kBlueFirePlacePage:
mask = 32;
break;
}
@@ -1203,7 +1201,7 @@ void Myst::o_bookGivePage(uint16 var, const ArgumentsArray &args) {
_globals.bluePagesInBook |= mask;
// Remove page from hand
- _globals.heldPage = 0;
+ _globals.heldPage = kNoPage;
_vm->_cursor->showCursor();
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index a91b9952b3..239030645c 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -190,9 +190,9 @@ uint16 Selenitic::getVar(uint16 var) {
case 33: // Maze runner at entry
return _mazeRunnerPosition != 288;
case 102: // Red page
- return !(_globals.redPagesInBook & 2) && (_globals.heldPage != 8);
+ return !(_globals.redPagesInBook & 2) && (_globals.heldPage != kRedSeleniticPage);
case 103: // Blue page
- return !(_globals.bluePagesInBook & 2) && (_globals.heldPage != 2);
+ return !(_globals.bluePagesInBook & 2) && (_globals.heldPage != kBlueSeleniticPage);
default:
return MystScriptParser::getVar(var);
}
@@ -223,18 +223,18 @@ void Selenitic::toggleVar(uint16 var) {
break;
case 102: // Red page
if (!(_globals.redPagesInBook & 2)) {
- if (_globals.heldPage == 8)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedSeleniticPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 8;
+ _globals.heldPage = kRedSeleniticPage;
}
break;
case 103: // Blue page
if (!(_globals.bluePagesInBook & 2)) {
- if (_globals.heldPage == 2)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueSeleniticPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 2;
+ _globals.heldPage = kBlueSeleniticPage;
}
break;
default:
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index 046aa5f9e7..cd1db68d44 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -280,9 +280,9 @@ uint16 Stoneship::getVar(uint16 var) {
return 0; // Closed
}
case 102: // Red page
- return !(_globals.redPagesInBook & 8) && (_globals.heldPage != 10);
+ return !(_globals.redPagesInBook & 8) && (_globals.heldPage != kRedStoneshipPage);
case 103: // Blue page
- return !(_globals.bluePagesInBook & 8) && (_globals.heldPage != 4);
+ return !(_globals.bluePagesInBook & 8) && (_globals.heldPage != kBlueStoneshipPage);
default:
return MystScriptParser::getVar(var);
}
@@ -334,18 +334,18 @@ void Stoneship::toggleVar(uint16 var) {
break;
case 102: // Red page
if (!(_globals.redPagesInBook & 8)) {
- if (_globals.heldPage == 10)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kRedStoneshipPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 10;
+ _globals.heldPage = kRedStoneshipPage;
}
break;
case 103: // Blue page
if (!(_globals.bluePagesInBook & 8)) {
- if (_globals.heldPage == 4)
- _globals.heldPage = 0;
+ if (_globals.heldPage == kBlueStoneshipPage)
+ _globals.heldPage = kNoPage;
else
- _globals.heldPage = 4;
+ _globals.heldPage = kBlueStoneshipPage;
}
break;
default: