You are not logged in.
Pages: 1
Here's a fun bug that we're going to fix.
What's the bug?
Map connections between two maps that have dungeon Tileset Ids are broken. Dungeon tilesets are defined in data/dungeon_tilesets.asm (https://github.com/iimarckus/pokered/bl … lesets.asm). For example, Mt. Moon's maps are dungeon maps because they use the Cave tileset. Therefore, if you want to make a cave that uses map connections, it won't work unless you make the fixes outlined below.
How do we fix it?
The LoadTilesetHeader routine is responsible for corrupting the connection data for dungeon maps. I chose to fix this problem by making a list of dungeon maps that are allowed to have map connections. Then, the LoadTilesetHeader looks to see if the current map is in that list. If it is, then it doesn't perform the usual dungeon work. The reason I chose not to allow all dungeon maps to have map connections is because there might be some unknown side effects of this particular solution. For example, it seems like this should break map-edge warps, but that wasn't the case for the maps I tested this with.
Here's the part of LoadTilesetHeader that we care about:
ld a, [W_CURMAPTILESET]
push hl
push de
ld hl, DungeonTilesets
ld de, $1
call IsInArray
pop de
pop hl
jr c, .asm_c797
ld a, [W_CURMAPTILESET]
ld b, a
ld a, [$ff8b]
cp b
jr z, .done
.asm_c797
ld a, [wDestinationWarpID]
cp $ff
jr z, .done
call LoadDestinationWarpPosition
ld a, [W_YCOORD]
and $1
ld [W_YBLOCKCOORD], a
ld a, [W_XCOORD]
and $1
ld [W_XBLOCKCOORD], a
.done
ret
First, define that list of dungeon maps allowed to use map connections right after the routine (terminate the list with $FF). I'm using Mt. Moon's maps as an example:
DungeonMapsWithConnections:
db MT_MOON_1, MT_MOON_2, MT_MOON_3, $FF
Then, make the following changes to the LoadTilesetHeader routine:
ld a, [W_CURMAPTILESET]
push hl
push de
ld hl, DungeonTilesets
ld de, $1
call IsInArray
pop de
pop hl
jr c, .asm_c797
.notDungeon
ld a, [W_CURMAPTILESET]
ld b, a
ld a, [$ff8b]
cp b
jr z, .done
jr .handleDungeon
.asm_c797
; check if the current dungeon map allows map connections
ld a, [W_CURMAP]
push hl
push de
ld hl, DungeonMapsWithConnections
ld de, $1
call IsInArray
pop de
pop hl
jr c, .notDungeon
.handleDungeon
ld a, [wDestinationWarpID]
cp $ff
jr z, .done
call LoadDestinationWarpPosition
ld a, [W_YCOORD]
and $1
ld [W_YBLOCKCOORD], a
ld a, [W_XCOORD]
and $1
ld [W_XBLOCKCOORD], a
.done
ret
Last edited by ShantyTown (2015-02-27 06:47:02)
My hacks: Pokémon Maize, Pokémon Red: Battle Factory
Offline
Pages: 1