Update & Animate Unit/WEP/EFF

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

00085c0c: 27bdff58 addiu r29,r29,0xff58
00085c10: afb20090 sw r18,0x0090(r29)
00085c14: 00809021 addu r18,r4,r0			r18 = misc unit data
00085c18: afbf00a4 sw r31,0x00a4(r29)
00085c1c: afb600a0 sw r22,0x00a0(r29)
00085c20: afb5009c sw r21,0x009c(r29)
00085c24: afb40098 sw r20,0x0098(r29)
00085c28: afb30094 sw r19,0x0094(r29)
00085c2c: afb1008c sw r17,0x008c(r29)
00085c30: afb00088 sw r16,0x0088(r29)
00085c34: 3c058007 lui r5,0x8007
00085c38: 24a580dc addiu r5,r5,0x80dc			start of map rotation animation data
00085c3c: 88a20003 lwl r2,0x0003(r5)
00085c40: 98a20000 lwr r2,0x0000(r5)			
00085c44: 88a30007 lwl r3,0x0007(r5)			
00085c48: 98a30004 lwr r3,0x0004(r5)			
00085c4c: aba2001b swl r2,0x001b(r29)			
00085c50: bba20018 swr r2,0x0018(r29)			Stores horizontal/vertical flip flags for south (0x18), west (0x1a)
00085c54: aba3001f swl r3,0x001f(r29)			
00085c58: bba3001c swr r3,0x001c(r29)			Stores horizontal/vertical flip flags for north (0x1c), east (0x1e)
00085c5c: 3c058007 lui r5,0x8007
00085c60: 24a580e4 addiu r5,r5,0x80e4
00085c64: 88a20003 lwl r2,0x0003(r5)
00085c68: 98a20000 lwr r2,0x0000(r5)
00085c6c: 88a30007 lwl r3,0x0007(r5)
00085c70: 98a30004 lwr r3,0x0004(r5)
00085c74: aba20023 swl r2,0x0023(r29)
00085c78: bba20020 swr r2,0x0020(r29)			Stores facing mod for south (0x20), west (0x22)
00085c7c: aba30027 swl r3,0x0027(r29)
00085c80: bba30024 swr r3,0x0024(r29)			Stores facing mod for north (0x24), east (0x26)
00085c84: 3c058007 lui r5,0x8007
00085c88: 24a580ec addiu r5,r5,0x80ec
00085c8c: 88a20003 lwl r2,0x0003(r5)
00085c90: 98a20000 lwr r2,0x0000(r5)
00085c94: 88a30007 lwl r3,0x0007(r5)
00085c98: 98a30004 lwr r3,0x0004(r5)
00085c9c: 88a4000b lwl r4,0x000b(r5)
00085ca0: 98a40008 lwr r4,0x0008(r5)
00085ca4: aba2002b swl r2,0x002b(r29)
00085ca8: bba20028 swr r2,0x0028(r29)
00085cac: aba3002f swl r3,0x002f(r29)
00085cb0: bba3002c swr r3,0x002c(r29)
00085cb4: aba40033 swl r4,0x0033(r29)
00085cb8: bba40030 swr r4,0x0030(r29)
00085cbc: 88a2000f lwl r2,0x000f(r5)
00085cc0: 98a2000c lwr r2,0x000c(r5)
00085cc4: 88a30013 lwl r3,0x0013(r5)
00085cc8: 98a30010 lwr r3,0x0010(r5)
00085ccc: 88a40017 lwl r4,0x0017(r5)
00085cd0: 98a40014 lwr r4,0x0014(r5)
00085cd4: aba20037 swl r2,0x0037(r29)
00085cd8: bba20034 swr r2,0x0034(r29)
00085cdc: aba3003b swl r3,0x003b(r29)
00085ce0: bba30038 swr r3,0x0038(r29)
00085ce4: aba4003f swl r4,0x003f(r29)
00085ce8: bba4003c swr r4,0x003c(r29)
00085cec: 88a2001b lwl r2,0x001b(r5)
00085cf0: 98a20018 lwr r2,0x0018(r5)
00085cf4: 88a3001f lwl r3,0x001f(r5)
00085cf8: 98a3001c lwr r3,0x001c(r5)
00085cfc: aba20043 swl r2,0x0043(r29)
00085d00: bba20040 swr r2,0x0040(r29)
00085d04: aba30047 swl r3,0x0047(r29)
00085d08: bba30044 swr r3,0x0044(r29)
00085d0c: 3c058007 lui r5,0x8007
00085d10: 24a5810c addiu r5,r5,0x810c
00085d14: 88a20003 lwl r2,0x0003(r5)			A lot of these double ups are the compiler being a fucking idiot.
00085d18: 98a20000 lwr r2,0x0000(r5)
00085d1c: 88a30007 lwl r3,0x0007(r5)
00085d20: 98a30004 lwr r3,0x0004(r5)
00085d24: 88a4000b lwl r4,0x000b(r5)
00085d28: 98a40008 lwr r4,0x0008(r5)
00085d2c: aba2004b swl r2,0x004b(r29)
00085d30: bba20048 swr r2,0x0048(r29)			stores walking animation for south (0x48)
00085d34: aba3004f swl r3,0x004f(r29)
00085d38: bba3004c swr r3,0x004c(r29)
00085d3c: aba40053 swl r4,0x0053(r29)
00085d40: bba40050 swr r4,0x0050(r29)			stores walking animation for west (0x50)
00085d44: 88a2000f lwl r2,0x000f(r5)
00085d48: 98a2000c lwr r2,0x000c(r5)
00085d4c: 88a30013 lwl r3,0x0013(r5)
00085d50: 98a30010 lwr r3,0x0010(r5)
00085d54: 88a40017 lwl r4,0x0017(r5)
00085d58: 98a40014 lwr r4,0x0014(r5)
00085d5c: aba20057 swl r2,0x0057(r29)
00085d60: bba20054 swr r2,0x0054(r29)
00085d64: aba3005b swl r3,0x005b(r29)
00085d68: bba30058 swr r3,0x0058(r29)			stores walking animation for north (0x58)
00085d6c: aba4005f swl r4,0x005f(r29)
00085d70: bba4005c swr r4,0x005c(r29)
00085d74: 88a2001b lwl r2,0x001b(r5)
00085d78: 98a20018 lwr r2,0x0018(r5)
00085d7c: 88a3001f lwl r3,0x001f(r5)
00085d80: 98a3001c lwr r3,0x001c(r5)
00085d84: aba20063 swl r2,0x0063(r29)
00085d88: bba20060 swr r2,0x0060(r29)			stores walking animation for east (0x60)
00085d8c: aba30067 swl r3,0x0067(r29)
00085d90: bba30064 swr r3,0x0064(r29)

Initialise

00085d94: 9642000a lhu r2,0x000a(r18)			load 'is using ability?' I feel like this is actually a sprite refresh thing.
00085d98: 00000000 nop
00085d9c: 104001f6 beq r2,r0,0x00086578		branch if not updating sprites.
00085da0: 00000000 nop
00085da4: 8e4202e8 lw r2,0x02e8(r18)			yeah this is probably always 0.
00085da8: 00000000 nop
00085dac: 10400003 beq r2,r0,0x00085dbc		Branch if pointer empty
00085db0: 00000000 nop
00085db4: 0c01fd00 jal 0x0007f400			smear a bunch of unit data disgustingly, and compute xy, xz, and yz vectors.
00085db8: 02402021 addu r4,r18,r0			r4 = Misc unit data
00085dbc: 3c02800a lui r2,0x800a
00085dc0: 84427786 lh r2,0x7786(r2)			Load Map rotation
00085dc4: 86430070 lh r3,0x0070(r18)			load Current unit facing
00085dc8: 00000000 nop
00085dcc: 00431021 addu r2,r2,r3			Add Map rotation & current facing
00085dd0: 30420fff andi r2,r2,0x0fff			make sure there's only map rotation & current facing
00085dd4: 04410002 bgez r2,0x00085de0			Branch if there wasn't some blaring error in the code
00085dd8: 00401821 addu r3,r2,r0			r3 = r2
00085ddc: 244303ff addiu r3,r2,0x03ff
00085de0: 00033283 sra r6,r3,0x0a			r6 = current facing (0, 1, 2, or 3)
00085de4: 04410002 bgez r2,0x00085df0
00085de8: 00c09821 addu r19,r6,r0			r19 = current facing
00085dec: 244200ff addiu r2,r2,0x00ff			add 1 to current facing (redundant?)
00085df0: 00022a03 sra r5,r2,0x08			r5 = current facing (0, 4, 8, or c)
00085df4: 9644000c lhu r4,0x000c(r18)			Load change of animation
00085df8: 00000000 nop
00085dfc: 10800142 beq r4,r0,0x00086308		branch if change of animation = facing direction
00085e00: 00a0a821 addu r21,r5,r0			r21 = current facing

Change Animation

00085e04: 2483ffff addiu r3,r4,0xffff			r3 = CA - 1
00085e08: 34020002 ori r2,r0,0x0002			r2 = 2
00085e0c: 1462002d bne r3,r2,0x00085ec4		branch if CA - 1 != 2 (not facing with the back to the camera?)
00085e10: 34100002 ori r16,r0,0x0002			r16 = 2

Change of animation = 3 (Default Walking animation)

00085e14: 26420060 addiu r2,r18,0x0060			r2 = misc data pointer + 0x60
00085e18: a4400208 sh r0,0x0208(r2)			clear Numerical display graphic trigger, EFF graphic trigger, WEP graphic trigger
00085e1c: 2610ffff addiu r16,r16,0xffff		
00085e20: 0601fffd bgez r16,0x00085e18			Loop twice
00085e24: 2442ffd0 addiu r2,r2,0xffd0			r2 - 0x30
00085e28: 02402021 addu r4,r18,r0			r4 = misc data pointer
00085e2c: 00151840 sll r3,r21,0x01			current facing * 2 (4s)
00085e30: 27a20010 addiu r2,r29,0x0010
00085e34: 00621821 addu r3,r3,r2			stack + current facing * 2
00085e38: 94620038 lhu r2,0x0038(r3)			load walking animation from stack
00085e3c: 264501d8 addiu r5,r18,0x01d8			misc data pointer + 0x1d8
00085e40: a64201dc sh r2,0x01dc(r18)			store current animation into unit data
00085e44: 96420012 lhu r2,0x0012(r18)			Load sprite display bytes (transparent, flip, etc.) 
00085e48: 94630018 lhu r3,0x0018(r3)			(for walking frames) horizontal/vertical bitflags for current angle?
00085e4c: 34060001 ori r6,r0,0x0001			r6 = 1
00085e50: a653006c sh r19,0x006c(r18)			store current facing (0, 1, 2, 3) to misc unit data 0x6c
00085e54: a655006e sh r21,0x006e(r18)			store current facing (0, 4, 8, c) to misc unit data 0x6e (this just seems wasteful)
00085e58: a64001de sh r0,0x01de(r18)			clear animation command pointer
00085e5c: a64001e2 sh r0,0x01e2(r18)			clear wait time
00085e60: a64001e4 sh r0,0x01e4(r18)			clear loop counter
00085e64: a6400054 sh r0,0x0054(r18)			clear Y
00085e68: a6400052 sh r0,0x0052(r18)			clear height
00085e6c: a6400050 sh r0,0x0050(r18)			clear x
00085e70: a640005c sh r0,0x005c(r18)			clear?
00085e74: a640005a sh r0,0x005a(r18)
00085e78: a6400058 sh r0,0x0058(r18)
00085e7c: a64001ea sh r0,0x01ea(r18)			clear slow-down amount
00085e80: a64001ec sh r0,0x01ec(r18)			clear anim frame offset
00085e84: a64001ee sh r0,0x01ee(r18)			clear Wait command wait frames
00085e88: a64001f0 sh r0,0x01f0(r18)			clear rotation bytes
00085e8c: 3042fff9 andi r2,r2,0xfff9			disinclude flip horizontal/vertical
00085e90: 00431025 or r2,r2,r3
00085e94: 0c021206 jal 0x00084818			Load Unit graphics from sprite sheet
00085e98: a6420012 sh r2,0x0012(r18)			store back
00085e9c: 02402021 addu r4,r18,r0			r4 = misc unit data pointer
00085ea0: 0c0216e8 jal 0x00085ba0			00085ba0 - 00085c08 seems to check something based on miscellaneous unit ID?
00085ea4: a640000c sh r0,0x000c(r18)			clear change of animation
00085ea8: 08021932 j 0x000864c8			jump ahead
00085eac: 00008021 addu r16,r0,r0			r16 = 0

VRAM SPR# calculation?

00085eb0: 02402021 addu r4,r18,r0			r4 = unit misc data pointer
00085eb4: 0c021686 jal 0x00085a18			00085a18 - 00085b9c enables certain flags in ~0x800a77c0 and does VRAM math
00085eb8: 02803021 addu r6,r20,r0			r6 = VRAM free active slot 4 (0) or 5 (1)
00085ebc: 08021817 j 0x0008605c
00085ec0: 34020002 ori r2,r0,0x0002

Change of Animation < 0xC

00085ec4: 2c82000c sltiu r2,r4,0x000c			r2 = true if CA = 0xc
00085ec8: 10400013 beq r2,r0,0x00085f18		Branch if > 0xC
00085ecc: 00131840 sll r3,r19,0x01			r3 = current facing * 2
00085ed0: 3c038004 lui r3,0x8004
00085ed4: 8c635994 lw r3,0x5994(r3)			current event timer?
00085ed8: 92420004 lbu r2,0x0004(r18)			Load unit misc ID
00085edc: 00602021 addu r4,r3,r0
00085ee0: 04610002 bgez r3,0x00085eec
00085ee4: 30450003 andi r5,r2,0x0003			unit misc ID && 0x3
00085ee8: 24640003 addiu r4,r3,0x0003			rounding (for a misc. unit ID?)
00085eec: 00041083 sra r2,r4,0x02
00085ef0: 00021080 sll r2,r2,0x02			
00085ef4: 00621023 subu r2,r3,r2			get the first 2 bits of data from event timer?
00085ef8: 10a20006 beq r5,r2,0x00085f14		branch if first two bits of event timer? matches first 2 bits of unit misc ID (skips dragoon jump check?)
00085efc: 3c032000 lui r3,0x2000
00085f00: 8e420080 lw r2,0x0080(r18)			load unit's coordinates + motion flags
00085f04: 00000000 nop
00085f08: 00431024 and r2,r2,r3			check for motion flag 0x20 (currently dragoon jumping upward)
00085f0c: 1040016e beq r2,r0,0x000864c8		branch if not dragon jumping
00085f10: 00008021 addu r16,r0,r0

unit ID matches ? or unit dragoon jumping

00085f14: 00131840 sll r3,r19,0x01			r3 = current facing * 2 (1s)
00085f18: 03a31821 addu r3,r29,r3			r3 = stack pointer + current facing * 2
00085f1c: 9642000c lhu r2,0x000c(r18)			load CA
00085f20: 84630020 lh r3,0x0020(r3)			Load facing mod (toward (0) or away (1))
00085f24: 964401dc lhu r4,0x01dc(r18)			Load current animation
00085f28: 2442ffff addiu r2,r2,0xffff			CA - 1
00085f2c: 00021040 sll r2,r2,0x01			2*(CA - 1)
00085f30: 00431021 addu r2,r2,r3			animation + Facing mod(?)
00085f34: 1444000a bne r2,r4,0x00085f60		branch if animation does not equal new animation
00085f38: 34110001 ori r17,r0,0x0001			Set Initialise unit's battle graphic data

Renew Animation

00085f3c: 964201e2 lhu r2,0x01e2(r18)			load wait time
00085f40: 00000000 nop
00085f44: 10400006 beq r2,r0,0x00085f60		branch if not waiting (skip drag jump check)
00085f48: 3c032000 lui r3,0x2000
00085f4c: 8e420080 lw r2,0x0080(r18)			if currently waiting, load x mode + movement flags
00085f50: 00000000 nop
00085f54: 00431024 and r2,r2,r3			check for motion flag 0x20 (in the middle of dragoon jumping up?)
00085f58: 104000e9 beq r2,r0,0x00086300		branch if not in the middle of that
00085f5c: 00000000 nop

Renew Animation; animation to proceed as normal

00085f60: 9642000c lhu r2,0x000c(r18)			Load CA
00085f64: 00000000 nop
00085f68: 2444ffff addiu r4,r2,0xffff			r4 = CA - 1
00085f6c: 288201f4 slti r2,r4,0x01f4			true if < 0x1f4
00085f70: 1040007c beq r2,r0,0x00086164		branch if animation is from EVTCHR
00085f74: 00131040 sll r2,r19,0x01			r2 = current facing * 2

New animation != EVTCHR animation

00085f78: 00042040 sll r4,r4,0x01			2CA - 2
00085f7c: 03a21021 addu r2,r29,r2			facing mod?
00085f80: 8e4501f8 lw r5,0x01f8(r18)			Load SEQ data pointer
00085f84: 84430020 lh r3,0x0020(r2)			load facing mod?
00085f88: 8ca20004 lw r2,0x0004(r5)			SP2 start animation
00085f8c: 00832021 addu r4,r4,r3			New animation
00085f90: 0082102b sltu r2,r4,r2			set true if new animation is less than that?
00085f94: 10400073 beq r2,r0,0x00086164		branch if sp2 (new sheet loaded via game-loop... not here.)
00085f98: 00000000 nop
00085f9c: 8ca20000 lw r2,0x0000(r5)			Attack sheet start animation
00085fa0: 00000000 nop
00085fa4: 0082102b sltu r2,r4,r2			set if loading animation from normal sheet
00085fa8: 1440006c bne r2,r0,0x0008615c		branch if loading animation from normal sheet
00085fac: 00008021 addu r16,r0,r0			r16 = 0

New animation is from second half of spritesheet (attacking spritesheet)

00085fb0: 92440004 lbu r4,0x0004(r18)			load misc unit ID
00085fb4: 00001821 addu r3,r0,r0			r3 = 0
00085fb8: 3c01800a lui r1,0x800a			
00085fbc: 00230821 addu r1,r1,r3			
00085fc0: 8c2277c4 lw r2,0x77c4(r1)			loads 'VRAM' graphic-decompression table slot's unit's misc ID
00085fc4: 00000000 nop					
00085fc8: 3042001f andi r2,r2,0x001f			
00085fcc: 10440006 beq r2,r4,0x00085fe8		branch if current unit already occupies VRAM slot
00085fd0: 34020002 ori r2,r0,0x0002			r2 = 2
00085fd4: 26100001 addiu r16,r16,0x0001		count r16 by 1
00085fd8: 2a020002 slti r2,r16,0x0002			only do this twice
00085fdc: 1440fff6 bne r2,r0,0x00085fb8		branch if this hasn't been repeated twice yet, if a unit ID hasn't been found?
00085fe0: 24637564 addiu r3,r3,0x7564			r3 = # repeats * 0x7564
00085fe4: 34020002 ori r2,r0,0x0002			r2 = 2
00085fe8: 1602005e bne r16,r2,0x00086164		animate unit if they already occupy VRAM slot
00085fec: 00008021 addu r16,r0,r0			r16 = 0

Unit does not occupy VRAM slot (prepare unit to occupy free slot)

00085ff0: 340400ff ori r4,r0,0x00ff			r4 = 0xff
00085ff4: 00001821 addu r3,r0,r0			r3 = 0
00085ff8: 3c01800a lui r1,0x800a
00085ffc: 00230821 addu r1,r1,r3			
00086000: 8c2277c4 lw r2,0x77c4(r1)			loads VRAM slot 4 misc. unit ID
00086004: 00000000 nop
00086008: 1444000f bne r2,r4,0x00086048		branch VRAM slot 4 is currently occupied
0008600c: 00000000 nop
00086010: 0000a021 addu r20,r0,r0			r20 = inner counter
00086014: 00001821 addu r3,r0,r0			r3 = 0
00086018: 3c01800a lui r1,0x800a
0008601c: 00230821 addu r1,r1,r3
00086020: 8c2277c8 lw r2,0x77c8(r1)			load VRAM slot 4 queued(?) misc ID?
00086024: 00000000 nop
00086028: 1040ffa1 beq r2,r0,0x00085eb0		branch if vram slot 4 is empty
0008602c: 02002821 addu r5,r16,r0			r5 = # of 0xff in loop
00086030: 26940001 addiu r20,r20,0x0001		r20 + 1 for every VRAM slot that is currently queued
00086034: 2a820002 slti r2,r20,0x0002			set true if inner counter is not 2
00086038: 1440fff7 bne r2,r0,0x00086018		loop and check VRAM slot 5
0008603c: 24637564 addiu r3,r3,0x7564			r3 = # of repeats * 0x7564 (size of VRAM data slots?)
00086040: 08021817 j 0x0008605c
00086044: 34020002 ori r2,r0,0x0002			r2 = 2
00086048: 26100001 addiu r16,r16,0x0001		r16 = r16 + 1
0008604c: 2a020002 slti r2,r16,0x0002			true if hasn't been repeated twice
00086050: 1440ffe9 bne r2,r0,0x00085ff8		loop and check VRAM slot 5
00086054: 24637564 addiu r3,r3,0x7564			r3 = # repeats * 0x7564 (size of VRAM data slots?)
00086058: 34020002 ori r2,r0,0x0002			r2 = 2
0008605c: 16020002 bne r16,r2,0x00086068		branch if hasn't been repeated twice before running into unused VRAM slot
00086060: 00000000 nop
00086064: 00008821 addu r17,r0,r0			r17 = 0 if both Misc. ID's are not 0xff
00086068: 16820002 bne r20,r2,0x00086074		Branch if hasn't been repeated twice before running into queued VRAM slot
0008606c: 00000000 nop
00086070: 00008821 addu r17,r0,r0			r17 = 0 if both 75c8 are not 0x00
00086074: 1620003d bne r17,r0,0x0008616c		branch if r17 != 0 (cannot animate caster *or* target, as either VRAM slots 4 or 5 are occupied)
00086078: 34100002 ori r16,r0,0x0002			r16 = 2
0008607c: 3c04800b lui r4,0x800b
00086080: 2484ed28 addiu r4,r4,0xed28			VRAM slot 5
00086084: 8c820000 lw r2,0x0000(r4)			load VRAM slot 5's misc. ID
00086088: 00000000 nop
0008608c: 2442ff02 addiu r2,r2,0xff02			subtract 0xfe from VRAM slot 5's misc ID
00086090: 2c420002 sltiu r2,r2,0x0002			set true if either 0xfe or 0xff (no target)
00086094: 14400033 bne r2,r0,0x00086164		branch if no target (animate attacker)
00086098: 00000000 nop
0008609c: 94840000 lhu r4,0x0000(r4)			Load 0x800bed28
000860a0: 0c01e9b9 jal 0x0007a6e4			Find current miscellaneous unit data pointer of VRAM slot 5
000860a4: 3084001f andi r4,r4,0x001f			r4 = unit Misc ID
000860a8: 00402021 addu r4,r2,r0			r4 = unit misc data pointer
000860ac: 1080002d beq r4,r0,0x00086164		branch if no misc data pointer (animate attacker)
000860b0: 00000000 nop

Animate target with default pre-hit animation:

000860b4: 948201dc lhu r2,0x01dc(r4)			load current animation
000860b8: 00000000 nop
000860bc: 30420001 andi r2,r2,0x0001
000860c0: 1040000c beq r2,r0,0x000860f4		branch if current animation is facing toward the camera
000860c4: 00000000 nop
000860c8: 90820006 lbu r2,0x0006(r4)			load spritesheet ID of target
000860cc: 00000000 nop
000860d0: 00021080 sll r2,r2,0x02
000860d4: 3c018009 lui r1,0x8009
000860d8: 00220821 addu r1,r1,r2
000860dc: 90224748 lbu r2,0x4748(r1)			load spritesheet SHP ID
000860e0: 3c018009 lui r1,0x8009
000860e4: 00220821 addu r1,r1,r2
000860e8: 902249d0 lbu r2,0x49d0(r1)			load spritesheet's default pre-hit pose
000860ec: 08021848 j 0x00086120
000860f0: a48201e0 sh r2,0x01e0(r4)			set unit anim to standing still until otherwise altered
000860f4: 90820006 lbu r2,0x0006(r4)			Load spritesheet ID
000860f8: 00000000 nop
000860fc: 00021080 sll r2,r2,0x02
00086100: 3c018009 lui r1,0x8009
00086104: 00220821 addu r1,r1,r2
00086108: 90224748 lbu r2,0x4748(r1)			spritesheet SHP ID
0008610c: 3c018009 lui r1,0x8009
00086110: 00220821 addu r1,r1,r2
00086114: 902249c4 lbu r2,0x49c4(r1)			spritesheet SHP default pre-hit pose
00086118: 00000000 nop
0008611c: a48201e0 sh r2,0x01e0(r4)
00086120: 248501d8 addiu r5,r4,0x01d8			Unit sprite data
00086124: 948601e0 lhu r6,0x01e0(r4)			current frame
00086128: 948701dc lhu r7,0x01dc(r4)			current animation
0008612c: 34110001 ori r17,r0,0x0001			Set Initialise unit's battle related graphcis data
00086130: a4800054 sh r0,0x0054(r4)			clear X, height, and Y?
00086134: a4800052 sh r0,0x0052(r4)
00086138: 0c021085 jal 0x00084214			Load Unit graphics from sprite sheet - animate target
0008613c: a4800050 sh r0,0x0050(r4)
00086140: 02402021 addu r4,r18,r0
00086144: 34050001 ori r5,r0,0x0001			2nd VRAM slot
00086148: 34060001 ori r6,r0,0x0001			2nd VRAM slot
0008614c: 0c021686 jal 0x00085a18
00086150: a64001e2 sh r0,0x01e2(r18)			Clear wait time
00086154: 08021859 j 0x00086164			animate attacker
00086158: 00000000 nop

normal animation sheet

0008615c: 0c0216e8 jal 0x00085ba0			if normal animation: Mark Unit's VRAM Slot as Unoccupied
00086160: 02402021 addu r4,r18,r0			r4 = unit misc. data pointer

Initialise Attacker's battle graphic data

00086164: 12200045 beq r17,r0,0x0008627c		branch if r17 = 0 
00086168: 34100002 ori r16,r0,0x0002			r16 = 0x2
0008616c: 26420060 addiu r2,r18,0x0060			r2 = misc unit data pointer + 0x60
00086170: a4400208 sh r0,0x0208(r2)			save 0 to numerical display data (1st), then to the EFF graphic trigger (2nd), then WEP graphic trigger (3rd)
00086174: 2610ffff addiu r16,r16,0xffff		r16 - 1
00086178: 0601fffd bgez r16,0x00086170			loop while r16 >= 0
0008617c: 2442ffd0 addiu r2,r2,0xffd0			r2 = r2 - 0x30
00086180: 9642000c lhu r2,0x000c(r18)			load change of animation
00086184: 00000000 nop
00086188: 2444ffff addiu r4,r2,0xffff			r4 = animation - 1
0008618c: 288201f4 slti r2,r4,0x01f4			check animation is from EVTCHR?
00086190: 14400004 bne r2,r0,0x000861a4		branch if not EVTCHR animation
00086194: 00000000 nop
00086198: 9642000c lhu r2,0x000c(r18)			load change of animation (CA)
0008619c: 0802186e j 0x000861b8			jump ahead
000861a0: 2442ffff addiu r2,r2,0xffff			animation - 1
000861a4: 00131040 sll r2,r19,0x01			r2 = facing direction
000861a8: 03a21021 addu r2,r29,r2			r2 = stack pointer
000861ac: 94430020 lhu r3,0x0020(r2)
000861b0: 00041040 sll r2,r4,0x01			r2 = 2 * CA - 2
000861b4: 00431021 addu r2,r2,r3			r2 = 2 * CA - 2 + facing camera/not
000861b8: a64201dc sh r2,0x01dc(r18)			Save animation
000861bc: 02402021 addu r4,r18,r0			r4 = misc. unit data pointer
000861c0: 264501d8 addiu r5,r18,0x01d8			unit animation pointer
000861c4: 00131040 sll r2,r19,0x01			facing direction * 2 (1s)
000861c8: 03a21021 addu r2,r29,r2
000861cc: 96430012 lhu r3,0x0012(r18)			sprite display bytes
000861d0: 94420018 lhu r2,0x0018(r2)			
000861d4: 34060001 ori r6,r0,0x0001			r6 = 1
000861d8: a653006c sh r19,0x006c(r18)			store facing (0, 1, 2, 3)
000861dc: a655006e sh r21,0x006e(r18)			store facing (0, 4, 8, c)
000861e0: a64001de sh r0,0x01de(r18)
000861e4: a64001e2 sh r0,0x01e2(r18)
000861e8: a64001e4 sh r0,0x01e4(r18)
000861ec: a6400054 sh r0,0x0054(r18)
000861f0: a6400052 sh r0,0x0052(r18)
000861f4: a6400050 sh r0,0x0050(r18)
000861f8: a640005c sh r0,0x005c(r18)
000861fc: a640005a sh r0,0x005a(r18)
00086200: a6400058 sh r0,0x0058(r18)
00086204: a64001ea sh r0,0x01ea(r18)
00086208: a64001ec sh r0,0x01ec(r18)
0008620c: a64001ee sh r0,0x01ee(r18)
00086210: a64001f0 sh r0,0x01f0(r18)			reset a bunch of data.
00086214: 3063fff9 andi r3,r3,0xfff9			nullify flip horizontal/vertical
00086218: 00621825 or r3,r3,r2				combine r2 flags and display bytes?
0008621c: 0c021206 jal 0x00084818			Load Unit graphics from sprite sheet
00086220: a6430012 sh r3,0x0012(r18)			store again
00086224: 3c03dfff lui r3,0xdfff
00086228: 8e420080 lw r2,0x0080(r18)			X/height/y coord + motion flags
0008622c: 3463ffff ori r3,r3,0xffff			0xdfffffff
00086230: 00431024 and r2,r2,r3			un-check dragoon jump motion bitflag
00086234: 92430130 lbu r3,0x0130(r18)			mount/rider value
00086238: a640000c sh r0,0x000c(r18)			clear change of animation
0008623c: ae420080 sw r2,0x0080(r18)			store new motion flags
00086240: 34020002 ori r2,r0,0x0002			2
00086244: 146200a0 bne r3,r2,0x000864c8		branch if not mount for 0x131
00086248: 00008021 addu r16,r0,r0
0008624c: 92440131 lbu r4,0x0131(r18)			load rider ID
00086250: 0c01e9b9 jal 0x0007a6e4			Find unit matching r4 ID
00086254: 00000000 nop
00086258: 00402021 addu r4,r2,r0
0008625c: 1080009a beq r4,r0,0x000864c8		branch if no rider pointer
00086260: 248501d8 addiu r5,r4,0x01d8
00086264: 34060001 ori r6,r0,0x0001
00086268: a48001de sh r0,0x01de(r4)			reset animation command pointer
0008626c: 0c021206 jal 0x00084818			Load Unit graphics from sprite sheet - Animate rider
00086270: a48001e2 sh r0,0x01e2(r4)			reset wait time (frames)
00086274: 08021932 j 0x000864c8
00086278: 00008021 addu r16,r0,r0

Not initialising unit graphic data:

0008627c: 964201e2 lhu r2,0x01e2(r18)			Wait time
00086280: 00000000 nop
00086284: 1040008f beq r2,r0,0x000864c4		branch if no wait time
00086288: 00000000 nop
0008628c: 3c028004 lui r2,0x8004
00086290: 8c425980 lw r2,0x5980(r2)			animation speed
00086294: 00000000 nop
00086298: 1840008a blez r2,0x000864c4			branch if not animation speed = 0
0008629c: 00008021 addu r16,r0,r0
000862a0: 3411ffff ori r17,r0,0xffff			r17 = -1 if animation speed != 0
000862a4: 964201e2 lhu r2,0x01e2(r18)			load wait time
000862a8: 00000000 nop
000862ac: 1040000c beq r2,r0,0x000862e0		branch if 0
000862b0: 26100001 addiu r16,r16,0x0001		increment r16?
000862b4: 964201e2 lhu r2,0x01e2(r18)
000862b8: 00000000 nop
000862bc: 00511021 addu r2,r2,r17			wait time - 1
000862c0: a64201e2 sh r2,0x01e2(r18)			store
000862c4: 964201e2 lhu r2,0x01e2(r18)
000862c8: 00000000 nop
000862cc: 14400004 bne r2,r0,0x000862e0		branch if not 0
000862d0: 02402021 addu r4,r18,r0
000862d4: 264501d8 addiu r5,r18,0x01d8
000862d8: 0c021206 jal 0x00084818			Load Unit graphics from sprite sheet
000862dc: 34060001 ori r6,r0,0x0001
000862e0: 3c028004 lui r2,0x8004
000862e4: 8c425980 lw r2,0x5980(r2)
000862e8: 00000000 nop
000862ec: 0202102a slt r2,r16,r2			
000862f0: 1440ffec bne r2,r0,0x000862a4		loop if animation speed > 1
000862f4: 00000000 nop
000862f8: 08021932 j 0x000864c8
000862fc: 00008021 addu r16,r0,r0			r16 = 0

Renewing animation & wait time not complete & unit currently in the middle of dragoon jumping

00086300: 08021931 j 0x000864c4			Finish Unit's animation (don't interrupt jump while it's in progress.)
00086304: a640000c sh r0,0x000c(r18)			Set change of animation to 0

Set Facing Direction:

00086308: 8e420080 lw r2,0x0080(r18)			coords + movement flags
0008630c: 3c030100 lui r3,0x0100			r3 = 0x01000000
00086310: 00431024 and r2,r2,r3			Check for float movement flag
00086314: 1440004a bne r2,r0,0x00086440		Branch if floating
00086318: 00a01821 addu r3,r5,r0			r3 = r5
0008631c: 8642006e lh r2,0x006e(r18)			load facing direction (0, 4, 8, c)
00086320: 00000000 nop
00086324: 10620023 beq r3,r2,0x000863b4		branch if not changing facing direction
00086328: 00000000 nop

Not Floating, Not Changing facing:

0008632c: 964501dc lhu r5,0x01dc(r18)			Load current animation
00086330: 00000000 nop
00086334: 2ca20006 sltiu r2,r5,0x0006			r2 = 1 if animation is already facing direction
00086338: 1040000a beq r2,r0,0x00086364		branch if animation not facing direction
0008633c: 00031840 sll r3,r3,0x01			r3 = r3 * 2
00086340: 27a20010 addiu r2,r29,0x0010			r2 = stack pointer + 0x10
00086344: 00621821 addu r3,r3,r2			load animation pointer
00086348: 94620038 lhu r2,0x0038(r3)			Load animation for current facing from stack
0008634c: 00000000 nop
00086350: a64201dc sh r2,0x01dc(r18)			Save current animation
00086354: 96420012 lhu r2,0x0012(r18)			Load 0x12 + 0x13 flags from Misc unit data
00086358: 94630018 lhu r3,0x0018(r3)			Load same flags from stack?
0008635c: 080218e3 j 0x0008638c			@Jump ahead
00086360: 3042fff9 andi r2,r2,0xfff9			remove horizontal/vertical flip flags

Animation currently not facing direction:

00086364: 00061840 sll r3,r6,0x01			r3 = current facing * 2
00086368: 27a20010 addiu r2,r29,0x0010			r2 = stack pointer + 0x10
0008636c: 00621821 addu r3,r3,r2			stack pointer + facing direction
00086370: 94640010 lhu r4,0x0010(r3)			facing mod for current direction
00086374: 30a2fffe andi r2,r5,0xfffe			animation - 2
00086378: 00441021 addu r2,r2,r4			animation for facing direction
0008637c: a64201dc sh r2,0x01dc(r18)			save current animation
00086380: 96420012 lhu r2,0x0012(r18)			load sprite display flags
00086384: 94630008 lhu r3,0x0008(r3)			load flip flags for facing direction
00086388: 3042fff9 andi r2,r2,0xfff9			reset sprite's horizontal/vertical flip
0008638c: 00431025 or r2,r2,r3				set sprite's horizontal/vertical flip flags for currently facing direction
00086390: a6420012 sh r2,0x0012(r18)			save flip flags
00086394: 02402021 addu r4,r18,r0			r4 = Unit Misc data
00086398: 264501d8 addiu r5,r18,0x01d8			r5 = Unit Misc data + 0x01d8
0008639c: 00003021 addu r6,r0,r0			r6 = 0
000863a0: a653006c sh r19,0x006c(r18)			save Current facing (vectory thing? 0, 1, 2, or 3)
000863a4: 0c021206 jal 0x00084818			--> Load Unit graphics from sprite sheet - animate unit
000863a8: a655006e sh r21,0x006e(r18)			save current facing (0, 4, 8, c)
000863ac: 08021932 j 0x000864c8			Finish animating Unit
000863b0: 00008021 addu r16,r0,r0			r16 = 0

Changing unit's facing direction

000863b4: 964201e2 lhu r2,0x01e2(r18)			Load wait time
000863b8: 00000000 nop
000863bc: 10400041 beq r2,r0,0x000864c4		$Branch if no wait time
000863c0: 00000000 nop						|
000863c4: 3c028004 lui r2,0x8004				|
000863c8: 8c425980 lw r2,0x5980(r2)				|animation speed
000863cc: 00000000 nop						|
000863d0: 1840003c blez r2,0x000864c4				$Branch if animation speed = 0
000863d4: 00008021 addu r16,r0,r0					|r16 = 0
000863d8: 3411ffff ori r17,r0,0xffff					|R17 = -1
000863dc: 964201e2 lhu r2,0x01e2(r18)					Δwait time (in frames)
000863e0: 00000000 nop							|
000863e4: 1040000c beq r2,r0,0x00086418				#branch if r2 = 0
000863e8: 26100001 addiu r16,r16,0x0001					|r16 + 1
000863ec: 964201e2 lhu r2,0x01e2(r18)						|wait time
000863f0: 00000000 nop								|
000863f4: 00511021 addu r2,r2,r17						|wait time - 1
000863f8: a64201e2 sh r2,0x01e2(r18)						|store new wait time
000863fc: 964201e2 lhu r2,0x01e2(r18)						|loads it again
00086400: 00000000 nop								|
00086404: 14400004 bne r2,r0,0x00086418					|#Branch if wait time isn't 0
00086408: 02402021 addu r4,r18,r0							|r4 = Unit Misc data
0008640c: 264501d8 addiu r5,r18,0x01d8							|r5 = Unit Misc data + 0x01d8
00086410: 0c021206 jal 0x00084818							|--> Load Unit graphics from sprite sheet animate unit when wait time = 0
00086414: 34060001 ori r6,r0,0x0001							|r6 = 0x1
00086418: 0c022c8d jal 0x0008b234					#--> 0008b234 - 0008b288 - animate unit's distortion effects
0008641c: 02402021 addu r4,r18,r0					|r4 = Misc unit data pointer
00086420: 3c028004 lui r2,0x8004					|
00086424: 8c425980 lw r2,0x5980(r2)					|animation speed
00086428: 00000000 nop							|
0008642c: 0202102a slt r2,r16,r2					|Set if r16 < r2
00086430: 1440ffea bne r2,r0,0x000863dc				Δloop animation speed times
00086434: 00000000 nop							|
00086438: 08021932 j 0x000864c8					@Finish animating unit
0008643c: 00008021 addu r16,r0,r0					|r16 = 0

Unit is Floating:

00086440: 964201e2 lhu r2,0x01e2(r18)					|Loads wait time
00086444: 00000000 nop							|
00086448: 1040001e beq r2,r0,0x000864c4				$Branch if 0 wait time
0008644c: 00000000 nop								|
00086450: 3c028004 lui r2,0x8004						|
00086454: 8c425980 lw r2,0x5980(r2)						|animation speed
00086458: 00000000 nop								|
0008645c: 18400019 blez r2,0x000864c4						$Branch if animation speed = 0
00086460: 00008021 addu r16,r0,r0							|r16 = 0
00086464: 3411ffff ori r17,r0,0xffff							|r17 = -1
00086468: 964201e2 lhu r2,0x01e2(r18)							*Load wait time
0008646c: 00000000 nop									|
00086470: 1040000c beq r2,r0,0x000864a4						#branch if wait time = 0
00086474: 26100001 addiu r16,r16,0x0001							|r16 + 1
00086478: 964201e2 lhu r2,0x01e2(r18)								|wait time
0008647c: 00000000 nop										|
00086480: 00511021 addu r2,r2,r17								|wait time - 1
00086484: a64201e2 sh r2,0x01e2(r18)								|save
00086488: 964201e2 lhu r2,0x01e2(r18)								|Load again
0008648c: 00000000 nop										|
00086490: 14400004 bne r2,r0,0x000864a4							#Branch r2 != 0
00086494: 02402021 addu r4,r18,r0									|r4 = Misc unit data pointer
00086498: 264501d8 addiu r5,r18,0x01d8									|r5 = Misc unit data pointer + 0x01d8 
0008649c: 0c021206 jal 0x00084818									|--> Load Unit graphics from sprite sheet animate party units? Load party unit graphics?
000864a0: 34060001 ori r6,r0,0x0001									|r6 = 1
000864a4: 0c022c8d jal 0x0008b234							#--> 0008b234 - 0008b288 - animate unit's distortion effects
000864a8: 02402021 addu r4,r18,r0							|r4 = Misc unit data pointer
000864ac: 3c028004 lui r2,0x8004							|
000864b0: 8c425980 lw r2,0x5980(r2)							|animation speed
000864b4: 00000000 nop									|
000864b8: 0202102a slt r2,r16,r2							|set r2 = 1 if r16 < r2
000864bc: 1440ffea bne r2,r0,0x00086468						*loop animation speed times
000864c0: 00000000 nop									|

Unit animation finished:

000864c4: 00008021 addu r16,r0,r0			$r16 = 0
000864c8: 34160208 ori r22,r0,0x0208			@r22 = 0x208
000864cc: 02409821 addu r19,r18,r0			|r19 = Misc unit data pointer
000864d0: 96620208 lhu r2,0x0208(r19)			&weapon graphic trigger
000864d4: 00000000 nop					|
000864d8: 10400022 beq r2,r0,0x00086564		$Branch if not weapon exists and is being animated
000864dc: 00000000 nop						|
000864e0: 96620212 lhu r2,0x0212(r19)				|wait time for weapon
000864e4: 00000000 nop						|
000864e8: 1040001e beq r2,r0,0x00086564			$branch if no wait time
000864ec: 00000000 nop						|
000864f0: 3c028004 lui r2,0x8004				|
000864f4: 8c425980 lw r2,0x5980(r2)				|animation speed
000864f8: 00000000 nop						|
000864fc: 18400019 blez r2,0x00086564				$Branch if animation speed is 0
00086500: 0000a021 addu r20,r0,r0					|r20 = 0
00086504: 02608821 addu r17,r19,r0					|r17 = Misc Unit Data pointer
00086508: 02c0a821 addu r21,r22,r0					|r21 = 0x208
0008650c: 96220212 lhu r2,0x0212(r17)					%load frame + frame delay + Frame command value
00086510: 00000000 nop							|
00086514: 1040000d beq r2,r0,0x0008654c				#Branch if above is 0
00086518: 26940001 addiu r20,r20,0x0001					|increase counter (number of times to trigger graphic loading?)
0008651c: 96220212 lhu r2,0x0212(r17)						|load frame + frame delay + Frame command value
00086520: 00000000 nop								|
00086524: 2442ffff addiu r2,r2,0xffff						|subtract 1
00086528: a6220212 sh r2,0x0212(r17)						|save new value
0008652c: 96220212 lhu r2,0x0212(r17)						|load frame + frame delay + Frame command value
00086530: 00000000 nop								|
00086534: 14400005 bne r2,r0,0x0008654c					#branch if above is not 0
00086538: 02402021 addu r4,r18,r0							|r4 = Misc Unit data pointer
0008653c: 02552821 addu r5,r18,r21							|r5 = WEP Sprite data pointer
00086540: 02003021 addu r6,r16,r0							|r6 = Sprite Palette ID
00086544: 0c02149b jal 0x0008526c							| --> Load WEP graphic from WEP1 Sheet -- Also processes various frame commands, and effect graphic loading
00086548: 34070001 ori r7,r0,0x0001							|r7 = 1
0008654c: 3c028004 lui r2,0x8004					#
00086550: 8c425980 lw r2,0x5980(r2)					|Load animation speed
00086554: 00000000 nop							|
00086558: 0282102a slt r2,r20,r2					|Set if less than No. frames already animated
0008655c: 1440ffeb bne r2,r0,0x0008650c				%loop animation speed times
00086560: 00000000 nop							|
00086564: 26d60030 addiu r22,r22,0x0030		$r22 + 0x30
00086568: 26100001 addiu r16,r16,0x0001		r16 + 1
0008656c: 2a020003 slti r2,r16,0x0003			r2 = 1 if r16 < 3
00086570: 1440ffd7 bne r2,r0,0x000864d0		loop and animate effect after weapon animated
00086574: 26730030 addiu r19,r19,0x0030		r19 + 0x30 (difference between Weapon data & Effect data)
00086578: 8fbf00a4 lw r31,0x00a4(r29)
0008657c: 8fb600a0 lw r22,0x00a0(r29)
00086580: 8fb5009c lw r21,0x009c(r29)
00086584: 8fb40098 lw r20,0x0098(r29)
00086588: 8fb30094 lw r19,0x0094(r29)
0008658c: 8fb20090 lw r18,0x0090(r29)
00086590: 8fb1008c lw r17,0x008c(r29)
00086594: 8fb00088 lw r16,0x0088(r29)
00086598: 27bd00a8 addiu r29,r29,0x00a8
0008659c: 03e00008 jr r31
000865a0: 00000000 nop