NMLTutorial/Base graphics replacement

From TTWiki
< NMLTutorial
Revision as of 15:31, 26 June 2012 by FooBar (talk | contribs) (intermediate save)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A base graphics set provides the graphics you see when you have no NewGRFs loaded. If you don't want to add any new elements to the game, you can easily replace just these graphics via NewGRF.

There are to distinct types of base graphis: those originating from TTD and those that were added later to TTDPatch and OpenTTD. The first type is replaced by means of the replace block, the latter by means of the replacenew block. The way these blocks work are similar to the spriteset block.

Replace TTD sprites

And by this we mean the graphics that originally were in TTD. If you use OpenGFX, this will of course replace OpenGFX sprites and not TTD sprites. But in either case we mean replacements of the sprites in trg1(r).grf (TTD) or ogfx1_base.grf. It's useful to have a decode (grfcodec) of either of those grfs available to look up the sprite numbers. If you don't have that, you can find one here (choose to view the full resolution version below the thumbnail).

Once you have the sprites you want to replace and know their sprite numbers, you can start writing your replace. The general syntax is as follows:

replace [<identifier>] (<sprite-id> [, <image-file>]) {
	<list_of_realsprites>
}

The <identifier> is something you choose yourself. It's useful to prefix it with replace_ to avoid confusion with other identifiers in your code. It's optional if you only want to replace regular 8 bit sprites, but required if you also want to provide 32 bit sprites and/or sprites for different zoom levels. The <sprite-id> is the sprite number of the first sprite you want to replace. You can then place all consecutive replacement sprites in this block. As soon as there is a gap, you start a new replace block. The <image-file> is again optional. Like with a spriteset you can either provide a single filename for all sprites inside the block, or omit the filename here and specify the filename for each realsprite individually.

The <list_of_realsprites> is the same as for spriteset blocks.

Climates other than temperate

Replace OpenGFX sprites

NML Tutorial: Base graphics replacement