fix(game): trigger warps by their tile behaviour (#93)

* fix(game): use the npc's own region for map and sprite lookups

* fix(game): trigger warps by their tile behaviour

* fix(game): classify every warp metatile behaviour the decomp accepts
This commit is contained in:
Fiereu authored and GitHub committed 2026-08-07 10:57:17 +02:00
1 parent 9866c1b0fb
commit 14fbc05bab
6 files changed
+177 -24

No files matched your search

@@ -83,7 +83,8 @@ private constructor(
)
}
// Only the behaviors we act on are mapped, everything else stays NORMAL.
// Only the behaviors we act on are mapped, everything else stays NORMAL. The two games give
// the same tile different names, so this matches on names and not on numbers.
private fun classify(name: String): TileBehavior? =
when (name) {
"MB_TALL_GRASS" -> TileBehavior.TALL_GRASS
@@ -92,6 +93,36 @@ private constructor(
"MB_JUMP_WEST" -> TileBehavior.JUMP_WEST
"MB_JUMP_NORTH" -> TileBehavior.JUMP_NORTH
"MB_JUMP_SOUTH" -> TileBehavior.JUMP_SOUTH
// The only door the decomp opens with TryDoorWarp.
"MB_ANIMATED_DOOR",
"MB_WARP_DOOR" -> TileBehavior.DOOR
"MB_NON_ANIMATED_DOOR",
"MB_WATER_DOOR",
"MB_CAVE_DOOR" -> TileBehavior.NON_ANIMATED_DOOR
// The rest of what the decomp's IsWarpMetatileBehavior accepts, in both games.
"MB_LADDER",
"MB_UP_ESCALATOR",
"MB_DOWN_ESCALATOR",
"MB_REGULAR_WARP",
"MB_FALL_WARP",
"MB_DEEP_SOUTH_WARP",
"MB_UNION_ROOM_WARP",
"MB_BRIDGE_OVER_OCEAN",
"MB_LAVARIDGE_GYM_B1F_WARP",
"MB_LAVARIDGE_GYM_1F_WARP",
"MB_LAVARIDGE_1F_WARP",
"MB_AQUA_HIDEOUT_WARP",
"MB_MT_PYRE_HOLE",
"MB_MOSSDEEP_GYM_WARP" -> TileBehavior.LADDER
"MB_UP_RIGHT_STAIR_WARP",
"MB_DOWN_RIGHT_STAIR_WARP" -> TileBehavior.STAIR_WARP_EAST
"MB_UP_LEFT_STAIR_WARP",
"MB_DOWN_LEFT_STAIR_WARP" -> TileBehavior.STAIR_WARP_WEST
"MB_NORTH_ARROW_WARP" -> TileBehavior.NORTH_ARROW_WARP
"MB_SOUTH_ARROW_WARP",
"MB_WATER_SOUTH_ARROW_WARP" -> TileBehavior.SOUTH_ARROW_WARP
"MB_EAST_ARROW_WARP" -> TileBehavior.EAST_ARROW_WARP
"MB_WEST_ARROW_WARP" -> TileBehavior.WEST_ARROW_WARP
else -> null
}