Difference between revisions of "Process Expiring Statuses"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " # ROUTINE: PROCESS EXPIRING STATUSES # (Decrements Status CT, Sets up an action to remove appropriate statuses) # Parameters: # r4 = [Unit Index] 0018d91...")
 
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
 
  0018d924: 3c048019 lui r4,0x8019
 
  0018d924: 3c048019 lui r4,0x8019
 
  0018d928: 248408cc addiu r4,r4,0x08cc          #  Base Unit array pointer
 
  0018d928: 248408cc addiu r4,r4,0x08cc          #  Base Unit array pointer
  0018d92c: 0c063681 jal 0x0018da04              #  ROUTINE: Set Action Target Variables (Sets 0x80192d90 = Action, 0x80192d98 = Target, etc.)
+
  0018d92c: 0c063681 jal 0x0018da04              #  ROUTINE: [[Set Action Target Variables]] (Sets 0x80192d90 = Action, 0x80192d98 = Target, etc.)
 
  0018d930: 00442021 addu r4,r2,r4                #  Unit data pointer for specified (parameter) unit index
 
  0018d930: 00442021 addu r4,r2,r4                #  Unit data pointer for specified (parameter) unit index
 
  0018d934: 00002021 addu r4,r0,r0                #  statusCounter = 0
 
  0018d934: 00002021 addu r4,r0,r0                #  statusCounter = 0
 
  0018d938: 34090080 ori r9,r0,0x0080             
 
  0018d938: 34090080 ori r9,r0,0x0080             
                                                 #  (statusCounter goes from 0 to 14, and the loop loads statuses starting at byte 4.  This includes statuses from Poison through Reflect - the ones that expire).
+
                                                 #  (statusCounter goes from 0 to 14, and the loop loads statuses starting at byte 4.   
 +
                                                #        This includes statuses from Poison through Reflect - the ones that expire).
 
                                                 #  do {
 
                                                 #  do {
 
  0018d93c: 04810002 bgez r4,0x0018d948           
 
  0018d93c: 04810002 bgez r4,0x0018d948           

Latest revision as of 22:31, 7 September 2016

# ROUTINE: PROCESS EXPIRING STATUSES
#   (Decrements Status CT, Sets up an action to remove appropriate statuses)
#   Parameters:
#       r4 = [Unit Index]     

0018d910: 27bdffe8 addiu r29,r29,0xffe8
0018d914: afbf0010 sw r31,0x0010(r29)
0018d918: 000410c0 sll r2,r4,0x03               #   [Unit Index] * 8
0018d91c: 00441023 subu r2,r2,r4                #   [Unit Index] * 7
0018d920: 00021180 sll r2,r2,0x06               #   [Unit Index] * 448  (sizeof(Unit) == 448)
0018d924: 3c048019 lui r4,0x8019
0018d928: 248408cc addiu r4,r4,0x08cc           #   Base Unit array pointer
0018d92c: 0c063681 jal 0x0018da04               #   ROUTINE: Set Action Target Variables (Sets 0x80192d90 = Action, 0x80192d98 = Target, etc.)
0018d930: 00442021 addu r4,r2,r4                #   Unit data pointer for specified (parameter) unit index
0018d934: 00002021 addu r4,r0,r0                #   statusCounter = 0
0018d938: 34090080 ori r9,r0,0x0080             
                                                #   (statusCounter goes from 0 to 14, and the loop loads statuses starting at byte 4.  
                                                #        This includes statuses from Poison through Reflect - the ones that expire).
                                                #   do {
0018d93c: 04810002 bgez r4,0x0018d948           
0018d940: 00801021 addu r2,r4,r0
0018d944: 24820007 addiu r2,r4,0x0007
0018d948: 000210c3 sra r2,r2,0x03
0018d94c: 24480003 addiu r8,r2,0x0003           #       statusOffset = (statusCounter / 8) + 3  (Start at the 4th status byte, thus +3)
0018d950: 3c078019 lui r7,0x8019
0018d954: 8ce72d98 lw r7,0x2d98(r7)             #       Target
0018d958: 30830007 andi r3,r4,0x0007            #       statusCounter & 0x07 == statusCounter mod 8
0018d95c: 00e82821 addu r5,r7,r8                
0018d960: 90a201bb lbu r2,0x01bb(r5)            #       Load target action's inflicted status byte for this status
0018d964: 00693007 srav r6,r9,r3                #       currentStatusFlag = (0x80 >> (statusCounter mod 8))
0018d968: 00461024 and r2,r2,r6
0018d96c: 10400015 beq r2,r0,0x0018d9c4         #       if (current status is inflicted by target action) {
0018d970: 00000000 nop
0018d974: 90a2004e lbu r2,0x004e(r5)            #           load target's innate status byte for this status
0018d978: 00000000 nop
0018d97c: 00461024 and r2,r2,r6
0018d980: 14400010 bne r2,r0,0x0018d9c4         #           if (status is not innate) {
0018d984: 00e41821 addu r3,r7,r4
0018d988: 9062005d lbu r2,0x005d(r3)            #               load CT for current status
0018d98c: 00000000 nop
0018d990: 2442ffff addiu r2,r2,0xffff           #               CT = CT - 1
0018d994: a062005d sb r2,0x005d(r3)             #               Store CT as current status CT
0018d998: 304200ff andi r2,r2,0x00ff
0018d99c: 14400009 bne r2,r0,0x0018d9c4         #               if (CT == 0) {
0018d9a0: 00000000 nop
0018d9a4: 3c038019 lui r3,0x8019
0018d9a8: 8c632d90 lw r3,0x2d90(r3)             #                   Load current action
0018d9ac: 00000000 nop
0018d9b0: 00681821 addu r3,r3,r8
0018d9b4: 90620020 lbu r2,0x0020(r3)            #                   statusRemovalByte = (current action's status removal byte for this status)
0018d9b8: 00000000 nop
0018d9bc: 00c21025 or r2,r6,r2                  #                   Include currentStatusFlag in the status removal byte (statusRemovalByte = statusRemovalByte OR currentStatusFlag)
0018d9c0: a0620020 sb r2,0x0020(r3)             #                   Store as the current status removal byte
                                                #               }
                                                #           }
                                                #       }
0018d9c4: 24840001 addiu r4,r4,0x0001           #       statusCounter = statusCounter + 1
0018d9c8: 2882000f slti r2,r4,0x000f            
0018d9cc: 1440ffdb bne r2,r0,0x0018d93c         #   } while (statusCounter < 15)
0018d9d0: 00000000 nop
0018d9d4: 0c0612c9 jal 0x00184b24               #   ROUTINE: Modify Status Inflictions
0018d9d8: 00002021 addu r4,r0,r0                #       (Parameter: r4 = 0: Stricter status removal?)
0018d9dc: 10400005 beq r2,r0,0x0018d9f4         #   if (Result (At least one status inflicted or removed) != 0) {
0018d9e0: 34020008 ori r2,r0,0x0008
0018d9e4: 3c038019 lui r3,0x8019
0018d9e8: 8c632d90 lw r3,0x2d90(r3)             #       Load current action
0018d9ec: 00000000 nop
0018d9f0: a0620025 sb r2,0x0025(r3)             #       Store Action Display Type = 0x08 (Status change)
                                                #   }
0018d9f4: 8fbf0010 lw r31,0x0010(r29)
0018d9f8: 27bd0018 addiu r29,r29,0x0018
0018d9fc: 03e00008 jr r31
0018da00: 00000000 nop