aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
authorEric Fry2018-06-25 22:21:51 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commitd77dd6c14ab6c41513ed282597a6da82289061e8 (patch)
treedbe1fbbc37a2d155c68130aafc9024e9d7731462 /engines/illusions
parent92e74327e6cd92b9764c851f99f02a9fa238051f (diff)
downloadscummvm-rg350-d77dd6c14ab6c41513ed282597a6da82289061e8.tar.gz
scummvm-rg350-d77dd6c14ab6c41513ed282597a6da82289061e8.tar.bz2
scummvm-rg350-d77dd6c14ab6c41513ed282597a6da82289061e8.zip
ILLUSIONS: Pause voice when entering in-game menu
Wire up load fail dialog when trying to restart from unsaved new game.
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/duckman/illusions_duckman.cpp4
-rw-r--r--engines/illusions/duckman/menusystem_duckman.cpp19
-rw-r--r--engines/illusions/duckman/menusystem_duckman.h2
-rw-r--r--engines/illusions/duckman/scriptopcodes_duckman.cpp1
-rw-r--r--engines/illusions/sound.cpp10
-rw-r--r--engines/illusions/sound.h2
-rw-r--r--engines/illusions/threads/talkthread_duckman.cpp4
7 files changed, 36 insertions, 6 deletions
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index 6ce29de8c6..38d3bab43c 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -1238,6 +1238,10 @@ void IllusionsEngine_Duckman::playTriggerCauseSound(uint32 verbId, uint32 object
}
bool IllusionsEngine_Duckman::loadSavegameFromScript(int16 slotNum, uint32 callingThreadId) {
+ if (_savegameSlotNum < 0) {
+ return false; // TODO need to handle reset from new game (without exising savegame).
+ }
+
const char *fileName = getSavegameFilename(_savegameSlotNum);
bool success = loadgame(fileName);
if (success)
diff --git a/engines/illusions/duckman/menusystem_duckman.cpp b/engines/illusions/duckman/menusystem_duckman.cpp
index 50ce9326c0..c773afc554 100644
--- a/engines/illusions/duckman/menusystem_duckman.cpp
+++ b/engines/illusions/duckman/menusystem_duckman.cpp
@@ -87,8 +87,10 @@ BaseMenu *DuckmanMenuSystem::createMenuById(int menuId) {
return createOptionsMenu();
case kDuckmanDebugPauseMenu:
return createDebugPauseMenu();
- case kDuckmanAddRemoveInventoryMenu:
- return createAddRemoveInventoryMenu();
+ case kDuckmanAddRemoveInventoryMenu:
+ return createAddRemoveInventoryMenu();
+ case kDuckmanLoadGameFailedMenu:
+ return createLoadGameFailedMenu();
default:
error("DuckmanMenuSystem::createMenuById() Invalid menu id %d", menuId);
}
@@ -107,6 +109,15 @@ BaseMenu *DuckmanMenuSystem::createLoadGameMenu() {
return 0; // TODO
}
+BaseMenu *DuckmanMenuSystem::createLoadGameFailedMenu() {
+ BaseMenu *menu = new BaseMenu(this, 0x00120003, 12, 17, 11, 27, 0);
+ menu->addText("Load Game Failed");
+ menu->addText("-------------------");
+ menu->addMenuItem(new MenuItem("Continue", new MenuActionReturnChoice(this, 1)));
+ return menu;
+}
+
+
MenuItem *DuckmanMenuSystem::createOptionsSliderMenuItem(MenuActionUpdateSlider **action, const Common::String &text, SliderActionType type, BaseMenu *baseMenu) {
int sliderValue = 0;
Common::String sliderText = "{~~~~~~~~~~~~~~~~}";
@@ -261,8 +272,10 @@ int DuckmanMenuSystem::convertRootMenuId(uint32 menuId) {
return kDuckmanSaveCompleteMenu;
/*
case 0x180006: // save game failed menu
- case 0x180007: // load game failed menu
*/
+ case 0x180007: // load game failed menu
+ return kDuckmanLoadGameFailedMenu;
+
/* TODO CHECKME Another pause menu?
case 0x180008:
menuData = &g_menuDataPause;
diff --git a/engines/illusions/duckman/menusystem_duckman.h b/engines/illusions/duckman/menusystem_duckman.h
index 5b3cd55758..edf8620020 100644
--- a/engines/illusions/duckman/menusystem_duckman.h
+++ b/engines/illusions/duckman/menusystem_duckman.h
@@ -37,6 +37,7 @@ namespace Illusions {
enum {
kDuckmanMainMenu,
kDuckmanLoadGameMenu,
+ kDuckmanLoadGameFailedMenu,
kDuckmanOptionsMenu,
kDuckmanPauseMenu,
kDuckmanDebugMenu,
@@ -66,6 +67,7 @@ public://protected:
BaseMenu *createMenuById(int menuId);
BaseMenu *createMainMenu();
BaseMenu *createLoadGameMenu();
+ BaseMenu *createLoadGameFailedMenu();
BaseMenu *createOptionsMenu();
BaseMenu *createPauseMenu();
BaseMenu *createQueryRestartMenu();
diff --git a/engines/illusions/duckman/scriptopcodes_duckman.cpp b/engines/illusions/duckman/scriptopcodes_duckman.cpp
index 81c0c41e6c..1876b13593 100644
--- a/engines/illusions/duckman/scriptopcodes_duckman.cpp
+++ b/engines/illusions/duckman/scriptopcodes_duckman.cpp
@@ -672,7 +672,6 @@ void ScriptOpcodes_Duckman::opDisplayMenu(ScriptThread *scriptThread, OpCall &op
}
void ScriptOpcodes_Duckman::opSwitchMenuChoice(ScriptThread *scriptThread, OpCall &opCall) {
- //_vm->_menuChoiceOfs = 156; // DEBUG Chose "Start game"
opCall._deltaOfs += _vm->_menuChoiceOfs;
}
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index a40c43f129..bc65e37784 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -211,6 +211,12 @@ bool VoicePlayer::isCued() {
return _voiceStatus == 2;
}
+void VoicePlayer::pause(bool paused) {
+ if(isPlaying()) {
+ g_system->getMixer()->pauseHandle(_soundHandle, paused);
+ }
+}
+
// Sound
Sound::Sound(uint32 soundEffectId, uint32 soundGroupId, bool looping)
@@ -304,6 +310,10 @@ void SoundMan::stopVoice() {
_voicePlayer->stop();
}
+void SoundMan::pauseVoice(bool paused) {
+ _voicePlayer->pause(paused);
+}
+
bool SoundMan::isVoicePlaying() {
return _voicePlayer->isPlaying();
}
diff --git a/engines/illusions/sound.h b/engines/illusions/sound.h
index 75464e8bd5..f6a96d5aaa 100644
--- a/engines/illusions/sound.h
+++ b/engines/illusions/sound.h
@@ -76,6 +76,7 @@ public:
bool cue(const char *voiceName);
void stopCueing();
void start(int16 volume, int16 pan);
+ void pause(bool paused);
void stop();
bool isPlaying();
bool isEnabled();
@@ -129,6 +130,7 @@ public:
void stopCueingVoice();
void startVoice(int16 volume, int16 pan);
void stopVoice();
+ void pauseVoice(bool paused);
bool isVoicePlaying();
bool isVoiceEnabled();
bool isVoiceCued();
diff --git a/engines/illusions/threads/talkthread_duckman.cpp b/engines/illusions/threads/talkthread_duckman.cpp
index 42d9747810..fdfcc0ac4f 100644
--- a/engines/illusions/threads/talkthread_duckman.cpp
+++ b/engines/illusions/threads/talkthread_duckman.cpp
@@ -206,7 +206,7 @@ int TalkThread_Duckman::onUpdate() {
void TalkThread_Duckman::onPause() {
if (_status == 5) {
if (!(_flags & 4)) {
- // TODO audvocPauseVoice();
+ _vm->_soundMan->pauseVoice(true);
}
if (!(_flags & 8))
_textDurationElapsed = getDurationElapsed(_textStartTime, _textEndTime);
@@ -220,7 +220,7 @@ void TalkThread_Duckman::onUnpause() {
_vm->_soundMan->cueVoice((char*)talkEntry->_voiceName);
} else if (_status == 5) {
if (!(_flags & 4)) {
- // TODO audvocUnpauseVoice();
+ _vm->_soundMan->pauseVoice(false);
}
if (!(_flags & 8)) {
_textStartTime = getCurrentTime();