Page 1 of 1

Having fun with sprite replacement

Posted: 27 Apr 2004 00:14
by ChrisCF
A complete grf file:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
0 * 4 03 00 00 00
1 * 48 08 06 43 4A FF 01 4C 69 76 65 72 79 20 63 68 65 63 6B 65 72 00 32 30 30 34 20 43 68 72 69 73 20 4D 2E 20 4A 61 63 6B 73 6F 6E 20 2D 20 47 50 00
2 * 5 0A 01 01 1A 0C
3 E:\MPS\TTWin95\newgrf\SPRITES\replace.pcx 0 0 01 12 32 -16 -6
All this is supposed to do is replace the bus that shows up in the colour selection window, so you can see a particular vehicle in all its player-colour permutations. Find attached an enlarged view of the unit in question, and how the thing looks in the colour selector.

Note that the actual .pcx file does not have the white border. Both pictures scaled to 200%.

Posted: 27 Apr 2004 09:46
by Korenn
to me it looks like the pcx you're using has an odd width?
ttd (or grfcodec) can only handle even width...

Posted: 27 Apr 2004 09:57
by Hyronymus
It's obviously f*** up (excusez le mot). Are you sure you coded everything right and didn't mix up xa dn y size/rel.

Posted: 27 Apr 2004 10:46
by ChrisCF
Korenn wrote:to me it looks like the pcx you're using has an odd width?
Learn to read :roll:
Hyronymus wrote:Are you sure you coded everything right and didn't mix up xa dn y size/rel.
Well, it's worked before, and I've followed the order specified in the header comments. I've also put the entire nfo above.

Posted: 27 Apr 2004 12:20
by Korenn
ChrisCF wrote:Learn to read :roll:
*rereads*

still nothing about the size of the pcx you're using.
learn to write :roll:

Posted: 27 Apr 2004 12:27
by Prof. Frink
In the picture comment he wrote:A unit, 12x32

Posted: 27 Apr 2004 12:35
by Patchman
Prof. Frink wrote:
In the picture comment he wrote:A unit, 12x32
That doesn't mention the PCX file, just the sprite within it.

I'm not sure if grfcodec can handle sprites at y=0, to be honest. Try:
- encode
- decode
- in decoded pcx, replace the sprite with the correct graphics
- encode again

Posted: 27 Apr 2004 20:47
by ChrisCF
The original file was 12x32, just like I said :roll:

Anyway, decoding and recoding has done the trick.