Document Gym scripts first half

This commit is contained in:
GriffinR
2019-10-11 17:25:07 -04:00
committed by huderlem
parent a0b3f5d9e3
commit 348bb002a8
18 changed files with 554 additions and 561 deletions

View File

@@ -583,7 +583,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
}
if (ShouldDoRoxanneCall() == TRUE)
{
ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_21307B);
ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_RegisterRoxanne);
return TRUE;
}
if (ShouldDoRivalRayquazaCall() == TRUE)

View File

@@ -970,7 +970,7 @@ static u8 sub_80B003C(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 dest
#undef tFlashRadiusDelta
#undef tClearScanlineEffect
void sub_80B009C(u8 flashLevel)
void AnimateFlash(u8 flashLevel)
{
u8 curFlashLevel = Overworld_GetFlashLevel();
u8 value = 0;

View File

@@ -636,6 +636,7 @@ static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEvent
}
}
// NOTE: Coordinates are +7, +7 from actual in-map coordinates
static const struct UCoords8 sMauvilleGymSwitchCoords[] =
{
{ 7, 22},
@@ -644,26 +645,24 @@ static const struct UCoords8 sMauvilleGymSwitchCoords[] =
{15, 16}
};
// Flips the switches on the ground when the player steps on them.
void MauvilleGymSpecial1(void)
// Presses the stepped-on switch and raises the rest
void MauvilleGymPressSwitch(void)
{
u8 i;
for (i = 0; i < ARRAY_COUNT(sMauvilleGymSwitchCoords); i++)
{
if (i == gSpecialVar_0x8004)
{
MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_ID(MauvilleGym, PressedSwitch));
}
else
{
MapGridSetMetatileIdAt(sMauvilleGymSwitchCoords[i].x, sMauvilleGymSwitchCoords[i].y, METATILE_ID(MauvilleGym, RaisedSwitch));
}
}
}
void MauvilleGymSpecial2(void)
// Sets the gym barriers back to the default state; their alt state is handled by MauvilleCity_Gym_EventScript_SetAltBarriers
void MauvilleGymSetDefaultBarriers(void)
{
int x, y;
// All switches/barriers are within these coord ranges -7
for (y = 12; y < 24; y++)
{
for (x = 7; x < 16; x++)
@@ -735,13 +734,9 @@ void MauvilleGymSpecial2(void)
break;
case METATILE_ID(MauvilleGym, FloorTile):
if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_ID(MauvilleGym, GreenBeamV1_On))
{
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV2_On) | METATILE_COLLISION_MASK);
}
else
{
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV2_On) | METATILE_COLLISION_MASK);
}
break;
case METATILE_ID(MauvilleGym, PoleBottom_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV1_On) | METATILE_COLLISION_MASK);
@@ -758,7 +753,7 @@ void MauvilleGymSpecial2(void)
}
// Presses all switches and deactivates all beams.
void MauvilleGymSpecial3(void)
void MauvilleGymDeactivatePuzzle(void)
{
int i, x, y;
const struct UCoords8 *switchCoords = sMauvilleGymSwitchCoords;

View File

@@ -607,7 +607,7 @@ bool8 ScrCmd_incrementgamestat(struct ScriptContext *ctx)
bool8 ScrCmd_animateflash(struct ScriptContext *ctx)
{
sub_80B009C(ScriptReadByte(ctx));
AnimateFlash(ScriptReadByte(ctx));
ScriptContext1_Stop();
return TRUE;
}