do some scrcmd/overworld labeling

This commit is contained in:
camthesaxman 2017-09-23 23:49:37 -05:00
parent 5598fc659b
commit cdc5d1b683
14 changed files with 163 additions and 148 deletions

View File

@ -603,7 +603,7 @@ struct SaveBlock1 /* 0x02025734 */
/*0x04*/ struct WarpData location;
/*0x0C*/ struct WarpData warp1;
/*0x14*/ struct WarpData warp2;
/*0x1C*/ struct WarpData warp3;
/*0x1C*/ struct WarpData lastHealLocation;
/*0x24*/ struct WarpData warp4;
/*0x2C*/ u16 battleMusic;
/*0x2E*/ u8 weather;

View File

@ -26,10 +26,10 @@ extern const struct UCoords32 gUnknown_0821664C[];
extern void (*gFieldCallback)(void);
// sub_8052F5C
void flag_var_implications_of_teleport_(void);
void Overworld_ResetStateAfterFly(void);
void Overworld_ResetStateAfterTeleport(void);
void sub_8053014(void);
void sub_8053050(void);
void Overworld_ResetStateAfterDigEscRope(void);
void Overworld_ResetStateAfterWhiteOut(void);
// sub_805308C
void ResetGameStats(void);
void IncrementGameStat(u8 index);
@ -41,8 +41,8 @@ void Overworld_SaveMapObjCoords(u8, s16, s16);
void Overworld_SaveMapObjMovementType(u8, u8);
// mapdata_load_assets_to_gpu_and_full_redraw
// get_mapdata_header
// warp_shift
// warp_set
// ApplyCurrentWarp
// SetWarpData
// warp_data_is_not_neg_1
struct MapHeader * const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
struct MapHeader * const warp1_get_mapheader(void);
@ -50,14 +50,14 @@ struct MapHeader * const warp1_get_mapheader(void);
// LoadSaveblockMapHeader
// sub_80533CC
void warp_in(void);
void warp1_set(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set_2(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
void sub_8053538(u8);
void sub_8053570(void);
void sub_8053588(u8);
void Overworld_SetWarpDestToLastHealLoc(void);
void Overworld_SetHealLocationWarp(u8);
void sub_80535C4(s16 a1, s16 a2);
void sub_805363C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8053678(void);
@ -69,7 +69,7 @@ void sub_8053720(s16, s16);
// unref_sub_8053790
void sub_80537CC(u8);
void gpu_sync_bg_hide();
// sub_8053818
// GetMapConnection
// sub_8053850
bool8 sub_80538B0(u16 x, u16 y);
bool8 sub_80538D0(u16 x, u16 y);
@ -89,7 +89,7 @@ void sub_8053D14(u16);
// sub_8053D30
// sub_8053D6C
// GetLocationMusic
// sav1_map_get_music
// GetCurrLocationMusic
// warp1_target_get_music
// call_map_music_set_to_zero
void sub_8053E90(void);

View File

@ -2199,7 +2199,7 @@ void sub_80FF0E0(u8 taskId)
void sub_80FF114(u8 taskId)
{
DrawWholeMapView();
warp1_set(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
Overworld_SetWarpDestination(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
warp_in();
}
void sub_80FF160(u8 taskId)

View File

@ -1213,7 +1213,7 @@ void task00_8084310(u8 taskId)
}
if (!FieldEffectActiveListContains(FLDEFF_USE_FLY))
{
flag_var_implications_of_teleport_();
Overworld_ResetStateAfterFly();
warp_in();
SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08084390;
@ -2267,7 +2267,7 @@ void sub_8087D78(struct Task *task)
{
if (!gPaletteFade.active && sub_8054034() == TRUE)
{
sub_8053570();
Overworld_SetWarpDestToLastHealLoc();
warp_in();
SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08085D88;

View File

@ -250,7 +250,7 @@ bool8 sub_80C7754(void)
}
else
{
warp1_set(mapGroup, mapNum, -1, x, y);
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y);
return TRUE;
}
}

View File

@ -700,11 +700,11 @@ void CableCarWarp(void)
{
if (gSpecialVar_0x8004 != 0)
{
warp1_set(MAP_GROUP_ROUTE112_CABLE_CAR_STATION, MAP_ID_ROUTE112_CABLE_CAR_STATION, -1, 6, 4);
Overworld_SetWarpDestination(MAP_GROUP_ROUTE112_CABLE_CAR_STATION, MAP_ID_ROUTE112_CABLE_CAR_STATION, -1, 6, 4);
}
else
{
warp1_set(MAP_GROUP_MT_CHIMNEY_CABLE_CAR_STATION, MAP_ID_MT_CHIMNEY_CABLE_CAR_STATION, -1, 6, 4);
Overworld_SetWarpDestination(MAP_GROUP_MT_CHIMNEY_CABLE_CAR_STATION, MAP_ID_MT_CHIMNEY_CABLE_CAR_STATION, -1, 6, 4);
}
}

View File

@ -152,7 +152,7 @@ static u8 sReturnLocation;
static const u8 *sPopupMenuActionList;
// common
void (*gUnknown_03005D00)(u8) = NULL;
void (*gFieldItemUseCallback)(u8) = NULL;
extern u16 gUnknown_030041B4;
extern struct PocketScrollState gBagPocketScrollStates[];
extern struct ItemSlot *gCurrentBagPocketItemSlots; // selected pocket item slots
@ -2718,7 +2718,7 @@ void ExecuteItemUseFromBlackPalette(void)
static void Task_CallItemUseOnFieldCallback(u8 taskId)
{
if (sub_807D770() == TRUE)
gUnknown_03005D00(taskId);
gFieldItemUseCallback(taskId);
}
void sub_80A5D04(void)

View File

@ -36,7 +36,7 @@
#include "task.h"
#include "vars.h"
extern void (*gUnknown_03005D00)(u8);
extern void (*gFieldItemUseCallback)(u8);
extern void (*gFieldCallback)(void);
extern void (*gUnknown_0300485C)(void);
extern void (*gUnknown_03004AE4)(u8, u16, TaskFunc);
@ -106,11 +106,13 @@ void SetUpItemUseOnFieldCallback(u8 taskId)
{
if (gTasks[taskId].data[2] != 1)
{
gFieldCallback = (void *)ExecuteItemUseFromBlackPalette;
gFieldCallback = ExecuteItemUseFromBlackPalette;
ItemMenu_ConfirmNormalFade(taskId);
}
else
gUnknown_03005D00(taskId);
{
gFieldItemUseCallback(taskId);
}
}
void HandleDeniedItemUseMessage(u8 var1, u8 playerMenuStatus, const u8 *text)
@ -187,7 +189,7 @@ void ItemUseOutOfBattle_Bike(u8 taskId)
{
if (Overworld_IsBikeAllowedOnCurrentMap() == TRUE && IsBikingDisallowedByPlayer() == FALSE)
{
gUnknown_03005D00 = (void *)ItemUseOnFieldCB_Bike;
gFieldItemUseCallback = (void *)ItemUseOnFieldCB_Bike;
SetUpItemUseOnFieldCallback(taskId);
}
else
@ -241,7 +243,7 @@ void ItemUseOutOfBattle_Rod(u8 taskId)
{
if (CanFish() == TRUE)
{
gUnknown_03005D00 = (void *)ItemUseOnFieldCB_Rod;
gFieldItemUseCallback = (void *)ItemUseOnFieldCB_Rod;
SetUpItemUseOnFieldCallback(taskId);
}
else
@ -257,7 +259,7 @@ void ItemUseOnFieldCB_Rod(u8 taskId)
void ItemUseOutOfBattle_Itemfinder(u8 var)
{
IncrementGameStat(0x27);
gUnknown_03005D00 = (void *)ItemUseOnFieldCB_Itemfinder;
gFieldItemUseCallback = (void *)ItemUseOnFieldCB_Itemfinder;
SetUpItemUseOnFieldCallback(var);
}
@ -780,7 +782,7 @@ void sub_80C9C7C(u8 taskId)
{
if (IsPlayerFacingPlantedBerryTree() == TRUE)
{
gUnknown_03005D00 = sub_80C9D00;
gFieldItemUseCallback = sub_80C9D00;
gFieldCallback = ExecuteItemUseFromBlackPalette;
gTasks[taskId].data[8] = (u32)c2_exit_to_overworld_2_switch >> 16;
gTasks[taskId].data[9] = (u32)c2_exit_to_overworld_2_switch;
@ -805,7 +807,7 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId)
{
if (TryToWaterBerryTree() == TRUE)
{
gUnknown_03005D00 = sub_80C9D74;
gFieldItemUseCallback = sub_80C9D74;
SetUpItemUseOnFieldCallback(taskId);
}
else
@ -909,7 +911,7 @@ void sub_80C9FC0(u8 var)
sub_80C9D98(var);
}
void sub_80C9FDC(void)
static void PrepareItemUseMessage(void)
{
RemoveBagItem(gScriptItemId, 1);
sub_80A3E0C();
@ -922,7 +924,7 @@ void ItemUseOutOfBattle_Repel(u8 var)
if (VarGet(VAR_REPEL_STEP_COUNT) == FALSE)
{
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gScriptItemId));
sub_80C9FDC();
PrepareItemUseMessage();
DisplayItemMessageOnField(var, gStringVar4, CleanUpItemMenuMessage, 1);
}
else
@ -975,10 +977,10 @@ void task08_080A1C44(u8 taskId)
DestroyTask(taskId);
}
void sub_80CA18C(u8 taskId)
void EscapeRopeCallback(u8 taskId)
{
sub_8053014();
sub_80C9FDC();
Overworld_ResetStateAfterDigEscRope();
PrepareItemUseMessage();
gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, task08_080A1C44, 0);
}
@ -995,7 +997,7 @@ void ItemUseOutOfBattle_EscapeRope(u8 taskId)
{
if (CanUseEscapeRopeOnCurrMap() == TRUE)
{
gUnknown_03005D00 = sub_80CA18C;
gFieldItemUseCallback = EscapeRopeCallback;
SetUpItemUseOnFieldCallback(taskId);
}
else
@ -1114,7 +1116,7 @@ void ItemUseInBattle_Escape(u8 taskId)
if((gBattleTypeFlags & BATTLE_TYPE_TRAINER) == FALSE)
{
sub_80C9FDC();
PrepareItemUseMessage();
DisplayItemMessageOnField(taskId, gStringVar4, sub_80A7094, 1);
}
else

View File

@ -99,7 +99,7 @@ void sub_8052DE4(void)
void WarpToTruck(void)
{
warp1_set(25, 40, -1, -1, -1); // inside of truck
Overworld_SetWarpDestination(25, 40, -1, -1, -1); // inside of truck
warp_in();
}

View File

@ -91,7 +91,7 @@ extern struct MapHeader * const * const gMapGroups[];
extern s32 gMaxFlashLevel;
EWRAM_DATA struct WarpData gUnknown_020297F0 = {0};
EWRAM_DATA struct WarpData gUnknown_020297F8 = {0};
EWRAM_DATA struct WarpData gWarpDestination = {0}; // new warp position
EWRAM_DATA struct WarpData gUnknown_02029800 = {0};
EWRAM_DATA struct WarpData gUnknown_02029808 = {0};
EWRAM_DATA struct UnkPlayerStruct gUnknown_02029810 = {0};
@ -195,12 +195,12 @@ static void DoWhiteOut(void)
ScriptContext2_RunNewScript(S_WhiteOut);
gSaveBlock1.money /= 2;
ScrSpecial_HealPlayerParty();
sub_8053050();
sub_8053570();
Overworld_ResetStateAfterWhiteOut();
Overworld_SetWarpDestToLastHealLoc();
warp_in();
}
void flag_var_implications_of_teleport_(void)
void Overworld_ResetStateAfterFly(void)
{
player_avatar_init_params_reset();
FlagClear(SYS_CYCLING_ROAD);
@ -221,7 +221,7 @@ void Overworld_ResetStateAfterTeleport(void)
ScriptContext2_RunNewScript(gUnknown_0819FC9F);
}
void sub_8053014(void)
void Overworld_ResetStateAfterDigEscRope(void)
{
player_avatar_init_params_reset();
FlagClear(SYS_CYCLING_ROAD);
@ -231,7 +231,7 @@ void sub_8053014(void)
FlagClear(SYS_USE_FLASH);
}
void sub_8053050(void)
void Overworld_ResetStateAfterWhiteOut(void)
{
player_avatar_init_params_reset();
FlagClear(SYS_CYCLING_ROAD);
@ -318,6 +318,7 @@ void Overworld_SaveMapObjCoords(u8 localId, s16 x, s16 y)
void Overworld_SaveMapObjMovementType(u8 localId, u8 movementType)
{
s32 i;
for (i = 0; i < 64; i++)
{
struct MapObjectTemplate *mapObjectTemplate = &gSaveBlock1.mapObjectTemplates[i];
@ -346,15 +347,15 @@ static struct MapData *get_mapdata_header(void)
return NULL;
}
static void warp_shift(void)
static void ApplyCurrentWarp(void)
{
gUnknown_020297F0 = gSaveBlock1.location;
gSaveBlock1.location = gUnknown_020297F8;
gSaveBlock1.location = gWarpDestination;
gUnknown_02029800 = sDummyWarpData;
gUnknown_02029808 = sDummyWarpData;
}
static void warp_set(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
static void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp->mapGroup = mapGroup;
warp->mapNum = mapNum;
@ -385,7 +386,7 @@ struct MapHeader *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 map
struct MapHeader *const warp1_get_mapheader(void)
{
return Overworld_GetMapHeaderByGroupAndId(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
return Overworld_GetMapHeaderByGroupAndId(gWarpDestination.mapGroup, gWarpDestination.mapNum);
}
static void set_current_map_header_from_sav1_save_old_name(void)
@ -422,34 +423,34 @@ void sub_80533CC(void)
void warp_in(void)
{
warp_shift();
ApplyCurrentWarp();
set_current_map_header_from_sav1_save_old_name();
sub_80533CC();
}
void warp1_set(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gUnknown_020297F8, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gWarpDestination, mapGroup, mapNum, warpId, x, y);
}
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId)
{
warp1_set(mapGroup, mapNum, warpId, -1, -1);
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, -1, -1);
}
void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId)
{
warp_set(&gSaveBlock1.warp2, mapGroup, mapNum, warpId, gSaveBlock1.pos.x, gSaveBlock1.pos.y);
SetWarpData(&gSaveBlock1.warp2, mapGroup, mapNum, warpId, gSaveBlock1.pos.x, gSaveBlock1.pos.y);
}
void saved_warp2_set_2(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gSaveBlock1.warp2, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gSaveBlock1.warp2, mapGroup, mapNum, warpId, x, y);
}
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused)
{
gUnknown_020297F8 = gSaveBlock1.warp2;
gWarpDestination = gSaveBlock1.warp2;
}
void sub_8053538(u8 a1)
@ -457,81 +458,82 @@ void sub_8053538(u8 a1)
const struct HealLocation *warp = GetHealLocation(a1);
if (warp)
warp1_set(warp->group, warp->map, -1, warp->x, warp->y);
Overworld_SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y);
}
void sub_8053570(void)
void Overworld_SetWarpDestToLastHealLoc(void)
{
gUnknown_020297F8 = gSaveBlock1.warp3;
gWarpDestination = gSaveBlock1.lastHealLocation;
}
void sub_8053588(u8 a1)
void Overworld_SetHealLocationWarp(u8 healLocationId)
{
const struct HealLocation *warp = GetHealLocation(a1);
if (warp)
warp_set(&gSaveBlock1.warp3, warp->group, warp->map, -1, warp->x, warp->y);
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
if (healLocation != NULL)
SetWarpData(&gSaveBlock1.lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y);
}
void sub_80535C4(s16 a1, s16 a2)
{
u8 v4 = Overworld_GetMapTypeOfSaveblockLocation();
u8 v5 = GetMapTypeByGroupAndId(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
u8 v5 = GetMapTypeByGroupAndId(gWarpDestination.mapGroup, gWarpDestination.mapNum);
if (is_map_type_1_2_3_5_or_6(v4) && is_map_type_1_2_3_5_or_6(v5) != TRUE)
sub_805363C(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, a1 - 7, a2 - 6);
}
void sub_805363C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gSaveBlock1.warp4, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gSaveBlock1.warp4, mapGroup, mapNum, warpId, x, y);
}
void sub_8053678(void)
{
gUnknown_020297F8 = gSaveBlock1.warp4;
gWarpDestination = gSaveBlock1.warp4;
}
void sub_8053690(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gUnknown_02029800, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gUnknown_02029800, mapGroup, mapNum, warpId, x, y);
}
void warp1_set_to_warp2(void)
static void warp1_set_to_warp2(void)
{
gUnknown_020297F8 = gUnknown_02029800;
gWarpDestination = gUnknown_02029800;
}
void sub_80536E4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gUnknown_02029808, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gUnknown_02029808, mapGroup, mapNum, warpId, x, y);
}
void sub_8053720(s16 x, s16 y)
{
if (warp_data_is_not_neg_1(&gUnknown_02029808) == TRUE)
{
gUnknown_020297F8 = gUnknown_020297F0;
gWarpDestination = gUnknown_020297F0;
}
else
{
warp1_set(gUnknown_02029808.mapGroup, gUnknown_02029808.mapNum, -1, x, y);
Overworld_SetWarpDestination(gUnknown_02029808.mapGroup, gUnknown_02029808.mapNum, -1, x, y);
}
}
void sub_8053778(void)
{
gUnknown_020297F8 = gSaveBlock1.warp1;
gWarpDestination = gSaveBlock1.warp1;
}
void unref_sub_8053790(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
warp_set(&gSaveBlock1.warp1, mapGroup, mapNum, warpId, x, y);
SetWarpData(&gSaveBlock1.warp1, mapGroup, mapNum, warpId, x, y);
}
void sub_80537CC(u8 a1)
{
const struct HealLocation *warp = GetHealLocation(a1);
if (warp)
warp_set(&gSaveBlock1.warp1, warp->group, warp->map, -1, warp->x, warp->y);
SetWarpData(&gSaveBlock1.warp1, warp->group, warp->map, -1, warp->x, warp->y);
}
void gpu_sync_bg_hide()
@ -539,7 +541,7 @@ void gpu_sync_bg_hide()
gSaveBlock1.warp1 = gSaveBlock1.warp2;
}
struct MapConnection *sub_8053818(u8 dir)
struct MapConnection *GetMapConnection(u8 dir)
{
s32 i;
s32 count = gMapHeader.connections->count;
@ -557,10 +559,11 @@ struct MapConnection *sub_8053818(u8 dir)
bool8 sub_8053850(u8 dir, u16 x, u16 y)
{
struct MapConnection *connection = sub_8053818(dir);
struct MapConnection *connection = GetMapConnection(dir);
if (connection != NULL)
{
warp1_set(connection->mapGroup, connection->mapNum, -1, x, y);
Overworld_SetWarpDestination(connection->mapGroup, connection->mapNum, -1, x, y);
}
else
{
@ -586,9 +589,9 @@ void sub_80538F0(u8 mapGroup, u8 mapNum)
{
s32 i;
warp1_set(mapGroup, mapNum, -1, -1, -1);
Overworld_SetWarpDestination(mapGroup, mapNum, -1, -1, -1);
sub_8053F0C();
warp_shift();
ApplyCurrentWarp();
set_current_map_header_from_sav1_save_old_name();
sub_8053154();
ClearTempFieldEventData();
@ -830,7 +833,7 @@ static u16 GetLocationMusic(struct WarpData *warp)
return Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum)->music;
}
u16 sav1_map_get_music(void)
u16 GetCurrLocationMusic(void)
{
u16 music;
@ -855,7 +858,7 @@ u16 sav1_map_get_music(void)
u16 warp1_target_get_music(void)
{
u16 music = GetLocationMusic(&gUnknown_020297F8);
u16 music = GetLocationMusic(&gWarpDestination);
if (music != 0x7FFF)
{
return music;
@ -877,7 +880,7 @@ void call_map_music_set_to_zero(void)
void sub_8053E90(void)
{
u16 music = sav1_map_get_music();
u16 music = GetCurrLocationMusic();
if (music != LEGENDARY_MUSIC)
{
@ -929,8 +932,8 @@ void sub_8053F0C(void)
void sub_8053F84(void)
{
u16 currentMusic = GetCurrentMapMusic();
if (currentMusic != sav1_map_get_music())
FadeOutAndPlayNewMapMusic(sav1_map_get_music(), 8);
if (currentMusic != GetCurrLocationMusic())
FadeOutAndPlayNewMapMusic(GetCurrLocationMusic(), 8);
}
void Overworld_ChangeMusicTo(u16 newMusic)

View File

@ -169,7 +169,7 @@ int SetUpFieldMove_Dig(void)
static void sub_810B5D8(void)
{
sub_8053014();
Overworld_ResetStateAfterDigEscRope();
FieldEffectStart(FLDEFF_USE_DIG);
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
}

View File

@ -670,12 +670,13 @@ bool8 ScrCmd_setmapfooter(struct ScriptContext *ctx)
bool8 ScrCmd_warp(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
warp1_set(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_8080E88();
player_avatar_init_params_reset();
return TRUE;
@ -683,12 +684,13 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx)
bool8 ScrCmd_warpmuted(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
warp1_set(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sp13E_warp_to_last_warp();
player_avatar_init_params_reset();
return TRUE;
@ -696,12 +698,13 @@ bool8 ScrCmd_warpmuted(struct ScriptContext *ctx)
bool8 ScrCmd_warpwalk(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
warp1_set(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_8080EF0();
player_avatar_init_params_reset();
return TRUE;
@ -709,17 +712,17 @@ bool8 ScrCmd_warpwalk(struct ScriptContext *ctx)
bool8 ScrCmd_warphole(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u16 x;
u16 y;
PlayerGetDestCoords(&x, &y);
if (v1 == 0xFF && v2 == 0xFF)
if (mapGroup == 0xFF && mapNum == 0xFF)
sub_8053720(x - 7, y - 7);
else
warp1_set(v1, v2, -1, x - 7, y - 7);
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
sp13F_fall_to_last_warp();
player_avatar_init_params_reset();
@ -728,12 +731,13 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
warp1_set(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_8080F68();
player_avatar_init_params_reset();
return TRUE;
@ -741,65 +745,71 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
bool8 ScrCmd_warp3(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
warp1_set(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
bool8 ScrCmd_warpplace(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
saved_warp2_set_2(0, v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
saved_warp2_set_2(0, mapGroup, mapNum, warpId, x, y);
return FALSE;
}
bool8 ScrCmd_warp4(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
sub_8053690(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
sub_8053690(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
bool8 ScrCmd_warp5(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
sub_80536E4(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
sub_80536E4(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
bool8 ScrCmd_warp6(struct ScriptContext *ctx)
{
u8 v1 = ScriptReadByte(ctx);
u8 v2 = ScriptReadByte(ctx);
u8 v3 = ScriptReadByte(ctx);
u16 v4 = VarGet(ScriptReadHalfword(ctx));
s8 v5 = VarGet(ScriptReadHalfword(ctx));
sub_805363C(v1, v2, v3, v4, v5);
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
u8 warpId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
sub_805363C(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
bool8 ScrCmd_getplayerxy(struct ScriptContext *ctx)
{
u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx));
u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx));
*ptr1 = gSaveBlock1.pos.x;
*ptr2 = gSaveBlock1.pos.y;
u16 *pX = GetVarPointer(ScriptReadHalfword(ctx));
u16 *pY = GetVarPointer(ScriptReadHalfword(ctx));
*pX = gSaveBlock1.pos.x;
*pY = gSaveBlock1.pos.y;
return FALSE;
}
@ -1748,8 +1758,8 @@ bool8 ScrCmd_checkanimation(struct ScriptContext *ctx)
bool8 ScrCmd_sethealplace(struct ScriptContext *ctx)
{
u16 v2 = VarGet(ScriptReadHalfword(ctx));
sub_8053588(v2);
u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
Overworld_SetHealLocationWarp(healLocationId);
return FALSE;
}

View File

@ -301,7 +301,7 @@ void sub_80BBBEC(u8 taskid)
s8 idx;
if (!gPaletteFade.active) {
idx = 4 * (gUnknown_020387DC / 10);
warp1_set(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, gUnknown_083D1374[idx + 2], gUnknown_083D1374[idx + 3]);
Overworld_SetWarpDestination(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, gUnknown_083D1374[idx + 2], gUnknown_083D1374[idx + 3]);
warp_in();
gFieldCallback = sub_80BBB90;
SetMainCallback2(CB2_LoadMap);

View File

@ -172,7 +172,7 @@ gUnknown_03005CF0: @ 3005CF0
@ item_menu
.align 4
gUnknown_03005D00: @ 3005D00
gFieldItemUseCallback: @ 3005D00
.space 0x10
gBagPocketScrollStates: @ 3005D10