Compatibility Rewrite/Hack

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

A rewrite thanks to SecondAdvent. Just looking at the section is a headache. SecondAdvent's rewrite saves a large amount of space (from 0x80184a2C to 0x80184b23) and gives freedom to change the compatibility damage changes as well as an accessory to neutralize compatibility damage.

00184964: 340600XX ori r6,r0,0x00XX		r6 = Accessory ID (for Neutralization)
00184968: 3c078019 lui r7,0x8019
0018496c: 8ce22d94 lw r2,0x2d94(r7)		Load Attacker's Data Pointer
00184970: 8ce32d98 lw r3,0x2d98(r7)		Load Target's Data Pointer
00184974: 9045001c lbu r5,0x001c(r2)		Load Attacker's Accessory ID
00184978: 9064001c lbu r4,0x001c(r3)		Load Target's Accessory ID
0018497c: 10a60029 beq r5,r6,0x00184a24		Branch if Attacker has Neutralization Accessory
00184980: 3401000c ori r1,r0,0x000c		r1 = 0c (Serpentarius)
00184984: 90450009 lbu r5,0x0009(r2)		Load Attacker's Zodiac
00184988: 10860026 beq r4,r6,0x00184a24		Branch if Target has Neutralization Accessory
0018498c: 00052902 srl r5,r5,0x04		r5 = Attacker's Zodiac
00184990: 90640009 lbu r4,0x0009(r3)		Load Target's Zodiac
00184994: 10a10023 beq r5,r1,0x00184a24		Branch if Attacker is Serpentarius
00184998: 00042102 srl r4,r4,0x04		r4 = Target's Zodiac
0018499c: 10810021 beq r4,r1,0x00184a24		Branch if Target is Serpentarius
001849a0: 0085302b sltu r6,r4,r5
001849a4: 14060002 bne r0,r6,0x001849b0		Branch if Target's Zodiac < Attacker's Zodiac
001849a8: 00a40823 subu r1,r5,r4		r1 = AZ - TZ
001849ac: 00850823 subu r1,r4,r5		r1 = TZ - AZ
001849b0: 84e538ce lh r5,0x38ce(r7)		Load XA
001849b4: 00e13021 addu r6,r7,r1
001849b8: 90c6f600 lbu r6,-0x0a00(r6)		Load Compat Modifier
001849bc: 34010003 ori r1,r0,0x0003		r1 = 3 (Opposing)
001849c0: 90420006 lbu r2,0x0006(r2)		Load Attacker's Gender byte
001849c4: 90630006 lbu r3,0x0006(r3)		Load Target's Gender byte
001849c8: 14c10009 bne r6,r1,0x001849f0		Branch if Compat Mod is not Opposing
001849cc: 00622025 or r4,r3,r2
001849d0: 30840020 andi r4,r4,0x0020
001849d4: 1480000b bne r4,r0,0x00184a04		Branch if either is a Monster
001849d8: 304200c0 andi r2,r2,0x00c0		r2 = Attacker's Gender
001849dc: 306300c0 andi r3,r3,0x00c0		r3 = Target's Gender
001849e0: 14620009 bne r3,r2,0x00184a08		Branch if Genders are Different
001849e4: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (best modifier)
001849e8: 08061282 j 0x00184a08
001849ec: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (worst modifier)
001849f0: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (good modifier)
001849f4: 34020002 ori r2,r0,0x0002		r2 = 2 (Good)
001849f8: 10460003 beq r2,r6,0x00184a08		Branch if they have Good compat
001849fc: 34030001 ori r3,r0,0x0001		r3 = 1 (Bad)
00184a00: 14660008 bne r3,r6,0x00184a24		Branch if they have Neutral compat
00184a04: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (bad modifier)
00184a08: 00250019 multu r1,r5			XA * XXX (X modifier)
00184a0c: 00002812 mflo r5			r5 = XA * XXX
00184a10: 00052a02 srl r5,r5,0x08		XA * XXX / 256
00184a14: 1ca00002 bgtz r5,0x00184a20		Branch if XA is positive
00184a18: 00000000 nop
00184a1c: 34050001 ori r5,r0,0x0001		XA = 1
00184a20: a4e538ce sh r5,0x38ce(r7)		Store XA
00184a24: 03e00008 jr r31
00184a28: 00000000 nop


Code