mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
Decompile start of flying.c
This commit is contained in:
parent
1b0079445d
commit
05f9368154
817
asm/flying.s
817
asm/flying.s
@ -5,823 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_810DE70
|
||||
sub_810DE70: @ 810DE70
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0
|
||||
bl InitSpritePosToAnimTarget
|
||||
ldrh r0, [r4, 0x22]
|
||||
adds r0, 0x14
|
||||
strh r0, [r4, 0x22]
|
||||
movs r0, 0xBF
|
||||
strh r0, [r4, 0x30]
|
||||
ldr r1, =sub_810DE98
|
||||
str r1, [r4, 0x1C]
|
||||
adds r0, r4, 0
|
||||
bl _call_via_r1
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810DE70
|
||||
|
||||
thumb_func_start sub_810DE98
|
||||
sub_810DE98: @ 810DE98
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0x30
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r1, 0x20
|
||||
bl Sin
|
||||
strh r0, [r4, 0x24]
|
||||
movs r1, 0x30
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r1, 0x8
|
||||
bl Cos
|
||||
strh r0, [r4, 0x26]
|
||||
ldrh r0, [r4, 0x30]
|
||||
adds r0, 0x5
|
||||
movs r1, 0xFF
|
||||
ands r0, r1
|
||||
strh r0, [r4, 0x30]
|
||||
ldrh r0, [r4, 0x2E]
|
||||
adds r0, 0x1
|
||||
strh r0, [r4, 0x2E]
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
cmp r0, 0x47
|
||||
bne _0810DED2
|
||||
adds r0, r4, 0
|
||||
bl DestroyAnimSprite
|
||||
_0810DED2:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_810DE98
|
||||
|
||||
thumb_func_start sub_810DED8
|
||||
sub_810DED8: @ 810DED8
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r1, =gTasks
|
||||
lsls r4, r0, 2
|
||||
adds r4, r0
|
||||
lsls r4, 3
|
||||
adds r4, r1
|
||||
ldr r1, =gBattleAnimArgs
|
||||
ldrh r0, [r1, 0x2]
|
||||
strh r0, [r4, 0x8]
|
||||
ldrh r0, [r1]
|
||||
strh r0, [r4, 0xA]
|
||||
ldr r0, =0x00002719
|
||||
bl IndexOfSpritePaletteTag
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4, 0xC]
|
||||
ldr r0, =sub_810DF18
|
||||
str r0, [r4]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810DED8
|
||||
|
||||
thumb_func_start sub_810DF18
|
||||
sub_810DF18: @ 810DF18
|
||||
push {r4-r7,lr}
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r2, =gTasks
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r3, r0, r2
|
||||
ldrh r0, [r3, 0x1C]
|
||||
adds r1, r0, 0x1
|
||||
strh r1, [r3, 0x1C]
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
movs r4, 0xA
|
||||
ldrsh r1, [r3, r4]
|
||||
adds r7, r2, 0
|
||||
cmp r0, r1
|
||||
bne _0810DF76
|
||||
movs r0, 0
|
||||
strh r0, [r3, 0x1C]
|
||||
ldrb r0, [r3, 0xC]
|
||||
ldr r2, =gPlttBufferFaded
|
||||
lsls r0, 4
|
||||
movs r3, 0x84
|
||||
lsls r3, 1
|
||||
adds r1, r0, r3
|
||||
lsls r1, 1
|
||||
adds r1, r2
|
||||
ldrh r6, [r1]
|
||||
movs r4, 0x7
|
||||
mov r12, r0
|
||||
ldr r0, =0x00000107
|
||||
add r0, r12
|
||||
lsls r0, 1
|
||||
adds r3, r0, r2
|
||||
_0810DF5E:
|
||||
ldrh r0, [r3]
|
||||
strh r0, [r1]
|
||||
subs r3, 0x2
|
||||
subs r1, 0x2
|
||||
subs r4, 0x1
|
||||
cmp r4, 0
|
||||
bgt _0810DF5E
|
||||
ldr r0, =0x00000101
|
||||
add r0, r12
|
||||
lsls r0, 1
|
||||
adds r0, r2
|
||||
strh r6, [r0]
|
||||
_0810DF76:
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r0, r7
|
||||
ldrh r1, [r0, 0x8]
|
||||
subs r1, 0x1
|
||||
strh r1, [r0, 0x8]
|
||||
lsls r1, 16
|
||||
cmp r1, 0
|
||||
bne _0810DF90
|
||||
adds r0, r5, 0
|
||||
bl DestroyAnimVisualTask
|
||||
_0810DF90:
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810DF18
|
||||
|
||||
thumb_func_start sub_810DFA8
|
||||
sub_810DFA8: @ 810DFA8
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
movs r1, 0x1
|
||||
bl InitSpritePosToAnimAttacker
|
||||
ldr r0, =gBattleAnimAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBattlerSide
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0810DFC8
|
||||
ldr r1, =gBattleAnimArgs
|
||||
ldrh r0, [r1, 0x4]
|
||||
negs r0, r0
|
||||
strh r0, [r1, 0x4]
|
||||
_0810DFC8:
|
||||
ldr r4, =gBattleAnimArgs
|
||||
ldrh r0, [r4, 0x8]
|
||||
strh r0, [r6, 0x2E]
|
||||
ldrh r0, [r6, 0x20]
|
||||
strh r0, [r6, 0x30]
|
||||
ldr r5, =gBattleAnimTarget
|
||||
ldrb r0, [r5]
|
||||
movs r1, 0x2
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldrh r1, [r4, 0x4]
|
||||
adds r0, r1
|
||||
strh r0, [r6, 0x32]
|
||||
ldrh r0, [r6, 0x22]
|
||||
strh r0, [r6, 0x34]
|
||||
ldrb r0, [r5]
|
||||
movs r1, 0x3
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldrh r4, [r4, 0x6]
|
||||
adds r0, r4
|
||||
strh r0, [r6, 0x36]
|
||||
adds r0, r6, 0
|
||||
bl InitAnimLinearTranslation
|
||||
ldr r0, =RunStoredCallbackWhenAffineAnimEnds
|
||||
str r0, [r6, 0x1C]
|
||||
ldr r1, =sub_810E028
|
||||
adds r0, r6, 0
|
||||
bl StoreSpriteCallbackInData6
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810DFA8
|
||||
|
||||
thumb_func_start sub_810E028
|
||||
sub_810E028: @ 810E028
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl AnimTranslateLinear
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0810E03C
|
||||
adds r0, r4, 0
|
||||
bl DestroyAnimSprite
|
||||
_0810E03C:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_810E028
|
||||
|
||||
thumb_func_start sub_810E044
|
||||
sub_810E044: @ 810E044
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r4, =gBattleAnimAttacker
|
||||
ldrb r0, [r4]
|
||||
bl GetBattlerSide
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0810E070
|
||||
ldr r1, =gBattleAnimArgs
|
||||
ldrh r0, [r1]
|
||||
negs r0, r0
|
||||
strh r0, [r1]
|
||||
ldrh r0, [r1, 0x2]
|
||||
negs r0, r0
|
||||
strh r0, [r1, 0x2]
|
||||
ldrh r0, [r1, 0x4]
|
||||
negs r0, r0
|
||||
strh r0, [r1, 0x4]
|
||||
ldrh r0, [r1, 0x6]
|
||||
negs r0, r0
|
||||
strh r0, [r1, 0x6]
|
||||
_0810E070:
|
||||
bl IsContest
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0810E088
|
||||
ldr r0, =gBattleAnimArgs
|
||||
ldrh r1, [r0, 0x2]
|
||||
negs r1, r1
|
||||
strh r1, [r0, 0x2]
|
||||
ldrh r1, [r0, 0x6]
|
||||
negs r1, r1
|
||||
strh r1, [r0, 0x6]
|
||||
_0810E088:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r5, 0x20]
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x3
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
ldr r2, =gBattleAnimArgs
|
||||
ldrh r1, [r2]
|
||||
ldrh r3, [r5, 0x20]
|
||||
adds r1, r3
|
||||
strh r1, [r5, 0x20]
|
||||
lsrs r0, 24
|
||||
ldrh r1, [r2, 0x2]
|
||||
adds r0, r1
|
||||
strh r0, [r5, 0x22]
|
||||
ldrh r0, [r2, 0x8]
|
||||
strh r0, [r5, 0x2E]
|
||||
movs r3, 0xC
|
||||
ldrsh r0, [r2, r3]
|
||||
cmp r0, 0
|
||||
bne _0810E0EC
|
||||
ldr r4, =gBattleAnimTarget
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r5, 0x32]
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x3
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r5, 0x36]
|
||||
b _0810E0FE
|
||||
.pool
|
||||
_0810E0EC:
|
||||
ldr r0, =gBattleAnimTarget
|
||||
ldrb r0, [r0]
|
||||
adds r2, r5, 0
|
||||
adds r2, 0x32
|
||||
adds r3, r5, 0
|
||||
adds r3, 0x36
|
||||
movs r1, 0x1
|
||||
bl SetAverageBattlerPositions
|
||||
_0810E0FE:
|
||||
ldr r4, =gBattleAnimArgs
|
||||
ldrh r0, [r4, 0x4]
|
||||
ldrh r1, [r5, 0x32]
|
||||
adds r0, r1
|
||||
strh r0, [r5, 0x32]
|
||||
ldrh r0, [r4, 0x6]
|
||||
ldrh r3, [r5, 0x36]
|
||||
adds r0, r3
|
||||
strh r0, [r5, 0x36]
|
||||
ldr r0, =StartAnimLinearTranslation
|
||||
str r0, [r5, 0x1C]
|
||||
ldr r1, =DestroyAnimSprite
|
||||
adds r0, r5, 0
|
||||
bl StoreSpriteCallbackInData6
|
||||
ldrb r1, [r4, 0xA]
|
||||
adds r0, r5, 0
|
||||
bl SeekSpriteAnim
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E044
|
||||
|
||||
thumb_func_start sub_810E13C
|
||||
sub_810E13C: @ 810E13C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0x1
|
||||
bl InitSpritePosToAnimAttacker
|
||||
ldr r1, =gBattleAnimArgs
|
||||
ldrh r0, [r1, 0x4]
|
||||
strh r0, [r4, 0x2E]
|
||||
ldrh r0, [r1, 0x6]
|
||||
strh r0, [r4, 0x30]
|
||||
ldr r0, =sub_810E184
|
||||
str r0, [r4, 0x1C]
|
||||
movs r0, 0
|
||||
bl GetAnimBattlerSpriteId
|
||||
ldr r2, =gSprites
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
adds r1, 0x3E
|
||||
ldrb r0, [r1]
|
||||
movs r2, 0x4
|
||||
orrs r0, r2
|
||||
strb r0, [r1]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E13C
|
||||
|
||||
thumb_func_start sub_810E184
|
||||
sub_810E184: @ 810E184
|
||||
push {lr}
|
||||
adds r2, r0, 0
|
||||
ldrh r1, [r2, 0x2E]
|
||||
movs r3, 0x2E
|
||||
ldrsh r0, [r2, r3]
|
||||
cmp r0, 0
|
||||
ble _0810E198
|
||||
subs r0, r1, 0x1
|
||||
strh r0, [r2, 0x2E]
|
||||
b _0810E1AA
|
||||
_0810E198:
|
||||
ldrh r0, [r2, 0x30]
|
||||
ldrh r1, [r2, 0x32]
|
||||
adds r0, r1
|
||||
strh r0, [r2, 0x32]
|
||||
lsls r0, 16
|
||||
asrs r0, 24
|
||||
ldrh r1, [r2, 0x26]
|
||||
subs r1, r0
|
||||
strh r1, [r2, 0x26]
|
||||
_0810E1AA:
|
||||
movs r3, 0x22
|
||||
ldrsh r0, [r2, r3]
|
||||
movs r3, 0x26
|
||||
ldrsh r1, [r2, r3]
|
||||
adds r0, r1
|
||||
movs r1, 0x20
|
||||
negs r1, r1
|
||||
cmp r0, r1
|
||||
bge _0810E1C2
|
||||
adds r0, r2, 0
|
||||
bl DestroyAnimSprite
|
||||
_0810E1C2:
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_810E184
|
||||
|
||||
thumb_func_start sub_810E1C8
|
||||
sub_810E1C8: @ 810E1C8
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r0, =gBattleAnimAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBattlerSide
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0810E1F8
|
||||
movs r0, 0x88
|
||||
lsls r0, 1
|
||||
strh r0, [r5, 0x20]
|
||||
ldr r0, =0x0000ffe0
|
||||
strh r0, [r5, 0x22]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1
|
||||
bl StartSpriteAffineAnim
|
||||
b _0810E1FE
|
||||
.pool
|
||||
_0810E1F8:
|
||||
ldr r0, =0x0000ffe0
|
||||
strh r0, [r5, 0x20]
|
||||
strh r0, [r5, 0x22]
|
||||
_0810E1FE:
|
||||
ldr r0, =gBattleAnimArgs
|
||||
ldrh r0, [r0]
|
||||
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_810E24C
|
||||
str r0, [r5, 0x1C]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E1C8
|
||||
|
||||
thumb_func_start sub_810E24C
|
||||
sub_810E24C: @ 810E24C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r0, 0x1
|
||||
strh r0, [r4, 0x2E]
|
||||
adds r0, r4, 0
|
||||
bl AnimTranslateLinear
|
||||
ldrh r1, [r4, 0x34]
|
||||
lsrs r0, r1, 8
|
||||
cmp r0, 0xC8
|
||||
bls _0810E274
|
||||
ldrh r0, [r4, 0x24]
|
||||
ldrh r2, [r4, 0x20]
|
||||
adds r0, r2
|
||||
strh r0, [r4, 0x20]
|
||||
movs r0, 0
|
||||
strh r0, [r4, 0x24]
|
||||
movs r0, 0xFF
|
||||
ands r0, r1
|
||||
strh r0, [r4, 0x34]
|
||||
_0810E274:
|
||||
movs r1, 0x20
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x24
|
||||
ldrsh r1, [r4, r2]
|
||||
adds r0, r1
|
||||
adds r0, 0x20
|
||||
movs r1, 0x98
|
||||
lsls r1, 1
|
||||
cmp r0, r1
|
||||
bhi _0810E296
|
||||
movs r1, 0x22
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x26
|
||||
ldrsh r1, [r4, r2]
|
||||
adds r0, r1
|
||||
cmp r0, 0xA0
|
||||
ble _0810E2BC
|
||||
_0810E296:
|
||||
movs r0, 0
|
||||
bl GetAnimBattlerSpriteId
|
||||
ldr r2, =gSprites
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
adds r1, 0x3E
|
||||
ldrb r2, [r1]
|
||||
movs r0, 0x5
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
strb r0, [r1]
|
||||
adds r0, r4, 0
|
||||
bl DestroyAnimSprite
|
||||
_0810E2BC:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E24C
|
||||
|
||||
thumb_func_start sub_810E2C8
|
||||
sub_810E2C8: @ 810E2C8
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldrh r0, [r4, 0x2E]
|
||||
subs r1, r0, 0x1
|
||||
strh r1, [r4, 0x2E]
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
bgt _0810E308
|
||||
ldrb r0, [r4, 0x1]
|
||||
lsls r0, 30
|
||||
lsrs r0, 30
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0810E2FA
|
||||
ldrb r0, [r4, 0x3]
|
||||
lsls r0, 26
|
||||
lsrs r0, 27
|
||||
bl FreeOamMatrix
|
||||
ldrb r1, [r4, 0x1]
|
||||
movs r0, 0x4
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r4, 0x1]
|
||||
_0810E2FA:
|
||||
adds r0, r4, 0
|
||||
bl DestroySprite
|
||||
ldr r1, =gAnimVisualTaskCount
|
||||
ldrb r0, [r1]
|
||||
subs r0, 0x1
|
||||
strb r0, [r1]
|
||||
_0810E308:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E2C8
|
||||
|
||||
thumb_func_start sub_810E314
|
||||
sub_810E314: @ 810E314
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r7, r0, 0
|
||||
adds r5, r7, 0
|
||||
adds r5, 0x2E
|
||||
ldr r0, =gBattleAnimArgs
|
||||
ldrh r1, [r0, 0xE]
|
||||
movs r0, 0x80
|
||||
lsls r0, 1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0810E33C
|
||||
ldr r0, =gBattleAnimAttacker
|
||||
b _0810E33E
|
||||
.pool
|
||||
_0810E33C:
|
||||
ldr r0, =gBattleAnimTarget
|
||||
_0810E33E:
|
||||
ldrb r6, [r0]
|
||||
adds r0, r6, 0
|
||||
bl GetBattlerSide
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0810E354
|
||||
ldr r1, =gBattleAnimArgs
|
||||
ldrh r0, [r1]
|
||||
negs r0, r0
|
||||
strh r0, [r1]
|
||||
_0810E354:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
ldr r4, =gBattleAnimArgs
|
||||
lsrs r0, 24
|
||||
ldrh r1, [r4]
|
||||
adds r0, r1
|
||||
strh r0, [r7, 0x20]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x1
|
||||
bl GetBattlerSpriteCoord
|
||||
lsls r0, 24
|
||||
ldrh r1, [r4, 0x2]
|
||||
lsrs r0, 24
|
||||
adds r1, r0, r1
|
||||
strh r1, [r7, 0x22]
|
||||
lsls r1, 8
|
||||
strh r1, [r5, 0x8]
|
||||
ldrh r1, [r4, 0xC]
|
||||
adds r0, r1
|
||||
lsls r0, 1
|
||||
ldrh r2, [r5, 0xE]
|
||||
movs r1, 0x1
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
strh r1, [r5, 0xE]
|
||||
ldrb r0, [r5]
|
||||
movs r2, 0x4
|
||||
mov r8, r2
|
||||
mov r1, r8
|
||||
orrs r0, r1
|
||||
strb r0, [r5]
|
||||
ldrh r0, [r4, 0x4]
|
||||
ldrb r1, [r4, 0x4]
|
||||
strh r1, [r5, 0x2]
|
||||
lsls r0, 16
|
||||
lsrs r0, 24
|
||||
strh r0, [r5, 0xA]
|
||||
ldrh r0, [r4, 0x6]
|
||||
strh r0, [r5, 0x4]
|
||||
ldrh r0, [r4, 0x8]
|
||||
strh r0, [r5, 0x6]
|
||||
ldrh r0, [r4, 0xA]
|
||||
strh r0, [r5, 0xC]
|
||||
subs r1, 0x40
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
cmp r1, 0x7F
|
||||
bhi _0810E44A
|
||||
bl IsContest
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0810E3F0
|
||||
adds r0, r6, 0
|
||||
bl GetBattlerSpriteBGPriority
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r0, 0x1
|
||||
movs r1, 0x3
|
||||
ands r0, r1
|
||||
lsls r0, 2
|
||||
ldrb r2, [r7, 0x5]
|
||||
movs r1, 0xD
|
||||
negs r1, r1
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
strb r1, [r7, 0x5]
|
||||
b _0810E408
|
||||
.pool
|
||||
_0810E3F0:
|
||||
adds r0, r6, 0
|
||||
bl GetBattlerSpriteBGPriority
|
||||
movs r1, 0x3
|
||||
ands r1, r0
|
||||
lsls r1, 2
|
||||
ldrb r2, [r7, 0x5]
|
||||
movs r0, 0xD
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r7, 0x5]
|
||||
_0810E408:
|
||||
ldrb r1, [r5, 0xE]
|
||||
movs r4, 0x2
|
||||
negs r4, r4
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
strb r0, [r5, 0xE]
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r5, r2]
|
||||
movs r1, 0x80
|
||||
lsls r1, 8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0810E4AA
|
||||
adds r3, r7, 0
|
||||
adds r3, 0x3F
|
||||
ldrb r2, [r3]
|
||||
lsls r0, r2, 31
|
||||
lsrs r0, 31
|
||||
movs r1, 0x1
|
||||
eors r1, r0
|
||||
adds r0, r4, 0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r3]
|
||||
lsls r0, 31
|
||||
lsrs r0, 31
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x2A
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r3]
|
||||
movs r1, 0x4
|
||||
orrs r0, r1
|
||||
b _0810E4A2
|
||||
_0810E44A:
|
||||
adds r0, r6, 0
|
||||
bl GetBattlerSpriteBGPriority
|
||||
movs r1, 0x3
|
||||
ands r1, r0
|
||||
lsls r1, 2
|
||||
ldrb r2, [r7, 0x5]
|
||||
movs r0, 0xD
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r7, 0x5]
|
||||
ldrb r0, [r5, 0xE]
|
||||
movs r4, 0x1
|
||||
orrs r0, r4
|
||||
strb r0, [r5, 0xE]
|
||||
movs r1, 0x4
|
||||
ldrsh r0, [r5, r1]
|
||||
movs r1, 0x80
|
||||
lsls r1, 8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0810E4AA
|
||||
adds r3, r7, 0
|
||||
adds r3, 0x3F
|
||||
ldrb r2, [r3]
|
||||
lsls r1, r2, 31
|
||||
lsrs r1, 31
|
||||
movs r0, 0x1
|
||||
eors r1, r0
|
||||
ands r1, r4
|
||||
movs r0, 0x2
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r3]
|
||||
lsls r0, 31
|
||||
lsrs r0, 31
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x2A
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r3]
|
||||
mov r2, r8
|
||||
orrs r0, r2
|
||||
_0810E4A2:
|
||||
movs r1, 0x11
|
||||
negs r1, r1
|
||||
ands r0, r1
|
||||
strb r0, [r3]
|
||||
_0810E4AA:
|
||||
ldrh r1, [r5, 0x2]
|
||||
lsrs r1, 6
|
||||
lsls r1, 4
|
||||
ldrb r2, [r5]
|
||||
movs r0, 0xF
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r5]
|
||||
ldr r3, =gSineTable
|
||||
ldrh r0, [r5, 0x2]
|
||||
lsls r0, 1
|
||||
adds r0, r3
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
ldrb r0, [r5, 0xC]
|
||||
muls r0, r1
|
||||
asrs r0, 8
|
||||
strh r0, [r7, 0x24]
|
||||
ldrb r2, [r7, 0x3]
|
||||
lsls r2, 26
|
||||
lsrs r2, 27
|
||||
movs r1, 0x24
|
||||
ldrsh r0, [r7, r1]
|
||||
negs r0, r0
|
||||
asrs r0, 1
|
||||
ldrb r5, [r5, 0xA]
|
||||
adds r0, r5
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 1
|
||||
adds r1, r3
|
||||
ldrh r4, [r1]
|
||||
ldr r1, =gOamMatrices
|
||||
lsls r2, 3
|
||||
adds r2, r1
|
||||
adds r0, 0x40
|
||||
lsls r0, 1
|
||||
adds r0, r3
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r2, 0x6]
|
||||
strh r0, [r2]
|
||||
strh r4, [r2, 0x2]
|
||||
lsls r0, r4, 16
|
||||
asrs r0, 16
|
||||
negs r0, r0
|
||||
strh r0, [r2, 0x4]
|
||||
ldr r0, =sub_810E520
|
||||
str r0, [r7, 0x1C]
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_810E314
|
||||
|
||||
thumb_func_start sub_810E520
|
||||
sub_810E520: @ 810E520
|
||||
push {r4-r7,lr}
|
||||
|
@ -165,6 +165,7 @@ SECTIONS {
|
||||
src/ice.o(.text);
|
||||
src/fight.o(.text);
|
||||
src/poison.o(.text);
|
||||
src/flying.o(.text);
|
||||
asm/flying.o(.text);
|
||||
src/psychic.o(.text);
|
||||
src/bug.o(.text);
|
||||
|
312
src/flying.c
312
src/flying.c
@ -1,13 +1,16 @@
|
||||
#include "global.h"
|
||||
#include "battle_anim.h"
|
||||
#include "palette.h"
|
||||
#include "trig.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "constants/rgb.h"
|
||||
|
||||
extern void sub_810DE70(struct Sprite *);
|
||||
extern void sub_810DFA8(struct Sprite *);
|
||||
extern void sub_810E044(struct Sprite *);
|
||||
extern void sub_810E13C(struct Sprite *);
|
||||
extern void sub_810E1C8(struct Sprite *);
|
||||
extern void sub_810E314(struct Sprite *);
|
||||
void sub_810DE70(struct Sprite *);
|
||||
void sub_810DFA8(struct Sprite *);
|
||||
void sub_810E044(struct Sprite *);
|
||||
void sub_810E13C(struct Sprite *);
|
||||
void sub_810E1C8(struct Sprite *);
|
||||
void sub_810E314(struct Sprite *);
|
||||
extern void sub_810EA4C(struct Sprite *);
|
||||
extern void sub_810EAA0(struct Sprite *);
|
||||
extern void sub_810EC34(struct Sprite *);
|
||||
@ -18,6 +21,13 @@ extern void sub_810EEF8(struct Sprite *);
|
||||
extern void sub_810F004(struct Sprite *);
|
||||
extern void sub_810F084(struct Sprite *);
|
||||
|
||||
static void sub_810DE98(struct Sprite *);
|
||||
static void sub_810DF18(u8);
|
||||
static void sub_810E028(struct Sprite *);
|
||||
static void sub_810E184(struct Sprite *);
|
||||
static void sub_810E24C(struct Sprite *);
|
||||
void sub_810E520(struct Sprite *);
|
||||
|
||||
const struct SpriteTemplate gUnknown_08596270 =
|
||||
{
|
||||
.tileTag = ANIM_TAG_GUST,
|
||||
@ -326,3 +336,293 @@ const struct SpriteTemplate gUnknown_08596514 =
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_810F084,
|
||||
};
|
||||
|
||||
|
||||
void sub_810DE70(struct Sprite *sprite)
|
||||
{
|
||||
InitSpritePosToAnimTarget(sprite, FALSE);
|
||||
sprite->pos1.y += 20;
|
||||
sprite->data[1] = 191;
|
||||
sprite->callback = sub_810DE98;
|
||||
sprite->callback(sprite);
|
||||
}
|
||||
|
||||
static void sub_810DE98(struct Sprite *sprite) {
|
||||
sprite->pos2.x = Sin(sprite->data[1], 32);
|
||||
sprite->pos2.y = Cos(sprite->data[1], 8);
|
||||
sprite->data[1] += 5;
|
||||
sprite->data[1] &= 0xFF;
|
||||
if (++sprite->data[0] == 71)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
void sub_810DED8(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].data[0] = gBattleAnimArgs[1];
|
||||
gTasks[taskId].data[1] = gBattleAnimArgs[0];
|
||||
gTasks[taskId].data[2] = IndexOfSpritePaletteTag(ANIM_TAG_GUST);
|
||||
gTasks[taskId].func = sub_810DF18;
|
||||
}
|
||||
|
||||
static void sub_810DF18(u8 taskId)
|
||||
{
|
||||
u8 data2;
|
||||
u16 temp;
|
||||
int i, base;
|
||||
|
||||
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1])
|
||||
{
|
||||
gTasks[taskId].data[10] = 0;
|
||||
data2 = gTasks[taskId].data[2];
|
||||
temp = gPlttBufferFaded[16 * data2 + 0x108];
|
||||
i = 7;
|
||||
base = data2 * 16;
|
||||
|
||||
do
|
||||
{
|
||||
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
|
||||
i--;
|
||||
}
|
||||
while (i > 0);
|
||||
|
||||
gPlttBufferFaded[base + 0x101] = temp;
|
||||
}
|
||||
|
||||
if (--gTasks[taskId].data[0] == 0)
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
|
||||
void sub_810DFA8(struct Sprite *sprite)
|
||||
{
|
||||
InitSpritePosToAnimAttacker(sprite, TRUE);
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||
|
||||
sprite->data[0] = gBattleAnimArgs[4];
|
||||
sprite->data[1] = sprite->pos1.x;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
|
||||
sprite->data[3] = sprite->pos1.y;
|
||||
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
|
||||
InitAnimLinearTranslation(sprite);
|
||||
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
|
||||
StoreSpriteCallbackInData6(sprite, sub_810E028);
|
||||
}
|
||||
|
||||
static void sub_810E028(struct Sprite *sprite)
|
||||
{
|
||||
if (AnimTranslateLinear(sprite))
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
void sub_810E044(struct Sprite *sprite)
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
{
|
||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||
}
|
||||
|
||||
if (IsContest())
|
||||
{
|
||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||
}
|
||||
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
sprite->pos1.x += gBattleAnimArgs[0];
|
||||
sprite->pos1.y += gBattleAnimArgs[1];
|
||||
sprite->data[0] = gBattleAnimArgs[4];
|
||||
|
||||
if (gBattleAnimArgs[6] == 0)
|
||||
{
|
||||
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
||||
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->data[2], &sprite->data[4]);
|
||||
}
|
||||
|
||||
sprite->data[2] = sprite->data[2] + gBattleAnimArgs[2];
|
||||
sprite->data[4] = sprite->data[4] + gBattleAnimArgs[3];
|
||||
sprite->callback = StartAnimLinearTranslation;
|
||||
|
||||
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
|
||||
SeekSpriteAnim(sprite, gBattleAnimArgs[5]);
|
||||
}
|
||||
|
||||
void sub_810E13C(struct Sprite *sprite)
|
||||
{
|
||||
InitSpritePosToAnimAttacker(sprite, TRUE);
|
||||
sprite->data[0] = gBattleAnimArgs[2];
|
||||
sprite->data[1] = gBattleAnimArgs[3];
|
||||
sprite->callback = sub_810E184;
|
||||
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = 1;
|
||||
}
|
||||
|
||||
static void sub_810E184(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0] > 0)
|
||||
{
|
||||
sprite->data[0]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->data[2] += sprite->data[1];
|
||||
sprite->pos2.y -= (sprite->data[2] >> 8);
|
||||
}
|
||||
|
||||
if (sprite->pos1.y + sprite->pos2.y < -32)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
void sub_810E1C8(struct Sprite *sprite)
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
{
|
||||
sprite->pos1.x = 272;
|
||||
sprite->pos1.y = -32;
|
||||
StartSpriteAffineAnim(sprite, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.x = -32;
|
||||
sprite->pos1.y = -32;
|
||||
}
|
||||
|
||||
sprite->data[0] = gBattleAnimArgs[0];
|
||||
sprite->data[1] = sprite->pos1.x;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
||||
sprite->data[3] = sprite->pos1.y;
|
||||
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
|
||||
InitAnimLinearTranslation(sprite);
|
||||
sprite->callback = sub_810E24C;
|
||||
}
|
||||
|
||||
static void sub_810E24C(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 1;
|
||||
AnimTranslateLinear(sprite);
|
||||
if (((u16)sprite->data[3] >> 8) > 200)
|
||||
{
|
||||
sprite->pos1.x += sprite->pos2.x;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->data[3] &= 0xFF;
|
||||
}
|
||||
|
||||
if ((u32)(sprite->pos1.x + sprite->pos2.x + 32) > 304 || sprite->pos1.y + sprite->pos2.y > 160)
|
||||
{
|
||||
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = 0;
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_810E2C8(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0]-- <= 0)
|
||||
{
|
||||
if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK)
|
||||
{
|
||||
FreeOamMatrix(sprite->oam.matrixNum);
|
||||
sprite->oam.affineMode = 0;
|
||||
}
|
||||
|
||||
DestroySprite(sprite);
|
||||
gAnimVisualTaskCount--;
|
||||
}
|
||||
}
|
||||
|
||||
// FAKEMATCHING
|
||||
void sub_810E314(struct Sprite *sprite)
|
||||
{
|
||||
s16 *data;
|
||||
u8 slot;
|
||||
s16 spriteCoord;
|
||||
int t1, t2;
|
||||
u32 arg2;
|
||||
u32 matrixNum;
|
||||
u8 sinIndex;
|
||||
register s16 sinVal asm ("r4");
|
||||
register int sinVal2 asm ("r0");
|
||||
|
||||
data = sprite->data;
|
||||
|
||||
if (gBattleAnimArgs[7] & 0x100)
|
||||
slot = gBattleAnimAttacker;
|
||||
else
|
||||
slot = gBattleAnimTarget;
|
||||
|
||||
if (GetBattlerSide(slot) == B_SIDE_PLAYER)
|
||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(slot, 0) + gBattleAnimArgs[0];
|
||||
spriteCoord = GetBattlerSpriteCoord(slot, 1);
|
||||
sprite->pos1.y = spriteCoord + gBattleAnimArgs[1];
|
||||
data[4] = sprite->pos1.y << 8;
|
||||
|
||||
t1 = (spriteCoord + (u16) gBattleAnimArgs[6]) << 1;
|
||||
data[7] = (data[7] & 1) | t1;
|
||||
((u8 *) data)[0] |= 4;
|
||||
|
||||
arg2 = (u16) gBattleAnimArgs[2];
|
||||
data[1] = (u8) gBattleAnimArgs[2];
|
||||
arg2 <<= 16;
|
||||
data[5] = arg2 >> 24;
|
||||
data[2] = gBattleAnimArgs[3];
|
||||
data[3] = gBattleAnimArgs[4];
|
||||
data[6] = gBattleAnimArgs[5];
|
||||
|
||||
if ((u16) (data[1] - 64) <= 0x7f)
|
||||
{
|
||||
if (!IsContest())
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(slot) + 1;
|
||||
else
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(slot);
|
||||
|
||||
((u8 *) data)[14] = data[7] & -2;
|
||||
|
||||
if (!(data[2] & 0x8000))
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
|
||||
sprite->animBeginning = 1;
|
||||
sprite->animEnded = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(slot);
|
||||
((u8 *) data)[14] |= 1;
|
||||
|
||||
if (data[2] & 0x8000)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
|
||||
sprite->animBeginning = 1;
|
||||
sprite->animEnded = 0;
|
||||
}
|
||||
}
|
||||
|
||||
t2 = (u16) data[1] >> 6 << 4;
|
||||
((u8 *) data)[0] = (15 & data[0]) | t2;
|
||||
|
||||
sprite->pos2.x = (gSineTable[(u16) data[1]] * (u8) data[6]) >> 8;
|
||||
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
|
||||
sinIndex = (-sprite->pos2.x >> 1) + data[5];
|
||||
sinVal = gSineTable[sinIndex];
|
||||
|
||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||
gOamMatrices[matrixNum].b = sinVal;
|
||||
sinVal2 = -sinVal;
|
||||
gOamMatrices[matrixNum].c = sinVal2;
|
||||
|
||||
sprite->callback = sub_810E520;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user