Replacing graphics in Car Jamboree

Page 1/4
| 2 | 3 | 4

Par MetallicaSepultura

Supporter (13)

Portrait de MetallicaSepultura

07-01-2023, 18:34

Hello. I'm new here, and i have a request.
I'm trying to switch two sprites in a game called "Car Jamboree". Basically i want to switch the yellow car, which is the player's one, with the green one.
I'm kind of unexpert with MSX programming. Can you help me with it?

!login ou Inscrivez-vous pour poster

Par aoineko

Paragon (1139)

Portrait de aoineko

07-01-2023, 21:23

Your question lacks some context.
Do you program in BASIC?
The obvious answer is to switch the position of the two cars, but if you're asking, it may not be that simple.

Par MetallicaSepultura

Supporter (13)

Portrait de MetallicaSepultura

07-01-2023, 23:35

I think the game itself is in assembly language, judging by the debugger built into blueMSX.
Anyway, the point isn't about changing cars position. i just need to switch the sprites like, the yellow car becomes the green one and viceversa, so that i have the green one as the playable vehicle.

Par aoineko

Paragon (1139)

Portrait de aoineko

07-01-2023, 23:53

Ah, okay. You're talking about an existing game.
A game in ROM? On disk?
You'd have to find the place where the program puts the color on the sprite (11 for yellow and 2 for green) and reverse them... but, that's like looking for a needle in a haystack.
With an emulator, you should have a way to put a break point when the program writes the color value in the first entries of the SAT (sprite attribute table). SAT address in VRAM depend on Screen mode but can be found in emulator. Color is 4th byte of each attribute entry (byte offset 3, 7, 11, 15, 19, ...).

Par Manuel

Ascended (19690)

Portrait de Manuel

08-01-2023, 00:17

aoineko: https://www.generation-msx.nl/software/omori-electric-compan... for some more info about this game...

Par MetallicaSepultura

Supporter (13)

Portrait de MetallicaSepultura

08-01-2023, 10:00

Quote:

You'd have to find the place where the program puts the color on the sprite

Well, not really a color changing. it's a sprite changing. Sorry if i wasn't clear with the explanation, but want i'm trying to do is switching the yellow car sprite for the green one and viceversa, so that i have green car as the playable one.

From what i know about old games programming, i should have to change also the palette values, because if you switch sprites and not the palette, the colors remain the same, but that's not a problem.

Par aoineko

Paragon (1139)

Portrait de aoineko

08-01-2023, 10:35

It's an MSX1 game so it's a fixed palette.
If you want to change the shape of the sprite as well, you have to check the modifications on the 3rd attribute of the sprites.
As a reminder the content of the SAT (sprite attribute table) is:

- Y position of the sprite #0          \
- X position of the sprite #0          | Sprite #0 attribute
- Shape of the sprite #0               |
- Color (and option) of the sprite #0  /
- Y position of the sprite #1          \
- X position of sprite #1              | Sprite #1 attribute
- Shape of the sprite #1               |
- Color (and option) of the sprite #2  /
- Y position of the sprite #2          \
- X position of sprite #2              | Sprite #2 attribute
- Shape of the sprite #2               |
- Color (and option) of the sprite #2  /
- ...

By placing breakpoints when the program writes to these locations in VRAM, you will know what to change in the program to reverse the color and shape.
Note that the color is probably set only once, but the shape is updated regularly as cars move.
However, you will need a basic knowledge of assembler to understand how it all works.

Par theNestruo

Champion (430)

Portrait de theNestruo

08-01-2023, 10:32

I have taken a look at the ROM structure (using this MSX-oriented this Binary files-2-PNG tool: bin2png --sprites) and graphic data appears uncompressed, only one half of each sprite, and only the non-rotated version (i.e.: the other half of the sprites and the rotated versions are code-generated).
Calculate the offsets of the data you want to change from the image (some math required), then do some changes with an hexadecimal editor to verify that you are modifying the right addresses.
Player sprite (looking up, two halves) seems to be at offset 0x087b: 0c 0f 1f 38 30 33 3f 1f 1f 3f 33 30 30 38 3f 3f 30 f0 f8 1c 0c 8c fc f8 f8 fc cc 0c 0c 1c fc f8

Par MetallicaSepultura

Supporter (13)

Portrait de MetallicaSepultura

08-01-2023, 11:40

Nice discovery, but for some reason BintoPng doesn't work on my computer. Is there some alternative?

Par theNestruo

Champion (430)

Portrait de theNestruo

08-01-2023, 12:28

Here's the default bin2png output:

Par aoineko

Paragon (1139)

Portrait de aoineko

08-01-2023, 13:25

MetallicaSepultura wrote:

Nice discovery, but for some reason BintoPng doesn't work on my computer. Is there some alternative?

No as adanced than BinToPng, but you try my online tool at https://aoineko.org/binviewer/
With those settings:

Page 1/4
| 2 | 3 | 4