Difference between revisions of "Check if unit can react"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Undo revision 22280 by Orkney (talk))
Tag: Undo
Line 1: Line 1:
r5 = set to check
+
<font face='Courier New'>
r4 = target data pointer   
+
   
Returns r2 = 0x01 if target has one of the checked statuses, else 0x00
+
  0018c968: 3c028019 lui r2,0x8019
---------------------------------------------------------------------------------------------------
+
  0018c96c: 8c42f5f0 lw r2,-0x0a10(r2) load reaction check
0005e1b0: 00003021 addu r6,r0,r0            |{{f/std|<nowiki>r6 = 0x00 (loop counter)</nowiki>}}
+
  0018c970: 27bdffe8 addiu r29,r29,0xffe8
  0005e1b4: 3c038006 lui r3,0x8006            |
+
  0018c974: 14400005 bne r2,r0,0x0018c98c branch if reacting
  0005e1b8: 246362d0 addiu r3,r3,0x62d0      |{{f/std|<nowiki>r3 = 800662d0</nowiki>}}
+
  0018c978: afbf0010 sw r31,0x0010(r29)
0005e1bc: 00051080 sll r2,r5,0x02          |{{f/std|<nowiki>Preset Value * 4</nowiki>}}
+
  0018c97c: 0c01786c jal 0x0005e1b0 [[Status Checks (r5 = set to check)]]
  0005e1c0: 00451021 addu r2,r2,r5            |{{f/std|<nowiki>Preset Value * 5</nowiki>}}
+
  0018c980: 34050004 ori r5,r0,0x0004
  0005e1c4: 00432821 addu r5,r2,r3            |{{f/std|<nowiki>r5 = 800662d0 + preset value *5</nowiki>}}
+
  0018c984: 08063264 j 0x0018c990 jump to end, return r2= 0 (status not found) or r2=1 (status found)
  0005e1c8: 00861021 addu r2,r4,r6            {{f/bloop|<nowiki> LOOP</nowiki>}} {{f/std|<nowiki>r2 = target data pointer + loop counter</nowiki>}}
+
  0018c988: 00000000 nop
  0005e1cc: 90420058 lbu r2,0x0058(r2)            |{{f/load|<nowiki>r2 = target current status set X (X = loop counter)</nowiki>}}
+
  0018c98c: 34020001 ori r2,r0,0x0001 return 01 if reacting
  0005e1d0: 90a30000 lbu r3,0x0000(r5)            |{{f/load|<nowiki>r3 = statuses to check</nowiki>}} {{f/jal|Status_Check_table_-_0x800662d0|<nowiki>Status_Check_table_-_0x800662d0</nowiki>}}
+
  0018c990: 8fbf0010 lw r31,0x0010(r29)
  0005e1d4: 00000000 nop                          |
+
  0018c994: 27bd0018 addiu r29,r29,0x0018
0005e1d8: 00431024 and r2,r2,r3                  |{{f/std|<nowiki>r2 <> 0x00 if target as one of the checked statuses</nowiki>}}
+
  0018c998: 03e00008 jr r31
  0005e1dc: 14400006 bne r2,r0,0x0005e1f8          {{f/Cond|<nowiki>If none of the checked status is found </nowiki>}} /If target has one of the statuses {{f/loc|<nowiki>branch to end (with r2 = 0x01)</nowiki>}}
+
  0018c99c: 00000000 nop
0005e1e0: 34020001 ori r2,r0,0x0001              |{{f/std|<nowiki>r2 = 1 (statuses found)</nowiki>}}
+
</font>
  0005e1e4: 24c60001 addiu r6,r6,0x0001                |{{f/std|<nowiki>Loop counter + 1 </nowiki>}}
 
  0005e1e8: 28c20005 slti r2,r6,0x0005                |{{f/std|<nowiki>r2 = 0x01 if counter < 0x05 - else 0x00</nowiki>}}
 
  0005e1ec: 1440fff6 bne r2,r0,0x0005e1c8    {{f/eloop|<nowiki>Loop while counter < 0x05 </nowiki>}} /Else goto r2 = 0x00 then exit the routine
 
  0005e1f0: 24a50001 addiu r5,r5,0x0001            |{{f/std|<nowiki>Checking status pointer +1</nowiki>}}
 
  0005e1f4: 00001021 addu r2,r0,r0            |{{f/std|<nowiki>r2 = 0 (statuses not found)</nowiki>}}
 
0005e1f8: 03e00008 jr r31                  
 
  0005e1fc: 00000000 nop
 

Revision as of 13:04, 27 November 2021

0018c968: 3c028019 lui r2,0x8019
0018c96c: 8c42f5f0 lw r2,-0x0a10(r2)		load reaction check
0018c970: 27bdffe8 addiu r29,r29,0xffe8
0018c974: 14400005 bne r2,r0,0x0018c98c		branch if reacting
0018c978: afbf0010 sw r31,0x0010(r29)
0018c97c: 0c01786c jal 0x0005e1b0			Status Checks (r5 = set to check)
0018c980: 34050004 ori r5,r0,0x0004
0018c984: 08063264 j 0x0018c990				jump to end, return r2= 0 (status not found) or r2=1 (status found)
0018c988: 00000000 nop
0018c98c: 34020001 ori r2,r0,0x0001			return 01 if reacting
0018c990: 8fbf0010 lw r31,0x0010(r29)
0018c994: 27bd0018 addiu r29,r29,0x0018
0018c998: 03e00008 jr r31
0018c99c: 00000000 nop