mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Use constant in wram for hidden item flags (#445)
Prevents defining more hidden items than the flag array has room for
This commit is contained in:
parent
d870ad6ea8
commit
5f7b444ae8
5 changed files with 15 additions and 2 deletions
|
@ -215,3 +215,6 @@ DEF NUM_TM_HM EQU NUM_TMS + NUM_HMS
|
||||||
; These fit in 7 bytes, with one unused bit left over.
|
; These fit in 7 bytes, with one unused bit left over.
|
||||||
DEF __tmhm_value__ = NUM_TM_HM + 1
|
DEF __tmhm_value__ = NUM_TM_HM + 1
|
||||||
DEF UNUSED_TMNUM EQU __tmhm_value__
|
DEF UNUSED_TMNUM EQU __tmhm_value__
|
||||||
|
|
||||||
|
DEF MAX_HIDDEN_ITEMS EQU 112
|
||||||
|
DEF MAX_HIDDEN_COINS EQU 16
|
||||||
|
|
|
@ -3,6 +3,7 @@ MACRO hidden_coin
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
HiddenCoinCoords:
|
HiddenCoinCoords:
|
||||||
|
table_width 3, HiddenCoinCoords
|
||||||
; map id, x, y
|
; map id, x, y
|
||||||
hidden_coin GAME_CORNER, 0, 8
|
hidden_coin GAME_CORNER, 0, 8
|
||||||
hidden_coin GAME_CORNER, 1, 16
|
hidden_coin GAME_CORNER, 1, 16
|
||||||
|
@ -16,4 +17,5 @@ HiddenCoinCoords:
|
||||||
hidden_coin GAME_CORNER, 11, 7
|
hidden_coin GAME_CORNER, 11, 7
|
||||||
hidden_coin GAME_CORNER, 15, 8
|
hidden_coin GAME_CORNER, 15, 8
|
||||||
hidden_coin GAME_CORNER, 12, 15
|
hidden_coin GAME_CORNER, 12, 15
|
||||||
|
assert_max_table_length MAX_HIDDEN_COINS
|
||||||
db -1 ; end
|
db -1 ; end
|
||||||
|
|
|
@ -3,6 +3,7 @@ MACRO hidden_item
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
HiddenItemCoords:
|
HiddenItemCoords:
|
||||||
|
table_width 3, HiddenItemCoords
|
||||||
; map id, x, y
|
; map id, x, y
|
||||||
hidden_item VIRIDIAN_FOREST, 1, 18
|
hidden_item VIRIDIAN_FOREST, 1, 18
|
||||||
hidden_item VIRIDIAN_FOREST, 16, 42
|
hidden_item VIRIDIAN_FOREST, 16, 42
|
||||||
|
@ -58,4 +59,5 @@ HiddenItemCoords:
|
||||||
hidden_item VERMILION_CITY, 14, 11
|
hidden_item VERMILION_CITY, 14, 11
|
||||||
hidden_item CERULEAN_CITY, 15, 8
|
hidden_item CERULEAN_CITY, 15, 8
|
||||||
hidden_item ROUTE_4, 40, 3
|
hidden_item ROUTE_4, 40, 3
|
||||||
|
assert_max_table_length MAX_HIDDEN_ITEMS
|
||||||
db -1 ; end
|
db -1 ; end
|
||||||
|
|
|
@ -16,6 +16,12 @@ MACRO assert_table_length
|
||||||
"{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes"
|
"{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes"
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
MACRO assert_max_table_length
|
||||||
|
DEF x = \1
|
||||||
|
ASSERT x * CURRENT_TABLE_WIDTH >= @ - {CURRENT_TABLE_START}, \
|
||||||
|
"{CURRENT_TABLE_START}: expected a maximum of {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes"
|
||||||
|
ENDM
|
||||||
|
|
||||||
MACRO list_start
|
MACRO list_start
|
||||||
DEF list_index = 0
|
DEF list_index = 0
|
||||||
IF _NARG == 1
|
IF _NARG == 1
|
||||||
|
|
|
@ -2042,9 +2042,9 @@ wGameProgressFlagsEnd::
|
||||||
|
|
||||||
ds 56
|
ds 56
|
||||||
|
|
||||||
wObtainedHiddenItemsFlags:: flag_array 112
|
wObtainedHiddenItemsFlags:: flag_array MAX_HIDDEN_ITEMS
|
||||||
|
|
||||||
wObtainedHiddenCoinsFlags:: flag_array 16
|
wObtainedHiddenCoinsFlags:: flag_array MAX_HIDDEN_COINS
|
||||||
|
|
||||||
; $00 = walking
|
; $00 = walking
|
||||||
; $01 = biking
|
; $01 = biking
|
||||||
|
|
Loading…
Reference in a new issue