+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Palette Change?
Pages: [1]
Author Topic: Palette Change?  (Read 2 times)
krazykevin
Guest
« on: April 30, 2008, 03:47:02 pm »

Is there any way you can change what palette a sprite is using? Like have a sprite use an existing palette rather than changing it.

For example: There's a green palette "assigned" to Sprite A and Sprite B. There's also another green palette being used. How can I reassign the second palette to Sprite B, so if I change the first palette to brown, Sprite A will be brown and Sprite B will still be green?
« Last Edit: April 30, 2008, 03:56:20 pm by krazykevin »
Disch
Guest
« Reply #1 on: April 30, 2008, 03:53:23 pm »

Yes
krazykevin
Guest
« Reply #2 on: April 30, 2008, 03:57:23 pm »

Umm... How?
Disch
Guest
« Reply #3 on: April 30, 2008, 03:59:04 pm »

It depends on the game and what platform it's on.

krazykevin
Guest
« Reply #4 on: April 30, 2008, 04:01:57 pm »

I'm working on SMB for the NES.
Disch
Guest
« Reply #5 on: April 30, 2008, 04:13:56 pm »

Palette assignment is often called "attribute" (note that attributes often include other things, such as H/V flipping, priority, etc).  Often times, such information is stored in a lookup table in the ROM.  For NES ROMs, since there can only be 4 sprite palettes active at once, the assigned palette is usually just a number between 0-3.

After looking at the SMB disassembly (available on this site -- in the docs section, I believe, too lazy to dig up a link right now), I found a lookup table labeled "EnemyAttributeData" which I'm betting is what you want.  It starts at offset 0x0686B in the ROM.  I'm unsure which byte coresponds to which enemy, so you may have to do a bit of tinkering.


On a side note:  I was kind of a big wiseass in this thread because your question was kind of poor.  You really should provide as much relevent information as you can when posting a question.
frantik
Guest
« Reply #6 on: April 30, 2008, 05:54:00 pm »

this should help a lil Wink

Code:
; $e73e-$e83f ( 0x674e - 0x684f ) enemy graphics table

EnemyGraphicsTable:
      .db $fc, $fc, $aa, $ab, $ac, $ad  ;buzzy beetle frame 1                     00
      .db $fc, $fc, $ae, $af, $b0, $b1  ;             frame 2                     06
      .db $fc, $a5, $a6, $a7, $a8, $a9  ;koopa troopa frame 1                     0c
      .db $fc, $a0, $a1, $a2, $a3, $a4  ;             frame 2                     12
      .db $69, $a5, $6a, $a7, $a8, $a9  ;koopa paratroopa frame 1                 18
      .db $6b, $a0, $6c, $a2, $a3, $a4  ;                 frame 2                 1e
      .db $fc, $fc, $96, $97, $98, $99  ;spiny frame 1                            24
      .db $fc, $fc, $9a, $9b, $9c, $9d  ;      frame 2                            2a
      .db $fc, $fc, $8f, $8e, $8e, $8f  ;spiny's egg frame 1                      30
      .db $fc, $fc, $95, $94, $94, $95  ;            frame 2                      36
      .db $fc, $fc, $dc, $dc, $df, $df  ;bloober frame 1                          3c
      .db $dc, $dc, $dd, $dd, $de, $de  ;        frame 2                          42
      .db $fc, $fc, $b2, $b3, $b4, $b5  ;cheep-cheep frame 1                      48
      .db $fc, $fc, $b6, $b3, $b7, $b5  ;            frame 2                      4e
      .db $fc, $fc, $70, $71, $72, $73  ;goomba                                   54
      .db $fc, $fc, $6e, $6e, $6f, $6f  ;koopa shell frame 1 (upside-down)        5a
      .db $fc, $fc, $6d, $6d, $6f, $6f  ;            frame 2                      60
      .db $fc, $fc, $6f, $6f, $6e, $6e  ;koopa shell frame 1 (rightsideup)        66
      .db $fc, $fc, $6f, $6f, $6d, $6d  ;            frame 2                      6c
      .db $fc, $fc, $f4, $f4, $f5, $f5  ;buzzy beetle shell frame 1 (rightsideup) 72
      .db $fc, $fc, $f4, $f4, $f5, $f5  ;                   frame 2               78
      .db $fc, $fc, $f5, $f5, $f4, $f4  ;buzzy beetle shell frame 1 (upside-down) 7e
      .db $fc, $fc, $f5, $f5, $f4, $f4  ;                   frame 2               84
      .db $fc, $fc, $fc, $fc, $ef, $ef  ;defeated goomba                          8a
      .db $b9, $b8, $bb, $ba, $bc, $bc  ;lakitu frame 1                           90
      .db $fc, $fc, $bd, $bd, $bc, $bc  ;       frame 2                           96
      .db $7a, $7b, $da, $db, $d8, $d8  ;princess                                 9c
      .db $cd, $cd, $ce, $ce, $cf, $cf  ;mushroom retainer                        a2
      .db $7d, $7c, $d1, $8c, $d3, $d2  ;hammer bro frame 1                       a8
      .db $7d, $7c, $89, $88, $8b, $8a  ;           frame 2                       ae
      .db $d5, $d4, $e3, $e2, $d3, $d2  ;           frame 3                       b4
      .db $d5, $d4, $e3, $e2, $8b, $8a  ;           frame 4                       ba
      .db $e5, $e5, $e6, $e6, $eb, $eb  ;piranha plant frame 1                    c0
      .db $ec, $ec, $ed, $ed, $ee, $ee  ;              frame 2                    c6
      .db $fc, $fc, $d0, $d0, $d7, $d7  ;podoboo                                  cc
      .db $bf, $be, $c1, $c0, $c2, $fc  ;bowser front frame 1                     d2
      .db $c4, $c3, $c6, $c5, $c8, $c7  ;bowser rear frame 1                      d8
      .db $bf, $be, $ca, $c9, $c2, $fc  ;       front frame 2                     de
      .db $c4, $c3, $c6, $c5, $cc, $cb  ;       rear frame 2                      e4
      .db $fc, $fc, $e8, $e7, $ea, $e9  ;bullet bill                              ea
      .db $f2, $f2, $f3, $f3, $f2, $f2  ;jumpspring frame 1                       f0
      .db $f1, $f1, $f1, $f1, $fc, $fc  ;           frame 2                       f6
      .db $f0, $f0, $fc, $fc, $fc, $fc  ;           frame 3                       fc
                                                                           
; $e840-$e85a ( 0x6850 - 0x686a ) enemy graphics table offsets based on enemy ID number
EnemyGfxTableOffsets:
      .db $0c, $0c, $00, $0c, $0c, $a8, $54, $3c
      .db $ea, $18, $48, $48, $cc, $c0, $18, $18
      .db $18, $90, $24, $ff, $48, $9c, $d2, $d8
      .db $f0, $f6, $fc

; $e85b-$e875 ( 0x686b - 0x6885 ) enemy attribute data
EnemyAttributeData:
      .db $01, $02, $03, $02, $01, $01, $03, $03
      .db $03, $01, $01, $02, $02, $21, $01, $02
      .db $01, $01, $02, $ff, $02, $02, $01, $01
      .db $02, $02, $02

to change the hammer bro attribute (for example) first you look at the sprite table and see the offset is 0xa8.  then you look at the offset table and see that $a8 is the 6th entry in the table.  then you modify the 6th entry in the attribute table

00 - mario color
01 - green/yellow/white color (default green koopa color)
02 - red/yellow/white color (default red koopa color)
03 - black/brown/tan (default goomba color)


« Last Edit: April 30, 2008, 06:04:22 pm by frantik »
krazykevin
Guest
« Reply #7 on: April 30, 2008, 10:00:47 pm »

 Shocked Wow. It seems pretty overwhelming to me. I'll experiment with it, though. I mean that's what rom hackers do right?

EDIT: Where can I find Mario's attributes? And how can I find which offset belongs to which sprite (for future hacks)?
« Last Edit: May 01, 2008, 02:49:55 pm by krazykevin »
krazykevin
Guest
« Reply #8 on: July 28, 2008, 02:03:58 pm »

Does anyone know where Mario's attributes are?
Hamtaro126
Guest
« Reply #9 on: July 29, 2008, 07:00:43 pm »

Quote from: krazykevin on July 28, 2008, 02:03:58 pm
Does anyone know where Mario's attributes are?

Mario uses Sprite Color 0, That means attributes are not implented for that character.

I am making a Conversion of SMB1 to MMC5 that will let you change it to another color.

If you want to make SMB1 hacks, It is best to use SMBDIS - The Comprehensive SMB1 disassembly to do hacks. And maybe you can put the attributes in.

One warning about SMBDIS: It uses X816, which is an outdated compiler.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC