src/gfxinit.cpp
author rubidium
Sat, 20 Oct 2007 21:39:50 +0000
changeset 7772 c89384e3f8de
parent 7767 9866e9700e62
child 7789 ffac1a901f54
permissions -rw-r--r--
(svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
     3
/** @file gfxinit.cpp */
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1844
diff changeset
     6
#include "openttd.h"
1299
39c06aba09aa (svn r1803) Move debugging stuff into files of it's own
tron
parents: 1250
diff changeset
     7
#include "debug.h"
2163
b17b313113a0 (svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents: 2159
diff changeset
     8
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#include "gfx.h"
2340
e18ef06bc59a (svn r2866) Move all functions and tables which aren't directly involved in managing the sprite heap to a new file gfxinit.c.
tron
parents: 2339
diff changeset
    10
#include "gfxinit.h"
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents: 1348
diff changeset
    11
#include "spritecache.h"
1363
775a7ee52369 (svn r1867) Include tables/sprites.h only in files which need it
tron
parents: 1361
diff changeset
    12
#include "table/sprites.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
#include "fileio.h"
4200
e6ba94085b81 (svn r5684) - Codechange: create an strtolower() function that uses tolower() on a whole string and apply it in the places this was used.
Darkvater
parents: 4059
diff changeset
    14
#include "string.h"
463
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 452
diff changeset
    15
#include "newgrf.h"
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    16
#include "md5.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2142
diff changeset
    17
#include "variables.h"
5156
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
    18
#include "fontcache.h"
4472
93758d1da52d (svn r6257) Use memcmp() to check the MD5 sum instead of using a home brewed loop
tron
parents: 4209
diff changeset
    19
#include <string.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    21
struct MD5File {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
    22
	const char * filename;     ///< filename
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
    23
	md5_byte_t hash[16];       ///< md5 sum of the file
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    24
};
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    25
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    26
struct FileList {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
    27
	MD5File basic[4];          ///< grf files that always have to be loaded
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
    28
	MD5File landscape[3];      ///< landscape specific grf files
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    29
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
    31
#include "table/files.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
#include "table/landscape_sprite.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    34
static const SpriteID * const _landscape_spriteindexes[] = {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
	_landscape_spriteindexes_1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
	_landscape_spriteindexes_2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
	_landscape_spriteindexes_3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    40
static const SpriteID * const _slopes_spriteindexes[] = {
37
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    41
	_slopes_spriteindexes_0,
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    42
	_slopes_spriteindexes_1,
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    43
	_slopes_spriteindexes_2,
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    44
	_slopes_spriteindexes_3,
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    45
};
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    46
7767
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    47
static const SpriteID * const _halftile_foundation_spriteindexes[] = {
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    48
	_halftile_foundation_spriteindexes_0,
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    49
	_halftile_foundation_spriteindexes_1,
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    50
	_halftile_foundation_spriteindexes_2,
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    51
	_halftile_foundation_spriteindexes_3,
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    52
};
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
    53
37
61bf1df68d82 (svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents: 0
diff changeset
    54
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    55
static uint LoadGrfFile(const char* filename, uint load_index, int file_index)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
{
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    57
	uint load_index_org = load_index;
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    58
	uint sprite_id = 0;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	FioOpenFile(file_index, filename);
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    61
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
    62
	DEBUG(sprite, 2, "Reading grf-file '%s'", filename);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    64
	while (LoadNextSprite(load_index, file_index, sprite_id)) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
		load_index++;
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
    66
		sprite_id++;
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    67
		if (load_index >= MAX_SPRITES) {
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
    68
			error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
	}
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
    71
	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    73
	return load_index - load_index_org;
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    74
}
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
    75
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
    76
7772
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    77
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl)
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    78
{
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    79
	uint start;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    80
	while ((start = *index_tbl++) != END) {
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    81
		uint end = *index_tbl++;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    82
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    83
		if (start == SKIP) { // skip sprites (amount in second var)
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    84
			SkipSprites(end);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    85
			(*sprite_id) += end;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    86
		} else { // load sprites and use indexes from start to end
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    87
			do {
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    88
			#ifdef NDEBUG
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    89
				LoadNextSprite(start, file_index, *sprite_id);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    90
			#else
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    91
				bool b = LoadNextSprite(start, file_index, *sprite_id);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    92
				assert(b);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    93
			#endif
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    94
				(*sprite_id)++;
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    95
			} while (++start <= end);
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    96
		}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    97
	}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    98
}
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
    99
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   100
static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index)
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
   101
{
6908
6b1324d7a2c9 (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID
truelight
parents: 6780
diff changeset
   102
	uint sprite_id = 0;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   103
365
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
   104
	FioOpenFile(file_index, filename);
957b98a0e1e8 (svn r553) -newgrf: Special routine for loading newgrf files. LoadNewGrfFile() introduced; will get more handy when loading stages will be introduced (octo and pasky).
darkvater
parents: 364
diff changeset
   105
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   106
	DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
7772
c89384e3f8de (svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
rubidium
parents: 7767
diff changeset
   108
	LoadSpritesIndexed(file_index, &sprite_id, index_tbl);
184
dbeaaaf8b2bb (svn r185) -Fix: [1016954] Cached_sprites does now work again
truelight
parents: 182
diff changeset
   109
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   112
/* Check that the supplied MD5 hash matches that stored for the supplied filename */
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   113
static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn)
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   114
{
4472
93758d1da52d (svn r6257) Use memcmp() to check the MD5 sum instead of using a home brewed loop
tron
parents: 4209
diff changeset
   115
	if (memcmp(file.hash, digest, sizeof(file.hash)) == 0) return true;
93758d1da52d (svn r6257) Use memcmp() to check the MD5 sum instead of using a home brewed loop
tron
parents: 4209
diff changeset
   116
	if (warn) fprintf(stderr, "MD5 of %s is ****INCORRECT**** - File Corrupt.\n", file.filename);
93758d1da52d (svn r6257) Use memcmp() to check the MD5 sum instead of using a home brewed loop
tron
parents: 4209
diff changeset
   117
	return false;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   118
}
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   119
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   120
/* Calculate and check the MD5 hash of the supplied filename.
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   121
 * returns true if the checksum is correct */
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   122
static bool FileMD5(const MD5File file, bool warn)
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   123
{
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   124
	size_t size;
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   125
	FILE *f = FioFOpenFile(file.filename, "rb", DATA_DIR, &size);
5482
0528f1dfb732 (svn r7766) -Fix: [OSX] removed incorrect debug message about corrupted/missing grf files
bjarni
parents: 5475
diff changeset
   126
862
9baf2b0cdb18 (svn r1343) -Fix: [Graphic] Autorail icon is now correct (Darkvater)
truelight
parents: 614
diff changeset
   127
	if (f != NULL) {
2028
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   128
		md5_state_t filemd5state;
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   129
		md5_byte_t buffer[1024];
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   130
		md5_byte_t digest[16];
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   131
		size_t len;
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   132
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   133
		md5_init(&filemd5state);
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   134
		while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) {
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   135
			size -= len;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   136
			md5_append(&filemd5state, buffer, len);
7574
40e7c5575a2a (svn r11099) -Codechange: allow on opening of a file via FioFOpenFile to request the size of the file, so we can keep that in mind
truelight
parents: 6917
diff changeset
   137
		}
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   138
6917
68ede6d8739e (svn r10170) -Codechange: remove some duplication of code.
rubidium
parents: 6908
diff changeset
   139
		if (ferror(f) && warn) ShowInfoF("Error Reading from %s \n", file.filename);
7592
792daecf7c77 (svn r11119) -Codechange: analyze .tar files upon loading, remembering their files and offsets, which speeds up .tar handling with a big factor
truelight
parents: 7574
diff changeset
   140
		FioFCloseFile(f);
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   141
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   142
		md5_finish(&filemd5state, digest);
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2588
diff changeset
   143
		return CheckMD5Digest(file, digest, warn);
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   144
	} else { // file not found
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   145
		return false;
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   146
	}
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   147
}
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   148
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   149
/* Checks, if either the Windows files exist (TRG1R.GRF) or the DOS files (TRG1.GRF)
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   150
 * by comparing the MD5 checksums of the files. _use_dos_palette is set accordingly.
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 966
diff changeset
   151
 * If neither are found, Windows palette is assumed.
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   152
 *
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   153
 * (Note: Also checks sample.cat for corruption) */
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6179
diff changeset
   154
void CheckExternalFiles()
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   155
{
1355
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   156
	uint i;
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   157
	/* count of files from this version */
1355
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   158
	uint dos = 0;
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   159
	uint win = 0;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   160
2028
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   161
	for (i = 0; i < 2; i++) if (FileMD5(files_dos.basic[i], true)) dos++;
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   162
	for (i = 0; i < 3; i++) if (FileMD5(files_dos.landscape[i], true)) dos++;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   163
2028
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   164
	for (i = 0; i < 2; i++) if (FileMD5(files_win.basic[i], true)) win++;
fff064370a36 (svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents: 2027
diff changeset
   165
	for (i = 0; i < 3; i++) if (FileMD5(files_win.landscape[i], true)) win++;
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   166
1355
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   167
	if (!FileMD5(sample_cat_win, false) && !FileMD5(sample_cat_dos, false))
5576
b19c640dfc37 (svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents: 5482
diff changeset
   168
		ShowInfo("Your 'sample.cat' file is corrupted or missing!");
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   169
4934
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   170
	for (i = 0; i < lengthof(files_openttd); i++) {
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   171
		if (!FileMD5(files_openttd[i], false)) {
5576
b19c640dfc37 (svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents: 5482
diff changeset
   172
			ShowInfoF("Your '%s' file is corrupted or missing!", files_openttd[i].filename);
4934
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   173
		}
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   174
	}
e62da41b70e3 (svn r6921) - PEBKAC: Add an MD5 sum check of our own data files, and warn if they don't match.
peter1138
parents: 4795
diff changeset
   175
1380
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   176
	/*
1389
fe967eec43d1 (svn r1893) If -i was specified respect it
tron
parents: 1381
diff changeset
   177
	 * forced DOS palette via command line -> leave it that way
1380
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   178
	 * all Windows files present -> Windows palette
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   179
	 * all DOS files present -> DOS palette
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   180
	 * no Windows files present and any DOS file present -> DOS palette
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   181
	 * otherwise -> Windows palette
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   182
	 */
1389
fe967eec43d1 (svn r1893) If -i was specified respect it
tron
parents: 1381
diff changeset
   183
	if (_use_dos_palette) {
fe967eec43d1 (svn r1893) If -i was specified respect it
tron
parents: 1381
diff changeset
   184
		return;
fe967eec43d1 (svn r1893) If -i was specified respect it
tron
parents: 1381
diff changeset
   185
	} else if (win == 5) {
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   186
		_use_dos_palette = false;
1381
6cfd0991443d (svn r1885) Fix typo in r1884
tron
parents: 1380
diff changeset
   187
	} else if (dos == 5 || (win == 0 && dos > 0)) {
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   188
		_use_dos_palette = true;
1380
72aa0a5df4db (svn r1884) Change palette detection algorithm: Use the DOS palette if there are no Windows .grfs but at least one DOS .grf
tron
parents: 1378
diff changeset
   189
	} else {
961
e9abf6f087f8 (svn r1453) Feature: MD5 hash check for TTD files
dominik
parents: 884
diff changeset
   190
		_use_dos_palette = false;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   191
	}
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   192
}
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   193
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   194
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   195
static const SpriteID trg1idx[] = {
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   196
	   0,    1, ///< Mouse cursor, ZZZ
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   197
/* Medium font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   198
	   2,   92, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   199
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   200
	 160,  160, ///< Move Ÿ to the correct position
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   201
	  98,   98, ///< Up arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   202
	 131,  133,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   203
	SKIP,    1, ///< skip currency sign
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   204
	 135,  135,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   205
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   206
	 137,  137,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   207
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   208
	 139,  139,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   209
	 140,  140, ///< @todo Down arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   210
	 141,  141,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   211
	 142,  142, ///< @todo Check mark
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   212
	 143,  143, ///< @todo Cross
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   213
	 144,  144,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   214
	 145,  145, ///< @todo Right arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   215
	 146,  149,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   216
	 118,  122, ///< Transport markers
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   217
	SKIP,    2,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   218
	 157,  157,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   219
	 114,  115, ///< Small up/down arrows
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   220
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   221
	 161,  225,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   222
/* Small font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   223
	 226,  316, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   224
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   225
	 384,  384, ///< Move Ÿ to the correct position
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   226
	 322,  322, ///< Up arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   227
	 355,  357,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   228
	SKIP,    1, ///< skip currency sign
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   229
	 359,  359,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   230
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   231
	 361,  361,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   232
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   233
	 363,  363,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   234
	 364,  364, ////< @todo Down arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   235
	 365,  366,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   236
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   237
	 368,  368,
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   238
	 369,  369, ///< @todo Right arrow
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   239
	 370,  373,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   240
	SKIP,    7,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   241
	 381,  381,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   242
	SKIP,    3,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   243
	 385,  449,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   244
/* Big font */
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   245
	 450,  540, ///< ' ' till 'z'
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   246
	SKIP,   36,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   247
	 608,  608, ///< Move Ÿ to the correct position
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   248
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   249
	 579,  581,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   250
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   251
	 583,  583,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   252
	SKIP,    5,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   253
	 589,  589,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   254
	SKIP,   15,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   255
	 605,  605,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   256
	SKIP,    3,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   257
	 609,  625,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   258
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   259
	 627,  632,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   260
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   261
	 634,  639,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   262
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   263
	 641,  657,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   264
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   265
	 659,  664,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   266
	SKIP,    2,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   267
	 667,  671,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   268
	SKIP,    1,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   269
	 673,  673,
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   270
/* Graphics */
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   271
	 674, 4792,
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   272
	END
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   273
};
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   274
2565
de04ba1d3a5c (svn r3102) - Fix (regression): Newly added sprite had problems when newgrf's where loaded. Thanks Tron for explaining what the problem was and how it should be solved.
Darkvater
parents: 2559
diff changeset
   275
/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
de04ba1d3a5c (svn r3102) - Fix (regression): Newly added sprite had problems when newgrf's where loaded. Thanks Tron for explaining what the problem was and how it should be solved.
Darkvater
parents: 2559
diff changeset
   276
 * amount of sprites and add them to the end of the list, with the index of
de04ba1d3a5c (svn r3102) - Fix (regression): Newly added sprite had problems when newgrf's where loaded. Thanks Tron for explaining what the problem was and how it should be solved.
Darkvater
parents: 2559
diff changeset
   277
 * the old sprite-count offset from SPR_OPENTTD_BASE. With this there is no
de04ba1d3a5c (svn r3102) - Fix (regression): Newly added sprite had problems when newgrf's where loaded. Thanks Tron for explaining what the problem was and how it should be solved.
Darkvater
parents: 2559
diff changeset
   278
 * correspondence of any kind with the ID's in the grf file, but results in
de04ba1d3a5c (svn r3102) - Fix (regression): Newly added sprite had problems when newgrf's where loaded. Thanks Tron for explaining what the problem was and how it should be solved.
Darkvater
parents: 2559
diff changeset
   279
 * a maximum use of sprite slots. */
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   280
static const SpriteID _openttd_grf_indexes[] = {
2571
550a7d323ced (svn r3108) Confine the use of SPR_OPENTTD_BASE to table/sprites.h by adding/using some sprite enums
tron
parents: 2565
diff changeset
   281
	SPR_IMG_AUTORAIL, SPR_CURSOR_WAYPOINT, // icons etc
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   282
	134, 134,  ///< euro symbol medium size
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   283
	582, 582,  ///<  euro symbol large size
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   284
	358, 358,  ///<  euro symbol tiny
2571
550a7d323ced (svn r3108) Confine the use of SPR_OPENTTD_BASE to table/sprites.h by adding/using some sprite enums
tron
parents: 2565
diff changeset
   285
	SPR_CURSOR_CANAL, SPR_IMG_FASTFORWARD, // more icons
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   286
	648, 648, ///<  nordic char: æ
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   287
	616, 616, ///<  nordic char: Æ
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   288
	666, 666, ///<  nordic char: ø
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   289
	634, 634, ///<  nordic char: Ø
4935
1eeda247f1ea (svn r6922) -Feature: Add proper cloning sprites and cursors, different for each vehicle. Big thanks
Darkvater
parents: 4934
diff changeset
   290
	SPR_PIN_UP, SPR_CURSOR_CLONE_TRAIN, // more icons
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   291
	382, 383, ///<  Œ œ tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   292
	158, 159, ///<  Œ œ medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   293
	606, 607, ///<  Œ œ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   294
	360, 360, ///<  Š tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   295
	362, 362, ///<  š tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   296
	136, 136, ///<  Š medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   297
	138, 138, ///<  š medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   298
	584, 584, ///<  Š large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   299
	586, 586, ///<  š large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   300
	626, 626, ///<  Ð large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   301
	658, 658, ///<  ð large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   302
	374, 374, ///<  Ž tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   303
	378, 378, ///<  ž tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   304
	150, 150, ///<  Ž medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   305
	154, 154, ///<  ž medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   306
	598, 598, ///<  Ž large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   307
	602, 602, ///<  ž large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   308
	640, 640, ///<  Þ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   309
	672, 672, ///<  þ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   310
	380, 380, ///<  º tiny
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   311
	156, 156, ///<  º medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   312
	604, 604, ///<  º large
6179
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   313
	317, 320, ///<  { | } ~ tiny
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   314
	 93,  96, ///<  { | } ~ medium
d19b0137d8e4 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6103
diff changeset
   315
	541, 544, ///<  { | } ~ large
2571
550a7d323ced (svn r3108) Confine the use of SPR_OPENTTD_BASE to table/sprites.h by adding/using some sprite enums
tron
parents: 2565
diff changeset
   316
	SPR_HOUSE_ICON, SPR_HOUSE_ICON,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   317
	585, 585, ///<  § large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   318
	587, 587, ///<  © large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   319
	592, 592, ///<  ® large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   320
	594, 597, ///<  ° ± ² ³ large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   321
	633, 633, ///<  × large
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   322
	665, 665, ///<  ÷ large
4935
1eeda247f1ea (svn r6922) -Feature: Add proper cloning sprites and cursors, different for each vehicle. Big thanks
Darkvater
parents: 4934
diff changeset
   323
	SPR_SELL_TRAIN, SPR_SHARED_ORDERS_ICON,
6729
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   324
	377, 377, ///<  · small
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   325
	153, 153, ///<  · medium
302e2c8fff07 (svn r9961) -Fix (r7182): some file were still in iso8859-15 instead of utf8.
rubidium
parents: 6691
diff changeset
   326
	601, 601, ///<  · large
6103
d38163ddfef9 (svn r8838) -Feature: Show newgrf error messages loaded in Action B in the newgrf gui
maedhros
parents: 6012
diff changeset
   327
	SPR_WARNING_SIGN, SPR_WARNING_SIGN,
2588
e719db837e8a (svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents: 2577
diff changeset
   328
	END
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   329
};
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   330
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   331
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6179
diff changeset
   332
static void LoadSpriteTables()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   333
{
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2588
diff changeset
   334
	const FileList* files = _use_dos_palette ? &files_dos : &files_win;
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2588
diff changeset
   335
	uint load_index;
1355
fbb8ffafb25a (svn r1859) Miscellaneous style changes
tron
parents: 1354
diff changeset
   336
	uint i;
614
b96f987dbf80 (svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents: 579
diff changeset
   337
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   338
	LoadGrfIndexed(files->basic[0].filename, trg1idx, 0);
2407
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   339
	DupSprite(  2, 130); // non-breaking space medium
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   340
	DupSprite(226, 354); // non-breaking space tiny
6c378ce4d469 (svn r2933) Implement the non-breaking space
tron
parents: 2353
diff changeset
   341
	DupSprite(450, 578); // non-breaking space large
2353
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   342
	load_index = 4793;
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   343
f431786ac7b3 (svn r2879) Major step twoards ISO-8859-15
tron
parents: 2342
diff changeset
   344
	for (i = 1; files->basic[i].filename != NULL; i++) {
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   345
		load_index += LoadGrfFile(files->basic[i].filename, load_index, i);
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   346
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
5151
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   348
	/* Load additional sprites for climates other than temperate */
6357
f0f5e7d1713c (svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents: 6248
diff changeset
   349
	if (_opt.landscape != LT_TEMPERATE) {
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   350
		LoadGrfIndexed(
5151
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   351
			files->landscape[_opt.landscape - 1].filename,
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   352
			_landscape_spriteindexes[_opt.landscape - 1],
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   353
			i++
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   354
		);
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   355
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
4936
ac3a8ba42785 (svn r6923) -Codechange: Load nsignalsw.grf in the same way as other mandatory additional grfs
Darkvater
parents: 4935
diff changeset
   357
	assert(load_index == SPR_SIGNALS_BASE);
ac3a8ba42785 (svn r6923) -Codechange: Load nsignalsw.grf in the same way as other mandatory additional grfs
Darkvater
parents: 4935
diff changeset
   358
	load_index += LoadGrfFile("nsignalsw.grf", load_index, i++);
ac3a8ba42785 (svn r6923) -Codechange: Load nsignalsw.grf in the same way as other mandatory additional grfs
Darkvater
parents: 4935
diff changeset
   359
2512
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   360
	assert(load_index == SPR_CANALS_BASE);
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   361
	load_index += LoadGrfFile("canalsw.grf", load_index, i++);
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   362
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   363
	assert(load_index == SPR_SLOPES_BASE);
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   364
	LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++);
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 1019
diff changeset
   365
2309
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   366
	load_index = SPR_AUTORAIL_BASE;
c48687a02a6c (svn r2833) Remove saving of sprite cache data:
tron
parents: 2305
diff changeset
   367
	load_index += LoadGrfFile("autorail.grf", load_index, i++);
142
0c2bd172af05 (svn r143) Fix: newgrfs are working again
dominik
parents: 74
diff changeset
   368
3355
e414a0b104a6 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 3252
diff changeset
   369
	assert(load_index == SPR_ELRAIL_BASE);
e414a0b104a6 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 3252
diff changeset
   370
	load_index += LoadGrfFile("elrailsw.grf", load_index, i++);
e414a0b104a6 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 3252
diff changeset
   371
3113
d79500c648da (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 2639
diff changeset
   372
	assert(load_index == SPR_2CCMAP_BASE);
d79500c648da (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 2639
diff changeset
   373
	load_index += LoadGrfFile("2ccmap.grf", load_index, i++);
d79500c648da (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 2639
diff changeset
   374
2512
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   375
	assert(load_index == SPR_OPENTTD_BASE);
a66b16c61a69 (svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
tron
parents: 2411
diff changeset
   376
	LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++);
2577
e2321aed315f (svn r3114) Close two gaps in the sprite array when loading openttd.grf. That's seven more free sprite slots, yay!
tron
parents: 2571
diff changeset
   377
	load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT;
142
0c2bd172af05 (svn r143) Fix: newgrfs are working again
dominik
parents: 74
diff changeset
   378
4059
b1e1c1193f0a (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents: 3355
diff changeset
   379
	assert(load_index == SPR_AIRPORTX_BASE);
b1e1c1193f0a (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents: 3355
diff changeset
   380
	load_index += LoadGrfFile("airports.grf", load_index, i++);
b1e1c1193f0a (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents: 3355
diff changeset
   381
6012
065d7234a7a9 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents: 5764
diff changeset
   382
	assert(load_index == SPR_ROADSTOP_BASE);
065d7234a7a9 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents: 5764
diff changeset
   383
	load_index += LoadGrfFile("roadstops.grf", load_index, i++);
065d7234a7a9 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents: 5764
diff changeset
   384
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6357
diff changeset
   385
	assert(load_index == SPR_GROUP_BASE);
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6357
diff changeset
   386
	load_index += LoadGrfFile("group.grf", load_index, i++);
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6357
diff changeset
   387
6691
f9adbb0be102 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium
parents: 6643
diff changeset
   388
	assert(load_index == SPR_TRAMWAY_BASE);
f9adbb0be102 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium
parents: 6643
diff changeset
   389
	load_index += LoadGrfFile("tramtrkw.grf", load_index, i++);
f9adbb0be102 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium
parents: 6643
diff changeset
   390
6764
d09d8d618a07 (svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents: 6729
diff changeset
   391
	assert(load_index == SPR_ONEWAY_BASE);
d09d8d618a07 (svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents: 6729
diff changeset
   392
	load_index += LoadGrfFile("oneway.grf", load_index, i++);
d09d8d618a07 (svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents: 6729
diff changeset
   393
7601
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7592
diff changeset
   394
	load_index++; // SPR_EMPTY_BOUNDING_BOX
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7592
diff changeset
   395
7767
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   396
	assert(load_index == SPR_HALFTILE_FOUNDATION_BASE);
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   397
	LoadGrfIndexed("halffndw.grf", _halftile_foundation_spriteindexes[_opt.landscape], i++);
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   398
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   399
	load_index = SPR_HALFTILE_SELECTION_BASE;
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   400
	load_index += LoadGrfFile("halfselw.grf", load_index, i++);
9866e9700e62 (svn r11316) -Codechange: add support for the half-tile (selection) graphics.
rubidium
parents: 7601
diff changeset
   401
6780
ba49b125d95e (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 6764
diff changeset
   402
	assert(load_index == SPR_FLAGS_BASE);
ba49b125d95e (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 6764
diff changeset
   403
	load_index += LoadGrfFile("flags.grf", load_index, i++);
ba49b125d95e (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 6764
diff changeset
   404
5156
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   405
	/* Initialize the unicode to sprite mapping table */
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   406
	InitializeUnicodeGlyphMap();
771ed0d9f836 (svn r7254) -Fix (r7250): move unicode glyph map initialisation to just before newgrf files are loaded, else newgrf glyphs will be cleared out too. (thanks Hadez)
peter1138
parents: 5151
diff changeset
   407
2342
aae24c9661ba (svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents: 2340
diff changeset
   408
	LoadNewGRF(load_index, i);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   409
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   410
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   411
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6179
diff changeset
   412
void GfxLoadSprites()
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1070
diff changeset
   413
{
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   414
	DEBUG(sprite, 2, "Loading sprite set %d", _opt.landscape);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   415
5151
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   416
	GfxInitSpriteMem();
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   417
	LoadSpriteTables();
23150e1b0660 (svn r7246) -Codechange: Always reload sprite and NewGRF data when loading or starting a game, instead of only when the climate type is different.
peter1138
parents: 5000
diff changeset
   418
	GfxInitPalettes();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   419
}