Does Unit Have Status In Set

From Final Fantasy Hacktics Wiki
Revision as of 22:01, 11 August 2020 by Glain (talk | contribs) (Created page with " # ROUTINE: DOES UNIT HAVE STATUS IN SET # Checks if a unit has a status in the specified Status Set (from RAM location 0x800662d0). Returns true (1) if so, and fals...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: DOES UNIT HAVE STATUS IN SET
#       Checks if a unit has a status in the specified Status Set (from RAM location 0x800662d0).  Returns true (1) if so, and false (0) if not.
#       Parameters:
#           r4 = (unit) Unit in-battle data pointer
#           r5 = (statusSetIndex) Index of Status Set to check against
#       Returns:
#           r2 = true (1) if unit has at least one status in the set, false (0) otherwise

8005e1b0: 00003021 addu r6,r0,r0                        #   index = 0
8005e1b4: 3c038006 lui r3,0x8006
8005e1b8: 246362d0 addiu r3,r3,0x62d0                   #   statusSets
8005e1bc: 00051080 sll r2,r5,0x02                       #   statusSetIndex * 4
8005e1c0: 00451021 addu r2,r2,r5                        #   statusSetIndex * 5
8005e1c4: 00432821 addu r5,r2,r3                        #   statusBytePtr = statusSets[statusSetIndex]
                                                        #   do {
8005e1c8: 00861021 addu r2,r4,r6                               
8005e1cc: 90420058 lbu r2,0x0058(r2)                    #       unit.currentStatues[index]
8005e1d0: 90a30000 lbu r3,0x0000(r5)                    #       statusByte = *statusBytePtr
8005e1d4: 00000000 nop
8005e1d8: 00431024 and r2,r2,r3
8005e1dc: 14400006 bne r2,r0,0x8005e1f8                 #       if ((unit.currentStatues[index] & statusByte) != 0) return true;
8005e1e0: 34020001 ori r2,r0,0x0001
8005e1e4: 24c60001 addiu r6,r6,0x0001                   #       index = index + 1
8005e1e8: 28c20005 slti r2,r6,0x0005
8005e1ec: 1440fff6 bne r2,r0,0x8005e1c8
8005e1f0: 24a50001 addiu r5,r5,0x0001                   #       statusBytePtr = statusBytePtr + 1
                                                        #   } while (index < 5);
8005e1f4: 00001021 addu r2,r0,r0                        #   return false;
8005e1f8: 03e00008 jr r31
8005e1fc: 00000000 nop