[Scummvm-git-logs] scummvm master -> 9e002020d96a66f793aa471530f1b692f626cf41

dreammaster noreply at scummvm.org
Sun May 31 22:59:05 UTC 2026


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

Summary:
663730f385 MADS: DRAGONSPHERE: pal_allocate difference fixed that was causing room 614 crash
9e002020d9 MADS: FOREST: Shifting Forest-specific extras/variables into Forest namespace


Commit: 663730f385187c766b455a7eead7de9c07be1788
    https://github.com/scummvm/scummvm/commit/663730f385187c766b455a7eead7de9c07be1788
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-06-01T08:58:55+10:00

Commit Message:
MADS: DRAGONSPHERE: pal_allocate difference fixed that was causing room 614 crash

Changed paths:
    engines/mads/madsv2/core/pal.cpp


diff --git a/engines/mads/madsv2/core/pal.cpp b/engines/mads/madsv2/core/pal.cpp
index 9d381650806..53d2ffb5596 100644
--- a/engines/mads/madsv2/core/pal.cpp
+++ b/engines/mads/madsv2/core/pal.cpp
@@ -19,6 +19,8 @@
  *
  */
 
+#include "common/debug.h"
+#include "mads/madsv2/engine.h"
 #include "mads/madsv2/core/pal.h"
 #include "mads/madsv2/core/mcga.h"
 #include "mads/madsv2/core/color.h"
@@ -424,7 +426,8 @@ int pal_allocate(ColorListPtr new_list, ShadowListPtr shadow_list, int pal_flags
 		// existing mapping.  The only reasons not to are  A) if we have
 		// found a (shadowing) match; and  B) if we are defining an initial
 		// background and therefore should not have any matches.
-		conduct_search = !found && !defining_background && cycle_mask != 0;
+		conduct_search = !found && !defining_background &&
+			(cycle_mask != 0 || g_engine->getGameID() == GType_Dragonsphere);
 
 		if (conduct_search) {
 			// Now, decide whether we need an exact match or are willing to just


Commit: 9e002020d96a66f793aa471530f1b692f626cf41
    https://github.com/scummvm/scummvm/commit/9e002020d96a66f793aa471530f1b692f626cf41
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-06-01T08:58:55+10:00

Commit Message:
MADS: FOREST: Shifting Forest-specific extras/variables into Forest namespace

Changed paths:
  A engines/mads/madsv2/forest/extra.cpp
  A engines/mads/madsv2/forest/extra.h
  R engines/mads/madsv2/core/extra.cpp
  R engines/mads/madsv2/core/extra.h
    engines/mads/madsv2/core/game.cpp
    engines/mads/madsv2/core/global.h
    engines/mads/madsv2/core/inter.cpp
    engines/mads/madsv2/core/midi.h
    engines/mads/madsv2/forest/forest.cpp
    engines/mads/madsv2/forest/global.cpp
    engines/mads/madsv2/forest/global.h
    engines/mads/madsv2/forest/journal.cpp
    engines/mads/madsv2/forest/journal.h
    engines/mads/madsv2/forest/rooms/room101.cpp
    engines/mads/madsv2/forest/rooms/room901.cpp
    engines/mads/madsv2/forest/rooms/room903.cpp
    engines/mads/madsv2/forest/rooms/room904.cpp
    engines/mads/module.mk


diff --git a/engines/mads/madsv2/core/game.cpp b/engines/mads/madsv2/core/game.cpp
index 234305d555c..d0d4fd24b75 100644
--- a/engines/mads/madsv2/core/game.cpp
+++ b/engines/mads/madsv2/core/game.cpp
@@ -63,9 +63,9 @@
 #include "mads/madsv2/core/camera.h"
 #include "mads/madsv2/core/quote.h"
 #include "mads/madsv2/core/text.h"
-#include "mads/madsv2/core/extra.h"
 #include "mads/madsv2/core/imath.h"
 #include "mads/madsv2/core/screen.h"
+#include "mads/madsv2/forest/extra.h"
 
 namespace MADS {
 namespace MADSV2 {
@@ -1678,55 +1678,10 @@ static void game_system_maintenance() {
 	}
 }
 
-
-void do_interface_for_ouaf() {
-	if (mouse_y > 156 &&
-		mouse_stop_stroke &&
-		player.commands_allowed &&
-		/* global[4] == -1 && */
-		!kernel.trigger &&
-		/* player.command_ready && */
-		inter_input_mode == INTER_LIMITED_SENTENCES &&
-		!global[2]  /* inventory_is_displayed */
-		/* pl conv_control.running < 0 */) {
-		if (room_id == 199) {  // Taranjeet's Journal
-
-			leave_journal();
-
-		} else if (mouse_x < 64) {
-			display_journal();
-		} else if (mouse_x < 139) {
-			display_inventory();
-		} else if (mouse_x < 195) {
-		} else if (mouse_x < 250) {
-			solve_me_selected();
-		} else {
-			door_selected();
-		}
-	}
-
-
-	if (kernel.trigger == 40) {
-		display_inventory();
-	}
-}
-
-
 /**
  * Calls, in proper order, all daemon code for this framing round.
  */
 static void game_daemon_code() {
-#if 0
-	global[4] = -1;  // turn off global[player_selected_object]
-
-	digi_read_another_chunk();
-
-	if (global[9]) midi_loop();  // please loop the damn music
-
-	if (section_id != 9) {
-		do_interface_for_ouaf();
-	}
-#endif
 	kernel.trigger_setup_mode = KERNEL_TRIGGER_DAEMON;
 
 	game_exec_function(room_daemon_code_pointer);
diff --git a/engines/mads/madsv2/core/global.h b/engines/mads/madsv2/core/global.h
index e36164e7258..340781bb014 100644
--- a/engines/mads/madsv2/core/global.h
+++ b/engines/mads/madsv2/core/global.h
@@ -63,42 +63,8 @@ constexpr int NO  = 0;
 
 /* ==================== System variables ===================== */
 
-#define walker_timing                   0   /* Stop walker timing (long) */
-#define walker_timing_2                 1
-#define inventory_is_displayed          2   /* T if inventory is being displayed */
-#define player_hyperwalked              3   /* T if player hit spacebar in room */
-#define player_selected_object          4   /* will be >= 0 (to hold selected object) else -1 */
-#define candle_is_on                    5   /* T if candle flame is on in interface */
-
-
-/* ================= Global to all sections ================== */
-
-#if 0
-#define player_score                    10  /* player's score of the game   */
-#define player_score_flags              11  /* 16 flags for checking if player increased score */
-#define dont_load_walker                12  /* if T, will not load walker in section code */
-#define perform_displacements           13  /* if T, will do displacements */
-#define intro                           14  /* if T, Intro is in progress */
-#define outro                           15  /* if T, Outro is in progress */
-#endif
-
-/* =================== Section 1  20 - 39 ==================== */
-
-#define section_1_variable              20  /* put description here */
-
-/* =================== Section 2  40 - 59 ==================== */
-
-
-/* =================== Section 3  60 - 79 ==================== */
-
-
-/* =================== Section 4  80 - 99 ==================== */
-
-
-/* ================== Section 5  100 - 119 =================== */
-
-
-/* ================== Section 6  120 - 139 =================== */
+constexpr int walker_timing                   = 0;   /* Stop walker timing (long) */
+constexpr int walker_timing_2                 = 1;
 
 
 extern char global_release_name[];
diff --git a/engines/mads/madsv2/core/inter.cpp b/engines/mads/madsv2/core/inter.cpp
index ec79119d379..d67ce4ecc7d 100644
--- a/engines/mads/madsv2/core/inter.cpp
+++ b/engines/mads/madsv2/core/inter.cpp
@@ -45,7 +45,7 @@
 #include "mads/madsv2/core/imath.h"
 #include "mads/madsv2/core/env.h"
 #include "mads/madsv2/core/error.h"
-#include "mads/madsv2/core/extra.h"
+#include "mads/madsv2/forest/extra.h"
 #include "mads/madsv2/engine.h"
 
 namespace MADS {
@@ -1850,7 +1850,8 @@ done:
 
 void inter_turn_off_object(void) {
 	if (inter_object_series >= 0) {
-		delete_sprite_in_interface(inter_object_series);
+		if (g_engine->getGameID() == GType_Forest)
+			Forest::delete_sprite_in_interface(inter_object_series);
 		matte_deallocate_series(inter_object_series, false);
 		inter_base_time = timer_read();
 		inter_object_series = -1;
@@ -1956,7 +1957,7 @@ void inter_spin_object(int object_id) {
 		SERIES_BONUS_OBJECT);
 
 	if (g_engine->getGameID() == GType_Forest) {
-		stamp_sprite_to_interface(OUAF_OBJECT_X, OUAF_OBJECT_Y, 1, inter_object_series);
+		Forest::stamp_sprite_to_interface(OUAF_OBJECT_X, OUAF_OBJECT_Y, 1, inter_object_series);
 		paul_object_showing = object_id;
 	}
 
diff --git a/engines/mads/madsv2/core/midi.h b/engines/mads/madsv2/core/midi.h
index be4b718d90b..52515cc9adc 100644
--- a/engines/mads/madsv2/core/midi.h
+++ b/engines/mads/madsv2/core/midi.h
@@ -29,6 +29,7 @@ namespace MADSV2 {
 
 extern void midi_play(const char *name);
 extern void midi_stop();
+inline void midi_loop() {}
 
 } // namespace MADSV2
 } // namespace MADS
diff --git a/engines/mads/madsv2/core/extra.cpp b/engines/mads/madsv2/forest/extra.cpp
similarity index 66%
rename from engines/mads/madsv2/core/extra.cpp
rename to engines/mads/madsv2/forest/extra.cpp
index 912d6299eba..e135a5355f2 100644
--- a/engines/mads/madsv2/core/extra.cpp
+++ b/engines/mads/madsv2/forest/extra.cpp
@@ -20,12 +20,19 @@
  */
 
 #include "common/textconsole.h"
+#include "mads/madsv2/core/global.h"
+#include "mads/madsv2/core/inter.h"
+#include "mads/madsv2/core/kernel.h"
 #include "mads/madsv2/core/matte.h"
-#include "mads/madsv2/core/extra.h"
+#include "mads/madsv2/core/mouse.h"
+#include "mads/madsv2/core/player.h"
+#include "mads/madsv2/forest/extra.h"
+#include "mads/madsv2/forest/global.h"
+#include "mads/madsv2/forest/journal.h"
 
 namespace MADS {
 namespace MADSV2 {
-
+namespace Forest {
 
 void fly_on_screen(int flying_object) {
 	error("TODO: fly_on_screen");
@@ -39,14 +46,6 @@ void display_inventory(void) {
 	error("TODO: display_inventory");
 }
 
-void display_journal(void) {
-	error("TODO: display_journal");
-}
-
-void leave_journal(void) {
-	error("TODO: leave_journal");
-}
-
 void solve_me_selected(void) {
 	error("TODO: solve_me_selected");
 }
@@ -79,6 +78,37 @@ void extra_blank_knothole(void) {
 	error("TODO: extra_blank_knothole");
 }
 
+void do_interface_for_ouaf() {
+	if (mouse_y > 156 &&
+		mouse_stop_stroke &&
+		player.commands_allowed &&
+		/* global[4] == -1 && */
+		!kernel.trigger &&
+		/* player.command_ready && */
+		inter_input_mode == INTER_LIMITED_SENTENCES &&
+		!global[inventory_is_displayed]
+		/* pl conv_control.running < 0 */) {
+		if (room_id == 199) {
+			// Taranjeet's Journal
+			leave_journal();
+
+		} else if (mouse_x < 64) {
+			display_journal();
+		} else if (mouse_x < 139) {
+			display_inventory();
+		} else if (mouse_x < 195) {
+		} else if (mouse_x < 250) {
+			solve_me_selected();
+		} else {
+			door_selected();
+		}
+	}
+
+	if (kernel.trigger == 40) {
+		display_inventory();
+	}
+}
 
+} // namespace Forest
 } // namespace MADSV2
 } // namespace MADS
diff --git a/engines/mads/madsv2/core/extra.h b/engines/mads/madsv2/forest/extra.h
similarity index 97%
rename from engines/mads/madsv2/core/extra.h
rename to engines/mads/madsv2/forest/extra.h
index 9730ab99a0e..e4cac25e94f 100644
--- a/engines/mads/madsv2/core/extra.h
+++ b/engines/mads/madsv2/forest/extra.h
@@ -26,7 +26,7 @@
 
 namespace MADS {
 namespace MADSV2 {
-
+namespace Forest {
 
 #define JOURNAL_FLY            1 
 #define BP_FLY                 2
@@ -49,11 +49,11 @@ extern void fly_on_screen(int flying_object);
 extern void fly_off_screen(int flying_object);
 
 extern void display_inventory(void);
-extern void display_journal(void);
-extern void leave_journal(void);
 extern void solve_me_selected(void);
 extern void door_selected(void);
 
+extern void do_interface_for_ouaf();
+
 extern void extra_spinning_object(void);
 extern void extra_inven_preserve_palette(void);
 extern void stamp_sprite_to_interface(int x, int y, int sprite, int series);
@@ -62,6 +62,7 @@ extern void extra_change_animation(int handle, int x, int y, byte scale, byte de
 extern void extra_shift_animation(int handle, int x, int y, byte scale);
 extern void extra_blank_knothole(void);
 
+} // namespace Forest
 } // namespace MADSV2
 } // namespace MADS
 
diff --git a/engines/mads/madsv2/forest/forest.cpp b/engines/mads/madsv2/forest/forest.cpp
index 4f2a10e778c..922dc568c3b 100644
--- a/engines/mads/madsv2/forest/forest.cpp
+++ b/engines/mads/madsv2/forest/forest.cpp
@@ -110,6 +110,7 @@ void ForestEngine::syncRoom(Common::Serializer &s) {
 }
 
 void ForestEngine::global_daemon_code() {
+	Forest::global_daemon_code();
 }
 
 void ForestEngine::global_pre_parser_code() {
diff --git a/engines/mads/madsv2/forest/global.cpp b/engines/mads/madsv2/forest/global.cpp
index 6e78c3e7b58..449173192f0 100644
--- a/engines/mads/madsv2/forest/global.cpp
+++ b/engines/mads/madsv2/forest/global.cpp
@@ -20,10 +20,13 @@
  */
 
 #include "common/textconsole.h"
-#include "mads/madsv2/forest/global.h"
+#include "mads/madsv2/core/digi.h"
+#include "mads/madsv2/core/error.h"
 #include "mads/madsv2/core/game.h"
 #include "mads/madsv2/core/kernel.h"
-#include "mads/madsv2/core/error.h"
+#include "mads/madsv2/core/midi.h"
+#include "mads/madsv2/forest/global.h"
+#include "mads/madsv2/forest/extra.h"
 
 namespace MADS {
 namespace MADSV2 {
@@ -169,6 +172,18 @@ void global_digi_play(int num) {
 	warning("TODO: global_digi_play");
 }
 
+void global_daemon_code() {
+	global[player_selected_object] = -1;
+
+	digi_read_another_chunk();
+
+	if (global[9]) midi_loop();  // please loop the damn music
+
+	if (section_id != 9) {
+		do_interface_for_ouaf();
+	}
+}
+
 } // namespace Forest
 } // namespace MADSV2
 } // namespace MADS
diff --git a/engines/mads/madsv2/forest/global.h b/engines/mads/madsv2/forest/global.h
index 13833c02b30..52f035909e7 100644
--- a/engines/mads/madsv2/forest/global.h
+++ b/engines/mads/madsv2/forest/global.h
@@ -29,22 +29,23 @@ namespace MADS {
 namespace MADSV2 {
 namespace Forest {
 
-enum {
-	kWalkerTiming2            =   1,
-	stop_walker_disabled      =   2,
-	temp_interface            =   3,
-	walker_converse           =   4,
+enum {	
+	walker_timing             =   0,   /* Stop walker timing (long) */
+	walker_timing_2           =   1,
+	inventory_is_displayed    =   2,   /* T if inventory is being displayed */
+	g003                      =   3,
+	player_selected_object    =   4,
 	walker_converse_state     =   5,
 	walker_converse_now       =   6,
-	_007                      =   7,
+	g007                      =   7,
 	g008                      =   8,
 	g009                      =   9,
-	g010                      =  10,
-	g011                      =  11,
-	g012                      =  12,
-	g013                      =  13,
-	g014                      =  14,
-	g015                      =  15,
+	player_score              =  10,  /* player's score of the game   */
+	player_score_flags        =  11,  /* 16 flags for checking if player increased score */
+	dont_load_walker          =  12,  /* if T, will not load walker in section code */
+	perform_displacements     =  13,  /* if T, will do displacements */
+	intro                     =  14,  /* if T, Intro is in progress */
+	outro                     =  15,  /* if T, Outro is in progress */
 	g016                      =  16,
 	g017                      =  17,
 	g018                      =  18,
@@ -242,12 +243,13 @@ enum {
 	g210                      = 210
 };
 
+extern int16 flags[40];
+
 extern void global_section_constructor();
 extern void sync_room(Common::Serializer &s);
 
 extern void global_digi_play(int num);
-
-extern int16 flags[40];
+extern void global_daemon_code();
 
 } // namespace Forest
 } // namespace MADSV2
diff --git a/engines/mads/madsv2/forest/journal.cpp b/engines/mads/madsv2/forest/journal.cpp
index 3526a5933fc..b86344bbc25 100644
--- a/engines/mads/madsv2/forest/journal.cpp
+++ b/engines/mads/madsv2/forest/journal.cpp
@@ -25,6 +25,18 @@ namespace MADS {
 namespace MADSV2 {
 namespace Forest {
 
+void display_journal() {
+	// TODO
+}
+
+void leave_journal() {
+	// TODO
+}
+
+void open_journal() {
+	// TODO
+}
+
 void close_journal() {
 	// TODO
 }
diff --git a/engines/mads/madsv2/forest/journal.h b/engines/mads/madsv2/forest/journal.h
index e4b4fd6647f..1e2f97fb3ed 100644
--- a/engines/mads/madsv2/forest/journal.h
+++ b/engines/mads/madsv2/forest/journal.h
@@ -28,6 +28,9 @@ namespace MADS {
 namespace MADSV2 {
 namespace Forest {
 
+extern void display_journal();
+extern void leave_journal();
+extern void open_journal();
 extern void close_journal();
 
 } // namespace Forest
diff --git a/engines/mads/madsv2/forest/rooms/room101.cpp b/engines/mads/madsv2/forest/rooms/room101.cpp
index d6182709f47..b1c5c7e0b9b 100644
--- a/engines/mads/madsv2/forest/rooms/room101.cpp
+++ b/engines/mads/madsv2/forest/rooms/room101.cpp
@@ -88,7 +88,7 @@ static Scratch scratch;
 static void room_101_init1() {
 	global[g009] = -1;
 	viewing_at_y = 22;
-	global[g010] = 0;
+	global[player_score] = 0;
 	player.walker_visible = false;
 	player.commands_allowed = false;
 	mouse_hide();
@@ -107,7 +107,7 @@ static void room_101_init1() {
 
 static void room_101_init2() {
 	player.commands_allowed = false;
-	global[g010] = 0;
+	global[player_score] = 0;
 
 	ss[3] = kernel_load_series(kernel_name('p', 7), 0);
 	seq[3] = kernel_seq_stamp(ss[3], 0, -1);
@@ -140,7 +140,7 @@ static void room_101_init2() {
 
 static void room_101_init3() {
 	player.commands_allowed = 0;
-	global[g010] = 0;
+	global[player_score] = 0;
 	global[g009] = 0;
 	midi_stop();
 	global[g131] = 0;
@@ -308,7 +308,7 @@ static void room_101_parser() {
 		goto handled;
 	}
 
-	if (global[walker_converse] >= 0) {
+	if (global[player_selected_object] >= 0) {
 		goto handled;
 	}
 
diff --git a/engines/mads/madsv2/forest/rooms/room901.cpp b/engines/mads/madsv2/forest/rooms/room901.cpp
index 0a3a52d6128..857d70d737a 100644
--- a/engines/mads/madsv2/forest/rooms/room901.cpp
+++ b/engines/mads/madsv2/forest/rooms/room901.cpp
@@ -40,7 +40,7 @@ namespace Rooms {
 
 static void room_901_init() {
 	global[g009] = 0;
-	global[g010] = 0;
+	global[player_score] = 0;
 	player.walker_visible = false;
 	viewing_at_y = 22;
 	mouse_hide();
diff --git a/engines/mads/madsv2/forest/rooms/room903.cpp b/engines/mads/madsv2/forest/rooms/room903.cpp
index 34444129e99..a080b8ecef5 100644
--- a/engines/mads/madsv2/forest/rooms/room903.cpp
+++ b/engines/mads/madsv2/forest/rooms/room903.cpp
@@ -50,7 +50,7 @@ namespace Rooms {
 static void room_903_init() {
 	mouse_hide();
 	global[g009] = false;
-	global[g010] = false;
+	global[player_score] = false;
 	viewing_at_y = 22;
 	kernel_timing_trigger(20, TRIGGER1);
 	kernel_run_animation("*rm903i", TRIGGER0);
diff --git a/engines/mads/madsv2/forest/rooms/room904.cpp b/engines/mads/madsv2/forest/rooms/room904.cpp
index 11d6e17e8c5..f926ac2abe5 100644
--- a/engines/mads/madsv2/forest/rooms/room904.cpp
+++ b/engines/mads/madsv2/forest/rooms/room904.cpp
@@ -48,7 +48,7 @@ namespace Rooms {
 static void room_904_init() {
 	mouse_hide();
 	global[g009] = false;
-	global[g010] = false;
+	global[player_score] = false;
 	viewing_at_y = 22;
 	kernel_timing_trigger(20, TRIGGER1);
 	kernel_run_animation("*rm903i", TRIGGER0);
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 774f3abfdd3..42123ec7955 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -76,7 +76,6 @@ MODULE_OBJS += \
 	madsv2/core/ems.o \
 	madsv2/core/env.o \
 	madsv2/core/error.o \
-	madsv2/core/extra.o \
 	madsv2/core/fileio.o \
 	madsv2/core/font.o \
 	madsv2/core/game.o \
@@ -265,6 +264,7 @@ MODULE_OBJS += \
 	madsv2/dragonsphere/sound_dragonsphere.o \
 	madsv2/forest/forest.o \
 	madsv2/forest/asound.o \
+	madsv2/forest/extra.o \
 	madsv2/forest/global.o \
 	madsv2/forest/journal.o \
 	madsv2/forest/main.o \




More information about the Scummvm-git-logs mailing list