Closed LinusU closed 10 months ago
Good start! How about using this PR to expand wram_constants.asm to define more of the bit flags? IMO it's easier to deal with than lots of small PRs.
Good start!
Thanks!
How about using this PR to expand wram_constants.asm to define more of the bit flags? IMO it's easier to deal with than lots of small PRs.
Unfortunately, this is not something I have time with now. I submitted the changes I had now since I'm working on another project that lead me to investigate how wMapConnections
worked, and made the change locally.
Do we know where these wMapConnections bits are being set? Curious if there are other places where we can use these new constants.
Edit: if we are not sure I can spend some time on it.
if we are not sure I can spend some time on it.
Please, feel free to! 🙏
Do we know where these wMapConnections bits are being set? Curious if there are other places where we can use these new constants.
Edit: if we are not sure I can spend some time on it.
wMapConnections bits are being loaded directly from the data/maps/headers/<MAPNAME>.asm
files. Specifically the map_header
macros.
See the following change suggestions:
Everything from wCurMapTileset to wMapConnections should be grouped together and some of the constants should be renamed... Something like:
wCurMapHeader::
wCurMapTileset:: db
wCurMapHeight:: db
wCurMapWidth:: db
wCurMapDataPtr:: dw
wCurMapTextPtr:: dw
wCurMapScriptPtr:: dw
wCurMapConnections:: db
wCurMapHeaderEnd::
wNorthConnectionHeader:: map_connection_struct wNorth
wSouthConnectionHeader:: map_connection_struct wSouth
wWestConnectionHeader:: map_connection_struct wWest
wEastConnectionHeader:: map_connection_struct wEast
The above should then be changed to:
ld a, [hli]
ld h, [hl]
ld l, a ; hl = base of map header
ld de, wCurMapHeader
ld c, wCurMapHeaderEnd - wCurMapHeader
So these are actually the same values as the EAST/WEST/SOUTH/NORTH
constants, but bits instead of shifted values. pokecrystal declares them together in map_data_constants.asm; I think pokered should do the same.
; connection directions
const_def
const EAST_F
const WEST_F
const SOUTH_F
const NORTH_F
; wMapConnections
const_def
shift_const EAST
shift_const WEST
shift_const SOUTH
shift_const NORTH
This would also be the start of porting pokecrystal's *_F
convention for bitflag constants.
@Rangi42 fixed ✅