[Scummvm-git-logs] scummvm master -> 49304f84d63576353ac51e5a628fb200d2084d7b

OMGPizzaGuy noreply at scummvm.org
Sun Jan 1 18:01:19 UTC 2023


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

Summary:
6bc55232fc ULTIMA8: Add debug channel for collision
72297f8ec6 ULTIMA8: Replace remaining uses of pout with debug
49304f84d6 ULTIMA8: Remove pout and ConsoleStream from debugger


Commit: 6bc55232fcd3bf8e987d8602961d11692310d967
    https://github.com/scummvm/scummvm/commit/6bc55232fcd3bf8e987d8602961d11692310d967
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-01T12:00:59-06:00

Commit Message:
ULTIMA8: Add debug channel for collision

Changed paths:
    engines/ultima/detection.cpp
    engines/ultima/ultima.h
    engines/ultima/ultima8/world/current_map.cpp
    engines/ultima/ultima8/world/item.cpp
    engines/ultima/ultima8/world/missile_tracker.cpp


diff --git a/engines/ultima/detection.cpp b/engines/ultima/detection.cpp
index 164bef79465..544ff8f8d52 100644
--- a/engines/ultima/detection.cpp
+++ b/engines/ultima/detection.cpp
@@ -56,6 +56,7 @@ const DebugChannelDef UltimaMetaEngineDetection::debugFlagList[] = {
 	{Ultima::kDebugVideo, "Video", "Video playback debug level"},
 	{Ultima::kDebugActor, "Actor", "Actor debug level"},
 	{Ultima::kDebugObject, "Object", "Object debug level"},
+	{Ultima::kDebugCollision, "Collision", "Collision debug level"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/ultima/ultima.h b/engines/ultima/ultima.h
index c40175497b8..1222a9ffe10 100644
--- a/engines/ultima/ultima.h
+++ b/engines/ultima/ultima.h
@@ -29,7 +29,8 @@ enum UltimaDebugChannels {
 	kDebugGraphics = 1 << 1,
 	kDebugVideo = 1 << 2,
 	kDebugActor = 1 << 3,
-	kDebugObject = 1 << 4
+	kDebugObject = 1 << 4,
+	kDebugCollision = 1 << 5
 };
 
 } // End of namespace Ultima
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 9da8b305886..155b5751ec6 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima.h"
 #include "ultima/ultima8/misc/pent_include.h"
 #include "ultima/ultima8/world/current_map.h"
 #include "ultima/ultima8/world/map.h"
@@ -798,10 +799,9 @@ bool CurrentMap::isValidPosition(int32 x, int32 y, int32 z,
 
 #if 0
 				if (item->getShape() == 145) {
-					pout << "Shape 145: (" << ix - ixd << "," << iy - iyd << ","
-					     << iz << ")-(" << ix << "," << iy << "," << iz + izd
-					     << ")" << Std::endl;
-					if (!si->is_solid()) pout << "not solid" << Std::endl;
+					debugC(kDebugObject, "Shape 145: (%d, %d, %d)-(%d, %d, %d) %s",
+						ix - ixd, iy - iyd, iz, ix, iy, iz + izd,
+						si->is_solid() ? "solid" : "not solid");
 				}
 #endif
 
@@ -817,7 +817,7 @@ bool CurrentMap::isValidPosition(int32 x, int32 y, int32 z,
 				         startz + zd <= iz || startz >= iz + izd)) {
 					// overlapping an item. Invalid position
 #if 0
-					pout << item->dumpInfo() << Std::endl;
+					debugC(kDebugObject, "%s", item->dumpInfo().c_str());
 #endif
 					if (blocker == nullptr) {
 						blocker = item;
@@ -969,11 +969,11 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
 	bool foundunsupported = false;
 
 #if 0
-	pout.Print("valid | support\n");
+	debugC(kDebugCollision, "valid | support")
 	for (unsigned int i = 0; i < SCANSIZE * 2 + 1; ++i) {
-		pout.Print("%05x | %05x\n", validmask[SCANSIZE * 2 - i], supportmask[SCANSIZE * 2 - i]);
+		debugC(kDebugCollision, "%05x | %05x", validmask[SCANSIZE * 2 - i], supportmask[SCANSIZE * 2 - i]);
 	}
-	pout.Print("-----------\n");
+	debugC(kDebugCollision, ("-----------");
 #endif
 
 	//
@@ -1070,10 +1070,11 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 	// Z is opposite direction to x and y..
 	centre[2] = start[2] + ext[2];
 
-//	pout << "Sweeping from (" << -ext[0] << ", " << -ext[1] << ", " << -ext[2] << ")" << Std::endl;
-//	pout << "              (" << ext[0] << ", " << ext[1] << ", " << ext[2] << ")" << Std::endl;
-//	pout << "Sweeping to   (" << vel[0]-ext[0] << ", " << vel[1]-ext[1] << ", " << vel[2]-ext[2] << ")" << Std::endl;
-//	pout << "              (" << vel[0]+ext[0] << ", " << vel[1]+ext[1] << ", " << vel[2]+ext[2] << ")" << Std::endl;
+	debugC(kDebugCollision, "Sweeping from (%d, %d, %d) - (%d, %d, %d) to (%d, %d, %d) - (%d, %d, %d)",
+		   -ext[0], -ext[1], -ext[2],
+		   ext[0], ext[1], ext[2],
+		   vel[0] - ext[0], vel[1] - ext[1], vel[2] - ext[2],
+		   vel[0] + ext[0], vel[1] + ext[1], vel[2] + ext[2]);
 
 	Std::list<SweepItem>::iterator sw_it;
 	if (hit) sw_it = hit->end();
@@ -1214,8 +1215,6 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 				//the first time of overlap occurred
 				//before the last time of overlap
 				if (first <= last) {
-					//pout << "Hit item " << other_item->getObjId() << " at first: " << first << "  last: " << last << Std::endl;
-
 					if (!hit)
 						return true;
 
@@ -1239,11 +1238,12 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 
 					// Now add it
 					sw_it = hit->insert(sw_it, SweepItem(other_item->getObjId(), first, last, touch, touch_floor, blocking, dirs));
-//					pout << "Hit item " << other_item->getObjId() << " at (" << first << "," << last << ")" << Std::endl;
-//					pout << "hit item      (" << other[0] << ", " << other[1] << ", " << other[2] << ")" << Std::endl;
-//					pout << "hit item time (" << u_0[0] << "-" << u_1[0] << ") (" << u_0[1] << "-" << u_1[1] << ") ("
-//						 << u_0[2] << "-" << u_1[2] << ")" << Std::endl;
-//					pout << "touch: " << touch << ", floor: " << touch_floor << ", block: " << blocking << Std::endl;
+
+					//debugC(kDebugCollision, "Hit item %u (%d, %d, %d) at first: %d, last: %d",
+					//	   other_item->getObjId(), other[0], other[1], other[2], first, last);
+					//debugC(kDebugCollision, "hit item time (%d-%d) (%d-%d) (%d-%d)",
+					//	u_0[0], u_1[0], u_0[1], u_1[1], u_0[2], u_1[2]);
+					//debugC(kDebugCollision, "touch: %d, floor: %d, block: %d", touch, touch_floor, blocking);
 				}
 			}
 		}
@@ -1390,9 +1390,9 @@ uint32 CurrentMap::I_canExistAtPoint(const uint8 *args, unsigned int /*argsize*/
 	ARG_WORLDPOINT(pt);
 
 	if (other) {
-		debug("I_canExistAtPoint other object: %s", other->dumpInfo().c_str());
+		debugC(kDebugObject, "I_canExistAtPoint other object: %s", other->dumpInfo().c_str());
 	} else {
-		debug("I_canExistAtPoint other object null.");
+		debugC(kDebugObject, "I_canExistAtPoint other object null.");
 	}
 	if (shape > 0x800)
 		return 0;
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index d33615b6a9c..50ceac23697 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1133,15 +1133,12 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 			if (hit < 0) hit = 0;
 
 			if (hit != 0x4000) {
-#if 0
-				pout << " Hit time: " << hit << Std::endl;
-				pout << "    Start: " << start[0] << ", " << start[1] << ", " << start[2] << Std::endl;
-				pout << "      End: " << end[0] << ", " << end[1] << ", " << end[2] << Std::endl;
-#endif
+				debugC(kDebugCollision, "Hit time: %d; Start: %d, %d, %d; End: %d, %d, %d",
+					hit, start[0], start[1], start[2], end[0], end[1], end[2]);
+
 				it->GetInterpolatedCoords(end, start, end);
-#if 0
-				pout << "Collision: " << end[0] << ", " << end[1] << ", " << end[2] << Std::endl;
-#endif
+
+				debugC(kDebugCollision, "Collision: %d, %d, %d", end[0], end[1], end[2]);
 			}
 		}
 
diff --git a/engines/ultima/ultima8/world/missile_tracker.cpp b/engines/ultima/ultima8/world/missile_tracker.cpp
index 4894e7cf879..3c2f8913cb9 100644
--- a/engines/ultima/ultima8/world/missile_tracker.cpp
+++ b/engines/ultima/ultima8/world/missile_tracker.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima.h"
 #include "ultima/ultima8/misc/pent_include.h"
 
 #include "ultima/ultima8/world/missile_tracker.h"
@@ -100,11 +101,9 @@ void MissileTracker::init(int32 x, int32 y, int32 z, int32 speed) {
 		_speedX = ((_destX - x) + (_frames / 2)) / _frames;
 		_speedY = ((_destY - y) + (_frames / 2)) / _frames;
 
-#if 0
-		pout.printf("MissileTracker: from (%d,%d,%d) to (%d,%d,%d)\n", x, y, z, _destX, _destY, _destZ);
-		pout.printf("speed: %d, _gravity: %d, _frames: %d\n", speed, _gravity, _frames);
-		pout.printf("resulting speed: (%d,%d,%d)\n", _speedX, _speedY, _speedZ);
-#endif
+		debugC(kDebugCollision, "MissileTracker: from (%d,%d,%d) to (%d,%d,%d)", x, y, z, _destX, _destY, _destZ);
+		debugC(kDebugCollision, "speed: %d, _gravity: %d, _frames: %d", speed, _gravity, _frames);
+		debugC(kDebugCollision, "resulting speed: (%d,%d,%d)", _speedX, _speedY, _speedZ);
 	} else {
 
 		// no significant horizontal movement


Commit: 72297f8ec6137b5d0f3c241536a724ab0f0769c5
    https://github.com/scummvm/scummvm/commit/72297f8ec6137b5d0f3c241536a724ab0f0769c5
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-01T12:00:59-06:00

Commit Message:
ULTIMA8: Replace remaining uses of pout with debug

Changed paths:
    engines/ultima/ultima8/audio/audio_process.cpp
    engines/ultima/ultima8/audio/speech_flex.cpp
    engines/ultima/ultima8/games/cru_game.cpp
    engines/ultima/ultima8/games/game_data.cpp
    engines/ultima/ultima8/games/u8_game.cpp
    engines/ultima/ultima8/gumps/credits_gump.cpp
    engines/ultima/ultima8/kernel/kernel.cpp
    engines/ultima/ultima8/kernel/object_manager.cpp
    engines/ultima/ultima8/misc/id_man.cpp
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/world/camera_process.cpp
    engines/ultima/ultima8/world/world.cpp


diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index 81c0e1c9294..e4085074e14 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -259,7 +259,7 @@ void AudioProcess::playSFX(int sfxNum, int priority, ObjId objId, int loops,
 				// Exactly the same (and playing) so just return
 				//if (it->priority == priority)
 				if (mixer->isPlaying(it->_channel)) {
-					pout << "Sound " << sfxNum << " already playing on obj " << objId << Std::endl;
+					debug(MM_INFO, "Sound %d already playing on obj %u", sfxNum, objId);
 					return;
 				} else {
 					it = _sampleInfo.erase(it);
@@ -374,7 +374,7 @@ bool AudioProcess::playSpeech(const Std::string &barked, int shapeNum, ObjId obj
 		        it->_priority == shapeNum && it->_objId == objId) {
 
 			if (mixer->isPlaying(it->_channel)) {
-				pout << "Speech already playing" << Std::endl;
+				debug(MM_INFO, "Speech already playing");
 				return true;
 			} else {
 				it = _sampleInfo.erase(it);
diff --git a/engines/ultima/ultima8/audio/speech_flex.cpp b/engines/ultima/ultima8/audio/speech_flex.cpp
index 3fd80a4042b..c3d9fe1a64a 100644
--- a/engines/ultima/ultima8/audio/speech_flex.cpp
+++ b/engines/ultima/ultima8/audio/speech_flex.cpp
@@ -46,7 +46,7 @@ SpeechFlex::SpeechFlex(Common::SeekableReadStream *rs) : SoundFlex(rs) {
 		TabsToSpaces(str, 1);
 		TrimSpaces(str);
 
-		// pout << "Found string: \"" << str << "\"" << Std::endl;
+		//debug(MM_INFO, "Found string: \"%s\"", str.c_str());
 
 		_phrases.push_back(str);
 	}
@@ -72,11 +72,11 @@ int SpeechFlex::getIndexForPhrase(const Std::string &phrase,
 	Std::string::size_type pos2 = text.findLastNotOf(' ');
 	text = text.substr(pos1, pos2 - pos1 + 1);
 
-//	pout << "Looking for string: \"" << text << "\"" << Std::endl;
+	//debug(MM_INFO, "Looking for string: \"%s\"", text.c_str());
 
 	for (it = _phrases.begin(); it != _phrases.end(); ++it) {
 		if (text.find(it->c_str()) == 0) {
-//			pout << "Found: " << i << Std::endl;
+			//debug(MM_INFO, "Found: %d", i);
 			end = (*it).size() + start + pos1;
 			if (end >= start + pos2)
 				end = phrase.size();
@@ -85,7 +85,7 @@ int SpeechFlex::getIndexForPhrase(const Std::string &phrase,
 		i++;
 	}
 
-//	pout << "Not found" << Std::endl;
+	//debug(MM_INFO, "Not found");
 
 	return 0;
 }
diff --git a/engines/ultima/ultima8/games/cru_game.cpp b/engines/ultima/ultima8/games/cru_game.cpp
index dd88f49060c..6f31479bdd2 100644
--- a/engines/ultima/ultima8/games/cru_game.cpp
+++ b/engines/ultima/ultima8/games/cru_game.cpp
@@ -71,7 +71,7 @@ static bool loadPalette(const char *path, PaletteManager::PalIndex index) {
 
 bool CruGame::loadFiles() {
 	// Load palette
-	pout << "Load Palettes" << Std::endl;
+	debug(MM_INFO, "Load Palettes");
 
 	if (!loadPalette("static/gamepal.pal", PaletteManager::Pal_Game))
 		return false;
@@ -87,7 +87,7 @@ bool CruGame::loadFiles() {
 	// We don't use his one at the moment, ok to fail.
 	loadPalette("static/star.pal", PaletteManager::Pal_Star);
 
-	pout << "Load GameData" << Std::endl;
+	debug(MM_INFO, "Load GameData");
 	GameData::get_instance()->loadRemorseData();
 
 	return true;
@@ -95,8 +95,7 @@ bool CruGame::loadFiles() {
 
 bool CruGame::startGame() {
 	// NOTE: assumes the entire engine has been reset!
-
-	pout << "Starting new Crusader: No Remorse game." << Std::endl;
+	debug(MM_INFO, "Starting new Crusader: No Remorse game.");
 
 	ObjectManager *objman = ObjectManager::get_instance();
 
@@ -150,7 +149,7 @@ bool CruGame::startInitialUsecode(int saveSlot) {
 static ProcId playMovie(const char *movieID, bool fade, bool noScale) {
 	MovieGump *gump = MovieGump::CruMovieViewer(movieID, 640, 480, nullptr, nullptr, 0);
 	if (!gump) {
-		pout << "RemorseGame::playIntro: movie " << movieID << " not found." << Std::endl;
+		debug(MM_INFO, "RemorseGame::playIntro: movie %s not found.", movieID);
 		return 0;
 	}
 	gump->CreateNotifier();
diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index ac91aa7f7e8..61bbddc1fd9 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -173,7 +173,7 @@ void GameData::loadTranslation() {
 	if (!translationfile.empty()) {
 		translationfile = "data/" + translationfile;
 
-		pout << "Loading translation: " << translationfile << Std::endl;
+		debug(MM_INFO, "Loading translation: %s", translationfile.c_str());
 
 		config->readConfigFile(translationfile, "language");
 	}
@@ -251,7 +251,7 @@ void GameData::loadU8Data() {
 	_mainUsecode = new UsecodeFlex(uds);
 
 	// Load main shapes
-	pout << "Load Shapes" << Std::endl;
+	debug(MM_INFO, "Load Shapes");
 	Common::SeekableReadStream *sf = filesystem->ReadFile("static/u8shapes.flx");
 	if (!sf) sf = filesystem->ReadFile("static/u8shapes.cmp");
 
@@ -527,7 +527,7 @@ void GameData::loadRemorseData() {
 	_mainUsecode = new UsecodeFlex(uds);
 
 	// Load main shapes
-	pout << "Load Shapes" << Std::endl;
+	debug(MM_INFO, "Load Shapes");
 	Common::SeekableReadStream *sf = filesystem->ReadFile("static/shapes.flx");
 
 	if (!sf)
diff --git a/engines/ultima/ultima8/games/u8_game.cpp b/engines/ultima/ultima8/games/u8_game.cpp
index da22f0b7de5..9aa2155a265 100644
--- a/engines/ultima/ultima8/games/u8_game.cpp
+++ b/engines/ultima/ultima8/games/u8_game.cpp
@@ -69,7 +69,7 @@ U8Game::~U8Game() {
 
 bool U8Game::loadFiles() {
 	// Load palette
-	pout << "Load Palette" << Std::endl;
+	debug(MM_INFO, "Load Palette");
 	Common::SeekableReadStream *pf = FileSystem::get_instance()->ReadFile("static/u8pal.pal");
 	if (!pf) {
 		warning("Unable to load static/u8pal.pal.");
@@ -81,7 +81,7 @@ bool U8Game::loadFiles() {
 	PaletteManager::get_instance()->load(PaletteManager::Pal_Game, *pf, xfds);
 	delete pf;
 
-	pout << "Load GameData" << Std::endl;
+	debug(MM_INFO, "Load GameData");
 	GameData::get_instance()->loadU8Data();
 
 	return true;
@@ -89,8 +89,7 @@ bool U8Game::loadFiles() {
 
 bool U8Game::startGame() {
 	// NOTE: assumes the entire engine has been reset!
-
-	pout << "Starting new Ultima 8 game." << Std::endl;
+	debug(MM_INFO, "Starting new Ultima 8 game.");
 
 	ObjectManager *objman = ObjectManager::get_instance();
 
@@ -169,7 +168,7 @@ ProcId U8Game::playIntroMovie(bool fade) {
 	FileSystem *filesys = FileSystem::get_instance();
 	Common::SeekableReadStream *skf = filesys->ReadFile(filename);
 	if (!skf) {
-		pout << "U8Game::playIntro: movie not found." << Std::endl;
+		debug(MM_INFO, "U8Game::playIntro: movie not found.");
 		return 0;
 	}
 
@@ -181,7 +180,7 @@ ProcId U8Game::playEndgameMovie(bool fade) {
 	FileSystem *filesys = FileSystem::get_instance();
 	Common::SeekableReadStream *skf = filesys->ReadFile(filename);
 	if (!skf) {
-		pout << "U8Game::playEndgame: movie not found." << Std::endl;
+		debug(MM_INFO, "U8Game::playEndgame: movie not found.");
 		return 0;
 	}
 
diff --git a/engines/ultima/ultima8/gumps/credits_gump.cpp b/engines/ultima/ultima8/gumps/credits_gump.cpp
index 59138854784..90ada5e69ee 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/credits_gump.cpp
@@ -139,7 +139,7 @@ void CreditsGump::run() {
 	}
 
 	if (_state == CS_CLOSING) {
-		// pout << "CreditsGump: closing" << Std::endl;
+		//debug(MM_INFO, "CreditsGump: closing");
 		Close();
 		return;
 	}
@@ -156,7 +156,7 @@ void CreditsGump::run() {
 	if (available == 0) nextblock = 0;
 
 	if (_state == CS_FINISHING && available <= 156) {
-		// pout << "CreditsGump: waiting before closing" << Std::endl;
+		//debug(MM_INFO, "CreditsGump: waiting before closing");
 		_timer = 120;
 		_state = CS_CLOSING;
 
@@ -192,7 +192,7 @@ void CreditsGump::run() {
 				continue;
 			}
 
-			// pout << "Rendering paragraph: " << line << Std::endl;
+			//debug(MM_INFO, "Rendering paragraph: %s", line.c_str());
 
 			if (line[0] == '+') {
 				// set _title
@@ -234,7 +234,7 @@ void CreditsGump::run() {
 					unsigned int remaining;
 					extractLine(line, modifier, outline);
 
-					// pout << "Rendering line: " << outline << Std::endl;
+					//debug(MM_INFO, "Rendering line: %s", outline.c.str());
 
 					switch (modifier) {
 					case '&':
@@ -251,7 +251,7 @@ void CreditsGump::run() {
 						indent = 32;
 						break;
 					case '@':
-						// pout << "CreditsGump: done, finishing" << Std::endl;
+						//debug(MM_INFO, "CreditsGump: done, finishing");
 						_state = CS_FINISHING;
 						break;
 					default:
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index 3e08c5d80f2..61db9cc0335 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -103,8 +103,8 @@ ProcId Kernel::addProcess(Process *proc, bool dispose) {
 	assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
 
 #if 0
-	pout << "[Kernel] Adding process " << proc
-	<< ", pid = " << proc->_pid << " type " << proc->GetClassType()._className << Std::endl;
+	debug(MM_INFO, "[Kernel] Adding process %p, pid = %u type %s",
+		proc, proc->_pid, proc->GetClassType()._className);
 #endif
 
 	if (dispose) {
@@ -125,8 +125,8 @@ ProcId Kernel::addProcessExec(Process *proc, bool dispose) {
 	assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
 
 #if 0
-	pout << "[Kernel] Adding process " << proc
-	     << ", pid = " << proc->_pid << Std::endl;
+	debug(MM_INFO, "[Kernel] Adding process %p, pid = %u type %s",
+		proc, proc->_pid, proc->GetClassType()._className);
 #endif
 
 	if (dispose) {
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index dc5a4a52757..354cde2bb18 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -276,7 +276,7 @@ bool ObjectManager::load(Common::ReadStream *rs, uint32 version) {
 			count++;
 		}
 	}
-	pout << "Reclaimed " << count << " _objIDs on load." << Std::endl;
+	debug(MM_INFO, "Reclaimed %u _objIDs on load.", count);
 
 	// Integrity check items - their ids should match, and if they have
 	// parents, those should be valid.
diff --git a/engines/ultima/ultima8/misc/id_man.cpp b/engines/ultima/ultima8/misc/id_man.cpp
index 44379a20553..bdd0d2c703a 100644
--- a/engines/ultima/ultima8/misc/id_man.cpp
+++ b/engines/ultima/ultima8/misc/id_man.cpp
@@ -102,8 +102,8 @@ void idMan::expand() {
 	_ids.resize(_end + 1);
 
 #if 0
-	pout << "Expanding idMan from (" << _begin << "-" << old_end << ") to ("
-	     << _begin << "-" << _end << ")" << Std::endl;
+	debug(MM_INFO, "Expanding idMan from (%u-%u) to (%u-%u)",
+		_begin, old_end, _begin, _end);
 #endif
 
 	// insert the new free IDs at the start
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 5b39443b55a..152bec22cf7 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -206,7 +206,7 @@ bool Ultima8Engine::hasFeature(EngineFeature f) const {
 
 Common::Error Ultima8Engine::startup() {
 	setDebugger(new Debugger());
-	pout << "-- Initializing Pentagram -- " << Std::endl;
+	debug(MM_INFO, "-- Initializing Pentagram --");
 
 	_gameInfo = nullptr;
 	_fileSystem = new FileSystem;
@@ -328,7 +328,7 @@ Common::Error Ultima8Engine::startup() {
 	// Audio Mixer
 	_audioMixer = new AudioMixer(_mixer);
 
-	pout << "-- Pentagram Initialized -- " << Std::endl << Std::endl;
+	debug(MM_INFO, "-- Pentagram Initialized -- ");
 
 	if (setupGame()) {
 		GraphicSysInit();
@@ -353,22 +353,22 @@ bool Ultima8Engine::setupGame() {
 	if (detected) {
 		// add game to games map
 		Std::string details = info->getPrintDetails();
-		debugN(MM_INFO, "%s", details.c_str());
+		debug(MM_INFO, "%s", details.c_str());
 	} else {
-		debugN(MM_INFO, "unknown, skipping");
+		debug(MM_INFO, "unknown, skipping");
 		return false;
 	}
 
 	_gameInfo = info;
 
-	pout << "Selected game: " << info->_name << Std::endl;
-	pout << info->getPrintDetails() << Std::endl;
+	debug(MM_INFO, "Selected game: %s", info->_name.c_str());
+	debug(MM_INFO, "%s", info->getPrintDetails().c_str());
 
 	return true;
 }
 
 Common::Error Ultima8Engine::startupGame() {
-	pout  << Std::endl << "-- Initializing Game: " << _gameInfo->_name << " --" << Std::endl;
+	debug(MM_INFO, "-- Initializing Game: %s --", _gameInfo->_name.c_str());
 
 	GraphicSysInit();
 
@@ -449,7 +449,7 @@ Common::Error Ultima8Engine::startupGame() {
 
 	newGame(saveSlot);
 
-	pout << "-- Game Initialized --" << Std::endl << Std::endl;
+	debug(MM_INFO, "-- Game Initialized --");
 	return Common::kNoError;
 }
 
@@ -458,7 +458,7 @@ void Ultima8Engine::shutdown() {
 }
 
 void Ultima8Engine::shutdownGame(bool reloading) {
-	pout << "-- Shutting down Game -- " << Std::endl;
+	debug(MM_INFO, "-- Shutting down Game -- ");
 
 	// Save config here....
 
@@ -498,7 +498,7 @@ void Ultima8Engine::shutdownGame(bool reloading) {
 	_configFileMan->clearRoot("game");
 	_gameInfo = nullptr;
 
-	pout << "-- Game Shutdown -- " << Std::endl;
+	debug(MM_INFO, "-- Game Shutdown -- ");
 
 	if (reloading) {
 		Rect dims;
@@ -552,9 +552,7 @@ Common::Error Ultima8Engine::runGame() {
 					_desktopGump->run();
 				}
 #if 0
-				pout << "--------------------------------------" << Std::endl;
-				pout << "NEW FRAME" << Std::endl;
-				pout << "--------------------------------------" << Std::endl;
+				debug(MM_INFO, "--- NEW FRAME ---");
 #endif
 				_inBetweenFrame = false;
 
@@ -570,7 +568,7 @@ Common::Error Ultima8Engine::runGame() {
 
 			// Calculate the lerp_factor
 			_lerpFactor = ((_animationRate - diff) * 256) / _animationRate;
-			//pout << "_lerpFactor: " << _lerpFactor << " framenum: " << framenum << Std::endl;
+			//debug(MM_INFO, "_lerpFactor: %d framenum: %d", _lerpFactor, framenum);
 			if (!_interpolate || _kernel->isPaused() || _lerpFactor > 256)
 				_lerpFactor = 256;
 		}
@@ -1054,7 +1052,7 @@ Common::Error Ultima8Engine::saveGameStream(Common::WriteStream *stream, bool is
 	// Restore mouse over
 	if (gump) gump->onMouseOver();
 
-	pout << "Done" << Std::endl;
+	debug(MM_INFO, "Done");
 
 	_mouse->popMouseCursor();
 
@@ -1269,7 +1267,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 		if (!ignore) {
 			error("%s", message.c_str());
 		}
-		pout << message << Std::endl;
+		debug(MM_INFO, "%s", message.c_str());
 #else
 		delete sg;
 		return Common::Error(Common::kReadingFailed, message);
@@ -1293,7 +1291,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _ucMachine->loadStrings(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "UCSTRINGS: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "UCSTRINGS: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "UCSTRINGS: failed\n";
 	delete ds;
 
@@ -1301,7 +1299,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _ucMachine->loadGlobals(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "UCGLOBALS: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "UCGLOBALS: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "UCGLOBALS: failed\n";
 	delete ds;
 
@@ -1309,7 +1307,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _ucMachine->loadLists(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "UCLISTS: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "UCLISTS: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "UCLISTS: failed\n";
 	delete ds;
 
@@ -1319,7 +1317,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _kernel->load(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "KERNEL: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "KERNEL: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "KERNEL: failed\n";
 	delete ds;
 
@@ -1327,7 +1325,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = load(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "APP: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "APP: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "APP: failed\n";
 	delete ds;
 
@@ -1336,7 +1334,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _world->load(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "WORLD: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "WORLD: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "WORLD: failed\n";
 	delete ds;
 
@@ -1344,7 +1342,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _world->getCurrentMap()->load(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "CURRENTMAP: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "CURRENTMAP: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "CURRENTMAP: failed\n";
 	delete ds;
 
@@ -1352,7 +1350,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _objectManager->load(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "OBJECTS: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "OBJECTS: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "OBJECTS: failed\n";
 	delete ds;
 
@@ -1360,7 +1358,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ok = _world->loadMaps(ds, version);
 	ok &= (ds->pos() == ds->size() && !ds->eos());
 	totalok &= ok;
-	pout << "MAPS: " << (ok ? "ok" : "failed") << Std::endl;
+	debug(MM_INFO, "MAPS: %s", (ok ? "ok" : "failed"));
 	if (!ok) message += "MAPS: failed\n";
 	delete ds;
 
@@ -1387,7 +1385,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 		return Common::Error(Common::kReadingFailed, message);
 	}
 
-	pout << "Done" << Std::endl;
+	debug(MM_INFO, "Done");
 
 	delete sg;
 	return Common::kNoError;
diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 03aa5914312..c466e401fc9 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -141,8 +141,8 @@ CameraProcess::CameraProcess(int32 x, int32 y, int32 z) :
 CameraProcess::CameraProcess(int32 x, int32 y, int32 z, int32 time) :
 	_ex(x), _ey(y), _ez(z), _time(time), _elapsed(0), _itemNum(0), _lastFrameNum(0) {
 	GetCameraLocation(_sx, _sy, _sz);
-	//pout << "Scrolling from (" << sx << "," << sy << "," << sz << ") to (" <<
-	//  ex << "," << ey << "," << ez << ") in " << _time << " frames" << Std::endl;
+	//debug(MM_INFO, "Scrolling from (%d, %d,%d) to (%d, %d, %d) in %d frames",
+	//  sx, sy, sz, ex, ey, ez,  _time);
 }
 
 void CameraProcess::terminate() {
diff --git a/engines/ultima/ultima8/world/world.cpp b/engines/ultima/ultima8/world/world.cpp
index 8386cc2fac6..97902f727e8 100644
--- a/engines/ultima/ultima8/world/world.cpp
+++ b/engines/ultima/ultima8/world/world.cpp
@@ -157,13 +157,13 @@ bool World::switchMap(uint32 newmap) {
 
 	uint32 oldmap = _currentMap->getNum();
 	if (oldmap != 0) {
-		pout << "Unloading map " << oldmap << Std::endl;
+		debug(MM_INFO, "Unloading map %u", oldmap);
 
 		assert(oldmap < _maps.size() && _maps[oldmap] != nullptr);
 
 		_currentMap->writeback();
 
-		pout << "Unloading Fixed items from map " << oldmap << Std::endl;
+		debug(MM_INFO, "Unloading Fixed items from map %u", oldmap);
 
 		_maps[oldmap]->unloadFixed();
 	}
@@ -180,7 +180,7 @@ bool World::switchMap(uint32 newmap) {
 		Kernel::get_instance()->addProcess(new SchedulerProcess());
 	}
 
-	pout << "Loading Fixed items in map " << newmap << Std::endl;
+	debug(MM_INFO, "Loading Fixed items in map %u", newmap);
 	Common::SeekableReadStream *items = GameData::get_instance()->getFixed()
 	                     ->get_datasource(newmap);
 	_maps[newmap]->loadFixed(items);
@@ -209,7 +209,7 @@ bool World::switchMap(uint32 newmap) {
 void World::loadNonFixed(Common::SeekableReadStream *rs) {
 	FlexFile *f = new FlexFile(rs);
 
-	pout << "Loading NonFixed items" << Std::endl;
+	debug(MM_INFO, "Loading NonFixed items");
 
 	for (unsigned int i = 0; i < f->getCount(); ++i) {
 
@@ -240,7 +240,7 @@ void World::loadItemCachNPCData(Common::SeekableReadStream *itemcach, Common::Se
 	delete itemcachflex;
 	delete npcdataflex;
 
-	pout << "Loading NPCs" << Std::endl;
+	debug(MM_INFO, "Loading NPCs");
 
 	for (uint32 i = 1; i < 256; ++i) { // Get rid of constants?
 		// These are ALL unsigned on disk


Commit: 49304f84d63576353ac51e5a628fb200d2084d7b
    https://github.com/scummvm/scummvm/commit/49304f84d63576353ac51e5a628fb200d2084d7b
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-01T12:00:59-06:00

Commit Message:
ULTIMA8: Remove pout and ConsoleStream from debugger

Changed paths:
    engines/ultima/ultima8/misc/debugger.cpp
    engines/ultima/ultima8/misc/debugger.h


diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index a733a6cc28b..3b08825e285 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -63,14 +63,9 @@ namespace Ultima8 {
 
 Debugger *g_debugger;
 
-console_ostream<char> *ppout;
-
 Debugger::Debugger() : Shared::Debugger() {
 	g_debugger = this;
 
-	// Set output pointers
-	ppout = &_strOut;
-
 	// WARNING: Not only can the methods below be executed directly in the debugger,
 	// they also act as the methods keybindings are made to. So be wary of changing names
 	registerCmd("quit", WRAP_METHOD(Debugger, cmdQuit));
@@ -214,7 +209,6 @@ Debugger::Debugger() : Shared::Debugger() {
 
 Debugger::~Debugger() {
 	g_debugger = nullptr;
-	ppout = nullptr;
 }
 
 
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index b8a4d1c0ccb..2ac0436c048 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -31,78 +31,10 @@
 namespace Ultima {
 namespace Ultima8 {
 
-class ConsoleStream : public Common::WriteStream {
-public:
-	enum Precision { hex = 16, dec = 10 };
-private:
-	Precision _precision;
-public:
-	ConsoleStream() : Common::WriteStream(), _precision(dec) {
-	}
-
-	int64 pos() const override {
-		return 0;
-	}
-
-	void Print(const char *fmt, ...) {
-		va_list argptr;
-		va_start(argptr, fmt);
-		Common::String str = Common::String::vformat(fmt, argptr);
-		va_end(argptr);
-
-		write(str.c_str(), str.size());
-	}
-
-	ConsoleStream &operator<<(const char *s) {
-		write(s, strlen(s));
-		return *this;
-	}
-
-	ConsoleStream &operator<<(const void *ptr) {
-		Common::String str = Common::String::format("%p", ptr);
-		write(str.c_str(), str.size());
-		return *this;
-	}
-
-	ConsoleStream &operator<<(const Common::String &str) {
-		write(str.c_str(), str.size());
-		return *this;
-	}
-
-	ConsoleStream &operator<<(Precision p) {
-		_precision = p;
-		return *this;
-	}
-
-	ConsoleStream &operator<<(int val) {
-		Common::String str = Common::String::format(
-			(_precision == hex) ? "%x" : "%d", val);
-		write(str.c_str(), str.size());
-		return *this;
-	}
-};
-
-template<class T>
-class console_ostream : public ConsoleStream {
-	uint32 write(const void *dataPtr, uint32 dataSize) override {
-		Common::String str((const char *)dataPtr, (const char *)dataPtr + dataSize);
-		debugN(MM_INFO, "%s", str.c_str());
-		return dataSize;
-	}
-};
-
-// Standard Output Stream Object
-extern console_ostream<char> *ppout;
-
-#define pout (*ppout)
-
 /**
  * Debugger base class
  */
 class Debugger : public Shared::Debugger {
-private:
-	// Standard Output Stream Object
-	console_ostream<char> _strOut;
 private:
 	const char *strBool(bool flag) {
 		return flag ? "true" : "false";




More information about the Scummvm-git-logs mailing list