[WTF] S1 Dynamic Palette and SonLVL

Discussion in 'Discussion and Q&A Archive' started by Ashuro, May 24, 2016.

  1. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    I mean that you shouldn't try choosing your colors by using SonMapED which uses a color graph where you pick a color and the program chooses the closest 9-bit color instead of just changing hex values. This makes it frustrating because the closest 9-bit color to the one you choose is usually not what you want. I can tell you from experience that I've always had a bad time using SonMapED to edit palettes. Also, about color swapping, I said that it's the one thing palette related that SonMapED is good for. I don't care much for Flex's color picker either. My favorite would be SonLVL which allows you to edit hex values but also use the color graph for if you're trying to adapt the palette to an image you want to import or something like that.
     
  2. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Okay i will test it!
     
  3. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    I'm not saying that you should use it or something, but since you mentioned it, there you go.
     
  4. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Damn this tool is very useful!! "God Save The Queen" lol
    Thank you!
    -----------------------------------------------------------------

    For those who really want to know how to put a different cycle palette for each act, i have build a code for my hack:


    PalCycle_MZ: ; XREF: PalCycle
    move.b $FFFFFE11,d1 ; this is the zone/act flag
    lea (Pal_MZCyc).l,a0 ; go to Pal_MZCyc
    cmp.b #2,d1 ; compare if it is zone act 3 (act1= #0, act2= #1, act3= #2) :cool:
    beq.w PalCycle_MZ_cont ; branch to PalCycle_MZ_cont if yes

    loc_196A_mz: ; XREF: PalCycle_Title ; subroutine for act 1 and act 2 :mad:
    subq.w #1,($FFFFF634).w
    bpl.s locret_1990_mz
    move.w #4,($FFFFF634).w
    move.w ($FFFFF632).w,d0
    addq.w #1,($FFFFF632).w
    andi.w #3,d0
    lsl.w #3,d0
    lea ($FFFFFB50).w,a1
    move.l (a0,d0.w),(a1)+
    move.l 4(a0,d0.w),(a1)

    locret_1990_mz:
    rts

    PalCycle_MZ_cont: ; subroutine for act 3 :mad:
    lea (pal_MZ3cyc).l,a0

    loc_196A_mz3:
    subq.w #1,($FFFFF634).w
    bpl.s locret_1990_mz3
    move.w #4,($FFFFF634).w
    move.w ($FFFFF632).w,d0
    addq.w #1,($FFFFF632).w
    andi.w #3,d0
    lsl.w #3,d0
    lea ($FFFFFB50).w,a1
    move.l (a0,d0.w),(a1)+
    move.l 4(a0,d0.w),(a1)

    locret_1990_mz3:
    rts
    -----------------------------------------------------------------------------------------------
    And of course, make it able to load the palette: ;)


    Pal_TitleCyc: incbin pallet\c_title.bin
    Pal_GHZCyc: incbin pallet\c_ghz.bin ; waterfall
    Pal_MZCyc: incbin pallet\c_mz.bin
    Pal_MZ3Cyc incbin pallet\c_mz3.bin ; THE FILE OF THE PALETTE CYCLE OF ACT 3 :oops:
    Pal_LZCyc1: incbin pallet\c_lz_wat.bin ; waterfalls pallet
    Pal_LZCyc2: incbin pallet\c_lz_bel.bin ; conveyor belt pallet
    Pal_LZCyc3: incbin pallet\c_lz_buw.bin ; conveyor belt (underwater) pallet
    Pal_SBZ3Cyc1: incbin pallet\c_sbz3_w.bin ; waterfalls pallet
    Pal_SLZCyc: incbin pallet\c_slz.bin
    Pal_SYZCyc1: incbin pallet\c_syz_1.bin
    Pal_SYZCyc2: incbin pallet\c_syz_2.bin
    ---------------------------------------------------------------------------------------------------

    I am a REAL NOOB in ASM, of course if i got it, so you can do it for each another act/zone as you want! :p:D
    But 2 years ago, when i've start sonic rom-hacking, i would never imagined I also help others by posting a asm code !

    (sorry for bad english)
     
  5. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    I would suggest doing something along the lines of:
    Code:
    Mz_CycleList:    dc.l Pal_MZCyc1, Pal_MZCyc2, Pal_MZCyc3
    PalCycle_MZ:
        moveq    #0,d1            ; clear the upper byte
        move.b    $FFFFFE11.w,d1        ; get actid
        lsl.w    #2,d1            ; shift up twice (mul by 4)
        move.l    Mz_CycleList(pc,d1.w),a0; get the cycling palette ptr
    
        ; and here follows the regular code
        subq.w    #1,($FFFFF634).w
        bpl.s    locret_1990
        move.w    #4,($FFFFF634).w
        move.w    ($FFFFF632).w,d0
        addq.w    #1,($FFFFF632).w
        andi.w    #3,d0
        lsl.w    #3,d0
        lea    ($FFFFFB50).w,a1
        move.l    (a0,d0.w),(a1)+
        move.l    4(a0,d0.w),(a1)
    
    locret_1990:
        rts
    The difference is, you do not need to copy any code, just add a little bit to load correct palette cycle pointer from a list.