Difference between revisions of "Knockback"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Notes - return link - color)
m (Nyzer moved page Knockback? to Knockback: Fucking question marks)
 
(No difference)

Latest revision as of 22:00, 22 December 2024

Set Fall damage if any
Turn off the 0x80 flag of "post action byte" at 0x801938ed (which is mandatory to run in this routine from preformula routine)
-------------------------------------------------------------------------------------------------------------------------------
0018ae3c: 27bdffe8 addiu r29,r29,0xffe8     |
0018ae40: afbf0010 sw r31,0x0010(r29)       |
0018ae44: 0c062b7d jal 0x0018adf4           |-->Action_data_nulling (reset most of attacker and target current action flags)
0018ae48: 00000000 nop                      |
0018ae4c: 3c068019 lui r6,0x8019            |
0018ae50: 24c638ed addiu r6,r6,0x38ed       |
0018ae54: 90c20000 lbu r2,0x0000(r6)        |r2 = knockback/poach/ post action ? byte ( 0x801938ed )
0018ae58: 00000000 nop                      |
0018ae5c: 3042007f andi r2,r2,0x007f        |r2 = r2 without 0x80 (flagged as fall dmg not calculated)
0018ae60: a0c20000 sb r2,0x0000(r6)         |store knockback/poach/ post action ? byte ( 0x801938ed ) with 0x80 removed?
0018ae64: 3c038019 lui r3,0x8019            |
0018ae68: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target current action data pointer
0018ae6c: 34020001 ori r2,r0,0x0001         |r2 = 0x01
0018ae70: a0620025 sb r2,0x0025(r3)         |Store target current action attack type = pseudo status
0018ae74: 3c058019 lui r5,0x8019            |
0018ae78: 8ca52d98 lw r5,0x2d98(r5)         |r5 = Target data pointer
0018ae7c: 00000000 nop                      |
0018ae80: 94a20058 lhu r2,0x0058(r5)        |load target current status set 1 and 2
0018ae84: 00000000 nop                      |
0018ae88: 30428060 andi r2,r2,0x8060        |r2 <> 0x00 if target has petrify, crystal or death
0018ae8c: 14400023 bne r2,r0,0x0018af1c     #If target isn't dead, crystalized nor petrified /Else branch to End
0018ae90: 00002021 addu r4,r0,r0            |r4 = 0x00  (will be fall damage if any)
0018ae94: 90c30000 lbu r3,0x0000(r6)             |r3 = knockback/poach/ post action ? byte ( 0x801938ed )
0018ae98: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0018ae9c: 14620017 bne r3,r2,0x0018aefc          #If post action byte is  0x01 (non flying unit ?) /Else branch to store damage section (with r4 = 0x00)
0018aea0: 00000000 nop                               | 
0018aea4: 3c028019 lui r2,0x8019                     | 
0018aea8: 904238ee lbu r2,0x38ee(r2)                 |r2 = fall distance*2?
0018aeac: 90a3003b lbu r3,0x003b(r5)                 |r3 = Target jump
0018aeb0: 00021042 srl r2,r2,0x01                    |r2 = r2/2 (nb of tiles fallen)
0018aeb4: 00431823 subu r3,r2,r3                     |r3 = fallen height - jump
0018aeb8: 18600010 blez r3,0x0018aefc                #If Fallen height > Target jump /Else branch to store damage section (with r4 = 0x00)
0018aebc: 00000000 nop                                   | 
0018aec0: 94a2002a lhu r2,0x002a(r5)                     |r2 = Target max hp
0018aec4: 00000000 nop                                   |
0018aec8: 00620018 mult r3,r2                            |
0018aecc: 00001812 mflo r3                               |r3 =  Target max hp * (fallen height - jump)
0018aed0: 3c026666 lui r2,0x6666                         |
0018aed4: 34426667 ori r2,r2,0x6667                      |r2 = 66666667 (it's 0,4 * 2^32)
0018aed8: 00620018 mult r3,r2                            |
0018aedc: 00031fc3 sra r3,r3,0x1f                        |r3 = 0x00 (in theory could be 0x01 if r3 is 2^32 …)
0018aee0: 00001010 mfhi r2                               |r2 = Target max hp * (fallen height - jump) * 0,4
0018aee4: 00021083 sra r2,r2,0x02                        |r2 = Target max hp * (fallen height - jump) * 0,1 = Fall damage
0018aee8: 00432023 subu r4,r2,r3                         |r4 =  r2 (fall damage)
0018aeec: 288203e8 slti r2,r4,0x03e8                     |r2 = 0x01 if fall damage < 1000
0018aef0: 14400002 bne r2,r0,0x0018aefc                  #if fall damage > 999
0018aef4: 00000000 nop                                       | 
0018aef8: 340403e7 ori r4,r0,0x03e7                          |r4 = fall damage limited to 999
0018aefc: 3c038019 lui r3,0x8019            |
0018af00: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target current action data pointer
0018af04: 10800005 beq r4,r0,0x0018af1c     #If there is any fall damage /Else branch to end
0018af08: a4640004 sh r4,0x0004(r3)             |store r4 as target current action HP damage
0018af0c: 90620025 lbu r2,0x0025(r3)            |r2 = target current action attack type
0018af10: 00000000 nop                          |
0018af14: 34420080 ori r2,r2,0x0080             |r2 = r2 with 0x80 flag enabled
0018af18: a0620025 sb r2,0x0025(r3)             |store r2  as target current action attack type updated with HP damage
0018af1c: 8fbf0010 lw r31,0x0010(r29)       |End
0018af20: 27bd0018 addiu r29,r29,0x0018     
0018af24: 03e00008 jr r31                   
0018af28: 00000000 nop

Retun location

0018b43c: Pre_Formula_Setup_(FDC)