Wednesday, November 15, 2017

The truncated palette cycle

Last time, we saw that the code for Super Sonic's palette cycle sets the Palette_frame RAM variable back to $24 when it's outside the PalCycle_SuperSonic array's bounds. It does so by checking if the variable's value is $36 or higher:
    ; increment palette frame and update Sonic's palette
    lea     (PalCycle_SuperSonic).l,a0
    move.w  (Palette_frame).w,d0
    addq.w  #6,(Palette_frame).w    ; next frame
    cmpi.w  #$36,(Palette_frame).w  ; is it the last frame?
    blo.s   loc_3898                ; if not, branch
    move.w  #$24,(Palette_frame).w  ; reset frame counter
This code causes the Palette_frame variable to loop between the values $24, $2A, and $30, giving Super Sonic a nice three-step strobe light effect:


What I didn't mention before is how the PalCycle_SuperSonic array actually has enough entries for a four-step palette cycle, the last of which are never used due to the above check:
    dc.w $CEE,$CEE,$AEE     ; $24
    dc.w $AEE,$8EE,$6CC     ; $2A
    dc.w $8EE,$0EE,$0AA     ; $30
    dc.w $AEE,$8EE,$6CC     ; $36
Applying the full cycle grants Super Sonic a smoother, pulsating light effect, closer to the other characters' Super forms:


It is unclear whether the extra colors were unused intentionally, or due to an oversight. In Super Sonic's regular palette, the last set of colors is identical to the second, producing the pulsating effect seen above. With the underwater palettes however, the last set of colors is identical to the the third, which would cause the palette cycle to hang awkwardly on its darkest step before resetting.

Whichever it was, my guess is that the developers decided the truncated version was good enough, so when the water palettes were later produced, they were only made to conform to the three-step cycle, with the last set of colors serving as padding.

2 comments:

  1. Do you plan to show off Super Sonic's unused idle frame? Not even TCRF seems to know about it.

    ReplyDelete
  2. Even fixed it still doesn't look as nice as Sonic 2's pallet cycle for Super Sonic.

    ReplyDelete