Unit graphic information loading

From Final Fantasy Hacktics Wiki
(Redirected from 00083f18 - 00084210)
Jump to navigation Jump to search

Unit graphic loading thing.
00083e10: 27bdffb8 addiu r29,r29,0xffb8
00083e14: afb10034 sw r17,0x0034(r29)
00083e18: 00a08821 addu r17,r5,r0			r17 = sprite display section
00083e1c: afb3003c sw r19,0x003c(r29)
00083e20: 00c09821 addu r19,r6,r0			r19 = SHP data pointer(?)
00083e24: afbf0044 sw r31,0x0044(r29)
00083e28: afb40040 sw r20,0x0040(r29)
00083e2c: afb20038 sw r18,0x0038(r29)
00083e30: afb00030 sw r16,0x0030(r29)
00083e34: 92740001 lbu r20,0x0001(r19)			Load rotation bytes?
00083e38: 92320003 lbu r18,0x0003(r17)			Load number of graphics to display
00083e3c: 32820060 andi r2,r20,0x0060			checks for 0x20 and 0x40 bytes (WTF DO THESE EVEN DO???)
00083e40: 00471025 or r2,r2,r7				adds spritesheet bitflags? (0x4 if SPR2 or EVTCHR block 1, 0x4 + 0x1 if EVTCHR block 2)
00083e44: a6220004 sh r2,0x0004(r17)			saves VRAM spritesheet ID
00083e48: 94820010 lhu r2,0x0010(r4)			VRAM palette ID
00083e4c: 00008021 addu r16,r0,r0			r16 = 0
00083e50: 12400028 beq r18,r0,0x00083ef4		branch if # of graphics is 0
00083e54: a6220006 sh r2,0x0006(r17)			saves VRAM palette ID
00083e58: 00101880 sll r3,r16,0x02			counter * 4
00083e5c: 24630002 addiu r3,r3,0x0002			counter * 4 + 2
00083e60: 02631821 addu r3,r19,r3			...???????? (stores information about the graphic per frame)
00083e64: 02002821 addu r5,r16,r0			r5 = counter
00083e68: 26100001 addiu r16,r16,0x0001		increment counter
00083e6c: 94690002 lhu r9,0x0002(r3)			load Graphic size (& tile offset)
00083e70: 80660000 lb r6,0x0000(r3)			load X shift
00083e74: 80670001 lb r7,0x0001(r3)			Load Y shift
00083e78: 31223c00 andi r2,r9,0x3c00			r2 = size reference
00083e7c: 000211c2 srl r2,r2,0x07			size reference / 128
00083e80: 312403ff andi r4,r9,0x03ff			total tile offset
00083e84: 3088001f andi r8,r4,0x001f			X tile offset
00083e88: 000840c0 sll r8,r8,0x03			X offset * 8
00083e8c: 00042142 srl r4,r4,0x05			
00083e90: 000420c0 sll r4,r4,0x03			Y offset * 8
00083e94: 3c018009 lui r1,0x8009
00083e98: 00220821 addu r1,r1,r2			
00083e9c: 8c2a46c8 lw r10,0x46c8(r1)			Load Raw image width
00083ea0: 3c018009 lui r1,0x8009
00083ea4: 00220821 addu r1,r1,r2
00083ea8: 8c2b46cc lw r11,0x46cc(r1)			Load Raw image height
00083eac: 32820061 andi r2,r20,0x0061			0x40, 0x20, 0x1 bit flags
00083eb0: 3129c000 andi r9,r9,0xc000			X/Y reverse (bit flags?)
00083eb4: 00094b42 srl r9,r9,0x0d			
00083eb8: 00491025 or r2,r2,r9				stores bit flags on r2
00083ebc: afa40014 sw r4,0x0014(r29)			save Y offset to stack
00083ec0: 02202021 addu r4,r17,r0			r4 = sprite display data section
00083ec4: afa80010 sw r8,0x0010(r29)			saves X offset to stack
00083ec8: afa20020 sw r2,0x0020(r29)			saves reverse flags to stack
00083ecc: 000a54c0 sll r10,r10,0x13
00083ed0: 000a5403 sra r10,r10,0x10			final Image width
00083ed4: 000b5cc0 sll r11,r11,0x13
00083ed8: 000b5c03 sra r11,r11,0x10			Final image height
00083edc: afaa0018 sw r10,0x0018(r29)			store in stack
00083ee0: 0c01ed3b jal 0x0007b4ec			Store Sprite Display Data
00083ee4: afab001c sw r11,0x001c(r29)			store in stack
00083ee8: 0212102b sltu r2,r16,r18			r2 = true if counter != # graphics to load
00083eec: 1440ffdb bne r2,r0,0x00083e5c		repeat
00083ef0: 00101880 sll r3,r16,0x02			r3 = counter * 4
00083ef4: 8fbf0044 lw r31,0x0044(r29)
00083ef8: 8fb40040 lw r20,0x0040(r29)
00083efc: 8fb3003c lw r19,0x003c(r29)
00083f00: 8fb20038 lw r18,0x0038(r29)
00083f04: 8fb10034 lw r17,0x0034(r29)
00083f08: 8fb00030 lw r16,0x0030(r29)
00083f0c: 27bd0048 addiu r29,r29,0x0048
00083f10: 03e00008 jr r31
00083f14: 00000000 nop