Has Status Effect (For Status Window)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: HAS STATUS EFFECT (FOR STATUS WINDOW)
#       Determines if the specified unit has at least one status effect.
#       Return value of this routine determines if status window shows or not.  (Comes up when pressing O button on a character screen in battle)
#
#       Parameters:
#           r4 = [Unit index]
#       Returns:
#           r2 = {
#               1, If the unit specified by ([Unit index]) has at least one status effect
#               0, Otherwise
#           }

00133c98: 27bdffe8 addiu r29,r29,0xffe8
00133c9c: afbf0010 sw r31,0x0010(r29)
00133ca0: 0c0602bf jal 0x00180afc               #   ROUTINE: Get Unit's Data Pointer (In-battle unit data)
00133ca4: 00000000 nop
00133ca8: 00402021 addu r4,r2,r0                #   Unit in-battle pointer
00133cac: 00001821 addu r3,r0,r0                #   [Status byte index] = 0
00133cb0: 00831021 addu r2,r4,r3
                                                #   do {
00133cb4: 90420058 lbu r2,0x0058(r2)            #       Get [Current Status byte] (Offset by [Status byte index]) for this unit
00133cb8: 00000000 nop
00133cbc: 10400003 beq r2,r0,0x00133ccc
00133cc0: 24630001 addiu r3,r3,0x0001           #       [Status byte index] = [Status byte index] + 1
                                                #       if ([Current Status byte] != 0)
00133cc4: 0804cf37 j 0x00133cdc                 #           return 1
00133cc8: 34020001 ori r2,r0,0x0001

00133ccc: 28620005 slti r2,r3,0x0005            #       (Check if [Status byte index] < 5)   
00133cd0: 1440fff8 bne r2,r0,0x00133cb4
00133cd4: 00831021 addu r2,r4,r3                #       (Point to next status byte based on [Status byte index])
                                                #   } while ([Status byte index] < 5)

00133cd8: 00001021 addu r2,r0,r0                #   return 0
00133cdc: 8fbf0010 lw r31,0x0010(r29)
00133ce0: 27bd0018 addiu r29,r29,0x0018
00133ce4: 03e00008 jr r31
00133ce8: 00000000 nop