News:

11 March 2016 - Forum Rules

Main Menu

change palette assigned to a sprite

Started by sebastianangel, May 30, 2021, 07:03:17 PM

Previous topic - Next topic

sebastianangel

Hello everyone, I am writing to request technical help that would come in handy in several projects that I have in mind and as time passes I am rediscovering new things! In this case I am with a doubt as to how the color palette assigned to a sprite? example:

I'm trying to learn since I don't know asm, but I found interesting the palette change that Mario does when he takes the flower and I thought if it could be applied in the same way to Toki when he takes the helmet to be able to change the color helmet by taking the palette color of an enemy

I was also wondering how to achieve this blinking effect?

Thank you very much in advance I hope to continue learning this, what I like, greetings :woot!:

FAST6191

The OAM is what controls the palette choice
http://wiki.nesdev.com/w/index.php/PPU_OAM
http://wiki.nesdev.com/w/index.php/PPU_palettes

The OAM is updated fairly often (even more so when moving) so you might need to intercept the commands the game normally uses there rather than writing your own randomly like you can do for hardcoding some cheats (if doing infinite lives in a game I can go find everything that touches the life counter, however once per frame I might instead

NES palettes are a bit more limited in what is allowed compared to later consoles, and many games already fill the palettes available, so be prepared to compromise on what you can get done here as well.

sebastianangel

Thank you very much I really appreciate the time you spent in explaining me and giving me good data where to investigate to deepen my knowledge, I will try to find those addresses through fceux, greetings friend :beer:

TRIFORCE89

I have a similar question.

I'd like to change the palette in Super Mario Bros. of the background fence graphic. I don't want to create a new palette though.

By default it shares a palette with (according to Data Crystal's ROM map): Title Screen Marquee/Icon/Text, Brickwork, Empty ? Blocks, Pyramid Blocks, Castles, Fencing, Treetrunks, Bridge Platforms, Mushroom Platform Stalks (4-2), Bill Blasters.

I'd like the fence to instead share a palette with: Bushes, Mountains, Pipes, Flagpole, Treetops, Bridgerails (2-3).

Basically just have it set to the pipe palette. Not something new.

Is there an easy way to do this in a hex editor, ideally. I use a Mac and the breadth of tools available to me is more limited.

Trax

The level tile mappings for (2x2) blocks are in one of 4 tables, each table associated to a different palette. At 0B08, there is a table for building the pointer to each table. These pointers point to the 4 tables with the tile mappings.

108B -> 0B10   Tiles with Palette 0
AC8B -> 0BAC   Tiles with Palette 1
648C -> 0C64   Tiles with Palette 2
8C8C -> 0C8C   Tiles with Palette 3 (cycling)


If you want one of these tile mapping entries to have another palette, you would have to transfer an entry from one table to another. In your case, you want to move your entry to Table 0. You will need to shift the other tables by one entry, and modify the pointers accordingly. If you have trouble understanding all this, I can help you through the process.

sebastianangel

Quote from: Trax on July 24, 2021, 09:35:35 PM
The level tile mappings for (2x2) blocks are in one of 4 tables, each table associated to a different palette. At 0B08, there is a table for building the pointer to each table. These pointers point to the 4 tables with the tile mappings.

108B -> 0B10   Tiles with Palette 0
AC8B -> 0BAC   Tiles with Palette 1
648C -> 0C64   Tiles with Palette 2
8C8C -> 0C8C   Tiles with Palette 3 (cycling)


If you want one of these tile mapping entries to have another palette, you would have to transfer an entry from one table to another. In your case, you want to move your entry to Table 0. You will need to shift the other tables by one entry, and modify the pointers accordingly. If you have trouble understanding all this, I can help you through the process.
ooh fantastic Trax :thumbsup: thank you very much for helping to understand, I will try to apply what you indicate here :crazy: