Calculate Reaction Targetting & Usage

From Final Fantasy Hacktics Wiki
Revision as of 13:21, 14 December 2012 by Choto (talk | contribs) (Created page with " 0017e178: 27bdffd0 addiu r29,r29,0xffd0 0017e17c: afb50024 sw r21,0x0024(r29) 0017e180: 0080a821 addu r21,r4,r0 0017e184: 3c038019 lui r3,0x8019 0017e188: 8c63f8c8 lw r3,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
0017e178: 27bdffd0 addiu r29,r29,0xffd0
0017e17c: afb50024 sw r21,0x0024(r29)
0017e180: 0080a821 addu r21,r4,r0
0017e184: 3c038019 lui r3,0x8019
0017e188: 8c63f8c8 lw r3,-0x0738(r3)
0017e18c: 2402ffff addiu r2,r0,0xffff
0017e190: afbf002c sw r31,0x002c(r29)
0017e194: afb60028 sw r22,0x0028(r29)
0017e198: afb40020 sw r20,0x0020(r29)
0017e19c: afb3001c sw r19,0x001c(r29)
0017e1a0: afb20018 sw r18,0x0018(r29)
0017e1a4: afb10014 sw r17,0x0014(r29)
0017e1a8: 106200ee beq r3,r2,0x 0017e564		branch if reaction ID does not exist
0017e1ac: afb00010 sw r16,0x0010(r29)		return r2= 0xff
0017e1b0: 00009821 addu r19,r0,r0
0017e1b4: 34140001 ori r20,r0,0x0001
0017e1b8: 2416ffff addiu r22,r0,0xffff
0017e1bc: 3c028019 lui r2,0x8019
0017e1c0: 8c42f8c8 lw r2,-0x0738(r2)		load reaction ID
0017e1c4: 3c018019 lui r1,0x8019
0017e1c8: ac20f5f0 sw r0,-0x0a10(r1)		load display somethin?
0017e1cc: 126200de beq r19,r2,0x 0017e548	branch if reaction ID = 0
0017e1d0: 001310c0 sll r2,r19,0x03
0017e1d4: 00531023 subu r2,r2,r19
0017e1d8: 00021180 sll r2,r2,0x06
0017e1dc: 3c038019 lui r3,0x8019
0017e1e0: 246308cc addiu r3,r3,0x08cc		r4 = unit data		
0017e1e4: 00438821 addu r17,r2,r3
0017e1e8: 02202021 addu r4,r17,r0
0017e1ec: 0c0604c3 jal 0x0018130c			load weapon guard usability
0017e1f0: 2632016e addiu r18,r17,0x016e		r18 = targeting data
0017e1f4: 144000d4 bne r2,r0,0x 0017e548		branch if not usable?
0017e1f8: 340200ff ori r2,r0,0x00ff			return 0xff
0017e1fc: 92230001 lbu r3,0x0001(r17)		load unit ID
0017e200: 00000000 nop
0017e204: 106200d0 beq r3,r2,0x 0017e548		branch if unit doesn't exist
0017e208: 00000000 nop
0017e20c: 0c06325a jal 0x0018c968			jump to see if unit reacts?
0017e210: 02202021 addu r4,r17,r0
0017e214: 9630019a lhu r16,0x019a(r17)		load reaction ID
0017e218: 14400006 bne r2,r0,0x 0017e234		branch if unit reacts
0017e21c: 3203ffff andi r3,r16,0xffff		r3 = reaction ID
0017e220: 3c028019 lui r2,0x8019
0017e224: 8c42f5fc lw r2,-0x0a04(r2)		load ??
0017e228: 00000000 nop
0017e22c: 14540004 bne r2,r20,0x 0017e240	branch if ?? is not 01
0017e230: 00000000 nop
0017e234: 340201b8 ori r2,r0,0x01b8
0017e238: 146200c3 bne r3,r2,0x 0017e548		branch if reaction is not "reflect"
0017e23c: 00000000 nop
0017e240: 120000c1 beq r16,r0,0x 0017e548	branch if reaction ID = 0
0017e244: 00000000 nop
0017e248: 3c058019 lui r5,0x8019
0017e24c: 24a53848 addiu r5,r5,0x3848		r5 = units targetting data address
0017e250: 3c018019 lui r1,0x8019
0017e254: ac34f5f0 sw r20,-0x0a10(r1)		store 01 into ??
0017e258: 0c01788b jal 0x0005e22c
0017e25c: 02402021 addu r4,r18,r0			jump to transfer target data
0017e260: 3c018019 lui r1,0x8019
0017e264: a4302d9c sh r16,0x2d9c(r1)		store reaction ID to current move? 
0017e268: a2530000 sb r19,0x0000(r18)		store ?? target ID?
0017e26c: a2400001 sb r0,0x0001(r18)		store last skillset used = 0
0017e270: 3c028019 lui r2,0x8019
0017e274: 94422d9c lhu r2,0x2d9c(r2)		load current ability ID?
0017e278: 34100001 ori r16,r0,0x0001
0017e27c: a6420002 sh r2,0x0002(r18)		store reaction ability ID as last attack used
0017e280: 2442fe4e addiu r2,r2,0xfe4e		reaction ID - 1b2
0017e284: 00021400 sll r2,r2,0x10			reaction ID - 1b2
0017e288: 00021c03 sra r3,r2,0x10		
0017e28c: 962601b2 lhu r6,0x01b2(r17)		load last attack on self byte
0017e290: 2c620009 sltiu r2,r3,0x0009		set if reaction ID is between 0x1b2 and 0x1bb?
0017e294: 10400057 beq r2,r0,0x 0017e3f4		branch if not
0017e298: a620019a sh r0,0x019a(r17)		store reaction ID = 0
0017e29c: 00031080 sll r2,r3,0x02			reaction ID - 1b2
0017e2a0: 3c018017 lui r1,0x8017
0017e2a4: 00220821 addu r1,r1,r2
0017e2a8: 8c224120 lw r2,0x4120(r1)
0017e2ac: 00000000 nop
0017e2b0: 00400008 jr r2
0017e2b4: 00000000 nop
00174120: 8017e2d0 lb r23,-0x1d30(r0) - Meatbone
00174124: 8017e2f8 lb r23,-0x1d08(r0) - Counter magic
00174128: 8017e30c lb r23,-0x1cf4(r0) - Counter Tackle
0017412c: 8017e31c lb r23,-0x1ce4(r0) - Counter Flood
00174130: 8017e3f4 lb r23,-0x1c0c(r0) - Absorb used Mp
00174134: 8017e3f4 lb r23,-0x1c0c(r0) - Gilgame Heart
00174138: 8017e2b8 lb r23,-0x1d48(r0) - Reflect
0017413c: 8017e360 lb r23,-0x1ca0(r0) - Auto Potion
00174140: 8017e3d0 lb r23,-0x1c30(r0) - Counter
00174144: 80181608 lb r24,0x1608(r0)
00174148: 80181640 lb r24,0x1640(r0)
0017414c: 80181658 lb r24,0x1658(r0)
00174150: 80181670 lb r24,0x1670(r0)
00174154: 801816b8 lb r24,0x16b8(r0)
00174158: 801816fc lb r24,0x16fc(r0)
0017415c: 801816fc lb r24,0x16fc(r0)
00174160: 801816cc lb r24,0x16cc(r0)
00174164: 801816fc lb r24,0x16fc(r0)
00174168: 801816fc lb r24,0x16fc(r0)
0017416c: 801816e4 lb r24,0x16e4(r0)
00174170: 100c0b0a beq r0,r12,0x 00176d9c

Counter Magic

0017e2b8: 0c05f964 jal 0x 0017e590			
0017e2bc: 02202021 addu r4,r17,r0
0017e2c0: 2c420001 sltiu r2,r2,0x0001
0017e2c4: 00021023 subu r2,r0,r2
0017e2c8: 0805f906 j 0x 0017e418
0017e2cc: 30500003 andi r16,r2,0x0003

Meatbone Slash

0017e2d0: 02202021 addu r4,r17,r0
0017e2d4: 34050001 ori r5,r0,0x0001		
0017e2d8: 00003021 addu r6,r0,r0
0017e2dc: 0c05f994 jal 0x 0017e650			Store Counter Ability
0017e2e0: 34070001 ori r7,r0,0x0001		
0017e2e4: 14400041 bne r2,r0,0x 0017e3ec		branch if ??
0017e2e8: 34020005 ori r2,r0,0x0005
0017e2ec: a2540001 sb r20,0x0001(r18)		
0017e2f0: 0805f906 j 0x 0017e418
0017e2f4: a242000a sb r2,0x000a(r18)		store reaction ID = 05?

Reflect?

0017e2f8: 02202021 addu r4,r17,r0
0017e2fc: 3405000b ori r5,r0,0x000b
0017e300: 00063400 sll r6,r6,0x10
0017e304: 0805f8d3 j 0x 0017e34c
0017e308: 00063403 sra r6,r6,0x10

Counter Tackle

0017e30c: 02202021 addu r4,r17,r0
0017e310: 3405000b ori r5,r0,0x000b
0017e314: 0805f8f7 j 0x 0017e3dc
0017e318: 34060093 ori r6,r0,0x0093			store ability = dash

Counter Flood

0017e31c: 0c060428 jal 0x001810a0		Map location calculation
0017e320: 02202021 addu r4,r17,r0
0017e324: 02202021 addu r4,r17,r0
0017e328: 000210c0 sll r2,r2,0x03
0017e32c: 3c018019 lui r1,0x8019
0017e330: 00220821 addu r1,r1,r2
0017e334: 9022f8cc lbu r2,-0x0734(r1)		load tile data
0017e338: 34050011 ori r5,r0,0x0011
0017e33c: 3042003f andi r2,r2,0x003f				
0017e340: 3c018006 lui r1,0x8006
0017e344: 00220821 addu r1,r1,r2
0017e348: 9026e9d0 lbu r6,-0x1630(r1)		get counter flood ability?
0017e34c: 0c05f994 jal 0x 0017e650			Store Counter Ability?
0017e350: 00003821 addu r7,r0,r0
0017e354: 2c420001 sltiu r2,r2,0x0001
0017e358: 0805f906 j 0x 0017e418
0017e35c: 00028040 sll r16,r2,0x01

Auto Potion

0017e360: 0c05f9e0 jal 0x 0017e780			Auto Potion Routine
0017e364: 02202021 addu r4,r17,r0
0017e368: 00401821 addu r3,r2,r0
0017e36c: 1076001f beq r3,r22,0x 0017e3ec	branch if autopotion returned no inventory 
0017e370: 34020006 ori r2,r0,0x0006
0017e374: a2420001 sb r2,0x0001(r18)		store 06 as used skillset ID? (attack)
0017e378: 34020005 ori r2,r0,0x0005
0017e37c: a2430008 sb r3,0x0008(r18)		store used item ID
0017e380: a242000a sb r2,0x000a(r18)		store 05 into 0x178 in unit data
0017e384: a253000b sb r19,0x000b(r18)		Store Target ID (0x11)
0017e388: 92220047 lbu r2,0x0047(r17)		load X coordinate
0017e38c: 00000000 nop
0017e390: a642000c sh r2,0x000c(r18)		store as target X coordinate
0017e394: 92220048 lbu r2,0x0048(r17)		load Y coordinate
0017e398: 02402021 addu r4,r18,r0			r4 = address to 0x16e in unit data
0017e39c: a6420010 sh r2,0x0010(r18)		store as target Y coordinate
0017e3a0: 96220048 lhu r2,0x0048(r17)		load Y coordinate??
0017e3a4: 34100002 ori r16,r0,0x0002		
0017e3a8: 000213c2 srl r2,r2,0x0f			clear r2??
0017e3ac: 0c05f0f7 jal 0x 0017c3dc			Jump to set status flags for display
0017e3b0: a642000e sh r2,0x000e(r18)		store ?? into into 0x17c in unit data
0017e3b4: 00401821 addu r3,r2,r0
0017e3b8: 340201b9 ori r2,r0,0x01b9
0017e3bc: 1076000b beq r3,r22,0x 0017e3ec	jump if returned value doesn't equal r22?
0017e3c0: a6220170 sh r2,0x0170(r17)		store last attack used = 0x1b9 (auto potion)
0017e3c4: 2462fffe addiu r2,r3,0xfffe
0017e3c8: 0805f8f9 j 0x 0017e3e4
0017e3cc: 2c420002 sltiu r2,r2,0x0002

Counter

0017e3d0: 02202021 addu r4,r17,r0
0017e3d4: 34050001 ori r5,r0,0x0001
0017e3d8: 00003021 addu r6,r0,r0			Counter ability = attack
0017e3dc: 0c05f994 jal 0x 0017e650			store counter ability
0017e3e0: 34070001 ori r7,r0,0x0001		
0017e3e4: 1040000d beq r2,r0,0x 0017e41c
0017e3e8: 2602ffff addiu r2,r16,0xffff


0017e3ec: 0805f906 j 0x 0017e418
0017e3f0: 00008021 addu r16,r0,r0
0017e3f4: 3c028019 lui r2,0x8019
0017e3f8: 84422d9c lh r2,0x2d9c(r2)		load current move ability ID? (reaction ID)
0017e3fc: 3c018006 lui r1,0x8006
0017e400: 00220821 addu r1,r1,r2
0017e404: 9022ea2a lbu r2,-0x15d6(r1)		load 0x5ea2a (this is in the terrain status infliction table)
0017e408: 00000000 nop
0017e40c: 30420030 andi r2,r2,0x0030		protect/shell check?
0017e410: 2c420001 sltiu r2,r2,0x0001		set if protect/shell not inflicted?
0017e414: 00028023 subu r16,r0,r2			


0017e418: 2602ffff addiu r2,r16,0xffff
0017e41c: 2c420002 sltiu r2,r2,0x0002
0017e420: 10400006 beq r2,r0,0x 0017e43c
0017e424: 00000000 nop
0017e428: 0c05f688 jal 0x 0017da20			Half of MP/MP cost section
0017e42c: 02202021 addu r4,r17,r0
0017e430: 10400002 beq r2,r0,0x 0017e43c
0017e434: 00000000 nop
0017e438: 00008021 addu r16,r0,r0
0017e43c: 16000007 bne r16,r0,0x 0017e45c
0017e440: 2602ffff addiu r2,r16,0xffff
0017e444: 3c048019 lui r4,0x8019
0017e448: 24843848 addiu r4,r4,0x3848
0017e44c: 0c01788b jal 0x0005e22c		transfer target data
0017e450: 02402821 addu r5,r18,r0
0017e454: 0805f953 j 0x 0017e54c			jump to end
0017e458: 26730001 addiu r19,r19,0x0001
0017e45c: 2c420003 sltiu r2,r2,0x0003
0017e460: 10400005 beq r2,r0,0x 0017e478
0017e464: 00000000 nop
0017e468: 0c05f528 jal 0x 0017d4a0			set weapon data
0017e46c: 02202021 addu r4,r17,r0
0017e470: 0805f94c j 0x 0017e530
0017e474: 00000000 nop


0017e478: 3c018019 lui r1,0x8019
0017e47c: a03438c2 sb r20,0x38c2(r1)		Store # of hits
0017e480: 3c018019 lui r1,0x8019
0017e484: a02038c3 sb r0,0x38c3(r1)			Store weapon Hand?
0017e488: 3c018019 lui r1,0x8019
0017e48c: a42038c8 sh r0,0x38c8(r1)			clear post action?
0017e490: 3c018019 lui r1,0x8019
0017e494: a02038ed sb r0,0x38ed(r1)			clear can poach
0017e498: 9222001d lbu r2,0x001d(r17)
0017e49c: 3c018019 lui r1,0x8019
0017e4a0: a02238c4 sb r2,0x38c4(r1)			store right arm equip	
0017e4a4: 9222001f lbu r2,0x001f(r17)
0017e4a8: 3c018019 lui r1,0x8019
0017e4ac: a02238c5 sb r2,0x38c5(r1)			store left arm equip
0017e4b0: 34020005 ori r2,r0,0x0005
0017e4b4: a2400001 sb r0,0x0001(r18)		store last skillset used = 0
0017e4b8: a242000a sb r2,0x000a(r18)		store reaction ID
0017e4bc: a253000b sb r19,0x000b(r18)		store target ID
0017e4c0: 3c038019 lui r3,0x8019
0017e4c4: 84632d9c lh r3,0x2d9c(r3)			load reaction ID
0017e4c8: 340201be ori r2,r0,0x01be		
0017e4cc: 1462000e bne r3,r2,0x 0017e508		branch if not damage split
0017e4d0: 00000000 nop
0017e4d4: 3c028019 lui r2,0x8019
0017e4d8: 9042f8c8 lbu r2,-0x0738(r2)		load unit ID?
0017e4dc: 00000000 nop
0017e4e0: a242000b sb r2,0x000b(r18)		store unit ID as target ID
0017e4e4: 3c038019 lui r3,0x8019
0017e4e8: 8c63f8c8 lw r3,-0x0738(r3)		load reaction ID
0017e4ec: 00000000 nop
0017e4f0: 000310c0 sll r2,r3,0x03
0017e4f4: 00431023 subu r2,r2,r3
0017e4f8: 00021180 sll r2,r2,0x06
0017e4fc: 3c038019 lui r3,0x8019
0017e500: 246308cc addiu r3,r3,0x08cc
0017e504: 00438821 addu r17,r2,r3			r17 = unit data?
0017e508: 92220047 lbu r2,0x0047(r17)		load X coordinate
0017e50c: 00000000 nop
0017e510: a642000c sh r2,0x000c(r18)		store X coordinate in target data
0017e514: 92220048 lbu r2,0x0048(r17)		Load Y coordinate
0017e518: 00000000 nop
0017e51c: a6420010 sh r2,0x0010(r18)		store Y coordinate in target data
0017e520: 96220048 lhu r2,0x0048(r17)		load y coordinate
0017e524: 00000000 nop
0017e528: 000213c2 srl r2,r2,0x0f
0017e52c: a642000e sh r2,0x000e(r18)		store higher elevation?
0017e530: 3c038019 lui r3,0x8019
0017e534: 94632d9c lhu r3,0x2d9c(r3)		load reaction ID
0017e538: 02601021 addu r2,r19,r0			r2 = target ID
0017e53c: a6a30000 sh r3,0x0000(r21)		store reaction ID onto stack
0017e540: 0805f959 j 0x 0017e564				jump to end
0017e544: a2420000 sb r2,0x0000(r18)		store target ID into attacker/self ID
0017e548: 26730001 addiu r19,r19,0x0001
0017e54c: 2a620015 slti r2,r19,0x0015
0017e550: 1440ff1a bne r2,r0,0x 0017e1bc
0017e554: 2402ffff addiu r2,r0,0xffff
0017e558: 3c018019 lui r1,0x8019
0017e55c: ac20f5f0 sw r0,-0x0a10(r1)		store 0 in action byte?
0017e560: a6a00000 sh r0,0x0000(r21)		store 0 as reaction ID
0017e564: 8fbf002c lw r31,0x002c(r29)
0017e568: 8fb60028 lw r22,0x0028(r29)
0017e56c: 8fb50024 lw r21,0x0024(r29)
0017e570: 8fb40020 lw r20,0x0020(r29)
0017e574: 8fb3001c lw r19,0x001c(r29)
0017e578: 8fb20018 lw r18,0x0018(r29)
0017e57c: 8fb10014 lw r17,0x0014(r29)
0017e580: 8fb00010 lw r16,0x0010(r29)
0017e584: 27bd0030 addiu r29,r29,0x0030
0017e588: 03e00008 jr r31
0017e58c: 00000000 nop