Select Target Tile

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: SELECT TARGET TILE
#   This routine selects the tile that the cursor is over as the target of the ability being used.
#       No parameters.
#       Returns:
#           ?
00074308: 27bdffe8 addiu r29,r29,0xffe8
0007430c: afbf0014 sw r31,0x0014(r29)
00074310: 0c01e886 jal 0x0007a218               #   ROUTINE: Get Source Unit Misc Data Pointer (Skipping routine and setting r2 = 0 (null) here causes cursor to disappear and no selection is made)
00074314: afb00010 sw r16,0x0010(r29)
00074318: 00408021 addu r16,r2,r0
0007431c: 8e030174 lw r3,0x0174(r16)
00074320: 34020002 ori r2,r0,0x0002
00074324: 14620006 bne r3,r2,0x00074340
00074328: a6000008 sh r0,0x0008(r16)
0007432c: 9205007c lbu r5,0x007c(r16)          Unit misc X
00074330: 9206007e lbu r6,0x007e(r16)          Unit misc elevation
00074334: 9207007d lbu r7,0x007d(r16)          Unit Y
00074338: 0801d0db j 0x0007436c
0007433c: 00000000 nop
00074340: 9202013d lbu r2,0x013d(r16)
00074344: 00000000 nop
00074348: 30420008 andi r2,r2,0x0008
0007434c: 1040000b beq r2,r0,0x0007437c
00074350: 00000000 nop
00074354: 3c058009 lui r5,0x8009
00074358: 8ca561b4 lw r5,0x61b4(r5)             Cursor X coordinates
0007435c: 3c068009 lui r6,0x8009
00074360: 8cc661b8 lw r6,0x61b8(r6)             Cursor Elevation
00074364: 3c078009 lui r7,0x8009
00074368: 8ce761bc lw r7,0x61bc(r7)             Cursor Y
0007436c: 0c010ac7 jal 0x00042b1c               #   ROUTINE: (Affects which tile is targeted - if removed, cursor position is ignored, and last targeted tile is targeted again)
00074370: 26040168 addiu r4,r16,0x0168
00074374: 34020005 ori r2,r0,0x0005
00074378: a2020166 sb r2,0x0166(r16)
0007437c: 0c05eabe jal 0x0017aaf8               #   ROUTINE: Calculate Targeting for Menu Types (Same effect as routine above if removed and r2 set = 1)
00074380: 2604015c addiu r4,r16,0x015c
00074384: 00401821 addu r3,r2,r0
00074388: 28620002 slti r2,r3,0x0002
0007438c: 10400007 beq r2,r0,0x000743ac
00074390: ae030178 sw r3,0x0178(r16)
00074394: 0461000a bgez r3,0x000743c0
00074398: 2402ffff addiu r2,r0,0xffff
0007439c: 1062002b beq r3,r2,0x0007444c
000743a0: 00000000 nop
000743a4: 0801d115 j 0x00074454
000743a8: 00000000 nop
000743ac: 34020002 ori r2,r0,0x0002
000743b0: 1062001e beq r3,r2,0x0007442c
000743b4: 00000000 nop
000743b8: 0801d115 j 0x00074454
000743bc: 00000000 nop
000743c0: 0c01bbb7 jal 0x0006eedc               #   ROUTINE: (No discernable effect if skipped)
000743c4: 00000000 nop
000743c8: 34040007 ori r4,r0,0x0007
000743cc: 3c038009 lui r3,0x8009
000743d0: 8c6360c0 lw r3,0x60c0(r3)
000743d4: 34020019 ori r2,r0,0x0019
000743d8: 3c018009 lui r1,0x8009
000743dc: ac2260e4 sw r2,0x60e4(r1)
000743e0: 34020002 ori r2,r0,0x0002
000743e4: 3c018009 lui r1,0x8009
000743e8: ac2260c0 sw r2,0x60c0(r1)
000743ec: 3c018009 lui r1,0x8009
000743f0: ac2360c4 sw r3,0x60c4(r1)
000743f4: 0c03b1c6 jal 0x000ec718               #   ROUTINE: Background Tile Color For Targeting/Movement (Partial Tiles) (If skipped, target tile doesn't turn yellow) (r4 = 7, r5 = 3)
000743f8: 34050003 ori r5,r0,0x0003
000743fc: 0c01b98d jal 0x0006e634               #   ROUTINE: (If skipped, projected action effect and bottom windows not shown)
00074400: 00000000 nop
00074404: 3c028004 lui r2,0x8004
00074408: 8c4273ac lw r2,0x73ac(r2)
0007440c: 3c031800 lui r3,0x1800
00074410: 00431024 and r2,r2,r3
00074414: 1440000f bne r2,r0,0x00074454
00074418: 00000000 nop
0007441c: 0c01a18d jal 0x00068634               #   ROUTINE: ?
00074420: 00000000 nop
00074424: 0801d115 j 0x00074454
00074428: 00000000 nop
0007442c: 0c01bbbc jal 0x0006eef0               #   ROUTINE: ?
00074430: 00000000 nop
00074434: 0c01cff8 jal 0x00073fe0               #   ROUTINE: ?
00074438: 00000000 nop
0007443c: 0c01b98d jal 0x0006e634               #   ROUTINE: ?
00074440: 00000000 nop
00074444: 0801d115 j 0x00074454
00074448: 00000000 nop
0007444c: 0c01c53d jal 0x000714f4               #   ROUTINE: ?
00074450: 00000000 nop
00074454: 0c01a0f5 jal 0x000683d4               #   ROUTINE: ?
00074458: 00000000 nop
0007445c: 8fbf0014 lw r31,0x0014(r29)
00074460: 8fb00010 lw r16,0x0010(r29)
00074464: 27bd0018 addiu r29,r29,0x0018
00074468: 03e00008 jr r31
0007446c: 00000000 nop

Return Locations

Battle.bin 
0007457c: 000744c8 - 000745a8
00075288: Decide what to do based on skillset/ability selections
000755b8: Set move/act based on skillset
00076a90: 000769b0 - 00076b78