diff --git a/asm/cable_car.s b/asm/cable_car.s deleted file mode 100644 index 96bc91a41..000000000 --- a/asm/cable_car.s +++ /dev/null @@ -1,2882 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_814FC70 -sub_814FC70: @ 814FC70 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814FC8E - ldr r0, =sub_814FCC8 - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask -_0814FC8E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814FC70 - - thumb_func_start sub_814FC9C -sub_814FC9C: @ 814FC9C - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - ldr r0, =sub_814FC70 - movs r1, 0x1 - bl CreateTask - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_814FC9C - - thumb_func_start sub_814FCC8 -sub_814FCC8: @ 814FCC8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - movs r4, 0 - str r4, [sp, 0x14] - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0x9 - bhi _0814FD20 - lsls r0, 2 - ldr r1, =_0814FCF8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0814FCF8: - .4byte _0814FD20 - .4byte _0814FDD8 - .4byte _0814FE90 - .4byte _0814FF50 - .4byte _0814FF7C - .4byte _0814FF98 - .4byte _0814FFF8 - .4byte _08150090 - .4byte _08150190 - .4byte _081501C8 -_0814FD20: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl sub_8150B6C - bl ScanlineEffect_Stop - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0x10 - mov r9, r0 - add r2, sp, 0xC - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r8, r0 -_0814FD4E: - strh r6, [r2] - add r0, sp, 0xC - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _0814FD4E - strh r6, [r2] - add r2, sp, 0xC - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r3, r8 - orrs r0, r3 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x10] - ldr r2, =0x040000d4 - mov r1, r9 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - add r0, sp, 0xC - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - ldr r4, =gUnknown_0203ABAC - ldr r0, =0x00004110 - bl AllocZeroed - str r0, [r4] - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FDD8: - bl ResetSpriteData - bl ResetTasks - bl FreeAllSpritePalettes - bl ResetPaletteFade - bl reset_temp_tile_data_buffers - bl StartWeather - movs r4, 0 - ldr r0, =gWeatherPtr - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xF0 - movs r2, 0 -_0814FDFC: - lsls r0, r4, 2 - adds r0, r1, r0 - str r2, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _0814FDFC - bl InitMapMusic - bl ResetMapMusic - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085CD66C - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r4, =gUnknown_0203ABAC - ldr r1, [r4] - adds r1, 0xFC - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r3, =0x000010fc - adds r1, r3 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x000020fc - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r2, =0x000030fc - adds r1, r2 - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r2, =gSpriteCoordOffsetX - ldr r1, =gSpriteCoordOffsetY - movs r0, 0 - strh r0, [r1] - strh r0, [r2] - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FE90: - movs r4, 0 - add r5, sp, 0x14 - ldr r6, =gUnknown_085CDB54 -_0814FE96: - lsls r0, r4, 3 - adds r0, r6 - bl LoadCompressedObjectPic - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _0814FE96 - ldr r0, =gUnknown_085CDB74 - bl LoadSpritePalettes - ldr r0, =gCableCarMtChimneyTilemap - adds r1, r5, 0 - bl malloc_and_decompress - ldr r4, =gUnknown_0203ABAC - ldr r1, [r4] - ldr r2, =0x000040fc - adds r1, r2 - str r0, [r1] - ldr r0, =gCableCarTreeTilemap - adds r1, r5, 0 - bl malloc_and_decompress - ldr r1, [r4] - movs r3, 0x82 - lsls r3, 7 - adds r1, r3 - str r0, [r1] - ldr r0, =gCableCarMountainTilemap - adds r1, r5, 0 - bl malloc_and_decompress - ldr r1, [r4] - ldr r2, =0x00004104 - adds r1, r2 - str r0, [r1] - ldr r0, =gCableCarPylonStemTilemap - adds r1, r5, 0 - bl malloc_and_decompress - ldr r1, [r4] - ldr r3, =0x0000410c - adds r2, r1, r3 - str r0, [r2] - ldr r0, =0x00004108 - adds r1, r0 - ldr r0, =gCableCarPylonHookTilemapEntries - str r0, [r1] - ldr r1, =gUnknown_08DBA5B8 - movs r0, 0 - str r0, [sp] - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FF50: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _0814FF5C - b _08150226 -_0814FF5C: - ldr r0, =gUnknown_08DBA518 - movs r1, 0 - movs r2, 0x80 - bl LoadPalette - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FF7C: - bl sub_8150D28 - bl RunTasks - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FF98: - ldr r0, =gUnknown_0203ABAC - ldr r0, [r0] - ldrb r0, [r0, 0x2] - cmp r0, 0x7 - bne _0814FFB4 - movs r2, 0x87 - lsls r2, 3 - adds r1, r6, r2 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FFB4: - ldr r0, =gWeatherPtr - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xF0 - ldr r0, [r1] - cmp r0, 0 - bne _0814FFC4 - b _08150226 -_0814FFC4: - movs r4, 0 - adds r3, r1, 0 - movs r5, 0xD - negs r5, r5 -_0814FFCC: - lsls r0, r4, 2 - adds r0, r3, r0 - ldr r2, [r0] - cmp r2, 0 - beq _0814FFDE - ldrb r1, [r2, 0x5] - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2, 0x5] -_0814FFDE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _0814FFCC - movs r3, 0x87 - lsls r3, 3 - adds r1, r6, r3 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_0814FFF8: - ldr r6, =gUnknown_0203ABAC - ldr r0, [r6] - movs r1, 0x82 - lsls r1, 7 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x20 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r0, 0x1 - movs r2, 0 - movs r3, 0x11 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r0, [r6] - ldr r2, =0x00004104 - adds r0, r2 - ldr r1, [r0] - movs r0, 0x1E - str r0, [sp] - movs r3, 0x14 - mov r8, r3 - str r3, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r0, [r6] - ldr r1, =0x00004108 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x5 - str r0, [sp] - movs r4, 0x2 - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r0, [r6] - ldr r2, =0x0000410c - adds r0, r2 - ldr r1, [r0] - str r4, [sp] - mov r3, r8 - str r3, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x2 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_08150090: - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - bl sub_81514C8 - ldr r1, =gUnknown_0203ABAC - mov r9, r1 - ldr r0, [r1] - ldr r2, =0x000040fc - mov r8, r2 - add r0, r8 - ldr r1, [r0] - adds r1, 0x90 - movs r6, 0xC - str r6, [sp] - movs r5, 0x3 - str r5, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0 - movs r3, 0xE - bl CopyToBgTilemapBufferRect_ChangePalette - mov r3, r9 - ldr r0, [r3] - add r0, r8 - ldr r1, [r0] - adds r1, 0xD8 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0xC - movs r3, 0x11 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r1, r9 - ldr r0, [r1] - add r0, r8 - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - adds r1, r2 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x18 - movs r3, 0x14 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r3, r9 - ldr r0, [r3] - add r0, r8 - ldr r1, [r0] - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0 - movs r3, 0x11 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r1, r9 - ldr r0, [r1] - add r0, r8 - ldr r1, [r0] - adds r1, 0x48 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0 - movs r3, 0x14 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r2, r9 - ldr r0, [r2] - add r0, r8 - ldr r1, [r0] - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0xC - movs r3, 0x14 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r3, r9 - ldr r0, [r3] - add r0, r8 - ldr r1, [r0] - adds r1, 0x48 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0xC - movs r3, 0x17 - bl CopyToBgTilemapBufferRect_ChangePalette - mov r1, r9 - ldr r0, [r1] - add r0, r8 - ldr r1, [r0] - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x18 - movs r3, 0x17 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_08150190: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x3 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =0x000001a9 - movs r1, 0x1 - bl FadeInNewBGM - movs r0, 0x1 - bl sub_8150B6C - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - b _08150224 - .pool -_081501C8: - ldr r3, =0x04000208 - ldrh r2, [r3] - movs r0, 0 - strh r0, [r3] - ldr r4, =0x04000200 - ldrh r0, [r4] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r4] - strh r2, [r3] - ldr r0, =sub_8150800 - bl SetVBlankCallback - ldr r0, =mainloop - bl SetMainCallback2 - ldr r0, =sub_81503E4 - movs r1, 0 - bl CreateTask - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08150218 - ldr r0, =sub_8150550 - b _0815021A - .pool -_08150218: - ldr r0, =sub_8150664 -_0815021A: - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_0203ABAC - ldr r1, [r1] -_08150224: - strb r0, [r1] -_08150226: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814FCC8 - - thumb_func_start mainloop -mainloop: @ 815023C - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - bl MapMusicMain - pop {r0} - bx r0 - thumb_func_end mainloop - - thumb_func_start c2_8011A1C -c2_8011A1C: @ 8150258 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - movs r4, 0 - movs r0, 0 - bl HideBg - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - movs r0, 0x3 - bl HideBg - movs r0, 0 - bl sub_8150B6C - ldr r0, =gSpriteCoordOffsetX - strh r4, [r0] - movs r0, 0 - bl sub_80AB130 - add r0, sp, 0x4 - mov r8, r0 - ldr r0, =gWeatherPtr - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xF0 - movs r2, 0 -_08150298: - lsls r0, r4, 2 - adds r0, r1, r0 - str r2, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _08150298 - bl ResetTasks - bl ResetSpriteData - bl ResetPaletteFade - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x3 - bl UnsetBgTilemapBuffer - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r6, =gUnknown_0203ABAC - ldr r0, [r6] - ldr r2, =0x00004108 - adds r1, r0, r2 - movs r5, 0 - str r5, [r1] - ldr r4, =0x0000410c - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r6] - adds r4, r0, r4 - str r5, [r4] - ldr r4, =0x00004104 - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r6] - adds r4, r0, r4 - str r5, [r4] - movs r4, 0x82 - lsls r4, 7 - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r6] - adds r4, r0, r4 - str r5, [r4] - ldr r4, =0x000040fc - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r6] - adds r4, r0, r4 - str r5, [r4] - bl Free - str r5, [r6] - movs r2, 0xC0 - lsls r2, 19 - movs r3, 0xC0 - lsls r3, 9 - mov r4, sp - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_08150340: - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r2, r5 - subs r3, r5 - cmp r3, r5 - bhi _08150340 - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - lsrs r0, r3, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x4] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - mov r0, sp - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - bl WarpIntoMap - ldr r0, =gFieldCallback - str r4, [r0] - ldr r0, =CB2_LoadMap - bl SetMainCallback2 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c2_8011A1C - - thumb_func_start sub_81503E4 -sub_81503E4: @ 81503E4 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - ldr r5, =gUnknown_0203ABAC - ldr r3, [r5] - ldrh r0, [r3, 0x6] - adds r0, 0x1 - strh r0, [r3, 0x6] - ldrb r2, [r3, 0x1] - adds r7, r5, 0 - cmp r2, 0x2 - beq _081504EA - cmp r2, 0x2 - bgt _08150414 - cmp r2, 0 - beq _08150422 - cmp r2, 0x1 - beq _0815043C - b _08150542 - .pool -_08150414: - cmp r2, 0x3 - bne _0815041A - b _08150510 -_0815041A: - cmp r2, 0xFF - bne _08150420 - b _08150528 -_08150420: - b _08150542 -_08150422: - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r3, 0x4] - cmp r0, r1 - beq _0815042E - b _08150542 -_0815042E: - ldrb r0, [r3, 0x2] - bl ChangeWeather - ldr r1, [r5] - movs r0, 0x1 - strb r0, [r1, 0x1] - b _08150542 -_0815043C: - ldrb r0, [r3, 0x2] - cmp r0, 0x2 - beq _08150490 - cmp r0, 0x7 - beq _08150448 - b _08150542 -_08150448: - ldr r0, =gWeatherPtr - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0xF0 - ldr r0, [r2] - cmp r0, 0 - beq _08150542 - ldrb r1, [r0, 0x5] - movs r0, 0xC - ands r0, r1 - cmp r0, 0 - beq _08150542 - adds r3, r2, 0 - movs r5, 0xD - negs r5, r5 -_08150466: - lsls r0, r4, 2 - adds r0, r3, r0 - ldr r2, [r0] - cmp r2, 0 - beq _08150478 - ldrb r1, [r2, 0x5] - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2, 0x5] -_08150478: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _08150466 - ldr r1, [r7] - movs r0, 0x2 - strb r0, [r1, 0x1] - b _08150542 - .pool -_08150490: - ldr r0, =gWeatherPtr - ldr r2, [r0] - movs r1, 0xDA - lsls r1, 3 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _081504A8 - strb r0, [r3, 0x1] - b _08150542 - .pool -_081504A8: - ldrh r1, [r3, 0x6] - ldrh r0, [r3, 0x4] - adds r0, 0x8 - cmp r1, r0 - blt _08150542 - adds r6, r2, 0 - adds r6, 0xF0 - movs r5, 0x1 - movs r7, 0x5 - negs r7, r7 -_081504BC: - lsls r0, r4, 2 - adds r0, r6, r0 - ldr r0, [r0] - cmp r0, 0 - beq _081504DE - adds r3, r0, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r1, r2, 29 - lsrs r1, 31 - eors r1, r5 - ands r1, r5 - lsls r1, 2 - adds r0, r7, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_081504DE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _081504BC - b _08150542 -_081504EA: - lsls r1, r0, 16 - ldr r0, =0x023a0000 - cmp r1, r0 - bne _08150542 - movs r0, 0x3 - strb r0, [r3, 0x1] - subs r0, 0x4 - str r4, [sp] - movs r1, 0x3 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x4 - bl FadeOutBGM - b _08150542 - .pool -_08150510: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08150542 - movs r0, 0xFF - strb r0, [r3, 0x1] - b _08150542 - .pool -_08150528: - movs r0, 0 - bl SetVBlankCallback - adds r0, r6, 0 - bl DestroyTask - ldr r0, [r5] - ldrb r0, [r0] - bl DestroyTask - ldr r0, =c2_8011A1C - bl SetMainCallback2 -_08150542: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81503E4 - - thumb_func_start sub_8150550 -sub_8150550: @ 8150550 - push {r4-r6,lr} - sub sp, 0xC - ldr r6, =gUnknown_0203ABAC - ldr r1, [r6] - ldrb r0, [r1, 0x1] - cmp r0, 0xFF - beq _08150630 - ldrb r0, [r1, 0x14] - subs r0, 0x1 - strb r0, [r1, 0x14] - ldr r1, [r6] - ldrh r0, [r1, 0x6] - movs r3, 0x1 - ands r0, r3 - cmp r0, 0 - bne _08150576 - ldrb r0, [r1, 0x15] - subs r0, 0x1 - strb r0, [r1, 0x15] -_08150576: - ldr r2, [r6] - ldrh r0, [r2, 0x6] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08150590 - ldrb r0, [r2, 0xC] - subs r0, 0x1 - strb r0, [r2, 0xC] - ldr r1, [r6] - ldrb r0, [r1, 0xD] - subs r0, 0x1 - strb r0, [r1, 0xD] -_08150590: - ldr r0, [r6] - ldrb r1, [r0, 0x14] - cmp r1, 0x20 - beq _081505DC - cmp r1, 0x20 - bgt _081505A8 - cmp r1, 0x10 - beq _081505F4 - b _08150630 - .pool -_081505A8: - cmp r1, 0x28 - beq _081505CA - cmp r1, 0xAF - bne _08150630 - movs r0, 0x2 - str r0, [sp] - movs r0, 0xA - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0x16 - bl FillBgTilemapBufferRect - b _08150630 -_081505CA: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0 - movs r2, 0x3 - b _081505EC -_081505DC: - str r3, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0 - movs r2, 0x2 -_081505EC: - movs r3, 0 - bl FillBgTilemapBufferRect - b _08150630 -_081505F4: - ldr r1, =0x00004108 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x5 - str r0, [sp] - movs r4, 0x2 - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r0, [r6] - ldr r1, =0x0000410c - adds r0, r1 - ldr r1, [r0] - str r4, [sp] - movs r0, 0x1E - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x2 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, [r6] - movs r0, 0x40 - strb r0, [r1, 0x15] -_08150630: - bl sub_815115C - ldr r3, =gSpriteCoordOffsetX - movs r0, 0 - ldrsh r2, [r3, r0] - adds r1, r2, 0x1 - adds r0, r1, 0 - cmp r1, 0 - bge _08150646 - adds r0, r2, 0 - adds r0, 0x80 -_08150646: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - strh r0, [r3] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150550 - - thumb_func_start sub_8150664 -sub_8150664: @ 8150664 - push {r4-r7,lr} - sub sp, 0xC - ldr r7, =gUnknown_0203ABAC - ldr r1, [r7] - ldrb r0, [r1, 0x1] - cmp r0, 0xFF - bne _08150674 - b _081507B6 -_08150674: - ldrb r0, [r1, 0x14] - adds r0, 0x1 - strb r0, [r1, 0x14] - ldr r1, [r7] - ldrh r0, [r1, 0x6] - movs r6, 0x1 - ands r0, r6 - cmp r0, 0 - bne _0815068C - ldrb r0, [r1, 0x15] - adds r0, 0x1 - strb r0, [r1, 0x15] -_0815068C: - ldr r2, [r7] - ldrh r0, [r2, 0x6] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _081506A6 - ldrb r0, [r2, 0xC] - adds r0, 0x1 - strb r0, [r2, 0xC] - ldr r1, [r7] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] -_081506A6: - ldr r0, [r7] - ldrb r1, [r0, 0x14] - cmp r1, 0x20 - beq _0815071A - cmp r1, 0x20 - bgt _081506BC - cmp r1, 0x10 - beq _081506E8 - b _081507B6 - .pool -_081506BC: - cmp r1, 0x28 - beq _08150784 - cmp r1, 0xB0 - bne _081507B6 - ldr r1, =0x0000410c - adds r0, r1 - ldr r1, [r0] - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1E - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x2 - bl CopyToBgTilemapBufferRect_ChangePalette - b _081507B6 - .pool -_081506E8: - movs r0, 0x3 - str r0, [sp] - movs r4, 0x2 - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r1, 0 - movs r2, 0x2 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - movs r0, 0xA - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0x16 - bl FillBgTilemapBufferRect - ldr r1, [r7] - movs r0, 0xC0 - strb r0, [r1, 0x15] - b _081507B6 -_0815071A: - ldr r5, =0x00004108 - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0x4] - str r6, [sp] - str r6, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x2 - movs r3, 0 - bl FillBgTilemapBufferRect - ldr r0, [r7] - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0x6] - str r6, [sp] - str r6, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x3 - movs r3, 0 - bl FillBgTilemapBufferRect - ldr r0, [r7] - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0xE] - str r6, [sp] - str r6, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x2 - movs r3, 0x1 - bl FillBgTilemapBufferRect - ldr r0, [r7] - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0x10] - str r6, [sp] - str r6, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x3 - movs r3, 0x1 - bl FillBgTilemapBufferRect - b _081507B6 - .pool -_08150784: - ldr r5, =0x00004108 - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0x8] - str r6, [sp] - str r6, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x4 - movs r3, 0 - bl FillBgTilemapBufferRect - ldr r0, [r7] - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0, 0x12] - str r6, [sp] - str r6, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r2, 0x4 - movs r3, 0x1 - bl FillBgTilemapBufferRect -_081507B6: - bl sub_81511B8 - ldr r0, =gUnknown_0203ABAC - ldr r1, [r0] - ldrh r0, [r1, 0x6] - ldrh r1, [r1, 0x4] - cmp r0, r1 - bcs _081507DC - ldr r4, =gSpriteCoordOffsetX - movs r1, 0 - ldrsh r0, [r4, r1] - b _081507E6 - .pool -_081507DC: - ldr r0, =gWeatherPtr - ldr r4, [r0] - ldr r0, =0x000006fc - adds r4, r0 - ldrh r0, [r4] -_081507E6: - adds r0, 0xF7 - movs r1, 0xF8 - bl __modsi3 - strh r0, [r4] - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150664 - - thumb_func_start sub_8150800 -sub_8150800: @ 8150800 - push {r4,lr} - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r4, =gUnknown_0203ABAC - ldr r0, [r4] - ldrb r1, [r0, 0x14] - movs r0, 0x1C - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x15] - movs r0, 0x1E - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0xC] - movs r0, 0x14 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0xD] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x8] - movs r0, 0x10 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x9] - movs r0, 0x12 - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150800 - - thumb_func_start nullsub_58 -nullsub_58: @ 8150864 - bx lr - thumb_func_end nullsub_58 - - thumb_func_start sub_8150868 -sub_8150868: @ 8150868 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gUnknown_0203ABAC - ldr r6, [r0] - ldrb r0, [r6, 0x1] - cmp r0, 0xFF - beq _08150934 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _081508E4 - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _08150892 - ldr r1, =0x47800000 - bl __addsf3 -_08150892: - ldr r1, =0x3e0f5c29 - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x2E] - subs r1, r0 - strh r1, [r5, 0x20] - movs r1, 0x6 - ldrsh r4, [r6, r1] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _081508BA - ldr r1, =0x47800000 - bl __addsf3 -_081508BA: - ldr r1, =0x3d89374c - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x30] - subs r1, r0 - strh r1, [r5, 0x22] - b _08150934 - .pool -_081508E4: - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _081508F8 - ldr r1, =0x47800000 - bl __addsf3 -_081508F8: - ldr r1, =0x3e0f5c29 - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x2E] - adds r0, r1 - strh r0, [r5, 0x20] - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _08150920 - ldr r1, =0x47800000 - bl __addsf3 -_08150920: - ldr r1, =0x3d89374c - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x30] - adds r0, r1 - strh r0, [r5, 0x22] -_08150934: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150868 - - thumb_func_start sub_8150948 -sub_8150948: @ 8150948 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gUnknown_0203ABAC - ldr r6, [r0] - ldrb r0, [r6, 0x1] - cmp r0, 0xFF - bne _08150958 - b _08150A60 -_08150958: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _081509C8 - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _08150974 - ldr r1, =0x47800000 - bl __addsf3 -_08150974: - ldr r1, =0x3e0f5c29 - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x2E] - subs r1, r0 - strh r1, [r5, 0x20] - movs r1, 0x6 - ldrsh r4, [r6, r1] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _0815099C - ldr r1, =0x47800000 - bl __addsf3 -_0815099C: - ldr r1, =0x3d89374c - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x30] - subs r1, r0 - strh r1, [r5, 0x22] - b _08150A18 - .pool -_081509C8: - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _081509DC - ldr r1, =0x47800000 - bl __addsf3 -_081509DC: - ldr r1, =0x3e0f5c29 - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x2E] - adds r0, r1 - strh r0, [r5, 0x20] - movs r0, 0x6 - ldrsh r4, [r6, r0] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _08150A04 - ldr r1, =0x47800000 - bl __addsf3 -_08150A04: - ldr r1, =0x3d89374c - bl __mulsf3 - bl __fixunssfsi - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x30] - adds r0, r1 - strh r0, [r5, 0x22] -_08150A18: - movs r0, 0x32 - ldrsh r2, [r5, r0] - cmp r2, 0 - bne _08150A48 - movs r0, 0x11 - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x34] - adds r1, r0, 0x1 - strh r1, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x9 - ble _08150A60 - strh r2, [r5, 0x34] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - b _08150A60 - .pool -_08150A48: - movs r2, 0 - movs r0, 0x10 - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x34] - adds r1, r0, 0x1 - strh r1, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x9 - ble _08150A60 - strh r2, [r5, 0x34] - strh r2, [r5, 0x32] -_08150A60: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8150948 - - thumb_func_start sub_8150A68 -sub_8150A68: @ 8150A68 - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _08150A98 - adds r0, r2, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 1 - ldrh r3, [r2, 0x20] - adds r0, r3 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x22] - adds r1, 0x10 - adds r0, r2, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - strh r0, [r2, 0x22] -_08150A98: - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x32 - ldrsh r1, [r2, r3] - cmp r0, r1 - blt _08150AEE - movs r0, 0x30 - ldrsh r1, [r2, r0] - cmp r1, 0 - beq _08150AB8 - cmp r1, 0x1 - beq _08150AC2 - b _08150AE0 -_08150AB8: - ldrh r0, [r2, 0x20] - adds r0, 0x1 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x2E] - b _08150AD2 -_08150AC2: - ldrh r0, [r2, 0x2E] - ands r0, r1 - cmp r0, 0 - beq _08150AE0 - ldrh r0, [r2, 0x20] - adds r0, 0x1 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x20] -_08150AD2: - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08150AE0 - ldrh r0, [r2, 0x22] - adds r0, 0x1 - strh r0, [r2, 0x22] -_08150AE0: - movs r1, 0x22 - ldrsh r0, [r2, r1] - cmp r0, 0xA0 - ble _08150AEE - adds r0, r2, 0 - bl DestroySprite -_08150AEE: - pop {r0} - bx r0 - thumb_func_end sub_8150A68 - - thumb_func_start sub_8150AF4 -sub_8150AF4: @ 8150AF4 - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _08150B12 - ldrh r1, [r2, 0x22] - adds r1, 0x10 - adds r0, r2, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - strh r0, [r2, 0x22] -_08150B12: - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x32 - ldrsh r1, [r2, r3] - cmp r0, r1 - blt _08150B68 - movs r0, 0x30 - ldrsh r1, [r2, r0] - cmp r1, 0 - beq _08150B32 - cmp r1, 0x1 - beq _08150B3C - b _08150B5A -_08150B32: - ldrh r0, [r2, 0x20] - subs r0, 0x1 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x2E] - b _08150B4C -_08150B3C: - ldrh r0, [r2, 0x2E] - ands r0, r1 - cmp r0, 0 - beq _08150B5A - ldrh r0, [r2, 0x20] - subs r0, 0x1 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x20] -_08150B4C: - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08150B5A - ldrh r0, [r2, 0x22] - subs r0, 0x1 - strh r0, [r2, 0x22] -_08150B5A: - movs r1, 0x22 - ldrsh r0, [r2, r1] - cmp r0, 0x4F - bgt _08150B68 - adds r0, r2, 0 - bl DestroySprite -_08150B68: - pop {r0} - bx r0 - thumb_func_end sub_8150AF4 - - thumb_func_start sub_8150B6C -sub_8150B6C: @ 8150B6C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08150B7A - cmp r0, 0x1 - beq _08150C1C -_08150B7A: - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0xE - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1C - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - b _08150D1C -_08150C1C: - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - ldr r0, =gSpecialVar_0x8004 - ldrh r3, [r0] - cmp r3, 0 - bne _08150C74 - ldr r1, =gUnknown_0203ABAC - ldr r2, [r1] - movs r0, 0xB0 - strb r0, [r2, 0x14] - ldr r2, [r1] - movs r0, 0x10 - strb r0, [r2, 0x15] - ldr r0, [r1] - strb r3, [r0, 0xC] - ldr r2, [r1] - movs r0, 0x50 - b _08150C8C - .pool -_08150C74: - ldr r1, =gUnknown_0203ABAC - ldr r2, [r1] - movs r3, 0 - movs r0, 0x60 - strb r0, [r2, 0x14] - ldr r2, [r1] - movs r0, 0xE8 - strb r0, [r2, 0x15] - ldr r0, [r1] - strb r3, [r0, 0xC] - ldr r2, [r1] - movs r0, 0x4 -_08150C8C: - strb r0, [r2, 0xD] - ldr r0, [r1] - strb r3, [r0, 0x9] - ldr r0, [r1] - strb r3, [r0, 0x9] - adds r4, r1, 0 - ldr r0, [r4] - ldrb r1, [r0, 0x14] - movs r0, 0x1C - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x15] - movs r0, 0x1E - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0xC] - movs r0, 0x14 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0xD] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x8] - movs r0, 0x10 - bl SetGpuReg - ldr r0, [r4] - ldrb r1, [r0, 0x9] - movs r0, 0x12 - bl SetGpuReg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r1, 0xFC - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg -_08150D1C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150B6C - - thumb_func_start sub_8150D28 -sub_8150D28: @ 8150D28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - ldr r1, =gCableCarPlayerGraphicsIDs - add r0, sp, 0xC - movs r2, 0x2 - bl memcpy - bl Random - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - add r6, sp, 0x10 - ldr r1, =gMtChimneyHikerGraphicsIDs - adds r0, r6, 0 - movs r2, 0x4 - bl memcpy - add r5, sp, 0x14 - ldr r1, =gMtChimneyHikerCoords - adds r0, r5, 0 - movs r2, 0x8 - bl memcpy - add r4, sp, 0x1C - ldr r1, =gMtChimneyHikerMovementDelayTable - adds r0, r4, 0 - movs r2, 0x4 - bl memcpy - ldr r0, =gUnknown_085CDBF8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x20] - str r1, [sp, 0x24] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - mov r8, r6 - mov r10, r5 - cmp r0, 0 - beq _08150D86 - cmp r0, 0x1 - beq _08150E68 -_08150D86: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - add r0, sp - adds r0, 0xC - ldrb r0, [r0] - ldr r1, =sub_8150948 - movs r2, 0x66 - str r2, [sp] - movs r2, 0xC8 - movs r3, 0x49 - bl AddPseudoEventObject - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08150DD0 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x8 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r0, 0x8 - strh r0, [r1, 0x24] - movs r0, 0x10 - strh r0, [r1, 0x26] - movs r0, 0xC8 - strh r0, [r1, 0x2E] - movs r0, 0x49 - strh r0, [r1, 0x30] -_08150DD0: - ldr r4, =gSpriteTemplate_85CDB9C - adds r0, r4, 0 - movs r1, 0xB0 - movs r2, 0x2B - movs r3, 0x67 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gSprites - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - movs r1, 0x20 - strh r1, [r0, 0x26] - strh r1, [r0, 0x24] - movs r1, 0xB0 - strh r1, [r0, 0x2E] - movs r1, 0x2B - strh r1, [r0, 0x30] - adds r4, 0x18 - adds r0, r4, 0 - movs r1, 0xC8 - movs r2, 0x63 - movs r3, 0x65 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8 - strh r1, [r0, 0x24] - movs r1, 0x4 - strh r1, [r0, 0x26] - movs r1, 0xC8 - strh r1, [r0, 0x2E] - movs r1, 0x63 - strh r1, [r0, 0x30] - ldr r2, =gUnknown_0203ABAC - ldr r1, [r2] - movs r0, 0x7 - strb r0, [r1, 0x2] - ldr r1, [r2] - movs r0, 0xAF - lsls r0, 1 - strh r0, [r1, 0x4] - movs r0, 0x2 - bl sub_80AB130 - b _08150F3A - .pool -_08150E68: - ldr r7, =gUnknown_0203ABAC - ldr r0, [r7] - ldr r1, =0x000040fc - adds r0, r1 - ldr r1, [r0] - adds r1, 0x48 - movs r0, 0xC - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r2, 0x18 - movs r3, 0x1A - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - add r0, sp - adds r0, 0xC - ldrb r0, [r0] - ldr r1, =sub_8150948 - movs r2, 0x66 - str r2, [sp] - movs r2, 0x80 - movs r3, 0x27 - bl AddPseudoEventObject - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08150ED4 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x8 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r0, 0x8 - strh r0, [r1, 0x24] - movs r0, 0x10 - strh r0, [r1, 0x26] - movs r0, 0x80 - strh r0, [r1, 0x2E] - movs r0, 0x27 - strh r0, [r1, 0x30] -_08150ED4: - ldr r4, =gSpriteTemplate_85CDB9C - adds r0, r4, 0 - movs r1, 0x68 - movs r2, 0x9 - movs r3, 0x67 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gSprites - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - movs r1, 0x20 - strh r1, [r0, 0x26] - strh r1, [r0, 0x24] - movs r1, 0x68 - strh r1, [r0, 0x2E] - movs r1, 0x9 - strh r1, [r0, 0x30] - adds r4, 0x18 - adds r0, r4, 0 - movs r1, 0x80 - movs r2, 0x41 - movs r3, 0x65 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8 - strh r1, [r0, 0x24] - movs r1, 0x4 - strh r1, [r0, 0x26] - movs r1, 0x80 - strh r1, [r0, 0x2E] - movs r1, 0x41 - strh r1, [r0, 0x30] - ldr r1, [r7] - movs r0, 0x2 - strb r0, [r1, 0x2] - ldr r1, [r7] - ldr r0, =0x00000109 - strh r0, [r1, 0x4] - movs r0, 0x7 - bl sub_80AB130 -_08150F3A: - movs r4, 0 - ldr r5, =gSprites -_08150F3E: - lsls r1, r4, 20 - movs r2, 0xC0 - lsls r2, 15 - adds r1, r2 - asrs r1, 16 - lsls r2, r4, 19 - ldr r3, =0xfff80000 - adds r2, r3 - asrs r2, 16 - ldr r0, =gSpriteTemplate_85CDBCC - movs r3, 0x68 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8 - strh r1, [r0, 0x24] - strh r1, [r0, 0x26] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x8 - bls _08150F3E - movs r0, 0x3F - mov r4, r9 - ands r0, r4 - cmp r0, 0 - bne _08151074 - mov r0, r9 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - add r0, r8 - ldrb r0, [r0] - ldr r5, =gSpecialVar_0x8004 - ldrh r4, [r5] - lsls r4, 2 - add r1, sp, 0x20 - adds r1, r4, r1 - ldr r1, [r1] - mov r3, r10 - adds r2, r3, r4 - movs r3, 0 - ldrsh r2, [r2, r3] - mov r3, sp - adds r3, 0x16 - adds r3, r4 - movs r4, 0 - ldrsh r3, [r3, r4] - movs r4, 0x6A - str r4, [sp] - bl AddPseudoEventObject - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08151074 - ldr r1, =gSprites - lsls r2, r6, 4 - adds r0, r2, r6 - lsls r0, 2 - adds r4, r0, r1 - ldrb r1, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r4, 0x5] - adds r0, r4, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - negs r0, r0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r5] - mov r8, r2 - cmp r0, 0 - bne _08151036 - movs r7, 0x1 - mov r5, r9 - ands r5, r7 - cmp r5, 0 - beq _08151030 - adds r0, r4, 0 - movs r1, 0x6 - b _08151044 - .pool -_08151030: - adds r0, r4, 0 - movs r1, 0x7 - b _08151056 -_08151036: - movs r7, 0x1 - mov r5, r9 - ands r5, r7 - cmp r5, 0 - beq _08151052 - adds r0, r4, 0 - movs r1, 0x7 -_08151044: - bl StartSpriteAnim - strh r7, [r4, 0x30] - ldrh r0, [r4, 0x22] - adds r0, 0x2 - strh r0, [r4, 0x22] - b _0815105C -_08151052: - adds r0, r4, 0 - movs r1, 0x6 -_08151056: - bl StartSpriteAnim - strh r5, [r4, 0x30] -_0815105C: - ldr r0, =gSprites - mov r2, r8 - adds r1, r2, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x3 - mov r3, r9 - ands r0, r3 - add r0, sp - adds r0, 0x1C - ldrb r0, [r0] - strh r0, [r1, 0x32] -_08151074: - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8150D28 - - thumb_func_start sub_8151088 -sub_8151088: @ 8151088 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r3, 0 - mov r9, r3 - ldr r2, =gUnknown_0203ABAC - ldr r0, [r2] - ldrb r1, [r0, 0x1B] - adds r1, 0x2 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 26 - lsrs r0, 24 - mov r12, r0 -_081510AA: - movs r7, 0 - lsls r0, r3, 1 - adds r1, r3, 0x3 - adds r2, r3, 0x6 - adds r4, r3, 0x1 - str r4, [sp, 0x4] - adds r0, r3 - lsls r0, 3 - str r0, [sp] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 3 - mov r8, r0 -_081510CC: - ldr r0, =gUnknown_0203ABAC - ldr r6, [r0] - lsls r3, r7, 1 - ldr r1, [sp] - adds r2, r3, r1 - adds r4, r6, 0 - adds r4, 0x22 - adds r2, r4, r2 - mov r1, r12 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - ldr r0, =0x000040fc - adds r5, r6, r0 - ldr r0, [r5] - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strh r0, [r2] - mov r1, r10 - adds r2, r3, r1 - adds r2, r4, r2 - str r2, [sp, 0x8] - ldr r0, [r5] - mov r2, r9 - lsls r1, r2, 1 - adds r0, r1, r0 - ldrh r0, [r0] - ldr r2, [sp, 0x8] - strh r0, [r2] - add r3, r8 - adds r4, r3 - ldr r0, [r5] - adds r1, r0 - adds r1, 0x48 - ldrh r0, [r1] - strh r0, [r4] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0xB - bls _081510CC - ldr r4, [sp, 0x4] - lsls r0, r4, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _081510AA - ldrb r0, [r6, 0x1B] - adds r0, 0x1 - movs r1, 0x3 - bl __modsi3 - strb r0, [r6, 0x1B] - 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_8151088 - - thumb_func_start sub_815115C -sub_815115C: @ 815115C - push {r4,r5,lr} - ldr r5, =gUnknown_0203ABAC - ldr r4, [r5] - ldrb r0, [r4, 0x1C] - adds r0, 0x1 - movs r1, 0x60 - bl __modsi3 - strb r0, [r4, 0x1C] - ldr r1, [r5] - ldrb r0, [r1, 0x1F] - ldrb r2, [r1, 0x1D] - subs r0, r2 - strb r0, [r1, 0x8] - ldr r2, [r5] - adds r0, r2, 0 - adds r0, 0x20 - ldrb r0, [r0] - ldrb r1, [r2, 0x1E] - subs r0, r1 - strb r0, [r2, 0x9] - ldr r1, [r5] - ldrb r0, [r1, 0x1D] - adds r0, 0x1 - strb r0, [r1, 0x1D] - ldr r2, [r5] - ldrb r0, [r2, 0x1D] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081511A0 - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - strb r0, [r2, 0x1E] -_081511A0: - ldr r0, [r5] - ldrb r0, [r0, 0x1D] - cmp r0, 0x10 - bls _081511AC - bl sub_8151214 -_081511AC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_815115C - - thumb_func_start sub_81511B8 -sub_81511B8: @ 81511B8 - push {r4,r5,lr} - ldr r5, =gUnknown_0203ABAC - ldr r4, [r5] - ldrb r0, [r4, 0x1C] - adds r0, 0x1 - movs r1, 0x60 - bl __modsi3 - strb r0, [r4, 0x1C] - ldr r1, [r5] - ldrb r0, [r1, 0x1D] - ldrb r2, [r1, 0x1F] - adds r0, r2 - strb r0, [r1, 0x8] - ldr r1, [r5] - adds r2, r1, 0 - adds r2, 0x20 - ldrb r0, [r1, 0x1E] - ldrb r2, [r2] - adds r0, r2 - strb r0, [r1, 0x9] - ldr r1, [r5] - ldrb r0, [r1, 0x1D] - adds r0, 0x1 - strb r0, [r1, 0x1D] - ldr r2, [r5] - ldrb r0, [r2, 0x1D] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081511FC - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - strb r0, [r2, 0x1E] -_081511FC: - ldr r0, [r5] - ldrb r0, [r0, 0x1D] - cmp r0, 0x10 - bls _08151208 - bl sub_8151388 -_08151208: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81511B8 - - thumb_func_start sub_8151214 -sub_8151214: @ 8151214 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r7, 0 - ldr r3, =gUnknown_0203ABAC - ldr r0, [r3] - strb r7, [r0, 0x1E] - strb r7, [r0, 0x1D] - ldr r1, [r3] - ldrb r0, [r1, 0x8] - strb r0, [r1, 0x1F] - ldr r0, [r3] - ldrb r1, [r0, 0x9] - adds r0, 0x20 - strb r1, [r0] - ldr r4, [r3] - ldrb r1, [r4, 0x19] - adds r2, r1, 0 - adds r2, 0x1E - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r4, 0x19] - ldr r1, [r3] - ldrb r0, [r1, 0x18] - subs r0, 0x2 - strb r0, [r1, 0x18] - ldr r4, =gUnknown_0203ABB2 - ldr r0, [r3] - ldrb r1, [r0, 0x1A] - adds r2, r1, 0 - adds r2, 0x17 - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r4] - ldr r6, =gUnknown_0203ABB0 - mov r9, r3 - ldr r0, =gUnknown_0203ABB1 - mov r8, r0 -_0815126E: - mov r1, r9 - ldr r2, [r1] - ldrb r0, [r2, 0x19] - strb r0, [r6] - ldr r0, =gUnknown_0203ABB2 - ldrb r0, [r0] - adds r1, r0, r7 - adds r0, r1, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r1, r0 - mov r1, r8 - strb r0, [r1] - ldrb r1, [r2, 0x18] - lsls r1, 1 - lsls r0, r7, 1 - adds r0, r7 - lsls r5, r0, 3 - adds r1, r5 - adds r0, r2, 0 - adds r0, 0x22 - adds r0, r1 - ldrh r1, [r0] - ldrb r2, [r6] - mov r0, r8 - ldrb r3, [r0] - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - mov r10, r0 - str r0, [sp, 0x8] - movs r0, 0 - bl FillBgTilemapBufferRect - ldrb r1, [r6] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r6] - mov r0, r9 - ldr r1, [r0] - ldrb r0, [r1, 0x18] - adds r0, 0x1 - lsls r0, 1 - adds r0, r5 - adds r1, 0x22 - adds r1, r0 - ldrh r1, [r1] - ldrb r2, [r6] - mov r0, r8 - ldrb r3, [r0] - str r4, [sp] - str r4, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - movs r0, 0 - bl FillBgTilemapBufferRect - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x8 - bls _0815126E - ldr r5, =gUnknown_0203ABB0 - ldr r4, =gUnknown_0203ABAC - ldr r0, [r4] - ldrb r1, [r0, 0x19] - adds r2, r1, 0 - adds r2, 0x1E - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r5] - ldrb r2, [r5] - movs r0, 0x2 - str r0, [sp] - movs r6, 0x20 - str r6, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - ldr r1, [r4] - ldrb r0, [r1, 0x18] - cmp r0, 0 - bne _08151368 - ldrb r2, [r1, 0x1A] - adds r3, r2, 0 - adds r3, 0x1D - adds r0, r3, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r3, r0 - strb r0, [r1, 0x1A] - ldr r1, [r4] - movs r0, 0xC - strb r0, [r1, 0x18] - bl sub_8151088 - ldr r0, [r4] - ldrb r1, [r0, 0x1A] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r5] - ldrb r3, [r5] - str r6, [sp] - movs r0, 0x9 - str r0, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl FillBgTilemapBufferRect -_08151368: - 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_8151214 - - thumb_func_start sub_8151388 -sub_8151388: @ 8151388 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r7, 0 - ldr r2, =gUnknown_0203ABAC - ldr r0, [r2] - strb r7, [r0, 0x1E] - strb r7, [r0, 0x1D] - ldr r1, [r2] - ldrb r0, [r1, 0x8] - strb r0, [r1, 0x1F] - ldr r0, [r2] - ldrb r1, [r0, 0x9] - adds r0, 0x20 - strb r1, [r0] - ldr r4, [r2] - ldrb r1, [r4, 0x19] - adds r3, r1, 0x2 - adds r0, r3, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r3, r0 - strb r0, [r4, 0x19] - ldr r1, [r2] - ldrb r0, [r1, 0x18] - adds r0, 0x2 - strb r0, [r1, 0x18] - ldr r1, =gUnknown_0203ABB5 - ldr r0, [r2] - ldrb r0, [r0, 0x1A] - strb r0, [r1] - ldr r6, =gUnknown_0203ABB3 - mov r10, r2 - ldr r0, =gUnknown_0203ABB4 - mov r9, r0 -_081513D4: - mov r1, r10 - ldr r2, [r1] - ldrb r0, [r2, 0x19] - strb r0, [r6] - ldr r0, =gUnknown_0203ABB5 - ldrb r0, [r0] - adds r1, r0, r7 - adds r0, r1, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r1, r0 - mov r1, r9 - strb r0, [r1] - ldrb r1, [r2, 0x18] - lsls r1, 1 - lsls r0, r7, 1 - adds r0, r7 - lsls r5, r0, 3 - adds r1, r5 - adds r0, r2, 0 - adds r0, 0x22 - adds r0, r1 - ldrh r1, [r0] - ldrb r2, [r6] - mov r0, r9 - ldrb r3, [r0] - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - mov r8, r0 - str r0, [sp, 0x8] - movs r0, 0 - bl FillBgTilemapBufferRect - ldrb r1, [r6] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r6] - mov r0, r10 - ldr r1, [r0] - ldrb r0, [r1, 0x18] - adds r0, 0x1 - lsls r0, 1 - adds r0, r5 - adds r1, 0x22 - adds r1, r0 - ldrh r1, [r1] - ldrb r2, [r6] - mov r0, r9 - ldrb r3, [r0] - str r4, [sp] - str r4, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - movs r0, 0 - bl FillBgTilemapBufferRect - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x8 - bls _081513D4 - ldr r4, =gUnknown_0203ABB4 - ldr r5, =gUnknown_0203ABAC - ldr r3, [r5] - ldrb r1, [r3, 0x1A] - adds r2, r1, 0 - adds r2, 0x17 - adds r0, r2, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r2, r0 - strb r0, [r4] - ldrb r2, [r3, 0x19] - ldrb r3, [r4] - movs r0, 0x2 - str r0, [sp] - movs r0, 0x9 - str r0, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r0, 0 - movs r1, 0 - bl FillBgTilemapBufferRect - ldr r1, [r5] - ldrb r0, [r1, 0x18] - cmp r0, 0xA - bne _081514A6 - ldrb r2, [r1, 0x1A] - adds r3, r2, 0x3 - adds r0, r3, 0 - asrs r0, 5 - lsls r0, 5 - subs r0, r3, r0 - strb r0, [r1, 0x1A] - ldr r1, [r5] - movs r0, 0xFE - strb r0, [r1, 0x18] - bl sub_8151088 -_081514A6: - 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_8151388 - - thumb_func_start sub_81514C8 -sub_81514C8: @ 81514C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081514D6 - cmp r0, 0x1 - beq _08151500 -_081514D6: - ldr r1, =gUnknown_0203ABAC - ldr r2, [r1] - movs r3, 0 - movs r0, 0x2 - strb r0, [r2, 0x1B] - ldr r0, [r1] - strb r3, [r0, 0x19] - ldr r2, [r1] - movs r0, 0x14 - strb r0, [r2, 0x1A] - ldr r1, [r1] - movs r0, 0xC - strb r0, [r1, 0x18] - bl sub_8151088 - bl sub_8151214 - b _08151522 - .pool -_08151500: - ldr r1, =gUnknown_0203ABAC - ldr r2, [r1] - movs r0, 0x2 - strb r0, [r2, 0x1B] - ldr r2, [r1] - movs r0, 0x1C - strb r0, [r2, 0x19] - ldr r2, [r1] - movs r0, 0x14 - strb r0, [r2, 0x1A] - ldr r1, [r1] - movs r0, 0x4 - strb r0, [r1, 0x18] - bl sub_8151088 - bl sub_8151388 -_08151522: - ldr r0, =gUnknown_0203ABAC - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x1C] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81514C8 - - .align 2, 0 @ Don't pad with nop. diff --git a/data/cable_car.s b/data/cable_car.s deleted file mode 100644 index c141e593c..000000000 --- a/data/cable_car.s +++ /dev/null @@ -1,106 +0,0 @@ -#include "constants/event_objects.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085CD66C:: @ 85CD66C - .4byte 0x000011c0, 0x000021d1, 0x000031e2, 0x000001f3 - - .align 2 -gCableCarMtChimneyTilemap:: @ 85CD67C - .incbin "graphics/misc/cable_car_mt_chimney_map.bin.lz" - - .align 2 -gCableCarTreeTilemap:: @ 85CD7D4 - .incbin "graphics/misc/cable_car_tree_map.bin.lz" - - .align 2 -gCableCarMountainTilemap:: @ 85CD958 - .incbin "graphics/misc/cable_car_mountain_map.bin.lz" - - .align 2 -gCableCarPylonHookTilemapEntries:: @ 85CDB1C - .2byte 0x3000 - .2byte 0x3001 - .2byte 0x3002 - .2byte 0x3003 - .2byte 0x3004 - .2byte 0x3005 - .2byte 0x3006 - .2byte 0x3007 - .2byte 0x3008 - .2byte 0x3009 - - .align 2 -gCableCarPylonStemTilemap:: @ 85CDB30 - .incbin "graphics/misc/cable_car_pylon_stem_map.bin.lz" - - .align 2 -gUnknown_085CDB54:: @ 85CDB54 - obj_tiles gCableCar_Gfx, 0x800, 1 - obj_tiles gCableCarDoor_Gfx, 0x40, 2 - obj_tiles gCableCarCord_Gfx, 0x80, 3 - null_obj_tiles - - .align 2 -gUnknown_085CDB74:: @ 85CDB74 - obj_pal gCableCar_Pal, 1 - null_obj_pal - - .align 2 -gOamData_85CDB84:: @ 85CDB84 - .2byte 0x0300 - .2byte 0xC000 - .2byte 0x0800 - - .align 2 -gOamData_85CDB8C:: @ 85CDB8C - .2byte 0x4300 - .2byte 0x0000 - .2byte 0x0800 - - .align 2 -gOamData_85CDB94:: @ 85CDB94 - .2byte 0x0300 - .2byte 0x4000 - .2byte 0x0800 - - .align 2 -gSpriteTemplate_85CDB9C:: @ 85CDB9C - spr_template 1, 1, gOamData_85CDB84, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8150868 - - .align 2 -gSpriteTemplate_85CDBB4:: @ 85CDBB4 - spr_template 2, 1, gOamData_85CDB8C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8150868 - - .align 2 -gSpriteTemplate_85CDBCC:: @ 85CDBCC - spr_template 3, 1, gOamData_85CDB94, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, nullsub_58 - -gCableCarPlayerGraphicsIDs:: @ 85CDBE4 - .byte EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL - .byte EVENT_OBJ_GFX_RIVAL_MAY_NORMAL - -gMtChimneyHikerGraphicsIDs:: @ 85CDBE6 - .byte EVENT_OBJ_GFX_HIKER - .byte EVENT_OBJ_GFX_CAMPER - .byte EVENT_OBJ_GFX_PICNICKER - .byte EVENT_OBJ_GFX_ZIGZAGOON_1 @ not used - - .align 1 -gMtChimneyHikerCoords:: @ 85CDBEA - .2byte 0, 80 - .2byte 240, 146 - -gMtChimneyHikerMovementDelayTable:: @ 85CDBF2 - .byte 0 - .byte 60 - .byte 120 - .byte 170 - - .align 2 -gUnknown_085CDBF8:: @ 85CDBF8 - .4byte sub_8150A68 - .4byte sub_8150AF4 diff --git a/data/maps/MtChimney_CableCarStation/scripts.inc b/data/maps/MtChimney_CableCarStation/scripts.inc index 2544e6729..89fc9fd38 100644 --- a/data/maps/MtChimney_CableCarStation/scripts.inc +++ b/data/maps/MtChimney_CableCarStation/scripts.inc @@ -48,7 +48,7 @@ MtChimney_CableCarStation_EventScript_22AC6C:: @ 822AC6C setvar VAR_0x40A3, 2 incrementgamestat 48 special CableCarWarp - special sub_814FC9C + special CableCar waitstate release end diff --git a/data/maps/Route112_CableCarStation/scripts.inc b/data/maps/Route112_CableCarStation/scripts.inc index 905e9e9ea..a7d3e8c7a 100644 --- a/data/maps/Route112_CableCarStation/scripts.inc +++ b/data/maps/Route112_CableCarStation/scripts.inc @@ -49,7 +49,7 @@ Route112_CableCarStation_EventScript_22AB38:: @ 822AB38 setvar VAR_0x40A3, 1 incrementgamestat 48 special CableCarWarp - special sub_814FC9C + special CableCar waitstate release end diff --git a/data/specials.inc b/data/specials.inc index 080f2c042..8ee70c306 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -163,7 +163,7 @@ gSpecials:: @ 81DBA64 def_special GetRivalSonDaughterString def_special SetFlagInVar def_special CableCarWarp - def_special sub_814FC9C + def_special CableCar def_special Overworld_PlaySpecialMapMusic def_special StartWallClock def_special Special_ViewWallClock diff --git a/include/global.h b/include/global.h index 83eb93eec..33a31bf4d 100644 --- a/include/global.h +++ b/include/global.h @@ -79,6 +79,14 @@ #define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24)) #define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr) +#define S16TOPOSFLOAT(val) \ +({ \ + s16 v = (val); \ + float f = (float)v; \ + if(v < 0) f += 65536.0f; \ + f; \ +}) + // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. // In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------". diff --git a/include/graphics.h b/include/graphics.h index b51926b8d..e2889ed86 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4740,4 +4740,12 @@ extern const u32 gUnknown_08D8D58C[]; extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; +// Cable Car +extern const u32 gUnknown_08DBA5B8[]; +extern const u16 gUnknown_08DBA518[]; +extern const u32 gCableCar_Gfx[]; +extern const u32 gCableCarDoor_Gfx[]; +extern const u32 gCableCarCord_Gfx[]; +extern const u16 gCableCar_Pal[]; + #endif //GUARD_GRAPHICS_H diff --git a/ld_script.txt b/ld_script.txt index ecd3822cb..87964b70d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -214,7 +214,7 @@ SECTIONS { src/battle_transition.o(.text); src/battle_controller_link_partner.o(.text); src/battle_message.o(.text); - asm/cable_car.o(.text); + src/cable_car.o(.text); src/math_util.o(.text); src/roulette_util.o(.text); src/rom_81520A8.o(.text); @@ -533,7 +533,7 @@ SECTIONS { src/battle_transition.o(.rodata); src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); - data/cable_car.o(.rodata); + src/cable_car.o(.rodata); src/save.o(.rodata); src/field_effect_helpers.o(.rodata); data/field_effect_helpers.o(.rodata); diff --git a/src/cable_car.c b/src/cable_car.c new file mode 100755 index 000000000..00606c905 --- /dev/null +++ b/src/cable_car.c @@ -0,0 +1,1006 @@ +#include "global.h" +#include "bg.h" +#include "decompress.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "field_weather.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "alloc.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "random.h" +#include "scanline_effect.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "constants/event_objects.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/weather.h" + +struct CableCar +{ + u8 taskId; + u8 state; + u8 weather; + u16 unk4; + u16 timer; + u8 bg0HorizontalOffset; + u8 bg0VerticalOffset; + u8 fillerA[0x2]; + u8 bg1HorizontalOffset; + u8 bg1VerticalOffset; + u8 fillerE[0x6]; + u8 bg3HorizontalOffset; + u8 bg3VerticalOffset; + u8 filler16[0x2]; + u8 unk18; + u8 unk19; + u8 unk1A; + u8 unk1B; + u8 unk1C; + u8 unk1D; + u8 unk1E; + u8 unk1F; + u8 unk20; + u16 unk22[9][12]; + u8 fillerFA[0x2]; + /*0x00FC*/ u16 bgTilemapBuffers[4][0x800]; + /*0x40FC*/ u16 *mtChimneyTilemap; + /*0x4100*/ u16 *treeTilemap; + /*0x4104*/ u16 *mountainTilemap; + /*0x4108*/ const u16 *pylonHookTilemapEntries; + /*0x410C*/ u8 *pylonStemTilemap; +}; + +static EWRAM_DATA struct CableCar *sCableCar = NULL; +EWRAM_DATA u8 gUnknown_0203ABB0 = 0; +EWRAM_DATA u8 gUnknown_0203ABB1 = 0; +EWRAM_DATA u8 gUnknown_0203ABB2 = 0; +EWRAM_DATA u8 gUnknown_0203ABB3 = 0; +EWRAM_DATA u8 gUnknown_0203ABB4 = 0; +EWRAM_DATA u8 gUnknown_0203ABB5 = 0; + +static void CableCarMainCallback_Setup(void); +static void sub_8150B6C(u8); +static void LoadCableCarSprites(void); +static void sub_81514C8(u8); +static void sub_81503E4(u8); +static void sub_8150550(u8); +static void sub_8150664(u8); +static void CableCarVblankCallback(void); +static void CableCarMainCallback_Run(void); +static void sub_815115C(void); +static void sub_81511B8(void); +static void sub_8150868(struct Sprite *); +static void nullsub_58(struct Sprite *); +static void sub_8151214(void); +static void sub_8151388(void); + +const struct BgTemplate gCableCarBgTemplates[4] = { + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 28, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, +}; + +const u8 gCableCarMtChimneyTilemap[] = INCBIN_U8("graphics/misc/cable_car_mt_chimney_map.bin.lz"); +const u8 gCableCarTreeTilemap[] = INCBIN_U8("graphics/misc/cable_car_tree_map.bin.lz"); +const u8 gCableCarMountainTilemap[] = INCBIN_U8("graphics/misc/cable_car_mountain_map.bin.lz"); + +const u16 gCableCarPylonHookTilemapEntries[] = { + 0x3000, + 0x3001, + 0x3002, + 0x3003, + 0x3004, + 0x3005, + 0x3006, + 0x3007, + 0x3008, + 0x3009, +}; + +const u8 gCableCarPylonStemTilemap[] = INCBIN_U8("graphics/misc/cable_car_pylon_stem_map.bin.lz"); + +const struct CompressedSpriteSheet gUnknown_085CDB54[] = { + { gCableCar_Gfx, 0x800, 1 }, + { gCableCarDoor_Gfx, 0x40, 2 }, + { gCableCarCord_Gfx, 0x80, 3 }, + { }, +}; + +const struct SpritePalette gUnknown_085CDB74[] = { + { gCableCar_Pal, 1 }, + { } +}; + +const struct OamData gOamData_85CDB84 = { + .affineMode = ST_OAM_AFFINE_DOUBLE, + .size = 3, + .priority = 2 +}; + +const struct OamData gOamData_85CDB8C = { + .affineMode = ST_OAM_AFFINE_DOUBLE, + .shape = ST_OAM_H_RECTANGLE, + .priority = 2 +}; + +const struct OamData gOamData_85CDB94 = { + .affineMode = ST_OAM_AFFINE_DOUBLE, + .size = 1, + .priority = 2 +}; + +const struct SpriteTemplate gSpriteTemplate_85CDB9C[] = +{ + { + .tileTag = 1, + .paletteTag = 1, + .oam = &gOamData_85CDB84, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8150868, + }, + { + .tileTag = 2, + .paletteTag = 1, + .oam = &gOamData_85CDB8C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8150868, + }, +}; + +const struct SpriteTemplate gSpriteTemplate_85CDBCC = { + .tileTag = 3, + .paletteTag = 1, + .oam = &gOamData_85CDB94, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = nullsub_58, +}; + +static void CableCarTask1(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetMainCallback2(CableCarMainCallback_Setup); + DestroyTask(taskId); + } +} + +void CableCar(void) +{ + ScriptContext2_Enable(); + CreateTask(CableCarTask1, 1); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); +} + +static void CableCarMainCallback_Setup(void) +{ + u16 imebak; + u8 i = 0; + int sizeOut = 0; + + switch (gMain.state) + { + case 0: + default: + SetVBlankCallback(NULL); + sub_8150B6C(0); + ScanlineEffect_Stop(); + DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaFill32Defvars(3, 0, (void *)OAM, OAM_SIZE); + DmaFill16Defvars(3, 0, (void *)PLTT, PLTT_SIZE); + sCableCar = AllocZeroed(sizeof(*sCableCar)); + gMain.state++; + break; + case 1: + ResetSpriteData(); + ResetTasks(); + FreeAllSpritePalettes(); + ResetPaletteFade(); + reset_temp_tile_data_buffers(); + StartWeather(); + for (i = 0; i < 20; i++) + gWeatherPtr->sprites.s2.ashSprites[i] = NULL; + + InitMapMusic(); + ResetMapMusic(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gCableCarBgTemplates, ARRAY_COUNT(gCableCarBgTemplates)); + SetBgTilemapBuffer(0, sCableCar->bgTilemapBuffers[0]); + SetBgTilemapBuffer(1, sCableCar->bgTilemapBuffers[1]); + SetBgTilemapBuffer(2, sCableCar->bgTilemapBuffers[2]); + SetBgTilemapBuffer(3, sCableCar->bgTilemapBuffers[3]); + gSpriteCoordOffsetX = gSpriteCoordOffsetY = 0; + gMain.state++; + break; + case 2: + for (i = 0; i < 3; i++) + LoadCompressedObjectPic(&gUnknown_085CDB54[i]); + + LoadSpritePalettes(gUnknown_085CDB74); + sCableCar->mtChimneyTilemap = malloc_and_decompress(gCableCarMtChimneyTilemap, &sizeOut); + sCableCar->treeTilemap = malloc_and_decompress(gCableCarTreeTilemap, &sizeOut); + sCableCar->mountainTilemap = malloc_and_decompress(gCableCarMountainTilemap, &sizeOut); + sCableCar->pylonStemTilemap = malloc_and_decompress(gCableCarPylonStemTilemap, &sizeOut); + sCableCar->pylonHookTilemapEntries = gCableCarPylonHookTilemapEntries; + decompress_and_copy_tile_data_to_vram(0, gUnknown_08DBA5B8, 0, 0, 0); + gMain.state++; + break; + case 3: + if (!free_temp_tile_data_buffers_if_possible()) + { + LoadPalette(gUnknown_08DBA518, 0, 0x80); + gMain.state++; + } + break; + case 4: + LoadCableCarSprites(); + RunTasks(); + gMain.state++; + break; + case 5: + if (sCableCar->weather == WEATHER_ASH) + { + gMain.state++; + } + else if (gWeatherPtr->sprites.s2.ashSprites[0]) + { + for (i = 0; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.ashSprites[i]) + gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0; + } + + gMain.state++; + } + break; + case 6: + CopyToBgTilemapBufferRect_ChangePalette(1, sCableCar->treeTilemap, 0, 17, 32, 15, 17); + CopyToBgTilemapBufferRect_ChangePalette(2, sCableCar->mountainTilemap, 0, 0, 30, 20, 17); + CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonHookTilemapEntries, 0, 0, 5, 2, 17); + CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 20, 17); + gMain.state++; + break; + case 7: + sub_81514C8(gSpecialVar_0x8004); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x48, 0, 14, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x6C, 12, 17, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x90, 24, 20, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x0, 0, 17, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x24, 0, 20, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x0, 12, 20, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x24, 12, 23, 12, 3, 17); + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x0, 24, 23, 12, 3, 17); + gMain.state++; + break; + case 8: + BeginNormalPaletteFade(0xFFFFFFFF, 3, 16, 0, RGB(0, 0, 0)); + FadeInNewBGM(MUS_ROPEWAY, 1); + sub_8150B6C(1); + gMain.state++; + break; + case 9: + imebak = REG_IME; + REG_IME = 0; + REG_IE |= INTR_FLAG_VBLANK; + REG_IME = imebak; + SetVBlankCallback(CableCarVblankCallback); + SetMainCallback2(CableCarMainCallback_Run); + CreateTask(sub_81503E4, 0); + if (gSpecialVar_0x8004 == 0) + sCableCar->taskId = CreateTask(sub_8150550, 1); + else + sCableCar->taskId = CreateTask(sub_8150664, 1); + break; + } +} + +static void CableCarMainCallback_Run(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + MapMusicMain(); +} + +static void CleanupCableCar(void) +{ + u8 i = 0; + + HideBg(0); + HideBg(1); + HideBg(2); + HideBg(3); + sub_8150B6C(0); + gSpriteCoordOffsetX = 0; + sub_80AB130(WEATHER_NONE); + for (i = 0; i < 20; i++) + gWeatherPtr->sprites.s2.ashSprites[i] = NULL; + + ResetTasks(); + ResetSpriteData(); + ResetPaletteFade(); + UnsetBgTilemapBuffer(0); + UnsetBgTilemapBuffer(1); + UnsetBgTilemapBuffer(2); + UnsetBgTilemapBuffer(3); + ResetBgsAndClearDma3BusyFlags(0); + sCableCar->pylonHookTilemapEntries = NULL; + FREE_AND_SET_NULL(sCableCar->pylonStemTilemap); + FREE_AND_SET_NULL(sCableCar->mountainTilemap); + FREE_AND_SET_NULL(sCableCar->treeTilemap); + FREE_AND_SET_NULL(sCableCar->mtChimneyTilemap); + FREE_AND_SET_NULL(sCableCar); + DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaFill32Defvars(3, 0, (void *)OAM, OAM_SIZE); + DmaFill16Defvars(3, 0, (void *)PLTT, PLTT_SIZE); + WarpIntoMap(); + gFieldCallback = NULL; + SetMainCallback2(CB2_LoadMap); +} + +static void sub_81503E4(u8 taskId) +{ + u8 i = 0; + + sCableCar->timer++; + switch (sCableCar->state) + { + case 0: + if (sCableCar->timer == sCableCar->unk4) + { + ChangeWeather(sCableCar->weather); + sCableCar->state = 1; + } + break; + case 1: + switch (sCableCar->weather) + { + case WEATHER_ASH: + if (gWeatherPtr->sprites.s2.ashSprites[0] != NULL && gWeatherPtr->sprites.s2.ashSprites[0]->oam.priority != 0) + { + for (; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) + { + gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0; + } + } + sCableCar->state = 2; + } + break; + case WEATHER_SUNNY: + if (gWeatherPtr->currWeather == WEATHER_SUNNY) + { + sCableCar->state = 2; + } + else if (sCableCar->timer >= sCableCar->unk4 + 8) + { + for (; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) + { + gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= TRUE; + } + } + } + break; + } + break; + case 2: + if (sCableCar->timer == 570) + { + sCableCar->state = 3; + BeginNormalPaletteFade(0xFFFFFFFF, 3, 0, 16, RGB(0, 0, 0)); + FadeOutBGM(4); + } + break; + case 3: + if (!gPaletteFade.active) + { + sCableCar->state = 0xFF; + } + break; + case 0xFF: + SetVBlankCallback(NULL); + DestroyTask(taskId); + DestroyTask(sCableCar->taskId); + SetMainCallback2(CleanupCableCar); + break; + } +} + +static void sub_8150550(u8 taskId) +{ + if (sCableCar->state != 0xFF) + { + sCableCar->bg3HorizontalOffset--; + if ((sCableCar->timer % 2) == 0) + sCableCar->bg3VerticalOffset--; + + if ((sCableCar->timer % 8) == 0) + { + sCableCar->bg1HorizontalOffset--; + sCableCar->bg1VerticalOffset--; + } + + switch (sCableCar->bg3HorizontalOffset) + { + case 175: + FillBgTilemapBufferRect(3, 0, 0, 22, 2, 10, 17); + break; + case 40: + FillBgTilemapBufferRect(3, 0, 3, 0, 2, 2, 17); + break; + case 32: + FillBgTilemapBufferRect(3, 0, 2, 0, 1, 2, 17); + break; + case 16: + CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonHookTilemapEntries, 0, 0, 5, 2, 17); + CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 30, 17); + sCableCar->bg3VerticalOffset = 64; + break; + } + } + + sub_815115C(); + gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 1) % 128; +} + +static void sub_8150664(u8 taskId) +{ + if (sCableCar->state != 0xFF) + { + sCableCar->bg3HorizontalOffset++; + if ((sCableCar->timer % 2) == 0) + sCableCar->bg3VerticalOffset++; + + if ((sCableCar->timer % 8) == 0) + { + sCableCar->bg1HorizontalOffset++; + sCableCar->bg1VerticalOffset++; + } + + switch (sCableCar->bg3HorizontalOffset) + { + case 176: + CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 30, 17); + break; + case 16: + FillBgTilemapBufferRect(3, 0, 2, 0, 3, 2, 17); + FillBgTilemapBufferRect(3, 0, 0, 22, 2, 10, 17); + sCableCar->bg3VerticalOffset = 192; + break; + case 32: + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[2], 2, 0, 1, 1, 17); + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[3], 3, 0, 1, 1, 17); + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[7], 2, 1, 1, 1, 17); + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[8], 3, 1, 1, 1, 17); + break; + case 40: + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[4], 4, 0, 1, 1, 17); + FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[9], 4, 1, 1, 1, 17); + break; + } + } + + sub_81511B8(); + if (sCableCar->timer < sCableCar->unk4) + gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248; + else + gWeatherPtr->unknown_6FC = (gWeatherPtr->unknown_6FC + 247) % 248; +} + +static void CableCarVblankCallback(void) +{ + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(3); + SetGpuReg(REG_OFFSET_BG3HOFS, sCableCar->bg3HorizontalOffset); + SetGpuReg(REG_OFFSET_BG3VOFS, sCableCar->bg3VerticalOffset); + SetGpuReg(REG_OFFSET_BG1HOFS, sCableCar->bg1HorizontalOffset); + SetGpuReg(REG_OFFSET_BG1VOFS, sCableCar->bg1VerticalOffset); + SetGpuReg(REG_OFFSET_BG0HOFS, sCableCar->bg0HorizontalOffset); + SetGpuReg(REG_OFFSET_BG0VOFS, sCableCar->bg0VerticalOffset); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static void nullsub_58(struct Sprite *sprite) +{ +} + +static void sub_8150868(struct Sprite *sprite) +{ + if (sCableCar->state != 0xFF) + { + if (gSpecialVar_0x8004 == 0) + { + sprite->pos1.x = sprite->data[0] - (u8)(0.14f * S16TOPOSFLOAT(sCableCar->timer)); + sprite->pos1.y = sprite->data[1] - (u8)(0.067f * S16TOPOSFLOAT(sCableCar->timer)); + } + else + { + sprite->pos1.x = sprite->data[0] + (u8)(0.14f * S16TOPOSFLOAT(sCableCar->timer)); + sprite->pos1.y = sprite->data[1] + (u8)(0.067f * S16TOPOSFLOAT(sCableCar->timer)); + } + } +} + +void sub_8150948(struct Sprite *sprite) +{ + if (sCableCar->state != 255) + { + if (!gSpecialVar_0x8004) + { + sprite->pos1.x = sprite->data[0] - (u8)(0.14f * S16TOPOSFLOAT(sCableCar->timer)); + sprite->pos1.y = sprite->data[1] - (u8)(0.067f * S16TOPOSFLOAT(sCableCar->timer)); + } + else + { + sprite->pos1.x = sprite->data[0] + (u8)(0.14f * S16TOPOSFLOAT(sCableCar->timer)); + sprite->pos1.y = sprite->data[1] + (u8)(0.067f * S16TOPOSFLOAT(sCableCar->timer)); + } + + switch (sprite->data[2]) + { + case 0: + sprite->pos2.y = 17; + if (sprite->data[3] ++ > 9) + { + sprite->data[3] = 0; + sprite->data[2] ++; + } + break; + default: + sprite->pos2.y = 16; + if (sprite->data[3] ++ > 9) + { + sprite->data[3] = 0; + sprite->data[2] = 0; + } + break; + } + } +} + +static void sub_8150A68(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + sprite->pos1.x += 2 * sprite->centerToCornerVecX; + sprite->pos1.y += 16 + sprite->centerToCornerVecY; + } + + if (++sprite->data[0] >= sprite->data[2]) + { + switch (sprite->data[1]) + { + case 0: + sprite->pos1.x++; + if ((sprite->data[0] % 4) == 0) + sprite->pos1.y++; + break; + case 1: + if ((sprite->data[0] % 2) != 0) + { + sprite->pos1.x++; + if ((sprite->pos1.x % 4) == 0) + sprite->pos1.y++; + } + break; + } + + if (sprite->pos1.y > 160) + DestroySprite(sprite); + } +} + +static void sub_8150AF4(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + sprite->pos1.y += 16 + sprite->centerToCornerVecY; + + if (++sprite->data[0] >= sprite->data[2]) + { + switch (sprite->data[1]) + { + case 0: + sprite->pos1.x--; + if ((sprite->data[0] % 4) == 0) + sprite->pos1.y--; + break; + case 1: + if ((sprite->data[0] % 2) != 0) + { + sprite->pos1.x--; + if ((sprite->pos1.x % 4) == 0) + sprite->pos1.y--; + } + break; + } + + if (sprite->pos1.y < 80) + DestroySprite(sprite); + } +} + +static void sub_8150B6C(bool8 which) +{ + switch (which) + { + case FALSE: + default: + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG3CNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG0CNT, 0); + SetGpuReg(REG_OFFSET_BG3HOFS, 0); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + break; + case TRUE: + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + if (gSpecialVar_0x8004 == 0) + { + sCableCar->bg3HorizontalOffset = 176; + sCableCar->bg3VerticalOffset = 16; + sCableCar->bg1HorizontalOffset = 0; + sCableCar->bg1VerticalOffset = 80; + sCableCar->bg0VerticalOffset = 0; + sCableCar->bg0VerticalOffset = 0; + } + else + { + sCableCar->bg3HorizontalOffset = 96; + sCableCar->bg3VerticalOffset = 232; + sCableCar->bg1HorizontalOffset = 0; + sCableCar->bg1VerticalOffset = 4; + sCableCar->bg0VerticalOffset = 0; + sCableCar->bg0VerticalOffset = 0; + } + + SetGpuReg(REG_OFFSET_BG3HOFS, sCableCar->bg3HorizontalOffset); + SetGpuReg(REG_OFFSET_BG3VOFS, sCableCar->bg3VerticalOffset); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, sCableCar->bg1HorizontalOffset); + SetGpuReg(REG_OFFSET_BG1VOFS, sCableCar->bg1VerticalOffset); + SetGpuReg(REG_OFFSET_BG0HOFS, sCableCar->bg0HorizontalOffset); + SetGpuReg(REG_OFFSET_BG0VOFS, sCableCar->bg0VerticalOffset); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL); + break; + } +} + +static void LoadCableCarSprites(void) +{ + u8 spriteId; + u8 i; + + u8 playerGraphicsIds[2] = { + EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, + EVENT_OBJ_GFX_RIVAL_MAY_NORMAL + }; + u16 rval = Random(); + u8 hikerGraphicsIds[4] = { + EVENT_OBJ_GFX_HIKER, + EVENT_OBJ_GFX_CAMPER, + EVENT_OBJ_GFX_PICNICKER, + EVENT_OBJ_GFX_ZIGZAGOON_1 + }; + s16 hikerCoords[2][2] = { + { 0, 80 }, + { 240, 146 } + }; + u8 hikerMovementDelayTable[4] = { + 0, + 60, + 120, + 170 + }; + void (*callbacks[2])(struct Sprite *) = { + sub_8150A68, + sub_8150AF4 + }; + + switch (gSpecialVar_0x8004) + { + case 0: + default: + spriteId = AddPseudoEventObject(playerGraphicsIds[gSaveBlock2Ptr->playerGender], sub_8150948, 200, 73, 102); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.priority = 2; + gSprites[spriteId].pos2.x = 8; + gSprites[spriteId].pos2.y = 16; + gSprites[spriteId].data[0] = 0xc8; + gSprites[spriteId].data[1] = 0x49; + } + spriteId = CreateSprite(&gSpriteTemplate_85CDB9C[0], 176, 43, 0x67); + gSprites[spriteId].pos2.x = gSprites[spriteId].pos2.y = 32; + gSprites[spriteId].data[0] = 176; + gSprites[spriteId].data[1] = 43; + spriteId = CreateSprite(&gSpriteTemplate_85CDB9C[1], 200, 99, 0x65); + gSprites[spriteId].pos2.x = 8; + gSprites[spriteId].pos2.y = 4; + gSprites[spriteId].data[0] = 200; + gSprites[spriteId].data[1] = 99; + sCableCar->weather = WEATHER_ASH; + sCableCar->unk4 = 0x15e; + sub_80AB130(WEATHER_SUNNY); + break; + case 1: + CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x24, 24, 26, 12, 3, 17); + spriteId = AddPseudoEventObject(playerGraphicsIds[gSaveBlock2Ptr->playerGender], sub_8150948, 128, 39, 102); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.priority = 2; + gSprites[spriteId].pos2.x = 8; + gSprites[spriteId].pos2.y = 16; + gSprites[spriteId].data[0] = 0x80; + gSprites[spriteId].data[1] = 0x27; + } + spriteId = CreateSprite(&gSpriteTemplate_85CDB9C[0], 104, 9, 0x67); + gSprites[spriteId].pos2.x = gSprites[spriteId].pos2.y = 0x20; + gSprites[spriteId].data[0] = 104; + gSprites[spriteId].data[1] = 9; + spriteId = CreateSprite(&gSpriteTemplate_85CDB9C[1], 128, 65, 0x65); + gSprites[spriteId].pos2.x = 8; + gSprites[spriteId].pos2.y = 4; + gSprites[spriteId].data[0] = 0x80; + gSprites[spriteId].data[1] = 0x41; + sCableCar->weather = WEATHER_SUNNY; + sCableCar->unk4 = 0x109; + sub_80AB130(WEATHER_ASH); + break; + } + for (i = 0; i < 9; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_85CDBCC, 16 * i + 96, 8 * i - 8, 0x68); + gSprites[spriteId].pos2.x = 8; + gSprites[spriteId].pos2.y = 8; + } + if ((rval % 64) == 0) + { + spriteId = AddPseudoEventObject(hikerGraphicsIds[rval % 3], callbacks[gSpecialVar_0x8004], hikerCoords[gSpecialVar_0x8004][0], hikerCoords[gSpecialVar_0x8004][1], 0x6a); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.priority = 2; + gSprites[spriteId].pos2.x = -gSprites[spriteId].centerToCornerVecX; + gSprites[spriteId].pos2.y = -gSprites[spriteId].centerToCornerVecY; + if (gSpecialVar_0x8004 == 0) + { + if (rval % 2) + { + StartSpriteAnim(&gSprites[spriteId], 6); + gSprites[spriteId].data[1] = 1; + gSprites[spriteId].pos1.y += 2; + } + else + { + StartSpriteAnim(&gSprites[spriteId], 7); + gSprites[spriteId].data[1] = 0; + } + } + else + { + if (rval % 2) + { + StartSpriteAnim(&gSprites[spriteId], 7); + gSprites[spriteId].data[1] = 1; + gSprites[spriteId].pos1.y += 2; + } + else + { + StartSpriteAnim(&gSprites[spriteId], 6); + gSprites[spriteId].data[1] = 0; + } + } + gSprites[spriteId].data[2] = hikerMovementDelayTable[rval % 4]; + } + } +} + +void sub_8151088(void) +{ + u8 i; + u8 j; + u8 k; + u8 offset; + + for (i = 0, k = 0, offset = 0x24 * (sCableCar->unk1B + 2); i < 3; i++) + { + for (j = 0; j < 12; j++) + { + sCableCar->unk22[i][j] = sCableCar->mtChimneyTilemap[offset++]; + sCableCar->unk22[i + 3][j] = sCableCar->mtChimneyTilemap[k]; + sCableCar->unk22[i + 6][j] = (sCableCar->mtChimneyTilemap + 0x24)[k]; + k++; + } + } + + sCableCar->unk1B = (sCableCar->unk1B + 1) % 3; +} + +static void sub_815115C(void) +{ + sCableCar->unk1C = (sCableCar->unk1C + 1) % 0x60; + sCableCar->bg0HorizontalOffset = sCableCar->unk1F - sCableCar->unk1D; + sCableCar->bg0VerticalOffset = sCableCar->unk20 - sCableCar->unk1E; + sCableCar->unk1D++; + if ((sCableCar->unk1D % 4) == 0) + sCableCar->unk1E++; + + if (sCableCar->unk1D > 16) + sub_8151214(); +} + +static void sub_81511B8(void) +{ + sCableCar->unk1C = (sCableCar->unk1C + 1) % 0x60; + sCableCar->bg0HorizontalOffset = sCableCar->unk1F + sCableCar->unk1D; + sCableCar->bg0VerticalOffset = sCableCar->unk20 + sCableCar->unk1E; + sCableCar->unk1D++; + if ((sCableCar->unk1D % 4) == 0) + sCableCar->unk1E++; + + if (sCableCar->unk1D > 16) + sub_8151388(); +} + +static void sub_8151214(void) +{ + u8 i = 0; + + sCableCar->unk1D = sCableCar->unk1E = 0; + sCableCar->unk1F = sCableCar->bg0HorizontalOffset; + sCableCar->unk20 = sCableCar->bg0VerticalOffset; + sCableCar->unk19 = (sCableCar->unk19 + 30) % 32; + sCableCar->unk18 -= 2; + gUnknown_0203ABB2 = (sCableCar->unk1A + 23) % 32; + for (i = 0; i < 9; i++) + { + gUnknown_0203ABB0 = sCableCar->unk19; + gUnknown_0203ABB1 = (gUnknown_0203ABB2 + i) % 32; + FillBgTilemapBufferRect(0, sCableCar->unk22[i][sCableCar->unk18], gUnknown_0203ABB0, gUnknown_0203ABB1, 1, 1, 17); + gUnknown_0203ABB0 = (gUnknown_0203ABB0 + 1) % 32; + FillBgTilemapBufferRect(0, sCableCar->unk22[i][sCableCar->unk18 + 1], gUnknown_0203ABB0, gUnknown_0203ABB1, 1, 1, 17); + } + + gUnknown_0203ABB0 = (sCableCar->unk19 + 30) % 32; + FillBgTilemapBufferRect(0, 0, gUnknown_0203ABB0, 0, 2, 32, 17); + if (sCableCar->unk18 == 0) + { + sCableCar->unk1A = (sCableCar->unk1A + 29) % 32; + sCableCar->unk18 = 12; + sub_8151088(); + gUnknown_0203ABB0 = (sCableCar->unk1A + 1) % 32; + FillBgTilemapBufferRect(0, 0, 0, gUnknown_0203ABB0, 32, 9, 17); + } +} + +static void sub_8151388(void) +{ + u8 i = 0; + + sCableCar->unk1D = sCableCar->unk1E = 0; + sCableCar->unk1F = sCableCar->bg0HorizontalOffset; + sCableCar->unk20 = sCableCar->bg0VerticalOffset; + sCableCar->unk19 = (sCableCar->unk19 + 2) % 32; + sCableCar->unk18 += 2; + gUnknown_0203ABB5 = sCableCar->unk1A; + for (i = 0; i < 9; i++) + { + gUnknown_0203ABB3 = sCableCar->unk19; + gUnknown_0203ABB4 = (gUnknown_0203ABB5 + i) % 32; + FillBgTilemapBufferRect(0, sCableCar->unk22[i][sCableCar->unk18], gUnknown_0203ABB3, gUnknown_0203ABB4, 1, 1, 17); + gUnknown_0203ABB3 = (gUnknown_0203ABB3 + 1) % 32; + FillBgTilemapBufferRect(0, sCableCar->unk22[i][sCableCar->unk18 + 1], gUnknown_0203ABB3, gUnknown_0203ABB4, 1, 1, 17); + } + + gUnknown_0203ABB4 = (sCableCar->unk1A + 23) % 32; + FillBgTilemapBufferRect(0, 0, sCableCar->unk19, gUnknown_0203ABB4, 2, 9, 17); + if (sCableCar->unk18 == 10) + { + sCableCar->unk1A = (sCableCar->unk1A + 3) % 32; + sCableCar->unk18 = 0xfe; + sub_8151088(); + } +} + +static void sub_81514C8(u8 arg0) +{ + switch (arg0) + { + case 0: + default: + sCableCar->unk1B = 2; + sCableCar->unk19 = 0; + sCableCar->unk1A = 20; + sCableCar->unk18 = 12; + sub_8151088(); + sub_8151214(); + break; + case 1: + sCableCar->unk1B = 2; + sCableCar->unk19 = 28; + sCableCar->unk1A = 20; + sCableCar->unk18 = 4; + sub_8151088(); + sub_8151388(); + break; + } + + sCableCar->unk1C = 0; +} diff --git a/src/overworld.c b/src/overworld.c index 417c52a9e..6998c9d98 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -147,7 +147,6 @@ extern void ResetAllPicSprites(void); extern void FieldEffectActiveListClear(void); extern void SetUpFieldTasks(void); extern void sub_81BE6B8(void); -extern void StartWeather(void); extern void ShowStartMenu(void); extern void sub_80AEE84(void); extern void mapldr_default(void); diff --git a/sym_ewram.txt b/sym_ewram.txt index 9d6d77a9a..b413f287d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -334,28 +334,7 @@ gUnknown_0203AB8C: @ 203AB8C .include "src/coins.o" .include "src/battle_transition.o" .include "src/battle_message.o" - -gUnknown_0203ABAC: @ 203ABAC - .space 0x4 - -gUnknown_0203ABB0: @ 203ABB0 - .space 0x1 - -gUnknown_0203ABB1: @ 203ABB1 - .space 0x1 - -gUnknown_0203ABB2: @ 203ABB2 - .space 0x1 - -gUnknown_0203ABB3: @ 203ABB3 - .space 0x1 - -gUnknown_0203ABB4: @ 203ABB4 - .space 0x1 - -gUnknown_0203ABB5: @ 203ABB5 - .space 0x3 - + .include "src/cable_car.o" .include "src/rom_81520A8.o" .include "src/save.o" .include "src/mystery_event_script.o"