Hacking DIY - Change Text and Sprite Colors
In this romhack you are going to change the color of the High Score text and the color of the Jumpman sprite.
For this hack you need a copy of the original 'dkong.zip' (Donkey Kong (US set 1)) and the HxD Editor to edit the romfiles.
A download link for the HxD Editor can be found on the 'LINKS' page.
Before we start the actual hacking, it is necessary to look how the game palettes determine the color of the different graphics in the game. The game has two different types of graphical elements: background graphics and sprites. The background graphics are build up from individual 8x8 pixel blocks and are used to display the stationary graphics like texts, girders, ladders, etc. The sprites are 16x16 pixel blocks that are used to display the moving graphics like Jumpman, Pauline, barrels, fireballs, pies, elevator platforms, etc.
The color of both background graphics and sprites is determined by the game palettes. The game palettes can be displayed by pressing the 'F4' button in a MAME emulator:
The game palette is configured using the two files c-2j.bpr en c-2k.bpr. The following picture overlays the color palette over both files. You can see here that the light green at the top right of the palette is the resultant of the value #0E (hexadecimal) in the c-2j.bpr file and the value #03 in the c-2k.bpr file.
The game palette can be broken down to four separate palettes that are selected in the game. Different screens in the game use different palettes. The following picture shows the four palettes and indicates in which screens they are used. The green markers indicate the parts of the palettes that determine the color of the girders and the ladders in these screens.
For the background graphics there is one mapping for all the screens that maps segments of 4 screenpositions to a color in the palette. The default mapping uses the same color for complete lines. This mapping is best illustrated using the High Score screen, as follows:
The background graphics mapping is configured using the file v-5e.bpr. The following picture shows how this maps to the line colors of the High Score screen. A column in the file corresponds to a line on the screen.
The numbers correspond to the 'groupings' in the palette for the screen as displayed in the following picture. Text always uses the third (rightmost) color of a block of the palette. So the top line of the screen (with 1UP, HIGH SCORE, 2UP) is defined as #00 (hexadecimal) and this corresponds to the red color in the 00 'grouping'. The next line (with the scores) is defined as #01 (hexadecimal) and this corresponds to the white color in the 01 'grouping'.
The sprites use the same palette as is used for the screen. For example the jumpman sprite uses the color of the 02 'grouping', the fireball sprites use the color of the 01 'grouping', the barrel sprites use the color of the 0B 'grouping and the bonus item sprites use the color of the 0A 'grouping'
Create a working folder for the romhack and place the copy of the original 'dkong.zip' into this folder.
Extract the files 'c-2j.bpr', 'c-2k.bpr' and 'v-5e.bpr' from the 'dkong.zip' to the working folder.
In order to change the color of Jumpman from red to green we have to change the red color in the marked 'groupings':
We are going to change it to the green from the Donkey Kong color table that corresponds with with value #0E in 'c-2j.bpr' and value #0B in 'c-2k.bpr'.
Start the HxD Editor and open the files 'c-2j.bpr' and 'c-2k.bpr' and change the contents according to the red values in the following pictures. To change a value just click in front of the number that you want to change, position the cursor and type the new number.
Save the files 'c-2j.bpr' and 'c-2k.bpr' after making the desired edits.
In order to change the color of the High Score text we change part of the color of the topmost line on the screen in such a way that the High Score text is changed into the blue of the marked 'groupings' shown above, but the 1UP and 2UP texts stay the original red color.
Start the HxD Editor and open the file 'v-5e.bpr' and change the contents as indicated with the red values in the following picture. To change a value just click in front of the number that you want to change, position the cursor and type the new number.
Save the file 'v-5e.bpr' after making the desired edits.
Add the files 'c-2j.bpr', 'c-2k.bpr' and 'v-5e.bpr' from the working folder back to the 'dkong.zip'.
The dkong.zip now contains the romhack with the changed colors of Jumpman and the High Score text. Test it by starting the rom with an emulator. Remember that the emulator must ignore the checksum errors that are caused by the changes that you made.