Get Unit's Spritesheet Value

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameter : r4 = misc unit data pointer (or 0x00 if not found)
Returns : r2 = 0x00 if invalid pointer, or unit is dead, crystal or treasure
          r2 = Unit's spritesheet Graphic height ( 0x80094748 + 0x03)
----------------------------------------------------------------------------------
0008dc24: 10800011 beq r4,r0,0x0008dc6c     #If Unit misc. Data pointer <> 0x00 /If pointer is invalid, go to END (with r2 = 0x00)
0008dc28: 00001021 addu r2,r0,r0                 |r2 = 0x00 (Fail)
0008dc2c: 8c820144 lw r2,0x0144(r4)              |r2 = Unit's Status Flags 5
0008dc30: 00000000 nop                           |
0008dc34: 30420009 andi r2,r2,0x0009             |r2 <> 0x00 if unit is Crystal or treasure
0008dc38: 1440000c bne r2,r0,0x0008dc6c          #If unit is neither crystal nor treasure / Else branch to End (with r2 = 0x00)
0008dc3c: 00001021 addu r2,r0,r0                 |r2 = 0x00 (Fail)
0008dc40: 8c820140 lw r2,0x0140(r4)                  |r2 = Unit's Status Flags 1 to 4 (word)
0008dc44: 00000000 nop                               |
0008dc48: 30420004 andi r2,r2,0x0004                 |r2 = 0x04 if unit is dead
0008dc4c: 14400007 bne r2,r0,0x0008dc6c              #If unit is not Dead / Else branch to End (with r2 = 0x00)
0008dc50: 00001021 addu r2,r0,r0                     |r2 = 0x00 (Fail)
0008dc54: 90820006 lbu r2,0x0006(r4)                     |r2 = Units Spritesheet ID
0008dc58: 00000000 nop                                   |
0008dc5c: 00021080 sll r2,r2,0x02                        |r2 = Units Spritesheet ID * 4
0008dc60: 3c018009 lui r1,0x8009                         |
0008dc64: 00220821 addu r1,r1,r2                         |
0008dc68: 9022474b lbu r2,0x474b(r1)                     |r2 = Unit's Spritesheet graphic height  ( 0x80094748 + 0x03 ) + Spritesheet ID * 4
0008dc6c: 03e00008 jr r31                  END
0008dc70: 00000000 nop

Return location

0008dc8c: 0008dc74_-_0008dc98
0008dcb4: Find_Unit's_Misc_Data_Pointer_and_Load_Spritesheet_Value