docs/32bpp.txt
author rubidium
Wed, 09 Jul 2008 19:13:21 +0000
branch0.6
changeset 11128 b62a7b45babf
parent 7392 a716551b0c7f
permissions -rw-r--r--
(svn r13686) [0.6] -Backport from trunk:
- Fix: Memory leak when NewGRFs got forcefully disabled and they defined GOTO labels (r13675)
- Fix: Crash when drawing a non-real sprite caused by NewGRF interference [FS#2127] (r13674)
- Fix: Disable static NewGRFs when non-static NewGRFs query them in the context of network games. This makes it impossible for static NewGRFs to disable non-static NewGRFs and 'bad' things happening because the non-static NewGRF doesn't know about the static NewGRF (r13576)
- Fix: First determine where to *exactly* build a house before asking a NewGRF whether the location is good instead of possibly moving the house a tile after the NewGRF said the location is good (r13489)
- Fix: Do not crash when resolving vehicle sprite groups with zero sprites (r13397)
- Fix: In the purchase list, CB36 for capacity was not called for the first part of rail and road vehicles (r13385)
7392
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     1
32bpp and OpenTTD
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     2
=================
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     3
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     4
OpenTTD has 32bpp support. This means: OpenTTD still is 8bpp, but it has the
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     5
posibility to override the graphics with 32bpp. This means that it isn't a
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     6
replacement of grf or newgrf, but simply an addition. If you want to use 32bpp
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     7
graphics of a newgrf, you do need the newgrf itself too (with 8bpp graphics).
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     8
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
     9
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    10
The Format
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    11
----------
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    12
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    13
32bpp images are stored in PNG. They should go in:
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    14
  data/sprites/<grfname>/<SpriteID>.png
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    15
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    16
For example, a grfname would be 'openttd' (without .grf, lowercase), and the
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    17
SpriteID 3, to override the 3rd sprite in openttd.grf with a 32bpp version.
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    18
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    19
The format of this PNG can be almost anything, but we advise to use RGBA
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    20
format. Alpha-channel is fully supported.
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    21
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    22
As the core of OpenTTD is 8bpp, and because you of course want company colours
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    23
in your images, you will need to add a mask for every sprite that needs colour
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    24
remapping. The name is simular as above, only you have to put a 'm' behind the
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    25
SpriteID. This image should be a 8bpp palette image, where the palette is the
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    26
OpenTTD palette. Upon load of the PNG, the mask is loaded too, and overrides
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    27
the RGB (not the Alpha) of the original PNG image, and replacing it with a
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    28
8bpp color remapped and converted to 32bpp.
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    29
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    30
An other thing that OpenTTD needs in your png, is 2 tEXt chunks: x_offs and
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    31
y_offs. This to define the x- and y-offset, of course. Use the tool we supply
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    32
to add this information. Sadly enough most graphical editors trashes those
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    33
chunks upon save, so you have to readd it every time you save your image.
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    34
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    35
Your images should be the same as the grf, in size.
a716551b0c7f (svn r10143) -Add: store the filename of the grfs opened and allow easy access to the name
truelight
parents:
diff changeset
    36