Difference between revisions of "Counter magic targeting"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(assuming r17 is labelled correctly as unit data, this is everything I could piece together)
 
(No difference)

Latest revision as of 02:32, 18 July 2024

This is actually Reflect's code!!

0017e590: 27bdffc0 addiu r29,r29,0xffc0
0017e594: afb10034 sw r17,0x0034(r29)
0017e598: 00808821 addu r17,r4,r0		r17 = unit data
0017e59c: afb00030 sw r16,0x0030(r29)
0017e5a0: 2630016e addiu r16,r17,0x016e 	r16 = targeting data
0017e5a4: afbf0038 sw r31,0x0038(r29)
0017e5a8: 92250047 lbu r5,0x0047(r17)		load reacting target's x coordinate
0017e5ac: 3c038019 lui r3,0x8019
0017e5b0: 90632dcc lbu r3,0x2dcc(r3)		load x coordinate from current unit's move
0017e5b4: 92240048 lbu r4,0x0048(r17)		load reacting target's y coordinate
0017e5b8: 3c028019 lui r2,0x8019
0017e5bc: 90422dd0 lbu r2,0x2dd0(r2)		load Y coordinate from current unit's move
0017e5c0: 00a32823 subu r5,r5,r3		
0017e5c4: 14a00003 bne r5,r0,0x 0017e5d4	branch if unit is not attacking themselves (x coordinate check)
0017e5c8: 00823023 subu r6,r4,r2
0017e5cc: 10c0001a beq r6,r0,0x 0017e638	skip routine if unit is attacking themselves (y coordinate check)
0017e5d0: 2402ffff addiu r2,r0,0xffff		r2 = 0xffff
0017e5d4: 27a20020 addiu r2,r29,0x0020
0017e5d8: afa20010 sw r2,0x0010(r29)
0017e5dc: 27a20024 addiu r2,r29,0x0024
0017e5e0: afa20014 sw r2,0x0014(r29)
0017e5e4: 27a20028 addiu r2,r29,0x0028
0017e5e8: 02202021 addu r4,r17,r0		r4 = unit data
0017e5ec: 00003821 addu r7,r0,r0		r7 = 0
0017e5f0: 0c063cac jal 0x0018f2b0		Load last used ability
0017e5f4: afa20018 sw r2,0x0018(r29)
0017e5f8: 1440000f bne r2,r0,0x 0017e638	skips routine if failed to load last used ability?
0017e5fc: 2402ffff addiu r2,r0,0xffff		r2 = 0xffff
0017e600: 3402000b ori r2,r0,0x000b		r2 = black magic? (time magic?)
0017e604: a2020001 sb r2,0x0001(r16)		saves skillset last used as black magic? (could be displaced by 1 address, because of the null skillset?)
0017e608: 962601b2 lhu r6,0x01b2(r17)		load last attack received by target
0017e60c: 34020005 ori r2,r0,0x0005		r2 = tile specific ability?
0017e610: a202000a sb r2,0x000a(r16)		store reaction ID = tile specific ability?
0017e614: a200000b sb r0,0x000b(r16)		clear target ID?
0017e618: 97a30020 lhu r3,0x0020(r29)		
0017e61c: 97a40024 lhu r4,0x0024(r29)
0017e620: 97a50028 lhu r5,0x0028(r29)
0017e624: 00001021 addu r2,r0,r0
0017e628: a6060002 sh r6,0x0002(r16)		store last attack used as proper ID
0017e62c: a603000c sh r3,0x000c(r16)		store target X panel
0017e630: a6040010 sh r4,0x0010(r16)		store target Y panel
0017e634: a605000e sh r5,0x000e(r16)		store target elevation
0017e638: 8fbf0038 lw r31,0x0038(r29)
0017e63c: 8fb10034 lw r17,0x0034(r29)
0017e640: 8fb00030 lw r16,0x0030(r29)
0017e644: 27bd0040 addiu r29,r29,0x0040
0017e648: 03e00008 jr r31
0017e64c: 00000000 nop