Language…
21 users online:  Alex,  Anorakun, Coille, derv82, Duraner Hawkeye, Eduard, FrostyLosty, Green, Green Jerry, Hammerer, Justepic, Minish Yoshi, PaceTheAce, Ringo,  RussianMan,  Sayuri,  Segment1Zone2, TCgamerboy2002, underway, Zavok, Zelda1995 - Guests: 210 - Bots: 171
Users: 64,425 (2,480 active)
Latest user: Playboy 27

Toggle Special World Colors from Overworld with L/R?

Hello- I am trying to figure out a way to make it so that the player can toggle between the special world color palette and
the standard overworld palette by pressing L or R on the overworld. Is there a way to do this?
-[Insert Signature Here]


It's possible, but does take a little bit of ASM work. SMW doesn't really provide an easy way to reload the entire palette, so instead you'd have to manually do so using a DMA. Like this:

Code
Pal_Normal:  incbin PalNormal.mw3
Pal_Special: incbin PalSpecial.mw3

!ram_useSpecial     =   $1F48   ; free RAM for toggling the special world
!ram_mirror         =   $1879   ; free RAM mirror of the above to check for when the flag is changed

Init:
    LDA !ram_useSpecial
    EOR #$01
    STA !ram_mirror
    RTL
    
Main:
    LDA $18         ; check for L/R
    AND #$30
    BEQ .return
    LDA !ram_useSpecial
    EOR #$01
    STA !ram_useSpecial
  .return:
    RTL

NMI:
    LDA !ram_useSpecial
    CMP !ram_mirror
    BEQ .return
    STA !ram_mirror
    
    REP #$10
    
    PHK : PLA       ; source
    STA $4304
    LDX.w #Pal_Normal
    LDA !ram_useSpecial
    BEQ +
    LDX.w #Pal_Special
  + STX $4302
    
    LDX #$0200      ; size
    STX $4305
    STZ $4307
    
    LDA #$00        ; control
    STA $2121
    LDX #$2200
    STX $4300
    LDA #$01
    STA $420B
    
    SEP #$10
  .return
    RTL

To use it, first export both the normal and special world palettes from LM with the #lm{exppal} button in the palette editor, and set the file type to export as to the ".mw3" format (instead of the default .pal). Put both the code above (as a .asm file) and the two palettes into UberASM Tool's overworld folder. You can name the palette files whatever, but make sure to change the "incbin" statements at the top of the ASM file to reference them. If successful, it should let you toggle between the two palettes with L/R:



Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thank you so much! Appreciate it!
-[Insert Signature Here]