Document the regi* code more

Fixed some confusing naming, named some unknown symbols, and fixed the
names of some flags.
This commit is contained in:
Phlosioneer 2019-02-15 18:24:55 -05:00
parent e95140270b
commit e90e3458cb
12 changed files with 110 additions and 90 deletions

View File

@ -10,66 +10,79 @@ gFieldEffectScriptPointers:: @ 82DB9D4
.4byte gFieldEffectScript_UseCutOnTree .4byte gFieldEffectScript_UseCutOnTree
.4byte gFieldEffectScript_Shadow .4byte gFieldEffectScript_Shadow
.4byte gFieldEffectScript_TallGrass .4byte gFieldEffectScript_TallGrass
.4byte gFieldEffectScript_Ripple .4byte gFieldEffectScript_Ripple
.4byte gFieldEffectScript_FieldMoveShowMon .4byte gFieldEffectScript_FieldMoveShowMon
.4byte gFieldEffectScript_Ash .4byte gFieldEffectScript_Ash
.4byte gFieldEffectScript_SurfBlob .4byte gFieldEffectScript_SurfBlob
.4byte gFieldEffectScript_UseSurf .4byte gFieldEffectScript_UseSurf
.4byte gFieldEffectScript_GroundImpactDust .4byte gFieldEffectScript_GroundImpactDust
.4byte gFieldEffectScript_Unknown11 .4byte gFieldEffectScript_Unknown11
.4byte gFieldEffectScript_BikeHopTallGrass .4byte gFieldEffectScript_BikeHopTallGrass
.4byte gFieldEffectScript_SandFootprints .4byte gFieldEffectScript_SandFootprints
.4byte gFieldEffectScript_BikeHopBigSplash .4byte gFieldEffectScript_BikeHopBigSplash
.4byte gFieldEffectScript_Splash .4byte gFieldEffectScript_Splash
.4byte gFieldEffectScript_BikeHopSmallSplash .4byte gFieldEffectScript_BikeHopSmallSplash
.4byte gFieldEffectScript_LongGrass .4byte gFieldEffectScript_LongGrass
.4byte gFieldEffectScript_Unknown18 .4byte gFieldEffectScript_Unknown18
.4byte gFieldEffectScript_Unknown19 .4byte gFieldEffectScript_Unknown19
.4byte gFieldEffectScript_Unknown20 .4byte gFieldEffectScript_Unknown20
.4byte gFieldEffectScript_Unknown21 .4byte gFieldEffectScript_Unknown21
.4byte gFieldEffectScript_Unknown22 .4byte gFieldEffectScript_Unknown22
.4byte gFieldEffectScript_BerryTreeGrowthSparkle .4byte gFieldEffectScript_BerryTreeGrowthSparkle
.4byte gFieldEffectScript_DeepSandFootprints .4byte gFieldEffectScript_DeepSandFootprints
.4byte gFieldEffectScript_Unknown25 .4byte gFieldEffectScript_Unknown25
.4byte gFieldEffectScript_Unknown26 .4byte gFieldEffectScript_Unknown26
.4byte gFieldEffectScript_Unknown27 .4byte gFieldEffectScript_Unknown27
.4byte gFieldEffectScript_TreeDisguise .4byte gFieldEffectScript_TreeDisguise
.4byte gFieldEffectScript_MountainDisguise .4byte gFieldEffectScript_MountainDisguise
.4byte gFieldEffectScript_Unknown30 .4byte gFieldEffectScript_Unknown30
.4byte gFieldEffectScript_UseFly .4byte gFieldEffectScript_UseFly
.4byte gFieldEffectScript_FlyIn .4byte gFieldEffectScript_FlyIn
.4byte gFieldEffectScript_QuestionMarkIcon .4byte gFieldEffectScript_QuestionMarkIcon
.4byte gFieldEffectScript_FeetInFlowingWater .4byte gFieldEffectScript_FeetInFlowingWater
.4byte gFieldEffectScript_BikeTireTracks .4byte gFieldEffectScript_BikeTireTracks
.4byte gFieldEffectScript_SandDisguisePlaceholder .4byte gFieldEffectScript_SandDisguisePlaceholder
.4byte gFieldEffectScript_UseRockSmash .4byte gFieldEffectScript_UseRockSmash
.4byte gFieldEffectScript_Unknown38 .4byte gFieldEffectScript_Unknown38
.4byte gFieldEffectScript_Unknown39 .4byte gFieldEffectScript_Unknown39
.4byte gFieldEffectScript_Unknown40 .4byte gFieldEffectScript_Unknown40
.4byte gFieldEffectScript_ShortGrass .4byte gFieldEffectScript_ShortGrass
.4byte gFieldEffectScript_HotSpringsWater .4byte gFieldEffectScript_HotSpringsWater
.4byte gFieldEffectScript_Unknown43 .4byte gFieldEffectScript_Unknown43
.4byte gFieldEffectScript_Unknown44 .4byte gFieldEffectScript_Unknown44
.4byte gFieldEffectScript_Unknown45 .4byte gFieldEffectScript_Unknown45
.4byte gFieldEffectScript_HeartIcon .4byte gFieldEffectScript_HeartIcon
.4byte gFieldEffectScript_Unknown47 .4byte gFieldEffectScript_Unknown47
.4byte gFieldEffectScript_Unknown48 .4byte gFieldEffectScript_Unknown48
.4byte gFieldEffectScript_JumpOutOfAsh .4byte gFieldEffectScript_JumpOutOfAsh
.4byte gFieldEffectScript_Unknown50 .4byte gFieldEffectScript_Unknown50
.4byte gFieldEffectScript_Unknown51 .4byte gFieldEffectScript_Unknown51
.4byte gFieldEffectScript_Unknown52 .4byte gFieldEffectScript_Unknown52
.4byte gFieldEffectScript_Bubbles .4byte gFieldEffectScript_Bubbles
.4byte gFieldEffectScript_Unknown54 .4byte gFieldEffectScript_Unknown54
.4byte gFieldEffectScript_Unknown55 .4byte gFieldEffectScript_Unknown55
.4byte gFieldEffectScript_Unknown56 .4byte gFieldEffectScript_Unknown56
.4byte gFieldEffectScript_Unknown57 .4byte gFieldEffectScript_Unknown57
.4byte gFieldEffectScript_Unknown58 .4byte gFieldEffectScript_Unknown58
.4byte gFieldEffectScript_FieldMoveShowMonInit .4byte gFieldEffectScript_FieldMoveShowMonInit
.4byte gFieldEffectScript_Unknown60
.4byte gFieldEffectScript_UsePuzzleEffect
.4byte gFieldEffectScript_Unknown61 .4byte gFieldEffectScript_Unknown61
.4byte gFieldEffectScript_Unknown62 .4byte gFieldEffectScript_Unknown62
.4byte gFieldEffectScript_Unknown63 .4byte gFieldEffectScript_Unknown63
.4byte gFieldEffectScript_Rayquaza .4byte gFieldEffectScript_Rayquaza
.4byte gFieldEffectScript_Unknown65 .4byte gFieldEffectScript_Unknown65
.4byte gFieldEffectScript_Unknown66 .4byte gFieldEffectScript_Unknown66
@ -315,7 +328,7 @@ gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC
field_eff_callnative FldEff_FieldMoveShowMonInit field_eff_callnative FldEff_FieldMoveShowMonInit
field_eff_end field_eff_end
gFieldEffectScript_Unknown60:: @ 82DBCD2 gFieldEffectScript_UsePuzzleEffect:: @ 82DBCD2
field_eff_callnative FldEff_UsePuzzleEffect field_eff_callnative FldEff_UsePuzzleEffect
field_eff_end field_eff_end

View File

@ -25,7 +25,7 @@ AncientTomb_EventScript_238FEE:: @ 8238FEE
return return
AncientTomb_MapScript1_238FF2: @ 8238FF2 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 end
AncientTomb_EventScript_238FFC:: @ 8238FFC AncientTomb_EventScript_238FFC:: @ 8238FFC
@ -39,7 +39,7 @@ AncientTomb_EventScript_238FFC:: @ 8238FFC
AncientTomb_EventScript_239033:: @ 8239033 AncientTomb_EventScript_239033:: @ 8239033
lockall 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 braillemessage AncientTomb_Braille_2A6D06
waitbuttonpress waitbuttonpress
hidebox2 hidebox2

View File

@ -16,7 +16,7 @@ DesertRuins_EventScript_22D975:: @ 822D975
return return
DesertRuins_MapScript1_22D989: @ 822D989 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 end
DesertRuins_EventScript_22D993:: @ 822D993 DesertRuins_EventScript_22D993:: @ 822D993
@ -39,7 +39,7 @@ DesertRuins_EventScript_22D9D7:: @ 822D9D7
DesertRuins_EventScript_22D9DB:: @ 822D9DB DesertRuins_EventScript_22D9DB:: @ 822D9DB
lockall 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 braillemessage DesertRuins_Braille_2A6CA0
waitbuttonpress waitbuttonpress
hidebox2 hidebox2

View File

@ -16,7 +16,7 @@ IslandCave_EventScript_238E44:: @ 8238E44
return return
IslandCave_MapScript1_238E58: @ 8238E58 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 end
IslandCave_EventScript_238E62:: @ 8238E62 IslandCave_EventScript_238E62:: @ 8238E62
@ -47,13 +47,13 @@ IslandCave_EventScript_238EAF:: @ 8238EAF
setmetatile 9, 20, 564, 1 setmetatile 9, 20, 564, 1
special DrawWholeMapView special DrawWholeMapView
playse SE_BAN playse SE_BAN
setflag FLAG_SYS_BRAILLE_WAIT setflag FLAG_SYS_BRAILLE_REGICE_PUZZLE
end end
IslandCave_EventScript_238EEF:: @ 8238EEF IslandCave_EventScript_238EEF:: @ 8238EEF
lockall lockall
call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 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 braillemessage IslandCave_Braille_2A6CD4
setflag FLAG_TEMP_2 setflag FLAG_TEMP_2
special ShouldDoBrailleRegicePuzzle special ShouldDoBrailleRegicePuzzle
@ -69,7 +69,7 @@ IslandCave_EventScript_238F1D:: @ 8238F1D
lockall lockall
call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45
braillemessage IslandCave_Braille_2A6CD4 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 setflag FLAG_TEMP_2
special ShouldDoBrailleRegicePuzzle special ShouldDoBrailleRegicePuzzle
goto IslandCave_EventScript_238F41 goto IslandCave_EventScript_238F41
@ -82,9 +82,9 @@ IslandCave_EventScript_238F41:: @ 8238F41
end end
IslandCave_EventScript_238F45:: @ 8238F45 IslandCave_EventScript_238F45:: @ 8238F45
setvar VAR_0x403B, 0 setvar VAR_REGICE_STEPS_1, 0
setvar VAR_0x403C, 0 setvar VAR_REGICE_STEPS_2, 0
setvar VAR_0x403D, 0 setvar VAR_REGICE_STEPS_3, 0
clearflag FLAG_TEMP_3 clearflag FLAG_TEMP_3
return return

View File

@ -291,7 +291,7 @@ gSpecials:: @ 81DBA64
def_special GetPokeblockNameByMonNature def_special GetPokeblockNameByMonNature
def_special GetSecretBaseNearbyMapName def_special GetSecretBaseNearbyMapName
def_special CheckRelicanthWailord def_special CheckRelicanthWailord
def_special ShouldDoBrailleStrengthEffectOld def_special ShouldDoBrailleRegirockEffectOld
def_special sub_80B0534 def_special sub_80B0534
def_special sub_80B058C def_special sub_80B058C
def_special WaitWeather def_special WaitWeather

View File

@ -1,11 +1,11 @@
#ifndef GUARD_BRAILLE_PUZZLES_H #ifndef GUARD_BRAILLE_PUZZLES_H
#define GUARD_BRAILLE_PUZZLES_H #define GUARD_BRAILLE_PUZZLES_H
bool8 ShouldDoBrailleFlyEffect(void); bool8 ShouldDoBrailleRegisteelEffect(void);
bool8 ShouldDoBrailleStrengthEffect(void); bool8 ShouldDoBrailleRegirockEffect(void);
bool8 ShouldDoBrailleDigEffect(void); bool8 ShouldDoBrailleDigEffect(void);
void DoBrailleDigEffect(void); void DoBrailleDigEffect(void);
void sub_8179918(void); void SetUpPuzzleEffectRegisteel(void);
void sub_8179834(void); void SetUpPuzzleEffectRegirock(void);
#endif // GUARD_BRAILLE_PUZZLES_H #endif // GUARD_BRAILLE_PUZZLES_H

View File

@ -61,7 +61,7 @@
#define FLDEFF_SECRET_POWER_SHRUB 57 #define FLDEFF_SECRET_POWER_SHRUB 57
#define FLDEFF_CUT_GRASS 58 #define FLDEFF_CUT_GRASS 58
#define FLDEFF_FIELD_MOVE_SHOW_MON_INIT 59 #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_PCTURN_ON 61
#define FLDEFF_HALL_OF_FAME_RECORD 62 #define FLDEFF_HALL_OF_FAME_RECORD 62
#define FLDEFF_USE_TELEPORT 63 #define FLDEFF_USE_TELEPORT 63

View File

@ -1352,9 +1352,9 @@
#define FLAG_SYS_ENC_UP_ITEM (SYSTEM_FLAGS + 0x4D) #define FLAG_SYS_ENC_UP_ITEM (SYSTEM_FLAGS + 0x4D)
#define FLAG_SYS_ENC_DOWN_ITEM (SYSTEM_FLAGS + 0x4E) #define FLAG_SYS_ENC_DOWN_ITEM (SYSTEM_FLAGS + 0x4E)
#define FLAG_SYS_BRAILLE_DIG (SYSTEM_FLAGS + 0x4F) #define FLAG_SYS_BRAILLE_DIG (SYSTEM_FLAGS + 0x4F)
#define FLAG_SYS_BRAILLE_STRENGTH (SYSTEM_FLAGS + 0x50) #define FLAG_SYS_BRAILLE_REGIROCK_HM (SYSTEM_FLAGS + 0x50)
#define FLAG_SYS_BRAILLE_WAIT (SYSTEM_FLAGS + 0x51) #define FLAG_SYS_BRAILLE_REGICE_PUZZLE (SYSTEM_FLAGS + 0x51)
#define FLAG_SYS_BRAILLE_FLY (SYSTEM_FLAGS + 0x52) #define FLAG_SYS_BRAILLE_REGISTEEL_HM (SYSTEM_FLAGS + 0x52)
#define FLAG_SYS_HAS_EON_TICKET (SYSTEM_FLAGS + 0x53) #define FLAG_SYS_HAS_EON_TICKET (SYSTEM_FLAGS + 0x53)
#define FLAG_LANDMARK_POKEMON_LEAGUE (SYSTEM_FLAGS + 0x54) #define FLAG_LANDMARK_POKEMON_LEAGUE (SYSTEM_FLAGS + 0x54)

View File

@ -75,9 +75,9 @@
#define VAR_0x4038 0x4038 #define VAR_0x4038 0x4038
#define VAR_0x4039 0x4039 #define VAR_0x4039 0x4039
#define VAR_0x403A 0x403A #define VAR_0x403A 0x403A
#define VAR_0x403B 0x403B #define VAR_REGICE_STEPS_1 0x403B
#define VAR_0x403C 0x403C #define VAR_REGICE_STEPS_2 0x403C
#define VAR_0x403D 0x403D #define VAR_REGICE_STEPS_3 0x403D
#define VAR_ALTERING_CAVE_WILD_SET 0x403E #define VAR_ALTERING_CAVE_WILD_SET 0x403E
#define VAR_0x403F 0x403F #define VAR_0x403F 0x403F
#define VAR_DAYS 0x4040 #define VAR_DAYS 0x4040

View File

@ -10,21 +10,20 @@
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/species.h" #include "constants/species.h"
#include "fieldmap.h"
extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId); // fieldmap #include "party_menu.h"
extern u8 GetCursorSelectionMonId(void); #include "fldeff.h"
extern u8 oei_task_add(void);
// why do this, GF? // why do this, GF?
enum enum
{ {
STRENGTH_PUZZLE, REGIROCK_PUZZLE,
FLY_PUZZLE REGISTEEL_PUZZLE
}; };
EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0;
static const u8 gUnknown_085EFE74[][2] = static const u8 gRegicePathCoords[][2] =
{ {
{0x04, 0x15}, {0x04, 0x15},
{0x05, 0x15}, {0x05, 0x15},
@ -65,8 +64,8 @@ static const u8 gUnknown_085EFE74[][2] =
}; };
void SealedChamberShakingEffect(u8); void SealedChamberShakingEffect(u8);
void sub_8179860(void); void DoBrailleRegirockEffect(void);
void sub_8179944(void); void DoBrailleRegisteelEffect(void);
bool8 ShouldDoBrailleDigEffect(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. // 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. // 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) if (gSaveBlock1.pos.x == 10 && gSaveBlock1.pos.y == 23)
return TRUE; return TRUE;
@ -131,7 +130,7 @@ void ShouldDoBrailleStrengthEffectOld(void)
return FALSE; return FALSE;
} }
void DoBrailleStrengthEffect(void) void DoBrailleRegirockEffect(void)
{ {
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH); FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
MapGridSetMetatileIdAt(14, 26, 554); MapGridSetMetatileIdAt(14, 26, 554);
@ -142,13 +141,13 @@ void DoBrailleStrengthEffect(void)
MapGridSetMetatileIdAt(16, 27, 3636); MapGridSetMetatileIdAt(16, 27, 3636);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BAN); PlaySE(SE_BAN);
FlagSet(FLAG_SYS_BRAILLE_STRENGTH); FlagSet(FLAG_SYS_BRAILLE_REGIROCK_HM);
ScriptContext2_Disable(); 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) if (gSaveBlock1.pos.x == 8 && gSaveBlock1.pos.y == 25)
return TRUE; return TRUE;
@ -157,24 +156,24 @@ bool8 ShouldDoBrailleFlyEffect(void)
return FALSE; return FALSE;
} }
void DoBrailleFlyEffect(void) void DoBrailleRegisteelEffect(void)
{ {
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened; gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT);
} }
bool8 FldEff_UseFlyAncientTomb(void) bool8 FldEff_UseFlyAncientTomb(void)
{ {
u8 taskId = oei_task_add(); u8 taskId = oei_task_add();
gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16;
gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback;
return FALSE; return FALSE;
} }
void UseFlyAncientTomb_Callback(void) void UseRegisteelHm_Callback(void)
{ {
FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT);
UseFlyAncientTomb_Finish(); UseFlyAncientTomb_Finish();
} }
@ -188,7 +187,7 @@ void UseFlyAncientTomb_Finish(void)
MapGridSetMetatileIdAt(16, 27, 3636); MapGridSetMetatileIdAt(16, 27, 3636);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BAN); PlaySE(SE_BAN);
FlagSet(FLAG_SYS_BRAILLE_FLY); FlagSet(FLAG_SYS_BRAILLE_REGISTEEL_HM);
ScriptContext2_Disable(); ScriptContext2_Disable();
} }
*/ */
@ -240,25 +239,25 @@ void SealedChamberShakingEffect(u8 taskId)
} }
// moved later in the function because it was rewritten. // 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.mapGroup == MAP_GROUP(DESERT_RUINS)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS)) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS))
{ {
if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23) if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23)
{ {
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE;
return TRUE; return TRUE;
} }
else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23) else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23)
{ {
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE;
return TRUE; return TRUE;
} }
else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23) else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23)
{ {
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE;
return TRUE; return TRUE;
} }
} }
@ -266,19 +265,19 @@ bool8 ShouldDoBrailleStrengthEffect(void)
return FALSE; return FALSE;
} }
void sub_8179834(void) void SetUpPuzzleEffectRegirock(void)
{ {
gFieldEffectArguments[0] = GetCursorSelectionMonId(); 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); FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT);
sub_8179860(); DoBrailleRegirockEffect();
} }
void sub_8179860(void) void DoBrailleRegirockEffect(void)
{ {
MapGridSetMetatileIdAt(14, 26, 554); MapGridSetMetatileIdAt(14, 26, 554);
MapGridSetMetatileIdAt(15, 26, 555); MapGridSetMetatileIdAt(15, 26, 555);
@ -288,33 +287,36 @@ void sub_8179860(void)
MapGridSetMetatileIdAt(16, 27, 3636); MapGridSetMetatileIdAt(16, 27, 3636);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BAN); PlaySE(SE_BAN);
FlagSet(FLAG_SYS_BRAILLE_STRENGTH); FlagSet(FLAG_SYS_BRAILLE_REGIROCK_HM);
ScriptContext2_Disable(); 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) if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 25)
{ sBraillePuzzleCallbackFlag = FLY_PUZZLE; return TRUE; } {
sBraillePuzzleCallbackFlag = REGISTEEL_PUZZLE;
return TRUE;
}
} }
return FALSE; return FALSE;
} }
void sub_8179918(void) void SetUpPuzzleEffectRegisteel(void)
{ {
gFieldEffectArguments[0] = GetCursorSelectionMonId(); 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); FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT);
sub_8179944(); DoBrailleRegisteelEffect();
} }
void sub_8179944(void) void DoBrailleRegisteelEffect(void)
{ {
MapGridSetMetatileIdAt(14, 26, 554); MapGridSetMetatileIdAt(14, 26, 554);
MapGridSetMetatileIdAt(15, 26, 555); MapGridSetMetatileIdAt(15, 26, 555);
@ -324,7 +326,7 @@ void sub_8179944(void)
MapGridSetMetatileIdAt(16, 27, 3636); MapGridSetMetatileIdAt(16, 27, 3636);
DrawWholeMapView(); DrawWholeMapView();
PlaySE(SE_BAN); PlaySE(SE_BAN);
FlagSet(FLAG_SYS_BRAILLE_FLY); FlagSet(FLAG_SYS_BRAILLE_REGISTEEL_HM);
ScriptContext2_Disable(); ScriptContext2_Disable();
} }
@ -332,7 +334,7 @@ void sub_8179944(void)
void DoBrailleWait(void) void DoBrailleWait(void)
{ {
/* /*
if (!FlagGet(FLAG_SYS_BRAILLE_WAIT)) if (!FlagGet(FLAG_SYS_BRAILLE_REGICE_PUZZLE))
CreateTask(Task_BrailleWait, 0x50); CreateTask(Task_BrailleWait, 0x50);
} }
@ -410,15 +412,15 @@ bool8 FldEff_UsePuzzleEffect(void)
{ {
u8 taskId = oei_task_add(); u8 taskId = oei_task_add();
if (sBraillePuzzleCallbackFlag == FLY_PUZZLE) if (sBraillePuzzleCallbackFlag == REGISTEEL_PUZZLE)
{ {
gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16;
gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback;
} }
else else
{ {
gTasks[taskId].data[8] = (u32)UseStrengthDesertRuins_Callback >> 16; gTasks[taskId].data[8] = (u32)UseRegirockHm_Callback >> 16;
gTasks[taskId].data[9] = (u32)UseStrengthDesertRuins_Callback; gTasks[taskId].data[9] = (u32)UseRegirockHm_Callback;
} }
return FALSE; return FALSE;
} }
@ -430,7 +432,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
if (gSaveBlock1Ptr->location.mapGroup == 0x18 if (gSaveBlock1Ptr->location.mapGroup == 0x18
&& gSaveBlock1Ptr->location.mapNum == 0x43) && gSaveBlock1Ptr->location.mapNum == 0x43)
{ {
if (FlagGet(FLAG_SYS_BRAILLE_WAIT) != FALSE) if (FlagGet(FLAG_SYS_BRAILLE_REGICE_PUZZLE))
return FALSE; return FALSE;
if (FlagGet(FLAG_TEMP_2) == FALSE) if (FlagGet(FLAG_TEMP_2) == FALSE)
return FALSE; return FALSE;
@ -439,35 +441,36 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
for (i = 0; i < 36; i++) for (i = 0; i < 36; i++)
{ {
u8 xPos = gUnknown_085EFE74[i][0]; u8 xPos = gRegicePathCoords[i][0];
u8 yPos = gUnknown_085EFE74[i][1]; u8 yPos = gRegicePathCoords[i][1];
if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos)
{ {
u16 varValue; u16 varValue;
if (i < 16) if (i < 16)
{ {
u16 val = VarGet(VAR_0x403B); u16 val = VarGet(VAR_REGICE_STEPS_1);
val |= 1 << i; val |= 1 << i;
VarSet(VAR_0x403B, val); VarSet(VAR_REGICE_STEPS_1, val);
} }
else if (i < 32) else if (i < 32)
{ {
u16 val = VarGet(VAR_0x403C); u16 val = VarGet(VAR_REGICE_STEPS_2);
val |= 1 << (i - 16); val |= 1 << (i - 16);
VarSet(VAR_0x403C, val); VarSet(VAR_REGICE_STEPS_2, val);
} }
else else
{ {
u16 val = VarGet(VAR_0x403D); u16 val = VarGet(VAR_REGICE_STEPS_3);
val |= 1 << (i - 32); val |= 1 << (i - 32);
VarSet(VAR_0x403D, val); VarSet(VAR_REGICE_STEPS_3, val);
} }
varValue = VarGet(VAR_0x403B); varValue = VarGet(VAR_REGICE_STEPS_1);
if (varValue != 0xFFFF || VarGet(VAR_0x403C) != varValue || VarGet(VAR_0x403D) != 0xF) if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != varValue || VarGet(VAR_REGICE_STEPS_3) != 0xF)
return FALSE; return FALSE;
// This final check is redundant.
if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21)
return TRUE; return TRUE;
else else

View File

@ -74,11 +74,13 @@ static const u32 gCaveTransitionTiles[] = INCBIN_U32("graphics/misc/cave_transit
// text // text
bool8 SetUpFieldMove_Flash(void) 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(); gSpecialVar_Result = GetCursorSelectionMonId();
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
gPostMenuFieldCallback = sub_8179918; gPostMenuFieldCallback = SetUpPuzzleEffectRegisteel;
return TRUE; return TRUE;
} }
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH)) else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))

View File

@ -119,11 +119,13 @@ static void sub_813561C(u8 taskId)
bool8 SetUpFieldMove_RockSmash(void) 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(); gSpecialVar_Result = GetCursorSelectionMonId();
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
gPostMenuFieldCallback = sub_8179834; gPostMenuFieldCallback = SetUpPuzzleEffectRegirock;
return TRUE; return TRUE;
} }
else if (CheckObjectGraphicsInFrontOfPlayer(EVENT_OBJ_GFX_BREAKABLE_ROCK) == TRUE) else if (CheckObjectGraphicsInFrontOfPlayer(EVENT_OBJ_GFX_BREAKABLE_ROCK) == TRUE)