Draw out routine dealing with experience gain

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters : r4 = Attacker data pointer
             r5 = Attacker misc data 0x18c pointer
             r6 = Number of hitted units

Do some post-action stuff related to katana inventory usage
- If katana do not break (special flag 1 = 0x08 or Targeted units = 0x00)
     --> Overrides all Attacker current action specials flags with 0x0008
     --> Set Attacker current action hit flag = 0x01 (hit) 
     --> Set Attacker current action type = 0x01 (pseudo status change)  
- Else seems to do nothing (...)
Note : Attacker current action evade type is set to 0x08 in break chance routine (might be changed later ?)
------------------------------------------------------------------------------------------------------------------------
0017d410: 9082016f lbu r2,0x016f(r4)        |r4 = Attacker last used skillset
0017d414: 3c018006 lui r1,0x8006            |
0017d418: 00220821 addu r1,r1,r2            |r1 = 0x80060000 + Skillset ID
0017d41c: 90235cb4 lbu r3,0x5cb4(r1)        |r3 = Attacker used action menu ( 0x80065cb4 + skillset ID)
0017d420: 34020007 ori r2,r0,0x0007         |r2 = 0x07 (katana inventory ID)
0017d424: 1462001c bne r3,r2,0x0017d498     #If used action menu is katana inventory /Else branch to END
0017d428: 3402005d ori r2,r0,0x005d              |r2 = 0x5d (Mime job ID)
0017d42c: 90830003 lbu r3,0x0003(r4)             |r3 = Attacker job ID
0017d430: 00000000 nop                           |
0017d434: 10620018 beq r3,r2,0x0017d498          #If Attacker job is NOT mime /Else branch to END
0017d438: 30c200ff andi r2,r6,0x00ff                 |r2 = Number of hitted target
0017d43c: 10400007 beq r2,r0,0x0017d45c              #If Number of hitted unit > 0x00
0017d440: 34020008 ori r2,r0,0x0008                  |r2 = 0x08
0017d444: 3c038019 lui r3,0x8019                         | 
0017d448: 94632db0 lhu r3,0x2db0(r3)                     |r3 = Attacker current action specials flags 1 and 2 from 0x80192da0 + 0x10 (copy of attacker data)
0017d44c: 00000000 nop                                   |
0017d450: 30620008 andi r2,r3,0x0008                     |r2 = 0x0008 if Special flag 1 0x08 is enabled (stole item ?)
0017d454: 1040000a beq r2,r0,0x0017d480                  #If Katana do not break /Else branch to broke section
0017d458: 34020008 ori r2,r0,0x0008                          |r2 = 0x08
0017d45c: 3c018019 lui r1,0x8019                     #E      |r1 = 0x80190000
0017d460: a4222db0 sh r2,0x2db0(r1)                          |Overrides all special flags with SF 1 = 0x08 and SF2 = 0x00  0x80192bd0
0017d464: 34020001 ori r2,r0,0x0001                          |r2 = 0x01
0017d468: 3c018019 lui r1,0x8019                             |r1 = 0x80190000
0017d46c: a0222dc5 sb r2,0x2dc5(r1)                          |Store 0x01 As Attacker current action attack type (pseudo status change) Overrides everything else
0017d470: 3c018019 lui r1,0x8019                             |
0017d474: a0222da0 sb r2,0x2da0(r1)                          |Store ACA hit flag = 0x01 (hit)
0017d478: 0805f526 j 0x0017d498                              >>Jump to END
0017d47c: 00000000 nop                                       |
0017d480: 30621000 andi r2,r3,0x1000                     #Else  r2 = 0x1000 if Special flag 2 0x10 is present Special flag 1 0x08 not present
0017d484: 10400004 beq r2,r0,0x0017d498                  #If Special flag 2 0x10 is present /Else branch to END
0017d488: 00000000 nop                                       | 
0017d48c: 90a20023 lbu r2,0x0023(r5)                         |r2 = Attacker misc data 0x1af
0017d490: 00000000 nop                                       |
0017d494: a0a20023 sb r2,0x0023(r5)                          |Store the data back unchanged ???
0017d498: 03e00008 jr r31                                        
0017d49c: 00000000 nop

Return locations

Battle.bin
0017d128: Main_ability_loading_routine?