Jump to content

Collision map file: Difference between revisions

Navigation meshes
Tile data: notes on effects
 
(4 intermediate revisions by the same user not shown)
Line 30: Line 30:
   u16 width;
   u16 width;
   u16 height;
   u16 height;
   u32 unknown_2;
   // pixel position of tilemap on the collision map (for camera)
  i16 tilemap_offset_x;
  i16 tilemap_offset_y;
   tile[height*width] tiles;
   tile[height*width] tiles;
};
};
Line 42: Line 44:


// Bitmask, multiple effects per tile are supported
// Bitmask, multiple effects per tile are supported
// NOTE #1: This list is for Boktai 1 - Boktai 2/3 use a different list.
// NOTE #2: At least in Boktai 2, it may even differ per dungeon.
enum tile_effects : u16 {
enum tile_effects : u16 {
   wall = 0x0002,    // an always inaccessible tile
   wall = 0x0002,    // an always inaccessible tile
Line 124: Line 128:


= 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 137: Line 139:


<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 143: Line 147:
   /* 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 203: Line 207:
   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 island must not contain any 0xffff (unreachable) entries.
<syntaxhighlight lang="c">
struct NavMesh_V2 {
  /* offset 0x00 */ u32 countIslands;
  // Byte offsets from start of this struct to each island
  /* offset 0x04 */ u32 islandOffsets[countIslands];
  NavIsland islands[];
};
struct NavIsland {
  // (exactly the same fields as the Boktai 1 NavMesh.)
};
</syntaxhighlight>
</syntaxhighlight>


= See also =
= See also =
* [[Collision map files (Boktai 1)]]
* [[Collision map files (Boktai 1)]]
* [[Collision map files (Boktai 2)]]


[[Category:Documentation]] [[Category:File formats]]
[[Category:Documentation]] [[Category:File formats]]
[[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]]
[[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]]