mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Document misc field_specials things
This commit is contained in:
parent
67636b7c64
commit
6e7bdb3ca4
@ -4769,7 +4769,7 @@ gUnknown_082A8350:: @ 82A8350
|
||||
waitmovement 0
|
||||
playse SE_RU_HYUU
|
||||
delay 60
|
||||
special sp13F_fall_to_last_warp
|
||||
special DoFallWarp
|
||||
waitstate
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ EventScript_2A4B9B:: @ 82A4B9B
|
||||
releaseall
|
||||
goto EventScript_2A4B5D
|
||||
|
||||
EventScript_2A4BAC:: @ 82A4BAC
|
||||
EventScript_PokeBlockFeeder:: @ 82A4BAC
|
||||
lockall
|
||||
special GetPokeblockFeederInFront
|
||||
compare VAR_RESULT, 65535
|
||||
|
@ -328,8 +328,8 @@ gSpecials:: @ 81DBA64
|
||||
def_special DoSealedChamberShakingEffect2
|
||||
def_special FoundBlackGlasses
|
||||
def_special sub_80AC81C
|
||||
def_special sp13E_warp_to_last_warp
|
||||
def_special sp13F_fall_to_last_warp
|
||||
def_special DoDiveWarp
|
||||
def_special DoFallWarp
|
||||
def_special ShowContestEntryMonPic
|
||||
def_special sub_80F8EB8
|
||||
def_special SetEReaderTrainerGfxId
|
||||
|
@ -538,7 +538,7 @@ extern const u8 EventScript_TV[];
|
||||
extern const u8 EventScript_ClosedSootopolisDoor[];
|
||||
extern const u8 SkyPillar_Outside_EventScript_2393F9[];
|
||||
extern const u8 EventScript_CableBoxResults[];
|
||||
extern const u8 EventScript_2A4BAC[];
|
||||
extern const u8 EventScript_PokeBlockFeeder[];
|
||||
extern const u8 Route110_TrickHouseEntrance_EventScript_26A22A[];
|
||||
extern const u8 EventScript_RegionMap[];
|
||||
extern const u8 EventScript_RunningShoesManual[];
|
||||
|
@ -7,8 +7,8 @@ struct FieldInput
|
||||
bool8 checkStandardWildEncounter:1;
|
||||
bool8 pressedStartButton:1;
|
||||
bool8 pressedSelectButton:1;
|
||||
bool8 input_field_0_4:1;
|
||||
bool8 input_field_0_5:1;
|
||||
bool8 heldDirection:1;
|
||||
bool8 heldDirection2:1;
|
||||
bool8 tookStep:1;
|
||||
bool8 pressedBButton:1;
|
||||
bool8 input_field_1_0:1;
|
||||
@ -20,7 +20,6 @@ struct FieldInput
|
||||
bool8 input_field_1_6:1;
|
||||
bool8 input_field_1_7:1;
|
||||
u8 dpadDirection;
|
||||
u8 input_field_3;
|
||||
};
|
||||
|
||||
void FieldClearPlayerInput(struct FieldInput *pStruct);
|
||||
|
@ -19,11 +19,11 @@ void sub_80AF688(void);
|
||||
bool8 sub_80AF6A4(void);
|
||||
void sub_80AF6D4(void);
|
||||
void sub_80AF6F0(void);
|
||||
void sub_80AF734(void);
|
||||
void sp13E_warp_to_last_warp(void);
|
||||
void DoWarp(void);
|
||||
void DoDiveWarp(void);
|
||||
void sub_80AF79C(void);
|
||||
void sub_80AF7D0(void);
|
||||
void sp13F_fall_to_last_warp(void);
|
||||
void DoDoorWarp(void);
|
||||
void DoFallWarp(void);
|
||||
void sub_80AF80C(u8 metatileBehavior);
|
||||
void sub_80AF828(void);
|
||||
void sub_80AF838(void);
|
||||
|
@ -57,7 +57,7 @@ void SetWarpDestinationToDynamicWarp(u8 unused);
|
||||
void SetWarpDestinationToHealLocation(u8 a1);
|
||||
void SetWarpDestinationToLastHealLocation(void);
|
||||
void SetLastHealLocationWarp(u8 healLocationId);
|
||||
void sub_8084D5C(s16 x, s16 y);
|
||||
void UpdateEscapeWarp(s16 x, s16 y);
|
||||
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||
void SetWarpDestinationToEscapeWarp(void);
|
||||
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||
|
@ -21,7 +21,7 @@ void sub_80EB498(void);
|
||||
void sub_80EB56C(void);
|
||||
void sub_80EB9E0(void);
|
||||
void sub_80EBB28(void);
|
||||
void sub_80E9668(const struct MapPosition *position, const struct MapEvents *events);
|
||||
void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events);
|
||||
|
||||
// SetCurrentSecretBaseFromPosition
|
||||
void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events);
|
||||
|
@ -12,17 +12,9 @@
|
||||
#include "overworld.h"
|
||||
#include "wallclock.h"
|
||||
|
||||
// static types
|
||||
|
||||
// static declarations
|
||||
|
||||
static void UpdatePerDay(struct Time *localTime);
|
||||
static void UpdatePerMinute(struct Time *localTime);
|
||||
|
||||
// rodata
|
||||
|
||||
// text
|
||||
|
||||
static void InitTimeBasedEvents(void)
|
||||
{
|
||||
FlagSet(FLAG_SYS_CLOCK_SET);
|
||||
|
@ -56,8 +56,8 @@ static bool8 TryArrowWarp(struct MapPosition *, u16, u8);
|
||||
static bool8 IsWarpMetatileBehavior(u16);
|
||||
static bool8 IsArrowWarpMetatileBehavior(u16, u8);
|
||||
static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *);
|
||||
static void sub_809CEB0(struct MapHeader *, s8, struct MapPosition *);
|
||||
static bool8 map_warp_consider_2_to_inside(struct MapPosition *, u16, u8);
|
||||
static void SetupWarp(struct MapHeader *, s8, struct MapPosition *);
|
||||
static bool8 TryDoorWarp(struct MapPosition *, u16, u8);
|
||||
static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
@ -74,8 +74,8 @@ void FieldClearPlayerInput(struct FieldInput *input)
|
||||
input->checkStandardWildEncounter = FALSE;
|
||||
input->pressedStartButton = FALSE;
|
||||
input->pressedSelectButton = FALSE;
|
||||
input->input_field_0_4 = FALSE;
|
||||
input->input_field_0_5 = FALSE;
|
||||
input->heldDirection = FALSE;
|
||||
input->heldDirection2 = FALSE;
|
||||
input->tookStep = FALSE;
|
||||
input->pressedBButton = FALSE;
|
||||
input->input_field_1_0 = FALSE;
|
||||
@ -107,8 +107,8 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
|
||||
|
||||
if (heldKeys & (DPAD_UP | DPAD_DOWN | DPAD_LEFT | DPAD_RIGHT))
|
||||
{
|
||||
input->input_field_0_4 = TRUE;
|
||||
input->input_field_0_5 = TRUE;
|
||||
input->heldDirection = TRUE;
|
||||
input->heldDirection2 = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
}
|
||||
if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE)
|
||||
return TRUE;
|
||||
if (input->input_field_0_4 && input->dpadDirection == playerDirection)
|
||||
if (input->heldDirection && input->dpadDirection == playerDirection)
|
||||
{
|
||||
if (TryArrowWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
@ -171,9 +171,9 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
|
||||
if (input->input_field_0_5 && input->dpadDirection == playerDirection)
|
||||
if (input->heldDirection2 && input->dpadDirection == playerDirection)
|
||||
{
|
||||
if (map_warp_consider_2_to_inside(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
if (TryDoorWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
if (input->pressedAButton && TrySetupDiveDownScript() == TRUE)
|
||||
@ -304,13 +304,10 @@ static const u8 *GetInteractedEventObjectScript(struct MapPosition *position, u8
|
||||
gSpecialVar_Facing = direction;
|
||||
|
||||
if (InTrainerHill() == TRUE)
|
||||
{
|
||||
script = sub_81D62AC();
|
||||
}
|
||||
else
|
||||
{
|
||||
script = GetEventObjectScriptPointerByEventObjectId(eventObjectId);
|
||||
}
|
||||
|
||||
script = GetRamScript(gSpecialVar_LastTalked, script);
|
||||
return script;
|
||||
}
|
||||
@ -381,7 +378,7 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
|
||||
if (MetatileBehavior_IsCableBoxResults1(metatileBehavior) == TRUE)
|
||||
return EventScript_CableBoxResults;
|
||||
if (MetatileBehavior_IsPokeblockFeeder(metatileBehavior) == TRUE)
|
||||
return EventScript_2A4BAC;
|
||||
return EventScript_PokeBlockFeeder;
|
||||
if (MetatileBehavior_IsTrickHousePuzzleDoor(metatileBehavior) == TRUE)
|
||||
return Route110_TrickHouseEntrance_EventScript_26A22A;
|
||||
if (MetatileBehavior_IsRegionMap(metatileBehavior) == TRUE)
|
||||
@ -694,8 +691,8 @@ static bool8 TryArrowWarp(struct MapPosition *position, u16 metatileBehavior, u8
|
||||
if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE && warpEventId != -1)
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
sub_809CEB0(&gMapHeader, warpEventId, position);
|
||||
sub_80AF734();
|
||||
SetupWarp(&gMapHeader, warpEventId, position);
|
||||
DoWarp();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -708,7 +705,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
|
||||
if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE)
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
sub_809CEB0(&gMapHeader, warpEventId, position);
|
||||
SetupWarp(&gMapHeader, warpEventId, position);
|
||||
if (MetatileBehavior_IsEscalator(metatileBehavior) == TRUE)
|
||||
{
|
||||
sub_80AF80C(metatileBehavior);
|
||||
@ -744,7 +741,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
|
||||
sub_80AF87C();
|
||||
return TRUE;
|
||||
}
|
||||
sub_80AF734();
|
||||
DoWarp();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -787,7 +784,7 @@ static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosit
|
||||
return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height);
|
||||
}
|
||||
|
||||
static void sub_809CEB0(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
|
||||
static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
|
||||
{
|
||||
const struct WarpEvent *warpEvent;
|
||||
|
||||
@ -829,14 +826,14 @@ static void sub_809CEB0(struct MapHeader *unused, s8 warpEventId, struct MapPosi
|
||||
const struct MapHeader *mapHeader;
|
||||
|
||||
SetWarpDestinationToMapWarp(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId);
|
||||
sub_8084D5C(position->x, position->y);
|
||||
UpdateEscapeWarp(position->x, position->y);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum);
|
||||
if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(NONE))
|
||||
SetDynamicWarp(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, warpEventId);
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 metatileBehavior, u8 direction)
|
||||
static bool8 TryDoorWarp(struct MapPosition *position, u16 metatileBehavior, u8 direction)
|
||||
{
|
||||
s8 warpEventId;
|
||||
|
||||
@ -844,17 +841,18 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met
|
||||
{
|
||||
if (MetatileBehavior_IsOpenSecretBaseDoor(metatileBehavior) == TRUE)
|
||||
{
|
||||
sub_80E9668(position, gMapHeader.events);
|
||||
WarpIntoSecretBase(position, gMapHeader.events);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (MetatileBehavior_IsWarpDoor(metatileBehavior) == TRUE)
|
||||
{
|
||||
warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position);
|
||||
if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE)
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
sub_809CEB0(&gMapHeader, warpEventId, position);
|
||||
sub_80AF7D0();
|
||||
SetupWarp(&gMapHeader, warpEventId, position);
|
||||
DoDoorWarp();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -949,7 +947,7 @@ bool8 dive_warp(struct MapPosition *position, u16 metatileBehavior)
|
||||
if (SetDiveWarpEmerge(position->x - 7, position->y - 7))
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
sp13E_warp_to_last_warp();
|
||||
DoDiveWarp();
|
||||
PlaySE(SE_W291);
|
||||
return TRUE;
|
||||
}
|
||||
@ -959,7 +957,7 @@ bool8 dive_warp(struct MapPosition *position, u16 metatileBehavior)
|
||||
if (SetDiveWarpDive(position->x - 7, position->y - 7))
|
||||
{
|
||||
StoreInitialPlayerAvatarState();
|
||||
sp13E_warp_to_last_warp();
|
||||
DoDiveWarp();
|
||||
PlaySE(SE_W291);
|
||||
return TRUE;
|
||||
}
|
||||
@ -1004,6 +1002,6 @@ int SetCableClubWarp(void)
|
||||
GetPlayerMovementDirection(); //unnecessary
|
||||
GetPlayerPosition(&position);
|
||||
MapGridGetMetatileBehaviorAt(position.x, position.y); //unnecessary
|
||||
sub_809CEB0(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position);
|
||||
SetupWarp(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position);
|
||||
return 0;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ static bool32 sub_80AF71C(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_80AF734(void)
|
||||
void DoWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
TryFadeOutOldMapMusic();
|
||||
@ -509,7 +509,7 @@ void sub_80AF734(void)
|
||||
CreateTask(sub_80AFA0C, 10);
|
||||
}
|
||||
|
||||
void sp13E_warp_to_last_warp(void)
|
||||
void DoDiveWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
TryFadeOutOldMapMusic();
|
||||
@ -529,16 +529,16 @@ void sub_80AF79C(void)
|
||||
CreateTask(sub_80AFA0C, 10);
|
||||
}
|
||||
|
||||
void sub_80AF7D0(void)
|
||||
void DoDoorWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
gFieldCallback = mapldr_default;
|
||||
CreateTask(sub_80AFA88, 10);
|
||||
}
|
||||
|
||||
void sp13F_fall_to_last_warp(void)
|
||||
void DoFallWarp(void)
|
||||
{
|
||||
sp13E_warp_to_last_warp();
|
||||
DoDiveWarp();
|
||||
gFieldCallback = sub_80B6B68;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ void Task_HandlePorthole(u8 taskId)
|
||||
FlagClear(0x4001);
|
||||
FlagClear(0x4000);
|
||||
SetWarpDestinationToDynamicWarp(0);
|
||||
sp13E_warp_to_last_warp();
|
||||
DoDiveWarp();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
@ -391,11 +392,11 @@ bool32 sub_8138120(void)
|
||||
{
|
||||
switch (gMapHeader.mapType)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
if (++(*GetVarPointer(VAR_0x40F3)) < 0xA)
|
||||
case MAP_TYPE_TOWN:
|
||||
case MAP_TYPE_CITY:
|
||||
case MAP_TYPE_ROUTE:
|
||||
case MAP_TYPE_6:
|
||||
if (++(*GetVarPointer(VAR_0x40F3)) < 10)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ void SetLastHealLocationWarp(u8 healLocationId)
|
||||
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y);
|
||||
}
|
||||
|
||||
void sub_8084D5C(s16 x, s16 y)
|
||||
void UpdateEscapeWarp(s16 x, s16 y)
|
||||
{
|
||||
u8 currMapType = GetCurrentMapType();
|
||||
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
|
||||
|
@ -749,7 +749,7 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx)
|
||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||
sub_80AF734();
|
||||
DoWarp();
|
||||
ResetInitialPlayerAvatarState();
|
||||
return TRUE;
|
||||
}
|
||||
@ -763,7 +763,7 @@ bool8 ScrCmd_warpsilent(struct ScriptContext *ctx)
|
||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||
sp13E_warp_to_last_warp();
|
||||
DoDiveWarp();
|
||||
ResetInitialPlayerAvatarState();
|
||||
return TRUE;
|
||||
}
|
||||
@ -777,7 +777,7 @@ bool8 ScrCmd_warpdoor(struct ScriptContext *ctx)
|
||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||
sub_80AF7D0();
|
||||
DoDoorWarp();
|
||||
ResetInitialPlayerAvatarState();
|
||||
return TRUE;
|
||||
}
|
||||
@ -794,7 +794,7 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
|
||||
SetWarpDestinationToFixedHoleWarp(x - 7, y - 7);
|
||||
else
|
||||
SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
|
||||
sp13F_fall_to_last_warp();
|
||||
DoFallWarp();
|
||||
ResetInitialPlayerAvatarState();
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ void sub_80E9608(const struct MapPosition *position, const struct MapEvents *eve
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80E9668(const struct MapPosition *position, const struct MapEvents *events)
|
||||
void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events)
|
||||
{
|
||||
sub_80E9608(position, events);
|
||||
sub_80E8B6C();
|
||||
|
Loading…
Reference in New Issue
Block a user