News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Pause Suit Palettes

Started by Mentlegen, July 14, 2017, 09:36:42 AM

Previous topic - Next topic

Mentlegen

Anyone know how project base and Hyper Metroid can change samus's pause menu palettes whenever you switch suits? I have been able to get this far by going to addresses B6F000 and B6F0A0. however i cannot seem to make it change palettes when switching suits. Is it asm?

Quote58

Yes, scyzer wrote code that swaps the palette. I thought the code was released at some point but I can't seem to find where now.

Mentlegen

Quote from: Quote58 on July 14, 2017, 12:25:38 PM
Yes, scyzer wrote code that swaps the palette. I thought the code was released at some point but I can't seem to find where now.
Thanks man, ill be hunting for that now

Scyzer


LoROM

!PaletteLine = 0 ;Which line to save the new palette to
!PaletteBank = $B6 ;Bank for the palettes
!PaletteAddress = $F200 ;Address for the palettes. Each pallete is 1 line ($20 bytes). Order is Power, Varia, Gravity.

;Don't change stuff under here
org $82B5C5 : JSR SetupSuitColourOn
org $82B5E3 : JSR SetupSuitColourOff
org $8291BE : JSR SetupSuitColourLoad
org $82F70F
SetupSuitColourOn: JSR $A27E : BRA $03
SetupSuitColourOff: JSR $A29D : BRA $03
SetupSuitColourLoad: JSR $A615
Assume mx:%00
ApplySuitColour: PHX : PHY
LDX #$0004 : LDA $09A2 : BIT #$20 : BNE + : DEX #2 : BIT #$01 : BNE + : DEX #2
+ LDA #!PaletteBank*256 : STA $01 : LDA SuitIndex,X : STA $00
LDY #$00 : LDX #$00
- LDA [$00],Y : STA !PaletteLine*32+$7EC000,X
INY #2 : INX #2 : CPX #$20 : BCC -
PLY : PLX : RTS
SuitIndex: DW PowerPal,VariaPal,GravityPal
org !PaletteBank*65536+!PaletteAddress
PowerPal: Skip #$20
VariaPal: Skip #$20
GravityPal: Skip #$20


Quote58

#4
edit: the samus image is simply tilemaps, not a sprite, as a result you can only use the first 8 palette lines, and samus/enemy palette is in the second half, used for sprites.

Mentlegen

Quote from: Scyzer on July 15, 2017, 02:08:52 AM

LoROM

!PaletteLine = 0 ;Which line to save the new palette to
!PaletteBank = $B6 ;Bank for the palettes
!PaletteAddress = $F200 ;Address for the palettes. Each pallete is 1 line ($20 bytes). Order is Power, Varia, Gravity.

;Don't change stuff under here
org $82B5C5 : JSR SetupSuitColourOn
org $82B5E3 : JSR SetupSuitColourOff
org $8291BE : JSR SetupSuitColourLoad
org $82F70F
SetupSuitColourOn: JSR $A27E : BRA $03
SetupSuitColourOff: JSR $A29D : BRA $03
SetupSuitColourLoad: JSR $A615
Assume mx:%00
ApplySuitColour: PHX : PHY
LDX #$0004 : LDA $09A2 : BIT #$20 : BNE + : DEX #2 : BIT #$01 : BNE + : DEX #2
+ LDA #!PaletteBank*256 : STA $01 : LDA SuitIndex,X : STA $00
LDY #$00 : LDX #$00
- LDA [$00],Y : STA !PaletteLine*32+$7EC000,X
INY #2 : INX #2 : CPX #$20 : BCC -
PLY : PLX : RTS
SuitIndex: DW PowerPal,VariaPal,GravityPal
org !PaletteBank*65536+!PaletteAddress
PowerPal: Skip #$20
VariaPal: Skip #$20
GravityPal: Skip #$20

Thanks for your code, I applied it and got partial success, The suit palette doesn't change but the top of the pause screen does. Anyidea why?

Quote58

Are you also using the redone tilemaps and wireframe gfx? In a normal rom the wireframe doesn't use the palette line the asm swaps the palette to, it uses 1 colour from a palette line used for other stuff.

Mentlegen

Quote from: Quote58 on July 15, 2017, 05:26:46 PM
Are you also using the redone tilemaps and wireframe gfx? In a normal rom the wireframe doesn't use the palette line the asm swaps the palette to, it uses 1 colour from a palette line used for other stuff.

I am not using wireframe, currently i have the tiles and palettes in place of project base. This is what it looks like right now (attached)

Quote58

Oh, it's most likely because scyzer left the palette line as 0 but the tilemaps are using palette line 1, so although the palettes were being stored correctly, they were not being stored to the palette line that the tilemaps are using by default. To fix it just change !PaletteLine to 1

Mentlegen

Quote from: Quote58 on July 16, 2017, 11:43:14 PM
Oh, it's most likely because scyzer left the palette line as 0 but the tilemaps are using palette line 1, so although the palettes were being stored correctly, they were not being stored to the palette line that the tilemaps are using by default. To fix it just change !PaletteLine to 1
Thank you so much. all of you. It works in full capacity now.