Inflicted Status Changes

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters : r4 = Acting unit's data pointer
             r5 = Status set
             r6 = Status flag
             r7 = Change Type (0x00 = Add status / 0x01 = Remove / 0x02 = Overwrittes)

Will update r4 Unit's inflicted status (0x1bb + set) and Current status (0x58 + set) 
Adding / removing r6 Status or overwritting all satus with r6
-------------------------------------------------------------------------------------------
0005e6cc: 34020001 ori r2,r0,0x0001         |r2 = 0x01
0005e6d0: 10e20010 beq r7,r2,0x0005e714     #If Change Type <> 0x01 /Else branch to Disable status (Change type 0x01) Section
0005e6d4: 00c01821 addu r3,r6,r0            |r3 = Status flag
0005e6d8: 28e20002 slti r2,r7,0x0002             |r2 = 0x01 if Change type < 0x02
0005e6dc: 10400005 beq r2,r0,0x0005e6f4          #If Change Type  < 0x02 /Else branch to check 0x02
0005e6e0: 00000000 nop                               | 
0005e6e4: 10e00008 beq r7,r0,0x0005e708              #If change Type <> 0x00 /Else branch to Enable status (Change type 0x00) Section
0005e6e8: 00851021 addu r2,r4,r5                     |r2 = Unit's Data Pointer + Status Set ID
0005e6ec: 080179cc j 0x0005e730                          >>Jump to innate status section (no infliction)
0005e6f0: 00851821 addu r3,r4,r5                         |r3 = Unit's Data Pointer + Status Set ID
0005e6f4: 34020002 ori r2,r0,0x0002              |r2 = 0x02
0005e6f8: 10e2000b beq r7,r2,0x0005e728          #If Change type <> 0x02 /Else branch to owerwritte (0x02) Section
0005e6fc: 00000000 nop                               |
0005e700: 080179cc j 0x0005e730                      >>Jump to innate status section (no infliction)
0005e704: 00851821 addu r3,r4,r5                     |r3 = Unit's Data Pointer + Status Set ID

                                            ** ENABLE STATUS **
0005e708: 904201bb lbu r2,0x01bb(r2)             |r2 = Acting unit's inflicted status matching r5 set
0005e70c: 080179cb j 0x0005e72c                  >>jump to innate status section
0005e710: 00464025 or r8,r2,r6                   |Update inficted status with status flag (r6)

                                            ** DISABLE STATUS **
0005e714: 00851021 addu r2,r4,r5                 |r2 = Unit's Data Pointer + Status Set ID
0005e718: 904301bb lbu r3,0x01bb(r2)             |r3 = Acting unit's inflicted status matching r5 set
0005e71c: 00061027 nor r2,r0,r6                  |r2 = Every status but the one(s) in r6
0005e720: 080179cb j 0x0005e72c                  >>jump to innate status section
0005e724: 00624024 and r8,r3,r2                  |Update inficted status without status flag (r6)

                                            ** OVERRIDE STATUS **
0005e728: 00604021 addu r8,r3,r0                 |r8 = Statuses (will be stored, overwritting every other status)

                                            ** Resolution **
0005e72c: 00851821 addu r3,r4,r5            |r3 = Unit's Data Pointer + Status Set ID
0005e730: 9062004e lbu r2,0x004e(r3)        |r2 Acting Unit's Innate Statuses (matching status set)
0005e734: a06801bb sb r8,0x01bb(r3)         |Store new Inflicted Statuses (Added / removed / overwritten)
0005e738: 01021025 or r2,r8,r2              |r2 = Acting unit innate status  + Acting units inflicted status
0005e73c: 03e00008 jr r31                   |
0005e740: a0620058 sb r2,0x0058(r3)         |Store Inflicted Statuses and innate status as Acting unit current status

Return locations

SCUS_942.21
0005e864: Status_infliction/removal?  r5 = 0x00 / r6 = variable / r7 = 0x00
0005e878: Status_infliction/removal?  r5 = 0x00 / r6 = variable / r7 = 0x01

Battle.bin
0018f274: Mimic_ability_setting       r5 = 0x00 / r6 = 0xd / r7 = 0x01