Sonic and Sega Retro Message Board: Seperate palettes for different characters in Sonic 2 - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Seperate palettes for different characters in Sonic 2 Posted due to public demand!

#1 User is offline Spanner 

Posted 24 July 2010 - 07:48 AM

  • Not much I can do on here nowadays...
  • Posts: 2873
  • Joined: 02-June 07
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic the Hedgehog Hacking Contest, Other Stuff
  • Wiki edits:2,193
Copypaste from SSRG since there's no point posting it there without doing the same on here.

Since a few people have begged for a guide on making a character have its own palette in Sonic 2, I'll just throw my shitty code around. Since my original method didn't want to play nice with underwater palettes, I've essentially cloned PalPointers and gave the character a new set. This means that you could effectively have different level palettes for the character too if you wanted to.

I'm using Knuckles because I have that character in a hack. I'm also using the Sonic 2 2007 disassembly, but the SVN code will most likely be similar. Go to PalLoad1:
Syntax Highlighted Code: ASM
PalLoad1:
lea (PalPointers).l,a1
lsl.w #3,d0
adda.w d0,a1
movea.l (a1)+,a2
movea.w (a1)+,a3
adda.w #$80,a3
move.w (a1)+,d7
 
- move.l (a2)+,(a3)+
dbf d7,-
rts
; End of function PalLoad1


Add these two lines after PalLoad1 before loading PalPointers:
Syntax Highlighted Code: ASM
	cmpi.w #3,(Player_Mode).l ; is Player Knuckles?
beq.w PalLoad1_Knux ; If yes, load different stuff


PalLoad1 will now look like this:
Syntax Highlighted Code: ASM
PalLoad1:
cmpi.w #3,(Player_Mode).l ; is Player Knuckles?
beq.w PalLoad1_Knux ; If yes, load different stuff
lea (PalPointers).l,a1
lsl.w #3,d0
adda.w d0,a1
movea.l (a1)+,a2
movea.w (a1)+,a3
adda.w #$80,a3
move.w (a1)+,d7
 
- move.l (a2)+,(a3)+
dbf d7,-
rts
; End of function PalLoad1


Now for PalLoad1_Knux. Simply copypaste the original, untouched PalLoad1 (without the Knuckles check of course) and set it to load a different set of PalPointers named PalPointers_Knux:
Syntax Highlighted Code: ASM
PalLoad1_Knux:
lea (PalPointers_Knux).l,a1
lsl.w #3,d0
adda.w d0,a1
movea.l (a1)+,a2
movea.w (a1)+,a3
adda.w #$80,a3
move.w (a1)+,d7
 
- move.l (a2)+,(a3)+
dbf d7,-
rts
; End of function PalLoad1


Now, we're going to do the same to PalLoad2, PalLoad3_Water and PalLoad4_Water. Really simple stuff here.

Finally, copypaste the PalPointers list, rename it PalPointers_Knux and change the pointers required for your character. Or, you could be a lazy arse and copypaste this into the disassembly, making the necessary changes:
Syntax Highlighted Code: ASM
PalPointers_Knux:
palptr Pal_SEGA, Normal_palette, $1F
palptr Pal_Title, Normal_palette_line2, 7
palptr Pal_UNK1, Normal_palette, $1F
palptr Pal_Knuckles, Normal_palette, $F ; S2K Palette
palptr Pal_EHZ, Normal_palette_line2, $17
palptr Pal_EHZ, Normal_palette_line2, $17
palptr Pal_WZ, Normal_palette_line2, $17
palptr Pal_EHZ, Normal_palette_line2, $17
palptr Pal_MTZ, Normal_palette_line2, $17
palptr Pal_MTZ, Normal_palette_line2, $17
palptr Pal_WFZ, Normal_palette_line2, $17
palptr Pal_HTZ, Normal_palette_line2, $17
palptr Pal_HPZ, Normal_palette_line2, $17
palptr Pal_EHZ, Normal_palette_line2, $17
palptr Pal_OOZ, Normal_palette_line2, $17
palptr Pal_MCZ, Normal_palette_line2, $17
palptr Pal_CNZ, Normal_palette_line2, $17
palptr Pal_CPZ, Normal_palette_line2, $17
palptr Pal_DEZ, Normal_palette_line2, $17
palptr Pal_ARZ, Normal_palette_line2, $17
palptr Pal_SCZ, Normal_palette_line2, $17
palptr Pal_HPZ_U_K, Normal_palette, $1F ; S2K Palette
palptr Pal_CPZ_U_K, Normal_palette, $1F ; S2K Palette
palptr Pal_ARZ_U_K, Normal_palette, $1F ; S2K Palette
palptr Pal_SS, Normal_palette, $17
palptr Pal_UNK2, Normal_palette_line2, 7
palptr Pal_UNK3, Normal_palette_line2, 7
palptr Pal_SS1, Normal_palette_line4, 7
palptr Pal_SS2, Normal_palette_line4, 7
palptr Pal_SS3, Normal_palette_line4, 7
palptr Pal_SS4, Normal_palette_line4, 7
palptr Pal_SS5, Normal_palette_line4, 7
palptr Pal_SS6, Normal_palette_line4, 7
palptr Pal_SS7, Normal_palette_line4, 7
palptr Pal_UNK4, Normal_palette_line4, 7
palptr Pal_UNK5, Normal_palette_line4, 7
palptr Pal_UNK6, Normal_palette_line4, 7
palptr Pal_OOZ_B, Normal_palette_line2, 7
palptr Pal_Menu, Normal_palette, $1F
palptr Pal_UNK7, Normal_palette, $1F


Now, build and this is what you should see:
- Sonic and Tails still load the same palette as they should
- Your new character will have its own palette
- Your new character will have correct underwater palettes


Just like this:




Try it yourself, making a character load its own palettes in Sonic 2.
This post has been edited by SOTI: 24 July 2010 - 07:50 AM

#2 User is offline ICEknight 

Posted 24 July 2010 - 11:22 AM

  • Posts: 9289
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
Nice. Does it also read the proper palette when reverting from Super mode?

#3 User is offline MainMemory 

Posted 24 July 2010 - 11:33 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
No, you would need to add new Super palettes for that.

#4 User is offline Spanner 

Posted 24 July 2010 - 09:37 PM

  • Not much I can do on here nowadays...
  • Posts: 2873
  • Joined: 02-June 07
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic the Hedgehog Hacking Contest, Other Stuff
  • Wiki edits:2,193
I haven't worked on the Super mode palettes. They aren't in PalPointers, it's a rotating palette. Looking at the code, it could be easy to do the same, all you need to do is make the palettes. Knuckles' setup is completely different however.

I might also put this up on the wiki.
This post has been edited by SOTI: 24 July 2010 - 09:45 PM

#5 User is offline Tweaker 

Posted 24 July 2010 - 11:58 PM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male
I don't really think such a specific guide is useful as much as a general guide to character-based game differences would be. Honestly, all it requires is checking a character variable that determines the current player character and loading different data based on that value; if you demonstrated a quick example of what would be required to do in those different routines, I imagine it would actually teach the reader instead of just holding their hand.

Nice work, though!

#6 User is offline jasonchrist 

Posted 25 July 2010 - 12:51 PM

  • Give Us A Wank
  • Posts: 1893
  • Joined: 22-July 08
  • Gender:Male
  • Project:Sonic Classic Hybrid Project
Would it be possible to give Robotnik his S1/CD palette using this? With the blue goggles and yellow collar?

#7 User is offline Spanner 

Posted 25 July 2010 - 01:06 PM

  • Not much I can do on here nowadays...
  • Posts: 2873
  • Joined: 02-June 07
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic the Hedgehog Hacking Contest, Other Stuff
  • Wiki edits:2,193
QUOTE (jasonchrist @ Jul 25 2010, 06:51 PM)
Would it be possible to give Robotnik his S1/CD palette using this? With the blue goggles and yellow collar?

Not really unless you're getting rid of Tails. Robotnik shares the character's palette, which is why his colours slightly changed in Sonic 2 to accommodate Tails.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users