Store Selected Tile Data

From Final Fantasy Hacktics Wiki
Revision as of 03:58, 24 November 2016 by Glain (talk | contribs) (Created page with " # ROUTINE: STORE SELECTED TILE DATA # Stores selected tile data into global variable locations, e.g. *0x8014d02c = Tile type ID # No parameters. # No return value....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: STORE SELECTED TILE DATA
#   Stores selected tile data into global variable locations, e.g. *0x8014d02c = Tile type ID
#   No parameters.
#   No return value.

0013f668: 27bdffe0 addiu r29,r29,-0x0020
0013f66c: 27a40010 addiu r4,r29,0x0010          #   (Coordinate data pointer)
0013f670: afbf001c sw r31,0x001c(r29)
0013f674: 0c0237c4 jal 0x0008df10               #   ROUTINE: Store Selected Tile Coordinates (Destination pointer = (Coordinate data pointer))
0013f678: afb00018 sw r16,0x0018(r29)
0013f67c: 87a50010 lh r5,0x0010(r29)            #   Routine Call Parameter 2 = X Coordinate
0013f680: 87a60014 lh r6,0x0014(r29)            #   Routine Call Parameter 3 = Y Coordinate
0013f684: 87a70012 lh r7,0x0012(r29)            #   Routine Call Parameter 4 = Higher Elevation value
0013f688: 0c061007 jal 0x0018401c               #   ROUTINE: Return Various Tile Data ((Call Result) = (Tile type ID))
0013f68c: 00002021 addu r4,r0,r0                #   Routine Call Parameter 1 = 0 (Tile type ID?)
0013f690: 34040003 ori r4,r0,0x0003             #   Routine Call Parameter 1 = 3 (?)
0013f694: 3c108015 lui r16,0x8015
0013f698: 2610d02c addiu r16,r16,0xd02c         #   Address of Tile type ID of currently selected tile (0x8014d02c)
0013f69c: 87a50010 lh r5,0x0010(r29)            #   Routine Call Parameter 2 = X Coordinate
0013f6a0: 87a60014 lh r6,0x0014(r29)            #   Routine Call Parameter 3 = Y Coordinate
0013f6a4: 87a70012 lh r7,0x0012(r29)            #   Routine Call Parameter 4 = Higher Elevation value
0013f6a8: 304200ff andi r2,r2,0x00ff
0013f6ac: 0c061007 jal 0x0018401c               #   ROUTINE: Return Various Tile Data
0013f6b0: a6020000 sh r2,0x0000(r16)            #   Store (Tile type ID) returned from previous call to 0x8014d02c
0013f6b4: 87a50010 lh r5,0x0010(r29)            #   Routine Call Parameter 2 = X Coordinate
0013f6b8: 87a60014 lh r6,0x0014(r29)            #   Routine Call Parameter 3 = Y Coordinate
0013f6bc: 87a70012 lh r7,0x0012(r29)            #   Routine Call Parameter 4 = Higher Elevation value
0013f6c0: 304200ff andi r2,r2,0x00ff
0013f6c4: 3c018015 lui r1,0x8015
0013f6c8: a422d032 sh r2,-0x2fce(r1)            #  *0x8014d032 = (Call Result) (Depth value?)
0013f6cc: 0c061007 jal 0x0018401c               #   ROUTINE: Return Various Tile Data
0013f6d0: 34040002 ori r4,r0,0x0002             #   Routine Call Parameter 1: 2 (Height)
0013f6d4: 304200ff andi r2,r2,0x00ff
0013f6d8: 00021040 sll r2,r2,0x01               #   (Height) * 2 = Height (halves)
0013f6dc: 87a50010 lh r5,0x0010(r29)            #   Routine Call Parameter 2 = X Coordinate
0013f6e0: 87a60014 lh r6,0x0014(r29)            #   Routine Call Parameter 3 = Y Coordinate
0013f6e4: 3c038015 lui r3,0x8015
0013f6e8: 9463d032 lhu r3,-0x2fce(r3)           #   (Depth portion)
0013f6ec: 87a70012 lh r7,0x0012(r29)            #   Routine Call Parameter 4 = Higher Elevation value
0013f6f0: 00621821 addu r3,r3,r2                #   (Depth portion) + Height (halves)
0013f6f4: 3c018015 lui r1,0x8015
0013f6f8: a423d032 sh r3,-0x2fce(r1)            #   *0x8014d032 = (Depth portion) + Height (halves)
0013f6fc: 0c061007 jal 0x0018401c               #   ROUTINE: Return Various Tile Data
0013f700: 34040004 ori r4,r0,0x0004             #   Routine Call Parameter 1 = 4 (?)
0013f704: 304200ff andi r2,r2,0x00ff
0013f708: 3c018015 lui r1,0x8015
0013f70c: a422d034 sh r2,-0x2fcc(r1)            #   *0x8014d034 = ?
0013f710: 00021040 sll r2,r2,0x01               #   *0x8014d034 * 2
0013f714: 3c038015 lui r3,0x8015
0013f718: 9463d032 lhu r3,-0x2fce(r3)           #   *0x8014d032
0013f71c: 86040000 lh r4,0x0000(r16)            #   Tile type ID
0013f720: 00621821 addu r3,r3,r2                #   *0x8014d032 + *0x8014d034 * 2
0013f724: 00042040 sll r4,r4,0x01               #   (Tile type ID) * 2
0013f728: 3c018015 lui r1,0x8015
0013f72c: a423d032 sh r3,-0x2fce(r1)            #   *0x8014d032 = *0x8014d032 + *0x8014d034 * 2
0013f730: 3c018006 lui r1,0x8006
0013f734: 00240821 addu r1,r1,r4
0013f738: 9022e950 lbu r2,-0x16b0(r1)           #   Data for this tile type ID (First byte)
0013f73c: 3c018015 lui r1,0x8015
0013f740: a422d02e sh r2,-0x2fd2(r1)            #   Store at 0x8014d02e
0013f744: 3c018006 lui r1,0x8006
0013f748: 00240821 addu r1,r1,r4
0013f74c: 9022e951 lbu r2,-0x16af(r1)           #   Data for this tile type ID (Second byte)
0013f750: 3c018015 lui r1,0x8015
0013f754: a422d030 sh r2,-0x2fd0(r1)            #   Store at 0x8014d030
0013f758: 8fbf001c lw r31,0x001c(r29)
0013f75c: 8fb00018 lw r16,0x0018(r29)
0013f760: 27bd0020 addiu r29,r29,0x0020
0013f764: 03e00008 jr r31
0013f768: 00000000 nop