aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-29 11:52:35 -0400
committerMatthew Hoops2011-09-29 11:52:35 -0400
commit69badbebc43488caa66bd5ac25d942fb36592259 (patch)
tree2fdb4aad522f1e7b6aec51f3da148daa5d25fe4e /engines
parent878601b2a3b1e60c4ec96ec1ca99d2e5eb5359be (diff)
downloadscummvm-rg350-69badbebc43488caa66bd5ac25d942fb36592259.tar.gz
scummvm-rg350-69badbebc43488caa66bd5ac25d942fb36592259.tar.bz2
scummvm-rg350-69badbebc43488caa66bd5ac25d942fb36592259.zip
PEGASUS: Add the PauseMenu code
Diffstat (limited to 'engines')
-rwxr-xr-xengines/pegasus/menu.cpp298
-rwxr-xr-xengines/pegasus/menu.h23
-rw-r--r--engines/pegasus/pegasus.cpp58
-rw-r--r--engines/pegasus/pegasus.h4
4 files changed, 381 insertions, 2 deletions
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
index 2aba4f0d94..dfef67c27b 100755
--- a/engines/pegasus/menu.cpp
+++ b/engines/pegasus/menu.cpp
@@ -914,4 +914,302 @@ void DeathMenu::drawAllScores() {
}
}
+enum {
+ kPauseMenuSave,
+ kPauseMenuContinue,
+ kPauseMenuRestore,
+ kPauseMenuSoundFX,
+ kPauseMenuAmbience,
+ kPauseMenuWalkthru,
+ kPauseMenuQuitToMainMenu,
+
+ kFirstPauseSelection = kPauseMenuSave,
+ kLastPauseSelection = kPauseMenuQuitToMainMenu
+};
+
+const tCoordType kPauseLeft = 194;
+const tCoordType kPauseTop = 68;
+
+const tCoordType kSaveGameLeft = kPauseLeft + 6;
+const tCoordType kSaveGameTop = kPauseTop + 56;
+
+const tCoordType kSaveGameSelectLeft = kPauseLeft - 44;
+const tCoordType kSaveGameSelectTop = kPauseTop + 52;
+
+const tCoordType kPauseContinueLeft = kPauseLeft + 18;
+const tCoordType kPauseContinueTop = kPauseTop + 100;
+
+const tCoordType kPauseContinueSelectLeft = kPauseLeft - 44;
+const tCoordType kPauseContinueSelectTop = kPauseTop + 95;
+
+const tCoordType kPauseRestoreLeft = kPauseLeft + 18;
+const tCoordType kPauseRestoreTop = kPauseTop + 136;
+
+const tCoordType kPauseRestoreSelectLeft = kPauseLeft - 44;
+const tCoordType kPauseRestoreSelectTop = kPauseTop + 131;
+
+const tCoordType kSoundFXLeft = kPauseLeft + 128;
+const tCoordType kSoundFXTop = kPauseTop + 187;
+const tCoordType kSoundFXRight = kSoundFXLeft + 96;
+const tCoordType kSoundFXBottom = kSoundFXTop + 14;
+
+const tCoordType kSoundFXSelectLeft = kPauseLeft - 44;
+const tCoordType kSoundFXSelectTop = kPauseTop + 172;
+
+const tCoordType kAmbienceLeft = kPauseLeft + 128;
+const tCoordType kAmbienceTop = kPauseTop + 227;
+const tCoordType kAmbienceRight = kAmbienceLeft + 96;
+const tCoordType kAmbienceBottom = kAmbienceTop + 14;
+
+const tCoordType kAmbienceSelectLeft = kPauseLeft - 44;
+const tCoordType kAmbienceSelectTop = kPauseTop + 212;
+
+const tCoordType kWalkthruLeft = kPauseLeft + 128;
+const tCoordType kWalkthruTop = kPauseTop + 264;
+
+const tCoordType kWalkthruSelectLeft = kPauseLeft - 44;
+const tCoordType kWalkthruSelectTop = kPauseTop + 255;
+
+const tCoordType kQuitLeft = kPauseLeft + 18;
+const tCoordType kQuitTop = kPauseTop + 302;
+
+const tCoordType kQuitSelectLeft = kPauseLeft - 44;
+const tCoordType kQuitSelectTop = kPauseTop + 297;
+
+// These are relative to the pause background.
+const tCoordType kPauseScoreLeft = 130;
+const tCoordType kPauseScoreTop = 34;
+const tCoordType kPauseScoreRight = kPauseScoreLeft + 108;
+const tCoordType kPauseScoreBottom = kPauseScoreTop + 12;
+
+// Never set the current input handler to the CPauseMenu.
+PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButton(0), _restoreButton(0),
+ _walkthroughButton(0), _continueButton(0), _soundFXLevel(0), _ambienceLevel(0), _quitButton(0),
+ _largeSelect(0), _smallSelect(0) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ _pauseBackground.initFromPICTFile("Images/Pause Screen/PausScrn.pict", true);
+
+ if (!vm->isDemo()) {
+ Surface numbers;
+ numbers.getImageFromPICTFile("Images/Pause Screen/Numbers.pict");
+ drawScore(GameState.getTotalScore(), kMaxTotalScore,
+ Common::Rect(kPauseScoreLeft, kPauseScoreTop, kPauseScoreRight, kPauseScoreBottom), &numbers);
+ }
+
+ _pauseBackground.setDisplayOrder(kPauseMenuOrder);
+ _pauseBackground.moveElementTo(kPauseLeft, kPauseTop);
+ _pauseBackground.startDisplaying();
+ _pauseBackground.show();
+
+ if (!vm->isDemo()) {
+ _saveButton.initFromPICTFile("Images/Pause Screen/SaveGame.pict");
+ _saveButton.setDisplayOrder(kSaveGameOrder);
+ _saveButton.moveElementTo(kSaveGameLeft, kSaveGameTop);
+ _saveButton.startDisplaying();
+
+ _restoreButton.initFromPICTFile("Images/Pause Screen/Restore.pict");
+ _restoreButton.setDisplayOrder(kRestoreOrder);
+ _restoreButton.moveElementTo(kPauseRestoreLeft, kPauseRestoreTop);
+ _restoreButton.startDisplaying();
+
+ _walkthroughButton.initFromPICTFile("Images/Pause Screen/Walkthru.pict");
+ _walkthroughButton.setDisplayOrder(kWalkthruOrder);
+ _walkthroughButton.moveElementTo(kWalkthruLeft, kWalkthruTop);
+ _walkthroughButton.startDisplaying();
+
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ }
+
+ _continueButton.initFromPICTFile("Images/Pause Screen/Continue.pict");
+ _continueButton.setDisplayOrder(kContinueOrder);
+ _continueButton.moveElementTo(kPauseContinueLeft, kPauseContinueTop);
+ _continueButton.startDisplaying();
+
+ _soundFXLevel.setDisplayOrder(kSoundFXOrder);
+ _soundFXLevel.setBounds(Common::Rect(kSoundFXLeft, kSoundFXTop, kSoundFXRight, kSoundFXBottom));
+ _soundFXLevel.startDisplaying();
+ _soundFXLevel.show();
+ _soundFXLevel.setSoundLevel(vm->getSoundFXLevel());
+
+ _ambienceLevel.setDisplayOrder(kAmbienceOrder);
+ _ambienceLevel.setBounds(Common::Rect(kAmbienceLeft, kAmbienceTop, kAmbienceRight, kAmbienceBottom));
+ _ambienceLevel.startDisplaying();
+ _ambienceLevel.show();
+ _ambienceLevel.setSoundLevel(vm->getAmbienceLevel());
+
+ _quitButton.initFromPICTFile("Images/Pause Screen/Quit2MM.pict");
+ _quitButton.setDisplayOrder(kQuitToMainMenuOrder);
+ _quitButton.moveElementTo(kQuitLeft, kQuitTop);
+ _quitButton.startDisplaying();
+
+ _largeSelect.initFromPICTFile("Images/Pause Screen/SelectL.pict", true);
+ _largeSelect.setDisplayOrder(kPauseLargeHiliteOrder);
+ _largeSelect.startDisplaying();
+
+ _smallSelect.initFromPICTFile("Images/Pause Screen/SelectS.pict", true);
+ _smallSelect.setDisplayOrder(kPauseSmallHiliteOrder);
+ _smallSelect.startDisplaying();
+
+ _menuSelection = (vm->isDemo()) ? kPauseMenuContinue : kPauseMenuSave;
+
+ updateDisplay();
+}
+
+void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ PegasusEngine *vm = (PegasusEngine *)g_engine;
+
+ if (input.upButtonDown()) {
+ if (vm->isDemo()) {
+ if (_menuSelection > kPauseMenuContinue) {
+ switch (_menuSelection) {
+ case kPauseMenuSoundFX:
+ _menuSelection = kPauseMenuContinue;
+ break;
+ case kPauseMenuAmbience:
+ _menuSelection = kPauseMenuSoundFX;
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _menuSelection = kPauseMenuAmbience;
+ break;
+ }
+ updateDisplay();
+ }
+ } else {
+ if (_menuSelection > kFirstPauseSelection) {
+ _menuSelection--;
+ updateDisplay();
+ }
+ }
+ } else if (input.downButtonDown()) {
+ if (vm->isDemo()) {
+ if (_menuSelection < kPauseMenuQuitToMainMenu) {
+ switch (_menuSelection) {
+ case kPauseMenuContinue:
+ _menuSelection = kPauseMenuSoundFX;
+ break;
+ case kPauseMenuSoundFX:
+ _menuSelection = kPauseMenuAmbience;
+ break;
+ case kPauseMenuAmbience:
+ _menuSelection = kPauseMenuQuitToMainMenu;
+ break;
+ }
+ updateDisplay();
+ }
+ } else {
+ if (_menuSelection < kLastPauseSelection) {
+ _menuSelection++;
+ updateDisplay();
+ }
+ }
+ } else if (input.leftButtonDown()) {
+ if (_menuSelection == kPauseMenuSoundFX) {
+ _soundFXLevel.decrementLevel();
+ vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ } else if (_menuSelection == kPauseMenuAmbience) {
+ _ambienceLevel.decrementLevel();
+ vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ }
+ } else if (input.rightButtonDown()) {
+ if (_menuSelection == kPauseMenuSoundFX) {
+ _soundFXLevel.incrementLevel();
+ vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ } else if (_menuSelection == kPauseMenuAmbience) {
+ _ambienceLevel.incrementLevel();
+ vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ }
+ } else if (JMPPPInput::isMenuButtonPressInput(input)) {
+ switch (_menuSelection) {
+ case kPauseMenuSave:
+ _saveButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _saveButton.hide();
+ setLastCommand(kMenuCmdPauseSave);
+ break;
+ case kPauseMenuRestore:
+ _restoreButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _restoreButton.hide();
+ setLastCommand(kMenuCmdPauseRestore);
+ break;
+ case kPauseMenuContinue:
+ _continueButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _continueButton.hide();
+ setLastCommand(kMenuCmdPauseContinue);
+ break;
+ case kPauseMenuWalkthru:
+ GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
+ if (GameState.getWalkthroughMode())
+ _walkthroughButton.show();
+ else
+ _walkthroughButton.hide();
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _quitButton.show();
+ vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ _quitButton.hide();
+ setLastCommand(kMenuCmdPauseQuit);
+ break;
+ }
+ }
+
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void PauseMenu::updateDisplay() {
+ switch (_menuSelection) {
+ case kPauseMenuSave:
+ _largeSelect.moveElementTo(kSaveGameSelectLeft, kSaveGameSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuContinue:
+ _smallSelect.moveElementTo(kPauseContinueSelectLeft, kPauseContinueSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kPauseMenuRestore:
+ _smallSelect.moveElementTo(kPauseRestoreSelectLeft, kPauseRestoreSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ case kPauseMenuSoundFX:
+ _largeSelect.moveElementTo(kSoundFXSelectLeft, kSoundFXSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuAmbience:
+ _largeSelect.moveElementTo(kAmbienceSelectLeft, kAmbienceSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuWalkthru:
+ _largeSelect.moveElementTo(kWalkthruSelectLeft, kWalkthruSelectTop);
+ _largeSelect.show();
+ _smallSelect.hide();
+ break;
+ case kPauseMenuQuitToMainMenu:
+ _smallSelect.moveElementTo(kQuitSelectLeft, kQuitSelectTop);
+ _smallSelect.show();
+ _largeSelect.hide();
+ break;
+ }
+}
+
+
} // End of namespace Pegasus
diff --git a/engines/pegasus/menu.h b/engines/pegasus/menu.h
index 17242208d1..741662336d 100755
--- a/engines/pegasus/menu.h
+++ b/engines/pegasus/menu.h
@@ -143,6 +143,29 @@ protected:
Sound _triumphSound;
};
+class PauseMenu : public GameMenu {
+public:
+ PauseMenu();
+ virtual ~PauseMenu() {}
+
+ virtual void handleInput(const Input &input, const Hotspot *);
+
+protected:
+ void updateDisplay();
+
+ uint32 _menuSelection;
+ Picture _pauseBackground;
+ Picture _saveButton;
+ Picture _restoreButton;
+ Picture _walkthroughButton;
+ Picture _continueButton;
+ SoundLevel _soundFXLevel;
+ SoundLevel _ambienceLevel;
+ Picture _quitButton;
+ Picture _largeSelect;
+ Picture _smallSelect;
+};
+
} // End of namespace Pegasus
#endif
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 6af7f083af..037688b337 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -674,6 +674,31 @@ void PegasusEngine::doGameMenuCommand(const tGameMenuCommand command) {
if (!isDemo())
resetIntroTimer();
break;
+ case kMenuCmdPauseSave:
+ error("Save game");
+ break;
+ case kMenuCmdPauseContinue:
+ pauseMenu(false);
+ break;
+ case kMenuCmdPauseRestore:
+ error("Load game");
+ break;
+ case kMenuCmdPauseQuit:
+#if 1
+ // TODO: This doesn't work yet
+ error("Return to main menu");
+#else
+ // TODO: Fade out
+ throwAwayEverything();
+ pauseMenu(false);
+ useMenu(new MainMenu());
+ _gfx->updateDisplay();
+ ((MainMenu *)_gameMenu)->startMainMenuLoop();
+ // TODO: Fade in
+ if (!isDemo())
+ resetIntroTimer();
+#endif
+ break;
case kMenuCmdNoCommand:
break;
default:
@@ -1532,9 +1557,8 @@ void PegasusEngine::shellGameInput(const Input &input, const Hotspot *cursorSpot
if (JMPPPInput::isRaiseBiochipsInput(input))
toggleBiochipDisplay();
- // TODO
if (JMPPPInput::isTogglePauseInput(input) && _neighborhood)
- warning("Pause");
+ pauseMenu(!isPaused());
}
if (JMPPPInput::isToggleInfoInput(input))
@@ -1638,4 +1662,34 @@ void PegasusEngine::removeAllItemsFromBiochips() {
_biochips.removeAllItems();
}
+void PegasusEngine::setSoundFXLevel(uint16 fxLevel) {
+ _FXLevel = fxLevel;
+ if (_neighborhood)
+ _neighborhood->setSoundFXLevel(fxLevel);
+ if (g_AIArea)
+ g_AIArea->setAIVolume(fxLevel);
+}
+
+void PegasusEngine::setAmbienceLevel(uint16 ambientLevel) {
+ _ambientLevel = ambientLevel;
+ if (_neighborhood)
+ _neighborhood->setAmbienceLevel(ambientLevel);
+}
+
+void PegasusEngine::pauseMenu(bool menuUp) {
+ if (menuUp) {
+ // TODO: Pause engine
+ _screenDimmer.startDisplaying();
+ _screenDimmer.show();
+ _gfx->updateDisplay();
+ useMenu(new PauseMenu());
+ } else {
+ // TODO: Resume engine
+ _screenDimmer.hide();
+ _screenDimmer.stopDisplaying();
+ useMenu(0);
+ g_AIArea->checkMiddleArea();
+ }
+}
+
} // End of namespace Pegasus
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index c0a7d02631..a79d2a7183 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -114,7 +114,9 @@ public:
// Volume
uint16 getSoundFXLevel() { return _FXLevel; }
+ void setSoundFXLevel(uint16);
uint16 getAmbienceLevel() { return _ambientLevel; }
+ void setAmbienceLevel(uint16);
// Items
bool playerHasItem(const Item *);
@@ -227,12 +229,14 @@ private:
bool playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y);
void throwAwayEverything();
void shellGameInput(const Input &input, const Hotspot *cursorSpot);
+ bool isPaused() { return false; } // TODO
// Menu
GameMenu *_gameMenu;
void doGameMenuCommand(const tGameMenuCommand);
void doInterfaceOverview();
ScreenDimmer _screenDimmer;
+ void pauseMenu(bool menuUp);
// Energy
int32 _savedEnergyValue;