From 25e12c9391878f474a9139950298a2ddc964ba0a Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 26 Dec 2022 12:14:10 -0600 Subject: [PATCH] wUnlockedUnowns engine_flag constants (#1025) --- constants/wram_constants.asm | 8 ++++++++ data/events/engine_flags.asm | 8 ++++---- data/wild/unlocked_unowns.asm | 13 +++++++------ engine/battle/core.asm | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 6cd206a8c..9a80a8c9d 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -310,3 +310,11 @@ DEF DAYCAREMAN_ACTIVE_F EQU 7 ; 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 diff --git a/data/events/engine_flags.asm b/data/events/engine_flags.asm index a5e435b55..e579a82c7 100644 --- a/data/events/engine_flags.asm +++ b/data/events/engine_flags.asm @@ -63,10 +63,10 @@ EngineFlags: 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 diff --git a/data/wild/unlocked_unowns.asm b/data/wild/unlocked_unowns.asm index 8e38581ef..4c0d83842 100644 --- a/data/wild/unlocked_unowns.asm +++ b/data/wild/unlocked_unowns.asm @@ -7,12 +7,13 @@ endr 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 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 739ad4f13..7d46f22c0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6476,7 +6476,7 @@ CheckUnownLetter: 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