Load WEP/EFF graphics from WEP1/EFF Sheet

From Final Fantasy Hacktics Wiki
Revision as of 11:47, 25 July 2024 by MrGudenheim (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Load WEP graphic from WEP1 Sheet 
Expects r4 = pointer to miscellaneous unit data
Expects r5 = WEP1 or EFF sprite data
Expects r6 to be palette ID
 
 0008526c: 27bdff98 addiu r29,r29,0xff98
 00085270: afbe0060 sw r30,0x0060(r29)
 00085274: 0080f021 addu r30,r4,r0			r30 = Points to misc. unit data data
 00085278: afb3004c sw r19,0x004c(r29)
 0008527c: 00a09821 addu r19,r5,r0			r19 = WEP sprite data
 00085280: afb7005c sw r23,0x005c(r29)
 00085284: 00e0b821 addu r23,r7,r0			r23 = value?
 00085288: afbf0064 sw r31,0x0064(r29)
 0008528c: afb60058 sw r22,0x0058(r29)
 00085290: afb50054 sw r21,0x0054(r29)
 00085294: afb40050 sw r20,0x0050(r29)
 00085298: afb20048 sw r18,0x0048(r29)
 0008529c: afb10044 sw r17,0x0044(r29)
 000852a0: afb00040 sw r16,0x0040(r29)
 000852a4: afa60028 sw r6,0x0028(r29)
 000852a8: 93c2013a lbu r2,0x013a(r30)			load used weapon
 000852ac: 96760004 lhu r22,0x0004(r19)		load current animation
 000852b0: 00021040 sll r2,r2,0x01			r2 = weapon ID * 2
 000852b4: 3c018009 lui r1,0x8009
 000852b8: 00220821 addu r1,r1,r2			r1 = 0x80090000 + ID * 2
 000852bc: 902243e5 lbu r2,0x43e5(r1)			load used weapon graphic ID
 000852c0: 96710006 lhu r17,0x0006(r19)		load frame command? Counter
 000852c4: 000210c0 sll r2,r2,0x03 
 000852c8: a7a20038 sh r2,0x0038(r29)			store used weapon graphic ID*8
 000852cc: 8e75001c lw r21,0x001c(r19)			load SHP data
 000852d0: 8e740020 lw r20,0x0020(r19)			load SEQ data
 000852d4: 16e00002 bne r23,r0,0x000852e0		#branch if value(?) != 0
 000852d8: 32d0ffff andi r16,r22,0xffff			|r16 = animation #
 000852dc: 2631fffe addiu r17,r17,0xfffe			|counter - 2
 000852e0: 2e020101 sltiu r2,r16,0x0101		set if animation < 0x101
 000852e4: 14400004 bne r2,r0,0x000852f8		#branch if so
 000852e8: 00101080 sll r2,r16,0x02				|animation*4
 000852ec: 0c011282 jal 0x00044a08				|--> 00044a08 - 00044a30 Also clears something. I dunno what it is though.
 000852f0: 34040009 ori r4,r0,0x0009				|clears r4 and moves 0x09 to r5. for some reason.
 000852f4: 00101080 sll r2,r16,0x02				|r2 = weapon anim*4
 000852f8: 00541021 addu r2,r2,r20			r2 = WP anim*4 + SEQ data location
 000852fc: 8c430000 lw r3,0x0000(r2)			load frame commands? Pointer from SEQ table (Make a new page for SEQ and SHP?)
 00085300: 2402ffff addiu r2,r0,0xffff			this seems to be a rather redundant check for garbage data.
 00085304: 14620005 bne r3,r2,0x0008531c		#branch if Frame command pointer is not 0xffff
 00085308: 00161880 sll r3,r22,0x02				|r3 = weapon anim*4
 0008530c: 34040009 ori r4,r0,0x0009				|r4 = 0x9
 00085310: 0c011282 jal 0x00044a08				|--> 00044a08 - 00044a30 clears r4 and moves to r5
 00085314: 00000000 nop					|
 00085318: 00161880 sll r3,r22,0x02				|r3 = weapon anim*4
 0008531c: 00741821 addu r3,r3,r20			animation*4 + SEQ data
 00085320: 00111400 sll r2,r17,0x10			r2 = r17 * 2^16
 00085324: 8c650000 lw r5,0x0000(r3)			Load Frame commands? pointer from SEQ table AGAIN
 00085328: 00021403 sra r2,r2,0x10			r2 = first halfword of r17 (even though it was already a halfword and unsigned)
 0008532c: 00a21021 addu r2,r5,r2			r2 = frame command counter + frame command location
 00085330: 90430000 lbu r3,0x0000(r2)			load Frame command
 00085334: 340200ff ori r2,r0,0x00ff
 00085338: 146200f5 bne r3,r2,0x00085710		#branch if frame command is not ff
 0008533c: 00111c00 sll r3,r17,0x10				|r3 = r17 * 2^16 (Moves halfword to upper half)
 00085340: 26230001 addiu r3,r17,0x0001			|r3 = r17 + 1
 00085344: 00031400 sll r2,r3,0x10				|in the event that the first frame command? = ff, another 1 is added to r2, and increment is increased by an additional 1, also.
 00085348: 00021403 sra r2,r2,0x10				|a stupid long way of moving r17 to r2
 0008534c: 00a21021 addu r2,r5,r2				|r2 = r2 + r5
 00085350: 90420000 lbu r2,0x0000(r2)				|Load frame command?
 00085354: 24710001 addiu r17,r3,0x0001			|r17 = r3 + 1
 00085358: 2443ff2d addiu r3,r2,0xff2d				|r3 = frame command? - 0xd3
 0008535c: 2c62002d sltiu r2,r3,0x002d				|set r2 = true if r3 < 0x00d2 (if frame command > 0xd3)
 00085360: 104000e9 beq r2,r0,0x00085708			#branch if not true (continues beyond table)
 00085364: 00031080 sll r2,r3,0x02					|r2 = r3 * 4 (location pointer)
 00085368: 3c018007 lui r1,0x8007					|
 0008536c: 00220821 addu r1,r1,r2					|r1 = 0x80070000 + r2
 00085370: 8c228028 lw r2,-0x7fd8(r1)					|loads a word from the table at this location, based on weapon and angle (Link a new page with the table here?)
 							Frame Command = 
 								0xd3: 0x800856b8 (skipped by above conditional)
 								0xd4: 0x80085708
 								0xd5: 0x800853b4
 								0xd6: 0x80085420
 								0xd7: 0x80085700
 								0xd8: 0x800854a4
 								0xd9: 0x800853d4
 								0xda: 0x80085708
 								0xdb: 0x80085470
 								0xdc: 0x800853e4
 								0xdd: 0x800854d8
 								0xde: 0x80085318 (jumps further back in routine)
 								0xdf: 0x800853c8
 							  0xe0, 0xe1: 0x80085318 (^)
 								0xe2: 0x800853f4
 							  0xe3, 0xe4: 0x80085700
 								0xe5: 0x80085668
 						    0xe6, 0xe7, 0xe8: 0x800853dc
 								0xe9: 0x80085700
 								0xea: 0x800853dc
 								0xeb: 0x80085394
 								0xec: 0x80085380
 					0xed, 0xee, 0xef, 0xf0, 0xf1: 0x80085700
 								0xf2: 0x800855ec
 						    0xf3, 0xf4, 0xf5: 0x80085700
 								0xf6: 0x8008543c
 								0xf7: 0x800856b0
 								0xf8: 0x800853dc
 								0xf9: 0x8008550c
 								0xfa: 0x800856b0
 								0xfb: 0x800853dc
 								0xfc: 0x80085570
 								0xfd: 0x800856cc
 								0xfe: 0x800853a8
 								0xff: 0x800853ac
 00085374: 00000000 nop
 00085378: 00400008 jr r2					jumps to address
 0008537c: 00000000 nop
 00085380: 96620018 lhu r2,0x0018(r19)			Load rotation flags
 00085384: 00000000 nop
 00085388: 38420002 xori r2,r2,0x0002			flips horizontal bitflag
 0008538c: 080214c6 j 0x00085318			Engage next frame command
 00085390: a6620018 sh r2,0x0018(r19)			Save new rotation flag
 00085394: 96620018 lhu r2,0x0018(r19)			load rotation flags
 00085398: 00000000 nop
 0008539c: 38420004 xori r2,r2,0x0004			flips vertical bitflag
 000853a0: 080214c6 j 0x00085318			Engage next frame command
 000853a4: a6620018 sh r2,0x0018(r19)			save new rotation flag
 000853a8: a6600000 sh r0,0x0000(r19)			clears graphic trigger
 000853ac: 08021679 j 0x000859e4			finish routine
 000853b0: a660000a sh r0,0x000a(r19)			clear frame + frame delay + frame command
 000853b4: 9662000c lhu r2,0x000c(r19)			Loads loop count
 000853b8: 00008821 addu r17,r0,r0			clear frame command byte indicator
 000853bc: 24420001 addiu r2,r2,0x0001			increment loop count
 000853c0: 080214c6 j 0x00085318			Engage next frame command
 000853c4: a662000c sh r2,0x000c(r19)			saves new loop count
 000853c8: 8e620024 lw r2,0x0024(r19)			Load ? display data pointer
 000853cc: 080214c6 j 0x00085318			engage next frame command 
 000853d0: a440000c sh r0,0x000c(r2)			clear spin on Y axis
 000853d4: 0c01a269 jal 0x000689a4			Set evade type data, item and throw stone hardcoding
 000853d8: 03c02021 addu r4,r30,r0			moves misc unit data into r4
 000853dc: 080214c6 j 0x00085318			queue next frame command
 000853e0: 26310002 addiu r17,r17,0x0002		increment frame command byte indicator by 2
 000853e4: 96710010 lhu r17,0x0010(r19)		?
 000853e8: 9676000e lhu r22,0x000e(r19)		Load Weapon animation from WEP1 data
 000853ec: 080214c7 j 0x0008531c			engage next frame command
 000853f0: 00161880 sll r3,r22,0x02			r3 = Weapon anim*4 (in case of error?)
 000853f4: 00161880 sll r3,r22,0x02			move weapon anim * 4 to r3
 000853f8: 00741821 addu r3,r3,r20			weapon animation's SEQ data
 000853fc: 02201021 addu r2,r17,r0			r2 = frame command byte indicator
 00085400: 00021400 sll r2,r2,0x10			why
 00085404: 8c630000 lw r3,0x0000(r3)			load spritesheet data
 00085408: 00021403 sra r2,r2,0x10			dumb compiler
 0008540c: 00621821 addu r3,r3,r2			r3 = r3 + r2
 00085410: 90620000 lbu r2,0x0000(r3)			load Frame delay
 00085414: 26310001 addiu r17,r17,0x0001		increment frame counter
 00085418: 080214c6 j 0x00085318			queue next frame command
 0008541c: a7c20014 sh r2,0x0014(r30)			save Frame delay to unit Misc data
 00085420: 3c028009 lui r2,0x8009
 00085424: 8c42612c lw r2,0x612c(r2)			load weapon sheathe check
 00085428: 00000000 nop
 0008542c: 144000a8 bne r2,r0,0x000856d0		#branch if not yet sheathing
 00085430: 00161080 sll r2,r22,0x02				|r2 = weapon anim*4
 00085434: 080214c6 j 0x00085318				|engage next command
 00085438: 26310001 addiu r17,r17,0x0001       		|increment frame command pointer by 1 (branch continues beyond here)
 0008543c: 02201021 addu r2,r17,r0			move frame command byte counter to r2
 00085440: 26310001 addiu r17,r17,0x0001		increment counter
 00085444: 00161880 sll r3,r22,0x02			weapon anim * 4
 00085448: 00741821 addu r3,r3,r20			Weapon anim's SEQ data
 0008544c: 00021400 sll r2,r2,0x10			queue bullshit
 00085450: 8c630000 lw r3,0x0000(r3)			Load frame command pointer
 00085454: 00021403 sra r2,r2,0x10			continued bullshit
 00085458: 00621821 addu r3,r3,r2			r3 = location of frame command
 0008545c: 90650000 lbu r5,0x0000(r3)			Load frame command byte
 00085460: 0c01ae58 jal 0x0006b960			0006b960 - 0006b990 seems to be an input-y thing
 00085464: 03c02021 addu r4,r30,r0			r4 = Unit misc data
 00085468: 080214c7 j 0x0008531c			queue next frame command
 0008546c: 00161880 sll r3,r22,0x02			r3 = weapon anim * 4
 00085470: 00161880 sll r3,r22,0x02			r3 = weapon anim * 4
 00085474: 00741821 addu r3,r3,r20			Weapon anim's SEQ Data
 00085478: 02201021 addu r2,r17,r0			r2 = frame command byte counter
 0008547c: 00021400 sll r2,r2,0x10			
 00085480: 8c630000 lw r3,0x0000(r3)			Load spritesheet data
 00085484: 00021403 sra r2,r2,0x10
 00085488: 00621821 addu r3,r3,r2			Weapon anim's spritesheet data
 0008548c: 90620000 lbu r2,0x0000(r3)			Load Frame delay
 00085490: 26310001 addiu r17,r17,0x0001		increment counter
 00085494: 00021600 sll r2,r2,0x18			
 00085498: 00021603 sra r2,r2,0x18
 0008549c: 080214c6 j 0x00085318			Next command, with new frame delay :D
 000854a0: a6620012 sh r2,0x0012(r19)			Save frame delay
 000854a4: 00161880 sll r3,r22,0x02			Weapon anim * 4
 000854a8: 00741821 addu r3,r3,r20			spritesheet data + weapon anim * 4
 000854ac: 02201021 addu r2,r17,r0			Move counter to r2
 000854b0: 00021400 sll r2,r2,0x10
 000854b4: 8c630000 lw r3,0x0000(r3)			frame command pointer
 000854b8: 00021403 sra r2,r2,0x10			compiler please
 000854bc: 00621821 addu r3,r3,r2			frame command pointer + counter
 000854c0: 90620000 lbu r2,0x0000(r3)			Load byte at this location
 000854c4: 26310001 addiu r17,r17,0x0001		increment counter
 000854c8: 00021600 sll r2,r2,0x18
 000854cc: 00021603 sra r2,r2,0x18
 000854d0: 080214c6 j 0x00085318			next command
 000854d4: a6620014 sh r2,0x0014(r19)			Save frame command byte to weapon rotation
 000854d8: 00161080 sll r2,r22,0x02			Weapon anim * 4
 000854dc: 00541021 addu r2,r2,r20			Weapon anim's SEQ data
 000854e0: 02201821 addu r3,r17,r0			r3 = frame command byte counter
 000854e4: 00031c00 sll r3,r3,0x10			
 000854e8: a676000e sh r22,0x000e(r19)			save weapon animation to WEP1 data
 000854ec: 8c420000 lw r2,0x0000(r2)			load command pointer
 000854f0: 00031c03 sra r3,r3,0x10
 000854f4: 00431021 addu r2,r2,r3			Load location of byte of current frame command
 000854f8: 90560000 lbu r22,0x0000(r2)			load byte to weapon anim (override? :O)
 000854fc: 26310001 addiu r17,r17,0x0001		increment counter + 1
 00085500: a6710010 sh r17,0x0010(r19)			save counter to WEP1 data
 00085504: 080214c6 j 0x00085318			queue next command
 00085508: 00008821 addu r17,r0,r0			clear counter
 0008550c: 00162080 sll r4,r22,0x02			r4 = weapon anim * 4
 00085510: 00942021 addu r4,r4,r20			Weapon anim's SEQ data
 00085514: 00111400 sll r2,r17,0x10			moves counter to r2
 00085518: 00021403 sra r2,r2,0x10
 0008551c: 26250001 addiu r5,r17,0x0001		increment counter into r5
 00085520: 8c830000 lw r3,0x0000(r4)			Load spritesheet data
 00085524: 24b10001 addiu r17,r5,0x0001		r17 = counter + 2
 00085528: 00621821 addu r3,r3,r2			
 0008552c: 90620000 lbu r2,0x0000(r3)			loads ?
 00085530: 97c30058 lhu r3,0x0058(r30)			loads some vector value?
 00085534: 00021600 sll r2,r2,0x18
 00085538: 00021603 sra r2,r2,0x18
 0008553c: 00431021 addu r2,r2,r3			r2 = r2 + r3
 00085540: a7c20058 sh r2,0x0058(r30)			save new value
 00085544: 00051400 sll r2,r5,0x10			sure, poggers your royal pain in the ass.
 00085548: 8c830000 lw r3,0x0000(r4)			load command pointer
 0008554c: 00021403 sra r2,r2,0x10
 00085550: 00621821 addu r3,r3,r2			add ? and command pointer
 00085554: 90620000 lbu r2,0x0000(r3)			load the command byte here
 00085558: 97c3005a lhu r3,0x005a(r30)			Load another vector value? 
 0008555c: 00021600 sll r2,r2,0x18
 00085560: 00021603 sra r2,r2,0x18
 00085564: 00431021 addu r2,r2,r3			Add the vector value to the command byte (not even related to the command? I don't think?)
 00085568: 080214c6 j 0x00085318
 0008556c: a7c2005a sh r2,0x005a(r30)			Save new value
 00085570: 26260001 addiu r6,r17,0x0001		r6 = counter + 1
 00085574: 00112400 sll r4,r17,0x10			r4 = counter
 00085578: 24d10001 addiu r17,r6,0x0001		r17 = counter + 2
 0008557c: 00161080 sll r2,r22,0x02			r2 = weapon anim * 4
 00085580: 00541021 addu r2,r2,r20			load weapon anim's SEQ data
 00085584: 00042403 sra r4,r4,0x10
 00085588: 8c430000 lw r3,0x0000(r2)			Load command pointer
 0008558c: 00061400 sll r2,r6,0x10
 00085590: 00021403 sra r2,r2,0x10
 00085594: 00642021 addu r4,r3,r4			r4 = command pointer + counter
 00085598: 00621821 addu r3,r3,r2			r3 = command pointer + counter + 1
 0008559c: 90820000 lbu r2,0x0000(r4)			load third command byte
 000855a0: 90640000 lbu r4,0x0000(r3)			load fourth command byte
 000855a4: 96630016 lhu r3,0x0016(r19)			?
 000855a8: 00021600 sll r2,r2,0x18
 000855ac: 1060000b beq r3,r0,0x000855dc		branch if ? = 0
 000855b0: 00022e03 sra r5,r2,0x18				|r5 = 3rd byte
 000855b4: 96620016 lhu r2,0x0016(r19)				|load ? again
 000855b8: 00000000 nop					|
 000855bc: 2442ffff addiu r2,r2,0xffff				|? - 1
 000855c0: a6620016 sh r2,0x0016(r19)				|Save ? - 1
 000855c4: 3042ffff andi r2,r2,0xffff				|does nothing
 000855c8: 1040ff54 beq r2,r0,0x0008531c			#Branch back to start of routine if ? - 1 = 0
 000855cc: 00161880 sll r3,r22,0x02				|r3 = weapon anim * 4
 000855d0: 24c2fffd addiu r2,r6,0xfffd				|r2 = counter - 2
 000855d4: 080214c7 j 0x0008531c				|load next command
 000855d8: 00a28821 addu r17,r5,r2				|r17 = 3rd byte + counter - 2
 000855dc: 24c2fffd addiu r2,r6,0xfffd			r2 = counter - 2
 000855e0: 00a28821 addu r17,r5,r2			r17 = 3rd byte + counter - 2
 000855e4: 080214c6 j 0x00085318			load next command
 000855e8: a6640016 sh r4,0x0016(r19)			save fourth command byte as ?
 000855ec: 26230001 addiu r3,r17,0x0001		Increment counter
 000855f0: 00112400 sll r4,r17,0x10			queue dumbass compiler doing stupid shit
 000855f4: 24710001 addiu r17,r3,0x0001		increment counter by 2
 000855f8: 00161080 sll r2,r22,0x02			r2 = weapon anim*4
 000855fc: 00541021 addu r2,r2,r20			weapon anim*4 + SEQ data pointer
 00085600: 00042403 sra r4,r4,0x10			Close dumbass compiler doing stupid shit
 00085604: 00031c00 sll r3,r3,0x10			queue even stupider shit
 00085608: 8c420000 lw r2,0x0000(r2)			Load frame command locations?
 0008560c: 00031c03 sra r3,r3,0x10			close even stupider shit
 00085610: 00442021 addu r4,r2,r4			get location of first frame command? (???)
 00085614: 00431021 addu r2,r2,r3			get location of second frame command? (???)
 00085618: 90900000 lbu r16,0x0000(r4)			Load first frame command?
 0008561c: 90520000 lbu r18,0x0000(r2)			Load second frame command?
 00085620: 16000004 bne r16,r0,0x00085634		#Branch if first frame command? is 0
 00085624: 00101040 sll r2,r16,0x01				|r2 = Frame command? * 2
 00085628: 0c011282 jal 0x00044a08				00044a08 - 00044a30 
 0008562c: 3404000d ori r4,r0,0x000d 				|Move 0x0d into r5, then clear r4.
 00085630: 00101040 sll r2,r16,0x01				|r2 = Frame command? * 2
 00085634: 00501021 addu r2,r2,r16			#r2 = Frame command? * 3
 00085638: 00021100 sll r2,r2,0x04			r2 = Frame command? * 30
 0008563c: 244201d8 addiu r2,r2,0x01d8			r2 = Frame command? * 30 + 0x1d8
 00085640: 03c21021 addu r2,r30,r2			r2 = Misc Unit data + Frame command * 30 + 0x1d8
 00085644: 34030001 ori r3,r0,0x0001			r3 = 0x1
 00085648: a4520004 sh r18,0x0004(r2)			Save second frame command?
 0008564c: a4400006 sh r0,0x0006(r2)			clears frame command counter
 00085650: a443000a sh r3,0x000a(r2)			saves 0x1 to Frame delay ++
 00085654: a4400012 sh r0,0x0012(r2)			clears frame delay
 00085658: a4400014 sh r0,0x0014(r2)			clears graphic rotation
 0008565c: a4400016 sh r0,0x0016(r2)			clears ??
 00085660: 080214c6 j 0x00085318			queue next command
 00085664: a4430000 sh r3,0x0000(r2)			saves 0x1 to graphic trigger
 00085668: 26230001 addiu r3,r17,0x0001		r3 = counter + 1
 0008566c: 00112400 sll r4,r17,0x10			r4 = counter
 00085670: 24710001 addiu r17,r3,0x0001		r17 = counter + 2
 00085674: 00161080 sll r2,r22,0x02			r2 = weapon anim * 4
 00085678: 00541021 addu r2,r2,r20			weapon anim's SEQ data
 0008567c: 00042403 sra r4,r4,0x10
 00085680: 00031c00 sll r3,r3,0x10
 00085684: 8c420000 lw r2,0x0000(r2)			load command pointer for anim
 00085688: 00031c03 sra r3,r3,0x10
 0008568c: 00442021 addu r4,r2,r4			r4 = location of 3rd byte
 00085690: 00431021 addu r2,r2,r3			r2 = location of 4th byte
 00085694: 90420000 lbu r2,0x0000(r2)			load 4th byte
 00085698: 90840000 lbu r4,0x0000(r4)			load 3rd byte
 0008569c: 8e630024 lw r3,0x0024(r19)			load ? display data
 000856a0: 00021200 sll r2,r2,0x08			move command to upper byte
 000856a4: 00822025 or r4,r4,r2			combine the two bytes together
 000856a8: 080214c6 j 0x00085318
 000856ac: a464000c sh r4,0x000c(r3)			Save byte combo to spin on Y axis
 000856b0: 080214c6 j 0x00085318
 000856b4: 26310003 addiu r17,r17,0x0003		r17 = r17 + 5
 000856b8: 3c038009 lui r3,0x8009
 000856bc: 8c63612c lw r3,0x612c(r3)			Weapon sheath check
 000856c0: 34020001 ori r2,r0,0x0001
 000856c4: 1462000e bne r3,r2,0x00085700		branch if weapon sheath check is not 1
 000856c8: 00000000 nop
 000856cc: 00161080 sll r2,r22,0x02			r2 = weapon anim * 4
 000856d0: 00541021 addu r2,r2,r20			r2 = location of frame command? Pointer
 000856d4: 00111c00 sll r3,r17,0x10			queue compiler bullshit
 000856d8: 8c420000 lw r2,0x0000(r2)			Load frame command? pointer
 000856dc: 00031c03 sra r3,r3,0x10			continued compiler bullshit
 000856e0: 00431021 addu r2,r2,r3			frame command location
 000856e4: 90420000 lbu r2,0x0000(r2)			Load frame command?
 000856e8: 00000000 nop				
 000856ec: 00021600 sll r2,r2,0x18			Frame command? * 2^18
 000856f0: 00022e03 sra r5,r2,0x18			Frame command? * 2^18 / 2^18 (this makes the number the conjugate negative number of itself (if the command was > 0x80) (0xf2 becomes -0xd))
 000856f4: 2622fffe addiu r2,r17,0xfffe		r2 = frame command counter - 2
 000856f8: 080214c6 j 0x00085318			jumps back to earlier in routine
 000856fc: 00a28821 addu r17,r5,r2			frame command counter = frame command counter - 2 - Frame command conjugate (wrap your head around that one)
 00085700: 080214c6 j 0x00085318
 00085704: 26310001 addiu r17,r17,0x0001
 00085708: 080214c4 j 0x00085310
 0008570c: 3404000d ori r4,r0,0x000d
 00085710: 00031c03 sra r3,r3,0x10			queue stupid method of moving frame counter to r3
 00085714: 00a31821 addu r3,r5,r3			r3 = frame command location + frame counter
 00085718: 93c2013b lbu r2,0x013b(r30)			load used weapon type
 0008571c: 90630000 lbu r3,0x0000(r3)			load 1st command byte
 00085720: 00021040 sll r2,r2,0x01			mod*2
 00085724: 00551021 addu r2,r2,r21			mod*2 + SHP data
 00085728: 94420000 lhu r2,0x0000(r2)			load first frame of weapon animation
 0008572c: 96640014 lhu r4,0x0014(r19)			load frame offset
 00085730: 00621821 addu r3,r3,r2			frame + 0 frame
 00085734: 00832021 addu r4,r4,r3			r4 = frame + offset + 0 frame
 00085738: a7a40030 sh r4,0x0030(r29)			store frame + offset + 0 frame
 0008573c: 12e0000a beq r23,r0,0x00085768		#branch if wait = 0
 00085740: 26240001 addiu r4,r17,0x0001			|increment Frame command counter?
 00085744: 00041400 sll r2,r4,0x10				|
 00085748: 00021403 sra r2,r2,0x10				|queue further stupidity moving register values
 0008574c: 00a21021 addu r2,r5,r2				|SHP data location + increment?
 00085750: 90420000 lbu r2,0x0000(r2)				|load delay
 00085754: 96630012 lhu r3,0x0012(r19)				|load current wait
 00085758: 24910001 addiu r17,r4,0x0001			|increment frame command counter again?
 0008575c: 00431021 addu r2,r2,r3				|r2 = delay + wait
 00085760: 080215db j 0x0008576c				|jump ahead
 00085764: a662000a sh r2,0x000a(r19)				|store
 00085768: 24910001 addiu r17,r4,0x0001		increments r17 if building next frame
 0008576c: 97a30030 lhu r3,0x0030(r29)			Load frame + weapon rotation + 1st byte
 00085770: 00000000 nop
 00085774: 00031080 sll r2,r3,0x02			r2 = r3*4
 00085778: 00551021 addu r2,r2,r21			WEP SHP Data
 0008577c: 2c630201 sltiu r3,r3,0x0201			Set r3 = true if r3 is less than 0x201
 00085780: 8c550040 lw r21,0x0040(r2)			Loads a spritesheet pointer?
 00085784: 14600004 bne r3,r0,0x00085798		#branch if r3 is less than 0x201
 00085788: 2402ffff addiu r2,r0,0xffff				|r2 = 0xffffffff
 0008578c: 0c011282 jal 0x00044a08				|--> 00044a08 - 00044a30 moves r4 to r5 and clears r4
 00085790: 34040008 ori r4,r0,0x0008				|defunct error routine
 00085794: 2402ffff addiu r2,r0,0xffff				|r2 = 0xffffffff
 00085798: 16a20003 bne r21,r2,0x000857a8		#Branch if r21 pointer is not invalid. fairly easy to manage in all honesty
 0008579c: 00000000 nop					|
 000857a0: 0c011282 jal 0x00044a08				|--> 00044a08 - 00044a30 moves r4 to r5 and clears r4
 000857a4: 34040008 ori r4,r0,0x0008				|r4 = 0x08
 
 000857a8: 92a20000 lbu r2,0x0000(r21)			Load WEP//EFF spritesheet data
 000857ac: 8e720024 lw r18,0x0024(r19)			load Display data (either for WEP or EFF)
 000857b0: 30420007 andi r2,r2,0x0007			No. graphics to load
 000857b4: 24420001 addiu r2,r2,0x0001              r2 = r2 + 1
 000857b8: a2420003 sb r2,0x0003(r18)               saves number of attacking sprites to display
 000857bc: 92a30000 lbu r3,0x0000(r21)              load WEP//EFF spritesheet data
 000857c0: 00000000 nop
 000857c4: 000318c2 srl r3,r3,0x03                  r3 = r3/8
 000857c8: 00031840 sll r3,r3,0x01                  r3 = r3*2 (filters out rotation pointer, then makes it a pointer)
 000857cc: 3c018009 lui r1,0x8009
 000857d0: 00230821 addu r1,r1,r3
 000857d4: 94244508 lhu r4,0x4508(r1)                load spin on Y axis?
 000857d8: 00000000 nop
 000857dc: a644000c sh r4,0x000c(r18)                store spin on Y axis?
 000857e0: 97c30012 lhu r3,0x0012(r30)               load action halfword? (transparent checks, and moving/acting?)
 000857e4: 00000000 nop
 000857e8: 30630002 andi r3,r3,0x0002                checks for moving/acting? (if the weapon is animated)
 000857ec: 10600003 beq r3,r0,0x000857fc             branch if not animated? acting? (branch if weapon is not animated for this frame (moving from its current position)
 000857f0: 305400ff andi r20,r2,0x00ff               move r2 to r20
 000857f4: 00041023 subu r2,r0,r4                    r2 = - Y axis spin
 000857f8: a642000c sh r2,0x000c(r18)                store - Y axis spin?
 000857fc: 2e820004 sltiu r2,r20,0x0004              set r2 = true if r20 < 0x4
 00085800: 14400002 bne r2,r0,0x0008580c             branch if so
 00085804: 34020001 ori r2,r0,0x0001                 r2 = 1
 00085808: 34140003 ori r20,r0,0x0003                r20 = 3
 0008580c: 96630002 lhu r3,0x0002(r19)               load graphic type (1 is weapon, 2 is Effect)
 00085810: 92b70001 lbu r23,0x0001(r21)              load Weapon's EFF graphic bitflags from WEP1 SHP data
 00085814: 10620005 beq r3,r2,0x0008582c             Branch if graphic type = Weapon
 00085818: 34020002 ori r2,r0,0x0002                 r2 = 2
 0008581c: 1062003a beq r3,r2,0x00085908             Branch if graphic type = Effect
 00085820: 32e20060 andi r2,r23,0x0060               moves 0x40, 0x20 bit flags to r2
 00085824: 08021675 j 0x000859d4
 00085828: a6710006 sh r17,0x0006(r19)               Saves byte command counter to WEP Data
 WEP
 0008582c: 32e20060 andi r2,r23,0x0060               moves 0x40 and 0x20 bit flags into r2?
 00085830: 34420009 ori r2,r2,0x0009                 r2 = all previous flags + 0x8, 0x1 (? and transparent)
 00085834: 00008021 addu r16,r0,r0                   clears r16
 00085838: a6420004 sh r2,0x0004(r18)                store Effect Graphic Bitflags
 0008583c: 8fac0028 lw r12,0x0028(r29)               load Graphic palette? (r6 from start of routine)
 00085840: 97c20010 lhu r2,0x0010(r30)               load VRAM Palette ID
 00085844: 000c1980 sll r3,r12,0x06                  r3 = r12 * 64
 00085848: 00431021 addu r2,r2,r3                    r2 = VRAM Palette + r3
 0008584c: 24420080 addiu r2,r2,0x0080               r2 + 0x80
 00085850: 1280005f beq r20,r0,0x000859d0            branch if r20 = 0
 00085854: a6420006 sh r2,0x0006(r18)                store VRAM palette ID + other nonsense
 00085858: 3205ffff andi r5,r16,0xffff               r5 = r16 (number of sprites already loaded from WEP1 spritesheet)
 0008585c: 00051080 sll r2,r5,0x02                   r2 = r5 * 4 
 00085860: 24420002 addiu r2,r2,0x0002               r2 = r2 + 2
 00085864: 02a21021 addu r2,r21,r2                    WEP1 SHP + Graphic location
 00085868: 02402021 addu r4,r18,r0                   r4 = graphic Display data
 0008586c: 26100001 addiu r16,r16,0x0001             count number of WEP sprites loaded this frame
 00085870: 944b0002 lhu r11,0x0002(r2)               load Graphic size?? (and tile offset??)
 00085874: 80460000 lb r6,0x0000(r2)                 load X Shift
 00085878: 80470001 lb r7,0x0001(r2)                  load Y Shift
 0008587c: 97ac0038 lhu r12,0x0038(r29)              load weapon graphic ID*8 (in battle sprite from WEP1)
 00085880: 31633c00 andi r3,r11,0x3c00              r3 = size reference?
 00085884: 000319c2 srl r3,r3,0x07                  r3 = size (?) / 128
 00085888: 316203ff andi r2,r11,0x03ff              r2 = Y Tile offset (total tile offset?)
 0008588c: 3048001f andi r8,r2,0x001f               r8 = X tile offset
 00085890: 000840c0 sll r8,r8,0x03                  X offset*8
 00085894: 00021142 srl r2,r2,0x05                  offset/32
 00085898: 000210c0 sll r2,r2,0x03                  offset/32 * 8 (gets rid of X offset?)
 0008589c: 01821021 addu r2,r12,r2                  weapon graphic ID*8 + offset/32 * 8
 000858a0: 3c018009 lui r1,0x8009
 000858a4: 00230821 addu r1,r1,r3                   r1 = 0x80090000 + r3 (size?)
 000858a8: 8c2946c8 lw r9,0x46c8(r1)                r9 = raw image width (word?)
 000858ac: 3c018009 lui r1,0x8009
 000858b0: 00230821 addu r1,r1,r3
 000858b4: 8c2a46cc lw r10,0x46cc(r1)               r10 = raw image height
 000858b8: 32e30061 andi r3,r23,0x0061              r3 = 0x40, 0x20, 0x1 bit flags
 000858bc: afa20014 sw r2,0x0014(r29)               store Y offset on WEP sheet to load from
 000858c0: 3162c000 andi r2,r11,0xc000               r2 = X/Y reverse (? bitflags?)
 000858c4: 00021342 srl r2,r2,0x0d                  
 000858c8: 00621825 or r3,r3,r2                     stores bitflag on top of r3?
 000858cc: afa80010 sw r8,0x0010(r29)               store X tile (pixel?) offset
 000858d0: afa30020 sw r3,0x0020(r29)               store reversal bytes (bit flags)
 000858d4: 00094cc0 sll r9,r9,0x13                  r9 = raw image width * 8192
 000858d8: 00094c03 sra r9,r9,0x10                  r9 = raw image width * 8192 / 1024 (total r9 * 8)
 000858dc: 000a54c0 sll r10,r10,0x13
 000858e0: 000a5403 sra r10,r10,0x10                same deal but with r10
 000858e4: afa90018 sw r9,0x0018(r29)               save image width to stack
 000858e8: 0c01ed3b jal 0x0007b4ec                  Store Sprite Display Data
 000858ec: afaa001c sw r10,0x001c(r29)              save image height to stack
 
 000858f0: 3202ffff andi r2,r16,0xffff              r2 = r16
 000858f4: 0054102b sltu r2,r2,r20                  set r2 = true if section counter (?) < r20
 000858f8: 1440ffd8 bne r2,r0,0x0008585c            branch if so
 000858fc: 3205ffff andi r5,r16,0xffff              r5 = r16
 00085900: 08021675 j 0x000859d4                    jump ahead
 00085904: a6710006 sh r17,0x0006(r19)              save incremenet (?)
 00085908: 34420008 ori r2,r2,0x0008                add 0x8 bit flag
 0008590c: 00008021 addu r16,r0,r0                  clears r16
 00085910: a6420004 sh r2,0x0004(r18)		     save new VRAM spritesheet ID?
 00085914: 8fac0028 lw r12,0x0028(r29)		     Load Sprite palette ID (R6 at start of routine)
 00085918: 97c20010 lhu r2,0x0010(r30)		     Load VRAM palette ID
 0008591c: 000c1980 sll r3,r12,0x06		     r3 = Sprite Palette ID * 64
 00085920: 00431021 addu r2,r2,r3                   r2 = VRAM Palette ID + Sprite Palette ID * 64
 00085924: 24420080 addiu r2,r2,0x0080              r2 = r2 + 0x80
 00085928: 12800029 beq r20,r0,0x000859d0	     branch if r20 = 0
 0008592c: a6420006 sh r2,0x0006(r18)               Save new VRAM Palette ID
 00085930: 3205ffff andi r5,r16,0xffff              r5 = r16 (section counter?)
 00085934: 00051080 sll r2,r5,0x02		     r2 = r5 * 4
 00085938: 24420002 addiu r2,r2,0x0002		     r2 = r2 + 2
 0008593c: 02a21021 addu r2,r21,r2		     r2 = SHP Data pointer + r2
 00085940: 02402021 addu r4,r18,r0		     r4 = ? Display pointer
 00085944: 26100001 addiu r16,r16,0x0001	     increment section counter?
 00085948: 944b0002 lhu r11,0x0002(r2)		     Load graphic size?? (And pixel offset?)
 0008594c: 80460000 lb r6,0x0000(r2)		     Load X shift
 00085950: 80470001 lb r7,0x0001(r2)		     Load Y shift
 00085954: 31633c00 andi r3,r11,0x3c00		     Size reference?
 00085958: 000319c2 srl r3,r3,0x07		     Size reference? / 128
 0008595c: 316203ff andi r2,r11,0x03ff		     r2 = Pixel displacement? (Total?)
 00085960: 3048001f andi r8,r2,0x001f		     r8 = Raw X Pixel displacement
 00085964: 000840c0 sll r8,r8,0x03		     r8 * 8
 00085968: 00021142 srl r2,r2,0x05
 0008596c: 000210c0 sll r2,r2,0x03		     r2 = Y Pixel displacement
 00085970: 3c018009 lui r1,0x8009
 00085974: 00230821 addu r1,r1,r3
 00085978: 8c2946c8 lw r9,0x46c8(r1)		     r9 = Raw image Width
 0008597c: 3c018009 lui r1,0x8009
 00085980: 00230821 addu r1,r1,r3
 00085984: 8c2a46cc lw r10,0x46cc(r1)		     r10 = Raw image height
 00085988: 32e30061 andi r3,r23,0x0061		     r3 = 0x40, 0x20, 0x01 bitflags
 0008598c: afa20014 sw r2,0x0014(r29)		     Save Y pixel displacement
 00085990: 3162c000 andi r2,r11,0xc000		     r2 = reverse bitflags
 00085994: 00021342 srl r2,r2,0x0d		     
 00085998: 00621825 or r3,r3,r2		     combine ?? bitflags and reverse bitflags
 0008599c: afa80010 sw r8,0x0010(r29)               save X Pixel displacement
 000859a0: afa30020 sw r3,0x0020(r29)		     save reverse bitflags?
 000859a4: 00094cc0 sll r9,r9,0x13
 000859a8: 00094c03 sra r9,r9,0x10		     r9 = actual image width
 000859ac: 000a54c0 sll r10,r10,0x13
 000859b0: 000a5403 sra r10,r10,0x10		     r10 = actual image height
 000859b4: afa90018 sw r9,0x0018(r29)		     Save image width
 000859b8: 0c01ed3b jal 0x0007b4ec		     Store Sprite Display Data
 000859bc: afaa001c sw r10,0x001c(r29)		     Save image height
 000859c0: 3202ffff andi r2,r16,0xffff              r2 =  r16
 000859c4: 0054102b sltu r2,r2,r20		     set r2 = 1 if r16 < r20
 000859c8: 1440ffda bne r2,r0,0x00085934	     branch to earlier in routine if so
 000859cc: 3205ffff andi r5,r16,0xffff		     r5 = r16
 000859d0: a6710006 sh r17,0x0006(r19)		Save Frame Command? Counter
 000859d4: 97ac0030 lhu r12,0x0030(r29)       Load Frame + all that other jazz
 000859d8: 00000000 nop
 000859dc: a66c0008 sh r12,0x0008(r19)        Save Frame + all that other jazz
 000859e0: a6760004 sh r22,0x0004(r19)        Save weapon animation
 000859e4: 8fbf0064 lw r31,0x0064(r29)
 000859e8: 8fbe0060 lw r30,0x0060(r29)
 000859ec: 8fb7005c lw r23,0x005c(r29)
 000859f0: 8fb60058 lw r22,0x0058(r29)
 000859f4: 8fb50054 lw r21,0x0054(r29)
 000859f8: 8fb40050 lw r20,0x0050(r29)
 000859fc: 8fb3004c lw r19,0x004c(r29)
 00085a00: 8fb20048 lw r18,0x0048(r29)
 00085a04: 8fb10044 lw r17,0x0044(r29)
 00085a08: 8fb00040 lw r16,0x0040(r29)
 00085a0c: 27bd0068 addiu r29,r29,0x0068
 00085a10: 03e00008 jr r31
 00085a14: 00000000 nop



 Return locations:(?)
 00085c0c - 000865a0


Related Pages

https://ffhacktics.com/wiki/Unit_Animation_Index

https://ffhacktics.com/wiki/SHP_%26_Graphic_info_page

https://ffhacktics.com/wiki/SEQ_%26_Animation_info_page

https://ffhacktics.com/wiki/Weapon_Animations

https://ffhacktics.com/wiki/Unit_Animations