diff --git a/asm/fire.s b/asm/fire.s deleted file mode 100644 index cd0339b9b..000000000 --- a/asm/fire.s +++ /dev/null @@ -1,2397 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8108EC8 -sub_8108EC8: @ 8108EC8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r4, 0x2E] - movs r0, 0x3C - strh r0, [r4, 0x30] - movs r0, 0x9 - strh r0, [r4, 0x32] - movs r0, 0x1E - strh r0, [r4, 0x34] - movs r0, 0xFE - lsls r0, 8 - strh r0, [r4, 0x36] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r1, =sub_80A634C - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8108EC8 - - thumb_func_start sub_8108F08 -sub_8108F08: @ 8108F08 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimArgs - movs r0, 0 - ldrsh r1, [r5, r0] - adds r0, r4, 0 - bl sub_80A6864 - ldrh r0, [r5, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x30] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x32] - ldr r0, =sub_80A656C - str r0, [r4, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8108F08 - - thumb_func_start sub_8108F4C -sub_8108F4C: @ 8108F4C - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08108F88 - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldrh r0, [r2, 0x8] - negs r0, r0 - strh r0, [r4, 0x32] - adds r1, r2, 0 - b _08108F9E - .pool -_08108F88: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x32] -_08108F9E: - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x36] - ldrh r0, [r1, 0xA] - strh r0, [r4, 0x34] - ldr r0, =sub_8109028 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8108F4C - - thumb_func_start sub_8108FBC -sub_8108FBC: @ 8108FBC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08108FF0 - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldrh r0, [r2, 0x8] - strh r0, [r4, 0x32] - adds r1, r2, 0 - b _08109008 - .pool -_08108FF0: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldrh r0, [r1, 0x8] - negs r0, r0 - strh r0, [r4, 0x32] -_08109008: - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x36] - ldrh r0, [r1, 0xA] - strh r0, [r4, 0x34] - ldr r0, =sub_8109028 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8108FBC - - thumb_func_start sub_8109028 -sub_8109028: @ 8109028 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x36 - ldrsh r1, [r2, r3] - cmp r0, r1 - bge _0810904E - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x24] - ldrh r0, [r2, 0x34] - ldrh r3, [r2, 0x26] - adds r0, r3 - strh r0, [r2, 0x26] -_0810904E: - movs r0, 0x2E - ldrsh r1, [r2, r0] - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r1, r0 - bne _08109060 - adds r0, r2, 0 - bl move_anim_8074EE0 -_08109060: - pop {r0} - bx r0 - thumb_func_end sub_8109028 - - thumb_func_start sub_8109064 -sub_8109064: @ 8109064 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08109090 - ldr r0, =gBattleAnimArgs - ldrh r1, [r4, 0x20] - ldrh r2, [r0] - subs r1, r2 - strh r1, [r4, 0x20] - b _081090A2 - .pool -_08109090: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - ldrh r2, [r4, 0x20] - adds r1, r2 - strh r1, [r4, 0x20] - adds r2, r4, 0 - adds r2, 0x43 - movs r1, 0x8 - strb r1, [r2] -_081090A2: - adds r2, r0, 0 - ldrh r0, [r2, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - movs r1, 0 - strh r0, [r4, 0x22] - ldrh r0, [r2, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r2, 0x6] - strh r0, [r4, 0x30] - ldrh r0, [r2, 0x8] - strh r0, [r4, 0x32] - ldrh r0, [r2, 0xA] - strh r0, [r4, 0x34] - ldrh r0, [r2, 0xC] - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldr r0, =sub_81090D8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109064 - - thumb_func_start sub_81090D8 -sub_81090D8: @ 81090D8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08109160 - movs r2, 0x38 - ldrsh r1, [r4, r2] - ldr r0, =0x00002710 - cmp r1, r0 - ble _081090F6 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1 - strb r0, [r1] -_081090F6: - movs r1, 0x2E - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 24 - ldrh r2, [r4, 0x30] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 24 - ldrh r2, [r4, 0x30] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - ldrh r0, [r4, 0x36] - ldrh r2, [r4, 0x38] - adds r0, r2 - strh r0, [r4, 0x38] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _0810914C - ldr r2, =0xffffff00 - b _08109154 - .pool -_0810914C: - cmp r0, 0 - bge _08109158 - movs r2, 0x80 - lsls r2, 1 -_08109154: - adds r0, r1, r2 - strh r0, [r4, 0x2E] -_08109158: - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x34] - b _08109166 -_08109160: - adds r0, r4, 0 - bl move_anim_8074EE0 -_08109166: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81090D8 - - thumb_func_start sub_810916C -sub_810916C: @ 810916C - push {lr} - movs r1, 0 - strh r1, [r0, 0x20] - strh r1, [r0, 0x22] - movs r1, 0x3C - strh r1, [r0, 0x2E] - movs r1, 0x8C - strh r1, [r0, 0x32] - movs r1, 0x50 - strh r1, [r0, 0x36] - ldr r1, =StartAnimLinearTranslation - str r1, [r0, 0x1C] - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_810916C - - thumb_func_start sub_8109198 -sub_8109198: @ 8109198 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - bl GetBattlerSide - adds r4, r0, 0 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _081091DE - movs r0, 0x2 - bl GetBattlerAtPosition - ldrb r1, [r5] - lsls r0, 24 - lsrs r0, 24 - cmp r1, r0 - beq _081091D6 - movs r0, 0x3 - bl GetBattlerAtPosition - ldrb r1, [r5] - lsls r0, 24 - lsrs r0, 24 - cmp r1, r0 - bne _081091DE -_081091D6: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_081091DE: - ldr r1, =sub_80A7938 - str r1, [r6, 0x1C] - adds r0, r6, 0 - bl _call_via_r1 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109198 - - thumb_func_start sub_8109200 -sub_8109200: @ 8109200 - ldr r2, =gBattleAnimArgs - ldrh r1, [r2] - negs r1, r1 - strh r1, [r2] - ldrh r1, [r2, 0x4] - negs r1, r1 - strh r1, [r2, 0x4] - ldr r1, =sub_80A7938 - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_8109200 - - thumb_func_start sub_810921C -sub_810921C: @ 810921C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - movs r1, 0 - strh r0, [r4, 0x3C] - strh r1, [r4, 0x2E] - ldr r0, =sub_8109244 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810921C - - thumb_func_start sub_8109244 -sub_8109244: @ 8109244 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8109338 - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x12 - bne _0810928E - movs r0, 0x19 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x20] - strh r0, [r5, 0x30] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x22] - strh r0, [r5, 0x34] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl InitAnimLinearTranslation - ldr r0, =sub_810929C - str r0, [r5, 0x1C] -_0810928E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109244 - - thumb_func_start sub_810929C -sub_810929C: @ 810929C - push {r4-r6,lr} - adds r6, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - beq _081092E4 - movs r4, 0 - strh r4, [r6, 0x2E] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x20] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x22] - strh r4, [r6, 0x26] - strh r4, [r6, 0x24] - ldr r1, =sub_8109314 - str r1, [r6, 0x1C] - adds r0, r6, 0 - bl _call_via_r1 - b _0810930E - .pool -_081092E4: - movs r1, 0x3C - ldrsh r0, [r6, r1] - movs r1, 0x1C - bl Sin - ldrh r1, [r6, 0x24] - adds r0, r1 - strh r0, [r6, 0x24] - movs r1, 0x3C - ldrsh r0, [r6, r1] - movs r1, 0x1C - bl Cos - ldrh r1, [r6, 0x26] - adds r0, r1 - strh r0, [r6, 0x26] - ldrh r0, [r6, 0x3C] - adds r0, 0x14 - movs r1, 0xFF - ands r0, r1 - strh r0, [r6, 0x3C] -_0810930E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_810929C - - thumb_func_start sub_8109314 -sub_8109314: @ 8109314 - push {r4,lr} - adds r4, r0, 0 - bl sub_8109338 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _08109330 - adds r0, r4, 0 - bl DestroyAnimSprite -_08109330: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8109314 - - thumb_func_start sub_8109338 -sub_8109338: @ 8109338 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x1C - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x1C - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x14 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x3C] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8109338 - - thumb_func_start sub_8109364 -sub_8109364: @ 8109364 - push {r4,lr} - adds r4, r0, 0 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x32] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A653C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109364 - - thumb_func_start sub_81093A4 -sub_81093A4: @ 81093A4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x2E] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =WaitAnimForDuration - str r0, [r4, 0x1C] - ldr r1, =sub_81093E4 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81093A4 - - thumb_func_start sub_81093E4 -sub_81093E4: @ 81093E4 - push {lr} - adds r3, r0, 0 - adds r3, 0x3E - ldrb r2, [r3] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r3] - ldrh r1, [r0, 0x30] - movs r2, 0 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - ldr r1, =sub_810940C - str r1, [r0, 0x1C] - bl _call_via_r1 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81093E4 - - thumb_func_start sub_810940C -sub_810940C: @ 810940C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x32] - lsls r1, 16 - asrs r1, 24 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x32] - lsls r1, 16 - asrs r1, 24 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0xA - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x32] - adds r0, 0xD0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - subs r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _08109458 - adds r0, r4, 0 - bl DestroyAnimSprite -_08109458: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810940C - - thumb_func_start sub_8109460 -sub_8109460: @ 8109460 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x26] - strh r5, [r4, 0x8] - strh r5, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x22] - strh r0, [r4, 0x10] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x12] - strh r5, [r4, 0x14] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80A7270 - ldr r0, =sub_81094D0 - str r0, [r4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109460 - - thumb_func_start sub_81094D0 -sub_81094D0: @ 81094D0 - push {r4,r5,lr} - sub sp, 0xC - 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, 0x6 - bls _081094EC - b _081097AA -_081094EC: - lsls r0, 2 - ldr r1, =_08109500 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08109500: - .4byte _0810951C - .4byte _08109542 - .4byte _081095F4 - .4byte _08109654 - .4byte _08109672 - .4byte _08109748 - .4byte _0810979C -_0810951C: - ldrh r1, [r4, 0x26] - lsls r1, 24 - lsrs r1, 24 - movs r3, 0x80 - lsls r3, 1 - movs r0, 0xE0 - str r0, [sp] - movs r0, 0x80 - lsls r0, 2 - str r0, [sp, 0x4] - movs r0, 0x20 - str r0, [sp, 0x8] - adds r0, r4, 0 - adds r2, r3, 0 - bl sub_80A805C - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08109542: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0810958A - movs r0, 0 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08109578 - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - b _08109588 - .pool -_08109578: - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r1, =0x0000fffd -_08109588: - strh r1, [r0, 0x24] -_0810958A: - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081095B8 - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _081095B8 - movs r0, 0 - strh r0, [r4, 0xE] - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - adds r1, 0x1 - strh r1, [r0, 0x22] -_081095B8: - adds r0, r4, 0 - bl sub_80A80C8 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _081095C8 - b _081097AA -_081095C8: - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7E6C - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r5, [r0, 0x24] - strh r5, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - b _08109790 - .pool -_081095F4: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bgt _08109604 - b _081097AA -_08109604: - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0810962E - ldrh r1, [r4, 0x26] - lsls r1, 24 - lsrs r1, 24 - movs r3, 0x80 - lsls r3, 2 - movs r0, 0xC0 - lsls r0, 1 - str r0, [sp] - movs r0, 0xF0 - str r0, [sp, 0x4] - movs r0, 0x6 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r2, 0xE0 - bl sub_80A805C - b _0810964E -_0810962E: - ldrh r1, [r4, 0x26] - lsls r1, 24 - lsrs r1, 24 - movs r3, 0x80 - lsls r3, 2 - movs r0, 0xC0 - lsls r0, 1 - str r0, [sp] - movs r0, 0xC0 - str r0, [sp, 0x4] - movs r0, 0x6 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r2, 0xE0 - bl sub_80A805C -_0810964E: - movs r0, 0 - strh r0, [r4, 0xA] - b _08109790 -_08109654: - adds r0, r4, 0 - bl sub_80A80C8 - lsls r0, 24 - cmp r0, 0 - beq _08109662 - b _081097AA -_08109662: - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - movs r2, 0x6 - bl sub_81097B4 - b _08109790 -_08109672: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081096C0 - movs r0, 0 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081096AC - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - b _081096BE - .pool -_081096AC: - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - subs r1, 0x3 -_081096BE: - strh r1, [r0, 0x26] -_081096C0: - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x18 - ble _081097AA - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081096FC - ldrh r1, [r4, 0x26] - lsls r1, 24 - lsrs r1, 24 - movs r2, 0xC0 - lsls r2, 1 - movs r0, 0x80 - lsls r0, 1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x8 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r3, 0xF0 - bl sub_80A805C - b _0810971A - .pool -_081096FC: - ldrh r1, [r4, 0x26] - lsls r1, 24 - lsrs r1, 24 - movs r2, 0xC0 - lsls r2, 1 - movs r0, 0x80 - lsls r0, 1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x8 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r3, 0xC0 - bl sub_80A805C -_0810971A: - ldrh r1, [r4, 0xC] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08109738 - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] -_08109738: - movs r0, 0 - strh r0, [r4, 0xA] - strh r0, [r4, 0xC] - strh r0, [r4, 0xE] - b _08109790 - .pool -_08109748: - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08109764 - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x1 - strh r1, [r0, 0x22] -_08109764: - adds r0, r4, 0 - bl sub_80A80C8 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _081097AA - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x10] - strh r1, [r0, 0x22] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7344 - strh r5, [r4, 0xC] -_08109790: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _081097AA - .pool -_0810979C: - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081097AA - adds r0, r5, 0 - bl DestroyAnimVisualTask -_081097AA: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81094D0 - - thumb_func_start sub_81097B4 -sub_81097B4: @ 81097B4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - adds r0, r4, 0 - bl sub_8109930 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrh r4, [r0, 0x20] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810980C - adds r0, r4, 0 - subs r0, 0xC - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x1 - b _08109816 - .pool -_0810980C: - adds r0, r4, 0 - adds r0, 0x10 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0xFF -_08109816: - movs r6, 0 - movs r5, 0 - lsls r4, 16 - str r4, [sp, 0x8] - mov r1, r9 - lsls r1, 16 - str r1, [sp, 0x4] - ldr r2, =gUnknown_085955CC - mov r9, r2 - lsls r0, 24 - asrs r0, 24 - str r0, [sp] - mov r3, r8 - lsls r3, 1 - mov r10, r3 -_08109834: - ldr r0, =gUnknown_085955B4 - ldr r2, [sp, 0x8] - asrs r1, r2, 16 - ldr r3, [sp, 0x4] - asrs r2, r3, 16 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _081098B6 - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r1 - ldrh r2, [r4, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - lsls r0, r5, 2 - adds r0, 0x40 - adds r1, r0 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldr r3, =0xfffffc00 - adds r0, r3, 0 - ands r2, r0 - orrs r2, r1 - strh r2, [r4, 0x4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x4 - bls _0810987E - movs r5, 0 -_0810987E: - lsls r2, r6, 2 - mov r1, r9 - adds r0, r2, r1 - ldrh r0, [r0] - ldr r3, [sp] - adds r1, r0, 0 - muls r1, r3 - lsls r1, 16 - asrs r1, 16 - ldr r0, =gUnknown_085955CC+2 - adds r2, r0 - movs r3, 0 - ldrsh r2, [r2, r3] - adds r0, r4, 0 - bl sub_8109984 - strh r7, [r4, 0x3A] - mov r0, r8 - strh r0, [r4, 0x3C] - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - add r0, r10 - ldr r1, =gTasks + 0x8 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] -_081098B6: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x6 - bls _08109834 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81097B4 - - thumb_func_start sub_81098EC -sub_81098EC: @ 81098EC - push {r4,lr} - adds r4, r0, 0 - bl sub_81099A0 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08109926 - ldr r3, =gTasks - movs r0, 0x3C - ldrsh r1, [r4, r0] - lsls r1, 1 - movs r0, 0x3A - ldrsh r2, [r4, r0] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r3, 0x8 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - adds r0, r4, 0 - bl DestroySprite -_08109926: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81098EC - - thumb_func_start sub_8109930 -sub_8109930: @ 8109930 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r2, [r1, 0x26] - ldrh r0, [r1, 0x22] - adds r2, r0 - adds r1, 0x29 - movs r0, 0 - ldrsb r0, [r1, r0] - adds r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08109970 - lsls r0, r4, 16 - movs r1, 0x94 - lsls r1, 15 - b _08109976 - .pool -_08109970: - lsls r0, r4, 16 - movs r1, 0xB0 - lsls r1, 14 -_08109976: - adds r0, r1 - lsrs r4, r0, 16 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8109930 - - thumb_func_start sub_8109984 -sub_8109984: @ 8109984 - movs r3, 0 - strh r3, [r0, 0x2E] - strh r3, [r0, 0x30] - ldrh r3, [r0, 0x20] - lsls r3, 3 - strh r3, [r0, 0x32] - ldrh r3, [r0, 0x22] - lsls r3, 3 - strh r3, [r0, 0x34] - lsls r1, 3 - strh r1, [r0, 0x36] - lsls r2, 3 - strh r2, [r0, 0x38] - bx lr - thumb_func_end sub_8109984 - - thumb_func_start sub_81099A0 -sub_81099A0: @ 81099A0 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _081099CA - movs r0, 0 - strh r0, [r2, 0x2E] - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - ldrh r0, [r2, 0x30] - adds r1, r0, 0 - muls r1, r0 - adds r0, r1, 0 - ldrh r3, [r2, 0x34] - adds r0, r3 - strh r0, [r2, 0x34] -_081099CA: - ldrh r0, [r2, 0x36] - ldrh r1, [r2, 0x32] - adds r0, r1 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 19 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x38] - ldrh r3, [r2, 0x34] - adds r1, r3 - strh r1, [r2, 0x34] - lsls r1, 16 - asrs r3, r1, 19 - strh r3, [r2, 0x22] - adds r0, 0x8 - lsls r0, 16 - movs r1, 0x80 - lsls r1, 17 - cmp r0, r1 - bhi _08109A00 - adds r1, r3, 0 - movs r0, 0x8 - negs r0, r0 - cmp r1, r0 - blt _08109A00 - cmp r1, 0x78 - ble _08109A0C -_08109A00: - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_08109A0C: - pop {r0} - bx r0 - thumb_func_end sub_81099A0 - - thumb_func_start sub_8109A10 -sub_8109A10: @ 8109A10 - push {r4,r5,lr} - ldr r3, =gBattleAnimArgs - ldrh r1, [r3] - movs r2, 0 - strh r1, [r0, 0x20] - ldrh r1, [r3, 0x2] - strh r1, [r0, 0x22] - strh r2, [r0, 0x2E] - strh r2, [r0, 0x30] - strh r2, [r0, 0x32] - ldrh r1, [r3, 0x4] - strh r1, [r0, 0x3A] - ldrh r1, [r3, 0x6] - strh r1, [r0, 0x3C] - ldrh r4, [r0, 0x4] - lsls r2, r4, 22 - lsrs r2, 22 - movs r5, 0x8 - ldrsh r1, [r3, r5] - lsls r1, 4 - adds r2, r1 - ldr r3, =0x000003ff - adds r1, r3, 0 - ands r2, r1 - ldr r1, =0xfffffc00 - ands r1, r4 - orrs r1, r2 - strh r1, [r0, 0x4] - ldr r1, =sub_8109A64 - str r1, [r0, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109A10 - - thumb_func_start sub_8109A64 -sub_8109A64: @ 8109A64 - push {r4,lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0x1 - beq _08109A96 - cmp r0, 0x1 - bgt _08109A7A - cmp r0, 0 - beq _08109A80 - b _08109AF4 -_08109A7A: - cmp r0, 0x2 - beq _08109AB4 - b _08109AF4 -_08109A80: - ldrh r1, [r2, 0x3A] - movs r3, 0x3A - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _08109A90 - subs r0, r1, 0x1 - strh r0, [r2, 0x3A] - b _08109AF4 -_08109A90: - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] -_08109A96: - ldrh r0, [r2, 0x22] - adds r0, 0x8 - strh r0, [r2, 0x22] - lsls r0, 16 - asrs r0, 16 - ldrh r3, [r2, 0x3C] - movs r4, 0x3C - ldrsh r1, [r2, r4] - cmp r0, r1 - blt _08109AF4 - strh r3, [r2, 0x22] - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - b _08109AF4 -_08109AB4: - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08109AE0 - movs r0, 0 - strh r0, [r2, 0x30] - ldrh r0, [r2, 0x32] - adds r0, 0x1 - strh r0, [r2, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08109ADC - ldr r0, =0x0000fffd - b _08109ADE - .pool -_08109ADC: - movs r0, 0x3 -_08109ADE: - strh r0, [r2, 0x26] -_08109AE0: - ldrh r0, [r2, 0x34] - adds r0, 0x1 - strh r0, [r2, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08109AF4 - adds r0, r2, 0 - bl DestroyAnimSprite -_08109AF4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8109A64 - - thumb_func_start sub_8109AFC -sub_8109AFC: @ 8109AFC - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _08109B70 - cmp r0, 0x1 - bgt _08109B12 - cmp r0, 0 - beq _08109B18 - b _08109C3E -_08109B12: - cmp r0, 0x2 - beq _08109BCE - b _08109C3E -_08109B18: - adds r0, r5, 0 - movs r1, 0 - bl InitAnimSpritePos - ldr r4, =gBattleAnimArgs - ldrb r1, [r4, 0x4] - adds r0, r5, 0 - bl StartSpriteAnim - ldrh r0, [r4, 0x4] - strh r0, [r5, 0x3C] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08109B48 - movs r0, 0x4 - b _08109B4A - .pool -_08109B48: - ldr r0, =0x0000fffc -_08109B4A: - strh r0, [r5, 0x36] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - b _08109BC6 - .pool -_08109B70: - ldrh r0, [r5, 0x30] - adds r0, 0xC0 - strh r0, [r5, 0x30] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08109B94 - ldrh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 24 - negs r0, r0 - b _08109B9A - .pool -_08109B94: - ldrh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 24 -_08109B9A: - strh r0, [r5, 0x26] - movs r2, 0x32 - ldrsh r0, [r5, r2] - movs r2, 0x36 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] - ldrh r0, [r5, 0x32] - adds r0, 0x4 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08109C3E - movs r0, 0 - strh r0, [r5, 0x34] -_08109BC6: - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - b _08109C3E -_08109BCE: - movs r1, 0x32 - ldrsh r0, [r5, r1] - movs r2, 0x36 - ldrsh r1, [r5, r2] - bl Sin - adds r2, r0, 0 - movs r3, 0 - strh r2, [r5, 0x24] - ldrh r0, [r5, 0x32] - adds r0, 0x4 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _08109C3E - ldrh r0, [r5, 0x20] - adds r1, r2, r0 - strh r1, [r5, 0x20] - ldrh r0, [r5, 0x26] - ldrh r2, [r5, 0x22] - adds r0, r2 - strh r0, [r5, 0x22] - strh r3, [r5, 0x26] - strh r3, [r5, 0x24] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r5, 0x2E] - strh r1, [r5, 0x30] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x22] - strh r0, [r5, 0x34] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_80A6FD4 - ldr r0, =sub_8109C4C - str r0, [r5, 0x1C] -_08109C3E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109AFC - - thumb_func_start sub_8109C4C -sub_8109C4C: @ 8109C4C - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _08109CA4 - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - ldrh r2, [r4, 0x38] - adds r0, r2, 0x4 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x38] - lsls r2, 16 - asrs r2, 16 - cmp r2, 0 - beq _08109C82 - cmp r2, 0xC4 - ble _08109CAA -_08109C82: - lsls r0, 16 - cmp r0, 0 - ble _08109CAA - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08109CAA - ldr r0, =gUnknown_02038440 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x90 - bl PlaySE12WithPanning - b _08109CAA - .pool -_08109CA4: - adds r0, r4, 0 - bl DestroyAnimSprite -_08109CAA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8109C4C - - thumb_func_start sub_8109CB0 -sub_8109CB0: @ 8109CB0 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08109CC8 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r4, 0x30] - adds r0, r1, 0x1 - strh r0, [r4, 0x2E] -_08109CC8: - movs r0, 0xC0 - lsls r0, 1 - adds r1, r0, 0 - ldrh r2, [r4, 0x34] - adds r1, r2 - strh r1, [r4, 0x34] - ldrh r0, [r4, 0x36] - adds r0, 0xA0 - strh r0, [r4, 0x36] - movs r2, 0x30 - ldrsh r0, [r4, r2] - lsls r1, 16 - asrs r1, 24 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x36] - lsls r1, 16 - asrs r1, 24 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x7 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _08109D64 - ldrh r0, [r4, 0x30] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x83 - bls _08109D3C - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - b _08109D80 - .pool -_08109D3C: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r4, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x5] - b _08109D80 - .pool -_08109D64: - ldrh r0, [r4, 0x30] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x83 - bls _08109D78 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1D - b _08109D7E -_08109D78: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1F -_08109D7E: - strb r0, [r1] -_08109D80: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _08109DA8 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_08109DA8: - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x1E - bne _08109DB6 - adds r0, r4, 0 - bl DestroyAnimSprite -_08109DB6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8109CB0 - - thumb_func_start sub_8109DBC -sub_8109DBC: @ 8109DBC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - movs r2, 0x1 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0 - bne _08109DE2 - movs r1, 0x1 -_08109DE2: - strh r1, [r4, 0x20] - ldr r0, =gBattleAnimTarget - ldrb r1, [r0] - movs r0, 0x2 - eors r0, r1 - bl IsBattlerSpriteVisible - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - strh r0, [r4, 0x22] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x24] - movs r0, 0x3 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x26] - ldr r0, =sub_8109E2C - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109DBC - - thumb_func_start sub_8109E2C -sub_8109E2C: @ 8109E2C - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r2, r0, r1 - movs r0, 0x8 - ldrsh r3, [r2, r0] - cmp r3, 0x1 - beq _08109EF4 - cmp r3, 0x1 - bgt _08109E54 - cmp r3, 0 - beq _08109E62 - b _0810A054 - .pool -_08109E54: - cmp r3, 0x2 - bne _08109E5A - b _08109F7C -_08109E5A: - cmp r3, 0x3 - bne _08109E60 - b _0810A010 -_08109E60: - b _0810A054 -_08109E62: - movs r1, 0x20 - ldrsh r0, [r2, r1] - lsls r0, 1 - ldrh r5, [r2, 0x1C] - adds r0, r5 - strh r0, [r2, 0x1C] - ldrh r0, [r2, 0xA] - adds r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08109E94 - strh r3, [r2, 0xA] - ldrh r0, [r2, 0xC] - adds r0, 0x1 - strh r0, [r2, 0xC] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08109E90 - movs r0, 0x2 - b _08109E92 -_08109E90: - ldr r0, =0x0000fffe -_08109E92: - strh r0, [r2, 0x1E] -_08109E94: - movs r1, 0 - strh r1, [r2, 0xE] - movs r7, 0x22 - ldrsh r0, [r2, r7] - cmp r1, r0 - bge _08109ED6 - ldr r4, =gSprites - adds r3, r2, 0 - adds r3, 0x8 -_08109EA6: - movs r1, 0xE - ldrsh r0, [r2, r1] - adds r0, 0xE - lsls r0, 1 - adds r0, r3, r0 - movs r5, 0 - ldrsh r0, [r0, r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r2, 0x1E] - ldrh r7, [r2, 0x1C] - adds r0, r7 - strh r0, [r1, 0x24] - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r5, 0x22 - ldrsh r1, [r2, r5] - cmp r0, r1 - blt _08109EA6 -_08109ED6: - ldrh r0, [r2, 0x1A] - adds r0, 0x1 - strh r0, [r2, 0x1A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - beq _08109EE6 - b _0810A054 -_08109EE6: - movs r0, 0 - strh r0, [r2, 0x1A] - b _0810A000 - .pool -_08109EF4: - ldrh r0, [r2, 0xA] - adds r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _08109F1C - movs r0, 0 - strh r0, [r2, 0xA] - ldrh r0, [r2, 0xC] - adds r0, 0x1 - strh r0, [r2, 0xC] - ands r0, r3 - lsls r0, 16 - cmp r0, 0 - beq _08109F18 - movs r0, 0x2 - b _08109F1A -_08109F18: - ldr r0, =0x0000fffe -_08109F1A: - strh r0, [r2, 0x1E] -_08109F1C: - movs r1, 0 - strh r1, [r2, 0xE] - movs r7, 0x22 - ldrsh r0, [r2, r7] - cmp r1, r0 - bge _08109F5E - ldr r4, =gSprites - adds r3, r2, 0 - adds r3, 0x8 -_08109F2E: - movs r1, 0xE - ldrsh r0, [r2, r1] - adds r0, 0xE - lsls r0, 1 - adds r0, r3, r0 - movs r5, 0 - ldrsh r0, [r0, r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r2, 0x1E] - ldrh r7, [r2, 0x1C] - adds r0, r7 - strh r0, [r1, 0x24] - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r5, 0x22 - ldrsh r1, [r2, r5] - cmp r0, r1 - blt _08109F2E -_08109F5E: - ldrh r0, [r2, 0x1A] - adds r0, 0x1 - strh r0, [r2, 0x1A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x60 - bne _0810A054 - movs r0, 0 - strh r0, [r2, 0x1A] - b _0810A000 - .pool -_08109F7C: - movs r7, 0x20 - ldrsh r1, [r2, r7] - lsls r1, 1 - ldrh r0, [r2, 0x1C] - subs r0, r1 - strh r0, [r2, 0x1C] - ldrh r0, [r2, 0xA] - adds r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08109FB0 - movs r0, 0 - strh r0, [r2, 0xA] - ldrh r0, [r2, 0xC] - adds r0, 0x1 - strh r0, [r2, 0xC] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08109FAC - strh r3, [r2, 0x1E] - b _08109FB0 -_08109FAC: - ldr r0, =0x0000fffe - strh r0, [r2, 0x1E] -_08109FB0: - movs r1, 0 - strh r1, [r2, 0xE] - movs r3, 0x22 - ldrsh r0, [r2, r3] - cmp r1, r0 - bge _08109FF2 - ldr r4, =gSprites - adds r3, r2, 0 - adds r3, 0x8 -_08109FC2: - movs r5, 0xE - ldrsh r0, [r2, r5] - adds r0, 0xE - lsls r0, 1 - adds r0, r3, r0 - movs r7, 0 - ldrsh r0, [r0, r7] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r2, 0x1E] - ldrh r5, [r2, 0x1C] - adds r0, r5 - strh r0, [r1, 0x24] - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r7, 0x22 - ldrsh r1, [r2, r7] - cmp r0, r1 - blt _08109FC2 -_08109FF2: - ldrh r0, [r2, 0x1A] - adds r0, 0x1 - strh r0, [r2, 0x1A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - bne _0810A054 -_0810A000: - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - b _0810A054 - .pool -_0810A010: - movs r1, 0 - strh r1, [r2, 0xE] - movs r3, 0x22 - ldrsh r0, [r2, r3] - cmp r1, r0 - bge _0810A04E - ldr r6, =gSprites - adds r3, r2, 0 - adds r3, 0x8 - movs r5, 0 -_0810A024: - movs r7, 0xE - ldrsh r0, [r2, r7] - adds r0, 0xE - lsls r0, 1 - adds r0, r3, r0 - movs r7, 0 - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r5, [r0, 0x24] - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r7, 0x22 - ldrsh r1, [r2, r7] - cmp r0, r1 - blt _0810A024 -_0810A04E: - adds r0, r4, 0 - bl DestroyAnimVisualTask -_0810A054: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8109E2C - - thumb_func_start AnimTask_BlendBackground -AnimTask_BlendBackground: @ 810A060 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r0, sp - bl sub_80A6B30 - mov r0, sp - ldrb r0, [r0, 0x8] - lsls r0, 4 - ldr r1, =gBattleAnimArgs - ldrb r2, [r1] - ldrh r3, [r1, 0x2] - movs r1, 0x10 - bl BlendPalette - adds r0, r4, 0 - bl DestroyAnimVisualTask - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_BlendBackground - - thumb_func_start sub_810A094 -sub_810A094: @ 810A094 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0x8 - ldrsh r0, [r2, r3] - mov r9, r1 - ldr r4, =gBattleAnimArgs - mov r8, r4 - cmp r0, 0 - bne _0810A0CA - ldrh r0, [r4] - strh r0, [r2, 0xA] - ldrh r0, [r4, 0x2] - strh r0, [r2, 0xC] - ldrh r0, [r4, 0x4] - strh r0, [r2, 0xE] - ldrh r0, [r4, 0x6] - strh r0, [r2, 0x10] -_0810A0CA: - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r6, [r0] - movs r5, 0x10 - ldrsh r0, [r2, r5] - cmp r0, 0 - bne _0810A100 - ldr r4, =gUnknown_08595684 - movs r1, 0x8 - ldrsh r0, [r2, r1] - b _0810A106 - .pool -_0810A100: - ldr r4, =gUnknown_08595694 - movs r3, 0x8 - ldrsh r0, [r2, r3] -_0810A106: - movs r1, 0xA - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - adds r0, r4 - ldrb r5, [r0] - lsls r0, r7, 2 - adds r1, r0, r7 - lsls r1, 3 - add r1, r9 - movs r4, 0xE - ldrsh r1, [r1, r4] - mov r12, r0 - cmp r1, 0x1 - bne _0810A154 - ldr r2, =gSprites - lsls r3, r6, 4 - adds r0, r3, r6 - lsls r0, 2 - adds r0, r2 - mov r10, r0 - mov r0, r8 - movs r4, 0x2 - ldrsh r1, [r0, r4] - lsls r0, r5, 24 - asrs r0, 24 - muls r0, r1 - cmp r0, 0 - bge _0810A144 - negs r0, r0 -_0810A144: - mov r5, r10 - strh r0, [r5, 0x26] - b _0810A16E - .pool -_0810A154: - ldr r3, =gSprites - lsls r4, r6, 4 - adds r2, r4, r6 - lsls r2, 2 - adds r2, r3 - lsls r0, r5, 24 - asrs r0, 24 - mov r5, r8 - ldrh r1, [r5, 0x2] - muls r0, r1 - strh r0, [r2, 0x24] - adds r2, r3, 0 - adds r3, r4, 0 -_0810A16E: - mov r1, r12 - adds r0, r1, r7 - lsls r0, 3 - add r0, r9 - movs r4, 0x8 - ldrsh r1, [r0, r4] - movs r5, 0xA - ldrsh r0, [r0, r5] - cmp r1, r0 - bne _0810A194 - adds r0, r3, r6 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x24] - strh r1, [r0, 0x26] - adds r0, r7, 0 - bl DestroyAnimVisualTask -_0810A194: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A094 - - .align 2, 0 diff --git a/asm/roulette_util.s b/asm/roulette_util.s deleted file mode 100644 index 61f6f67b1..000000000 --- a/asm/roulette_util.s +++ /dev/null @@ -1,1431 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8151678 -sub_8151678: @ 8151678 - push {lr} - movs r1, 0 - strb r1, [r0] - strh r1, [r0, 0x2] - adds r0, 0x4 - movs r2, 0xC0 - bl memset - pop {r0} - bx r0 - thumb_func_end sub_8151678 - - thumb_func_start sub_815168C -sub_815168C: @ 815168C - push {r4-r7,lr} - adds r3, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r6, 0xF - bhi _081516A8 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r5, r3, r0 - ldrb r7, [r5, 0x4] - lsrs r0, r7, 7 - cmp r0, 0 - beq _081516AC -_081516A8: - movs r0, 0xFF - b _0815170A -_081516AC: - ldrh r0, [r2] - movs r4, 0 - strh r0, [r5, 0x8] - ldrh r0, [r2, 0x2] - strh r0, [r5, 0xA] - ldrb r0, [r2, 0x4] - strb r0, [r5, 0xC] - ldrb r0, [r2, 0x5] - strb r0, [r5, 0xD] - ldrb r0, [r2, 0x6] - strb r0, [r5, 0xE] - ldrb r3, [r2, 0x7] - lsls r0, r3, 27 - lsrs r0, 27 - ldrb r2, [r5, 0xF] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - movs r0, 0x60 - ands r0, r3 - movs r2, 0x61 - negs r2, r2 - ands r1, r2 - orrs r1, r0 - lsls r3, 24 - asrs r3, 31 - lsls r3, 7 - movs r0, 0x7F - ands r1, r0 - orrs r1, r3 - strb r1, [r5, 0xF] - subs r0, 0xFF - ands r0, r7 - movs r2, 0x80 - orrs r0, r2 - strb r0, [r5, 0x4] - strb r4, [r5, 0x6] - strb r4, [r5, 0x5] - lsls r1, 24 - cmp r1, 0 - bge _08151704 - movs r0, 0xFF - b _08151706 -_08151704: - movs r0, 0x1 -_08151706: - strb r0, [r5, 0x7] - adds r0, r6, 0 -_0815170A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_815168C - - thumb_func_start sub_8151710 -sub_8151710: @ 8151710 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r4, r1, 0 - cmp r4, 0xF - bhi _0815173C - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r1, r2, r0 - ldrb r0, [r1, 0x4] - lsrs r0, 7 - cmp r0, 0 - beq _0815173C - adds r0, r1, 0x4 - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r4, 0 - b _0815173E -_0815173C: - movs r0, 0xFF -_0815173E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8151710 - - thumb_func_start sub_8151744 -sub_8151744: @ 8151744 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r5, r0, 0 - movs r0, 0 - mov r12, r0 - ldrb r1, [r5, 0x8] - cmp r12, r1 - bcc _0815175C - b _081518F4 -_0815175C: - movs r7, 0x1F - ldr r0, =0xfffffc1f - mov r10, r0 - movs r1, 0x7D - negs r1, r1 - mov r9, r1 - movs r0, 0x1F - mov r8, r0 -_0815176C: - ldrh r0, [r5, 0x6] - add r0, r12 - lsls r0, 1 - ldr r1, =gPlttBufferFaded - adds r3, r0, r1 - ldr r1, =gPlttBufferUnfaded - adds r6, r0, r1 - ldrb r0, [r5] - lsls r0, 25 - lsrs r0, 25 - cmp r0, 0x1 - beq _08151798 - cmp r0, 0x2 - beq _081517F6 - b _081518E2 - .pool -_08151798: - ldr r0, [r3] - lsls r2, r0, 27 - lsrs r0, r2, 27 - movs r1, 0x3 - ldrsb r1, [r5, r1] - adds r0, r1 - cmp r0, 0x1F - bhi _081517BA - lsrs r0, r2, 27 - adds r0, r1 - ands r0, r7 - ldrb r2, [r3] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] -_081517BA: - ldr r0, [r3] - lsls r2, r0, 22 - lsrs r0, r2, 27 - movs r1, 0x3 - ldrsb r1, [r5, r1] - adds r0, r1 - cmp r0, 0x1F - bhi _081517DE - lsrs r0, r2, 27 - adds r0, r1 - mov r1, r8 - ands r0, r1 - lsls r0, 5 - ldrh r2, [r3] - mov r1, r10 - ands r1, r2 - orrs r1, r0 - strh r1, [r3] -_081517DE: - ldr r0, [r3] - lsls r2, r0, 17 - lsrs r0, r2, 27 - movs r1, 0x3 - ldrsb r1, [r5, r1] - adds r0, r1 - cmp r0, 0x1F - bls _081517F0 - b _081518E2 -_081517F0: - lsrs r0, r2, 27 - adds r0, r1 - b _081518D4 -_081517F6: - movs r0, 0x3 - ldrsb r0, [r5, r0] - cmp r0, 0 - bge _08151868 - ldr r0, [r3] - lsls r4, r0, 27 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 27 - lsrs r0, 27 - cmp r1, r0 - blt _08151826 - lsrs r0, r4, 27 - adds r0, r2 - ands r0, r7 - ldrb r2, [r3] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] -_08151826: - ldr r0, [r3] - lsls r4, r0, 22 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 22 - lsrs r0, 27 - cmp r1, r0 - blt _08151850 - lsrs r0, r4, 27 - adds r0, r2 - mov r1, r8 - ands r0, r1 - lsls r0, 5 - ldrh r2, [r3] - mov r1, r10 - ands r1, r2 - orrs r1, r0 - strh r1, [r3] -_08151850: - ldr r0, [r3] - lsls r4, r0, 17 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 17 - lsrs r0, 27 - cmp r1, r0 - blt _081518E2 - b _081518D0 -_08151868: - ldr r0, [r3] - lsls r4, r0, 27 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 27 - lsrs r0, 27 - cmp r1, r0 - bgt _08151890 - lsrs r0, r4, 27 - adds r0, r2 - ands r0, r7 - ldrb r2, [r3] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] -_08151890: - ldr r0, [r3] - lsls r4, r0, 22 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 22 - lsrs r0, 27 - cmp r1, r0 - bgt _081518BA - lsrs r0, r4, 27 - adds r0, r2 - mov r1, r8 - ands r0, r1 - lsls r0, 5 - ldrh r2, [r3] - mov r1, r10 - ands r1, r2 - orrs r1, r0 - strh r1, [r3] -_081518BA: - ldr r0, [r3] - lsls r4, r0, 17 - lsrs r1, r4, 27 - movs r2, 0x3 - ldrsb r2, [r5, r2] - adds r1, r2 - ldr r0, [r6] - lsls r0, 17 - lsrs r0, 27 - cmp r1, r0 - bgt _081518E2 -_081518D0: - lsrs r0, r4, 27 - adds r0, r2 -_081518D4: - ands r0, r7 - lsls r0, 2 - ldrb r2, [r3, 0x1] - mov r1, r9 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] -_081518E2: - mov r0, r12 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - ldrb r0, [r5, 0x8] - cmp r12, r0 - bcs _081518F4 - b _0815176C -_081518F4: - ldrb r1, [r5, 0x2] - adds r0, r1, 0x1 - strb r0, [r5, 0x2] - ldrb r0, [r5, 0xB] - lsls r0, 27 - lsls r1, 24 - asrs r0, 3 - cmp r1, r0 - beq _0815190A - movs r0, 0 - b _0815193E -_0815190A: - movs r0, 0 - strb r0, [r5, 0x2] - movs r0, 0x3 - ldrsb r0, [r5, r0] - negs r0, r0 - strb r0, [r5, 0x3] - ldrb r2, [r5] - movs r1, 0x7F - movs r0, 0x7F - ands r0, r2 - cmp r0, 0x1 - bne _0815192A - lsls r0, r2, 25 - lsrs r0, 25 - adds r0, 0x1 - b _08151930 -_0815192A: - lsls r0, r2, 25 - lsrs r0, 25 - subs r0, 0x1 -_08151930: - ands r0, r1 - movs r1, 0x80 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r5] - movs r0, 0x1 -_0815193E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8151744 - - thumb_func_start sub_815194C -sub_815194C: @ 815194C - push {r4,r5,lr} - adds r3, r0, 0 - movs r2, 0 - ldrb r0, [r3] - lsls r0, 25 - lsrs r0, 25 - cmp r0, 0x1 - beq _08151962 - cmp r0, 0x2 - beq _08151990 - b _081519CA -_08151962: - ldrb r0, [r3, 0x8] - cmp r2, r0 - bcs _08151982 - ldr r4, =gPlttBufferFaded -_0815196A: - ldrh r0, [r3, 0x6] - adds r0, r2 - lsls r0, 1 - adds r0, r4 - ldrh r1, [r3, 0x4] - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r3, 0x8] - cmp r2, r0 - bcc _0815196A -_08151982: - ldrb r2, [r3] - lsls r1, r2, 25 - lsrs r1, 25 - adds r1, 0x1 - b _081519BC - .pool -_08151990: - ldrb r0, [r3, 0x8] - cmp r2, r0 - bcs _081519B4 - ldr r5, =gPlttBufferFaded - ldr r4, =gPlttBufferUnfaded -_0815199A: - ldrh r0, [r3, 0x6] - adds r0, r2 - lsls r0, 1 - adds r1, r0, r5 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r3, 0x8] - cmp r2, r0 - bcc _0815199A -_081519B4: - ldrb r2, [r3] - lsls r1, r2, 25 - lsrs r1, 25 - subs r1, 0x1 -_081519BC: - movs r0, 0x7F - ands r1, r0 - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_081519CA: - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_815194C - - thumb_func_start task_tutorial_controls_fadein -task_tutorial_controls_fadein: @ 81519DC - push {r4-r6,lr} - adds r4, r0, 0 - movs r5, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _08151A40 -_081519E8: - ldrh r0, [r4, 0x2] - asrs r0, r5 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08151A36 - lsls r1, r5, 1 - adds r0, r1, r5 - lsls r3, r0, 2 - adds r2, r4, r3 - ldrb r0, [r2, 0x5] - subs r0, 0x1 - strb r0, [r2, 0x5] - lsls r0, 24 - lsrs r0, 24 - adds r6, r1, 0 - cmp r0, 0xFF - bne _08151A36 - ldrh r0, [r2, 0x8] - movs r2, 0x80 - lsls r2, 8 - adds r1, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08151A24 - adds r0, r3, 0x4 - adds r0, r4, r0 - bl sub_8151744 - b _08151A2C -_08151A24: - adds r0, r3, 0x4 - adds r0, r4, r0 - bl sub_815194C -_08151A2C: - adds r0, r6, r5 - lsls r0, 2 - adds r0, r4, r0 - ldrb r1, [r0, 0xD] - strb r1, [r0, 0x5] -_08151A36: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xF - bls _081519E8 -_08151A40: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end task_tutorial_controls_fadein - - thumb_func_start sub_8151A48 -sub_8151A48: @ 8151A48 - push {r4-r7,lr} - adds r3, r0, 0 - lsls r1, 16 - lsrs r6, r1, 16 - movs r4, 0 - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - movs r5, 0x1 - movs r7, 0x80 - negs r7, r7 -_08151A5E: - adds r0, r6, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _08151A8C - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r2, r3, r0 - ldrb r0, [r2, 0x4] - lsrs r0, 7 - cmp r0, 0 - beq _08151A8C - adds r0, r5, 0 - lsls r0, r4 - ldrh r1, [r3, 0x2] - orrs r0, r1 - strh r0, [r3, 0x2] - ldrb r1, [r2, 0x4] - adds r0, r7, 0 - ands r0, r1 - orrs r0, r5 - strb r0, [r2, 0x4] -_08151A8C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _08151A5E - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8151A48 - - thumb_func_start sub_8151A9C -sub_8151A9C: @ 8151A9C - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - lsls r1, 16 - lsrs r7, r1, 16 - movs r5, 0 - movs r3, 0x1 -_08151AAA: - ldrh r0, [r6, 0x2] - asrs r0, r5 - ands r0, r3 - cmp r0, 0 - beq _08151B12 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r4, r6, r0 - ldrb r0, [r4, 0x4] - lsrs r0, 7 - cmp r0, 0 - beq _08151B12 - adds r0, r7, 0 - asrs r0, r5 - ands r0, r3 - cmp r0, 0 - beq _08151B12 - ldrh r1, [r4, 0xA] - lsls r1, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - ldrb r2, [r4, 0xC] - lsls r2, 1 - str r3, [sp] - bl memcpy - ldrb r0, [r4, 0x4] - movs r2, 0x80 - negs r2, r2 - adds r1, r2, 0 - ands r0, r1 - strb r0, [r4, 0x4] - movs r0, 0 - strb r0, [r4, 0x6] - strb r0, [r4, 0x5] - ldrb r0, [r4, 0xF] - lsls r0, 24 - ldr r3, [sp] - cmp r0, 0 - bge _08151B10 - movs r0, 0xFF - strb r0, [r4, 0x7] - b _08151B12 - .pool -_08151B10: - strb r3, [r4, 0x7] -_08151B12: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xF - bls _08151AAA - ldr r0, =0x0000ffff - cmp r7, r0 - bne _08151B2C - movs r0, 0 - strb r0, [r6] - b _08151B30 - .pool -_08151B2C: - ldrh r0, [r6, 0x2] - bics r0, r7 -_08151B30: - strh r0, [r6, 0x2] - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8151A9C - - thumb_func_start sub_8151B3C -sub_8151B3C: @ 8151B3C - push {r4,r5,lr} - adds r5, r0, 0 - movs r4, 0 - strh r4, [r5] - adds r0, r5, 0x4 - movs r1, 0 - movs r2, 0xC0 - bl memset -_08151B4E: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r5, r0 - strb r4, [r0, 0x4] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _08151B4E - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8151B3C - - thumb_func_start sub_8151B68 -sub_8151B68: @ 8151B68 - push {r4,r5,lr} - adds r2, r0, 0 - adds r5, r1, 0 - movs r3, 0 - movs r4, 0 - ldrb r0, [r2, 0x5] - lsrs r0, 7 - cmp r0, 0 - bne _08151B7E - adds r4, r2, 0x4 - b _08151B9C -_08151B7E: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xF - bhi _08151B9C - lsls r0, r3, 1 - adds r0, r3 - lsls r1, r0, 2 - adds r0, r2, r1 - ldrb r0, [r0, 0x5] - lsrs r0, 7 - cmp r0, 0 - bne _08151B7E - adds r0, r1, 0x4 - adds r4, r2, r0 -_08151B9C: - cmp r4, 0 - beq _08151BCA - ldrb r1, [r4, 0x1] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - movs r1, 0x80 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0 - strb r0, [r4, 0x2] - strb r0, [r4, 0x3] - adds r1, r4, 0x4 - adds r0, r5, 0 - ldm r0!, {r2,r4} - stm r1!, {r2,r4} - adds r0, r3, 0 - b _08151BCC -_08151BCA: - movs r0, 0xFF -_08151BCC: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8151B68 - - thumb_func_start sub_8151BD4 -sub_8151BD4: @ 8151BD4 - push {r4,r5,lr} - adds r4, r0, 0 - ldrb r1, [r4, 0x1] - movs r2, 0x40 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08151C16 - ldrb r1, [r4, 0xB] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08151C16 - ldrh r2, [r4, 0x6] - ldrb r0, [r4, 0x8] - adds r0, r2, r0 - cmp r2, r0 - bge _08151C16 - ldr r5, =gPlttBufferFaded - ldr r3, =gPlttBufferUnfaded -_08151BFC: - lsls r0, r2, 1 - adds r1, r0, r5 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r4, 0x6] - ldrb r1, [r4, 0x8] - adds r0, r1 - cmp r2, r0 - blt _08151BFC -_08151C16: - adds r0, r4, 0x4 - movs r1, 0 - movs r2, 0x8 - bl memset - ldrb r1, [r4, 0x1] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - subs r1, 0x10 - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - movs r1, 0x7F - ands r0, r1 - strb r0, [r4, 0x1] - movs r0, 0 - strb r0, [r4, 0x3] - strb r0, [r4, 0x2] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8151BD4 - - thumb_func_start sub_8151C50 -sub_8151C50: @ 8151C50 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 24 - movs r5, 0 - cmp r2, 0 - bne _08151C74 - movs r1, 0xF - ands r1, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, 0x4 - adds r0, r6, r0 - bl sub_8151BD4 - b _08151CA0 -_08151C74: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08151C94 - lsls r0, r5, 1 - adds r0, r5 - lsls r1, r0, 2 - adds r0, r6, r1 - ldrb r0, [r0, 0x5] - lsrs r0, 7 - cmp r0, 0 - beq _08151C94 - adds r0, r1, 0x4 - adds r0, r6, r0 - bl sub_8151BD4 -_08151C94: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0xF - bls _08151C74 -_08151CA0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8151C50 - - thumb_func_start sub_8151CA8 -sub_8151CA8: @ 8151CA8 - push {r4-r7,lr} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 24 - movs r3, 0 - cmp r2, 0 - bne _08151CDC - movs r0, 0xF - adds r3, r0, 0 - ands r3, r4 - lsls r1, r3, 1 - adds r1, r3 - lsls r1, 2 - adds r1, r5, r1 - ldrb r2, [r1, 0x5] - movs r0, 0x41 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - movs r0, 0x1 - lsls r0, r3 - ldrh r1, [r5] - orrs r0, r1 - strh r0, [r5] - b _08151D20 -_08151CDC: - movs r6, 0x1 - movs r7, 0x41 - negs r7, r7 -_08151CE2: - adds r0, r4, 0 - ands r0, r6 - cmp r0, 0 - beq _08151D00 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r5, r0 - ldrb r1, [r2, 0x5] - lsrs r0, r1, 7 - cmp r0, 0 - beq _08151D00 - lsls r0, r1, 25 - cmp r0, 0 - blt _08151D06 -_08151D00: - lsls r0, r4, 17 - lsrs r4, r0, 16 - b _08151D16 -_08151D06: - adds r0, r7, 0 - ands r0, r1 - strb r0, [r2, 0x5] - adds r0, r6, 0 - lsls r0, r3 - ldrh r1, [r5] - orrs r0, r1 - strh r0, [r5] -_08151D16: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xF - bls _08151CE2 -_08151D20: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8151CA8 - - thumb_func_start sub_8151D28 -sub_8151D28: @ 8151D28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 24 - movs r0, 0 - mov r12, r0 - cmp r2, 0 - bne _08151DB0 - movs r1, 0xF - ands r1, r7 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, 0x4 - mov r1, r8 - adds r3, r1, r0 - ldrb r1, [r3, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _08151E3A - ldrb r1, [r3, 0xB] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08151D8E - ldrh r2, [r3, 0x6] - ldrb r0, [r3, 0x8] - adds r0, r2, r0 - cmp r2, r0 - bge _08151D8E - ldr r5, =gPlttBufferFaded - ldr r4, =gPlttBufferUnfaded -_08151D74: - lsls r0, r2, 1 - adds r1, r0, r5 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r3, 0x6] - ldrb r1, [r3, 0x8] - adds r0, r1 - cmp r2, r0 - blt _08151D74 -_08151D8E: - ldrb r0, [r3, 0x1] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r3, 0x1] - movs r1, 0x1 - mov r2, r12 - lsls r1, r2 - mov r2, r8 - ldrh r0, [r2] - bics r0, r1 - strh r0, [r2] - b _08151E3A - .pool -_08151DB0: - movs r0, 0x1 - mov r9, r0 - movs r1, 0x40 - mov r10, r1 -_08151DB8: - mov r2, r12 - lsls r0, r2, 1 - add r0, r12 - lsls r0, 2 - adds r0, 0x4 - mov r1, r8 - adds r3, r1, r0 - adds r0, r7, 0 - mov r2, r9 - ands r0, r2 - cmp r0, 0 - beq _08151DDA - ldrb r1, [r3, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - beq _08151DE4 -_08151DDA: - lsls r0, r7, 17 - lsrs r7, r0, 16 - mov r5, r12 - adds r5, 0x1 - b _08151E30 -_08151DE4: - ldrb r1, [r3, 0xB] - mov r0, r10 - ands r0, r1 - mov r5, r12 - adds r5, 0x1 - cmp r0, 0 - beq _08151E1A - ldrh r2, [r3, 0x6] - ldrb r0, [r3, 0x8] - adds r0, r2, r0 - cmp r2, r0 - bge _08151E1A - ldr r6, =gPlttBufferFaded - ldr r4, =gPlttBufferUnfaded -_08151E00: - lsls r0, r2, 1 - adds r1, r0, r6 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r3, 0x6] - ldrb r1, [r3, 0x8] - adds r0, r1 - cmp r2, r0 - blt _08151E00 -_08151E1A: - ldrb r1, [r3, 0x1] - mov r0, r10 - orrs r0, r1 - strb r0, [r3, 0x1] - mov r1, r9 - mov r0, r12 - lsls r1, r0 - mov r2, r8 - ldrh r0, [r2] - bics r0, r1 - strh r0, [r2] -_08151E30: - lsls r0, r5, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0xF - bls _08151DB8 -_08151E3A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8151D28 - - thumb_func_start sub_8151E50 -sub_8151E50: @ 8151E50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - str r0, [sp] - movs r0, 0 - mov r10, r0 - ldr r1, [sp] - ldrh r0, [r1] - cmp r0, 0 - bne _08151E6C - b _08151FF6 -_08151E6C: - movs r2, 0xF - mov r9, r2 - movs r3, 0x10 - negs r3, r3 - mov r8, r3 - movs r7, 0x1 -_08151E78: - mov r5, r10 - lsls r0, r5, 1 - add r0, r10 - lsls r0, 2 - adds r0, 0x4 - ldr r1, [sp] - adds r4, r1, r0 - ldrb r2, [r4, 0x1] - movs r3, 0xC0 - ands r3, r2 - cmp r3, 0x80 - beq _08151E92 - b _08151FE6 -_08151E92: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08151EA8 - ldrb r0, [r4, 0xB] - ands r3, r0 - cmp r3, 0 - beq _08151EA8 - b _08151FE6 -_08151EA8: - ldrb r0, [r4, 0x2] - subs r0, 0x1 - strb r0, [r4, 0x2] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08151EB8 - b _08151FE6 -_08151EB8: - ldrb r0, [r4, 0x9] - strb r0, [r4, 0x2] - ldrh r0, [r4, 0x6] - ldrb r1, [r4, 0x8] - lsls r2, 28 - lsrs r2, 28 - ldrh r3, [r4, 0x4] - bl BlendPalette - ldrb r5, [r4, 0xB] - lsls r0, r5, 26 - asrs r0, 30 - cmp r0, 0x1 - beq _08151F16 - cmp r0, 0x1 - bgt _08151EE4 - cmp r0, 0 - beq _08151EEA - b _08151FD0 - .pool -_08151EE4: - cmp r0, 0x2 - beq _08151F92 - b _08151FD0 -_08151EEA: - ldrb r2, [r4, 0x1] - lsls r1, r2, 28 - lsrs r0, r1, 28 - adds r0, 0x1 - mov r3, r9 - ands r0, r3 - mov r6, r8 - adds r3, r6, 0 - ands r3, r2 - orrs r3, r0 - strb r3, [r4, 0x1] - lsrs r1, 28 - lsls r0, r5, 28 - asrs r0, 28 - cmp r1, r0 - bne _08151FD0 - ldrb r0, [r4, 0x3] - adds r0, 0x1 - strb r0, [r4, 0x3] - ands r3, r6 - strb r3, [r4, 0x1] - b _08151FD0 -_08151F16: - ldrb r3, [r4, 0x1] - movs r0, 0x10 - ands r0, r3 - cmp r0, 0 - beq _08151F54 - lsls r0, r3, 28 - lsrs r0, 28 - subs r0, 0x1 - mov r5, r9 - ands r0, r5 - mov r2, r8 - ands r2, r3 - orrs r2, r0 - strb r2, [r4, 0x1] - cmp r0, 0 - bne _08151FD0 - ldrb r0, [r4, 0x3] - adds r0, 0x1 - strb r0, [r4, 0x3] - lsls r0, r2, 27 - lsrs r0, 31 - eors r0, r7 - ands r0, r7 - lsls r0, 4 - movs r3, 0x11 - negs r3, r3 - adds r1, r3, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r4, 0x1] - b _08151FD0 -_08151F54: - lsls r0, r5, 28 - asrs r0, 28 - subs r0, 0x1 - mov r5, r9 - ands r0, r5 - lsls r2, r3, 28 - lsrs r1, r2, 28 - adds r1, 0x1 - ands r1, r5 - mov r5, r8 - ands r3, r5 - orrs r3, r1 - strb r3, [r4, 0x1] - lsrs r2, 28 - cmp r2, r0 - bne _08151FD0 - ldrb r0, [r4, 0x3] - adds r0, 0x1 - strb r0, [r4, 0x3] - lsls r0, r3, 27 - lsrs r0, 31 - eors r0, r7 - ands r0, r7 - lsls r0, 4 - movs r2, 0x11 - negs r2, r2 - adds r1, r2, 0 - ands r3, r1 - orrs r3, r0 - strb r3, [r4, 0x1] - b _08151FD0 -_08151F92: - ldrb r2, [r4, 0x1] - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _08151FA2 - mov r0, r8 - ands r0, r2 - b _08151FB0 -_08151FA2: - lsls r1, r5, 28 - asrs r1, 28 - mov r3, r9 - ands r1, r3 - mov r0, r8 - ands r0, r2 - orrs r0, r1 -_08151FB0: - strb r0, [r4, 0x1] - ldrb r2, [r4, 0x1] - lsls r0, r2, 27 - lsrs r0, 31 - eors r0, r7 - ands r0, r7 - lsls r0, 4 - movs r5, 0x11 - negs r5, r5 - adds r1, r5, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r4, 0x1] - ldrb r0, [r4, 0x3] - adds r0, 0x1 - strb r0, [r4, 0x3] -_08151FD0: - ldrb r1, [r4, 0xA] - cmp r1, 0xFF - beq _08151FE6 - ldrb r0, [r4, 0x3] - cmp r0, r1 - bne _08151FE6 - ldrb r1, [r4] - ldr r0, [sp] - movs r2, 0 - bl sub_8151D28 -_08151FE6: - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0xF - bhi _08151FF6 - b _08151E78 -_08151FF6: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8151E50 - - thumb_func_start sub_8152008 -sub_8152008: @ 8152008 - push {r4-r7,lr} - adds r6, r0, 0 - ldr r0, [sp, 0x14] - ldr r4, [sp, 0x18] - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - lsrs r3, 19 - adds r3, r2 - lsls r3, 1 - adds r6, r3 - cmp r1, r4 - bcs _08152052 -_08152030: - lsls r0, r1, 6 - adds r2, r6, r0 - movs r0, 0 - adds r3, r1, 0x1 - cmp r0, r5 - bcs _0815204A -_0815203C: - strh r7, [r2] - adds r2, 0x2 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, r5 - bcc _0815203C -_0815204A: - lsls r0, r3, 24 - lsrs r1, r0, 24 - cmp r1, r4 - bcc _08152030 -_08152052: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8152008 - - thumb_func_start sub_8152058 -sub_8152058: @ 8152058 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, [sp, 0x14] - ldr r4, [sp, 0x18] - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r6, r4, 24 - movs r4, 0 - lsrs r3, 19 - adds r3, r2 - lsls r3, 1 - adds r7, r3 - cmp r4, r6 - bcs _081520A2 -_0815207C: - lsls r0, r4, 6 - adds r2, r7, r0 - movs r3, 0 - adds r4, 0x1 - cmp r3, r5 - bcs _0815209A -_08152088: - ldrh r0, [r1] - strh r0, [r2] - adds r1, 0x2 - adds r2, 0x2 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, r5 - bcc _08152088 -_0815209A: - lsls r0, r4, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _0815207C -_081520A2: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8152058 - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle_anim.h b/include/battle_anim.h index c3601bbd9..8d73ea9b3 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -3,6 +3,7 @@ #include "battle.h" #include "constants/battle_anim.h" +#include "task.h" enum { @@ -124,6 +125,11 @@ void sub_80A6D60(struct UnknownAnimStruct2*, const void*, u32); void sub_80A6CC0(u32, const void*, u32); void sub_80A6DAC(bool8); void sub_80A634C(struct Sprite *); +void sub_80A653C(struct Sprite *); +void sub_80A7E6C(u8 spriteId); +void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); +u8 sub_80A80C8(struct Task *task); +void sub_80A8EE4(struct Sprite *); enum { diff --git a/include/roulette.h b/include/roulette.h new file mode 100755 index 000000000..71100d0d3 --- /dev/null +++ b/include/roulette.h @@ -0,0 +1,34 @@ +#ifndef GUARD_ROULETTE_H +#define GUARD_ROULETTE_H + +struct UnkStruct1 +{ + u16 var00; + u16 var02; + u8 var04; + u8 var05; + u8 var06; + s8 var07_0:5; + s8 var07_5:2; + s8 var07_7:1; +}; + +struct UnkStruct3 +{ + u8 var00_0:7; + u8 var00_7:1; + u8 var01; + s8 var02; + s8 var03; + struct UnkStruct1 var04; +}; + +struct UnkStruct0 +{ + u8 var00; + u8 var01; + u16 var02; //flag for each UnkStruct3 + struct UnkStruct3 var04[0x10]; +}; + +#endif // GUARD_ROULETTE_H diff --git a/include/roulette_util.h b/include/roulette_util.h index f59c4e44c..964f551fe 100644 --- a/include/roulette_util.h +++ b/include/roulette_util.h @@ -1,17 +1,46 @@ #ifndef GUARD_ROULETTE_UTIL_H #define GUARD_ROULETTE_UTIL_H +struct InnerStruct203CF18_3 +{ + u16 unk0; + u16 unk2; + u8 unk4; + u8 unk5; + u8 unk6; + s8 unk7_0:4; + s8 unk7_4:2; + s8 unk7_6:1; + s8 unk7_7:1; +}; + +struct InnerStruct203CF18_2 +{ + u8 unk0; + u8 unk1_0:4; + u8 unk1_4:1; + s8 unk1_5:1; + s8 unk1_6:1; + u32 unk1_7:1; + u8 unk2; + u8 unk3; + struct InnerStruct203CF18_3 unk4; +}; + // structures struct InnerStruct203CF18 { - u8 filler[0xC4]; + u16 unk0; + struct InnerStruct203CF18_2 unk4[16]; }; -void sub_8151B68(struct InnerStruct203CF18 *, const u8*); +int sub_8151B68(struct InnerStruct203CF18 *, const struct InnerStruct203CF18_3 *); void sub_8151B3C(struct InnerStruct203CF18 *); -void sub_8151CA8(struct InnerStruct203CF18 *, u8, u8); -void sub_8151C50(struct InnerStruct203CF18 *, u8, u8); -void sub_8151D28(struct InnerStruct203CF18 *, u8, u8); +void sub_8151CA8(struct InnerStruct203CF18 *, u16, u8); +void sub_8151C50(struct InnerStruct203CF18 *, u16, u8); +void sub_8151D28(struct InnerStruct203CF18 *, u16, u8); void sub_8151E50(struct InnerStruct203CF18 *); +void sub_8152008(u16 *dest, u16 src, u8 left, u8 top, u8 width, u8 height); +void sub_8152058(u16 *dest, u16 *src, u8 left, u8 top, u8 width, u8 height); #endif // GUARD_ROULETTE_UTIL_H diff --git a/include/strings.h b/include/strings.h index 22d12aa18..e17ea8646 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1034,7 +1034,7 @@ extern const u8 gText_DexSortAtoZDescription[]; extern const u8 gText_DexSortHeaviestDescription[]; extern const u8 gText_DexSortLightestDescription[]; extern const u8 gText_DexSortTallestDescription[]; -extern const u8 ggText_DexSortSmallestDescription[]; +extern const u8 gText_DexSortSmallestDescription[]; extern const u8 gText_DexEmptyString[]; extern const u8 gText_DexSearchDontSpecify[]; extern const u8 gText_DexSearchTypeNone[]; diff --git a/ld_script.txt b/ld_script.txt index ef41a20fc..d5e6efc4f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -161,7 +161,7 @@ SECTIONS { asm/battle_anim_effects_1.o(.text); asm/battle_anim_effects_2.o(.text); asm/water.o(.text); - asm/fire.o(.text); + src/fire.o(.text); asm/electric.o(.text); asm/ice.o(.text); src/fight.o(.text); @@ -217,7 +217,7 @@ SECTIONS { src/battle_message.o(.text); asm/cable_car.o(.text); src/math_util.o(.text); - asm/roulette_util.o(.text); + src/roulette_util.o(.text); src/rom_81520A8.o(.text); src/save.o(.text); src/mystery_event_script.o(.text); diff --git a/src/fire.c b/src/fire.c index 02c0db81c..c054f154e 100644 --- a/src/fire.c +++ b/src/fire.c @@ -1,24 +1,43 @@ #include "global.h" #include "battle_anim.h" #include "constants/rgb.h" +#include "constants/songs.h" +#include "sound.h" +#include "util.h" +#include "task.h" +#include "trig.h" -extern void sub_8108EC8(struct Sprite *); -extern void sub_8108F08(struct Sprite *); -extern void sub_8108FBC(struct Sprite *); -extern void sub_8108F4C(struct Sprite *); -extern void sub_8109064(struct Sprite *); -extern void sub_810916C(struct Sprite *); -extern void TranslateAnimSpriteToTargetMonLocation(struct Sprite *); -extern void sub_8109198(struct Sprite *); -extern void sub_8109200(struct Sprite *); -extern void sub_810921C(struct Sprite *); -extern void sub_8109364(struct Sprite *); -extern void sub_81093A4(struct Sprite *); -extern void sub_80A8EE4(struct Sprite *); -extern void sub_81098EC(struct Sprite *); -extern void sub_8109A10(struct Sprite *); -extern void sub_8109AFC(struct Sprite *); -extern void sub_8109CB0(struct Sprite *); +static void sub_8108EC8(struct Sprite *); +static void sub_8108F08(struct Sprite *); +static void sub_8108F4C(struct Sprite *); +static void sub_8108FBC(struct Sprite *); +static void sub_8109028(struct Sprite *); +static void sub_8109064(struct Sprite *); +static void sub_81090D8(struct Sprite *); +static void sub_810916C(struct Sprite *); +static void AnimEmberFlare(struct Sprite *); +static void sub_8109200(struct Sprite *); +static void AnimFireRing(struct Sprite *); +static void AnimFireRingStep1(struct Sprite *); +static void AnimFireRingStep2(struct Sprite *); +static void AnimFireRingStep3(struct Sprite *); +static void UpdateFireRingCircleOffset(struct Sprite *); +static void AnimFireCross(struct Sprite *); +static void sub_81093A4(struct Sprite *); +static void sub_81093E4(struct Sprite *); +static void sub_810940C(struct Sprite *); +static void sub_81094D0(u8 taskId); +static void sub_81097B4(u8 spriteId, u8 taskId, u8 a3); +static void sub_81098EC(struct Sprite *); +static u16 sub_8109930(u8 spriteId); +static void sub_8109984(struct Sprite *sprite, s16 x, s16 y); +static void sub_81099A0(struct Sprite *); +static void sub_8109A10(struct Sprite *); +static void sub_8109A64(struct Sprite *); +static void sub_8109AFC(struct Sprite *); +static void sub_8109C4C(struct Sprite *); +static void sub_8109CB0(struct Sprite *); +static void sub_8109E2C(u8 taskId); const union AnimCmd gUnknown_08595340[] = { @@ -234,7 +253,7 @@ const struct SpriteTemplate gEmberFlareSpriteTemplate = .anims = gUnknown_085954D0, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8109198, + .callback = AnimEmberFlare, }; const struct SpriteTemplate gUnknown_08595504 = @@ -256,7 +275,7 @@ const struct SpriteTemplate gUnknown_0859551C = .anims = gUnknown_085954D0, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810921C, + .callback = AnimFireRing, }; const union AnimCmd gUnknown_08595534[] = @@ -297,7 +316,7 @@ const struct SpriteTemplate gUnknown_0859556C = .anims = gUnknown_08595540, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8109364, + .callback = AnimFireCross, }; const struct SpriteTemplate gBattleAnimSpriteTemplate_8595584 = @@ -436,3 +455,867 @@ const s8 gUnknown_08595694[16] = { -1, 0, 1, 0, -1, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1, }; + +static void sub_8108EC8(struct Sprite *sprite) +{ + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = 0x3C; + sprite->data[2] = 0x9; + sprite->data[3] = 0x1E; + sprite->data[4] = 0xFE00; + + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + + sprite->callback = sub_80A634C; + sprite->callback(sprite); +} + +static void sub_8108F08(struct Sprite *sprite) +{ + sub_80A6864(sprite, gBattleAnimArgs[0]); + + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[2] = gBattleAnimArgs[3]; + + sprite->callback = sub_80A656C; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +static void sub_8108F4C(struct Sprite *sprite) +{ + sub_80A6838(sprite); + + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[2] = -gBattleAnimArgs[4]; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[2] = gBattleAnimArgs[4]; + } + + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[4] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[5]; + + sprite->callback = sub_8109028; +} + +static void sub_8108FBC(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[2] = gBattleAnimArgs[4]; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[2] = -gBattleAnimArgs[4]; + } + + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[4] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[5]; + + sprite->callback = sub_8109028; +} + +static void sub_8109028(struct Sprite *sprite) +{ + if (++sprite->data[0] < sprite->data[4]) + { + sprite->pos2.x += sprite->data[2]; + sprite->pos2.y += sprite->data[3]; + } + + if (sprite->data[0] == sprite->data[1]) + move_anim_8074EE0(sprite); +} + +static void sub_8109064(struct Sprite *sprite) +{ + sub_80A6838(sprite); + + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->subpriority = 8; + } + + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[2] = gBattleAnimArgs[4]; + sprite->data[3] = gBattleAnimArgs[5]; + sprite->data[4] = gBattleAnimArgs[6]; + sprite->data[5] = 0; + + sprite->callback = sub_81090D8; +} + +static void sub_81090D8(struct Sprite *sprite) +{ + if (sprite->data[3]) + { + if(sprite->data[5] > 10000) + sprite->subpriority = 1; + + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1] + (sprite->data[5] >> 8)); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[1] + (sprite->data[5] >> 8)); + + sprite->data[0] += sprite->data[2]; + sprite->data[5] += sprite->data[4]; + + if (sprite->data[0] > 255) + sprite->data[0] -= 256; + else if (sprite->data[0] < 0) + sprite->data[0] += 256; + + sprite->data[3]--; + } + else + { + move_anim_8074EE0(sprite); + } +} + +//sunlight +static void sub_810916C(struct Sprite *sprite) +{ + sprite->pos1.x = 0; + sprite->pos1.y = 0; + sprite->data[0] = 60; + sprite->data[2] = 140; + sprite->data[4] = 80; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +//fire 2 + +// Animates the secondary effect of MOVE_EMBER, where the flames grow and slide +// horizontally a bit. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: target x pixel offset +// arg 3: target y pixel offset +// arg 4: duration +// arg 5: ? (todo: something related to which mon the pixel offsets are based on) +// arg 6: ? (todo: something related to which mon the pixel offsets are based on) +static void AnimEmberFlare(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget) + && (gBattleAnimAttacker == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) + || gBattleAnimAttacker == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->callback = sub_80A7938; + sprite->callback(sprite); +} + +static void sub_8109200(struct Sprite *sprite) +{ + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->callback = sub_80A7938; +} + +// Animates the a fire sprite in the first-half of the MOVE_FIRE_BLAST +// animation. The fire sprite first moves in a circle around the mon, +// and then it is translated towards the target mon, while still rotating. +// Lastly, it moves in a circle around the target mon. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: initial wave offset +//void AnimFireRing(struct Sprite *sprite) +void AnimFireRing(struct Sprite *sprite) +{ + InitAnimSpritePos(sprite, 1); + + sprite->data[7] = gBattleAnimArgs[2]; + sprite->data[0] = 0; + + sprite->callback = AnimFireRingStep1; +} + +static void AnimFireRingStep1(struct Sprite *sprite) +{ + UpdateFireRingCircleOffset(sprite); + + if (++sprite->data[0] == 0x12) + { + sprite->data[0] = 0x19; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + + InitAnimLinearTranslation(sprite); + + sprite->callback = AnimFireRingStep2; + } +} + +static void AnimFireRingStep2(struct Sprite *sprite) +{ + if (TranslateAnimLinear(sprite)) + { + sprite->data[0] = 0; + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->pos2.y = 0; + sprite->pos2.x = 0; + + sprite->callback = AnimFireRingStep3; + sprite->callback(sprite); + } + else + { + sprite->pos2.x += Sin(sprite->data[7], 28); + sprite->pos2.y += Cos(sprite->data[7], 28); + + sprite->data[7] = (sprite->data[7] + 20) & 0xFF; + } +} + +static void AnimFireRingStep3(struct Sprite *sprite) +{ + UpdateFireRingCircleOffset(sprite); + + if (++sprite->data[0] == 0x1F) + DestroyAnimSprite(sprite); +} + +static void UpdateFireRingCircleOffset(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[7], 28); + sprite->pos2.y = Cos(sprite->data[7], 28); + + sprite->data[7] = (sprite->data[7] + 20) & 0xFF; +} + +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: duration +// arg 3: x delta +// arg 4: y delta +// AnimFireCross(struct Sprite *sprite) +static void AnimFireCross(struct Sprite *sprite) +{ + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[2] = gBattleAnimArgs[4]; + + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + + sprite->callback = sub_80A653C; //TranslateSpriteOverDuration +} + +static void sub_81093A4(struct Sprite *sprite) +{ + InitAnimSpritePos(sprite, 1); + + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[0] = gBattleAnimArgs[3]; + + sprite->invisible = TRUE; + sprite->callback = WaitAnimForDuration; + + StoreSpriteCallbackInData6(sprite, sub_81093E4); +} + +static void sub_81093E4(struct Sprite *sprite) +{ + sprite->invisible = FALSE; + + sprite->data[0] = sprite->data[1]; + sprite->data[1] = 0; + + sprite->callback = sub_810940C; + sprite->callback(sprite); +} + +static void sub_810940C(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[1], sprite->data[2] >> 8); + sprite->pos2.y = Cos(sprite->data[1], sprite->data[2] >> 8); + + sprite->data[1] = (sprite->data[1] + 10) & 0xFF; + sprite->data[2] += 0xD0; + + if (--sprite->data[0] == -1) + DestroyAnimSprite(sprite); +} + +void sub_8109460(u8 taskId) // initialize animation task for Move_ERUPTION? +{ + struct Task *task = &gTasks[taskId]; + + task->data[15] = GetAnimBattlerSpriteId(0); + + task->data[0] = 0; + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = 0; + task->data[4] = gSprites[task->data[15]].pos1.y; + task->data[5] = GetBattlerSide(gBattleAnimAttacker); + task->data[6] = 0; + + sub_80A7270(task->data[15], 0); + + task->func = sub_81094D0; +} + +static void sub_81094D0(u8 taskId) // animate Move_ERUPTION? +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + sub_80A805C(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 0x20); + + task->data[0]++; + case 1: + if (++task->data[1] > 1) + { + task->data[1] = 0; + + if (++task->data[2] & 0x1) + gSprites[task->data[15]].pos2.x = 3; + else + gSprites[task->data[15]].pos2.x = -3; + } + + if (task->data[5]) + { + if (++task->data[3] > 4) + { + task->data[3] = 0; + gSprites[task->data[15]].pos1.y++; + } + } + + if(!sub_80A80C8(task)) + { + sub_80A7E6C(task->data[15]); + gSprites[task->data[15]].pos2.x = 0; + + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = 0; + task->data[0]++; + } + break; + case 2: + if (++task->data[1] > 4) + { + if (task->data[5]) + sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 0x6); + else + sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 0x6); + + task->data[1] = 0; + task->data[0]++; + } + break; + case 3: + if (!sub_80A80C8(task)) + { + sub_81097B4(task->data[15], taskId, 6); + + task->data[0]++; + } + break; + case 4: + if (++task->data[1] > 1) + { + task->data[1] = 0; + + if (++task->data[2] & 1) + gSprites[task->data[15]].pos2.y += 3; + else + gSprites[task->data[15]].pos2.y -= 3; + } + + if (++task->data[3] > 0x18) + { + if (task->data[5]) + sub_80A805C(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 0x8); + else + sub_80A805C(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 0x8); + + if (task->data[2] & 1) + gSprites[task->data[15]].pos2.y -= 3; + + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = 0; + task->data[0]++; + } + break; + case 5: + if (task->data[5]) + gSprites[task->data[15]].pos1.y--; + + if (!sub_80A80C8(task)) + { + gSprites[task->data[15]].pos1.y = task->data[4]; + sub_80A7344(task->data[15]); + + task->data[2] = 0; + task->data[0]++; + } + break; + case 6: + if (!task->data[6]) + DestroyAnimVisualTask(taskId); + + break; + default: + } +} + +static void sub_81097B4(u8 spriteId, u8 taskId, u8 a3) +{ + u16 i, j; + s8 sign; + + u16 y = sub_8109930(spriteId); + u16 x = gSprites[spriteId].pos1.x; + + if(!GetBattlerSide(gBattleAnimAttacker)) + { + x -= 0xC; + sign = 1; + } + else + { + x += 0x10; + sign = -1; + } + + for (i = 0, j = 0; i <= 6; i++) + { + u8 spriteId = CreateSprite(&gUnknown_085955B4, x, y, 2); + + if (spriteId != 0x40) + { + gSprites[spriteId].oam.tileNum += j * 4 + 0x40; + + if (++j >= 5) + j = 0; + //gHeatedRockCoords + sub_8109984(&gSprites[spriteId], gUnknown_085955CC[i][0] * sign, gUnknown_085955CC[i][1]); + gSprites[spriteId].data[6] = taskId; + gSprites[spriteId].data[7] = a3; + + gTasks[taskId].data[a3]++; + } + } +} + +static void sub_81098EC(struct Sprite *sprite) +{ + sub_81099A0(sprite); + + if (sprite->invisible) + { + gTasks[sprite->data[6]].data[sprite->data[7]]--; + DestroySprite(sprite); + } +} + +static u16 sub_8109930(u8 spriteId) +{ + u16 var1 = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY; + + if (GetBattlerSide(gBattleAnimAttacker) == 0) + { + var1 = ((var1 << 16) + 0x4A0000) >> 16; + } + else + { + var1 = ((var1 << 16) + 0x2C0000) >> 16; + } + + return var1; +} + +static void sub_8109984(struct Sprite *sprite, s16 x, s16 y) +{ + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->data[2] = (u16)sprite->pos1.x * 8; + sprite->data[3] = (u16)sprite->pos1.y * 8; + sprite->data[4] = x * 8; + sprite->data[5] = y * 8; +} + +static void sub_81099A0(struct Sprite *sprite) +{ + int var1; + if (++sprite->data[0] > 2) + { + sprite->data[0] = 0; + ++sprite->data[1]; + var1 = (u16)sprite->data[1] * (u16)sprite->data[1]; + sprite->data[3] += var1; + } + + sprite->data[2] += sprite->data[4]; + sprite->pos1.x = sprite->data[2] >> 3; + sprite->data[3] += sprite->data[5]; + sprite->pos1.y = sprite->data[3] >> 3; + + if (sprite->pos1.x < -8 || sprite->pos1.x > 0xf8 || sprite->pos1.y < -8 || sprite->pos1.y > 120) + sprite->invisible = TRUE; +} + +static void sub_8109A10(struct Sprite *sprite) +{ + sprite->pos1.x = gBattleAnimArgs[0]; + sprite->pos1.y = gBattleAnimArgs[1]; + + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[6] = gBattleAnimArgs[2]; + sprite->data[7] = gBattleAnimArgs[3]; + + sprite->oam.tileNum += gBattleAnimArgs[4] * 16; + sprite->callback = sub_8109A64; +} + +static void sub_8109A64(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (sprite->data[6] != 0) + { + sprite->data[6]--; + return; + } + + sprite->data[0]++; + // fall through + case 1: + sprite->pos1.y += 8; + if (sprite->pos1.y >= sprite->data[7]) + { + sprite->pos1.y = sprite->data[7]; + sprite->data[0]++; + } + break; + case 2: + if (++sprite->data[1] > 1) + { + sprite->data[1] = 0; + if ((++sprite->data[2] & 1) != 0) + { + sprite->pos2.y = -3; + } + else + { + sprite->pos2.y = 3; + } + } + + if (++sprite->data[3] > 16) + { + DestroyAnimSprite(sprite); + } + break; + } +} + +//wisp orb +static void sub_8109AFC(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + InitAnimSpritePos(sprite, 0); + StartSpriteAnim(sprite, gBattleAnimArgs[2]); + sprite->data[7] = gBattleAnimArgs[2]; + + if (GetBattlerSide(gBattleAnimAttacker) != 0) + { + sprite->data[4] = 4; + } + else + { + sprite->data[4] = -4; + } + + sprite->oam.priority = sub_80A8328(gBattleAnimTarget); + sprite->data[0]++; + break; + case 1: + sprite->data[1] += 192; + if (GetBattlerSide(gBattleAnimAttacker) != 0) + { + sprite->pos2.y = -(sprite->data[1] >> 8); + } + else + { + sprite->pos2.y = sprite->data[1] >> 8; + } + + sprite->pos2.x = Sin(sprite->data[2], sprite->data[4]); + sprite->data[2] = (sprite->data[2] + 4) & 0xFF; + + if (++sprite->data[3] == 1) + { + sprite->data[3] = 0; + sprite->data[0]++; + } + break; + case 2: + sprite->pos2.x = Sin(sprite->data[2], sprite->data[4]); + sprite->data[2] = (sprite->data[2] + 4) & 0xFF; + + if (++sprite->data[3] == 31) + { + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos2.x = 0; + + sprite->data[0] = 256; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + + sub_80A6FD4(sprite); + sprite->callback = sub_8109C4C; + } + break; + } +} + +static void sub_8109C4C(struct Sprite *sprite) +{ + s16 initialData5; + s16 newData5; + + if (!TranslateAnimLinear(sprite)) + { + sprite->pos2.x += Sin(sprite->data[5], 16); + initialData5 = sprite->data[5]; + sprite->data[5] = (sprite->data[5] + 4) & 0xFF; + newData5 = sprite->data[5]; + + if ((initialData5 == 0 || initialData5 > 196) && newData5 > 0 && sprite->data[7] == 0) + { + PlaySE12WithPanning(SE_W172, gUnknown_02038440); + } + } + else + { + DestroyAnimSprite(sprite); + } +} + +//wisp fire +void sub_8109CB0(struct Sprite *sprite) +{ + if (!sprite->data[0]) + { + sprite->data[1] = gBattleAnimArgs[0]; + sprite->data[0] += 1; + } + + sprite->data[3] += 0xC0 * 2; + sprite->data[4] += 0xA0; + + sprite->pos2.x = Sin(sprite->data[1], sprite->data[3] >> 8); + sprite->pos2.y = Cos(sprite->data[1], sprite->data[4] >> 8); + + sprite->data[1] = (sprite->data[1] + 7) & 0xFF; + + if (!IsContest()) + { + if (sprite->data[1] < 64 || sprite->data[1] > 195) + sprite->oam.priority = sub_80A8328(gBattleAnimTarget); + else + sprite->oam.priority = sub_80A8328(gBattleAnimTarget) + 1; + } + else + { + if (sprite->data[1] < 64 || sprite->data[1] > 195) + sprite->subpriority = 0x1D; + else + sprite->subpriority = 0x1F; + } + + if (++sprite->data[2] > 0x14) + sprite->invisible ^= 1; + + if (sprite->data[2] == 0x1E) + DestroyAnimSprite(sprite); +} + +void sub_8109DBC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1; + task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1; + task->data[14] = GetAnimBattlerSpriteId(1); + task->data[15] = GetAnimBattlerSpriteId(3); + + task->func = sub_8109E2C; +} + +static void sub_8109E2C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + task->data[10] += task->data[12] * 2; + if (++task->data[1] >= 2) + { + task->data[1] = 0; + task->data[2]++; + if (task->data[2] & 1) + task->data[11] = 2; + else + task->data[11] = -2; + } + + for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++) + { + gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11]; + } + + if (++task->data[9] == 16) + { + task->data[9] = 0; + task->data[0]++; + } + break; + case 1: + if (++task->data[1] >= 5) + { + task->data[1] = 0; + task->data[2]++; + + if (task->data[2] & 1) + task->data[11] = 2; + else + task->data[11] = -2; + } + + for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++) + { + gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11]; + } + + if (++task->data[9] == 96) + { + task->data[9] = 0; + task->data[0]++; + } + break; + case 2: + task->data[10] -= task->data[12] * 2; + + if (++task->data[1] >= 2) + { + task->data[1] = 0; + task->data[2]++; + + if (task->data[2] & 1) + task->data[11] = 2; + else + task->data[11] = -2; + } + + for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++) + { + gSprites[task->data[task->data[3] + 14]].pos2.x = task->data[10] + task->data[11]; + } + + if (++task->data[9] == 16) + { + task->data[0]++; + } + break; + case 3: + for (task->data[3] = 0; task->data[3] < task->data[13]; task->data[3]++) + { + gSprites[task->data[task->data[3] + 14]].pos2.x = 0; + } + + DestroyAnimVisualTask(taskId); + break; + } +} + +// Used to add a color mask to the battle interface / HUD in Heat Wave. +// arg 0: opacity +// arg 1: color code +void AnimTask_BlendBackground(u8 taskId) +{ + struct UnknownAnimStruct2 unk; + sub_80A6B30(&unk); + BlendPalette(unk.unk8 << 4, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); // u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor + DestroyAnimVisualTask(taskId); +} + +void sub_810A094(u8 taskId) +{ + s8 unk; + u8 spriteId; + + if (gTasks[taskId].data[0] == 0) + { + gTasks[taskId].data[1] = gBattleAnimArgs[0]; + gTasks[taskId].data[2] = gBattleAnimArgs[1]; + gTasks[taskId].data[3] = gBattleAnimArgs[2]; + gTasks[taskId].data[4] = gBattleAnimArgs[3]; + } + gTasks[taskId].data[0]++; + + spriteId = gBattlerSpriteIds[gBattleAnimTarget]; + + if (!gTasks[taskId].data[4]) + unk = gUnknown_08595684[gTasks[taskId].data[0] % 10]; + else + unk = gUnknown_08595694[gTasks[taskId].data[0] % 10]; + + if (gTasks[taskId].data[3] == 1) + gSprites[spriteId].pos2.y = gBattleAnimArgs[1] * unk < 0 ? -(gBattleAnimArgs[1] * unk) : gBattleAnimArgs[1] * unk; + else + gSprites[spriteId].pos2.x = gBattleAnimArgs[1] * unk; + + if (gTasks[taskId].data[0] == gTasks[taskId].data[1]) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + DestroyAnimVisualTask(taskId); + } +} \ No newline at end of file diff --git a/src/fldeff_groundshake.c b/src/fldeff_groundshake.c index e9a46bb86..73d72c8b6 100644 --- a/src/fldeff_groundshake.c +++ b/src/fldeff_groundshake.c @@ -32,7 +32,17 @@ static void sub_81BEA20(void); static void sub_81BEAD8(struct Sprite* sprite); // rodata -static const u8 gUnknown_08617E18[] = {0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b}; +const struct InnerStruct203CF18_3 gUnknown_08617E18 = { + .unk0 = 0x433b, + .unk2 = 0x61, + .unk4 = 0x0F, + .unk5 = 0x05, + .unk6 = 0xFF, + .unk7_0 = 0xB, + .unk7_4 = 0x1, + .unk7_6 = 0, + .unk7_7 = 1, +}; static const union AnimCmd gSpriteAnim_8617E20[] = { @@ -131,7 +141,7 @@ void sub_81BE6B8(void) gUnknown_0203CF18 = (struct Struct203CF18 *)AllocZeroed(sizeof(struct Struct203CF18)); sub_8151B3C(&(gUnknown_0203CF18->unk4)); - sub_8151B68(&(gUnknown_0203CF18->unk4), gUnknown_08617E18); + sub_8151B68(&(gUnknown_0203CF18->unk4), &gUnknown_08617E18); sub_8151CA8(&(gUnknown_0203CF18->unk4), 1, 1); gUnknown_0203CF18->taskId = CreateTask(sub_81BE698, 0xFF); } diff --git a/src/pokedex.c b/src/pokedex.c index fa74b073a..d13a87f54 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1083,7 +1083,7 @@ static const struct PokedexOption gDexSortOptions[] = {gText_DexSortHeaviestDescription, gText_DexSortHeaviestTitle}, {gText_DexSortLightestDescription, gText_DexSortLightestTitle}, {gText_DexSortTallestDescription, gText_DexSortTallestTitle}, - {ggText_DexSortSmallestDescription, gText_DexSortSmallestTitle}, + {gText_DexSortSmallestDescription, gText_DexSortSmallestTitle}, {NULL, NULL}, }; diff --git a/src/roulette_util.c b/src/roulette_util.c new file mode 100755 index 000000000..a197cfa09 --- /dev/null +++ b/src/roulette_util.c @@ -0,0 +1,700 @@ +#include "global.h" +#include "palette.h" +#include "roulette.h" +#include "roulette_util.h" +#include "util.h" + +void sub_8151678(struct UnkStruct0 *r0) +{ + r0->var00 = 0; + r0->var02 = 0; + memset(&r0->var04, 0, sizeof(r0->var04)); +} + +u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, struct UnkStruct1 *r2) +{ + if (!(r1 < 16) || (r0->var04[r1].var00_7)) + return 0xFF; + + r0->var04[r1].var04.var00 = r2->var00; + r0->var04[r1].var04.var02 = r2->var02; + r0->var04[r1].var04.var04 = r2->var04; + r0->var04[r1].var04.var05 = r2->var05; + r0->var04[r1].var04.var06 = r2->var06; + r0->var04[r1].var04.var07_0 = r2->var07_0; + r0->var04[r1].var04.var07_5 = r2->var07_5; + r0->var04[r1].var04.var07_7 = r2->var07_7; + r0->var04[r1].var00_0 = 0; + r0->var04[r1].var00_7 = 1; + r0->var04[r1].var02 = 0; + r0->var04[r1].var01 = 0; + if (r0->var04[r1].var04.var07_7 < 0) + r0->var04[r1].var03 = 0xFF; + else + r0->var04[r1].var03 = 1; + + return r1; +} + +u8 sub_8151710(struct UnkStruct0 *r0, u8 r1) +{ + if (r1 >= 16) + return 0xFF; + if (!r0->var04[r1].var00_7) + return 0xFF; + + memset(&r0->var04[r1], 0, sizeof(r0->var04[r1])); + return r1; +} + +u8 sub_8151744(struct UnkStruct3 *r0) +{ + u8 i; + u8 returnval; + + for (i = 0; i < r0->var04.var04; i++) + { + struct PlttData *faded = (struct PlttData *)&gPlttBufferFaded[r0->var04.var02 + i]; + struct PlttData *unfaded = (struct PlttData *)&gPlttBufferUnfaded[r0->var04.var02 + i]; + + switch (r0->var00_0) + { + case 1: + if (faded->r + r0->var03 >= 0 && faded->r + r0->var03 < 32) + faded->r += r0->var03; + if (faded->g + r0->var03 >= 0 && faded->g + r0->var03 < 32) + faded->g += r0->var03; + if (faded->b + r0->var03 >= 0 && faded->b + r0->var03 < 32) + faded->b += r0->var03; + break; + case 2: + if (r0->var03 < 0) + { + if (faded->r + r0->var03 >= unfaded->r) + faded->r += r0->var03; + if (faded->g + r0->var03 >= unfaded->g) + faded->g += r0->var03; + if (faded->b + r0->var03 >= unfaded->b) + faded->b += r0->var03; + } + else + { + if (faded->r + r0->var03 <= unfaded->r) + faded->r += r0->var03; + if (faded->g + r0->var03 <= unfaded->g) + faded->g += r0->var03; + if (faded->b + r0->var03 <= unfaded->b) + faded->b += r0->var03; + } + break; + } + } + if ((u32)r0->var02++ != r0->var04.var07_0) + { + returnval = 0; + } + else + { + r0->var02 = 0; + r0->var03 *= -1; + if (r0->var00_0 == 1) + r0->var00_0++; + else + r0->var00_0--; + returnval = 1; + } + return returnval; +} + +u8 sub_815194C(struct UnkStruct3 *r0) +{ + u8 rg2 = 0; + + switch (r0->var00_0) + { + case 1: + for (rg2 = 0; rg2 < r0->var04.var04; rg2++) + gPlttBufferFaded[r0->var04.var02 + rg2] = r0->var04.var00; + r0->var00_0++; + break; + case 2: + for (rg2 = 0; rg2 < r0->var04.var04; rg2++) + gPlttBufferFaded[r0->var04.var02 + rg2] = gPlttBufferUnfaded[r0->var04.var02 + rg2]; + r0->var00_0--; + break; + } + return 1; +} + +void task_tutorial_controls_fadein(struct UnkStruct0 *r0) +{ + u8 i = 0; + + if (r0->var00) + { + for (i = 0; i < 16; i++) + { + if ((r0->var02 >> i) & 1) + { + if (--r0->var04[i].var01 == 0xFF) // if underflow ? + { + if (r0->var04[i].var04.var00 & 0x8000) // PlttData->unused_15 ? + sub_8151744(&r0->var04[i]); + else + sub_815194C(&r0->var04[i]); + + r0->var04[i].var01 = r0->var04[i].var04.var05; + } + } + } + } +} + +void sub_8151A48(struct UnkStruct0 *r0, u16 r1) +{ + u8 i = 0; + + r0->var00++; + for (i = 0; i < 16; i++) + { + if ((r1 >> i) & 1) + { + if (r0->var04[i].var00_7) + { + r0->var02 |= 1 << i; + r0->var04[i].var00_0 = 1; + } + } + } +} + +void sub_8151A9C(struct UnkStruct0 *r0, u16 r1) +{ + u8 i; + + for (i = 0; i < 16; i++) + { + if ((r0->var02 >> i) & 1) + { + if (r0->var04[i].var00_7) + { + if ((r1 >> i) & 1) + { + u32 offset = r0->var04[i].var04.var02; + u16 *faded = &gPlttBufferFaded[offset]; + u16 *unfaded = &gPlttBufferUnfaded[offset]; + memcpy(faded, unfaded, r0->var04[i].var04.var04 * 2); + r0->var04[i].var00_0 = 0; + r0->var04[i].var02 = 0; + r0->var04[i].var01 = 0; + if (r0->var04[i].var04.var07_7 < 0) + r0->var04[i].var03 = 0xFF; + else + r0->var04[i].var03 = 0x1; + } + } + } + } + if (r1 == 0xFFFF) + { + r0->var00 = 0; + r0->var02 = 0; + } + else + { + r0->var02 = r0->var02 & ~r1; + } +} + +void sub_8151B3C(struct InnerStruct203CF18 *arg0) +{ + u8 i = 0; + arg0->unk0 = 0; + memset(&arg0->unk4, 0, sizeof(arg0->unk4)); + for (; i < 16; i++) + { + arg0->unk4[i].unk0 = i; + } +} + +int sub_8151B68(struct InnerStruct203CF18 *arg0, const struct InnerStruct203CF18_3 *arg1) +{ + u8 i = 0; + struct InnerStruct203CF18_2 *r4 = NULL; + + if (!arg0->unk4[0].unk1_7) + { + r4 = &arg0->unk4[0]; + } + else + { + while (++i < 16) + { + if (!arg0->unk4[i].unk1_7) + { + r4 = &arg0->unk4[i]; + break; + } + } + } + + if (r4 == 0) + return 0xFF; + + r4->unk1_0 = 0; + r4->unk1_4 = 0; + r4->unk1_6 = 1; + r4->unk1_7 = 1; + r4->unk2 = 0; + r4->unk3 = 0; + memcpy(&r4->unk4, arg1, sizeof(*arg1)); + return i; +} + +void sub_8151BD4(struct InnerStruct203CF18_2 *arg0) +{ + u16 i; + + if (!arg0->unk1_6 && arg0->unk4.unk7_6) + { + for (i = arg0->unk4.unk2; i < arg0->unk4.unk2 + arg0->unk4.unk4; i++) + gPlttBufferFaded[i] = gPlttBufferUnfaded[i]; + } + + memset(&arg0->unk4, 0, sizeof(arg0->unk4)); + arg0->unk1_0 = 0; + arg0->unk1_4 = 0; + arg0->unk1_5 = 0; + arg0->unk1_6 = 1; + arg0->unk1_7 = 0; + arg0->unk3 = 0; + arg0->unk2 = 0; +} + +void sub_8151C50(struct InnerStruct203CF18 *arg0, u16 arg1, u8 arg2) +{ + u16 i = 0; + + if (!arg2) + { + sub_8151BD4(&arg0->unk4[arg1 & 0xF]); + } + else + { + for (i = 0; i < 16; i++) + { + if ((arg1 & 1) && arg0->unk4[i].unk1_7) + sub_8151BD4(&arg0->unk4[i]); + + arg1 >>= 1; + } + } +} + +// there seems to be a temp var involved inside the first if block +void sub_8151CA8(struct InnerStruct203CF18 *arg0, u16 arg1, u8 arg2) +{ + u8 i = 0; + + if (!arg2) + { + i = arg1 & 0xF; + arg0->unk4[i].unk1_6 = 0; + arg0->unk0 |= 1 << i; + } + else + { + for (i = 0; i < 16; i++) + { + if (!(arg1 & 1) || !arg0->unk4[i].unk1_7 || !arg0->unk4[i].unk1_6) + { + arg1 <<= 1; + } + else + { + arg0->unk4[i].unk1_6 = 0; + arg0->unk0 |= 1 << i; + } + } + } +} + +void sub_8151D28(struct InnerStruct203CF18 *arg0, u16 arg1, u8 arg2) +{ + u16 i; + struct InnerStruct203CF18_2 *var0; + u8 j = 0; + + if (!arg2) + { + var0 = &arg0->unk4[arg1 & 0xF]; + if (!var0->unk1_6 && var0->unk1_7) + { + if (var0->unk4.unk7_6) + { + for (i = var0->unk4.unk2; i < var0->unk4.unk2 + var0->unk4.unk4; i++) + gPlttBufferFaded[i] = gPlttBufferUnfaded[i]; + } + + var0->unk1_6 = 1; + arg0->unk0 &= ~(1 << j); + } + } + else + { + for (j = 0; j < 16; j++) + { + var0 = &arg0->unk4[j]; + if (!(arg1 & 1) || var0->unk1_6 || !var0->unk1_7) + { + arg1 <<= 1; + } + else + { + if (var0->unk4.unk7_6) + { + for (i = var0->unk4.unk2; i < var0->unk4.unk2 + var0->unk4.unk4; i++) + gPlttBufferFaded[i] = gPlttBufferUnfaded[i]; + } + + var0->unk1_6 = 1; + arg0->unk0 &= ~(1 << j); + } + } + } +} + +#ifdef NONMATCHING +void sub_8151E50(struct InnerStruct203CF18 *arg0) +{ + struct InnerStruct203CF18_2 *var0; + u8 i = 0; + + if (arg0->unk0) + { + for (i = 0; i < 16; i++) + { + var0 = &arg0->unk4[i]; + if ((!var0->unk1_6 && var0->unk1_7) && (!gPaletteFade.active || !var0->unk4.unk7_7)) + { + if (--var0->unk2 == 0xFF) + { + var0->unk2 = var0->unk4.unk5; + BlendPalette(var0->unk4.unk2, var0->unk4.unk4, var0->unk1_0, var0->unk4.unk0); + switch (var0->unk4.unk7_4) + { + case 0: + if (var0->unk1_0++ == var0->unk4.unk7_0) + { + var0->unk3++; + var0->unk1_0 = 0; + } + break; + case 1: + if (var0->unk1_4) + { + if (--var0->unk1_0 == 0) + { + var0->unk3++; + var0->unk1_4 ^= 1; + } + } + else + { + if (var0->unk1_0++ == var0->unk4.unk7_0 - 1) + { + var0->unk3++; + var0->unk1_4 ^= 1; + } + } + break; + case 2: + if (var0->unk1_4) + var0->unk1_0 = 0; + else + var0->unk1_0 = var0->unk4.unk7_0; + + var0->unk1_4 ^= 1; + var0->unk3++; + break; + } + + if (var0->unk4.unk6 != 0xFF && var0->unk3 == 0xFF) + sub_8151D28(arg0, var0->unk0, 0); + } + } + } + } +} +#else +NAKED +void sub_8151E50(struct InnerStruct203CF18 *arg0) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x4\n\ + str r0, [sp]\n\ + movs r0, 0\n\ + mov r10, r0\n\ + ldr r1, [sp]\n\ + ldrh r0, [r1]\n\ + cmp r0, 0\n\ + bne _08151E6C\n\ + b _08151FF6\n\ +_08151E6C:\n\ + movs r2, 0xF\n\ + mov r9, r2\n\ + movs r3, 0x10\n\ + negs r3, r3\n\ + mov r8, r3\n\ + movs r7, 0x1\n\ +_08151E78:\n\ + mov r5, r10\n\ + lsls r0, r5, 1\n\ + add r0, r10\n\ + lsls r0, 2\n\ + adds r0, 0x4\n\ + ldr r1, [sp]\n\ + adds r4, r1, r0\n\ + ldrb r2, [r4, 0x1]\n\ + movs r3, 0xC0\n\ + ands r3, r2\n\ + cmp r3, 0x80\n\ + beq _08151E92\n\ + b _08151FE6\n\ +_08151E92:\n\ + ldr r0, =gPaletteFade\n\ + ldrb r1, [r0, 0x7]\n\ + adds r0, r3, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08151EA8\n\ + ldrb r0, [r4, 0xB]\n\ + ands r3, r0\n\ + cmp r3, 0\n\ + beq _08151EA8\n\ + b _08151FE6\n\ +_08151EA8:\n\ + ldrb r0, [r4, 0x2]\n\ + subs r0, 0x1\n\ + strb r0, [r4, 0x2]\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0xFF\n\ + beq _08151EB8\n\ + b _08151FE6\n\ +_08151EB8:\n\ + ldrb r0, [r4, 0x9]\n\ + strb r0, [r4, 0x2]\n\ + ldrh r0, [r4, 0x6]\n\ + ldrb r1, [r4, 0x8]\n\ + lsls r2, 28\n\ + lsrs r2, 28\n\ + ldrh r3, [r4, 0x4]\n\ + bl BlendPalette\n\ + ldrb r5, [r4, 0xB]\n\ + lsls r0, r5, 26\n\ + asrs r0, 30\n\ + cmp r0, 0x1\n\ + beq _08151F16\n\ + cmp r0, 0x1\n\ + bgt _08151EE4\n\ + cmp r0, 0\n\ + beq _08151EEA\n\ + b _08151FD0\n\ + .pool\n\ +_08151EE4:\n\ + cmp r0, 0x2\n\ + beq _08151F92\n\ + b _08151FD0\n\ +_08151EEA:\n\ + ldrb r2, [r4, 0x1]\n\ + lsls r1, r2, 28\n\ + lsrs r0, r1, 28\n\ + adds r0, 0x1\n\ + mov r3, r9\n\ + ands r0, r3\n\ + mov r6, r8\n\ + adds r3, r6, 0\n\ + ands r3, r2\n\ + orrs r3, r0\n\ + strb r3, [r4, 0x1]\n\ + lsrs r1, 28\n\ + lsls r0, r5, 28\n\ + asrs r0, 28\n\ + cmp r1, r0\n\ + bne _08151FD0\n\ + ldrb r0, [r4, 0x3]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x3]\n\ + ands r3, r6\n\ + strb r3, [r4, 0x1]\n\ + b _08151FD0\n\ +_08151F16:\n\ + ldrb r3, [r4, 0x1]\n\ + movs r0, 0x10\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _08151F54\n\ + lsls r0, r3, 28\n\ + lsrs r0, 28\n\ + subs r0, 0x1\n\ + mov r5, r9\n\ + ands r0, r5\n\ + mov r2, r8\n\ + ands r2, r3\n\ + orrs r2, r0\n\ + strb r2, [r4, 0x1]\n\ + cmp r0, 0\n\ + bne _08151FD0\n\ + ldrb r0, [r4, 0x3]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x3]\n\ + lsls r0, r2, 27\n\ + lsrs r0, 31\n\ + eors r0, r7\n\ + ands r0, r7\n\ + lsls r0, 4\n\ + movs r3, 0x11\n\ + negs r3, r3\n\ + adds r1, r3, 0\n\ + ands r2, r1\n\ + orrs r2, r0\n\ + strb r2, [r4, 0x1]\n\ + b _08151FD0\n\ +_08151F54:\n\ + lsls r0, r5, 28\n\ + asrs r0, 28\n\ + subs r0, 0x1\n\ + mov r5, r9\n\ + ands r0, r5\n\ + lsls r2, r3, 28\n\ + lsrs r1, r2, 28\n\ + adds r1, 0x1\n\ + ands r1, r5\n\ + mov r5, r8\n\ + ands r3, r5\n\ + orrs r3, r1\n\ + strb r3, [r4, 0x1]\n\ + lsrs r2, 28\n\ + cmp r2, r0\n\ + bne _08151FD0\n\ + ldrb r0, [r4, 0x3]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x3]\n\ + lsls r0, r3, 27\n\ + lsrs r0, 31\n\ + eors r0, r7\n\ + ands r0, r7\n\ + lsls r0, 4\n\ + movs r2, 0x11\n\ + negs r2, r2\n\ + adds r1, r2, 0\n\ + ands r3, r1\n\ + orrs r3, r0\n\ + strb r3, [r4, 0x1]\n\ + b _08151FD0\n\ +_08151F92:\n\ + ldrb r2, [r4, 0x1]\n\ + movs r0, 0x10\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _08151FA2\n\ + mov r0, r8\n\ + ands r0, r2\n\ + b _08151FB0\n\ +_08151FA2:\n\ + lsls r1, r5, 28\n\ + asrs r1, 28\n\ + mov r3, r9\n\ + ands r1, r3\n\ + mov r0, r8\n\ + ands r0, r2\n\ + orrs r0, r1\n\ +_08151FB0:\n\ + strb r0, [r4, 0x1]\n\ + ldrb r2, [r4, 0x1]\n\ + lsls r0, r2, 27\n\ + lsrs r0, 31\n\ + eors r0, r7\n\ + ands r0, r7\n\ + lsls r0, 4\n\ + movs r5, 0x11\n\ + negs r5, r5\n\ + adds r1, r5, 0\n\ + ands r2, r1\n\ + orrs r2, r0\n\ + strb r2, [r4, 0x1]\n\ + ldrb r0, [r4, 0x3]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x3]\n\ +_08151FD0:\n\ + ldrb r1, [r4, 0xA]\n\ + cmp r1, 0xFF\n\ + beq _08151FE6\n\ + ldrb r0, [r4, 0x3]\n\ + cmp r0, r1\n\ + bne _08151FE6\n\ + ldrb r1, [r4]\n\ + ldr r0, [sp]\n\ + movs r2, 0\n\ + bl sub_8151D28\n\ +_08151FE6:\n\ + mov r0, r10\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r10, r0\n\ + cmp r0, 0xF\n\ + bhi _08151FF6\n\ + b _08151E78\n\ +_08151FF6:\n\ + add sp, 0x4\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} +#endif // NONMATCHING + +void sub_8152008(u16 *dest, u16 src, u8 left, u8 top, u8 width, u8 height) +{ + u16 *_dest; + u8 i; + u8 j; + i = 0; + dest = &dest[top * 32 + left]; + for (; i < height; i++) + { + _dest = dest + i * 32; + for (j = 0; j < width; j++) + { + *_dest++ = src; + } + } +} + +void sub_8152058(u16 *dest, u16 *src, u8 left, u8 top, u8 width, u8 height) +{ + u16 *_dest; + u16 *_src = src; + u8 i; + u8 j; + i = 0; + dest = &dest[top * 32 + left]; + for (; i < height; i++) + { + _dest = dest + i * 32; + for (j = 0; j < width; j++) + { + *_dest++ = *_src++; + } + } +} diff --git a/src/strings.c b/src/strings.c index 7b3df0eca..3ac6fa36c 100644 --- a/src/strings.c +++ b/src/strings.c @@ -155,7 +155,7 @@ const u8 gText_DexSortAtoZDescription[] = _("Spotted and owned POKéMON are list const u8 gText_DexSortHeaviestDescription[] = _("Owned POKéMON are listed from the\nheaviest to the lightest."); const u8 gText_DexSortLightestDescription[] = _("Owned POKéMON are listed from the\nlightest to the heaviest."); const u8 gText_DexSortTallestDescription[] = _("Owned POKéMON are listed from the\ntallest to the smallest."); -const u8 ggText_DexSortSmallestDescription[] = _("Owned POKéMON are listed from the\nsmallest to the tallest."); +const u8 gText_DexSortSmallestDescription[] = _("Owned POKéMON are listed from the\nsmallest to the tallest."); const u8 gText_DexEmptyString[] = _(""); const u8 gText_DexSearchDontSpecify[] = _("DON'T SPECIFY."); const u8 gText_DexSearchTypeNone[] = _("NONE");