Set unit placement and validate

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

0017f640: 27bdffe8 addiu r29,r29,0xffe8
0017f644: 000430c0 sll r6,r4,0x03
0017f648: 00c43023 subu r6,r6,r4
0017f64c: 00063180 sll r6,r6,0x06
0017f650: 3c028019 lui r2,0x8019
0017f654: 244208cc addiu r2,r2,0x08cc
0017f658: 00c23021 addu r6,r6,r2			r6 = unit data
0017f65c: afbf0010 sw r31,0x0010(r29)
0017f660: 90a30003 lbu r3,0x0003(r5)		
0017f664: 94c20048 lhu r2,0x0048(r6)		load Y Coordinate
0017f668: 000319c2 srl r3,r3,0x07
0017f66c: 00031bc0 sll r3,r3,0x0f
0017f670: 30427fff andi r2,r2,0x7fff		make Y coordinate positive
0017f674: 00431025 or r2,r2,r3
0017f678: a4c20048 sh r2,0x0048(r6)			store Y coordinate/Facing/map level/stepping stone
0017f67c: 90a20002 lbu r2,0x0002(r5)		load ??
0017f680: 00000000 nop
0017f684: a0c20048 sb r2,0x0048(r6)			store Y coordinate only
0017f688: 90a20001 lbu r2,0x0001(r5)
0017f68c: 00000000 nop
0017f690: a0c20047 sb r2,0x0047(r6)			store X coordinate
0017f694: 90a30003 lbu r3,0x0003(r5)
0017f698: 94c20048 lhu r2,0x0048(r6)
0017f69c: 3063000f andi r3,r3,0x000f		
0017f6a0: 00031a00 sll r3,r3,0x08
0017f6a4: 3042f0ff andi r2,r2,0xf0ff
0017f6a8: 00431025 or r2,r2,r3
0017f6ac: 0c05fdb1 jal 0x0017f6c4			validate unit placement
0017f6b0: a4c20048 sh r2,0x0048(r6)
0017f6b4: 8fbf0010 lw r31,0x0010(r29)
0017f6b8: 27bd0018 addiu r29,r29,0x0018
0017f6bc: 03e00008 jr r31
0017f6c0: 00000000 nop