Move find item flag calculation
Jump to navigation
Jump to search
#Parameters: #r4 = map ID #r5 = current MFI tile (0-3) #r6 = check type 0 = checking found item flags 1 = saving updated found item flags #Returns: #r2 = activation outcome 0 = no item found or no trap activated 1 = item found or trap activated 001804c4: 000417c2 srl r2,r4,0x1f #checking if map ID was negative? waste of a line 001804c8: 00821021 addu r2,r4,r2 #r2 = map ID 001804cc: 00023843 sra r7,r2,0x01 #r7 = (map ID) / 2 ? 001804d0: 30840001 andi r4,r4,0x0001 #r4 = 0x01 if map ID was an odd number 001804d4: 00042080 sll r4,r4,0x02 #r4 = 0x04 if map ID was an odd number 001804d8: 00852021 addu r4,r4,r5 #r4 = current MFI number (0-3: map 1's MFI 1-4; 4-7: map 2's MFI 1-4) 001804dc: 34020080 ori r2,r0,0x0080 001804e0: 10c0000b beq r6,r0,0x00180510 #branch if checking flags instead of saving 001804e4: 00822007 srav r4,r2,r4 #r4 = 0x80 sra current MFI number = current MFI found item flag save updated flags 001804e8: 3c018006 lui r1,0x8006 001804ec: 00270821 addu r1,r1,r7 001804f0: 90239414 lbu r3,-0x6bec(r1) #load move find item flags for these maps 001804f4: 00000000 nop 001804f8: 00831825 or r3,r4,r3 #update MFI flags with this flag 001804fc: 3c018006 lui r1,0x8006 00180500: 00270821 addu r1,r1,r7 00180504: a0239414 sb r3,-0x6bec(r1) #store updated move find item flags for these maps 00180508: 0806014a j 0x00180528 #jump to End 0018050c: 34020001 ori r2,r0,0x0001 #return r2 = 1 check flags 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 #compare map flags with updated flag 00180524: 2c420001 sltiu r2,r2,0x0001 #0x00 = item already found. 0x01 = item never found before End: 00180528: 03e00008 jr r31 0018052c: 00000000 nop
Return Locations
001802a0: Rare/common item determination 001803e0: Set map Item/trap data