How to improve the fade in and fade out progressions in Sonic 1 and 2

The palette fading routines in Sonic 1 and Sonic 2 (and possibly to a degree Sonic 3 & Knuckles) known as "Pal_FadeTo" and "Pal_FadeFrom", aren't 100% true to their name. Here is a screenshot of Sonic 1's title screen 6 frames during fade in:

From a logical point of view, this is incorrect fading, what happens here is it fades the blue parts in first, then fades the green parts in, and then finally fades the red parts in, the same goes for fading out, red first, then green, finally blue.

Strictly speaking for a the nearest possible perfect fade, all colours need to be fading in and out simultaneously (At the correct timing of course), so for example the colour 06E4 should fade in the pattern of:

0020 0040 0060 0080 02A0 04C2 06E4

And fade out in the pattern of:

04C2 02A0 0080 0060 0040 0020 0000

To correct for Sonic 1, you'll need to go to the routine "Pal_FadeTo" and replace everything from there down to "; End of function Pal_DecColor" with this:

(Unfortunately this is going to look more messy than it is until IPB can get the fucking tab spaces fixed properly)

So that code isn't really dead then? =P Also, I applied your new fading technique and it's nice and it works from going from one level to another, but the title menu has gone wrong now, any reason?

EDIT: Although, when the stars twinkle just before the art work loads, if you press start, it all loads up instantly and then it's viewable. If I don't press start and let the artwork fade in, I get the above result.

Man, we should really get these ASM tags to work again. But until that is done, it'd be a better idea to use [code] tags, so it'd be great if you could edit your post again (as annoying as it may seem).

As for the actual content, this is one of these "Never noticed it before you mentioned it" kind of things. This comes from the fact that I always found the fade transition fine as it was, but taking a closer look really shows me that I was wrong. This looks cleaner and more accurate, the way it should've always been.

However, it did give me a weird feeling. I noticed that I've seen this before. So, is it just me or did you use this feature in your own projects for years now, but never had time to actually make a guide for it? Because when I downloaded the Sonic 1 example, I immediately thought "Yep, this is done by MarkeyJester".

However, it did give me a weird feeling. I noticed that I've seen this before. So, is it just me or did you use this feature in your own projects for years now, but never had time to actually make a guide for it? Because when I downloaded the Sonic 1 example, I immediately thought "Yep, this is done by MarkeyJester".

Click to expand...

I haven't actually applied it to any hacks before, but I did note about it a few years ago, but that was in a private channel, so chances are you've never seen any hack associated with me to do with palette fading

This was the probem. As you can see when I quoted to you that dead (yet undead) code, there was no label pointing to it and right above it is an 'rts', so it was truley being "unused". Adding the new code you quoted above and then adding the "NewRouine" label next to the "dead" code, it now works perfectly. Cheers, mate =)

A bug has appeared in the Sonic 2 Fade-in routine, although this only seems to happen on the Title screen.

(Don't worry, the selection menu is gone because I took it out myself)

When the title screen is in the middle of fading in, if you press start to go straight to the point, the palette goes wrong (or doesn't seem to finish loading). I tried the ROM you supplied us, MJ, and the bug exists in that too, so I know it's not any of my work interfering.