How to change sprite tile location(or whatever it's called)?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
How to change sprite tile location(or whatever it's called)?
by on (#175583)
Sorry if this is a noobish question or I'm posting in the wrong section, I'm kind of new to this.
I'm creating a hack of Super Mario Bros., and modifying Mario's graphics for a new character. However, I noticed that some of the tiles on Mario's standing sprite (specifically when he's big Mario) are mirrored versions of another tile (for example, the overalls/shoes tile), and the character that I want to replace Mario with doesn't have that type of symmetry. How would I be able to change a sprite's tile from one to another, as illustrated in the included image (and horizontally flip it in this case)?
As a note of interest, I use a SMB Rom builder. Will I need to modify the asm file, the chr file, or the Rom itself to change the tile?
Please try to describe this in the simplest possible method, as I think this might become a regular thing for me when it comes to graphics hacking.
Thanks for the help.
Re: How to change sprite tile location(or whatever it's call
by on (#175584)
I haven't tried it, but looking at the disasembly...
Quote:
DrawPlayer_Intermediate:

??
Or maybe

ChkForPlayerAttrib:

ora #%01000000


It looks like the 'ora #%01000000' line is responsible for the flipped tile. Replace with 'nop,nop' or with 'ora #0' would stop the flipping.

The metatile definitions for Mario are listed here...

Quote:
PlayerGraphicsTable:

...
Quote:
.db $00, $01, $4c, $4d, $4a, $4a, $4b, $4b ;big player standing


For example.

If I were you, I would do everything with your level editor first, and then try to locate these within the output ROM, and edit them as a last step.

Good luck.
Re: How to change sprite tile location(or whatever it's call
by on (#175589)
Thanks for that, it's working perfectly!
Re: How to change sprite tile location(or whatever it's call
by on (#175603)
Before I learned to program for the NES, I hacked SMB to make Sonic the main character. The methods I used were very crude: in addition to modifying the CHR, I just searched and replaced strings in the ROM. This worked fine for sprites and palettes, IIRC. I would simply search for the 8 tile indices that formed a sprite and replace that with new tile indices. If mirrored tiles were used, I would just flip them in the CHR so they'd look correct in the game! :lol: