Trap & Unit graphic information loading

From Final Fantasy Hacktics Wiki
(Redirected from 00084214 - 000846ac)
Jump to navigation Jump to search
80084214: 27bdffa8 addiu r29,r29,-0x0058
80084218: afb20038 sw r18,0x0038(r29)
8008421c: 00809021 addu r18,r4,r0			r18 = unit misc data pointer
80084220: afb00030 sw r16,0x0030(r29)
80084224: 00a08021 addu r16,r5,r0			r16 = unit sprite data
80084228: afb10034 sw r17,0x0034(r29)
8008422c: 30d1ffff andi r17,r6,0xffff			r17 = load frame
80084230: 02203021 addu r6,r17,r0			r6 = load frame
80084234: afb3003c sw r19,0x003c(r29)
80084238: 30f3ffff andi r19,r7,0xffff			r19 = animation
8008423c: 02603821 addu r7,r19,r0			r7 = "
80084240: afbf0054 sw r31,0x0054(r29)
80084244: afbe0050 sw r30,0x0050(r29)
80084248: afb7004c sw r23,0x004c(r29)
8008424c: afb60048 sw r22,0x0048(r29)
80084250: afb50044 sw r21,0x0044(r29)
80084254: afb40040 sw r20,0x0040(r29)
80084258: 965e007a lhu r30,0x007a(r18)			loads chicken/frog/crystal/treasure graphic Y offset
8008425c: 27a20028 addiu r2,r29,0x0028			r2 = stack pointer + 0x28 (for some reason)
80084260: afa20010 sw r2,0x0010(r29)			save stack pointer to stack
80084264: 27a2002c addiu r2,r29,0x002c			stack pointer + 0x2c
80084268: 0c020fc6 jal 0x80083f18			--> Update Sprite display data
8008426c: afa20014 sw r2,0x0014(r29)			save stack pointer to stack
80084270: 8fa3002c lw r3,0x002c(r29)			load Frame ID's data pointer
80084274: 2402ffff addiu r2,r0,-0x0001			r2 = 0xffffffff
80084278: 14620003 bne r3,r2,0x80084288		#branch if pointer is not completely invalid
8008427c: 00000000 nop						|
80084280: 0c011282 jal 0x80044a08				|--> 00044a08 - 00044a30 Clears information if above results in some kind of error
80084284: 34040008 ori r4,r0,0x0008				|r4 = 0x08
80084288: 8fa2002c lw r2,0x002c(r29)			#load Frame ID's data pointer
8008428c: 00000000 nop
80084290: 90430000 lbu r3,0x0000(r2)			Load Frame's first byte of data
80084294: 8e15002c lw r21,0x002c(r16)			sprite display section pointer
80084298: 30630007 andi r3,r3,0x0007			filters out 0x4, 0x2, 0x1 bitflags (number of graphics to load - 1)
8008429c: 24630001 addiu r3,r3,0x0001			add 1
800842a0: a2a30003 sb r3,0x0003(r21)			save number of graphics to display data
800842a4: 8fa2002c lw r2,0x002c(r29)			load Frame ID's data pointer
800842a8: 00000000 nop
800842ac: 90420000 lbu r2,0x0000(r2)			Load Frame's first byte of data
800842b0: 00000000 nop
800842b4: 000210c2 srl r2,r2,0x03			
800842b8: 00021040 sll r2,r2,0x01			filters out 0xf8 for spin on Y axis pointer
800842bc: 3c018009 lui r1,0x8009
800842c0: 00220821 addu r1,r1,r2
800842c4: 94224508 lhu r2,0x4508(r1)			load... spin on Y axis
800842c8: 307600ff andi r22,r3,0x00ff			r22 = number of graphics (counter)
800842cc: a6a2000c sh r2,0x000c(r21)			store spin on Y axis
800842d0: 2ec20009 sltiu r2,r22,0x0009			r2 = true if number of graphics < 0x9
800842d4: 14400004 bne r2,r0,0x800842e8		#branch if true (it can't exceed 8 but go off I guess)
800842d8: 00000000 nop						|
800842dc: 34160008 ori r22,r0,0x0008				|cap number of graphics at 8
800842e0: 0c011282 jal 0x80044a08				|--> 00044a08 - 00044a30 it's the bug graphic link hype
800842e4: 3404000a ori r4,r0,0x000a				|r4 = 0x0a
800842e8: 92420006 lbu r2,0x0006(r18)			#load spritesheet ID
800842ec: 8fa6002c lw r6,0x002c(r29)			load SHP frame ID data pointer
800842f0: 2c42009b sltiu r2,r2,0x009b			set true if spritesheet is < 0x9b (any unit)
800842f4: 90d40001 lbu r20,0x0001(r6)			r20 = loads second byte of Frame's data
800842f8: 14400035 bne r2,r0,0x800843d0		#branch if spritesheet is not OTHER.BIN
800842fc: 32820060 andi r2,r20,0x0060				|r2 = 0x40 and 0x20 bit flags

chicken/frog/crystal/chest
80084300: 3442000b ori r2,r2,0x000b				|add 0xb bitflag set (0x8, 0x2, 0x1)
80084304: a6a20004 sh r2,0x0004(r21)				|save VRAM spritesheet ID 
80084308: 96420010 lhu r2,0x0010(r18)				|VRAM palette ID
8008430c: 00008821 addu r17,r0,r0				|r17 = 0 (for counter purposes)
80084310: 12c000da beq r22,r0,0x8008467c			$branch if number of graphics to load is 0
80084314: a6a20006 sh r2,0x0006(r21)					|save VRAM palette to display data
80084318: 02a02021 addu r4,r21,r0					|r4 = unit display data
8008431c: 3225ffff andi r5,r17,0xffff					|r5 = counter
80084320: 26310001 addiu r17,r17,0x0001				|increment counter by 1
80084324: 00051080 sll r2,r5,0x02					|r2 = counter * 4
80084328: 8fa3002c lw r3,0x002c(r29)					|load SHP pointer from stack
8008432c: 24420002 addiu r2,r2,0x0002					|counter * 4 + 2
80084330: 00439821 addu r19,r2,r3					|r19 = SHP pointer + counter * 4 + 2 (position of graphic size and raw pixel offset)
80084334: 96700002 lhu r16,0x0002(r19)					|woah look at that lmao
80084338: 82660000 lb r6,0x0000(r19)					|load X shift
8008433c: 82670001 lb r7,0x0001(r19)					|load Y shift
80084340: 32033c00 andi r3,r16,0x3c00					|obtain size reference
80084344: 000319c2 srl r3,r3,0x07					|size reference / 128
80084348: 320203ff andi r2,r16,0x03ff					|total raw pixel offset
8008434c: 3048001f andi r8,r2,0x001f					|raw x pixel offset
80084350: 000840c0 sll r8,r8,0x03					|raw x pixel offset * 0x8
80084354: 00021142 srl r2,r2,0x05					|raw Y pixel offset
80084358: 000210c0 sll r2,r2,0x03					|raw y pixel offset * 0x8
8008435c: 03c21021 addu r2,r30,r2					|raw Y pixel offset + OTHER Y graphic offset
80084360: 00021400 sll r2,r2,0x10					|
80084364: 00021403 sra r2,r2,0x10					|
80084368: 3c018009 lui r1,0x8009					|
8008436c: 00230821 addu r1,r1,r3					|
80084370: 8c2946c8 lw r9,0x46c8(r1)					|load raw image width
80084374: 3c018009 lui r1,0x8009					|
80084378: 00230821 addu r1,r1,r3					|
8008437c: 8c2a46cc lw r10,0x46cc(r1)					|load raw image height
80084380: 32830061 andi r3,r20,0x0061					|r3 = 0x40, 0x20, 0x1 bitflags (from. vram sprite. reverse and transparent flags?)
80084384: afa20014 sw r2,0x0014(r29)					|save Y pixel offset
80084388: 3202c000 andi r2,r16,0xc000					|r2 = reverse bit flags
8008438c: 00021342 srl r2,r2,0x0d					|move bit flags to lower byte thanks
80084390: 00621825 or r3,r3,r2						|combine bitflags
80084394: afa80010 sw r8,0x0010(r29)					|save X pixel offset
80084398: afa30020 sw r3,0x0020(r29)					|save reversal bytes
8008439c: 00094cc0 sll r9,r9,0x13					|
800843a0: 00094c03 sra r9,r9,0x10					|raw image width * 8
800843a4: 000a54c0 sll r10,r10,0x13					|
800843a8: 000a5403 sra r10,r10,0x10					|raw image height * 8
800843ac: afa90018 sw r9,0x0018(r29)					|save image width
800843b0: 0c01ed3b jal 0x8007b4ec					|--> Store Sprite Display Data
800843b4: afaa001c sw r10,0x001c(r29)					|save image height
800843b8: 3222ffff andi r2,r17,0xffff					|r2 = counter - 1
800843bc: 0056102b sltu r2,r2,r22					|r2 = true if counter - 1 < graphics to load
800843c0: 1440ffd6 bne r2,r0,0x8008431c				|branch to repeat this if result is true.
800843c4: 02a02021 addu r4,r21,r0					|r4 = unit display data
800843c8: 0802119f j 0x8008467c				$♠jump to end if finished
800843cc: 00000000 nop						|

all unit types (including human, monster, and lucavi)
800843d0: 8e02001c lw r2,0x001c(r16)			#load SHP Data pointer
800843d4: 00000000 nop					|
800843d8: 8c420000 lw r2,0x0000(r2)			|loads the start of SPR2 frames
800843dc: 00000000 nop					|
800843e0: 0222102b sltu r2,r17,r2			|
800843e4: 10400088 beq r2,r0,0x80084608		#branch if loading from SPR2
SPR1:
800843e8: 32830060 andi r3,r20,0x0060				|r3 = VRAM 0x40 and 0x20 bitflags
800843ec: 9642000e lhu r2,0x000e(r18)				|load VRAM spritesheet ID
800843f0: 00000000 nop						|
800843f4: 00431025 or r2,r2,r3					|add 0x40 and 0x20 bit flags
800843f8: a6a20004 sh r2,0x0004(r21)				|save new VRAM spritesheet ID
800843fc: 96420010 lhu r2,0x0010(r18)				|load VRAM palette
80084400: 00008821 addu r17,r0,r0				|reset r17 counter
80084404: 12c0009d beq r22,r0,0x8008467c			♠branch if number of graphics to load is 0
80084408: a6a20006 sh r2,0x0006(r21)					|Store VRAM palette in display data
8008440c: 32820061 andi r2,r20,0x0061					|check 0x40, 0x20, 0x1 VRAM(?) flags
80084410: 305700ff andi r23,r2,0x00ff					|move to r23
80084414: 3234ffff andi r20,r17,0xffff					|move counter to r20
80084418: 00141080 sll r2,r20,0x02					|counter * 4
8008441c: 8fa3002c lw r3,0x002c(r29)					|load frame ID's SHP data pointer
80084420: 24420002 addiu r2,r2,0x0002					|counter * 4 + 2
80084424: 00439821 addu r19,r2,r3					|Frame data + counter * 4 + 2
80084428: 96700002 lhu r16,0x0002(r19)					|size pointer + X and Y tile offset of counter
8008442c: 00000000 nop							|
80084430: 32023c00 andi r2,r16,0x3c00					|size reference
80084434: 00023282 srl r6,r2,0x0a					|
80084438: 3402000e ori r2,r0,0x000e					|e
8008443c: 14c2004c bne r6,r2,0x80084570				|branch if size reference != 0xe? (original: 0x3800)
80084440: 02a02021 addu r4,r21,r0					|r4 = sprite data pointer
80084444: 92430006 lbu r3,0x0006(r18)					|load spritesheet ID
80084448: 34020049 ori r2,r0,0x0049
8008444c: 10620003 beq r3,r2,0x8008445c				|branch if spritesheet is Altima 2nd form
80084450: 34020041 ori r2,r0,0x0041
80084454: 1462001d bne r3,r2,0x800844cc				|branch if spritesheet is not altima 1st form
80084458: 02802821 addu r5,r20,r0
8008445c: 02802821 addu r5,r20,r0					|if spritesheet is altima: r5 = current graphic# counter
80084460: 320203ff andi r2,r16,0x03ff					|x and y tile pointers
80084464: 3043001f andi r3,r2,0x001f					|x tile pointer
80084468: 00021142 srl r2,r2,0x05					|y tile pointer
8008446c: 000210c0 sll r2,r2,0x03					|y tile * 8
80084470: 03c21021 addu r2,r30,r2					|y tile offset + ????
80084474: 00021400 sll r2,r2,0x10
80084478: 82660000 lb r6,0x0000(r19)					|load x shift
8008447c: 82670001 lb r7,0x0001(r19)					|load y shift
80084480: 00021403 sra r2,r2,0x10
80084484: afa20014 sw r2,0x0014(r29)					|store y tile offset to stack
80084488: 3202c000 andi r2,r16,0xc000					|altima x/y reverse bitflags (not?)
8008448c: 00021342 srl r2,r2,0x0d
80084490: 02e21025 or r2,r23,r2					|altima x/y reverse bitflags and 0x40/20/1 bit flags
80084494: afa20020 sw r2,0x0020(r29)					|store, that, to stack
80084498: 3c028009 lui r2,0x8009
8008449c: 8c424738 lw r2,0x4738(r2)					|arute/kanzen image width pointer
800844a0: 000318c0 sll r3,r3,0x03					|x tile pointer * x
800844a4: afa30010 sw r3,0x0010(r29)					|store
800844a8: 3c038009 lui r3,0x8009
800844ac: 8c63473c lw r3,0x473c(r3)					|arute/kanzen image height pointer
800844b0: 000214c0 sll r2,r2,0x13
800844b4: 00021403 sra r2,r2,0x10					|altima specific width * 8
800844b8: 00031cc0 sll r3,r3,0x13
800844bc: 00031c03 sra r3,r3,0x10					|altima specific height * 8
800844c0: afa20018 sw r2,0x0018(r29)
800844c4: 0802117a j 0x800845e8					|store sprite display data
800844c8: afa3001c sw r3,0x001c(r29)
800844cc: 321103ff andi r17,r16,0x03ff					|total tile offset
800844d0: 3232001f andi r18,r17,0x001f					|x tile offset
800844d4: 001290c0 sll r18,r18,0x03					|x tile * 8
800844d8: 00118942 srl r17,r17,0x05					|y tile offset
800844dc: 001110c0 sll r2,r17,0x03					|y tile * 8
800844e0: 24420018 addiu r2,r2,0x0018					|y tile * 8 + 0x18
800844e4: 82660000 lb r6,0x0000(r19)					|x shift
800844e8: 92670001 lbu r7,0x0001(r19)					|y shift
800844ec: 340b0030 ori r11,r0,0x0030					|width = 0x30
800844f0: afab0018 sw r11,0x0018(r29)					|store
800844f4: 340b0018 ori r11,r0,0x0018					|height = 0x18
800844f8: 3210c000 andi r16,r16,0xc000					|x/y reverse bitflags (not? I don't think)
800844fc: 00108342 srl r16,r16,0x0d					|moves 0x8000 and 0x4000 to 0x4 and 0x2 bitflags? (0x4??? that's used, for... something else?)
80084500: 02f08025 or r16,r23,r16					|combine with VRAM flags
80084504: afb20010 sw r18,0x0010(r29)
80084508: afa20014 sw r2,0x0014(r29)
8008450c: afab001c sw r11,0x001c(r29)					|store height
80084510: afb00020 sw r16,0x0020(r29)					|store x/y reverse + VRAM flags
80084514: 00073e00 sll r7,r7,0x18
80084518: 00073e03 sra r7,r7,0x18
8008451c: 0c01ed3b jal 0x8007b4ec					|Store Sprite Display Data
80084520: 24e70018 addiu r7,r7,0x0018					|y shift + 0x18
80084524: 02a02021 addu r4,r21,r0					|r4 = sprite data
80084528: 26850001 addiu r5,r20,0x0001					|r5 = current graphic# count + 1
8008452c: 001188c0 sll r17,r17,0x03					|Y tile offset * 8
80084530: 82660000 lb r6,0x0000(r19)					|x shift
80084534: 82670001 lb r7,0x0001(r19)					|y shift
80084538: 340b0030 ori r11,r0,0x0030					|width = 0x30
8008453c: afab0018 sw r11,0x0018(r29)
80084540: 340b0018 ori r11,r0,0x0018					|height = 0x18
80084544: 36100080 ori r16,r16,0x0080					|VRAM flag 0x80
80084548: afb20010 sw r18,0x0010(r29)
8008454c: afb10014 sw r17,0x0014(r29)
80084550: afab001c sw r11,0x001c(r29)
80084554: 0c01ed3b jal 0x8007b4ec					|Store Sprite Display Data
80084558: afb00020 sw r16,0x0020(r29)
8008455c: 92a20003 lbu r2,0x0003(r21)					|load No. graphics
80084560: 00000000 nop
80084564: 24420001 addiu r2,r2,0x0001					|+1
80084568: 0802119f j 0x8008467c					|end
8008456c: a2a20003 sb r2,0x0003(r21)					|store
80084570: 02802821 addu r5,r20,r0					|Other size references (this probably handles all the stuff properly - see: Unit graphic information loading
80084574: 000630c0 sll r6,r6,0x03
80084578: 320203ff andi r2,r16,0x03ff
8008457c: 3043001f andi r3,r2,0x001f
80084580: 000318c0 sll r3,r3,0x03
80084584: 00021142 srl r2,r2,0x05
80084588: 000210c0 sll r2,r2,0x03
8008458c: 03c21021 addu r2,r30,r2
80084590: 00021400 sll r2,r2,0x10
80084594: 3c018009 lui r1,0x8009
80084598: 00260821 addu r1,r1,r6
8008459c: 8c2846c8 lw r8,0x46c8(r1)
800845a0: 3c018009 lui r1,0x8009
800845a4: 00260821 addu r1,r1,r6
800845a8: 8c2946cc lw r9,0x46cc(r1)
800845ac: 82660000 lb r6,0x0000(r19)
800845b0: 82670001 lb r7,0x0001(r19)
800845b4: 00021403 sra r2,r2,0x10
800845b8: afa20014 sw r2,0x0014(r29)
800845bc: 3202c000 andi r2,r16,0xc000
800845c0: 00021342 srl r2,r2,0x0d
800845c4: 02e21025 or r2,r23,r2
800845c8: afa30010 sw r3,0x0010(r29)
800845cc: afa20020 sw r2,0x0020(r29)
800845d0: 000844c0 sll r8,r8,0x13
800845d4: 00084403 sra r8,r8,0x10
800845d8: 00094cc0 sll r9,r9,0x13
800845dc: 00094c03 sra r9,r9,0x10
800845e0: afa80018 sw r8,0x0018(r29)
800845e4: afa9001c sw r9,0x001c(r29)
800845e8: 0c01ed3b jal 0x8007b4ec			Store Sprite Display Data
800845ec: 26310001 addiu r17,r17,0x0001		|counter ++
800845f0: 3222ffff andi r2,r17,0xffff
800845f4: 0056102b sltu r2,r2,r22			|set while still not all graphics
800845f8: 1440ff87 bne r2,r0,0x80084418		|loop
800845fc: 3234ffff andi r20,r17,0xffff			|r20 = counter
80084600: 0802119f j 0x8008467c			|end
80084604: 00000000 nop
EVTCHR1/2, SPR2/+?
80084608: 2e2200d2 sltiu r2,r17,0x00d2			#r2 = true if frame < 0xd2 (first EVTCHR frame)
8008460c: 10400012 beq r2,r0,0x80084658		branch if loading EVTCHR frame
80084610: 2e620258 sltiu r2,r19,0x0258			set true if animation < 0x258 (EVTCHR block 2)
80084614: 3c02800a lui r2,0x800a
80084618: 8c4277c4 lw r2,0x77c4(r2)			misc. ID of VRAM slot 4
8008461c: 92430004 lbu r3,0x0004(r18)			load Misc unit data
80084620: 3042001f andi r2,r2,0x001f			misc Unit ID
80084624: 14430004 bne r2,r3,0x80084638		branch if misc unit ID is inconsistent
80084628: 02402021 addu r4,r18,r0			r4 = misc unit data pointer
8008462c: 02a02821 addu r5,r21,r0			r5 = sprite display section pointer
80084630: 0802119d j 0x80084674			unit graphic loading
80084634: 34070004 ori r7,r0,0x0004			this unit uses VRAM spritesheet 4
80084638: 3c02800b lui r2,0x800b
8008463c: 8c42ed28 lw r2,-0x12d8(r2)			misc. ID of VRAM slot 5
80084640: 00000000 nop
80084644: 3042001f andi r2,r2,0x001f
80084648: 10430008 beq r2,r3,0x8008466c		branch if unit uses VRAM spritesheet 5
8008464c: 00000000 nop
80084650: 0802119f j 0x8008467c			end if cannot animate unit?
80084654: 00000000 nop
80084658: 10400004 beq r2,r0,0x8008466c		branch if animating from EVTCHR block 2
8008465c: 02402021 addu r4,r18,r0
80084660: 02a02821 addu r5,r21,r0
80084664: 0802119d j 0x80084674			unit graphic loading
80084668: 34070004 ori r7,r0,0x0004			#VRAM spritesheet 4 if animating from EVTCHR block 1
8008466c: 02a02821 addu r5,r21,r0
80084670: 34070005 ori r7,r0,0x0005			VRAM spritesheet 5 if animating from EVTCHR block 2
80084674: 0c020f84 jal 0x80083e10			-->Unit graphic information loading
80084678: 00000000 nop
Return
8008467c: 8fbf0054 lw r31,0x0054(r29)			♠
80084680: 8fbe0050 lw r30,0x0050(r29)
80084684: 8fb7004c lw r23,0x004c(r29)
80084688: 8fb60048 lw r22,0x0048(r29)
8008468c: 8fb50044 lw r21,0x0044(r29)
80084690: 8fb40040 lw r20,0x0040(r29)
80084694: 8fb3003c lw r19,0x003c(r29)
80084698: 8fb20038 lw r18,0x0038(r29)
8008469c: 8fb10034 lw r17,0x0034(r29)
800846a0: 8fb00030 lw r16,0x0030(r29)
800846a4: 27bd0058 addiu r29,r29,0x0058
800846a8: 03e00008 jr r31
800846ac: 00000000 nop