[Scummvm-git-logs] scummvm master -> e7c1709bb6a596717fbf1429ea5960d9ca6b7f15
sev-
noreply at scummvm.org
Tue Apr 28 17:48:13 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:
e7c1709bb6 DIRECTOR: LINGO: Finished parsing MAP file in MapNavigatorXObj
Commit: e7c1709bb6a596717fbf1429ea5960d9ca6b7f15
https://github.com/scummvm/scummvm/commit/e7c1709bb6a596717fbf1429ea5960d9ca6b7f15
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-28T19:47:47+02:00
Commit Message:
DIRECTOR: LINGO: Finished parsing MAP file in MapNavigatorXObj
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 adbe16aa23a..0f196ca3523 100644
--- a/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
+++ b/engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
@@ -21,6 +21,7 @@
#include "common/system.h"
#include "common/file.h"
+#include "common/memstream.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
@@ -133,14 +134,20 @@ void MapNavigatorXObj::m_new(int nargs) {
MapNavigatorXObject *me = static_cast<MapNavigatorXObject *>(g_lingo->_state->me.u.obj);
me->_filename = g_lingo->pop().asString();
- Common::File in;
+ Common::File file;
- if (!in.open(Common::Path(me->_filename))) {
+ if (!file.open(Common::Path(me->_filename))) {
warning("MapNavigatorXObj::m_new(): Cannot open file %s", me->_filename.c_str());
g_lingo->push(g_lingo->_state->me);
return;
}
+ byte *data = (byte *)calloc(file.size(), 1);
+ file.read(data, file.size());
+
+ Common::MemoryReadStream in(data, file.size(), DisposeAfterUse::YES);
+
+
me->_nodeCount = in.readUint16BE();
me->_hotspotCount = in.readUint16BE();
me->_firstNodeIndex = in.readUint16BE();
@@ -158,11 +165,83 @@ void MapNavigatorXObj::m_new(int nargs) {
if (in.pos() % 2) // align to a word
(void)in.readByte();
- debug(1, "%d: pict: %04x hotspots: %04x unk04: %04x listoff: %04x name: %s", i, n.background_picture, n.hotspot_count, n.unknown_04, n.hotspot_list_offset, n.name.c_str());
-
me->_nodes.push_back(n);
}
+ for (int i = 0; i < me->_nodeCount; i++) {
+ uint32 pos = me->_nodes[i].hotspot_list_offset;
+
+ debug(1, "%d: pict: %04x hotspots: %04x unk04: %04x listoff: %04x name: %s",
+ i, me->_nodes[i].background_picture, me->_nodes[i].hotspot_count, me->_nodes[i].unknown_04,
+ me->_nodes[i].hotspot_list_offset, me->_nodes[i].name.c_str());
+
+ for (int j = 0; j < me->_nodes[i].hotspot_count; j++) {
+ NavHotSpot h;
+
+ in.seek(pos);
+
+ h.record_size = in.readUint16BE();
+ h.left = in.readUint16BE();
+ h.top = in.readUint16BE();
+ h.right = in.readUint16BE();
+ h.bottom = in.readUint16BE();
+ h.cursor_id = in.readUint16BE();
+ h.initially_hidden = in.readByte();
+ h.unknown_0d = in.readByte();
+ h.condition_count = in.readUint16BE();
+ h.evaluation_name = in.readPascalString();
+
+ me->_nodes[i].hotspots.push_back(h);
+
+ debug(1, " %d: size: %04x [%d, %d, %d, %d], cursorId: %d hidden: %d unk: %d condCnt: %d evalName: %s",
+ j, h.record_size, h.left, h.top, h.right, h.bottom, h.cursor_id, h.initially_hidden,
+ h.unknown_0d, h.condition_count, h.evaluation_name.c_str());
+
+ // Reading conditions
+ if (in.pos() % 2) // align to a word
+ (void)in.readByte();
+
+ int pos1 = in.pos();
+
+ for (int k = 0; k < h.condition_count; k++) {
+ NavCondition c;
+
+ in.seek(pos1);
+
+ c.record_size = in.readUint16BE();
+ c.destination_node = in.readUint16BE();
+ c.condition_id = in.readUint16BE();
+ c.instruction_count = in.readUint16BE();
+
+ debug(1, " %d: size: %d destnode: %d condId: %d instCnt: %d", k, c.record_size, c.destination_node,
+ c.condition_id, c.instruction_count);
+
+ me->_nodes[i].hotspots[j].conditions.push_back(c);
+
+ // Reading instructions
+ for (int l = 0; l < c.instruction_count; l++) {
+ NavInstruction ii;
+
+ ii.instruction_type = in.readByte();
+ ii.reserved = in.readByte();;
+ ii.text = in.readPascalString();
+
+ if (in.pos() % 2) // align to a word
+ (void)in.readByte();
+
+ debug(1, " %d: type: %d reserved: %d text: %s", l, ii.instruction_type,
+ ii.reserved, ii.text.c_str());
+
+ me->_nodes[i].hotspots[j].conditions[k].instructions.push_back(ii);
+ }
+
+ pos1 += c.record_size;
+ }
+
+ pos += h.record_size;
+ }
+ }
+
g_lingo->push(g_lingo->_state->me);
}
diff --git a/engines/director/lingo/xlibs/m/mapnavigatorxobj.h b/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
index 54502d8199e..ea8c152b300 100644
--- a/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
+++ b/engines/director/lingo/xlibs/m/mapnavigatorxobj.h
@@ -24,12 +24,43 @@
namespace Director {
+struct NavInstruction {
+ byte instruction_type;
+ byte reserved;
+ Common::String text;
+};
+struct NavCondition {
+ uint16 record_size;
+ uint16 destination_node;
+ uint16 condition_id;
+ uint16 instruction_count;
+
+ Common::Array<NavInstruction> instructions;
+};
+
+struct NavHotSpot {
+ uint16 record_size;
+ int16 left;
+ int16 top;
+ int16 right;
+ int16 bottom;
+ uint16 cursor_id;
+ byte initially_hidden;
+ byte unknown_0d;
+ uint16 condition_count;
+ Common::String evaluation_name;
+
+ Common::Array<NavCondition> conditions;
+};
+
struct NavNode {
- int16 background_picture;
- int16 hotspot_count;
- int16 unknown_04;
- int16 hotspot_list_offset;
+ uint16 background_picture;
+ uint16 hotspot_count;
+ uint16 unknown_04;
+ uint16 hotspot_list_offset;
Common::String name;
+
+ Common::Array<NavHotSpot> hotspots;
};
class MapNavigatorXObject : public Object<MapNavigatorXObject> {
More information about the Scummvm-git-logs
mailing list