Set Rider/Mount's X/Y Data
Jump to navigation
Jump to search
Set Rider/Mount's X/Y Data
0017fddc: 27bdffc8 addiu r29,r29,0xffc8 0017fde0: afb10014 sw r17,0x0014(r29) 0017fde4: 00808821 addu r17,r4,r0 r17 = Unit's ID 0017fde8: afb50024 sw r21,0x0024(r29) 0017fdec: 0000a821 addu r21,r0,r0 r21 = 0 0017fdf0: afb40020 sw r20,0x0020(r29) 0017fdf4: 00a0a021 addu r20,r5,r0 r20 = Unit's X Coordinate 0017fdf8: afb3001c sw r19,0x001c(r29) 0017fdfc: 00c09821 addu r19,r6,r0 r19 = Unit's Y Coordinate 0017fe00: afb20018 sw r18,0x0018(r29) 0017fe04: 00e09021 addu r18,r7,r0 r18 = Unit's Map Level 0017fe08: 001110c0 sll r2,r17,0x03 ID * 8 0017fe0c: 00511023 subu r2,r2,r17 ID * 7 0017fe10: 00021180 sll r2,r2,0x06 ID * 1c0 0017fe14: 3c038019 lui r3,0x8019 0017fe18: 246308cc addiu r3,r3,0x08cc 0017fe1c: afb00010 sw r16,0x0010(r29) 0017fe20: 00438021 addu r16,r2,r3 r16 = Unit's Data Pointer 0017fe24: 328400ff andi r4,r20,0x00ff r4 = Unit's X Coordinate 0017fe28: 326500ff andi r5,r19,0x00ff r5 = Unit's Y Coordinate 0017fe2c: 324600ff andi r6,r18,0x00ff r6 = Unit's Map Level 0017fe30: afb7002c sw r23,0x002c(r29) 0017fe34: 93b70048 lbu r23,0x0048(r29) Load Attack Facing? 0017fe38: 34070080 ori r7,r0,0x0080 r7 = 80 (Chocobo Check) 0017fe3c: afbf0030 sw r31,0x0030(r29) 0017fe40: 0c05f72a jal 0x0017dca8 Check if another unit is on the same Tile 0017fe44: afb60028 sw r22,0x0028(r29) 0017fe48: 04400005 bltz r2,0x0017fe60 Branch if there was a movement error 0017fe4c: 00000000 nop 0017fe50: 10510003 beq r2,r17,0x0017fe60 Branch if Unit ID = Found unit ID 0017fe54: 00000000 nop 0017fe58: 0040b021 addu r22,r2,r0 r22 = Found Unit ID 0017fe5c: 34150001 ori r21,r0,0x0001 r21 = 1 (Unit being Ridden?) 0017fe60: 3c03800e lui r3,0x800e 0017fe64: 90634e9c lbu r3,0x4e9c(r3) Load Map Max X 0017fe68: 326200ff andi r2,r19,0x00ff r2 = Unit's Y Coordinate 0017fe6c: 00430018 mult r2,r3 Max X * Y 0017fe70: 324200ff andi r2,r18,0x00ff r2 = Unit's Map Level 0017fe74: 00021200 sll r2,r2,0x08 Map Level * 0x100 0017fe78: 00001812 mflo r3 r3 = Max X * Y 0017fe7c: 00431021 addu r2,r2,r3 Y Mod = Max X * Y + Map Level * 0x100 0017fe80: 328300ff andi r3,r20,0x00ff r3 = Unit's X Coordinate 0017fe84: 00431021 addu r2,r2,r3 Tile ID = Y Mod + X 0017fe88: 000210c0 sll r2,r2,0x03 Tile ID * 8 0017fe8c: 3c018019 lui r1,0x8019 0017fe90: 00220821 addu r1,r1,r2 0017fe94: 9023f8d2 lbu r3,-0x072e(r1) Load Tile's ? 0017fe98: 00000000 nop 0017fe9c: 30620001 andi r2,r3,0x0001 0017fea0: 1440003b bne r2,r0,0x0017ff90 Branch if Tile isn't selectable 0017fea4: 2402ffff addiu r2,r0,0xffff r2 = FFFF (Fail) 0017fea8: 30620002 andi r2,r3,0x0002 0017feac: 14400038 bne r2,r0,0x0017ff90 Branch if Tile isn't targetable 0017feb0: 2402ffff addiu r2,r0,0xffff r2 = FFFF (Fail) 0017feb4: 92040182 lbu r4,0x0182(r16) Load Unit's Mount Info 0017feb8: 00000000 nop 0017febc: 30820040 andi r2,r4,0x0040 0017fec0: 1440000a bne r2,r0,0x0017feec Branch if Unit is being Mounted 0017fec4: 00000000 nop 0017fec8: 10800008 beq r4,r0,0x0017feec Branch if Unit has no Mount Data 0017fecc: a2000182 sb r0,0x0182(r16) Store Mount Data = 0 0017fed0: 3083001f andi r3,r4,0x001f r3 = Rider/Mount Unit's ID 0017fed4: 000310c0 sll r2,r3,0x03 ID * 8 0017fed8: 00431023 subu r2,r2,r3 ID * 7 0017fedc: 00021180 sll r2,r2,0x06 ID * 1c0 0017fee0: 3c018019 lui r1,0x8019 0017fee4: 00220821 addu r1,r1,r2 0017fee8: a0200a4e sb r0,0x0a4e(r1) Store Rider/Mount Unit's Mount data = 0 0017feec: 12a0000a beq r21,r0,0x0017ff18 Branch if Unit isn't riding/being ridden 0017fef0: 26c20080 addiu r2,r22,0x0080 Found Unit ID + 0x80 (enable Riding) 0017fef4: 32c300ff andi r3,r22,0x00ff r3 = Found Unit ID 0017fef8: a2020182 sb r2,0x0182(r16) Store new Mounting Data 0017fefc: 000310c0 sll r2,r3,0x03 ID * 8 0017ff00: 00431023 subu r2,r2,r3 ID * 7 0017ff04: 00021180 sll r2,r2,0x06 ID * 1c0 0017ff08: 26230040 addiu r3,r17,0x0040 Unit's ID + 0x40 (enable mounted) 0017ff0c: 3c018019 lui r1,0x8019 0017ff10: 00220821 addu r1,r1,r2 0017ff14: a0230a4e sb r3,0x0a4e(r1) Store Unit's new Mounting data 0017ff18: 324300ff andi r3,r18,0x00ff r3 = Unit's Map Level 0017ff1c: 000333c0 sll r6,r3,0x0f Map Level * 0x8000 0017ff20: 32e3000f andi r3,r23,0x000f r3 = Attack Facing? 0017ff24: a2130048 sb r19,0x0048(r16) Store Unit's Y Coordinate 0017ff28: 96020048 lhu r2,0x0048(r16) Load Unit's Y Coordinate 0017ff2c: 00032a00 sll r5,r3,0x08 Attack Facing? * 0x100 0017ff30: a2140047 sb r20,0x0047(r16) Store Unit's X Coordinate 0017ff34: 30427fff andi r2,r2,0x7fff Y AND 0x7FFF 0017ff38: 00461025 or r2,r2,r6 Map Level * 0x8000 + Y 0017ff3c: 3042f0ff andi r2,r2,0xf0ff Y Data AND 0xF0FF (all but facing stuff) 0017ff40: 00451025 or r2,r2,r5 Y + ? Facing (maybe end of turn facing?) 0017ff44: a6020048 sh r2,0x0048(r16) Store Unit's new Y Data 0017ff48: 30820040 andi r2,r4,0x0040 0017ff4c: 1040000f beq r2,r0,0x0017ff8c Branch if Unit isn't being mounted 0017ff50: 3083001f andi r3,r4,0x001f r3 = Rider's ID 0017ff54: 000310c0 sll r2,r3,0x03 ID * 8 0017ff58: 00431023 subu r2,r2,r3 ID * 7 0017ff5c: 00021180 sll r2,r2,0x06 ID * 1c0 0017ff60: 3c038019 lui r3,0x8019 0017ff64: 246308cc addiu r3,r3,0x08cc 0017ff68: 00431821 addu r3,r2,r3 0017ff6c: a0730048 sb r19,0x0048(r3) Store Rider's Y Coordinate 0017ff70: 94620048 lhu r2,0x0048(r3) Load Rider's Y Coordinate 0017ff74: a0740047 sb r20,0x0047(r3) Store Rider's X Coordinate 0017ff78: 30427fff andi r2,r2,0x7fff Y AND 0x7FFF 0017ff7c: 00461025 or r2,r2,r6 Map Level * 0x8000 + Y 0017ff80: 3042f0ff andi r2,r2,0xf0ff Y Data AND 0xF0FF 0017ff84: 00451025 or r2,r2,r5 Y + Attack Facing? 0017ff88: a4620048 sh r2,0x0048(r3) Store Rider's new Y Data 0017ff8c: 00001021 addu r2,r0,r0 r2 = 0 (success) 0017ff90: 8fbf0030 lw r31,0x0030(r29) 0017ff94: 8fb7002c lw r23,0x002c(r29) 0017ff98: 8fb60028 lw r22,0x0028(r29) 0017ff9c: 8fb50024 lw r21,0x0024(r29) 0017ffa0: 8fb40020 lw r20,0x0020(r29) 0017ffa4: 8fb3001c lw r19,0x001c(r29) 0017ffa8: 8fb20018 lw r18,0x0018(r29) 0017ffac: 8fb10014 lw r17,0x0014(r29) 0017ffb0: 8fb00010 lw r16,0x0010(r29) 0017ffb4: 27bd0038 addiu r29,r29,0x0038 0017ffb8: 03e00008 jr r31 0017ffbc: 00000000 nop