[Scummvm-git-logs] scummvm master -> 697c58e889c78ca7f759fb77ddfc13f2129d8d1a
sev-
noreply at scummvm.org
Wed Apr 29 16:51:41 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:
697c58e889 DIRECTOR: LINGO: Further work on MapNavigatorXObj methods
Commit: 697c58e889c78ca7f759fb77ddfc13f2129d8d1a
https://github.com/scummvm/scummvm/commit/697c58e889c78ca7f759fb77ddfc13f2129d8d1a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-29T18:51:20+02:00
Commit Message:
DIRECTOR: LINGO: Further work on MapNavigatorXObj methods
Changed paths:
engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
engines/director/lingo/xlibs/m/mapnavigatorxobj.h
diff --git a/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp b/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
index b05eabbde56..e58a9c3c9a4 100644
--- a/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
+++ b/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
@@ -131,10 +131,9 @@ void MapNavigatorXObj::close(ObjectType type) {
}
void mapnav_initialize_hidden_flags(MapNavigatorXObject *me) {
- int n = 0;
for (int i = 0; i < me->_nodeCount; i++) {
for (int j = 0; j < me->_nodes[i].hotspot_count; j++) {
- me->_hiddenFlags[n++] = me->_nodes[i].hotspots[j].initially_hidden;
+ me->_nodes[i].hotspots[j].isHidden = me->_nodes[i].hotspots[j].initially_hidden;
}
}
}
@@ -252,30 +251,30 @@ void MapNavigatorXObj::m_new(int nargs) {
}
}
- me->_hiddenFlags.resize(me->_hotspotCount);
-
mapnav_initialize_hidden_flags(me);
g_lingo->push(g_lingo->_state->me);
}
-void MapNavigatorXObj::m_resetHidden(int nargs) {
+XOBJSTUBNR(MapNavigatorXObj::m_dispose)
+
+void MapNavigatorXObj::m_getFirstNode(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
- mapnav_initialize_hidden_flags(me);
+ g_lingo->push(me->_firstNodeIndex + 1); // Lingo node indices are 1-based
}
-void MapNavigatorXObj::m_getFirstNode(int nargs) {
+void MapNavigatorXObj::m_resetHidden(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
- g_lingo->push(me->_firstNodeIndex + 1); // Lingo node indices are 1-based
+ mapnav_initialize_hidden_flags(me);
}
void MapNavigatorXObj::m_getNodeName(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
Common::String nodeName = "";
- int16 nodeIndex = g_lingo->pop().asInt();
+ int nodeIndex = g_lingo->pop().asInt() - 1; // Lingo node indices are 1-based
if (nodeIndex >= 0 && nodeIndex < me->_nodeCount) {
nodeName = me->_nodes[nodeIndex].name;
@@ -286,11 +285,28 @@ void MapNavigatorXObj::m_getNodeName(int nargs) {
g_lingo->push(nodeName);
}
+void MapNavigatorXObj::m_getNodeIndex(int nargs) {
+ MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
+
+ Common::String nodeName = g_lingo->pop().asString();
+
+ // The originakl used binary search since the node names were sorted. We ignore that
+ for (int i = 0; i < me->_nodeCount; i++) {
+ if (me->_nodes[i].name == nodeName) {
+ g_lingo->push(i + 1); // Lingo node indices are 1-based
+ return;
+ }
+ }
+ warning("MapNavigatorXObj::m_getNodeIndex: Node name '%s' not found", nodeName.c_str());
+
+ g_lingo->push(0);
+}
+
void MapNavigatorXObj::m_getBackgroundPicture(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
int result = 0;
- int16 nodeIndex = g_lingo->pop().asInt();
+ int nodeIndex = g_lingo->pop().asInt() - 1; // Lingo node indices are 1-based
if (nodeIndex >= 0 && nodeIndex < me->_nodeCount) {
result = me->_nodes[nodeIndex].background_picture;
@@ -305,7 +321,7 @@ void MapNavigatorXObj::m_getHotSpotCount(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
int result = 0;
- int16 nodeIndex = g_lingo->pop().asInt();
+ int nodeIndex = g_lingo->pop().asInt() - 1; // Lingo node indices are 1-based
if (nodeIndex >= 0 && nodeIndex < me->_nodeCount) {
result = me->_nodes[nodeIndex].hotspot_count;
@@ -316,10 +332,27 @@ void MapNavigatorXObj::m_getHotSpotCount(int nargs) {
g_lingo->push(result);
}
+void MapNavigatorXObj::m_setHidden(int nargs) {
+ MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
+
+ Common::String nodeName = "";
+ int flag = g_lingo->pop().asInt();
+ int hotspotIndex = g_lingo->pop().asInt() - 1; // Lingo hotspot indices are 1-based
+ int nodeIndex = g_lingo->pop().asInt() - 1; // Lingo node indices are 1-based
+
+ if (nodeIndex < 0 || nodeIndex >= me->_nodeCount) {
+ warning("MapNavigatorXObj::m_setHidden: Invalid node index %d", nodeIndex);
+ return;
+ }
+
+ if (hotspotIndex < 0 || hotspotIndex >= me->_nodes[nodeIndex].hotspot_count) {
+ warning("MapNavigatorXObj::m_setHidden: Invalid hotspot index %d for node %d", hotspotIndex, nodeIndex);
+ return;
+ }
+
+ me->_nodes[nodeIndex].hotspots[hotspotIndex].isHidden = flag ? true : false;
+}
-XOBJSTUBNR(MapNavigatorXObj::m_dispose)
-XOBJSTUB(MapNavigatorXObj::m_getNodeIndex, 0)
-XOBJSTUBNR(MapNavigatorXObj::m_setHidden)
XOBJSTUB(MapNavigatorXObj::m_getHidden, 0)
XOBJSTUB(MapNavigatorXObj::m_pointInside, 0)
XOBJSTUB(MapNavigatorXObj::m_getHotSpotRect, "")
diff --git a/engines/director/lingo/xlibs/m/mapnavigatorxobj.h b/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
index 6f4f1576e94..b95ffe95d05 100644
--- a/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
+++ b/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
@@ -50,6 +50,8 @@ struct NavHotSpot {
uint16 condition_count;
Common::String evaluation_name;
+ bool isHidden; // Not part of the original data, used to track current hidden state in ScummVM
+
Common::Array<NavCondition> conditions;
};
@@ -72,7 +74,6 @@ public:
int16 _hotspotCount;
int16 _firstNodeIndex;
Common::Array<NavNode> _nodes;
- Common::Array<byte> _hiddenFlags;
};
namespace MapNavigatorXObj {
More information about the Scummvm-git-logs
mailing list