diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/field_control_avatar.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index a973b80ca..ffdf926f5 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -100,12 +100,12 @@ static bool8 CheckStandardWildEncounter(u16); static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *, u16, u8); static bool8 IsWarpMetatileBehavior(u16); static bool8 IsArrowWarpMetatileBehavior(u16, u8); -static s8 FindWarpEventByPosition(struct MapHeader *, struct MapPosition *); +static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *); static void sub_8068C30(struct MapHeader *, s8, struct MapPosition *); static bool8 map_warp_consider_2_to_inside(struct MapPosition *, u16, u8); -static s8 FindWarpEventByCoordsAndId(struct MapHeader *, u16, u16, u8); +static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8); static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8); -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *, u16, u16, u8); +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8); static bool8 TryStartCoordEventScript(struct MapPosition *); static bool8 TryStartWarpEventScript(struct MapPosition *, u16); static bool8 TryStartCrackedFloorHoleScript(u16); @@ -400,7 +400,7 @@ static u8 *GetInteractedEventObjectScript(struct MapPosition *position, u8 metat static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - struct BgEvent *bgEvent = FindBackgroundEventByPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); + struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); if (bgEvent == NULL) return NULL; @@ -676,7 +676,7 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior) static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *position, u16 metatileBehavior, u8 direction) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE && warpEventId != -1) { @@ -690,7 +690,7 @@ static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct Map bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileBehavior) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { @@ -757,9 +757,9 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction) return FALSE; } -static s8 FindWarpEventByPosition(struct MapHeader *mapHeader, struct MapPosition *position) +static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position) { - return FindWarpEventByCoordsAndId(mapHeader, position->x - 7, position->y - 7, position->height); + return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height); } static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position) @@ -768,17 +768,17 @@ static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosi if (warpEvent->mapNum == 0x7F) { - copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->mapGroup); + copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->warpId); } else { struct MapHeader *mapHeader; - warp1_set_2(warpEvent->unk7, warpEvent->mapNum, warpEvent->mapGroup); + warp1_set_2(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId); sub_80535C4(position->x, position->y); - mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->unk7, warpEvent->mapNum); - if (mapHeader->events->warps[warpEvent->mapGroup].mapNum == 0x7F) - saved_warp2_set(mapHeader->events->warps[warpEventId].mapGroup, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); + mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum); + if (mapHeader->events->warps[warpEvent->warpId].mapNum == 0x7F) + saved_warp2_set(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); } } @@ -795,7 +795,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met } if (MetatileBehavior_IsWarpDoor(metatileBehavior) == TRUE) { - warpEventId = FindWarpEventByPosition(&gMapHeader, position); + warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { StoreInitialPlayerAvatarState(); @@ -808,7 +808,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met return FALSE; } -static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, u8 warpId) +static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { s32 i; struct WarpEvent *warpEvent = mapHeader->events->warps; @@ -818,7 +818,7 @@ static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, { if ((u16)warpEvent->x == x && (u16)warpEvent->y == y) { - if ((u8)warpEvent->warpId == warpId || (u8)warpEvent->warpId == 0) + if (warpEvent->elevation == elevation || warpEvent->elevation == 0) return i; } } @@ -871,7 +871,7 @@ u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position) return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); } -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { u8 i; struct BgEvent *bgEvents = mapHeader->events->bgEvents; @@ -950,6 +950,6 @@ int SetCableClubWarp(void) GetPlayerMovementDirection(); //unnecessary GetPlayerPosition(&position); MapGridGetMetatileBehaviorAt(position.x, position.y); //unnecessary - sub_8068C30(&gMapHeader, FindWarpEventByPosition(&gMapHeader, &position), &position); + sub_8068C30(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position); return 0; } |