Set Tile Flags for Pathfinding

From Final Fantasy Hacktics Wiki
Revision as of 07:20, 28 May 2023 by Talcall (talk | contribs)
Jump to navigation Jump to search

00174e84: 00806021 addu r12,r4,r0			PV1
00174e88: 00004021 addu r8,r0,r0
00174e8c: 00003821 addu r7,r0,r0
00174e90: 3c098019 lui r9,0x8019
00174e94: 8d29f4e0 lw r9,-0x0b20(r9)			Scratchpad for current unit (S0x00)
00174e98: 3c0d8019 lui r13,0x8019
00174e9c: 8dadf4e4 lw r13,-0x0b1c(r13)			0x80 Scratchpad (S0x80)
00174ea0: 3c0b8019 lui r11,0x8019
00174ea4: 8d6bf4f0 lw r11,-0x0b10(r11)			pointer to scratchpad 0x200 (S0x200)
00174ea8: 3c0e8019 lui r14,0x8019
00174eac: 8dcef4e8 lw r14,-0x0b18(r14)			Scratchpad for all other units(S0x180)
00174eb0: 01602021 addu r4,r11,r0
00174eb4: 01603021 addu r6,r11,r0
00174eb8: 3c028019 lui r2,0x8019
00174ebc: 24422dd8 addiu r2,r2,0x2dd8			moveable/targettable panel grid
00174ec0: 00e22821 addu r5,r7,r2
00174ec4: 31820001 andi r2,r12,0x0001			check for flag input
00174ec8: a0a00001 sb r0,0x0001(r5)			set panel colour to initial
00174ecc: 10400005 beq r2,r0,0x00174ee4		branch if not doing?
00174ed0: a0a00002 sb r0,0x0002(r5)			unit standing on tile to initialise
00174ed4: 340200ff ori r2,r0,0x00ff
00174ed8: a0a00000 sb r0,0x0000(r5)
00174edc: a0a00003 sb r0,0x0003(r5)
00174ee0: a0a20004 sb r2,0x0004(r5)
00174ee4: 29020200 slti r2,r8,0x0200
00174ee8: 10400055 beq r2,r0,0x00175040		skip ahead if tile counter > 0x200
00174eec: 000818c0 sll r3,r8,0x03
00174ef0: 3c028019 lui r2,0x8019
00174ef4: 2442f8cc addiu r2,r2,0xf8cc
00174ef8: 00622821 addu r5,r3,r2			tile data start
00174efc: a0c00000 sb r0,0x0000(r6)			set scratchpad 0x200 to 0
00174f00: 90a20004 lbu r2,0x0004(r5)			load slope height
00174f04: 00000000 nop
00174f08: 30430005 andi r3,r2,0x0005
00174f0c: 34020001 ori r2,r0,0x0001
00174f10: 10620003 beq r3,r2,0x00174f20		branch if slope height = 1
00174f14: 34020004 ori r2,r0,0x0004
00174f18: 1462000d bne r3,r2,0x00174f50		branch if slope height != 4
00174f1c: 00000000 nop
00174f20: 90830000 lbu r3,0x0000(r4)			slope heights 1 + 4: load scratchpad 0x200 value
00174f24: 00000000 nop
00174f28: 34620002 ori r2,r3,0x0002
00174f2c: a0820000 sb r2,0x0000(r4)			add flag 0x02 and store
00174f30: 90a20003 lbu r2,0x0003(r5)			load tile height
00174f34: 00000000 nop
00174f38: 3042001f andi r2,r2,0x001f
00174f3c: 28420003 slti r2,r2,0x0003
00174f40: 1440000d bne r2,r0,0x00174f78		branch if tile height < 0x3
00174f44: 34620042 ori r2,r3,0x0042
00174f48: 0805d3de j 0x00174f78
00174f4c: a0820000 sb r2,0x0000(r4)			if tile height > 0x03 + slope = 1 or 4, set value 0x42 and store
00174f50: 90a20003 lbu r2,0x0003(r5)
00174f54: 91230004 lbu r3,0x0004(r9)			load unit's jump
00174f58: 3042001f andi r2,r2,0x001f
00174f5c: 0062182a slt r3,r3,r2
00174f60: 10600005 beq r3,r0,0x00174f78		branch if jump > tile height
00174f64: 00000000 nop
00174f68: 90820000 lbu r2,0x0000(r4)
00174f6c: 00000000 nop
00174f70: 34420040 ori r2,r2,0x0040
00174f74: a0820000 sb r2,0x0000(r4)
00174f78: 90a20006 lbu r2,0x0006(r5)			misc. tile flags
00174f7c: 00000000 nop
00174f80: 30430001 andi r3,r2,0x0001			Unselectable by cursor
00174f84: 00021042 srl r2,r2,0x01
00174f88: 30420001 andi r2,r2,0x0001			cannot target (red cursor)
00174f8c: 00621825 or r3,r3,r2
00174f90: 14600014 bne r3,r0,0x00174fe4		branch if either of the above
00174f94: 00000000 nop
00174f98: 90a20003 lbu r2,0x0003(r5)			else, load height halves + depth value
00174f9c: 00000000 nop
00174fa0: 00021942 srl r3,r2,0x05			depth
00174fa4: 10600005 beq r3,r0,0x00174fbc		branch if depth = 0
00174fa8: 2c620004 sltiu r2,r3,0x0004			check for depth < 4
00174fac: 91220011 lbu r2,0x0011(r9)			load unit's cannot enter water flag
00174fb0: 00000000 nop
00174fb4: 1440000b bne r2,r0,0x00174fe4		branch if unit cannot enter water
00174fb8: 2c620004 sltiu r2,r3,0x0004
00174fbc: 14400005 bne r2,r0,0x00174fd4		branch if water depth < 0x4
00174fc0: 00000000 nop
00174fc4: 91220013 lbu r2,0x0013(r9)			if tile is depth = 4, load unit's will sink flag
00174fc8: 00000000 nop
00174fcc: 14400005 bne r2,r0,0x00174fe4		branch if they will
00174fd0: 00000000 nop
00174fd4: 90820000 lbu r2,0x0000(r4)			load 0x200 flag
00174fd8: 00000000 nop
00174fdc: 34420010 ori r2,r2,0x0010			set avoids sinking in tile
00174fe0: a0820000 sb r2,0x0000(r4)
00174fe4: 90a30006 lbu r3,0x0006(r5)			
00174fe8: 00000000 nop
00174fec: 30620001 andi r2,r3,0x0001
00174ff0: 10400004 beq r2,r0,0x00175004		branch if tile can be selected
00174ff4: 00000000 nop
00174ff8: 90820000 lbu r2,0x0000(r4)			
00174ffc: 0805d40f j 0x0017503c
00175000: 34420080 ori r2,r2,0x0080
00175004: 9122000e lbu r2,0x000e(r9)			load move type
00175008: 00000000 nop
0017500c: 1440000c bne r2,r0,0x00175040		branch if not fly
00175010: 30620002 andi r2,r3,0x0002
00175014: 1040000a beq r2,r0,0x00175040		branch if can target tile
00175018: 3403003f ori r3,r0,0x003f
0017501c: 90a20000 lbu r2,0x0000(r5)			load tile type
00175020: 00000000 nop
00175024: 3042003f andi r2,r2,0x003f
00175028: 10430005 beq r2,r3,0x00175040		branch if tile is cross-section
0017502c: 00000000 nop
00175030: 90820000 lbu r2,0x0000(r4)
00175034: 00000000 nop
00175038: 34420010 ori r2,r2,0x0010			unit avoids sinking if unit has fly - unless tile is cross-section (what)
0017503c: a0820000 sb r2,0x0000(r4)
00175040: 24840001 addiu r4,r4,0x0001			0x200 scratchpad ++
00175044: 24c60001 addiu r6,r6,0x0001
00175048: 25080001 addiu r8,r8,0x0001			increment tile count
0017504c: 29020210 slti r2,r8,0x0210
00175050: 1440ff99 bne r2,r0,0x00174eb8
00175054: 24e70005 addiu r7,r7,0x0005			this process seems redundant for tiles 0x200 and up, they're skipped anyway.
00175058: 34020003 ori r2,r0,0x0003
0017505c: 11820052 beq r12,r2,0x001751a8
00175060: 31820001 andi r2,r12,0x0001
00175064: 00004021 addu r8,r0,r0
00175068: 01c03821 addu r7,r14,r0
0017506c: 90e60003 lbu r6,0x0003(r7)
00175070: 340200ff ori r2,r0,0x00ff
00175074: 30c300ff andi r3,r6,0x00ff
00175078: 10620046 beq r3,r2,0x00175194
0017507c: 00000000 nop
00175080: 90e30001 lbu r3,0x0001(r7)
00175084: 91220018 lbu r2,0x0018(r9)
00175088: 00000000 nop
0017508c: 00620018 mult r3,r2
00175090: 90e20002 lbu r2,0x0002(r7)
00175094: 90e40000 lbu r4,0x0000(r7)
00175098: 3042007f andi r2,r2,0x007f
0017509c: 00021200 sll r2,r2,0x08
001750a0: 00001812 mflo r3
001750a4: 00431021 addu r2,r2,r3
001750a8: 00445021 addu r10,r2,r4
001750ac: 30c3001f andi r3,r6,0x001f
001750b0: 000310c0 sll r2,r3,0x03
001750b4: 00431023 subu r2,r2,r3
001750b8: 00021180 sll r2,r2,0x06
001750bc: 3c018019 lui r1,0x8019
001750c0: 00220821 addu r1,r1,r2
001750c4: 902308cc lbu r3,0x08cc(r1)
001750c8: 34020049 ori r2,r0,0x0049
001750cc: 14620007 bne r3,r2,0x001750ec
001750d0: 016a2021 addu r4,r11,r10
001750d4: 016a1821 addu r3,r11,r10
001750d8: 90620000 lbu r2,0x0000(r3)
001750dc: 00000000 nop
001750e0: 34420080 ori r2,r2,0x0080
001750e4: 304200ef andi r2,r2,0x00ef
001750e8: a0620000 sb r2,0x0000(r3)
001750ec: 000a1080 sll r2,r10,0x02
001750f0: 004a1021 addu r2,r2,r10
001750f4: 3c018019 lui r1,0x8019
001750f8: 00220821 addu r1,r1,r2
001750fc: a0282dda sb r8,0x2dda(r1)
00175100: 90820000 lbu r2,0x0000(r4)
00175104: 00000000 nop
00175108: 34450004 ori r5,r2,0x0004
0017510c: 30c20040 andi r2,r6,0x0040
00175110: 14400018 bne r2,r0,0x00175174
00175114: a0850000 sb r5,0x0000(r4)
00175118: 91220022 lbu r2,0x0022(r9)
0017511c: 00000000 nop
00175120: 14400006 bne r2,r0,0x0017513c
00175124: 30a200f7 andi r2,r5,0x00f7
00175128: 90e30002 lbu r3,0x0002(r7)
0017512c: 00000000 nop
00175130: 000319c2 srl r3,r3,0x07
00175134: 000318c0 sll r3,r3,0x03
00175138: 00431025 or r2,r2,r3
0017513c: a0820000 sb r2,0x0000(r4)
00175140: 30c20020 andi r2,r6,0x0020
00175144: 14400006 bne r2,r0,0x00175160
00175148: 016a1821 addu r3,r11,r10
0017514c: 90620000 lbu r2,0x0000(r3)
00175150: 00000000 nop
00175154: 34420020 ori r2,r2,0x0020
00175158: 0805d465 j 0x00175194
0017515c: a0620000 sb r2,0x0000(r3)
00175160: 90620000 lbu r2,0x0000(r3)
00175164: 00000000 nop
00175168: 304200df andi r2,r2,0x00df
0017516c: 0805d465 j 0x00175194
00175170: a0620000 sb r2,0x0000(r3)
00175174: 30a300cf andi r3,r5,0x00cf
00175178: a0830000 sb r3,0x0000(r4)
0017517c: 9122000e lbu r2,0x000e(r9)
00175180: 00000000 nop
00175184: 14400002 bne r2,r0,0x00175190
00175188: 30a200c7 andi r2,r5,0x00c7
0017518c: 34620008 ori r2,r3,0x0008
00175190: a0820000 sb r2,0x0000(r4)
00175194: 25080001 addiu r8,r8,0x0001
00175198: 29020010 slti r2,r8,0x0010
0017519c: 1440ffb3 bne r2,r0,0x0017506c
001751a0: 24e70007 addiu r7,r7,0x0007
001751a4: 31820001 andi r2,r12,0x0001
001751a8: 1040000d beq r2,r0,0x001751e0
001751ac: 34020001 ori r2,r0,0x0001
001751b0: a5a00018 sh r0,0x0018(r13)
001751b4: 91230008 lbu r3,0x0008(r9)
001751b8: 91220018 lbu r2,0x0018(r9)
001751bc: 00000000 nop
001751c0: 00620018 mult r3,r2
001751c4: 91220009 lbu r2,0x0009(r9)
001751c8: 91240007 lbu r4,0x0007(r9)
001751cc: 00021200 sll r2,r2,0x08
001751d0: 00001812 mflo r3
001751d4: 00431021 addu r2,r2,r3
001751d8: 00445021 addu r10,r2,r4
001751dc: 34020001 ori r2,r0,0x0001
001751e0: 15820027 bne r12,r2,0x00175280
001751e4: 000a1880 sll r3,r10,0x02
001751e8: 006a1821 addu r3,r3,r10
001751ec: 3c048019 lui r4,0x8019
001751f0: 24842dd8 addiu r4,r4,0x2dd8
001751f4: 016a1021 addu r2,r11,r10
001751f8: 90420000 lbu r2,0x0000(r2)
001751fc: 00000000 nop
00175200: 30420020 andi r2,r2,0x0020
00175204: 1040000d beq r2,r0,0x0017523c
00175208: 00642821 addu r5,r3,r4
0017520c: 34020024 ori r2,r0,0x0024
00175210: a1a20054 sb r2,0x0054(r13)
00175214: 90a20002 lbu r2,0x0002(r5)
00175218: 24840a00 addiu r4,r4,0x0a00
0017521c: 00021880 sll r3,r2,0x02
00175220: 00621821 addu r3,r3,r2
00175224: 91220006 lbu r2,0x0006(r9)
00175228: 00641821 addu r3,r3,r4
0017522c: a0600004 sb r0,0x0004(r3)
00175230: 24420001 addiu r2,r2,0x0001
00175234: 0805d491 j 0x00175244
00175238: a0620000 sb r2,0x0000(r3)
0017523c: 34020008 ori r2,r0,0x0008
00175240: a1a20054 sb r2,0x0054(r13)
00175244: 34020004 ori r2,r0,0x0004
00175248: a1a20055 sb r2,0x0055(r13)
0017524c: 91220006 lbu r2,0x0006(r9)
00175250: 016a1821 addu r3,r11,r10
00175254: a0a00004 sb r0,0x0004(r5)
00175258: 24420001 addiu r2,r2,0x0001
0017525c: a0a20000 sb r2,0x0000(r5)
00175260: 90620000 lbu r2,0x0000(r3)
00175264: 00000000 nop
00175268: 34420001 ori r2,r2,0x0001
0017526c: a0620000 sb r2,0x0000(r3)
00175270: 91220006 lbu r2,0x0006(r9)
00175274: 00000000 nop
00175278: 24420001 addiu r2,r2,0x0001
0017527c: a1a20062 sb r2,0x0062(r13)
00175280: 03e00008 jr r31
00175284: 00000000 nop