[Scummvm-git-logs] scummvm master -> 6d94bfc154bc6e67b764b5a50681a44ece5f58b9

dreammaster noreply at scummvm.org
Fri Feb 14 04:13:58 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6d94bfc154 M4: RIDDLE: Beginnings of Options Menu


Commit: 6d94bfc154bc6e67b764b5a50681a44ece5f58b9
    https://github.com/scummvm/scummvm/commit/6d94bfc154bc6e67b764b5a50681a44ece5f58b9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-02-13T20:13:40-08:00

Commit Message:
M4: RIDDLE: Beginnings of Options Menu

Changed paths:
  A engines/m4/gui/gui_menu_items.cpp
  A engines/m4/gui/gui_menu_items.h
  R engines/m4/gui/gui_menu.cpp
  R engines/m4/gui/gui_menu.h
    engines/m4/adv_r/kernel.h
    engines/m4/burger/gui/game_menu.cpp
    engines/m4/burger/gui/game_menu.h
    engines/m4/module.mk
    engines/m4/riddle/gui/game_menu.cpp
    engines/m4/riddle/gui/game_menu.h
    engines/m4/vars.h


diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index c1bf5d37d60..92803f0a412 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -69,6 +69,7 @@ struct Kernel {
 	bool unused = false;
 
 	size_t mem_avail() const { return 7999999; }
+	bool cameraPans() const { return !camera_pan_instant; }
 };
 
 } // namespace M4
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 40cb8b82b00..095175035a7 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -404,6 +404,11 @@ void CreateGameMenuMain(RGB8 *myPalette) {
 
 //----------------------------------   OPTIONS MENU   -------------------------------------//
 
+#define OPTIONS_MENU_X		175
+#define OPTIONS_MENU_Y		100
+#define OPTIONS_MENU_W		298
+#define OPTIONS_MENU_H		218
+
 void DestroyOptionsMenu();
 
 
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 47f1c55cf31..0ac19b19479 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -26,7 +26,7 @@
 #include "graphics/surface.h"
 #include "m4/m4_types.h"
 #include "m4/graphics/gr_buff.h"
-#include "m4/gui/gui_menu.h"
+#include "m4/gui/gui_menu_items.h"
 #include "m4/gui/gui_univ.h"
 
 namespace M4 {
@@ -132,11 +132,6 @@ enum game_menu_button_tags {
  * Options menu defines
  */
 
-#define OPTIONS_MENU_X		175
-#define OPTIONS_MENU_Y		100
-#define OPTIONS_MENU_W		298
-#define OPTIONS_MENU_H		218
-
 enum option_menu_item_tags {
 	OM_TAG_DONE = 1,
 	OM_TAG_CANCEL,
diff --git a/engines/m4/gui/gui_menu.cpp b/engines/m4/gui/gui_menu_items.cpp
similarity index 99%
rename from engines/m4/gui/gui_menu.cpp
rename to engines/m4/gui/gui_menu_items.cpp
index c8df5004594..eeadd92cf8e 100644
--- a/engines/m4/gui/gui_menu.cpp
+++ b/engines/m4/gui/gui_menu_items.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "graphics/thumbnail.h"
-#include "m4/gui/gui_menu.h"
+#include "m4/gui/gui_menu_items.h"
 #include "m4/adv_r/other.h"
 #include "m4/adv_r/adv_background.h"
 #include "m4/adv_r/adv_control.h"
diff --git a/engines/m4/gui/gui_menu.h b/engines/m4/gui/gui_menu_items.h
similarity index 97%
rename from engines/m4/gui/gui_menu.h
rename to engines/m4/gui/gui_menu_items.h
index 89a24b61d70..5571374946f 100644
--- a/engines/m4/gui/gui_menu.h
+++ b/engines/m4/gui/gui_menu_items.h
@@ -20,8 +20,8 @@
  *
  */
 
-#ifndef M4_GUI_GUI_MENU_H
-#define M4_GUI_GUI_MENU_H
+#ifndef M4_GUI_GUI_MENU_ITEMS_H
+#define M4_GUI_GUI_MENU_ITEMS_H
 
 #include "graphics/surface.h"
 #include "m4/m4_types.h"
@@ -211,12 +211,18 @@ public:
 
 	enum button_types {
 		BTN_TYPE_GM_GENERIC,
-		BTN_TYPE_SL_SAVE,
-		BTN_TYPE_SL_LOAD,
-		BTN_TYPE_SL_CANCEL,
-		BTN_TYPE_SL_TEXT,
-		BTN_TYPE_OM_DONE,
-		BTN_TYPE_OM_CANCEL,
+
+		// Riddle
+		BTN_TYPE_OM_SCROLLING_ON = 1,
+		BTN_TYPE_OM_SCROLLING_OFF = 2,
+
+		// Burger
+		BTN_TYPE_SL_SAVE = 1,
+		BTN_TYPE_SL_LOAD = 2,
+		BTN_TYPE_SL_CANCEL = 3,
+		BTN_TYPE_SL_TEXT = 4,
+		BTN_TYPE_OM_DONE = 5,
+		BTN_TYPE_OM_CANCEL = 6,
 
 		BTN_TYPE_TOTAL_NUMBER
 	};
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 4da112ac4f6..1a2e482cd78 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -52,7 +52,7 @@ MODULE_OBJS = \
 	gui/gui_cheapo.o \
 	gui/gui_dialog.o \
 	gui/gui_item.o \
-	gui/gui_menu.o \
+	gui/gui_menu_items.o \
 	gui/gui_mouse.o \
 	gui/gui_sys.o \
 	gui/gui_vmng_core.o \
diff --git a/engines/m4/riddle/gui/game_menu.cpp b/engines/m4/riddle/gui/game_menu.cpp
index 847c4cf9f85..4a78068274e 100644
--- a/engines/m4/riddle/gui/game_menu.cpp
+++ b/engines/m4/riddle/gui/game_menu.cpp
@@ -96,9 +96,8 @@ void GameMenu::show(RGB8 *myPalette) {
 	CompactMem();
 
 	// Load in the game menu sprites
-	if (!guiMenu::loadSprites("gamemenu", GM_TOTAL_SPRITES)) {
-		return;
-	}
+	if (!guiMenu::loadSprites("gamemenu", GM_TOTAL_SPRITES))
+		error("Error loading gamemenu");
 
 	_GM(gameMenu) = guiMenu::create(_GM(menuSprites)[GM_DIALOG_BOX],
 		GAME_MENU_X, GAME_MENU_Y, MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
@@ -131,10 +130,9 @@ void GameMenu::show(RGB8 *myPalette) {
 	LockMouseSprite(0);
 }
 
-void GameMenu::DestroyGameMenu() {
-	if (!_GM(gameMenu)) {
+void GameMenu::destroyGameMenu() {
+	if (!_GM(gameMenu))
 		return;
-	}
 
 	// Remove the screen from the gui
 	vmng_screen_dispose(_GM(gameMenu));
@@ -148,7 +146,7 @@ void GameMenu::DestroyGameMenu() {
 
 void GameMenu::cbQuitGame(void *, void *) {
 	// Destroy the game menu
-	DestroyGameMenu();
+	destroyGameMenu();
 
 	// Shutdown the menu system
 	guiMenu::shutdown(false);
@@ -159,7 +157,7 @@ void GameMenu::cbQuitGame(void *, void *) {
 
 void GameMenu::cbMainMenu(void *, void *) {
 	// Destroy the game menu
-	DestroyGameMenu();
+	destroyGameMenu();
 
 	if (!_GM(gameMenuFromMain)) {
 		// Save the game so we can resume from here if possible
@@ -182,14 +180,20 @@ void GameMenu::cbMainMenu(void *, void *) {
 
 void GameMenu::cbResume(void *, void *) {
 	// Destroy the game menu
-	DestroyGameMenu();
+	destroyGameMenu();
 
 	// Shutdown the menu system
 	guiMenu::shutdown(true);
 }
 
 void GameMenu::cbOptions(void *, void *) {
-	// TODO
+	// Destroy the game menu
+	destroyGameMenu();
+
+	_GM(buttonClosesDialog) = true;
+
+	// Create the options menu
+	OptionsMenu::show();
 }
 
 void GameMenu::cbSave(void *, void *) {
@@ -200,6 +204,72 @@ void GameMenu::cbLoad(void *, void *) {
 	// TODO
 }
 
+/*-------------------- OPTIONS MENU --------------------*/
+
+#define OPTIONS_MENU_X 212
+#define OPTIONS_MENU_Y 160
+#define OPTIONS_MENU_SPRITE 0
+
+#define OM_TAG_GAMEMENU		1
+#define OM_GAMEMENU_X		14
+#define OM_GAMEMENU_Y		94
+#define OM_GAMEMENU_W		26
+#define OM_GAMEMENU_H		26
+
+#define OM_TAG_SCROLLING	4
+#define OM_SCROLLING_X		131
+#define OM_SCROLLING_Y		113
+#define OM_SCROLLING_W		39
+#define OM_SCROLLING_H		39
+
+void OptionsMenu::show() {
+	// Load in the options menu sprites
+	if (!guiMenu::loadSprites("opmenu", GM_TOTAL_SPRITES))
+		error("Error loading opmenu");
+
+	_GM(opMenu) = guiMenu::create(_GM(menuSprites)[OPTIONS_MENU_SPRITE],
+		OPTIONS_MENU_X, OPTIONS_MENU_Y, MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
+	if (!_GM(opMenu)) {
+		return;
+	}
+
+	menuItemButton::add(_GM(opMenu), OM_TAG_GAMEMENU,
+		OM_GAMEMENU_X, OM_GAMEMENU_Y, OM_GAMEMENU_W, OM_GAMEMENU_H,
+		cbGameMenu, menuItemButton::BTN_TYPE_GM_GENERIC);
+
+
+	menuItemButton::add(_GM(opMenu), OM_TAG_GAMEMENU,
+		OM_SCROLLING_X, OM_SCROLLING_Y, OM_SCROLLING_W, OM_SCROLLING_H, cbGameMenu,
+		_G(kernel).cameraPans() ? menuItemButton::BTN_TYPE_OM_SCROLLING_ON :
+			menuItemButton::BTN_TYPE_OM_SCROLLING_OFF);
+
+	guiMenu::configure(_GM(opMenu), cbGameMenu, cbGameMenu);
+	vmng_screen_show((void *)_GM(opMenu));
+	LockMouseSprite(0);
+}
+
+void OptionsMenu::destroyOptionsMenu() {
+	// Remove the screen from the gui
+	vmng_screen_dispose(_GM(opMenu));
+
+	// Destroy the menu resources
+	guiMenu::destroy(_GM(opMenu));
+
+	// Unload the menu sprites
+	guiMenu::unloadSprites();
+}
+
+void OptionsMenu::cbGameMenu(void *, void *) {
+	destroyOptionsMenu();
+
+	GameMenu::show(nullptr);
+}
+
+void OptionsMenu::cbScrolling(M4::GUI::menuItemButton *myItem, M4::GUI::guiMenu *) {
+	_G(kernel).camera_pan_instant = myItem->buttonType ==
+		menuItemButton::BTN_TYPE_OM_SCROLLING_ON;
+}
+
 /*-------------------- ACCESS METHODS --------------------*/
 
 void CreateGameMenu(RGB8 *myPalette) {
diff --git a/engines/m4/riddle/gui/game_menu.h b/engines/m4/riddle/gui/game_menu.h
index ef6a8c2faaf..83ec58c9a7e 100644
--- a/engines/m4/riddle/gui/game_menu.h
+++ b/engines/m4/riddle/gui/game_menu.h
@@ -23,7 +23,7 @@
 #ifndef M4_RIDDLE_GUI_GAME_MENU_H
 #define M4_RIDDLE_GUI_GAME_MENU_H
 
-#include "m4/m4_types.h"
+#include "m4/gui/gui_menu_items.h"
 
 namespace M4 {
 namespace Riddle {
@@ -31,7 +31,7 @@ namespace GUI {
 
 class GameMenu {
 private:
-	static void DestroyGameMenu();
+	static void destroyGameMenu();
 	static void cbQuitGame(void *, void *);
 	static void cbMainMenu(void *, void *);
 	static void cbResume(void *, void *);
@@ -43,6 +43,16 @@ public:
 	static void show(RGB8 *myPalette);
 };
 
+class OptionsMenu {
+private:
+	static void destroyOptionsMenu();
+	static void cbGameMenu(void *, void *);
+	static void cbScrolling(M4::GUI::menuItemButton *myItem, M4::GUI::guiMenu *);
+
+public:
+	static void show();
+};
+
 extern void CreateGameMenu(RGB8 *myPalette);
 
 } // namespace GUI
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 16d682969f2..c82370207c9 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -47,7 +47,7 @@
 #include "m4/graphics/rend.h"
 #include "m4/gui/gui_dialog.h"
 #include "m4/gui/gui_item.h"
-#include "m4/gui/gui_menu.h"
+#include "m4/gui/gui_menu_items.h"
 #include "m4/gui/gui_mouse.h"
 #include "m4/gui/gui_univ.h"
 #include "m4/gui/hotkeys.h"




More information about the Scummvm-git-logs mailing list