Difference between revisions of "Get Unit's Spritesheet Value"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 0008dc24: 10800011 beq r4,r0,0x0008dc6c Branch if Misc Unit Data Pointer = 0 0008dc28: 00001021 addu r2,r0,r0 r2 = 0 (Fail) 0008dc2c: 8c820144 lw r2,0x0144(r4) Load Stat...")
 
m (Notes Formatting, return location)
 
Line 1: Line 1:
  0008dc24: 10800011 beq r4,r0,0x0008dc6c Branch if Misc Unit Data Pointer = 0
+
Parameter : r4 = misc unit data pointer (or 0x00 if not found)
  0008dc28: 00001021 addu r2,r0,r0 r2 = 0 (Fail)
+
Returns : r2 = 0x00 if invalid pointer, or unit is dead, crystal or treasure
  0008dc2c: 8c820144 lw r2,0x0144(r4) Load Status Flags 5
+
          r2 = Unit's spritesheet '''Graphic height''' ( 0x80094748 + 0x03)
  0008dc30: 00000000 nop
+
----------------------------------------------------------------------------------
  0008dc34: 30420009 andi r2,r2,0x0009
+
  0008dc24: 10800011 beq r4,r0,0x0008dc6c     {{f/Cond|<nowiki>If Unit misc. Data pointer <> 0x00</nowiki>}} /If pointer is invalid, go to END ('''with r2 = 0x00''')
  0008dc38: 1440000c bne r2,r0,0x0008dc6c Branch if Unit is a Treasure/Crystal
+
  0008dc28: 00001021 addu r2,r0,r0                 |{{f/std|<nowiki>r2 = 0x00 (Fail)</nowiki>}}
  0008dc3c: 00001021 addu r2,r0,r0 r2 = 0 (Fail)
+
  0008dc2c: 8c820144 lw r2,0x0144(r4)             |{{f/adr|<nowiki>r2 = Unit's Status Flags 5</nowiki>}}
  0008dc40: 8c820140 lw r2,0x0140(r4) Load Status Flags 1-4
+
  0008dc30: 00000000 nop                           |
  0008dc44: 00000000 nop
+
  0008dc34: 30420009 andi r2,r2,0x0009             |{{f/std|<nowiki>r2 <> 0x00 if unit is Crystal or treasure</nowiki>}}
  0008dc48: 30420004 andi r2,r2,0x0004
+
  0008dc38: 1440000c bne r2,r0,0x0008dc6c         {{f/Cond|<nowiki>If unit is neither crystal nor treasure</nowiki>}} / Else branch to End ('''with r2 = 0x00''')
  0008dc4c: 14400007 bne r2,r0,0x0008dc6c Branch if Unit is Dead
+
  0008dc3c: 00001021 addu r2,r0,r0                 |{{f/std|<nowiki>r2 = 0x00 (Fail)</nowiki>}}
  0008dc50: 00001021 addu r2,r0,r0 r2 = 0 (Fail)
+
  0008dc40: 8c820140 lw r2,0x0140(r4)                 |{{f/adr|<nowiki>r2 = Unit's Status Flags 1 to 4 (word)</nowiki>}}
  0008dc54: 90820006 lbu r2,0x0006(r4) Load Spritesheet ID
+
  0008dc44: 00000000 nop                               |
  0008dc58: 00000000 nop
+
  0008dc48: 30420004 andi r2,r2,0x0004                 |{{f/std|<nowiki>r2 = 0x04 if unit is dead</nowiki>}}
  0008dc5c: 00021080 sll r2,r2,0x02 ID * 4
+
  0008dc4c: 14400007 bne r2,r0,0x0008dc6c             {{f/Cond|<nowiki>If unit is not Dead</nowiki>}} / Else branch to End ('''with r2 = 0x00''')
  0008dc60: 3c018009 lui r1,0x8009
+
  0008dc50: 00001021 addu r2,r0,r0                     |{{f/std|<nowiki>r2 = 0x00 (Fail)</nowiki>}}
  0008dc64: 00220821 addu r1,r1,r2
+
  0008dc54: 90820006 lbu r2,0x0006(r4)                     |{{f/load|<nowiki>r2 = Units Spritesheet ID</nowiki>}}
  0008dc68: 9022474b lbu r2,0x474b(r1) Load Spritesheet's Value
+
  0008dc58: 00000000 nop                                   |
  0008dc6c: 03e00008 jr r31
+
  0008dc5c: 00021080 sll r2,r2,0x02                       |{{f/std|<nowiki>r2 = Units Spritesheet ID * 4</nowiki>}}
 +
  0008dc60: 3c018009 lui r1,0x8009                         |
 +
  0008dc64: 00220821 addu r1,r1,r2                         |
 +
  0008dc68: 9022474b lbu r2,0x474b(r1)                     |{{f/load|<nowiki>r2 = Unit's Spritesheet graphic height</nowiki>}} {{f/std|<nowiki> ( 0x80094748 + 0x03 ) + Spritesheet ID * 4</nowiki>}}
 +
  0008dc6c: 03e00008 jr r31                 '''END'''
 
  0008dc70: 00000000 nop
 
  0008dc70: 00000000 nop
 +
===Return location===
 +
0008dc8c: [[0008dc74_-_0008dc98]]
 +
0008dcb4: [[Find_Unit%27s_Misc_Data_Pointer_and_Load_Spritesheet_Value]]

Latest revision as of 13:49, 8 December 2021

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