Get Unit's Portrait/Palette

From Final Fantasy Hacktics Wiki
Revision as of 02:08, 2 March 2012 by Choto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Get Unit's Portrait/Palette
0005e120: a0a00000 sb r0,0x0000(r5)		Store Palette = 0
0005e124: 90860003 lbu r6,0x0003(r4)		Load Unit's Job ID
0005e128: 90830000 lbu r3,0x0000(r4)		Load Unit's Sprite Set
0005e12c: 24c2ffa4 addiu r2,r6,0xffa4		Job ID - 0x5c (Dancer)
0005e130: 2c420002 sltiu r2,r2,0x0002
0005e134: 10400002 beq r2,r0,0x0005e140		Branch if Job isn't Dancer/Mime
0005e138: 306300ff andi r3,r3,0x00ff		(Bard/Dancer use the same Job ID  for Palette)
0005e13c: 24c6ffff addiu r6,r6,0xffff		Job ID --
0005e140: 2c620080 sltiu r2,r3,0x0080
0005e144: 14400018 bne r2,r0,0x0005e1a8		Branch if Sprite Set is Special
0005e148: 00601021 addu r2,r3,r0		Portrait = Sprite Set
0005e14c: 34020080 ori r2,r0,0x0080		r2 = 0x80
0005e150: 14620005 bne r3,r2,0x0005e168		Branch if Sprite Set != Generic Male
0005e154: 30c200ff andi r2,r6,0x00ff
0005e158: 00021040 sll r2,r2,0x01		Job ID * 2
0005e15c: 2443ffcc addiu r3,r2,0xffcc		Job ID * 2 - 0x34
0005e160: 0801786a j 0x0005e1a8
0005e164: 306200fe andi r2,r3,0x00fe		r2 = Male Portrait
0005e168: 34020081 ori r2,r0,0x0081
0005e16c: 14620005 bne r3,r2,0x0005e184		Branch if Sprite Set != Generic Female
0005e170: 30c200ff andi r2,r6,0x00ff
0005e174: 00021040 sll r2,r2,0x01		Job ID * 2
0005e178: 2443ffcd addiu r3,r2,0xffcd		Job ID * 2 - 0x33
0005e17c: 0801786a j 0x0005e1a8
0005e180: 306200ff andi r2,r3,0x00ff		r2 = Female Portrait
0005e184: 34020082 ori r2,r0,0x0082
0005e188: 10620003 beq r3,r2,0x0005e198		Branch if Sprite Set = Monster
0005e18c: 24c30028 addiu r3,r6,0x0028		r3 = Job ID + 0x28 
0005e190: 0801786a j 0x0005e1a8
0005e194: 306200ff andi r2,r3,0x00ff		Palette = Job ID + 0x28
0005e198: 90820160 lbu r2,0x0160(r4)		Load Palette
0005e19c: 00000000 nop
0005e1a0: a0a20000 sb r2,0x0000(r5)		Store Palette
0005e1a4: 9082015f lbu r2,0x015f(r4)		Load Unit's Portrait (Set from Job Data)
0005e1a8: 03e00008 jr r31
0005e1ac: 00000000 nop


Return Locations

0005e09c: Calculate Unit's Palette/Portrait (return Portrait)