Merge pull request #311 from Slawter666/pss-label

Bring some labels over from pokeruby + template formatting
This commit is contained in:
Diegoisawesome 2018-09-05 01:36:05 -05:00 committed by GitHub
commit c0687c7832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1655 additions and 568 deletions

View File

@ -774,7 +774,7 @@ _08150340:
orrs r3, r0 orrs r3, r0
str r3, [r2, 0x8] str r3, [r2, 0x8]
ldr r0, [r2, 0x8] ldr r0, [r2, 0x8]
bl warp_in bl WarpIntoMap
ldr r0, =gFieldCallback ldr r0, =gFieldCallback
str r4, [r0] str r4, [r0]
ldr r0, =CB2_LoadMap ldr r0, =CB2_LoadMap

View File

@ -530,7 +530,7 @@ sub_809C2C8: @ 809C2C8
ldrh r1, [r4, 0x2] ldrh r1, [r4, 0x2]
b _0809C30E b _0809C30E
_0809C2F0: _0809C2F0:
ldr r1, =gUnknown_08339D64 ldr r1, =gDirectionToVectors
lsls r2, r6, 3 lsls r2, r6, 3
adds r0, r2, r1 adds r0, r2, r1
ldr r3, [r0] ldr r3, [r0]
@ -631,7 +631,7 @@ _0809C3B4:
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bne _0809C400 bne _0809C400
ldr r1, =gUnknown_08339D64 ldr r1, =gDirectionToVectors
lsls r2, r7, 3 lsls r2, r7, 3
adds r0, r2, r1 adds r0, r2, r1
ldr r3, [r0] ldr r3, [r0]
@ -1658,7 +1658,7 @@ mapheader_run_first_tag2_script_list_match_conditionally: @ 809CC38
negs r0, r0 negs r0, r0
cmp r4, r0 cmp r4, r0
beq _0809CC90 beq _0809CC90
bl walkrun_find_lowest_active_bit_in_bitfield bl StoreInitialPlayerAvatarState
mov r0, r8 mov r0, r8
adds r1, r4, 0 adds r1, r4, 0
adds r2, r7, 0 adds r2, r7, 0
@ -1699,7 +1699,7 @@ sub_809CC9C: @ 809CC9C
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bne _0809CD8A bne _0809CD8A
bl walkrun_find_lowest_active_bit_in_bitfield bl StoreInitialPlayerAvatarState
adds r0, r7, 0 adds r0, r7, 0
adds r1, r4, 0 adds r1, r4, 0
adds r2, r6, 0 adds r2, r6, 0
@ -2083,7 +2083,7 @@ _0809CFB0:
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bne _0809CFFC bne _0809CFFC
bl walkrun_find_lowest_active_bit_in_bitfield bl StoreInitialPlayerAvatarState
adds r0, r6, 0 adds r0, r6, 0
adds r1, r4, 0 adds r1, r4, 0
adds r2, r5, 0 adds r2, r5, 0
@ -2334,7 +2334,7 @@ dive_warp: @ 809D16C
subs r1, 0x7 subs r1, 0x7
lsls r1, 16 lsls r1, 16
lsrs r1, 16 lsrs r1, 16
bl sub_8085058 bl SetDiveWarpEmerge
b _0809D1C8 b _0809D1C8
.pool .pool
_0809D1A4: _0809D1A4:
@ -2353,12 +2353,12 @@ _0809D1A4:
subs r1, 0x7 subs r1, 0x7
lsls r1, 16 lsls r1, 16
lsrs r1, 16 lsrs r1, 16
bl sub_8085078 bl SetDiveWarpDive
_0809D1C8: _0809D1C8:
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _0809D1E0 beq _0809D1E0
bl walkrun_find_lowest_active_bit_in_bitfield bl StoreInitialPlayerAvatarState
bl sp13E_warp_to_last_warp bl sp13E_warp_to_last_warp
movs r0, 0xE9 movs r0, 0xE9
bl PlaySE bl PlaySE
@ -2407,7 +2407,7 @@ sub_809D1E8: @ 809D1E8
subs r1, 0x7 subs r1, 0x7
lsls r1, 16 lsls r1, 16
lsrs r1, 16 lsrs r1, 16
bl sub_8085058 bl SetDiveWarpEmerge
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -2431,7 +2431,7 @@ _0809D244:
subs r1, 0x7 subs r1, 0x7
lsls r1, 16 lsls r1, 16
lsrs r1, 16 lsrs r1, 16
bl sub_8085078 bl SetDiveWarpDive
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1

View File

@ -20,7 +20,7 @@ SetUpReflection: @ 8153ED4
ldrsh r2, [r4, r0] ldrsh r2, [r4, r0]
adds r0, r4, 0 adds r0, r4, 0
movs r3, 0x98 movs r3, 0x98
bl obj_unfreeze bl CreateCopySpriteAt
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
lsls r1, r0, 4 lsls r1, r0, 4
@ -34,7 +34,7 @@ SetUpReflection: @ 8153ED4
movs r0, 0xC movs r0, 0xC
orrs r1, r0 orrs r1, r0
strb r1, [r7, 0x5] strb r1, [r7, 0x5]
ldr r2, =gUnknown_084975C4 ldr r2, =gReflectionEffectPaletteMap
lsrs r0, r1, 4 lsrs r0, r1, 4
adds r0, r2 adds r0, r2
ldrb r0, [r0] ldrb r0, [r0]
@ -185,7 +185,7 @@ npc_pal_op_B: @ 815401C
bne _0815404C bne _0815404C
ldrh r0, [r2, 0x2] ldrh r0, [r2, 0x2]
adds r1, r4, 0 adds r1, r4, 0
bl npc_load_two_palettes__no_record bl LoadPlayerObjectReflectionPalette
b _0815406A b _0815406A
.pool .pool
_0815404C: _0815404C:
@ -193,15 +193,15 @@ _0815404C:
bne _0815405A bne _0815405A
ldrh r0, [r2, 0x2] ldrh r0, [r2, 0x2]
adds r1, r4, 0 adds r1, r4, 0
bl npc_load_two_palettes__and_record bl LoadSpecialObjectReflectionPalette
b _0815406A b _0815406A
_0815405A: _0815405A:
adds r0, r4, 0 adds r0, r4, 0
bl npc_paltag_by_palslot bl GetObjectPaletteTag
lsls r0, 16 lsls r0, 16
lsrs r0, 16 lsrs r0, 16
adds r1, r4, 0 adds r1, r4, 0
bl pal_patch_for_npc bl PatchObjectPalette
_0815406A: _0815406A:
adds r0, r4, 0 adds r0, r4, 0
bl UpdateSpritePaletteWithWeather bl UpdateSpritePaletteWithWeather
@ -225,7 +225,7 @@ npc_pal_op_A: @ 8154078
beq _0815409C beq _0815409C
adds r0, r1, 0 adds r0, r1, 0
adds r1, r4, 0 adds r1, r4, 0
bl pal_patch_for_npc bl PatchObjectPalette
adds r0, r4, 0 adds r0, r4, 0
bl UpdateSpritePaletteWithWeather bl UpdateSpritePaletteWithWeather
_0815409C: _0815409C:
@ -277,7 +277,7 @@ _081540E0:
b _08154214 b _08154214
.pool .pool
_081540FC: _081540FC:
ldr r1, =gUnknown_084975C4 ldr r1, =gReflectionEffectPaletteMap
ldrb r0, [r5, 0x5] ldrb r0, [r5, 0x5]
lsrs r0, 4 lsrs r0, 4
adds r0, r1 adds r0, r1

View File

@ -7914,7 +7914,7 @@ sub_80AF0B4: @ 80AF0B4
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24
bl warp1_get_mapheader bl GetDestinationWarpMapHeader
ldrb r1, [r0, 0x17] ldrb r1, [r0, 0x17]
adds r0, r4, 0 adds r0, r4, 0
bl sub_8137360 bl sub_8137360
@ -8924,7 +8924,7 @@ _080AF914:
bl sub_80AF710 bl sub_80AF710
cmp r0, 0 cmp r0, 0
bne _080AF93E bne _080AF93E
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080AF93E beq _080AF93E
@ -8934,7 +8934,7 @@ _080AF926:
strh r0, [r4, 0x8] strh r0, [r4, 0x8]
b _080AF93E b _080AF93E
_080AF92E: _080AF92E:
bl warp_in bl WarpIntoMap
ldr r0, =sub_8086074 ldr r0, =sub_8086074
bl SetMainCallback2 bl SetMainCallback2
adds r0, r5, 0 adds r0, r5, 0
@ -8999,7 +8999,7 @@ _080AF9B2:
bl sub_80AF710 bl sub_80AF710
cmp r0, 0 cmp r0, 0
bne _080AF9E8 bne _080AF9E8
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080AF9E8 beq _080AF9E8
@ -9014,7 +9014,7 @@ _080AF9D0:
ldrb r0, [r0] ldrb r0, [r0]
cmp r0, 0 cmp r0, 0
bne _080AF9E8 bne _080AF9E8
bl warp_in bl WarpIntoMap
ldr r0, =CB2_LoadMap ldr r0, =CB2_LoadMap
bl SetMainCallback2 bl SetMainCallback2
adds r0, r5, 0 adds r0, r5, 0
@ -9076,7 +9076,7 @@ _080AFA44:
bl sub_81BE72C bl sub_81BE72C
strh r5, [r4, 0xA] strh r5, [r4, 0xA]
_080AFA5A: _080AFA5A:
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080AFA7C beq _080AFA7C
@ -9086,7 +9086,7 @@ _080AFA64:
strh r0, [r4, 0x8] strh r0, [r4, 0x8]
b _080AFA7C b _080AFA7C
_080AFA6C: _080AFA6C:
bl warp_in bl WarpIntoMap
ldr r0, =CB2_LoadMap ldr r0, =CB2_LoadMap
bl SetMainCallback2 bl SetMainCallback2
adds r0, r6, 0 adds r0, r6, 0
@ -9297,7 +9297,7 @@ _080AFC2C:
bl sub_80AF710 bl sub_80AF710
cmp r0, 0 cmp r0, 0
bne _080AFC56 bne _080AFC56
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080AFC56 beq _080AFC56
@ -9307,7 +9307,7 @@ _080AFC3E:
strh r0, [r4, 0x8] strh r0, [r4, 0x8]
b _080AFC56 b _080AFC56
_080AFC46: _080AFC46:
bl warp_in bl WarpIntoMap
ldr r0, =sub_8086024 ldr r0, =sub_8086024
bl SetMainCallback2 bl SetMainCallback2
adds r0, r5, 0 adds r0, r5, 0
@ -10049,7 +10049,7 @@ _080B0210:
bl sub_80AF710 bl sub_80AF710
cmp r0, 0 cmp r0, 0
bne _080B023A bne _080B023A
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080B023A beq _080B023A
@ -10059,7 +10059,7 @@ _080B0222:
strh r0, [r4, 0x8] strh r0, [r4, 0x8]
b _080B023A b _080B023A
_080B022A: _080B022A:
bl warp_in bl WarpIntoMap
ldr r0, =CB2_LoadMap ldr r0, =CB2_LoadMap
bl SetMainCallback2 bl SetMainCallback2
adds r0, r5, 0 adds r0, r5, 0
@ -10492,7 +10492,7 @@ task50_0807F0C8: @ 80B05CC
push {r4,lr} push {r4,lr}
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_80859A0 bl BGMusicStopped
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1

View File

@ -89,10 +89,10 @@ u8 GetEventObjectIdByXY(s16, s16);
void SetEventObjectDirection(struct EventObject *, u8); void SetEventObjectDirection(struct EventObject *, u8);
u8 GetFirstInactiveEventObjectId(void); u8 GetFirstInactiveEventObjectId(void);
void RemoveEventObjectByLocalIdAndMap(u8, u8, u8); void RemoveEventObjectByLocalIdAndMap(u8, u8, u8);
void npc_load_two_palettes__no_record(u16, u8); void LoadPlayerObjectReflectionPalette(u16, u8);
void npc_load_two_palettes__and_record(u16, u8); void LoadSpecialObjectReflectionPalette(u16, u8);
void sub_808EBA8(u8, u8, u8, s16, s16); void sub_808EBA8(u8, u8, u8, s16, s16);
void pal_patch_for_npc(u16, u8); void PatchObjectPalette(u16, u8);
void sub_808E16C(s16, s16); void sub_808E16C(s16, s16);
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat); void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat);
void sub_8092FF0(s16, s16, s16 *, s16 *); void sub_8092FF0(s16, s16, s16 *, s16 *);
@ -113,7 +113,7 @@ void EventObjectTurn(struct EventObject *, u8);
void EventObjectTurnByLocalIdAndMap(u8, u8, u8, u8); void EventObjectTurnByLocalIdAndMap(u8, u8, u8, u8);
const struct EventObjectGraphicsInfo *GetEventObjectGraphicsInfo(u8); const struct EventObjectGraphicsInfo *GetEventObjectGraphicsInfo(u8);
void npc_by_local_id_and_map_set_field_1_bit_x20(u8, u8, u8, u8); void npc_by_local_id_and_map_set_field_1_bit_x20(u8, u8, u8, u8);
void gpu_pal_allocator_reset__manage_upper_four(void); void FreeAndReserveObjectSpritePalettes(void);
void sub_808E82C(u8, u8, u8, s16, s16); void sub_808E82C(u8, u8, u8, s16, s16);
void sub_808E7E4(u8, u8, u8); void sub_808E7E4(u8, u8, u8);
void sub_808E78C(u8, u8, u8, u8); void sub_808E78C(u8, u8, u8, u8);
@ -122,6 +122,7 @@ void EventObjectGetLocalIdAndMap(struct EventObject *eventObject, void *localId,
void ShiftEventObjectCoords(struct EventObject *, s16, s16); void ShiftEventObjectCoords(struct EventObject *, s16, s16);
void sub_808EB08(struct EventObject *, s16, s16); void sub_808EB08(struct EventObject *, s16, s16);
void sub_808F254(u8, u8, u8); void sub_808F254(u8, u8, u8);
void InitEventObjectPalettes(u8 palSlot);
void UpdateEventObjectCurrentMovement(struct EventObject *, struct Sprite *, bool8(struct EventObject *, struct Sprite *)); void UpdateEventObjectCurrentMovement(struct EventObject *, struct Sprite *, bool8(struct EventObject *, struct Sprite *));
u8 EventObjectFaceOppositeDirection(struct EventObject *, u8); u8 EventObjectFaceOppositeDirection(struct EventObject *, u8);
u8 GetOppositeDirection(u8); u8 GetOppositeDirection(u8);

View File

@ -1,10 +1,10 @@
#ifndef GUARD_OVERWORLD_H #ifndef GUARD_OVERWORLD_H
#define GUARD_OVERWORLD_H #define GUARD_OVERWORLD_H
struct UnkPlayerStruct struct InitialPlayerAvatarState
{ {
u8 player_field_0; u8 transitionFlags;
u8 player_field_1; u8 direction;
}; };
struct LinkPlayerEventObject struct LinkPlayerEventObject
@ -16,7 +16,7 @@ struct LinkPlayerEventObject
}; };
// Exported RAM declarations // Exported RAM declarations
extern struct WarpData gUnknown_020322DC; extern struct WarpData gLastUsedWarp;
extern struct LinkPlayerEventObject gLinkPlayerEventObjects[4]; extern struct LinkPlayerEventObject gLinkPlayerEventObjects[4];
extern u16 *gBGTilemapBuffers1; extern u16 *gBGTilemapBuffers1;
@ -26,7 +26,7 @@ extern u16 *gBGTilemapBuffers3;
extern void (*gFieldCallback)(void); extern void (*gFieldCallback)(void);
// Exported ROM declarations // Exported ROM declarations
extern const struct UCoords32 gUnknown_08339D64[]; extern const struct UCoords32 gDirectionToVectors[];
void DoWhiteOut(void); void DoWhiteOut(void);
void Overworld_ResetStateAfterFly(void); void Overworld_ResetStateAfterFly(void);
@ -45,13 +45,13 @@ 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); void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
bool32 warp_data_is_not_neg_1(struct WarpData *warp); 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 warp1_get_mapheader(void); struct MapHeader const *const GetDestinationWarpMapHeader(void);
void set_current_map_header_from_sav1_save_old_name(void); void LoadCurrentMapData(void);
void LoadSaveblockMapHeader(void); void LoadSaveblockMapHeader(void);
void update_camera_pos_from_warpid(void); void SetPlayerCoordsFromWarp(void);
void warp_in(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);
void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
@ -63,21 +63,21 @@ void Overworld_SetHealLocationWarp(u8 healLocationId);
void sub_8084D5C(s16 a1, s16 a2); 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 sub_8084E2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void warp1_set_to_warp2(void); void SetFixedDiveWarpAsDestination(void);
void sub_8084E80(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084EBC(s16 x, s16 y); void SetFixedHoleWarpAsDestination(s16 x, s16 y);
void warp1_set_to_sav1w(void); void warp1_set_to_sav1w(void);
void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); 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 sub_8084FF8(u8 dir, u16 x, u16 y); bool8 SetDiveWarp(u8 dir, u16 x, u16 y);
bool8 sub_8085058(u16 x, u16 y); bool8 SetDiveWarpEmerge(u16 x, u16 y);
bool8 sub_8085078(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);
void player_avatar_init_params_reset(void); void ResetInitialPlayerAvatarState(void);
void walkrun_find_lowest_active_bit_in_bitfield(void); void StoreInitialPlayerAvatarState(void);
bool32 Overworld_IsBikingAllowed(void); bool32 Overworld_IsBikingAllowed(void);
void SetDefaultFlashLevel(void); void SetDefaultFlashLevel(void);
void Overworld_SetFlashLevel(s32 flashLevel); void Overworld_SetFlashLevel(s32 flashLevel);
@ -96,7 +96,7 @@ void Overworld_ChangeMusicToDefault(void);
void Overworld_ChangeMusicTo(u16 newMusic); void Overworld_ChangeMusicTo(u16 newMusic);
u8 GetMapMusicFadeoutSpeed(void); u8 GetMapMusicFadeoutSpeed(void);
void music_something(void); void music_something(void);
bool8 sub_80859A0(void); bool8 BGMusicStopped(void);
void Overworld_FadeOutMapMusic(void); void Overworld_FadeOutMapMusic(void);
void UpdateAmbientCry(s16 *state, u16 *delayCounter); void UpdateAmbientCry(s16 *state, u16 *delayCounter);
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum); u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);

View File

@ -193,20 +193,92 @@ static const u8 sColorTable[][3] =
static const struct WindowTemplate gUnknown_0861F328[] = static const struct WindowTemplate gUnknown_0861F328[] =
{ {
{0x00, 0x0e, 0x02, 0x0f, 0x10, 0x0f, 0x001e}, {
{0x00, 0x00, 0x0d, 0x0e, 0x06, 0x0f, 0x010e}, .priority = 0,
{0x01, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x0162}, .tilemapLeft = 14,
{0x01, 0x18, 0x11, 0x05, 0x02, 0x0f, 0x01ce}, .tilemapTop = 2,
.width = 15,
.height = 16,
.paletteNum = 15,
.baseBlock = 30
},
{
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
.width = 14,
.height = 6,
.paletteNum = 15,
.baseBlock = 270
},
{
.priority = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 354
},
{
.priority = 1,
.tilemapLeft = 24,
.tilemapTop = 17,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 462
},
DUMMY_WIN_TEMPLATE, DUMMY_WIN_TEMPLATE,
}; };
static const struct WindowTemplate gUnknown_0861F350[] = static const struct WindowTemplate gUnknown_0861F350[] =
{ {
{0x01, 0x16, 0x11, 0x07, 0x02, 0x0f, 0x01d8}, {
{0x01, 0x16, 0x0f, 0x07, 0x04, 0x0f, 0x01d8}, .priority = 1,
{0x01, 0x0f, 0x0f, 0x0e, 0x04, 0x0f, 0x01d8}, .tilemapLeft = 22,
{0x01, 0x0f, 0x0d, 0x0e, 0x06, 0x0f, 0x01d8}, .tilemapTop = 17,
{0x01, 0x18, 0x0f, 0x05, 0x04, 0x0f, 0x01d8}, .width = 7,
.height = 2,
.paletteNum = 15,
.baseBlock = 472
},
{
.priority = 1,
.tilemapLeft = 22,
.tilemapTop = 15,
.width = 7,
.height = 4,
.paletteNum = 15,
.baseBlock = 472
},
{
.priority = 1,
.tilemapLeft = 15,
.tilemapTop = 15,
.width = 14,
.height = 4,
.paletteNum = 15,
.baseBlock = 472
},
{
.priority = 1,
.tilemapLeft = 15,
.tilemapTop = 13,
.width = 14,
.height = 6,
.paletteNum = 15,
.baseBlock = 472
},
{
.priority = 1,
.tilemapLeft = 24,
.tilemapTop = 15,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 472
},
}; };
extern const struct CompressedSpriteSheet gUnknown_0861F3CC; extern const struct CompressedSpriteSheet gUnknown_0861F3CC;

View File

@ -64,11 +64,28 @@ static const struct BgTemplate sTrainerHillRecordsBgTemplates[] =
static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] = static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] =
{ {
{0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14}, {
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
.width = 26,
.height = 18,
.paletteNum = 15,
.baseBlock = 20
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate sLinkBattleRecordsWindow = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1}; static const struct WindowTemplate sLinkBattleRecordsWindow =
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
.width = 26,
.height = 17,
.paletteNum = 15,
.baseBlock = 1
};
static const u8 sText_DashesNoPlayer[] = _("-------"); static const u8 sText_DashesNoPlayer[] = _("-------");
static const u8 sText_DashesNoScore[] = _("----"); static const u8 sText_DashesNoScore[] = _("----");

View File

@ -322,18 +322,72 @@ static const struct BgTemplate sBerryBlenderBgTemplates[3] =
static const struct WindowTemplate sBerryBlender_WindowTemplates[] = static const struct WindowTemplate sBerryBlender_WindowTemplates[] =
{ {
{0, 1, 6, 7, 2, 0xE, 0x28}, {
{0, 0x16, 6, 7, 2, 0xE, 0x36}, .priority = 0,
{0, 1, 0xC, 7, 2, 0xE, 0x44}, .tilemapLeft = 1,
{0, 0x16, 0xC, 7, 2, 0xE, 0x52}, .tilemapTop = 6,
{0, 2, 0xF, 0x1B, 4, 0xE, 0x60}, .width = 7,
{0, 5, 3, 0x15, 0xE, 0xE, 0x60}, .height = 2,
.paletteNum = 14,
.baseBlock = 0x28,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 6,
.width = 7,
.height = 2,
.paletteNum = 14,
.baseBlock = 0x36,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 12,
.width = 7,
.height = 2,
.paletteNum = 14,
.baseBlock = 0x44,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 12,
.width = 7,
.height = 2,
.paletteNum = 14,
.baseBlock = 0x52,
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 14,
.baseBlock = 0x60,
},
{
.priority = 0,
.tilemapLeft = 5,
.tilemapTop = 3,
.width = 21,
.height = 14,
.paletteNum = 14,
.baseBlock = 0x60,
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate sBlender_YesNoWindowTemplate = static const struct WindowTemplate sBlender_YesNoWindowTemplate =
{ {
0, 0x15, 9, 5, 4, 0xE, 0xCC .priority = 0,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 14,
.baseBlock = 0xCC
}; };
static const s8 sUnknown_083399C0[][2] = static const s8 sUnknown_083399C0[][2] =
@ -790,7 +844,16 @@ static const u8 sUnknown_08339CD2[] =
0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02 0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02
}; };
static const struct WindowTemplate sBlenderRecordWindowTemplate = {0, 6, 4, 0x12, 0xB, 0xF, 8}; static const struct WindowTemplate sBlenderRecordWindowTemplate =
{
.priority = 0,
.tilemapLeft = 6,
.tilemapTop = 4,
.width = 18,
.height = 11,
.paletteNum = 15,
.baseBlock = 8
};
// code // code

View File

@ -101,10 +101,42 @@ static const u8 sTextColors[2][3] =
static const struct WindowTemplate sWindowTemplates[] = static const struct WindowTemplate sWindowTemplates[] =
{ {
{0x01, 0x0b, 0x04, 0x08, 0x02, 0x0f, 0x0045}, // WIN_BERRY_NAME { // WIN_BERRY_NAME
{0x01, 0x0b, 0x07, 0x12, 0x04, 0x0f, 0x0055}, // WIN_SIZE_FIRM .priority = 1,
{0x01, 0x04, 0x0e, 0x19, 0x04, 0x0f, 0x009d}, // WIN_DESC .tilemapLeft = 11,
{0x00, 0x02, 0x00, 0x08, 0x02, 0x0f, 0x0101}, // WIN_BERRY_TAG .tilemapTop = 4,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 69,
},
{ // WIN_SIZE_FIRM
.priority = 1,
.tilemapLeft = 11,
.tilemapTop = 7,
.width = 18,
.height = 4,
.paletteNum = 15,
.baseBlock = 85,
},
{ // WIN_DESC
.priority = 1,
.tilemapLeft = 4,
.tilemapTop = 14,
.width = 25,
.height = 4,
.paletteNum = 15,
.baseBlock = 157,
},
{ // WIN_BERRY_TAG
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 0,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 257,
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };

View File

@ -948,7 +948,15 @@ static const struct BgTemplate gUnknown_085E6F68[] =
}; };
static const struct WindowTemplate gUnknown_085E6F6C[] = static const struct WindowTemplate gUnknown_085E6F6C[] =
{ {
{ 0x00, 0x00, 0x09, 0x1E, 0x0C, 0x08, 0x0001 }, {
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 9,
.width = 30,
.height = 12,
.paletteNum = 8,
.baseBlock = 1
},
DUMMY_WIN_TEMPLATE, DUMMY_WIN_TEMPLATE,
}; };
static const u8 gUnknown_085E6F7C[][2] = static const u8 gUnknown_085E6F7C[][2] =

View File

@ -61,7 +61,16 @@ EWRAM_DATA static u16 sHatchedEggMotherMoves[4] = {0};
#include "data/pokemon/egg_moves.h" #include "data/pokemon/egg_moves.h"
static const struct WindowTemplate sDaycareLevelMenuWindowTemplate = {0, 0xF, 1, 0xE, 6, 0xF, 8}; static const struct WindowTemplate sDaycareLevelMenuWindowTemplate =
{
.priority = 0,
.tilemapLeft = 15,
.tilemapTop = 1,
.width = 14,
.height = 6,
.paletteNum = 15,
.baseBlock = 8
};
static const struct ListMenuItem sLevelMenuItems[] = static const struct ListMenuItem sLevelMenuItems[] =
{ {

View File

@ -214,22 +214,67 @@ void (*const SecretBasePC_SelectedDecorActions[][2])(u8 taskId) = {
} }
}; };
const struct WindowTemplate gUnknown_085A6B90[4] = { const struct WindowTemplate gUnknown_085A6B90[4] =
{ 0, 1, 1, 18, 8, 15, 0x0001 }, {
{ 0, 1, 1, 13, 18, 13, 0x0091 }, {
{ 0, 17, 1, 12, 2, 15, 0x017b }, .priority = 0,
{ 0, 16, 13, 13, 6, 15, 0x0193 } .tilemapLeft = 1,
.tilemapTop = 1,
.width = 18,
.height = 8,
.paletteNum = 15,
.baseBlock = 0x0001
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 13,
.height = 18,
.paletteNum = 13,
.baseBlock = 0x0091
},
{
.priority = 0,
.tilemapLeft = 17,
.tilemapTop = 1,
.width = 12,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x017b
},
{
.priority = 0,
.tilemapLeft = 16,
.tilemapTop = 13,
.width = 13,
.height = 6,
.paletteNum = 15,
.baseBlock = 0x0193
}
}; };
const u16 gUnknown_085A6BB0[] = INCBIN_U16("graphics/decorations/unk_85a6bb0.gbapal"); const u16 gUnknown_085A6BB0[] = INCBIN_U16("graphics/decorations/unk_85a6bb0.gbapal");
const struct ListMenuTemplate gUnknown_085A6BD0 = { const struct ListMenuTemplate gUnknown_085A6BD0 =
NULL, {
sub_8127480, .items = NULL,
sub_81274A0, .moveCursorFunc = sub_8127480,
0, 0, .itemPrintFunc = sub_81274A0,
0, 0, 8, 0, .totalItems = 0,
9, 2, 1, 3, FALSE, 0, FALSE, 7 .maxShowed = 0,
.windowId = 0,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
.upText_Y = 9,
.cursorPal = 2,
.fillValue = 1,
.cursorShadowPal = 3,
.lettersSpacing = FALSE,
.itemVerticalPadding = 0,
.scrollMultiple = FALSE,
.fontId = 7
}; };
#include "data/decoration/icon.h" #include "data/decoration/icon.h"
@ -1087,7 +1132,7 @@ void sub_8127B04(u8 taskId)
{ {
DrawWholeMapView(); DrawWholeMapView();
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]); Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
warp_in(); WarpIntoMap();
} }
u16 sub_8127B54(u8 decor, u8 a1) u16 sub_8127B54(u8 decor, u8 a1)

View File

@ -253,13 +253,27 @@ static const struct BgTemplate sBgTemplates_EggHatch[2] =
static const struct WindowTemplate sWinTemplates_EggHatch[2] = static const struct WindowTemplate sWinTemplates_EggHatch[2] =
{ {
{0, 2, 0xF, 0x1A, 4, 0, 0x40}, {
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 26,
.height = 4,
.paletteNum = 0,
.baseBlock = 64
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate sYesNoWinTemplate = static const struct WindowTemplate sYesNoWinTemplate =
{ {
0, 0x15, 9, 5, 4, 0xF, 0x1A8 .priority = 0,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 424
}; };
static const s16 sEggShardVelocities[][2] = static const s16 sEggShardVelocities[][2] =

View File

@ -26,9 +26,9 @@
// this file was known as evobjmv.c in Game Freak's original source // this file was known as evobjmv.c in Game Freak's original source
extern u8 gUnknown_020375B4; EWRAM_DATA u8 sCurrentReflectionType = 0;
extern u16 gUnknown_020375B6; EWRAM_DATA u16 sCurrentSpecialObjectPaletteTag = 0;
extern struct LockedAnimEventObjects *gLockedAnimEventObjects; EWRAM_DATA struct LockedAnimEventObjects *gLockedAnimEventObjects = {0};
static void MoveCoordsInDirection(u32, s16 *, s16 *, s16, s16); static void MoveCoordsInDirection(u32, s16 *, s16 *, s16, s16);
static bool8 EventObjectExecSingleMovementAction(struct EventObject *, struct Sprite *); static bool8 EventObjectExecSingleMovementAction(struct EventObject *, struct Sprite *);
@ -102,7 +102,7 @@ static struct EventObjectTemplate *FindEventObjectTemplateByLocalId(u8 localId,
static void ClearEventObjectMovement(struct EventObject *, struct Sprite *); static void ClearEventObjectMovement(struct EventObject *, struct Sprite *);
static void EventObjectSetSingleMovement(struct EventObject *, struct Sprite *, u8); static void EventObjectSetSingleMovement(struct EventObject *, struct Sprite *, u8);
const u8 gUnknown_084975C4[] = {1, 1, 6, 7, 8, 9, 6, 7, 8, 9, 11, 11, 0, 0, 0, 0}; const u8 gReflectionEffectPaletteMap[] = {1, 1, 6, 7, 8, 9, 6, 7, 8, 9, 11, 11, 0, 0, 0, 0};
const struct SpriteTemplate gCameraSpriteTemplate = {0, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, ObjectCB_CameraObject}; const struct SpriteTemplate gCameraSpriteTemplate = {0, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, ObjectCB_CameraObject};
@ -376,7 +376,7 @@ const u8 gInitialMovementTypeFacingDirections[] = {
#include "data/field_event_obj/event_object_subsprites.h" #include "data/field_event_obj/event_object_subsprites.h"
#include "data/field_event_obj/event_object_graphics_info.h" #include "data/field_event_obj/event_object_graphics_info.h"
const struct SpritePalette gUnknown_0850BBC8[] = { const struct SpritePalette sEventObjectSpritePalettes[] = {
{gEventObjectPalette0, 0x1103}, {gEventObjectPalette0, 0x1103},
{gEventObjectPalette1, 0x1104}, {gEventObjectPalette1, 0x1104},
{gEventObjectPalette2, 0x1105}, {gEventObjectPalette2, 0x1105},
@ -415,7 +415,7 @@ const struct SpritePalette gUnknown_0850BBC8[] = {
{NULL, 0x0000}, {NULL, 0x0000},
}; };
const u16 Unknown_0850BCE8[] = { const u16 gPlayerReflectionPaletteTags[] = {
0x1101, 0x1101,
0x1101, 0x1101,
0x1101, 0x1101,
@ -429,115 +429,115 @@ const u16 Unknown_0850BCF0[] = {
0x1111, 0x1111,
}; };
const u16 Unknown_0850BCF8[] = { const u16 gPlayerUnderwaterReflectionPaletteTags[] = {
0x1115, 0x1115,
0x1115, 0x1115,
0x1115, 0x1115,
0x1115, 0x1115,
}; };
const struct PairedPalettes gUnknown_0850BD00[] = { const struct PairedPalettes gPlayerReflectionPaletteSets[] = {
{0x1100, Unknown_0850BCE8}, {0x1100, gPlayerReflectionPaletteTags},
{0x1110, Unknown_0850BCF0}, {0x1110, Unknown_0850BCF0},
{0x1115, Unknown_0850BCF8}, {0x1115, gPlayerUnderwaterReflectionPaletteTags},
{0x11FF, NULL}, {0x11FF, NULL},
}; };
const u16 Unknown_0850BD20[] = { const u16 gQuintyPlumpReflectionPaletteTags[] = {
0x110C, 0x110C,
0x110C, 0x110C,
0x110C, 0x110C,
0x110C, 0x110C,
}; };
const u16 Unknown_0850BD28[] = { const u16 gTruckReflectionPaletteTags[] = {
0x110D, 0x110D,
0x110D, 0x110D,
0x110D, 0x110D,
0x110D, 0x110D,
}; };
const u16 Unknown_0850BD30[] = { const u16 gVigorothMoverReflectionPaletteTags[] = {
0x110E, 0x110E,
0x110E, 0x110E,
0x110E, 0x110E,
0x110E, 0x110E,
}; };
const u16 Unknown_0850BD38[] = { const u16 gMovingBoxReflectionPaletteTags[] = {
0x1112, 0x1112,
0x1112, 0x1112,
0x1112, 0x1112,
0x1112, 0x1112,
}; };
const u16 Unknown_0850BD40[] = { const u16 gCableCarReflectionPaletteTags[] = {
0x1113, 0x1113,
0x1113, 0x1113,
0x1113, 0x1113,
0x1113, 0x1113,
}; };
const u16 Unknown_0850BD48[] = { const u16 gSSTidalReflectionPaletteTags[] = {
0x1114, 0x1114,
0x1114, 0x1114,
0x1114, 0x1114,
0x1114, 0x1114,
}; };
const u16 Unknown_0850BD50[] = { const u16 gSubmarineShadowReflectionPaletteTags[] = {
0x111B, 0x111B,
0x111B, 0x111B,
0x111B, 0x111B,
0x111B, 0x111B,
}; };
const u16 Unknown_0850BD58[] = { const u16 Unknown_0850BD58[] = { // Kyogre2?
0x1117, 0x1117,
0x1117, 0x1117,
0x1117, 0x1117,
0x1117, 0x1117,
}; };
const u16 Unknown_0850BD60[] = { const u16 Unknown_0850BD60[] = { // Groudon2?
0x1119, 0x1119,
0x1119, 0x1119,
0x1119, 0x1119,
0x1119, 0x1119,
}; };
const u16 Unknown_0850BD68[] = { const u16 Unknown_0850BD68[] = { // Invisible Keckleon?
0x1109, 0x1109,
0x1109, 0x1109,
0x1109, 0x1109,
0x1109, 0x1109,
}; };
const u16 Unknown_0850BD70[] = { const u16 gRedLeafReflectionPaletteTags[] = {
0x111D, 0x111D,
0x111D, 0x111D,
0x111D, 0x111D,
0x111D, 0x111D,
}; };
const struct PairedPalettes gUnknown_0850BD78[] = { const struct PairedPalettes gSpecialObjectReflectionPaletteSets[] = {
{4352, Unknown_0850BCE8}, {4352, gPlayerReflectionPaletteTags},
{4368, Unknown_0850BCF0}, {4368, Unknown_0850BCF0},
{4363, Unknown_0850BD20}, {4363, gQuintyPlumpReflectionPaletteTags},
{4365, Unknown_0850BD28}, {4365, gTruckReflectionPaletteTags},
{4366, Unknown_0850BD30}, {4366, gVigorothMoverReflectionPaletteTags},
{4370, Unknown_0850BD38}, {4370, gMovingBoxReflectionPaletteTags},
{4371, Unknown_0850BD40}, {4371, gCableCarReflectionPaletteTags},
{4372, Unknown_0850BD48}, {4372, gSSTidalReflectionPaletteTags},
{4374, Unknown_0850BD58}, {4374, Unknown_0850BD58},
{4376, Unknown_0850BD60}, {4376, Unknown_0850BD60},
{4357, Unknown_0850BD68}, {4357, Unknown_0850BD68},
{4379, Unknown_0850BD50}, {4379, gSubmarineShadowReflectionPaletteTags},
{4381, Unknown_0850BD70}, {4381, gRedLeafReflectionPaletteTags},
{4607, NULL}, {4607, NULL},
}; };
const u16 gUnknown_0850BDE8[] = { const u16 gObjectPaletteTags0[] = {
0x1100, 0x1100,
0x1101, 0x1101,
0x1103, 0x1103,
@ -550,7 +550,7 @@ const u16 gUnknown_0850BDE8[] = {
0x110A, 0x110A,
}; };
const u16 gUnknown_0850BDFC[] = { const u16 gObjectPaletteTags1[] = {
0x1100, 0x1100,
0x1101, 0x1101,
0x1103, 0x1103,
@ -563,7 +563,7 @@ const u16 gUnknown_0850BDFC[] = {
0x110A, 0x110A,
}; };
const u16 gUnknown_0850BE10[] = { const u16 gObjectPaletteTags2[] = {
0x1100, 0x1100,
0x1101, 0x1101,
0x1103, 0x1103,
@ -576,7 +576,7 @@ const u16 gUnknown_0850BE10[] = {
0x110A, 0x110A,
}; };
const u16 gUnknown_0850BE24[] = { const u16 gObjectPaletteTags3[] = {
0x1100, 0x1100,
0x1101, 0x1101,
0x1103, 0x1103,
@ -590,11 +590,11 @@ const u16 gUnknown_0850BE24[] = {
}; };
const u16 *const gUnknown_0850BE38[] = { const u16 *const gObjectPaletteTagSets[] = {
gUnknown_0850BDE8, gObjectPaletteTags0,
gUnknown_0850BDFC, gObjectPaletteTags1,
gUnknown_0850BE10, gObjectPaletteTags2,
gUnknown_0850BE24, gObjectPaletteTags3,
}; };
#include "data/field_event_obj/berry_tree_graphics_tables.h" #include "data/field_event_obj/berry_tree_graphics_tables.h"
@ -798,7 +798,7 @@ bool8 (*const gDirectionBlockedMetatileFuncs[])(u8) = {
MetatileBehavior_IsWestBlocked MetatileBehavior_IsWestBlocked
}; };
const struct Coords16 gDirectionToVectors[] = { static const struct Coords16 sDirectionToVectors[] = {
{ 0, 0}, { 0, 0},
{ 0, 1}, { 0, 1},
{ 0, -1}, { 0, -1},
@ -1461,11 +1461,11 @@ static u8 TrySetupEventObjectSprite(struct EventObjectTemplate *eventObjectTempl
paletteSlot = graphicsInfo->paletteSlot; paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0) if (paletteSlot == 0)
{ {
npc_load_two_palettes__no_record(graphicsInfo->paletteTag1, 0); LoadPlayerObjectReflectionPalette(graphicsInfo->paletteTag1, 0);
} }
else if (paletteSlot == 10) else if (paletteSlot == 10)
{ {
npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, 10); LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, 10);
} }
else if (paletteSlot >= 16) else if (paletteSlot >= 16)
{ {
@ -1653,7 +1653,7 @@ u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
sprite->data[1] = z; sprite->data[1] = z;
if (graphicsInfo->paletteSlot == 10) if (graphicsInfo->paletteSlot == 10)
{ {
npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot); LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
} }
else if (graphicsInfo->paletteSlot >= 16) else if (graphicsInfo->paletteSlot >= 16)
{ {
@ -1806,11 +1806,11 @@ static void sub_808E1B8(u8 eventObjectId, s16 x, s16 y)
paletteSlot = graphicsInfo->paletteSlot; paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0) if (paletteSlot == 0)
{ {
npc_load_two_palettes__no_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot); LoadPlayerObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
} }
else if (paletteSlot == 10) else if (paletteSlot == 10)
{ {
npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot); LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
} }
else if (paletteSlot >= 16) else if (paletteSlot >= 16)
{ {
@ -1882,11 +1882,11 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId)
paletteSlot = graphicsInfo->paletteSlot; paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0) if (paletteSlot == 0)
{ {
pal_patch_for_npc(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot); PatchObjectPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
} }
else if (paletteSlot == 10) else if (paletteSlot == 10)
{ {
npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot); LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
} }
else if (paletteSlot >= 16) else if (paletteSlot >= 16)
{ {
@ -1980,14 +1980,14 @@ const struct EventObjectGraphicsInfo *GetEventObjectGraphicsInfo(u8 graphicsId)
{ {
graphicsId = VarGetEventObjectGraphicsId(graphicsId - SPRITE_VAR); graphicsId = VarGetEventObjectGraphicsId(graphicsId - SPRITE_VAR);
} }
if (graphicsId == 0x45) if (graphicsId == EVENT_OBJ_GFX_BARD)
{ {
bard = GetCurrentMauvilleOldMan(); bard = GetCurrentMauvilleOldMan();
return gMauvilleOldManGraphicsInfoPointers[bard]; return gMauvilleOldManGraphicsInfoPointers[bard];
} }
if (graphicsId >= NUM_OBJECT_GRAPHICS_INFO) if (graphicsId >= NUM_OBJECT_GRAPHICS_INFO)
{ {
graphicsId = 0x05; // LittleBoy1 graphicsId = EVENT_OBJ_GFX_LITTLE_BOY_1;
} }
return gEventObjectGraphicsInfoPointers[graphicsId]; return gEventObjectGraphicsInfoPointers[graphicsId];
} }
@ -2071,7 +2071,7 @@ void sub_808E82C(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y)
} }
} }
void gpu_pal_allocator_reset__manage_upper_four(void) void FreeAndReserveObjectSpritePalettes(void)
{ {
FreeAllSpritePalettes(); FreeAllSpritePalettes();
gReservedSpritePaletteCount = 12; gReservedSpritePaletteCount = 12;
@ -2084,7 +2084,7 @@ static void sub_808E894(u16 paletteTag)
paletteSlot = FindEventObjectPaletteIndexByTag(paletteTag); paletteSlot = FindEventObjectPaletteIndexByTag(paletteTag);
if (paletteSlot != 0x11ff) // always true if (paletteSlot != 0x11ff) // always true
{ {
sub_808E8F4(&gUnknown_0850BBC8[paletteSlot]); sub_808E8F4(&sEventObjectSpritePalettes[paletteSlot]);
} }
} }
@ -2107,19 +2107,19 @@ static u8 sub_808E8F4(const struct SpritePalette *spritePalette)
return LoadSpritePalette(spritePalette); return LoadSpritePalette(spritePalette);
} }
void pal_patch_for_npc(u16 paletteTag, u8 paletteSlot) void PatchObjectPalette(u16 paletteTag, u8 paletteSlot)
{ {
u16 paletteIdx; u16 paletteIdx;
paletteIdx = FindEventObjectPaletteIndexByTag(paletteTag); paletteIdx = FindEventObjectPaletteIndexByTag(paletteTag);
LoadPalette(gUnknown_0850BBC8[paletteIdx].data, 16 * paletteSlot + 256, 0x20); LoadPalette(sEventObjectSpritePalettes[paletteIdx].data, 16 * paletteSlot + 256, 0x20);
} }
void pal_patch_for_npc_range(const u16 *paletteTags, u8 minSlot, u8 maxSlot) void PatchObjectPaletteRange(const u16 *paletteTags, u8 minSlot, u8 maxSlot)
{ {
while (minSlot < maxSlot) while (minSlot < maxSlot)
{ {
pal_patch_for_npc(*paletteTags, minSlot); PatchObjectPalette(*paletteTags, minSlot);
paletteTags++; paletteTags++;
minSlot++; minSlot++;
} }
@ -2129,9 +2129,9 @@ static u8 FindEventObjectPaletteIndexByTag(u16 tag)
{ {
u8 i; u8 i;
for (i = 0; gUnknown_0850BBC8[i].tag != 0x11ff; i++) for (i = 0; sEventObjectSpritePalettes[i].tag != 0x11ff; i++)
{ {
if (gUnknown_0850BBC8[i].tag == tag) if (sEventObjectSpritePalettes[i].tag == tag)
{ {
return i; return i;
} }
@ -2139,32 +2139,32 @@ static u8 FindEventObjectPaletteIndexByTag(u16 tag)
return 0xff; return 0xff;
} }
void npc_load_two_palettes__no_record(u16 tag, u8 slot) void LoadPlayerObjectReflectionPalette(u16 tag, u8 slot)
{ {
u8 i; u8 i;
pal_patch_for_npc(tag, slot); PatchObjectPalette(tag, slot);
for (i = 0; gUnknown_0850BD00[i].tag != 0x11ff; i++) for (i = 0; gPlayerReflectionPaletteSets[i].tag != 0x11ff; i++)
{ {
if (gUnknown_0850BD00[i].tag == tag) if (gPlayerReflectionPaletteSets[i].tag == tag)
{ {
pal_patch_for_npc(gUnknown_0850BD00[i].data[gUnknown_020375B4], gUnknown_084975C4[slot]); PatchObjectPalette(gPlayerReflectionPaletteSets[i].data[sCurrentReflectionType], gReflectionEffectPaletteMap[slot]);
return; return;
} }
} }
} }
void npc_load_two_palettes__and_record(u16 tag, u8 slot) void LoadSpecialObjectReflectionPalette(u16 tag, u8 slot)
{ {
u8 i; u8 i;
gUnknown_020375B6 = tag; sCurrentSpecialObjectPaletteTag = tag;
pal_patch_for_npc(tag, slot); PatchObjectPalette(tag, slot);
for (i = 0; gUnknown_0850BD78[i].tag != 0x11ff; i++) for (i = 0; gSpecialObjectReflectionPaletteSets[i].tag != 0x11ff; i++)
{ {
if (gUnknown_0850BD78[i].tag == tag) if (gSpecialObjectReflectionPaletteSets[i].tag == tag)
{ {
pal_patch_for_npc(gUnknown_0850BD78[i].data[gUnknown_020375B4], gUnknown_084975C4[slot]); PatchObjectPalette(gSpecialObjectReflectionPaletteSets[i].data[sCurrentReflectionType], gReflectionEffectPaletteMap[slot]);
return; return;
} }
} }
@ -2172,7 +2172,7 @@ void npc_load_two_palettes__and_record(u16 tag, u8 slot)
static void sub_808EAB0(u16 tag, u8 slot) static void sub_808EAB0(u16 tag, u8 slot)
{ {
pal_patch_for_npc(tag, slot); PatchObjectPalette(tag, slot);
} }
void unref_sub_808EAC4(struct EventObject *eventObject, s16 x, s16 y) void unref_sub_808EAC4(struct EventObject *eventObject, s16 x, s16 y)
@ -2191,7 +2191,7 @@ void ShiftEventObjectCoords(struct EventObject *eventObject, s16 x, s16 y)
eventObject->currentCoords.y = y; eventObject->currentCoords.y = y;
} }
/*static*/ void npc_coords_set(struct EventObject *eventObject, s16 x, s16 y) /*static*/ void SetEventObjectCoords(struct EventObject *eventObject, s16 x, s16 y)
{ {
eventObject->previousCoords.x = x; eventObject->previousCoords.x = x;
eventObject->previousCoords.y = y; eventObject->previousCoords.y = y;
@ -2206,7 +2206,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y)
sprite = &gSprites[eventObject->spriteId]; sprite = &gSprites[eventObject->spriteId];
graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId);
npc_coords_set(eventObject, x, y); SetEventObjectCoords(eventObject, x, y);
sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
@ -2414,7 +2414,7 @@ u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
return i; return i;
} }
u8 obj_unfreeze(struct Sprite *sprite, s16 x, s16 y, u8 subpriority) u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
{ {
s16 i; s16 i;
@ -2610,35 +2610,35 @@ void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat)
} }
} }
void npc_paltag_set_load(u8 palSlot) void InitEventObjectPalettes(u8 palSlot)
{ {
gpu_pal_allocator_reset__manage_upper_four(); FreeAndReserveObjectSpritePalettes();
gUnknown_020375B6 = 0x11ff; sCurrentSpecialObjectPaletteTag = 0x11ff;
gUnknown_020375B4 = palSlot; sCurrentReflectionType = palSlot;
if (palSlot == 1) if (palSlot == 1)
{ {
pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 6); PatchObjectPaletteRange(gObjectPaletteTagSets[sCurrentReflectionType], 0, 6);
gReservedSpritePaletteCount = 8; gReservedSpritePaletteCount = 8;
} }
else else
{ {
pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 10); PatchObjectPaletteRange(gObjectPaletteTagSets[sCurrentReflectionType], 0, 10);
} }
} }
u16 npc_paltag_by_palslot(u8 palSlot) u16 GetObjectPaletteTag(u8 palSlot)
{ {
u8 i; u8 i;
if (palSlot < 10) if (palSlot < 10)
{ {
return gUnknown_0850BE38[gUnknown_020375B4][palSlot]; return gObjectPaletteTagSets[sCurrentReflectionType][palSlot];
} }
for (i = 0; gUnknown_0850BD78[i].tag != 0x11ff; i++) for (i = 0; gSpecialObjectReflectionPaletteSets[i].tag != 0x11ff; i++)
{ {
if (gUnknown_0850BD78[i].tag == gUnknown_020375B6) if (gSpecialObjectReflectionPaletteSets[i].tag == sCurrentSpecialObjectPaletteTag)
{ {
return gUnknown_0850BD78[i].data[gUnknown_020375B4]; return gSpecialObjectReflectionPaletteSets[i].data[sCurrentReflectionType];
} }
} }
return 0x11ff; return 0x11ff;
@ -4957,14 +4957,14 @@ void sub_8092EF0(u8 localId, u8 mapNum, u8 mapGroup)
void MoveCoords(u8 direction, s16 *x, s16 *y) void MoveCoords(u8 direction, s16 *x, s16 *y)
{ {
*x += gDirectionToVectors[direction].x; *x += sDirectionToVectors[direction].x;
*y += gDirectionToVectors[direction].y; *y += sDirectionToVectors[direction].y;
} }
void sub_8092F60(u8 direction, s16 *x, s16 *y) void sub_8092F60(u8 direction, s16 *x, s16 *y)
{ {
*x += gDirectionToVectors[direction].x << 4; *x += sDirectionToVectors[direction].x << 4;
*y += gDirectionToVectors[direction].y << 4; *y += sDirectionToVectors[direction].y << 4;
} }
static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 deltaY) static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 deltaY)
@ -4972,13 +4972,13 @@ static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 delta
u8 direction = dir; u8 direction = dir;
s16 dx2 = (u16)deltaX; s16 dx2 = (u16)deltaX;
s16 dy2 = (u16)deltaY; s16 dy2 = (u16)deltaY;
if (gDirectionToVectors[direction].x > 0) if (sDirectionToVectors[direction].x > 0)
*x += dx2; *x += dx2;
if (gDirectionToVectors[direction].x < 0) if (sDirectionToVectors[direction].x < 0)
*x -= dx2; *x -= dx2;
if (gDirectionToVectors[direction].y > 0) if (sDirectionToVectors[direction].y > 0)
*y += dy2; *y += dy2;
if (gDirectionToVectors[direction].y < 0) if (sDirectionToVectors[direction].y < 0)
*y -= dy2; *y -= dy2;
} }
@ -8389,32 +8389,32 @@ void UnfreezeEventObjects(void)
void Step1(struct Sprite *sprite, u8 dir) void Step1(struct Sprite *sprite, u8 dir)
{ {
sprite->pos1.x += gDirectionToVectors[dir].x; sprite->pos1.x += sDirectionToVectors[dir].x;
sprite->pos1.y += gDirectionToVectors[dir].y; sprite->pos1.y += sDirectionToVectors[dir].y;
} }
void Step2(struct Sprite *sprite, u8 dir) void Step2(struct Sprite *sprite, u8 dir)
{ {
sprite->pos1.x += 2 * (u16) gDirectionToVectors[dir].x; sprite->pos1.x += 2 * (u16) sDirectionToVectors[dir].x;
sprite->pos1.y += 2 * (u16) gDirectionToVectors[dir].y; sprite->pos1.y += 2 * (u16) sDirectionToVectors[dir].y;
} }
void Step3(struct Sprite *sprite, u8 dir) void Step3(struct Sprite *sprite, u8 dir)
{ {
sprite->pos1.x += 2 * (u16) gDirectionToVectors[dir].x + (u16) gDirectionToVectors[dir].x; sprite->pos1.x += 2 * (u16) sDirectionToVectors[dir].x + (u16) sDirectionToVectors[dir].x;
sprite->pos1.y += 2 * (u16) gDirectionToVectors[dir].y + (u16) gDirectionToVectors[dir].y; sprite->pos1.y += 2 * (u16) sDirectionToVectors[dir].y + (u16) sDirectionToVectors[dir].y;
} }
void Step4(struct Sprite *sprite, u8 dir) void Step4(struct Sprite *sprite, u8 dir)
{ {
sprite->pos1.x += 4 * (u16) gDirectionToVectors[dir].x; sprite->pos1.x += 4 * (u16) sDirectionToVectors[dir].x;
sprite->pos1.y += 4 * (u16) gDirectionToVectors[dir].y; sprite->pos1.y += 4 * (u16) sDirectionToVectors[dir].y;
} }
void Step8(struct Sprite *sprite, u8 dir) void Step8(struct Sprite *sprite, u8 dir)
{ {
sprite->pos1.x += 8 * (u16) gDirectionToVectors[dir].x; sprite->pos1.x += 8 * (u16) sDirectionToVectors[dir].x;
sprite->pos1.y += 8 * (u16) gDirectionToVectors[dir].y; sprite->pos1.y += 8 * (u16) sDirectionToVectors[dir].y;
} }
void oamt_npc_ministep_reset(struct Sprite *sprite, u8 a2, u8 a3) void oamt_npc_ministep_reset(struct Sprite *sprite, u8 a2, u8 a3)

View File

@ -1170,7 +1170,7 @@ void task00_8084310(u8 taskId)
if (!FieldEffectActiveListContains(FLDEFF_USE_FLY)) if (!FieldEffectActiveListContains(FLDEFF_USE_FLY))
{ {
Overworld_ResetStateAfterFly(); Overworld_ResetStateAfterFly();
warp_in(); WarpIntoMap();
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08084390; gFieldCallback = mapldr_08084390;
DestroyTask(taskId); DestroyTask(taskId);
@ -1355,7 +1355,7 @@ void sub_80B6FB8(struct Task *);
void sub_80B7004(struct Task *); void sub_80B7004(struct Task *);
void sub_80B7050(void); void sub_80B7050(void);
void sub_80B7060(void); void sub_80B7060(void);
bool8 sub_80859A0(void); bool8 BGMusicStopped(void);
void sub_80B70B4(void); void sub_80B70B4(void);
void sub_80E1570(void); void sub_80E1570(void);
void sub_80B70DC(u8); void sub_80B70DC(u8);
@ -1476,10 +1476,10 @@ void sub_80B7050(void)
void sub_80B7060(void) void sub_80B7060(void)
{ {
if (!gPaletteFade.active && sub_80859A0() == TRUE) if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{ {
sub_80E1570(); sub_80E1570();
warp_in(); WarpIntoMap();
gFieldCallback = sub_80B70B4; gFieldCallback = sub_80B70B4;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B6E88)); DestroyTask(FindTaskIdByFunc(sub_80B6E88));
@ -1838,9 +1838,9 @@ bool8 sub_80B77F8(struct Task *task, struct EventObject *eventObject, struct Spr
bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite)
{ {
if (!gPaletteFade.active && sub_80859A0() == TRUE) if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{ {
warp_in(); WarpIntoMap();
gFieldCallback = mapldr_080851BC; gFieldCallback = mapldr_080851BC;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B75F0)); DestroyTask(FindTaskIdByFunc(sub_80B75F0));
@ -2004,9 +2004,9 @@ 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)
{ {
if (!gPaletteFade.active && sub_80859A0() == TRUE) if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{ {
warp_in(); WarpIntoMap();
gFieldCallback = sub_80B6B68; gFieldCallback = sub_80B6B68;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B7A8C)); DestroyTask(FindTaskIdByFunc(sub_80B7A8C));
@ -2063,11 +2063,11 @@ void sub_80B7D34(struct Task *task)
eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId];
if (!EventObjectIsMovementOverridden(eventObject) || EventObjectClearHeldMovementIfFinished(eventObject)) if (!EventObjectIsMovementOverridden(eventObject) || EventObjectClearHeldMovementIfFinished(eventObject))
{ {
if (task->data[14] == 0 && !gPaletteFade.active && sub_80859A0() == TRUE) if (task->data[14] == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE)
{ {
SetEventObjectDirection(eventObject, task->data[15]); SetEventObjectDirection(eventObject, task->data[15]);
sub_8084E14(); sub_8084E14();
warp_in(); WarpIntoMap();
gFieldCallback = mapldr_080859D4; gFieldCallback = mapldr_080859D4;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B7CE4)); DestroyTask(FindTaskIdByFunc(sub_80B7CE4));
@ -2234,10 +2234,10 @@ static void TeleportFieldEffectTask4(struct Task *task)
task->data[5] = TRUE; task->data[5] = TRUE;
} }
if (sub_80859A0() == TRUE) if (BGMusicStopped() == TRUE)
{ {
Overworld_SetWarpDestToLastHealLoc(); Overworld_SetWarpDestToLastHealLoc();
warp_in(); WarpIntoMap();
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08085D88; gFieldCallback = mapldr_08085D88;
DestroyTask(FindTaskIdByFunc(ExecuteTeleportFieldEffectTask)); DestroyTask(FindTaskIdByFunc(ExecuteTeleportFieldEffectTask));

View File

@ -55,9 +55,26 @@ static const struct BgTemplate gUnknown_085E5068[] = {
} }
}; };
static const struct WindowTemplate gUnknown_085E5070[] = { static const struct WindowTemplate gUnknown_085E5070[] =
{ 0, 17, 17, 12, 2, 15, 0x0001 }, {
{ 0, 22, 1, 7, 2, 15, 0x0019 }, {
.priority = 0,
.tilemapLeft = 17,
.tilemapTop = 17,
.width = 12,
.height = 2,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 1,
.width = 7,
.height = 2,
.paletteNum = 15,
.baseBlock = 25
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };

View File

@ -269,7 +269,7 @@ u16 GetRecordedCyclingRoadResults(void) {
} }
void UpdateCyclingRoadState(void) { void UpdateCyclingRoadState(void) {
if (gUnknown_020322DC.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gUnknown_020322DC.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE)) if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE))
{ {
return; return;
} }
@ -2094,7 +2094,7 @@ bool32 warp0_in_pokecenter(void)
static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff }; static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff };
int i; int i;
u16 map = (gUnknown_020322DC.mapGroup << 8) + gUnknown_020322DC.mapNum; u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++) for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++)
{ {

View File

@ -712,8 +712,8 @@ int GetPostCameraMoveMapBorderId(int x, int y)
int CanCameraMoveInDirection(int direction) int CanCameraMoveInDirection(int direction)
{ {
int x, y; int x, y;
x = gSaveBlock1Ptr->pos.x + 7 + gUnknown_08339D64[direction].x; x = gSaveBlock1Ptr->pos.x + 7 + gDirectionToVectors[direction].x;
y = gSaveBlock1Ptr->pos.y + 7 + gUnknown_08339D64[direction].y; y = gSaveBlock1Ptr->pos.y + 7 + gDirectionToVectors[direction].y;
if (GetMapBorderIdAt(x, y) == -1) if (GetMapBorderIdAt(x, y) == -1)
{ {
return 0; return 0;

View File

@ -149,14 +149,57 @@ void sub_81AD6FC(u8 taskId);
// .rodata // .rodata
const struct BgTemplate gUnknown_08613F90[3] = { const struct BgTemplate gUnknown_08613F90[3] =
{0, 0, 31, 0, 0, 1, 0}, {
{1, 0, 30, 0, 0, 0, 0}, {
{2, 3, 29, 0, 0, 2, 0} .bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0,
},
{
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0,
},
{
.bg = 2,
.charBaseIndex = 3,
.mapBaseIndex = 29,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0,
},
}; };
const struct ListMenuTemplate gUnknown_08613F9C = { const struct ListMenuTemplate gUnknown_08613F9C =
NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0 {
.items = NULL,
.moveCursorFunc = bag_menu_change_item_callback,
.itemPrintFunc = sub_81AB520,
.totalItems = 0,
.maxShowed = 0,
.windowId = 0,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
.upText_Y = 1,
.cursorPal = 1,
.fillValue = 0,
.cursorShadowPal = 3,
.lettersSpacing = 0,
.itemVerticalPadding = 0,
.scrollMultiple = 0,
.fontId = 7,
.cursorKind = 0
}; };
const struct MenuAction gUnknown_08613FB4[] = { const struct MenuAction gUnknown_08613FB4[] = {
@ -221,27 +264,157 @@ const u8 gUnknown_08614164[][3] = {
{0, 14, 10} {0, 14, 10}
}; };
const struct WindowTemplate gUnknown_08614174[] = { const struct WindowTemplate gUnknown_08614174[] =
{0, 14, 2, 15, 16, 1, 0x27}, {
{0, 0, 13, 14, 6, 1, 0x117}, {
{0, 4, 1, 8, 2, 1, 0x1A1}, .priority = 0,
{0, 1, 13, 5, 6, 12, 0x16B}, .tilemapLeft = 14,
{0, 7, 13, 4, 6, 12, 0x189}, .tilemapTop = 2,
{1, 2, 15, 27, 4, 15, 0x1B1}, .width = 15,
{0xFF, 0, 0, 0, 0, 0, 0} .height = 16,
.paletteNum = 1,
.baseBlock = 0x27,
},
{
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
.width = 14,
.height = 6,
.paletteNum = 1,
.baseBlock = 0x117,
},
{
.priority = 0,
.tilemapLeft = 4,
.tilemapTop = 1,
.width = 8,
.height = 2,
.paletteNum = 1,
.baseBlock = 0x1A1,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 13,
.width = 5,
.height = 6,
.paletteNum = 12,
.baseBlock = 0x16B,
},
{
.priority = 0,
.tilemapLeft = 7,
.tilemapTop = 13,
.width = 4,
.height = 6,
.paletteNum = 12,
.baseBlock = 0x189,
},
{
.priority = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x1B1,
},
DUMMY_WIN_TEMPLATE,
}; };
const struct WindowTemplate gUnknown_086141AC[] = { const struct WindowTemplate gUnknown_086141AC[] =
{1, 22, 17, 7, 2, 15, 0x21D}, {
{1, 22, 15, 7, 4, 15, 0x21D}, {
{1, 15, 15, 14, 4, 15, 0x21D}, .priority = 1,
{1, 15, 13, 14, 6, 15, 0x21D}, .tilemapLeft = 22,
{1, 2, 15, 27, 4, 15, 0x1B1}, .tilemapTop = 17,
{1, 24, 15, 5, 4, 15, 0x21D}, .width = 7,
{1, 21, 9, 5, 4, 15, 0x21D}, .height = 2,
{1, 24, 17, 5, 2, 15, 0x21D}, .paletteNum = 15,
{1, 18, 11, 10, 2, 15, 0x245}, .baseBlock = 0x21D,
{1, 1, 1, 10, 2, 15, 0x231} },
{
.priority = 1,
.tilemapLeft = 22,
.tilemapTop = 15,
.width = 7,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 15,
.tilemapTop = 15,
.width = 14,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 15,
.tilemapTop = 13,
.width = 14,
.height = 6,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x1B1,
},
{
.priority = 1,
.tilemapLeft = 24,
.tilemapTop = 15,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 24,
.tilemapTop = 17,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x21D,
},
{
.priority = 1,
.tilemapLeft = 18,
.tilemapTop = 11,
.width = 10,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x245,
},
{
.priority = 1,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 10,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x231,
},
}; };
// .text // .text

View File

@ -878,7 +878,7 @@ void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId)
void task08_080A1C44(u8 taskId) void task08_080A1C44(u8 taskId)
{ {
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
sub_80B7CC8(); sub_80B7CC8();
DestroyTask(taskId); DestroyTask(taskId);
} }

View File

@ -131,29 +131,121 @@ const u8 gUnknown_082FEEF0[] = INCBIN_U8("graphics/birch_speech/map.bin.lz");
const u16 gUnknown_082FF018[] = INCBIN_U16("graphics/birch_speech/bg2.gbapal"); const u16 gUnknown_082FF018[] = INCBIN_U16("graphics/birch_speech/bg2.gbapal");
const u16 gUnknown_082FF028[] = {0, 0, 0, 0, 0, 0, 0, 0}; const u16 gUnknown_082FF028[] = {0, 0, 0, 0, 0, 0, 0, 0};
const struct WindowTemplate sWindowTemplates_NoSavedGame[] = { const struct WindowTemplate sWindowTemplates_NoSavedGame[] =
{0, 2, 1, 26, 2, 15, 1}, {
{0, 2, 5, 26, 2, 15, 0x35} {
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 5,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x35
}
}; };
const struct WindowTemplate sWindowTemplates_HasSavedGame[] = { const struct WindowTemplate sWindowTemplates_HasSavedGame[] =
{0, 2, 1, 26, 6, 15, 1}, {
{0, 2, 9, 26, 2, 15, 0x9D}, {
{0, 2, 13, 26, 2, 15, 0xD1}, .priority = 0,
{0, 2, 17, 26, 2, 15, 0x105}, .tilemapLeft = 2,
{0, 2, 21, 26, 2, 15, 0x139} .tilemapTop = 1,
.width = 26,
.height = 6,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 9,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x9D
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 13,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 0xD1
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 17,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x105
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 21,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x139
}
}; };
const struct WindowTemplate sWindowTemplate_ErrorWindow[] = { const struct WindowTemplate sWindowTemplate_ErrorWindow[] =
{0, 2, 15, 26, 4, 15, 0x16D}, {
{0xFF, 0, 0, 0, 0, 0, 0} {
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 26,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x16D
},
DUMMY_WIN_TEMPLATE
}; };
const struct WindowTemplate gUnknown_082FF080[] = { const struct WindowTemplate gUnknown_082FF080[] =
{0, 2, 15, 27, 4, 15, 1}, {
{0, 3, 5, 6, 4, 15, 0x6D}, {
{0, 3, 2, 9, 10, 15, 0x85}, .priority = 0,
{0xFF, 0, 0, 0, 0, 0, 0} .tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 3,
.tilemapTop = 5,
.width = 6,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x6D
},
{
.priority = 0,
.tilemapLeft = 3,
.tilemapTop = 2,
.width = 9,
.height = 10,
.paletteNum = 15,
.baseBlock = 0x85
},
DUMMY_WIN_TEMPLATE
}; };
const u16 gMainMenuBgPal[] = INCBIN_U16("graphics/misc/main_menu_bg.gbapal"); const u16 gMainMenuBgPal[] = INCBIN_U16("graphics/misc/main_menu_bg.gbapal");

View File

@ -65,13 +65,27 @@ static const u8 gUnknown_0860F094[] = { 8, 4, 1 };
static const struct WindowTemplate gUnknown_0860F098[] = static const struct WindowTemplate gUnknown_0860F098[] =
{ {
{ 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 }, {
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x194
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gUnknown_0860F0A8 = static const struct WindowTemplate gUnknown_0860F0A8 =
{ {
0x00, 0x15, 0x09, 0x05, 0x04, 0x0F, 0x125 .priority = 0,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x125
}; };
const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal");

View File

@ -42,8 +42,24 @@ static const struct BgTemplate sBgTemplates[] =
static const struct WindowTemplate sWindowTemplates[] = static const struct WindowTemplate sWindowTemplates[] =
{ {
{0, 4, 15, 22, 4, 14, 20}, {
{0, 7, 6, 16, 4, 14, 0x6C}, .priority = 0,
.tilemapLeft = 4,
.tilemapTop = 15,
.width = 22,
.height = 4,
.paletteNum = 14,
.baseBlock = 20
},
{
.priority = 0,
.tilemapLeft = 7,
.tilemapTop = 6,
.width = 16,
.height = 4,
.paletteNum = 14,
.baseBlock = 0x6C
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };

View File

@ -113,12 +113,53 @@ static const struct BgTemplate gUnknown_0858BE00[] =
} }
}; };
static const struct WindowTemplate gUnknown_0858BE10[] = { static const struct WindowTemplate gUnknown_0858BE10[] =
{ 0x01, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x030 }, {
{ 0x02, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x0C8 }, {
{ 0x03, 0x08, 0x06, 0x11, 0x02, 0x0A, 0x030 }, .priority = 1,
{ 0x03, 0x08, 0x04, 0x11, 0x02, 0x0A, 0x052 }, .tilemapLeft = 3,
{ 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0B, 0x074 }, .tilemapTop = 10,
.width = 19,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x030
},
{
.priority = 2,
.tilemapLeft = 3,
.tilemapTop = 10,
.width = 19,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x0C8
},
{
.priority = 3,
.tilemapLeft = 8,
.tilemapTop = 6,
.width = 17,
.height = 2,
.paletteNum = 10,
.baseBlock = 0x030
},
{
.priority = 3,
.tilemapLeft = 8,
.tilemapTop = 4,
.width = 17,
.height = 2,
.paletteNum = 10,
.baseBlock = 0x052
},
{
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.height = 2,
.paletteNum = 11,
.baseBlock = 0x074
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };

View File

@ -133,7 +133,7 @@ static void ClearFrontierRecord(void)
static void WarpToTruck(void) static void WarpToTruck(void)
{ {
Overworld_SetWarpDestination(25, 40, -1, -1, -1); // inside of truck Overworld_SetWarpDestination(25, 40, -1, -1, -1); // inside of truck
warp_in(); WarpIntoMap();
} }
void Sav2_ClearSetDefault(void) void Sav2_ClearSetDefault(void)

View File

@ -91,8 +91,24 @@ static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] =
static const struct WindowTemplate sOptionMenuWinTemplates[] = static const struct WindowTemplate sOptionMenuWinTemplates[] =
{ {
{1, 2, 1, 0x1A, 2, 1, 2}, {
{0, 2, 5, 0x1A, 0xE, 1, 0x36}, .priority = 1,
.tilemapLeft = 2,
.tilemapTop = 1,
.width = 26,
.height = 2,
.paletteNum = 1,
.baseBlock = 2
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 5,
.width = 26,
.height = 14,
.paletteNum = 1,
.baseBlock = 0x36
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };

View File

@ -1,8 +1,8 @@
#include "global.h" #include "global.h"
#include "overworld.h" #include "overworld.h"
#include "main.h"
#include "battle_setup.h" #include "battle_setup.h"
#include "berry.h" #include "berry.h"
#include "bg.h"
// #include "cable_club.h" // #include "cable_club.h"
#include "clock.h" #include "clock.h"
#include "event_data.h" #include "event_data.h"
@ -20,15 +20,18 @@
#include "field_weather.h" #include "field_weather.h"
#include "fieldmap.h" #include "fieldmap.h"
// #include "fldeff_flash.h" // #include "fldeff_flash.h"
#include "gpu_regs.h"
#include "heal_location.h" #include "heal_location.h"
#include "link.h" #include "link.h"
#include "link_rfu.h"
#include "load_save.h" #include "load_save.h"
#include "main.h" #include "main.h"
#include "malloc.h"
#include "m4a.h" #include "m4a.h"
#include "constants/maps.h"
#include "map_name_popup.h" #include "map_name_popup.h"
#include "menu.h" #include "menu.h"
#include "metatile_behavior.h" #include "metatile_behavior.h"
#include "money.h"
#include "new_game.h" #include "new_game.h"
#include "palette.h" #include "palette.h"
#include "play_time.h" #include "play_time.h"
@ -37,12 +40,11 @@
// #include "rotating_gate.h" // #include "rotating_gate.h"
#include "safari_zone.h" #include "safari_zone.h"
#include "save.h" #include "save.h"
#include "save_location.h"
#include "script.h" #include "script.h"
// #include "script_pokemon_80C4.h" // #include "script_pokemon_80C4.h"
#include "secret_base.h" #include "secret_base.h"
#include "constants/songs.h"
#include "sound.h" #include "sound.h"
#include "constants/species.h"
#include "start_menu.h" #include "start_menu.h"
#include "task.h" #include "task.h"
// #include "tileset_anim.h" // #include "tileset_anim.h"
@ -50,14 +52,11 @@
#include "tv.h" #include "tv.h"
#include "scanline_effect.h" #include "scanline_effect.h"
#include "wild_encounter.h" #include "wild_encounter.h"
#include "bg.h"
#include "money.h"
#include "save_location.h"
#include "constants/abilities.h" #include "constants/abilities.h"
#include "malloc.h"
#include "gpu_regs.h"
#include "link_rfu.h"
#include "constants/map_types.h" #include "constants/map_types.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/species.h"
// event scripts // event scripts
extern const u8 EventScript_WhiteOut[]; extern const u8 EventScript_WhiteOut[];
@ -159,7 +158,6 @@ extern void sub_80AAFA4(void);
extern void ShowStartMenu(void); extern void ShowStartMenu(void);
extern void sub_80AEE84(void); extern void sub_80AEE84(void);
extern void mapldr_default(void); extern void mapldr_default(void);
extern void npc_paltag_set_load(u8);
extern void sub_8088B3C(u16, u16); extern void sub_8088B3C(u16, u16);
extern bool32 sub_800F0B8(void); extern bool32 sub_800F0B8(void);
extern bool32 sub_8009F3C(void); extern bool32 sub_8009F3C(void);
@ -185,7 +183,7 @@ static bool32 sub_8086638(u8 *state);
static bool32 load_map_stuff(u8 *state, u32); static bool32 load_map_stuff(u8 *state, u32);
static bool32 map_loading_iteration_2_link(u8 *state); static bool32 map_loading_iteration_2_link(u8 *state);
static void mli4_mapscripts_and_other(void); static void mli4_mapscripts_and_other(void);
static void map_loading_lcd_reset(void); static void InitOverworldGraphicsRegisters(void);
static u8 sub_8087858(u8); static u8 sub_8087858(u8);
static u16 sub_80871C0(u32 a1); static u16 sub_80871C0(u32 a1);
static void sub_80867C8(void); static void sub_80867C8(void);
@ -246,9 +244,9 @@ static void c1_link_related_func_set(u16 (*func)(u32));
static void SetFieldVBlankCallback(void); static void SetFieldVBlankCallback(void);
static void FieldClearVBlankHBlankCallbacks(void); static void FieldClearVBlankHBlankCallbacks(void);
static void sub_8085810(void); static void sub_8085810(void);
static u8 sub_808532C(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3); static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 a2, u8 a3);
static u8 sub_808538C(struct UnkPlayerStruct *playerStruct, u8 a2, u16 a3, u8 a4); static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 a2, u16 a3, u8 a4);
static u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void); static u16 GetCenterScreenMetatileBehavior(void);
// IWRAM bss vars // IWRAM bss vars
IWRAM_DATA static void *sUnknown_03000E0C; IWRAM_DATA static void *sUnknown_03000E0C;
@ -260,12 +258,12 @@ IWRAM_DATA static u32 sUnusedVar;
// EWRAM vars // EWRAM vars
EWRAM_DATA static u8 sUnknown_020322D8 = 0; EWRAM_DATA static u8 sUnknown_020322D8 = 0;
EWRAM_DATA struct WarpData gUnknown_020322DC = {0}; EWRAM_DATA struct WarpData gLastUsedWarp = {0};
EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position
EWRAM_DATA static struct WarpData sUnknown_020322EC = {0}; EWRAM_DATA static struct WarpData gFixedDiveWarp = {0};
EWRAM_DATA static struct WarpData sUnknown_020322F4 = {0}; EWRAM_DATA static struct WarpData gFixedHoleWarp = {0};
EWRAM_DATA static u16 sLastMapSectionId = 0; EWRAM_DATA static u16 sLastMapSectionId = 0;
EWRAM_DATA static struct UnkPlayerStruct sUnknown_02032300 = {0}; EWRAM_DATA static struct InitialPlayerAvatarState gInitialPlayerAvatarState = {0};
EWRAM_DATA static u16 sAmbientCrySpecies = 0; EWRAM_DATA static u16 sAmbientCrySpecies = 0;
EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE; EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE;
EWRAM_DATA struct LinkPlayerEventObject gLinkPlayerEventObjects[4] = {0}; EWRAM_DATA struct LinkPlayerEventObject gLinkPlayerEventObjects[4] = {0};
@ -292,17 +290,17 @@ static const u8 sUnusedData[] =
0x2C, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00,
}; };
const struct UCoords32 gUnknown_08339D64[] = const struct UCoords32 gDirectionToVectors[] =
{ {
{ 0, 0}, { 0, 0}, // DIR_NONE
{ 0, 1}, { 0, 1}, // DIR_SOUTH
{ 0, -1}, { 0, -1}, // DIR_NORTH
{-1, 0}, {-1, 0}, // DIR_WEST
{ 1, 0}, { 1, 0}, // DIR_EAST
{-1, 1}, {-1, 1}, // DIR_SOUTHWEST
{ 1, 1}, { 1, 1}, // DIR_SOUTHEAST
{-1, -1}, {-1, -1}, // DIR_NORTHWEST
{ 1, -1}, { 1, -1}, // DIR_NORTHEAST
}; };
static const struct BgTemplate gUnknown_08339DAC[] = static const struct BgTemplate gUnknown_08339DAC[] =
@ -345,7 +343,7 @@ static const struct BgTemplate gUnknown_08339DAC[] =
} }
}; };
static const struct ScanlineEffectParams gUnknown_08339DBC = static const struct ScanlineEffectParams sFlashEffectParams =
{ {
(void *)REG_ADDR_WIN0H, (void *)REG_ADDR_WIN0H,
((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1, ((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1,
@ -400,12 +398,12 @@ void DoWhiteOut(void)
HealPlayerParty(); HealPlayerParty();
Overworld_ResetStateAfterWhiteOut(); Overworld_ResetStateAfterWhiteOut();
Overworld_SetWarpDestToLastHealLoc(); Overworld_SetWarpDestToLastHealLoc();
warp_in(); WarpIntoMap();
} }
void Overworld_ResetStateAfterFly(void) void Overworld_ResetStateAfterFly(void)
{ {
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD); FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE); FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
@ -415,7 +413,7 @@ void Overworld_ResetStateAfterFly(void)
void Overworld_ResetStateAfterTeleport(void) void Overworld_ResetStateAfterTeleport(void)
{ {
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD); FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE); FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
@ -426,7 +424,7 @@ void Overworld_ResetStateAfterTeleport(void)
void Overworld_ResetStateAfterDigEscRope(void) void Overworld_ResetStateAfterDigEscRope(void)
{ {
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD); FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE); FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
@ -436,7 +434,7 @@ void Overworld_ResetStateAfterDigEscRope(void)
static void Overworld_ResetStateAfterWhiteOut(void) static void Overworld_ResetStateAfterWhiteOut(void)
{ {
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD); FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE); FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
@ -575,16 +573,16 @@ const struct MapLayout *GetMapLayout(void)
void ApplyCurrentWarp(void) void ApplyCurrentWarp(void)
{ {
gUnknown_020322DC = gSaveBlock1Ptr->location; gLastUsedWarp = gSaveBlock1Ptr->location;
gSaveBlock1Ptr->location = sWarpDestination; gSaveBlock1Ptr->location = sWarpDestination;
sUnknown_020322EC = sDummyWarpData; gFixedDiveWarp = sDummyWarpData;
sUnknown_020322F4 = sDummyWarpData; gFixedHoleWarp = sDummyWarpData;
} }
void set_warp2_warp3_to_neg_1(void) void set_warp2_warp3_to_neg_1(void)
{ {
sUnknown_020322EC = sDummyWarpData; gFixedDiveWarp = sDummyWarpData;
sUnknown_020322F4 = sDummyWarpData; gFixedHoleWarp = sDummyWarpData;
} }
void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
@ -596,7 +594,7 @@ void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x,
warp->y = y; warp->y = y;
} }
bool32 warp_data_is_not_neg_1(struct WarpData *warp) bool32 IsDummyWarp(struct WarpData *warp)
{ {
if (warp->mapGroup != -1) if (warp->mapGroup != -1)
return FALSE; return FALSE;
@ -617,12 +615,12 @@ struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u
return gMapGroups[mapGroup][mapNum]; return gMapGroups[mapGroup][mapNum];
} }
struct MapHeader const *const warp1_get_mapheader(void) struct MapHeader const *const GetDestinationWarpMapHeader(void)
{ {
return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
} }
void set_current_map_header_from_sav1_save_old_name(void) 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);
@ -636,7 +634,7 @@ void LoadSaveblockMapHeader(void)
gMapHeader.mapLayout = GetMapLayout(); gMapHeader.mapLayout = GetMapLayout();
} }
void update_camera_pos_from_warpid(void) 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)
{ {
@ -655,11 +653,11 @@ void update_camera_pos_from_warpid(void)
} }
} }
void warp_in(void) void WarpIntoMap(void)
{ {
ApplyCurrentWarp(); ApplyCurrentWarp();
set_current_map_header_from_sav1_save_old_name(); LoadCurrentMapData();
update_camera_pos_from_warpid(); SetPlayerCoordsFromWarp();
} }
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)
@ -726,27 +724,27 @@ void sub_8084E14(void)
sWarpDestination = gSaveBlock1Ptr->warp4; sWarpDestination = gSaveBlock1Ptr->warp4;
} }
void sub_8084E2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{ {
SetWarpData(&sUnknown_020322EC, mapGroup, mapNum, warpId, x, y); SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
} }
void warp1_set_to_warp2(void) void SetFixedDiveWarpAsDestination(void)
{ {
sWarpDestination = sUnknown_020322EC; sWarpDestination = gFixedDiveWarp;
} }
void sub_8084E80(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{ {
SetWarpData(&sUnknown_020322F4, mapGroup, mapNum, warpId, x, y); SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y);
} }
void sub_8084EBC(s16 x, s16 y) void SetFixedHoleWarpAsDestination(s16 x, s16 y)
{ {
if (warp_data_is_not_neg_1(&sUnknown_020322F4) == TRUE) if (IsDummyWarp(&gFixedHoleWarp) == TRUE)
sWarpDestination = gUnknown_020322DC; sWarpDestination = gLastUsedWarp;
else else
Overworld_SetWarpDestination(sUnknown_020322F4.mapGroup, sUnknown_020322F4.mapNum, -1, x, y); Overworld_SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y);
} }
void warp1_set_to_sav1w(void) void warp1_set_to_sav1w(void)
@ -787,7 +785,7 @@ const struct MapConnection *GetMapConnection(u8 dir)
return NULL; return NULL;
} }
bool8 sub_8084FF8(u8 dir, u16 x, u16 y) bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
{ {
const struct MapConnection *connection = GetMapConnection(dir); const struct MapConnection *connection = GetMapConnection(dir);
@ -798,21 +796,21 @@ bool8 sub_8084FF8(u8 dir, u16 x, u16 y)
else else
{ {
mapheader_run_script_with_tag_x6(); mapheader_run_script_with_tag_x6();
if (warp_data_is_not_neg_1(&sUnknown_020322EC)) if (IsDummyWarp(&gFixedDiveWarp))
return FALSE; return FALSE;
warp1_set_to_warp2(); SetFixedDiveWarpAsDestination();
} }
return TRUE; return TRUE;
} }
bool8 sub_8085058(u16 x, u16 y) bool8 SetDiveWarpEmerge(u16 x, u16 y)
{ {
return sub_8084FF8(CONNECTION_EMERGE, x, y); return SetDiveWarp(CONNECTION_EMERGE, x, y);
} }
bool8 sub_8085078(u16 x, u16 y) bool8 SetDiveWarpDive(u16 x, u16 y)
{ {
return sub_8084FF8(CONNECTION_DIVE, x, y); return SetDiveWarp(CONNECTION_DIVE, x, y);
} }
void mliX_load_map(u8 mapGroup, u8 mapNum) void mliX_load_map(u8 mapGroup, u8 mapNum)
@ -824,7 +822,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
sub_8085810(); sub_8085810();
ApplyCurrentWarp(); ApplyCurrentWarp();
set_current_map_header_from_sav1_save_old_name(); LoadCurrentMapData();
LoadEventObjTemplatesFromHeader(); LoadEventObjTemplatesFromHeader();
TrySetMapSaveWarpStatus(); TrySetMapSaveWarpStatus();
ClearTempFieldEventData(); ClearTempFieldEventData();
@ -860,7 +858,7 @@ static void mli0_load_map(u32 a1)
bool8 v2; bool8 v2;
bool8 indoors; bool8 indoors;
set_current_map_header_from_sav1_save_old_name(); LoadCurrentMapData();
if (!(sUnknown_020322D8 & 1)) if (!(sUnknown_020322D8 & 1))
{ {
if (gMapHeader.mapLayoutId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
@ -905,84 +903,84 @@ static void mli0_load_map(u32 a1)
} }
} }
void player_avatar_init_params_reset(void) void ResetInitialPlayerAvatarState(void)
{ {
sUnknown_02032300.player_field_1 = 1; gInitialPlayerAvatarState.direction = 1;
sUnknown_02032300.player_field_0 = 1; gInitialPlayerAvatarState.transitionFlags = 1;
} }
void walkrun_find_lowest_active_bit_in_bitfield(void) void StoreInitialPlayerAvatarState(void)
{ {
sUnknown_02032300.player_field_1 = GetPlayerFacingDirection(); gInitialPlayerAvatarState.direction = GetPlayerFacingDirection();
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE)) if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE))
sUnknown_02032300.player_field_0 = 2; gInitialPlayerAvatarState.transitionFlags = 2;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE))
sUnknown_02032300.player_field_0 = 4; gInitialPlayerAvatarState.transitionFlags = 4;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
sUnknown_02032300.player_field_0 = 8; gInitialPlayerAvatarState.transitionFlags = 8;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
sUnknown_02032300.player_field_0 = 16; gInitialPlayerAvatarState.transitionFlags = 16;
else else
sUnknown_02032300.player_field_0 = 1; gInitialPlayerAvatarState.transitionFlags = 1;
} }
static struct UnkPlayerStruct *sub_80852D4(void) static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
{ {
struct UnkPlayerStruct playerStruct; struct InitialPlayerAvatarState playerStruct;
u8 mapType = Overworld_GetMapTypeOfSaveblockLocation(); u8 mapType = Overworld_GetMapTypeOfSaveblockLocation();
u16 v2 = cur_mapdata_block_role_at_screen_center_acc_to_sav1(); u16 metatileBehavior = GetCenterScreenMetatileBehavior();
u8 v4 = sub_808532C(&sUnknown_02032300, v2, mapType); u8 transitionFlags = GetAdjustedInitialTransitionFlags(&gInitialPlayerAvatarState, metatileBehavior, mapType);
playerStruct.player_field_0 = v4; playerStruct.transitionFlags = transitionFlags;
playerStruct.player_field_1 = sub_808538C(&sUnknown_02032300, v4, v2, mapType); playerStruct.direction = GetAdjustedInitialDirection(&gInitialPlayerAvatarState, transitionFlags, metatileBehavior, mapType);
sUnknown_02032300 = playerStruct; gInitialPlayerAvatarState = playerStruct;
return &sUnknown_02032300; return &gInitialPlayerAvatarState;
} }
static u8 sub_808532C(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3) static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 metatileBehavior, u8 mapType)
{ {
if (a3 != 8 && FlagGet(FLAG_SYS_CRUISE_MODE)) if (mapType != MAP_TYPE_INDOOR && FlagGet(FLAG_SYS_CRUISE_MODE))
return 1; return 1;
else if (a3 == 5) else if (mapType == MAP_TYPE_UNDERWATER)
return 16; return 16;
else if (MetatileBehavior_IsSurfableWaterOrUnderwater(a2) == 1) else if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE)
return 8; return 8;
else if (Overworld_IsBikingAllowed() != TRUE) else if (Overworld_IsBikingAllowed() != TRUE)
return 1; return 1;
else if (playerStruct->player_field_0 == 2) else if (playerStruct->transitionFlags == 2)
return 2; return 2;
else if (playerStruct->player_field_0 != 4) else if (playerStruct->transitionFlags != 4)
return 1; return 1;
else else
return 4; return 4;
} }
static u8 sub_808538C(struct UnkPlayerStruct *playerStruct, u8 a2, u16 a3, u8 a4) static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType)
{ {
if (FlagGet(FLAG_SYS_CRUISE_MODE) && a4 == 6) if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6)
return 4; return 4;
else if (MetatileBehavior_IsDeepSouthWarp(a3) == TRUE) else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE)
return 2; return 2;
else if (MetatileBehavior_IsNonAnimDoor(a3) == TRUE || MetatileBehavior_IsDoor(a3) == TRUE) else if (MetatileBehavior_IsNonAnimDoor(metatileBehavior) == TRUE || MetatileBehavior_IsDoor(metatileBehavior) == TRUE)
return 1; return 1;
else if (MetatileBehavior_IsSouthArrowWarp(a3) == TRUE) else if (MetatileBehavior_IsSouthArrowWarp(metatileBehavior) == TRUE)
return 2; return 2;
else if (MetatileBehavior_IsNorthArrowWarp(a3) == TRUE) else if (MetatileBehavior_IsNorthArrowWarp(metatileBehavior) == TRUE)
return 1; return 1;
else if (MetatileBehavior_IsWestArrowWarp(a3) == TRUE) else if (MetatileBehavior_IsWestArrowWarp(metatileBehavior) == TRUE)
return 4; return 4;
else if (MetatileBehavior_IsEastArrowWarp(a3) == TRUE) else if (MetatileBehavior_IsEastArrowWarp(metatileBehavior) == TRUE)
return 3; return 3;
else if ((playerStruct->player_field_0 == 16 && a2 == 8) else if ((playerStruct->transitionFlags == 16 && transitionFlags == 8)
|| (playerStruct->player_field_0 == 8 && a2 == 16)) || (playerStruct->transitionFlags == 8 && transitionFlags == 16))
return playerStruct->player_field_1; return playerStruct->direction;
else if (MetatileBehavior_IsLadder(a3) == TRUE) else if (MetatileBehavior_IsLadder(metatileBehavior) == TRUE)
return playerStruct->player_field_1; return playerStruct->direction;
else else
return 1; return 1;
} }
static u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void) static u16 GetCenterScreenMetatileBehavior(void)
{ {
return MapGridGetMetatileBehaviorAt(gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7); return MapGridGetMetatileBehaviorAt(gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7);
} }
@ -1232,7 +1230,7 @@ void Overworld_ChangeMusicTo(u16 newMusic)
u8 GetMapMusicFadeoutSpeed(void) u8 GetMapMusicFadeoutSpeed(void)
{ {
const struct MapHeader *mapHeader = warp1_get_mapheader(); const struct MapHeader *mapHeader = GetDestinationWarpMapHeader();
if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE) if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE)
return 2; return 2;
else else
@ -1258,7 +1256,7 @@ void music_something(void)
} }
} }
bool8 sub_80859A0(void) bool8 BGMusicStopped(void)
{ {
return IsNotWaitingForBGMStop(); return IsNotWaitingForBGMStop();
} }
@ -1361,7 +1359,7 @@ u8 Overworld_GetMapTypeOfSaveblockLocation(void)
u8 get_map_light_from_warp0(void) u8 get_map_light_from_warp0(void)
{ {
return GetMapTypeByWarpData(&gUnknown_020322DC); return GetMapTypeByWarpData(&gLastUsedWarp);
} }
bool8 is_map_type_1_2_3_5_or_6(u8 mapType) bool8 is_map_type_1_2_3_5_or_6(u8 mapType)
@ -1550,7 +1548,7 @@ void CB2_NewGame(void)
StopMapMusic(); StopMapMusic();
ResetSafariZoneFlag_(); ResetSafariZoneFlag_();
NewGameInitData(); NewGameInitData();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
PlayTimeCounter_Start(); PlayTimeCounter_Start();
ScriptContext1_Init(); ScriptContext1_Init();
ScriptContext2_Disable(); ScriptContext2_Disable();
@ -1572,7 +1570,7 @@ void CB2_WhiteOut(void)
StopMapMusic(); StopMapMusic();
ResetSafariZoneFlag_(); ResetSafariZoneFlag_();
DoWhiteOut(); DoWhiteOut();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
ScriptContext1_Init(); ScriptContext1_Init();
ScriptContext2_Disable(); ScriptContext2_Disable();
gFieldCallback = sub_80AF3C8; gFieldCallback = sub_80AF3C8;
@ -1755,7 +1753,7 @@ void CB2_ContinueSavedGame(void)
{ {
ClearSecretBase2Field_9(); ClearSecretBase2Field_9();
warp1_set_to_sav1w(); warp1_set_to_sav1w();
warp_in(); WarpIntoMap();
sub_80EDB44(); sub_80EDB44();
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
} }
@ -1806,19 +1804,19 @@ static void VBlankCB_Field(void)
TransferTilesetAnimsBuffer(); TransferTilesetAnimsBuffer();
} }
static void sub_80863B0(void) static void InitCurrentFlashLevelScanlineEffect(void)
{ {
u8 val; u8 flashLevel;
if (sub_81A9E6C()) if (sub_81A9E6C())
{ {
door_upload_tiles(); door_upload_tiles();
ScanlineEffect_SetParams(gUnknown_08339DBC); ScanlineEffect_SetParams(sFlashEffectParams);
} }
else if ((val = Overworld_GetFlashLevel())) else if ((flashLevel = Overworld_GetFlashLevel()))
{ {
sub_80B00E8(val); sub_80B00E8(flashLevel);
ScanlineEffect_SetParams(gUnknown_08339DBC); ScanlineEffect_SetParams(sFlashEffectParams);
} }
} }
@ -1850,8 +1848,8 @@ static bool32 map_loading_iteration_3(u8 *state)
(*state)++; (*state)++;
break; break;
case 4: case 4:
sub_80863B0(); InitCurrentFlashLevelScanlineEffect();
map_loading_lcd_reset(); InitOverworldGraphicsRegisters();
sub_8197200(); sub_8197200();
(*state)++; (*state)++;
break; break;
@ -1925,8 +1923,8 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++; (*state)++;
break; break;
case 4: case 4:
sub_80863B0(); InitCurrentFlashLevelScanlineEffect();
map_loading_lcd_reset(); InitOverworldGraphicsRegisters();
sub_8197200(); sub_8197200();
(*state)++; (*state)++;
break; break;
@ -2022,8 +2020,8 @@ static bool32 map_loading_iteration_2_link(u8 *state)
(*state)++; (*state)++;
break; break;
case 3: case 3:
sub_80863B0(); InitCurrentFlashLevelScanlineEffect();
map_loading_lcd_reset(); InitOverworldGraphicsRegisters();
sub_8197200(); sub_8197200();
(*state)++; (*state)++;
break; break;
@ -2102,13 +2100,13 @@ static void sub_80867D8(void)
static void sub_8086860(void) static void sub_8086860(void)
{ {
sub_80863B0(); InitCurrentFlashLevelScanlineEffect();
map_loading_lcd_reset(); InitOverworldGraphicsRegisters();
sub_8197200(); sub_8197200();
mapdata_load_assets_to_gpu_and_full_redraw(); mapdata_load_assets_to_gpu_and_full_redraw();
} }
static void map_loading_lcd_reset(void) static void InitOverworldGraphicsRegisters(void)
{ {
clear_scheduled_bg_copies_to_vram(); clear_scheduled_bg_copies_to_vram();
reset_temp_tile_data_buffers(); reset_temp_tile_data_buffers();
@ -2153,9 +2151,9 @@ static void sub_8086988(u32 a1)
ResetCameraUpdateInfo(); ResetCameraUpdateInfo();
InstallCameraPanAheadCallback(); InstallCameraPanAheadCallback();
if (!a1) if (!a1)
npc_paltag_set_load(0); InitEventObjectPalettes(0);
else else
npc_paltag_set_load(1); InitEventObjectPalettes(1);
FieldEffectActiveListClear(); FieldEffectActiveListClear();
sub_80AAFA4(); sub_80AAFA4();
@ -2178,16 +2176,16 @@ static void sub_80869DC(void)
static void mli4_mapscripts_and_other(void) static void mli4_mapscripts_and_other(void)
{ {
s16 x, y; s16 x, y;
struct UnkPlayerStruct *player; struct InitialPlayerAvatarState *player;
gUnknown_03005DEC = 0; gUnknown_03005DEC = 0;
gUnknown_03005DE8 = 0; gUnknown_03005DE8 = 0;
sub_808D438(); sub_808D438();
sav1_camera_get_focus_coords(&x, &y); sav1_camera_get_focus_coords(&x, &y);
player = sub_80852D4(); player = GetInitialPlayerAvatarState();
InitPlayerAvatar(x, y, player->player_field_1, gSaveBlock2Ptr->playerGender); InitPlayerAvatar(x, y, player->direction, gSaveBlock2Ptr->playerGender);
SetPlayerAvatarTransitionFlags(player->player_field_0); SetPlayerAvatarTransitionFlags(player->transitionFlags);
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
TrySpawnEventObjects(0, 0); TrySpawnEventObjects(0, 0);
mapheader_run_first_tag4_script_list_match(); mapheader_run_first_tag4_script_list_match();
} }
@ -2732,8 +2730,8 @@ static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1)
return 0; return 0;
unkStruct = a1->sub; unkStruct = a1->sub;
unkStruct.x += gUnknown_08339D64[a1->d].x; unkStruct.x += gDirectionToVectors[a1->d].x;
unkStruct.y += gUnknown_08339D64[a1->d].y; unkStruct.y += gDirectionToVectors[a1->d].y;
unkStruct.height = 0; unkStruct.height = 0;
linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y); linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y);
@ -3166,12 +3164,12 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
SetObjectSubpriorityByZCoord(eventObj->previousElevation, sprite, 1); SetObjectSubpriorityByZCoord(eventObj->previousElevation, sprite, 1);
sprite->oam.priority = ZCoordToPriority(eventObj->previousElevation); sprite->oam.priority = ZCoordToPriority(eventObj->previousElevation);
if (!linkPlayerEventObj->mode) if (!linkPlayerEventObj->mode)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(eventObj->range.as_byte)); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(eventObj->range.as_byte));
else else
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(eventObj->range.as_byte)); StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(eventObj->range.as_byte));
UpdateEventObjectSpriteVisibility(sprite, 0); UpdateEventObjectSpriteVisibility(sprite, 0);
if (eventObj->triggerGroundEffectsOnMove) if (eventObj->triggerGroundEffectsOnMove)
{ {
sprite->invisible = ((sprite->data[7] & 4) >> 2); sprite->invisible = ((sprite->data[7] & 4) >> 2);

View File

@ -184,9 +184,33 @@ const struct MenuAction gMailboxMailOptions[] =
static const struct WindowTemplate gUnknown_085DFF24[3] = static const struct WindowTemplate gUnknown_085DFF24[3] =
{ {
{0x00, 0x01, 0x01, 0x09, 0x06, 0x0F, 0x0001}, {
{0x00, 0x01, 0x01, 0x09, 0x08, 0x0F, 0x0001}, .priority = 0,
{0x00, 0x01, 0x01, 0x0A, 0x08, 0x0F, 0x0001} .tilemapLeft = 1,
.tilemapTop = 1,
.width = 9,
.height = 6,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 9,
.height = 8,
.paletteNum = 15,
.baseBlock = 1
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 10,
.height = 8,
.paletteNum = 15,
.baseBlock = 1
}
}; };
static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFromWithdrawYesNoFuncList static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFromWithdrawYesNoFuncList
@ -195,27 +219,85 @@ static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFr
ItemStorage_ResumeInputFromNoToss ItemStorage_ResumeInputFromNoToss
}; };
static const struct ListMenuTemplate gUnknown_085DFF44 = { static const struct ListMenuTemplate gUnknown_085DFF44 =
NULL, {
ItemStorage_MoveCursor, .items = NULL,
fish4_goto_x5_or_x6, .moveCursorFunc = ItemStorage_MoveCursor,
0, 0, .itemPrintFunc = fish4_goto_x5_or_x6,
0, 0, 8, 0, .totalItems = 0,
9, 2, 1, 3, FALSE, 0, FALSE, 7 .maxShowed = 0,
.windowId = 0,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
.upText_Y = 9,
.cursorPal = 2,
.fillValue = 1,
.cursorShadowPal = 3,
.lettersSpacing = FALSE,
.itemVerticalPadding = 0,
.scrollMultiple = FALSE,
.fontId = 7
}; };
static const struct WindowTemplate gUnknown_085DFF5C[5] = static const struct WindowTemplate gUnknown_085DFF5C[5] =
{ {
{0x00, 0x10, 0x01, 0x0D, 0x12, 0x0F, 0x0001}, {
{0x00, 0x01, 0x0D, 0x0D, 0x06, 0x0F, 0x00EB}, .priority = 0,
{0x00, 0x01, 0x08, 0x03, 0x03, 0x0F, 0x0153}, .tilemapLeft = 16,
{0x00, 0x01, 0x01, 0x0D, 0x02, 0x0F, 0x0139}, .tilemapTop = 1,
{0x00, 0x08, 0x09, 0x06, 0x02, 0x0F, 0x015C} .width = 13,
.height = 18,
.paletteNum = 15,
.baseBlock = 0x0001
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 13,
.width = 13,
.height = 6,
.paletteNum = 15,
.baseBlock = 0x00EB
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 8,
.width = 3,
.height = 3,
.paletteNum = 15,
.baseBlock = 0x0153
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 13,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x0139
},
{
.priority = 0,
.tilemapLeft = 8,
.tilemapTop = 9,
.width = 6,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x015C
}
}; };
static const struct WindowTemplate gUnknown_085DFF84 = static const struct WindowTemplate gUnknown_085DFF84 =
{ {
0x00, 0x09, 0x07, 0x05, 0x04, 0x0F, 0x0168 .priority = 0,
.tilemapLeft = 9,
.tilemapTop = 7,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x0168
}; };
static const u8 gUnknown_085DFF8C[] = {0x01, 0x03, 0x02, 0x00}; static const u8 gUnknown_085DFF8C[] = {0x01, 0x03, 0x02, 0x00};
@ -476,7 +558,7 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss)
playerPCItemPageInfo.scrollIndicatorId = 0xFF; playerPCItemPageInfo.scrollIndicatorId = 0xFF;
ItemStorage_SetItemAndMailCount(taskId); ItemStorage_SetItemAndMailCount(taskId);
sub_816BC14(); sub_816BC14();
gpu_pal_allocator_reset__manage_upper_four(); FreeAndReserveObjectSpritePalettes();
LoadListMenuArrowsGfx(); LoadListMenuArrowsGfx();
sub_8122344(gUnknown_0203BCC4->spriteIds, 7); sub_8122344(gUnknown_0203BCC4->spriteIds, 7);
sub_8197434(0,0); sub_8197434(0,0);

View File

@ -294,21 +294,118 @@ static const struct Pokeblock sFavoritePokeblocksTable[] =
static const struct WindowTemplate sWindowTemplatesForPokeblockMenu[] = static const struct WindowTemplate sWindowTemplatesForPokeblockMenu[] =
{ {
{0, 2, 1, 9, 2, 0xF, 0x1E}, {
{0, 0xF, 1, 0xE, 0x12, 0xF, 0x30}, .priority = 0,
{0, 2, 0xD, 5, 2, 0xF, 0x12C}, .tilemapLeft = 2,
{0, 2, 0xF, 5, 2, 0xF, 0x136}, .tilemapTop = 1,
{0, 2, 0x11, 5, 2, 0xF, 0x140}, .width = 9,
{0, 8, 0xD, 5, 2, 0xF, 0x14A}, .height = 2,
{0, 8, 0xF, 5, 2, 0xF, 0x154}, .paletteNum = 15,
{0, 0xB, 0x11, 2, 2, 0xF, 0x15E}, .baseBlock = 0x1E
{1, 7, 5, 6, 6, 0xF, 0x162}, },
{1, 7, 7, 6, 4, 0xF, 0x186}, {
{1, 2, 0xF, 0x1B, 4, 0xF, 0x19E}, .priority = 0,
.tilemapLeft = 15,
.tilemapTop = 1,
.width = 14,
.height = 18,
.paletteNum = 15,
.baseBlock = 0x30
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 13,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x12C
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x136
},
{
.priority = 0,
.tilemapLeft = 2,
.tilemapTop = 17,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x140
},
{
.priority = 0,
.tilemapLeft = 8,
.tilemapTop = 13,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x14A
},
{
.priority = 0,
.tilemapLeft = 8,
.tilemapTop = 15,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x154
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 17,
.width = 2,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x15E
},
{
.priority = 1,
.tilemapLeft = 7,
.tilemapTop = 5,
.width = 6,
.height = 6,
.paletteNum = 15,
.baseBlock = 0x162
},
{
.priority = 1,
.tilemapLeft = 7,
.tilemapTop = 7,
.width = 6,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x186
},
{
.priority = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 27,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x19E
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate sTossPkblockWindowTemplate = {1, 0x15, 9, 5, 4, 0xF, 0x20A}; static const struct WindowTemplate sTossPkblockWindowTemplate =
{
.priority = 1,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x20A
};
static const struct ListMenuTemplate sPokeblockListMenuTemplate = static const struct ListMenuTemplate sPokeblockListMenuTemplate =
{ {

View File

@ -172,7 +172,7 @@ static void sub_81C2074(u16 a, s16 b);
static void sub_81C20F0(u8 taskId); static void sub_81C20F0(u8 taskId);
static void sub_81C2194(u16 *a, u16 b, u8 c); static void sub_81C2194(u16 *a, u16 b, u8 c);
static void sub_81C2228(struct Pokemon* mon); static void sub_81C2228(struct Pokemon* mon);
static void sub_81C22CC(struct Pokemon* mon); static void DrawExperienceProgressBar(struct Pokemon* mon);
static void sub_81C240C(u16 a); static void sub_81C240C(u16 a);
static void sub_81C2524(void); static void sub_81C2524(void);
static void sub_81C2554(void); static void sub_81C2554(void);
@ -313,48 +313,304 @@ static const struct UnkStruct_61CC04 gUnknown_0861CC10 =
static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5}; static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
static const struct WindowTemplate gUnknown_0861CC24[] = static const struct WindowTemplate gUnknown_0861CC24[] =
{ {
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 }, {
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 }, .priority = 0,
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d }, .tilemapLeft = 0,
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 }, .tilemapTop = 0,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 }, .width = 11,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 }, .height = 2,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 }, .paletteNum = 6,
{ 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 }, .baseBlock = 1,
{ 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 }, },
{ 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad }, {
{ 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 }, .priority = 0,
{ 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 }, .tilemapLeft = 0,
{ 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 }, .tilemapTop = 0,
{ 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f }, .width = 11,
{ 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b }, .height = 2,
{ 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f }, .paletteNum = 6,
{ 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 }, .baseBlock = 23,
{ 0x00, 0x01, 0x02, 0x04, 0x02, 0x07, 0x0183 }, },
{ 0x00, 0x01, 0x0c, 0x09, 0x02, 0x06, 0x018b }, {
{ 0x00, 0x01, 0x0e, 0x09, 0x04, 0x06, 0x019d }, .priority = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 11,
.height = 2,
.paletteNum = 6,
.baseBlock = 45,
},
{
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 11,
.height = 2,
.paletteNum = 6,
.baseBlock = 67,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 0,
.width = 8,
.height = 2,
.paletteNum = 7,
.baseBlock = 89,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 0,
.width = 8,
.height = 2,
.paletteNum = 7,
.baseBlock = 105,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 0,
.width = 8,
.height = 2,
.paletteNum = 7,
.baseBlock = 121,
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 4,
.width = 0,
.height = 2,
.paletteNum = 6,
.baseBlock = 137,
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 4,
.width = 18,
.height = 2,
.paletteNum = 6,
.baseBlock = 137,
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 6,
.width = 18,
.height = 2,
.paletteNum = 6,
.baseBlock = 173,
},
{
.priority = 0,
.tilemapLeft = 10,
.tilemapTop = 7,
.width = 6,
.height = 6,
.paletteNum = 6,
.baseBlock = 209,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 7,
.width = 5,
.height = 6,
.paletteNum = 6,
.baseBlock = 245,
},
{
.priority = 0,
.tilemapLeft = 10,
.tilemapTop = 14,
.width = 11,
.height = 4,
.paletteNum = 6,
.baseBlock = 275,
},
{
.priority = 0,
.tilemapLeft = 0,
.tilemapTop = 18,
.width = 6,
.height = 2,
.paletteNum = 6,
.baseBlock = 319,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 15,
.width = 9,
.height = 4,
.paletteNum = 6,
.baseBlock = 331,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 15,
.width = 5,
.height = 4,
.paletteNum = 6,
.baseBlock = 367,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 4,
.width = 0,
.height = 2,
.paletteNum = 6,
.baseBlock = 387,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 2,
.width = 4,
.height = 2,
.paletteNum = 7,
.baseBlock = 387,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 12,
.width = 9,
.height = 2,
.paletteNum = 6,
.baseBlock = 395,
},
{
.priority = 0,
.tilemapLeft = 1,
.tilemapTop = 14,
.width = 9,
.height = 4,
.paletteNum = 6,
.baseBlock = 413,
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gUnknown_0861CCCC[] = static const struct WindowTemplate gUnknown_0861CCCC[] =
{ {
{ 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 }, {
{ 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 }, .priority = 0,
{ 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 }, .tilemapLeft = 11,
{ 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d }, .tilemapTop = 4,
.width = 11,
.height = 2,
.paletteNum = 6,
.baseBlock = 449,
},
{
.priority = 0,
.tilemapLeft = 22,
.tilemapTop = 4,
.width = 7,
.height = 2,
.paletteNum = 6,
.baseBlock = 471,
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 9,
.width = 18,
.height = 4,
.paletteNum = 6,
.baseBlock = 485,
},
{
.priority = 0,
.tilemapLeft = 11,
.tilemapTop = 14,
.width = 18,
.height = 6,
.paletteNum = 6,
.baseBlock = 557,
},
}; };
static const struct WindowTemplate gUnknown_0861CCEC[] = static const struct WindowTemplate gUnknown_0861CCEC[] =
{ {
{ 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 }, {
{ 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 }, .priority = 0,
{ 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 }, .tilemapLeft = 10,
{ 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d }, .tilemapTop = 4,
{ 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f }, .width = 10,
.height = 2,
.paletteNum = 6,
.baseBlock = 449,
},
{
.priority = 0,
.tilemapLeft = 20,
.tilemapTop = 4,
.width = 10,
.height = 2,
.paletteNum = 6,
.baseBlock = 469,
},
{
.priority = 0,
.tilemapLeft = 16,
.tilemapTop = 7,
.width = 6,
.height = 6,
.paletteNum = 6,
.baseBlock = 489,
},
{
.priority = 0,
.tilemapLeft = 27,
.tilemapTop = 7,
.width = 3,
.height = 6,
.paletteNum = 6,
.baseBlock = 525,
},
{
.priority = 0,
.tilemapLeft = 24,
.tilemapTop = 14,
.width = 6,
.height = 4,
.paletteNum = 6,
.baseBlock = 543,
},
}; };
static const struct WindowTemplate gUnknown_0861CD14[] = static const struct WindowTemplate gUnknown_0861CD14[] =
{ {
{ 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 }, {
{ 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b }, .priority = 0,
{ 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 }, .tilemapLeft = 15,
.tilemapTop = 4,
.width = 9,
.height = 10,
.paletteNum = 6,
.baseBlock = 449,
},
{
.priority = 0,
.tilemapLeft = 24,
.tilemapTop = 4,
.width = 6,
.height = 10,
.paletteNum = 8,
.baseBlock = 539,
},
{
.priority = 0,
.tilemapLeft = 10,
.tilemapTop = 15,
.width = 20,
.height = 4,
.paletteNum = 6,
.baseBlock = 599,
},
}; };
static const u8 sTextColors_861CD2C[][3] = static const u8 sTextColors_861CD2C[][3] =
{ {
@ -661,7 +917,7 @@ static const struct SpriteTemplate gUnknown_0861D084 =
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
static const struct OamData gOamData_861D09C = static const struct OamData sOamData_StatusCondition =
{ {
.y = 0, .y = 0,
.affineMode = 0, .affineMode = 0,
@ -677,42 +933,42 @@ static const struct OamData gOamData_861D09C =
.paletteNum = 0, .paletteNum = 0,
.affineParam = 0, .affineParam = 0,
}; };
static const union AnimCmd gSpriteAnim_861D0A4[] = { static const union AnimCmd sSpriteAnim_StatusPoison[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE), ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0AC[] = { static const union AnimCmd sSpriteAnim_StatusParalyzed[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE), ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0B4[] = { static const union AnimCmd sSpriteAnim_StatusSleep[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE), ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0BC[] = { static const union AnimCmd sSpriteAnim_StatusFrozen[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE), ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0C4[] = { static const union AnimCmd sSpriteAnim_StatusBurn[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE), ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0CC[] = { static const union AnimCmd sSpriteAnim_StatusPokerus[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE), ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0D4[] = { static const union AnimCmd sSpriteAnim_StatusFaint[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE), ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd *const gSpriteAnimTable_861D0DC[] = { static const union AnimCmd *const sSpriteAnimTable_StatusCondition[] = {
gSpriteAnim_861D0A4, sSpriteAnim_StatusPoison,
gSpriteAnim_861D0AC, sSpriteAnim_StatusParalyzed,
gSpriteAnim_861D0B4, sSpriteAnim_StatusSleep,
gSpriteAnim_861D0BC, sSpriteAnim_StatusFrozen,
gSpriteAnim_861D0C4, sSpriteAnim_StatusBurn,
gSpriteAnim_861D0CC, sSpriteAnim_StatusPokerus,
gSpriteAnim_861D0D4, sSpriteAnim_StatusFaint,
}; };
static const struct CompressedSpriteSheet gUnknown_0861D0F8 = static const struct CompressedSpriteSheet gUnknown_0861D0F8 =
{ {
@ -725,12 +981,12 @@ static const struct CompressedSpritePalette gUnknown_0861D100 =
.data = gStatusPal_Icons, .data = gStatusPal_Icons,
.tag = 30001 .tag = 30001
}; };
static const struct SpriteTemplate gUnknown_0861D108 = static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
{ {
.tileTag = 30001, .tileTag = 30001,
.paletteTag = 30001, .paletteTag = 30001,
.oam = &gOamData_861D09C, .oam = &sOamData_StatusCondition,
.anims = gSpriteAnimTable_861D0DC, .anims = sSpriteAnimTable_StatusCondition,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
@ -1521,7 +1777,7 @@ static void sub_81C0D44(u8 taskId)
static void sub_81C0E24(void) static void sub_81C0E24(void)
{ {
if (pssData->currPageIndex == 1) if (pssData->currPageIndex == 1)
sub_81C22CC(&pssData->currentMon); DrawExperienceProgressBar(&pssData->currentMon);
} }
static void sub_81C0E48(u8 taskId) static void sub_81C0E48(u8 taskId)
@ -2270,37 +2526,40 @@ static void sub_81C228C(bool8 isMonShiny)
schedule_bg_copy_tilemap_to_vram(3); schedule_bg_copy_tilemap_to_vram(3);
} }
static void sub_81C22CC(struct Pokemon *unused) static void DrawExperienceProgressBar(struct Pokemon *unused)
{ {
s64 r6r7; s64 numExpProgressBarTicks;
struct PokeSummary *summary = &pssData->summary; struct PokeSummary *summary = &pssData->summary;
u16 *r9; u16 *r9;
u8 i; u8 i;
if (summary->level < MAX_MON_LEVEL) if (summary->level < MAX_MON_LEVEL)
{ {
u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; u32 expBetweenLevels = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; u32 expSinceLastLevel = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
r6r7 = r4 * 64 / r1; // Calculate the number of 1-pixel "ticks" to illuminate in the experience progress bar.
if (r6r7 == 0 && r4 != 0) // There are 8 tiles that make up the bar, and each tile has 8 "ticks". Hence, the numerator
r6r7 = 1; // is multiplied by 64.
numExpProgressBarTicks = expSinceLastLevel * 64 / expBetweenLevels;
if (numExpProgressBarTicks == 0 && expSinceLastLevel != 0)
numExpProgressBarTicks = 1;
} }
else else
{ {
r6r7 = 0; numExpProgressBarTicks = 0;
} }
r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255]; r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255];
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (r6r7 > 7) if (numExpProgressBarTicks > 7)
r9[i] = 0x206A; r9[i] = 0x206A;
else else
r9[i] = 0x2062 + (r6r7 % 8); r9[i] = 0x2062 + (numExpProgressBarTicks % 8);
r6r7 -= 8; numExpProgressBarTicks -= 8;
if (r6r7 < 0) if (numExpProgressBarTicks < 0)
r6r7 = 0; numExpProgressBarTicks = 0;
} }
if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0])
@ -3735,7 +3994,7 @@ static void CreateSetStatusSprite(void)
if (*spriteId == 0xFF) if (*spriteId == 0xFF)
{ {
*spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0); *spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
} }
anim = sub_81B205C(&pssData->currentMon); anim = sub_81B205C(&pssData->currentMon);

View File

@ -1637,7 +1637,7 @@ void sub_8014290(u16 arg0, u16 x, u16 y)
VarSet(VAR_0x4087, arg0); VarSet(VAR_0x4087, arg0);
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y); Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
saved_warp2_set_2(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y); saved_warp2_set_2(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
warp_in(); WarpIntoMap();
} }
void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4) void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
@ -1648,7 +1648,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
gUnknown_03005DB4 = GetMultiplayerId(); gUnknown_03005DB4 = GetMultiplayerId();
sub_809D2BC(); sub_809D2BC();
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y);
warp_in(); WarpIntoMap();
} }
void sub_8014384(void) void sub_8014384(void)

View File

@ -35,7 +35,7 @@ extern void CB2_ReturnToFieldContinueScriptPlayMapMusic(void);
extern void CB2_LoadMap(void); extern void CB2_LoadMap(void);
extern void sub_80AF6F0(void); extern void sub_80AF6F0(void);
extern void ScriptContext1_Stop(void); extern void ScriptContext1_Stop(void);
extern void warp_in(void); extern void WarpIntoMap(void);
extern void GetXYCoordsOneStepInFrontOfPlayer(s16* x, s16* y); extern void GetXYCoordsOneStepInFrontOfPlayer(s16* x, s16* y);
extern void PlayerGetDestCoords(s16* x, s16* y); extern void PlayerGetDestCoords(s16* x, s16* y);
@ -117,7 +117,7 @@ void CB2_EndSafariBattle(void)
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS) else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
{ {
ScriptContext2_RunNewScript(EventScript_2A4B4C); ScriptContext2_RunNewScript(EventScript_2A4B4C);
warp_in(); WarpIntoMap();
gFieldCallback = sub_80AF6F0; gFieldCallback = sub_80AF6F0;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
} }

View File

@ -750,7 +750,7 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF734(); sub_80AF734();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -764,7 +764,7 @@ bool8 ScrCmd_warpsilent(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sp13E_warp_to_last_warp(); sp13E_warp_to_last_warp();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -778,7 +778,7 @@ bool8 ScrCmd_warpdoor(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF7D0(); sub_80AF7D0();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -791,11 +791,11 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
if (mapGroup == 0xFF && mapNum == 0xFF) if (mapGroup == 0xFF && mapNum == 0xFF)
sub_8084EBC(x - 7, y - 7); SetFixedHoleWarpAsDestination(x - 7, y - 7);
else else
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
sp13F_fall_to_last_warp(); sp13F_fall_to_last_warp();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -809,7 +809,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF848(); sub_80AF848();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -823,7 +823,7 @@ bool8 ScrCmd_warpD7(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF87C(); sub_80AF87C();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -859,7 +859,7 @@ bool8 ScrCmd_setdivewarp(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx));
sub_8084E2C(mapGroup, mapNum, warpId, x, y); SetFixedDiveWarp(mapGroup, mapNum, warpId, x, y);
return FALSE; return FALSE;
} }
@ -871,7 +871,7 @@ bool8 ScrCmd_setholewarp(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx));
sub_8084E80(mapGroup, mapNum, warpId, x, y); SetFixedHoleWarp(mapGroup, mapNum, warpId, x, y);
return FALSE; return FALSE;
} }
@ -2240,7 +2240,7 @@ bool8 ScrCmd_warpD1(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_808D074(GetPlayerFacingDirection()); sub_808D074(GetPlayerFacingDirection());
sub_80B0244(); sub_80B0244();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }
@ -2293,6 +2293,6 @@ bool8 ScrCmd_warpE0(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF79C(); sub_80AF79C();
player_avatar_init_params_reset(); ResetInitialPlayerAvatarState();
return TRUE; return TRUE;
} }

View File

@ -388,7 +388,7 @@ void sub_80E8FD0(u8 taskId)
gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_10 ++; gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_10 ++;
} }
sub_80E8F9C(); sub_80E8F9C();
warp_in(); WarpIntoMap();
gFieldCallback = sub_80AF168; gFieldCallback = sub_80AF168;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId); DestroyTask(taskId);
@ -446,7 +446,7 @@ void sub_80E916C(u8 taskId)
{ {
idx = sCurSecretBaseId / 10 * 4; idx = sCurSecretBaseId / 10 * 4;
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]); Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]);
warp_in(); WarpIntoMap();
gFieldCallback = sub_80E9108; gFieldCallback = sub_80E9108;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId); DestroyTask(taskId);
@ -644,7 +644,7 @@ void sub_80E96A4(u8 taskId)
break; break;
case 2: case 2:
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e); copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e);
warp_in(); WarpIntoMap();
gFieldCallback = mapldr_default; gFieldCallback = mapldr_default;
SetMainCallback2(CB2_LoadMap); SetMainCallback2(CB2_LoadMap);
ScriptContext2_Disable(); ScriptContext2_Disable();

View File

@ -59,13 +59,38 @@ static void SpriteCB_PMIndicator(struct Sprite *sprite);
static const u8 sUnknown_085B1F58[] = INCBIN_U8("graphics/wallclock/graphics_85b1f58.4bpp.lz"); static const u8 sUnknown_085B1F58[] = INCBIN_U8("graphics/wallclock/graphics_85b1f58.4bpp.lz");
static const u16 sUnknown_085B21D4[] = INCBIN_U16("graphics/wallclock/palette_85b21d4.gbapal"); static const u16 sUnknown_085B21D4[] = INCBIN_U16("graphics/wallclock/palette_85b21d4.gbapal");
static const struct WindowTemplate gUnknown_085B21DC[] = {
{ 0x00, 0x03, 0x11, 0x18, 0x02, 0x0e, 0x200 }, static const struct WindowTemplate gUnknown_085B21DC[] =
{ 0x02, 0x18, 0x10, 0x06, 0x02, 0x0c, 0x230 }, {
{
.priority = 0,
.tilemapLeft = 3,
.tilemapTop = 17,
.width = 24,
.height = 2,
.paletteNum = 14,
.baseBlock = 512
},
{
.priority = 2,
.tilemapLeft = 24,
.tilemapTop = 16,
.width = 6,
.height = 2,
.paletteNum = 12,
.baseBlock = 560
},
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gUnknown_085B21F4 = { static const struct WindowTemplate gUnknown_085B21F4 =
0x00, 0x18, 0x09, 0x05, 0x04, 0x0e, 0x23c {
.priority = 0,
.tilemapLeft = 24,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 14,
.baseBlock = 572
}; };
static const struct BgTemplate gUnknown_085B21FC[] = { static const struct BgTemplate gUnknown_085B21FC[] = {
{ {
@ -115,23 +140,25 @@ static const union AnimCmd *const gUnknown_085B2248[] = {
static const union AnimCmd *const gUnknown_085B224C[] = { static const union AnimCmd *const gUnknown_085B224C[] = {
Unknown_085B2240 Unknown_085B2240
}; };
static const struct SpriteTemplate gUnknown_085B2250 = { static const struct SpriteTemplate gUnknown_085B2250 =
TAG_GFX_WALL_CLOCK_HAND, {
TAG_PAL_WALL_CLOCK_HAND, .tileTag = TAG_GFX_WALL_CLOCK_HAND,
&Unknown_085B2230, .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
gUnknown_085B2248, .oam = &Unknown_085B2230,
NULL, .anims = gUnknown_085B2248,
gDummySpriteAffineAnimTable, .images = NULL,
SpriteCB_MinuteHand .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_MinuteHand
}; };
static const struct SpriteTemplate gUnknown_085B2268 = { static const struct SpriteTemplate gUnknown_085B2268 =
TAG_GFX_WALL_CLOCK_HAND, {
TAG_PAL_WALL_CLOCK_HAND, .tileTag = TAG_GFX_WALL_CLOCK_HAND,
&Unknown_085B2230, .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
gUnknown_085B224C, .oam = &Unknown_085B2230,
NULL, .anims = gUnknown_085B224C,
gDummySpriteAffineAnimTable, .images = NULL,
SpriteCB_HourHand .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_HourHand
}; };
static const struct OamData Unknown_085B2280 = { static const struct OamData Unknown_085B2280 = {
.y = 0xa0, .y = 0xa0,
@ -152,23 +179,25 @@ static const union AnimCmd *const gUnknown_085B2298[] = {
static const union AnimCmd *const gUnknown_085B229C[] = { static const union AnimCmd *const gUnknown_085B229C[] = {
Unknown_085B2290 Unknown_085B2290
}; };
static const struct SpriteTemplate gUnknown_085B22A0 = { static const struct SpriteTemplate gUnknown_085B22A0 =
TAG_GFX_WALL_CLOCK_HAND, {
TAG_PAL_WALL_CLOCK_HAND, .tileTag = TAG_GFX_WALL_CLOCK_HAND,
&Unknown_085B2280, .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
gUnknown_085B2298, .oam = &Unknown_085B2280,
NULL, .anims = gUnknown_085B2298,
gDummySpriteAffineAnimTable, .images = NULL,
SpriteCB_AMIndicator .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_AMIndicator
}; };
static const struct SpriteTemplate gUnknown_085B22B8 = { static const struct SpriteTemplate gUnknown_085B22B8 =
TAG_GFX_WALL_CLOCK_HAND, {
TAG_PAL_WALL_CLOCK_HAND, .tileTag = TAG_GFX_WALL_CLOCK_HAND,
&Unknown_085B2280, .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
gUnknown_085B229C, .oam = &Unknown_085B2280,
NULL, .anims = gUnknown_085B229C,
gDummySpriteAffineAnimTable, .images = NULL,
SpriteCB_PMIndicator .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_PMIndicator
}; };
static const s8 sClockHandCoords[][2] = { static const s8 sClockHandCoords[][2] = {
{ 0x00, -0x18}, { 0x00, -0x18},

View File

@ -226,15 +226,7 @@ gUnknown_020375A4: @ 20375A4
gUnknown_020375AC: @ 20375AC gUnknown_020375AC: @ 20375AC
.space 0x8 .space 0x8
gUnknown_020375B4: @ 20375B4 .include "src/event_object_movement.o"
.space 0x2
gUnknown_020375B6: @ 20375B6
.space 0x2
gLockedAnimEventObjects: @ 20375B8
.space 0x4
.include "src/field_message_box.o" .include "src/field_message_box.o"
.align 2 .align 2