Difference between revisions of "Move find item flag calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
<font face='Courier New'>
+
#Parameters
 +
    #r4 = map ID
 +
    #r5 = trap flags?
 +
    #r6 = ??
 +
        0: trap?
 +
        1: item?
 +
 
   
 
   
r6 = 0: read item found flags
 
 
  001804c4: 000417c2 srl r2,r4,0x1f
 
  001804c4: 000417c2 srl r2,r4,0x1f
 
  001804c8: 00821021 addu r2,r4,r2
 
  001804c8: 00821021 addu r2,r4,r2
Line 9: Line 14:
 
  001804d8: 00852021 addu r4,r4,r5
 
  001804d8: 00852021 addu r4,r4,r5
 
  001804dc: 34020080 ori r2,r0,0x0080
 
  001804dc: 34020080 ori r2,r0,0x0080
  001804e0: 10c0000b beq r6,r0,0x00180510
+
  001804e0: 10c0000b beq r6,r0,0x00180510 branch if trap?
 
  001804e4: 00822007 srav r4,r2,r4
 
  001804e4: 00822007 srav r4,r2,r4
 +
 +
item?
 
  001804e8: 3c018006 lui r1,0x8006
 
  001804e8: 3c018006 lui r1,0x8006
 
  001804ec: 00270821 addu r1,r1,r7
 
  001804ec: 00270821 addu r1,r1,r7
Line 19: Line 26:
 
  00180500: 00270821 addu r1,r1,r7
 
  00180500: 00270821 addu r1,r1,r7
 
  00180504: a0239414 sb r3,-0x6bec(r1) store new move find item flags
 
  00180504: a0239414 sb r3,-0x6bec(r1) store new move find item flags
  00180508: 0806014a j 0x00180528
+
  00180508: 0806014a j 0x00180528 jump to End
  0018050c: 34020001 ori r2,r0,0x0001 return r2 = 1
+
  0018050c: 34020001 ori r2,r0,0x0001 return r2 = 1
 +
 +
trap?
 
  00180510: 3c018006 lui r1,0x8006
 
  00180510: 3c018006 lui r1,0x8006
 
  00180514: 00270821 addu r1,r1,r7
 
  00180514: 00270821 addu r1,r1,r7
Line 27: Line 36:
 
  00180520: 00441024 and r2,r2,r4
 
  00180520: 00441024 and r2,r2,r4
 
  00180524: 2c420001 sltiu r2,r2,0x0001
 
  00180524: 2c420001 sltiu r2,r2,0x0001
 +
 +
End:
 
  00180528: 03e00008 jr r31
 
  00180528: 03e00008 jr r31
 
  0018052c: 00000000 nop
 
  0018052c: 00000000 nop
</font>
 

Revision as of 18:21, 5 September 2024

#Parameters
    #r4 = map ID
    #r5 = trap flags?
    #r6 = ??
        0: trap?
        1: item?


001804c4: 000417c2 srl r2,r4,0x1f
001804c8: 00821021 addu r2,r4,r2
001804cc: 00023843 sra r7,r2,0x01
001804d0: 30840001 andi r4,r4,0x0001
001804d4: 00042080 sll r4,r4,0x02
001804d8: 00852021 addu r4,r4,r5
001804dc: 34020080 ori r2,r0,0x0080
001804e0: 10c0000b beq r6,r0,0x00180510		branch if trap?
001804e4: 00822007 srav r4,r2,r4

item?
001804e8: 3c018006 lui r1,0x8006
001804ec: 00270821 addu r1,r1,r7
001804f0: 90239414 lbu r3,-0x6bec(r1)			load move find item flags?
001804f4: 00000000 nop
001804f8: 00831825 or r3,r4,r3
001804fc: 3c018006 lui r1,0x8006
00180500: 00270821 addu r1,r1,r7
00180504: a0239414 sb r3,-0x6bec(r1)			store new move find item flags
00180508: 0806014a j 0x00180528			jump to End
0018050c: 34020001 ori r2,r0,0x0001			return r2 = 1

trap?
00180510: 3c018006 lui r1,0x8006
00180514: 00270821 addu r1,r1,r7
00180518: 90229414 lbu r2,-0x6bec(r1)			load move find item flags
0018051c: 00000000 nop
00180520: 00441024 and r2,r2,r4
00180524: 2c420001 sltiu r2,r2,0x0001

End:
00180528: 03e00008 jr r31
0018052c: 00000000 nop