Palette mod by status

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

#Parameters
    #r4 = Misc Unit Data Pointer
    #r6 = ?

#Returns
    #r5 = Shade Type (Talcall notes)
        4 = additive (brighter)
        5 = neutral shading?
        6 = monochrome

#*NOTE* : reference misc unit data for status tables, not normal unit data


000822bc: 27bdffd0 addiu r29,r29,0xffd0
000822c0: afbf0028 sw r31,0x0028(r29)
000822c4: 9082013e lbu r2,0x013e(r4)		#load modified palette byte
000822c8: 00000000 nop
000822cc: 14400062 bne r2,r0,0x00082458			#branch to End if not zero
000822d0: 00c04021 addu r8,r6,r0
000822d4: 3c0260c2 lui r2,0x60c2
000822d8: 34426020 ori r2,r2,0x6020		#statuses 20 60 c2 60 (Petrify, Berserk, Cursed, Oil, Poison, Blood Suck, Undead, and Regen)
000822dc: 8c830140 lw r3,0x0140(r4)		#load status flags
000822e0: 90870004 lbu r7,0x0004(r4)		#load misc ID
000822e4: 00621024 and r2,r3,r2			#check for palette changing status
000822e8: 10400059 beq r2,r0,0x00082450			#branch to Non-status Palette Modification if no palette-editing status present
000822ec: 30620020 andi r2,r3,0x0020

Petrify:

000822f0: 10400007 beq r2,r0,0x00082310			#branch if not petrify
000822f4: 34060003 ori r6,r0,0x0003			
000822f8: 34050006 ori r5,r0,0x0006		#shade type 6
000822fc: afa00010 sw r0,0x0010(r29)		#store ? = 0 (this is zeroed out for every status here)
00082300: afa00014 sw r0,0x0014(r29)		#store red = 0
00082304: afa00018 sw r0,0x0018(r29)		#store green = 0
00082308: 08020910 j 0x00082440				#Status Palette Modification
0008230c: afa0001c sw r0,0x001c(r29)		#store blue = 0

Blood suck:

00082310: 3c020002 lui r2,0x0002
00082314: 00621024 and r2,r3,r2
00082318: 10400008 beq r2,r0,0x0008233c			#branch if not blood suck
0008231c: 34020003 ori r2,r0,0x0003			
00082320: 34050006 ori r5,r0,0x0006		#shade type 6
00082324: afa20014 sw r2,0x0014(r29)		#store red = 3
00082328: 2402ffff addiu r2,r0,0xffff
0008232c: afa20018 sw r2,0x0018(r29)		#store green = -1
00082330: 34020008 ori r2,r0,0x0008		#prep blue value as 8
00082334: 0802090f j 0x0008243c				#(Save blue = r2)
00082338: afa00010 sw r0,0x0010(r29)		#store ? = 0

Berserk:

0008233c: 30624000 andi r2,r3,0x4000
00082340: 10400008 beq r2,r0,0x00082364			#branch if not berserk
00082344: 34060003 ori r6,r0,0x0003
00082348: 34050004 ori r5,r0,0x0004		#shade type 4
0008234c: 34020008 ori r2,r0,0x0008
00082350: afa00010 sw r0,0x0010(r29)		#store ? = 0
00082354: afa20014 sw r2,0x0014(r29)		#store red = 8
00082358: afa00018 sw r0,0x0018(r29)		#store green = 0
0008235c: 08020910 j 0x00082440				#Status Palette Modification
00082360: afa0001c sw r0,0x001c(r29)		#store blue = 0

Poison:

00082364: 3c020040 lui r2,0x0040
00082368: 00621024 and r2,r3,r2
0008236c: 10400007 beq r2,r0,0x0008238c			#branch if not poison
00082370: 34020008 ori r2,r0,0x0008
00082374: 34050005 ori r5,r0,0x0005		#shade type 5
00082378: afa00010 sw r0,0x0010(r29)		#store ? = 0
0008237c: afa00014 sw r0,0x0014(r29)		#store red = 0
00082380: afa20018 sw r2,0x0018(r29)		#store green = 8
00082384: 08020910 j 0x00082440				#Status Palette Modification
00082388: afa0001c sw r0,0x001c(r29)		#store blue = 0

Regen:

0008238c: 3c022000 lui r2,0x2000
00082390: 00621024 and r2,r3,r2
00082394: 10400006 beq r2,r0,0x000823b0			#branch if not regen
00082398: 34060003 ori r6,r0,0x0003
0008239c: 34050004 ori r5,r0,0x0004		#shade type 4
000823a0: 34020008 ori r2,r0,0x0008		#prep blue value as 8
000823a4: afa00010 sw r0,0x0010(r29)		#store ? = 0
000823a8: 0802090e j 0x00082438				#(Save green = 0 and blue = r2)
000823ac: afa00014 sw r0,0x0014(r29)		#store red = 0

Oil:

000823b0: 3c020080 lui r2,0x0080
000823b4: 00621024 and r2,r3,r2
000823b8: 10400006 beq r2,r0,0x000823d4			#branch if not oil
000823bc: 2402fffc addiu r2,r0,0xfffc		#(also preps blue value as -4)
000823c0: 34050005 ori r5,r0,0x0005		#shade type 5
000823c4: afa00010 sw r0,0x0010(r29)		#store ? = 0
000823c8: afa20014 sw r2,0x0014(r29)		#store red = -4
000823cc: 0802090f j 0x0008243c				#(Save blue = r2)
000823d0: afa20018 sw r2,0x0018(r29)		#store green = -4

Cursed:

000823d4: 30622000 andi r2,r3,0x2000
000823d8: 10400007 beq r2,r0,0x000823f8			#branch if not cursed
000823dc: 34060003 ori r6,r0,0x0003
000823e0: 34050005 ori r5,r0,0x0005		#shade type 5
000823e4: 2402fff8 addiu r2,r0,0xfff8		#(also preps blue value as -8)
000823e8: afa00010 sw r0,0x0010(r29)		#store ? = 0
000823ec: afa20014 sw r2,0x0014(r29)		#store red = -8
000823f0: 0802090f j 0x0008243c				#(Save blue = r2)
000823f4: afa20018 sw r2,0x0018(r29)		#store green = -8

Undead:

000823f8: 3c024000 lui r2,0x4000
000823fc: 00621024 and r2,r3,r2
00082400: 10400013 beq r2,r0,0x00082450			#branch if not undead (end? Lol)
00082404: 00000000 nop
00082408: 90820006 lbu r2,0x0006(r4)		#load spritesheet ID
0008240c: 00000000 nop
00082410: 24420075 addiu r2,r2,0x0075		#spritesheet ID + 0x75
00082414: 304200ff andi r2,r2,0x00ff		
00082418: 2c420002 sltiu r2,r2,0x0002		#Skeleton/Ghost sprite check
0008241c: 1440000c bne r2,r0,0x00082450			#branch to Non-status Palette Modification if Skeleton/Ghost sprite
00082420: 34060003 ori r6,r0,0x0003
00082424: 34050005 ori r5,r0,0x0005		#shade type 5
00082428: 34020004 ori r2,r0,0x0004
0008242c: afa20014 sw r2,0x0014(r29)		#store red = 4
00082430: 34020005 ori r2,r0,0x0005		#prep blue value as 5
00082434: afa00010 sw r0,0x0010(r29)		#store ? = 0

Save Green:

00082438: afa00018 sw r0,0x0018(r29)		#store green = 0

Save Blue:

0008243c: afa2001c sw r2,0x001c(r29)		#store blue = r2 (value varies depending on jumps)

Status Palette Modification:

00082440: 0c020844 jal 0x00082110			#Special spritesheet ID palette mods?
00082444: afa80020 sw r8,0x0020(r29)
00082448: 08020916 j 0x00082458				#jump to End
0008244c: 00000000 nop

Non-status Palette Modification:

00082450: 0c020755 jal 0x00081d54			#Weather/time of day/tile palette modification
00082454: 01003021 addu r6,r8,r0

End:

00082458: 8fbf0028 lw r31,0x0028(r29)
0008245c: 27bd0030 addiu r29,r29,0x0030
00082460: 03e00008 jr r31
00082464: 00000000 nop