Load Unit graphics from sprite sheet

From Final Fantasy Hacktics Wiki
(Redirected from 00084818 - 00085230)
Jump to navigation Jump to search

appears to be a unit graphic loading routine - extremely similar in structure to Load WEP graphic from WEP1 Sheet
00084818: 27bdffc0 addiu r29,r29,0xffc0
0008481c: afb30024 sw r19,0x0024(r29)
00084820: 00809821 addu r19,r4,r0		r19 = misc unit data pointer
00084824: afb5002c sw r21,0x002c(r29)
00084828: 00a0a821 addu r21,r5,r0		r21 = frame & animation data
0008482c: afbe0038 sw r30,0x0038(r29)
00084830: 00c0f021 addu r30,r6,r0		r30 = wait frames (in progress)
00084834: afbf003c sw r31,0x003c(r29)
00084838: afb70034 sw r23,0x0034(r29)
0008483c: afb60030 sw r22,0x0030(r29)
00084840: afb40028 sw r20,0x0028(r29)
00084844: afb20020 sw r18,0x0020(r29)
00084848: afb1001c sw r17,0x001c(r29)
0008484c: afb00018 sw r16,0x0018(r29)
00084850: 96b70004 lhu r23,0x0004(r21)		load current animation
00084854: 96b20006 lhu r18,0x0006(r21)		load unit (not weapon) byte counter
00084858: 32e3ffff andi r3,r23,0xffff		move animation to r3
0008485c: 2c6201f4 sltiu r2,r3,0x01f4		r2 = true if animation < 0x1f4
00084860: 10400004 beq r2,r0,0x00084874	#branch if animation > 0x1f4               // if animation is on evtchr slot 1
00084864: 02e0a021 addu r20,r23,r0			|r20 = current animation
00084868: 8eb60020 lw r22,0x0020(r21)			|SEQ data pointer
0008486c: 08021227 j 0x0008489c			@jump ahead
00084870: 00000000 nop					|
00084874: 2c620258 sltiu r2,r3,0x0258		#r2 = true if animation < 0x258
00084878: 10400005 beq r2,r0,0x00084890	#branch if animation > 0x258               // if animation is on evtchr slot 2
0008487c: 26f4fe0c addiu r20,r23,0xfe0c		|r20 = animation - 0x1f4
00084880: 3c16800a lui r22,0x800a			|
00084884: 26d677d8 addiu r22,r22,0x77d8		|r22 = 0x800a77d8                  // if animation is on evtchr slot 1, use slot1 seq data
00084888: 08021227 j 0x0008489c			@jump ahead
0008488c: 00000000 nop
00084890: 3c16800b lui r22,0x800b		#
00084894: 26d6ed3c addiu r22,r22,0xed3c	r22 = 0x800aed3c                           // if animation is on evtchr slot 2, use slot2 seq data
00084898: 26f4fda8 addiu r20,r23,0xfda8	r20 = animation - 0x258
0008489c: 17c00002 bne r30,r0,0x000848a8	@#branch if wait frames != 0
000848a0: 3282ffff andi r2,r20,0xffff			|r2 = animation
000848a4: 2652fffe addiu r18,r18,0xfffe		|r18 = counter - 1                 //
000848a8: 00021080 sll r2,r2,0x02		#animation * 4
000848ac: 00561021 addu r2,r2,r22		SEQ + animation * 4
000848b0: 8c430008 lw r3,0x0008(r2)		load animation's first instr. byte
000848b4: 2402ffff addiu r2,r0,0xffff
000848b8: 14620005 bne r3,r2,0x000848d0	#branch if pointer is not invalid
000848bc: 3282ffff andi r2,r20,0xffff			|move animation to r2
000848c0: 34040009 ori r4,r0,0x0009			|
000848c4: 0c011282 jal 0x00044a08			|move r4 to r5 and clear something (error thing) // free to remove.
000848c8: 00000000 nop					|
000848cc: 3282ffff andi r2,r20,0xffff			|move animation to r2
000848d0: 00021080 sll r2,r2,0x02		#animation * 4
000848d4: 00561021 addu r2,r2,r22		SEQ + animation * 4
000848d8: 00121c00 sll r3,r18,0x10		
000848dc: 8c450008 lw r5,0x0008(r2)		load animation's frame command pointer
000848e0: 00031c03 sra r3,r3,0x10		I heard you like garbage                   // I can fix a lot of these compiler inefficiencies...
000848e4: 00a31821 addu r3,r5,r3		
000848e8: 90630000 lbu r3,0x0000(r3)		load appropriate frame command byte
000848ec: 340200ff ori r2,r0,0x00ff		r2 = 0xff
000848f0: 14620223 bne r3,r2,0x00085180	#branch if byte is not 0xff                // load frame in r3 and wait by byte 2 frames
000848f4: 00121400 sll r2,r18,0x10			|moves counter to r2
000848f8: 26430001 addiu r3,r18,0x0001			|increment byte counter
000848fc: 00031400 sll r2,r3,0x10			|
00084900: 00021403 sra r2,r2,0x10			|moves counter + 1 to r2
00084904: 00a21021 addu r2,r5,r2			|
00084908: 90420000 lbu r2,0x0000(r2)			|load appropriate byte
0008490c: 24720001 addiu r18,r3,0x0001			|increment counter again
00084910: 2443ff42 addiu r3,r2,0xff42			|subtract 0xbe  
00084914: 2c620042 sltiu r2,r3,0x0042			|r2 = true if r3 < 0x42 (if command byte => 0xbe)
00084918: 10400217 beq r2,r0,0x00085178		$branch if command byte < 0xbe (invalid command) // free to remove, just don't use animation instructions less than and I should be good.
0008491c: 00031080 sll r2,r3,0x02				|r2 = r3 * 4 (makes it a pointer :D)
00084920: 3c018006 lui r1,0x8006				|
00084924: 00220821 addu r1,r1,r2				|
00084928: 8c227f20 lw r2,0x7f20(r1)				|loads return addresses based byte
0008492c: 00000000 nop						|
00084930: 00400008 jr r2					|go there (above branches continue past this)     // I really want to compact this table... I could fit like twice as many instructions here. alas, must I?
00084934: 00000000 nop						|
						Return addresses based on command byte:
						0xbe: 0x80085168 (initialise something?)
						0xbf: 0x80085158 (unsure and not used?)
						0xc0: 0x80085110 WaitForDistort(ffc0, ##)
						0xc1: 0x800850c0 QueueDistortAnim(ffc1, Distort ID, Var)
						0xc2: 0x800848cc nop
						0xc3: 0x80085000 UnloadMFItem(ffc3)
						0xc4: 0x80085078 MFItemPos(ffc4, XX, YY)
						0xc5: 0x80084ff4 LoadMFItem(ffc5)
						0xc6: 0x80085008 WaitForInput(ffc6, ##)
				    0xc7, 0xc8, 0xc9: 0x80084b08 nop(##,##)
						0xca: 0x80085170 nop(##)
						0xcb: 0x80084fe0 MoveUp2(ffcb)
						0xcc: 0x80084fcc MoveUp1(ffcc)           // these can be simplified to use the argument as part of the calculation.
						0xcd: 0x80084fb8 MoveBackward2(ffcd)
						0xce: 0x80084fa4 MoveBackward1(ffcd)
						0xcf: 0x80084f90 MoveDown2(ffcf)
						0xd0: 0x80084f7c MoveDown1(ffd0)
						0xd1: 0x80084f68 MoveForward2(ffd1)
						0xd2: 0x80084f54 MoveForward1(ffd2)
						0xd3: 0x8008505c WeaponSheatheCheck1(ffd3, ##)
						0xd4: 0x80085024 PlayAttackSound(ffd4, SoundID)
						0xd5: 0x80084a00 IncrementLoop(ffd5)             // loopcount is a debug variable. can be repurposed.
						0xd6: 0x80084b3c WeaponSheatheCheck2(ffd6, ##)
						0xd7: 0x80085170 nop(##)
						0xd8: 0x80084c64 SetFrameOffset(ffd8, Rotation)
						0xd9: 0x80084b00 QueueThrowAnimation(ffd9, ####) // does not use its argument. can trim the fat.
						0xda: 0x80085178 ReturnErrorFinishAnim(ffda)     // can be repurposed
						0xdb: 0x80084c2c SetSlowdown(ffdb, Wait)
						0xdc: 0x80084b10 ReloadAnimation(ffdc)
						0xdd: 0x80084c9c OverrideAnimation(ffdd, ID)
						0xde: 0x80084a20 PostGenericAttack (ffde)
						0xdf: 0x80084a14 SetYRotation0(ffdf)
						0xe0: 0x8008496c ClearShadow(ffe0)
						0xe1: 0x80084960 SetShadow(ffe1)
						0xe2: 0x80084cf4 SetLayerPriority(ffe2, LayerID) // layer IDs can be concatenated. nevertheless, mostly outside my scope.
					  0xe3, 0xe4: 0x80085170 nop(##)
						0xe5: 0x80084e8c SaveYSpin(ffe5, Spin)
				    0xe6, 0xe7, 0xe8: 0x80084b08 nop(##,##)
						0xe9: 0x80085170 nop(##)
						0xea: 0x80084b08 nop(##,##)
						0xeb: 0x8008494c FlipVertical(ffeb)
						0xec: 0x80084938 FlipHorizontal(ffec)
						0xed: 0x80085170 nop(##)
						0xee: 0x80084c00 MoveUnitFB(ffee, XX)
						0xef: 0x80084bc8 MoveUnitDU(ffef, YY)
						0xf0: 0x80084b90 MoveUnitRL(fff0, ZZ)
						0xf1: 0x80084b08 nop(##,##)
						0xf2: 0x80084d24 QueueSpriteAnim(fff2, Graphic, ID) // cannot set the animation of the unit themselves. shame. should it?
				    0xf3, 0xf4, 0xf5: 0x80085170 nop(##)
				    		0xf6: 0x80084b58 PlaySound(fff6, ID)
						0xf7: 0x80084f4c nop(##,##,##)
						0xf8: 0x80084b08 nop(##,##)
						0xf9: 0x80084e24 UNKNOWN1(##,##)
						0xfa: 0x80084ed8 MoveUnit(fffa, ZZ, YY, XX)
						0xfb: 0x80084b08 nop(##,##)
						0xfc: 0x80084da4 Wait(fffc, ##, Loops)
						0xfd: 0x80085120 HoldWeapon (fffd, ##)
					  0xfe, 0xff: 0x80084974 PauseAnimation(ffff) (also EndAnimation (fffe), but that mostly exists for weapon compat.)

Flip Horizontal

00084938: 96a20018 lhu r2,0x0018(r21)		load rotation flags
0008493c: 00000000 nop
00084940: 38420002 xori r2,r2,0x0002		flip horizontal flip flag
00084944: 08021233 j 0x000848cc		queue next command
00084948: a6a20018 sh r2,0x0018(r21)		save rotation flag

Flip Vertical

0008494c: 96a20018 lhu r2,0x0018(r21)		load rotation flags
00084950: 00000000 nop
00084954: 38420004 xori r2,r2,0x0004		flip vertical flip flag
00084958: 08021233 j 0x000848cc		queue next command
0008495c: a6a20018 sh r2,0x0018(r21)		save rotation flags

Set Shadow

00084960: 34020001 ori r2,r0,0x0001
00084964: 08021233 j 0x000848cc		queue next command
00084968: a2620298 sb r2,0x0298(r19)		Save 1 to unit's shadow

Clear Shadow

0008496c: 08021233 j 0x000848cc		queue next command
00084970: a2600298 sb r0,0x0298(r19)		save 0 to unit's shadow

Pause Animation

00084974: 32e3ffff andi r3,r23,0xffff		r3 = animation
00084978: 2c6201f4 sltiu r2,r3,0x01f4		set if animation is < 0x1f4
0008497c: 1040001e beq r2,r0,0x000849f8	#branch if not                                   // if animation is from EVTCHR1 or EVTCHR2
00084980: 30620001 andi r2,r3,0x0001			|r2 = true if animation is odd
00084984: 1040000c beq r2,r0,0x000849b8		$branch if even
00084988: 02602021 addu r4,r19,r0				|r4 = unit misc. data pointer
0008498c: 92620006 lbu r2,0x0006(r19)				|load unit spritesheet ID
00084990: 00000000 nop						|
00084994: 00021080 sll r2,r2,0x02				|ID * 4
00084998: 3c018009 lui r1,0x8009				|
0008499c: 00220821 addu r1,r1,r2				|
000849a0: 90224748 lbu r2,0x4748(r1)				|Load spritesheet's SHP ID
000849a4: 3c018009 lui r1,0x8009				|
000849a8: 00220821 addu r1,r1,r2				|
000849ac: 903049d0 lbu r16,0x49d0(r1)				|Load associated byte to SHP ID // loads and stores a wait frame for the unit
000849b0: 08021277 j 0x000849dc				@jump ahead
000849b4: 00000000 nop						|
000849b8: 92620006 lbu r2,0x0006(r19)			$load unit spritesheet ID
000849bc: 00000000 nop					|
000849c0: 00021080 sll r2,r2,0x02			|unit spritesheet ID * 4
000849c4: 3c018009 lui r1,0x8009			|
000849c8: 00220821 addu r1,r1,r2			|
000849cc: 90224748 lbu r2,0x4748(r1)			|Load spritesheet's SHP ID
000849d0: 3c018009 lui r1,0x8009			|
000849d4: 00220821 addu r1,r1,r2			|
000849d8: 903049c4 lbu r16,0x49c4(r1)			|Load associated byte to SHP ID        // loads and stores a wait frame for the unit
000849dc: 02a02821 addu r5,r21,r0			@r5 = Frame + Animation data
000849e0: 3206ffff andi r6,r16,0xffff			|r6 = associated byte to SHP ID
000849e4: 02e03821 addu r7,r23,r0			|r7 = animation ID
000849e8: a4800054 sh r0,0x0054(r4)			|save 0 to Y?
000849ec: a4800052 sh r0,0x0052(r4)			|save 0 to Height?
000849f0: 0c021085 jal 0x00084214			|--> Update Sprite display data
000849f4: a4800050 sh r0,0x0050(r4)			|save 0 to X?
000849f8: 08021480 j 0x00085200		#Finishes animation
000849fc: a6a0000a sh r0,0x000a(r21)		clears frame delay + other stuff (number of frames in that pose)

Increment Loop

00084a00: 96a2000c lhu r2,0x000c(r21)		Load loop count
00084a04: 00009021 addu r18,r0,r0		set counter to 0
00084a08: 24420001 addiu r2,r2,0x0001		increment loop count by 1
00084a0c: 08021233 j 0x000848cc		queue next command
00084a10: a6a2000c sh r2,0x000c(r21)		save new loop count

Set Y Rotation == 0

00084a14: 8ea2002c lw r2,0x002c(r21)		Load sprite display section
00084a18: 08021233 j 0x000848cc		queue next animation
00084a1c: a440000c sh r0,0x000c(r2)		set rotation on Y axis to 0

Post Generic Attack Calculation

00084a20: 3c038009 lui r3,0x8009
00084a24: 8c6360e4 lw r3,0x60e4(r3)		loads type of display?
00084a28: 34020034 ori r2,r0,0x0034		r2 = 0x34
00084a2c: 1062ffa7 beq r3,r2,0x000848cc	queue next command if display type is 0x34            // not compatible with displaying damage?
00084a30: 00000000 nop
00084a34: 866401a0 lh r4,0x01a0(r19)		Load last attack used's ID
00084a38: 00000000 nop
00084a3c: 1080000d beq r4,r0,0x00084a74	#Branch if said attack was... attack.
00084a40: 00801821 addu r3,r4,r0			|r3 = ability ID
00084a44: 3402016f ori r2,r0,0x016f			|r2 = 0x16f
00084a48: 1082000a beq r4,r2,0x00084a74		#branch if attack ID was frog attack
00084a4c: 2462ff76 addiu r2,r3,0xff76				|r2 = ability - 0x8a
00084a50: 2c420008 sltiu r2,r2,0x0008				|r2 = true if ability is between 0x8a and 0x91 (exclusive, Knight skills only?)
00084a54: 14400007 bne r2,r0,0x00084a74			#branch if such is the case
00084a58: 2462ff2b addiu r2,r3,0xff2b					|type of display - 0xd5
00084a5c: 2c420003 sltiu r2,r2,0x0003					|r2 = true if ability is between 0xd5 and 0xd7 (exclusive, Mustadio's skills?)
00084a60: 14400004 bne r2,r0,0x00084a74				#branch if such is the case
00084a64: 2462fe76 addiu r2,r3,0xfe76						|ability - 0x18a
00084a68: 2c420014 sltiu r2,r2,0x0014						|r2 = true if ability is between 0x18a (exclusive, dragoon and archer skills?) // this is dumb, and I can trim it down.
00084a6c: 1040ff98 beq r2,r0,0x000848d0					|queue next command if this is not the case
00084a70: 3282ffff andi r2,r20,0xffff						|r2 = animation
00084a74: 9262018d lbu r2,0x018d(r19)		#load Limit for target data
00084a78: 00000000 nop
00084a7c: 1040ff94 beq r2,r0,0x000848d0	queue next command if limit is 0
00084a80: 3282ffff andi r2,r20,0xffff		r2 = animation
00084a84: 9262018d lbu r2,0x018d(r19)		load limit again
00084a88: 00000000 nop				
00084a8c: 1040ff8f beq r2,r0,0x000848cc	queue next command if limit is 0, but different this time I swear                // can trim this
00084a90: 00008821 addu r17,r0,r0		r17 = 0
00084a94: 3222ffff andi r2,r17,0xffff		r2 = r17
00084a98: 02621021 addu r2,r19,r2		r2 = misc. unit data + counter
00084a9c: 9044018e lbu r4,0x018e(r2)		Load first target
00084aa0: 0c01e9c9 jal 0x0007a724		--> Get unit misc data that matches r4 ID
00084aa4: 00000000 nop				
00084aa8: 00408021 addu r16,r2,r0		r16 = r2 (target unit ID)
00084aac: 1200000d beq r16,r0,0x00084ae4	#branch if result of routine returns 0 (invalid unit?)
00084ab0: 26310001 addiu r17,r17,0x0001		|increment r17 by 1
00084ab4: 02602021 addu r4,r19,r0			|r4 = misc. unit data pointer
00084ab8: 0c020e5e jal 0x00083978			|--> Set targets animation based on attack type
00084abc: 02002821 addu r5,r16,r0			|r5 = r16
00084ac0: 02602021 addu r4,r19,r0			|r4 = misc. unit data pointer
00084ac4: 0c020e1d jal 0x00083874			|--> Set attacker animation for shield block
00084ac8: 02002821 addu r5,r16,r0			|r5 = r16
00084acc: 92040004 lbu r4,0x0004(r16)			|Unit Misc ID?
00084ad0: 0c01a2f5 jal 0x00068bd4			|--> Jump to post action display
00084ad4: 00000000 nop					|
00084ad8: 02602021 addu r4,r19,r0			|r4 = misc unit data pointer
00084adc: 0c01a253 jal 0x0006894c			|--> Set evade type data and weapon element effect
00084ae0: 00002821 addu r5,r0,r0			|r5 = 0
00084ae4: 9263018d lbu r3,0x018d(r19)		#loads something :D
00084ae8: 3222ffff andi r2,r17,0xffff		moves resultant counter to r2
00084aec: 0043102b sltu r2,r2,r3		sets r2 to true if the number of times gone through the routine is less than r3
00084af0: 1440ffe9 bne r2,r0,0x00084a98	repeat part of the routine if still not matching target hit# limit
00084af4: 3222ffff andi r2,r17,0xffff		moves r17 into r2 again
00084af8: 08021234 j 0x000848d0		queues next command
00084afc: 3282ffff andi r2,r20,0xffff		r2 = animation

Queue Throw Hardcoding and Projectile Loading

00084b00: 0c01a269 jal 0x000689a4		--> Set evade type data, item and throw stone hardcoding
00084b04: 02602021 addu r4,r19,r0		r4 = misc unit data pointer
00084b08: 08021233 j 0x000848cc		queue next command
00084b0c: 26520002 addiu r18,r18,0x0002	increment counter by 2

Reload Animation

00084b10: 96b7000e lhu r23,0x000e(r21)		Load unit animation
00084b14: 96b20010 lhu r18,0x0010(r21)		load last animation's counter
00084b18: 32e3ffff andi r3,r23,0xffff		moves animation into r3
00084b1c: 2c6201f4 sltiu r2,r3,0x01f4		set if animation is less than 0x1f4
00084b20: 1440ff6a bne r2,r0,0x000848cc	queue next command if so
00084b24: 02e0a021 addu r20,r23,r0		r20 = animation
00084b28: 2c620258 sltiu r2,r3,0x0258		set if animation is less than 0x258
00084b2c: 1440ff67 bne r2,r0,0x000848cc	queue next command if so
00084b30: 26f4fe0c addiu r20,r23,0xfe0c	r20 = animation - 1f4
00084b34: 08021233 j 0x000848cc		queue next command
00084b38: 26f4fda8 addiu r20,r23,0xfda8	r20 = animation - 0x258

Weapon Sheathe Check 2

00084b3c: 3c028009 lui r2,0x8009		
00084b40: 8c42612c lw r2,0x612c(r2)		load weapon sheathe check (maybe an anim finished check lmao)
00084b44: 00000000 nop
00084b48: 14400176 bne r2,r0,0x00085124	branch if not finishing animation
00084b4c: 3282ffff andi r2,r20,0xffff		r2 = animation
00084b50: 08021234 j 0x000848d0		queue next command
00084b54: 26520001 addiu r18,r18,0x0001	increment counter by 1

Play Sound

00084b58: 02401021 addu r2,r18,r0		r2 = counter
00084b5c: 26520001 addiu r18,r18,0x0001	r18 = counter + 1
00084b60: 3283ffff andi r3,r20,0xffff		r3 = animation
00084b64: 00031880 sll r3,r3,0x02		animation * 4
00084b68: 00761821 addu r3,r3,r22		SEQ animation + Anim * 4
00084b6c: 00021400 sll r2,r2,0x10		
00084b70: 8c630008 lw r3,0x0008(r3)		load pointer to frame commands
00084b74: 00021403 sra r2,r2,0x10
00084b78: 00621821 addu r3,r3,r2
00084b7c: 90650000 lbu r5,0x0000(r3)
00084b80: 0c01ae58 jal 0x0006b960		--> 0006b960 - 0006b990 plays sound
00084b84: 02602021 addu r4,r19,r0
00084b88: 08021234 j 0x000848d0		queue next command
00084b8c: 3282ffff andi r2,r20,0xffff

Move Unit Right+/Left-

00084b90: 02401021 addu r2,r18,r0		r2 = counter
00084b94: 26520001 addiu r18,r18,0x0001	r18 = counter + 1
00084b98: 3283ffff andi r3,r20,0xffff		r3 = animation
00084b9c: 00031880 sll r3,r3,0x02		animation * 4
00084ba0: 00761821 addu r3,r3,r22		seq data + animation * 4
00084ba4: 00021400 sll r2,r2,0x10
00084ba8: 8c630008 lw r3,0x0008(r3)		load pointer to frame commands
00084bac: 00021403 sra r2,r2,0x10
00084bb0: 00621821 addu r3,r3,r2
00084bb4: 80650000 lb r5,0x0000(r3)
00084bb8: 0c0211ac jal 0x000846b0		--> Move Unit Right+/Left-
00084bbc: 02602021 addu r4,r19,r0
00084bc0: 08021234 j 0x000848d0		queue next command
00084bc4: 3282ffff andi r2,r20,0xffff

Move Unit Down+/Up-

00084bc8: 02401021 addu r2,r18,r0		r2 = counter
00084bcc: 26520001 addiu r18,r18,0x0001	r18 = counter + 1
00084bd0: 3283ffff andi r3,r20,0xffff
00084bd4: 00031880 sll r3,r3,0x02
00084bd8: 00761821 addu r3,r3,r22
00084bdc: 00021400 sll r2,r2,0x10
00084be0: 8c630008 lw r3,0x0008(r3)		load pointer to frame commands
00084be4: 00021403 sra r2,r2,0x10
00084be8: 00621821 addu r3,r3,r2
00084bec: 80650000 lb r5,0x0000(r3)		load 1st byte
00084bf0: 0c0211d6 jal 0x00084758		--> Move Unit Down+/Up- - Float routine?
00084bf4: 02602021 addu r4,r19,r0		r4 = unit misc. data pointer
00084bf8: 08021234 j 0x000848d0		queue next command
00084bfc: 3282ffff andi r2,r20,0xffff		r2 = animation

Move Unit Forward+/Back-

00084c00: 02401021 addu r2,r18,r0		r2 = counter
00084c04: 3283ffff andi r3,r20,0xffff		r3 = animation
00084c08: 00031880 sll r3,r3,0x02		animation * 4
00084c0c: 00761821 addu r3,r3,r22		seq data + animation * 4
00084c10: 00021400 sll r2,r2,0x10
00084c14: 8c630008 lw r3,0x0008(r3)		frame command pointer
00084c18: 00021403 sra r2,r2,0x10
00084c1c: 00621821 addu r3,r3,r2
00084c20: 80650000 lb r5,0x0000(r3)		load third byte to r5
00084c24: 080213cf j 0x00084f3c		jump ahead with this r5 value
00084c28: 26520001 addiu r18,r18,0x0001	increment counter by 1

Set Slowdown

00084c2c: 3283ffff andi r3,r20,0xffff		r3 = animation
00084c30: 00031880 sll r3,r3,0x02		animation * 4
00084c34: 00761821 addu r3,r3,r22
00084c38: 02401021 addu r2,r18,r0
00084c3c: 00021400 sll r2,r2,0x10
00084c40: 8c630008 lw r3,0x0008(r3)		frame command pointer
00084c44: 00021403 sra r2,r2,0x10
00084c48: 00621821 addu r3,r3,r2
00084c4c: 90620000 lbu r2,0x0000(r3)		load third frame command
00084c50: 26520001 addiu r18,r18,0x0001	increment counter
00084c54: 00021600 sll r2,r2,0x18
00084c58: 00021603 sra r2,r2,0x18
00084c5c: 08021233 j 0x000848cc		queue next command
00084c60: a6a20012 sh r2,0x0012(r21)		save third frame command to sprite data

Set Frame Offset

00084c64: 3283ffff andi r3,r20,0xffff		r3 = animation
00084c68: 00031880 sll r3,r3,0x02		anim * 4
00084c6c: 00761821 addu r3,r3,r22
00084c70: 02401021 addu r2,r18,r0
00084c74: 00021400 sll r2,r2,0x10
00084c78: 8c630008 lw r3,0x0008(r3)		pointer to frame commands
00084c7c: 00021403 sra r2,r2,0x10
00084c80: 00621821 addu r3,r3,r2
00084c84: 90620000 lbu r2,0x0000(r3)		Load third command byte
00084c88: 26520001 addiu r18,r18,0x0001	increment counter
00084c8c: 00021600 sll r2,r2,0x18
00084c90: 00021603 sra r2,r2,0x18
00084c94: 08021233 j 0x000848cc
00084c98: a6a20014 sh r2,0x0014(r21)		save third byte to... ?

Override Animation

00084c9c: 3283ffff andi r3,r20,0xffff		r3 = animation
00084ca0: 00031880 sll r3,r3,0x02		anim * 4
00084ca4: 00761821 addu r3,r3,r22		pointer to SEQ data
00084ca8: 02401021 addu r2,r18,r0		r2 = counter
00084cac: 00021400 sll r2,r2,0x10
00084cb0: a6b7000e sh r23,0x000e(r21)		save animation to sprite data
00084cb4: 8c630008 lw r3,0x0008(r3)		load frame command pointer
00084cb8: 00021403 sra r2,r2,0x10
00084cbc: 00621821 addu r3,r3,r2
00084cc0: 90770000 lbu r23,0x0000(r3)		Load 3rd byte into raw anim register
00084cc4: 26520001 addiu r18,r18,0x0001	increment counter
00084cc8: 32e3ffff andi r3,r23,0xffff		r3 = new animation
00084ccc: 2c6201f4 sltiu r2,r3,0x01f4		set r2 true if anim# < 0x1f4
00084cd0: 14400005 bne r2,r0,0x00084ce8	#branch if so
00084cd4: 02e0a021 addu r20,r23,r0			|r20 = animation
00084cd8: 2c620258 sltiu r2,r3,0x0258			|set if animation is less than 0x258
00084cdc: 14400002 bne r2,r0,0x00084ce8		#branch if so
00084ce0: 26f4fe0c addiu r20,r23,0xfe0c			|r20 = animation -0x1f4
00084ce4: 26f4fda8 addiu r20,r23,0xfda8			|r20 = animation -x0258
00084ce8: a6b20010 sh r18,0x0010(r21)		#save counter
00084cec: 08021233 j 0x000848cc		queue next command
00084cf0: 00009021 addu r18,r0,r0		reset counter

Set Unit-Weapon-Glint Layer priority

00084cf4: 3283ffff andi r3,r20,0xffff		r3 = animation
00084cf8: 00031880 sll r3,r3,0x02		anim * 4
00084cfc: 00761821 addu r3,r3,r22
00084d00: 02401021 addu r2,r18,r0
00084d04: 00021400 sll r2,r2,0x10
00084d08: 8c630008 lw r3,0x0008(r3)		load frame command pointer
00084d0c: 00021403 sra r2,r2,0x10
00084d10: 00621821 addu r3,r3,r2
00084d14: 90620000 lbu r2,0x0000(r3)		load 3rd frame command
00084d18: 26520001 addiu r18,r18,0x0001	increment counter
00084d1c: 08021233 j 0x000848cc		queue next command
00084d20: a6620014 sh r2,0x0014(r19)		save ?

Queue Weapon1/Glint2 Sprite Animation

00084d24: 26430001 addiu r3,r18,0x0001			r3 = counter + 1
00084d28: 00122400 sll r4,r18,0x10
00084d2c: 24720001 addiu r18,r3,0x0001			r18 = counter + 2
00084d30: 3282ffff andi r2,r20,0xffff			r2 = animation
00084d34: 00021080 sll r2,r2,0x02			r2 = animation * 4
00084d38: 00561021 addu r2,r2,r22			r2 = SEQ + anim * 4
00084d3c: 00042403 sra r4,r4,0x10			r4 = counter
00084d40: 00031c00 sll r3,r3,0x10			
00084d44: 8c420008 lw r2,0x0008(r2)			load unit anim's command pointer
00084d48: 00031c03 sra r3,r3,0x10			r3 = r18 + 1
00084d4c: 00442021 addu r4,r2,r4			pointer to 3rd byte
00084d50: 00431021 addu r2,r2,r3			pointer to 4th byte
00084d54: 90900000 lbu r16,0x0000(r4)			load 3rd byte
00084d58: 90510000 lbu r17,0x0000(r2)			Load 4th byte
00084d5c: 16000004 bne r16,r0,0x00084d70		#branch if ? is not 0
00084d60: 00101040 sll r2,r16,0x01				|r2 = 3rd byte * 2
00084d64: 0c011282 jal 0x00044a08				|error jump thing.
00084d68: 3404000d ori r4,r0,0x000d				|move r4 to r5
00084d6c: 00101040 sll r2,r16,0x01				|r2 = ? * 2
00084d70: 00501021 addu r2,r2,r16			#r2 = 3rd byte * 3
00084d74: 00021100 sll r2,r2,0x04			r2 = 3rd byte * 0x30
00084d78: 244201d8 addiu r2,r2,0x01d8			r2 = 3rd byte * 0x30 + 0x1d8
00084d7c: 02621021 addu r2,r19,r2			r2 = WEP1 data (usually)
00084d80: 34080001 ori r8,r0,0x0001
00084d84: a448000a sh r8,0x000a(r2)			saves 1 to anim frame length
00084d88: a4510004 sh r17,0x0004(r2)			Save weapon animation
00084d8c: a4400006 sh r0,0x0006(r2)			clear increment
00084d90: a4400012 sh r0,0x0012(r2)			clear frame delay
00084d94: a4400014 sh r0,0x0014(r2)			clear weapon rotation
00084d98: a4400016 sh r0,0x0016(r2)			clear ?
00084d9c: 08021233 j 0x000848cc			queue next command
00084da0: a4480000 sh r8,0x0000(r2)			save 1 to graphic trigger

Wait

00084da4: 26460001 addiu r6,r18,0x0001			r6 = counter + 1
00084da8: 00122400 sll r4,r18,0x10
00084dac: 24d20001 addiu r18,r6,0x0001			r18 = counter + 2
00084db0: 3282ffff andi r2,r20,0xffff			r2 = animation
00084db4: 00021080 sll r2,r2,0x02			anim * 4
00084db8: 00561021 addu r2,r2,r22			seq data pointer
00084dbc: 00042403 sra r4,r4,0x10			r4 = counter
00084dc0: 8c430008 lw r3,0x0008(r2)			pointer to frame commands
00084dc4: 00061400 sll r2,r6,0x10
00084dc8: 00021403 sra r2,r2,0x10			r2 = counter + 1
00084dcc: 00642021 addu r4,r3,r4			position of 3rd command byte
00084dd0: 00621821 addu r3,r3,r2			position of 4th command byte
00084dd4: 90820000 lbu r2,0x0000(r4)			load 3rd byte
00084dd8: 90640000 lbu r4,0x0000(r3)			load 4th
00084ddc: 96a30016 lhu r3,0x0016(r21)			load 16th byte of sprite data
00084de0: 00021600 sll r2,r2,0x18			
00084de4: 1060000b beq r3,r0,0x00084e14		#branch if timer is still blank
00084de8: 00022e03 sra r5,r2,0x18				|r5 = 3rd byte
00084dec: 96a20016 lhu r2,0x0016(r21)				|
00084df0: 00000000 nop						|
00084df4: 2442ffff addiu r2,r2,0xffff				|
00084df8: a6a20016 sh r2,0x0016(r21)				|save third byte as 0x16 byte in sprite data
00084dfc: 3042ffff andi r2,r2,0xffff				|
00084e00: 1040feb3 beq r2,r0,0x000848d0			|branch if timer reaches 0
00084e04: 3282ffff andi r2,r20,0xffff				|r2 = animation
00084e08: 24c2fffd addiu r2,r6,0xfffd				|
00084e0c: 08021233 j 0x000848cc				|queue next command
00084e10: 00a29021 addu r18,r5,r2				|counter + 3rd byte - 2
00084e14: 24c2fffd addiu r2,r6,0xfffd			#counter - 2
00084e18: 00a29021 addu r18,r5,r2			counter + 3rd byte - 2
00084e1c: 08021233 j 0x000848cc			queue next command
00084e20: a6a40016 sh r4,0x0016(r21)			store 4th byte as wait frames

UNKNOWN1

00084e24: 3284ffff andi r4,r20,0xffff			r4 = anim
00084e28: 00042080 sll r4,r4,0x02			anim * 4
00084e2c: 00962021 addu r4,r4,r22			seq data pointer
00084e30: 00121400 sll r2,r18,0x10
00084e34: 00021403 sra r2,r2,0x10			r2 = counter
00084e38: 26450001 addiu r5,r18,0x0001			r5 = counter + 1
00084e3c: 8c830008 lw r3,0x0008(r4)			frame command pointer
00084e40: 24b20001 addiu r18,r5,0x0001			r18 = counter + 2
00084e44: 00621821 addu r3,r3,r2			location of third byte
00084e48: 90620000 lbu r2,0x0000(r3)			load third command byte
00084e4c: 96630058 lhu r3,0x0058(r19)			load ? from vector data?
00084e50: 00021600 sll r2,r2,0x18			
00084e54: 00021603 sra r2,r2,0x18
00084e58: 00431021 addu r2,r2,r3			load command byte and ? vector
00084e5c: a6620058 sh r2,0x0058(r19)			save again
00084e60: 00051400 sll r2,r5,0x10
00084e64: 8c830008 lw r3,0x0008(r4)			frame command pointer
00084e68: 00021403 sra r2,r2,0x10			r2 = counter + 1
00084e6c: 00621821 addu r3,r3,r2
00084e70: 90620000 lbu r2,0x0000(r3)			4th command byte
00084e74: 9663005a lhu r3,0x005a(r19)			load more vector
00084e78: 00021600 sll r2,r2,0x18
00084e7c: 00021603 sra r2,r2,0x18
00084e80: 00431021 addu r2,r2,r3			add vector and 4th command byte
00084e84: 08021233 j 0x000848cc			queue next command
00084e88: a662005a sh r2,0x005a(r19)			save more vector

Save Y Spin

00084e8c: 26430001 addiu r3,r18,0x0001			r3 = counter + 1
00084e90: 00122400 sll r4,r18,0x10
00084e94: 24720001 addiu r18,r3,0x0001			r18 = counter + 2
00084e98: 3282ffff andi r2,r20,0xffff			r2 = anim
00084e9c: 00021080 sll r2,r2,0x02			anim * 4
00084ea0: 00561021 addu r2,r2,r22			seq data pointer
00084ea4: 00042403 sra r4,r4,0x10			r4 = counter
00084ea8: 00031c00 sll r3,r3,0x10
00084eac: 8c420008 lw r2,0x0008(r2)			load frame command pointer
00084eb0: 00031c03 sra r3,r3,0x10
00084eb4: 00442021 addu r4,r2,r4			location of 3rd command byte
00084eb8: 00431021 addu r2,r2,r3			location of 4th command byte
00084ebc: 90420000 lbu r2,0x0000(r2)			load third command byte
00084ec0: 90840000 lbu r4,0x0000(r4)			load fourth command byte
00084ec4: 8ea3002c lw r3,0x002c(r21)			loads ? display pointer
00084ec8: 00021200 sll r2,r2,0x08			move 3rd byte to upper byte of halfword
00084ecc: 00822025 or r4,r4,r2				combines two commands
00084ed0: 08021233 j 0x000848cc			queue next command
00084ed4: a464000c sh r4,0x000c(r3)			save new rotation

Move Unit Down+/Up-, Right+/Left-, Forward+/Back-

00084ed8: 02602021 addu r4,r19,r0			r4 = misc unit data pointer
00084edc: 3291ffff andi r17,r20,0xffff			r17 = animation
00084ee0: 00118880 sll r17,r17,0x02			anim * 4
00084ee4: 02368821 addu r17,r17,r22			Seq data pointer
00084ee8: 00121400 sll r2,r18,0x10
00084eec: 00021403 sra r2,r2,0x10			r2 = counter
00084ef0: 8e230008 lw r3,0x0008(r17)			frame command pointer
00084ef4: 26500001 addiu r16,r18,0x0001		r16 = counter + 1
00084ef8: 00621821 addu r3,r3,r2			Location of 3rd byte
00084efc: 80650000 lb r5,0x0000(r3)			third byte
00084f00: 0c0211ac jal 0x000846b0			--> Move Unit Right+/Left- Knockback? moving?
00084f04: 26120002 addiu r18,r16,0x0002		increment counter again
00084f08: 00101400 sll r2,r16,0x10
00084f0c: 8e230008 lw r3,0x0008(r17)			frame command pointer
00084f10: 00021403 sra r2,r2,0x10			r2 = counter + 1
00084f14: 00621821 addu r3,r3,r2			Location of 4th byte
00084f18: 80650000 lb r5,0x0000(r3)			load 4th byte
00084f1c: 0c0211d6 jal 0x00084758			--> Move Unit Down+/Up- the definitely not float routine
00084f20: 02602021 addu r4,r19,r0			r4 = misc unit data pointer
00084f24: 26100001 addiu r16,r16,0x0001		r16 = counter + 2
00084f28: 00108400 sll r16,r16,0x10
00084f2c: 8e220008 lw r2,0x0008(r17)			frame command pointer again
00084f30: 00108403 sra r16,r16,0x10
00084f34: 00501021 addu r2,r2,r16			location of 5th byte
00084f38: 80450000 lb r5,0x0000(r2)			load 5th byte
00084f3c: 0c0211dc jal 0x00084770			--> Move Unit Forward+/Back-
00084f40: 02602021 addu r4,r19,r0			r4 = unit misc data pointer
00084f44: 08021234 j 0x000848d0			queue next command
00084f48: 3282ffff andi r2,r20,0xffff			r2 = animation

Nop 3 Args

00084f4c: 08021233 j 0x000848cc			queue next command
00084f50: 26520003 addiu r18,r18,0x0003		skip ahead 3 bytes

Move Forward 1

00084f54: 02602021 addu r4,r19,r0			r4 = unit misc data
00084f58: 0c0211dc jal 0x00084770			--> 00084770 - 00084814
00084f5c: 34050001 ori r5,r0,0x0001			r5 = 1
00084f60: 08021234 j 0x000848d0			queue next command
00084f64: 3282ffff andi r2,r20,0xffff			r2 = animation

Move Forward 2

00084f68: 02602021 addu r4,r19,r0			r4 = unit misc data
00084f6c: 0c0211dc jal 0x00084770			--> 00084770 - 00084814
00084f70: 34050002 ori r5,r0,0x0002			r5 = 2
00084f74: 08021234 j 0x000848d0			queue next command
00084f78: 3282ffff andi r2,r20,0xffff			r2 = animation

Move Down 1

00084f7c: 02602021 addu r4,r19,r0			r4 = unit Misc data
00084f80: 0c0211d6 jal 0x00084758			--> 00084758 - 0008476c the definitely not float routine
00084f84: 34050001 ori r5,r0,0x0001			r5 = 1
00084f88: 08021234 j 0x000848d0			queue next command
00084f8c: 3282ffff andi r2,r20,0xffff			r2 = animation

Move Down 2

00084f90: 02602021 addu r4,r19,r0
00084f94: 0c0211d6 jal 0x00084758			--> 00084758 - 0008476c the definitely not float routine
00084f98: 34050002 ori r5,r0,0x0002
00084f9c: 08021234 j 0x000848d0			queue next command
00084fa0: 3282ffff andi r2,r20,0xffff

Move Backward 1

00084fa4: 02602021 addu r4,r19,r0
00084fa8: 0c0211dc jal 0x00084770			--> 00084770 - 00084814
00084fac: 2405ffff addiu r5,r0,0xffff			r5 = -1
00084fb0: 08021234 j 0x000848d0
00084fb4: 3282ffff andi r2,r20,0xffff

Move Backward 2

00084fb8: 02602021 addu r4,r19,r0
00084fbc: 0c0211dc jal 0x00084770			--> 00084770 - 00084814
00084fc0: 2405fffe addiu r5,r0,0xfffe			r5 = -2
00084fc4: 08021234 j 0x000848d0
00084fc8: 3282ffff andi r2,r20,0xffff

Move Up 1

00084fcc: 02602021 addu r4,r19,r0
00084fd0: 0c0211d6 jal 0x00084758			--> 00084758 - 0008476c the definitely not float routine
00084fd4: 2405ffff addiu r5,r0,0xffff			r5 = -1
00084fd8: 08021234 j 0x000848d0
00084fdc: 3282ffff andi r2,r20,0xffff

Move Up 2

00084fe0: 02602021 addu r4,r19,r0
00084fe4: 0c0211d6 jal 0x00084758			--> 00084758 - 0008476c the definitely not float routine
00084fe8: 2405fffe addiu r5,r0,0xfffe			r5 = -2
00084fec: 08021234 j 0x000848d0
00084ff0: 3282ffff andi r2,r20,0xffff

Load Move-Find Item

00084ff4: 34020001 ori r2,r0,0x0001			r2 = 1
00084ff8: 08021233 j 0x000848cc			queue next command
00084ffc: a26202d0 sb r2,0x02d0(r19)			save 1 to item display

Unload Move-Find Item

00085000: 08021233 j 0x000848cc
00085004: a26002d0 sb r0,0x02d0(r19)			save 0 to item display?

Wait For Controller Input

00085008: 3c02800a lui r2,0x800a
0008500c: 8c428db8 lw r2,-0x7248(r2)			post action check?
00085010: 00000000 nop
00085014: 10400043 beq r2,r0,0x00085124		@branch if 0
00085018: 3282ffff andi r2,r20,0xffff			r2 = animation
0008501c: 08021234 j 0x000848d0			queue next command
00085020: 26520001 addiu r18,r18,0x0001		r18 = counter + 1

Play Attack Sound as Per Weapon Type

00085024: 02401021 addu r2,r18,r0			r2 = counter
00085028: 26520001 addiu r18,r18,0x0001		r18 = counter + 1
0008502c: 3283ffff andi r3,r20,0xffff			r3 = animation
00085030: 00031880 sll r3,r3,0x02
00085034: 00761821 addu r3,r3,r22
00085038: 00021400 sll r2,r2,0x10
0008503c: 8c630008 lw r3,0x0008(r3)			frame command pointer
00085040: 00021403 sra r2,r2,0x10
00085044: 00621821 addu r3,r3,r2
00085048: 90650000 lbu r5,0x0000(r3)			third frame command
0008504c: 0c020988 jal 0x00082620			--> 00082620 - 00082788
00085050: 02602021 addu r4,r19,r0			r4 = misc unit data
00085054: 08021234 j 0x000848d0
00085058: 3282ffff andi r2,r20,0xffff			r2 = animation

Weapon Sheathe Check 1

0008505c: 3c028009 lui r2,0x8009
00085060: 8c42612c lw r2,0x612c(r2)			weapon sheathe check
00085064: 34080001 ori r8,r0,0x0001
00085068: 1048002e beq r2,r8,0x00085124		@branch if 1
0008506c: 3282ffff andi r2,r20,0xffff
00085070: 08021234 j 0x000848d0			queue next command otherwise
00085074: 26520001 addiu r18,r18,0x0001		counter + 1

Set Move-Find Item Position

00085078: 3284ffff andi r4,r20,0xffff			r4 = animation
0008507c: 00042080 sll r4,r4,0x02			anim * 4
00085080: 00962021 addu r4,r4,r22
00085084: 00121400 sll r2,r18,0x10
00085088: 8c830008 lw r3,0x0008(r4)			frame command pointer
0008508c: 00021403 sra r2,r2,0x10
00085090: 00621821 addu r3,r3,r2
00085094: 90620000 lbu r2,0x0000(r3)			3rd frame command
00085098: 26450001 addiu r5,r18,0x0001			r5 = counter + 1
0008509c: a26202d2 sb r2,0x02d2(r19)			save 3rd byte to whatever this is lmao
000850a0: 00051400 sll r2,r5,0x10
000850a4: 8c830008 lw r3,0x0008(r4)			frame command pointer again
000850a8: 00021403 sra r2,r2,0x10
000850ac: 00621821 addu r3,r3,r2
000850b0: 90620000 lbu r2,0x0000(r3)			4th byte
000850b4: 24b20001 addiu r18,r5,0x0001			counter + 2
000850b8: 08021233 j 0x000848cc
000850bc: a26202d3 sb r2,0x02d3(r19)			save 4th byte to whatever that is lmao

Queue Secondary Sprite Distortion/Movement Animation

000850c0: 3284ffff andi r4,r20,0xffff			r4 = anim
000850c4: 00042080 sll r4,r4,0x02			anim * 4
000850c8: 00962021 addu r4,r4,r22
000850cc: 00121400 sll r2,r18,0x10
000850d0: 8c830008 lw r3,0x0008(r4)			frame command pointer
000850d4: 00021403 sra r2,r2,0x10
000850d8: 00621821 addu r3,r3,r2
000850dc: 90620000 lbu r2,0x0000(r3)			3rd command byte
000850e0: 26450001 addiu r5,r18,0x0001			r5 = counter + 1
000850e4: 24420002 addiu r2,r2,0x0002			r2 = 3rd byte + 2
000850e8: a2620087 sb r2,0x0087(r19)			Store 3rd byte as distortion type
000850ec: 00051400 sll r2,r5,0x10
000850f0: 8c830008 lw r3,0x0008(r4)			frame command pointer
000850f4: 00021403 sra r2,r2,0x10
000850f8: 00621821 addu r3,r3,r2
000850fc: 90620000 lbu r2,0x0000(r3)			4th byte
00085100: 24b20001 addiu r18,r5,0x0001			counter + 2
00085104: ae600088 sw r0,0x0088(r19)			clear distortion counter
00085108: 08021233 j 0x000848cc
0008510c: ae62008c sw r2,0x008c(r19)			save 4th byte as distortion variable (temp, per distort anim.)

Wait For Sprite Distortion/Movement Animation

00085110: 92620087 lbu r2,0x0087(r19)			load distortion animation check
00085114: 00000000 nop
00085118: 10400015 beq r2,r0,0x00085170		#branch if distortion animation is complete
0008511c: 00000000 nop						|
00085120: 3282ffff andi r2,r20,0xffff				|r2 = animation
00085124: 00021080 sll r2,r2,0x02				@command 0xffd3 and 0xffc6 branch here
00085128: 00561021 addu r2,r2,r22				|
0008512c: 00121c00 sll r3,r18,0x10				|
00085130: 8c420008 lw r2,0x0008(r2)				|frame command pointer
00085134: 00031c03 sra r3,r3,0x10				|
00085138: 00431021 addu r2,r2,r3				|
0008513c: 90420000 lbu r2,0x0000(r2)				|load 3rd byte
00085140: 00000000 nop						|
00085144: 00021600 sll r2,r2,0x18				|
00085148: 00022e03 sra r5,r2,0x18				|move 3rd byte to r5
0008514c: 2642fffe addiu r2,r18,0xfffe				|r2 = counter - 2
00085150: 08021233 j 0x000848cc				|queue next command
00085154: 00a29021 addu r18,r5,r2				|r18 = counter - 2 + 3rd byte

Is this... erroneous?

00085158: 0c01fc90 jal 0x0007f240				|0007f240 - 0007f2a8
0008515c: 02602021 addu r4,r19,r0				|r4 = unit misc data
00085160: 08021234 j 0x000848d0				|queue next command
00085164: 3282ffff andi r2,r20,0xffff				|r2 = animation

Initialise ?

00085168: 08021233 j 0x000848cc				|queue next command
0008516c: ae6002e8 sw r0,0x02e8(r19)				|clears 'unused section'.

Nop 1 arg

00085170: 08021233 j 0x000848cc			#queue next command
00085174: 26520001 addiu r18,r18,0x0001		counter + 1

Return Error & Finish Animation

00085178: 08021231 j 0x000848c4			queue some error check, deletes weapons if check is triggered. unsure about units.
0008517c: 3404000d ori r4,r0,0x000d			r4 = 0xd

Load Frame and Wait

00085180: 00021403 sra r2,r2,0x10			continues moving counter to r2
00085184: 00a21021 addu r2,r5,r2			r2 = location of 1st byte
00085188: 96a30014 lhu r3,0x0014(r21)			load frame offset
0008518c: 90420000 lbu r2,0x0000(r2)			load 2nd byte
00085190: 26440001 addiu r4,r18,0x0001			r4 = counter + 1
00085194: 13c00011 beq r30,r0,0x000851dc		#branch if wait frames = 0
00085198: 00628021 addu r16,r3,r2				|absolute frame (to load, command frame + frame offset)
0008519c: 00041400 sll r2,r4,0x10				|
000851a0: 00021403 sra r2,r2,0x10				|r2 = counter + 1
000851a4: 00a21021 addu r2,r5,r2				|location of 2nd byte
000851a8: 90420000 lbu r2,0x0000(r2)				|load 2nd byte
000851ac: 96a30012 lhu r3,0x0012(r21)				|load frame delay
000851b0: 00000000 nop						|
000851b4: 00431021 addu r2,r2,r3				|add 2nd byte and frame delay
000851b8: a6a2000a sh r2,0x000a(r21)				|save to amount of frames to not update sprite
000851bc: 96a2000a lhu r2,0x000a(r21)			#load wait frames
000851c0: 00000000 nop
000851c4: 2c420101 sltiu r2,r2,0x0101			r2 = true if wait frames < 0x101
000851c8: 14400005 bne r2,r0,0x000851e0		#branch if wait frames > 0x101
000851cc: 24920001 addiu r18,r4,0x0001				|r18 = counter + 2
000851d0: 34020001 ori r2,r0,0x0001				|r2 = 1
000851d4: 08021478 j 0x000851e0				#jump ahead
000851d8: a6a2000a sh r2,0x000a(r21)				|save 1 to wait frames if wait frames exceed 0x100
000851dc: 24920001 addiu r18,r4,0x0001				|skipped?
000851e0: 02602021 addu r4,r19,r0			#r4 = unit misc data
000851e4: 02a02821 addu r5,r21,r0			r5 = unit sprite data
000851e8: 3206ffff andi r6,r16,0xffff			r6 = load frame
000851ec: 0c021085 jal 0x00084214			--> 00084214 - 000846ac the actual graphic loading part of the graphic loading routine. the thing that. loads the rotation.
000851f0: 02e03821 addu r7,r23,r0			r7 = animation
000851f4: a6b20006 sh r18,0x0006(r21)			save counter to unit sprite data
000851f8: a6b00008 sh r16,0x0008(r21)			save first byte + speed(?) to frame (I wonder how the math works out on that one)
000851fc: a6b70004 sh r23,0x0004(r21)			save animation to unit animation
00085200: 8fbf003c lw r31,0x003c(r29)
00085204: 8fbe0038 lw r30,0x0038(r29)
00085208: 8fb70034 lw r23,0x0034(r29)
0008520c: 8fb60030 lw r22,0x0030(r29)
00085210: 8fb5002c lw r21,0x002c(r29)
00085214: 8fb40028 lw r20,0x0028(r29)
00085218: 8fb30024 lw r19,0x0024(r29)
0008521c: 8fb20020 lw r18,0x0020(r29)
00085220: 8fb1001c lw r17,0x001c(r29)
00085224: 8fb00018 lw r16,0x0018(r29)
00085228: 27bd0040 addiu r29,r29,0x0040
0008522c: 03e00008 jr r31
00085230: 00000000 nop