Determining Multi Hit Formulas

From Final Fantasy Hacktics Wiki
Revision as of 14:45, 22 February 2012 by Choto (talk | contribs)
Jump to navigation Jump to search
Determining Multi Hit Formulas (and other ugly hard coding)
0017d4a0: 27bdffe8 addiu r29,r29,0xffe8
0017d4a4: 3c038019 lui r3,0x8019
0017d4a8: 8c63f5f0 lw r3,-0x0a10(r3)
0017d4ac: 34020001 ori r2,r0,0x0001
0017d4b0: afbf0014 sw r31,0x0014(r29)
0017d4b4: afb00010 sw r16,0x0010(r29)
0017d4b8: 3c018019 lui r1,0x8019
0017d4bc: a02238c2 sb r2,0x38c2(r1)		Hit is normal hits, not multi-hit.
0017d4c0: 3c018019 lui r1,0x8019
0017d4c4: a02038c3 sb r0,0x38c3(r1) 		???
0017d4c8: 3c018019 lui r1,0x8019
0017d4cc: a42038c8 sh r0,0x38c8(r1) 		No Spell Procs.
0017d4d0: 3c018019 lui r1,0x8019
0017d4d4: a02038ed sb r0,0x38ed(r1) 		Attack is not evaded?
0017d4d8: 14600009 bne r3,r0,0x0017d500 	If RAM 0x18F5F0 isn't 0, GOTO RAM  0x17D500.
0017d4dc: 00002821 addu r5,r0,r0
0017d4e0: 3c018019 lui r1,0x8019
0017d4e4: a02038e8 sb r0,0x38e8(r1) 		ELSE, No Spell Procs (again).
0017d4e8: 3c018019 lui r1,0x8019
0017d4ec: a02038e7 sb r0,0x38e7(r1) 		No EXP bonus.
0017d4f0: 3c018019 lui r1,0x8019
0017d4f4: a020390c sb r0,0x390c(r1) 		???
0017d4f8: 3c018019 lui r1,0x8019
0017d4fc: a020390d sb r0,0x390d(r1) 		???
0017d500: 9082016f lbu r2,0x016f(r4) 		Load attack's Skillset ID.
0017d504: 3c018006 lui r1,0x8006
0017d508: 00220821 addu r1,r1,r2
0017d50c: 90265cb4 lbu r6,0x5cb4(r1) 		Load attack's menu type from SCUS.
0017d510: 3c018019 lui r1,0x8019
0017d514: a020f7ec sb r0,-0x0814(r1) 		Clear byte where Ability Flags are  copied (one of many places).
0017d518: 9082001d lbu r2,0x001d(r4)
0017d51c: 3c018019 lui r1,0x8019
0017d520: a02238c4 sb r2,0x38c4(r1) 		RH Weapon is stored.
0017d524: 9082001f lbu r2,0x001f(r4)
0017d528: 3c038019 lui r3,0x8019
0017d52c: 906338c4 lbu r3,0x38c4(r3)
0017d530: 3c018019 lui r1,0x8019
0017d534: a02238c5 sb r2,0x38c5(r1) 		LH Weapon is stored.
0017d538: 340200ff ori r2,r0,0x00ff
0017d53c: 14620008 bne r3,r2,0x0017d560 	If RH weapon exists, GOTO RAM  0x17D560.
0017d540: 30c300ff andi r3,r6,0x00ff
0017d544: 9083001f lbu r3,0x001f(r4)
0017d548: 340200ff ori r2,r0,0x00ff
0017d54c: 3c018019 lui r1,0x8019
0017d550: a02238c5 sb r2,0x38c5(r1)
0017d554: 3c018019 lui r1,0x8019
0017d558: a02338c4 sb r3,0x38c4(r1) 		ELSE, LH weapon is set as primary  weapon, and LH weapon byte = none.
0017d55c: 30c300ff andi r3,r6,0x00ff
0017d560: 34020002 ori r2,r0,0x0002
0017d564: 14620006 bne r3,r2,0x0017d580 	If attack type isn't THROW, GOTO  RAM 0x17D580
0017d568: 00000000 nop
0017d56c: 90820176 lbu r2,0x0176(r4)
0017d570: 3c018019 lui r1,0x8019
0017d574: a02238c4 sb r2,0x38c4(r1) 		If attack type is THROW, store  thrown item and GOTO END.
0017d578: 0805f5bd j 0x0017d6f4
0017d57c: 00000000 nop
0017d580: 10600003 beq r3,r0,0x0017d590 	If attack type is <Default>, GOTO RAM 0x17D590
0017d584: 34020006 ori r2,r0,0x0006
0017d588: 1462002b bne r3,r2,0x0017d638 	If attack type isn't Monster, GOTO  RAM 0x17D638
0017d58c: 30c300ff andi r3,r6,0x00ff
0017d590: 84830170 lh r3,0x0170(r4) 		If Attack type is <Default> or Monster, load attack ID.
0017d594: 00000000 nop
0017d598: 04610004 bgez r3,0x0017d5ac
0017d59c: 000310c0 sll r2,r3,0x03
0017d5a0: 28620170 slti r2,r3,0x0170
0017d5a4: 1040000b beq r2,r0,0x0017d5d4 	If attack is after Potion, GOTO RAM 0x17D5D4
0017d5a8: 000310c0 sll r2,r3,0x03
0017d5ac: 00431023 subu r2,r2,r3
0017d5b0: 00021040 sll r2,r2,0x01
0017d5b4: 3c038006 lui r3,0x8006
0017d5b8: 2463fbf0 addiu r3,r3,0xfbf0
0017d5bc: 00431021 addu r2,r2,r3
0017d5c0: 90430003 lbu r3,0x0003(r2)
0017d5c4: 3c018019 lui r1,0x8019
0017d5c8: a023f7ec sb r3,-0x0814(r1) 		Store Ability Flags Byte 1
0017d5cc: 90500009 lbu r16,0x0009(r2) 		Load X
0017d5d0: 90450008 lbu r5,0x0008(r2) 		Load Formula
0017d5d4: 00000000 nop
0017d5d8: 24a2ffe2 addiu r2,r5,0xffe2
0017d5dc: 2c420002 sltiu r2,r2,0x0002
0017d5e0: 10400010 beq r2,r0,0x0017d624 	If Formula is not Rafa's or  Malak's, GOTO RAM 0x17D624.
0017d5e4: 30a300ff andi r3,r5,0x00ff
0017d5e8: 3c028019 lui r2,0x8019
0017d5ec: 8c42f5fc lw r2,-0x0a04(r2)
0017d5f0: 00000000 nop
0017d5f4: 1440000c bne r2,r0,0x0017d628 	ELSE if attack hits no one, GOTO  RAM 0x17D628.
0017d5f8: 3402005e ori r2,r0,0x005e
0017d5fc: 0c0088c3 jal 0x0002230c
0017d600: 00000000 nop
0017d604: 02020018 mult r16,r2
0017d608: 00001012 mflo r2
0017d60c: 04410002 bgez r2,0x0017d618
0017d610: 00000000 nop
0017d614: 24427fff addiu r2,r2,0x7fff
0017d618: 000213c3 sra r2,r2,0x0f
0017d61c: 0805f5bb j 0x0017d6ec ELSE (if Rafa/Malak formula hits), GOTO RAM  0x17D6EC and store r2 = RN{1...X+1}, the amount of hits.
0017d620: 24420001 addiu r2,r2,0x0001
0017d624: 3402005e ori r2,r0,0x005e
0017d628: 14620003 bne r3,r2,0x0017d638 If Formula is not Triple Thunder/Flame's,  GOTO RAM 0x17D638.  This is the hard-coding of multi-hit for Triple Flame/Thunder.
0017d62c: 30c300ff andi r3,r6,0x00ff
0017d630: 0805f5bb j 0x0017d6ec  If it is, GOTO RAM 0x17D6EC and store X+1, the amount of hits.  Because there is no corresponding check (like Rafa/Malak) to see if you actually hit anything in the AoE, it is possible to have the animation  appear even if nothing is in the AoE.
0017d634: 26020001 addiu r2,r16,0x0001
0017d638: 34020009 ori r2,r0,0x0009
0017d63c: 1062002d beq r3,r2,0x0017d6f4 If attack type is Jump, GOTO END.
0017d640: 34020008 ori r2,r0,0x0008
0017d644: 10620009 beq r3,r2,0x0017d66c
0017d648: 3402000a ori r2,r0,0x000 a
0017d64c: 10620007 beq r3,r2,0x0017d66c If attack type is Attack or Charge, GOTO  RAM 0x17D66C
0017d650: 00000000 nop
0017d654: 3c028019 lui r2,0x8019
0017d658: 9042f7ec lbu r2,-0x0814(r2)
0017d65c: 00000000 nop
0017d660: 30420020 andi r2,r2,0x0020
0017d664: 10400023 beq r2,r0,0x0017d6f4
0017d668: 00000000 nop
0017d66c: 9082005a lbu r2,0x005a(r4) Attack type here is Attack, Charge, or has  Ranged Weapon.
0017d670: 90850091 lbu r5,0x0091(r4)
0017d674: 30420002 andi r2,r2,0x0002
0017d678: 14400006 bne r2,r0,0x0017d694 If attacker is frogged, GOTO RAM 0x17D694
0017d67c: 340200ff ori r2,r0,0x00ff
0017d680: 90820006 lbu r2,0x0006(r4)
0017d684: 00000000 nop
0017d688: 30420020 andi r2,r2,0x002 0
0017d68c: 10400005 beq r2,r0,0x0017d6a4 If attacker is not a monster, GOTO RAM  0x17D6A4
0017d690: 340200ff ori r2,r0,0x00ff
0017d694: 3c018019 lui r1,0x8019
0017d698: a02238c4 sb r2,0x38c4(r1) If attacker is frogged or is a monster, RH Weapon = none .
0017d69c: 3c018019 lui r1,0x801 9
0017d6a0: a02238c5 sb r2,0x38c5(r1) If attacker is frogged or is a monster, LH W eapon = none.
0017d6a4: 3c048019 lui r4,0x8019
0017d6a8: 248438c4 addiu r4,r4,0x38c4
0017d6ac: 94830000 lhu r3,0x0000(r4)
0017d6b0: 3402ffff ori r2,r0,0xffff
0017d6b4: 1062000a beq r3,r2,0x0017d6e0
0017d6b8: 340300ff ori r3,r0,0x00ff
0017d6bc: 90820000 lbu r2,0x0000(r4)
0017d6c0: 00000000 nop
0017d6c4: 1043000b beq r2,r3,0x0017d6f4
0017d6c8: 00000000 nop
0017d6cc: 3c028019 lui r2,0x8019
0017d6d0: 904238c5 lbu r2,0x38c5(r2)
0017d6d4: 00000000 nop
0017d6d8: 10430006 beq r2,r3,0x0017d6f4
0017d6dc: 00000000 nop
0017d6e0: 30a20001 andi r2,r5,0x0001
0017d6e4: 10400003 beq r2,r0,0x0017d6f4
0017d6e8: 34020002 ori r2,r0,0x0002
0017d6ec: 3c018019 lui r1,0x8019
0017d6f0: a02238c2 sb r2,0x38c2(r1) Store number of hits from multi-hit or two swords.
0017d6f4: 8fbf0014 lw r31,0x0014(r29)
0017d6f8: 8fb00010 lw r16,0x0010(r29)
0017d6fc: 27bd0018 addiu r29,r29,0x0018
0017d700: 03e00008 jr r31
0017d704: 00000000 nop


Return Locations

0017ca98: - Routine at 17c9b8
0017e0f8: - Big... Contains Hamedo check
0017e468: - Routine at 17e178
0017f1c4: - Routine at 17f17c