mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Document deoxys rock
This commit is contained in:
parent
46d41d2fb9
commit
67636b7c64
@ -341,5 +341,5 @@ gFieldEffectScript_Unknown65:: @ 82DBCF9
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_Unknown66:: @ 82DBCFF
|
||||
field_eff_callnative sub_80B9E28
|
||||
field_eff_callnative Fldeff_MoveDeoxysRock
|
||||
field_eff_end
|
||||
|
@ -11,8 +11,8 @@ BirthIsland_Exterior_MapScript1_267F25: @ 8267F25
|
||||
BirthIsland_Exterior_MapScript1_267F29: @ 8267F29
|
||||
setflag FLAG_0x8D3
|
||||
setvar VAR_OBJ_GFX_ID_0, EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL
|
||||
setvar VAR_0x4034, 0
|
||||
setvar VAR_0x4035, 0
|
||||
setvar VAR_DEOXYS_ROCK_STEP_COUNT, 0
|
||||
setvar VAR_DEOXYS_ROCK_LEVEL, 0
|
||||
call_if_set FLAG_0x1AD, BirthIsland_Exterior_EventScript_267F4E
|
||||
call_if_unset FLAG_0x1AD, BirthIsland_Exterior_EventScript_267F55
|
||||
end
|
||||
@ -25,7 +25,7 @@ BirthIsland_Exterior_EventScript_267F4E:: @ 8267F4E
|
||||
BirthIsland_Exterior_EventScript_267F55:: @ 8267F55
|
||||
goto_if_set FLAG_0x1AC, BirthIsland_Exterior_EventScript_27374E
|
||||
clearflag FLAG_HIDE_BIRTH_ISLAND_DEOXYS_TRIANGLE
|
||||
clearflag FLAG_0x8D4
|
||||
clearflag FLAG_DEOXYS_ROCK_COMPLETE
|
||||
return
|
||||
|
||||
BirthIsland_Exterior_MapScript1_267F65: @ 8267F65
|
||||
@ -42,7 +42,7 @@ BirthIsland_Exterior_EventScript_267F6F:: @ 8267F6F
|
||||
BirthIsland_Exterior_EventScript_267F83:: @ 8267F83
|
||||
lock
|
||||
faceplayer
|
||||
special sub_813AFC8
|
||||
special DoDeoxysRockInteraction
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 0, BirthIsland_Exterior_EventScript_267FBB
|
||||
|
@ -488,7 +488,7 @@ gSpecials:: @ 81DBA64
|
||||
def_special sub_81B892C
|
||||
def_special sub_813AEB4
|
||||
def_special sub_813AF48
|
||||
def_special sub_813AFC8
|
||||
def_special DoDeoxysRockInteraction
|
||||
def_special sub_813B1D0
|
||||
def_special CreateObedientEnemyMon
|
||||
def_special StartMirageTowerDisintegration
|
||||
|
@ -67,6 +67,6 @@
|
||||
#define FLDEFF_USE_TELEPORT 63
|
||||
#define FLDEFF_64 64
|
||||
#define FLDEFF_65 65
|
||||
#define FLDEFF_66 66
|
||||
#define FLDEFF_MOVE_DEOXYS_ROCK 66
|
||||
|
||||
#endif
|
||||
|
@ -1356,7 +1356,7 @@
|
||||
#define FLAG_SYS_FRONTIER_PASS (SYSTEM_FLAGS + 0x72)
|
||||
|
||||
#define FLAG_0x8D3 (SYSTEM_FLAGS + 0x73)
|
||||
#define FLAG_0x8D4 (SYSTEM_FLAGS + 0x74)
|
||||
#define FLAG_DEOXYS_ROCK_COMPLETE (SYSTEM_FLAGS + 0x74)
|
||||
#define FLAG_0x8D5 (SYSTEM_FLAGS + 0x75)
|
||||
#define FLAG_0x8D6 (SYSTEM_FLAGS + 0x76)
|
||||
|
||||
|
@ -68,8 +68,8 @@
|
||||
#define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032
|
||||
#define VAR_FRONTIER_GAMBLER_PLACED_BET_F 0x4033
|
||||
|
||||
#define VAR_0x4034 0x4034
|
||||
#define VAR_0x4035 0x4035
|
||||
#define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034
|
||||
#define VAR_DEOXYS_ROCK_LEVEL 0x4035
|
||||
#define VAR_STORAGE_UNKNOWN 0x4036
|
||||
#define VAR_0x4037 0x4037
|
||||
#define VAR_0x4038 0x4038
|
||||
|
@ -6,7 +6,7 @@ u8 sub_813B260(void);
|
||||
u16 get_unknown_box_id(void);
|
||||
bool8 InMultiBattleRoom(void);
|
||||
void sub_813BF10(void);
|
||||
void increment_var_x4026_on_birth_island_modulo_100(void);
|
||||
void IncrementBirthIslandRockStepCount(void);
|
||||
bool8 sub_813B3B0(void);
|
||||
bool8 ShouldDoBrailleRegicePuzzle(void);
|
||||
bool32 is_tile_that_overrides_player_control(void);
|
||||
|
@ -154,7 +154,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
if (input->tookStep)
|
||||
{
|
||||
IncrementGameStat(GAME_STAT_STEPS);
|
||||
increment_var_x4026_on_birth_island_modulo_100();
|
||||
IncrementBirthIslandRockStepCount();
|
||||
if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ static void sub_80B9A60(struct Task *);
|
||||
|
||||
static void sub_80B9BE8(u8 taskId);
|
||||
static void sub_80B9DB8(struct Sprite* sprite);
|
||||
static void sub_80B9EDC(u8 taskId);
|
||||
static void Fldeff_MoveDeoxysRock_Step(u8 taskId);
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
@ -3644,7 +3644,7 @@ static void sub_80B9DB8(struct Sprite* sprite)
|
||||
DestroySprite(sprite);
|
||||
}
|
||||
|
||||
bool8 sub_80B9E28(struct Sprite* sprite)
|
||||
bool8 Fldeff_MoveDeoxysRock(struct Sprite* sprite)
|
||||
{
|
||||
u8 eventObjectIdBuffer;
|
||||
if (!TryGetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &eventObjectIdBuffer))
|
||||
@ -3658,7 +3658,7 @@ bool8 sub_80B9E28(struct Sprite* sprite)
|
||||
xPos = (gFieldEffectArguments[3] - xPos) * 16;
|
||||
yPos = (gFieldEffectArguments[4] - yPos) * 16;
|
||||
ShiftEventObjectCoords(object, gFieldEffectArguments[3] + 7, gFieldEffectArguments[4] + 7);
|
||||
taskId = CreateTask(sub_80B9EDC, 0x50);
|
||||
taskId = CreateTask(Fldeff_MoveDeoxysRock_Step, 0x50);
|
||||
gTasks[taskId].data[1] = object->spriteId;
|
||||
gTasks[taskId].data[2] = gSprites[object->spriteId].pos1.x + xPos;
|
||||
gTasks[taskId].data[3] = gSprites[object->spriteId].pos1.y + yPos;
|
||||
@ -3668,7 +3668,7 @@ bool8 sub_80B9E28(struct Sprite* sprite)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_80B9EDC(u8 taskId)
|
||||
static void Fldeff_MoveDeoxysRock_Step(u8 taskId)
|
||||
{
|
||||
// BUG: Possible divide by zero
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
@ -115,9 +115,9 @@ static void sub_813A738(u8 taskId);
|
||||
static void sub_813A600(u8 taskId);
|
||||
static void sub_813A664(u8 taskId);
|
||||
static void sub_813ABD4(u16 a0);
|
||||
static void task_deoxys_sound(u8 taskId);
|
||||
static void sub_813B0B4(u8 a0);
|
||||
static void sub_813B160(u8 taskId);
|
||||
static void Task_DeoxysRockInteraction(u8 taskId);
|
||||
static void ChangeDeoxysRockLevel(u8 a0);
|
||||
static void WaitForDeoxysRockMovement(u8 taskId);
|
||||
static void sub_813B57C(u8 taskId);
|
||||
static void sub_813B824(u8 taskId);
|
||||
static void _fwalk(u8 taskId);
|
||||
@ -3233,12 +3233,12 @@ void sub_813AF48(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_813AFC8(void)
|
||||
void DoDeoxysRockInteraction(void)
|
||||
{
|
||||
CreateTask(task_deoxys_sound, 8);
|
||||
CreateTask(Task_DeoxysRockInteraction, 8);
|
||||
}
|
||||
|
||||
static const u16 gUnknown_085B3280[][16] = {
|
||||
static const u16 sDeoxysRockPalettes[][16] = {
|
||||
INCBIN_U16("graphics/misc/deoxys1.gbapal"),
|
||||
INCBIN_U16("graphics/misc/deoxys2.gbapal"),
|
||||
INCBIN_U16("graphics/misc/deoxys3.gbapal"),
|
||||
@ -3252,25 +3252,25 @@ static const u16 gUnknown_085B3280[][16] = {
|
||||
INCBIN_U16("graphics/misc/deoxys11.gbapal"),
|
||||
};
|
||||
|
||||
static const u8 gUnknown_085B33E0[][2] = {
|
||||
{ 0x0f, 0x0c },
|
||||
{ 0x0b, 0x0e },
|
||||
{ 0x0f, 0x08 },
|
||||
{ 0x13, 0x0e },
|
||||
{ 0x0c, 0x0b },
|
||||
{ 0x12, 0x0b },
|
||||
{ 0x0f, 0x0e },
|
||||
{ 0x0b, 0x0e },
|
||||
{ 0x13, 0x0e },
|
||||
{ 0x0f, 0x0f },
|
||||
{ 0x0f, 0x0a },
|
||||
static const u8 sDeoxysRockCoords[][2] = {
|
||||
{ 15, 12 },
|
||||
{ 11, 14 },
|
||||
{ 15, 8 },
|
||||
{ 19, 14 },
|
||||
{ 12, 11 },
|
||||
{ 18, 11 },
|
||||
{ 15, 14 },
|
||||
{ 11, 14 },
|
||||
{ 19, 14 },
|
||||
{ 15, 15 },
|
||||
{ 15, 10 },
|
||||
};
|
||||
|
||||
static void task_deoxys_sound(u8 taskId)
|
||||
static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
{
|
||||
static const u8 gUnknown_085B33F6[] = { 0x04, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x06, 0x03, 0x03 };
|
||||
static const u8 sStoneMaxStepCounts[] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
|
||||
|
||||
if (FlagGet(FLAG_0x8D4) == TRUE)
|
||||
if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE)
|
||||
{
|
||||
gSpecialVar_Result = 3;
|
||||
EnableBothScriptContexts();
|
||||
@ -3278,100 +3278,92 @@ static void task_deoxys_sound(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 temp1 = VarGet(VAR_0x4035);
|
||||
u16 temp2 = VarGet(VAR_0x4034);
|
||||
u16 rockLevel = VarGet(VAR_DEOXYS_ROCK_LEVEL);
|
||||
u16 stepCount = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT);
|
||||
|
||||
VarSet(VAR_0x4034, 0);
|
||||
if (temp1 != 0 && gUnknown_085B33F6[temp1 - 1] < temp2)
|
||||
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0);
|
||||
if (rockLevel != 0 && sStoneMaxStepCounts[rockLevel - 1] < stepCount)
|
||||
{
|
||||
sub_813B0B4(0);
|
||||
VarSet(VAR_0x4035, 0);
|
||||
// Player failed to take the shortest path to the stone, so it resets.
|
||||
ChangeDeoxysRockLevel(0);
|
||||
VarSet(VAR_DEOXYS_ROCK_LEVEL, 0);
|
||||
gSpecialVar_Result = 0;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else if (temp1 == 10)
|
||||
else if (rockLevel == 10)
|
||||
{
|
||||
FlagSet(FLAG_0x8D4);
|
||||
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
|
||||
gSpecialVar_Result = 2;
|
||||
EnableBothScriptContexts();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp1++;
|
||||
sub_813B0B4(temp1);
|
||||
VarSet(VAR_0x4035, temp1);
|
||||
rockLevel++;
|
||||
ChangeDeoxysRockLevel(rockLevel);
|
||||
VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel);
|
||||
gSpecialVar_Result = 1;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_813B0B4(u8 a0)
|
||||
static void ChangeDeoxysRockLevel(u8 rockLevel)
|
||||
{
|
||||
u8 eventObjectId;
|
||||
LoadPalette(&gUnknown_085B3280[a0], 0x1A0, 8);
|
||||
LoadPalette(&sDeoxysRockPalettes[rockLevel], 0x1A0, 8);
|
||||
TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId);
|
||||
|
||||
if (a0 == 0)
|
||||
{
|
||||
if (rockLevel == 0)
|
||||
PlaySE(SE_W109);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_RG_DEOMOV);
|
||||
}
|
||||
|
||||
CreateTask(sub_813B160, 8);
|
||||
|
||||
CreateTask(WaitForDeoxysRockMovement, 8);
|
||||
gFieldEffectArguments[0] = 1;
|
||||
gFieldEffectArguments[1] = 58;
|
||||
gFieldEffectArguments[2] = 26;
|
||||
gFieldEffectArguments[3] = gUnknown_085B33E0[a0][0];
|
||||
gFieldEffectArguments[4] = gUnknown_085B33E0[a0][1];
|
||||
gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0];
|
||||
gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1];
|
||||
|
||||
if (a0 == 0)
|
||||
{
|
||||
if (rockLevel == 0)
|
||||
gFieldEffectArguments[5] = 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
gFieldEffectArguments[5] = 5;
|
||||
}
|
||||
|
||||
FieldEffectStart(FLDEFF_66);
|
||||
Overworld_SetEventObjTemplateCoords(1, gUnknown_085B33E0[a0][0], gUnknown_085B33E0[a0][1]);
|
||||
FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK);
|
||||
Overworld_SetEventObjTemplateCoords(1, sDeoxysRockCoords[rockLevel][0], sDeoxysRockCoords[rockLevel][1]);
|
||||
}
|
||||
|
||||
static void sub_813B160(u8 taskId)
|
||||
static void WaitForDeoxysRockMovement(u8 taskId)
|
||||
{
|
||||
if (FieldEffectActiveListContains(FLDEFF_66) == FALSE)
|
||||
if (FieldEffectActiveListContains(FLDEFF_MOVE_DEOXYS_ROCK) == FALSE)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void increment_var_x4026_on_birth_island_modulo_100(void)
|
||||
void IncrementBirthIslandRockStepCount(void)
|
||||
{
|
||||
u16 var = VarGet(VAR_0x4034);
|
||||
u16 var = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT);
|
||||
if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(BIRTH_ISLAND_EXTERIOR) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BIRTH_ISLAND_EXTERIOR))
|
||||
{
|
||||
var++;
|
||||
if (var > 99)
|
||||
{
|
||||
VarSet(VAR_0x4034, 0);
|
||||
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_0x4034, var);
|
||||
VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_813B1D0(void)
|
||||
{
|
||||
LoadPalette(&gUnknown_085B3280[(u8)VarGet(VAR_0x4035)], 0x1A0, 8);
|
||||
LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], 0x1A0, 8);
|
||||
BlendPalettes(0x04000000, 16, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user