[Scummvm-git-logs] scummvm master -> b5e47c8237690a57029c90a62b9a820a9a220ad7
dreammaster
noreply at scummvm.org
Sat Feb 24 19:10:06 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fa10facb6e M4: Add syncSoundSettings to engine initialization
b5e47c8237 M4: Fix crashes opening dialogs from original game dialog
Commit: fa10facb6e79f69bd531237da2b06504e8844a70
https://github.com/scummvm/scummvm/commit/fa10facb6e79f69bd531237da2b06504e8844a70
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-02-24T11:09:59-08:00
Commit Message:
M4: Add syncSoundSettings to engine initialization
Changed paths:
engines/m4/m4.cpp
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 3fcf3ed0f66..e8d80b6c47e 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -87,6 +87,7 @@ int M4Engine::isDemo() const {
Common::Error M4Engine::run() {
// Initialize 320x200 paletted graphics mode
initGraphics(640, 480);
+ syncSoundSettings();
// Instantiate globals and setup
Vars *vars = createVars();
Commit: b5e47c8237690a57029c90a62b9a820a9a220ad7
https://github.com/scummvm/scummvm/commit/b5e47c8237690a57029c90a62b9a820a9a220ad7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-02-24T11:09:59-08:00
Commit Message:
M4: Fix crashes opening dialogs from original game dialog
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/game_menu.h
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index bcf16e29491..26c5fb82292 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -807,15 +807,21 @@ void BurgerEngine::showSaveScreen() {
}
}
-void BurgerEngine::showLoadScreen(bool fromMainMenu) {
+void BurgerEngine::showLoadScreen(LoadDialogSource source) {
if (_useOriginalSaveLoad) {
- if (fromMainMenu)
+ switch (source) {
+ case kLoadFromMainMenu:
GUI::CreateLoadMenuFromMain(_G(master_palette));
- else
+ break;
+ case kLoadFromGameDialog:
+ GUI::CreateLoadMenu(_G(master_palette));
+ break;
+ case kLoadFromHotkey:
GUI::CreateF3LoadMenu(_G(master_palette));
-
+ break;
+ }
} else {
- M4Engine::showLoadScreen(fromMainMenu);
+ M4Engine::showLoadScreen(source);
}
}
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 3bc2ac7d668..4dfe945848c 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -84,7 +84,7 @@ public:
void syncFlags(Common::Serializer &s) override;
void showSaveScreen() override;
- void showLoadScreen(bool fromMainMenu = false) override;
+ void showLoadScreen(LoadDialogSource source) override;
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
void global_daemon() override;
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 05a0f99b242..e72a95dd7e3 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -49,6 +49,8 @@ namespace GUI {
#define LockMouseSprite mouse_lock_sprite
#define UnlockMouseSprite mouse_unlock_sprite
+static bool buttonClosesDialog;
+
void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu);
void CreateSaveMenu(RGB8 *myPalette);
void CreateLoadMenu(RGB8 *myPalette);
@@ -770,8 +772,13 @@ bool button_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32
// digi_play(inv_click_snd, 2, 255, -1, inv_click_snd_room_lock);
currMenu = (guiMenu *)myItem->myMenu;
currTag = myItem->tag;
+ buttonClosesDialog = false;
+
(myItem->callback)((void *)myItem, (void *)myItem->myMenu);
- myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+
+ status = 0;
+ myScreen = buttonClosesDialog ? nullptr : vmng_screen_find((void *)myItem->myMenu, &status);
+
if ((!myScreen) || (status != SCRN_ACTIVE)) {
*currItem = nullptr;
} else {
@@ -2632,6 +2639,7 @@ void cb_Game_Save(void *, void *) {
// Destroy the game menu
DestroyGameMenu();
menu_Shutdown(true);
+ buttonClosesDialog = true;
// Create the save game menu
g_engine->showSaveScreen();
@@ -2641,9 +2649,10 @@ void cb_Game_Load(void *, void *) {
// Destroy the game menu
DestroyGameMenu();
menu_Shutdown(true);
+ buttonClosesDialog = true;
// Create the save game menu
- g_engine->showLoadScreen();
+ g_engine->showLoadScreen(M4Engine::kLoadFromGameDialog);
}
void cb_Game_Main(void *, void *) {
@@ -2672,6 +2681,7 @@ void cb_Game_Main(void *, void *) {
void cb_Game_Options(void *, void *) {
// Destroy the game menu
DestroyGameMenu();
+ buttonClosesDialog = true;
// Create the options menu
CreateOptionsMenu(nullptr);
@@ -2749,6 +2759,7 @@ void cb_Options_Game_Cancel(void *, void *) {
// Destroy the options menu
DestroyOptionsMenu();
+ buttonClosesDialog = true;
// Create the options menu
CreateGameMenuMain(nullptr);
@@ -2757,6 +2768,7 @@ void cb_Options_Game_Cancel(void *, void *) {
void cb_Options_Game_Done(void *, void *) {
// Destroy the options menu
DestroyOptionsMenu();
+ buttonClosesDialog = true;
// Create the options menu
CreateGameMenuMain(nullptr);
@@ -3258,6 +3270,8 @@ void cb_SaveLoad_Cancel(void *, void *theMenu) {
CreateGameMenuMain(nullptr);
}
}
+
+ buttonClosesDialog = true;
}
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index e8cec67114f..8e1ef57c8db 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -150,10 +150,11 @@ menuItem *menu_TextFieldAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32
const char *prompt = nullptr, int32 specialtag = 0, CALLBACK callback = nullptr, bool transparent = false);
//GAME MENU FUNCTIONS
-void CreateGameMenu(RGB8 *myPalette);
-void CreateOptionsMenu(RGB8 *myPalette);
-void CreateF2SaveMenu(RGB8 *myPalette);
-void CreateF3LoadMenu(RGB8 *myPalette);
+extern void CreateGameMenu(RGB8 *myPalette);
+extern void CreateOptionsMenu(RGB8 *myPalette);
+extern void CreateF2SaveMenu(RGB8 *myPalette);
+extern void CreateLoadMenu(RGB8 *myPalette);
+extern void CreateF3LoadMenu(RGB8 *myPalette);
//routines used by the main menu
void CreateLoadMenuFromMain(RGB8 *myPalette);
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 97a3b1754a3..b5207d71ca6 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -127,7 +127,7 @@ void Room903::daemon() {
break;
case 7:
- g_engine->showLoadScreen(true);
+ g_engine->showLoadScreen(M4Engine::kLoadFromMainMenu);
break;
case 8:
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 18a8bbfdf16..50e3a7cf382 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -151,7 +151,7 @@ void Hotkeys::saveGame(void *, void *) {
}
void Hotkeys::loadGame(void *, void *) {
- g_engine->showLoadScreen();
+ g_engine->showLoadScreen(M4Engine::kLoadFromHotkey);
}
void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e8d80b6c47e..cc8414b384e 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -149,7 +149,7 @@ void M4Engine::showSaveScreen() {
saveGameDialog();
}
-void M4Engine::showLoadScreen(bool fromMainMenu) {
+void M4Engine::showLoadScreen(LoadDialogSource source) {
loadGameDialog();
}
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 216fbe31449..43e7baf9c7b 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -167,10 +167,11 @@ public:
*/
virtual void showSaveScreen();
+ enum LoadDialogSource { kLoadFromMainMenu, kLoadFromGameDialog, kLoadFromHotkey };
/**
* Show restore game dialog
*/
- virtual void showLoadScreen(bool fromMainMenu = false);
+ virtual void showLoadScreen(LoadDialogSource fromMainMenu);
/**
* Show the engine information
More information about the Scummvm-git-logs
mailing list