diff --git a/asm/fieldmap.s b/asm/fieldmap.s deleted file mode 100644 index 21aea8ad7..000000000 --- a/asm/fieldmap.s +++ /dev/null @@ -1,2285 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mapconnection_get_mapheader -mapconnection_get_mapheader: @ 8087D44 - push {lr} - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0x9] - adds r0, r2, 0 - bl Overworld_GetMapHeaderByGroupAndId - pop {r1} - bx r1 - thumb_func_end mapconnection_get_mapheader - - thumb_func_start not_trainer_hill_battle_pyramid -not_trainer_hill_battle_pyramid: @ 8087D54 - push {r4,lr} - ldr r4, =gMapHeader - adds r0, r4, 0 - bl mapheader_copy_mapdata_with_padding - ldr r0, [r4, 0x4] - bl sub_80E8EE0 - bl mapheader_run_script_with_tag_x1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end not_trainer_hill_battle_pyramid - - thumb_func_start sub_8087D74 -sub_8087D74: @ 8087D74 - push {r4,lr} - ldr r4, =gMapHeader - adds r0, r4, 0 - bl mapheader_copy_mapdata_with_padding - movs r0, 0 - bl sub_80E9238 - ldr r0, [r4, 0x4] - bl sub_80E8EE0 - bl mapdata_from_sav2 - bl mapheader_run_script_with_tag_x1 - ldr r1, =gUnknown_03005DC0 - ldr r0, [r1] - ldr r1, [r1, 0x4] - bl UpdateTVScreensOnMap - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8087D74 - - thumb_func_start battle_pyramid_map_load_related -battle_pyramid_map_load_related: @ 8087DAC - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x03ff03ff - str r0, [sp] - ldr r5, =gUnknown_02032318 - ldr r2, =0x01001400 - mov r0, sp - adds r1, r5, 0 - bl CpuFastSet - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81AA078 - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end battle_pyramid_map_load_related - - thumb_func_start trainer_hill_map_load_related -trainer_hill_map_load_related: @ 8087DE4 - push {r4,lr} - sub sp, 0x4 - ldr r0, =0x03ff03ff - str r0, [sp] - ldr r4, =gUnknown_02032318 - ldr r2, =0x01001400 - mov r0, sp - adds r1, r4, 0 - bl CpuFastSet - adds r0, r4, 0 - bl sub_81D5FB4 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end trainer_hill_map_load_related - - thumb_func_start mapheader_copy_mapdata_with_padding -@ void mapheader_copy_mapdata_with_padding(struct mapheader *mapHeader) -mapheader_copy_mapdata_with_padding: @ 8087E14 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldr r5, [r6] - ldr r0, =0x03ff03ff - str r0, [sp] - ldr r4, =gUnknown_02032318 - ldr r2, =0x01001400 - mov r0, sp - adds r1, r4, 0 - bl CpuFastSet - ldr r2, =gUnknown_03005DC0 - str r4, [r2, 0x8] - ldr r1, [r5] - adds r1, 0xF - str r1, [r2] - ldr r0, [r5, 0x4] - adds r0, 0xE - str r0, [r2, 0x4] - muls r1, r0 - movs r0, 0xA0 - lsls r0, 6 - cmp r1, r0 - bgt _08087E56 - ldr r0, [r5, 0xC] - ldrh r1, [r5] - ldrh r2, [r5, 0x4] - bl map_copy_with_padding - adds r0, r6, 0 - bl mapheader_copy_mapdata_of_adjacent_maps -_08087E56: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end mapheader_copy_mapdata_with_padding - - thumb_func_start map_copy_with_padding -@ int map_copy_with_padding(void *src) -map_copy_with_padding: @ 8087E70 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - lsls r2, 16 - lsrs r2, 16 - ldr r0, =gUnknown_03005DC0 - ldr r4, [r0, 0x8] - ldr r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, 0xE - adds r4, r0 - cmp r2, 0 - beq _08087EB8 - mov r0, r8 - lsls r6, r0, 1 - adds r5, r2, 0 - movs r0, 0x1E - adds r0, r6 - mov r9, r0 -_08087EA4: - adds r0, r7, 0 - adds r1, r4, 0 - mov r2, r8 - bl CpuSet - add r4, r9 - adds r7, r6 - subs r5, 0x1 - cmp r5, 0 - bne _08087EA4 -_08087EB8: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end map_copy_with_padding - - thumb_func_start mapheader_copy_mapdata_of_adjacent_maps -@ void mapheader_copy_mapdata_of_adjacent_maps(struct mapheader *mapHeader) -mapheader_copy_mapdata_of_adjacent_maps: @ 8087EC8 - push {r4-r7,lr} - adds r6, r0, 0 - ldr r0, [r6, 0xC] - cmp r0, 0 - beq _08087F4C - ldr r1, [r0] - ldr r5, [r0, 0x4] - ldr r2, =gUnknown_02037340 - ldr r0, =gUnknown_08486EF8 - ldr r0, [r0] - str r0, [r2] - cmp r1, 0 - ble _08087F4C - adds r4, r2, 0 - adds r7, r1, 0 -_08087EE6: - adds r0, r5, 0 - bl mapconnection_get_mapheader - adds r1, r0, 0 - ldr r2, [r5, 0x4] - ldrb r0, [r5] - cmp r0, 0x2 - beq _08087F1E - cmp r0, 0x2 - bgt _08087F08 - cmp r0, 0x1 - beq _08087F12 - b _08087F44 - .pool -_08087F08: - cmp r0, 0x3 - beq _08087F2A - cmp r0, 0x4 - beq _08087F36 - b _08087F44 -_08087F12: - adds r0, r6, 0 - bl sub_8087FB8 - ldrb r0, [r4] - movs r1, 0x1 - b _08087F40 -_08087F1E: - adds r0, r6, 0 - bl sub_8088020 - ldrb r0, [r4] - movs r1, 0x2 - b _08087F40 -_08087F2A: - adds r0, r6, 0 - bl sub_8088080 - ldrb r0, [r4] - movs r1, 0x4 - b _08087F40 -_08087F36: - adds r0, r6, 0 - bl sub_80880E0 - ldrb r0, [r4] - movs r1, 0x8 -_08087F40: - orrs r0, r1 - strb r0, [r4] -_08087F44: - subs r7, 0x1 - adds r5, 0xC - cmp r7, 0 - bne _08087EE6 -_08087F4C: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end mapheader_copy_mapdata_of_adjacent_maps - - thumb_func_start sub_8087F54 -sub_8087F54: @ 8087F54 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, [sp, 0x18] - ldr r4, [r2] - ldr r7, [r4] - adds r2, r7, 0 - muls r2, r5 - adds r2, r3 - lsls r2, 1 - ldr r3, [r4, 0xC] - adds r6, r3, r2 - ldr r3, =gUnknown_03005DC0 - ldr r2, [r3] - muls r1, r2 - adds r1, r0 - lsls r1, 1 - ldr r0, [r3, 0x8] - adds r5, r0, r1 - ldr r0, [sp, 0x20] - cmp r0, 0 - ble _08087FA6 - adds r4, r0, 0 - ldr r3, =0x001fffff - mov r8, r3 -_08087F86: - adds r0, r6, 0 - adds r1, r5, 0 - ldr r2, [sp, 0x1C] - mov r3, r8 - ands r2, r3 - bl CpuSet - ldr r0, =gUnknown_03005DC0 - ldr r0, [r0] - lsls r0, 1 - adds r5, r0 - lsls r0, r7, 1 - adds r6, r0 - subs r4, 0x1 - cmp r4, 0 - bne _08087F86 -_08087FA6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8087F54 - - thumb_func_start sub_8087FB8 -sub_8087FB8: @ 8087FB8 - push {r4-r7,lr} - sub sp, 0xC - adds r3, r0, 0 - adds r5, r1, 0 - cmp r5, 0 - beq _08088012 - ldr r0, [r5] - ldr r4, [r0] - adds r2, 0x7 - ldr r0, [r3] - ldr r0, [r0, 0x4] - adds r7, r0, 0x7 - cmp r2, 0 - bge _08087FEC - negs r6, r2 - adds r2, r4 - ldr r0, =gUnknown_03005DC0 - ldr r3, [r0] - cmp r2, r3 - bge _08087FE2 - adds r3, r2, 0 -_08087FE2: - movs r2, 0 - b _08087FFC - .pool -_08087FEC: - movs r6, 0 - adds r0, r2, r4 - ldr r1, =gUnknown_03005DC0 - ldr r1, [r1] - subs r3, r1, r2 - cmp r0, r1 - bge _08087FFC - adds r3, r4, 0 -_08087FFC: - movs r0, 0 - str r0, [sp] - str r3, [sp, 0x4] - movs r0, 0x7 - str r0, [sp, 0x8] - adds r0, r2, 0 - adds r1, r7, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8087F54 -_08088012: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8087FB8 - - thumb_func_start sub_8088020 -sub_8088020: @ 8088020 - push {r4-r7,lr} - sub sp, 0xC - adds r5, r1, 0 - cmp r5, 0 - beq _08088074 - ldr r0, [r5] - ldr r4, [r0] - ldr r0, [r0, 0x4] - adds r2, 0x7 - subs r7, r0, 0x7 - cmp r2, 0 - bge _08088050 - negs r6, r2 - adds r2, r4 - ldr r0, =gUnknown_03005DC0 - ldr r3, [r0] - cmp r2, r3 - bge _08088046 - adds r3, r2, 0 -_08088046: - movs r2, 0 - b _08088060 - .pool -_08088050: - movs r6, 0 - adds r0, r2, r4 - ldr r1, =gUnknown_03005DC0 - ldr r1, [r1] - subs r3, r1, r2 - cmp r0, r1 - bge _08088060 - adds r3, r4, 0 -_08088060: - str r7, [sp] - str r3, [sp, 0x4] - movs r0, 0x7 - str r0, [sp, 0x8] - adds r0, r2, 0 - movs r1, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8087F54 -_08088074: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8088020 - - thumb_func_start sub_8088080 -sub_8088080: @ 8088080 - push {r4-r7,lr} - sub sp, 0xC - adds r5, r1, 0 - cmp r5, 0 - beq _080880D4 - ldr r0, [r5] - ldr r1, [r0] - ldr r4, [r0, 0x4] - adds r2, 0x7 - subs r7, r1, 0x7 - cmp r2, 0 - bge _080880B0 - negs r6, r2 - adds r1, r2, r4 - ldr r0, =gUnknown_03005DC0 - ldr r3, [r0, 0x4] - cmp r1, r3 - bge _080880A6 - adds r3, r1, 0 -_080880A6: - movs r2, 0 - b _080880C0 - .pool -_080880B0: - movs r6, 0 - adds r0, r2, r4 - ldr r1, =gUnknown_03005DC0 - ldr r1, [r1, 0x4] - subs r3, r1, r2 - cmp r0, r1 - bge _080880C0 - adds r3, r4, 0 -_080880C0: - str r6, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - str r3, [sp, 0x8] - movs r0, 0 - adds r1, r2, 0 - adds r2, r5, 0 - adds r3, r7, 0 - bl sub_8087F54 -_080880D4: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8088080 - - thumb_func_start sub_80880E0 -sub_80880E0: @ 80880E0 - push {r4-r7,lr} - sub sp, 0xC - adds r3, r0, 0 - adds r5, r1, 0 - cmp r5, 0 - beq _08088138 - ldr r0, [r5] - ldr r4, [r0, 0x4] - ldr r0, [r3] - ldr r0, [r0] - adds r7, r0, 0x7 - adds r2, 0x7 - cmp r2, 0 - bge _08088114 - negs r6, r2 - adds r1, r2, r4 - ldr r0, =gUnknown_03005DC0 - ldr r3, [r0, 0x4] - cmp r1, r3 - bge _0808810A - adds r3, r1, 0 -_0808810A: - movs r2, 0 - b _08088124 - .pool -_08088114: - movs r6, 0 - adds r0, r2, r4 - ldr r1, =gUnknown_03005DC0 - ldr r1, [r1, 0x4] - subs r3, r1, r2 - cmp r0, r1 - bge _08088124 - adds r3, r4, 0 -_08088124: - str r6, [sp] - movs r0, 0x8 - str r0, [sp, 0x4] - str r3, [sp, 0x8] - adds r0, r7, 0 - adds r1, r2, 0 - adds r2, r5, 0 - movs r3, 0 - bl sub_8087F54 -_08088138: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80880E0 - - thumb_func_start MapGridGetZCoordAt -@ u8 MapGridGetZCoordAt(s32 x, s32 y) -MapGridGetZCoordAt: @ 8088144 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - cmp r2, 0 - blt _08088174 - ldr r1, =gUnknown_03005DC0 - ldr r3, [r1] - cmp r2, r3 - bge _08088174 - cmp r4, 0 - blt _08088174 - ldr r0, [r1, 0x4] - cmp r4, r0 - bge _08088174 - adds r0, r3, 0 - muls r0, r4 - adds r0, r2, r0 - ldr r1, [r1, 0x8] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - b _08088196 - .pool -_08088174: - ldr r0, =gMapHeader - ldr r3, [r0] - adds r1, r2, 0x1 - movs r2, 0x1 - ands r1, r2 - adds r0, r4, 0x1 - ands r0, r2 - lsls r0, 1 - adds r1, r0 - ldr r0, [r3, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r1, [r1] - movs r2, 0xC0 - lsls r2, 4 - adds r0, r2, 0 - orrs r1, r0 -_08088196: - ldr r0, =0x000003ff - cmp r1, r0 - beq _080881A8 - lsrs r0, r1, 12 - b _080881AA - .pool -_080881A8: - movs r0, 0 -_080881AA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end MapGridGetZCoordAt - - thumb_func_start MapGridIsImpassableAt -@ u8 MapGridIsImpassableAt(s32 x, s32 y) -MapGridIsImpassableAt: @ 80881B0 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - cmp r2, 0 - blt _080881E0 - ldr r1, =gUnknown_03005DC0 - ldr r3, [r1] - cmp r2, r3 - bge _080881E0 - cmp r4, 0 - blt _080881E0 - ldr r0, [r1, 0x4] - cmp r4, r0 - bge _080881E0 - adds r0, r3, 0 - muls r0, r4 - adds r0, r2, r0 - ldr r1, [r1, 0x8] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - b _08088202 - .pool -_080881E0: - ldr r0, =gMapHeader - ldr r3, [r0] - adds r1, r2, 0x1 - movs r2, 0x1 - ands r1, r2 - adds r0, r4, 0x1 - ands r0, r2 - lsls r0, 1 - adds r1, r0 - ldr r0, [r3, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r1, [r1] - movs r2, 0xC0 - lsls r2, 4 - adds r0, r2, 0 - orrs r1, r0 -_08088202: - ldr r0, =0x000003ff - cmp r1, r0 - beq _0808821C - movs r0, 0xC0 - lsls r0, 4 - ands r1, r0 - lsrs r0, r1, 10 - b _0808821E - .pool -_0808821C: - movs r0, 0x1 -_0808821E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end MapGridIsImpassableAt - - thumb_func_start MapGridGetMetatileIdAt -@ u16 MapGridGetMetatileIdAt(s32 x, s32 y) -MapGridGetMetatileIdAt: @ 8088224 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - blt _08088254 - ldr r1, =gUnknown_03005DC0 - ldr r2, [r1] - cmp r5, r2 - bge _08088254 - cmp r6, 0 - blt _08088254 - ldr r0, [r1, 0x4] - cmp r6, r0 - bge _08088254 - adds r0, r2, 0 - muls r0, r6 - adds r0, r5, r0 - ldr r1, [r1, 0x8] - lsls r0, 1 - adds r0, r1 - ldrh r4, [r0] - b _08088278 - .pool -_08088254: - ldr r0, =gMapHeader - ldr r3, [r0] - adds r1, r5, 0x1 - movs r2, 0x1 - ands r1, r2 - adds r0, r6, 0x1 - ands r0, r2 - lsls r0, 1 - adds r1, r0 - ldr r0, [r3, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r1, [r1] - movs r2, 0xC0 - lsls r2, 4 - adds r0, r2, 0 - adds r4, r0, 0 - orrs r4, r1 -_08088278: - ldr r0, =0x000003ff - cmp r4, r0 - beq _0808828C - ands r4, r0 - adds r0, r4, 0 - b _080882B0 - .pool -_0808828C: - ldr r0, =gMapHeader - ldr r3, [r0] - adds r1, r5, 0x1 - movs r2, 0x1 - ands r1, r2 - adds r0, r6, 0x1 - ands r0, r2 - lsls r0, 1 - adds r1, r0 - ldr r0, [r3, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - movs r2, 0xC0 - lsls r2, 4 - adds r1, r2, 0 - orrs r0, r1 - ands r0, r4 -_080882B0: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end MapGridGetMetatileIdAt - - thumb_func_start MapGridGetMetatileBehaviorAt -@ u8 MapGridGetMetatileBehaviorAt(s32 x, s32 y) -MapGridGetMetatileBehaviorAt: @ 80882BC - push {lr} - bl MapGridGetMetatileIdAt - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - adds r1, r0, 0 - movs r0, 0xFF - ands r0, r1 - pop {r1} - bx r1 - thumb_func_end MapGridGetMetatileBehaviorAt - - thumb_func_start MapGridGetMetatileLayerTypeAt -@ u8 MapGridGetMetatileLayerTypeAt(s32 x, s32 y) -MapGridGetMetatileLayerTypeAt: @ 80882D4 - push {lr} - bl MapGridGetMetatileIdAt - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - adds r1, r0, 0 - movs r0, 0xF0 - lsls r0, 8 - ands r0, r1 - lsrs r0, 12 - pop {r1} - bx r1 - thumb_func_end MapGridGetMetatileLayerTypeAt - - thumb_func_start MapGridSetMetatileIdAt -@ void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId) -MapGridSetMetatileIdAt: @ 80882F0 - push {r4,r5,lr} - adds r3, r0, 0 - lsls r2, 16 - lsrs r5, r2, 16 - cmp r3, 0 - blt _08088328 - ldr r2, =gUnknown_03005DC0 - ldr r4, [r2] - cmp r3, r4 - bge _08088328 - cmp r1, 0 - blt _08088328 - ldr r0, [r2, 0x4] - cmp r1, r0 - bge _08088328 - muls r1, r4 - adds r1, r3, r1 - ldr r0, [r2, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - movs r2, 0xF0 - lsls r2, 8 - ands r2, r0 - ldr r0, =0x00000fff - ands r0, r5 - orrs r2, r0 - strh r2, [r1] -_08088328: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end MapGridSetMetatileIdAt - - thumb_func_start MapGridSetMetatileEntryAt -@ void MapGridSetMetatileEntryAt(s32 x, s32 y, u16 metatileEntry) -MapGridSetMetatileEntryAt: @ 8088338 - push {r4,r5,lr} - adds r3, r0, 0 - lsls r2, 16 - lsrs r5, r2, 16 - cmp r3, 0 - blt _08088364 - ldr r2, =gUnknown_03005DC0 - ldr r4, [r2] - cmp r3, r4 - bge _08088364 - cmp r1, 0 - blt _08088364 - ldr r0, [r2, 0x4] - cmp r1, r0 - bge _08088364 - adds r0, r4, 0 - muls r0, r1 - adds r0, r3, r0 - ldr r1, [r2, 0x8] - lsls r0, 1 - adds r0, r1 - strh r5, [r0] -_08088364: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end MapGridSetMetatileEntryAt - - thumb_func_start GetBehaviorByMetatileId -@ u16 GetBehaviorByMetatileId(u16 metatileId) -GetBehaviorByMetatileId: @ 8088370 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - adds r3, r2, 0 - ldr r0, =0x000001ff - cmp r2, r0 - bhi _08088394 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x10] - ldr r1, [r0, 0x10] - lsls r0, r2, 1 - b _080883B2 - .pool -_08088394: - ldr r0, =0x000003ff - cmp r2, r0 - bls _080883A4 - movs r0, 0xFF - b _080883B6 - .pool -_080883A4: - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x14] - ldr r1, [r0, 0x10] - lsls r0, r3, 1 - adds r0, r1 - ldr r1, =0xfffffc00 -_080883B2: - adds r0, r1 - ldrh r0, [r0] -_080883B6: - pop {r1} - bx r1 - .pool - thumb_func_end GetBehaviorByMetatileId - - thumb_func_start save_serialize_map -save_serialize_map: @ 80883C4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - adds r4, r1, 0 - adds r4, 0x34 - ldr r0, =gUnknown_03005DC0 - ldr r0, [r0] - mov r8, r0 - movs r0, 0 - ldrsh r6, [r1, r0] - movs r2, 0x2 - ldrsh r0, [r1, r2] - adds r1, r0, 0 - adds r1, 0xE - cmp r0, r1 - bge _08088420 - mov r12, r1 - ldr r1, =gUnknown_02032318 - mov r9, r1 - lsls r7, r6, 1 -_080883F2: - adds r1, r6, 0 - adds r3, r1, 0 - adds r3, 0xF - adds r5, r0, 0x1 - cmp r1, r3 - bge _0808841A - mov r2, r8 - muls r2, r0 - adds r0, r2, 0 - lsls r0, 1 - add r0, r9 - adds r2, r7, r0 - subs r1, r3, r1 -_0808840C: - ldrh r0, [r2] - strh r0, [r4] - adds r4, 0x2 - adds r2, 0x2 - subs r1, 0x1 - cmp r1, 0 - bne _0808840C -_0808841A: - adds r0, r5, 0 - cmp r0, r12 - blt _080883F2 -_08088420: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end save_serialize_map - - thumb_func_start sub_8088438 -sub_8088438: @ 8088438 - push {r4,lr} - movs r2, 0 - movs r1, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - adds r3, r0, 0 - adds r3, 0x34 - ldr r4, =0x000001ff -_08088448: - lsls r0, r1, 1 - adds r0, r3, r0 - ldrh r0, [r0] - orrs r2, r0 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r4 - bls _08088448 - cmp r2, 0 - beq _0808846C - movs r0, 0 - b _0808846E - .pool -_0808846C: - movs r0, 0x1 -_0808846E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8088438 - - thumb_func_start sav2_mapdata_clear -sav2_mapdata_clear: @ 8088474 - push {lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - adds r1, 0x34 - ldr r2, =0x01000100 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sav2_mapdata_clear - - thumb_func_start mapdata_from_sav2 -mapdata_from_sav2: @ 808849C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - adds r7, r0, 0 - adds r7, 0x34 - bl sub_8088438 - cmp r0, 0 - bne _080885AC - ldr r0, =gUnknown_03005DC0 - ldr r0, [r0] - str r0, [sp] - ldr r0, [r4] - movs r2, 0 - ldrsh r1, [r0, r2] - mov r10, r1 - movs r2, 0x2 - ldrsh r1, [r0, r2] - mov r8, r1 - mov r6, r8 - adds r0, r6, 0 - adds r0, 0xE - cmp r6, r0 - bge _0808855A -_080884D6: - cmp r6, r8 - bne _080884EC - cmp r6, 0 - beq _080884EC - movs r0, 0 - mov r9, r0 - b _08088508 - .pool -_080884EC: - mov r0, r8 - adds r0, 0xD - movs r1, 0xFF - mov r9, r1 - cmp r6, r0 - bne _08088508 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x4] - subs r0, 0x1 - cmp r6, r0 - beq _08088508 - movs r2, 0x1 - mov r9, r2 -_08088508: - mov r5, r10 - adds r0, r5, 0 - adds r0, 0xF - mov r1, r8 - adds r1, 0xE - str r1, [sp, 0x8] - adds r2, r6, 0x1 - str r2, [sp, 0x4] - cmp r5, r0 - bge _08088552 - ldr r0, [sp] - lsls r3, r0, 16 -_08088520: - ldr r1, [sp] - adds r0, r1, 0 - muls r0, r6 - adds r0, r5, r0 - lsls r0, 1 - ldr r1, =gUnknown_02032318 - adds r4, r0, r1 - adds r0, r4, 0 - lsrs r1, r3, 16 - mov r2, r9 - str r3, [sp, 0xC] - bl sub_8088BF0 - lsls r0, 24 - ldr r3, [sp, 0xC] - cmp r0, 0 - bne _08088546 - ldrh r0, [r7] - strh r0, [r4] -_08088546: - adds r7, 0x2 - adds r5, 0x1 - mov r0, r10 - adds r0, 0xF - cmp r5, r0 - blt _08088520 -_08088552: - ldr r6, [sp, 0x4] - ldr r2, [sp, 0x8] - cmp r6, r2 - blt _080884D6 -_0808855A: - mov r5, r10 - adds r0, r5, 0 - adds r0, 0xF - cmp r5, r0 - bge _080885A8 - mov r0, r8 - subs r0, 0x1 - lsls r0, 16 - mov r9, r0 - lsls r4, r5, 16 - mov r0, r8 - adds r0, 0xD - lsls r7, r0, 16 -_08088574: - mov r0, r8 - cmp r0, 0 - beq _08088584 - asrs r0, r4, 16 - mov r2, r9 - asrs r1, r2, 16 - bl sub_80D423C -_08088584: - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x4] - subs r0, 0x1 - cmp r6, r0 - bge _08088598 - asrs r0, r4, 16 - asrs r1, r7, 16 - bl sub_80D42B8 -_08088598: - movs r0, 0x80 - lsls r0, 9 - adds r4, r0 - adds r5, 0x1 - mov r0, r10 - adds r0, 0xF - cmp r5, r0 - blt _08088574 -_080885A8: - bl sav2_mapdata_clear -_080885AC: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end mapdata_from_sav2 - - thumb_func_start sub_80885C4 -sub_80885C4: @ 80885C4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r3, r0, 24 - adds r2, r3, 0 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x34 - str r0, [sp, 0x4] - ldr r0, =gUnknown_03005DC0 - ldr r0, [r0] - str r0, [sp] - movs r4, 0 - mov r9, r4 - mov r8, r4 - movs r0, 0 - ldrsh r6, [r1, r0] - str r6, [sp, 0x8] - movs r4, 0x2 - ldrsh r5, [r1, r4] - movs r7, 0xF - movs r6, 0xE - mov r12, r6 - cmp r3, 0x2 - beq _0808861E - cmp r3, 0x2 - bgt _08088614 - cmp r3, 0x1 - beq _08088626 - b _0808863E - .pool -_08088614: - cmp r2, 0x3 - beq _08088630 - cmp r2, 0x4 - beq _08088638 - b _0808863E -_0808861E: - adds r5, 0x1 - movs r0, 0xD - mov r12, r0 - b _0808863E -_08088626: - movs r1, 0x1 - mov r8, r1 - movs r3, 0xD - mov r12, r3 - b _0808863E -_08088630: - ldr r4, [sp, 0x8] - adds r4, 0x1 - str r4, [sp, 0x8] - b _0808863C -_08088638: - movs r6, 0x1 - mov r9, r6 -_0808863C: - movs r7, 0xE -_0808863E: - movs r1, 0 - cmp r1, r12 - bge _08088682 - ldr r0, =gUnknown_02032318 - mov r10, r0 -_08088648: - adds r4, r1, 0x1 - cmp r7, 0 - beq _0808867C - adds r0, r1, r5 - ldr r3, [sp] - adds r2, r3, 0 - muls r2, r0 - add r1, r8 - lsls r0, r1, 4 - subs r0, r1 - add r0, r9 - ldr r6, [sp, 0x8] - adds r2, r6, r2 - adds r3, r7, 0 - lsls r2, 1 - add r2, r10 - lsls r0, 1 - ldr r6, [sp, 0x4] - adds r1, r0, r6 -_0808866E: - ldrh r0, [r1] - strh r0, [r2] - adds r1, 0x2 - adds r2, 0x2 - subs r3, 0x1 - cmp r3, 0 - bne _0808866E -_0808867C: - adds r1, r4, 0 - cmp r1, r12 - blt _08088648 -_08088682: - bl sav2_mapdata_clear - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80885C4 - - thumb_func_start GetMapBorderIdAt -@ u32 GetMapBorderIdAt(s32 x, s32 y) -GetMapBorderIdAt: @ 808869C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - cmp r4, 0 - blt _080886D8 - ldr r1, =gUnknown_03005DC0 - ldr r2, [r1] - cmp r4, r2 - bge _080886D8 - cmp r5, 0 - blt _080886D8 - ldr r0, [r1, 0x4] - cmp r5, r0 - bge _080886D8 - adds r0, r2, 0 - muls r0, r5 - adds r0, r4, r0 - ldr r1, [r1, 0x8] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x000003ff - cmp r1, r0 - beq _08088770 - b _08088700 - .pool -_080886D8: - ldr r0, =gMapHeader - ldr r3, [r0] - adds r1, r4, 0x1 - movs r2, 0x1 - ands r1, r2 - adds r0, r5, 0x1 - ands r0, r2 - lsls r0, 1 - adds r1, r0 - ldr r0, [r3, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r1, [r1] - movs r2, 0xC0 - lsls r2, 4 - adds r0, r2, 0 - orrs r0, r1 - ldr r1, =0x000003ff - cmp r0, r1 - beq _08088770 -_08088700: - ldr r1, =gUnknown_03005DC0 - ldr r0, [r1] - subs r0, 0x8 - cmp r4, r0 - blt _0808872C - ldr r0, =gUnknown_02037340 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08088770 - movs r0, 0x4 - b _08088782 - .pool -_0808872C: - cmp r4, 0x6 - bgt _08088744 - ldr r0, =gUnknown_02037340 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08088770 - movs r0, 0x3 - b _08088782 - .pool -_08088744: - ldr r0, [r1, 0x4] - subs r0, 0x7 - cmp r5, r0 - blt _08088760 - ldr r0, =gUnknown_02037340 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08088770 - movs r0, 0x1 - b _08088782 - .pool -_08088760: - cmp r5, 0x6 - bgt _08088780 - ldr r0, =gUnknown_02037340 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0808877C -_08088770: - movs r0, 0x1 - negs r0, r0 - b _08088782 - .pool -_0808877C: - movs r0, 0x2 - b _08088782 -_08088780: - movs r0, 0 -_08088782: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetMapBorderIdAt - - thumb_func_start GetPostCameraMoveMapBorderId -@ u32 GetPostCameraMoveMapBorderId(s32 deltaX, s32 deltaY) -GetPostCameraMoveMapBorderId: @ 8088788 - push {r4,lr} - adds r3, r1, 0 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - movs r4, 0 - ldrsh r2, [r1, r4] - adds r0, 0x7 - adds r2, r0 - movs r0, 0x2 - ldrsh r1, [r1, r0] - adds r3, 0x7 - adds r1, r3 - adds r0, r2, 0 - bl GetMapBorderIdAt - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetPostCameraMoveMapBorderId - - thumb_func_start CanCameraMoveInDirection -@ bool32 CanCameraMoveInDirection(u8 direction) -CanCameraMoveInDirection: @ 80887B0 - push {r4,r5,lr} - ldr r1, =gSaveBlock1Ptr - ldr r4, [r1] - movs r1, 0 - ldrsh r3, [r4, r1] - ldr r2, =gUnknown_08339D64 - lsls r0, 3 - adds r1, r0, r2 - ldr r1, [r1] - adds r1, 0x7 - adds r3, r1 - movs r5, 0x2 - ldrsh r1, [r4, r5] - adds r2, 0x4 - adds r0, r2 - ldr r0, [r0] - adds r0, 0x7 - adds r1, r0 - adds r0, r3, 0 - bl GetMapBorderIdAt - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _080887F0 - movs r0, 0x1 - b _080887F2 - .pool -_080887F0: - movs r0, 0 -_080887F2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end CanCameraMoveInDirection - - thumb_func_start sub_80887F8 -sub_80887F8: @ 80887F8 - push {r4-r7,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - adds r7, r3, 0 - bl mapconnection_get_mapheader - adds r3, r0, 0 - cmp r4, 0x2 - beq _08088860 - cmp r4, 0x2 - bgt _08088816 - cmp r4, 0x1 - beq _0808884C - b _08088872 -_08088816: - cmp r4, 0x3 - beq _08088834 - cmp r4, 0x4 - bne _08088872 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - negs r0, r6 - strh r0, [r1] - ldr r2, [r5, 0x4] - ldrh r0, [r1, 0x2] - subs r0, r2 - b _08088870 - .pool -_08088834: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, [r3] - ldr r0, [r0] - strh r0, [r1] - ldr r2, [r5, 0x4] - ldrh r0, [r1, 0x2] - subs r0, r2 - b _08088870 - .pool -_0808884C: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r2, [r5, 0x4] - ldrh r0, [r1] - subs r0, r2 - strh r0, [r1] - negs r0, r7 - b _08088870 - .pool -_08088860: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r2, [r5, 0x4] - ldrh r0, [r1] - subs r0, r2 - strh r0, [r1] - ldr r0, [r3] - ldr r0, [r0, 0x4] -_08088870: - strh r0, [r1, 0x2] -_08088872: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80887F8 - - thumb_func_start CameraMove -@ u8 CameraMove(s32 deltaX, s32 deltaY) -CameraMove: @ 808887C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r10, r0 - mov r9, r1 - ldr r1, =gCamera - ldrb r0, [r1] - movs r1, 0x2 - negs r1, r1 - ands r1, r0 - ldr r2, =gCamera - strb r1, [r2] - mov r0, r10 - mov r1, r9 - bl GetPostCameraMoveMapBorderId - adds r7, r0, 0 - adds r0, r7, 0x1 - cmp r0, 0x1 - bhi _080888C4 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldrh r0, [r1] - add r0, r10 - strh r0, [r1] - ldrh r0, [r1, 0x2] - add r0, r9 - strh r0, [r1, 0x2] - b _08088932 - .pool -_080888C4: - bl save_serialize_map - bl sub_81BE72C - ldr r1, =gSaveBlock1Ptr - ldr r0, [r1] - movs r2, 0 - ldrsh r5, [r0, r2] - movs r1, 0x2 - ldrsh r6, [r0, r1] - lsls r2, r7, 24 - lsrs r2, 24 - mov r8, r2 - mov r0, r8 - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_8088950 - adds r4, r0, 0 - adds r1, r7, 0 - mov r2, r10 - mov r3, r9 - bl sub_80887F8 - ldrb r0, [r4, 0x8] - ldrb r1, [r4, 0x9] - bl mliX_load_map - ldr r1, =gCamera - ldrb r0, [r1] - movs r1, 0x1 - orrs r0, r1 - ldr r2, =gCamera - strb r0, [r2] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r2, 0 - ldrsh r0, [r1, r2] - subs r5, r0 - ldr r0, =gCamera - str r5, [r0, 0x4] - movs r2, 0x2 - ldrsh r0, [r1, r2] - subs r6, r0 - ldr r0, =gCamera - str r6, [r0, 0x8] - ldrh r0, [r1] - add r0, r10 - strh r0, [r1] - ldrh r0, [r1, 0x2] - add r0, r9 - strh r0, [r1, 0x2] - mov r0, r8 - bl sub_80885C4 -_08088932: - ldr r0, =gCamera - ldrb r0, [r0] - lsls r0, 31 - lsrs r0, 31 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end CameraMove - - thumb_func_start sub_8088950 -sub_8088950: @ 8088950 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r1 - mov r8, r2 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gMapHeader - ldr r0, [r0, 0xC] - ldr r7, [r0] - ldr r4, [r0, 0x4] - movs r5, 0 - cmp r5, r7 - bge _08088998 -_0808896E: - ldrb r0, [r4] - cmp r0, r6 - bne _08088990 - adds r0, r6, 0 - mov r1, r9 - mov r2, r8 - adds r3, r4, 0 - bl sub_80889A8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08088990 - adds r0, r4, 0 - b _0808899A - .pool -_08088990: - adds r5, 0x1 - adds r4, 0xC - cmp r5, r7 - blt _0808896E -_08088998: - movs r0, 0 -_0808899A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8088950 - - thumb_func_start sub_80889A8 -sub_80889A8: @ 80889A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r1, 0 - mov r8, r2 - adds r5, r3, 0 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - adds r0, r5, 0 - bl mapconnection_get_mapheader - adds r2, r0, 0 - cmp r4, 0x1 - blt _08088A00 - cmp r4, 0x2 - bgt _080889E0 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r1, [r0] - ldr r0, [r2] - ldr r2, [r0] - ldr r3, [r5, 0x4] - adds r0, r7, 0 - b _080889F2 - .pool -_080889E0: - cmp r6, 0x4 - bgt _08088A00 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r1, [r0, 0x4] - ldr r0, [r2] - ldr r2, [r0, 0x4] - ldr r3, [r5, 0x4] - mov r0, r8 -_080889F2: - bl sub_8088A0C - lsls r0, 24 - lsrs r0, 24 - b _08088A02 - .pool -_08088A00: - movs r0, 0 -_08088A02: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80889A8 - - thumb_func_start sub_8088A0C -sub_8088A0C: @ 8088A0C - push {r4,lr} - adds r4, r0, 0 - adds r0, r2, 0 - adds r2, r3, 0 - cmp r3, 0 - bge _08088A1A - movs r3, 0 -_08088A1A: - adds r2, r0, r2 - cmp r2, r1 - bge _08088A22 - adds r1, r2, 0 -_08088A22: - cmp r3, r4 - bgt _08088A2E - cmp r4, r1 - bgt _08088A2E - movs r0, 0x1 - b _08088A30 -_08088A2E: - movs r0, 0 -_08088A30: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8088A0C - - thumb_func_start sub_8088A38 -sub_8088A38: @ 8088A38 - push {lr} - cmp r0, 0 - blt _08088A46 - cmp r0, r1 - bge _08088A46 - movs r0, 0x1 - b _08088A48 -_08088A46: - movs r0, 0 -_08088A48: - pop {r1} - bx r1 - thumb_func_end sub_8088A38 - - thumb_func_start sub_8088A4C -sub_8088A4C: @ 8088A4C - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - bl mapconnection_get_mapheader - adds r1, r0, 0 - ldrb r0, [r4] - cmp r0, 0x1 - blt _08088A84 - cmp r0, 0x2 - bgt _08088A72 - ldr r0, [r4, 0x4] - subs r0, r5, r0 - ldr r1, [r1] - ldr r1, [r1] - bl sub_8088A38 - b _08088A86 -_08088A72: - cmp r0, 0x4 - bgt _08088A84 - ldr r0, [r4, 0x4] - subs r0, r6, r0 - ldr r1, [r1] - ldr r1, [r1, 0x4] - bl sub_8088A38 - b _08088A86 -_08088A84: - movs r0, 0 -_08088A86: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8088A4C - - thumb_func_start sub_8088A8C -sub_8088A8C: @ 8088A8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =gMapHeader - ldr r0, [r2, 0xC] - cmp r0, 0 - bne _08088AB4 - b _08088B2A - .pool -_08088AB0: - adds r0, r4, 0 - b _08088B2C -_08088AB4: - ldr r7, [r0] - ldr r4, [r0, 0x4] - movs r6, 0 - cmp r6, r7 - bge _08088B2A - lsls r0, r1, 16 - asrs r5, r0, 16 - mov r9, r2 - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - mov r10, r0 -_08088ACC: - ldrb r1, [r4] - adds r3, r1, 0 - subs r0, r1, 0x5 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _08088B22 - cmp r1, 0x2 - bne _08088AE2 - cmp r5, 0x6 - bgt _08088B22 -_08088AE2: - cmp r1, 0x1 - bne _08088AF2 - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0, 0x4] - adds r0, 0x7 - cmp r5, r0 - blt _08088B22 -_08088AF2: - mov r0, r8 - lsls r2, r0, 16 - cmp r1, 0x3 - bne _08088B00 - mov r1, r10 - cmp r1, 0x6 - bgt _08088B22 -_08088B00: - cmp r3, 0x4 - bne _08088B12 - asrs r1, r2, 16 - mov r3, r9 - ldr r0, [r3] - ldr r0, [r0] - adds r0, 0x7 - cmp r1, r0 - blt _08088B22 -_08088B12: - asrs r1, r2, 16 - subs r1, 0x7 - adds r0, r4, 0 - subs r2, r5, 0x7 - bl sub_8088A4C - cmp r0, 0x1 - beq _08088AB0 -_08088B22: - adds r6, 0x1 - adds r4, 0xC - cmp r6, r7 - blt _08088ACC -_08088B2A: - movs r0, 0 -_08088B2C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8088A8C - - thumb_func_start sub_8088B3C -sub_8088B3C: @ 8088B3C - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - subs r0, 0x7 - strh r0, [r2] - subs r1, 0x7 - strh r1, [r2, 0x2] - bx lr - .pool - thumb_func_end sub_8088B3C - - thumb_func_start sav1_camera_get_focus_coords -sav1_camera_get_focus_coords: @ 8088B58 - ldr r2, =gSaveBlock1Ptr - ldr r3, [r2] - ldrh r2, [r3] - adds r2, 0x7 - strh r2, [r0] - ldrh r0, [r3, 0x2] - adds r0, 0x7 - strh r0, [r1] - bx lr - .pool - thumb_func_end sav1_camera_get_focus_coords - - thumb_func_start SetCameraCoords -@ void SetCameraCoords(u16 x, u16 y) -SetCameraCoords: @ 8088B70 - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - strh r0, [r2] - strh r1, [r2, 0x2] - bx lr - .pool - thumb_func_end SetCameraCoords - - thumb_func_start GetCameraCoords -@ void GetCameraCoords(u16 *x, u16 *y) -GetCameraCoords: @ 8088B80 - ldr r2, =gSaveBlock1Ptr - ldr r3, [r2] - ldrh r2, [r3] - strh r2, [r0] - ldrh r0, [r3, 0x2] - strh r0, [r1] - bx lr - .pool - thumb_func_end GetCameraCoords - - thumb_func_start sub_8088B94 -sub_8088B94: @ 8088B94 - push {r4,r5,lr} - adds r4, r0, 0 - adds r3, r1, 0 - adds r5, r2, 0 - cmp r4, 0 - blt _08088BE6 - ldr r2, =gUnknown_03005DC0 - ldr r1, [r2] - cmp r4, r1 - bge _08088BE6 - cmp r3, 0 - blt _08088BE6 - ldr r0, [r2, 0x4] - cmp r3, r0 - bge _08088BE6 - cmp r5, 0 - beq _08088BD4 - adds r0, r1, 0 - muls r0, r3 - adds r0, r4, r0 - ldr r1, [r2, 0x8] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r3, 0xC0 - lsls r3, 4 - adds r2, r3, 0 - orrs r1, r2 - strh r1, [r0] - b _08088BE6 - .pool -_08088BD4: - muls r1, r3 - adds r1, r4, r1 - ldr r0, [r2, 0x8] - lsls r1, 1 - adds r1, r0 - ldrh r2, [r1] - ldr r0, =0x0000f3ff - ands r0, r2 - strh r0, [r1] -_08088BE6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8088B94 - - thumb_func_start sub_8088BF0 -sub_8088BF0: @ 8088BF0 - push {lr} - adds r3, r0, 0 - lsls r1, 16 - lsrs r0, r1, 16 - adds r1, r0, 0 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0xFF - beq _08088C24 - cmp r2, 0 - bne _08088C0C - lsls r0, 1 - subs r3, r0 - b _08088C10 -_08088C0C: - lsls r0, r1, 1 - adds r3, r0 -_08088C10: - ldrh r1, [r3] - ldr r0, =0x000003ff - ands r0, r1 - adds r1, r2, 0 - bl sub_80FADE4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08088C2C -_08088C24: - movs r0, 0 - b _08088C2E - .pool -_08088C2C: - movs r0, 0x1 -_08088C2E: - pop {r1} - bx r1 - thumb_func_end sub_8088BF0 - - thumb_func_start copy_tileset_patterns_to_vram -@ void copy_tileset_patterns_to_vram(tileset *tileset, int num_tiles, int offset) -copy_tileset_patterns_to_vram: @ 8088C34 - push {r4-r7,lr} - sub sp, 0x4 - adds r3, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r6, r4, 0 - lsls r2, 16 - lsrs r5, r2, 16 - adds r7, r5, 0 - cmp r3, 0 - beq _08088C70 - ldrb r0, [r3] - cmp r0, 0 - bne _08088C60 - ldr r1, [r3, 0x4] - lsls r2, r4, 21 - lsrs r2, 16 - movs r0, 0x2 - adds r3, r5, 0 - bl LoadBgTiles - b _08088C70 -_08088C60: - ldr r1, [r3, 0x4] - lsls r2, r6, 5 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - adds r3, r7, 0 - bl decompress_and_copy_tile_data_to_vram -_08088C70: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end copy_tileset_patterns_to_vram - - thumb_func_start copy_tileset_patterns_to_vram2 -@ void copy_tileset_patterns_to_vram2(tileset *tileset, int num_tiles, int offset) -copy_tileset_patterns_to_vram2: @ 8088C78 - push {r4-r7,lr} - sub sp, 0x4 - adds r3, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r6, r4, 0 - lsls r2, 16 - lsrs r5, r2, 16 - adds r7, r5, 0 - cmp r3, 0 - beq _08088CB4 - ldrb r0, [r3] - cmp r0, 0 - bne _08088CA4 - ldr r1, [r3, 0x4] - lsls r2, r4, 21 - lsrs r2, 16 - movs r0, 0x2 - adds r3, r5, 0 - bl LoadBgTiles - b _08088CB4 -_08088CA4: - ldr r1, [r3, 0x4] - lsls r2, r6, 5 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - adds r3, r7, 0 - bl copy_decompressed_tile_data_to_vram_autofree -_08088CB4: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end copy_tileset_patterns_to_vram2 - - thumb_func_start nullsub_3 -nullsub_3: @ 8088CBC - bx lr - thumb_func_end nullsub_3 - - thumb_func_start nullsub_90 -nullsub_90: @ 8088CC0 - bx lr - thumb_func_end nullsub_90 - - thumb_func_start apply_map_tileset_palette -@ void apply_map_tileset_palette(tileset *tileset, int dest_offset, int size) -apply_map_tileset_palette: @ 8088CC4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - mov r8, r5 - lsls r6, r2, 16 - lsrs r7, r6, 16 - adds r2, r7, 0 - movs r1, 0 - mov r0, sp - strh r1, [r0] - cmp r4, 0 - beq _08088D42 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _08088D18 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x2 - bl LoadPalette - ldr r0, [r4, 0x8] - adds r0, 0x2 - adds r5, 0x1 - lsls r5, 16 - lsrs r5, 16 - subs r4, r7, 0x2 - lsls r2, r4, 16 - lsrs r2, 16 - adds r1, r5, 0 - bl LoadPalette - lsls r4, 15 - lsrs r4, 16 - adds r0, r5, 0 - adds r1, r4, 0 - bl nullsub_3 - b _08088D42 -_08088D18: - cmp r0, 0x1 - bne _08088D32 - ldr r0, [r4, 0x8] - adds r0, 0xC0 - adds r1, r5, 0 - adds r2, r7, 0 - bl LoadPalette - lsrs r1, r6, 17 - adds r0, r5, 0 - bl nullsub_3 - b _08088D42 -_08088D32: - ldr r0, [r4, 0x8] - mov r1, r8 - bl LoadCompressedPalette - lsrs r1, r6, 17 - mov r0, r8 - bl nullsub_3 -_08088D42: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end apply_map_tileset_palette - - thumb_func_start copy_map_tileset1_to_vram -@ void copy_map_tileset1_to_vram(mapdata_header *a1) -copy_map_tileset1_to_vram: @ 8088D50 - push {lr} - ldr r0, [r0, 0x10] - movs r1, 0x80 - lsls r1, 2 - movs r2, 0 - bl copy_tileset_patterns_to_vram - pop {r0} - bx r0 - thumb_func_end copy_map_tileset1_to_vram - - thumb_func_start copy_map_tileset2_to_vram -@ void copy_map_tileset2_to_vram(mapdata_header *a1) -copy_map_tileset2_to_vram: @ 8088D64 - push {lr} - ldr r0, [r0, 0x14] - movs r2, 0x80 - lsls r2, 2 - adds r1, r2, 0 - bl copy_tileset_patterns_to_vram - pop {r0} - bx r0 - thumb_func_end copy_map_tileset2_to_vram - - thumb_func_start copy_map_tileset2_to_vram_2 -@ void copy_map_tileset2_to_vram_2(mapdata_header *a1) -copy_map_tileset2_to_vram_2: @ 8088D78 - push {lr} - ldr r0, [r0, 0x14] - movs r2, 0x80 - lsls r2, 2 - adds r1, r2, 0 - bl copy_tileset_patterns_to_vram2 - pop {r0} - bx r0 - thumb_func_end copy_map_tileset2_to_vram_2 - - thumb_func_start apply_map_tileset1_palette -@ void apply_map_tileset1_palette(mapdata_header *a1) -apply_map_tileset1_palette: @ 8088D8C - push {lr} - ldr r0, [r0, 0x10] - movs r1, 0 - movs r2, 0xC0 - bl apply_map_tileset_palette - pop {r0} - bx r0 - thumb_func_end apply_map_tileset1_palette - - thumb_func_start apply_map_tileset2_palette -@ void apply_map_tileset2_palette(mapdata_header *a1) -apply_map_tileset2_palette: @ 8088D9C - push {lr} - ldr r0, [r0, 0x14] - movs r1, 0x60 - movs r2, 0xE0 - bl apply_map_tileset_palette - pop {r0} - bx r0 - thumb_func_end apply_map_tileset2_palette - - thumb_func_start copy_map_tileset1_tileset2_to_vram -@ void copy_map_tileset1_tileset2_to_vram(mapdata_header *a1) -copy_map_tileset1_tileset2_to_vram: @ 8088DAC - push {r4,r5,lr} - adds r5, r0, 0 - cmp r5, 0 - beq _08088DCC - ldr r0, [r5, 0x10] - movs r4, 0x80 - lsls r4, 2 - adds r1, r4, 0 - movs r2, 0 - bl copy_tileset_patterns_to_vram2 - ldr r0, [r5, 0x14] - adds r1, r4, 0 - adds r2, r4, 0 - bl copy_tileset_patterns_to_vram2 -_08088DCC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end copy_map_tileset1_tileset2_to_vram - - thumb_func_start apply_map_tileset1_tileset2_palette -@ void apply_map_tileset1_tileset2_palette(mapdata_header *a1) -apply_map_tileset1_tileset2_palette: @ 8088DD4 - push {r4,lr} - adds r4, r0, 0 - cmp r4, 0 - beq _08088DE6 - bl apply_map_tileset1_palette - adds r0, r4, 0 - bl apply_map_tileset2_palette -_08088DE6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end apply_map_tileset1_tileset2_palette - - .align 2, 0 @ Don't pad with nop. diff --git a/common_syms/field_camera.txt b/common_syms/field_camera.txt new file mode 100644 index 000000000..615026aee --- /dev/null +++ b/common_syms/field_camera.txt @@ -0,0 +1,3 @@ +gUnknown_03005DD0 +gUnknown_03005DE8 +gUnknown_03005DEC diff --git a/common_syms/fieldmap.txt b/common_syms/fieldmap.txt new file mode 100644 index 000000000..49e0fb980 --- /dev/null +++ b/common_syms/fieldmap.txt @@ -0,0 +1 @@ +gUnknown_03005DC0 diff --git a/data/fieldmap.s b/data/fieldmap.s deleted file mode 100644 index 1daa3efdf..000000000 --- a/data/fieldmap.s +++ /dev/null @@ -1,8 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_08486EF8:: @ 8486EF8 - .4byte 0x00000000 diff --git a/include/battle_frontier_2.h b/include/battle_frontier_2.h index 638ff692e..3f8f8049d 100644 --- a/include/battle_frontier_2.h +++ b/include/battle_frontier_2.h @@ -7,5 +7,6 @@ u16 sub_81A89A0(u8); void sub_81A8AF8(void); bool8 InBattlePike(void); void sub_819FA50(void); +void sub_81AA078(u16*, u8); #endif // GUARD_BATTLE_FRONTIER_2_H diff --git a/include/fieldmap.h b/include/fieldmap.h index 3128e95ce..6e127ce5d 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -1,22 +1,31 @@ #ifndef GUARD_FIELDMAP_H #define GUARD_FIELDMAP_H -extern struct MapCoords { - int width; - int height; -} gUnknown_03005DC0; +extern struct BackupMapData gUnknown_03005DC0; u32 MapGridGetMetatileIdAt(int, int); u32 MapGridGetMetatileBehaviorAt(int, int); void MapGridSetMetatileIdAt(int, int, u16); void MapGridSetMetatileEntryAt(int, int, u16); void GetCameraCoords(u16*, u16*); -bool8 MapGridIsImpassableAt(s16, s16); -s32 GetMapBorderIdAt(s16, s16); -bool32 CanCameraMoveInDirection(u8); +bool8 MapGridIsImpassableAt(int, int); +int GetMapBorderIdAt(int x, int y); +int CanCameraMoveInDirection(int direction); u16 GetBehaviorByMetatileId(u16 metatileId); void sav1_camera_get_focus_coords(u16 *x, u16 *y); u8 MapGridGetMetatileLayerTypeAt(s32 x, s32 y); u8 CameraMove(s32 deltaX, s32 deltaY); +void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader); +void map_copy_with_padding(u16 *map, u16 width, u16 height); +void mapheader_copy_mapdata_of_adjacent_maps(struct MapHeader *); +void fillSouthConnection(struct MapHeader const *, struct MapHeader const *, s32); +void fillNorthConnection(struct MapHeader const *, struct MapHeader const *, s32); +void fillWestConnection(struct MapHeader const *, struct MapHeader const *, s32); +void fillEastConnection(struct MapHeader const *, struct MapHeader const *, s32); +void mapdata_from_sav2(void); +bool8 sub_8088BF0(u16*, u16, u8); +struct MapConnection *sub_8088950(u8 direction, int x, int y); +bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection); +bool8 sub_8088A0C(int x, int src_width, int dest_width, int offset); #endif //GUARD_FIELDMAP_H diff --git a/include/fldeff_80F9BCC.h b/include/fldeff_80F9BCC.h index d57665c68..84015065e 100644 --- a/include/fldeff_80F9BCC.h +++ b/include/fldeff_80F9BCC.h @@ -10,5 +10,6 @@ void sub_80FA5E4(s16 id, s16 x, s16 y); void sub_80FA794(s16 x, s16 y); void overworld_poison_effect(void); +bool8 sub_80FADE4(u16, u8); #endif //GUARD_FLDEFF_80F9BCC_H diff --git a/include/fldeff_cut.h b/include/fldeff_cut.h new file mode 100644 index 000000000..f985fd82d --- /dev/null +++ b/include/fldeff_cut.h @@ -0,0 +1,7 @@ +#ifndef GUARD_FLDEFF_CUT_H +#define GUARD_FLDEFF_CUT_H + +void sub_80D423C(s16, s16); +void sub_80D42B8(s16, s16); + +#endif // GUARD_FLDEFF_CUT_H diff --git a/include/fldeff_groundshake.h b/include/fldeff_groundshake.h new file mode 100644 index 000000000..c1629f9bd --- /dev/null +++ b/include/fldeff_groundshake.h @@ -0,0 +1,6 @@ +#ifndef GUARD_FLDEFF_GROUNDSHAKE_H +#define GUARD_FLDEFF_GROUNDSHAKE_H + +void sub_81BE72C(void); + +#endif // GUARD_FLDEFF_GROUNDSHAKE_H diff --git a/include/overworld.h b/include/overworld.h index cd0f4e60f..59d4d6a30 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -44,8 +44,8 @@ void ApplyCurrentWarp(void); void set_warp2_warp3_to_neg_1(void); 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); -const struct MapHeader *Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); -const struct MapHeader *warp1_get_mapheader(void); +struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); +struct MapHeader const *const warp1_get_mapheader(void); void set_current_map_header_from_sav1_save_old_name(void); void LoadSaveblockMapHeader(void); void update_camera_pos_from_warpid(void); diff --git a/include/pokenav.h b/include/pokenav.h index fabe211ea..42affc938 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -20,6 +20,7 @@ void sub_81D1E90(struct PlayerPCItemPageStruct *); void sub_81D1EC0(void); void sub_81D1D04(u8); bool8 sub_81D1C44(u8); +void sub_81D5FB4(u16*); #endif //GUARD_POKENAV_H diff --git a/include/secret_base.h b/include/secret_base.h index b2502889c..173efef09 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -10,5 +10,7 @@ void sub_80E9578(void); void sub_80E980C(void); u8 *GetSecretBaseMapName(u8 *dest); const u8 *GetSecretBaseTrainerLoseText(void); +void sub_80E8EE0(struct MapEvents const *events); +void sub_80E9238(u8 flagIn); #endif //GUARD_SECRET_BASE_H diff --git a/include/tv.h b/include/tv.h index 19c900ba8..1e05a680e 100644 --- a/include/tv.h +++ b/include/tv.h @@ -45,5 +45,6 @@ void PutPokemonTodayCaughtOnAir(void); void TV_PutSecretBaseVisitOnTheAir(void); bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent); +void UpdateTVScreensOnMap(int, int); #endif //GUARD_TV_H diff --git a/ld_script.txt b/ld_script.txt index 2832bcada..e8b6951a7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -87,7 +87,7 @@ SECTIONS { src/play_time.o(.text); src/new_game.o(.text); src/overworld.o(.text); - asm/fieldmap.o(.text); + src/fieldmap.o(.text); src/metatile_behavior.o(.text); src/field_camera.o(.text); src/field_door.o(.text); @@ -396,7 +396,7 @@ SECTIONS { src/overworld.o(.rodata); data/tilesets.o(.rodata); data/maps.o(.rodata); - data/fieldmap.o(.rodata); + src/fieldmap.o(.rodata); src/metatile_behavior.o(.rodata); src/field_door.o(.rodata); data/field_player_avatar.o(.rodata); diff --git a/src/field_camera.c b/src/field_camera.c index f653e0bf1..95167ee10 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -12,6 +12,8 @@ #include "sprite.h" #include "text.h" +EWRAM_DATA bool8 gUnusedBikeCameraAheadPanback = FALSE; + // Static type declarations struct FieldCameraUnknownStruct { @@ -40,6 +42,10 @@ static IWRAM_DATA s16 gUnknown_03000E2A; static IWRAM_DATA u8 gUnknown_03000E2C; static IWRAM_DATA void (*gUnknown_03000E30)(void); +struct CameraObject gUnknown_03005DD0; +u16 gUnknown_03005DE8; +u16 gUnknown_03005DEC; + // text static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraUnknownStruct *a) { diff --git a/src/fieldmap.c b/src/fieldmap.c new file mode 100644 index 000000000..87e493e95 --- /dev/null +++ b/src/fieldmap.c @@ -0,0 +1,1034 @@ +#include "global.h" +#include "overworld.h" +#include "bg.h" +#include "battle_frontier_2.h" +#include "constants/RGB.h" +#include "fieldmap.h" +#include "fldeff_80F9BCC.h" +#include "fldeff_cut.h" +#include "fldeff_groundshake.h" +#include "menu.h" +#include "palette.h" +#include "pokenav.h" +#include "script.h" +#include "secret_base.h" +#include "tv.h" + +struct ConnectionFlags +{ + u8 south:1; + u8 north:1; + u8 west:1; + u8 east:1; +}; + +EWRAM_DATA static u16 gUnknown_02032318[0x2800] = {0}; +EWRAM_DATA struct MapHeader gMapHeader = {0}; +EWRAM_DATA struct Camera gCamera = {0}; +EWRAM_DATA static struct ConnectionFlags gUnknown_02037340 = {0}; +EWRAM_DATA static u32 sFiller_02037344 = 0; // without this, the next file won't align properly + +struct BackupMapData gUnknown_03005DC0; + +static const struct ConnectionFlags sDummyConnectionFlags = {0}; + +struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *connection) +{ + return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum); +} + +void not_trainer_hill_battle_pyramid(void) +{ + mapheader_copy_mapdata_with_padding(&gMapHeader); + sub_80E8EE0(gMapHeader.events); + mapheader_run_script_with_tag_x1(); +} + +void sub_8087D74(void) +{ + mapheader_copy_mapdata_with_padding(&gMapHeader); + sub_80E9238(0); + sub_80E8EE0(gMapHeader.events); + mapdata_from_sav2(); + mapheader_run_script_with_tag_x1(); + UpdateTVScreensOnMap(gUnknown_03005DC0.width, gUnknown_03005DC0.height); +} + +void battle_pyramid_map_load_related(u8 a0) +{ + CpuFastFill(0x03ff03ff, gUnknown_02032318, sizeof(gUnknown_02032318)); + sub_81AA078(gUnknown_02032318, a0); +} + +void trainer_hill_map_load_related(void) +{ + CpuFastFill(0x03ff03ff, gUnknown_02032318, sizeof(gUnknown_02032318)); + sub_81D5FB4(gUnknown_02032318); +} + +void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader) +{ + struct MapData const *mapData; + int width; + int height; + mapData = mapHeader->mapData; + CpuFastFill16(0x03ff, gUnknown_02032318, sizeof(gUnknown_02032318)); + gUnknown_03005DC0.map = gUnknown_02032318; + width = mapData->width + 15; + gUnknown_03005DC0.width = width; + height = mapData->height + 14; + gUnknown_03005DC0.height = height; + if (width * height <= 0x2800) + { + map_copy_with_padding(mapData->map, mapData->width, mapData->height); + mapheader_copy_mapdata_of_adjacent_maps(mapHeader); + } +} + +void map_copy_with_padding(u16 *map, u16 width, u16 height) +{ + u16 *dest; + int y; + dest = gUnknown_03005DC0.map; + dest += gUnknown_03005DC0.width * 7 + 7; + for (y = 0; y < height; y++) + { + CpuCopy16(map, dest, width * 2); + dest += width + 0xf; + map += width; + } +} + +void mapheader_copy_mapdata_of_adjacent_maps(struct MapHeader *mapHeader) +{ + int count; + struct MapConnection *connection; + int i; + + if (mapHeader->connections) + { + count = mapHeader->connections->count; + connection = mapHeader->connections->connections; + + gUnknown_02037340 = sDummyConnectionFlags; + for (i = 0; i < count; i++, connection++) + { + struct MapHeader const *cMap = mapconnection_get_mapheader(connection); + u32 offset = connection->offset; + + switch (connection->direction) + { + case CONNECTION_SOUTH: + fillSouthConnection(mapHeader, cMap, offset); + gUnknown_02037340.south = 1; + break; + case CONNECTION_NORTH: + fillNorthConnection(mapHeader, cMap, offset); + gUnknown_02037340.north = 1; + break; + case CONNECTION_WEST: + fillWestConnection(mapHeader, cMap, offset); + gUnknown_02037340.west = 1; + break; + case CONNECTION_EAST: + fillEastConnection(mapHeader, cMap, offset); + gUnknown_02037340.east = 1; + break; + } + } + } +} + +void sub_8087F54(int x, int y, struct MapHeader const *mapHeader, int x2, int y2, int width, int height) +{ + int i; + u16 *src; + u16 *dest; + int mapWidth; + + mapWidth = mapHeader->mapData->width; + src = &mapHeader->mapData->map[mapWidth * y2 + x2]; + dest = &gUnknown_03005DC0.map[gUnknown_03005DC0.width * y + x]; + + for (i = 0; i < height; i++) + { + CpuCopy16(src, dest, width * 2); + dest += gUnknown_03005DC0.width; + src += mapWidth; + } +} + +void fillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset) +{ + int x, y; + int x2; + int width; + int cWidth; + + if (connectedMapHeader) + { + cWidth = connectedMapHeader->mapData->width; + x = offset + 7; + y = mapHeader->mapData->height + 7; + if (x < 0) + { + x2 = -x; + x += cWidth; + if (x < gUnknown_03005DC0.width) + { + width = x; + } + else + { + width = gUnknown_03005DC0.width; + } + x = 0; + } + else + { + x2 = 0; + if (x + cWidth < gUnknown_03005DC0.width) + { + width = cWidth; + } + else + { + width = gUnknown_03005DC0.width - x; + } + } + + sub_8087F54( + x, y, + connectedMapHeader, + x2, /*y2*/ 0, + width, /*height*/ 7); + } +} + +void fillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset) +{ + int x; + int x2, y2; + int width; + int cWidth, cHeight; + + if (connectedMapHeader) + { + cWidth = connectedMapHeader->mapData->width; + cHeight = connectedMapHeader->mapData->height; + x = offset + 7; + y2 = cHeight - 7; + if (x < 0) + { + x2 = -x; + x += cWidth; + if (x < gUnknown_03005DC0.width) + { + width = x; + } + else + { + width = gUnknown_03005DC0.width; + } + x = 0; + } + else + { + x2 = 0; + if (x + cWidth < gUnknown_03005DC0.width) + { + width = cWidth; + } + else + { + width = gUnknown_03005DC0.width - x; + } + } + + sub_8087F54( + x, /*y*/ 0, + connectedMapHeader, + x2, y2, + width, /*height*/ 7); + + } +} + +void fillWestConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset) +{ + int y; + int x2, y2; + int height; + int cWidth, cHeight; + if (connectedMapHeader) + { + cWidth = connectedMapHeader->mapData->width; + cHeight = connectedMapHeader->mapData->height; + y = offset + 7; + x2 = cWidth - 7; + if (y < 0) + { + y2 = -y; + if (y + cHeight < gUnknown_03005DC0.height) + { + height = y + cHeight; + } + else + { + height = gUnknown_03005DC0.height; + } + y = 0; + } + else + { + y2 = 0; + if (y + cHeight < gUnknown_03005DC0.height) + { + height = cHeight; + } + else + { + height = gUnknown_03005DC0.height - y; + } + } + + sub_8087F54( + /*x*/ 0, y, + connectedMapHeader, + x2, y2, + /*width*/ 7, height); + } +} + +void fillEastConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset) +{ + int x, y; + int y2; + int height; + int cHeight; + if (connectedMapHeader) + { + cHeight = connectedMapHeader->mapData->height; + x = mapHeader->mapData->width + 7; + y = offset + 7; + if (y < 0) + { + y2 = -y; + if (y + cHeight < gUnknown_03005DC0.height) + { + height = y + cHeight; + } + else + { + height = gUnknown_03005DC0.height; + } + y = 0; + } + else + { + y2 = 0; + if (y + cHeight < gUnknown_03005DC0.height) + { + height = cHeight; + } + else + { + height = gUnknown_03005DC0.height - y; + } + } + + sub_8087F54( + x, y, + connectedMapHeader, + /*x2*/ 0, y2, + /*width*/ 8, height); + } +} + +union Block +{ + struct + { + u16 block:10; + u16 collision:2; + u16 elevation:4; + } block; + u16 value; +}; + +u8 MapGridGetZCoordAt(int x, int y) +{ + u16 block; + int i; + u16 *border; + + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + block = gUnknown_03005DC0.map[x + gUnknown_03005DC0.width * y]; + } + else + { + border = gMapHeader.mapData->border; + i = (x + 1) & 1; + i += ((y + 1) & 1) * 2; + block = gMapHeader.mapData->border[i]; + block |= 0xc00; + } + + if (block == 0x3ff) + { + return 0; + } + + return block >> 12; +} + +u8 MapGridIsImpassableAt(int x, int y) +{ + u16 block; + int i; + u16 *border; + + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + block = gUnknown_03005DC0.map[x + gUnknown_03005DC0.width * y]; + } + else + { + border = gMapHeader.mapData->border; + i = (x + 1) & 1; + i += ((y + 1) & 1) * 2; + block = gMapHeader.mapData->border[i]; + block |= 0xc00; + } + if (block == 0x3ff) + { + return 1; + } + return (block & 0xc00) >> 10; +} + +u32 MapGridGetMetatileIdAt(int x, int y) +{ + u16 block; + int i; + int j; + struct MapData const *mapData; + u16 *border; + u16 block2; + + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + block = gUnknown_03005DC0.map[x + gUnknown_03005DC0.width * y]; + } + else + { + mapData = gMapHeader.mapData; + i = (x + 1) & 1; + i += ((y + 1) & 1) * 2; + block = mapData->border[i] | 0xc00; + } + if (block == 0x3ff) + { + border = gMapHeader.mapData->border; + j = (x + 1) & 1; + j += ((y + 1) & 1) * 2; + block2 = gMapHeader.mapData->border[j]; + block2 |= 0xc00; + return block2 & block; + } + return block & 0x3ff; +} + +u32 MapGridGetMetatileBehaviorAt(int x, int y) +{ + u16 metatile; + metatile = MapGridGetMetatileIdAt(x, y); + return GetBehaviorByMetatileId(metatile) & 0xff; +} + +u8 MapGridGetMetatileLayerTypeAt(int x, int y) +{ + u16 metatile; + metatile = MapGridGetMetatileIdAt(x, y); + return (GetBehaviorByMetatileId(metatile) & 0xf000) >> 12; +} + +void MapGridSetMetatileIdAt(int x, int y, u16 metatile) +{ + int i; + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + i = x + y * gUnknown_03005DC0.width; + gUnknown_03005DC0.map[i] = (gUnknown_03005DC0.map[i] & 0xf000) | (metatile & 0xfff); + } +} + +void MapGridSetMetatileEntryAt(int x, int y, u16 metatile) +{ + int i; + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + i = x + gUnknown_03005DC0.width * y; + gUnknown_03005DC0.map[i] = metatile; + } +} + +u16 GetBehaviorByMetatileId(u16 metatile) +{ + u16 *attributes; + if (metatile <= 0x1ff) + { + attributes = gMapHeader.mapData->primaryTileset->metatileAttributes; + return attributes[metatile]; + } + else if (metatile <= 0x3ff) + { + attributes = gMapHeader.mapData->secondaryTileset->metatileAttributes; + return attributes[metatile - 0x200]; + } + else + { + return 0xff; + } +} + +void save_serialize_map(void) +{ + int i, j; + int x, y; + u16 *mapView; + int width; + mapView = gSaveBlock1Ptr->mapView; + width = gUnknown_03005DC0.width; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y; + for (i = y; i < y + 14; i++) + { + for (j = x; j < x + 15; j++) + { + *mapView++ = gUnknown_02032318[width * i + j]; + } + } +} + +int sub_8088438(void) +{ + u16 i; + u32 r2; + r2 = 0; + for (i = 0; i < 0x200; i++) + { + r2 |= gSaveBlock1Ptr->mapView[i]; + } + if (r2 == 0) + { + return 1; + } + return 0; +} + +void sav2_mapdata_clear(void) +{ + CpuFill16(0, gSaveBlock1Ptr->mapView, sizeof(gSaveBlock1Ptr->mapView)); +} + +void mapdata_from_sav2(void) +{ + u8 a0; + int i, j; + int x, y; + u16 *mapView; + int width; + mapView = gSaveBlock1Ptr->mapView; + if (!sub_8088438()) + { + width = gUnknown_03005DC0.width; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y; + for (i = y; i < y + 14; i++) + { + if (i == y && i != 0) + a0 = 0; + else if (i == y + 13 && i != gMapHeader.mapData->height - 1) + a0 = 1; + else + a0 = -1; + + for (j = x; j < x + 15; j++) + { + if (!sub_8088BF0(&gUnknown_02032318[j + width * i], width, a0)) + gUnknown_02032318[j + width * i] = *mapView; + mapView++; + } + } + for (j = x; j < x + 15; j++) + { + if (y != 0) + sub_80D423C(j, y - 1); + if (i < gMapHeader.mapData->height - 1) + sub_80D42B8(j, y + 13); + } + sav2_mapdata_clear(); + } +} + +void sub_80885C4(u8 a1) +{ + int width; + u16 *mapView; + int x0, y0; + int x2, y2; + u16 *src, *dest; + int srci, desti; + int r9, r8; + int x, y; + int i, j; + mapView = gSaveBlock1Ptr->mapView; + width = gUnknown_03005DC0.width; + r9 = 0; + r8 = 0; + x0 = gSaveBlock1Ptr->pos.x; + y0 = gSaveBlock1Ptr->pos.y; + x2 = 15; + y2 = 14; + switch (a1) + { + case CONNECTION_NORTH: + y0 += 1; + y2 = 13; + break; + case CONNECTION_SOUTH: + r8 = 1; + y2 = 13; + break; + case CONNECTION_WEST: + x0 += 1; + x2 = 14; + break; + case CONNECTION_EAST: + r9 = 1; + x2 = 14; + break; + } + for (y = 0; y < y2; y++) + { + i = 0; + j = 0; + for (x = 0; x < x2; x++) + { + desti = width * (y + y0); + srci = (y + r8) * 15 + r9; + src = &mapView[srci + i]; + dest = &gUnknown_02032318[x0 + desti + j]; + *dest = *src; + i++; + j++; + } + } + sav2_mapdata_clear(); +} + +int GetMapBorderIdAt(int x, int y) +{ + struct MapData const *mapData; + u16 block, block2; + int i, j; + if (x >= 0 && x < gUnknown_03005DC0.width + && y >= 0 && y < gUnknown_03005DC0.height) + { + i = gUnknown_03005DC0.width; + i *= y; + block = gUnknown_03005DC0.map[x + i]; + if (block == 0x3ff) + { + goto fail; + } + } + else + { + mapData = gMapHeader.mapData; + j = (x + 1) & 1; + j += ((y + 1) & 1) * 2; + block2 = 0xc00 | mapData->border[j]; + if (block2 == 0x3ff) + { + goto fail; + } + } + goto success; +fail: + return -1; +success: + + if (x >= (gUnknown_03005DC0.width - 8)) + { + if (!gUnknown_02037340.east) + { + return -1; + } + return CONNECTION_EAST; + } + else if (x < 7) + { + if (!gUnknown_02037340.west) + { + return -1; + } + return CONNECTION_WEST; + } + else if (y >= (gUnknown_03005DC0.height - 7)) + { + if (!gUnknown_02037340.south) + { + return -1; + } + return CONNECTION_SOUTH; + } + else if (y < 7) + { + if (!gUnknown_02037340.north) + { + return -1; + } + return CONNECTION_NORTH; + } + else + { + return 0; + } +} + +int GetPostCameraMoveMapBorderId(int x, int y) +{ + return GetMapBorderIdAt(gSaveBlock1Ptr->pos.x + 7 + x, gSaveBlock1Ptr->pos.y + 7 + y); +} + +int CanCameraMoveInDirection(int direction) +{ + int x, y; + x = gSaveBlock1Ptr->pos.x + 7 + gUnknown_08339D64[direction].x; + y = gSaveBlock1Ptr->pos.y + 7 + gUnknown_08339D64[direction].y; + if (GetMapBorderIdAt(x, y) == -1) + { + return 0; + } + return 1; +} + +void sub_80887F8(struct MapConnection *connection, int direction, int x, int y) +{ + struct MapHeader const *mapHeader; + mapHeader = mapconnection_get_mapheader(connection); + switch (direction) + { + case CONNECTION_EAST: + gSaveBlock1Ptr->pos.x = -x; + gSaveBlock1Ptr->pos.y -= connection->offset; + break; + case CONNECTION_WEST: + gSaveBlock1Ptr->pos.x = mapHeader->mapData->width; + gSaveBlock1Ptr->pos.y -= connection->offset; + break; + case CONNECTION_SOUTH: + gSaveBlock1Ptr->pos.x -= connection->offset; + gSaveBlock1Ptr->pos.y = -y; + break; + case CONNECTION_NORTH: + gSaveBlock1Ptr->pos.x -= connection->offset; + gSaveBlock1Ptr->pos.y = mapHeader->mapData->height; + break; + } +} + +bool8 CameraMove(int x, int y) +{ + unsigned int direction; + struct MapConnection *connection; + int old_x, old_y; + gCamera.active = FALSE; + direction = GetPostCameraMoveMapBorderId(x, y); + if (direction + 1 <= 1) + { + gSaveBlock1Ptr->pos.x += x; + gSaveBlock1Ptr->pos.y += y; + } + else + { + save_serialize_map(); + sub_81BE72C(); + old_x = gSaveBlock1Ptr->pos.x; + old_y = gSaveBlock1Ptr->pos.y; + connection = sub_8088950(direction, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y); + sub_80887F8(connection, direction, x, y); + mliX_load_map(connection->mapGroup, connection->mapNum); + gCamera.active = TRUE; + gCamera.x = old_x - gSaveBlock1Ptr->pos.x; + gCamera.y = old_y - gSaveBlock1Ptr->pos.y; + gSaveBlock1Ptr->pos.x += x; + gSaveBlock1Ptr->pos.y += y; + sub_80885C4(direction); + } + return gCamera.active; +} + +struct MapConnection *sub_8088950(u8 direction, int x, int y) +{ + int count; + struct MapConnection *connection; + int i; + count = gMapHeader.connections->count; + connection = gMapHeader.connections->connections; + for (i = 0; i < count; i++, connection++) + { + if (connection->direction == direction && sub_80889A8(direction, x, y, connection) == TRUE) + return connection; + } + return NULL; +} + +bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection) +{ + struct MapHeader const *mapHeader; + mapHeader = mapconnection_get_mapheader(connection); + switch (direction) + { + case CONNECTION_SOUTH: + case CONNECTION_NORTH: + return sub_8088A0C(x, gMapHeader.mapData->width, mapHeader->mapData->width, connection->offset); + case CONNECTION_WEST: + case CONNECTION_EAST: + return sub_8088A0C(y, gMapHeader.mapData->height, mapHeader->mapData->height, connection->offset); + } + return FALSE; +} + +bool8 sub_8088A0C(int x, int src_width, int dest_width, int offset) +{ + int offset2; + offset2 = offset; + + if (offset2 < 0) + offset2 = 0; + + if (dest_width + offset < src_width) + src_width = dest_width + offset; + + if (offset2 <= x && x <= src_width) + return TRUE; + + return FALSE; +} + +int sub_8088A38(int x, int width) +{ + if (x >= 0 && x < width) + return TRUE; + + return FALSE; +} + +int sub_8088A4C(struct MapConnection *connection, int x, int y) +{ + struct MapHeader const *mapHeader; + mapHeader = mapconnection_get_mapheader(connection); + switch (connection->direction) + { + case CONNECTION_SOUTH: + case CONNECTION_NORTH: + return sub_8088A38(x - connection->offset, mapHeader->mapData->width); + case CONNECTION_WEST: + case CONNECTION_EAST: + return sub_8088A38(y - connection->offset, mapHeader->mapData->height); + } + return FALSE; +} + +struct MapConnection *sub_8088A8C(s16 x, s16 y) +{ + int count; + struct MapConnection *connection; + int i; + u8 direction; + if (!gMapHeader.connections) + { + return NULL; + } + else + { + count = gMapHeader.connections->count; + connection = gMapHeader.connections->connections; + for (i = 0; i < count; i++, connection++) + { + direction = connection->direction; + if ((direction == CONNECTION_DIVE || direction == CONNECTION_EMERGE) + || (direction == CONNECTION_NORTH && y > 6) + || (direction == CONNECTION_SOUTH && y < gMapHeader.mapData->height + 7) + || (direction == CONNECTION_WEST && x > 6) + || (direction == CONNECTION_EAST && x < gMapHeader.mapData->width + 7)) + { + continue; + } + if (sub_8088A4C(connection, x - 7, y - 7) == TRUE) + { + return connection; + } + } + } + return NULL; +} + +void sub_8088B3C(u16 x, u16 y) +{ + gSaveBlock1Ptr->pos.x = x - 7; + gSaveBlock1Ptr->pos.y = y - 7; +} + +void sav1_camera_get_focus_coords(u16 *x, u16 *y) +{ + *x = gSaveBlock1Ptr->pos.x + 7; + *y = gSaveBlock1Ptr->pos.y + 7; +} + +void SetCameraCoords(u16 x, u16 y) +{ + gSaveBlock1Ptr->pos.x = x; + gSaveBlock1Ptr->pos.y = y; +} + +void GetCameraCoords(u16 *x, u16 *y) +{ + *x = gSaveBlock1Ptr->pos.x; + *y = gSaveBlock1Ptr->pos.y; +} + +void sub_8088B94(int x, int y, int a2) +{ + if (x >= 0 && x < gUnknown_03005DC0.width && y >= 0 && y < gUnknown_03005DC0.height) + { + if (a2 != 0) + gUnknown_03005DC0.map[x + gUnknown_03005DC0.width * y] |= 0xC00; + else + gUnknown_03005DC0.map[x + gUnknown_03005DC0.width * y] &= 0xF3FF; + } +} + +bool8 sub_8088BF0(u16* a0, u16 a1, u8 a2) +{ + if (a2 == 0xFF) + return FALSE; + + if (a2 == 0) + a0 -= a1; + else + a0 += a1; + + if (sub_80FADE4(*a0 & 0x3FF, a2) == 1) + return TRUE; + return FALSE; +} + +void copy_tileset_patterns_to_vram(struct Tileset const *tileset, u16 numTiles, u16 offset) +{ + if (tileset) + { + if (!tileset->isCompressed) + LoadBgTiles(2, tileset->tiles, numTiles * 32, offset); + else + decompress_and_copy_tile_data_to_vram(2, tileset->tiles, numTiles * 32, offset, 0); + } +} + +void copy_tileset_patterns_to_vram2(struct Tileset const *tileset, u16 numTiles, u16 offset) +{ + if (tileset) + { + if (!tileset->isCompressed) + LoadBgTiles(2, tileset->tiles, numTiles * 32, offset); + else + copy_decompressed_tile_data_to_vram_autofree(2, tileset->tiles, numTiles * 32, offset, 0); + } +} + +void nullsub_3(u16 a0, u16 a1) +{ + +} + +void nullsub_90(void) +{ + +} + +void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u16 size) +{ + u16 black = RGB_BLACK; + + if (tileset) + { + if (tileset->isSecondary == FALSE) + { + LoadPalette(&black, destOffset, 2); + LoadPalette(((u16*)tileset->palettes) + 1, destOffset + 1, size - 2); + nullsub_3(destOffset + 1, (size - 2) >> 1); + } + else if (tileset->isSecondary == TRUE) + { + LoadPalette(((u16*)tileset->palettes) + 0x60, destOffset, size); + nullsub_3(destOffset, size >> 1); + } + else + { + LoadCompressedPalette((u16*)tileset->palettes, destOffset, size); + nullsub_3(destOffset, size >> 1); + } + } +} + +void copy_map_tileset1_to_vram(struct MapData const *mapData) +{ + copy_tileset_patterns_to_vram(mapData->primaryTileset, 0x200, 0); +} + +void copy_map_tileset2_to_vram(struct MapData const *mapData) +{ + copy_tileset_patterns_to_vram(mapData->secondaryTileset, 0x200, 0x200); +} + +void copy_map_tileset2_to_vram_2(struct MapData const *mapData) +{ + copy_tileset_patterns_to_vram2(mapData->secondaryTileset, 0x200, 0x200); +} + +void apply_map_tileset1_palette(struct MapData const *mapData) +{ + apply_map_tileset_palette(mapData->primaryTileset, 0, 0xC0); +} + +void apply_map_tileset2_palette(struct MapData const *mapData) +{ + apply_map_tileset_palette(mapData->secondaryTileset, 0x60, 0xE0); +} + +void copy_map_tileset1_tileset2_to_vram(struct MapData const *mapData) +{ + if (mapData) + { + copy_tileset_patterns_to_vram2(mapData->primaryTileset, 0x200, 0); + copy_tileset_patterns_to_vram2(mapData->secondaryTileset, 0x200, 0x200); + } +} + +void apply_map_tileset1_tileset2_palette(struct MapData const *mapData) +{ + if (mapData) + { + apply_map_tileset1_palette(mapData); + apply_map_tileset2_palette(mapData); + } +} diff --git a/src/overworld.c b/src/overworld.c index 532615f27..f42f0db7f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -137,7 +137,6 @@ extern void trainer_hill_map_load_related(void); extern void sub_8087D74(void); extern void battle_pyramid_map_load_related(u8); extern void sub_80B00E8(u8); -extern void UpdateTVScreensOnMap(u32, u32); extern void sub_80E9238(u8); extern void sub_81A3908(void); extern void sub_81AA2F8(void); @@ -614,12 +613,12 @@ bool32 warp_data_is_not_neg_1(struct WarpData *warp) return TRUE; } -const struct MapHeader *Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum) +struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum) { return gMapGroups[mapGroup][mapNum]; } -const struct MapHeader *warp1_get_mapheader(void) +struct MapHeader const *const warp1_get_mapheader(void) { return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); } diff --git a/src/secret_base.c b/src/secret_base.c index c886912f4..cd6143ed0 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -327,7 +327,7 @@ void sub_80E8E18(void) VarSet(VAR_SECRET_BASE_MAP, gMapHeader.regionMapSectionId); } -void sub_80E8EE0(struct MapEvents *events) +void sub_80E8EE0(struct MapEvents const *events) { u16 bgEventIndex; u16 i; diff --git a/sym_common.txt b/sym_common.txt index b0548a84c..ff7dcc7b6 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -55,17 +55,8 @@ gUnknown_03005DB4: @ 3005DB4 gFieldLinkPlayerCount: @ 3005DB8 .space 0x8 -gUnknown_03005DC0: @ 3005DC0 - .space 0x10 - -gUnknown_03005DD0: @ 3005DD0 - .space 0x18 - -gUnknown_03005DE8: @ 3005DE8 - .space 0x4 - -gUnknown_03005DEC: @ 3005DEC - .space 0x4 + .include "fieldmap.o" + .include "field_camera.o" gSelectedMapObject: @ 3005DF0 .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 9bf04d201..f860e63c7 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -209,22 +209,10 @@ gUnknown_020322D5: @ 20322D5 .space 0x3 .include "src/overworld.o" + .include "src/fieldmap.o" + .include "src/field_camera.o" -gUnknown_02032318: @ 2032318 - .space 0x5000 - -gMapHeader: @ 2037318 - .space 0x1C - -gCamera: @ 2037334 - .space 0xC - -gUnknown_02037340: @ 2037340 - .space 0x8 - -gUnusedBikeCameraAheadPanback: @ 2037348 - .space 0x4 - + .align 2 gUnknown_0203734C: @ 203734C .space 0x4