ref: 25e12c9391878f474a9139950298a2ddc964ba0a
parent: f739f8b1acd3d381015192636600bd3b38bdf28f
author: vulcandth <vulcandth@gmail.com>
date: Mon Dec 26 07:14:10 EST 2022
wUnlockedUnowns engine_flag constants (#1025)
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -310,3 +310,11 @@
; wDayCareLady::
DEF DAYCARELADY_HAS_MON_F EQU 0
DEF DAYCARELADY_ACTIVE_F EQU 7
+
+; wUnlockedUnowns::
+ const_def
+ const UNLOCKED_UNOWNS_A_TO_K_F
+ const UNLOCKED_UNOWNS_L_TO_R_F
+ const UNLOCKED_UNOWNS_S_TO_W_F
+ const UNLOCKED_UNOWNS_X_TO_Z_F
+DEF NUM_UNLOCKED_UNOWN_SETS EQU const_value
--- a/data/events/engine_flags.asm
+++ b/data/events/engine_flags.asm
@@ -63,10 +63,10 @@
engine_flag wKantoBadges, EARTHBADGE
; unown sets (see data/wild/unlocked_unowns.asm)
- engine_flag wUnlockedUnowns, 0 ; A-K
- engine_flag wUnlockedUnowns, 1 ; L-R
- engine_flag wUnlockedUnowns, 2 ; S-W
- engine_flag wUnlockedUnowns, 3 ; X-Z
+ engine_flag wUnlockedUnowns, UNLOCKED_UNOWNS_A_TO_K_F
+ engine_flag wUnlockedUnowns, UNLOCKED_UNOWNS_L_TO_R_F
+ engine_flag wUnlockedUnowns, UNLOCKED_UNOWNS_S_TO_W_F
+ engine_flag wUnlockedUnowns, UNLOCKED_UNOWNS_X_TO_Z_F
engine_flag wUnlockedUnowns, 4 ; unused
engine_flag wUnlockedUnowns, 5 ; unused
engine_flag wUnlockedUnowns, 6 ; unused
--- a/data/wild/unlocked_unowns.asm
+++ b/data/wild/unlocked_unowns.asm
@@ -7,12 +7,13 @@
ENDM
UnlockedUnownLetterSets:
-; entries correspond to wUnlockedUnowns bits
- dw .Set_A_K ; ENGINE_UNLOCKED_UNOWNS_A_TO_K
- dw .Set_L_R ; ENGINE_UNLOCKED_UNOWNS_L_TO_R
- dw .Set_S_W ; ENGINE_UNLOCKED_UNOWNS_S_TO_W
- dw .Set_X_Z ; ENGINE_UNLOCKED_UNOWNS_X_TO_Z
-.End
+; entries correspond to UNLOCKED_UNOWNS_* constants
+ table_width 2, UnlockedUnownLetterSets
+ dw .Set_A_K ; UNLOCKED_UNOWNS_A_TO_K_F
+ dw .Set_L_R ; UNLOCKED_UNOWNS_L_TO_R_F
+ dw .Set_S_W ; UNLOCKED_UNOWNS_S_TO_W_F
+ dw .Set_X_Z ; UNLOCKED_UNOWNS_X_TO_Z_F
+ assert_table_length NUM_UNLOCKED_UNOWN_SETS
.Set_A_K:
unown_set A, B, C, D, E, F, G, H, I, J, K
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6476,7 +6476,7 @@
inc e
inc e
ld a, e
- cp UnlockedUnownLetterSets.End - UnlockedUnownLetterSets
+ cp NUM_UNLOCKED_UNOWN_SETS * 2
jr c, .loop
; Hasn't been unlocked, or the letter is invalid