[Scummvm-git-logs] scummvm master -> d3e36245a5a2fba0a34dca6a3b9891832275d1d7

dreammaster noreply at scummvm.org
Tue Mar 3 07:54:19 UTC 2026


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

Summary:
d3e36245a5 BAGEL: METAGAME: Add debug messages for random seed and mouse clicks


Commit: d3e36245a5a2fba0a34dca6a3b9891832275d1d7
    https://github.com/scummvm/scummvm/commit/d3e36245a5a2fba0a34dca6a3b9891832275d1d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-03-03T18:54:11+11:00

Commit Message:
BAGEL: METAGAME: Add debug messages for random seed and mouse clicks

Changed paths:
    engines/bagel/bagel.cpp
    engines/bagel/bagel.h
    engines/bagel/detection.cpp
    engines/bagel/detection.h
    engines/bagel/hodjnpodj/hodjnpodj.cpp
    engines/bagel/hodjnpodj/metagame/gtl/gtlview.cpp


diff --git a/engines/bagel/bagel.cpp b/engines/bagel/bagel.cpp
index 94adc4affce..0e86601541f 100644
--- a/engines/bagel/bagel.cpp
+++ b/engines/bagel/bagel.cpp
@@ -72,4 +72,10 @@ void BagelEngine::enableKeymapper(bool enabled) {
 	getEventManager()->getKeymapper()->setEnabled(enabled);
 }
 
+uint32 BagelEngine::getRandomNumber(uint maxNum) {
+	uint32 result = _randomSource.getRandomNumber(maxNum);
+	debugC(9, kDebugRandom, "getRandomNumber(%d) = %d", maxNum, result);
+	return result;
+}
+
 } // End of namespace Bagel
diff --git a/engines/bagel/bagel.h b/engines/bagel/bagel.h
index 1ba4cf2976f..e04b34763d0 100644
--- a/engines/bagel/bagel.h
+++ b/engines/bagel/bagel.h
@@ -35,6 +35,8 @@ struct BagelGameDescription;
 class BagelEngine : public Engine {
 private:
 	const ADGameDescription *_gameDescription;
+
+protected:
 	Common::RandomSource _randomSource;
 
 public:
@@ -77,9 +79,7 @@ public:
 	/**
 	 * Gets a random number
 	 */
-	uint32 getRandomNumber(uint maxNum = 0x7fffffff) {
-		return _randomSource.getRandomNumber(maxNum);
-	}
+	uint32 getRandomNumber(uint maxNum = 0x7fffffff);
 
 	bool hasFeature(EngineFeature f) const override {
 		return
diff --git a/engines/bagel/detection.cpp b/engines/bagel/detection.cpp
index db5da80a7b5..de90d9597bc 100644
--- a/engines/bagel/detection.cpp
+++ b/engines/bagel/detection.cpp
@@ -22,6 +22,11 @@
 #include "bagel/detection.h"
 #include "bagel/detection_tables.h"
 
+const DebugChannelDef BagelMetaEngineDetection::debugFlagList[] = {
+	{ Bagel::kDebugRandom, "Random", "Random number generation debug level" },
+	DEBUG_CHANNEL_END
+};
+
 BagelMetaEngineDetection::BagelMetaEngineDetection() : AdvancedMetaEngineDetection(Bagel::gameDescriptions, Bagel::bagelGames) {
 	_guiOptions = GUIO2(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVELOAD);
 	_flags = kADFlagMatchFullPaths;
diff --git a/engines/bagel/detection.h b/engines/bagel/detection.h
index a46e4c0f759..3235741a775 100644
--- a/engines/bagel/detection.h
+++ b/engines/bagel/detection.h
@@ -26,6 +26,10 @@
 
 namespace Bagel {
 
+enum BagelDebugChannels {
+	kDebugRandom = 1
+};
+
 extern const PlainGameDescriptor bagelGames[];
 
 extern const ADGameDescription gameDescriptions[];
@@ -35,6 +39,7 @@ extern const ADGameDescription gameDescriptions[];
 } // End of namespace Bagel
 
 class BagelMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
+	static const DebugChannelDef debugFlagList[];
 
 public:
 	BagelMetaEngineDetection();
@@ -51,6 +56,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Copyright(C) 1996 Boffo Games, Inc.";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 #endif // BAGEL_DETECTION_H
diff --git a/engines/bagel/hodjnpodj/hodjnpodj.cpp b/engines/bagel/hodjnpodj/hodjnpodj.cpp
index b74c0458edd..5a27f3f0595 100644
--- a/engines/bagel/hodjnpodj/hodjnpodj.cpp
+++ b/engines/bagel/hodjnpodj/hodjnpodj.cpp
@@ -59,6 +59,11 @@ Common::Error HodjNPodjEngine::run() {
 
 	_midi = new MusicPlayer();
 
+	// Set random seed
+	if (ConfMan.hasKey("randomseed"))
+		_randomSource.setSeed(ConfMan.getInt("randomseed"));
+	debug(1, "Starting random seed: %d", _randomSource.getSeed());
+
 	// Run the game
 	BagelMetaEngine::setKeybindingMode(KBMODE_NORMAL);
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtlview.cpp b/engines/bagel/hodjnpodj/metagame/gtl/gtlview.cpp
index b4411f49c29..b886cf1408c 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtlview.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtlview.cpp
@@ -26,6 +26,7 @@
 #include "bagel/hodjnpodj/metagame/gtl/gtlview.h"
 #include "bagel/hodjnpodj/metagame/gtl/gtlfrm.h"
 #include "bagel/hodjnpodj/hnplibs/rules.h"
+#include "bagel/detection.h"
 
 namespace Bagel {
 namespace HodjNPodj {
@@ -412,6 +413,7 @@ void CGtlView::OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int
 void CGtlView::OnLButtonDown(unsigned int nFlags, CPoint cMousePoint) {
 	CGtlDoc* xpDoc = GetDocument() ;
 
+	debugC(2, kDebugRandom, "Mouse click (%d, %d)", cMousePoint.x, cMousePoint.y);
 	xpDoc->m_xpGtlData->AcceptClick(this, cMousePoint, CLICK_LDOWN) ;
 
 	if (bExitMetaDLL)




More information about the Scummvm-git-logs mailing list