Set map Item/trap data

From Final Fantasy Hacktics Wiki
Revision as of 20:27, 5 September 2024 by RetroTypes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
001802c8: 27bdffd8 addiu r29,r29,0xffd8
001802cc: afb10014 sw r17,0x0014(r29)
001802d0: 00808821 addu r17,r4,r0				X
001802d4: afb20018 sw r18,0x0018(r29)
001802d8: 00a09021 addu r18,r5,r0				Y
001802dc: afb3001c sw r19,0x001c(r29)
001802e0: 00c09821 addu r19,r6,r0				Map level
001802e4: afb40020 sw r20,0x0020(r29)
001802e8: 341400ff ori r20,r0,0x00ff
001802ec: afb00010 sw r16,0x0010(r29)
001802f0: 00008021 addu r16,r0,r0				counter = 0
001802f4: afbf0024 sw r31,0x0024(r29)
001802f8: 3c018019 lui r1,0x8019
001802fc: a020f8a8 sb r0,-0x0758(r1)			clear move find item data
00180300: 322400ff andi r4,r17,0x00ff
00180304: 324500ff andi r5,r18,0x00ff
00180308: 326600ff andi r6,r19,0x00ff
0018030c: 0c05f72a jal 0x0017dca8				Check if another unit is on the same Tile
00180310: 34070010 ori r7,r0,0x0010
00180314: 00401821 addu r3,r2,r0
00180318: 04610006 bgez r3,0x00180334
0018031c: 34020015 ori r2,r0,0x0015
00180320: 26100001 addiu r16,r16,0x0001
00180324: 2a020015 slti r2,r16,0x0015
00180328: 1440fff6 bne r2,r0,0x00180304
0018032c: 322400ff andi r4,r17,0x00ff
00180330: 34020015 ori r2,r0,0x0015
00180334: 12020006 beq r16,r2,0x00180350
00180338: 322400ff andi r4,r17,0x00ff
0018033c: 34020004 ori r2,r0,0x0004
00180340: 3c018019 lui r1,0x8019
00180344: a022f8a8 sb r2,-0x0758(r1)			store trap 4
00180348: 3c018019 lui r1,0x8019
0018034c: a023f8ad sb r3,-0x0753(r1)			store 
00180350: 00008021 addu r16,r0,r0
00180354: 324500ff andi r5,r18,0x00ff
00180358: 326600ff andi r6,r19,0x00ff
0018035c: 3c078019 lui r7,0x8019
00180360: 24e73910 addiu r7,r7,0x3910
00180364: 00e08821 addu r17,r7,r0
00180368: 92230000 lbu r3,0x0000(r17)			load coordinates
0018036c: 00000000 nop
00180370: 00031102 srl r2,r3,0x04				get X coordinates
00180374: 14440008 bne r2,r4,0x00180398			branch if not equal to trap location X
00180378: 3062000f andi r2,r3,0x000f			get Y coordinate
0018037c: 14450006 bne r2,r5,0x00180398			branch if not equal to trap location Y
00180380: 00000000 nop
00180384: 92220001 lbu r2,0x0001(r17)			load trap flags
00180388: 00000000 nop
0018038c: 000211c2 srl r2,r2,0x07
00180390: 10460006 beq r2,r6,0x001803ac			branch if = ??
00180394: 34020004 ori r2,r0,0x0004
00180398: 26100001 addiu r16,r16,0x0001			counter++
0018039c: 2a020004 slti r2,r16,0x0004			perform for 4 traps
001803a0: 1440fff0 bne r2,r0,0x00180364			
001803a4: 24e70004 addiu r7,r7,0x0004			trap address++
001803a8: 34020004 ori r2,r0,0x0004
001803ac: 1202003a beq r16,r2,0x00180498		branch to end if no trap found
001803b0: 00000000 nop
001803b4: 3c018019 lui r1,0x8019
001803b8: a030f8a9 sb r16,-0x0757(r1)			store trap counter
001803bc: 92220001 lbu r2,0x0001(r17)			load activation bytes
001803c0: 00000000 nop
001803c4: 30420020 andi r2,r2,0x0020
001803c8: 14400015 bne r2,r0,0x00180420			branch if always trap
001803cc: 00000000 nop
001803d0: 0c04ed64 jal 0x0013b590				Get Script Variable get map ID
001803d4: 34040033 ori r4,r0,0x0033				r4 = 0x33 (variable 0x33 is current map)
001803d8: 00402021 addu r4,r2,r0				r2 = map #
001803dc: 02002821 addu r5,r16,r0			
001803e0: 0c060131 jal 0x001804c4				Move find item flag calculation
001803e4: 00003021 addu r6,r0,r0				item = already found
001803e8: 1040000d beq r2,r0,0x00180420			branch if move find item not equipped?
001803ec: 00000000 nop
001803f0: 3c028019 lui r2,0x8019
001803f4: 9042f8a8 lbu r2,-0x0758(r2)			load item found flag
001803f8: 00000000 nop
001803fc: 34420001 ori r2,r2,0x0001
00180400: 3c018019 lui r1,0x8019
00180404: a022f8a8 sb r2,-0x0758(r1)			store item was found
00180408: 92220002 lbu r2,0x0002(r17)			load rare item 4
0018040c: 3c018019 lui r1,0x8019
00180410: a022f8aa sb r2,-0x0756(r1)			store rare item 4
00180414: 92220003 lbu r2,0x0003(r17)			load common item 4
00180418: 3c018019 lui r1,0x8019
0018041c: a022f8ab sb r2,-0x0755(r1)			store common item 4
00180420: 92230001 lbu r3,0x0001(r17)			load trap flags
00180424: 00000000 nop
00180428: 30620010 andi r2,r3,0x0010
0018042c: 1440001a bne r2,r0,0x00180498			branch if trap is disabled
00180430: 30620001 andi r2,r3,0x0001
00180434: 10400003 beq r2,r0,0x00180444			branch if not degenerator
00180438: 30620002 andi r2,r3,0x0002
0018043c: 0806011c j 0x00180470
00180440: 0000a021 addu r20,r0,r0				return r20 = 0x00 (degenerator)
00180444: 10400003 beq r2,r0,0x00180454			branch if not deathtrap
00180448: 30620004 andi r2,r3,0x0004
0018044c: 0806011c j 0x00180470
00180450: 34140001 ori r20,r0,0x0001			return r20 = 0x01 (deathtrap)
00180454: 10400003 beq r2,r0,0x00180464			branch if not sleeping gas
00180458: 30620008 andi r2,r3,0x0008
0018045c: 0806011c j 0x00180470
00180460: 34140002 ori r20,r0,0x0002			return r20 = 0x02 (sleeping gas)
00180464: 10400003 beq r2,r0,0x00180474			branch if not steel needle
00180468: 340200ff ori r2,r0,0x00ff
0018046c: 34140003 ori r20,r0,0x0003			r20 = 0x03 (steel needle)
00180470: 340200ff ori r2,r0,0x00ff
00180474: 12820008 beq r20,r2,0x00180498		branch if no trap flags set
00180478: 00000000 nop
0018047c: 3c038019 lui r3,0x8019
00180480: 2463f8a8 addiu r3,r3,0xf8a8			r3 = trap data
00180484: 90620000 lbu r2,0x0000(r3)			load activation flag
00180488: 3c018019 lui r1,0x8019
0018048c: a034f8ac sb r20,-0x0754(r1)			store trap type
00180490: 34420002 ori r2,r2,0x0002
00180494: a0620000 sb r2,0x0000(r3)				activate 0x02 flag at 0x8019f8a8
00180498: 3c028019 lui r2,0x8019
0018049c: 2442f8a8 addiu r2,r2,0xf8a8			return r2 = move-find item data (8018f8a8)
001804a0: 8fbf0024 lw r31,0x0024(r29)
001804a4: 8fb40020 lw r20,0x0020(r29)
001804a8: 8fb3001c lw r19,0x001c(r29)
001804ac: 8fb20018 lw r18,0x0018(r29)
001804b0: 8fb10014 lw r17,0x0014(r29)
001804b4: 8fb00010 lw r16,0x0010(r29)
001804b8: 27bd0028 addiu r29,r29,0x0028
001804bc: 03e00008 jr r31
001804c0: 00000000 nop