Jump to content

Collision map file: Difference between revisions

Tile data: add tilemap offset
NavMesh changes in Boktai 2/3
Line 126: Line 126:


= Navigation mesh =
= Navigation mesh =
'''TODO''': This description is for Boktai 1 only. The navigation mesh data (may?) have changed in Boktai 2.


The navigation mesh is used to guide NPCs between arbitrary points on the map. A navigation mesh contains three data structures:
The navigation mesh is used to guide NPCs between arbitrary points on the map. A navigation mesh contains three data structures:
Line 139: Line 137:


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
// Note: This is for Boktai 1. See below for changes in Boktai 2/3.
struct NavMesh {
struct NavMesh {
   // Number of elements in the rects array
   // Number of elements in the rects array
Line 145: Line 145:
   /* offset 0x04*/ u16 countDistanceMap;
   /* offset 0x04*/ u16 countDistanceMap;


   // Byte offset from start of this struct to the rects array
   // The following offsets are byte offsets from the start of this struct.
   /* offset 0x08*/ u32 offsetToRects;
   /* offset 0x08*/ u32 offsetToRects;
   /* offset 0x0c*/ u32 offsetToPortals;
   /* offset 0x0c*/ u32 offsetToPortals;
Line 205: Line 205:
   return distanceMap[index];
   return distanceMap[index];
}
}
</syntaxhighlight>
== Changes in Boktai 2/3 ==
The navigation mesh format is slightly different in Boktai 2/3. The core concepts remain the same, but the navigation mesh is now subdivided into independent "islands", where each island is unreachable from all other islands. For example, a map with 1 room would have 1 island, while a complicated indoor map with multiple rooms would have one island per room. NavRect and NavPortal numbering starts from 0 inside of every island.
This implies that the distanceMap array in each islands must not contain any 0xffff (unreachable) entries.
<syntaxhighlight lang="c">
struct NavMesh_V2 {
  /* offset 0x00 */ countIslands;
  // Byte offsets from start of this struct to each island
  /* offset 0x04 */ islandOffsets[countIslands];
  NavIsland islands[];
};
struct NavIsland {
  // (exactly the same fields as the Boktai 1 NavMesh.)
};
</syntaxhighlight>
</syntaxhighlight>