[Scummvm-git-logs] scummvm master -> 989eda8376b5393f96ff65259aad8970fdc0837a

OMGPizzaGuy noreply at scummvm.org
Tue Sep 26 00:00:53 UTC 2023


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:
989eda8376 ULTIMA8: Add debugger command "GameMapGump::toggleFootpads"


Commit: 989eda8376b5393f96ff65259aad8970fdc0837a
    https://github.com/scummvm/scummvm/commit/989eda8376b5393f96ff65259aad8970fdc0837a
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-25T18:55:31-05:00

Commit Message:
ULTIMA8: Add debugger command "GameMapGump::toggleFootpads"
This draws wire frames around objects similar to the "Footpads" cheat menu toggles from the original game

Changed paths:
    engines/ultima/ultima8/gumps/game_map_gump.cpp
    engines/ultima/ultima8/gumps/game_map_gump.h
    engines/ultima/ultima8/misc/debugger.cpp
    engines/ultima/ultima8/misc/debugger.h
    engines/ultima/ultima8/world/item_sorter.cpp
    engines/ultima/ultima8/world/item_sorter.h


diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 717fd460baa..648f4ca57b2 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -42,6 +42,7 @@ namespace Ultima8 {
 DEFINE_RUNTIME_CLASSTYPE_CODE(GameMapGump)
 
 bool GameMapGump::_highlightItems = false;
+bool GameMapGump::_showFootpads = false;
 
 GameMapGump::GameMapGump() :
 	Gump(), _displayDragging(false), _displayList(0), _draggingShape(0),
@@ -167,7 +168,7 @@ void GameMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 	}
 
 
-	_displayList->PaintDisplayList(surf, _highlightItems);
+	_displayList->PaintDisplayList(surf, _highlightItems, _showFootpads);
 }
 
 // Trace a click, and return ObjId
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.h b/engines/ultima/ultima8/gumps/game_map_gump.h
index a7185272ec4..4c53d9896a1 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.h
+++ b/engines/ultima/ultima8/gumps/game_map_gump.h
@@ -85,6 +85,9 @@ public:
 	static bool is_highlightItems() {
 		return _highlightItems;
 	}
+	static void toggleFootpads() {
+		_showFootpads = !_showFootpads;
+	}
 
 	void        RenderSurfaceChanged() override;
 
@@ -96,6 +99,7 @@ protected:
 	int32 _draggingPos[3];
 
 	static bool _highlightItems;
+	static bool _showFootpads;
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 017f64f974e..819f78560b4 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -135,6 +135,7 @@ Debugger::Debugger() : GUI::Debugger() {
 	registerCmd("GameMapGump::startHighlightItems", WRAP_METHOD(Debugger, cmdStartHighlightItems));
 	registerCmd("GameMapGump::stopHighlightItems", WRAP_METHOD(Debugger, cmdStopHighlightItems));
 	registerCmd("GameMapGump::toggleHighlightItems", WRAP_METHOD(Debugger, cmdToggleHighlightItems));
+	registerCmd("GameMapGump::toggleFootpads", WRAP_METHOD(Debugger, cmdToggleFootpads));
 	registerCmd("GameMapGump::dumpMap", WRAP_METHOD(Debugger, cmdDumpMap));
 	registerCmd("GameMapGump::dumpAllMaps", WRAP_METHOD(Debugger, cmdDumpAllMaps));
 	registerCmd("GameMapGump::incrementSortOrder", WRAP_METHOD(Debugger, cmdIncrementSortOrder));
@@ -666,6 +667,11 @@ bool Debugger::cmdToggleHighlightItems(int argc, const char **argv) {
 	return false;
 }
 
+bool Debugger::cmdToggleFootpads(int argc, const char **argv) {
+	GameMapGump::toggleFootpads();
+	return false;
+}
+
 void Debugger::dumpCurrentMap() {
 	// Increase number of available object IDs.
 	ObjectManager::get_instance()->allow64kObjects();
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 86d543d9edd..a76f14f1da7 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -108,6 +108,7 @@ private:
 	bool cmdStartHighlightItems(int argc, const char **argv);
 	bool cmdStopHighlightItems(int argc, const char **argv);
 	bool cmdToggleHighlightItems(int argc, const char **argv);
+	bool cmdToggleFootpads(int argc, const char **argv);
 	bool cmdDumpMap(int argc, const char **argvv);
 	bool cmdDumpAllMaps(int argc, const char **argv);
 	bool cmdIncrementSortOrder(int argc, const char **argv);
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index c80e3fdcfd8..9857f1306ab 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -279,7 +279,7 @@ void ItemSorter::AddItem(const Item *add) {
 			add->getFlags(), add->getExtFlags(), add->getObjId());
 }
 
-void ItemSorter::PaintDisplayList(RenderSurface *surf, bool item_highlight) {
+void ItemSorter::PaintDisplayList(RenderSurface *surf, bool item_highlight, bool showFootpads) {
 	if (_sortLimit) {
 		// Clear the surface when debugging the sorter
 		uint32 color = TEX32_PACK_RGB(0, 0, 0);
@@ -365,7 +365,9 @@ void ItemSorter::PaintDisplayList(RenderSurface *surf, bool item_highlight) {
 	SortItem *end = nullptr;
 	_painted = nullptr;  // Reset the paint tracking
 	while (it != end) {
-		if (it->_order == -1) if (PaintSortItem(surf, it)) return;
+		if (it->_order == -1)
+			if (PaintSortItem(surf, it, showFootpads))
+				return;
 		it = it->_next;
 	}
 
@@ -393,7 +395,7 @@ void ItemSorter::PaintDisplayList(RenderSurface *surf, bool item_highlight) {
  * Recursively paint this item and all its dependencies.
  * Returns true if recursion should stop.
  */
-bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si) {
+bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si, bool showFootpad) {
 	// Don't paint this, or dependencies (yet) if occluded
 	if (si->_occluded)
 		return false;
@@ -411,7 +413,7 @@ bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si) {
 			break;
 		}
 		else if ((*it)->_order == -1) {
-			if (PaintSortItem(surf, *it))
+			if (PaintSortItem(surf, *it, showFootpad))
 				return true;
 		}
 		++it;
@@ -419,8 +421,6 @@ bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si) {
 
 	// Now paint us!
 	if (surf) {
-		//	if (wire) si->info->draw_box_back(s, dispx, dispy, 255);
-
 		if (si->_extFlags & Item::EXT_HIGHLIGHT && si->_extFlags & Item::EXT_TRANSPARENT)
 			surf->PaintHighlightInvis(si->_shape, si->_frame, si->_sxBot, si->_syBot, si->_trans, (si->_flags & Item::FLG_FLIPPED) != 0, TRANSPARENT_COLOR);
 		if (si->_extFlags & Item::EXT_HIGHLIGHT)
@@ -432,7 +432,28 @@ bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si) {
 		else
 			surf->Paint(si->_shape, si->_frame, si->_sxBot, si->_syBot, (si->_flags & Item::FLG_FLIPPED) != 0);
 
-	//	if (wire) si->info->draw_box_front(s, dispx, dispy, 255);
+		// Draw wire frame footpads
+		if (showFootpad) {
+			uint32 color = TEX32_PACK_RGB(0xFF, 0xFF, 0xFF);
+			int32 syLeftTop = (si->_xLeft + si->_y) / 8 - si->_zTop - _camSy;
+			int32 syRightTop = (si->_x + si->_yFar) / 8 - si->_zTop - _camSy;
+			int32 syNearTop = (si->_x + si->_y) / 8 - si->_zTop - _camSy;
+
+			surf->drawLine32(color, si->_sxTop, si->_syTop, si->_sxLeft, syLeftTop);
+			surf->drawLine32(color, si->_sxTop, si->_syTop, si->_sxRight, syRightTop);
+			surf->drawLine32(color, si->_sxBot, syNearTop, si->_sxLeft, syLeftTop);
+			surf->drawLine32(color, si->_sxBot, syNearTop, si->_sxRight, syRightTop);
+
+			if (si->_z < si->_zTop) {
+				int32 syLeftBot = (si->_xLeft + si->_y) / 8 - si->_z - _camSy;
+				int32 syRightBot = (si->_x + si->_yFar) / 8 - si->_z - _camSy;
+				surf->drawLine32(color, si->_sxLeft, syLeftTop, si->_sxLeft, syLeftBot);
+				surf->drawLine32(color, si->_sxRight, syRightTop, si->_sxRight, syRightBot);
+				surf->drawLine32(color, si->_sxBot, syNearTop, si->_sxBot, si->_syBot);
+				surf->drawLine32(color, si->_sxLeft, syLeftBot, si->_sxBot, si->_syBot);
+				surf->drawLine32(color, si->_sxRight, syRightBot, si->_sxBot, si->_syBot);
+			}
+		}
 
 		// weapon overlay
 		// FIXME: use highlight/invisibility, also add to Trace() ?
@@ -479,7 +500,9 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
 		it = _items;
 		_painted = nullptr;
 		while (it != nullptr) {
-			if (it->_order == -1) if (PaintSortItem(nullptr ,it)) break;
+			if (it->_order == -1)
+				if (PaintSortItem(nullptr, it, false))
+					break;
 
 			it = it->_next;
 		}
diff --git a/engines/ultima/ultima8/world/item_sorter.h b/engines/ultima/ultima8/world/item_sorter.h
index 8bc1db47a3a..974892f9ee7 100644
--- a/engines/ultima/ultima8/world/item_sorter.h
+++ b/engines/ultima/ultima8/world/item_sorter.h
@@ -60,7 +60,7 @@ public:
 	void AddItem(const Item *);                   // Add an Item. SetupLerp() MUST have been called
 
 	// Finishes the display list and Paints
-	void PaintDisplayList(RenderSurface *surf, bool item_highlight = false);
+	void PaintDisplayList(RenderSurface *surf, bool item_highlight = false, bool showFootpads = false);
 
 	// Trace and find an object. Returns objid.
 	// If face is non-NULL, also return the face of the 3d bbox (x,y) is on
@@ -69,7 +69,7 @@ public:
 	void IncSortLimit(int count);
 
 private:
-	bool PaintSortItem(RenderSurface *surf, SortItem *si);
+	bool PaintSortItem(RenderSurface *surf, SortItem *si, bool showFootpad);
 };
 
 } // End of namespace Ultima8




More information about the Scummvm-git-logs mailing list