From e90e3458cb0836a5a027b4ed59fd05f34f904bcf Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 15 Feb 2019 18:24:55 -0500 Subject: [PATCH] Document the regi* code more Fixed some confusing naming, named some unknown symbols, and fixed the names of some flags. --- data/field_effect_scripts.s | 17 +++- data/maps/AncientTomb/scripts.inc | 4 +- data/maps/DesertRuins/scripts.inc | 4 +- data/maps/IslandCave/scripts.inc | 14 ++-- data/specials.inc | 2 +- include/braille_puzzles.h | 8 +- include/constants/field_effects.h | 2 +- include/constants/flags.h | 6 +- include/constants/vars.h | 6 +- src/braille_puzzles.c | 125 +++++++++++++++--------------- src/fldeff_flash.c | 6 +- src/fldeff_rocksmash.c | 6 +- 12 files changed, 110 insertions(+), 90 deletions(-) diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 93fe33f8a..2edf13661 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -10,66 +10,79 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_UseCutOnTree .4byte gFieldEffectScript_Shadow .4byte gFieldEffectScript_TallGrass + .4byte gFieldEffectScript_Ripple .4byte gFieldEffectScript_FieldMoveShowMon .4byte gFieldEffectScript_Ash .4byte gFieldEffectScript_SurfBlob .4byte gFieldEffectScript_UseSurf + .4byte gFieldEffectScript_GroundImpactDust .4byte gFieldEffectScript_Unknown11 .4byte gFieldEffectScript_BikeHopTallGrass .4byte gFieldEffectScript_SandFootprints .4byte gFieldEffectScript_BikeHopBigSplash + .4byte gFieldEffectScript_Splash .4byte gFieldEffectScript_BikeHopSmallSplash .4byte gFieldEffectScript_LongGrass .4byte gFieldEffectScript_Unknown18 .4byte gFieldEffectScript_Unknown19 + .4byte gFieldEffectScript_Unknown20 .4byte gFieldEffectScript_Unknown21 .4byte gFieldEffectScript_Unknown22 .4byte gFieldEffectScript_BerryTreeGrowthSparkle .4byte gFieldEffectScript_DeepSandFootprints + .4byte gFieldEffectScript_Unknown25 .4byte gFieldEffectScript_Unknown26 .4byte gFieldEffectScript_Unknown27 .4byte gFieldEffectScript_TreeDisguise .4byte gFieldEffectScript_MountainDisguise + .4byte gFieldEffectScript_Unknown30 .4byte gFieldEffectScript_UseFly .4byte gFieldEffectScript_FlyIn .4byte gFieldEffectScript_QuestionMarkIcon .4byte gFieldEffectScript_FeetInFlowingWater + .4byte gFieldEffectScript_BikeTireTracks .4byte gFieldEffectScript_SandDisguisePlaceholder .4byte gFieldEffectScript_UseRockSmash .4byte gFieldEffectScript_Unknown38 .4byte gFieldEffectScript_Unknown39 + .4byte gFieldEffectScript_Unknown40 .4byte gFieldEffectScript_ShortGrass .4byte gFieldEffectScript_HotSpringsWater .4byte gFieldEffectScript_Unknown43 .4byte gFieldEffectScript_Unknown44 + .4byte gFieldEffectScript_Unknown45 .4byte gFieldEffectScript_HeartIcon .4byte gFieldEffectScript_Unknown47 .4byte gFieldEffectScript_Unknown48 .4byte gFieldEffectScript_JumpOutOfAsh + .4byte gFieldEffectScript_Unknown50 .4byte gFieldEffectScript_Unknown51 .4byte gFieldEffectScript_Unknown52 .4byte gFieldEffectScript_Bubbles .4byte gFieldEffectScript_Unknown54 + .4byte gFieldEffectScript_Unknown55 .4byte gFieldEffectScript_Unknown56 .4byte gFieldEffectScript_Unknown57 .4byte gFieldEffectScript_Unknown58 .4byte gFieldEffectScript_FieldMoveShowMonInit - .4byte gFieldEffectScript_Unknown60 + + .4byte gFieldEffectScript_UsePuzzleEffect .4byte gFieldEffectScript_Unknown61 .4byte gFieldEffectScript_Unknown62 .4byte gFieldEffectScript_Unknown63 .4byte gFieldEffectScript_Rayquaza + .4byte gFieldEffectScript_Unknown65 .4byte gFieldEffectScript_Unknown66 @@ -315,7 +328,7 @@ gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC field_eff_callnative FldEff_FieldMoveShowMonInit field_eff_end -gFieldEffectScript_Unknown60:: @ 82DBCD2 +gFieldEffectScript_UsePuzzleEffect:: @ 82DBCD2 field_eff_callnative FldEff_UsePuzzleEffect field_eff_end diff --git a/data/maps/AncientTomb/scripts.inc b/data/maps/AncientTomb/scripts.inc index 45bb9e007..7e9b027b2 100644 --- a/data/maps/AncientTomb/scripts.inc +++ b/data/maps/AncientTomb/scripts.inc @@ -25,7 +25,7 @@ AncientTomb_EventScript_238FEE:: @ 8238FEE return AncientTomb_MapScript1_238FF2: @ 8238FF2 - call_if_unset FLAG_SYS_BRAILLE_FLY, AncientTomb_EventScript_238FFC + call_if_unset FLAG_SYS_BRAILLE_REGISTEEL_HM, AncientTomb_EventScript_238FFC end AncientTomb_EventScript_238FFC:: @ 8238FFC @@ -39,7 +39,7 @@ AncientTomb_EventScript_238FFC:: @ 8238FFC AncientTomb_EventScript_239033:: @ 8239033 lockall - goto_if_set FLAG_SYS_BRAILLE_FLY, AncientTomb_EventScript_239046 + goto_if_set FLAG_SYS_BRAILLE_REGISTEEL_HM, AncientTomb_EventScript_239046 braillemessage AncientTomb_Braille_2A6D06 waitbuttonpress hidebox2 diff --git a/data/maps/DesertRuins/scripts.inc b/data/maps/DesertRuins/scripts.inc index 62828e971..ff58b3ba5 100644 --- a/data/maps/DesertRuins/scripts.inc +++ b/data/maps/DesertRuins/scripts.inc @@ -16,7 +16,7 @@ DesertRuins_EventScript_22D975:: @ 822D975 return DesertRuins_MapScript1_22D989: @ 822D989 - call_if_unset FLAG_SYS_BRAILLE_STRENGTH, DesertRuins_EventScript_22D993 + call_if_unset FLAG_SYS_BRAILLE_REGIROCK_HM, DesertRuins_EventScript_22D993 end DesertRuins_EventScript_22D993:: @ 822D993 @@ -39,7 +39,7 @@ DesertRuins_EventScript_22D9D7:: @ 822D9D7 DesertRuins_EventScript_22D9DB:: @ 822D9DB lockall - goto_if_set FLAG_SYS_BRAILLE_STRENGTH, DesertRuins_EventScript_22D9EE + goto_if_set FLAG_SYS_BRAILLE_REGIROCK_HM, DesertRuins_EventScript_22D9EE braillemessage DesertRuins_Braille_2A6CA0 waitbuttonpress hidebox2 diff --git a/data/maps/IslandCave/scripts.inc b/data/maps/IslandCave/scripts.inc index 7b551b4a7..3b6d94f0b 100644 --- a/data/maps/IslandCave/scripts.inc +++ b/data/maps/IslandCave/scripts.inc @@ -16,7 +16,7 @@ IslandCave_EventScript_238E44:: @ 8238E44 return IslandCave_MapScript1_238E58: @ 8238E58 - call_if_unset FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238E62 + call_if_unset FLAG_SYS_BRAILLE_REGICE_PUZZLE, IslandCave_EventScript_238E62 end IslandCave_EventScript_238E62:: @ 8238E62 @@ -47,13 +47,13 @@ IslandCave_EventScript_238EAF:: @ 8238EAF setmetatile 9, 20, 564, 1 special DrawWholeMapView playse SE_BAN - setflag FLAG_SYS_BRAILLE_WAIT + setflag FLAG_SYS_BRAILLE_REGICE_PUZZLE end IslandCave_EventScript_238EEF:: @ 8238EEF lockall call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 - goto_if_set FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238F13 + goto_if_set FLAG_SYS_BRAILLE_REGICE_PUZZLE, IslandCave_EventScript_238F13 braillemessage IslandCave_Braille_2A6CD4 setflag FLAG_TEMP_2 special ShouldDoBrailleRegicePuzzle @@ -69,7 +69,7 @@ IslandCave_EventScript_238F1D:: @ 8238F1D lockall call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 braillemessage IslandCave_Braille_2A6CD4 - goto_if_set FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238F41 + goto_if_set FLAG_SYS_BRAILLE_REGICE_PUZZLE, IslandCave_EventScript_238F41 setflag FLAG_TEMP_2 special ShouldDoBrailleRegicePuzzle goto IslandCave_EventScript_238F41 @@ -82,9 +82,9 @@ IslandCave_EventScript_238F41:: @ 8238F41 end IslandCave_EventScript_238F45:: @ 8238F45 - setvar VAR_0x403B, 0 - setvar VAR_0x403C, 0 - setvar VAR_0x403D, 0 + setvar VAR_REGICE_STEPS_1, 0 + setvar VAR_REGICE_STEPS_2, 0 + setvar VAR_REGICE_STEPS_3, 0 clearflag FLAG_TEMP_3 return diff --git a/data/specials.inc b/data/specials.inc index b3ca15ed1..cbbd81dc1 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -291,7 +291,7 @@ gSpecials:: @ 81DBA64 def_special GetPokeblockNameByMonNature def_special GetSecretBaseNearbyMapName def_special CheckRelicanthWailord - def_special ShouldDoBrailleStrengthEffectOld + def_special ShouldDoBrailleRegirockEffectOld def_special sub_80B0534 def_special sub_80B058C def_special WaitWeather diff --git a/include/braille_puzzles.h b/include/braille_puzzles.h index d4c5a24d8..1614c92e1 100644 --- a/include/braille_puzzles.h +++ b/include/braille_puzzles.h @@ -1,11 +1,11 @@ #ifndef GUARD_BRAILLE_PUZZLES_H #define GUARD_BRAILLE_PUZZLES_H -bool8 ShouldDoBrailleFlyEffect(void); -bool8 ShouldDoBrailleStrengthEffect(void); +bool8 ShouldDoBrailleRegisteelEffect(void); +bool8 ShouldDoBrailleRegirockEffect(void); bool8 ShouldDoBrailleDigEffect(void); void DoBrailleDigEffect(void); -void sub_8179918(void); -void sub_8179834(void); +void SetUpPuzzleEffectRegisteel(void); +void SetUpPuzzleEffectRegirock(void); #endif // GUARD_BRAILLE_PUZZLES_H diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index add195df8..282f9ce75 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -61,7 +61,7 @@ #define FLDEFF_SECRET_POWER_SHRUB 57 #define FLDEFF_CUT_GRASS 58 #define FLDEFF_FIELD_MOVE_SHOW_MON_INIT 59 -#define FLDEFF_USE_FLY_ANCIENT_TOMB 60 +#define FLDEFF_USE_TOMB_PUZZLE_EFFECT 60 #define FLDEFF_PCTURN_ON 61 #define FLDEFF_HALL_OF_FAME_RECORD 62 #define FLDEFF_USE_TELEPORT 63 diff --git a/include/constants/flags.h b/include/constants/flags.h index 5082014e7..11a0c849c 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1352,9 +1352,9 @@ #define FLAG_SYS_ENC_UP_ITEM (SYSTEM_FLAGS + 0x4D) #define FLAG_SYS_ENC_DOWN_ITEM (SYSTEM_FLAGS + 0x4E) #define FLAG_SYS_BRAILLE_DIG (SYSTEM_FLAGS + 0x4F) -#define FLAG_SYS_BRAILLE_STRENGTH (SYSTEM_FLAGS + 0x50) -#define FLAG_SYS_BRAILLE_WAIT (SYSTEM_FLAGS + 0x51) -#define FLAG_SYS_BRAILLE_FLY (SYSTEM_FLAGS + 0x52) +#define FLAG_SYS_BRAILLE_REGIROCK_HM (SYSTEM_FLAGS + 0x50) +#define FLAG_SYS_BRAILLE_REGICE_PUZZLE (SYSTEM_FLAGS + 0x51) +#define FLAG_SYS_BRAILLE_REGISTEEL_HM (SYSTEM_FLAGS + 0x52) #define FLAG_SYS_HAS_EON_TICKET (SYSTEM_FLAGS + 0x53) #define FLAG_LANDMARK_POKEMON_LEAGUE (SYSTEM_FLAGS + 0x54) diff --git a/include/constants/vars.h b/include/constants/vars.h index c055c5baf..fedc85657 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -75,9 +75,9 @@ #define VAR_0x4038 0x4038 #define VAR_0x4039 0x4039 #define VAR_0x403A 0x403A -#define VAR_0x403B 0x403B -#define VAR_0x403C 0x403C -#define VAR_0x403D 0x403D +#define VAR_REGICE_STEPS_1 0x403B +#define VAR_REGICE_STEPS_2 0x403C +#define VAR_REGICE_STEPS_3 0x403D #define VAR_ALTERING_CAVE_WILD_SET 0x403E #define VAR_0x403F 0x403F #define VAR_DAYS 0x4040 diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 6be8ba4a4..449c1dfea 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -10,21 +10,20 @@ #include "constants/maps.h" #include "constants/songs.h" #include "constants/species.h" - -extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId); // fieldmap -extern u8 GetCursorSelectionMonId(void); -extern u8 oei_task_add(void); +#include "fieldmap.h" +#include "party_menu.h" +#include "fldeff.h" // why do this, GF? enum { - STRENGTH_PUZZLE, - FLY_PUZZLE + REGIROCK_PUZZLE, + REGISTEEL_PUZZLE }; EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; -static const u8 gUnknown_085EFE74[][2] = +static const u8 gRegicePathCoords[][2] = { {0x04, 0x15}, {0x05, 0x15}, @@ -65,8 +64,8 @@ static const u8 gUnknown_085EFE74[][2] = }; void SealedChamberShakingEffect(u8); -void sub_8179860(void); -void sub_8179944(void); +void DoBrailleRegirockEffect(void); +void DoBrailleRegisteelEffect(void); bool8 ShouldDoBrailleDigEffect(void) { @@ -115,10 +114,10 @@ bool8 CheckRelicanthWailord(void) // THEORY: this was caused by block commenting out all of the older R/S braille functions but leaving the call to it itself, which creates the nullsub. // the code is shown below to show what this might look like. -void ShouldDoBrailleStrengthEffectOld(void) +void ShouldDoBrailleRegirockEffectOld(void) { /* - if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1.location.mapGroup == MAP_GROUP_DESERT_RUINS && gSaveBlock1.location.mapNum == MAP_ID_DESERT_RUINS)) + if (!FlagGet(FLAG_SYS_BRAILLE_REGIROCK_HM) && (gSaveBlock1.location.mapGroup == MAP_GROUP_DESERT_RUINS && gSaveBlock1.location.mapNum == MAP_ID_DESERT_RUINS)) { if (gSaveBlock1.pos.x == 10 && gSaveBlock1.pos.y == 23) return TRUE; @@ -131,7 +130,7 @@ void ShouldDoBrailleStrengthEffectOld(void) return FALSE; } -void DoBrailleStrengthEffect(void) +void DoBrailleRegirockEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH); MapGridSetMetatileIdAt(14, 26, 554); @@ -142,13 +141,13 @@ void DoBrailleStrengthEffect(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_STRENGTH); + FlagSet(FLAG_SYS_BRAILLE_REGIROCK_HM); ScriptContext2_Disable(); } -bool8 ShouldDoBrailleFlyEffect(void) +bool8 ShouldDoBrailleRegisteelEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1.location.mapGroup == MAP_GROUP_ANCIENT_TOMB && gSaveBlock1.location.mapNum == MAP_ID_ANCIENT_TOMB)) + if (!FlagGet(FLAG_SYS_BRAILLE_REGISTEEL_HM) && (gSaveBlock1.location.mapGroup == MAP_GROUP_ANCIENT_TOMB && gSaveBlock1.location.mapNum == MAP_ID_ANCIENT_TOMB)) { if (gSaveBlock1.pos.x == 8 && gSaveBlock1.pos.y == 25) return TRUE; @@ -157,24 +156,24 @@ bool8 ShouldDoBrailleFlyEffect(void) return FALSE; } -void DoBrailleFlyEffect(void) +void DoBrailleRegisteelEffect(void) { gFieldEffectArguments[0] = gLastFieldPokeMenuOpened; - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } bool8 FldEff_UseFlyAncientTomb(void) { u8 taskId = oei_task_add(); - gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; + gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; return FALSE; } -void UseFlyAncientTomb_Callback(void) +void UseRegisteelHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); UseFlyAncientTomb_Finish(); } @@ -188,7 +187,7 @@ void UseFlyAncientTomb_Finish(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_FLY); + FlagSet(FLAG_SYS_BRAILLE_REGISTEEL_HM); ScriptContext2_Disable(); } */ @@ -240,25 +239,25 @@ void SealedChamberShakingEffect(u8 taskId) } // moved later in the function because it was rewritten. -bool8 ShouldDoBrailleStrengthEffect(void) +bool8 ShouldDoBrailleRegirockEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) + if (!FlagGet(FLAG_SYS_BRAILLE_REGIROCK_HM) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(DESERT_RUINS) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS)) { if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } } @@ -266,19 +265,19 @@ bool8 ShouldDoBrailleStrengthEffect(void) return FALSE; } -void sub_8179834(void) +void SetUpPuzzleEffectRegirock(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } -void UseStrengthDesertRuins_Callback(void) +void UseRegirockHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); - sub_8179860(); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); + DoBrailleRegirockEffect(); } -void sub_8179860(void) +void DoBrailleRegirockEffect(void) { MapGridSetMetatileIdAt(14, 26, 554); MapGridSetMetatileIdAt(15, 26, 555); @@ -288,33 +287,36 @@ void sub_8179860(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_STRENGTH); + FlagSet(FLAG_SYS_BRAILLE_REGIROCK_HM); ScriptContext2_Disable(); } -bool8 ShouldDoBrailleFlyEffect(void) +bool8 ShouldDoBrailleRegisteelEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x44)) + if (!FlagGet(FLAG_SYS_BRAILLE_REGISTEEL_HM) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x44)) { if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 25) - { sBraillePuzzleCallbackFlag = FLY_PUZZLE; return TRUE; } + { + sBraillePuzzleCallbackFlag = REGISTEEL_PUZZLE; + return TRUE; + } } return FALSE; } -void sub_8179918(void) +void SetUpPuzzleEffectRegisteel(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } -void UseFlyAncientTomb_Callback(void) +void UseRegisteelHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); - sub_8179944(); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); + DoBrailleRegisteelEffect(); } -void sub_8179944(void) +void DoBrailleRegisteelEffect(void) { MapGridSetMetatileIdAt(14, 26, 554); MapGridSetMetatileIdAt(15, 26, 555); @@ -324,7 +326,7 @@ void sub_8179944(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_FLY); + FlagSet(FLAG_SYS_BRAILLE_REGISTEEL_HM); ScriptContext2_Disable(); } @@ -332,7 +334,7 @@ void sub_8179944(void) void DoBrailleWait(void) { /* - if (!FlagGet(FLAG_SYS_BRAILLE_WAIT)) + if (!FlagGet(FLAG_SYS_BRAILLE_REGICE_PUZZLE)) CreateTask(Task_BrailleWait, 0x50); } @@ -410,15 +412,15 @@ bool8 FldEff_UsePuzzleEffect(void) { u8 taskId = oei_task_add(); - if (sBraillePuzzleCallbackFlag == FLY_PUZZLE) + if (sBraillePuzzleCallbackFlag == REGISTEEL_PUZZLE) { - gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; + gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; } else { - gTasks[taskId].data[8] = (u32)UseStrengthDesertRuins_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseStrengthDesertRuins_Callback; + gTasks[taskId].data[8] = (u32)UseRegirockHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegirockHm_Callback; } return FALSE; } @@ -430,7 +432,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void) if (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x43) { - if (FlagGet(FLAG_SYS_BRAILLE_WAIT) != FALSE) + if (FlagGet(FLAG_SYS_BRAILLE_REGICE_PUZZLE)) return FALSE; if (FlagGet(FLAG_TEMP_2) == FALSE) return FALSE; @@ -439,35 +441,36 @@ bool8 ShouldDoBrailleRegicePuzzle(void) for (i = 0; i < 36; i++) { - u8 xPos = gUnknown_085EFE74[i][0]; - u8 yPos = gUnknown_085EFE74[i][1]; + u8 xPos = gRegicePathCoords[i][0]; + u8 yPos = gRegicePathCoords[i][1]; if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) { u16 varValue; if (i < 16) { - u16 val = VarGet(VAR_0x403B); + u16 val = VarGet(VAR_REGICE_STEPS_1); val |= 1 << i; - VarSet(VAR_0x403B, val); + VarSet(VAR_REGICE_STEPS_1, val); } else if (i < 32) { - u16 val = VarGet(VAR_0x403C); + u16 val = VarGet(VAR_REGICE_STEPS_2); val |= 1 << (i - 16); - VarSet(VAR_0x403C, val); + VarSet(VAR_REGICE_STEPS_2, val); } else { - u16 val = VarGet(VAR_0x403D); + u16 val = VarGet(VAR_REGICE_STEPS_3); val |= 1 << (i - 32); - VarSet(VAR_0x403D, val); + VarSet(VAR_REGICE_STEPS_3, val); } - varValue = VarGet(VAR_0x403B); - if (varValue != 0xFFFF || VarGet(VAR_0x403C) != varValue || VarGet(VAR_0x403D) != 0xF) + varValue = VarGet(VAR_REGICE_STEPS_1); + if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != varValue || VarGet(VAR_REGICE_STEPS_3) != 0xF) return FALSE; + // This final check is redundant. if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) return TRUE; else diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c index f3bd76cbf..c002f700f 100644 --- a/src/fldeff_flash.c +++ b/src/fldeff_flash.c @@ -74,11 +74,13 @@ static const u32 gCaveTransitionTiles[] = INCBIN_U32("graphics/misc/cave_transit // text bool8 SetUpFieldMove_Flash(void) { - if (ShouldDoBrailleFlyEffect()) + // In Ruby and Sapphire, Registeel's tomb is opened by using Fly. In Emerald, + // Flash is used instead. + if (ShouldDoBrailleRegisteelEffect()) { gSpecialVar_Result = GetCursorSelectionMonId(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_8179918; + gPostMenuFieldCallback = SetUpPuzzleEffectRegisteel; return TRUE; } else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH)) diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index 9181b5532..86df8e943 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -119,11 +119,13 @@ static void sub_813561C(u8 taskId) bool8 SetUpFieldMove_RockSmash(void) { - if (ShouldDoBrailleStrengthEffect()) + // In Ruby and Sapphire, Regirock's tomb is opened by using Strength. In Emerald, + // it is opened by using Rock Smash. + if (ShouldDoBrailleRegirockEffect()) { gSpecialVar_Result = GetCursorSelectionMonId(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_8179834; + gPostMenuFieldCallback = SetUpPuzzleEffectRegirock; return TRUE; } else if (CheckObjectGraphicsInFrontOfPlayer(EVENT_OBJ_GFX_BREAKABLE_ROCK) == TRUE)