[Scummvm-git-logs] scummvm master -> 0bad0a32b2295e9dc3a784cff3e7fe3a4ed376dd
bluegr
noreply at scummvm.org
Thu Dec 30 14:28:06 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
05f6707210 BURIED: Simplify some of the variable casts for the Mayan logic
67eaeb6342 BURIED: Adjust some comments
0bad0a32b2 BURIED: Remove superfluous SFX when erasing codes in the ShopNet screen
Commit: 05f6707210958c5daca110f919ab8e38840ce670
https://github.com/scummvm/scummvm/commit/05f6707210958c5daca110f919ab8e38840ce670
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-30T16:27:48+02:00
Commit Message:
BURIED: Simplify some of the variable casts for the Mayan logic
This makes it easier to read the code. No functional changes were made.
Changed paths:
engines/buried/environ/mayan.cpp
diff --git a/engines/buried/environ/mayan.cpp b/engines/buried/environ/mayan.cpp
index e51cbb050b4..f50a47dc716 100644
--- a/engines/buried/environ/mayan.cpp
+++ b/engines/buried/environ/mayan.cpp
@@ -74,13 +74,16 @@ int PlaceCeramicBowl::droppedItem(Window *viewWindow, int itemID, const Common::
}
int PlaceCeramicBowl::timerCallback(Window *viewWindow) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
if (_dropped) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelStatus == 0) {
+ if (globalFlags.myTPCodeWheelStatus == 0) {
// Play slide death animation
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(4);
+ sceneView->playSynchronousAnimation(4);
// Notify the player of his gruesome death
- ((SceneViewWindow *)viewWindow)->showDeathScene(11);
+ sceneView->showDeathScene(11);
return SC_DEATH;
} else {
// Kill the ambient
@@ -98,7 +101,7 @@ int PlaceCeramicBowl::timerCallback(Window *viewWindow) {
newDest.transitionData = 3;
newDest.transitionStartFrame = -1;
newDest.transitionLength = -1;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDest);
+ sceneView->moveToDestination(newDest);
}
}
@@ -129,8 +132,11 @@ private:
AdjustWheels::AdjustWheels(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
- _curLeftFrame = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelLeftIndex;
- _curRightFrame = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelRightIndex;
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ _curLeftFrame = globalFlags.myTPCodeWheelLeftIndex;
+ _curRightFrame = globalFlags.myTPCodeWheelRightIndex;
_leftUpRegion = Common::Rect(46, 0, 200, 70);
_leftDownRegion = Common::Rect(46, 106, 200, 189);
_rightUpRegion = Common::Rect(212, 0, 432, 66);
@@ -164,7 +170,10 @@ int AdjustWheels::paint(Window *viewWindow, Graphics::Surface *preBuffer) {
}
int AdjustWheels::gdiPaint(Window *viewWindow) {
- if (_translateText && ((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (_translateText && globalFlags.bcTranslateEnabled == 1) {
Common::Rect absoluteRect = viewWindow->getAbsoluteRect();
Common::Rect rect(168, 70, 262, 108);
rect.translate(absoluteRect.left, absoluteRect.top);
@@ -175,6 +184,9 @@ int AdjustWheels::gdiPaint(Window *viewWindow) {
}
int AdjustWheels::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
// TODO: Wait between frames after figuring out timing
if (_leftUpRegion.contains(pointLocation) || _leftDownRegion.contains(pointLocation) ||
@@ -245,8 +257,8 @@ int AdjustWheels::mouseUp(Window *viewWindow, const Common::Point &pointLocation
viewWindow->invalidateWindow(false);
}
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelLeftIndex = _curLeftFrame;
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelRightIndex = _curRightFrame;
+ globalFlags.myTPCodeWheelLeftIndex = _curLeftFrame;
+ globalFlags.myTPCodeWheelRightIndex = _curRightFrame;
byte status = 0;
if (_curLeftFrame == 8 && _curRightFrame == 12)
@@ -268,7 +280,7 @@ int AdjustWheels::mouseUp(Window *viewWindow, const Common::Point &pointLocation
else if (_curLeftFrame == 10 && _curRightFrame == 28)
status = 1;
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelStatus = status;
+ globalFlags.myTPCodeWheelStatus = status;
return SC_TRUE;
}
@@ -281,12 +293,15 @@ int AdjustWheels::mouseUp(Window *viewWindow, const Common::Point &pointLocation
newDest.transitionData = -1;
newDest.transitionStartFrame = -1;
newDest.transitionLength = -1;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDest);
+ sceneView->moveToDestination(newDest);
return SC_TRUE;
}
int AdjustWheels::mouseMove(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.bcTranslateEnabled == 1) {
Common::Rect translateTextRegion(168, 72, 260, 106);
if (translateTextRegion.contains(pointLocation)) {
@@ -295,8 +310,8 @@ int AdjustWheels::mouseMove(Window *viewWindow, const Common::Point &pointLocati
Common::String rightText = _vm->getString(IDMYTP_WHEELS_RIGHT_TRANS_TEXT_BASE + _curRightFrame / 2);
Common::String finalString = leftText + rightText;
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 &&
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCodeWheelStatus == 1) {
+ if (globalFlags.generalWalkthroughMode == 1 &&
+ globalFlags.myTPCodeWheelStatus == 1) {
if (_vm->getVersion() >= MAKEVERSION(1, 0, 4, 0))
finalString += _vm->getString(IDS_MYTP_WALKTHROUGH_HINT_TEXT);
@@ -304,7 +319,7 @@ int AdjustWheels::mouseMove(Window *viewWindow, const Common::Point &pointLocati
finalString += " (Mayan Sacred Day)";
}
- ((SceneViewWindow *)viewWindow)->displayTranslationText(finalString);
+ sceneView->displayTranslationText(finalString);
_translateText = true;
viewWindow->invalidateWindow(false);
}
@@ -347,7 +362,10 @@ DateCombinationRead::DateCombinationRead(BuriedEngine *vm, Window *viewWindow, c
}
int DateCombinationRead::gdiPaint(Window *viewWindow) {
- if (_currentRegion >= 0 && ((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (_currentRegion >= 0 && globalFlags.bcTranslateEnabled == 1) {
Common::Rect absoluteRect = viewWindow->getAbsoluteRect();
int left = _currentRegion * 43 + 20 + absoluteRect.left;
Common::Rect rect(left, absoluteRect.top + 18, left + 43, absoluteRect.top + 110);
@@ -358,7 +376,10 @@ int DateCombinationRead::gdiPaint(Window *viewWindow) {
}
int DateCombinationRead::mouseMove(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.bcTranslateEnabled == 1) {
Common::Rect symbols(20, 18, 407, 110);
if (symbols.contains(pointLocation)) {
@@ -366,11 +387,11 @@ int DateCombinationRead::mouseMove(Window *viewWindow, const Common::Point &poin
if (_currentRegion != translatedSymbolIndex) {
// Update flags
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPCalendarListTranslated = 1;
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myTPTextTranslated = 1;
+ globalFlags.myTPCalendarListTranslated = 1;
+ globalFlags.myTPTextTranslated = 1;
// Display the text
- ((SceneViewWindow *)viewWindow)->displayTranslationText(_vm->getString(IDMYTP_WALLS_COMBO_TRANS_TEXT_BASE + translatedSymbolIndex));
+ sceneView->displayTranslationText(_vm->getString(IDMYTP_WALLS_COMBO_TRANS_TEXT_BASE + translatedSymbolIndex));
// Reset the current region and redraw
_currentRegion = translatedSymbolIndex;
@@ -412,6 +433,8 @@ ViewSingleTranslation::ViewSingleTranslation(BuriedEngine *vm, Window *viewWindo
int translatedTextID, int left, int top, int right, int bottom,
int flagAOffset, int flagBOffset, int visitedFlagOffset) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
_textTranslated = false;
_textID = translatedTextID;
_clickableRegion = Common::Rect(left, top, right, bottom);
@@ -420,12 +443,14 @@ ViewSingleTranslation::ViewSingleTranslation(BuriedEngine *vm, Window *viewWindo
_visitedFlagOffset = visitedFlagOffset;
if (_visitedFlagOffset >= 0)
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_visitedFlagOffset, 1);
+ sceneView->setGlobalFlagByte(_visitedFlagOffset, 1);
}
int ViewSingleTranslation::gdiPaint(Window *viewWindow) {
// Draw the translated box, if applicable
- if (_textTranslated && ((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
+ if (_textTranslated && sceneView->getGlobalFlags().bcTranslateEnabled == 1) {
Common::Rect absoluteRect = viewWindow->getAbsoluteRect();
Common::Rect rect(_clickableRegion);
rect.translate(absoluteRect.left, absoluteRect.top);
@@ -436,11 +461,13 @@ int ViewSingleTranslation::gdiPaint(Window *viewWindow) {
}
int ViewSingleTranslation::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
if (_staticData.location.depth != 0) {
// If we're not at depth zero, move to depth zero
Location newLocation = _staticData.location;
newLocation.depth = 0;
- ((SceneViewWindow *)viewWindow)->jumpToScene(newLocation);
+ sceneView->jumpToScene(newLocation);
return SC_TRUE;
}
@@ -448,17 +475,19 @@ int ViewSingleTranslation::mouseUp(Window *viewWindow, const Common::Point &poin
}
int ViewSingleTranslation::mouseMove(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
+ if (sceneView->getGlobalFlags().bcTranslateEnabled == 1) {
if (_clickableRegion.contains(pointLocation)) {
// Make sure we didn't already render the text
if (!_textTranslated) {
if (_flagAOffset >= 0)
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_flagAOffset, 1);
+ sceneView->setGlobalFlagByte(_flagAOffset, 1);
if (_flagBOffset >= 0)
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(_flagBOffset, 1);
+ sceneView->setGlobalFlagByte(_flagBOffset, 1);
// Load and display the text
- ((SceneViewWindow *)viewWindow)->displayTranslationText(_vm->getString(_textID));
+ sceneView->displayTranslationText(_vm->getString(_textID));
_textTranslated = true;
viewWindow->invalidateWindow(false);
}
@@ -506,6 +535,9 @@ GenericCavernDoorMainView::GenericCavernDoorMainView(BuriedEngine *vm, Window *v
int rightZoomDepth, int rightLeft, int rightTop, int rightRight, int rightBottom,
int offeringHeadZoomDepth, int offeringHeadLeft, int offeringHeadTop, int offeringHeadRight, int offeringHeadBottom) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
_topZoomDepth = topZoomDepth;
_rightZoomDepth = rightZoomDepth;
_offeringHeadZoomDepth = offeringHeadZoomDepth;
@@ -514,19 +546,23 @@ GenericCavernDoorMainView::GenericCavernDoorMainView(BuriedEngine *vm, Window *v
_offeringHeadZoomRegion = Common::Rect(offeringHeadLeft, offeringHeadTop, offeringHeadRight, offeringHeadBottom);
if (_staticData.location.node == 7)
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCViewedDeathGodDoor = 1;
+ globalFlags.myMCViewedDeathGodDoor = 1;
}
int GenericCavernDoorMainView::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
if (_staticData.location.node == 7 && (_staticData.location.timeZone != priorLocation.timeZone ||
_staticData.location.environment != priorLocation.environment || _staticData.location.node != priorLocation.node ||
_staticData.location.facing != priorLocation.facing || _staticData.location.orientation != priorLocation.orientation ||
- _staticData.location.depth != priorLocation.depth) && !((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID))
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
+ _staticData.location.depth != priorLocation.depth) && !sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID))
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
return SC_TRUE;
}
int GenericCavernDoorMainView::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
// Build a default structure
DestinationScene newDestination;
newDestination.destinationScene = _staticData.location;
@@ -537,19 +573,19 @@ int GenericCavernDoorMainView::mouseUp(Window *viewWindow, const Common::Point &
if (_topZoomRegion.contains(pointLocation)) {
newDestination.destinationScene.depth = _topZoomDepth;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDestination);
+ sceneView->moveToDestination(newDestination);
return SC_TRUE;
}
if (_rightZoomRegion.contains(pointLocation)) {
newDestination.destinationScene.depth = _rightZoomDepth;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDestination);
+ sceneView->moveToDestination(newDestination);
return SC_TRUE;
}
if (_offeringHeadZoomRegion.contains(pointLocation)) {
newDestination.destinationScene.depth = _offeringHeadZoomDepth;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDestination);
+ sceneView->moveToDestination(newDestination);
return SC_TRUE;
}
@@ -602,6 +638,8 @@ int GenericCavernDoorOfferingHead::draggingItem(Window *viewWindow, int itemID,
}
int GenericCavernDoorOfferingHead::droppedItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
if (pointLocation.x == -1 && pointLocation.y == -1)
return SIC_REJECT;
@@ -611,71 +649,71 @@ int GenericCavernDoorOfferingHead::droppedItem(Window *viewWindow, int itemID, c
if (_dropRegion.contains(pointLocation)) {
switch (itemID) {
case kItemBalconyKey:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(2);
+ sceneView->playSynchronousAnimation(2);
break;
case kItemBloodyArrow:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(3);
+ sceneView->playSynchronousAnimation(3);
break;
case kItemObsidianBlock:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(5);
+ sceneView->playSynchronousAnimation(5);
break;
case kItemCoilOfRope:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(6);
+ sceneView->playSynchronousAnimation(6);
break;
case kItemCopperKey:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(7);
+ sceneView->playSynchronousAnimation(7);
break;
case kItemCopperMedallion:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(8);
+ sceneView->playSynchronousAnimation(8);
break;
case kItemCeramicBowl:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(9);
+ sceneView->playSynchronousAnimation(9);
break;
case kItemGrapplingHook:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(10);
+ sceneView->playSynchronousAnimation(10);
break;
case kItemHammer:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(11);
+ sceneView->playSynchronousAnimation(11);
break;
case kItemPreservedHeart:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(12);
+ sceneView->playSynchronousAnimation(12);
break;
case kItemJadeBlock:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(13);
+ sceneView->playSynchronousAnimation(13);
break;
case kItemLimestoneBlock:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(14);
+ sceneView->playSynchronousAnimation(14);
break;
case kItemMetalBar:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(15);
+ sceneView->playSynchronousAnimation(15);
break;
case kItemCavernSkull:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(16);
+ sceneView->playSynchronousAnimation(16);
break;
case kItemEntrySkull:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(17);
+ sceneView->playSynchronousAnimation(17);
break;
case kItemSpearSkull:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(18);
+ sceneView->playSynchronousAnimation(18);
break;
case kItemWaterCanFull:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(19);
+ sceneView->playSynchronousAnimation(19);
break;
case kItemWoodenPegs:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(20);
+ sceneView->playSynchronousAnimation(20);
break;
case kItemGoldCoins:
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(21);
+ sceneView->playSynchronousAnimation(21);
break;
}
// Reset the offering flag
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCTransMadeAnOffering = 1;
+ sceneView->getGlobalFlags().myMCTransMadeAnOffering = 1;
// If this was the correct offering, move to the open door scene
if (itemID == _correctOfferingID) {
_vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 10), 128, false, true);
- ((SceneViewWindow *)viewWindow)->moveToDestination(_correctDestination);
+ sceneView->moveToDestination(_correctDestination);
}
// These items don't get consumed
@@ -689,9 +727,11 @@ int GenericCavernDoorOfferingHead::droppedItem(Window *viewWindow, int itemID, c
}
int GenericCavernDoorOfferingHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
Location newLocation = _staticData.location;
newLocation.depth = 0;
- ((SceneViewWindow *)viewWindow)->jumpToScene(newLocation);
+ sceneView->jumpToScene(newLocation);
return SC_TRUE;
}
@@ -700,8 +740,11 @@ int GenericCavernDoorOfferingHead::specifyCursor(Window *viewWindow, const Commo
}
bool GenericCavernDoorOfferingHead::isValidItemToDrop(Window *viewWindow, int itemID) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
// If this is walkthrough mode, only accept the correct item
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1) {
+ if (globalFlags.generalWalkthroughMode == 1) {
if (itemID == _correctOfferingID || (_staticData.location.node == 8 && itemID == kItemBloodyArrow))
return true;
@@ -753,6 +796,9 @@ private:
DeathGodCavernDoorOfferingHead::DeathGodCavernDoorOfferingHead(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
int correctOfferingDestDepth, int transitionType, int transitionData, int transitionStartFrame, int transitionLength) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
_correctDestination.destinationScene = _staticData.location;
_correctDestination.destinationScene.depth = correctOfferingDestDepth;
_correctDestination.transitionType = transitionType;
@@ -761,7 +807,7 @@ DeathGodCavernDoorOfferingHead::DeathGodCavernDoorOfferingHead(BuriedEngine *vm,
_correctDestination.transitionLength = transitionLength;
_dropRegion = Common::Rect(50, 76, 228, 182);
- byte offerings = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCDeathGodOfferings;
+ byte offerings = globalFlags.myMCDeathGodOfferings;
if (offerings & 1) {
if (offerings & 2) {
@@ -785,21 +831,27 @@ DeathGodCavernDoorOfferingHead::DeathGodCavernDoorOfferingHead(BuriedEngine *vm,
}
int DeathGodCavernDoorOfferingHead::preExitRoom(Window *viewWindow, const Location &newLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ InventoryWindow *inventoryWindow = ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow;
+
// Put any pieces placed in the head back in the inventory
- byte &offerings = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCDeathGodOfferings;
+ byte &offerings = globalFlags.myMCDeathGodOfferings;
if (offerings & 1)
- ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->addItem(kItemObsidianBlock);
+ inventoryWindow->addItem(kItemObsidianBlock);
if (offerings & 2)
- ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->addItem(kItemJadeBlock);
+ inventoryWindow->addItem(kItemJadeBlock);
if (offerings & 4)
- ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->addItem(kItemLimestoneBlock);
+ inventoryWindow->addItem(kItemLimestoneBlock);
offerings = 0;
return SC_TRUE;
}
int DeathGodCavernDoorOfferingHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
// Return to depth zero
DestinationScene newDest;
newDest.destinationScene = _staticData.location;
@@ -808,13 +860,16 @@ int DeathGodCavernDoorOfferingHead::mouseUp(Window *viewWindow, const Common::Po
newDest.transitionData = -1;
newDest.transitionStartFrame = -1;
newDest.transitionLength = -1;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDest);
+ sceneView->moveToDestination(newDest);
return SC_TRUE;
}
int DeathGodCavernDoorOfferingHead::draggingItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
if ((itemID == kItemJadeBlock || itemID == kItemLimestoneBlock || itemID == kItemObsidianBlock) && _dropRegion.contains(pointLocation)) {
- byte offerings = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCDeathGodOfferings;
+ byte offerings = globalFlags.myMCDeathGodOfferings;
if ((offerings & 1) != 0 && itemID == kItemObsidianBlock)
return 0;
@@ -830,11 +885,14 @@ int DeathGodCavernDoorOfferingHead::draggingItem(Window *viewWindow, int itemID,
}
int DeathGodCavernDoorOfferingHead::droppedItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
if (pointLocation.x == -1 && pointLocation.y == -1)
return SIC_REJECT;
if ((itemID == kItemJadeBlock || itemID == kItemLimestoneBlock || itemID == kItemObsidianBlock) && _dropRegion.contains(pointLocation)) {
- byte &offerings = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myMCDeathGodOfferings;
+ byte &offerings = globalFlags.myMCDeathGodOfferings;
// Make sure we didn't already place the item
if ((offerings & 1) != 0 && itemID == kItemObsidianBlock)
@@ -879,7 +937,7 @@ int DeathGodCavernDoorOfferingHead::droppedItem(Window *viewWindow, int itemID,
if ((offerings & 1) != 0 && (offerings & 2) != 0 && (offerings & 4) != 0) {
_vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 10), 128, false, true);
- ((SceneViewWindow *)viewWindow)->moveToDestination(_correctDestination);
+ sceneView->moveToDestination(_correctDestination);
}
return SIC_ACCEPT;
@@ -905,17 +963,23 @@ private:
WealthGodRopeDrop::WealthGodRopeDrop(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().myWGPlacedRope == 1)
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.myWGPlacedRope == 1)
_staticData.navFrameIndex = 121;
_dropRope = Common::Rect(222, 149, 282, 189);
}
int WealthGodRopeDrop::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().myWGPlacedRope != 0) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.myWGPlacedRope != 0) {
Location newLocation = _staticData.location;
newLocation.depth = 1;
- ((SceneViewWindow *)viewWindow)->jumpToScene(newLocation);
+ sceneView->jumpToScene(newLocation);
}
return SC_TRUE;
@@ -930,14 +994,17 @@ int WealthGodRopeDrop::draggingItem(Window *viewWindow, int itemID, const Common
}
int WealthGodRopeDrop::droppedItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
if (pointLocation.x == -1 && pointLocation.y == -1)
return SIC_REJECT;
if (_dropRope.contains(pointLocation) && (itemID == kItemCoilOfRope || itemID == kItemGrapplingHook)) {
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myWGPlacedRope = 1;
+ globalFlags.myWGPlacedRope = 1;
Location newLocation = _staticData.location;
newLocation.depth = 1;
- ((SceneViewWindow *)viewWindow)->jumpToScene(newLocation);
+ sceneView->jumpToScene(newLocation);
return SIC_ACCEPT;
}
@@ -951,8 +1018,11 @@ public:
WaterGodInitialWalkSetFlag::WaterGodInitialWalkSetFlag(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
// Set flag on entry
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myWTCurrentBridgeStatus = 1;
+ globalFlags.myWTCurrentBridgeStatus = 1;
}
class WaterGodBridgeJump : public SceneBase {
@@ -984,6 +1054,9 @@ WaterGodBridgeJump::WaterGodBridgeJump(BuriedEngine *vm, Window *viewWindow, con
int movieFileNameID, int playingStartingFrame, int sequenceStartingFrame, int framesPerCycle,
int jumpFudgeFrames, int sequenceLength, bool jumpMidCycle, int frameOffsetToEndOfSwing) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
_movieID = movieFileNameID;
_playingStartingFrame = playingStartingFrame;
_startingMovieFrame = sequenceStartingFrame;
@@ -1004,10 +1077,12 @@ WaterGodBridgeJump::WaterGodBridgeJump(BuriedEngine *vm, Window *viewWindow, con
_staticData.destForward.transitionLength = -1;
// Set visited flag
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myWTSteppedOnSwings = 1;
+ globalFlags.myWTSteppedOnSwings = 1;
}
int WaterGodBridgeJump::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
// Raise the ambient sound
_vm->_sound->adjustSecondaryAmbientSoundVolume(128, false, 0, 0);
uint32 ambientPos = _vm->_sound->getSecondaryAmbientPosition();
@@ -1015,16 +1090,18 @@ int WaterGodBridgeJump::postEnterRoom(Window *viewWindow, const Location &priorL
int frameStartingOffset = (ambientPos / 1838) % _sequenceLength + (_startingMovieFrame - _playingStartingFrame) % _sequenceLength;
// Load and start the new asynchronous animation
- ((SceneViewWindow *)viewWindow)->startAsynchronousAnimation(_movieID, _startingMovieFrame, _playingStartingFrame + frameStartingOffset, _sequenceLength, true);
+ sceneView->startAsynchronousAnimation(_movieID, _startingMovieFrame, _playingStartingFrame + frameStartingOffset, _sequenceLength, true);
return SC_TRUE;
}
int WaterGodBridgeJump::preExitRoom(Window *viewWindow, const Location &newLocation) {
- _finalFrameIndex = ((SceneViewWindow *)viewWindow)->getAsynchronousAnimationCurrentPosition();
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
+ _finalFrameIndex = sceneView->getAsynchronousAnimationCurrentPosition();
// Moving to another node should kill the anim
if (newLocation.node != 4 || newLocation.timeZone != 2 || newLocation.environment != 4)
- ((SceneViewWindow *)viewWindow)->stopAsynchronousAnimation();
+ sceneView->stopAsynchronousAnimation();
// If we are walking into a node less than 5, kill the ambient
if (newLocation.node <= 3)
@@ -1034,6 +1111,8 @@ int WaterGodBridgeJump::preExitRoom(Window *viewWindow, const Location &newLocat
}
int WaterGodBridgeJump::postExitRoom(Window *viewWindow, const Location &newLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
if (newLocation.facing == _staticData.location.facing && newLocation.timeZone == _staticData.location.timeZone &&
newLocation.environment == _staticData.location.environment) {
if (_jumpMidCycle) {
@@ -1043,18 +1122,18 @@ int WaterGodBridgeJump::postExitRoom(Window *viewWindow, const Location &newLoca
if (diff > _framesPerCycle || diffB > _framesPerCycle || diffC > _jumpFudgeFrames * 2) {
if (_staticData.location.facing == 0)
- ((SceneViewWindow *)viewWindow)->showDeathScene(14);
+ sceneView->showDeathScene(14);
else
- ((SceneViewWindow *)viewWindow)->showDeathScene(15);
+ sceneView->showDeathScene(15);
return SC_DEATH;
}
} else {
if ((_finalFrameIndex - _playingStartingFrame) % _framesPerCycle > _jumpFudgeFrames && _framesPerCycle - (_finalFrameIndex - _playingStartingFrame) % _framesPerCycle > _jumpFudgeFrames) {
if (_staticData.location.facing == 0)
- ((SceneViewWindow *)viewWindow)->showDeathScene(14);
+ sceneView->showDeathScene(14);
else
- ((SceneViewWindow *)viewWindow)->showDeathScene(15);
+ sceneView->showDeathScene(15);
return SC_DEATH;
}
@@ -1065,10 +1144,13 @@ int WaterGodBridgeJump::postExitRoom(Window *viewWindow, const Location &newLoca
}
int WaterGodBridgeJump::timerCallback(Window *viewWindow) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ NavArrowWindow *navArrow = ((GameUIWindow *)viewWindow->getParent())->_navArrowWindow;
+
// If we have reached the end of the starting sequence, reset the arrows
- if (_staticData.destForward.destinationScene.timeZone == -1 && ((SceneViewWindow *)viewWindow)->getAsynchronousAnimationCurrentPosition() >= _startingMovieFrame) {
+ if (_staticData.destForward.destinationScene.timeZone == -1 && sceneView->getAsynchronousAnimationCurrentPosition() >= _startingMovieFrame) {
_staticData.destForward = _savedDestForward;
- ((GameUIWindow *)viewWindow->getParent())->_navArrowWindow->updateAllArrows(_staticData);
+ navArrow->updateAllArrows(_staticData);
}
return SC_TRUE;
@@ -1108,6 +1190,8 @@ ArrowGodHead::ArrowGodHead(BuriedEngine *vm, Window *viewWindow, const LocationS
int emptyClosedStill, int emptyOpenStill, int fullClosedStill, int fullOpenStill,
int emptyClosedAnim, int emptyOpenAnim, int fullClosedAnim, int fullOpenAnim) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
_soundID = -1;
_headID = headID;
_skullRegion = Common::Rect(clickLeft, clickTop, clickRight, clickBottom);
@@ -1119,12 +1203,15 @@ ArrowGodHead::ArrowGodHead(BuriedEngine *vm, Window *viewWindow, const LocationS
_headAnimations[1] = emptyOpenAnim;
_headAnimations[2] = fullClosedAnim;
_headAnimations[3] = fullOpenAnim;
- _staticData.navFrameIndex = _stillFrames[((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID)];
+ _staticData.navFrameIndex = _stillFrames[sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID)];
}
int ArrowGodHead::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (_staticData.location.node == 0) {
if (headAStatus == 0)
@@ -1144,21 +1231,26 @@ int ArrowGodHead::postEnterRoom(Window *viewWindow, const Location &priorLocatio
}
int ArrowGodHead::mouseDown(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+ InventoryWindow *inventoryWindow = ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow;
+
// For walkthrough mode, don't allow input
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
+ if (globalFlags.generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
return SC_FALSE;
- if (_skullRegion.contains(pointLocation) && ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 3) {
- byte skullIndex = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID);
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID, 0);
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, 1);
+ if (_skullRegion.contains(pointLocation) && sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 3) {
+ byte skullIndex = sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID, 0);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, 1);
_staticData.navFrameIndex = _stillFrames[1];
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
// Begin dragging
- Common::Point ptInventoryWindow = viewWindow->convertPointToWindow(pointLocation, ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow);
- ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->startDraggingNewItem(skullIndex, ptInventoryWindow);
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ Common::Point ptInventoryWindow = viewWindow->convertPointToWindow(pointLocation, inventoryWindow);
+ inventoryWindow->startDraggingNewItem(skullIndex, ptInventoryWindow);
+ bioChipRightWindow->sceneChanged();
return SC_TRUE;
}
@@ -1166,21 +1258,25 @@ int ArrowGodHead::mouseDown(Window *viewWindow, const Common::Point &pointLocati
}
int ArrowGodHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
// For walkthrough mode, don't allow input
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
+ if (globalFlags.generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
return SC_FALSE;
// Did we click on the head?
if (_skullRegion.contains(pointLocation)) {
- byte headStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID);
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
+ byte headStatus = sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
if (headStatus & 1)
headStatus--;
else
headStatus++;
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, headStatus);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, headStatus);
// Play the proper movie
int currentSoundID = -1;
@@ -1196,15 +1292,15 @@ int ArrowGodHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation
_vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 11), 96);
}
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(_headAnimations[headStatus]);
+ sceneView->playSynchronousAnimation(_headAnimations[headStatus]);
_staticData.navFrameIndex = _stillFrames[headStatus];
viewWindow->invalidateWindow(false);
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headBStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadBStatus;
- byte headCStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadCStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headBStatus = globalFlags.myAGHeadBStatus;
+ byte headCStatus = globalFlags.myAGHeadCStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (_staticData.location.node == 0) {
if (headAStatus == 0)
@@ -1228,9 +1324,9 @@ int ArrowGodHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation
_vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 11), 96);
if (headStatus & 1)
- ((SceneViewWindow *)viewWindow)->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + _headID * 4, g_system->getMillis());
+ sceneView->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + _headID * 4, g_system->getMillis());
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ bioChipRightWindow->sceneChanged();
return SC_TRUE;
}
@@ -1238,36 +1334,43 @@ int ArrowGodHead::mouseUp(Window *viewWindow, const Common::Point &pointLocation
}
int ArrowGodHead::draggingItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
return 0;
- if ((itemID == kItemCavernSkull || itemID == kItemEntrySkull || itemID == kItemSpearSkull) && ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) < 2 && _skullRegion.contains(pointLocation))
+ if ((itemID == kItemCavernSkull || itemID == kItemEntrySkull || itemID == kItemSpearSkull) && sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) < 2 && _skullRegion.contains(pointLocation))
return 1;
return 0;
}
int ArrowGodHead::droppedItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
+ if (globalFlags.generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
return SIC_REJECT;
if (pointLocation.x == -1 && pointLocation.y == -1)
return SIC_REJECT;
- if ((itemID == kItemCavernSkull || itemID == kItemEntrySkull || itemID == kItemSpearSkull) && ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 1 && _skullRegion.contains(pointLocation)) {
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, 2);
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID, itemID);
+ if ((itemID == kItemCavernSkull || itemID == kItemEntrySkull || itemID == kItemSpearSkull) && sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 1 && _skullRegion.contains(pointLocation)) {
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID, 2);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadATouched) + _headID, 1);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatusSkullID) + _headID, itemID);
int currentSoundID = _vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 14), 128, false, true);
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(_headAnimations[2]);
+ sceneView->playSynchronousAnimation(_headAnimations[2]);
_staticData.navFrameIndex = _stillFrames[2];
viewWindow->invalidateWindow(false);
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (_staticData.location.node == 0) {
if (headAStatus == 0)
@@ -1285,7 +1388,7 @@ int ArrowGodHead::droppedItem(Window *viewWindow, int itemID, const Common::Poin
_vm->_sound->stopSoundEffect(currentSoundID);
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ bioChipRightWindow->sceneChanged();
return SIC_ACCEPT;
}
@@ -1293,11 +1396,14 @@ int ArrowGodHead::droppedItem(Window *viewWindow, int itemID, const Common::Poin
}
int ArrowGodHead::specifyCursor(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.generalWalkthroughMode == 1 && (_headID == 0 || _headID == 3))
return 0;
if (_skullRegion.contains(pointLocation)) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 3)
+ if (sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + _headID) == 3)
return kCursorOpenHand;
return kCursorFinger;
@@ -1307,20 +1413,24 @@ int ArrowGodHead::specifyCursor(Window *viewWindow, const Common::Point &pointLo
}
int ArrowGodHead::timerCallback(Window *viewWindow) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
for (int i = 0; i < 4; i++) {
- uint32 lastStartedTimer = ((SceneViewWindow *)viewWindow)->getGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4);
+ uint32 lastStartedTimer = sceneView->getGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4);
if (lastStartedTimer > 0 && g_system->getMillis() > (lastStartedTimer + WAR_GOD_HEAD_TIMER_VALUE)) {
- ((SceneViewWindow *)viewWindow)->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4, 0);
+ sceneView->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4, 0);
TempCursorChange cursorChange(kCursorWait);
if (i == _headID) {
- byte status = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
+ byte status = sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
if (status & 1) {
status--;
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
int currentSoundID = -1;
if (status == 2)
@@ -1328,17 +1438,17 @@ int ArrowGodHead::timerCallback(Window *viewWindow) {
else
currentSoundID = _vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 13), 128, false, true);
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(_headAnimations[status]);
+ sceneView->playSynchronousAnimation(_headAnimations[status]);
_staticData.navFrameIndex = _stillFrames[status];
viewWindow->invalidateWindow(false);
_vm->_sound->stopSoundEffect(currentSoundID);
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headBStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadBStatus;
- byte headCStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadCStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headBStatus = globalFlags.myAGHeadBStatus;
+ byte headCStatus = globalFlags.myAGHeadCStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (_staticData.location.node == 0) {
if (headAStatus == 0)
@@ -1363,21 +1473,21 @@ int ArrowGodHead::timerCallback(Window *viewWindow) {
}
}
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ bioChipRightWindow->sceneChanged();
} else {
- byte status = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
+ byte status = sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
if (status & 1) {
status--;
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
if (status == 2)
_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 14), 128);
else
_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 13), 128);
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (_staticData.location.node == 0) {
if (headAStatus == 0)
@@ -1394,7 +1504,7 @@ int ArrowGodHead::timerCallback(Window *viewWindow) {
}
}
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ bioChipRightWindow->sceneChanged();
if (_headID == 1 || _headID == 2) {
if (_staticData.location.node == 0)
@@ -1425,13 +1535,16 @@ private:
ArrowGodDepthChange::ArrowGodDepthChange(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
_scheduledDepthChange = false;
_soundID = -1;
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headBStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadBStatus;
- byte headCStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadCStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headBStatus = globalFlags.myAGHeadBStatus;
+ byte headCStatus = globalFlags.myAGHeadCStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
int targetDepth = 0;
@@ -1476,23 +1589,26 @@ ArrowGodDepthChange::ArrowGodDepthChange(BuriedEngine *vm, Window *viewWindow, c
if (_staticData.location.depth != targetDepth) {
Location newLocation = _staticData.location;
newLocation.depth = targetDepth;
- ((SceneViewWindow *)viewWindow)->getSceneStaticData(newLocation, _staticData);
+ sceneView->getSceneStaticData(newLocation, _staticData);
_frameCycleCount = _staticData.cycleStartFrame;
// Reload the frame files, if applicable
- ((SceneViewWindow *)viewWindow)->changeStillFrameMovie(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, SF_STILLS));
+ sceneView->changeStillFrameMovie(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, SF_STILLS));
if (_staticData.cycleStartFrame >= 0)
- ((SceneViewWindow *)viewWindow)->changeCycleFrameMovie(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, SF_CYCLES));
+ sceneView->changeCycleFrameMovie(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, SF_CYCLES));
}
}
int ArrowGodDepthChange::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
if (((priorLocation.depth >= 8 && priorLocation.depth <= 11) && _staticData.location.depth < 8) ||
((priorLocation.depth >= 4 && priorLocation.depth <= 7) && _staticData.location.depth < 4)) {
- byte headBStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadBStatus;
- byte headCStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadCStatus;
- byte &headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ byte headBStatus = globalFlags.myAGHeadBStatus;
+ byte headCStatus = globalFlags.myAGHeadCStatus;
+ byte &headDStatus = globalFlags.myAGHeadDStatus;
byte doorLevelVolume = 0;
switch (_staticData.location.node) {
@@ -1508,7 +1624,7 @@ int ArrowGodDepthChange::postEnterRoom(Window *viewWindow, const Location &prior
_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 13), 128);
_scheduledDepthChange = true;
adjustSpearVolume(viewWindow);
- ((SceneViewWindow *)viewWindow)->jumpToScene(_staticData.location);
+ sceneView->jumpToScene(_staticData.location);
return SC_TRUE; // Original does not return here, but the status of this would be bad in that case
}
break;
@@ -1529,6 +1645,8 @@ int ArrowGodDepthChange::postEnterRoom(Window *viewWindow, const Location &prior
}
int ArrowGodDepthChange::postExitRoom(Window *viewWindow, const Location &newLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
if (_staticData.location.timeZone == newLocation.timeZone &&
_staticData.location.environment == newLocation.environment &&
_staticData.location.node == newLocation.node &&
@@ -1537,7 +1655,7 @@ int ArrowGodDepthChange::postExitRoom(Window *viewWindow, const Location &newLoc
_staticData.location.depth == newLocation.depth &&
!_scheduledDepthChange) {
// Notify the player of his gruesome death
- ((SceneViewWindow *)viewWindow)->showDeathScene(13);
+ sceneView->showDeathScene(13);
return SC_DEATH;
}
@@ -1545,6 +1663,10 @@ int ArrowGodDepthChange::postExitRoom(Window *viewWindow, const Location &newLoc
}
int ArrowGodDepthChange::timerCallback(Window *viewWindow) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
SceneBase::timerCallback(viewWindow);
// Check to see if we moved into a death scene
@@ -1555,9 +1677,9 @@ int ArrowGodDepthChange::timerCallback(Window *viewWindow) {
_staticData.location.depth == 7 || _staticData.location.depth == 5 ||
_staticData.location.depth == 9)) {
if (_staticData.location.depth == 1)
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(19);
+ sceneView->playSynchronousAnimation(19);
- ((SceneViewWindow *)viewWindow)->showDeathScene(13);
+ sceneView->showDeathScene(13);
return SC_DEATH;
}
@@ -1567,50 +1689,53 @@ int ArrowGodDepthChange::timerCallback(Window *viewWindow) {
_staticData.location.depth == 3 || _staticData.location.depth == 11 ||
_staticData.location.depth == 10 || _staticData.location.depth == 6 ||
_staticData.location.depth == 7)) {
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(17);
- ((SceneViewWindow *)viewWindow)->showDeathScene(13);
+ sceneView->playSynchronousAnimation(17);
+ sceneView->showDeathScene(13);
return SC_DEATH;
}
// Loop through the four heads
for (int i = 0; i < 4; i++) {
- uint32 lastStartedTimer = ((SceneViewWindow *)viewWindow)->getGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4);
+ uint32 lastStartedTimer = sceneView->getGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4);
// Check if there is a timer going for this head
if (lastStartedTimer > 0 && (g_system->getMillis() > (lastStartedTimer + WAR_GOD_HEAD_TIMER_VALUE) ||
- i == 0 || (((SceneViewWindow *)viewWindow)->getGlobalFlags().generalWalkthroughMode == 1 && i == 1) ||
- (((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i) == 2 && i == 3))) {
- ((SceneViewWindow *)viewWindow)->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4, 0);
+ i == 0 || (globalFlags.generalWalkthroughMode == 1 && i == 1) ||
+ (sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i) == 2 && i == 3))) {
+ sceneView->setGlobalFlagDWord(offsetof(GlobalFlags, myAGHeadAOpenedTime) + i * 4, 0);
TempCursorChange cursorChange(kCursorWait);
- byte status = ((SceneViewWindow *)viewWindow)->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
+ byte status = sceneView->getGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i);
if (status & 1) {
status--;
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
+ sceneView->setGlobalFlagByte(offsetof(GlobalFlags, myAGHeadAStatus) + i, status);
_vm->_sound->playSynchronousSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, (status == 2) ? 14 : 13), 128);
_scheduledDepthChange = true;
adjustSpearVolume(viewWindow);
}
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->sceneChanged();
+ bioChipRightWindow->sceneChanged();
}
}
if (_scheduledDepthChange) {
_scheduledDepthChange = false;
Location location = _staticData.location;
- ((SceneViewWindow *)viewWindow)->jumpToScene(location);
+ sceneView->jumpToScene(location);
}
return SC_TRUE;
}
bool ArrowGodDepthChange::adjustSpearVolume(Window *viewWindow) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
// TODO: Looks like there's a bug in the original. node == 3 should also be in here, I think
// Need to investigate
if (_staticData.location.node >= 0 && _staticData.location.node <= 2) {
- byte headAStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadAStatus;
- byte headDStatus = ((SceneViewWindow *)viewWindow)->getGlobalFlags().myAGHeadDStatus;
+ byte headAStatus = globalFlags.myAGHeadAStatus;
+ byte headDStatus = globalFlags.myAGHeadDStatus;
if (headAStatus == 0) {
_vm->_sound->adjustSecondaryAmbientSoundVolume(128, false, 0, 0);
@@ -1651,57 +1776,69 @@ DeathGodAltar::DeathGodAltar(BuriedEngine *vm, Window *viewWindow, const Locatio
}
int DeathGodAltar::postEnterRoom(Window *viewWindow, const Location &priorLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 1) {
- if (!((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART)) {
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(3);
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.myDGOfferedHeart == 1) {
+ if (!sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART)) {
+ sceneView->playSynchronousAnimation(3);
_staticData.navFrameIndex = 51;
viewWindow->invalidateWindow(false);
if ((_staticData.location.timeZone != priorLocation.timeZone || _staticData.location.environment != priorLocation.environment ||
_staticData.location.node != priorLocation.node || _staticData.location.facing != priorLocation.facing ||
_staticData.location.orientation != priorLocation.orientation || _staticData.location.depth != priorLocation.depth) &&
- !((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART))
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
+ !sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART))
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
}
} else if ((_staticData.location.timeZone != priorLocation.timeZone || _staticData.location.environment != priorLocation.environment ||
_staticData.location.node != priorLocation.node || _staticData.location.facing != priorLocation.facing ||
_staticData.location.orientation != priorLocation.orientation || _staticData.location.depth != priorLocation.depth) &&
- !((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_PHONY_BLOOD)) {
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
+ !sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_PHONY_BLOOD)) {
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
}
return SC_TRUE;
}
int DeathGodAltar::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
- if (_puzzleBox.contains(pointLocation) && ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 1 && ((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (_puzzleBox.contains(pointLocation) && globalFlags.myDGOfferedHeart == 1 && globalFlags.takenEnvironCart == 0) {
Location puzzleLocation = _staticData.location;
puzzleLocation.depth = 1;
- ((SceneViewWindow *)viewWindow)->jumpToScene(puzzleLocation);
+ sceneView->jumpToScene(puzzleLocation);
}
return SC_FALSE;
}
int DeathGodAltar::draggingItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
- if (itemID == kItemPreservedHeart && ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 0 && _heartPool.contains(pointLocation))
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (itemID == kItemPreservedHeart && globalFlags.myDGOfferedHeart == 0 && _heartPool.contains(pointLocation))
return 1;
return 0;
}
int DeathGodAltar::droppedItem(Window *viewWindow, int itemID, const Common::Point &pointLocation, int itemFlags) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
if (pointLocation.x == -1 && pointLocation.y == -1)
return SIC_REJECT;
- if (itemID == kItemPreservedHeart && ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 0 && _heartPool.contains(pointLocation)) {
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart = 1;
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(2);
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(3);
+ if (itemID == kItemPreservedHeart && globalFlags.myDGOfferedHeart == 0 && _heartPool.contains(pointLocation)) {
+ globalFlags.myDGOfferedHeart = 1;
+ sceneView->playSynchronousAnimation(2);
+ sceneView->playSynchronousAnimation(3);
_staticData.navFrameIndex = 51;
- if (!((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART))
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
+ if (!sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART))
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_PRESENT));
return SIC_ACCEPT;
}
@@ -1710,9 +1847,12 @@ int DeathGodAltar::droppedItem(Window *viewWindow, int itemID, const Common::Poi
}
int DeathGodAltar::specifyCursor(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcLocateEnabled == 1) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 1 &&
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0 &&
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.bcLocateEnabled == 1) {
+ if (globalFlags.myDGOfferedHeart == 1 &&
+ globalFlags.takenEnvironCart == 0 &&
_staticData.navFrameIndex == 51 && _puzzleBox.contains(pointLocation))
return -2;
@@ -1720,7 +1860,7 @@ int DeathGodAltar::specifyCursor(Window *viewWindow, const Common::Point &pointL
return -2;
return -1;
- } else if (_puzzleBox.contains(pointLocation) && ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOfferedHeart == 1 && ((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0) {
+ } else if (_puzzleBox.contains(pointLocation) && globalFlags.myDGOfferedHeart == 1 && globalFlags.takenEnvironCart == 0) {
// This logic is broken in 1.04, 1.05, and 1.10. I fixed it here to match mouseUp
return kCursorFinger;
}
@@ -1729,26 +1869,30 @@ int DeathGodAltar::specifyCursor(Window *viewWindow, const Common::Point &pointL
}
int DeathGodAltar::locateAttempted(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcLocateEnabled == 1 &&
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0 &&
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
+ if (globalFlags.bcLocateEnabled == 1 &&
+ globalFlags.takenEnvironCart == 0 &&
_puzzleBox.contains(pointLocation) && _staticData.navFrameIndex == 51 &&
- !((SceneViewWindow *)viewWindow)->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART)) {
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_MUST_BE_REVEALED)); // All will be reveaaaaaaaaled (Yes, I used this joke twice now)
+ !sceneView->isNumberInGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), MAYAN_EVIDENCE_ENVIRON_CART)) {
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_MUST_BE_REVEALED)); // All will be reveaaaaaaaaled (Yes, I used this joke twice now)
return SC_TRUE;
}
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcLocateEnabled == 1) {
+ if (globalFlags.bcLocateEnabled == 1) {
if (_blood.contains(pointLocation)) {
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(6);
+ sceneView->playSynchronousAnimation(6);
// Attempt to add it to the biochip
- if (((SceneViewWindow *)viewWindow)->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_PHONY_BLOOD))
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ACQUIRED));
+ if (sceneView->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_PHONY_BLOOD))
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ACQUIRED));
else
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
// Disable capture
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->disableEvidenceCapture();
+ bioChipRightWindow->disableEvidenceCapture();
}
return SC_TRUE;
@@ -1818,7 +1962,10 @@ int DeathGodPuzzleBox::paint(Window *viewWindow, Graphics::Surface *preBuffer) {
}
int DeathGodPuzzleBox::gdiPaint(Window *viewWindow) {
- if (_translateText && ((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (_translateText && globalFlags.bcTranslateEnabled == 1) {
Common::Rect absoluteRect = viewWindow->getAbsoluteRect();
Common::Rect rect(42, 64, 324, 125);
rect.translate(absoluteRect.left, absoluteRect.top);
@@ -1829,6 +1976,11 @@ int DeathGodPuzzleBox::gdiPaint(Window *viewWindow) {
}
int DeathGodPuzzleBox::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+ InventoryWindow *inventoryWindow = ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow;
+
for (int i = 0; i < 4; i++) {
if (_clickableRegions[i].contains(pointLocation)) {
if (pointLocation.y - _clickableRegions[i].top > _clickableRegions[i].height() / 2) {
@@ -1876,40 +2028,40 @@ int DeathGodPuzzleBox::mouseUp(Window *viewWindow, const Common::Point &pointLoc
newDestination.transitionStartFrame = -1;
newDestination.transitionLength = -1;
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0)
+ if (globalFlags.takenEnvironCart == 0)
newDestination.transitionData = 4;
else
newDestination.transitionData = 5;
BuriedEngine *vm = _vm;
- ((SceneViewWindow *)viewWindow)->moveToDestination(newDestination);
+ sceneView->moveToDestination(newDestination);
// Play animation capturing the evidence
// FIXME: Is this right? Shouldn't this be if takenEnvironCart == 0 only?
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(7);
+ sceneView->playSynchronousAnimation(7);
// Attempt to add it to the biochip
- if (((SceneViewWindow *)viewWindow)->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_ENVIRON_CART))
- ((SceneViewWindow *)viewWindow)->displayLiveText(vm->getString(IDS_MBT_EVIDENCE_RIPPLE_DOCUMENTED));
+ if (sceneView->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_ENVIRON_CART))
+ sceneView->displayLiveText(vm->getString(IDS_MBT_EVIDENCE_RIPPLE_DOCUMENTED));
else
- ((SceneViewWindow *)viewWindow)->displayLiveText(vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
+ sceneView->displayLiveText(vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
// Disable capture
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->disableEvidenceCapture();
+ bioChipRightWindow->disableEvidenceCapture();
// Set the scoring flag
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().scoreCompletedDeathGod = 1;
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myDGOpenedPuzzleBox = 1;
+ globalFlags.scoreCompletedDeathGod = 1;
+ globalFlags.myDGOpenedPuzzleBox = 1;
// Play an Arthur comment
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().takenEnvironCart == 0 && ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow->isItemInInventory(kItemBioChipAI))
+ if (globalFlags.takenEnvironCart == 0 && inventoryWindow->isItemInInventory(kItemBioChipAI))
vm->_sound->playSoundEffect("BITDATA/MAYAN/MYDG_C01.BTA"); // Broken in 1.01
return SC_TRUE;
} else {
// We did the puzzle incorrectly, so spin the wheels and kill the player
- ((SceneViewWindow *)viewWindow)->playPlacedSynchronousAnimation(8, 320, 0);
- ((SceneViewWindow *)viewWindow)->showDeathScene(12);
+ sceneView->playPlacedSynchronousAnimation(8, 320, 0);
+ sceneView->showDeathScene(12);
return SC_DEATH;
}
}
@@ -1918,7 +2070,10 @@ int DeathGodPuzzleBox::mouseUp(Window *viewWindow, const Common::Point &pointLoc
}
int DeathGodPuzzleBox::mouseMove(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcTranslateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.bcTranslateEnabled == 1) {
Common::Rect translateTextRegion(42, 64, 324, 126);
if (translateTextRegion.contains(pointLocation)) {
@@ -1931,7 +2086,7 @@ int DeathGodPuzzleBox::mouseMove(Window *viewWindow, const Common::Point &pointL
translatedText += ' ';
translatedText += _vm->getString(IDMYDG_PUZZLE_BOX_TRANS_TEXT_BASE + 30 + _puzzleIndexes[3] / 6);
- ((SceneViewWindow *)viewWindow)->displayTranslationText(translatedText);
+ sceneView->displayTranslationText(translatedText);
_translateText = true;
viewWindow->invalidateWindow(false);
@@ -2005,19 +2160,23 @@ MainCavernGlassCapture::MainCavernGlassCapture(BuriedEngine *vm, Window *viewWin
}
int MainCavernGlassCapture::locateAttempted(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcLocateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+ BioChipRightWindow *bioChipRightWindow = ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow;
+
+ if (globalFlags.bcLocateEnabled == 1) {
if (_glass.contains(pointLocation)) {
// Play the animation
- ((SceneViewWindow *)viewWindow)->playSynchronousAnimation(22);
+ sceneView->playSynchronousAnimation(22);
// Attempt to add it to the biochip
- if (((SceneViewWindow *)viewWindow)->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID))
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ACQUIRED));
+ if (sceneView->addNumberToGlobalFlagTable(offsetof(GlobalFlags, evcapBaseID), offsetof(GlobalFlags, evcapNumCaptured), 12, MAYAN_EVIDENCE_BROKEN_GLASS_PYRAMID))
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ACQUIRED));
else
- ((SceneViewWindow *)viewWindow)->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
+ sceneView->displayLiveText(_vm->getString(IDS_MBT_EVIDENCE_ALREADY_ACQUIRED));
// Disable capture
- ((GameUIWindow *)viewWindow->getParent())->_bioChipRightWindow->disableEvidenceCapture();
+ bioChipRightWindow->disableEvidenceCapture();
}
return SC_TRUE;
@@ -2027,7 +2186,10 @@ int MainCavernGlassCapture::locateAttempted(Window *viewWindow, const Common::Po
}
int MainCavernGlassCapture::specifyCursor(Window *viewWindow, const Common::Point &pointLocation) {
- if (((SceneViewWindow *)viewWindow)->getGlobalFlags().bcLocateEnabled == 1) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
+ if (globalFlags.bcLocateEnabled == 1) {
if (_glass.contains(pointLocation))
return -2;
@@ -2114,6 +2276,9 @@ private:
WalkDualAmbientVolumeChange::WalkDualAmbientVolumeChange(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
byte newVolume, byte secondVolume, uint32 volumeChangeTime, int stepCount) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+ GlobalFlags &globalFlags = sceneView->getGlobalFlags();
+
_newVolume = newVolume;
_volumeChangeTime = volumeChangeTime;
_stepCount = stepCount;
@@ -2123,7 +2288,7 @@ WalkDualAmbientVolumeChange::WalkDualAmbientVolumeChange(BuriedEngine *vm, Windo
if (_staticData.location.timeZone == 2 && _staticData.location.environment == 4 &&
_staticData.location.node == 5 && _staticData.location.facing == 0 &&
_staticData.location.orientation == 1 && _staticData.location.depth == 0)
- ((SceneViewWindow *)viewWindow)->getGlobalFlags().myWTSteppedOnFarLedge = 1;
+ globalFlags.myWTSteppedOnFarLedge = 1;
}
int WalkDualAmbientVolumeChange::preExitRoom(Window *viewWindow, const Location &newLocation) {
@@ -2144,70 +2309,70 @@ public:
SetVolumeAndFlag::SetVolumeAndFlag(BuriedEngine *vm, Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation,
byte newVolume, int flagOffset, byte flagValue) :
SceneBase(vm, viewWindow, sceneStaticData, priorLocation) {
+ SceneViewWindow *sceneView = ((SceneViewWindow *)viewWindow);
+
_vm->_sound->adjustAmbientSoundVolume(newVolume, false, 0, 0);
if (flagOffset >= 0)
- ((SceneViewWindow *)viewWindow)->setGlobalFlagByte(flagOffset, flagValue);
+ sceneView->setGlobalFlagByte(flagOffset, flagValue);
}
bool SceneViewWindow::initializeMayanTimeZoneAndEnvironment(Window *viewWindow, int environment) {
- GlobalFlags &flags = ((SceneViewWindow *)viewWindow)->getGlobalFlags();
+ InventoryWindow *inventoryWindow = ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow;
if (environment == -1) {
- InventoryWindow *inventoryWindow = ((GameUIWindow *)viewWindow->getParent())->_inventoryWindow;
-
- flags.myTPCodeWheelStatus = flags.generalWalkthroughMode;
- flags.myTPCodeWheelLeftIndex = flags.generalWalkthroughMode == 1 ? 8 : 0;
- flags.myTPCodeWheelRightIndex = flags.generalWalkthroughMode == 1 ? 12 : 0;
- flags.myMCDeathGodOfferings = 0;
- flags.myWGPlacedRope = flags.generalWalkthroughMode;
- flags.myWTCurrentBridgeStatus = 0;
- flags.myAGHeadAStatus = flags.generalWalkthroughMode == 1 ? 2 : 0;
- flags.myAGHeadBStatus = 0;
- flags.myAGHeadCStatus = 0;
- flags.myAGHeadDStatus = flags.generalWalkthroughMode == 1 ? 2 : 0;
- flags.myAGHeadAStatusSkullID = flags.generalWalkthroughMode == 1 ? kItemCavernSkull : 0;
- flags.myAGHeadBStatusSkullID = 0;
- flags.myAGHeadCStatusSkullID = 0;
- flags.myAGHeadDStatusSkullID = flags.generalWalkthroughMode == 1 ? kItemSpearSkull : 0;
- flags.myAGTimerHeadID = 0;
- flags.myAGTimerStartTime = 0;
- flags.myDGOfferedHeart = 0;
- flags.myAGHeadAOpenedTime = 0;
- flags.myAGHeadBOpenedTime = 0;
- flags.myAGHeadCOpenedTime = 0;
- flags.myAGHeadDOpenedTime = 0;
-
- flags.myPickedUpCeramicBowl = inventoryWindow->isItemInInventory(kItemCeramicBowl) ? 1 : 0;
- flags.myMCPickedUpSkull = inventoryWindow->isItemInInventory(kItemCavernSkull) ? 1 : 0;
- flags.myWGRetrievedJadeBlock = inventoryWindow->isItemInInventory(kItemJadeBlock) ? 1 : 0;
- flags.myWTRetrievedLimestoneBlock = inventoryWindow->isItemInInventory(kItemLimestoneBlock) ? 1 : 0;
- flags.myAGRetrievedEntrySkull = inventoryWindow->isItemInInventory(kItemEntrySkull) ? 1 : 0;
- flags.myAGRetrievedSpearSkull = inventoryWindow->isItemInInventory(kItemSpearSkull) ? 1 : 0;
- flags.myAGRetrievedCopperMedal = inventoryWindow->isItemInInventory(kItemCopperMedallion) ? 1 : 0;
- flags.myAGRetrievedObsidianBlock = inventoryWindow->isItemInInventory(kItemObsidianBlock) ? 1 : 0;
- flags.takenEnvironCart = inventoryWindow->isItemInInventory(kItemEnvironCart) ? 1 : 0;
-
- if (flags.generalWalkthroughMode == 1) {
- flags.myMCPickedUpSkull = 1;
- flags.myAGRetrievedSpearSkull = 1;
- flags.myAGRetrievedCopperMedal = 1;
+ _globalFlags.myTPCodeWheelStatus = _globalFlags.generalWalkthroughMode;
+ _globalFlags.myTPCodeWheelLeftIndex = _globalFlags.generalWalkthroughMode == 1 ? 8 : 0;
+ _globalFlags.myTPCodeWheelRightIndex = _globalFlags.generalWalkthroughMode == 1 ? 12 : 0;
+ _globalFlags.myMCDeathGodOfferings = 0;
+ _globalFlags.myWGPlacedRope = _globalFlags.generalWalkthroughMode;
+ _globalFlags.myWTCurrentBridgeStatus = 0;
+ _globalFlags.myAGHeadAStatus = _globalFlags.generalWalkthroughMode == 1 ? 2 : 0;
+ _globalFlags.myAGHeadBStatus = 0;
+ _globalFlags.myAGHeadCStatus = 0;
+ _globalFlags.myAGHeadDStatus = _globalFlags.generalWalkthroughMode == 1 ? 2 : 0;
+ _globalFlags.myAGHeadAStatusSkullID = _globalFlags.generalWalkthroughMode == 1 ? kItemCavernSkull : 0;
+ _globalFlags.myAGHeadBStatusSkullID = 0;
+ _globalFlags.myAGHeadCStatusSkullID = 0;
+ _globalFlags.myAGHeadDStatusSkullID = _globalFlags.generalWalkthroughMode == 1 ? kItemSpearSkull : 0;
+ _globalFlags.myAGTimerHeadID = 0;
+ _globalFlags.myAGTimerStartTime = 0;
+ _globalFlags.myDGOfferedHeart = 0;
+ _globalFlags.myAGHeadAOpenedTime = 0;
+ _globalFlags.myAGHeadBOpenedTime = 0;
+ _globalFlags.myAGHeadCOpenedTime = 0;
+ _globalFlags.myAGHeadDOpenedTime = 0;
+
+ _globalFlags.myPickedUpCeramicBowl = inventoryWindow->isItemInInventory(kItemCeramicBowl) ? 1 : 0;
+ _globalFlags.myMCPickedUpSkull = inventoryWindow->isItemInInventory(kItemCavernSkull) ? 1 : 0;
+ _globalFlags.myWGRetrievedJadeBlock = inventoryWindow->isItemInInventory(kItemJadeBlock) ? 1 : 0;
+ _globalFlags.myWTRetrievedLimestoneBlock = inventoryWindow->isItemInInventory(kItemLimestoneBlock) ? 1 : 0;
+ _globalFlags.myAGRetrievedEntrySkull = inventoryWindow->isItemInInventory(kItemEntrySkull) ? 1 : 0;
+ _globalFlags.myAGRetrievedSpearSkull = inventoryWindow->isItemInInventory(kItemSpearSkull) ? 1 : 0;
+ _globalFlags.myAGRetrievedCopperMedal = inventoryWindow->isItemInInventory(kItemCopperMedallion) ? 1 : 0;
+ _globalFlags.myAGRetrievedObsidianBlock = inventoryWindow->isItemInInventory(kItemObsidianBlock) ? 1 : 0;
+ _globalFlags.takenEnvironCart = inventoryWindow->isItemInInventory(kItemEnvironCart) ? 1 : 0;
+
+ if (_globalFlags.generalWalkthroughMode == 1) {
+ _globalFlags.myMCPickedUpSkull = 1;
+ _globalFlags.myAGRetrievedSpearSkull = 1;
+ _globalFlags.myAGRetrievedCopperMedal = 1;
}
} else if (environment == 2) {
- flags.scoreEnteredMainCavern = 1;
- flags.myVisitedMainCavern = 1;
+ _globalFlags.scoreEnteredMainCavern = 1;
+ _globalFlags.myVisitedMainCavern = 1;
} else if (environment == 3) {
- flags.myVisitedWealthGod = 1;
- flags.myVisitedSpecRooms = 1;
+ _globalFlags.myVisitedWealthGod = 1;
+ _globalFlags.myVisitedSpecRooms = 1;
} else if (environment == 4) {
- flags.myVisitedWaterGod = 1;
- flags.myVisitedSpecRooms = 1;
+ _globalFlags.myVisitedWaterGod = 1;
+ _globalFlags.myVisitedSpecRooms = 1;
} else if (environment == 5) {
- flags.myVisitedArrowGod = 1;
- flags.myVisitedSpecRooms = 1;
+ _globalFlags.myVisitedArrowGod = 1;
+ _globalFlags.myVisitedSpecRooms = 1;
} else if (environment == 6) {
- flags.myVisitedDeathGod = 1;
- flags.myVisitedSpecRooms = 1;
+ _globalFlags.myVisitedDeathGod = 1;
+ _globalFlags.myVisitedSpecRooms = 1;
}
return true;
@@ -2238,15 +2403,15 @@ bool SceneViewWindow::startMayanAmbient(int oldTimeZone, int oldEnvironment, int
}
bool SceneViewWindow::checkCustomMayanAICommentDependencies(const Location &commentLocation, const AIComment &commentData) {
- //((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory
+ InventoryWindow *inventoryWindow = ((GameUIWindow *)getParent())->_inventoryWindow;
switch (commentData.dependencyFlagOffsetB) {
case 1: // Player hasn't translated any inscriptions
return _globalFlags.myTPTextTranslated == 0;
case 2: // Player hasn't translated any inscriptions, has translate biochip
- return _globalFlags.myTPTextTranslated == 0 && ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemBioChipTranslate);
+ return _globalFlags.myTPTextTranslated == 0 && inventoryWindow->isItemInInventory(kItemBioChipTranslate);
case 3: // Player hasn't translated any inscriptions, doesn't have translate biochip
- return _globalFlags.myTPTextTranslated == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemBioChipTranslate);
+ return _globalFlags.myTPTextTranslated == 0 && !inventoryWindow->isItemInInventory(kItemBioChipTranslate);
case 4: // Has translated inscription above calendar, calendar not set to sacred day, player has never been to main cavern
return _globalFlags.myTPCalendarTopTranslated == 1 && _globalFlags.myTPCodeWheelStatus == 0 && _globalFlags.myVisitedMainCavern == 0;
case 5: // Has translated inscription above calendar, calendar is set to sacred day, player has never been to main cavern
@@ -2256,7 +2421,7 @@ bool SceneViewWindow::checkCustomMayanAICommentDependencies(const Location &comm
case 7: // Player has never been to main cavern, calendar not set to sacred day
return _globalFlags.myVisitedMainCavern == 0 && _globalFlags.myTPCodeWheelStatus == 0;
case 8: // Ceramic bowl not in the inventory
- return !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCeramicBowl);
+ return !inventoryWindow->isItemInInventory(kItemCeramicBowl);
case 9: // If node is not 5, 6, or 8
return commentLocation.node != 6 && commentLocation.node != 5 && commentLocation.node != 8;
case 10: // If node is not 1, 0, 7, or 8
@@ -2268,7 +2433,7 @@ bool SceneViewWindow::checkCustomMayanAICommentDependencies(const Location &comm
case 13: // Not any door, no translations
return _globalFlags.myVisitedSpecRooms == 0 && _globalFlags.myMCTransDoor == 0;
case 14: // Not any door, no translations, has translate chip
- return _globalFlags.myVisitedSpecRooms == 0 && _globalFlags.myMCTransDoor == 0 && ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemBioChipTranslate);
+ return _globalFlags.myVisitedSpecRooms == 0 && _globalFlags.myMCTransDoor == 0 && inventoryWindow->isItemInInventory(kItemBioChipTranslate);
case 15: // Not any door, has translated arrow or translated water or translated wealth
return _globalFlags.myVisitedSpecRooms == 0 && (_globalFlags.myMCTransAGOffering == 1 || _globalFlags.myMCTransWGOffering == 1 || _globalFlags.myMCTransWTOffering == 1);
case 16: // Has translated wealth, has not been through wealth god door
@@ -2302,7 +2467,7 @@ bool SceneViewWindow::checkCustomMayanAICommentDependencies(const Location &comm
case 30: // Never put in heart
return _globalFlags.myDGOfferedHeart == 0;
case 31: // Never put in heart, no heart in inventory
- return _globalFlags.myDGOfferedHeart == 0 && ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemPreservedHeart);
+ return _globalFlags.myDGOfferedHeart == 0 && inventoryWindow->isItemInInventory(kItemPreservedHeart);
case 32: // After put in heart, puzzle box never opened
return _globalFlags.myDGOfferedHeart == 1 && _globalFlags.myDGOpenedPuzzleBox == 0;
case 33: // After put in heart, puzzle box never opened, player has not translated 'Itzamna' inscription over inside door of temple
@@ -2318,25 +2483,25 @@ bool SceneViewWindow::checkCustomMayanAICommentDependencies(const Location &comm
case 38: // S1 jam, S2 not jam, S3 not jam, not altar
return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGVisitedAltar == 0;
case 39: // S1 jam, S2 not jam, S3 not jam, S4 not jam, not altar, no skulls
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGVisitedAltar == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull);
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGVisitedAltar == 0 && !inventoryWindow->isItemInInventory(kItemCavernSkull) && !inventoryWindow->isItemInInventory(kItemEntrySkull) && !inventoryWindow->isItemInInventory(kItemSpearSkull);
case 40: // Before interacting with S3 or S4, not altar
return _globalFlags.myAGHeadCTouched == 0 && _globalFlags.myAGHeadDTouched == 0 && _globalFlags.myAGVisitedAltar == 0;
case 41: // S1 jam, S2 jam, S3 not jam, S4 not jam, after interacting with S3 and S4, not altar, no skulls
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 2 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull);
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 2 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && !inventoryWindow->isItemInInventory(kItemCavernSkull) && !inventoryWindow->isItemInInventory(kItemEntrySkull) && !inventoryWindow->isItemInInventory(kItemSpearSkull);
case 42: // S1 jam, S2 not jam, S3 not jam, S4 not jam, after interacting with S3 and S4, not altar, only 1 skull in inventory
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && (((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull));
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && (inventoryWindow->isItemInInventory(kItemCavernSkull) ^ inventoryWindow->isItemInInventory(kItemEntrySkull) ^ inventoryWindow->isItemInInventory(kItemSpearSkull));
case 43: // S1 jam, S2 jam, S3 not jam, S4 not jam, after interacting with S3 and S4, not altar, no skulls
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 2 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull);
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 2 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGHeadCTouched == 1 && _globalFlags.myAGHeadDTouched == 1 && _globalFlags.myAGVisitedAltar == 0 && !inventoryWindow->isItemInInventory(kItemCavernSkull) && !inventoryWindow->isItemInInventory(kItemEntrySkull) && !inventoryWindow->isItemInInventory(kItemSpearSkull);
case 44: // S1 jam, S2 not jam, S3 jam, S4 not jam, not altar, no skulls
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGVisitedAltar == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull);
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 0 && _globalFlags.myAGVisitedAltar == 0 && !inventoryWindow->isItemInInventory(kItemCavernSkull) && !inventoryWindow->isItemInInventory(kItemEntrySkull) && !inventoryWindow->isItemInInventory(kItemSpearSkull);
case 45: // S1 jam, S2 not jam, S3 not jam, S4 jam, not altar, no skulls
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) && !((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull);
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && !inventoryWindow->isItemInInventory(kItemCavernSkull) && !inventoryWindow->isItemInInventory(kItemEntrySkull) && !inventoryWindow->isItemInInventory(kItemSpearSkull);
case 46: // S1 jam, S2 not jam, S3 not jam, S4 jam, not altar, only 1 skull in inventory
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && (((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull));
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadBStatus == 0 && _globalFlags.myAGHeadCStatus == 0 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && (inventoryWindow->isItemInInventory(kItemCavernSkull) ^ inventoryWindow->isItemInInventory(kItemEntrySkull) ^ inventoryWindow->isItemInInventory(kItemSpearSkull));
case 47: // S1 jam, S3 jam, S4 jam, not altar
return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0;
case 48: // S1 jam, S3 jam, not altar, only 1 skull in inventory
- return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && (((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemCavernSkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemEntrySkull) ^ ((GameUIWindow *)getParent())->_inventoryWindow->isItemInInventory(kItemSpearSkull));
+ return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0 && (inventoryWindow->isItemInInventory(kItemCavernSkull) ^ inventoryWindow->isItemInInventory(kItemEntrySkull) ^ inventoryWindow->isItemInInventory(kItemSpearSkull));
case 49: // S1 jam, S2 jam, S3 jam, not altar
return _globalFlags.myAGHeadAStatus == 2 && _globalFlags.myAGHeadCStatus == 2 && _globalFlags.myAGHeadDStatus == 2 && _globalFlags.myAGVisitedAltar == 0;
case 50: // S1 not jam, S2 jam, not altar
Commit: 67eaeb634272e48b15e1795102d3ce2833e30aac
https://github.com/scummvm/scummvm/commit/67eaeb634272e48b15e1795102d3ce2833e30aac
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-30T16:27:49+02:00
Commit Message:
BURIED: Adjust some comments
Changed paths:
engines/buried/detection_tables.h
engines/buried/environ/mayan.cpp
engines/buried/navarrow.cpp
diff --git a/engines/buried/detection_tables.h b/engines/buried/detection_tables.h
index 542aea1818d..730aa2c71d7 100644
--- a/engines/buried/detection_tables.h
+++ b/engines/buried/detection_tables.h
@@ -25,6 +25,10 @@ namespace Buried {
#define GUIO_FULL_GAME GUIO1(GAMEOPTION_ALLOW_SKIP)
#define GUIO_GAME_DEMO GUIO1(GUIO_NOLAUNCHLOAD)
+// NOTE: If variants with new languages are added, the Mayan death god
+// box puzzle will need to be updated. Check environ/mayan.cpp,
+// DeathGodPuzzleBox::isPuzzleSolved()
+
static const ADGameDescription gameDescriptions[] = {
// English Windows 3.11 8BPP
// Installed
diff --git a/engines/buried/environ/mayan.cpp b/engines/buried/environ/mayan.cpp
index f50a47dc716..917e8bf28e3 100644
--- a/engines/buried/environ/mayan.cpp
+++ b/engines/buried/environ/mayan.cpp
@@ -2119,11 +2119,6 @@ int DeathGodPuzzleBox::specifyCursor(Window *viewWindow, const Common::Point &po
}
bool DeathGodPuzzleBox::isPuzzleSolved() const {
- // TODO: Ask players for solutions for other languages
- // clone2727 has the English, French, and Japanese source.
- // clone2727 has the Italian and Spanish versions and solved the puzzle
- // manually for those.
-
switch (_vm->getLanguage()) {
case Common::DE_DEU:
case Common::ES_ESP:
diff --git a/engines/buried/navarrow.cpp b/engines/buried/navarrow.cpp
index 00c6f2bb39e..08e50f9192a 100644
--- a/engines/buried/navarrow.cpp
+++ b/engines/buried/navarrow.cpp
@@ -140,7 +140,7 @@ void NavArrowWindow::onLButtonDown(const Common::Point &point, uint flags) {
((GameUIWindow *)_parent)->_inventoryWindow->destroyInfoWindow();
((GameUIWindow *)_parent)->_inventoryWindow->destroyBurnedLetterWindow();
- // clone2727: This logic was broken in the original. retVal wasn't initialized.
+ // This logic was broken in the original. retVal wasn't initialized.
bool retVal = false;
// Did we click anywhere near the forward button?
Commit: 0bad0a32b2295e9dc3a784cff3e7fe3a4ed376dd
https://github.com/scummvm/scummvm/commit/0bad0a32b2295e9dc3a784cff3e7fe3a4ed376dd
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-30T16:27:49+02:00
Commit Message:
BURIED: Remove superfluous SFX when erasing codes in the ShopNet screen
Changed paths:
engines/buried/environ/future_apartment.cpp
diff --git a/engines/buried/environ/future_apartment.cpp b/engines/buried/environ/future_apartment.cpp
index b862fbe6eb3..fc3f54ed30b 100644
--- a/engines/buried/environ/future_apartment.cpp
+++ b/engines/buried/environ/future_apartment.cpp
@@ -489,9 +489,6 @@ int KitchenUnitShopNet::onCharacter(Window *viewWindow, const Common::KeyState &
if (character.keycode == Common::KEYCODE_BACKSPACE || character.keycode == Common::KEYCODE_DELETE) {
if (!_shopNetCode.empty()) {
- // clone2727 asks why the sound effect is being played again
- _vm->_sound->playSoundEffect(_vm->getFilePath(_staticData.location.timeZone, _staticData.location.environment, 9));
-
if (_shopNetCode.size() == 6 || _shopNetCode.size() == 11) {
_shopNetCode.deleteLastChar();
_shopNetCode.deleteLastChar();
More information about the Scummvm-git-logs
mailing list