[Scummvm-git-logs] scummvm master -> 85bf85dfe8d439ea2608eb06aa9f2834cf92c9b7

OMGPizzaGuy noreply at scummvm.org
Wed Dec 28 05:30:36 UTC 2022


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:
f955c834a2 ULTIMA8: Use debug channel for path finding
61e2afbeda ULTIMA: Move debug channels out of Shared namespace
85bf85dfe8 ULTIMA8: Use debug channel for SKF video player


Commit: f955c834a27eaeea0fd67c70fdd91c69e62c525b
    https://github.com/scummvm/scummvm/commit/f955c834a27eaeea0fd67c70fdd91c69e62c525b
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-12-27T23:24:44-06:00

Commit Message:
ULTIMA8: Use debug channel for path finding

Changed paths:
    engines/ultima/ultima8/world/actors/pathfinder.cpp
    engines/ultima/ultima8/world/actors/pathfinder_process.cpp


diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index 1551bdcf58b..1172baa4946 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -92,9 +92,7 @@ bool PathfindingState::checkItem(const Item *item, int xyRange, int zRange) cons
 
 bool PathfindingState::checkHit(const Actor *_actor, const Item *target) const {
 	assert(target);
-#if 0
-	pout << "Trying hit in _direction " << _actor->getDirToItemCentre(*target) << Std::endl;
-#endif
+	debugC(Shared::kDebugPath, "Trying hit in _direction %d", _actor->getDirToItemCentre(*target));
 	AnimationTracker tracker;
 	if (!tracker.init(_actor, Animation::attack,
 	                  _actor->getDirToItemCentre(*target), this)) {
@@ -123,11 +121,8 @@ Pathfinder::Pathfinder() : _actor(nullptr), _targetItem(nullptr),
 }
 
 Pathfinder::~Pathfinder() {
-#if 1
-	pout << "~Pathfinder: " << _cleanupNodes.size() << " nodes to clean up, visited "
-		 << _visited.size() << " and "
-	     << expandednodes << " expanded nodes in " << _expandTime << "ms." << Std::endl;
-#endif
+	debugC(Shared::kDebugPath, "~Pathfinder: %u nodes to clean up, visited %u and %u expanded nodes in %dms.",
+		_cleanupNodes.size(), _visited.size(), expandednodes, _expandTime);
 
 	// clean up _nodes
 	Std::vector<PathNode *>::iterator iter;
@@ -396,18 +391,10 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
 	else
 		costHeuristic(newnode);
 
-#if 0
-	pout << "trying dir " << state._direction;
-
-	if (steps > 0) {
-		pout << ", " << steps << " steps";
-	}
-	pout << " from ("
-	     << oldnode->state._x << "," << oldnode->state._y << ") to ("
-	     << newnode->state._x << "," << newnode->state._y
-	     << "), cost = " << newnode->cost << ", heurtotcost = "
-	     << newnode->heuristicTotalCost << Std::endl;
-#endif
+	debugC(Shared::kDebugPath, "Trying dir %d, steps %d from (%d, %d) to (%d, %d), cost %d, heurtotcost %d",
+		   state._direction, steps,
+		   oldnode->state._x, oldnode->state._y, newnode->state._x, newnode->state._y,
+		   newnode->cost, newnode->heuristicTotalCost);
 
 #ifdef DEBUG
 	if (_actor->getObjId() == _visualDebugActor) {
@@ -511,16 +498,12 @@ void Pathfinder::expandNode(PathNode *node) {
 }
 
 bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
-#if 0
-	pout << "Actor " << _actor->getObjId();
-
 	if (_targetItem) {
-		pout << " pathfinding to item: ";
+		debugC(Shared::kDebugPath, "Actor %u pathfinding to item %u", _actor->getObjId(), _targetItem->getObjId());
 		_targetItem->dumpInfo();
 	} else {
-		pout << " pathfinding to (" << _targetX << "," << _targetY << "," << _targetZ << ")" << Std::endl;
+		debugC(Shared::kDebugPath, "Actor %u pathfinding to (%d, %d, %d)", _actor->getObjId(), _targetX, _targetY, _targetZ);
 	}
-#endif
 
 #ifdef DEBUG
 	if (_actor->getObjId() == _visualDebugActor) {
@@ -557,11 +540,9 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 		_cleanupNodes.push_back(node);
 		_nodes.pop();
 
-#if 0
-		pout << "Trying node: (" << node->state._x << "," << node->state._y
-		     << "," << node->state._z << ") target=(" << _targetX << ","
-		     << _targetY << "," << _targetZ << ")" << Std::endl;
-#endif
+		debugC(Shared::kDebugPath, "Trying node: (%d, %d, %d) target=(%d, %d, %d)",
+			node->state._x, node->state._y, node->state._z,
+			_targetX, _targetY, _targetZ);
 
 		if (checkTarget(node)) {
 			// done!
@@ -573,10 +554,8 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 				n = n->parent;
 				length++;
 			}
-#if 0
-			pout << "Pathfinder: path found (length = " << length << ")"
-			     << Std::endl;
-#endif
+
+			debugC(Shared::kDebugPath, "Pathfinder: path found (length = %u)", length);
 
 			unsigned int i = length;
 			if (length > 0) length++; // add space for final 'stand' action
@@ -589,11 +568,9 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 				action._direction = node->state._direction;
 				action._steps = node->stepsfromparent;
 				path[--i] = action;
-#if 0
-				pout << "anim = " << node->state._lastAnim << ", dir = "
-				     << node->state._direction << ", steps = "
-				     << node->stepsfromparent << Std::endl;
-#endif
+
+				debugC(Shared::kDebugPath, "anim = %d, dir = %d, steps = %d",
+					node->state._lastAnim, node->state._direction, node->stepsfromparent);
 
 				//TODO: check how turns work
 				//TODO: append final 'stand' animation
@@ -624,13 +601,11 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 
 	_expandTime = g_system->getMillis() - starttime;
 
-#if 0
 	static int32 pfcalls = 0;
 	static int32 pftotaltime = 0;
 	pfcalls++;
 	pftotaltime += _expandTime;
-	pout << "maxout average = " << (pftotaltime / pfcalls) << "ms." << Std::endl;
-#endif
+	debugC(Shared::kDebugPath, "maxout average = %dms.", pftotaltime / pfcalls);
 
 	return false;
 }
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
index 62017fd2bdf..6e6b9c29fe0 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
@@ -68,7 +68,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor, ObjId itemid, bool hit) :
 
 	if (!ok) {
 		// can't get there...
-		debug(MM_INFO, "PathfinderProcess: actor %d failed to find path", _itemNum);
+		debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 		_result = PATH_FAILED;
 		terminateDeferred();
 		return;
@@ -92,7 +92,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor, int32 x, int32 y, int32 z) :
 
 	if (!ok) {
 		// can't get there...
-		debug(MM_INFO, "PathfinderProcess: actor %d failed to find path", _itemNum);
+		debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 		_result = PATH_FAILED;
 		terminateDeferred();
 		return;
@@ -145,26 +145,21 @@ void PathfinderProcess::run() {
 
 	if (ok && _currentStep >= _path.size()) {
 		// done
-#if 0
-		pout << "PathfinderProcess: done" << Std::endl;
-#endif
+		debugC(Shared::kDebugPath, "PathfinderProcess: done");
 		_result = PATH_OK;
 		terminate();
 		return;
 	}
 
 	// try to take the next step
-
-#if 0
-	pout << "PathfinderProcess: trying step" << Std::endl;
-#endif
+	debugC(Shared::kDebugPath, "PathfinderProcess: trying step");
 
 	// if actor is still animating for whatever reason, wait until he stopped
 	// FIXME: this should happen before the pathfinder is actually called,
 	// since the running animation may move the actor, which could break
 	// the found _path.
 	if (actor->hasActorFlags(Actor::ACT_ANIMLOCK)) {
-		warning("PathfinderProcess: ANIMLOCK, waiting");
+		debugC(Shared::kDebugPath, "PathfinderProcess: ANIMLOCK, waiting");
 		return;
 	}
 
@@ -175,9 +170,7 @@ void PathfinderProcess::run() {
 	}
 
 	if (!ok) {
-#if 0
-		pout << "PathfinderProcess: recalculating _path" << Std::endl;
-#endif
+		debugC(Shared::kDebugPath, "PathfinderProcess: recalculating _path");
 
 		// need to redetermine _path
 		ok = true;
@@ -204,7 +197,7 @@ void PathfinderProcess::run() {
 		_currentStep = 0;
 		if (!ok) {
 			// can't get there anymore
-			debug(MM_INFO, "PathfinderProcess: actor %d failed to find path", _itemNum);
+			debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 			_result = PATH_FAILED;
 			terminate();
 			return;
@@ -212,9 +205,7 @@ void PathfinderProcess::run() {
 	}
 
 	if (_currentStep >= _path.size()) {
-#if 0
-		pout << "PathfinderProcess: done" << Std::endl;
-#endif
+		debugC(Shared::kDebugPath, "PathfinderProcess: done");
 		// done
 		_result = PATH_OK;
 		terminate();
@@ -224,11 +215,10 @@ void PathfinderProcess::run() {
 	uint16 animpid = actor->doAnim(_path[_currentStep]._action,
 	                               _path[_currentStep]._direction,
 	                               _path[_currentStep]._steps);
-#if 0
-	pout << "PathfinderProcess(" << getPid() << "): taking step "
-	     << _path[_currentStep].action << "," << _path[_currentStep].direction
-	     << " (animpid=" << animpid << ")" << Std::endl;
-#endif
+
+	debugC(Shared::kDebugPath, "PathfinderProcess(%u): taking step %d, %d (animpid=%u)",
+		getPid(), _path[_currentStep]._action, _path[_currentStep]._direction, animpid);
+
 	_currentStep++;
 
 	waitFor(animpid);


Commit: 61e2afbeda0c771632a996adaf974fbc6369f5da
    https://github.com/scummvm/scummvm/commit/61e2afbeda0c771632a996adaf974fbc6369f5da
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-12-27T23:24:44-06:00

Commit Message:
ULTIMA: Move debug channels out of Shared namespace

Changed paths:
  A engines/ultima/ultima.h
    engines/ultima/shared/engine/ultima.cpp
    engines/ultima/shared/engine/ultima.h
    engines/ultima/ultima8/world/actors/pathfinder.cpp
    engines/ultima/ultima8/world/actors/pathfinder_process.cpp


diff --git a/engines/ultima/shared/engine/ultima.cpp b/engines/ultima/shared/engine/ultima.cpp
index b99dede6875..41f5e6984f6 100644
--- a/engines/ultima/shared/engine/ultima.cpp
+++ b/engines/ultima/shared/engine/ultima.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima.h"
 #include "ultima/shared/engine/ultima.h"
 #include "ultima/shared/engine/data_archive.h"
 #include "ultima/shared/engine/events.h"
diff --git a/engines/ultima/shared/engine/ultima.h b/engines/ultima/shared/engine/ultima.h
index dc1168ec87b..86dc41a59d5 100644
--- a/engines/ultima/shared/engine/ultima.h
+++ b/engines/ultima/shared/engine/ultima.h
@@ -32,11 +32,6 @@
 namespace Ultima {
 namespace Shared {
 
-enum UltimaDebugChannels {
-	kDebugPath = 1 << 0,
-	kDebugGraphics = 1 << 1
-};
-
 class UltimaEngine : public Engine, public EventsCallback {
 private:
 	Common::RandomSource _randomSource;
diff --git a/engines/ultima/ultima.h b/engines/ultima/ultima.h
new file mode 100644
index 00000000000..c83376d7a53
--- /dev/null
+++ b/engines/ultima/ultima.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA_ULTIMA_H
+#define ULTIMA_ULTIMA_H
+
+namespace Ultima {
+
+enum UltimaDebugChannels {
+	kDebugPath = 1 << 0,
+	kDebugGraphics = 1 << 1
+};
+
+} // End of namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index 1172baa4946..e24915e82ce 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/system.h"
+#include "ultima/ultima.h"
 #include "ultima/ultima8/misc/direction_util.h"
 #include "ultima/ultima8/world/actors/actor.h"
 #include "ultima/ultima8/world/actors/animation_tracker.h"
@@ -92,7 +93,7 @@ bool PathfindingState::checkItem(const Item *item, int xyRange, int zRange) cons
 
 bool PathfindingState::checkHit(const Actor *_actor, const Item *target) const {
 	assert(target);
-	debugC(Shared::kDebugPath, "Trying hit in _direction %d", _actor->getDirToItemCentre(*target));
+	debugC(kDebugPath, "Trying hit in _direction %d", _actor->getDirToItemCentre(*target));
 	AnimationTracker tracker;
 	if (!tracker.init(_actor, Animation::attack,
 	                  _actor->getDirToItemCentre(*target), this)) {
@@ -121,7 +122,7 @@ Pathfinder::Pathfinder() : _actor(nullptr), _targetItem(nullptr),
 }
 
 Pathfinder::~Pathfinder() {
-	debugC(Shared::kDebugPath, "~Pathfinder: %u nodes to clean up, visited %u and %u expanded nodes in %dms.",
+	debugC(kDebugPath, "~Pathfinder: %u nodes to clean up, visited %u and %u expanded nodes in %dms.",
 		_cleanupNodes.size(), _visited.size(), expandednodes, _expandTime);
 
 	// clean up _nodes
@@ -391,7 +392,7 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
 	else
 		costHeuristic(newnode);
 
-	debugC(Shared::kDebugPath, "Trying dir %d, steps %d from (%d, %d) to (%d, %d), cost %d, heurtotcost %d",
+	debugC(kDebugPath, "Trying dir %d, steps %d from (%d, %d) to (%d, %d), cost %d, heurtotcost %d",
 		   state._direction, steps,
 		   oldnode->state._x, oldnode->state._y, newnode->state._x, newnode->state._y,
 		   newnode->cost, newnode->heuristicTotalCost);
@@ -499,10 +500,10 @@ void Pathfinder::expandNode(PathNode *node) {
 
 bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 	if (_targetItem) {
-		debugC(Shared::kDebugPath, "Actor %u pathfinding to item %u", _actor->getObjId(), _targetItem->getObjId());
+		debugC(kDebugPath, "Actor %u pathfinding to item %u", _actor->getObjId(), _targetItem->getObjId());
 		_targetItem->dumpInfo();
 	} else {
-		debugC(Shared::kDebugPath, "Actor %u pathfinding to (%d, %d, %d)", _actor->getObjId(), _targetX, _targetY, _targetZ);
+		debugC(kDebugPath, "Actor %u pathfinding to (%d, %d, %d)", _actor->getObjId(), _targetX, _targetY, _targetZ);
 	}
 
 #ifdef DEBUG
@@ -540,7 +541,7 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 		_cleanupNodes.push_back(node);
 		_nodes.pop();
 
-		debugC(Shared::kDebugPath, "Trying node: (%d, %d, %d) target=(%d, %d, %d)",
+		debugC(kDebugPath, "Trying node: (%d, %d, %d) target=(%d, %d, %d)",
 			node->state._x, node->state._y, node->state._z,
 			_targetX, _targetY, _targetZ);
 
@@ -555,7 +556,7 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 				length++;
 			}
 
-			debugC(Shared::kDebugPath, "Pathfinder: path found (length = %u)", length);
+			debugC(kDebugPath, "Pathfinder: path found (length = %u)", length);
 
 			unsigned int i = length;
 			if (length > 0) length++; // add space for final 'stand' action
@@ -569,7 +570,7 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 				action._steps = node->stepsfromparent;
 				path[--i] = action;
 
-				debugC(Shared::kDebugPath, "anim = %d, dir = %d, steps = %d",
+				debugC(kDebugPath, "anim = %d, dir = %d, steps = %d",
 					node->state._lastAnim, node->state._direction, node->stepsfromparent);
 
 				//TODO: check how turns work
@@ -605,7 +606,7 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
 	static int32 pftotaltime = 0;
 	pfcalls++;
 	pftotaltime += _expandTime;
-	debugC(Shared::kDebugPath, "maxout average = %dms.", pftotaltime / pfcalls);
+	debugC(kDebugPath, "maxout average = %dms.", pftotaltime / pfcalls);
 
 	return false;
 }
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
index 6e6b9c29fe0..c5302b65ce4 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
@@ -19,8 +19,8 @@
  *
  */
 
+#include "ultima/ultima.h"
 #include "ultima/ultima8/world/actors/pathfinder_process.h"
-
 #include "ultima/ultima8/world/actors/actor.h"
 #include "ultima/ultima8/world/get_object.h"
 #include "ultima/ultima8/misc/direction_util.h"
@@ -68,7 +68,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor, ObjId itemid, bool hit) :
 
 	if (!ok) {
 		// can't get there...
-		debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
+		debugC(kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 		_result = PATH_FAILED;
 		terminateDeferred();
 		return;
@@ -92,7 +92,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor, int32 x, int32 y, int32 z) :
 
 	if (!ok) {
 		// can't get there...
-		debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
+		debugC(kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 		_result = PATH_FAILED;
 		terminateDeferred();
 		return;
@@ -145,21 +145,21 @@ void PathfinderProcess::run() {
 
 	if (ok && _currentStep >= _path.size()) {
 		// done
-		debugC(Shared::kDebugPath, "PathfinderProcess: done");
+		debugC(kDebugPath, "PathfinderProcess: done");
 		_result = PATH_OK;
 		terminate();
 		return;
 	}
 
 	// try to take the next step
-	debugC(Shared::kDebugPath, "PathfinderProcess: trying step");
+	debugC(kDebugPath, "PathfinderProcess: trying step");
 
 	// if actor is still animating for whatever reason, wait until he stopped
 	// FIXME: this should happen before the pathfinder is actually called,
 	// since the running animation may move the actor, which could break
 	// the found _path.
 	if (actor->hasActorFlags(Actor::ACT_ANIMLOCK)) {
-		debugC(Shared::kDebugPath, "PathfinderProcess: ANIMLOCK, waiting");
+		debugC(kDebugPath, "PathfinderProcess: ANIMLOCK, waiting");
 		return;
 	}
 
@@ -170,7 +170,7 @@ void PathfinderProcess::run() {
 	}
 
 	if (!ok) {
-		debugC(Shared::kDebugPath, "PathfinderProcess: recalculating _path");
+		debugC(kDebugPath, "PathfinderProcess: recalculating _path");
 
 		// need to redetermine _path
 		ok = true;
@@ -197,7 +197,7 @@ void PathfinderProcess::run() {
 		_currentStep = 0;
 		if (!ok) {
 			// can't get there anymore
-			debugC(Shared::kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
+			debugC(kDebugPath, "PathfinderProcess: actor %d failed to find path", _itemNum);
 			_result = PATH_FAILED;
 			terminate();
 			return;
@@ -205,7 +205,7 @@ void PathfinderProcess::run() {
 	}
 
 	if (_currentStep >= _path.size()) {
-		debugC(Shared::kDebugPath, "PathfinderProcess: done");
+		debugC(kDebugPath, "PathfinderProcess: done");
 		// done
 		_result = PATH_OK;
 		terminate();
@@ -216,7 +216,7 @@ void PathfinderProcess::run() {
 	                               _path[_currentStep]._direction,
 	                               _path[_currentStep]._steps);
 
-	debugC(Shared::kDebugPath, "PathfinderProcess(%u): taking step %d, %d (animpid=%u)",
+	debugC(kDebugPath, "PathfinderProcess(%u): taking step %d, %d (animpid=%u)",
 		getPid(), _path[_currentStep]._action, _path[_currentStep]._direction, animpid);
 
 	_currentStep++;


Commit: 85bf85dfe8d439ea2608eb06aa9f2834cf92c9b7
    https://github.com/scummvm/scummvm/commit/85bf85dfe8d439ea2608eb06aa9f2834cf92c9b7
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-12-27T23:24:44-06:00

Commit Message:
ULTIMA8: Use debug channel for SKF video player

Changed paths:
    engines/ultima/shared/engine/ultima.cpp
    engines/ultima/ultima.h
    engines/ultima/ultima8/graphics/skf_player.cpp


diff --git a/engines/ultima/shared/engine/ultima.cpp b/engines/ultima/shared/engine/ultima.cpp
index 41f5e6984f6..2a77bad4a46 100644
--- a/engines/ultima/shared/engine/ultima.cpp
+++ b/engines/ultima/shared/engine/ultima.cpp
@@ -50,6 +50,7 @@ bool UltimaEngine::initialize() {
 
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
 	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
+	DebugMan.addDebugChannel(kDebugVideo, "Video", "Debug video and audio playback");
 
 	// Call syncSoundSettings to get default volumes set
 	syncSoundSettings();
diff --git a/engines/ultima/ultima.h b/engines/ultima/ultima.h
index c83376d7a53..c19e8642b3a 100644
--- a/engines/ultima/ultima.h
+++ b/engines/ultima/ultima.h
@@ -26,7 +26,8 @@ namespace Ultima {
 
 enum UltimaDebugChannels {
 	kDebugPath = 1 << 0,
-	kDebugGraphics = 1 << 1
+	kDebugGraphics = 1 << 1,
+	kDebugVideo = 1 << 2
 };
 
 } // End of namespace Ultima
diff --git a/engines/ultima/ultima8/graphics/skf_player.cpp b/engines/ultima/ultima8/graphics/skf_player.cpp
index 31a0dee7519..08b6c86e6c1 100644
--- a/engines/ultima/ultima8/graphics/skf_player.cpp
+++ b/engines/ultima/ultima8/graphics/skf_player.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima.h"
 #include "ultima/ultima8/misc/pent_include.h"
 #include "ultima/ultima8/graphics/skf_player.h"
 #include "ultima/ultima8/convert/u8/convert_shape_u8.h"
@@ -157,7 +158,7 @@ void SKFPlayer::run() {
 				return;
 			}
 		} else {
-			pout << "Unknown fade action: " << _curAction << Std::endl;
+			debugC(kDebugVideo, "Unknown fade action: %u", _curAction);
 		}
 	}
 
@@ -183,54 +184,54 @@ void SKFPlayer::run() {
 
 	// handle _events for the current frame
 	while (_curEvent < _events.size() && _events[_curEvent]->_frame <= _curFrame) {
-//		pout << "event " << _curEvent << Std::endl;
+		debugCN(kDebugVideo, "Event %u: ", _curEvent);
 		switch (_events[_curEvent]->_action) {
 		case SKF_FadeOut:
 			_curAction = SKF_FadeOut;
 			_fadeColour = 0;
 			_fadeLevel = 0;
-//			pout << "FadeOut" << Std::endl;
+			debugC(kDebugVideo, "FadeOut");
 			break;
 		case SKF_FadeIn:
 			_curAction = SKF_FadeIn;
 			_fadeLevel = FADESTEPS;
-//			pout << "FadeIn" << Std::endl;
+			debugC(kDebugVideo, "FadeIn");
 			break;
 		case SKF_FadeWhite:
 			_curAction = SKF_FadeWhite;
 			_fadeColour = 0xFF;
 			_fadeLevel = 0;
-//			pout << "FadeWhite" << Std::endl;
+			debugC(kDebugVideo, "FadeWhite");
 			break;
 		case SKF_Wait:
-//			pout << "Wait " << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "Wait %u", _events[_curEvent]->_data);
 			_timer = _events[_curEvent]->_data;
 			_curEvent++;
 			return;
 		case SKF_PlayMusic:
-//			pout << "PlayMusic " << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "PlayMusic %u", _events[_curEvent]->_data);
 			if (musicproc) musicproc->playMusic(_events[_curEvent]->_data);
 			break;
 		case SKF_SlowStopMusic:
-//			pout << "SlowStopMusic" << Std::endl;
+			debugC(kDebugVideo, "SlowStopMusic");
 			if (musicproc)
 				musicproc->fadeMusic(1500);
 			_curAction = SKF_SlowStopMusic;
 			break;
 		case SKF_PlaySFX:
-//			pout << "PlaySFX " << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "PlaySFX %u", _events[_curEvent]->_data);
 			if (audioproc) audioproc->playSFX(_events[_curEvent]->_data, 0x60, 0, 0);
 			break;
 		case SKF_StopSFX:
-//			pout << "StopSFX" << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "StopSFX %u", _events[_curEvent]->_data);
 			if (audioproc) audioproc->stopSFX(_events[_curEvent]->_data, 0);
 			break;
 		case SKF_SetSpeed:
-//			pout << "SetSpeed " << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "SetSpeed %u", _events[_curEvent]->_data);
 //			_frameRate = _events[_curEvent]->_data;
 			break;
 		case SKF_PlaySound: {
-//			pout << "PlaySound " << _events[_curEvent]->_data << Std::endl;
+			debugC(kDebugVideo, "PlaySound %u", _events[_curEvent]->_data);
 
 			if (!speechMute && audioproc) {
 				uint8 *buf = _skf->get_object(_events[_curEvent]->_data);
@@ -262,12 +263,12 @@ void SKFPlayer::run() {
 			break;
 		}
 		case SKF_ClearSubs:
-//			pout << "ClearSubs" << Std::endl;
+			debugC(kDebugVideo, "ClearSubs");
 			delete _subs;
 			_subs = nullptr;
 			break;
 		default:
-			pout << "Unknown action" << Std::endl;
+			debugC(kDebugVideo, "Unknown action %d", _events[_curEvent]->_action);
 			break;
 		}
 
@@ -294,9 +295,7 @@ void SKFPlayer::run() {
 
 		objecttype = object->readUint16LE();
 
-//		pout << "Object " << _curObject << "/" << _skf->getCount()
-//			 << ", type = " << objecttype << Std::endl;
-
+		debugC(kDebugVideo, "Object %u/%u, type = %u", _curObject, _skf->getCount(),  objecttype);
 
 		if (objecttype == 1) {
 			palman->load(PaletteManager::Pal_Movie, *object);




More information about the Scummvm-git-logs mailing list