diff --git a/asm/cable_car.s b/asm/cable_car.s index 276b878e2..96bc91a41 100644 --- a/asm/cable_car.s +++ b/asm/cable_car.s @@ -170,9 +170,9 @@ _0814FDD8: bl FreeAllSpritePalettes bl ResetPaletteFade bl reset_temp_tile_data_buffers - bl sub_80AAFA4 + bl StartWeather movs r4, 0 - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r0, [r0] adds r1, r0, 0 adds r1, 0xF0 @@ -334,7 +334,7 @@ _0814FF98: b _08150224 .pool _0814FFB4: - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r0, [r0] adds r1, r0, 0 adds r1, 0xF0 @@ -649,7 +649,7 @@ c2_8011A1C: @ 8150258 bl sub_80AB130 add r0, sp, 0x4 mov r8, r0 - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r0, [r0] adds r1, r0, 0 adds r1, 0xF0 @@ -831,7 +831,7 @@ _08150422: b _08150542 _0815042E: ldrb r0, [r3, 0x2] - bl weather_set + bl ChangeWeather ldr r1, [r5] movs r0, 0x1 strb r0, [r1, 0x1] @@ -844,7 +844,7 @@ _0815043C: beq _08150448 b _08150542 _08150448: - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r0, [r0] adds r2, r0, 0 adds r2, 0xF0 @@ -881,7 +881,7 @@ _08150478: b _08150542 .pool _08150490: - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r2, [r0] movs r1, 0xDA lsls r1, 3 @@ -1290,7 +1290,7 @@ _081507B6: b _081507E6 .pool _081507DC: - ldr r0, =gUnknown_0854C14C + ldr r0, =gWeatherPtr ldr r4, [r0] ldr r0, =0x000006fc adds r4, r0 diff --git a/asm/field_screen.s b/asm/field_screen.s index 8a97644ac..904a68ba1 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -5,7816 +5,6 @@ .text - thumb_func_start sub_80AAFA4 -@ void sub_80AAFA4() -sub_80AAFA4: @ 80AAFA4 - push {r4-r6,lr} - ldr r0, =sub_80AB1B0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - bne _080AB060 - movs r0, 0x90 - lsls r0, 5 - bl AllocSpritePalette - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0854C270 - lsls r1, r5, 5 - ldr r2, =gPlttBufferUnfaded + 0x200 - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - bl sub_80AB294 - ldr r4, =gUnknown_02038454 - ldr r1, =0x000006d5 - adds r0, r4, r1 - strb r5, [r0] - ldr r0, =0x00001201 - bl AllocSpritePalette - ldr r2, =0x000006d4 - adds r1, r4, r2 - strb r0, [r1] - ldr r1, =0x000006da - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0x4 - adds r0, r4, r2 - strb r6, [r0] - adds r1, 0x4 - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0xC - adds r0, r4, r2 - strb r6, [r0] - adds r1, 0x22 - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0x17 - adds r0, r4, r2 - strb r6, [r0] - adds r1, 0x24 - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0x1B - adds r0, r4, r2 - strb r6, [r0] - subs r1, 0xD - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0x18 - adds r0, r4, r2 - strb r6, [r0] - subs r1, 0x1D - adds r0, r4, r1 - strb r6, [r0] - movs r0, 0x10 - movs r1, 0 - bl sub_80AC124 - movs r2, 0xDA - lsls r2, 3 - adds r0, r4, r2 - strb r6, [r0] - ldr r0, =0x000006c6 - adds r1, r4, r0 - movs r0, 0x3 - strb r0, [r1] - movs r1, 0xD9 - lsls r1, 3 - adds r0, r4, r1 - strb r6, [r0] - adds r2, 0x3 - adds r1, r4, r2 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =sub_80AB160 - movs r1, 0x50 - bl CreateTask - ldr r1, =0x000006c9 - adds r4, r1 - strb r0, [r4] -_080AB060: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AAFA4 - - thumb_func_start weather_set -weather_set: @ 80AB098 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - beq _080AB0AE - cmp r4, 0x5 - beq _080AB0AE - cmp r4, 0xD - beq _080AB0AE - bl play_some_sound -_080AB0AE: - ldr r1, =gUnknown_02038454 - ldr r2, =0x000006d1 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, r4 - beq _080AB0D2 - movs r3, 0xDA - lsls r3, 3 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r4 - bne _080AB0D2 - ldr r0, =gUnknown_0854C150 - lsls r1, r4, 4 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 -_080AB0D2: - ldr r1, =gUnknown_02038454 - ldr r2, =0x000006d3 - adds r0, r1, r2 - movs r2, 0 - strb r2, [r0] - ldr r3, =0x000006d1 - adds r0, r1, r3 - strb r4, [r0] - ldr r0, =0x000006ce - adds r1, r0 - strh r2, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end weather_set - - thumb_func_start sub_80AB104 -sub_80AB104: @ 80AB104 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl play_some_sound - ldr r0, =gUnknown_02038454 - movs r2, 0xDA - lsls r2, 3 - adds r1, r0, r2 - strb r4, [r1] - ldr r1, =0x000006d1 - adds r0, r1 - strb r4, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB104 - - thumb_func_start sub_80AB130 -sub_80AB130: @ 80AB130 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl play_some_sound - ldr r1, =gUnknown_02038454 - movs r2, 0xDA - lsls r2, 3 - adds r0, r1, r2 - strb r4, [r0] - adds r2, 0x1 - adds r0, r1, r2 - strb r4, [r0] - movs r0, 0xD9 - lsls r0, 3 - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB130 - - thumb_func_start sub_80AB160 -sub_80AB160: @ 80AB160 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r2, =gUnknown_02038454 - movs r1, 0xD9 - lsls r1, 3 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080AB198 - ldr r1, =gUnknown_0854C150 - movs r3, 0xDA - lsls r3, 3 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 4 - adds r1, 0x8 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80AB1B0 - str r1, [r0] -_080AB198: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB160 - - thumb_func_start sub_80AB1B0 -sub_80AB1B0: @ 80AB1B0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gUnknown_02038454 - movs r0, 0xDA - lsls r0, 3 - adds r6, r5, r0 - ldr r1, =0x000006d1 - adds r7, r5, r1 - ldrb r0, [r6] - ldrb r2, [r7] - cmp r0, r2 - beq _080AB22C - ldr r0, =gUnknown_0854C150 - mov r9, r0 - ldrb r0, [r6] - lsls r0, 4 - mov r1, r9 - adds r1, 0xC - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080AB23C - ldr r1, =0x000006c6 - adds r1, r5 - mov r8, r1 - ldrb r0, [r1] - cmp r0, 0x2 - beq _080AB23C - ldrb r0, [r7] - lsls r0, 4 - add r0, r9 - ldr r0, [r0] - bl _call_via_r0 - ldr r2, =0x000006c3 - adds r0, r5, r2 - strb r4, [r0] - mov r0, r8 - strb r4, [r0] - ldrb r0, [r7] - strb r0, [r6] - adds r2, 0x10 - adds r1, r5, r2 - movs r0, 0x1 - strb r0, [r1] - b _080AB23C - .pool -_080AB22C: - ldr r0, =gUnknown_0854C150 - ldrb r1, [r6] - lsls r1, 4 - adds r0, 0x4 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 -_080AB23C: - ldr r1, =gUnknown_0854C240 - ldr r0, =gUnknown_02038454 - ldr r2, =0x000006c6 - adds r0, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB1B0 - - thumb_func_start sub_80AB26C -sub_80AB26C: @ 80AB26C - ldr r0, =gUnknown_02038454 - ldr r2, =0x000006c1 - adds r1, r0, r2 - movs r2, 0 - strb r2, [r1] - ldr r1, =0x000006c2 - adds r0, r1 - strb r2, [r0] - bx lr - .pool - thumb_func_end sub_80AB26C - - thumb_func_start nullsub_36 -nullsub_36: @ 80AB28C - bx lr - thumb_func_end nullsub_36 - - thumb_func_start sub_80AB290 -sub_80AB290: @ 80AB290 - movs r0, 0 - bx lr - thumb_func_end sub_80AB290 - - thumb_func_start sub_80AB294 -sub_80AB294: @ 80AB294 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r1, =gUnknown_03000F50 - ldr r0, =gUnknown_0854C250 - str r0, [r1] - movs r0, 0 - mov r12, r0 - ldr r1, =gUnknown_020388B4 - mov r10, r1 -_080AB2AC: - mov r7, r10 - mov r0, r12 - cmp r0, 0 - bne _080AB2B8 - ldr r1, =0xfffffda0 - adds r7, r1 -_080AB2B8: - movs r5, 0 - movs r0, 0x1 - add r0, r12 - mov r9, r0 -_080AB2C0: - lsls r1, r5, 8 - lsls r0, r5, 24 - lsrs r2, r0, 16 - mov r0, r12 - cmp r0, 0 - bne _080AB2E4 - adds r0, r1, 0 - lsls r0, 12 - lsrs r4, r0, 16 - b _080AB2E6 - .pool -_080AB2E4: - movs r4, 0 -_080AB2E6: - movs r3, 0 - adds r1, r5, 0x1 - mov r8, r1 -_080AB2EC: - subs r1, r2, r4 - lsls r1, 16 - lsrs r2, r1, 16 - lsls r0, r3, 5 - adds r0, r7 - adds r0, r5 - lsrs r1, 24 - strb r1, [r0] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x2 - bls _080AB2EC - adds r6, r2, 0 - movs r0, 0xF8 - lsls r0, 5 - subs r0, r2 - cmp r0, 0 - bge _080AB314 - adds r0, 0xF -_080AB314: - lsls r0, 12 - lsrs r4, r0, 16 - cmp r5, 0xB - bhi _080AB35E - cmp r3, 0x12 - bhi _080AB384 -_080AB320: - adds r0, r2, r4 - lsls r0, 16 - lsrs r2, r0, 16 - subs r0, r2, r6 - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - ble _080AB33C - lsrs r0, 31 - adds r0, r1, r0 - asrs r0, 1 - subs r0, r2, r0 - lsls r0, 16 - lsrs r2, r0, 16 -_080AB33C: - lsls r0, r3, 5 - adds r0, r7 - adds r1, r0, r5 - lsrs r0, r2, 8 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1F - bls _080AB352 - movs r0, 0x1F - strb r0, [r1] -_080AB352: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x12 - bls _080AB320 - b _080AB384 -_080AB35E: - cmp r3, 0x12 - bhi _080AB384 - movs r6, 0x1F -_080AB364: - adds r1, r2, r4 - lsls r1, 16 - lsrs r2, r1, 16 - lsls r0, r3, 5 - adds r0, r7 - adds r0, r5 - lsrs r1, 24 - strb r1, [r0] - cmp r1, 0x1F - bls _080AB37A - strb r6, [r0] -_080AB37A: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x12 - bls _080AB364 -_080AB384: - mov r1, r8 - lsls r0, r1, 16 - lsrs r5, r0, 16 - cmp r5, 0x1F - bls _080AB2C0 - mov r1, r9 - lsls r0, r1, 16 - lsrs r0, 16 - mov r12, r0 - cmp r0, 0x1 - bls _080AB2AC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80AB294 - - thumb_func_start sub_80AB3A8 -sub_80AB3A8: @ 80AB3A8 - push {r4-r7,lr} - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r2, r0, r1 - ldrb r1, [r2] - adds r3, r0, 0 - cmp r1, 0x2 - beq _080AB42C - movs r7, 0xD8 - lsls r7, 3 - adds r4, r3, r7 - ldr r1, =0x000006c1 - adds r0, r3, r1 - ldrb r7, [r4] - mov r12, r7 - movs r6, 0 - ldrsb r6, [r4, r6] - movs r5, 0 - ldrsb r5, [r0, r5] - cmp r6, r5 - bne _080AB3E4 - movs r0, 0x3 - strb r0, [r2] - b _080AB42C - .pool -_080AB3E4: - ldr r0, =0x000006c3 - adds r2, r3, r0 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - ldr r7, =0x000006c2 - adds r1, r3, r7 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bcc _080AB42C - movs r0, 0 - strb r0, [r2] - mov r0, r12 - cmp r6, r5 - bge _080AB414 - adds r0, 0x1 - b _080AB418 - .pool -_080AB414: - mov r0, r12 - subs r0, 0x1 -_080AB418: - strb r0, [r4] - movs r1, 0xD8 - lsls r1, 3 - adds r0, r3, r1 - movs r2, 0 - ldrsb r2, [r0, r2] - movs r0, 0 - movs r1, 0x20 - bl pal_fade_2 -_080AB42C: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80AB3A8 - - thumb_func_start sub_80AB434 -sub_80AB434: @ 80AB434 - push {lr} - ldr r2, =gUnknown_02038454 - ldr r0, =0x000006cb - adds r1, r2, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _080AB452 - ldr r3, =0x000006ca - adds r1, r2, r3 - movs r0, 0 - strb r0, [r1] -_080AB452: - movs r1, 0xDA - lsls r1, 3 - adds r0, r2, r1 - ldrb r0, [r0] - subs r0, 0x3 - cmp r0, 0xA - bhi _080AB51C - lsls r0, 2 - ldr r1, =_080AB47C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AB47C: - .4byte _080AB4A8 - .4byte _080AB4A8 - .4byte _080AB4A8 - .4byte _080AB4F4 - .4byte _080AB51C - .4byte _080AB51C - .4byte _080AB51C - .4byte _080AB51C - .4byte _080AB4A8 - .4byte _080AB4D0 - .4byte _080AB4A8 -_080AB4A8: - bl sub_80AB54C - lsls r0, 24 - cmp r0, 0 - bne _080AB53C - ldr r0, =gUnknown_02038454 - movs r2, 0xD8 - lsls r2, 3 - adds r1, r0, r2 - movs r2, 0x3 - strb r2, [r1] - ldr r3, =0x000006c6 - adds r0, r3 - strb r2, [r0] - b _080AB53C - .pool -_080AB4D0: - bl sub_80AB5AC - lsls r0, 24 - cmp r0, 0 - bne _080AB53C - ldr r1, =gUnknown_02038454 - movs r0, 0xD8 - lsls r0, 3 - adds r2, r1, r0 - movs r0, 0xFA - strb r0, [r2] - ldr r2, =0x000006c6 - adds r1, r2 - b _080AB538 - .pool -_080AB4F4: - bl sub_80AB604 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _080AB53C - ldr r0, =gUnknown_02038454 - movs r3, 0xD8 - lsls r3, 3 - adds r1, r0, r3 - strb r2, [r1] - ldr r1, =0x000006c6 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] - b _080AB53C - .pool -_080AB51C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080AB53C - ldr r3, =0x000006c1 - adds r0, r2, r3 - ldrb r1, [r0] - subs r3, 0x1 - adds r0, r2, r3 - strb r1, [r0] - ldr r0, =0x000006c6 - adds r1, r2, r0 -_080AB538: - movs r0, 0x3 - strb r0, [r1] -_080AB53C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB434 - - thumb_func_start sub_80AB54C -sub_80AB54C: @ 80AB54C - push {r4,lr} - sub sp, 0x4 - ldr r2, =gUnknown_02038454 - ldr r0, =0x000006c7 - adds r4, r2, r0 - ldrb r0, [r4] - cmp r0, 0x10 - beq _080AB5A2 - adds r1, r0, 0x1 - strb r1, [r4] - lsls r0, r1, 24 - lsrs r0, 24 - cmp r0, 0xF - bhi _080AB594 - movs r3, 0x10 - subs r3, r1 - lsls r3, 24 - lsrs r3, 24 - ldr r1, =0x000006c4 - adds r0, r2, r1 - ldrh r0, [r0] - str r0, [sp] - movs r0, 0 - movs r1, 0x20 - movs r2, 0x3 - bl sub_80AB848 - movs r0, 0x1 - b _080AB5A4 - .pool -_080AB594: - movs r0, 0 - movs r1, 0x20 - movs r2, 0x3 - bl pal_fade_2 - movs r0, 0x10 - strb r0, [r4] -_080AB5A2: - movs r0, 0 -_080AB5A4: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AB54C - - thumb_func_start sub_80AB5AC -sub_80AB5AC: @ 80AB5AC - push {r4,lr} - ldr r2, =gUnknown_02038454 - ldr r0, =0x000006c7 - adds r4, r2, r0 - ldrb r0, [r4] - cmp r0, 0x10 - beq _080AB5FC - adds r3, r0, 0x1 - strb r3, [r4] - lsls r0, r3, 24 - lsrs r0, 24 - cmp r0, 0xF - bhi _080AB5EC - movs r0, 0x6 - negs r0, r0 - movs r1, 0x10 - subs r1, r3 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =0x000006c4 - adds r2, r3 - ldrh r2, [r2] - bl sub_80AB990 - movs r0, 0x1 - b _080AB5FE - .pool -_080AB5EC: - movs r2, 0x6 - negs r2, r2 - movs r0, 0 - movs r1, 0x20 - bl pal_fade_2 - movs r0, 0x10 - strb r0, [r4] -_080AB5FC: - movs r0, 0 -_080AB5FE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AB5AC - - thumb_func_start sub_80AB604 -sub_80AB604: @ 80AB604 - push {lr} - ldr r2, =gUnknown_02038454 - ldr r1, =0x000006c7 - adds r0, r2, r1 - ldrb r1, [r0] - cmp r1, 0x10 - beq _080AB638 - adds r1, 0x1 - strb r1, [r0] - movs r0, 0x10 - subs r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0x000006c4 - adds r1, r2, r3 - ldrh r1, [r1] - bl sub_80ABAB0 - movs r0, 0x1 - b _080AB63A - .pool -_080AB638: - movs r0, 0 -_080AB63A: - pop {r1} - bx r1 - thumb_func_end sub_80AB604 - - thumb_func_start nullsub_94 -nullsub_94: @ 80AB640 - bx lr - thumb_func_end nullsub_94 - - thumb_func_start pal_fade_2 -pal_fade_2: @ 80AB644 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r3, r0, 24 - adds r4, r3, 0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r2, 24 - asrs r0, r2, 24 - cmp r0, 0 - ble _080AB754 - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r6, r3, 4 - adds r0, r1, r3 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r4, r9 - bcc _080AB67C - b _080AB82E -_080AB67C: - ldr r1, [sp] - lsls r0, r1, 24 - asrs r0, 19 - str r0, [sp, 0x4] -_080AB684: - ldr r0, =gUnknown_03000F50 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080AB6C0 - lsls r1, r6, 1 - ldr r0, =gPlttBufferUnfaded - adds r0, r1, r0 - ldr r2, =gPlttBufferFaded - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet - adds r0, r6, 0 - adds r0, 0x10 - lsls r0, 16 - lsrs r6, r0, 16 - mov r2, r9 - lsls r2, 16 - mov r8, r2 - adds r4, 0x1 - mov r12, r4 - b _080AB73E - .pool -_080AB6C0: - cmp r0, 0x2 - beq _080AB6D4 - adds r1, r4, 0 - subs r1, 0x10 - ldr r2, =gUnknown_02038454 - ldr r3, =0x000006d5 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r1, r0 - bne _080AB6E4 -_080AB6D4: - ldr r0, =gUnknown_020388B4 - b _080AB6EA - .pool -_080AB6E4: - movs r3, 0x80 - lsls r3, 2 - adds r0, r2, r3 -_080AB6EA: - ldr r1, [sp, 0x4] - adds r5, r1, r0 - movs r7, 0 - mov r2, r9 - lsls r2, 16 - mov r8, r2 - adds r4, 0x1 - mov r12, r4 - ldr r3, =gPlttBufferFaded - mov r10, r3 -_080AB6FE: - adds r2, r6, 0 - lsls r0, r2, 1 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - ldr r1, [r0] - lsls r0, r1, 27 - lsrs r0, 27 - adds r0, r5, r0 - ldrb r4, [r0] - lsls r0, r1, 22 - lsrs r0, 27 - adds r0, r5, r0 - ldrb r3, [r0] - lsls r1, 17 - lsrs r1, 27 - adds r1, r5, r1 - ldrb r1, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r2, 1 - add r2, r10 - lsls r1, 10 - lsls r3, 5 - orrs r1, r3 - orrs r1, r4 - strh r1, [r2] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0xF - bls _080AB6FE -_080AB73E: - mov r2, r12 - lsls r0, r2, 16 - lsrs r4, r0, 16 - cmp r0, r8 - bcc _080AB684 - b _080AB82E - .pool -_080AB754: - cmp r0, 0 - bge _080AB81C - mvns r0, r0 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r6, r3, 4 - adds r0, r1, r3 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r4, r3, 0 - cmp r4, r9 - bcs _080AB82E -_080AB770: - ldr r0, =gUnknown_03000F50 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080AB7AC - lsls r1, r6, 1 - ldr r0, =gPlttBufferUnfaded - adds r0, r1, r0 - ldr r2, =gPlttBufferFaded - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet - adds r0, r6, 0 - adds r0, 0x10 - lsls r0, 16 - lsrs r6, r0, 16 - mov r3, r9 - lsls r3, 16 - mov r8, r3 - adds r4, 0x1 - mov r12, r4 - b _080AB804 - .pool -_080AB7AC: - movs r7, 0 - mov r0, r9 - lsls r0, 16 - mov r8, r0 - adds r4, 0x1 - mov r12, r4 - ldr r1, =gUnknown_0854014C - mov r10, r1 - ldr r2, [sp] - lsls r0, r2, 24 - asrs r5, r0, 11 -_080AB7C2: - lsls r0, r6, 1 - ldr r3, =gPlttBufferFaded - adds r4, r0, r3 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - ldrh r3, [r0] - lsls r3, 16 - lsrs r0, r3, 17 - movs r1, 0xF - ands r0, r1 - lsrs r1, r3, 18 - movs r2, 0xF0 - ands r1, r2 - orrs r0, r1 - lsrs r3, 19 - movs r2, 0xF0 - lsls r2, 4 - adds r1, r2, 0 - ands r3, r1 - orrs r0, r3 - lsls r0, 1 - adds r0, r5 - add r0, r10 - ldrh r0, [r0] - strh r0, [r4] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0xF - bls _080AB7C2 -_080AB804: - mov r3, r12 - lsls r0, r3, 16 - lsrs r4, r0, 16 - cmp r0, r8 - bcc _080AB770 - b _080AB82E - .pool -_080AB81C: - lsls r1, r4, 5 - ldr r0, =gPlttBufferUnfaded - adds r0, r1, r0 - ldr r2, =gPlttBufferFaded - adds r1, r2 - mov r3, r9 - lsls r2, r3, 3 - bl CpuFastSet -_080AB82E: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end pal_fade_2 - - thumb_func_start sub_80AB848 -sub_80AB848: @ 80AB848 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - ldr r4, [sp, 0x34] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - mov r1, sp - strh r4, [r1] - ldr r1, [sp] - lsls r3, r1, 27 - lsrs r3, 27 - str r3, [sp, 0x4] - lsls r3, r1, 22 - lsrs r3, 27 - str r3, [sp, 0x8] - lsls r1, 17 - lsrs r1, 27 - str r1, [sp, 0xC] - lsls r6, r0, 4 - mov r3, r10 - adds r1, r3, r0 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - movs r1, 0xFF - lsls r1, 24 - adds r2, r1 - lsrs r2, 24 - adds r4, r0, 0 - cmp r4, r10 - bcs _080AB974 - lsls r0, r2, 24 - asrs r0, 19 - str r0, [sp, 0x10] -_080AB8A0: - ldr r0, =gUnknown_03000F50 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080AB8D4 - mov r0, sp - ldrh r3, [r0] - adds r0, r6, 0 - movs r1, 0x10 - mov r2, r8 - bl BlendPalette - adds r0, r6, 0 - adds r0, 0x10 - lsls r0, 16 - lsrs r6, r0, 16 - mov r3, r10 - lsls r3, 16 - mov r9, r3 - adds r4, 0x1 - mov r12, r4 - b _080AB96A - .pool -_080AB8D4: - cmp r0, 0x1 - bne _080AB8E4 - ldr r0, =gUnknown_02038654 - ldr r1, [sp, 0x10] - adds r5, r1, r0 - b _080AB8EA - .pool -_080AB8E4: - ldr r0, =gUnknown_020388B4 - ldr r3, [sp, 0x10] - adds r5, r3, r0 -_080AB8EA: - movs r7, 0 - mov r0, r10 - lsls r0, 16 - mov r9, r0 - adds r4, 0x1 - mov r12, r4 -_080AB8F6: - adds r4, r6, 0 - lsls r0, r4, 1 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - ldr r1, [r0] - lsls r0, r1, 27 - lsrs r0, 27 - adds r0, r5, r0 - ldrb r3, [r0] - lsls r0, r1, 22 - lsrs r0, 27 - adds r0, r5, r0 - ldrb r2, [r0] - lsls r1, 17 - lsrs r1, 27 - adds r1, r5, r1 - ldrb r1, [r1] - ldr r6, [sp, 0x4] - subs r0, r6, r3 - mov r6, r8 - muls r6, r0 - adds r0, r6, 0 - asrs r0, 4 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldr r6, [sp, 0x8] - subs r0, r6, r2 - mov r6, r8 - muls r6, r0 - adds r0, r6, 0 - asrs r0, 4 - adds r2, r0 - lsls r2, 24 - ldr r6, [sp, 0xC] - subs r0, r6, r1 - mov r6, r8 - muls r6, r0 - adds r0, r6, 0 - asrs r0, 4 - adds r1, r0 - lsls r1, 24 - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r4, 1 - ldr r0, =gPlttBufferFaded - adds r4, r0 - lsrs r1, 14 - lsrs r2, 19 - orrs r1, r2 - orrs r1, r3 - strh r1, [r4] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0xF - bls _080AB8F6 -_080AB96A: - mov r1, r12 - lsls r0, r1, 16 - lsrs r4, r0, 16 - cmp r0, r9 - bcc _080AB8A0 -_080AB974: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AB848 - - thumb_func_start sub_80AB990 -sub_80AB990: @ 80AB990 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r1, 24 - lsrs r6, r1, 24 - mov r1, sp - strh r2, [r1] - lsls r0, 24 - movs r1, 0xFF - lsls r1, 24 - eors r0, r1 - lsrs r0, 24 - str r0, [sp, 0x4] - ldr r0, [sp] - lsls r1, r0, 27 - lsrs r1, 27 - str r1, [sp, 0x8] - lsls r1, r0, 22 - lsrs r1, 27 - str r1, [sp, 0xC] - lsls r0, 17 - lsrs r0, 27 - mov r10, r0 - movs r5, 0 - movs r4, 0 -_080AB9C8: - ldr r0, =gUnknown_03000F50 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080AB9F4 - mov r0, sp - ldrh r3, [r0] - adds r0, r5, 0 - movs r1, 0x10 - adds r2, r6, 0 - bl BlendPalette - adds r0, r5, 0 - adds r0, 0x10 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - mov r8, r4 - b _080ABA8A - .pool -_080AB9F4: - movs r0, 0 - mov r12, r0 - ldr r1, [sp, 0x4] - lsls r0, r1, 24 - adds r4, 0x1 - mov r8, r4 - movs r7, 0x1E - asrs r0, 11 - mov r9, r0 -_080ABA06: - adds r4, r5, 0 - lsls r0, r4, 1 - ldr r5, =gPlttBufferUnfaded - adds r0, r5 - ldr r0, [r0] - lsls r2, r0, 27 - lsrs r2, 27 - lsls r1, r0, 22 - lsrs r1, 27 - lsls r0, 17 - lsrs r0, 27 - ands r0, r7 - lsls r0, 7 - ands r1, r7 - lsls r1, 3 - orrs r0, r1 - ands r2, r7 - lsls r0, 1 - orrs r0, r2 - add r0, r9 - ldr r1, =gUnknown_0854014C - adds r0, r1 - ldr r1, [r0] - lsls r3, r1, 27 - lsrs r3, 27 - lsls r2, r1, 22 - lsrs r2, 27 - lsls r1, 17 - lsrs r1, 27 - ldr r5, [sp, 0x8] - subs r0, r5, r3 - muls r0, r6 - asrs r0, 4 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldr r5, [sp, 0xC] - subs r0, r5, r2 - muls r0, r6 - asrs r0, 4 - adds r2, r0 - lsls r2, 24 - mov r5, r10 - subs r0, r5, r1 - muls r0, r6 - asrs r0, 4 - adds r1, r0 - lsls r1, 24 - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r4, 1 - ldr r0, =gPlttBufferFaded - adds r4, r0 - lsrs r1, 14 - lsrs r2, 19 - orrs r1, r2 - orrs r1, r3 - strh r1, [r4] - mov r0, r12 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r12, r0 - cmp r0, 0xF - bls _080ABA06 -_080ABA8A: - mov r1, r8 - lsls r0, r1, 16 - lsrs r4, r0, 16 - cmp r4, 0x1F - bls _080AB9C8 - 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 sub_80AB990 - - thumb_func_start sub_80ABAB0 -sub_80ABAB0: @ 80ABAB0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r3, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r3, 16 - lsrs r3, 16 - mov r0, sp - strh r3, [r0] - movs r1, 0x80 - lsls r1, 1 - movs r0, 0 - adds r2, r7, 0 - bl BlendPalette - ldr r0, [sp] - lsls r1, r0, 27 - lsrs r1, 27 - str r1, [sp, 0x4] - lsls r1, r0, 22 - lsrs r1, 27 - str r1, [sp, 0x8] - lsls r0, 17 - lsrs r0, 27 - mov r10, r0 - movs r4, 0x10 -_080ABAEC: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80ABC00 - lsls r0, 24 - cmp r0, 0 - beq _080ABB9C - adds r0, r4, 0x1 - lsls r1, r0, 20 - lsrs r1, 16 - mov r12, r1 - lsls r1, r4, 20 - lsrs r6, r1, 16 - mov r9, r0 - cmp r6, r12 - bcs _080ABBB0 - movs r0, 0x1C - mov r8, r0 -_080ABB10: - lsls r5, r6, 1 - ldr r0, =gPlttBufferUnfaded - adds r0, r5, r0 - ldr r2, [r0] - lsls r4, r2, 27 - lsrs r4, 27 - lsls r3, r2, 22 - lsrs r3, 27 - lsls r2, 17 - lsrs r2, 27 - mov r0, r8 - subs r1, r0, r4 - lsls r0, r1, 1 - adds r0, r1 - asrs r0, 2 - adds r4, r0 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0x1F - subs r1, r3 - lsls r0, r1, 1 - adds r0, r1 - asrs r0, 2 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - subs r1, r0, r2 - lsls r0, r1, 1 - adds r0, r1 - asrs r0, 2 - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldr r1, [sp, 0x4] - subs r0, r1, r4 - muls r0, r7 - asrs r0, 4 - adds r4, r0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, [sp, 0x8] - subs r0, r1, r3 - muls r0, r7 - asrs r0, 4 - adds r3, r0 - lsls r3, 24 - mov r1, r10 - subs r0, r1, r2 - muls r0, r7 - asrs r0, 4 - adds r2, r0 - lsls r2, 24 - ldr r0, =gPlttBufferFaded - adds r5, r0 - lsrs r2, 14 - lsrs r3, 19 - orrs r2, r3 - orrs r2, r4 - strh r2, [r5] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, r12 - bcc _080ABB10 - b _080ABBB0 - .pool -_080ABB9C: - lsls r0, r4, 20 - lsrs r0, 16 - mov r1, sp - ldrh r3, [r1] - movs r1, 0x10 - adds r2, r7, 0 - bl BlendPalette - adds r4, 0x1 - mov r9, r4 -_080ABBB0: - mov r1, r9 - lsls r0, r1, 16 - lsrs r4, r0, 16 - cmp r4, 0x1F - bls _080ABAEC - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80ABAB0 - - thumb_func_start sub_80ABBCC -sub_80ABBCC: @ 80ABBCC - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r3, =gUnknown_02038454 - ldr r0, =0x000006fa - adds r1, r3, r0 - ldrb r0, [r1] - cmp r0, 0x5 - bhi _080ABBEE - ldr r4, =0x000006f4 - adds r0, r3, r4 - ldrb r3, [r1] - adds r0, r3 - strb r2, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080ABBEE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ABBCC - - thumb_func_start sub_80ABC00 -sub_80ABC00: @ 80ABC00 - push {r4,r5,lr} - lsls r0, 24 - lsrs r3, r0, 24 - movs r1, 0 - ldr r2, =gUnknown_02038454 - ldr r4, =0x000006fa - adds r0, r2, r4 - ldrb r0, [r0] - cmp r1, r0 - bcs _080ABC3E - ldr r5, =0x000006f4 - adds r4, r2, r5 - adds r2, r0, 0 -_080ABC1A: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, r3 - bne _080ABC34 - movs r0, 0x1 - b _080ABC40 - .pool -_080ABC34: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r2 - bcc _080ABC1A -_080ABC3E: - movs r0, 0 -_080ABC40: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80ABC00 - - thumb_func_start sub_80ABC48 -sub_80ABC48: @ 80ABC48 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _080ABC6E - lsls r2, r4, 24 - asrs r2, 24 - movs r0, 0 - movs r1, 0x20 - bl pal_fade_2 - movs r1, 0xD8 - lsls r1, 3 - adds r0, r5, r1 - strb r4, [r0] -_080ABC6E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ABC48 - - thumb_func_start sub_80ABC7C -sub_80ABC7C: @ 80ABC7C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r3, =gUnknown_02038454 - ldr r0, =0x000006c6 - adds r2, r3, r0 - ldrb r0, [r2] - cmp r0, 0x3 - bne _080ABCBC - movs r1, 0 - strb r1, [r2] - movs r2, 0xD8 - lsls r2, 3 - adds r0, r3, r2 - strb r4, [r0] - adds r2, 0x1 - adds r0, r3, r2 - strb r5, [r0] - adds r2, 0x2 - adds r0, r3, r2 - strb r1, [r0] - ldr r1, =0x000006c2 - adds r0, r3, r1 - strb r6, [r0] - lsls r0, r4, 24 - asrs r0, 24 - bl sub_80ABC48 -_080ABCBC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ABC7C - - thumb_func_start FadeScreen -FadeScreen: @ 80ABCD0 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r0, 0x1 - beq _080ABD08 - cmp r0, 0x1 - bgt _080ABCEC - cmp r0, 0 - beq _080ABCF6 - b _080ABDE4 -_080ABCEC: - cmp r2, 0x2 - beq _080ABCFC - cmp r2, 0x3 - beq _080ABD0C - b _080ABDE4 -_080ABCF6: - movs r4, 0 - movs r1, 0 - b _080ABD10 -_080ABCFC: - ldr r4, =0x0000ffff - movs r1, 0 - b _080ABD10 - .pool -_080ABD08: - movs r4, 0 - b _080ABD0E -_080ABD0C: - ldr r4, =0x0000ffff -_080ABD0E: - movs r1, 0x1 -_080ABD10: - ldr r0, =gUnknown_02038454 - movs r2, 0xDA - lsls r2, 3 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x3 - blt _080ABD38 - cmp r0, 0x6 - ble _080ABD2A - cmp r0, 0xD - bgt _080ABD38 - cmp r0, 0xB - blt _080ABD38 -_080ABD2A: - movs r2, 0x1 - b _080ABD3A - .pool -_080ABD38: - movs r2, 0 -_080ABD3A: - cmp r1, 0 - beq _080ABD7C - cmp r2, 0 - beq _080ABD4E - ldr r0, =gPlttBufferFaded - ldr r1, =gPlttBufferUnfaded - movs r2, 0x80 - lsls r2, 1 - bl CpuFastSet -_080ABD4E: - movs r0, 0x1 - negs r0, r0 - lsls r1, r5, 24 - asrs r1, 24 - str r4, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_02038454 - ldr r3, =0x000006c6 - adds r0, r3 - movs r1, 0x2 - strb r1, [r0] - b _080ABDE4 - .pool -_080ABD7C: - ldr r1, =gUnknown_02038454 - ldr r3, =0x000006c4 - adds r0, r1, r3 - strh r4, [r0] - cmp r2, 0 - beq _080ABDA0 - ldr r0, =0x000006c7 - adds r1, r0 - movs r0, 0 - strb r0, [r1] - b _080ABDB2 - .pool -_080ABDA0: - movs r0, 0x1 - negs r0, r0 - lsls r1, r5, 24 - asrs r1, 24 - str r4, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_080ABDB2: - ldr r4, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r0, r4, r1 - movs r1, 0 - movs r5, 0x1 - strb r5, [r0] - ldr r2, =0x000006ca - adds r0, r4, r2 - strb r5, [r0] - ldr r3, =0x000006cb - adds r0, r4, r3 - strb r1, [r0] - movs r1, 0xE6 - lsls r1, 3 - adds r0, r4, r1 - ldrb r0, [r0] - adds r2, 0x68 - adds r1, r4, r2 - ldrb r1, [r1] - bl sub_80AC124 - movs r3, 0xD9 - lsls r3, 3 - adds r4, r3 - strb r5, [r4] -_080ABDE4: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FadeScreen - - thumb_func_start IsWeatherNotFadingIn -IsWeatherNotFadingIn: @ 80ABDFC - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - bx lr - .pool - thumb_func_end IsWeatherNotFadingIn - - thumb_func_start UpdateSpritePaletteWithWeather -@ void UpdateSpritePaletteWithWeather(u8 a1) -UpdateSpritePaletteWithWeather: @ 80ABE18 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 8 - movs r1, 0x80 - lsls r1, 13 - adds r0, r1 - lsrs r4, r0, 16 - ldr r5, =gUnknown_02038454 - ldr r2, =0x000006c6 - adds r0, r5, r2 - ldrb r0, [r0] - adds r1, r5, 0 - cmp r0, 0x1 - beq _080ABE60 - cmp r0, 0x2 - beq _080ABEAC - adds r2, 0xA - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x6 - beq _080ABEE4 - lsls r0, r4, 24 - lsrs r0, 24 - subs r2, 0x10 - adds r1, r2 - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x1 - bl pal_fade_2 - b _080ABEF4 - .pool -_080ABE60: - ldr r2, =0x000006ca - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080ABEF4 - adds r2, 0x6 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x6 - bne _080ABE7C - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80ABBCC -_080ABE7C: - lsls r0, r4, 20 - lsrs r4, r0, 16 - movs r2, 0 - ldr r6, =gPlttBufferFaded - ldr r0, =0x000006c4 - adds r3, r5, r0 -_080ABE88: - adds r0, r4, r2 - lsls r0, 1 - adds r0, r6 - ldrh r1, [r3] - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0xF - bls _080ABE88 - b _080ABEF4 - .pool -_080ABEAC: - lsls r0, r4, 20 - lsrs r4, r0, 16 - lsls r1, r4, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet - ldr r0, =gPaletteFade - ldrh r2, [r0, 0x4] - lsls r2, 21 - lsrs r2, 27 - ldrh r3, [r0, 0x6] - lsls r3, 17 - lsrs r3, 17 - adds r0, r4, 0 - movs r1, 0x10 - bl BlendPalette - b _080ABEF4 - .pool -_080ABEE4: - lsls r0, r4, 20 - lsrs r4, r0, 16 - ldr r3, =0x000073fc - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0xC - bl BlendPalette -_080ABEF4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateSpritePaletteWithWeather - - thumb_func_start ApplyWeatherGammaShiftToPal -ApplyWeatherGammaShiftToPal: @ 80ABF00 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02038454 - movs r2, 0xD8 - lsls r2, 3 - adds r1, r2 - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x1 - bl pal_fade_2 - pop {r0} - bx r0 - .pool - thumb_func_end ApplyWeatherGammaShiftToPal - - thumb_func_start sub_80ABF20 -sub_80ABF20: @ 80ABF20 - push {lr} - ldr r1, =gUnknown_02038454 - ldr r2, =0x000006c6 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080ABF3C - movs r0, 0 - b _080ABF42 - .pool -_080ABF3C: - ldr r2, =0x000006ca - adds r0, r1, r2 - ldrb r0, [r0] -_080ABF42: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80ABF20 - - thumb_func_start sub_80ABF4C -sub_80ABF4C: @ 80ABF4C - push {r4,lr} - ldr r4, =gUnknown_02038454 - ldr r1, =0x000006d4 - adds r4, r1 - ldrb r1, [r4] - lsls r1, 20 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl LoadPalette - ldrb r0, [r4] - bl UpdateSpritePaletteWithWeather - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ABF4C - - thumb_func_start sub_80ABF7C -sub_80ABF7C: @ 80ABF7C - movs r2, 0x20 - strb r2, [r0] - strb r2, [r1] - bx lr - thumb_func_end sub_80ABF7C - - thumb_func_start sub_80ABF84 -sub_80ABF84: @ 80ABF84 - ldr r0, =gUnknown_02038454 - ldr r2, =0x0000074d - adds r1, r0, r2 - movs r2, 0x1 - strb r2, [r1] - ldr r1, =0x0000074e - adds r0, r1 - strb r2, [r0] - bx lr - .pool - thumb_func_end sub_80ABF84 - - thumb_func_start sub_80ABFA4 -sub_80ABFA4: @ 80ABFA4 - push {r4,lr} - ldr r1, =gUnknown_02038454 - ldr r0, =0x0000074d - adds r4, r1, r0 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x1F - bgt _080ABFD8 - ldr r0, =0x0000074e - adds r1, r0 - adds r0, r4, 0 - bl sub_80ABF7C - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x1F - bgt _080ABFD8 - movs r0, 0x1 - b _080ABFDA - .pool -_080ABFD8: - movs r0, 0 -_080ABFDA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80ABFA4 - - thumb_func_start sub_80ABFE0 -sub_80ABFE0: @ 80ABFE0 - push {lr} - lsls r0, 24 - asrs r0, 24 - mvns r0, r0 - bl sub_80ABC48 - pop {r0} - bx r0 - thumb_func_end sub_80ABFE0 - - thumb_func_start sub_80ABFF0 -sub_80ABFF0: @ 80ABFF0 - ldr r1, =gUnknown_02038454 - ldr r2, =0x0000073c - adds r0, r1, r2 - movs r2, 0 - strh r2, [r0] - movs r3, 0xE8 - lsls r3, 3 - adds r0, r1, r3 - strh r2, [r0] - adds r3, 0x2 - adds r0, r1, r3 - strh r2, [r0] - ldr r0, =0x0000073e - adds r1, r0 - strh r2, [r1] - bx lr - .pool - thumb_func_end sub_80ABFF0 - - thumb_func_start sub_80AC01C -sub_80AC01C: @ 80AC01C - push {r4-r7,lr} - ldr r5, =gUnknown_02038454 - ldr r0, =0x00000742 - adds r7, r5, r0 - movs r2, 0 - ldrsh r1, [r7, r2] - cmp r1, 0x1 - beq _080AC090 - cmp r1, 0x1 - bgt _080AC040 - cmp r1, 0 - beq _080AC046 - b _080AC118 - .pool -_080AC040: - cmp r1, 0x2 - beq _080AC0E4 - b _080AC118 -_080AC046: - movs r3, 0xE8 - lsls r3, 3 - adds r6, r5, r3 - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _080AC118 - strh r1, [r6] - ldr r0, =0x0000073c - adds r4, r5, r0 - ldrh r0, [r4] - adds r1, r0, 0x1 - strh r1, [r4] - lsls r0, 24 - asrs r0, 24 - bl sub_80ABFE0 - ldrh r1, [r4] - movs r2, 0 - ldrsh r0, [r4, r2] - cmp r0, 0x5 - ble _080AC118 - ldr r3, =0x0000073e - adds r0, r5, r3 - strh r1, [r0] - movs r0, 0x1 - strh r0, [r7] - movs r0, 0x3C - strh r0, [r6] - b _080AC118 - .pool -_080AC090: - movs r0, 0xE8 - lsls r0, 3 - adds r2, r5, r0 - ldrh r0, [r2] - adds r0, 0x3 - movs r1, 0x7F - ands r0, r1 - strh r0, [r2] - ldr r1, =gSineTable - movs r3, 0 - ldrsh r0, [r2, r3] - lsls r0, 1 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - subs r0, 0x1 - asrs r0, 6 - adds r0, 0x2 - ldr r2, =0x0000073c - adds r6, r5, r2 - adds r2, r0, 0 - strh r0, [r6] - ldr r3, =0x0000073e - adds r4, r5, r3 - movs r3, 0 - ldrsh r1, [r4, r3] - cmp r0, r1 - beq _080AC0D0 - lsls r0, r2, 24 - asrs r0, 24 - bl sub_80ABFE0 -_080AC0D0: - ldrh r0, [r6] - strh r0, [r4] - b _080AC118 - .pool -_080AC0E4: - movs r0, 0xE8 - lsls r0, 3 - adds r1, r5, r0 - ldrh r0, [r1] - adds r0, 0x1 - movs r6, 0 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _080AC118 - strh r6, [r1] - ldr r1, =0x0000073c - adds r4, r5, r1 - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r4] - lsls r0, 24 - asrs r0, 24 - bl sub_80ABFE0 - movs r2, 0 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - bne _080AC118 - strh r6, [r7] -_080AC118: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC01C - - thumb_func_start sub_80AC124 -sub_80AC124: @ 80AC124 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gUnknown_02038454 - movs r4, 0xE6 - lsls r4, 3 - adds r2, r3, r4 - strh r0, [r2] - adds r4, 0x2 - adds r2, r3, r4 - strh r1, [r2] - adds r4, 0x2 - adds r2, r3, r4 - strh r0, [r2] - ldr r2, =0x00000736 - adds r3, r2 - strh r1, [r3] - lsls r1, 8 - orrs r1, r0 - movs r0, 0x52 - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC124 - - thumb_func_start sub_80AC164 -sub_80AC164: @ 80AC164 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gUnknown_02038454 - ldr r5, =0x00000734 - adds r4, r3, r5 - movs r5, 0 - strh r0, [r4] - ldr r4, =0x00000736 - adds r0, r3, r4 - strh r1, [r0] - ldr r1, =0x0000073a - adds r0, r3, r1 - strb r2, [r0] - adds r4, 0x3 - adds r0, r3, r4 - strb r5, [r0] - movs r0, 0xE7 - lsls r0, 3 - adds r3, r0 - strb r5, [r3] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC164 - - thumb_func_start sub_80AC1A8 -sub_80AC1A8: @ 80AC1A8 - push {r4-r6,lr} - ldr r0, =gUnknown_02038454 - movs r1, 0xE6 - lsls r1, 3 - adds r3, r0, r1 - ldr r2, [r3] - ldr r6, =0x00000734 - adds r4, r0, r6 - ldr r1, [r4] - adds r5, r0, 0 - cmp r2, r1 - beq _080AC26C - ldr r0, =0x00000739 - adds r2, r5, r0 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - ldr r6, =0x0000073a - adds r1, r5, r6 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bls _080AC238 - movs r0, 0 - strb r0, [r2] - movs r0, 0xE7 - lsls r0, 3 - adds r1, r5, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080AC210 - ldrh r1, [r3] - adds r2, r1, 0 - ldrh r0, [r4] - cmp r2, r0 - bcs _080AC230 - adds r0, r1, 0x1 - b _080AC236 - .pool -_080AC210: - ldr r1, =0x00000732 - adds r3, r5, r1 - ldr r2, =0x00000736 - adds r0, r5, r2 - ldrh r1, [r3] - adds r2, r1, 0 - ldrh r0, [r0] - cmp r2, r0 - bcs _080AC230 - adds r0, r1, 0x1 - b _080AC236 - .pool -_080AC230: - cmp r2, r0 - bls _080AC238 - subs r0, r1, 0x1 -_080AC236: - strh r0, [r3] -_080AC238: - ldr r6, =0x00000732 - adds r0, r5, r6 - ldrh r1, [r0] - lsls r1, 8 - movs r0, 0xE6 - lsls r0, 3 - adds r4, r5, r0 - ldrh r0, [r4] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r4] - ldr r2, =0x00000734 - adds r0, r5, r2 - ldr r0, [r0] - cmp r1, r0 - beq _080AC26C - movs r0, 0 - b _080AC26E - .pool -_080AC26C: - movs r0, 0x1 -_080AC26E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80AC1A8 - - thumb_func_start sub_80AC274 -sub_80AC274: @ 80AC274 - push {lr} - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x9 - bhi _080AC306 - lsls r0, 2 - ldr r1, =_080AC290 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AC290: - .4byte _080AC2B8 - .4byte _080AC2C0 - .4byte _080AC2C8 - .4byte _080AC2D0 - .4byte _080AC2D8 - .4byte _080AC2E0 - .4byte _080AC2E8 - .4byte _080AC2F0 - .4byte _080AC2F8 - .4byte _080AC300 -_080AC2B8: - movs r0, 0x1 - bl SetWeather - b _080AC306 -_080AC2C0: - movs r0, 0x2 - bl SetWeather - b _080AC306 -_080AC2C8: - movs r0, 0x3 - bl SetWeather - b _080AC306 -_080AC2D0: - movs r0, 0x4 - bl SetWeather - b _080AC306 -_080AC2D8: - movs r0, 0x5 - bl SetWeather - b _080AC306 -_080AC2E0: - movs r0, 0x6 - bl SetWeather - b _080AC306 -_080AC2E8: - movs r0, 0x9 - bl SetWeather - b _080AC306 -_080AC2F0: - movs r0, 0x7 - bl SetWeather - b _080AC306 -_080AC2F8: - movs r0, 0x8 - bl SetWeather - b _080AC306 -_080AC300: - movs r0, 0xB - bl SetWeather -_080AC306: - pop {r0} - bx r0 - thumb_func_end sub_80AC274 - - thumb_func_start weather_get_current -weather_get_current: @ 80AC30C - ldr r0, =gUnknown_02038454 - movs r1, 0xDA - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end weather_get_current - - thumb_func_start sub_80AC31C -sub_80AC31C: @ 80AC31C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r1, =gUnknown_02038454 - ldr r3, =0x000006c6 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0x2 - beq _080AC36E - cmp r2, 0x53 - beq _080AC354 - cmp r2, 0x53 - bgt _080AC344 - cmp r2, 0x51 - beq _080AC360 - b _080AC36E - .pool -_080AC344: - cmp r2, 0x55 - bne _080AC36E - ldr r0, =0x000006dd - adds r1, r0 - movs r0, 0 - b _080AC366 - .pool -_080AC354: - ldr r3, =0x000006dd - adds r1, r3 - movs r0, 0x1 - b _080AC366 - .pool -_080AC360: - ldr r0, =0x000006dd - adds r1, r0 - movs r0, 0x2 -_080AC366: - strb r0, [r1] - adds r0, r2, 0 - bl PlaySE -_080AC36E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC31C - - thumb_func_start play_some_sound -play_some_sound: @ 80AC378 - push {lr} - bl IsSpecialSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _080AC3B6 - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006dd - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080AC3A8 - cmp r0, 0x1 - bgt _080AC3B0 - cmp r0, 0 - bne _080AC3B0 - movs r0, 0x56 - bl PlaySE - b _080AC3B6 - .pool -_080AC3A8: - movs r0, 0x54 - bl PlaySE - b _080AC3B6 -_080AC3B0: - movs r0, 0x52 - bl PlaySE -_080AC3B6: - pop {r0} - bx r0 - thumb_func_end play_some_sound - - thumb_func_start IsWeatherChangeComplete -IsWeatherChangeComplete: @ 80AC3BC - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006d3 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end IsWeatherChangeComplete - - thumb_func_start sub_80AC3D0 -sub_80AC3D0: @ 80AC3D0 - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80AC3D0 - - thumb_func_start sub_80AC3E4 -sub_80AC3E4: @ 80AC3E4 - ldr r0, =gUnknown_02038454 - ldr r1, =0x000006c6 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80AC3E4 - - thumb_func_start PreservePaletteInWeather -PreservePaletteInWeather: @ 80AC3F8 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0854C250 - ldr r5, =gUnknown_02038BA4 - adds r1, r5, 0 - movs r2, 0x10 - bl CpuSet - adds r4, r5 - movs r0, 0 - strb r0, [r4] - ldr r0, =gUnknown_03000F50 - str r5, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PreservePaletteInWeather - - thumb_func_start ResetPreservedPalettesInWeather -ResetPreservedPalettesInWeather: @ 80AC428 - ldr r1, =gUnknown_03000F50 - ldr r0, =gUnknown_0854C250 - str r0, [r1] - bx lr - .pool - thumb_func_end ResetPreservedPalettesInWeather - - thumb_func_start sub_80AC438 -sub_80AC438: @ 80AC438 - push {lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r2, =0x000006c1 - adds r1, r0, r2 - movs r2, 0 - strb r2, [r1] - ldr r1, =0x000006c2 - adds r3, r0, r1 - movs r1, 0x14 - strb r1, [r3] - ldr r3, =0x000006d2 - adds r1, r0, r3 - strb r2, [r1] - subs r3, 0x6 - adds r1, r0, r3 - strh r2, [r1] - ldr r1, =0x000006de - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AC46C - movs r0, 0 - movs r1, 0x10 - bl sub_80AC124 -_080AC46C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC438 - - thumb_func_start sub_80AC484 -sub_80AC484: @ 80AC484 - push {r4,lr} - bl sub_80AC438 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AC4A4 - adds r4, r1, r2 -_080AC49A: - bl sub_80AC4B4 - ldrb r0, [r4] - cmp r0, 0 - beq _080AC49A -_080AC4A4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC484 - - thumb_func_start sub_80AC4B4 -sub_80AC4B4: @ 80AC4B4 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x000006cc - adds r4, r5, r0 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AC4E4 - cmp r0, 0x1 - bgt _080AC4D8 - cmp r0, 0 - beq _080AC4DE - b _080AC508 - .pool -_080AC4D8: - cmp r0, 0x2 - beq _080AC4F0 - b _080AC508 -_080AC4DE: - bl sub_80AC594 - b _080AC502 -_080AC4E4: - movs r0, 0xC - movs r1, 0x8 - movs r2, 0x1 - bl sub_80AC164 - b _080AC502 -_080AC4F0: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AC508 - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080AC502: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AC508: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC4B4 - - thumb_func_start sub_80AC514 -sub_80AC514: @ 80AC514 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ce - adds r4, r0, r1 - ldrh r0, [r4] - cmp r0, 0 - beq _080AC534 - cmp r0, 0x1 - beq _080AC540 - movs r0, 0 - b _080AC556 - .pool -_080AC534: - movs r0, 0 - movs r1, 0x10 - movs r2, 0x1 - bl sub_80AC164 - b _080AC54E -_080AC540: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AC554 - bl sub_80AC660 -_080AC54E: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AC554: - movs r0, 0x1 -_080AC556: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AC514 - - thumb_func_start sub_80AC55C -sub_80AC55C: @ 80AC55C - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006c1 - adds r2, r1, r0 - movs r0, 0 - strb r0, [r2] - ldr r0, =0x000006c2 - adds r1, r0 - movs r0, 0x14 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80AC55C - - thumb_func_start sub_80AC580 -sub_80AC580: @ 80AC580 - push {lr} - bl sub_80AC55C - pop {r0} - bx r0 - thumb_func_end sub_80AC580 - - thumb_func_start nullsub_95 -nullsub_95: @ 80AC58C - bx lr - thumb_func_end nullsub_95 - - thumb_func_start sub_80AC590 -sub_80AC590: @ 80AC590 - movs r0, 0 - bx lr - thumb_func_end sub_80AC590 - - thumb_func_start sub_80AC594 -sub_80AC594: @ 80AC594 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006de - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080AC650 - ldr r0, =sCloudSpriteSheet - bl LoadSpriteSheet - ldr r0, =gUnknown_0854C290 - bl sub_80ABF4C - movs r5, 0 -_080AC5B2: - ldr r0, =sCloudSpriteTemplate - movs r1, 0 - movs r2, 0 - movs r3, 0xFF - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x40 - beq _080AC628 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - lsls r2, r5, 2 - movs r0, 0xFA - lsls r0, 1 - adds r1, r0 - adds r1, r2 - lsls r4, r3, 4 - adds r4, r3 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - str r4, [r1] - ldr r0, =gUnknown_0854FB50 - adds r2, r0 - ldrh r0, [r2] - adds r0, 0x7 - lsls r0, 16 - asrs r0, 16 - ldrh r1, [r2, 0x2] - adds r1, 0x7 - lsls r1, 16 - asrs r1, 16 - adds r2, r4, 0 - adds r2, 0x20 - adds r3, r4, 0 - adds r3, 0x22 - bl sub_8093038 - adds r4, 0x3E - ldrb r0, [r4] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r4] - b _080AC63A - .pool -_080AC628: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - lsls r0, r5, 2 - movs r2, 0xFA - lsls r2, 1 - adds r1, r2 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_080AC63A: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x2 - bls _080AC5B2 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006de - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080AC650: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC594 - - thumb_func_start sub_80AC660 -sub_80AC660: @ 80AC660 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006de - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AC6A4 - movs r4, 0 - movs r0, 0xFA - lsls r0, 1 - adds r5, r1, r0 -_080AC678: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080AC686 - bl DestroySprite -_080AC686: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x2 - bls _080AC678 - movs r0, 0x90 - lsls r0, 5 - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006de - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_080AC6A4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC660 - - thumb_func_start sub_80AC6B4 -sub_80AC6B4: @ 80AC6B4 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - movs r1, 0x1 - ands r0, r1 - strh r0, [r2, 0x2E] - cmp r0, 0 - beq _080AC6CC - ldrh r0, [r2, 0x20] - subs r0, 0x1 - strh r0, [r2, 0x20] -_080AC6CC: - pop {r0} - bx r0 - thumb_func_end sub_80AC6B4 - - thumb_func_start sub_80AC6D0 -sub_80AC6D0: @ 80AC6D0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006cc - adds r3, r1, r0 - movs r2, 0 - movs r0, 0 - strh r0, [r3] - ldr r3, =0x000006d2 - adds r0, r1, r3 - strb r2, [r0] - subs r3, 0x11 - adds r0, r1, r3 - strb r2, [r0] - ldr r0, =0x000006c2 - adds r1, r0 - strb r2, [r1] - bx lr - .pool - thumb_func_end sub_80AC6D0 - - thumb_func_start sub_80AC704 -sub_80AC704: @ 80AC704 - push {r4,lr} - bl sub_80AC6D0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AC724 - adds r4, r1, r2 -_080AC71A: - bl sub_80AC734 - ldrb r0, [r4] - cmp r0, 0 - beq _080AC71A -_080AC724: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC704 - - thumb_func_start sub_80AC734 -sub_80AC734: @ 80AC734 - push {lr} - ldr r1, =gUnknown_0854C14C - ldr r0, [r1] - ldr r2, =0x000006cc - adds r0, r2 - ldrh r0, [r0] - adds r2, r1, 0 - cmp r0, 0x4 - bhi _080AC810 - lsls r0, 2 - ldr r1, =_080AC75C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AC75C: - .4byte _080AC770 - .4byte _080AC78C - .4byte _080AC7A4 - .4byte _080AC7C0 - .4byte _080AC7D8 -_080AC770: - ldr r1, [r2] - ldr r2, =0x000006c6 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AC814 - ldr r0, =0x000006cc - adds r1, r0 - b _080AC7F8 - .pool -_080AC78C: - bl sub_80ABF84 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r1, r2 - b _080AC7F8 - .pool -_080AC7A4: - bl sub_80ABFA4 - lsls r0, 24 - cmp r0, 0 - bne _080AC814 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006cc - adds r1, r0 - b _080AC7F8 - .pool -_080AC7C0: - bl sub_80ABFF0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r1, r2 - b _080AC7F8 - .pool -_080AC7D8: - bl sub_80AC01C - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r1, =0x0000073c - adds r0, r2, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x6 - bne _080AC814 - ldr r0, =0x000006d2 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x000006cc - adds r1, r2, r0 -_080AC7F8: - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080AC814 - .pool -_080AC810: - bl sub_80AC01C -_080AC814: - pop {r0} - bx r0 - thumb_func_end sub_80AC734 - - thumb_func_start sub_80AC818 -sub_80AC818: @ 80AC818 - movs r0, 0 - bx lr - thumb_func_end sub_80AC818 - - thumb_func_start sub_80AC81C -sub_80AC81C: @ 80AC81C - push {lr} - ldr r0, =task50_0807B6D4 - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC81C - - thumb_func_start task50_0807B6D4 -task50_0807B6D4: @ 80AC830 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _080AC922 - lsls r0, 2 - ldr r1, =_080AC85C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AC85C: - .4byte _080AC870 - .4byte _080AC89A - .4byte _080AC8C8 - .4byte _080AC8F8 - .4byte _080AC918 -_080AC870: - movs r0, 0 - strh r0, [r4, 0xA] - strh r0, [r4, 0xC] - ldr r0, =0x04000048 - ldrh r0, [r0] - strh r0, [r4, 0xE] - ldr r1, =0x00003f3f - movs r0, 0x48 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0x9E - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080AC89A: - ldrh r0, [r4, 0xA] - adds r0, 0x3 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _080AC8AC - movs r0, 0x10 - strh r0, [r4, 0xA] -_080AC8AC: - ldrh r1, [r4, 0xA] - movs r0, 0x54 - bl SetGpuReg - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0xF - ble _080AC922 - b _080AC910 - .pool -_080AC8C8: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x9 - ble _080AC922 - strh r1, [r4, 0xC] - ldrh r0, [r4, 0xA] - subs r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - bgt _080AC8EE - strh r1, [r4, 0xA] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080AC8EE: - ldrh r1, [r4, 0xA] - movs r0, 0x54 - bl SetGpuReg - b _080AC922 -_080AC8F8: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldrh r1, [r4, 0xE] - movs r0, 0x48 - bl SetGpuReg -_080AC910: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080AC922 -_080AC918: - bl EnableBothScriptContexts - adds r0, r5, 0 - bl DestroyTask -_080AC922: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end task50_0807B6D4 - - thumb_func_start sub_80AC928 -sub_80AC928: @ 80AC928 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r0, r1, r2 - movs r3, 0 - movs r2, 0 - strh r2, [r0] - ldr r4, =0x000006d2 - adds r0, r1, r4 - strb r3, [r0] - adds r4, 0x4 - adds r0, r1, r4 - strh r2, [r0] - ldr r0, =0x000006db - adds r2, r1, r0 - movs r0, 0x8 - strb r0, [r2] - ldr r2, =0x000006dc - adds r0, r1, r2 - strb r3, [r0] - adds r4, 0x3 - adds r2, r1, r4 - movs r0, 0xA - strb r0, [r2] - ldr r0, =0x000006c1 - adds r2, r1, r0 - movs r0, 0x3 - strb r0, [r2] - ldr r2, =0x000006c2 - adds r1, r2 - movs r0, 0x14 - strb r0, [r1] - movs r0, 0x55 - bl sub_80AC31C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC928 - - thumb_func_start sub_80AC994 -sub_80AC994: @ 80AC994 - push {r4,lr} - bl sub_80AC928 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AC9B4 - adds r4, r1, r2 -_080AC9AA: - bl sub_80AC9C4 - ldrb r0, [r4] - cmp r0, 0 - beq _080AC9AA -_080AC9B4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC994 - - thumb_func_start sub_80AC9C4 -sub_80AC9C4: @ 80AC9C4 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x000006cc - adds r4, r5, r0 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AC9F4 - cmp r0, 0x1 - bgt _080AC9E8 - cmp r0, 0 - beq _080AC9EE - b _080ACA18 - .pool -_080AC9E8: - cmp r0, 0x2 - beq _080ACA00 - b _080ACA18 -_080AC9EE: - bl sub_80ACD68 - b _080ACA12 -_080AC9F4: - bl sub_80ACD78 - lsls r0, 24 - cmp r0, 0 - bne _080ACA18 - b _080ACA12 -_080ACA00: - bl sub_80ACEAC - lsls r0, 24 - cmp r0, 0 - bne _080ACA18 - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080ACA12: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080ACA18: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AC9C4 - - thumb_func_start sub_80ACA24 -sub_80ACA24: @ 80ACA24 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r1, =0x000006ce - adds r3, r2, r1 - ldrh r1, [r3] - adds r4, r0, 0 - cmp r1, 0 - beq _080ACA48 - cmp r1, 0x1 - beq _080ACA7C - movs r0, 0 - b _080ACAAA - .pool -_080ACA48: - ldr r5, =0x000006d1 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, 0x3 - beq _080ACA5A - cmp r0, 0x5 - beq _080ACA5A - cmp r0, 0xD - bne _080ACA70 -_080ACA5A: - ldr r0, [r4] - ldr r1, =0x000006ce - adds r0, r1 - movs r1, 0xFF - strh r1, [r0] - movs r0, 0 - b _080ACAAA - .pool -_080ACA70: - ldr r4, =0x000006d9 - adds r0, r2, r4 - strb r1, [r0] - ldrh r0, [r3] - adds r0, 0x1 - strh r0, [r3] -_080ACA7C: - bl sub_80ACEAC - lsls r0, 24 - cmp r0, 0 - bne _080ACAA8 - bl sub_80ACF38 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r5, =0x000006ce - adds r1, r5 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0 - b _080ACAAA - .pool -_080ACAA8: - movs r0, 0x1 -_080ACAAA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80ACA24 - - thumb_func_start sub_80ACAB0 -sub_80ACAB0: @ 80ACAB0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - movs r1, 0x30 - ldrsh r0, [r7, r1] - cmp r0, 0 - bne _080ACAC4 - ldr r0, =0x00000169 - strh r0, [r7, 0x30] -_080ACAC4: - movs r2, 0x30 - ldrsh r1, [r7, r2] - ldr r0, =0x41c64e6d - muls r0, r1 - ldr r3, =0x00003039 - adds r0, r3 - lsls r0, 1 - lsrs r0, 17 - movs r1, 0x96 - lsls r1, 2 - bl __umodsi3 - movs r1, 0 - mov r8, r1 - strh r0, [r7, 0x30] - ldr r1, =gUnknown_0854FC4C - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r2, =0x000006dc - adds r5, r2 - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldrh r6, [r0] - movs r3, 0x30 - ldrsh r0, [r7, r3] - movs r1, 0x1E - bl __modsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - lsls r0, r4, 3 - strh r0, [r7, 0x32] - movs r1, 0x30 - ldrsh r0, [r7, r1] - movs r1, 0x1E - bl __divsi3 - lsls r0, 16 - lsls r4, 7 - strh r4, [r7, 0x32] - asrs r0, 9 - strh r0, [r7, 0x34] - ldr r2, =gUnknown_0854FC44 - ldrb r1, [r5] - lsls r1, 2 - adds r1, r2 - movs r3, 0 - ldrsh r1, [r1, r3] - muls r1, r6 - subs r4, r1 - strh r4, [r7, 0x32] - ldrb r1, [r5] - lsls r1, 2 - adds r2, 0x2 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - muls r1, r6 - subs r0, r1 - strh r0, [r7, 0x34] - adds r0, r7, 0 - movs r1, 0 - bl StartSpriteAnim - mov r3, r8 - strh r3, [r7, 0x36] - adds r2, r7, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - strh r6, [r7, 0x2E] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ACAB0 - - thumb_func_start sub_80ACB84 -sub_80ACB84: @ 80ACB84 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x36 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _080ACC60 - ldr r3, =gUnknown_0854FC44 - ldr r4, =gUnknown_0854C14C - ldr r2, [r4] - ldr r0, =0x000006dc - adds r2, r0 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0] - ldrh r0, [r5, 0x32] - adds r1, r0 - strh r1, [r5, 0x32] - ldrb r0, [r2] - lsls r0, 2 - adds r3, 0x2 - adds r0, r3 - ldrh r0, [r0] - ldrh r2, [r5, 0x34] - adds r0, r2 - strh r0, [r5, 0x34] - lsls r1, 16 - asrs r1, 20 - strh r1, [r5, 0x20] - lsls r0, 16 - asrs r2, r0, 20 - strh r2, [r5, 0x22] - movs r3, 0x38 - ldrsh r0, [r5, r3] - adds r3, r4, 0 - cmp r0, 0 - beq _080ACC04 - adds r0, r1, 0 - adds r0, 0x8 - lsls r0, 16 - movs r1, 0x80 - lsls r1, 17 - cmp r0, r1 - bhi _080ACC04 - adds r1, r2, 0 - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - blt _080ACC04 - cmp r1, 0xB0 - bgt _080ACC04 - adds r0, r5, 0 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - b _080ACC0E - .pool -_080ACC04: - adds r0, r5, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 -_080ACC0E: - strb r1, [r0] - adds r4, r0, 0 - ldrh r0, [r5, 0x2E] - subs r0, 0x1 - strh r0, [r5, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _080ACC80 - ldr r0, [r3] - ldr r1, =0x000006dc - adds r0, r1 - ldrb r1, [r0] - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl StartSpriteAnim - movs r0, 0x1 - strh r0, [r5, 0x36] - ldr r1, =gSpriteCoordOffsetX - ldrh r0, [r5, 0x20] - ldrh r1, [r1] - subs r0, r1 - strh r0, [r5, 0x20] - ldr r1, =gSpriteCoordOffsetY - ldrh r0, [r5, 0x22] - ldrh r1, [r1] - subs r0, r1 - strh r0, [r5, 0x22] - ldrb r0, [r4] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r4] - b _080ACC80 - .pool -_080ACC60: - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080ACC80 - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - adds r0, r5, 0 - bl sub_80ACAB0 -_080ACC80: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80ACB84 - - thumb_func_start sub_80ACC88 -sub_80ACC88: @ 80ACC88 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _080ACCA8 - adds r0, r4, 0 - bl sub_80ACAB0 - ldr r0, =sub_80ACB84 - str r0, [r4, 0x1C] - b _080ACCAC - .pool -_080ACCA8: - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] -_080ACCAC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80ACC88 - - thumb_func_start sub_80ACCB4 -sub_80ACCB4: @ 80ACCB4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - lsls r5, r1, 16 - lsrs r5, 16 - ldr r2, =gUnknown_0854FC4C - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006dc - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r1, r0, r2 - ldrh r1, [r1] - mov r8, r1 - adds r2, 0x2 - adds r0, r2 - ldrh r4, [r0] - add r4, r8 - adds r0, r5, 0 - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r5, 0 - adds r1, r4, 0 - bl __modsi3 - lsls r0, 16 - lsrs r4, r0, 16 - subs r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =0x0000ffff - cmp r6, r0 - beq _080ACD12 - adds r5, r0, 0 -_080ACD02: - adds r0, r7, 0 - bl sub_80ACAB0 - subs r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, r5 - bne _080ACD02 -_080ACD12: - cmp r4, r8 - bcs _080ACD48 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x0000ffff - cmp r4, r0 - beq _080ACD34 - adds r5, r0, 0 -_080ACD24: - adds r0, r7, 0 - bl sub_80ACB84 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, r5 - bne _080ACD24 -_080ACD34: - movs r0, 0 - b _080ACD5C - .pool -_080ACD48: - mov r1, r8 - subs r0, r4, r1 - strh r0, [r7, 0x2E] - adds r2, r7, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x1 -_080ACD5C: - strh r0, [r7, 0x3A] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80ACCB4 - - thumb_func_start sub_80ACD68 -sub_80ACD68: @ 80ACD68 - push {lr} - ldr r0, =gUnknown_0854FC54 - bl LoadSpriteSheet - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ACD68 - - thumb_func_start sub_80ACD78 -sub_80ACD78: @ 80ACD78 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r0, =0x000006da - adds r2, r4, r0 - ldrb r0, [r2] - cmp r0, 0x18 - bne _080ACD92 - b _080ACE98 -_080ACD92: - ldrb r7, [r2] - ldr r0, =gSpriteTemplate_854FC2C - ldr r2, =gUnknown_0854FB90 - lsls r6, r7, 2 - adds r2, r6, r2 - movs r3, 0 - ldrsh r1, [r2, r3] - movs r3, 0x2 - ldrsh r2, [r2, r3] - movs r3, 0x4E - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x40 - beq _080ACE40 - ldr r3, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r3 - movs r0, 0 - strh r0, [r1, 0x38] - lsls r2, r7, 3 - adds r0, r2, r7 - lsls r0, 4 - adds r0, r7 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - ldr r1, =0x00000257 - mov r10, r6 - mov r9, r3 - mov r12, r4 - mov r8, r2 - cmp r0, r1 - ble _080ACDF6 - adds r2, r1, 0 -_080ACDDE: - adds r0, r4, r5 - lsls r0, 2 - ldr r6, =gSprites - adds r0, r6 - ldr r3, =0xfffffda8 - ldrh r6, [r0, 0x30] - adds r1, r3, r6 - strh r1, [r0, 0x30] - lsls r1, 16 - asrs r1, 16 - cmp r1, r2 - bgt _080ACDDE -_080ACDF6: - mov r0, r12 - adds r4, r0, r5 - lsls r4, 2 - add r4, r9 - adds r0, r4, 0 - bl sub_80ACAB0 - mov r3, r8 - adds r1, r3, r7 - adds r0, r4, 0 - bl sub_80ACCB4 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - add r0, r10 - str r4, [r0] - b _080ACE46 - .pool -_080ACE40: - adds r1, r4, r6 - movs r0, 0 - str r0, [r1] -_080ACE46: - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r6, =0x000006da - adds r1, r2, r6 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x18 - bne _080ACE9C - movs r3, 0 - adds r1, r2, 0 - ldr r5, =sub_80ACB84 - ldr r4, =sub_80ACC88 -_080ACE64: - lsls r0, r3, 2 - adds r0, r1, r0 - ldr r2, [r0] - cmp r2, 0 - beq _080ACE8E - movs r6, 0x3A - ldrsh r0, [r2, r6] - cmp r0, 0 - bne _080ACE8C - str r5, [r2, 0x1C] - b _080ACE8E - .pool -_080ACE8C: - str r4, [r2, 0x1C] -_080ACE8E: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x17 - bls _080ACE64 -_080ACE98: - movs r0, 0 - b _080ACE9E -_080ACE9C: - movs r0, 0x1 -_080ACE9E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80ACD78 - - thumb_func_start sub_80ACEAC -sub_80ACEAC: @ 80ACEAC - push {r4-r7,lr} - ldr r0, =gUnknown_0854C14C - ldr r3, [r0] - movs r0, 0xDB - lsls r0, 3 - adds r4, r3, r0 - ldr r1, =0x000006d9 - adds r5, r3, r1 - ldrb r0, [r4] - ldrb r7, [r5] - cmp r0, r7 - bne _080ACED0 - movs r0, 0 - b _080ACF32 - .pool -_080ACED0: - ldr r0, =0x000006d6 - adds r2, r3, r0 - ldrh r0, [r2] - adds r0, 0x1 - movs r6, 0 - strh r0, [r2] - ldr r7, =0x000006db - adds r1, r3, r7 - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1] - cmp r0, r1 - bls _080ACF30 - strh r6, [r2] - ldrb r0, [r4] - adds r1, r0, 0 - ldrb r5, [r5] - cmp r1, r5 - bcs _080ACF10 - adds r0, 0x1 - strb r0, [r4] - lsls r0, r1, 2 - adds r0, r3, r0 - ldr r1, [r0] - movs r0, 0x1 - strh r0, [r1, 0x38] - b _080ACF30 - .pool -_080ACF10: - subs r0, 0x1 - strb r0, [r4] - ldrb r0, [r4] - lsls r0, 2 - adds r0, r3, r0 - ldr r0, [r0] - strh r6, [r0, 0x38] - ldrb r0, [r4] - lsls r0, 2 - adds r0, r3, r0 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] -_080ACF30: - movs r0, 0x1 -_080ACF32: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80ACEAC - - thumb_func_start sub_80ACF38 -sub_80ACF38: @ 80ACF38 - push {r4-r7,lr} - movs r4, 0 - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r3, =0x000006da - adds r1, r2, r3 - adds r7, r0, 0 - ldrb r1, [r1] - cmp r4, r1 - bcs _080ACF6A - adds r5, r2, 0 - adds r6, r5, r3 -_080ACF50: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080ACF5E - bl DestroySprite -_080ACF5E: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - ldrb r0, [r6] - cmp r4, r0 - bcc _080ACF50 -_080ACF6A: - ldr r0, [r7] - ldr r1, =0x000006da - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, =0x00001206 - bl FreeSpriteTilesByTag - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ACF38 - - thumb_func_start sub_80ACF8C -sub_80ACF8C: @ 80ACF8C - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r0, r1, r2 - movs r2, 0 - movs r3, 0 - strh r3, [r0] - ldr r4, =0x000006d2 - adds r0, r1, r4 - strb r2, [r0] - ldr r0, =0x000006c1 - adds r2, r1, r0 - movs r0, 0x3 - strb r0, [r2] - subs r4, 0x10 - adds r2, r1, r4 - movs r0, 0x14 - strb r0, [r2] - ldr r0, =0x000006e5 - adds r2, r1, r0 - movs r0, 0x10 - strb r0, [r2] - movs r2, 0xDC - lsls r2, 3 - adds r1, r2 - strh r3, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ACF8C - - thumb_func_start sub_80ACFDC -sub_80ACFDC: @ 80ACFDC - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl sub_80ACF8C - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - ldr r3, =0x000006d2 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD032 - mov r8, r2 - adds r7, r1, r3 -_080ACFF8: - bl snowflakes_progress2 - movs r4, 0 - mov r1, r8 - ldr r0, [r1] - ldr r3, =0x000006e4 - adds r0, r3 - ldrb r0, [r0] - cmp r4, r0 - bcs _080AD02C - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - adds r6, r5, r3 -_080AD012: - lsls r1, r4, 2 - adds r0, r5, 0 - adds r0, 0x60 - adds r0, r1 - ldr r0, [r0] - bl sub_80AD30C - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - ldrb r0, [r6] - cmp r4, r0 - bcc _080AD012 -_080AD02C: - ldrb r0, [r7] - cmp r0, 0 - beq _080ACFF8 -_080AD032: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ACFDC - - thumb_func_start snowflakes_progress2 -snowflakes_progress2: @ 80AD048 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x000006cc - adds r4, r5, r0 - ldrh r0, [r4] - cmp r0, 0 - bne _080AD070 - bl snowflakes_progress - lsls r0, 24 - cmp r0, 0 - bne _080AD070 - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AD070: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end snowflakes_progress2 - - thumb_func_start sub_80AD084 -sub_80AD084: @ 80AD084 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r0, =0x000006ce - adds r3, r2, r0 - ldrh r1, [r3] - cmp r1, 0 - beq _080AD0A4 - cmp r1, 0x1 - beq _080AD0B6 - movs r0, 0 - b _080AD0E2 - .pool -_080AD0A4: - ldr r4, =0x000006e5 - adds r0, r2, r4 - strb r1, [r0] - subs r4, 0x5 - adds r0, r2, r4 - strh r1, [r0] - ldrh r0, [r3] - adds r0, 0x1 - strh r0, [r3] -_080AD0B6: - bl snowflakes_progress - lsls r0, 24 - cmp r0, 0 - bne _080AD0E0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006ce - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0 - b _080AD0E2 - .pool -_080AD0E0: - movs r0, 0x1 -_080AD0E2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AD084 - - thumb_func_start snowflakes_progress -snowflakes_progress: @ 80AD0E8 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006e4 - adds r3, r1, r0 - ldr r4, =0x000006e5 - adds r2, r1, r4 - ldrb r0, [r3] - ldrb r4, [r2] - cmp r0, r4 - bne _080AD110 - movs r0, 0 - b _080AD152 - .pool -_080AD110: - movs r0, 0xDC - lsls r0, 3 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x24 - bls _080AD13A - movs r0, 0 - strh r0, [r1] - ldrb r0, [r3] - ldrb r2, [r2] - cmp r0, r2 - bcs _080AD136 - bl snowflake_add - b _080AD13A -_080AD136: - bl snowflake_remove -_080AD13A: - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r2, =0x000006e4 - adds r1, r0, r2 - ldr r4, =0x000006e5 - adds r0, r4 - ldrb r1, [r1] - ldrb r0, [r0] - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 -_080AD152: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end snowflakes_progress - - thumb_func_start snowflake_add -snowflake_add: @ 80AD164 - push {r4-r6,lr} - ldr r0, =gUnknown_0854FC8C - movs r1, 0 - movs r2, 0 - movs r3, 0x4E - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _080AD1C8 - ldr r0, =gSprites - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r4, r0 - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x000006e4 - adds r6, r5, r0 - ldrb r0, [r6] - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_80AD204 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r6] - adds r1, r0, 0x1 - strb r1, [r6] - lsls r0, 24 - lsrs r0, 22 - adds r5, 0x60 - adds r5, r0 - str r4, [r5] - movs r0, 0x1 - b _080AD1CA - .pool -_080AD1C8: - movs r0, 0 -_080AD1CA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end snowflake_add - - thumb_func_start snowflake_remove -snowflake_remove: @ 80AD1D0 - push {lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006e4 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0 - bne _080AD1EC - movs r0, 0 - b _080AD200 - .pool -_080AD1EC: - subs r0, 0x1 - strb r0, [r2] - lsls r0, 24 - lsrs r0, 22 - adds r1, 0x60 - adds r1, r0 - ldr r0, [r1] - bl DestroySprite - movs r0, 0x1 -_080AD200: - pop {r1} - bx r1 - thumb_func_end snowflake_remove - - thumb_func_start sub_80AD204 -sub_80AD204: @ 80AD204 - push {r4-r7,lr} - adds r5, r0, 0 - bl Random - movs r1, 0x36 - ldrsh r2, [r5, r1] - lsls r1, r2, 2 - adds r1, r2 - movs r2, 0x7 - ands r1, r2 - lsls r4, r1, 4 - subs r4, r1 - lsls r4, 1 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1E - bl __umodsi3 - adds r4, r0 - lsls r4, 16 - lsrs r4, 16 - ldr r1, =gSpriteCoordOffsetY - adds r0, r5, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r1] - adds r0, r1 - movs r2, 0x3 - negs r2, r2 - adds r1, r2, 0 - subs r1, r0 - movs r7, 0 - strh r1, [r5, 0x22] - ldr r1, =gSpriteCoordOffsetX - adds r0, r5, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r1] - adds r0, r1 - subs r4, r0 - strh r4, [r5, 0x20] - movs r1, 0x22 - ldrsh r0, [r5, r1] - lsls r0, 7 - strh r0, [r5, 0x2E] - strh r7, [r5, 0x24] - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r6, r0, 0 - movs r4, 0x3 - ands r4, r6 - lsls r0, r4, 2 - adds r0, r4 - adds r0, 0x40 - strh r0, [r5, 0x30] - strh r0, [r5, 0x3C] - movs r1, 0x1 - bics r1, r6 - adds r0, r5, 0 - bl StartSpriteAnim - strh r7, [r5, 0x34] - movs r0, 0x1 - cmp r4, 0 - bne _080AD294 - movs r0, 0x2 -_080AD294: - strh r0, [r5, 0x32] - movs r0, 0x1F - ands r0, r6 - adds r0, 0xD2 - strh r0, [r5, 0x3A] - strh r7, [r5, 0x38] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD204 - - thumb_func_start sub_80AD2B0 -sub_80AD2B0: @ 80AD2B0 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006e2 - adds r4, r0, r1 - ldrh r0, [r4] - cmp r0, 0x12 - bls _080AD2F6 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =sub_80AD30C - str r0, [r3, 0x1C] - ldr r1, =gSpriteCoordOffsetY - adds r0, r3, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r1] - adds r0, r1 - movs r1, 0xFA - subs r1, r0 - movs r2, 0 - strh r1, [r3, 0x22] - movs r1, 0x22 - ldrsh r0, [r3, r1] - lsls r0, 7 - strh r0, [r3, 0x2E] - strh r2, [r4] -_080AD2F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD2B0 - - thumb_func_start sub_80AD30C -sub_80AD30C: @ 80AD30C - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x30] - ldrh r1, [r4, 0x2E] - adds r0, r1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 23 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x34] - adds r0, r2 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x34] - ldr r1, =gSineTable - movs r3, 0x34 - ldrsh r0, [r4, r3] - lsls r0, 1 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _080AD33E - adds r0, 0x3F -_080AD33E: - asrs r0, 6 - strh r0, [r4, 0x24] - adds r0, r4, 0 - adds r0, 0x28 - movs r5, 0 - ldrsb r5, [r0, r5] - ldrh r0, [r4, 0x20] - adds r0, r5 - ldr r1, =gSpriteCoordOffsetX - ldrh r1, [r1] - adds r3, r1, r0 - ldr r2, =0x000001ff - adds r0, r2, 0 - ands r3, r0 - adds r2, r3, 0 - movs r0, 0x80 - lsls r0, 1 - ands r0, r2 - cmp r0, 0 - beq _080AD370 - ldr r3, =0xffffff00 - adds r0, r3, 0 - orrs r2, r0 - lsls r0, r2, 16 - lsrs r3, r0, 16 -_080AD370: - lsls r0, r3, 16 - asrs r0, 16 - movs r2, 0x3 - negs r2, r2 - cmp r0, r2 - bge _080AD394 - adds r1, r5 - movs r0, 0xF2 - subs r0, r1 - b _080AD39C - .pool -_080AD394: - cmp r0, 0xF2 - ble _080AD39E - adds r0, r1, r5 - subs r0, r2, r0 -_080AD39C: - strh r0, [r4, 0x20] -_080AD39E: - adds r0, r4, 0 - adds r0, 0x29 - movs r3, 0 - ldrsb r3, [r0, r3] - ldrh r0, [r4, 0x22] - adds r0, r3 - ldr r1, =gSpriteCoordOffsetY - ldrh r1, [r1] - adds r2, r1, r0 - movs r0, 0xFF - ands r2, r0 - adds r0, r2, 0 - subs r0, 0xA4 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x6 - bhi _080AD3E0 - adds r1, r3 - movs r0, 0xFA - subs r0, r1 - movs r1, 0 - strh r0, [r4, 0x22] - movs r2, 0x22 - ldrsh r0, [r4, r2] - lsls r0, 7 - strh r0, [r4, 0x2E] - strh r1, [r4, 0x38] - movs r0, 0xDC - strh r0, [r4, 0x3A] - b _080AD40C - .pool -_080AD3E0: - adds r0, r2, 0 - subs r0, 0xF3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x6 - bhi _080AD40C - movs r1, 0 - movs r0, 0xA3 - strh r0, [r4, 0x22] - lsls r0, 7 - strh r0, [r4, 0x2E] - strh r1, [r4, 0x38] - movs r0, 0xDC - strh r0, [r4, 0x3A] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_80AD2B0 - str r0, [r4, 0x1C] -_080AD40C: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x3A - ldrsh r1, [r4, r3] - cmp r0, r1 - bne _080AD438 - adds r0, r4, 0 - bl sub_80AD204 - movs r0, 0xFA - strh r0, [r4, 0x22] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_80AD2B0 - str r0, [r4, 0x1C] -_080AD438: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD30C - - thumb_func_start sub_80AD444 -sub_80AD444: @ 80AD444 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r0, r1, r2 - movs r3, 0 - movs r2, 0 - strh r2, [r0] - ldr r5, =0x000006d2 - adds r4, r1, r5 - strb r3, [r4] - adds r5, 0x4 - adds r0, r1, r5 - strh r2, [r0] - ldr r0, =0x000006db - adds r2, r1, r0 - movs r0, 0x4 - strb r0, [r2] - ldr r2, =0x000006dc - adds r0, r1, r2 - strb r3, [r0] - adds r5, 0x3 - adds r2, r1, r5 - movs r0, 0x10 - strb r0, [r2] - ldr r0, =0x000006c1 - adds r2, r1, r0 - movs r0, 0x3 - strb r0, [r2] - subs r5, 0x17 - adds r2, r1, r5 - movs r0, 0x14 - strb r0, [r2] - strb r3, [r4] - ldr r0, =0x000006ed - adds r1, r0 - strb r3, [r1] - movs r0, 0x51 - bl sub_80AC31C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD444 - - thumb_func_start sub_80AD4B8 -sub_80AD4B8: @ 80AD4B8 - push {r4,lr} - bl sub_80AD444 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD4D8 - adds r4, r1, r2 -_080AD4CE: - bl sub_80AD584 - ldrb r0, [r4] - cmp r0, 0 - beq _080AD4CE -_080AD4D8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD4B8 - - thumb_func_start sub_80AD4E8 -sub_80AD4E8: @ 80AD4E8 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r0, r1, r2 - movs r4, 0 - movs r2, 0 - strh r2, [r0] - ldr r5, =0x000006d2 - adds r3, r1, r5 - strb r4, [r3] - adds r5, 0x4 - adds r0, r1, r5 - strh r2, [r0] - ldr r0, =0x000006db - adds r2, r1, r0 - movs r0, 0x4 - strb r0, [r2] - adds r5, 0x6 - adds r2, r1, r5 - movs r0, 0x1 - strb r0, [r2] - ldr r0, =0x000006d9 - adds r2, r1, r0 - movs r0, 0x18 - strb r0, [r2] - subs r5, 0x1B - adds r2, r1, r5 - movs r0, 0x3 - strb r0, [r2] - ldr r0, =0x000006c2 - adds r1, r0 - movs r0, 0x14 - strb r0, [r1] - strb r4, [r3] - movs r0, 0x53 - bl sub_80AC31C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD4E8 - - thumb_func_start sub_80AD554 -sub_80AD554: @ 80AD554 - push {r4,lr} - bl sub_80AD4E8 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD574 - adds r4, r1, r2 -_080AD56A: - bl sub_80AD584 - ldrb r0, [r4] - cmp r0, 0 - beq _080AD56A -_080AD574: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD554 - - thumb_func_start sub_80AD584 -sub_80AD584: @ 80AD584 - push {r4,r5,lr} - bl sub_80AD9F8 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006cc - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0xE - bls _080AD59A - b _080AD8FA -_080AD59A: - lsls r0, 2 - ldr r1, =_080AD5B0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AD5B0: - .4byte _080AD5EC - .4byte _080AD608 - .4byte _080AD62C - .4byte _080AD65C - .4byte _080AD680 - .4byte _080AD6B0 - .4byte _080AD6E0 - .4byte _080AD70C - .4byte _080AD72A - .4byte _080AD788 - .4byte _080AD80C - .4byte _080AD834 - .4byte _080AD864 - .4byte _080AD8A8 - .4byte _080AD8DC -_080AD5EC: - bl sub_80ACD68 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006cc - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD608: - bl sub_80ACD78 - lsls r0, 24 - cmp r0, 0 - beq _080AD614 - b _080AD8FA -_080AD614: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r3, =0x000006cc - adds r1, r3 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD62C: - bl sub_80ACEAC - lsls r0, 24 - cmp r0, 0 - beq _080AD638 - b _080AD8FA -_080AD638: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006d2 - adds r2, r1, r0 - movs r0, 0x1 - strb r0, [r2] - ldr r2, =0x000006cc - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD65C: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r3, =0x000006c6 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD66C - b _080AD8FA -_080AD66C: - ldr r0, =0x000006cc - adds r1, r0 - movs r0, 0x6 - b _080AD8F8 - .pool -_080AD680: - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r2, =0x000006ea - adds r1, r4, r2 - movs r0, 0x1 - strb r0, [r1] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r5, 0xB4 - lsls r5, 1 - adds r1, r5, 0 - bl __umodsi3 - adds r0, r5 - ldr r3, =0x000006e6 - adds r1, r4, r3 - strh r0, [r1] - ldr r0, =0x000006cc - adds r4, r0 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AD6B0: - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r3, =0x000006e6 - adds r1, r2, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080AD6C6 - b _080AD8FA -_080AD6C6: - ldr r0, =0x000006cc - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD6E0: - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r1, =0x000006ea - adds r0, r4, r1 - movs r5, 0x1 - strb r5, [r0] - bl Random - lsls r0, 16 - lsrs r0, 16 - ands r0, r5 - ldr r2, =0x000006eb - adds r1, r4, r2 - strb r0, [r1] - b _080AD768 - .pool -_080AD70C: - bl Random - ldr r1, =gUnknown_0854C14C - ldr r2, [r1] - movs r1, 0x1 - ands r1, r0 - adds r1, 0x1 - ldr r3, =0x000006ec - adds r0, r2, r3 - strb r1, [r0] - ldr r0, =0x000006cc - adds r2, r0 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] -_080AD72A: - movs r0, 0x13 - bl sub_80ABC48 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006eb - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD74E - ldr r3, =0x000006ec - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0x1 - bne _080AD74E - movs r0, 0x14 - bl sub_80AD9BC -_080AD74E: - bl Random - ldr r1, =gUnknown_0854C14C - ldr r4, [r1] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - adds r0, 0x6 - ldr r2, =0x000006e6 - adds r1, r4, r2 - strh r0, [r1] -_080AD768: - ldr r3, =0x000006cc - adds r4, r3 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080AD8FA - .pool -_080AD788: - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r0, =0x000006e6 - adds r5, r4, r0 - ldrh r0, [r5] - subs r0, 0x1 - strh r0, [r5] - lsls r0, 16 - cmp r0, 0 - beq _080AD79E - b _080AD8FA -_080AD79E: - movs r0, 0x3 - bl sub_80ABC48 - ldr r2, =0x000006ea - adds r1, r4, r2 - movs r0, 0x1 - strb r0, [r1] - ldr r3, =0x000006ec - adds r1, r4, r3 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - beq _080AD7E8 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - ands r0, r1 - adds r0, 0x3C - strh r0, [r5] - ldr r0, =0x000006cc - adds r1, r4, r0 - movs r0, 0xA - b _080AD8F8 - .pool -_080AD7E8: - ldr r1, =0x000006eb - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AD800 - ldr r2, =0x000006cc - adds r1, r4, r2 - b _080AD8F6 - .pool -_080AD800: - ldr r3, =0x000006cc - adds r1, r4, r3 - movs r0, 0xB - b _080AD8F8 - .pool -_080AD80C: - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r0, =0x000006e6 - adds r1, r2, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080AD8FA - ldr r3, =0x000006cc - adds r1, r2, r3 - movs r0, 0x8 - b _080AD8F8 - .pool -_080AD834: - bl Random - ldr r1, =gUnknown_0854C14C - ldr r2, [r1] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - ands r0, r1 - adds r0, 0x3C - ldr r3, =0x000006e6 - adds r1, r2, r3 - strh r0, [r1] - ldr r0, =0x000006cc - adds r2, r0 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _080AD8FA - .pool -_080AD864: - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r1, =0x000006e6 - adds r4, r5, r1 - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r4] - lsls r0, 16 - cmp r0, 0 - bne _080AD8FA - movs r0, 0x64 - bl sub_80AD9BC - movs r0, 0x13 - bl sub_80ABC48 - bl Random - movs r1, 0xF - ands r1, r0 - adds r1, 0x1E - strh r1, [r4] - ldr r2, =0x000006cc - adds r1, r5, r2 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD8A8: - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r3, =0x000006e6 - adds r1, r4, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080AD8FA - movs r0, 0x13 - movs r1, 0x3 - movs r2, 0x5 - bl sub_80ABC7C - ldr r0, =0x000006cc - adds r1, r4, r0 - ldrh r0, [r1] - adds r0, 0x1 - b _080AD8F8 - .pool -_080AD8DC: - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r1, =0x000006c6 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _080AD8FA - ldr r3, =0x000006ea - adds r1, r2, r3 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x000006cc - adds r1, r2, r0 -_080AD8F6: - movs r0, 0x4 -_080AD8F8: - strh r0, [r1] -_080AD8FA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD584 - - thumb_func_start sub_80AD910 -sub_80AD910: @ 80AD910 - push {r4-r6,lr} - ldr r0, =gUnknown_0854C14C - ldr r6, [r0] - ldr r0, =0x000006ce - adds r5, r6, r0 - ldrh r1, [r5] - cmp r1, 0x1 - beq _080AD946 - cmp r1, 0x1 - bgt _080AD934 - cmp r1, 0 - beq _080AD93A - b _080AD9AC - .pool -_080AD934: - cmp r1, 0x2 - beq _080AD990 - b _080AD9AC -_080AD93A: - ldr r2, =0x000006ea - adds r0, r6, r2 - strb r1, [r0] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_080AD946: - bl sub_80AD584 - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r1, =0x000006ea - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080AD9B4 - subs r1, 0x19 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x3 - beq _080AD9AC - cmp r0, 0x5 - beq _080AD9AC - cmp r0, 0xD - beq _080AD9AC - ldr r0, =0x000006d9 - adds r1, r2, r0 - movs r0, 0 - strb r0, [r1] - ldr r0, =0x000006ce - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080AD9B4 - .pool -_080AD990: - bl sub_80ACEAC - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080AD9B4 - bl sub_80ACF38 - ldr r1, =0x000006ed - adds r0, r6, r1 - strb r4, [r0] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_080AD9AC: - movs r0, 0 - b _080AD9B6 - .pool -_080AD9B4: - movs r0, 0x1 -_080AD9B6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80AD910 - - thumb_func_start sub_80AD9BC -sub_80AD9BC: @ 80AD9BC - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r0, =0x000006ed - adds r5, r4, r0 - ldrb r0, [r5] - cmp r0, 0 - bne _080AD9EA - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl __umodsi3 - movs r2, 0xDD - lsls r2, 3 - adds r1, r4, r2 - strh r0, [r1] - movs r0, 0x1 - strb r0, [r5] -_080AD9EA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AD9BC - - thumb_func_start sub_80AD9F8 -sub_80AD9F8: @ 80AD9F8 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006ed - adds r0, r1, r2 - ldrb r4, [r0] - cmp r4, 0x1 - bne _080ADA58 - movs r0, 0xDD - lsls r0, 3 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080ADA54 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _080ADA58 - bl Random - ands r4, r0 - cmp r4, 0 - beq _080ADA38 - movs r0, 0x57 - bl PlaySE - b _080ADA3E - .pool -_080ADA38: - movs r0, 0x58 - bl PlaySE -_080ADA3E: - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ed - adds r0, r1 - movs r1, 0 - strb r1, [r0] - b _080ADA58 - .pool -_080ADA54: - subs r0, 0x1 - strh r0, [r1] -_080ADA58: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80AD9F8 - - thumb_func_start sub_80ADA60 -sub_80ADA60: @ 80ADA60 - push {lr} - ldr r0, =gUnknown_0854C14C - ldr r3, [r0] - ldr r0, =0x000006cc - adds r1, r3, r0 - movs r2, 0 - movs r0, 0 - strh r0, [r1] - ldr r1, =0x000006d2 - adds r0, r3, r1 - strb r2, [r0] - subs r1, 0x11 - adds r0, r3, r1 - strb r2, [r0] - ldr r2, =0x000006c2 - adds r1, r3, r2 - movs r0, 0x14 - strb r0, [r1] - ldr r1, =0x000006fb - adds r0, r3, r1 - ldrb r1, [r0] - cmp r1, 0 - bne _080ADAA8 - adds r2, 0x2E - adds r0, r3, r2 - strh r1, [r0] - adds r2, 0x2 - adds r0, r3, r2 - strh r1, [r0] - subs r2, 0x4 - adds r0, r3, r2 - strh r1, [r0] - movs r0, 0 - movs r1, 0x10 - bl sub_80AC124 -_080ADAA8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADA60 - - thumb_func_start sub_80ADAC0 -sub_80ADAC0: @ 80ADAC0 - push {r4,lr} - bl sub_80ADA60 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080ADAE0 - adds r4, r1, r2 -_080ADAD6: - bl sub_80ADAF0 - ldrb r0, [r4] - cmp r0, 0 - beq _080ADAD6 -_080ADAE0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADAC0 - - thumb_func_start sub_80ADAF0 -sub_80ADAF0: @ 80ADAF0 - push {r4-r6,lr} - ldr r0, =gUnknown_0854C14C - ldr r6, [r0] - ldr r0, =gSpriteCoordOffsetX - ldr r1, =0x000006f2 - adds r2, r6, r1 - ldrh r0, [r0] - ldrh r1, [r2] - subs r0, r1 - movs r1, 0xFF - ands r0, r1 - ldr r3, =0x000006ee - adds r1, r6, r3 - strh r0, [r1] - movs r0, 0xDE - lsls r0, 3 - adds r1, r6, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bls _080ADB2A - movs r0, 0 - strh r0, [r1] - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] -_080ADB2A: - ldr r1, =0x000006cc - adds r5, r6, r1 - ldrh r4, [r5] - cmp r4, 0 - beq _080ADB50 - cmp r4, 0x1 - beq _080ADB90 - b _080ADBA6 - .pool -_080ADB50: - bl sub_80ADCAC - movs r3, 0xDA - lsls r3, 3 - adds r0, r6, r3 - ldrb r0, [r0] - cmp r0, 0x6 - bne _080ADB6C - movs r0, 0xC - movs r1, 0x8 - movs r2, 0x3 - bl sub_80AC164 - b _080ADB76 -_080ADB6C: - movs r0, 0x4 - movs r1, 0x10 - movs r2, 0 - bl sub_80AC164 -_080ADB76: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006cc - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080ADBA6 - .pool -_080ADB90: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080ADBA6 - ldr r1, =0x000006d2 - adds r0, r6, r1 - strb r4, [r0] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_080ADBA6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADAF0 - - thumb_func_start sub_80ADBB0 -sub_80ADBB0: @ 80ADBB0 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r0, =gSpriteCoordOffsetX - ldr r1, =0x000006f2 - adds r3, r2, r1 - ldrh r0, [r0] - ldrh r1, [r3] - subs r0, r1 - movs r1, 0xFF - ands r0, r1 - ldr r4, =0x000006ee - adds r1, r2, r4 - strh r0, [r1] - movs r0, 0xDE - lsls r0, 3 - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bls _080ADBEA - movs r0, 0 - strh r0, [r1] - ldrh r0, [r3] - adds r0, 0x1 - strh r0, [r3] -_080ADBEA: - ldr r1, =0x000006ce - adds r4, r2, r1 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080ADC26 - cmp r0, 0x1 - bgt _080ADC14 - cmp r0, 0 - beq _080ADC1A - b _080ADC3E - .pool -_080ADC14: - cmp r0, 0x2 - beq _080ADC32 - b _080ADC3E -_080ADC1A: - movs r0, 0 - movs r1, 0x10 - movs r2, 0x3 - bl sub_80AC164 - b _080ADC36 -_080ADC26: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080ADC42 - b _080ADC36 -_080ADC32: - bl sub_80ADD68 -_080ADC36: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080ADC42 -_080ADC3E: - movs r0, 0 - b _080ADC44 -_080ADC42: - movs r0, 0x1 -_080ADC44: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80ADBB0 - - thumb_func_start sub_80ADC4C -sub_80ADC4C: @ 80ADC4C - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gSpriteCoordOffsetY - ldrb r0, [r0] - strh r0, [r3, 0x26] - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ee - adds r2, r0, r1 - ldrh r1, [r2] - adds r1, 0x20 - movs r4, 0x2E - ldrsh r0, [r3, r4] - lsls r0, 6 - adds r1, r0 - strh r1, [r3, 0x20] - lsls r1, 16 - ldr r0, =0x010f0000 - cmp r1, r0 - ble _080ADC90 - movs r0, 0xF0 - lsls r0, 1 - adds r1, r0, 0 - ldrh r2, [r2] - adds r1, r2 - movs r4, 0x2E - ldrsh r2, [r3, r4] - movs r0, 0x4 - subs r0, r2 - lsls r0, 6 - subs r1, r0 - ldr r0, =0x000001ff - ands r1, r0 - strh r1, [r3, 0x20] -_080ADC90: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADC4C - - thumb_func_start sub_80ADCAC -sub_80ADCAC: @ 80ADCAC - push {r4,r5,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006fb - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080ADD56 - ldr r0, =gUnknown_0854FD30 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - movs r5, 0 -_080ADCD0: - ldr r0, =gSpriteTemplate_854FD18 - movs r1, 0 - movs r2, 0 - movs r3, 0xFF - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080ADD34 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r5, 0 - movs r1, 0x5 - bl __umodsi3 - strh r0, [r4, 0x2E] - lsls r0, 16 - lsrs r0, 10 - adds r0, 0x20 - strh r0, [r4, 0x20] - adds r0, r5, 0 - movs r1, 0x5 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 10 - adds r0, 0x20 - strh r0, [r4, 0x22] - ldr r2, =gUnknown_0854C14C - ldr r0, [r2] - lsls r1, r5, 2 - adds r0, 0xA0 - adds r0, r1 - str r4, [r0] - b _080ADD42 - .pool -_080ADD34: - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - lsls r0, r5, 2 - adds r1, 0xA0 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_080ADD42: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x13 - bls _080ADCD0 - ldr r0, [r2] - ldr r1, =0x000006fb - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080ADD56: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADCAC - - thumb_func_start sub_80ADD68 -sub_80ADD68: @ 80ADD68 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006fb - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080ADDA8 - movs r4, 0 - adds r5, r1, 0 - adds r5, 0xA0 -_080ADD7E: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080ADD8C - bl DestroySprite -_080ADD8C: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x13 - bls _080ADD7E - ldr r0, =0x00001201 - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006fb - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_080ADDA8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADD68 - - thumb_func_start sub_80ADDBC -sub_80ADDBC: @ 80ADDBC - push {lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006cc - adds r2, r1, r0 - movs r3, 0 - movs r0, 0 - strh r0, [r2] - ldr r2, =0x000006d2 - adds r0, r1, r2 - strb r3, [r0] - subs r2, 0x11 - adds r0, r1, r2 - strb r3, [r0] - ldr r3, =0x000006c2 - adds r0, r1, r3 - movs r2, 0x14 - strb r2, [r0] - adds r3, 0x3C - adds r0, r1, r3 - strh r2, [r0] - movs r0, 0xE0 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _080ADE04 - movs r0, 0 - movs r1, 0x10 - bl sub_80AC124 - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x52 - bl SetGpuReg -_080ADE04: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADDBC - - thumb_func_start sub_80ADE18 -sub_80ADE18: @ 80ADE18 - push {r4,lr} - bl sub_80ADDBC - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080ADE38 - adds r4, r1, r2 -_080ADE2E: - bl sub_80ADE48 - ldrb r0, [r4] - cmp r0, 0 - beq _080ADE2E -_080ADE38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADE18 - - thumb_func_start sub_80ADE48 -sub_80ADE48: @ 80ADE48 - push {r4,r5,lr} - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - ldr r0, =gSpriteCoordOffsetX - ldrh r0, [r0] - ldr r3, =0x000001ff - ands r3, r0 - ldr r0, =0x000006fc - adds r1, r0 - strh r3, [r1] - cmp r3, 0xEF - bls _080ADE74 - adds r4, r1, 0 - adds r1, r3, 0 -_080ADE64: - adds r3, r1, 0 - subs r3, 0xF0 - adds r1, r3, 0 - lsls r0, r3, 16 - lsrs r0, 16 - cmp r0, 0xEF - bhi _080ADE64 - strh r3, [r4] -_080ADE74: - ldr r5, [r2] - ldr r1, =0x000006cc - adds r4, r5, r1 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080ADEAC - cmp r0, 0x1 - bgt _080ADEA0 - cmp r0, 0 - beq _080ADEA6 - b _080ADEE8 - .pool -_080ADEA0: - cmp r0, 0x2 - beq _080ADEC8 - b _080ADEE8 -_080ADEA6: - bl sub_80ADF5C - b _080ADEDA -_080ADEAC: - movs r1, 0xE0 - lsls r1, 3 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080ADEBC - bl sub_80ADF6C -_080ADEBC: - movs r0, 0x10 - movs r1, 0 - movs r2, 0x1 - bl sub_80AC164 - b _080ADEDA -_080ADEC8: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080ADEEC - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080ADEDA: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080ADEEC - .pool -_080ADEE8: - bl sub_80AC1A8 -_080ADEEC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80ADE48 - - thumb_func_start sub_80ADEF4 -sub_80ADEF4: @ 80ADEF4 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ce - adds r4, r0, r1 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080ADF2A - cmp r0, 0x1 - bgt _080ADF18 - cmp r0, 0 - beq _080ADF1E - b _080ADF4E - .pool -_080ADF18: - cmp r0, 0x2 - beq _080ADF40 - b _080ADF4E -_080ADF1E: - movs r0, 0 - movs r1, 0x10 - movs r2, 0x1 - bl sub_80AC164 - b _080ADF38 -_080ADF2A: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080ADF52 - bl sub_80AE014 -_080ADF38: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080ADF52 -_080ADF40: - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080ADF4E: - movs r0, 0 - b _080ADF54 -_080ADF52: - movs r0, 0x1 -_080ADF54: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80ADEF4 - - thumb_func_start sub_80ADF5C -sub_80ADF5C: @ 80ADF5C - push {lr} - ldr r0, =gUnknown_0854FD38 - bl LoadSpriteSheet - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADF5C - - thumb_func_start sub_80ADF6C -sub_80ADF6C: @ 80ADF6C - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - movs r1, 0xE0 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE008 - movs r5, 0 -_080ADF80: - ldr r0, =gSpriteTemplate_854FD58 - movs r1, 0 - movs r2, 0 - movs r3, 0x4E - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080ADFE4 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r0, r5, 0 - movs r1, 0x5 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x32] - adds r0, r5, 0 - movs r1, 0x5 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x34] - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 6 - adds r0, 0x20 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_0854C14C - ldr r0, [r2] - lsls r1, r5, 2 - adds r0, 0xF0 - adds r0, r1 - str r4, [r0] - b _080ADFF2 - .pool -_080ADFE4: - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - lsls r0, r5, 2 - adds r1, 0xF0 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_080ADFF2: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x13 - bls _080ADF80 - ldr r0, [r2] - movs r1, 0xE0 - lsls r1, 3 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080AE008: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80ADF6C - - thumb_func_start sub_80AE014 -sub_80AE014: @ 80AE014 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - movs r2, 0xE0 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AE058 - movs r4, 0 - adds r5, r1, 0 - adds r5, 0xF0 -_080AE02C: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080AE03A - bl DestroySprite -_080AE03A: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x13 - bls _080AE02C - ldr r0, =0x00001202 - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - movs r1, 0xE0 - lsls r1, 3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_080AE058: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE014 - - thumb_func_start sub_80AE068 -sub_80AE068: @ 80AE068 - push {r4,lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x30] - adds r0, 0x1 - strh r0, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _080AE084 - movs r0, 0 - strh r0, [r3, 0x30] - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] -_080AE084: - ldr r1, =gSpriteCoordOffsetY - ldrh r0, [r3, 0x2E] - ldrh r1, [r1] - adds r0, r1 - strh r0, [r3, 0x22] - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006fc - adds r2, r0, r1 - ldrh r1, [r2] - adds r1, 0x20 - movs r4, 0x32 - ldrsh r0, [r3, r4] - lsls r0, 6 - adds r1, r0 - strh r1, [r3, 0x20] - lsls r1, 16 - ldr r0, =0x010f0000 - cmp r1, r0 - ble _080AE0C8 - movs r0, 0xF0 - lsls r0, 1 - adds r1, r0, 0 - ldrh r2, [r2] - adds r1, r2 - movs r4, 0x32 - ldrsh r2, [r3, r4] - movs r0, 0x4 - subs r0, r2 - lsls r0, 6 - subs r1, r0 - ldr r0, =0x000001ff - ands r1, r0 - strh r1, [r3, 0x20] -_080AE0C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE068 - - thumb_func_start sub_80AE0E4 -sub_80AE0E4: @ 80AE0E4 - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r3, [r0] - ldr r1, =0x000006cc - adds r0, r3, r1 - movs r1, 0 - movs r2, 0 - strh r2, [r0] - ldr r4, =0x000006d2 - adds r0, r3, r4 - strb r1, [r0] - subs r4, 0x11 - adds r0, r3, r4 - strb r1, [r0] - ldr r0, =0x000006c2 - adds r1, r3, r0 - movs r0, 0x14 - strb r0, [r1] - movs r1, 0xDE - lsls r1, 3 - adds r0, r3, r1 - strh r2, [r0] - adds r4, 0x31 - adds r1, r3, r4 - movs r0, 0x1 - strh r0, [r1] - ldr r1, =0x00000724 - adds r0, r3, r1 - ldrb r2, [r0] - cmp r2, 0 - bne _080AE14E - adds r4, 0x2A - adds r0, r3, r4 - strh r2, [r0] - subs r1, 0x6 - adds r0, r3, r1 - strh r2, [r0] - adds r4, 0x4 - adds r0, r3, r4 - strh r2, [r0] - adds r1, 0x4 - adds r0, r3, r1 - strh r2, [r0] - subs r4, 0x8 - adds r0, r3, r4 - strh r2, [r0] - subs r1, 0x8 - adds r0, r3, r1 - strh r2, [r0] - movs r0, 0 - movs r1, 0x10 - bl sub_80AC124 -_080AE14E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE0E4 - - thumb_func_start sub_80AE168 -sub_80AE168: @ 80AE168 - push {r4,lr} - bl sub_80AE0E4 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE188 - adds r4, r1, r2 -_080AE17E: - bl sub_80AE198 - ldrb r0, [r4] - cmp r0, 0 - beq _080AE17E -_080AE188: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE168 - - thumb_func_start sub_80AE198 -sub_80AE198: @ 80AE198 - push {r4,r5,lr} - bl sub_80AE25C - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x000006cc - adds r4, r5, r0 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AE1CC - cmp r0, 0x1 - bgt _080AE1C0 - cmp r0, 0 - beq _080AE1C6 - b _080AE1F0 - .pool -_080AE1C0: - cmp r0, 0x2 - beq _080AE1D8 - b _080AE1F0 -_080AE1C6: - bl sub_80AE2F0 - b _080AE1EA -_080AE1CC: - movs r0, 0xC - movs r1, 0x8 - movs r2, 0x8 - bl sub_80AC164 - b _080AE1EA -_080AE1D8: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AE1F0 - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080AE1EA: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AE1F0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE198 - - thumb_func_start sub_80AE1FC -sub_80AE1FC: @ 80AE1FC - push {r4,lr} - bl sub_80AE25C - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ce - adds r4, r0, r1 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AE236 - cmp r0, 0x1 - bgt _080AE224 - cmp r0, 0 - beq _080AE22A - b _080AE24E - .pool -_080AE224: - cmp r0, 0x2 - beq _080AE242 - b _080AE24E -_080AE22A: - movs r0, 0 - movs r1, 0x10 - movs r2, 0x1 - bl sub_80AC164 - b _080AE246 -_080AE236: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AE252 - b _080AE246 -_080AE242: - bl sub_80AE3A8 -_080AE246: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080AE252 -_080AE24E: - movs r0, 0 - b _080AE254 -_080AE252: - movs r0, 0x1 -_080AE254: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AE1FC - - thumb_func_start sub_80AE25C -sub_80AE25C: @ 80AE25C - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r3, [r0] - ldr r0, =0x0000071c - adds r2, r3, r0 - ldrh r0, [r2] - adds r0, 0x1 - movs r5, 0 - strh r0, [r2] - ldr r1, =0x0000ffff - adds r4, r1, 0 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bls _080AE288 - movs r0, 0xE4 - lsls r0, 3 - adds r1, r3, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - strh r5, [r2] -_080AE288: - ldr r1, =0x0000071e - adds r2, r3, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - ands r0, r4 - cmp r0, 0x4 - bls _080AE2A4 - ldr r0, =0x00000722 - adds r1, r3, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - strh r5, [r2] -_080AE2A4: - ldr r0, =gSpriteCoordOffsetX - movs r2, 0xE4 - lsls r2, 3 - adds r1, r3, r2 - ldrh r0, [r0] - ldrh r1, [r1] - subs r0, r1 - movs r1, 0xFF - ands r0, r1 - subs r2, 0x8 - adds r1, r3, r2 - strh r0, [r1] - ldr r1, =gSpriteCoordOffsetY - adds r2, 0xA - adds r0, r3, r2 - ldrh r0, [r0] - ldrh r1, [r1] - adds r0, r1 - subs r2, 0x8 - adds r1, r3, r2 - strh r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE25C - - thumb_func_start sub_80AE2F0 -sub_80AE2F0: @ 80AE2F0 - push {r4-r6,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x00000724 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE396 - ldr r0, =gUnknown_0854FD70 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - movs r6, 0 -_080AE314: - adds r0, r6, 0 - movs r1, 0x5 - bl __udivsi3 - adds r5, r0, 0 - lsls r2, r5, 22 - asrs r2, 16 - ldr r0, =gSpriteTemplate_854FD8C - movs r1, 0 - movs r3, 0xFF - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080AE370 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r6, 0 - movs r1, 0x5 - bl __umodsi3 - strh r0, [r4, 0x2E] - strh r5, [r4, 0x30] - ldr r2, =gUnknown_0854C14C - ldr r0, [r2] - lsls r1, r6, 2 - movs r3, 0xA0 - lsls r3, 1 - adds r0, r3 - adds r0, r1 - str r4, [r0] - b _080AE382 - .pool -_080AE370: - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - lsls r0, r6, 2 - movs r3, 0xA0 - lsls r3, 1 - adds r1, r3 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_080AE382: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x13 - bls _080AE314 - ldr r0, [r2] - ldr r1, =0x00000724 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080AE396: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE2F0 - - thumb_func_start sub_80AE3A8 -sub_80AE3A8: @ 80AE3A8 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x00000724 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AE3EA - movs r4, 0 - movs r0, 0xA0 - lsls r0, 1 - adds r5, r1, r0 -_080AE3C0: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080AE3CE - bl DestroySprite -_080AE3CE: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x13 - bls _080AE3C0 - ldr r0, =0x00001203 - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x00000724 - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_080AE3EA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE3A8 - - thumb_func_start sub_80AE3FC -sub_80AE3FC: @ 80AE3FC - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x0000071a - adds r0, r1, r2 - ldrh r0, [r0] - strh r0, [r3, 0x26] - movs r4, 0xE3 - lsls r4, 3 - adds r2, r1, r4 - ldrh r1, [r2] - adds r1, 0x20 - movs r4, 0x2E - ldrsh r0, [r3, r4] - lsls r0, 6 - adds r1, r0 - strh r1, [r3, 0x20] - lsls r1, 16 - ldr r0, =0x010f0000 - cmp r1, r0 - ble _080AE444 - movs r0, 0xF0 - lsls r0, 1 - adds r1, r0, 0 - ldrh r2, [r2] - adds r1, r2 - movs r4, 0x2E - ldrsh r2, [r3, r4] - movs r0, 0x4 - subs r0, r2 - lsls r0, 6 - subs r1, r0 - ldr r0, =0x000001ff - ands r1, r0 - strh r1, [r3, 0x20] -_080AE444: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE3FC - - thumb_func_start sub_80AE45C -sub_80AE45C: @ 80AE45C - push {r4,lr} - ldr r0, =gUnknown_0854C14C - ldr r3, [r0] - ldr r0, =0x000006cc - adds r1, r3, r0 - movs r2, 0 - movs r0, 0 - strh r0, [r1] - ldr r1, =0x000006d2 - adds r0, r3, r1 - strb r2, [r0] - ldr r4, =0x000006c1 - adds r0, r3, r4 - strb r2, [r0] - ldr r0, =0x000006c2 - adds r1, r3, r0 - movs r0, 0x14 - strb r0, [r1] - ldr r1, =0x00000716 - adds r0, r3, r1 - ldrb r2, [r0] - cmp r2, 0 - bne _080AE4B8 - adds r4, 0x43 - adds r1, r3, r4 - adds r4, 0x4 - adds r0, r3, r4 - str r2, [r0] - str r2, [r1] - ldr r0, =0x00000712 - adds r1, r3, r0 - movs r0, 0x8 - strh r0, [r1] - adds r4, 0xC - adds r0, r3, r4 - strh r2, [r0] - ldrh r2, [r1] - cmp r2, 0x5F - bls _080AE4B0 - movs r0, 0x80 - subs r0, r2 - strh r0, [r1] -_080AE4B0: - movs r0, 0 - movs r1, 0x10 - bl sub_80AC124 -_080AE4B8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE45C - - thumb_func_start sub_80AE4DC -sub_80AE4DC: @ 80AE4DC - push {r4,lr} - bl sub_80AE45C - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE4FC - adds r4, r1, r2 -_080AE4F2: - bl sub_80AE50C - ldrb r0, [r4] - cmp r0, 0 - beq _080AE4F2 -_080AE4FC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE4DC - - thumb_func_start sub_80AE50C -sub_80AE50C: @ 80AE50C - push {r4,r5,lr} - bl sub_80AE624 - bl sub_80AE5EC - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x00000712 - adds r1, r5, r0 - ldrh r0, [r1] - cmp r0, 0x5F - bls _080AE528 - movs r0, 0x20 - strh r0, [r1] -_080AE528: - ldr r0, =0x000006cc - adds r4, r5, r0 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AE558 - cmp r0, 0x1 - bgt _080AE548 - cmp r0, 0 - beq _080AE54E - b _080AE57C - .pool -_080AE548: - cmp r0, 0x2 - beq _080AE564 - b _080AE57C -_080AE54E: - bl sub_80AE738 - bl sub_80AE7F8 - b _080AE576 -_080AE558: - movs r0, 0x10 - movs r1, 0 - movs r2, 0 - bl sub_80AC164 - b _080AE576 -_080AE564: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AE57C - ldr r0, =0x000006d2 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080AE576: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080AE57C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE50C - - thumb_func_start sub_80AE588 -sub_80AE588: @ 80AE588 - push {r4,lr} - bl sub_80AE624 - bl sub_80AE5EC - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x000006ce - adds r4, r0, r1 - ldrh r0, [r4] - cmp r0, 0x1 - beq _080AE5C6 - cmp r0, 0x1 - bgt _080AE5B4 - cmp r0, 0 - beq _080AE5BA - b _080AE5DE - .pool -_080AE5B4: - cmp r0, 0x2 - beq _080AE5D2 - b _080AE5DE -_080AE5BA: - movs r0, 0 - movs r1, 0x10 - movs r2, 0 - bl sub_80AC164 - b _080AE5D6 -_080AE5C6: - bl sub_80AC1A8 - lsls r0, 24 - cmp r0, 0 - beq _080AE5E2 - b _080AE5D6 -_080AE5D2: - bl sub_80AE6A4 -_080AE5D6: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _080AE5E2 -_080AE5DE: - movs r0, 0 - b _080AE5E4 -_080AE5E2: - movs r0, 0x1 -_080AE5E4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80AE588 - - thumb_func_start sub_80AE5EC -sub_80AE5EC: @ 80AE5EC - push {lr} - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r0, =0x00000714 - adds r3, r2, r0 - ldrh r0, [r3] - adds r1, r0, 0x1 - strh r1, [r3] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bls _080AE612 - ldr r1, =0x00000712 - adds r0, r2, r1 - ldrh r1, [r0] - adds r1, 0x1 - movs r2, 0 - strh r1, [r0] - strh r2, [r3] -_080AE612: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE5EC - - thumb_func_start sub_80AE624 -sub_80AE624: @ 80AE624 - push {r4-r6,lr} - ldr r0, =gUnknown_0854C14C - ldr r2, [r0] - ldr r0, =0x00000704 - adds r4, r2, r0 - ldr r6, =gSineTable - ldr r1, =0x00000712 - adds r5, r2, r1 - ldrh r0, [r5] - lsls r0, 1 - adds r0, r6 - movs r3, 0 - ldrsh r1, [r0, r3] - lsls r1, 2 - ldr r0, [r4] - subs r0, r1 - str r0, [r4] - movs r0, 0xE1 - lsls r0, 3 - adds r3, r2, r0 - ldrh r0, [r5] - lsls r0, 1 - adds r0, r6 - movs r5, 0 - ldrsh r1, [r0, r5] - ldr r0, [r3] - subs r0, r1 - str r0, [r3] - ldr r1, =gSpriteCoordOffsetX - ldr r0, [r4] - lsrs r0, 8 - ldrh r1, [r1] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - ldr r4, =0x0000070e - adds r1, r2, r4 - strh r0, [r1] - ldr r1, =gSpriteCoordOffsetY - ldr r0, [r3] - lsrs r0, 8 - ldrh r1, [r1] - adds r0, r1 - movs r5, 0xE2 - lsls r5, 3 - adds r2, r5 - strh r0, [r2] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE624 - - thumb_func_start sub_80AE6A4 -sub_80AE6A4: @ 80AE6A4 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x00000716 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AE6E6 - movs r4, 0 - movs r0, 0xC8 - lsls r0, 1 - adds r5, r1, r0 -_080AE6BC: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080AE6CA - bl DestroySprite -_080AE6CA: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x13 - bls _080AE6BC - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x00000716 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, =0x00001204 - bl FreeSpriteTilesByTag -_080AE6E6: - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x00000717 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080AE720 - movs r4, 0 - movs r0, 0xF0 - lsls r0, 1 - adds r5, r1, r0 -_080AE6FC: - lsls r0, r4, 2 - adds r0, r5, r0 - ldr r0, [r0] - cmp r0, 0 - beq _080AE70A - bl DestroySprite -_080AE70A: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x4 - bls _080AE6FC - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x00000717 - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_080AE720: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE6A4 - - thumb_func_start sub_80AE738 -sub_80AE738: @ 80AE738 - push {r4-r7,lr} - sub sp, 0x4 - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x00000716 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE7E6 - ldr r0, =gUnknown_0854FDDC - bl LoadSpriteSheet - ldr r0, =gUnknown_0854C2B0 - bl sub_80ABF4C - movs r7, 0 -_080AE758: - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - adds r6, r0, 0 - lsls r2, r6, 22 - asrs r2, 16 - ldr r0, =gSpriteTemplate_854FDC4 - movs r1, 0 - movs r3, 0x1 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _080AE7C0 - ldr r2, =gUnknown_0854C14C - ldr r5, [r2] - lsls r0, r7, 2 - movs r3, 0xC8 - lsls r3, 1 - adds r5, r3 - adds r5, r0 - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - str r4, [r5] - adds r0, r7, 0 - movs r1, 0x5 - str r2, [sp] - bl __umodsi3 - strh r0, [r4, 0x2E] - ldr r0, [r5] - strh r6, [r0, 0x30] - ldr r2, [sp] - b _080AE7D2 - .pool -_080AE7C0: - ldr r2, =gUnknown_0854C14C - ldr r1, [r2] - lsls r0, r7, 2 - movs r3, 0xC8 - lsls r3, 1 - adds r1, r3 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_080AE7D2: - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x13 - bls _080AE758 - ldr r0, [r2] - ldr r1, =0x00000716 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080AE7E6: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE738 - - thumb_func_start sub_80AE7F8 -sub_80AE7F8: @ 80AE7F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r4, =gUnknown_0854C14C - ldr r0, [r4] - ldr r1, =0x00000717 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080AE8E4 - movs r7, 0 - mov r9, r4 - movs r2, 0 - mov r10, r2 -_080AE818: - lsls r0, r7, 1 - mov r8, r0 - adds r6, r0, r7 - lsls r5, r6, 4 - adds r1, r5, 0 - adds r1, 0x18 - lsls r1, 16 - asrs r1, 16 - ldr r0, =gSpriteTemplate_854FDC4 - movs r2, 0xD0 - movs r3, 0x1 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _080AE8BC - mov r2, r9 - ldr r4, [r2] - lsls r0, r7, 2 - movs r2, 0xF0 - lsls r2, 1 - adds r4, r2 - adds r4, r0 - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - str r2, [r4] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x3] - ldr r1, [r4] - adds r0, r6, r5 - strh r0, [r1, 0x30] - ldr r1, [r4] - movs r0, 0x8 - strh r0, [r1, 0x2E] - ldr r0, [r4] - mov r1, r10 - strh r1, [r0, 0x32] - ldr r1, [r4] - ldr r0, =0x00006730 - strh r0, [r1, 0x36] - ldr r1, [r4] - ldr r0, =gUnknown_0854FDE4 - add r0, r8 - ldrh r0, [r0] - strh r0, [r1, 0x34] - ldr r0, [r4] - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, [r4] - movs r1, 0 - movs r2, 0x2 - movs r3, 0 - bl CalcCenterToCornerVec - ldr r1, [r4] - ldr r0, =sub_80AE958 - str r0, [r1, 0x1C] - b _080AE8CE - .pool -_080AE8BC: - mov r2, r9 - ldr r0, [r2] - lsls r1, r7, 2 - movs r2, 0xF0 - lsls r2, 1 - adds r0, r2 - adds r0, r1 - mov r1, r10 - str r1, [r0] -_080AE8CE: - mov r2, r9 - ldr r0, [r2] - ldr r1, =0x00000717 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x4 - bls _080AE818 -_080AE8E4: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE7F8 - - thumb_func_start sub_80AE8F8 -sub_80AE8F8: @ 80AE8F8 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - movs r2, 0xE2 - lsls r2, 3 - adds r0, r1, r2 - ldrh r0, [r0] - strh r0, [r3, 0x26] - ldr r4, =0x0000070e - adds r2, r1, r4 - ldrh r1, [r2] - adds r1, 0x20 - movs r4, 0x2E - ldrsh r0, [r3, r4] - lsls r0, 6 - adds r1, r0 - strh r1, [r3, 0x20] - lsls r1, 16 - ldr r0, =0x010f0000 - cmp r1, r0 - ble _080AE940 - movs r0, 0xF0 - lsls r0, 1 - adds r1, r0, 0 - ldrh r2, [r2] - adds r1, r2 - movs r4, 0x2E - ldrsh r2, [r3, r4] - movs r0, 0x4 - subs r0, r2 - lsls r0, 6 - subs r1, r0 - ldr r0, =0x000001ff - ands r1, r0 - strh r1, [r3, 0x20] -_080AE940: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE8F8 - - thumb_func_start sub_80AE958 -sub_80AE958: @ 80AE958 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x34] - subs r0, 0x1 - strh r0, [r2, 0x34] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080AE972 - ldr r0, =sub_80AE97C - str r0, [r2, 0x1C] -_080AE972: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE958 - - thumb_func_start sub_80AE97C -sub_80AE97C: @ 80AE97C - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x22] - subs r0, 0x1 - strh r0, [r5, 0x22] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x30 - negs r1, r1 - cmp r0, r1 - bge _080AE99A - movs r0, 0xD0 - strh r0, [r5, 0x22] - movs r0, 0x4 - strh r0, [r5, 0x2E] -_080AE99A: - movs r0, 0x2E - ldrsh r4, [r5, r0] - ldr r3, =gSineTable - movs r2, 0x30 - ldrsh r1, [r5, r2] - lsls r0, r1, 1 - adds r0, r3 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r2, r4, 0 - muls r2, r0 - adds r1, 0x40 - lsls r1, 1 - adds r1, r3 - movs r3, 0 - ldrsh r0, [r1, r3] - muls r0, r4 - lsrs r2, 8 - strh r2, [r5, 0x24] - lsrs r0, 8 - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x30] - adds r0, 0xA - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x30] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080AE9E6 - movs r0, 0 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] -_080AE9E6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AE97C - - thumb_func_start sub_80AE9F0 -sub_80AE9F0: @ 80AE9F0 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x000006cc - adds r2, r1, r0 - movs r0, 0 - strh r0, [r2] - ldr r0, =0x000006c1 - adds r2, r1, r0 - movs r0, 0x3 - strb r0, [r2] - ldr r0, =0x000006c2 - adds r1, r0 - movs r0, 0x14 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80AE9F0 - - thumb_func_start sub_80AEA20 -sub_80AEA20: @ 80AEA20 - push {lr} - bl sub_80AE9F0 - pop {r0} - bx r0 - thumb_func_end sub_80AEA20 - - thumb_func_start nullsub_96 -nullsub_96: @ 80AEA2C - bx lr - thumb_func_end nullsub_96 - - thumb_func_start sub_80AEA30 -sub_80AEA30: @ 80AEA30 - movs r0, 0 - bx lr - thumb_func_end sub_80AEA30 - - thumb_func_start sub_80AEA34 -sub_80AEA34: @ 80AEA34 - push {r4,r5,lr} - bl sub_80ADA60 - ldr r0, =gUnknown_0854C14C - ldr r4, [r0] - ldr r1, =0x0000072e - adds r0, r4, r1 - ldrb r5, [r0] - cmp r5, 0 - bne _080AEA6C - ldr r0, =gUnknown_0854FDF8 - bl LoadSpriteSheet - movs r2, 0xE5 - lsls r2, 3 - adds r0, r4, r2 - strh r5, [r0] - ldr r0, =gUnknown_0854FDF0 - ldrb r1, [r0] - subs r2, 0x2 - adds r0, r4, r2 - strh r1, [r0] - ldr r1, =0x0000072a - adds r0, r4, r1 - strh r5, [r0] - adds r2, 0x6 - adds r0, r4, r2 - strh r5, [r0] -_080AEA6C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEA34 - - thumb_func_start sub_80AEA88 -sub_80AEA88: @ 80AEA88 - push {r4,lr} - bl sub_80AEA34 - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r2, =0x000006d2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080AEAA8 - adds r4, r1, r2 -_080AEA9E: - bl sub_80AEAB8 - ldrb r0, [r4] - cmp r0, 0 - beq _080AEA9E -_080AEAA8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEA88 - - thumb_func_start sub_80AEAB8 -sub_80AEAB8: @ 80AEAB8 - push {r4-r7,lr} - bl sub_80ADAF0 - ldr r0, =gUnknown_0854C14C - ldr r5, [r0] - ldr r0, =0x00000726 - adds r4, r5, r0 - ldrh r0, [r4] - adds r0, 0x1 - movs r6, 0 - strh r0, [r4] - ldr r1, =0x0000ffff - adds r7, r1, 0 - ldr r2, =gUnknown_0854FDF0 - movs r1, 0xE5 - lsls r1, 3 - adds r3, r5, r1 - ldrh r1, [r3] - adds r1, r2 - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1] - cmp r0, r1 - bls _080AEB10 - strh r6, [r4] - ldrh r0, [r3] - adds r0, 0x1 - strh r0, [r3] - ands r0, r7 - cmp r0, 0x7 - bls _080AEAF8 - strh r6, [r3] -_080AEAF8: - ldr r0, =0x0000072a - adds r4, r5, r0 - ldrh r0, [r4] - bl sub_80AEB48 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - ands r0, r7 - cmp r0, 0xC - bls _080AEB10 - strh r6, [r4] -_080AEB10: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEAB8 - - thumb_func_start sub_80AEB2C -sub_80AEB2C: @ 80AEB2C - push {lr} - bl sub_80ADBB0 - lsls r0, 24 - cmp r0, 0 - beq _080AEB3C - movs r0, 0x1 - b _080AEB42 -_080AEB3C: - bl sub_80AEBD0 - movs r0, 0 -_080AEB42: - pop {r1} - bx r1 - thumb_func_end sub_80AEB2C - - thumb_func_start sub_80AEB48 -sub_80AEB48: @ 80AEB48 - push {r4,lr} - lsls r0, 16 - ldr r1, =gUnknown_0854FE00 - lsrs r0, 14 - adds r3, r0, r1 - adds r1, 0x2 - adds r0, r1 - ldr r1, =gSpriteCoordOffsetY - ldrh r2, [r0] - ldrh r0, [r1] - subs r2, r0 - ldr r0, =gSpriteTemplate_854FE44 - movs r4, 0 - ldrsh r1, [r3, r4] - lsls r2, 16 - asrs r2, 16 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _080AEBB0 - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r3] - movs r0, 0 - strh r0, [r1, 0x2E] - strh r0, [r1, 0x30] - strh r0, [r1, 0x32] - ldr r0, =gUnknown_0854C14C - ldr r1, [r0] - ldr r0, =0x0000072c - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_080AEBB0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEB48 - - thumb_func_start sub_80AEBD0 -sub_80AEBD0: @ 80AEBD0 - push {r4,r5,lr} - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x0000072c - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080AEC1A - movs r4, 0 - ldr r5, =gSprites -_080AEBE4: - lsls r0, r4, 4 - adds r0, r4 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x14 - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =gSpriteTemplate_854FE44 - cmp r1, r0 - bne _080AEBFE - adds r0, r2, r5 - bl DestroySprite -_080AEBFE: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3F - bls _080AEBE4 - ldr r0, =0x00001205 - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0854C14C - ldr r0, [r0] - ldr r1, =0x0000072c - adds r0, r1 - movs r1, 0 - strh r1, [r0] -_080AEC1A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEBD0 - - thumb_func_start sub_80AEC34 -sub_80AEC34: @ 80AEC34 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - movs r2, 0 - adds r0, 0x2 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080AEC74 - strh r2, [r1, 0x2E] - movs r3, 0x30 - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _080AEC66 - ldrh r0, [r1, 0x24] - adds r0, 0x1 - strh r0, [r1, 0x24] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _080AEC74 - movs r0, 0x1 - strh r0, [r1, 0x30] - b _080AEC74 -_080AEC66: - ldrh r0, [r1, 0x24] - subs r0, 0x1 - strh r0, [r1, 0x24] - lsls r0, 16 - cmp r0, 0 - bgt _080AEC74 - strh r2, [r1, 0x30] -_080AEC74: - ldrh r0, [r1, 0x22] - subs r0, 0x3 - strh r0, [r1, 0x22] - ldrh r0, [r1, 0x32] - adds r0, 0x1 - strh r0, [r1, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x77 - ble _080AEC8E - adds r0, r1, 0 - bl DestroySprite -_080AEC8E: - pop {r0} - bx r0 - thumb_func_end sub_80AEC34 - - thumb_func_start sub_80AEC94 -sub_80AEC94: @ 80AEC94 - ldr r2, =gUnknown_02038BC4 - strb r0, [r2] - ldr r0, =gUnknown_02038BC6 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_80AEC94 - - thumb_func_start sub_80AECA8 -sub_80AECA8: @ 80AECA8 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080AECCC - cmp r0, 0x1 - beq _080AECF8 - b _080AED1C - .pool -_080AECCC: - ldrh r0, [r4, 0x1E] - subs r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - cmp r0, 0 - bgt _080AED1C - ldrb r0, [r4, 0x2] - bl weather_set - ldr r1, =gUnknown_02038BC4 - ldrh r0, [r4, 0x2] - strb r0, [r1] - movs r1, 0x96 - lsls r1, 2 - adds r0, r1, 0 - strh r0, [r4, 0x1E] - ldrh r0, [r4] - adds r0, 0x1 - b _080AED1A - .pool -_080AECF8: - ldrh r0, [r4, 0x1E] - subs r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - cmp r0, 0 - bgt _080AED1C - ldrb r0, [r4, 0x4] - bl weather_set - ldr r1, =gUnknown_02038BC4 - ldrh r0, [r4, 0x4] - strb r0, [r1] - movs r1, 0x96 - lsls r1, 2 - adds r0, r1, 0 - strh r0, [r4, 0x1E] - movs r0, 0 -_080AED1A: - strh r0, [r4] -_080AED1C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AECA8 - - thumb_func_start bag_add_task0_by_acit -bag_add_task0_by_acit: @ 80AED28 - push {lr} - ldr r0, =sub_80AECA8 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - movs r2, 0x96 - lsls r2, 2 - adds r0, r2, 0 - strh r0, [r1, 0x1E] - ldr r3, =gUnknown_02038BC4 - ldrb r2, [r3] - cmp r2, 0xD - bne _080AED60 - movs r0, 0xC - b _080AED66 - .pool -_080AED60: - cmp r2, 0xC - bne _080AED6C - movs r0, 0xD -_080AED66: - strh r0, [r1, 0x2] - strh r2, [r1, 0x4] - b _080AED78 -_080AED6C: - movs r0, 0xD - strb r0, [r3] - movs r0, 0xC - strh r0, [r1, 0x2] - movs r0, 0xD - strh r0, [r1, 0x4] -_080AED78: - pop {r0} - bx r0 - thumb_func_end bag_add_task0_by_acit - - thumb_func_start SetSav1Weather -SetSav1Weather: @ 80AED7C - push {r4,r5,lr} - ldr r4, =gSaveBlock1Ptr - ldr r1, [r4] - adds r1, 0x2E - ldrb r5, [r1] - lsls r0, 24 - lsrs r0, 24 - bl sub_80AEEE8 - ldr r1, [r4] - adds r1, 0x2E - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x2E - ldrb r0, [r0] - adds r1, r5, 0 - bl sub_80AEFDC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetSav1Weather - - thumb_func_start GetSav1Weather -GetSav1Weather: @ 80AEDAC - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - adds r0, 0x2E - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetSav1Weather - - thumb_func_start SetSav1WeatherFromCurrMapHeader -SetSav1WeatherFromCurrMapHeader: @ 80AEDBC - push {r4,r5,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - adds r0, 0x2E - ldrb r5, [r0] - ldr r0, =gMapHeader - ldrb r0, [r0, 0x16] - bl sub_80AEEE8 - ldr r1, [r4] - adds r1, 0x2E - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x2E - ldrb r0, [r0] - adds r1, r5, 0 - bl sub_80AEFDC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetSav1WeatherFromCurrMapHeader - - thumb_func_start SetWeather -SetWeather: @ 80AEDF0 - push {lr} - bl SetSav1Weather - bl GetSav1Weather - lsls r0, 24 - lsrs r0, 24 - bl weather_set - pop {r0} - bx r0 - thumb_func_end SetWeather - - thumb_func_start sub_80AEE08 -sub_80AEE08: @ 80AEE08 - push {lr} - bl SetSav1Weather - bl GetSav1Weather - lsls r0, 24 - lsrs r0, 24 - bl sub_80AB104 - pop {r0} - bx r0 - thumb_func_end sub_80AEE08 - - thumb_func_start DoCurrentWeather -DoCurrentWeather: @ 80AEE20 - push {r4,r5,lr} - bl GetSav1Weather - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bne _080AEE4C - ldr r0, =sub_80AECA8 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080AEE3E - bl bag_add_task0_by_acit -_080AEE3E: - ldr r0, =gUnknown_02038BC4 - ldrb r4, [r0] - b _080AEE6E - .pool -_080AEE4C: - ldr r5, =sub_80AECA8 - adds r0, r5, 0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _080AEE68 - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_080AEE68: - ldr r1, =gUnknown_02038BC4 - movs r0, 0xD - strb r0, [r1] -_080AEE6E: - adds r0, r4, 0 - bl weather_set - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DoCurrentWeather - - thumb_func_start sub_80AEE84 -sub_80AEE84: @ 80AEE84 - push {r4,r5,lr} - bl GetSav1Weather - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bne _080AEEB0 - ldr r0, =sub_80AECA8 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080AEEA2 - bl bag_add_task0_by_acit -_080AEEA2: - ldr r0, =gUnknown_02038BC4 - ldrb r4, [r0] - b _080AEED2 - .pool -_080AEEB0: - ldr r5, =sub_80AECA8 - adds r0, r5, 0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _080AEECC - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_080AEECC: - ldr r1, =gUnknown_02038BC4 - movs r0, 0xD - strb r0, [r1] -_080AEED2: - adds r0, r4, 0 - bl sub_80AB104 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AEE84 - - thumb_func_start sub_80AEEE8 -sub_80AEEE8: @ 80AEEE8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x15 - bhi _080AEFB4 - lsls r0, 2 - ldr r1, =_080AEF00 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AEF00: - .4byte _080AEFB4 - .4byte _080AEF58 - .4byte _080AEF5C - .4byte _080AEF60 - .4byte _080AEF64 - .4byte _080AEF68 - .4byte _080AEF6C - .4byte _080AEF70 - .4byte _080AEF74 - .4byte _080AEF78 - .4byte _080AEF7C - .4byte _080AEF80 - .4byte _080AEF84 - .4byte _080AEF88 - .4byte _080AEF8C - .4byte _080AEF90 - .4byte _080AEFB4 - .4byte _080AEFB4 - .4byte _080AEFB4 - .4byte _080AEFB4 - .4byte _080AEF94 - .4byte _080AEF9C -_080AEF58: - movs r0, 0x1 - b _080AEFB6 -_080AEF5C: - movs r0, 0x2 - b _080AEFB6 -_080AEF60: - movs r0, 0x3 - b _080AEFB6 -_080AEF64: - movs r0, 0x4 - b _080AEFB6 -_080AEF68: - movs r0, 0x5 - b _080AEFB6 -_080AEF6C: - movs r0, 0x6 - b _080AEFB6 -_080AEF70: - movs r0, 0x7 - b _080AEFB6 -_080AEF74: - movs r0, 0x8 - b _080AEFB6 -_080AEF78: - movs r0, 0x9 - b _080AEFB6 -_080AEF7C: - movs r0, 0xA - b _080AEFB6 -_080AEF80: - movs r0, 0xB - b _080AEFB6 -_080AEF84: - movs r0, 0xC - b _080AEFB6 -_080AEF88: - movs r0, 0xD - b _080AEFB6 -_080AEF8C: - movs r0, 0xE - b _080AEFB6 -_080AEF90: - movs r0, 0xF - b _080AEFB6 -_080AEF94: - ldr r1, =gUnknown_0854FE5C - b _080AEF9E - .pool -_080AEF9C: - ldr r1, =gUnknown_0854FE60 -_080AEF9E: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - adds r0, 0x2F - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - b _080AEFB6 - .pool -_080AEFB4: - movs r0, 0 -_080AEFB6: - pop {r1} - bx r1 - thumb_func_end sub_80AEEE8 - - thumb_func_start UpdateWeatherPerDay -UpdateWeatherPerDay: @ 80AEFBC - lsls r0, 16 - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - adds r2, 0x2F - lsrs r0, 16 - ldrb r1, [r2] - adds r0, r1 - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 16 - strb r1, [r2] - bx lr - .pool - thumb_func_end UpdateWeatherPerDay - - thumb_func_start sub_80AEFDC -sub_80AEFDC: @ 80AEFDC - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r0, 24 - cmp r0, r1 - beq _080AEFF6 - cmp r2, 0x3 - beq _080AEFF0 - cmp r2, 0x5 - bne _080AEFF6 -_080AEFF0: - movs r0, 0x28 - bl IncrementGameStat -_080AEFF6: - pop {r0} - bx r0 - thumb_func_end sub_80AEFDC thumb_func_start palette_bg_faded_fill_white palette_bg_faded_fill_white: @ 80AEFFC @@ -8722,7 +912,7 @@ sub_80AF734: @ 80AF734 bl ScriptContext2_Enable bl music_something bl sub_80AF0B4 - bl play_some_sound + bl PlayRainSoundEffect movs r0, 0x9 bl PlaySE ldr r0, =gFieldCallback @@ -8742,7 +932,7 @@ sp13E_warp_to_last_warp: @ 80AF76C bl ScriptContext2_Enable bl music_something bl sub_80AF0B4 - bl play_some_sound + bl PlayRainSoundEffect ldr r0, =gFieldCallback ldr r1, =mapldr_default str r1, [r0] @@ -8762,7 +952,7 @@ sub_80AF79C: @ 80AF79C movs r0, 0x3 movs r1, 0x8 bl FadeScreen - bl play_some_sound + bl PlayRainSoundEffect ldr r0, =gFieldCallback ldr r1, =sub_80AF3B0 str r1, [r0] @@ -9253,7 +1443,7 @@ _080AFBCE: _080AFBD4: bl music_something bl sub_80AF0B4 - bl play_some_sound + bl PlayRainSoundEffect movs r0, 0 strh r0, [r5, 0x8] ldr r0, =sub_80AFA0C @@ -9325,7 +1515,7 @@ sub_80AFC60: @ 80AFC60 bl ScriptContext2_Enable bl music_something bl sub_80AF0B4 - bl play_some_sound + bl PlayRainSoundEffect movs r0, 0x9 bl PlaySE ldr r0, =gFieldCallback diff --git a/asm/ice.s b/asm/ice.s index 37142e535..3202213b4 100644 --- a/asm/ice.s +++ b/asm/ice.s @@ -1368,7 +1368,7 @@ _0810C0E2: mov r0, sp movs r2, 0 bl sub_80A6D60 - ldr r0, =gUnknown_0854C270 + ldr r0, =gUnknown_083970E8 mov r1, sp ldrb r1, [r1, 0x8] lsls r1, 4 @@ -1650,7 +1650,7 @@ _0810C366: mov r0, sp movs r2, 0 bl sub_80A6D60 - ldr r0, =gUnknown_0854C270 + ldr r0, =gUnknown_083970E8 mov r1, sp ldrb r1, [r1, 0x8] lsls r1, 4 diff --git a/data/field_screen.s b/data/field_screen.s index 968e2e7f3..508e86c63 100644 --- a/data/field_screen.s +++ b/data/field_screen.s @@ -3,490 +3,3 @@ .section .rodata - .align 2 -gUnknown_0854014C:: @ 854014C - .incbin "graphics/misc/sunny_day/0.gbapal" - .incbin "graphics/misc/sunny_day/1.gbapal" - .incbin "graphics/misc/sunny_day/2.gbapal" - .incbin "graphics/misc/sunny_day/3.gbapal" - .incbin "graphics/misc/sunny_day/4.gbapal" - .incbin "graphics/misc/sunny_day/5.gbapal" - .incbin "graphics/misc/sunny_day/6.gbapal" - .incbin "graphics/misc/sunny_day/7.gbapal" - .incbin "graphics/misc/sunny_day/8.gbapal" - .incbin "graphics/misc/sunny_day/9.gbapal" - .incbin "graphics/misc/sunny_day/10.gbapal" - .incbin "graphics/misc/sunny_day/11.gbapal" - .incbin "graphics/misc/sunny_day/12.gbapal" - .incbin "graphics/misc/sunny_day/13.gbapal" - .incbin "graphics/misc/sunny_day/14.gbapal" - .incbin "graphics/misc/sunny_day/15.gbapal" - .incbin "graphics/misc/sunny_day/16.gbapal" - .incbin "graphics/misc/sunny_day/17.gbapal" - .incbin "graphics/misc/sunny_day/18.gbapal" - .incbin "graphics/misc/sunny_day/19.gbapal" - .incbin "graphics/misc/sunny_day/20.gbapal" - .incbin "graphics/misc/sunny_day/21.gbapal" - .incbin "graphics/misc/sunny_day/22.gbapal" - .incbin "graphics/misc/sunny_day/23.gbapal" - .incbin "graphics/misc/sunny_day/24.gbapal" - .incbin "graphics/misc/sunny_day/25.gbapal" - .incbin "graphics/misc/sunny_day/26.gbapal" - .incbin "graphics/misc/sunny_day/27.gbapal" - .incbin "graphics/misc/sunny_day/28.gbapal" - .incbin "graphics/misc/sunny_day/29.gbapal" - .incbin "graphics/misc/sunny_day/30.gbapal" - .incbin "graphics/misc/sunny_day/31.gbapal" - .incbin "graphics/misc/sunny_day/32.gbapal" - .incbin "graphics/misc/sunny_day/33.gbapal" - .incbin "graphics/misc/sunny_day/34.gbapal" - .incbin "graphics/misc/sunny_day/35.gbapal" - .incbin "graphics/misc/sunny_day/36.gbapal" - .incbin "graphics/misc/sunny_day/37.gbapal" - .incbin "graphics/misc/sunny_day/38.gbapal" - .incbin "graphics/misc/sunny_day/39.gbapal" - .incbin "graphics/misc/sunny_day/40.gbapal" - .incbin "graphics/misc/sunny_day/41.gbapal" - .incbin "graphics/misc/sunny_day/42.gbapal" - .incbin "graphics/misc/sunny_day/43.gbapal" - .incbin "graphics/misc/sunny_day/44.gbapal" - .incbin "graphics/misc/sunny_day/45.gbapal" - .incbin "graphics/misc/sunny_day/46.gbapal" - .incbin "graphics/misc/sunny_day/47.gbapal" - .incbin "graphics/misc/sunny_day/48.gbapal" - .incbin "graphics/misc/sunny_day/49.gbapal" - .incbin "graphics/misc/sunny_day/50.gbapal" - .incbin "graphics/misc/sunny_day/51.gbapal" - .incbin "graphics/misc/sunny_day/52.gbapal" - .incbin "graphics/misc/sunny_day/53.gbapal" - .incbin "graphics/misc/sunny_day/54.gbapal" - .incbin "graphics/misc/sunny_day/55.gbapal" - .incbin "graphics/misc/sunny_day/56.gbapal" - .incbin "graphics/misc/sunny_day/57.gbapal" - .incbin "graphics/misc/sunny_day/58.gbapal" - .incbin "graphics/misc/sunny_day/59.gbapal" - .incbin "graphics/misc/sunny_day/60.gbapal" - .incbin "graphics/misc/sunny_day/61.gbapal" - .incbin "graphics/misc/sunny_day/62.gbapal" - .incbin "graphics/misc/sunny_day/63.gbapal" - .incbin "graphics/misc/sunny_day/64.gbapal" - .incbin "graphics/misc/sunny_day/65.gbapal" - .incbin "graphics/misc/sunny_day/66.gbapal" - .incbin "graphics/misc/sunny_day/67.gbapal" - .incbin "graphics/misc/sunny_day/68.gbapal" - .incbin "graphics/misc/sunny_day/69.gbapal" - .incbin "graphics/misc/sunny_day/70.gbapal" - .incbin "graphics/misc/sunny_day/71.gbapal" - .incbin "graphics/misc/sunny_day/72.gbapal" - .incbin "graphics/misc/sunny_day/73.gbapal" - .incbin "graphics/misc/sunny_day/74.gbapal" - .incbin "graphics/misc/sunny_day/75.gbapal" - .incbin "graphics/misc/sunny_day/76.gbapal" - .incbin "graphics/misc/sunny_day/77.gbapal" - .incbin "graphics/misc/sunny_day/78.gbapal" - .incbin "graphics/misc/sunny_day/79.gbapal" - .incbin "graphics/misc/sunny_day/80.gbapal" - .incbin "graphics/misc/sunny_day/81.gbapal" - .incbin "graphics/misc/sunny_day/82.gbapal" - .incbin "graphics/misc/sunny_day/83.gbapal" - .incbin "graphics/misc/sunny_day/84.gbapal" - .incbin "graphics/misc/sunny_day/85.gbapal" - .incbin "graphics/misc/sunny_day/86.gbapal" - .incbin "graphics/misc/sunny_day/87.gbapal" - .incbin "graphics/misc/sunny_day/88.gbapal" - .incbin "graphics/misc/sunny_day/89.gbapal" - .incbin "graphics/misc/sunny_day/90.gbapal" - .incbin "graphics/misc/sunny_day/91.gbapal" - .incbin "graphics/misc/sunny_day/92.gbapal" - .incbin "graphics/misc/sunny_day/93.gbapal" - .incbin "graphics/misc/sunny_day/94.gbapal" - .incbin "graphics/misc/sunny_day/95.gbapal" - - .align 2 -gUnknown_0854C14C:: @ 854C14C - .4byte gUnknown_02038454 - - .align 2 -gUnknown_0854C150:: @ 854C150 - .4byte sub_80AB26C - .4byte nullsub_36 - .4byte sub_80AB26C - .4byte sub_80AB290 - .4byte sub_80AC438 - .4byte sub_80AC4B4 - .4byte sub_80AC484 - .4byte sub_80AC514 - .4byte sub_80AC55C - .4byte nullsub_95 - .4byte sub_80AC580 - .4byte sub_80AC590 - .4byte sub_80AC928 - .4byte sub_80AC9C4 - .4byte sub_80AC994 - .4byte sub_80ACA24 - .4byte sub_80ACF8C - .4byte snowflakes_progress2 - .4byte sub_80ACFDC - .4byte sub_80AD084 - .4byte sub_80AD444 - .4byte sub_80AD584 - .4byte sub_80AD4B8 - .4byte sub_80AD910 - .4byte sub_80ADA60 - .4byte sub_80ADAF0 - .4byte sub_80ADAC0 - .4byte sub_80ADBB0 - .4byte sub_80ADDBC - .4byte sub_80ADE48 - .4byte sub_80ADE18 - .4byte sub_80ADEF4 - .4byte sub_80AE45C - .4byte sub_80AE50C - .4byte sub_80AE4DC - .4byte sub_80AE588 - .4byte sub_80AE0E4 - .4byte sub_80AE198 - .4byte sub_80AE168 - .4byte sub_80AE1FC - .4byte sub_80ADA60 - .4byte sub_80ADAF0 - .4byte sub_80ADAC0 - .4byte sub_80ADBB0 - .4byte sub_80AE9F0 - .4byte nullsub_96 - .4byte sub_80AEA20 - .4byte sub_80AEA30 - .4byte sub_80AC6D0 - .4byte sub_80AC734 - .4byte sub_80AC704 - .4byte sub_80AC818 - .4byte sub_80AD4E8 - .4byte sub_80AD584 - .4byte sub_80AD554 - .4byte sub_80AD910 - .4byte sub_80AEA34 - .4byte sub_80AEAB8 - .4byte sub_80AEA88 - .4byte sub_80AEB2C - - .align 2 -gUnknown_0854C240:: @ 854C240 - .4byte sub_80AB3A8 - .4byte sub_80AB434 - .4byte nullsub_94 - .4byte nullsub_94 - - .align 2 -gUnknown_0854C250:: @ 854C250 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01 - - .align 2 -gUnknown_0854C270:: @ 854C270 - .incbin "graphics/weather/0.gbapal" - - .align 2 -gUnknown_0854C290:: @ 854C290 - .incbin "graphics/weather/1.gbapal" - - .align 2 -gUnknown_0854C2B0:: @ 854C2B0 - .incbin "graphics/weather/2.gbapal" - - .align 2 -gWeatherFog2Tiles:: @ 854C2D0 - .incbin "graphics/weather/fog2.4bpp" - - .align 2 -gWeatherFog1Tiles:: @ 854CAD0 - .incbin "graphics/weather/fog1.4bpp" - - .align 2 -gWeatherCloudTiles:: @ 854D2D0 - .incbin "graphics/weather/cloud.4bpp" - - .align 2 -gWeatherSnow1Tiles:: @ 854DAD0 - .incbin "graphics/weather/snow0.4bpp" - - .align 2 -gWeatherSnow2Tiles:: @ 854DAF0 - .incbin "graphics/weather/snow1.4bpp" - - .align 2 -gWeatherBubbleTiles:: @ 854DB10 - .incbin "graphics/weather/bubble.4bpp" - - .align 2 -gWeatherAshTiles:: @ 854DB50 - .incbin "graphics/weather/ash.4bpp" - - .align 2 -gWeatherRainTiles:: @ 854EB50 - .incbin "graphics/weather/rain.4bpp" - - .align 2 -gWeatherSandstormTiles:: @ 854F150 - .incbin "graphics/weather/sandstorm.4bpp" - - .align 1 -gUnknown_0854FB50:: @ 854FB50 - .2byte 0x0000, 0x0042, 0x0005, 0x0049, 0x000a, 0x004e - - .align 2 -sCloudSpriteSheet:: @ 854FB5C - obj_tiles gWeatherCloudTiles, 0x0800, 0x1200 - - .align 2 -gOamData_854FB64:: @ 854FB64 - .2byte 0x0400, 0xc000, 0x0c00, 0x0000 - - .align 2 -gSpriteAnim_854FB6C:: @ 854FB6C - .2byte 0x0000, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FB74:: @ 854FB74 - .4byte gSpriteAnim_854FB6C - - .align 2 -sCloudSpriteTemplate:: @ 854FB78 - spr_template 0x1200, 0x1201, gOamData_854FB64, gSpriteAnimTable_854FB74, NULL, gDummySpriteAffineAnimTable, sub_80AC6B4 - - .align 2 -gUnknown_0854FB90:: @ 854FB90 - .2byte 0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0040, 0x0090, 0x00e0, 0x0090, 0x0080, 0x0020, 0x0020, 0x0020, 0x00c0, 0x0020, 0x0060 - .2byte 0x0048, 0x0080, 0x0048, 0x0020, 0x0048, 0x00c0, 0x00d8, 0x0060, 0x00d8, 0x0000, 0x0068, 0x00a0, 0x0068, 0x0040, 0x0068, 0x00e0 - .2byte 0x0090, 0x0000, 0x0090, 0x00a0, 0x0090, 0x0040, 0x0020, 0x00e0, 0x0020, 0x0080, 0x0048, 0x0020, 0x0048, 0x00c0, 0x0030, 0x0060 - - .align 2 -gOamData_854FBF0:: @ 854FBF0 - .2byte 0x8000, 0x8000, 0x2400, 0x0000 - - .align 2 -gSpriteAnim_854FBF8:: @ 854FBF8 - .2byte 0x0000, 0x0010, 0xfffe, 0x0000 - - .align 2 -gSpriteAnim_854FC00:: @ 854FC00 - .2byte 0x0008, 0x0003, 0x0020, 0x0002, 0x0028, 0x0002, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FC10:: @ 854FC10 - .2byte 0x0008, 0x0003, 0x0010, 0x0003, 0x0018, 0x0004, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FC20:: @ 854FC20 - .4byte gSpriteAnim_854FBF8 - .4byte gSpriteAnim_854FC00 - .4byte gSpriteAnim_854FC10 - - .align 2 -gSpriteTemplate_854FC2C:: @ 854FC2C - spr_template 0x1206, 0x1200, gOamData_854FBF0, gSpriteAnimTable_854FC20, NULL, gDummySpriteAffineAnimTable, sub_80ACB84 - - .align 1 -gUnknown_0854FC44:: @ 854FC44 - .2byte 0xff98, 0x00d0, 0xff60, 0x0140 - - .align 1 -gUnknown_0854FC4C:: @ 854FC4C - .2byte 0x0012, 0x0007, 0x000c, 0x000a - - .align 2 -gUnknown_0854FC54:: @ 854FC54 - obj_tiles gWeatherRainTiles, 0x0600, 0x1206 - - .align 2 -gOamData_854FC5C:: @ 854FC5C - .2byte 0x0000, 0x0000, 0x0400, 0x0000 - - .align 2 -gUnknown_0854FC64:: @ 854FC64 - obj_frame_tiles gWeatherSnow1Tiles, 0x0020 - obj_frame_tiles gWeatherSnow2Tiles, 0x0020 - - .align 2 -gSpriteAnim_854FC74:: @ 854FC74 - .2byte 0x0000, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FC7C:: @ 854FC7C - .2byte 0x0001, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FC84:: @ 854FC84 - .4byte gSpriteAnim_854FC74 - .4byte gSpriteAnim_854FC7C - - .align 2 -gUnknown_0854FC8C:: @ 854FC8C - spr_template 0xffff, 0x1200, gOamData_854FC5C, gSpriteAnimTable_854FC84, gUnknown_0854FC64, gDummySpriteAffineAnimTable, sub_80AD30C - - .align 2 -gUnknown_0854FCA4:: @ 854FCA4 - .2byte 0x0000, 0x0006, 0x0006, 0x000c, 0x0012, 0x002a, 0x012c, 0x012c - - .align 2 -gOamData_854FCB4:: @ 854FCB4 - .2byte 0x0400, 0xc000, 0x0800, 0x0000 - - .align 2 -gSpriteAnim_854FCBC:: @ 854FCBC - .2byte 0x0000, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FCC4:: @ 854FCC4 - .2byte 0x0020, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FCCC:: @ 854FCCC - .2byte 0x0040, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FCD4:: @ 854FCD4 - .2byte 0x0060, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FCDC:: @ 854FCDC - .2byte 0x0080, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FCE4:: @ 854FCE4 - .2byte 0x00a0, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FCEC:: @ 854FCEC - .4byte gSpriteAnim_854FCBC - .4byte gSpriteAnim_854FCC4 - .4byte gSpriteAnim_854FCCC - .4byte gSpriteAnim_854FCD4 - .4byte gSpriteAnim_854FCDC - .4byte gSpriteAnim_854FCE4 - - .align 2 -gSpriteAffineAnim_854FD04:: @ 854FD04 - .2byte 0x0200, 0x0200, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_854FD14:: @ 854FD14 - .4byte gSpriteAffineAnim_854FD04 - - .align 2 -gSpriteTemplate_854FD18:: @ 854FD18 - spr_template 0x1201, 0x1200, gOamData_854FCB4, gSpriteAnimTable_854FCEC, NULL, gSpriteAffineAnimTable_854FD14, sub_80ADC4C - - .align 2 -gUnknown_0854FD30:: @ 854FD30 - obj_tiles gWeatherFog1Tiles, 0x0800, 0x1201 - - .align 2 -gUnknown_0854FD38:: @ 854FD38 - obj_tiles gWeatherAshTiles, 0x1000, 0x1202 - - .align 2 -gOamData_854FD40:: @ 854FD40 - .2byte 0x0400, 0xc000, 0xf400, 0x0000 - - .align 2 -gSpriteAnim_854FD48:: @ 854FD48 - .2byte 0x0000, 0x003c, 0x0040, 0x003c, 0xfffe, 0x0000 - - .align 2 -gSpriteAnimTable_854FD54:: @ 854FD54 - .4byte gSpriteAnim_854FD48 - - .align 2 -gSpriteTemplate_854FD58:: @ 854FD58 - spr_template 0x1202, 0x1200, gOamData_854FD40, gSpriteAnimTable_854FD54, NULL, gDummySpriteAffineAnimTable, sub_80AE068 - - .align 2 -gUnknown_0854FD70:: @ 854FD70 - obj_tiles gWeatherFog2Tiles, 0x0800, 0x1203 - - .align 2 -gOamData_854FD78:: @ 854FD78 - .2byte 0x0400, 0xc000, 0x0800, 0x0000 - - .align 2 -gSpriteAnim_854FD80:: @ 854FD80 - .2byte 0x0000, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FD88:: @ 854FD88 - .4byte gSpriteAnim_854FD80 - - .align 2 -gSpriteTemplate_854FD8C:: @ 854FD8C - spr_template 0x1203, 0x1200, gOamData_854FD78, gSpriteAnimTable_854FD88, NULL, gDummySpriteAffineAnimTable, sub_80AE3FC - - .align 2 -gOamData_854FDA4:: @ 854FDA4 - .2byte 0x0400, 0xc000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_854FDAC:: @ 854FDAC - .2byte 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_854FDB4:: @ 854FDB4 - .2byte 0x0040, 0x0003, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FDBC:: @ 854FDBC - .4byte gSpriteAnim_854FDAC - .4byte gSpriteAnim_854FDB4 - - .align 2 -gSpriteTemplate_854FDC4:: @ 854FDC4 - spr_template 0x1204, 0x1201, gOamData_854FDA4, gSpriteAnimTable_854FDBC, NULL, gDummySpriteAffineAnimTable, sub_80AE8F8 - - .align 2 -gUnknown_0854FDDC:: @ 854FDDC - obj_tiles gWeatherSandstormTiles, 0x0a00, 0x1204 - - .align 1 -gUnknown_0854FDE4:: @ 854FDE4 - .2byte 0x0000, 0x0078, 0x0050, 0x00a0, 0x0028, 0x0000 - -gUnknown_0854FDF0:: @ 854FDF0 - .byte 0x28, 0x5a, 0x3c, 0x5a, 0x02, 0x3c, 0x28, 0x1e - - .align 2 -gUnknown_0854FDF8:: @ 854FDF8 - obj_tiles gWeatherBubbleTiles, 0x0040, 0x1205 - - .align 1 -gUnknown_0854FE00:: @ 854FE00 - .2byte 0x0078, 0x00a0, 0x0178, 0x00a0, 0x0028, 0x008c, 0x0128, 0x008c, 0x00b4, 0x0082, 0x01b4, 0x0082, 0x003c, 0x00a0, 0x01b4, 0x00a0 - .2byte 0x00dc, 0x00b4, 0x01dc, 0x00b4, 0x000a, 0x005a, 0x010a, 0x005a, 0x0100, 0x00a0 - - .align 2 -gSpriteAnim_854FE34:: @ 854FE34 - .2byte 0x0000, 0x0010, 0x0001, 0x0010, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_854FE40:: @ 854FE40 - .4byte gSpriteAnim_854FE34 - - .align 2 -gSpriteTemplate_854FE44:: @ 854FE44 - spr_template 0x1205, 0x1200, gUnknown_08524904, gSpriteAnimTable_854FE40, NULL, gDummySpriteAffineAnimTable, sub_80AEC34 - -gUnknown_0854FE5C:: @ 854FE5C - .byte 0x02, 0x03, 0x05, 0x03 - -gUnknown_0854FE60:: @ 854FE60 - .byte 0x02, 0x02, 0x03, 0x02 - - .align 1 -gUnknown_0854FE64:: @ 854FE64 - .2byte 0x00c8, 0x0048, 0x0040, 0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0000, 0x0000 - - .align 2 -gMaxFlashLevel:: @ 854FE78 - .4byte 0x00000008 - - .align 2 -gUnknown_0854FE7C:: @ 854FE7C - .4byte 0x04000040, 0xa2600001, 0x00000001 - diff --git a/data/field_screen_2.s b/data/field_screen_2.s new file mode 100644 index 000000000..105018014 --- /dev/null +++ b/data/field_screen_2.s @@ -0,0 +1,17 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + + .align 1 +gUnknown_0854FE64:: @ 854FE64 + .2byte 0x00c8, 0x0048, 0x0040, 0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0000, 0x0000 + + .align 2 +gMaxFlashLevel:: @ 854FE78 + .4byte 0x00000008 + + .align 2 +gUnknown_0854FE7C:: @ 854FE7C + .4byte 0x04000040, 0xa2600001, 0x00000001 + diff --git a/data/field_weather.s b/data/field_weather.s new file mode 100644 index 000000000..2121ecf23 --- /dev/null +++ b/data/field_weather.s @@ -0,0 +1,103 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + + .align 2 +gUnknown_0854014C:: @ 854014C + .incbin "graphics/misc/sunny_day/0.gbapal" + .incbin "graphics/misc/sunny_day/1.gbapal" + .incbin "graphics/misc/sunny_day/2.gbapal" + .incbin "graphics/misc/sunny_day/3.gbapal" + .incbin "graphics/misc/sunny_day/4.gbapal" + .incbin "graphics/misc/sunny_day/5.gbapal" + .incbin "graphics/misc/sunny_day/6.gbapal" + .incbin "graphics/misc/sunny_day/7.gbapal" + .incbin "graphics/misc/sunny_day/8.gbapal" + .incbin "graphics/misc/sunny_day/9.gbapal" + .incbin "graphics/misc/sunny_day/10.gbapal" + .incbin "graphics/misc/sunny_day/11.gbapal" + .incbin "graphics/misc/sunny_day/12.gbapal" + .incbin "graphics/misc/sunny_day/13.gbapal" + .incbin "graphics/misc/sunny_day/14.gbapal" + .incbin "graphics/misc/sunny_day/15.gbapal" + .incbin "graphics/misc/sunny_day/16.gbapal" + .incbin "graphics/misc/sunny_day/17.gbapal" + .incbin "graphics/misc/sunny_day/18.gbapal" + .incbin "graphics/misc/sunny_day/19.gbapal" + .incbin "graphics/misc/sunny_day/20.gbapal" + .incbin "graphics/misc/sunny_day/21.gbapal" + .incbin "graphics/misc/sunny_day/22.gbapal" + .incbin "graphics/misc/sunny_day/23.gbapal" + .incbin "graphics/misc/sunny_day/24.gbapal" + .incbin "graphics/misc/sunny_day/25.gbapal" + .incbin "graphics/misc/sunny_day/26.gbapal" + .incbin "graphics/misc/sunny_day/27.gbapal" + .incbin "graphics/misc/sunny_day/28.gbapal" + .incbin "graphics/misc/sunny_day/29.gbapal" + .incbin "graphics/misc/sunny_day/30.gbapal" + .incbin "graphics/misc/sunny_day/31.gbapal" + .incbin "graphics/misc/sunny_day/32.gbapal" + .incbin "graphics/misc/sunny_day/33.gbapal" + .incbin "graphics/misc/sunny_day/34.gbapal" + .incbin "graphics/misc/sunny_day/35.gbapal" + .incbin "graphics/misc/sunny_day/36.gbapal" + .incbin "graphics/misc/sunny_day/37.gbapal" + .incbin "graphics/misc/sunny_day/38.gbapal" + .incbin "graphics/misc/sunny_day/39.gbapal" + .incbin "graphics/misc/sunny_day/40.gbapal" + .incbin "graphics/misc/sunny_day/41.gbapal" + .incbin "graphics/misc/sunny_day/42.gbapal" + .incbin "graphics/misc/sunny_day/43.gbapal" + .incbin "graphics/misc/sunny_day/44.gbapal" + .incbin "graphics/misc/sunny_day/45.gbapal" + .incbin "graphics/misc/sunny_day/46.gbapal" + .incbin "graphics/misc/sunny_day/47.gbapal" + .incbin "graphics/misc/sunny_day/48.gbapal" + .incbin "graphics/misc/sunny_day/49.gbapal" + .incbin "graphics/misc/sunny_day/50.gbapal" + .incbin "graphics/misc/sunny_day/51.gbapal" + .incbin "graphics/misc/sunny_day/52.gbapal" + .incbin "graphics/misc/sunny_day/53.gbapal" + .incbin "graphics/misc/sunny_day/54.gbapal" + .incbin "graphics/misc/sunny_day/55.gbapal" + .incbin "graphics/misc/sunny_day/56.gbapal" + .incbin "graphics/misc/sunny_day/57.gbapal" + .incbin "graphics/misc/sunny_day/58.gbapal" + .incbin "graphics/misc/sunny_day/59.gbapal" + .incbin "graphics/misc/sunny_day/60.gbapal" + .incbin "graphics/misc/sunny_day/61.gbapal" + .incbin "graphics/misc/sunny_day/62.gbapal" + .incbin "graphics/misc/sunny_day/63.gbapal" + .incbin "graphics/misc/sunny_day/64.gbapal" + .incbin "graphics/misc/sunny_day/65.gbapal" + .incbin "graphics/misc/sunny_day/66.gbapal" + .incbin "graphics/misc/sunny_day/67.gbapal" + .incbin "graphics/misc/sunny_day/68.gbapal" + .incbin "graphics/misc/sunny_day/69.gbapal" + .incbin "graphics/misc/sunny_day/70.gbapal" + .incbin "graphics/misc/sunny_day/71.gbapal" + .incbin "graphics/misc/sunny_day/72.gbapal" + .incbin "graphics/misc/sunny_day/73.gbapal" + .incbin "graphics/misc/sunny_day/74.gbapal" + .incbin "graphics/misc/sunny_day/75.gbapal" + .incbin "graphics/misc/sunny_day/76.gbapal" + .incbin "graphics/misc/sunny_day/77.gbapal" + .incbin "graphics/misc/sunny_day/78.gbapal" + .incbin "graphics/misc/sunny_day/79.gbapal" + .incbin "graphics/misc/sunny_day/80.gbapal" + .incbin "graphics/misc/sunny_day/81.gbapal" + .incbin "graphics/misc/sunny_day/82.gbapal" + .incbin "graphics/misc/sunny_day/83.gbapal" + .incbin "graphics/misc/sunny_day/84.gbapal" + .incbin "graphics/misc/sunny_day/85.gbapal" + .incbin "graphics/misc/sunny_day/86.gbapal" + .incbin "graphics/misc/sunny_day/87.gbapal" + .incbin "graphics/misc/sunny_day/88.gbapal" + .incbin "graphics/misc/sunny_day/89.gbapal" + .incbin "graphics/misc/sunny_day/90.gbapal" + .incbin "graphics/misc/sunny_day/91.gbapal" + .incbin "graphics/misc/sunny_day/92.gbapal" + .incbin "graphics/misc/sunny_day/93.gbapal" + .incbin "graphics/misc/sunny_day/94.gbapal" + .incbin "graphics/misc/sunny_day/95.gbapal" diff --git a/include/field_weather.h b/include/field_weather.h index a48361b8a..d4bc85afd 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -4,7 +4,8 @@ #include "sprite.h" // Controls how the weather should be changing the screen palettes. -enum { +enum +{ WEATHER_PAL_STATE_CHANGING_WEATHER, WEATHER_PAL_STATE_SCREEN_FADING_IN, WEATHER_PAL_STATE_SCREEN_FADING_OUT, @@ -38,11 +39,11 @@ struct Weather u8 gammaStepDelay; u8 gammaStepFrameCounter; u16 fadeDestColor; - u8 palProcessingState; - u8 fadeScreenCounter; - bool8 readyForInit; - u8 taskId; - u8 unknown_6CA; + /*0x6C6*/ u8 palProcessingState; + /*0x6C7*/ u8 fadeScreenCounter; + /*0x6C8*/ bool8 readyForInit; + /*0x6C9*/ u8 taskId; + /*0x6CA*/ u8 unknown_6CA; u8 unknown_6CB; u16 initStep; u16 finishStep; @@ -168,6 +169,7 @@ void ResetDroughtWeatherPaletteLoading(void); bool8 LoadDroughtWeatherPalettes(void); u8 GetCurrentWeather(void); void LoadCustomWeatherSpritePalette(const u16 *palette); +void SetWeatherScreenFadeOut(void); extern struct Weather gWeather; diff --git a/include/global.h b/include/global.h index cc8df049f..83eb93eec 100644 --- a/include/global.h +++ b/include/global.h @@ -881,7 +881,7 @@ struct SaveBlock1 /*0x24*/ struct WarpData warp4; /*0x2C*/ u16 savedMusic; /*0x2E*/ u8 weather; - /*0x2F*/ u8 filler_2F; + /*0x2F*/ u8 weatherCycleStage; /*0x30*/ u8 flashLevel; /*0x32*/ u16 mapLayoutId; /*0x34*/ u16 mapView[0x100]; diff --git a/ld_script.txt b/ld_script.txt index ddafe6ecf..7fe0e5f47 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -113,6 +113,8 @@ SECTIONS { src/reshow_battle_screen.o(.text); src/battle_anim_80A9C70.o(.text); src/title_screen.o(.text); + src/field_weather.o(.text); + src/field_weather_effect.o(.text); asm/field_screen.o(.text); src/battle_setup.o(.text); src/cable_club.o(.text); @@ -444,7 +446,11 @@ SECTIONS { data/battle_anim_80A9C70.o(.rodata); src/battle_anim_80A9C70.o(.rodata); src/title_screen.o(.rodata); + data/field_weather.o(.rodata); + src/field_weather.o(.rodata); data/field_screen.o(.rodata); + src/field_weather_effect.o(.rodata); + data/field_screen_2.o(.rodata); src/battle_setup.o(.rodata); src/cable_club.o(.rodata); src/trainer_see.o(.rodata); diff --git a/src/battle_transition.c b/src/battle_transition.c index 94b9e78f9..aa8877148 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -59,7 +59,7 @@ typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); extern const struct OamData gEventObjectBaseOam_32x32; -extern void sub_80AC3D0(void); +extern void SetWeatherScreenFadeOut(void); // this file's functions static void LaunchBattleTransitionTask(u8 transitionId); @@ -981,7 +981,7 @@ static void Task_BattleTransitionMain(u8 taskId) static bool8 Transition_Phase1(struct Task *task) { - sub_80AC3D0(); + SetWeatherScreenFadeOut(); CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); if (sPhase1_Tasks[task->tTransitionId] != NULL) { diff --git a/src/battle_util.c b/src/battle_util.c index 4c9ef75d9..94aaea66c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -23,7 +23,7 @@ #include "link.h" #include "berry.h" -extern u8 weather_get_current(void); +extern u8 GetCurrentWeather(void); // rom const data static const u16 sSoundMovesTable[] = @@ -1827,7 +1827,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITYEFFECT_SWITCH_IN_WEATHER: if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) { - switch (weather_get_current()) + switch (GetCurrentWeather()) { case 3: case 5: @@ -1862,7 +1862,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } if (effect) { - gBattleCommunication[MULTISTRING_CHOOSER] = weather_get_current(); + gBattleCommunication[MULTISTRING_CHOOSER] = GetCurrentWeather(); BattleScriptPushCursorAndCallback(BattleScript_OverworldWeatherStarts); } break; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 4b7ee9a61..28386528a 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -60,7 +60,7 @@ extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NickHatchPrompt[]; -extern void play_some_sound(void); +extern void PlayRainSoundEffect(void); extern u16 sub_80D22D0(void); extern u8 CountPartyAliveNonEggMonsExcept(u8); @@ -581,7 +581,7 @@ static void Task_EggHatchPlayBGM(u8 taskID) if (gTasks[taskID].data[0] == 0) { StopMapMusic(); - play_some_sound(); + PlayRainSoundEffect(); } if (gTasks[taskID].data[0] == 1) PlayBGM(MUS_ME_SHINKA); diff --git a/src/field_screen.c b/src/field_screen.c deleted file mode 100644 index 2d33d237f..000000000 --- a/src/field_screen.c +++ /dev/null @@ -1,15 +0,0 @@ - -// Includes -#include "global.h" - -// Static type declarations - -// Static RAM declarations -IWRAM_DATA u8 *gUnknown_03000F50; -IWRAM_DATA u32 filler_03000f54; - -// Static ROM declarations - -// .rodata - -// .text diff --git a/src/field_weather.c b/src/field_weather.c new file mode 100644 index 000000000..0be584d51 --- /dev/null +++ b/src/field_weather.c @@ -0,0 +1,1152 @@ +#include "global.h" +#include "constants/songs.h" +#include "constants/weather.h" +#include "constants/rgb.h" +#include "util.h" +#include "event_object_movement.h" +#include "field_weather.h" +#include "main.h" +#include "menu.h" +#include "palette.h" +#include "random.h" +#include "script.h" +#include "start_menu.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "gpu_regs.h" + +#define MACRO1(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00)) + +enum +{ + GAMMA_NONE, + GAMMA_NORMAL, + GAMMA_ALT, +}; + +struct RGBColor +{ + u16 r:5; + u16 g:5; + u16 b:5; +}; + +struct WeatherPaletteData +{ + u16 gammaShiftColors[8][0x1000]; // 0x1000 is the number of bytes that make up all palettes. +}; + +struct WeatherCallbacks +{ + void (*initVars)(void); + void (*main)(void); + void (*initAll)(void); + bool8 (*finish)(void); +}; + +// This file's functions. +/*static*/ bool8 LightenSpritePaletteInFog(u8); +/*static*/ void BuildGammaShiftTables(void); +/*static*/ void UpdateWeatherGammaShift(void); +/*static*/ void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex); +/*static*/ void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaIndex, u8 blendCoeff, u16 blendColor); +/*static*/ void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 blendColor); +/*static*/ void ApplyFogBlend(u8 blendCoeff, u16 blendColor); +/*static*/ bool8 FadeInScreen_RainShowShade(void); +/*static*/ bool8 FadeInScreen_Drought(void); +/*static*/ bool8 FadeInScreen_Fog1(void); +/*static*/ void FadeInScreenWithWeather(void); +/*static*/ void DoNothing(void); +void None_Init(void); +void None_Main(void); +bool8 None_Finish(void); +void Clouds_InitVars(void); +void Clouds_Main(void); +void Clouds_InitAll(void); +bool8 Clouds_Finish(void); +void Weather2_InitVars(void); +void Weather2_Main(void); +void Weather2_InitAll(void); +bool8 Weather2_Finish(void); +void LightRain_InitVars(void); +void LightRain_Main(void); +void LightRain_InitAll(void); +bool8 LightRain_Finish(void); +void Snow_InitVars(void); +void Snow_Main(void); +void Snow_InitAll(void); +bool8 Snow_Finish(void); +void MedRain_InitVars(void); +void Rain_Main(void); +void MedRain_InitAll(void); +bool8 Rain_Finish(void); +void Fog1_InitVars(void); +void Fog1_Main(void); +void Fog1_InitAll(void); +bool8 Fog1_Finish(void); +void Ash_InitVars(void); +void Ash_Main(void); +void Ash_InitAll(void); +bool8 Ash_Finish(void); +void Sandstorm_InitVars(void); +void Sandstorm_Main(void); +void Sandstorm_InitAll(void); +bool8 Sandstorm_Finish(void); +void Fog2_InitVars(void); +void Fog2_Main(void); +void Fog2_InitAll(void); +bool8 Fog2_Finish(void); +void Fog1_InitVars(void); +void Fog1_Main(void); +void Fog1_InitAll(void); +bool8 Fog1_Finish(void); +void Shade_InitVars(void); +void Shade_Main(void); +void Shade_InitAll(void); +bool8 Shade_Finish(void); +void Drought_InitVars(void); +void Drought_Main(void); +void Drought_InitAll(void); +bool8 Drought_Finish(void); +void HeavyRain_InitVars(void); +void Rain_Main(void); +void HeavyRain_InitAll(void); +bool8 Rain_Finish(void); +void Bubbles_InitVars(void); +void Bubbles_Main(void); +void Bubbles_InitAll(void); +bool8 Bubbles_Finish(void); + +// Const rom data + +// This is a pointer to gWeather. All code in this file accesses gWeather directly, +// while code in other field weather files accesses gWeather through this pointer. +// This is likely the result of compiler optimization, since using the pointer in +// this file produces the same result as accessing gWeather directly. +struct Weather *const gWeatherPtr = &gWeather; + +/*static*/ const struct WeatherCallbacks sWeatherFuncs[] = +{ + {None_Init, None_Main, None_Init, None_Finish}, + {Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish}, + {Weather2_InitVars, Weather2_Main, Weather2_InitAll, Weather2_Finish}, + {LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish}, + {Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish}, + {MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish}, + {Fog1_InitVars, Fog1_Main, Fog1_InitAll, Fog1_Finish}, + {Ash_InitVars, Ash_Main, Ash_InitAll, Ash_Finish}, + {Sandstorm_InitVars, Sandstorm_Main, Sandstorm_InitAll, Sandstorm_Finish}, + {Fog2_InitVars, Fog2_Main, Fog2_InitAll, Fog2_Finish}, + {Fog1_InitVars, Fog1_Main, Fog1_InitAll, Fog1_Finish}, + {Shade_InitVars, Shade_Main, Shade_InitAll, Shade_Finish}, + {Drought_InitVars, Drought_Main, Drought_InitAll, Drought_Finish}, + {HeavyRain_InitVars, Rain_Main, HeavyRain_InitAll, Rain_Finish}, + {Bubbles_InitVars, Bubbles_Main, Bubbles_InitAll, Bubbles_Finish}, +}; + +void (*const gWeatherPalStateFuncs[])(void) = +{ + UpdateWeatherGammaShift, // WEATHER_PAL_STATE_CHANGING_WEATHER + FadeInScreenWithWeather, // WEATHER_PAL_STATE_SCREEN_FADING_IN + DoNothing, // WEATHER_PAL_STATE_SCREEN_FADING_OUT + DoNothing, // WEATHER_PAL_STATE_IDLE +}; + +// This table specifies which of the gamma shift tables should be +// applied to each of the background and sprite palettes. +/*static*/ const u8 sBasePaletteGammaTypes[32] = +{ + // background palettes + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NONE, + GAMMA_NONE, + // sprite palettes + GAMMA_ALT, + GAMMA_NORMAL, + GAMMA_ALT, + GAMMA_ALT, + GAMMA_ALT, + GAMMA_ALT, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_ALT, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, + GAMMA_NORMAL, +}; + + +// EWRAM +EWRAM_DATA struct Weather gWeather = {0}; +EWRAM_DATA u8 gFieldEffectPaletteGammaTypes[32] = {0}; + +// IWRAM bss +IWRAM_DATA const u8 *sPaletteGammaTypes; +IWRAM_DATA u32 filler_03000f54; + +// const +extern const u16 gUnknown_083970E8[]; +extern const u16 gUnknown_0854014C[][4096]; + +// code +void StartWeather(void) +{ + if (!FuncIsActiveTask(Task_WeatherMain)) + { + u8 index = AllocSpritePalette(0x1200); + CpuCopy32(gUnknown_083970E8, &gPlttBufferUnfaded[0x100 + index * 16], 32); + BuildGammaShiftTables(); + gWeather.altGammaSpritePalIndex = index; + gWeather.weatherPicSpritePalIndex = AllocSpritePalette(0x1201); + gWeather.rainSpriteCount = 0; + gWeather.unknown_6D8 = 0; + gWeather.cloudSpritesCreated = 0; + gWeather.snowflakeSpriteCount = 0; + gWeather.ashSpritesCreated = 0; + gWeather.fog1SpritesCreated = 0; + gWeather.fog2SpritesCreated = 0; + gWeather.sandstormSprites1Created = 0; + gWeather.sandstormSprites2Created = 0; + gWeather.unknown_72E = 0; + gWeather.lightenedFogSpritePalsCount = 0; + Weather_SetBlendCoeffs(16, 0); + gWeather.currWeather = 0; + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + gWeather.readyForInit = FALSE; + gWeather.weatherChangeComplete = TRUE; + gWeather.taskId = CreateTask(Task_WeatherInit, 80); + } +} + +void ChangeWeather(u8 weather) +{ + if (weather != WEATHER_RAIN_LIGHT && weather != WEATHER_RAIN_MED && weather != WEATHER_RAIN_HEAVY) + { + PlayRainSoundEffect(); + } + + if (gWeather.nextWeather != weather && gWeather.currWeather == weather) + { + sWeatherFuncs[weather].initVars(); + } + + gWeather.weatherChangeComplete = FALSE; + gWeather.nextWeather = weather; + gWeather.finishStep = 0; +} + +void sub_80AB104(u8 weather) +{ + PlayRainSoundEffect(); + gWeather.currWeather = weather; + gWeather.nextWeather = weather; +} + +void sub_80AB130(u8 weather) +{ + PlayRainSoundEffect(); + gWeather.currWeather = weather; + gWeather.nextWeather = weather; + gWeather.readyForInit = TRUE; +} + +void Task_WeatherInit(u8 taskId) +{ + // Waits until it's ok to initialize weather. + // When the screen fades in, this is set to TRUE. + if (gWeather.readyForInit) + { + sWeatherFuncs[gWeather.currWeather].initAll(); + gTasks[taskId].func = Task_WeatherMain; + } +} + +void Task_WeatherMain(u8 taskId) +{ + if (gWeather.currWeather != gWeather.nextWeather) + { + if (!sWeatherFuncs[gWeather.currWeather].finish() && gWeather.palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) + { + // Finished cleaning up previous weather. Now transition to next weather. + sWeatherFuncs[gWeather.nextWeather].initVars(); + gWeather.gammaStepFrameCounter = 0; + gWeather.palProcessingState = WEATHER_PAL_STATE_CHANGING_WEATHER; + gWeather.currWeather = gWeather.nextWeather; + gWeather.weatherChangeComplete = TRUE; + } + } + else + { + sWeatherFuncs[gWeather.currWeather].main(); + } + + gWeatherPalStateFuncs[gWeather.palProcessingState](); +} + +void None_Init(void) +{ + gWeather.gammaTargetIndex = 0; + gWeather.gammaStepDelay = 0; +} + +void None_Main(void) +{ +} + +u8 None_Finish(void) +{ + return 0; +} + +// Builds two tables that contain gamma shifts for palette colors. +// It's unclear why the two tables aren't declared as const arrays, since +// this function always builds the same two tables. +/*static*/ void BuildGammaShiftTables(void) +{ + u16 v0; + u8 (*v1)[32]; + u16 v2; + u16 v4; + u16 v5; + u16 v6; + u16 v9; + u32 v10; + u16 v11; + s16 dunno; + + sPaletteGammaTypes = sBasePaletteGammaTypes; + for (v0 = 0; v0 <= 1; v0++) + { + if (v0 == 0) + v1 = gWeather.gammaShifts; + else + v1 = gWeather.altGammaShifts; + + for (v2 = 0; v2 < 32; v2++) + { + v4 = v2 << 8; + if (v0 == 0) + v5 = (v2 << 8) / 16; + else + v5 = 0; + for (v6 = 0; v6 <= 2; v6++) + { + v4 = (v4 - v5); + v1[v6][v2] = v4 >> 8; + } + v9 = v4; + v10 = 0x1f00 - v4; + if ((0x1f00 - v4) < 0) + { + v10 += 0xf; + } + v11 = v10 >> 4; + if (v2 < 12) + { + for (; v6 < 19; v6++) + { + v4 += v11; + dunno = v4 - v9; + if (dunno > 0) + v4 -= (dunno + ((u16)dunno >> 15)) >> 1; + v1[v6][v2] = v4 >> 8; + if (v1[v6][v2] > 0x1f) + v1[v6][v2] = 0x1f; + } + } + else + { + for (; v6 < 19; v6++) + { + v4 += v11; + v1[v6][v2] = v4 >> 8; + if (v1[v6][v2] > 0x1f) + v1[v6][v2] = 0x1f; + } + } + } + } +} + +// When the weather is changing, it gradually updates the palettes +// towards the desired gamma shift. +/*static*/ void UpdateWeatherGammaShift(void) +{ + if (gWeather.palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) + { + if (gWeather.gammaIndex == gWeather.gammaTargetIndex) + { + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + } + else + { + if (++gWeather.gammaStepFrameCounter >= gWeather.gammaStepDelay) + { + gWeather.gammaStepFrameCounter = 0; + if (gWeather.gammaIndex < gWeather.gammaTargetIndex) + gWeather.gammaIndex++; + else + gWeather.gammaIndex--; + + ApplyGammaShift(0, 32, gWeather.gammaIndex); + } + } + } +} + +/*static*/ void FadeInScreenWithWeather(void) +{ + if (++gWeather.unknown_6CB > 1) + gWeather.unknown_6CA = 0; + + switch (gWeather.currWeather) + { + case WEATHER_RAIN_LIGHT: + case WEATHER_RAIN_MED: + case WEATHER_RAIN_HEAVY: + case WEATHER_SNOW: + case WEATHER_SHADE: + if (FadeInScreen_RainShowShade() == FALSE) + { + gWeather.gammaIndex = 3; + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + } + break; + case WEATHER_DROUGHT: + if (FadeInScreen_Drought() == FALSE) + { + gWeather.gammaIndex = -6; + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + } + break; + case WEATHER_FOG_1: + if (FadeInScreen_Fog1() == FALSE) + { + gWeather.gammaIndex = 0; + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + } + break; + case WEATHER_ASH: + case WEATHER_SANDSTORM: + case WEATHER_FOG_2: + case WEATHER_FOG_3: + default: + if (!gPaletteFade.active) + { + gWeather.gammaIndex = gWeather.gammaTargetIndex; + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; + } + break; + } +} + +bool8 FadeInScreen_RainShowShade(void) +{ + if (gWeather.fadeScreenCounter == 16) + return FALSE; + + if (++gWeather.fadeScreenCounter >= 16) + { + ApplyGammaShift(0, 32, 3); + gWeather.fadeScreenCounter = 16; + return FALSE; + } + + ApplyGammaShiftWithBlend(0, 32, 3, 16 - gWeather.fadeScreenCounter, gWeather.fadeDestColor); + return TRUE; +} + +bool8 FadeInScreen_Drought(void) +{ + if (gWeather.fadeScreenCounter == 16) + return FALSE; + + if (++gWeather.fadeScreenCounter >= 16) + { + ApplyGammaShift(0, 32, -6); + gWeather.fadeScreenCounter = 16; + return FALSE; + } + + ApplyDroughtGammaShiftWithBlend(-6, 16 - gWeather.fadeScreenCounter, gWeather.fadeDestColor); + return TRUE; +} + +bool8 FadeInScreen_Fog1(void) +{ + if (gWeather.fadeScreenCounter == 16) + return FALSE; + + gWeather.fadeScreenCounter++; + ApplyFogBlend(16 - gWeather.fadeScreenCounter, gWeather.fadeDestColor); + return TRUE; +} + +/*static*/ void DoNothing(void) +{ } + +/*static*/ void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex) +{ + u16 curPalIndex; + u16 palOffset; + u8 *gammaTable; + u16 i; + + if (gammaIndex > 0) + { + gammaIndex--; + palOffset = startPalIndex * 16; + numPalettes += startPalIndex; + curPalIndex = startPalIndex; + + // Loop through the speficied palette range and apply necessary gamma shifts to the colors. + while (curPalIndex < numPalettes) + { + if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE) + { + // No palette change. + CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16)); + palOffset += 16; + } + else + { + u8 r, g, b; + + if (sPaletteGammaTypes[curPalIndex] == GAMMA_ALT || curPalIndex - 16 == gWeather.altGammaSpritePalIndex) + gammaTable = gWeather.altGammaShifts[gammaIndex]; + else + gammaTable = gWeather.gammaShifts[gammaIndex]; + + for (i = 0; i < 16; i++) + { + // Apply gamma shift to the original color. + struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + r = gammaTable[baseColor.r]; + g = gammaTable[baseColor.g]; + b = gammaTable[baseColor.b]; + gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r; + } + } + + curPalIndex++; + } + } + else if (gammaIndex < 0) + { + // A negative gammIndex value means that the blending will come from the special Drought weather's palette tables. + gammaIndex = -gammaIndex - 1; + palOffset = startPalIndex * 16; + numPalettes += startPalIndex; + curPalIndex = startPalIndex; + + while (curPalIndex < numPalettes) + { + if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE) + { + // No palette change. + CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16)); + palOffset += 16; + } + else + { + for (i = 0; i < 16; i++) + { + gPlttBufferFaded[palOffset] = gUnknown_0854014C[gammaIndex][MACRO1(gPlttBufferUnfaded[palOffset])]; + palOffset++; + } + } + + curPalIndex++; + } + } + else + { + // No palette blending. + CpuFastCopy(gPlttBufferUnfaded + startPalIndex * 16, gPlttBufferFaded + startPalIndex * 16, numPalettes * 16 * sizeof(u16)); + } +} + +/*static*/ void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaIndex, u8 blendCoeff, u16 blendColor) +{ + u16 palOffset; + u16 curPalIndex; + u16 i; + struct RGBColor color = *(struct RGBColor *)&blendColor; + u8 rBlend = color.r; + u8 gBlend = color.g; + u8 bBlend = color.b; + + palOffset = startPalIndex * 16; + numPalettes += startPalIndex; + gammaIndex--; + curPalIndex = startPalIndex; + + while (curPalIndex < numPalettes) + { + if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE) + { + // No gamma shift. Simply blend the colors. + BlendPalette(palOffset, 16, blendCoeff, blendColor); + palOffset += 16; + } + else + { + u8 *gammaTable; + + if (sPaletteGammaTypes[curPalIndex] == GAMMA_NORMAL) + gammaTable = gWeather.gammaShifts[gammaIndex]; + else + gammaTable = gWeather.altGammaShifts[gammaIndex]; + + for (i = 0; i < 16; i++) + { + struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + u8 r = gammaTable[baseColor.r]; + u8 g = gammaTable[baseColor.g]; + u8 b = gammaTable[baseColor.b]; + + // Apply gamma shift and target blend color to the original color. + r += ((rBlend - r) * blendCoeff) >> 4; + g += ((gBlend - g) * blendCoeff) >> 4; + b += ((bBlend - b) * blendCoeff) >> 4; + gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r; + } + } + + curPalIndex++; + } +} + +void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 blendColor) +{ + struct RGBColor color; + u8 rBlend; + u8 gBlend; + u8 bBlend; + u16 curPalIndex; + u16 palOffset; + u16 i; + + gammaIndex = -gammaIndex - 1; + color = *(struct RGBColor *)&blendColor; + rBlend = color.r; + gBlend = color.g; + bBlend = color.b; + palOffset = 0; + for (curPalIndex = 0; curPalIndex < 32; curPalIndex++) + { + if (sPaletteGammaTypes[curPalIndex] == GAMMA_NONE) + { + // No gamma shift. Simply blend the colors. + BlendPalette(palOffset, 16, blendCoeff, blendColor); + palOffset += 16; + } + else + { + for (i = 0; i < 16; i++) + { + u32 offset; + struct RGBColor color1; + struct RGBColor color2; + u8 r1, g1, b1; + u8 r2, g2, b2; + + color1 = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + r1 = color1.r; + g1 = color1.g; + b1 = color1.b; + + offset = ((b1 & 0x1E) << 7) | ((g1 & 0x1E) << 3) | ((r1 & 0x1E) >> 1); + color2 = *(struct RGBColor *)&gUnknown_0854014C[gammaIndex][offset]; + r2 = color2.r; + g2 = color2.g; + b2 = color2.b; + + r2 += ((rBlend - r2) * blendCoeff) >> 4; + g2 += ((gBlend - g2) * blendCoeff) >> 4; + b2 += ((bBlend - b2) * blendCoeff) >> 4; + + gPlttBufferFaded[palOffset++] = (b2 << 10) | (g2 << 5) | r2; + } + } + } +} + +void ApplyFogBlend(u8 blendCoeff, u16 blendColor) +{ + struct RGBColor color; + u8 rBlend; + u8 gBlend; + u8 bBlend; + u16 curPalIndex; + + BlendPalette(0, 256, blendCoeff, blendColor); + color = *(struct RGBColor *)&blendColor; + rBlend = color.r; + gBlend = color.g; + bBlend = color.b; + + for (curPalIndex = 16; curPalIndex < 32; curPalIndex++) + { + if (LightenSpritePaletteInFog(curPalIndex)) + { + u16 palEnd = (curPalIndex + 1) * 16; + u16 palOffset = curPalIndex * 16; + + while (palOffset < palEnd) + { + struct RGBColor color = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + u8 r = color.r; + u8 g = color.g; + u8 b = color.b; + + r += ((28 - r) * 3) >> 2; + g += ((31 - g) * 3) >> 2; + b += ((28 - b) * 3) >> 2; + + r += ((rBlend - r) * blendCoeff) >> 4; + g += ((gBlend - g) * blendCoeff) >> 4; + b += ((bBlend - b) * blendCoeff) >> 4; + + gPlttBufferFaded[palOffset] = (b << 10) | (g << 5) | r; + palOffset++; + } + } + else + { + BlendPalette(curPalIndex * 16, 16, blendCoeff, blendColor); + } + } +} + +/*static*/ void MarkFogSpritePalToLighten(u8 paletteIndex) +{ + if (gWeather.lightenedFogSpritePalsCount < 6) + { + gWeather.lightenedFogSpritePals[gWeather.lightenedFogSpritePalsCount] = paletteIndex; + gWeather.lightenedFogSpritePalsCount++; + } +} + +/*static*/ bool8 LightenSpritePaletteInFog(u8 paletteIndex) +{ + u16 i; + + for (i = 0; i < gWeather.lightenedFogSpritePalsCount; i++) + { + if (gWeather.lightenedFogSpritePals[i] == paletteIndex) + return TRUE; + } + + return FALSE; +} + +void sub_80ABC48(s8 gammaIndex) +{ + if (gWeather.palProcessingState == WEATHER_PAL_STATE_IDLE) + { + ApplyGammaShift(0, 32, gammaIndex); + gWeather.gammaIndex = gammaIndex; + } +} + +void sub_80ABC7C(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay) +{ + if (gWeather.palProcessingState == WEATHER_PAL_STATE_IDLE) + { + gWeather.palProcessingState = WEATHER_PAL_STATE_CHANGING_WEATHER; + gWeather.gammaIndex = gammaIndex; + gWeather.gammaTargetIndex = gammaTargetIndex; + gWeather.gammaStepFrameCounter = 0; + gWeather.gammaStepDelay = gammaStepDelay; + sub_80ABC48(gammaIndex); + } +} + +void FadeScreen(u8 mode, s8 delay) +{ + u32 fadeColor; + bool8 fadeOut; + bool8 useWeatherPal; + + switch (mode) + { + case FADE_FROM_BLACK: + fadeColor = 0; + fadeOut = FALSE; + break; + case FADE_FROM_WHITE: + fadeColor = 0xFFFF; + fadeOut = FALSE; + break; + case FADE_TO_BLACK: + fadeColor = 0; + fadeOut = TRUE; + break; + case FADE_TO_WHITE: + fadeColor = 0xFFFF; + fadeOut = TRUE; + break; + default: + return; + } + + switch (gWeather.currWeather) + { + case WEATHER_RAIN_LIGHT: + case WEATHER_RAIN_MED: + case WEATHER_RAIN_HEAVY: + case WEATHER_SNOW: + case WEATHER_FOG_1: + case WEATHER_SHADE: + case WEATHER_DROUGHT: + useWeatherPal = TRUE; + break; + default: + useWeatherPal = FALSE; + break; + } + + if (fadeOut) + { + if (useWeatherPal) + CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); + + BeginNormalPaletteFade(0xFFFFFFFF, delay, 0, 16, fadeColor); + gWeather.palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT; + } + else + { + gWeather.fadeDestColor = fadeColor; + if (useWeatherPal) + gWeather.fadeScreenCounter = 0; + else + BeginNormalPaletteFade(0xFFFFFFFF, delay, 16, 0, fadeColor); + + gWeather.palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; + gWeather.unknown_6CA = 1; + gWeather.unknown_6CB = 0; + Weather_SetBlendCoeffs(gWeather.currBlendEVA, gWeather.currBlendEVB); + gWeather.readyForInit = TRUE; + } +} + +bool8 IsWeatherNotFadingIn(void) +{ + return (gWeather.palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_IN); +} + +void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex) +{ + u16 paletteIndex = 16 + spritePaletteIndex; + u16 i; + + switch (gWeather.palProcessingState) + { + case WEATHER_PAL_STATE_SCREEN_FADING_IN: + if (gWeather.unknown_6CA != 0) + { + if (gWeather.currWeather == WEATHER_FOG_1) + MarkFogSpritePalToLighten(paletteIndex); + paletteIndex *= 16; + for (i = 0; i < 16; i++) + gPlttBufferFaded[paletteIndex + i] = gWeather.fadeDestColor; + } + break; + case WEATHER_PAL_STATE_SCREEN_FADING_OUT: + paletteIndex *= 16; + CpuFastCopy(gPlttBufferFaded + paletteIndex, gPlttBufferUnfaded + paletteIndex, 32); + BlendPalette(paletteIndex, 16, gPaletteFade.y, gPaletteFade.blendColor); + break; + // WEATHER_PAL_STATE_CHANGING_WEATHER + // WEATHER_PAL_STATE_CHANGING_IDLE + default: + if (gWeather.currWeather != WEATHER_FOG_1) + { + ApplyGammaShift(paletteIndex, 1, gWeather.gammaIndex); + } + else + { + paletteIndex *= 16; + BlendPalette(paletteIndex, 16, 12, RGB(28, 31, 28)); + } + break; + } +} + +void ApplyWeatherGammaShiftToPal(u8 paletteIndex) +{ + ApplyGammaShift(paletteIndex, 1, gWeather.gammaIndex); +} + +u8 sub_80ABF20(void) +{ + if (gWeather.palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN) + return gWeather.unknown_6CA; + else + return 0; +} + +void LoadCustomWeatherSpritePalette(const u16 *palette) +{ + LoadPalette(palette, 0x100 + gWeather.weatherPicSpritePalIndex * 16, 32); + UpdateSpritePaletteWithWeather(gWeather.weatherPicSpritePalIndex); +} + +void LoadDroughtWeatherPalette(u8 *gammaIndexPtr, u8 *a1) +{ + *gammaIndexPtr = 0x20; + *a1 = 0x20; +} + +void ResetDroughtWeatherPaletteLoading(void) +{ + gWeather.loadDroughtPalsIndex = 1; + gWeather.loadDroughtPalsOffset = 1; +} + +bool8 LoadDroughtWeatherPalettes(void) +{ + if (gWeather.loadDroughtPalsIndex < 32) + { + LoadDroughtWeatherPalette(&gWeather.loadDroughtPalsIndex, &gWeather.loadDroughtPalsOffset); + if (gWeather.loadDroughtPalsIndex < 32) + return TRUE; + } + return FALSE; +} + +void sub_80ABFE0(s8 gammaIndex) +{ + sub_80ABC48(-gammaIndex - 1); +} + +void sub_80ABFF0(void) +{ + gWeather.unknown_73C = 0; + gWeather.unknown_740 = 0; + gWeather.unknown_742 = 0; + gWeather.unknown_73E = 0; +} + +void sub_80AC01C(void) +{ + switch (gWeather.unknown_742) + { + case 0: + if (++gWeather.unknown_740 > 5) + { + gWeather.unknown_740 = 0; + sub_80ABFE0(gWeather.unknown_73C++); + if (gWeather.unknown_73C > 5) + { + gWeather.unknown_73E = gWeather.unknown_73C; + gWeather.unknown_742 = 1; + gWeather.unknown_740 = 0x3C; + } + } + break; + case 1: + gWeather.unknown_740 = (gWeather.unknown_740 + 3) & 0x7F; + gWeather.unknown_73C = ((gSineTable[gWeather.unknown_740] - 1) >> 6) + 2; + if (gWeather.unknown_73C != gWeather.unknown_73E) + sub_80ABFE0(gWeather.unknown_73C); + gWeather.unknown_73E = gWeather.unknown_73C; + break; + case 2: + if (++gWeather.unknown_740 > 5) + { + gWeather.unknown_740 = 0; + sub_80ABFE0(--gWeather.unknown_73C); + if (gWeather.unknown_73C == 3) + gWeather.unknown_742 = 0; + } + break; + } +} + +void Weather_SetBlendCoeffs(u8 eva, u8 evb) +{ + gWeather.currBlendEVA = eva; + gWeather.currBlendEVB = evb; + gWeather.targetBlendEVA = eva; + gWeather.targetBlendEVB = evb; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(eva, evb)); +} + +void Weather_SetTargetBlendCoeffs(u8 eva, u8 evb, int delay) +{ + gWeather.targetBlendEVA = eva; + gWeather.targetBlendEVB = evb; + gWeather.blendDelay = delay; + gWeather.blendFrameCounter = 0; + gWeather.blendUpdateCounter = 0; +} + +bool8 Weather_UpdateBlend(void) +{ + if (gWeather.currBlendEVA == gWeather.targetBlendEVA + && gWeather.currBlendEVB == gWeather.targetBlendEVB) + return TRUE; + + if (++gWeather.blendFrameCounter > gWeather.blendDelay) + { + gWeather.blendFrameCounter = 0; + gWeather.blendUpdateCounter++; + + // Update currBlendEVA and currBlendEVB on alternate frames + if (gWeather.blendUpdateCounter & 1) + { + if (gWeather.currBlendEVA < gWeather.targetBlendEVA) + gWeather.currBlendEVA++; + else if (gWeather.currBlendEVA > gWeather.targetBlendEVA) + gWeather.currBlendEVA--; + } + else + { + if (gWeather.currBlendEVB < gWeather.targetBlendEVB) + gWeather.currBlendEVB++; + else if (gWeather.currBlendEVB > gWeather.targetBlendEVB) + gWeather.currBlendEVB--; + } + } + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gWeather.currBlendEVA, gWeather.currBlendEVB)); + + if (gWeather.currBlendEVA == gWeather.targetBlendEVA + && gWeather.currBlendEVB == gWeather.targetBlendEVB) + return TRUE; + + return FALSE; +} + +void sub_80AC274(u8 a) +{ + switch (a) + { + case 1: + SetWeather(WEATHER_CLOUDS); + break; + case 2: + SetWeather(WEATHER_SUNNY); + break; + case 3: + SetWeather(WEATHER_RAIN_LIGHT); + break; + case 4: + SetWeather(WEATHER_SNOW); + break; + case 5: + SetWeather(WEATHER_RAIN_MED); + break; + case 6: + SetWeather(WEATHER_FOG_1); + break; + case 7: + SetWeather(WEATHER_FOG_2); + break; + case 8: + SetWeather(WEATHER_ASH); + break; + case 9: + SetWeather(WEATHER_SANDSTORM); + break; + case 10: + SetWeather(WEATHER_SHADE); + break; + } +} + +u8 GetCurrentWeather(void) +{ + return gWeather.currWeather; +} + +void SetRainStrengthFromSoundEffect(u16 soundEffect) +{ + if (gWeather.palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) + { + switch (soundEffect) + { + case SE_T_KOAME: + gWeather.rainStrength = 0; + break; + case SE_T_OOAME: + gWeather.rainStrength = 1; + break; + case SE_T_AME: + gWeather.rainStrength = 2; + break; + default: + return; + } + + PlaySE(soundEffect); + } +} + +void PlayRainSoundEffect(void) +{ + if (IsSpecialSEPlaying()) + { + switch (gWeather.rainStrength) + { + case 0: + PlaySE(SE_T_KOAME_E); + break; + case 1: + PlaySE(SE_T_OOAME_E); + break; + case 2: + default: + PlaySE(SE_T_AME_E); + break; + } + } +} + +u8 IsWeatherChangeComplete(void) +{ + return gWeather.weatherChangeComplete; +} + +void SetWeatherScreenFadeOut(void) +{ + gWeather.palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT; +} + +void sub_80AC3E4(void) +{ + gWeather.palProcessingState = WEATHER_PAL_STATE_IDLE; +} + +void PreservePaletteInWeather(u8 preservedPalIndex) +{ + CpuCopy16(sBasePaletteGammaTypes, gFieldEffectPaletteGammaTypes, 32); + gFieldEffectPaletteGammaTypes[preservedPalIndex] = GAMMA_NONE; + sPaletteGammaTypes = gFieldEffectPaletteGammaTypes; +} + +void ResetPreservedPalettesInWeather(void) +{ + sPaletteGammaTypes = sBasePaletteGammaTypes; +} diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c new file mode 100644 index 000000000..ad3e80cfa --- /dev/null +++ b/src/field_weather_effect.c @@ -0,0 +1,2484 @@ +#include "global.h" +#include "event_object_movement.h" +#include "field_weather.h" +#include "overworld.h" +#include "random.h" +#include "script.h" +#include "constants/weather.h" +#include "constants/songs.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "gpu_regs.h" + +const u16 gUnknown_083970E8[] = INCBIN_U16("graphics/weather/0.gbapal"); +const u16 gUnknown_0854C290[] = INCBIN_U16("graphics/weather/1.gbapal"); +const u16 gUnknown_0854C2B0[] = INCBIN_U16("graphics/weather/2.gbapal"); +const u8 gWeatherFog2Tiles[] = INCBIN_U8("graphics/weather/fog2.4bpp"); +const u8 gWeatherFog1Tiles[] = INCBIN_U8("graphics/weather/fog1.4bpp"); +const u8 gWeatherCloudTiles[] = INCBIN_U8("graphics/weather/cloud.4bpp"); +const u8 gWeatherSnow1Tiles[] = INCBIN_U8("graphics/weather/snow0.4bpp"); +const u8 gWeatherSnow2Tiles[] = INCBIN_U8("graphics/weather/snow1.4bpp"); +const u8 gWeatherBubbleTiles[] = INCBIN_U8("graphics/weather/bubble.4bpp"); +const u8 gWeatherAshTiles[] = INCBIN_U8("graphics/weather/ash.4bpp"); +const u8 gWeatherRainTiles[] = INCBIN_U8("graphics/weather/rain.4bpp"); +const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp"); + +/*static*/ const struct Coords16 gUnknown_0854FB50[] = +{ + { 0, 66}, + { 5, 73}, + {10, 78}, +}; + +/*static*/ const struct SpriteSheet sCloudSpriteSheet = {gWeatherCloudTiles, sizeof(gWeatherCloudTiles), 0x1200}; + +/*static*/ const struct OamData gOamData_839A9DC = +{ + .y = 0, + .affineMode = 0, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 3, + .paletteNum = 0, + .affineParam = 0, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839A9E4[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd *const gSpriteAnimTable_839A9EC[] = +{ + gSpriteAnim_839A9E4, +}; + +void sub_80AC6B4(struct Sprite *); +/*static*/ const struct SpriteTemplate sCloudSpriteTemplate = +{ + .tileTag = 4608, + .paletteTag = 4609, + .oam = &gOamData_839A9DC, + .anims = gSpriteAnimTable_839A9EC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80AC6B4, +}; + +extern void sub_80ABC48(s8 gammaIndex); +extern void sub_80ABFF0(void); +extern void sub_80AC01C(void); +extern void Weather_SetTargetBlendCoeffs(u8 a, u8 b, int c); +extern bool8 Weather_UpdateBlend(void); +extern void SetRainStrengthFromSoundEffect(u16 sndEff); +extern void sub_80ABC7C(u8 a, u8 b, u8 c); +extern void sub_80AB104(u8); + +//------------------------------------------------------------------------------ +// Clouds +//------------------------------------------------------------------------------ + +void Clouds_InitVars(void) +{ + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->initStep = 0; + if (gWeatherPtr->cloudSpritesCreated == FALSE) + Weather_SetBlendCoeffs(0, 16); +} + +void Clouds_Main(void); + +void Clouds_InitAll(void) +{ + Clouds_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Clouds_Main(); +} + +void CreateCloudSprites(void); + +void Clouds_Main(void) +{ + switch (gWeatherPtr->initStep) + { + case 0: + CreateCloudSprites(); + gWeatherPtr->initStep++; + break; + case 1: + Weather_SetTargetBlendCoeffs(12, 8, 1); + gWeatherPtr->initStep++; + break; + case 2: + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + } +} + +void sub_807E0A0(void); + +bool8 Clouds_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + Weather_SetTargetBlendCoeffs(0, 16, 1); + gWeatherPtr->finishStep++; + return TRUE; + case 1: + if (Weather_UpdateBlend()) + { + sub_807E0A0(); + gWeatherPtr->finishStep++; + } + return TRUE; + } + return FALSE; +} + +//------------------------------------------------------------------------------ +// Weather 2 +//------------------------------------------------------------------------------ + +void Weather2_InitVars(void) +{ + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; +} + +void Weather2_InitAll(void) +{ + Weather2_InitVars(); +} + +void Weather2_Main(void) +{ +} + +int Weather2_Finish(void) +{ + return 0; +} + +void CreateCloudSprites(void) +{ + u16 i; + + if (gWeatherPtr->cloudSpritesCreated == TRUE) + return; + LoadSpriteSheet(&sCloudSpriteSheet); + LoadCustomWeatherSpritePalette(gUnknown_0854C290); + for (i = 0; i < 3; i++) + { + u8 spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); + + if (spriteId != 64) + { + struct Sprite *sprite; + + gWeatherPtr->sprites.s1.cloudSprites[i] = &gSprites[spriteId]; + sprite = gWeatherPtr->sprites.s1.cloudSprites[i]; + sub_8093038(gUnknown_0854FB50[i].x + 7, gUnknown_0854FB50[i].y + 7, &sprite->pos1.x, &sprite->pos1.y); + sprite->coordOffsetEnabled = TRUE; + } + else + { + gWeatherPtr->sprites.s1.cloudSprites[i] = NULL; + } + } + gWeatherPtr->cloudSpritesCreated = TRUE; +} + +void sub_807E0A0(void) +{ + u16 i; + + if (gWeatherPtr->cloudSpritesCreated == FALSE) + return; + for (i = 0; i < 3; i++) + { + if (gWeatherPtr->sprites.s1.cloudSprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s1.cloudSprites[i]); + } + FreeSpriteTilesByTag(0x1200); + gWeatherPtr->cloudSpritesCreated = FALSE; +} + +void sub_80AC6B4(struct Sprite *sprite) +{ + sprite->data[0] = (sprite->data[0] + 1) & 1; + if (sprite->data[0] != 0) + sprite->pos1.x--; +} + +//------------------------------------------------------------------------------ +// Drought +//------------------------------------------------------------------------------ + +void Drought_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 0; +} + +void Drought_Main(void); + +void Drought_InitAll(void) +{ + Drought_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Drought_Main(); +} + +void Drought_Main(void) +{ + switch (gWeatherPtr->initStep) + { + case 0: + if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_CHANGING_WEATHER) + gWeatherPtr->initStep++; + break; + case 1: + ResetDroughtWeatherPaletteLoading(); + gWeatherPtr->initStep++; + break; + case 2: + if (LoadDroughtWeatherPalettes() == FALSE) + gWeatherPtr->initStep++; + break; + case 3: + sub_80ABFF0(); + gWeatherPtr->initStep++; + break; + case 4: + sub_80AC01C(); + if (gWeatherPtr->unknown_73C == 6) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + default: + sub_80AC01C(); + break; + } +} + +int Drought_Finish(void) +{ + return 0; +} + +void task50_0807B6D4(u8); + +void sub_80AC81C(void) +{ + CreateTask(task50_0807B6D4, 0x50); +} + +#define tState data[0] +#define tBlendY data[1] +#define tBlendDelay data[2] +#define tWinRange data[3] + +void task50_0807B6D4(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->tState) + { + case 0: + task->tBlendY = 0; + task->tBlendDelay = 0; + task->tWinRange = REG_WININ; + SetGpuReg(REG_OFFSET_WININ, WIN_RANGE(63, 63)); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_EFFECT_LIGHTEN); + SetGpuReg(REG_OFFSET_BLDY, 0); + task->tState++; + // fall through + case 1: + task->tBlendY += 3; + if (task->tBlendY > 16) + task->tBlendY = 16; + SetGpuReg(REG_OFFSET_BLDY, task->tBlendY); + if (task->tBlendY >= 16) + task->tState++; + break; + case 2: + task->tBlendDelay++; + if (task->tBlendDelay > 9) + { + task->tBlendDelay = 0; + task->tBlendY--; + if (task->tBlendY <= 0) + { + task->tBlendY = 0; + task->tState++; + } + SetGpuReg(REG_OFFSET_BLDY, task->tBlendY); + } + break; + case 3: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_WININ, task->tWinRange); + task->tState++; + break; + case 4: + EnableBothScriptContexts(); + DestroyTask(taskId); + break; + } +} + +#undef tState +#undef tBlendY +#undef tBlendDelay +#undef tWinRange + +//------------------------------------------------------------------------------ +// Light Rain +//------------------------------------------------------------------------------ + +void LightRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->unknown_6D6 = 0; + gWeatherPtr->unknown_6DB = 8; + gWeatherPtr->unknown_6DC = 0; + gWeatherPtr->unknown_6D9 = 10; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + SetRainStrengthFromSoundEffect(SE_T_KOAME); +} + +void LightRain_Main(void); + +void LightRain_InitAll(void) +{ + LightRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + LightRain_Main(); +} + +void LoadRainSpriteSheet(void); +u8 CreateRainSprite(void); +u8 sub_807E8E8(void); + +void LightRain_Main(void) +{ + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (CreateRainSprite() == 0) + gWeatherPtr->initStep++; + break; + case 2: + if (sub_807E8E8() == FALSE) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + } +} + +void DestroyRainSprites(void); + +bool8 LightRain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + { + gWeatherPtr->finishStep = 0xFF; + return FALSE; + } + else + { + gWeatherPtr->unknown_6D9 = 0; + gWeatherPtr->finishStep++; + } + // fall through + case 1: + if (sub_807E8E8() == FALSE) + { + DestroyRainSprites(); + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +// defined below +extern const s16 gUnknown_0839AABC[][2]; +extern const u16 gUnknown_0839AAC4[][2]; + +void sub_807E4EC(struct Sprite *sprite) +{ + u32 randVal; + u16 r6; + s32 r4; + s32 r0; + + if (sprite->data[1] == 0) + sprite->data[1] = 361; + randVal = sprite->data[1] * 1103515245 + 12345; + sprite->data[1] = ((randVal & 0x7FFF0000) >> 16) % 600; + + r6 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; + + r4 = sprite->data[1] % 30; + sprite->data[2] = r4 * 8; // useless assignment + + r0 = sprite->data[1] / 30; + sprite->data[3] = r0 * 8; // useless assignment + + sprite->data[2] = r4; + sprite->data[2] <<= 7; + + sprite->data[3] = r0; + sprite->data[3] <<= 7; + + sprite->data[2] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0] * r6; + sprite->data[3] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1] * r6; + + StartSpriteAnim(sprite, 0); + sprite->data[4] = 0; + sprite->coordOffsetEnabled = FALSE; + sprite->data[0] = r6; +} + +void sub_807E5C0(struct Sprite *sprite) +{ + if (sprite->data[4] == 0) + { + sprite->data[2] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0]; + sprite->data[3] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1]; + sprite->pos1.x = sprite->data[2] >> 4; + sprite->pos1.y = sprite->data[3] >> 4; + + if (sprite->data[5] != 0 + && (sprite->pos1.x >= -8 && sprite->pos1.x <= 248) + && sprite->pos1.y >= -16 && sprite->pos1.y <= 176) + sprite->invisible = FALSE; + else + sprite->invisible = TRUE; + + sprite->data[0]--; + if (sprite->data[0] == 0) + { + StartSpriteAnim(sprite, gWeatherPtr->unknown_6DC + 1); + sprite->data[4] = 1; + sprite->pos1.x -= gSpriteCoordOffsetX; + sprite->pos1.y -= gSpriteCoordOffsetY; + sprite->coordOffsetEnabled = TRUE; + } + } + else if (sprite->animEnded) + { + sprite->invisible = TRUE; + sub_807E4EC(sprite); + } +} + +void sub_807E6C4(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + sub_807E4EC(sprite); + sprite->callback = sub_807E5C0; + } + else + { + sprite->data[0]--; + } +} + +void sub_807E6F0(struct Sprite *sprite, u16 b) +{ + u16 r8 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; + u16 r6 = b / (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); + u16 r4 = b % (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); + + while (--r6 != 0xFFFF) + sub_807E4EC(sprite); + if (r4 < r8) + { + while (--r4 != 0xFFFF) + sub_807E5C0(sprite); + sprite->data[6] = 0; + } + else + { + sprite->data[0] = r4 - r8; + sprite->invisible = TRUE; + sprite->data[6] = 1; + } +} + +extern const struct SpriteSheet sRainSpriteSheet; // defined below + +void LoadRainSpriteSheet(void) +{ + LoadSpriteSheet(&sRainSpriteSheet); +} + +/*static*/ const struct Coords16 sRainSpriteCoords[] = +{ + { 0, 0}, + { 0, 160}, + { 0, 64}, + {144, 224}, + {144, 128}, + { 32, 32}, + { 32, 192}, + { 32, 96}, + { 72, 128}, + { 72, 32}, + { 72, 192}, + {216, 96}, + {216, 0}, + {104, 160}, + {104, 64}, + {104, 224}, + {144, 0}, + {144, 160}, + {144, 64}, + { 32, 224}, + { 32, 128}, + { 72, 32}, + { 72, 192}, + { 48, 96}, +}; + +/*static*/ const struct OamData gOamData_839AA68 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 2, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 2, + .affineParam = 0, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AA70[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_JUMP(0), +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AA78[] = +{ + ANIMCMD_FRAME(8, 3), + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(40, 2), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AA88[] = +{ + ANIMCMD_FRAME(8, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(24, 4), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd *const gSpriteAnimTable_839AA98[] = +{ + gSpriteAnim_839AA70, + gSpriteAnim_839AA78, + gSpriteAnim_839AA88, +}; + +/*static*/ const struct SpriteTemplate sRainSpriteTemplate = +{ + .tileTag = 4614, + .paletteTag = 4608, + .oam = &gOamData_839AA68, + .anims = gSpriteAnimTable_839AA98, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_807E5C0, +}; + + +const s16 gUnknown_0839AABC[][2] = +{ + {-104, 208}, + {-160, 320}, +}; + +const u16 gUnknown_0839AAC4[][2] = +{ + {18, 7}, + {12, 10}, +}; + +/*static*/ const struct SpriteSheet sRainSpriteSheet = {gWeatherRainTiles, sizeof(gWeatherRainTiles), 0x1206}; + +/*static*/ const struct OamData gOamData_839AAD4 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +/*static*/ const struct SpriteFrameImage gSpriteImageTable_839AADC[] = +{ + {gWeatherSnow1Tiles, sizeof(gWeatherSnow1Tiles)}, + {gWeatherSnow2Tiles, sizeof(gWeatherSnow2Tiles)}, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AAEC[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AAF4[] = +{ + ANIMCMD_FRAME(1, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd *const gSpriteAnimTable_839AAFC[] = +{ + gSpriteAnim_839AAEC, + gSpriteAnim_839AAF4, +}; + +void sub_807ED48(struct Sprite *); +/*static*/ const struct SpriteTemplate sSnowflakeSpriteTemplate = +{ + .tileTag = 0xFFFF, + .paletteTag = 4608, + .oam = &gOamData_839AAD4, + .anims = gSpriteAnimTable_839AAFC, + .images = gSpriteImageTable_839AADC, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_807ED48, +}; + +// unused data +/*static*/ const u16 unusedData_839AB1C[] = {0, 6, 6, 12, 18, 42, 300, 300}; + +/*static*/ const struct OamData gOamData_839AB2C = +{ + .y = 0, + .affineMode = 0, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB34[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB3C[] = +{ + ANIMCMD_FRAME(32, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB44[] = +{ + ANIMCMD_FRAME(64, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB4C[] = +{ + ANIMCMD_FRAME(96, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB54[] = +{ + ANIMCMD_FRAME(128, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd gSpriteAnim_839AB5C[] = +{ + ANIMCMD_FRAME(160, 16), + ANIMCMD_END, +}; + +/*static*/ const union AnimCmd *const gSpriteAnimTable_839AB64[] = +{ + gSpriteAnim_839AB34, + gSpriteAnim_839AB3C, + gSpriteAnim_839AB44, + gSpriteAnim_839AB4C, + gSpriteAnim_839AB54, + gSpriteAnim_839AB5C, +}; + +/*static*/ const union AffineAnimCmd gSpriteAffineAnim_839AB7C[] = +{ + AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), + AFFINEANIMCMD_END, +}; + +/*static*/ const union AffineAnimCmd *const gSpriteAffineAnimTable_839AB8C[] = +{ + gSpriteAffineAnim_839AB7C, +}; + +/*static*/ void Fog1SpriteCallback(struct Sprite *); +/*static*/ const struct SpriteTemplate sFog1SpriteTemplate = +{ + .tileTag = 4609, + .paletteTag = 4608, + .oam = &gOamData_839AB2C, + .anims = gSpriteAnimTable_839AB64, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_839AB8C, + .callback = Fog1SpriteCallback, +}; + +bool8 CreateRainSprite(void) +{ + u8 spriteNum; + u8 spriteId; + + if (gWeatherPtr->rainSpriteCount == 24) + return FALSE; + + spriteNum = gWeatherPtr->rainSpriteCount; + spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, + sRainSpriteCoords[spriteNum].x, sRainSpriteCoords[spriteNum].y, 78); + if (spriteId != 64) + { + gSprites[spriteId].data[5] = 0; + gSprites[spriteId].data[1] = spriteNum * 145; + while (gSprites[spriteId].data[1] >= 600) + gSprites[spriteId].data[1] -= 600; + sub_807E4EC(&gSprites[spriteId]); + sub_807E6F0(&gSprites[spriteId], spriteNum * 9); + gSprites[spriteId].invisible = TRUE; + gWeatherPtr->sprites.s1.rainSprites[spriteNum] = &gSprites[spriteId]; + } + else + { + gWeatherPtr->sprites.s1.rainSprites[spriteNum] = NULL; + } + + if (++gWeatherPtr->rainSpriteCount == 24) + { + u16 i; + + for (i = 0; i < 24; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) + { + if (gWeatherPtr->sprites.s1.rainSprites[i]->data[6] == 0) + gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E5C0; + else + gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E6C4; + } + } + return FALSE; + } + return TRUE; +} + +bool8 sub_807E8E8(void) +{ + if (gWeatherPtr->unknown_6D8 == gWeatherPtr->unknown_6D9) + return FALSE; + + if (++gWeatherPtr->unknown_6D6 > gWeatherPtr->unknown_6DB) + { + gWeatherPtr->unknown_6D6 = 0; + if (gWeatherPtr->unknown_6D8 < gWeatherPtr->unknown_6D9) + { + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8++]->data[5] = 1; + } + else + { + gWeatherPtr->unknown_6D8--; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->data[5] = 0; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->invisible = TRUE; + } + } + return TRUE; +} + +void DestroyRainSprites(void) +{ + u16 i; + + for (i = 0; i < gWeatherPtr->rainSpriteCount; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s1.rainSprites[i]); + } + gWeatherPtr->rainSpriteCount = 0; + FreeSpriteTilesByTag(0x1206); +} + +//------------------------------------------------------------------------------ +// Snow +//------------------------------------------------------------------------------ + +void Snow_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->unknown_6E5 = 16; + gWeatherPtr->unknown_6E0 = 0; +} + +void Snow_Main(void); +void sub_807ED48(struct Sprite *); + +void Snow_InitAll(void) +{ + Snow_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + { + u16 i; + + Snow_Main(); + for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) + { + sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); + } + } +} + +u8 snowflakes_progress(void); + +void Snow_Main(void) +{ + if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } +} + +bool8 Snow_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6E5 = 0; + gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + if (snowflakes_progress() == FALSE) + { + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +bool8 CreateSnowflakeSprite(void); +bool8 RemoveSnowflakeSprite(void); + +bool8 snowflakes_progress(void) +{ + if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) + return FALSE; + + gWeatherPtr->unknown_6E0++; + if (gWeatherPtr->unknown_6E0 > 36) + { + gWeatherPtr->unknown_6E0 = 0; + if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) + CreateSnowflakeSprite(); + else + RemoveSnowflakeSprite(); + } + return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); +} + +void sub_807EC40(struct Sprite *); + +bool8 CreateSnowflakeSprite(void) +{ + u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); + + if (spriteId == 64) + return FALSE; + gSprites[spriteId].data[4] = gWeatherPtr->snowflakeSpriteCount; + sub_807EC40(&gSprites[spriteId]); + gSprites[spriteId].coordOffsetEnabled = TRUE; + gWeatherPtr->sprites.s1.snowflakeSprites[gWeatherPtr->snowflakeSpriteCount++] = &gSprites[spriteId]; + return TRUE; +} + +bool8 RemoveSnowflakeSprite(void) +{ + if (gWeatherPtr->snowflakeSpriteCount != 0) + { + DestroySprite(gWeatherPtr->sprites.s1.snowflakeSprites[--gWeatherPtr->snowflakeSpriteCount]); + return TRUE; + } + return FALSE; +} + +void sub_807EC40(struct Sprite *sprite) +{ + u16 r4 = ((sprite->data[4] * 5) & 7) * 30 + (Random() % 30); + u16 r6; + + sprite->pos1.y = -3 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->pos1.x = r4 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + sprite->data[0] = sprite->pos1.y * 128; + sprite->pos2.x = 0; + r6 = Random(); + sprite->data[1] = (r6 & 3) * 5 + 64; + sprite->data[7] = (r6 & 3) * 5 + 64; + StartSpriteAnim(sprite, (r6 & 1) ? 0 : 1); + sprite->data[3] = 0; + sprite->data[2] = ((r6 & 3) == 0) ? 2 : 1; + sprite->data[6] = (r6 & 0x1F) + 210; + sprite->data[5] = 0; +} + +void sub_807ECEC(struct Sprite *sprite) +{ + if (gWeatherPtr->unknown_6E2 > 18) + { + sprite->invisible = FALSE; + sprite->callback = sub_807ED48; + sprite->pos1.y = 0xFA - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->data[0] = sprite->pos1.y * 128; + gWeatherPtr->unknown_6E2 = 0; + } +} + +void sub_807ED48(struct Sprite *sprite) +{ + s16 r3; + s16 r2; + + sprite->data[0] += sprite->data[1]; + sprite->pos1.y = sprite->data[0] >> 7; + sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF; + sprite->pos2.x = gSineTable[sprite->data[3]] / 64; + + r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; + if (r3 & 0x100) + r3 = -0x100 | r3; // hmm... what is this? + if (r3 < -3) + sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + else if (r3 > 242) + sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + + r2 = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; + if (r2 > 163 && r2 < 171) + { + sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->data[0] = sprite->pos1.y * 128; + sprite->data[5] = 0; + sprite->data[6] = 220; + } + else if (r2 > 242 && r2 < 250) + { + sprite->pos1.y = 163; + sprite->data[0] = sprite->pos1.y * 128; + sprite->data[5] = 0; + sprite->data[6] = 220; + sprite->invisible = TRUE; + sprite->callback = sub_807ECEC; + } + + sprite->data[5]++; + if (sprite->data[5] == sprite->data[6]) + { + sub_807EC40(sprite); + sprite->pos1.y = 250; + sprite->invisible = TRUE; + sprite->callback = sub_807ECEC; + } +} + +//------------------------------------------------------------------------------ +// Medium Rain +//------------------------------------------------------------------------------ + +void MedRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->unknown_6D6 = 0; + gWeatherPtr->unknown_6DB = 4; + gWeatherPtr->unknown_6DC = 0; + gWeatherPtr->unknown_6D9 = 16; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + gWeatherPtr->unknown_6ED = 0; + SetRainStrengthFromSoundEffect(SE_T_AME); +} + +void Rain_Main(void); + +void MedRain_InitAll(void) +{ + MedRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +//------------------------------------------------------------------------------ +// Heavy Rain +//------------------------------------------------------------------------------ + +void HeavyRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->unknown_6D6 = 0; + gWeatherPtr->unknown_6DB = 4; + gWeatherPtr->unknown_6DC = 1; + gWeatherPtr->unknown_6D9 = 24; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + SetRainStrengthFromSoundEffect(SE_T_OOAME); +} + +void HeavyRain_InitAll(void) +{ + HeavyRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +void UpdateThunderSound(void); +void SetThunderCounter(u16); + +void Rain_Main(void) +{ + UpdateThunderSound(); + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (CreateRainSprite()) + break; + gWeatherPtr->initStep++; + break; + case 2: + if (sub_807E8E8()) + break; + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + break; + case 3: + if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_CHANGING_WEATHER) + break; + gWeatherPtr->initStep = 6; + break; + case 4: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6E6 = (Random() % 360) + 360; + gWeatherPtr->initStep++; + // fall through + case 5: + if (--gWeatherPtr->unknown_6E6 != 0) + break; + gWeatherPtr->initStep++; + break; + case 6: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6EB = Random() % 2; + gWeatherPtr->initStep++; + break; + case 7: + gWeatherPtr->unknown_6EC = (Random() & 1) + 1; + gWeatherPtr->initStep++; + // fall through + case 8: + sub_80ABC48(19); + if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1) + SetThunderCounter(20); + gWeatherPtr->unknown_6E6 = (Random() % 3) + 6; + gWeatherPtr->initStep++; + break; + case 9: + if (--gWeatherPtr->unknown_6E6 != 0) + break; + sub_80ABC48(3); + gWeatherPtr->unknown_6EA = 1; + if (--gWeatherPtr->unknown_6EC != 0) + { + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep = 10; + } + else if (gWeatherPtr->unknown_6EB == 0) + { + gWeatherPtr->initStep = 4; + } + else + { + gWeatherPtr->initStep = 11; + } + break; + case 10: + if (--gWeatherPtr->unknown_6E6 != 0) + break; + gWeatherPtr->initStep = 8; + break; + case 11: + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep++; + break; + case 12: + if (--gWeatherPtr->unknown_6E6 != 0) + break; + SetThunderCounter(100); + sub_80ABC48(19); + // Why use "% 16" everywhere else and "& 0xF" here. So dumb. + gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30; + gWeatherPtr->initStep++; + break; + case 13: + if (--gWeatherPtr->unknown_6E6 != 0) + break; + sub_80ABC7C(19, 3, 5); + gWeatherPtr->initStep++; + break; + case 14: + if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_IDLE) + break; + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->initStep = 4; + break; + } +} + +bool8 Rain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6EA = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + Rain_Main(); + if (gWeatherPtr->unknown_6EA != 0) + { + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + return FALSE; + gWeatherPtr->unknown_6D9 = 0; + gWeatherPtr->finishStep++; + } + break; + case 2: + if (sub_807E8E8()) + break; + DestroyRainSprites(); + gWeatherPtr->unknown_6ED = 0; + gWeatherPtr->finishStep++; + return FALSE; + default: + return FALSE; + } + return TRUE; +} + +void SetThunderCounter(u16 max) +{ + if (gWeatherPtr->unknown_6ED == 0) + { + gWeatherPtr->thunderCounter = Random() % max; + gWeatherPtr->unknown_6ED = 1; + } +} + +void UpdateThunderSound(void) +{ + if (gWeatherPtr->unknown_6ED == 1) + { + if (gWeatherPtr->thunderCounter == 0) + { + if (IsSEPlaying()) + return; + if (Random() & 1) + PlaySE(SE_T_KAMI); + else + PlaySE(SE_T_KAMI2); + gWeatherPtr->unknown_6ED = 0; + } + else + { + gWeatherPtr->thunderCounter--; + } + } +} + +//------------------------------------------------------------------------------ +// Fog 1 +//------------------------------------------------------------------------------ + +void Fog1_Main(void); +/*static*/ void CreateFog1Sprites(void); +/*static*/ void DestroyFog1Sprites(void); + +void Fog1_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; + if (gWeatherPtr->fog1SpritesCreated == 0) + { + gWeatherPtr->unknown_6F0 = 0; + gWeatherPtr->unknown_6F2 = 0; + gWeatherPtr->fog1ScrollPosX = 0; + Weather_SetBlendCoeffs(0, 16); + } +} + +void Fog1_InitAll(void) +{ + Fog1_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Fog1_Main(); +} + +void Fog1_Main(void) +{ + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; + if (++gWeatherPtr->unknown_6F0 > 3) + { + gWeatherPtr->unknown_6F0 = 0; + gWeatherPtr->unknown_6F2++; + } + switch (gWeatherPtr->initStep) + { + case 0: + CreateFog1Sprites(); + if (gWeatherPtr->currWeather == WEATHER_FOG_1) + Weather_SetTargetBlendCoeffs(12, 8, 3); + else + Weather_SetTargetBlendCoeffs(4, 16, 0); + gWeatherPtr->initStep++; + break; + case 1: + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + } +} + +bool8 Fog1_Finish(void) +{ + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; + if (++gWeatherPtr->unknown_6F0 > 3) + { + gWeatherPtr->unknown_6F0 = 0; + gWeatherPtr->unknown_6F2++; + } + switch (gWeatherPtr->finishStep) + { + case 0: + Weather_SetTargetBlendCoeffs(0, 16, 3); + gWeatherPtr->finishStep++; + break; + case 1: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->finishStep++; + break; + case 2: + DestroyFog1Sprites(); + gWeatherPtr->finishStep++; + break; + default: + return FALSE; + } + return TRUE; +} + +#define sprColumn data[0] + +/*static*/ void Fog1SpriteCallback(struct Sprite *sprite) +{ + sprite->pos2.y = (u8)gSpriteCoordOffsetY; + sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->sprColumn * 64; + if (sprite->pos1.x > 0x10F) + { + sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->sprColumn) * 64; + sprite->pos1.x &= 0x1FF; + } +} + +/*static*/ void CreateFog1Sprites(void) +{ + u16 i; + + if (!gWeatherPtr->fog1SpritesCreated) + { + struct SpriteSheet fog1SpriteSheet = {gWeatherFog1Tiles, sizeof(gWeatherFog1Tiles), 0x1201}; + + LoadSpriteSheet(&fog1SpriteSheet); + for (i = 0; i < 20; i++) + { + u8 spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); + + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + + sprite->sprColumn = i % 5; + sprite->pos1.x = (i % 5) * 64 + 32; + sprite->pos1.y = (i / 5) * 64 + 32; + gWeatherPtr->sprites.s2.fog1Sprites[i] = sprite; + } + else + { + gWeatherPtr->sprites.s2.fog1Sprites[i] = NULL; + } + } + gWeatherPtr->fog1SpritesCreated = TRUE; + } +} + +#undef sprColumn + +/*static*/ void DestroyFog1Sprites(void) +{ + u16 i; + + if (gWeatherPtr->fog1SpritesCreated) + { + for (i = 0; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]); + } + FreeSpriteTilesByTag(0x1201); + gWeatherPtr->fog1SpritesCreated = 0; + } +} + +//------------------------------------------------------------------------------ +// Volcanic ash +//------------------------------------------------------------------------------ + +void Ash_Main(void); +void LoadAshSpriteSheet(void); +void CreateAshSprites(void); +void DestroyAshSprites(void); + +void Ash_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->unknown_6FE = 20; + if (!gWeatherPtr->ashSpritesCreated) + { + Weather_SetBlendCoeffs(0, 16); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // Those aren't even valid coefficients! + } +} + +void Ash_InitAll(void) +{ + Ash_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Ash_Main(); +} + +void Ash_Main(void) +{ + gWeatherPtr->unknown_6FC = gSpriteCoordOffsetX & 0x1FF; + while (gWeatherPtr->unknown_6FC > 0xEF) + gWeatherPtr->unknown_6FC -= 0xF0; + switch (gWeatherPtr->initStep) + { + case 0: + LoadAshSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (!gWeatherPtr->ashSpritesCreated) + CreateAshSprites(); + Weather_SetTargetBlendCoeffs(16, 0, 1); + gWeatherPtr->initStep++; + break; + case 2: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + break; + default: + Weather_UpdateBlend(); + break; + } +} + +bool8 Ash_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + Weather_SetTargetBlendCoeffs(0, 16, 1); + gWeatherPtr->finishStep++; + break; + case 1: + if (!Weather_UpdateBlend()) + break; + DestroyAshSprites(); + gWeatherPtr->finishStep++; + break; + case 2: + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + gWeatherPtr->finishStep++; + return FALSE; + default: + return FALSE; + } + return TRUE; +} + +/*static*/ const struct SpriteSheet sAshSpriteSheet = {gWeatherAshTiles, sizeof(gWeatherAshTiles), 0x1202}; + +void LoadAshSpriteSheet(void) +{ + LoadSpriteSheet(&sAshSpriteSheet); +} + +const struct OamData gOamData_839ABB8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 1, + .paletteNum = 15, + .affineParam = 0, +}; + +const union AnimCmd gSpriteAnim_839ABC0[] = +{ + ANIMCMD_FRAME(0, 60), + ANIMCMD_FRAME(64, 60), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gSpriteAnimTable_839ABCC[] = +{ + gSpriteAnim_839ABC0, +}; + +void sub_807FAA8(struct Sprite *); +/*static*/ const struct SpriteTemplate sAshSpriteTemplate = +{ + .tileTag = 4610, + .paletteTag = 4608, + .oam = &gOamData_839ABB8, + .anims = gSpriteAnimTable_839ABCC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_807FAA8, +}; + +void CreateAshSprites(void) +{ + u8 i; + + if (!gWeatherPtr->ashSpritesCreated) + { + for (i = 0; i < 20; i++) + { + u8 spriteId = CreateSpriteAtEnd(&sAshSpriteTemplate, 0, 0, 0x4E); + + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + + sprite->data[1] = 0; + sprite->data[2] = (u8)(i % 5); + sprite->data[3] = (u8)(i / 5); + sprite->data[0] = sprite->data[3] * 64 + 32; + gWeatherPtr->sprites.s2.ashSprites[i] = sprite; + } + else + { + gWeatherPtr->sprites.s2.ashSprites[i] = NULL; + } + } + gWeatherPtr->ashSpritesCreated = TRUE; + } +} + +void DestroyAshSprites(void) +{ + u16 i; + + if (gWeatherPtr->ashSpritesCreated) + { + for (i = 0; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s2.ashSprites[i]); + } + FreeSpriteTilesByTag(0x1202); + gWeatherPtr->ashSpritesCreated = FALSE; + } +} + +void sub_807FAA8(struct Sprite *sprite) +{ + sprite->data[1]++; + if (sprite->data[1] > 5) + { + sprite->data[1] = 0; + sprite->data[0]++; + } + sprite->pos1.y = gSpriteCoordOffsetY + sprite->data[0]; + sprite->pos1.x = gWeatherPtr->unknown_6FC + 32 + sprite->data[2] * 64; + if (sprite->pos1.x > 271) + { + sprite->pos1.x = gWeatherPtr->unknown_6FC + 0x1E0 - (4 - sprite->data[2]) * 64; + sprite->pos1.x &= 0x1FF; + } +} + +//------------------------------------------------------------------------------ +// Fog 2 +//------------------------------------------------------------------------------ + +void Fog2_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = 0; + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->unknown_6F0 = 0; + gWeatherPtr->unknown_6F2 = 1; + if (gWeatherPtr->fog2SpritesCreated == 0) + { + gWeatherPtr->unknown_71C = 0; + gWeatherPtr->unknown_71E = 0; + gWeatherPtr->unknown_720 = 0; + gWeatherPtr->unknown_722 = 0; + gWeatherPtr->unknown_718 = 0; + gWeatherPtr->unknown_71A = 0; + Weather_SetBlendCoeffs(0, 16); + } +} + +void Fog2_Main(void); + +void Fog2_InitAll(void) +{ + Fog2_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Fog2_Main(); +} + +void sub_807FC9C(void); +void CreateFog2Sprites(void); + +void Fog2_Main(void) +{ + sub_807FC9C(); + switch (gWeatherPtr->initStep) + { + case 0: + CreateFog2Sprites(); + gWeatherPtr->initStep++; + break; + case 1: + Weather_SetTargetBlendCoeffs(12, 8, 8); + gWeatherPtr->initStep++; + break; + case 2: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + break; + } +} + +void DestroyFog2Sprites(void); + +bool8 Fog2_Finish(void) +{ + sub_807FC9C(); + switch (gWeatherPtr->finishStep) + { + case 0: + Weather_SetTargetBlendCoeffs(0, 16, 1); + gWeatherPtr->finishStep++; + break; + case 1: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->finishStep++; + break; + case 2: + DestroyFog2Sprites(); + gWeatherPtr->finishStep++; + break; + default: + return FALSE; + } + return TRUE; +} + +void sub_807FC9C(void) +{ + if (++gWeatherPtr->unknown_71C > 2) + { + gWeatherPtr->unknown_720++; + gWeatherPtr->unknown_71C = 0; + } + + if (++gWeatherPtr->unknown_71E > 4) + { + gWeatherPtr->unknown_722++; + gWeatherPtr->unknown_71E = 0; + } + + gWeatherPtr->unknown_718 = (gSpriteCoordOffsetX - gWeatherPtr->unknown_720) & 0xFF; + gWeatherPtr->unknown_71A = gSpriteCoordOffsetY + gWeatherPtr->unknown_722; +} + +extern const struct SpriteTemplate sFog2SpriteTemplate; // defined below + +void CreateFog2Sprites(void) +{ + u16 i; + + if (!gWeatherPtr->fog2SpritesCreated) + { + struct SpriteSheet fog2SpriteSheet = {gWeatherFog2Tiles, sizeof(gWeatherFog2Tiles), 0x1203}; + + LoadSpriteSheet(&fog2SpriteSheet); + for (i = 0; i < 20; i++) + { + u8 spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF); + + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + + sprite->data[0] = i % 5; + sprite->data[1] = i / 5; + gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite; + } + else + { + gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL; + } + } + gWeatherPtr->fog2SpritesCreated = TRUE; + } +} + +const struct OamData gOamData_839ABF0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0, +}; + +const union AnimCmd gSpriteAnim_839ABF8[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_839AC00[] = +{ + gSpriteAnim_839ABF8, +}; + +void Fog2SpriteCallback(struct Sprite *); +const struct SpriteTemplate sFog2SpriteTemplate = +{ + .tileTag = 4611, + .paletteTag = 4608, + .oam = &gOamData_839ABF0, + .anims = gSpriteAnimTable_839AC00, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = Fog2SpriteCallback, +}; + +void DestroyFog2Sprites(void) +{ + u16 i; + + if (gWeatherPtr->fog2SpritesCreated) + { + for (i = 0; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.fog2Sprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s2.fog2Sprites[i]); + } + FreeSpriteTilesByTag(0x1203); + gWeatherPtr->fog2SpritesCreated = FALSE; + } +} + +void Fog2SpriteCallback(struct Sprite *sprite) +{ + sprite->pos2.y = gWeatherPtr->unknown_71A; + sprite->pos1.x = gWeatherPtr->unknown_718 + 32 + sprite->data[0] * 64; + if (sprite->pos1.x > 271) + { + sprite->pos1.x = gWeatherPtr->unknown_718 + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x &= 0x1FF; + } +} + +//------------------------------------------------------------------------------ +// Sandstorm +//------------------------------------------------------------------------------ + +void Sandstorm_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = 0; + gWeatherPtr->gammaTargetIndex = 0; + gWeatherPtr->gammaStepDelay = 20; + if (gWeatherPtr->sandstormSprites1Created == 0) + { + gWeatherPtr->unknown_704 = gWeatherPtr->unknown_708 = 0; + gWeatherPtr->unknown_712 = 8; + gWeatherPtr->unknown_714 = 0; + // Dead code. How does the compiler not optimize this out? + if (gWeatherPtr->unknown_712 > 0x5F) + gWeatherPtr->unknown_712 = 0x80 - gWeatherPtr->unknown_712; + Weather_SetBlendCoeffs(0, 16); + } +} + +void Sandstorm_Main(void); + +void Sandstorm_InitAll(void) +{ + Sandstorm_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Sandstorm_Main(); +} + +void sub_808002C(void); +void sub_8080064(void); +void CreateSandstormSprites_1(void); +void CreateSandstormSprites_2(void); + +void Sandstorm_Main(void) +{ + sub_8080064(); + sub_808002C(); + if (gWeatherPtr->unknown_712 > 0x5F) + gWeatherPtr->unknown_712 = 32; + switch (gWeatherPtr->initStep) + { + case 0: + CreateSandstormSprites_1(); + CreateSandstormSprites_2(); + gWeatherPtr->initStep++; + break; + case 1: + Weather_SetTargetBlendCoeffs(16, 0, 0); + gWeatherPtr->initStep++; + break; + case 2: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + break; + } +} + +void sub_80800E4(void); + +bool8 Sandstorm_Finish(void) +{ + sub_8080064(); + sub_808002C(); + switch (gWeatherPtr->finishStep) + { + case 0: + Weather_SetTargetBlendCoeffs(0, 16, 0); + gWeatherPtr->finishStep++; + break; + case 1: + if (!Weather_UpdateBlend()) + break; + gWeatherPtr->finishStep++; + break; + case 2: + sub_80800E4(); + gWeatherPtr->finishStep++; + break; + default: + return FALSE; + } + return TRUE; +} + +void sub_808002C(void) +{ + if (gWeatherPtr->unknown_714++ > 4) + { + gWeatherPtr->unknown_712++; + gWeatherPtr->unknown_714 = 0; + } +} + +void sub_8080064(void) +{ + gWeatherPtr->unknown_704 -= gSineTable[gWeatherPtr->unknown_712] * 4; + gWeatherPtr->unknown_708 -= gSineTable[gWeatherPtr->unknown_712]; + gWeatherPtr->unknown_70E = (gSpriteCoordOffsetX + (gWeatherPtr->unknown_704 >> 8)) & 0xFF; + gWeatherPtr->unknown_710 = gSpriteCoordOffsetY + (gWeatherPtr->unknown_708 >> 8); +} + +void sub_80800E4(void) +{ + u16 i; + + if (gWeatherPtr->sandstormSprites1Created) + { + for (i = 0; i < 20; i++) + { + if (gWeatherPtr->sprites.s2.sandstormSprites1[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites1[i]); + } + gWeatherPtr->sandstormSprites1Created = FALSE; + FreeSpriteTilesByTag(0x1204); + } + + if (gWeatherPtr->sandstormSprites2Created) + { + for (i = 0; i < 5; i++) + { + if (gWeatherPtr->sprites.s2.sandstormSprites2[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites2[i]); + } + gWeatherPtr->sandstormSprites2Created = FALSE; + } +} + +const struct OamData gOamData_839AC1C = +{ + .y = 0, + .affineMode = 0, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +const union AnimCmd gSpriteAnim_839AC24[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_839AC2C[] = +{ + ANIMCMD_FRAME(64, 3), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_839AC34[] = +{ + gSpriteAnim_839AC24, + gSpriteAnim_839AC2C, +}; + +void SandstormSpriteCallback1(struct Sprite *); +const struct SpriteTemplate sSandstormSpriteTemplate = +{ + .tileTag = 4612, + .paletteTag = 4609, + .oam = &gOamData_839AC1C, + .anims = gSpriteAnimTable_839AC34, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SandstormSpriteCallback1, +}; + +/*static*/ const struct SpriteSheet sSandstormSpriteSheet = {gWeatherSandstormTiles, sizeof(gWeatherSandstormTiles), 0x1204}; + +void CreateSandstormSprites_1(void) +{ + u16 i; + + if (!gWeatherPtr->sandstormSprites1Created) + { + LoadSpriteSheet(&sSandstormSpriteSheet); + LoadCustomWeatherSpritePalette(gUnknown_0854C2B0); + for (i = 0; i < 20; i++) + { + u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, 0, (i / 5) * 64, 1); + + if (spriteId != MAX_SPRITES) + { + gWeatherPtr->sprites.s2.sandstormSprites1[i] = &gSprites[spriteId]; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[0] = i % 5; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[1] = i / 5; + } + else + { + gWeatherPtr->sprites.s2.sandstormSprites1[i] = NULL; + } + } + gWeatherPtr->sandstormSprites1Created = TRUE; + } +} + +const u16 gUnknown_0839AC5C[] = {0, 120, 80, 160, 40, 0}; + +void SandstormSpriteCallback2(struct Sprite *); + +void CreateSandstormSprites_2(void) +{ + u16 i; + + if (!gWeatherPtr->sandstormSprites2Created) + { + for (i = 0; i < 5; i++) + { + u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 0x18, 0xD0, 1); + + if (spriteId != MAX_SPRITES) + { + gWeatherPtr->sprites.s2.sandstormSprites2[i] = &gSprites[spriteId]; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->oam.size = 2; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[1] = i * 51; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[0] = 8; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[2] = 0; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[4] = 0x6730; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[3] = gUnknown_0839AC5C[i]; + StartSpriteAnim(gWeatherPtr->sprites.s2.sandstormSprites2[i], 1); + CalcCenterToCornerVec(gWeatherPtr->sprites.s2.sandstormSprites2[i], 0, 2, 0); + gWeatherPtr->sprites.s2.sandstormSprites2[i]->callback = SandstormSpriteCallback2; + } + else + { + gWeatherPtr->sprites.s2.sandstormSprites2[i] = NULL; + } + gWeatherPtr->sandstormSprites2Created = TRUE; + } + } +} + +void SandstormSpriteCallback1(struct Sprite *sprite) +{ + sprite->pos2.y = gWeatherPtr->unknown_710; + sprite->pos1.x = gWeatherPtr->unknown_70E + 32 + sprite->data[0] * 64; + if (sprite->pos1.x > 271) + { + sprite->pos1.x = gWeatherPtr->unknown_70E + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x &= 0x1FF; + } +} + +void SandstormSpriteCallback3(struct Sprite *); + +void SandstormSpriteCallback2(struct Sprite *sprite) +{ + if (--sprite->data[3] == -1) + sprite->callback = SandstormSpriteCallback3; +} + +void SandstormSpriteCallback3(struct Sprite *sprite) +{ + u32 x; + u32 y; + + if (--sprite->pos1.y < -48) + { + sprite->pos1.y = 208; + sprite->data[0] = 4; + } + x = sprite->data[0] * gSineTable[sprite->data[1]]; + y = sprite->data[0] * gSineTable[sprite->data[1] + 64]; + sprite->pos2.x = x >> 8; + sprite->pos2.y = y >> 8; + sprite->data[1] = (sprite->data[1] + 10) & 0xFF; + if (++sprite->data[2] > 8) + { + sprite->data[2] = 0; + sprite->data[0]++; + } +} + +//------------------------------------------------------------------------------ +// Shade +//------------------------------------------------------------------------------ + +void Shade_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; +} + +void Shade_InitAll(void) +{ + Shade_InitVars(); +} + +void Shade_Main(void) +{ +} + +bool8 Shade_Finish(void) +{ + return FALSE; +} + +//------------------------------------------------------------------------------ +// Weather 14 +//------------------------------------------------------------------------------ + +const u8 gUnknown_0839AC68[] = {40, 90, 60, 90, 2, 60, 40, 30}; + +const struct SpriteSheet gWeatherBubbleSpriteSheet = {gWeatherBubbleTiles, sizeof(gWeatherBubbleTiles), 0x1205}; + +void Bubbles_InitVars(void) +{ + Fog1_InitVars(); + if (gWeatherPtr->unknown_72E == 0) + { + LoadSpriteSheet(&gWeatherBubbleSpriteSheet); + gWeatherPtr->unknown_728 = 0; + gWeatherPtr->unknown_726 = gUnknown_0839AC68[0]; + gWeatherPtr->unknown_72A = 0; + gWeatherPtr->unknown_72C = 0; + } +} + +void Bubbles_Main(void); + +void Bubbles_InitAll(void) +{ + Bubbles_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Bubbles_Main(); +} + +void sub_8080588(u16); + +void Bubbles_Main(void) +{ + Fog1_Main(); + if (++gWeatherPtr->unknown_726 > gUnknown_0839AC68[gWeatherPtr->unknown_728]) + { + gWeatherPtr->unknown_726 = 0; + if (++gWeatherPtr->unknown_728 > 7) + gWeatherPtr->unknown_728 = 0; + sub_8080588(gWeatherPtr->unknown_72A); + if (++gWeatherPtr->unknown_72A > 12) + gWeatherPtr->unknown_72A = 0; + } +} + +void sub_8080610(void); + +bool8 Bubbles_Finish(void) +{ + if (!Fog1_Finish()) + { + sub_8080610(); + return FALSE; + } + return TRUE; +} + +const s16 gUnknown_0839AC78[][2] = +{ + {120, 160}, + {376, 160}, + { 40, 140}, + {296, 140}, + {180, 130}, + {436, 130}, + { 60, 160}, + {436, 160}, + {220, 180}, + {476, 180}, + { 10, 90}, + {266, 90}, + {256, 160}, +}; + +const union AnimCmd gSpriteAnim_839ACAC[] = +{ + ANIMCMD_FRAME(0, 16), + ANIMCMD_FRAME(1, 16), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_839ACB8[] = +{ + gSpriteAnim_839ACAC, +}; + +extern const struct OamData gUnknown_08524904; + +void unc_0807DAB4(struct Sprite *); +const struct SpriteTemplate gSpriteTemplate_839ACBC = +{ + .tileTag = 4613, + .paletteTag = 4608, + .oam = &gUnknown_08524904, + .anims = gSpriteAnimTable_839ACB8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = unc_0807DAB4, +}; + +void sub_8080588(u16 a) +{ + s16 x = gUnknown_0839AC78[a][0]; + s16 y = gUnknown_0839AC78[a][1] - gSpriteCoordOffsetY; + u8 spriteId = CreateSpriteAtEnd( + &gSpriteTemplate_839ACBC, + x, + y, + 0); + + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.priority = 1; + gSprites[spriteId].coordOffsetEnabled = TRUE; + gSprites[spriteId].data[0] = 0; + gSprites[spriteId].data[1] = 0; + gSprites[spriteId].data[2] = 0; + gWeatherPtr->unknown_72C++; + } +} + +void sub_8080610(void) +{ + u16 i; + + if (gWeatherPtr->unknown_72C != 0) + { + for (i = 0; i < 64; i++) + { + if (gSprites[i].template == &gSpriteTemplate_839ACBC) + DestroySprite(&gSprites[i]); + } + FreeSpriteTilesByTag(0x1205); + gWeatherPtr->unknown_72C = 0; + } +} + +void unc_0807DAB4(struct Sprite *sprite) +{ + ++sprite->data[0]; + if (++sprite->data[0] > 8) // double increment + { + sprite->data[0] = 0; + if (sprite->data[1] == 0) + { + if (++sprite->pos2.x > 4) + sprite->data[1] = 1; + } + else + { + if (--sprite->pos2.x <= 0) + sprite->data[1] = 0; + } + } + sprite->pos1.y -= 3; + if (++sprite->data[2] > 0x77) + DestroySprite(sprite); +} + +// New Emerald functions. +extern u8 gUnknown_02038BC4; +extern u16 gUnknown_02038BC6; +void sub_80AEC94(u32 a0, u32 a1) +{ + gUnknown_02038BC4 = a0; + gUnknown_02038BC6 = a1; +} + +void sub_80AECA8(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + if (data[15]-- <= 0) + { + ChangeWeather(data[1]); + gUnknown_02038BC4 = data[1]; + data[15] = 600; + data[0]++; + } + break; + case 1: + if (data[15]-- <= 0) + { + ChangeWeather(data[2]); + gUnknown_02038BC4 = data[2]; + data[15] = 600; + data[0] = 0; + } + break; + } +} + +void sub_80AED28(void) +{ + u8 taskId = CreateTask(sub_80AECA8, 0); + s16 *data = gTasks[taskId].data; + + data[15] = 600; + if (gUnknown_02038BC4 == 13) + { + data[1] = 12; + data[2] = 13; + } + else if (gUnknown_02038BC4 == 12) + { + data[1] = 13; + data[2] = 12; + } + else + { + gUnknown_02038BC4 = 13; + data[1] = 12; + data[2] = 13; + } +} + +//------------------------------------------------------------------------------ + +/*static*/ u8 TranslateWeatherNum(u8); +/*static*/ void UpdateRainCounter(u8, u8); + +void SetSav1Weather(u32 weather) +{ + u8 oldWeather = gSaveBlock1Ptr->weather; + gSaveBlock1Ptr->weather = TranslateWeatherNum(weather); + UpdateRainCounter(gSaveBlock1Ptr->weather, oldWeather); +} + +u8 GetSav1Weather(void) +{ + return gSaveBlock1Ptr->weather; +} + +void SetSav1WeatherFromCurrMapHeader(void) +{ + u8 oldWeather = gSaveBlock1Ptr->weather; + gSaveBlock1Ptr->weather = TranslateWeatherNum(gMapHeader.weather); + UpdateRainCounter(gSaveBlock1Ptr->weather, oldWeather); +} + +void SetWeather(u32 weather) +{ + SetSav1Weather(weather); + ChangeWeather(GetSav1Weather()); +} + +void SetWeather_Unused(u32 weather) +{ + SetSav1Weather(weather); + sub_80AB104(GetSav1Weather()); +} + +void DoCurrentWeather(void) +{ + u8 weather = GetSav1Weather(); + + if (weather == 15) + { + if (!FuncIsActiveTask(sub_80AECA8)) + sub_80AED28(); + weather = gUnknown_02038BC4; + } + else + { + if (FuncIsActiveTask(sub_80AECA8)) + DestroyTask(FindTaskIdByFunc(sub_80AECA8)); + gUnknown_02038BC4 = 13; + } + ChangeWeather(weather); +} + +void sub_80AEE84(void) +{ + u8 weather = GetSav1Weather(); + + if (weather == 15) + { + if (!FuncIsActiveTask(sub_80AECA8)) + sub_80AED28(); + weather = gUnknown_02038BC4; + } + else + { + if (FuncIsActiveTask(sub_80AECA8)) + DestroyTask(FindTaskIdByFunc(sub_80AECA8)); + gUnknown_02038BC4 = 13; + } + sub_80AB104(weather); +} + +/*static*/ const u8 sWeatherCycleRoute119[] = +{ + WEATHER_SUNNY, + WEATHER_RAIN_LIGHT, + WEATHER_RAIN_MED, + WEATHER_RAIN_LIGHT, +}; +/*static*/ const u8 sWeatherCycleRoute123[] = +{ + WEATHER_SUNNY, + WEATHER_SUNNY, + WEATHER_RAIN_LIGHT, + WEATHER_SUNNY, +}; + +/*static*/ u8 TranslateWeatherNum(u8 weather) +{ + switch (weather) + { + case WEATHER_NONE: return WEATHER_NONE; + case WEATHER_CLOUDS: return WEATHER_CLOUDS; + case WEATHER_SUNNY: return WEATHER_SUNNY; + case WEATHER_RAIN_LIGHT: return WEATHER_RAIN_LIGHT; + case WEATHER_SNOW: return WEATHER_SNOW; + case WEATHER_RAIN_MED: return WEATHER_RAIN_MED; + case WEATHER_FOG_1: return WEATHER_FOG_1; + case WEATHER_ASH: return WEATHER_ASH; + case WEATHER_SANDSTORM: return WEATHER_SANDSTORM; + case WEATHER_FOG_2: return WEATHER_FOG_2; + case WEATHER_FOG_3: return WEATHER_FOG_3; + case WEATHER_SHADE: return WEATHER_SHADE; + case WEATHER_DROUGHT: return WEATHER_DROUGHT; + case WEATHER_RAIN_HEAVY: return WEATHER_RAIN_HEAVY; + case WEATHER_BUBBLES: return WEATHER_BUBBLES; + case 15: return 15; + case WEATHER_ROUTE119_CYCLE: return sWeatherCycleRoute119[gSaveBlock1Ptr->weatherCycleStage]; + case WEATHER_ROUTE123_CYCLE: return sWeatherCycleRoute123[gSaveBlock1Ptr->weatherCycleStage]; + default: return WEATHER_NONE; + } +} + +void UpdateWeatherPerDay(u16 increment) +{ + u16 weatherStage = gSaveBlock1Ptr->weatherCycleStage + increment; + weatherStage %= 4; + gSaveBlock1Ptr->weatherCycleStage = weatherStage; +} + +/*static*/ void UpdateRainCounter(u8 newWeather, u8 oldWeather) +{ + if (newWeather != oldWeather + && (newWeather == WEATHER_RAIN_LIGHT || newWeather == WEATHER_RAIN_MED)) + IncrementGameStat(GAME_STAT_GOT_RAINED_ON); +} diff --git a/src/fldeff_sweetscent.c b/src/fldeff_sweetscent.c index 9951fe581..bc62ac2af 100644 --- a/src/fldeff_sweetscent.c +++ b/src/fldeff_sweetscent.c @@ -4,6 +4,7 @@ #include "field_effect.h" #include "field_player_avatar.h" #include "field_screen.h" +#include "field_weather.h" #include "palette.h" #include "party_menu.h" #include "rom6.h" @@ -40,7 +41,7 @@ bool8 FldEff_SweetScent(void) { u8 taskId; - sub_80AC3D0(); + SetWeatherScreenFadeOut(); taskId = oei_task_add(); gTasks[taskId].data[8] = (u32)StartSweetScentFieldEffect >> 16; gTasks[taskId].data[9] = (u32)StartSweetScentFieldEffect; diff --git a/src/overworld.c b/src/overworld.c index 3193ec0d3..470e27ffc 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -148,7 +148,7 @@ extern void ResetAllPicSprites(void); extern void FieldEffectActiveListClear(void); extern void SetUpFieldTasks(void); extern void sub_81BE6B8(void); -extern void sub_80AAFA4(void); +extern void StartWeather(void); extern void ShowStartMenu(void); extern void sub_80AEE84(void); extern void mapldr_default(void); @@ -2160,7 +2160,7 @@ static void sub_8086988(u32 a1) InitEventObjectPalettes(1); FieldEffectActiveListClear(); - sub_80AAFA4(); + StartWeather(); sub_80AEE84(); if (!a1) SetUpFieldTasks(); diff --git a/src/start_menu.c b/src/start_menu.c index 079f05be0..0e52f05fb 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -88,7 +88,7 @@ extern void sub_80AF688(void); extern void var_800D_set_xB(void); extern void sub_808B864(void); extern void CB2_Pokedex(void); -extern void play_some_sound(void); +extern void PlayRainSoundEffect(void); extern void CB2_PartyMenuFromStartMenu(void); extern void CB2_PokeNav(void); extern void sub_80C4DDC(void (*)(void)); @@ -621,7 +621,7 @@ static bool8 StartMenuPokedexCallback(void) if (!gPaletteFade.active) { IncrementGameStat(GAME_STAT_CHECKED_POKEDEX); - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_Pokedex); @@ -636,7 +636,7 @@ static bool8 StartMenuPokemonCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_PartyMenuFromStartMenu); // Display party menu @@ -651,7 +651,7 @@ static bool8 StartMenuBagCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_BagMenuFromStartMenu); // Display bag menu @@ -666,7 +666,7 @@ static bool8 StartMenuPokeNavCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_PokeNav); // Display PokeNav @@ -681,7 +681,7 @@ static bool8 StartMenuPlayerNameCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); @@ -720,7 +720,7 @@ static bool8 StartMenuOptionCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_InitOptionMenu); // Display option menu @@ -753,7 +753,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); overworld_free_bg_tilemaps(); TrainerCard_ShowLinkCard(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu); @@ -782,7 +782,7 @@ static bool8 StartMenuBattlePyramidBagCallback(void) { if (!gPaletteFade.active) { - play_some_sound(); + PlayRainSoundEffect(); RemoveExtraStartMenuWindows(); overworld_free_bg_tilemaps(); SetMainCallback2(CB2_PyramidBagMenuFromStartMenu); diff --git a/sym_bss.txt b/sym_bss.txt index d006e1364..a40d3751d 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -21,7 +21,7 @@ .include "src/tileset_anims.o" .include "src/palette.o" .include "src/sound.o" - .include "src/field_screen.o" + .include "src/field_weather.o" .include "src/field_effect.o" .include "src/pokemon_storage_system.o" .include "src/fldeff_cut.o" diff --git a/sym_ewram.txt b/sym_ewram.txt index 19146b72d..8d8a6c177 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -154,17 +154,7 @@ gUnknown_020375C0: @ 20375C0 .include "src/battle_anim_80A5C6C.o" .space 0xC -gUnknown_02038454: @ 2038454 - .space 0x200 - -gUnknown_02038654: @ 2038654 - .space 0x260 - -gUnknown_020388B4: @ 20388B4 - .space 0x2F0 - -gUnknown_02038BA4: @ 2038BA4 - .space 0x20 + .include "src/field_weather.o" gUnknown_02038BC4: @ 2038BC4 .space 0x2