Remove control based on status

From Final Fantasy Hacktics Wiki
Revision as of 19:58, 11 March 2022 by Orkney (talk | contribs)
Jump to navigation Jump to search
Parameters : r4 = Targeted unit data pointer

Remove ENTD control flag if Targeted Unit has confusion / blood suck / charm / berserk / chicken
If Not ENTD (0x05) is restored by default from Unit 0x1ba (modified ENTD flags)
If Target is not charmed : restore Team from modified ENTD flag
----------------------------------------------------------------------------------------------------------------
0018e1b0: 90820059 lbu r2,0x0059(r4)        |r2 = Targeted Unit curent status set 2
0018e1b4: 00000000 nop                      |
0018e1b8: 30420014 andi r2,r2,0x0014        |r2 <> 0x00 if Targeted Unit has confusion/blood suck
0018e1bc: 1440000b bne r2,r0,0x0018e1ec     #If Targeted Unit has neither confusion nor blood suck
0018e1c0: 00000000 nop                          |
0018e1c4: 9082005a lbu r2,0x005a(r4)            |r2 = Targeted Unit current status set 3
0018e1c8: 00000000 nop                          |
0018e1cc: 3042000c andi r2,r2,0x000c            |r2<> 0x00 if Targeted Unit has berserk or chicken
0018e1d0: 14400006 bne r2,r0,0x0018e1ec         #branch if target is berserk/chicken
0018e1d4: 00000000 nop                              |
0018e1d8: 9082005c lbu r2,0x005c(r4)                |r2 = Targeted Unit current status set 5
0018e1dc: 00000000 nop                              |
0018e1e0: 30420020 andi r2,r2,0x0020                |r2<> 0x00 if Targeted Unit has charm
0018e1e4: 10400006 beq r2,r0,0x0018e200             #If Targeted Unit has charm
0018e1e8: 00000000 nop                                  |
0018e1ec: 90820005 lbu r2,0x0005(r4)        #E   #E     |r2 = Targeted Unit ENTD flags
0018e1f0: 00000000 nop                                  |
0018e1f4: 304200f7 andi r2,r2,0x00f7                    |r2 = Targeted Unit ENTD flags without [Control] flag
0018e1f8: 08063885 j 0x0018e214                         >>jump avoiding Targeted Unit control restoration
0018e1fc: a0820005 sb r2,0x0005(r4)                     |Store Targeted Unit ENTD disabling unit control
                                            #Else Targeted Unit has no status removing control
0018e200: 908201ba lbu r2,0x01ba(r4)            |r2 = Targeted Unit modified ENTD flags
0018e204: 90830005 lbu r3,0x0005(r4)            |r3 = Targeted Unit ENTD flags
0018e208: 30420008 andi r2,r2,0x0008            |r2 = 0x08 if modified ENTD flag [control] is enabled
0018e20c: 00621825 or r3,r3,r2                  |r3 = Targeted Unit ENTD flags + [Control] if present in modified ENTD flags
0018e210: a0830005 sb r3,0x0005(r4)             |Restore control if present in modified ENTD flags
0018e214: 9082005c lbu r2,0x005c(r4)        |r2 = Targeted Unit curent status set 5
0018e218: 00000000 nop                      |
0018e21c: 30420020 andi r2,r2,0x0020        |r2 = 0x20 if Targeted Unit is charmed
0018e220: 14400007 bne r2,r0,0x0018e240     #If Targeted Unit is not charmed - restore team
0018e224: 00000000 nop                          |
0018e228: 90830005 lbu r3,0x0005(r4)            |r3 = Targeted Unit ENTD flags
0018e22c: 908201ba lbu r2,0x01ba(r4)            |r2 = Targeted Unit modified ENTD flags
0018e230: 306300cf andi r3,r3,0x00cf            |r3 = Targeted Unit ENTD flags - everything but team flags
0018e234: 30420030 andi r2,r2,0x0030            |r2 = Targeted Unit modified ENTD Team flags
0018e238: 00621825 or r3,r3,r2                  |r3 = ENTD flag upadted with modified ENTD Team
0018e23c: a0830005 sb r3,0x0005(r4)             |Store updated ENTD flags
0018e240: 03e00008 jr r31                   END
0018e244: 00000000 nop

Return location

Battle.bin
0018e178: Post_Ability_Hardcoding?