Further synchronisation

This commit is contained in:
Slawter666 2018-10-17 01:11:44 +01:00
parent 3aff112127
commit 1435c96b41
23 changed files with 158 additions and 155 deletions

View File

@ -178,9 +178,9 @@ _0809C006:
bx r0 bx r0
thumb_func_end FieldGetPlayerInput thumb_func_end FieldGetPlayerInput
thumb_func_start sub_809C014 thumb_func_start ProcessPlayerFieldInput
@ int sub_809C014(overworld_input_data *input_data) @ int ProcessPlayerFieldInput(overworld_input_data *input_data)
sub_809C014: @ 809C014 ProcessPlayerFieldInput: @ 809C014
push {r4-r6,lr} push {r4-r6,lr}
sub sp, 0x8 sub sp, 0x8
adds r5, r0, 0 adds r5, r0, 0
@ -348,7 +348,7 @@ _0809C172:
pop {r4-r6} pop {r4-r6}
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end sub_809C014 thumb_func_end ProcessPlayerFieldInput
thumb_func_start player_get_pos_to_and_height thumb_func_start player_get_pos_to_and_height
player_get_pos_to_and_height: @ 809C17C player_get_pos_to_and_height: @ 809C17C
@ -1560,7 +1560,7 @@ overworld_poison_step: @ 809CB94
strh r1, [r0] strh r1, [r0]
cmp r1, 0 cmp r1, 0
bne _0809CBD4 bne _0809CBD4
bl overworld_poison bl DoPoisonFieldEffect
cmp r0, 0x1 cmp r0, 0x1
beq _0809CBD4 beq _0809CBD4
cmp r0, 0x1 cmp r0, 0x1

View File

@ -7851,7 +7851,7 @@ palette_bg_faded_fill_black: @ 80AF020
thumb_func_start pal_fill_for_maplights thumb_func_start pal_fill_for_maplights
pal_fill_for_maplights: @ 80AF040 pal_fill_for_maplights: @ 80AF040
push {r4,lr} push {r4,lr}
bl get_map_light_from_warp0 bl GetLastUsedWarpMapType
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24

View File

@ -2200,8 +2200,8 @@ _080FAE2A:
.pool .pool
thumb_func_end sub_80FADE4 thumb_func_end sub_80FADE4
thumb_func_start task50_overworld_poison_effect thumb_func_start task50_FldeffPoison_Start
task50_overworld_poison_effect: @ 80FAE38 task50_FldeffPoison_Start: @ 80FAE38
push {lr} push {lr}
lsls r0, 24 lsls r0, 24
lsrs r2, r0, 24 lsrs r2, r0, 24
@ -2260,25 +2260,25 @@ _080FAE92:
_080FAEA2: _080FAEA2:
pop {r0} pop {r0}
bx r0 bx r0
thumb_func_end task50_overworld_poison_effect thumb_func_end task50_FldeffPoison_Start
thumb_func_start overworld_poison_effect thumb_func_start FldeffPoison_Start
overworld_poison_effect: @ 80FAEA8 FldeffPoison_Start: @ 80FAEA8
push {lr} push {lr}
movs r0, 0x4F movs r0, 0x4F
bl PlaySE bl PlaySE
ldr r0, =task50_overworld_poison_effect ldr r0, =task50_FldeffPoison_Start
movs r1, 0x50 movs r1, 0x50
bl CreateTask bl CreateTask
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end overworld_poison_effect thumb_func_end FldeffPoison_Start
thumb_func_start FieldPoisonEffectIsRunning thumb_func_start FieldPoisonEffectIsRunning
FieldPoisonEffectIsRunning: @ 80FAEC0 FieldPoisonEffectIsRunning: @ 80FAEC0
push {lr} push {lr}
ldr r0, =task50_overworld_poison_effect ldr r0, =task50_FldeffPoison_Start
bl FuncIsActiveTask bl FuncIsActiveTask
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24

View File

@ -3324,7 +3324,7 @@ EventScript_2736B3:: @ 82736B3
EventScript_2736BC:: @ 82736BC EventScript_2736BC:: @ 82736BC
lockall lockall
special sub_80F972C special ExecuteWhiteOut
waitstate waitstate
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_eq EventScript_2736D9 goto_eq EventScript_2736D9

View File

@ -210,7 +210,7 @@ gSpecials:: @ 81DBA64
def_special ShowLinkBattleRecords def_special ShowLinkBattleRecords
def_special IsEnoughForCostInVar0x8005 def_special IsEnoughForCostInVar0x8005
def_special SubtractMoneyFromVar0x8005 def_special SubtractMoneyFromVar0x8005
def_special sub_80F972C def_special ExecuteWhiteOut
def_special sp0C8_whiteout_maybe def_special sp0C8_whiteout_maybe
def_special RotatingGate_InitPuzzle def_special RotatingGate_InitPuzzle
def_special RotatingGate_InitPuzzleAndGraphics def_special RotatingGate_InitPuzzleAndGraphics

View File

@ -82,7 +82,7 @@ struct LockedAnimEventObjects
extern const struct SpriteFrameImage gEventObjectPicTable_PechaBerryTree[]; extern const struct SpriteFrameImage gEventObjectPicTable_PechaBerryTree[];
extern const u8 gReflectionEffectPaletteMap[]; extern const u8 gReflectionEffectPaletteMap[];
void sub_808D438(void); void ResetEventObjects(void);
u8 GetMoveDirectionAnimNum(u8); u8 GetMoveDirectionAnimNum(u8);
u8 GetEventObjectIdByLocalIdAndMap(u8, u8, u8); u8 GetEventObjectIdByLocalIdAndMap(u8, u8, u8);
bool8 TryGetEventObjectIdByLocalIdAndMap(u8, u8, u8, u8 *); bool8 TryGetEventObjectIdByLocalIdAndMap(u8, u8, u8, u8 *);

View File

@ -25,7 +25,7 @@ struct FieldInput
void FieldClearPlayerInput(struct FieldInput *pStruct); void FieldClearPlayerInput(struct FieldInput *pStruct);
void FieldGetPlayerInput(struct FieldInput *pStruct, u16 keys, u16 heldKeys); void FieldGetPlayerInput(struct FieldInput *pStruct, u16 keys, u16 heldKeys);
int sub_809C014(struct FieldInput *pStruct); int ProcessPlayerFieldInput(struct FieldInput *pStruct);
u8 *sub_80682A8(struct MapPosition *, u8, u8); u8 *sub_80682A8(struct MapPosition *, u8, u8);
void overworld_poison_timer_set(void); void overworld_poison_timer_set(void);
void prev_quest_postbuffer_cursor_backup_reset(void); void prev_quest_postbuffer_cursor_backup_reset(void);

View File

@ -179,8 +179,8 @@ bool8 sub_80B7B94(struct Task *, struct EventObject *, struct Sprite *);
bool8 sub_80B7BCC(struct Task *, struct EventObject *, struct Sprite *); bool8 sub_80B7BCC(struct Task *, struct EventObject *, struct Sprite *);
bool8 sub_80B7BF4(struct Task *, struct EventObject *, struct Sprite *); bool8 sub_80B7BF4(struct Task *, struct EventObject *, struct Sprite *);
void sub_80B7D14(struct Task *); static void EscapeRopeFieldEffect_Step0(struct Task *);
void sub_80B7D34(struct Task *); static void EscapeRopeFieldEffect_Step1(struct Task *);
void sub_80B7EC4(struct Task *); void sub_80B7EC4(struct Task *);
void sub_80B7EE8(struct Task *); void sub_80B7EE8(struct Task *);

View File

@ -13,7 +13,7 @@ enum {
FLDPSN_FNT FLDPSN_FNT
}; };
void sub_80F972C(void); void ExecuteWhiteOut(void);
unsigned int overworld_poison(void); u32 DoPoisonFieldEffect(void);
#endif //GUARD_FIELD_POISON_H #endif //GUARD_FIELD_POISON_H

View File

@ -11,7 +11,7 @@ void sub_80FA5E4(s16 id, s16 x, s16 y);
void sub_80FA794(s16 x, s16 y); void sub_80FA794(s16 x, s16 y);
void CreateRecordMixingSprite(void); void CreateRecordMixingSprite(void);
void DestroyRecordMixingSprite(void); void DestroyRecordMixingSprite(void);
void overworld_poison_effect(void); void FldeffPoison_Start(void);
bool8 sub_80FADE4(u16, u8); bool8 sub_80FADE4(u16, u8);
#endif //GUARD_FLDEFF_80F9BCC_H #endif //GUARD_FLDEFF_80F9BCC_H

View File

@ -234,7 +234,7 @@ struct EventObjectGraphicsInfo
#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) #define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1)
#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) #define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2)
#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) #define PLAYER_AVATAR_FLAG_SURFING (1 << 3)
#define PLAYER_AVATAR_FLAG_4 (1 << 4) #define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4)
#define PLAYER_AVATAR_FLAG_5 (1 << 5) #define PLAYER_AVATAR_FLAG_5 (1 << 5)
#define PLAYER_AVATAR_FLAG_6 (1 << 6) #define PLAYER_AVATAR_FLAG_6 (1 << 6)
#define PLAYER_AVATAR_FLAG_DASH (1 << 7) #define PLAYER_AVATAR_FLAG_DASH (1 << 7)

View File

@ -47,13 +47,13 @@ void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType);
const struct MapLayout *GetMapLayout(void); const struct MapLayout *GetMapLayout(void);
void ApplyCurrentWarp(void); void ApplyCurrentWarp(void);
void set_warp2_warp3_to_neg_1(void); void set_warp2_warp3_to_neg_1(void);
void SetWarpData(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);
bool32 IsDummyWarp(struct WarpData *warp); static bool32 IsDummyWarp(struct WarpData *warp);
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
struct MapHeader const *const GetDestinationWarpMapHeader(void); struct MapHeader const *const GetDestinationWarpMapHeader(void);
void LoadCurrentMapData(void); static void LoadCurrentMapData(void);
void LoadSaveblockMapHeader(void); static void LoadSaveblockMapHeader(void);
void SetPlayerCoordsFromWarp(void); static void SetPlayerCoordsFromWarp(void);
void WarpIntoMap(void); void WarpIntoMap(void);
void Overworld_SetWarpDestination(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 warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId);
@ -67,7 +67,7 @@ void sub_8084D5C(s16 a1, s16 a2);
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084E14(void); void sub_8084E14(void);
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedDiveWarpAsDestination(void); static void SetFixedDiveWarpAsDestination(void);
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedHoleWarpAsDestination(s16 x, s16 y); void SetFixedHoleWarpAsDestination(s16 x, s16 y);
void warp1_set_to_sav1w(void); void warp1_set_to_sav1w(void);
@ -75,7 +75,7 @@ void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084F6C(u8 a1); void sub_8084F6C(u8 a1);
void sub_8084FAC(void); void sub_8084FAC(void);
const struct MapConnection *GetMapConnection(u8 dir); const struct MapConnection *GetMapConnection(u8 dir);
bool8 SetDiveWarp(u8 dir, u16 x, u16 y); static bool8 SetDiveWarp(u8 dir, u16 x, u16 y);
bool8 SetDiveWarpEmerge(u16 x, u16 y); bool8 SetDiveWarpEmerge(u16 x, u16 y);
bool8 SetDiveWarpDive(u16 x, u16 y); bool8 SetDiveWarpDive(u16 x, u16 y);
void mliX_load_map(u8 mapGroup, u8 mapNum); void mliX_load_map(u8 mapGroup, u8 mapNum);
@ -105,7 +105,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter);
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum); u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
u8 GetMapTypeByWarpData(struct WarpData *warp); u8 GetMapTypeByWarpData(struct WarpData *warp);
u8 Overworld_GetMapTypeOfSaveblockLocation(void); u8 Overworld_GetMapTypeOfSaveblockLocation(void);
u8 get_map_light_from_warp0(void); u8 GetLastUsedWarpMapType(void);
bool8 is_map_type_1_2_3_5_or_6(u8 mapType); bool8 is_map_type_1_2_3_5_or_6(u8 mapType);
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
bool8 Overworld_MapTypeIsIndoors(u8 mapType); bool8 Overworld_MapTypeIsIndoors(u8 mapType);

View File

@ -968,7 +968,7 @@ bool8 IsBikingDisallowedByPlayer(void)
s16 x, y; s16 x, y;
u8 tileBehavior; u8 tileBehavior;
if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4))) if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_UNDERWATER)))
{ {
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y);

View File

@ -74,7 +74,7 @@ static void sub_8097D68(struct Sprite*);
static void ApplyLevitateMovement(u8); static void ApplyLevitateMovement(u8);
static bool8 MovementType_Disguise_Callback(struct EventObject *, struct Sprite *); static bool8 MovementType_Disguise_Callback(struct EventObject *, struct Sprite *);
static bool8 MovementType_Hidden_Callback(struct EventObject *, struct Sprite *); static bool8 MovementType_Hidden_Callback(struct EventObject *, struct Sprite *);
static void sub_808D450(void); static void CreateReflectionEffectSprites(void);
static u8 GetEventObjectIdByLocalId(u8); static u8 GetEventObjectIdByLocalId(u8);
static u8 GetEventObjectIdByLocalIdAndMapInternal(u8, u8, u8); static u8 GetEventObjectIdByLocalIdAndMapInternal(u8, u8, u8);
static bool8 GetAvailableEventObjectId(u16, u8, u8, u8 *); static bool8 GetAvailableEventObjectId(u16, u8, u8, u8 *);
@ -1083,15 +1083,15 @@ static void ClearAllEventObjects(void)
ClearEventObject(&gEventObjects[i]); ClearEventObject(&gEventObjects[i]);
} }
void sub_808D438(void) void ResetEventObjects(void)
{ {
ClearLinkPlayerEventObjects(); ClearLinkPlayerEventObjects();
ClearAllEventObjects(); ClearAllEventObjects();
ClearPlayerAvatarInfo(); ClearPlayerAvatarInfo();
sub_808D450(); CreateReflectionEffectSprites();
} }
static void sub_808D450(void) static void CreateReflectionEffectSprites(void)
{ {
u8 spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31); u8 spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31);
gSprites[spriteId].oam.affineMode = 1; gSprites[spriteId].oam.affineMode = 1;
@ -1809,7 +1809,7 @@ void sub_808E16C(s16 x, s16 y)
sub_808E1B8(i, x, y); sub_808E1B8(i, x, y);
} }
} }
sub_808D450(); CreateReflectionEffectSprites();
} }
static void sub_808E1B8(u8 eventObjectId, s16 x, s16 y) static void sub_808E1B8(u8 eventObjectId, s16 x, s16 y)

View File

@ -1,10 +1,9 @@
#include "global.h" #include "global.h"
#include "field_effect.h"
#include "trainer_pokemon_sprites.h"
#include "decompress.h" #include "decompress.h"
#include "field_camera.h"
#include "field_effect_helpers.h"
#include "event_object_movement.h" #include "event_object_movement.h"
#include "field_camera.h"
#include "field_effect.h"
#include "field_effect_helpers.h"
#include "field_player_avatar.h" #include "field_player_avatar.h"
#include "field_screen.h" #include "field_screen.h"
#include "field_weather.h" #include "field_weather.h"
@ -22,8 +21,10 @@
#include "sound.h" #include "sound.h"
#include "sprite.h" #include "sprite.h"
#include "task.h" #include "task.h"
#include "trainer_pokemon_sprites.h"
#include "trig.h" #include "trig.h"
#include "util.h" #include "util.h"
#include "constants/event_object_movement_constants.h"
#include "constants/rgb.h" #include "constants/rgb.h"
#include "constants/songs.h" #include "constants/songs.h"
@ -322,9 +323,9 @@ bool8 (*const gUnknown_0855C460[])(struct Task *, struct EventObject *, struct S
sub_80B7BF4, sub_80B7BF4,
}; };
void (*const gUnknown_0855C474[])(struct Task *) = { void (*const gEscapeRopeFieldEffectFuncs[])(struct Task *) = {
sub_80B7D14, EscapeRopeFieldEffect_Step0,
sub_80B7D34, EscapeRopeFieldEffect_Step1,
}; };
// .text // .text
@ -1686,7 +1687,7 @@ bool8 sub_80B7478(struct Task *task, struct EventObject *eventObject)
return FALSE; return FALSE;
} }
void Task_Dive(u8); static void Task_Dive(u8);
extern int dive_warp(struct MapPosition *, u16); extern int dive_warp(struct MapPosition *, u16);
bool8 FldEff_UseDive(void) bool8 FldEff_UseDive(void)
@ -1999,7 +2000,7 @@ bool8 sub_80B7BCC(struct Task *task, struct EventObject *eventObject, struct Spr
return FALSE; return FALSE;
} }
void sub_80B7CE4(u8); static void DoEscapeRopeFieldEffect(u8);
void mapldr_080859D4(void); void mapldr_080859D4(void);
bool8 sub_80B7BF4(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) bool8 sub_80B7BF4(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite)
@ -2032,29 +2033,29 @@ void sub_80B7CAC(struct Sprite *sprite)
} }
} }
void sub_80B7CC8(void) void StartEscapeRopeFieldEffect(void)
{ {
ScriptContext2_Enable(); ScriptContext2_Enable();
FreezeEventObjects(); FreezeEventObjects();
CreateTask(sub_80B7CE4, 0x50); CreateTask(DoEscapeRopeFieldEffect, 0x50);
} }
void sub_80B7CE4(u8 taskId) static void DoEscapeRopeFieldEffect(u8 taskId)
{ {
gUnknown_0855C474[gTasks[taskId].data[0]](&gTasks[taskId]); gEscapeRopeFieldEffectFuncs[gTasks[taskId].data[0]](&gTasks[taskId]);
} }
void sub_80B7D14(struct Task *task) static void EscapeRopeFieldEffect_Step0(struct Task *task)
{ {
task->data[0]++; task->data[0]++;
task->data[14] = 64; task->data[14] = 64;
task->data[15] = GetPlayerFacingDirection(); task->data[15] = GetPlayerFacingDirection();
} }
void sub_80B7D34(struct Task *task) static void EscapeRopeFieldEffect_Step1(struct Task *task)
{ {
struct EventObject *eventObject; struct EventObject *eventObject;
u8 spinDirections[5] = {1, 3, 4, 2, 1}; u8 spinDirections[5] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH};
if (task->data[14] != 0 && (--task->data[14]) == 0) if (task->data[14] != 0 && (--task->data[14]) == 0)
{ {
music_something(); music_something();
@ -2070,7 +2071,7 @@ void sub_80B7D34(struct Task *task)
WarpIntoMap(); WarpIntoMap();
gFieldCallback = mapldr_080859D4; gFieldCallback = mapldr_080859D4;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B7CE4)); DestroyTask(FindTaskIdByFunc(DoEscapeRopeFieldEffect));
} else if (task->data[1] == 0 || (--task->data[1]) == 0) } else if (task->data[1] == 0 || (--task->data[1]) == 0)
{ {
EventObjectSetHeldMovement(eventObject, GetFaceDirectionMovementAction(spinDirections[eventObject->facingDirection])); EventObjectSetHeldMovement(eventObject, GetFaceDirectionMovementAction(spinDirections[eventObject->facingDirection]));
@ -2905,7 +2906,7 @@ void sub_80B8E14(struct Task *task)
if (!EventObjectIsMovementOverridden(eventObject) || EventObjectClearHeldMovementIfFinished(eventObject)) if (!EventObjectIsMovementOverridden(eventObject) || EventObjectClearHeldMovementIfFinished(eventObject))
{ {
sub_808C114(); sub_808C114();
EventObjectSetHeldMovement(eventObject, 0x39); EventObjectSetHeldMovement(eventObject, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION);
task->data[0]++; task->data[0]++;
} }
} }
@ -3210,7 +3211,7 @@ void sub_80B9204(struct Task *task)
gPlayerAvatar.preventStep = TRUE; gPlayerAvatar.preventStep = TRUE;
SetPlayerAvatarStateMask(1); SetPlayerAvatarStateMask(1);
sub_808C114(); sub_808C114();
EventObjectSetHeldMovement(eventObject, 0x39); EventObjectSetHeldMovement(eventObject, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION);
task->data[0]++; task->data[0]++;
} }
} }
@ -3250,7 +3251,7 @@ void sub_80B92F8(struct Task *task)
task->data[0]++; task->data[0]++;
task->data[2] = 16; task->data[2] = 16;
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT); SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
EventObjectSetHeldMovement(&gEventObjects[gPlayerAvatar.eventObjectId], 0x02); EventObjectSetHeldMovement(&gEventObjects[gPlayerAvatar.eventObjectId], MOVEMENT_ACTION_FACE_LEFT);
} }
} }
@ -3275,7 +3276,7 @@ void sub_80B9390(struct Task *task)
EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(0x03)); EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(0x03));
StartSpriteAnim(&gSprites[eventObject->spriteId], 0x16); StartSpriteAnim(&gSprites[eventObject->spriteId], 0x16);
eventObject->inanimate = 1; eventObject->inanimate = 1;
EventObjectSetHeldMovement(eventObject, 0x48); EventObjectSetHeldMovement(eventObject, MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT);
if (task->data[15] & 0x08) if (task->data[15] & 0x08)
{ {
DestroySprite(&gSprites[eventObject->fieldEffectSpriteId]); DestroySprite(&gSprites[eventObject->fieldEffectSpriteId]);
@ -3585,7 +3586,7 @@ void sub_80B9978(struct Task *task)
sprite->pos2.y = 0; sprite->pos2.y = 0;
sprite->coordOffsetEnabled = 1; sprite->coordOffsetEnabled = 1;
sub_808C114(); sub_808C114();
EventObjectSetHeldMovement(eventObject, 0x39); EventObjectSetHeldMovement(eventObject, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION);
task->data[0]++; task->data[0]++;
} }
} }

View File

@ -624,7 +624,7 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
return; return;
} }
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH) if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
&& IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0) && IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0)
{ {
PlayerRun(direction); PlayerRun(direction);

View File

@ -1,20 +1,20 @@
#include "global.h" #include "global.h"
#include "string_util.h"
#include "party_menu.h"
#include "constants/species.h"
#include "task.h"
#include "field_message_box.h"
#include "strings.h"
#include "rom_818CFC8.h"
#include "battle_frontier_2.h"
#include "pokenav.h"
#include "event_data.h"
#include "script.h"
#include "battle.h" #include "battle.h"
#include "fldeff_80F9BCC.h" #include "battle_frontier_2.h"
#include "event_data.h"
#include "field_message_box.h"
#include "field_poison.h" #include "field_poison.h"
#include "fldeff_80F9BCC.h"
#include "party_menu.h"
#include "pokenav.h"
#include "rom_818CFC8.h"
#include "script.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "constants/species.h"
static bool32 sub_80F9568(struct Pokemon *pokemon) static bool32 IsMonValidSpecies(struct Pokemon *pokemon)
{ {
u16 species = GetMonData(pokemon, MON_DATA_SPECIES2); u16 species = GetMonData(pokemon, MON_DATA_SPECIES2);
if (species == SPECIES_NONE || species == SPECIES_EGG) if (species == SPECIES_NONE || species == SPECIES_EGG)
@ -24,14 +24,14 @@ static bool32 sub_80F9568(struct Pokemon *pokemon)
return TRUE; return TRUE;
} }
static bool32 sub_80F958C(void) static bool32 AllMonsFainted(void)
{ {
int i; int i;
struct Pokemon *pokemon; struct Pokemon *pokemon = gPlayerParty;
for (pokemon = gPlayerParty, i = 0; i < PARTY_SIZE; i++, pokemon++) for (i = 0; i < PARTY_SIZE; i++, pokemon++)
{ {
if (sub_80F9568(pokemon) && GetMonData(pokemon, MON_DATA_HP) != 0) if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) != 0)
{ {
return FALSE; return FALSE;
} }
@ -39,27 +39,28 @@ static bool32 sub_80F958C(void)
return TRUE; return TRUE;
} }
static void sub_80F95C0(u8 partyIdx) static void FaintFromFieldPoison(u8 partyIdx)
{ {
struct Pokemon *pokemon = gPlayerParty + partyIdx; struct Pokemon *pokemon = gPlayerParty + partyIdx;
unsigned int status = STATUS1_NONE; u32 status = STATUS1_NONE;
AdjustFriendship(pokemon, 0x07); AdjustFriendship(pokemon, 0x07);
SetMonData(pokemon, MON_DATA_STATUS, &status); SetMonData(pokemon, MON_DATA_STATUS, &status);
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
StringGetEnd10(gStringVar1); StringGetEnd10(gStringVar1);
} }
static bool32 sub_80F960C(u8 partyIdx) static bool32 MonFaintedFromPoison(u8 partyIdx)
{ {
struct Pokemon *pokemon = gPlayerParty + partyIdx; struct Pokemon *pokemon = gPlayerParty + partyIdx;
if (sub_80F9568(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
{ {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static void sub_80F9654(u8 taskId) static void Task_WhiteOut(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
switch (data[0]) switch (data[0])
@ -67,9 +68,9 @@ static void sub_80F9654(u8 taskId)
case 0: case 0:
for (; data[1] < PARTY_SIZE; data[1]++) for (; data[1] < PARTY_SIZE; data[1]++)
{ {
if (sub_80F960C(data[1])) if (MonFaintedFromPoison(data[1]))
{ {
sub_80F95C0(data[1]); FaintFromFieldPoison(data[1]);
ShowFieldMessage(gText_PkmnFainted3); ShowFieldMessage(gText_PkmnFainted3);
data[0]++; data[0]++;
return; return;
@ -84,7 +85,7 @@ static void sub_80F9654(u8 taskId)
} }
break; break;
case 2: case 2:
if (sub_80F958C()) if (AllMonsFainted())
{ {
if (InBattlePyramid() | InBattlePike() || sub_81D5C18()) if (InBattlePyramid() | InBattlePike() || sub_81D5C18())
{ {
@ -105,19 +106,19 @@ static void sub_80F9654(u8 taskId)
} }
} }
void sub_80F972C(void) void ExecuteWhiteOut(void)
{ {
CreateTask(sub_80F9654, 80); CreateTask(Task_WhiteOut, 80);
ScriptContext1_Stop(); ScriptContext1_Stop();
} }
unsigned int overworld_poison(void) u32 DoPoisonFieldEffect(void)
{ {
int i; int i;
unsigned int hp; u32 hp;
struct Pokemon *pokemon = gPlayerParty; struct Pokemon *pokemon = gPlayerParty;
unsigned int numPoisoned = 0; u32 numPoisoned = 0;
unsigned int numFainted = 0; u32 numFainted = 0;
for (i = 0; i < PARTY_SIZE; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
@ -134,7 +135,7 @@ unsigned int overworld_poison(void)
} }
if (numFainted != 0 || numPoisoned != 0) if (numFainted != 0 || numPoisoned != 0)
{ {
overworld_poison_effect(); FldeffPoison_Start();
} }
if (numFainted != 0) if (numFainted != 0)
{ {

View File

@ -1513,7 +1513,7 @@ bool8 FoundBlackGlasses(void)
void SetRoute119Weather(void) void SetRoute119Weather(void)
{ {
if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
{ {
SetSav1Weather(20); SetSav1Weather(20);
} }
@ -1521,7 +1521,7 @@ void SetRoute119Weather(void)
void SetRoute123Weather(void) void SetRoute123Weather(void)
{ {
if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
{ {
SetSav1Weather(21); SetSav1Weather(21);
} }

View File

@ -156,7 +156,7 @@ void c2_change_map(void)
static bool8 sub_8137304(void) static bool8 sub_8137304(void)
{ {
u8 i; u8 i;
u8 v0 = get_map_light_from_warp0(); u8 v0 = GetLastUsedWarpMapType();
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation(); u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
for (i = 0; gUnknown_085B27C8[i].unk0; i++) for (i = 0; gUnknown_085B27C8[i].unk0; i++)

View File

@ -58,7 +58,7 @@ extern void sub_81C5924(void);
extern void sub_81C59BC(void); extern void sub_81C59BC(void);
extern void sub_81AB9A8(u8); extern void sub_81AB9A8(u8);
extern void sub_81ABA88(u8); extern void sub_81ABA88(u8);
extern void sub_80B7CC8(void); extern void StartEscapeRopeFieldEffect(void);
extern u8* sub_806CF78(u16); extern u8* sub_806CF78(u16);
extern void sub_81B89F0(void); extern void sub_81B89F0(void);
extern u8 GetItemEffectType(u16); extern u8 GetItemEffectType(u16);
@ -260,7 +260,7 @@ bool32 CanFish(void)
if (MetatileBehavior_IsWaterfall(tileBehavior)) if (MetatileBehavior_IsWaterfall(tileBehavior))
return FALSE; return FALSE;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
return FALSE; return FALSE;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
@ -890,7 +890,7 @@ void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId)
void task08_080A1C44(u8 taskId) void task08_080A1C44(u8 taskId)
{ {
ResetInitialPlayerAvatarState(); ResetInitialPlayerAvatarState();
sub_80B7CC8(); StartEscapeRopeFieldEffect();
DestroyTask(taskId); DestroyTask(taskId);
} }

View File

@ -585,7 +585,7 @@ void set_warp2_warp3_to_neg_1(void)
gFixedHoleWarp = sDummyWarpData; gFixedHoleWarp = sDummyWarpData;
} }
void SetWarpData(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->mapGroup = mapGroup;
warp->mapNum = mapNum; warp->mapNum = mapNum;
@ -594,7 +594,7 @@ void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x,
warp->y = y; warp->y = y;
} }
bool32 IsDummyWarp(struct WarpData *warp) static bool32 IsDummyWarp(struct WarpData *warp)
{ {
if (warp->mapGroup != -1) if (warp->mapGroup != -1)
return FALSE; return FALSE;
@ -620,7 +620,7 @@ struct MapHeader const *const GetDestinationWarpMapHeader(void)
return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
} }
void LoadCurrentMapData(void) static void LoadCurrentMapData(void)
{ {
sLastMapSectionId = gMapHeader.regionMapSectionId; sLastMapSectionId = gMapHeader.regionMapSectionId;
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
@ -628,13 +628,13 @@ void LoadCurrentMapData(void)
gMapHeader.mapLayout = GetMapLayout(); gMapHeader.mapLayout = GetMapLayout();
} }
void LoadSaveblockMapHeader(void) static void LoadSaveblockMapHeader(void)
{ {
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
gMapHeader.mapLayout = GetMapLayout(); gMapHeader.mapLayout = GetMapLayout();
} }
void SetPlayerCoordsFromWarp(void) static void SetPlayerCoordsFromWarp(void)
{ {
if (gSaveBlock1Ptr->location.warpId >= 0 && gSaveBlock1Ptr->location.warpId < gMapHeader.events->warpCount) if (gSaveBlock1Ptr->location.warpId >= 0 && gSaveBlock1Ptr->location.warpId < gMapHeader.events->warpCount)
{ {
@ -729,7 +729,7 @@ void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y); SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
} }
void SetFixedDiveWarpAsDestination(void) static void SetFixedDiveWarpAsDestination(void)
{ {
sWarpDestination = gFixedDiveWarp; sWarpDestination = gFixedDiveWarp;
} }
@ -785,7 +785,7 @@ const struct MapConnection *GetMapConnection(u8 dir)
return NULL; return NULL;
} }
bool8 SetDiveWarp(u8 dir, u16 x, u16 y) static bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
{ {
const struct MapConnection *connection = GetMapConnection(dir); const struct MapConnection *connection = GetMapConnection(dir);
@ -905,8 +905,8 @@ static void mli0_load_map(u32 a1)
void ResetInitialPlayerAvatarState(void) void ResetInitialPlayerAvatarState(void)
{ {
gInitialPlayerAvatarState.direction = 1; gInitialPlayerAvatarState.direction = DIR_SOUTH;
gInitialPlayerAvatarState.transitionFlags = 1; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT;
} }
void StoreInitialPlayerAvatarState(void) void StoreInitialPlayerAvatarState(void)
@ -914,15 +914,15 @@ void StoreInitialPlayerAvatarState(void)
gInitialPlayerAvatarState.direction = GetPlayerFacingDirection(); gInitialPlayerAvatarState.direction = GetPlayerFacingDirection();
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE)) if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE))
gInitialPlayerAvatarState.transitionFlags = 2; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_MACH_BIKE;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE))
gInitialPlayerAvatarState.transitionFlags = 4; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ACRO_BIKE;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
gInitialPlayerAvatarState.transitionFlags = 8; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_SURFING;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
gInitialPlayerAvatarState.transitionFlags = 16; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_UNDERWATER;
else else
gInitialPlayerAvatarState.transitionFlags = 1; gInitialPlayerAvatarState.transitionFlags = PLAYER_AVATAR_FLAG_ON_FOOT;
} }
static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void) static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
@ -940,44 +940,44 @@ static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 metatileBehavior, u8 mapType) static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 metatileBehavior, u8 mapType)
{ {
if (mapType != MAP_TYPE_INDOOR && FlagGet(FLAG_SYS_CRUISE_MODE)) if (mapType != MAP_TYPE_INDOOR && FlagGet(FLAG_SYS_CRUISE_MODE))
return 1; return PLAYER_AVATAR_FLAG_ON_FOOT;
else if (mapType == MAP_TYPE_UNDERWATER) else if (mapType == MAP_TYPE_UNDERWATER)
return 16; return PLAYER_AVATAR_FLAG_UNDERWATER;
else if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE) else if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE)
return 8; return PLAYER_AVATAR_FLAG_SURFING;
else if (Overworld_IsBikingAllowed() != TRUE) else if (Overworld_IsBikingAllowed() != TRUE)
return 1; return PLAYER_AVATAR_FLAG_ON_FOOT;
else if (playerStruct->transitionFlags == 2) else if (playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_MACH_BIKE)
return 2; return PLAYER_AVATAR_FLAG_MACH_BIKE;
else if (playerStruct->transitionFlags != 4) else if (playerStruct->transitionFlags != PLAYER_AVATAR_FLAG_ACRO_BIKE)
return 1; return PLAYER_AVATAR_FLAG_ON_FOOT;
else else
return 4; return PLAYER_AVATAR_FLAG_ACRO_BIKE;
} }
static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType) static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType)
{ {
if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6) if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6)
return 4; return DIR_EAST;
else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE) else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE)
return 2; return DIR_NORTH;
else if (MetatileBehavior_IsNonAnimDoor(metatileBehavior) == TRUE || MetatileBehavior_IsDoor(metatileBehavior) == TRUE) else if (MetatileBehavior_IsNonAnimDoor(metatileBehavior) == TRUE || MetatileBehavior_IsDoor(metatileBehavior) == TRUE)
return 1; return DIR_SOUTH;
else if (MetatileBehavior_IsSouthArrowWarp(metatileBehavior) == TRUE) else if (MetatileBehavior_IsSouthArrowWarp(metatileBehavior) == TRUE)
return 2; return DIR_NORTH;
else if (MetatileBehavior_IsNorthArrowWarp(metatileBehavior) == TRUE) else if (MetatileBehavior_IsNorthArrowWarp(metatileBehavior) == TRUE)
return 1; return DIR_SOUTH;
else if (MetatileBehavior_IsWestArrowWarp(metatileBehavior) == TRUE) else if (MetatileBehavior_IsWestArrowWarp(metatileBehavior) == TRUE)
return 4; return DIR_EAST;
else if (MetatileBehavior_IsEastArrowWarp(metatileBehavior) == TRUE) else if (MetatileBehavior_IsEastArrowWarp(metatileBehavior) == TRUE)
return 3; return DIR_WEST;
else if ((playerStruct->transitionFlags == 16 && transitionFlags == 8) else if ((playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_UNDERWATER && transitionFlags == PLAYER_AVATAR_FLAG_SURFING)
|| (playerStruct->transitionFlags == 8 && transitionFlags == 16)) || (playerStruct->transitionFlags == PLAYER_AVATAR_FLAG_SURFING && transitionFlags == PLAYER_AVATAR_FLAG_UNDERWATER ))
return playerStruct->direction; return playerStruct->direction;
else if (MetatileBehavior_IsLadder(metatileBehavior) == TRUE) else if (MetatileBehavior_IsLadder(metatileBehavior) == TRUE)
return playerStruct->direction; return playerStruct->direction;
else else
return 1; return DIR_SOUTH;
} }
static u16 GetCenterScreenMetatileBehavior(void) static u16 GetCenterScreenMetatileBehavior(void)
@ -1357,7 +1357,7 @@ u8 Overworld_GetMapTypeOfSaveblockLocation(void)
return GetMapTypeByWarpData(&gSaveBlock1Ptr->location); return GetMapTypeByWarpData(&gSaveBlock1Ptr->location);
} }
u8 get_map_light_from_warp0(void) u8 GetLastUsedWarpMapType(void)
{ {
return GetMapTypeByWarpData(&gLastUsedWarp); return GetMapTypeByWarpData(&gLastUsedWarp);
} }
@ -1458,7 +1458,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
FieldGetPlayerInput(&inputStruct, newKeys, heldKeys); FieldGetPlayerInput(&inputStruct, newKeys, heldKeys);
if (!ScriptContext2_IsEnabled()) if (!ScriptContext2_IsEnabled())
{ {
if (sub_809C014(&inputStruct) == 1) if (ProcessPlayerFieldInput(&inputStruct) == 1)
{ {
ScriptContext2_Enable(); ScriptContext2_Enable();
HideMapNamePopUpWindow(); HideMapNamePopUpWindow();
@ -2168,7 +2168,7 @@ static void sub_80869DC(void)
{ {
gTotalCameraPixelOffsetX = 0; gTotalCameraPixelOffsetX = 0;
gTotalCameraPixelOffsetY = 0; gTotalCameraPixelOffsetY = 0;
sub_808D438(); ResetEventObjects();
TrySpawnEventObjects(0, 0); TrySpawnEventObjects(0, 0);
mapheader_run_first_tag4_script_list_match(); mapheader_run_first_tag4_script_list_match();
} }
@ -2180,7 +2180,7 @@ static void mli4_mapscripts_and_other(void)
gTotalCameraPixelOffsetX = 0; gTotalCameraPixelOffsetX = 0;
gTotalCameraPixelOffsetY = 0; gTotalCameraPixelOffsetY = 0;
sub_808D438(); ResetEventObjects();
sav1_camera_get_focus_coords(&x, &y); sav1_camera_get_focus_coords(&x, &y);
player = GetInitialPlayerAvatarState(); player = GetInitialPlayerAvatarState();
InitPlayerAvatar(x, y, player->direction, gSaveBlock2Ptr->playerGender); InitPlayerAvatar(x, y, player->direction, gSaveBlock2Ptr->playerGender);

View File

@ -1,21 +1,22 @@
#include "global.h" #include "global.h"
#include "constants/event_objects.h"
#include "constants/songs.h"
#include "rom6.h"
#include "braille_puzzles.h" #include "braille_puzzles.h"
#include "event_data.h" #include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h" #include "event_scripts.h"
#include "field_effect.h" #include "field_effect.h"
#include "event_object_movement.h"
#include "field_player_avatar.h" #include "field_player_avatar.h"
#include "item_use.h" #include "item_use.h"
#include "party_menu.h"
#include "overworld.h" #include "overworld.h"
#include "party_menu.h"
#include "rom6.h"
#include "script.h" #include "script.h"
#include "sound.h" #include "sound.h"
#include "sprite.h" #include "sprite.h"
#include "task.h" #include "task.h"
#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
#include "constants/map_types.h" #include "constants/map_types.h"
#include "constants/songs.h"
// static functions // static functions
static void task08_080C9820(u8 taskId); static void task08_080C9820(u8 taskId);
@ -31,14 +32,14 @@ static void sub_8135780(void);
extern struct MapPosition gPlayerFacingPosition; extern struct MapPosition gPlayerFacingPosition;
// text // text
bool8 CheckObjectGraphicsInFrontOfPlayer(u8 a) bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId)
{ {
u8 eventObjId; u8 eventObjId;
GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
gPlayerFacingPosition.height = PlayerGetZCoord(); gPlayerFacingPosition.height = PlayerGetZCoord();
eventObjId = GetEventObjectIdByXYZ(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.height); eventObjId = GetEventObjectIdByXYZ(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.height);
if (gEventObjects[eventObjId].graphicsId != a) if (gEventObjects[eventObjId].graphicsId != graphicsId)
{ {
return FALSE; return FALSE;
} }
@ -73,7 +74,7 @@ static void task08_080C9820(u8 taskId)
else else
{ {
sub_808C114(); sub_808C114();
EventObjectSetHeldMovement(&gEventObjects[eventObjId], 0x39); EventObjectSetHeldMovement(&gEventObjects[eventObjId], MOVEMENT_ACTION_START_ANIM_IN_DIRECTION);
gTasks[taskId].func = sub_813552C; gTasks[taskId].func = sub_813552C;
} }
} }
@ -90,7 +91,7 @@ static void sub_813552C(u8 taskId)
static void sub_8135578(u8 taskId) static void sub_8135578(u8 taskId)
{ {
if (!FieldEffectActiveListContains(6)) if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON))
{ {
gFieldEffectArguments[1] = GetPlayerFacingDirection(); gFieldEffectArguments[1] = GetPlayerFacingDirection();
if (gFieldEffectArguments[1] == 1) if (gFieldEffectArguments[1] == 1)
@ -189,7 +190,7 @@ bool8 FldEff_UseDig(void)
gTasks[taskId].data[8] = (u32)sub_8135780 >> 16; gTasks[taskId].data[8] = (u32)sub_8135780 >> 16;
gTasks[taskId].data[9] = (u32)sub_8135780; gTasks[taskId].data[9] = (u32)sub_8135780;
if (!ShouldDoBrailleDigEffect()) if (!ShouldDoBrailleDigEffect())
SetPlayerAvatarTransitionFlags(1); SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
return FALSE; return FALSE;
} }

View File

@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void)
1, // 23 1, // 23
}; };
if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0())) if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()))
{ {
RtcCalcLocalTime(); RtcCalcLocalTime();
if (tide[gLocalTime.hours]) if (tide[gLocalTime.hours])