Difference between revisions of "Check if Unit can be Targeted"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 0017bdd0: 27bdffe0 addiu r29,r29,0xffe0 0017bdd4: afb00010 sw r16,0x0010(r29) 0017bdd8: 00a08021 addu r16,r5,r0 r16 = Stack Pointer 0017bddc: 000410c0 sll r2,r4,0x03 Uni...")
 
m (return link)
Line 1: Line 1:
  0017bdd0: 27bdffe0 addiu r29,r29,0xffe0
+
  0017bdd0: 27bdffe0 addiu r29,r29,0xffe0     |
  0017bdd4: afb00010 sw r16,0x0010(r29)
+
  0017bdd4: afb00010 sw r16,0x0010(r29)       |
  0017bdd8: 00a08021 addu r16,r5,r0 r16 = Stack Pointer
+
  0017bdd8: 00a08021 addu r16,r5,r0           |{{f/std|<nowiki>r16 = Stack Pointer (previous routine - r29 0x10)</nowiki>}}
  0017bddc: 000410c0 sll r2,r4,0x03 Unit ID * 8
+
  0017bddc: 000410c0 sll r2,r4,0x03           |{{f/std|<nowiki>r2 =Unit ID * 8</nowiki>}}
  0017bde0: 00441023 subu r2,r2,r4 ID * 7
+
  0017bde0: 00441023 subu r2,r2,r4           |{{f/std|<nowiki>r2 =Unit ID * 7</nowiki>}}
  0017bde4: 00021180 sll r2,r2,0x06 ID * 448
+
  0017bde4: 00021180 sll r2,r2,0x06           |{{f/std|<nowiki>r2 =Unit ID * 448 (0x1c0)</nowiki>}}
  0017bde8: 3c038019 lui r3,0x8019
+
  0017bde8: 3c038019 lui r3,0x8019           |
  0017bdec: 246308cc addiu r3,r3,0x08cc
+
  0017bdec: 246308cc addiu r3,r3,0x08cc       |{{f/std|<nowiki>r3 = 0x801908cc (start of unit 0x00 data)</nowiki>}}
  0017bdf0: afb10014 sw r17,0x0014(r29)
+
  0017bdf0: afb10014 sw r17,0x0014(r29)       |
  0017bdf4: 00438821 addu r17,r2,r3 r17 = Unit's Data Pointer
+
  0017bdf4: 00438821 addu r17,r2,r3           |{{f/adr|<nowiki>r17 = Unit's Data Pointer</nowiki>}}
  0017bdf8: afbf0018 sw r31,0x0018(r29)
+
  0017bdf8: afbf0018 sw r31,0x0018(r29)       |
  0017bdfc: 0c060428 jal 0x001810a0 [[Map Location Calculation]]
+
  0017bdfc: 0c060428 jal 0x001810a0           |{{f/jal|Map Location Calculation|<nowiki>Map Location Calculation</nowiki>}}  return r2 = Unit Tile Info ( X coord.  +( Y coord. * Map Max X) + elevation * 256 (= 0x00 or 0x100)
  0017be00: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0017be00: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit's Data Pointer</nowiki>}}
  0017be04: ae020000 sw r2,0x0000(r16) Store Tile ID
+
  0017be04: ae020000 sw r2,0x0000(r16)       |{{f/store|<nowiki>Store Tile ID in stack pointer  (previous routine - r29 0x10)</nowiki>}}
  0017be08: 92230001 lbu r3,0x0001(r17) Load Unit's ID
+
  0017be08: 92230001 lbu r3,0x0001(r17)       |{{f/load|<nowiki>r3 = Unit ID</nowiki>}}
  0017be0c: 340200ff ori r2,r0,0x00ff
+
  0017be0c: 340200ff ori r2,r0,0x00ff         |{{f/std|<nowiki>r2 = 0xff</nowiki>}}
  0017be10: 1062000f beq r3,r2,0x0017be50 Branch if Unit doesn't exist
+
  0017be10: 1062000f beq r3,r2,0x0017be50     {{f/Cond|<nowiki>If unit exists</nowiki>}} / Else branch to {{f/loc|<nowiki>End</nowiki>}} With r2 = 0x01
  0017be14: 34020001 ori r2,r0,0x0001 r2 = 1
+
  0017be14: 34020001 ori r2,r0,0x0001         |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0017be18: 92220058 lbu r2,0x0058(r17) Load Unit's Current Statuses 1
+
  0017be18: 92220058 lbu r2,0x0058(r17)           |{{f/load|<nowiki>r2 = Unit's Current Statuses 1</nowiki>}}
  0017be1c: 00000000 nop
+
  0017be1c: 00000000 nop                           |
  0017be20: 30420044 andi r2,r2,0x0044
+
  0017be20: 30420044 andi r2,r2,0x0044             |{{f/std|<nowiki>r2 <> 0x00 if unit has crystal or jump</nowiki>}}
  0017be24: 1440000a bne r2,r0,0x0017be50 Branch if Unit is a Crystal/Jumping
+
  0017be24: 1440000a bne r2,r0,0x0017be50         {{f/Cond|<nowiki>If unit doesn't have crystal or jump</nowiki>}} / Else branch to {{f/loc|<nowiki>End</nowiki>}} With r2 = 0x01
  0017be28: 34020001 ori r2,r0,0x0001 r2 = 1
+
  0017be28: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0017be2c: 92220059 lbu r2,0x0059(r17) Load Unit's Current Statuses 2
+
  0017be2c: 92220059 lbu r2,0x0059(r17)               |{{f/load|<nowiki>r2 = Unit's Current Statuses 2</nowiki>}}
  0017be30: 00000000 nop
+
  0017be30: 00000000 nop                               |
  0017be34: 30420001 andi r2,r2,0x0001
+
  0017be34: 30420001 andi r2,r2,0x0001                 |{{f/std|<nowiki>r2 = 0x01 if unit has treasure</nowiki>}}
  0017be38: 14400005 bne r2,r0,0x0017be50 Branch if Unit is Treasure
+
  0017be38: 14400005 bne r2,r0,0x0017be50             {{f/Cond|<nowiki>If unit doesn't has treasure</nowiki>}} / Else branch to {{f/loc|<nowiki>End</nowiki>}} With r2 = 0x01
  0017be3c: 34020001 ori r2,r0,0x0001 r2 = 1
+
  0017be3c: 34020001 ori r2,r0,0x0001                 |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0017be40: 92220182 lbu r2,0x0182(r17) Load Unit's Mount Info
+
  0017be40: 92220182 lbu r2,0x0182(r17)                   |{{f/load|<nowiki>r2 =  Unit's Mount Info</nowiki>}}
  0017be44: 00000000 nop
+
  0017be44: 00000000 nop                                   |
  0017be48: 30420040 andi r2,r2,0x0040
+
  0017be48: 30420040 andi r2,r2,0x0040                     |{{f/std|<nowiki>r2 = 0x40 if un,it is being ridden / Else 0x00</nowiki>}}
  0017be4c: 0002102b sltu r2,r0,r2 r2 = 1 if Unit is being Ridden
+
  0017be4c: 0002102b sltu r2,r0,r2                         |{{f/std|<nowiki>r2 = 1 if Unit is being Ridden / Else 0x00</nowiki>}}
  0017be50: 8fbf0018 lw r31,0x0018(r29)
+
  0017be50: 8fbf0018 lw r31,0x0018(r29)       END
  0017be54: 8fb10014 lw r17,0x0014(r29)
+
  0017be54: 8fb10014 lw r17,0x0014(r29)                  
  0017be58: 8fb00010 lw r16,0x0010(r29)
+
  0017be58: 8fb00010 lw r16,0x0010(r29)                  
  0017be5c: 27bd0020 addiu r29,r29,0x0020
+
  0017be5c: 27bd0020 addiu r29,r29,0x0020                
  0017be60: 03e00008 jr r31
+
  0017be60: 03e00008 jr r31                              
  0017be64: 00000000 nop
+
  0017be64: 00000000 nop  
 +
=== Return locations ===
 +
0017bce4: [[Check_Allies/Enemies_that_can_be_Targeted]]                             
 +
0017cba8: [[Reaction_Target/Hit_Calculation]]

Revision as of 21:01, 4 December 2021

0017bdd0: 27bdffe0 addiu r29,r29,0xffe0     |
0017bdd4: afb00010 sw r16,0x0010(r29)       |
0017bdd8: 00a08021 addu r16,r5,r0           |r16 = Stack Pointer (previous routine - r29 0x10)
0017bddc: 000410c0 sll r2,r4,0x03           |r2 =Unit ID * 8
0017bde0: 00441023 subu r2,r2,r4            |r2 =Unit ID * 7
0017bde4: 00021180 sll r2,r2,0x06           |r2 =Unit ID * 448 (0x1c0)
0017bde8: 3c038019 lui r3,0x8019            |
0017bdec: 246308cc addiu r3,r3,0x08cc       |r3 = 0x801908cc (start of unit 0x00 data)
0017bdf0: afb10014 sw r17,0x0014(r29)       |
0017bdf4: 00438821 addu r17,r2,r3           |r17 = Unit's Data Pointer
0017bdf8: afbf0018 sw r31,0x0018(r29)       |
0017bdfc: 0c060428 jal 0x001810a0           |-->Map Location Calculation  return r2 = Unit Tile Info ( X coord.  +( Y coord. * Map Max X) + elevation * 256 (= 0x00 or 0x100)
0017be00: 02202021 addu r4,r17,r0           |r4 = Unit's Data Pointer
0017be04: ae020000 sw r2,0x0000(r16)        |Store Tile ID in stack pointer  (previous routine - r29 0x10)
0017be08: 92230001 lbu r3,0x0001(r17)       |r3 = Unit ID
0017be0c: 340200ff ori r2,r0,0x00ff         |r2 = 0xff
0017be10: 1062000f beq r3,r2,0x0017be50     #If unit exists / Else branch to End With r2 = 0x01
0017be14: 34020001 ori r2,r0,0x0001         |r2 = 0x01
0017be18: 92220058 lbu r2,0x0058(r17)            |r2 = Unit's Current Statuses 1
0017be1c: 00000000 nop                           |
0017be20: 30420044 andi r2,r2,0x0044             |r2 <> 0x00 if unit has crystal or jump
0017be24: 1440000a bne r2,r0,0x0017be50          #If unit doesn't have crystal or jump / Else branch to End With r2 = 0x01
0017be28: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0017be2c: 92220059 lbu r2,0x0059(r17)                |r2 = Unit's Current Statuses 2
0017be30: 00000000 nop                               |
0017be34: 30420001 andi r2,r2,0x0001                 |r2 = 0x01 if unit has treasure
0017be38: 14400005 bne r2,r0,0x0017be50              #If unit doesn't has treasure / Else branch to End With r2 = 0x01
0017be3c: 34020001 ori r2,r0,0x0001                  |r2 = 0x01
0017be40: 92220182 lbu r2,0x0182(r17)                    |r2 =  Unit's Mount Info
0017be44: 00000000 nop                                   |
0017be48: 30420040 andi r2,r2,0x0040                     |r2 = 0x40 if un,it is being ridden / Else 0x00
0017be4c: 0002102b sltu r2,r0,r2                         |r2 = 1 if Unit is being Ridden / Else 0x00
0017be50: 8fbf0018 lw r31,0x0018(r29)        END
0017be54: 8fb10014 lw r17,0x0014(r29)                    
0017be58: 8fb00010 lw r16,0x0010(r29)                    
0017be5c: 27bd0020 addiu r29,r29,0x0020                  
0017be60: 03e00008 jr r31                                
0017be64: 00000000 nop 

Return locations

0017bce4: Check_Allies/Enemies_that_can_be_Targeted                              
0017cba8: Reaction_Target/Hit_Calculation