author | matthijs |
Wed, 22 Mar 2006 22:26:16 +0000 | |
branch | 0.4.5 |
changeset 9958 | bed516c67d61 |
parent 9939 | c4797077028a |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1844
diff
changeset
|
4 |
#include "openttd.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1250
diff
changeset
|
5 |
#include "debug.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#include "functions.h" |
0 | 7 |
#include "gfx.h" |
2340
0a9f3eeccb96
(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
|
8 |
#include "gfxinit.h" |
1349
07514c2cc6d1
(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
|
9 |
#include "spritecache.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1361
diff
changeset
|
10 |
#include "table/sprites.h" |
0 | 11 |
#include "fileio.h" |
463
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
452
diff
changeset
|
12 |
#include "newgrf.h" |
961 | 13 |
#include "md5.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2142
diff
changeset
|
14 |
#include "variables.h" |
0 | 15 |
#include <ctype.h> |
16 |
||
961 | 17 |
typedef struct MD5File { |
18 |
const char * const filename; // filename |
|
962
c1de16d93e46
(svn r1454) -Fix: small warnings in spritecache.c
darkvater
parents:
961
diff
changeset
|
19 |
const md5_byte_t hash[16]; // md5 sum of the file |
961 | 20 |
} MD5File; |
21 |
||
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
22 |
typedef struct FileList { |
1725
97841c222b55
(svn r2229) - Fix: [ 1188777 ] Non-existing sprite #5125 (presignal). The DOS grf file trgi.grf has 6 less sprites than the windows one. This results in some segfaults for certain sprites. Fixed it by added a dummy grf file consisting ofr 6 sprites and loaded when using DOS gfx at the appropiate place.
Darkvater
parents:
1437
diff
changeset
|
23 |
const MD5File basic[5]; // grf files that always have to be loaded |
961 | 24 |
const MD5File landscape[3]; // landscape specific grf files |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
25 |
} FileList; |
0 | 26 |
|
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
27 |
enum { |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
28 |
SKIP = 0xFFFE, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
29 |
END = 0xFFFF |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
30 |
}; |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
31 |
|
961 | 32 |
#include "table/files.h" |
0 | 33 |
#include "table/landscape_sprite.h" |
34 |
||
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
35 |
static const SpriteID * const _landscape_spriteindexes[] = { |
0 | 36 |
_landscape_spriteindexes_1, |
37 |
_landscape_spriteindexes_2, |
|
38 |
_landscape_spriteindexes_3, |
|
39 |
}; |
|
40 |
||
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
41 |
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
|
42 |
_slopes_spriteindexes_0, |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
43 |
_slopes_spriteindexes_1, |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
44 |
_slopes_spriteindexes_2, |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
45 |
_slopes_spriteindexes_3, |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
46 |
}; |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
47 |
|
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
48 |
|
2342
c19fb4f2df30
(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
|
49 |
static uint LoadGrfFile(const char* filename, uint load_index, int file_index) |
0 | 50 |
{ |
2342
c19fb4f2df30
(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
|
51 |
uint load_index_org = load_index; |
0 | 52 |
|
53 |
FioOpenFile(file_index, filename); |
|
365
5752af05ed75
(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
|
54 |
|
366
9d2630b8b4de
(svn r554) -newgrf: Keep track of GRF files. Remember them all in a linked list, this already enables tests for an already loaded GRF file in SkipIf(). Patch by octo, heavily re-hammered by pasky
darkvater
parents:
365
diff
changeset
|
55 |
DEBUG(spritecache, 2) ("Reading grf-file ``%s''", filename); |
0 | 56 |
|
57 |
while (LoadNextSprite(load_index, file_index)) { |
|
58 |
load_index++; |
|
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
59 |
if (load_index >= MAX_SPRITES) { |
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
60 |
error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files."); |
0 | 61 |
} |
62 |
} |
|
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
63 |
DEBUG(spritecache, 2) ("Currently %i sprites are loaded", load_index); |
0 | 64 |
|
365
5752af05ed75
(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
|
65 |
return load_index - load_index_org; |
5752af05ed75
(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
|
66 |
} |
5752af05ed75
(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
|
67 |
|
2342
c19fb4f2df30
(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
|
68 |
|
c19fb4f2df30
(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
|
69 |
static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index) |
365
5752af05ed75
(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
|
70 |
{ |
2342
c19fb4f2df30
(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
|
71 |
uint start; |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
72 |
|
365
5752af05ed75
(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 |
FioOpenFile(file_index, filename); |
5752af05ed75
(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 |
|
366
9d2630b8b4de
(svn r554) -newgrf: Keep track of GRF files. Remember them all in a linked list, this already enables tests for an already loaded GRF file in SkipIf(). Patch by octo, heavily re-hammered by pasky
darkvater
parents:
365
diff
changeset
|
75 |
DEBUG(spritecache, 2) ("Reading indexed grf-file ``%s''", filename); |
0 | 76 |
|
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
77 |
while ((start = *index_tbl++) != END) { |
2342
c19fb4f2df30
(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
|
78 |
uint end = *index_tbl++; |
c19fb4f2df30
(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
|
79 |
|
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
80 |
if (start == SKIP) { // skip sprites (amount in second var) |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
81 |
SkipSprites(end); |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
82 |
} else { // load sprites and use indexes from start to end |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
83 |
do { |
1844
372dae999453
(svn r2349) - Fix: remove warning from release build when assertions are no longer active
Darkvater
parents:
1725
diff
changeset
|
84 |
#ifdef NDEBUG |
372dae999453
(svn r2349) - Fix: remove warning from release build when assertions are no longer active
Darkvater
parents:
1725
diff
changeset
|
85 |
LoadNextSprite(start, file_index); |
372dae999453
(svn r2349) - Fix: remove warning from release build when assertions are no longer active
Darkvater
parents:
1725
diff
changeset
|
86 |
#else |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
87 |
bool b = LoadNextSprite(start, file_index); |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
88 |
assert(b); |
1844
372dae999453
(svn r2349) - Fix: remove warning from release build when assertions are no longer active
Darkvater
parents:
1725
diff
changeset
|
89 |
#endif |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
90 |
} while (++start <= end); |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
91 |
} |
0 | 92 |
} |
184
dbeaaaf8b2bb
(svn r185) -Fix: [1016954] Cached_sprites does now work again
truelight
parents:
182
diff
changeset
|
93 |
} |
0 | 94 |
|
95 |
||
961 | 96 |
/* Check that the supplied MD5 hash matches that stored for the supplied filename */ |
97 |
static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn) |
|
98 |
{ |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
99 |
uint i; |
961 | 100 |
|
101 |
/* Loop through each byte of the file MD5 and the stored MD5... */ |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
102 |
for (i = 0; i < 16; i++) if (file.hash[i] != digest[i]) break; |
961 | 103 |
|
104 |
/* If all bytes of the MD5's match (i.e. the MD5's match)... */ |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
105 |
if (i == 16) { |
961 | 106 |
return true; |
107 |
} else { |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
108 |
if (warn) fprintf(stderr, "MD5 of %s is ****INCORRECT**** - File Corrupt.\n", file.filename); |
961 | 109 |
return false; |
110 |
}; |
|
111 |
} |
|
112 |
||
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
966
diff
changeset
|
113 |
/* Calculate and check the MD5 hash of the supplied filename. |
961 | 114 |
* returns true if the checksum is correct */ |
115 |
static bool FileMD5(const MD5File file, bool warn) |
|
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
116 |
{ |
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
117 |
FILE *f; |
961 | 118 |
char buf[MAX_PATH]; |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
119 |
|
961 | 120 |
// open file |
121 |
sprintf(buf, "%s%s", _path.data_dir, file.filename); |
|
122 |
f = fopen(buf, "rb"); |
|
123 |
||
124 |
#if !defined(WIN32) |
|
125 |
if (f == NULL) { |
|
1329 | 126 |
char *s; |
961 | 127 |
// make lower case and check again |
1355 | 128 |
for (s = buf + strlen(_path.data_dir) - 1; *s != '\0'; s++) |
961 | 129 |
*s = tolower(*s); |
130 |
f = fopen(buf, "rb"); |
|
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
131 |
} |
961 | 132 |
#endif |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
133 |
|
862
d7e52ef99f42
(svn r1343) -Fix: [Graphic] Autorail icon is now correct (Darkvater)
truelight
parents:
614
diff
changeset
|
134 |
if (f != NULL) { |
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
135 |
md5_state_t filemd5state; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
136 |
md5_byte_t buffer[1024]; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
137 |
md5_byte_t digest[16]; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
138 |
size_t len; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
139 |
|
961 | 140 |
md5_init(&filemd5state); |
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
141 |
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0) |
961 | 142 |
md5_append(&filemd5state, buffer, len); |
143 |
||
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
144 |
if (ferror(f) && warn) fprintf(stderr, "Error Reading from %s \n", buf); |
961 | 145 |
fclose(f); |
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
966
diff
changeset
|
146 |
|
961 | 147 |
md5_finish(&filemd5state, digest); |
2639 | 148 |
return CheckMD5Digest(file, digest, warn); |
961 | 149 |
} else { // file not found |
150 |
return false; |
|
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
966
diff
changeset
|
151 |
} |
961 | 152 |
} |
153 |
||
154 |
/* Checks, if either the Windows files exist (TRG1R.GRF) or the DOS files (TRG1.GRF) |
|
155 |
* by comparing the MD5 checksums of the files. _use_dos_palette is set accordingly. |
|
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
966
diff
changeset
|
156 |
* If neither are found, Windows palette is assumed. |
961 | 157 |
* |
158 |
* (Note: Also checks sample.cat for corruption) */ |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
159 |
void CheckExternalFiles(void) |
961 | 160 |
{ |
1355 | 161 |
uint i; |
162 |
// count of files from this version |
|
163 |
uint dos = 0; |
|
164 |
uint win = 0; |
|
961 | 165 |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
166 |
for (i = 0; i < 2; i++) if (FileMD5(files_dos.basic[i], true)) dos++; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
167 |
for (i = 0; i < 3; i++) if (FileMD5(files_dos.landscape[i], true)) dos++; |
961 | 168 |
|
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
169 |
for (i = 0; i < 2; i++) if (FileMD5(files_win.basic[i], true)) win++; |
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
170 |
for (i = 0; i < 3; i++) if (FileMD5(files_win.landscape[i], true)) win++; |
961 | 171 |
|
1355 | 172 |
if (!FileMD5(sample_cat_win, false) && !FileMD5(sample_cat_dos, false)) |
2028
d7686f53adf2
(svn r2537) Small changes, especially use fprintf to stderr for warnings and errors instead of plain printf
tron
parents:
2027
diff
changeset
|
173 |
fprintf(stderr, "Your sample.cat file is corrupted or missing!\n"); |
961 | 174 |
|
1380
7faf03f67dc3
(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
|
175 |
/* |
1389 | 176 |
* forced DOS palette via command line -> leave it that way |
1380
7faf03f67dc3
(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
|
177 |
* all Windows files present -> Windows palette |
7faf03f67dc3
(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 DOS files present -> DOS palette |
7faf03f67dc3
(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 |
* no Windows files present and any DOS file present -> DOS palette |
7faf03f67dc3
(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 |
* otherwise -> Windows palette |
7faf03f67dc3
(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 |
*/ |
1389 | 182 |
if (_use_dos_palette) { |
183 |
return; |
|
184 |
} else if (win == 5) { |
|
961 | 185 |
_use_dos_palette = false; |
1381 | 186 |
} else if (dos == 5 || (win == 0 && dos > 0)) { |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
187 |
_use_dos_palette = true; |
1380
7faf03f67dc3
(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
|
188 |
} else { |
961 | 189 |
_use_dos_palette = false; |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
190 |
} |
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
191 |
} |
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
192 |
|
2342
c19fb4f2df30
(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
|
193 |
|
2353 | 194 |
static const SpriteID trg1idx[] = { |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
195 |
0, 1, // Mouse cursor, ZZZ |
2353 | 196 |
/* Medium font */ |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
197 |
2, 92, // ' ' till 'z' |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
198 |
SKIP, 36, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
199 |
160, 160, // Move ¾ to the correct position |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
200 |
98, 98, // Up arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
201 |
131, 133, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
202 |
SKIP, 1, // skip currency sign |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
203 |
135, 135, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
204 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
205 |
137, 137, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
206 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
207 |
139, 139, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
208 |
140, 140, // TODO Down arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
209 |
141, 141, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
210 |
142, 142, // TODO Check mark |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
211 |
143, 143, // TODO Cross |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
212 |
144, 144, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
213 |
145, 145, // TODO Right arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
214 |
146, 149, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
215 |
118, 122, // Transport markers |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
216 |
SKIP, 2, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
217 |
157, 157, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
218 |
114, 115, // Small up/down arrows |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
219 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
220 |
161, 225, |
2353 | 221 |
/* Small font */ |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
222 |
226, 316, // ' ' till 'z' |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
223 |
SKIP, 36, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
224 |
384, 384, // Move ¾ to the correct position |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
225 |
322, 322, // Up arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
226 |
355, 357, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
227 |
SKIP, 1, // skip currency sign |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
228 |
359, 359, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
229 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
230 |
361, 361, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
231 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
232 |
363, 363, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
233 |
364, 364, // TODO Down arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
234 |
365, 366, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
235 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
236 |
368, 368, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
237 |
369, 369, // TODO Right arrow |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
238 |
370, 373, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
239 |
SKIP, 7, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
240 |
381, 381, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
241 |
SKIP, 3, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
242 |
385, 449, |
2353 | 243 |
/* Big font */ |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
244 |
450, 540, // ' ' till 'z' |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
245 |
SKIP, 36, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
246 |
608, 608, // Move ¾ to the correct position |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
247 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
248 |
579, 581, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
249 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
250 |
583, 583, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
251 |
SKIP, 5, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
252 |
589, 589, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
253 |
SKIP, 15, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
254 |
605, 605, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
255 |
SKIP, 3, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
256 |
609, 625, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
257 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
258 |
627, 632, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
259 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
260 |
634, 639, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
261 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
262 |
641, 657, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
263 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
264 |
659, 664, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
265 |
SKIP, 2, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
266 |
667, 671, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
267 |
SKIP, 1, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
268 |
673, 673, |
2353 | 269 |
/* Graphics */ |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
270 |
674, 4792, |
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
271 |
END |
2353 | 272 |
}; |
273 |
||
2565
19b3af477934
(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
|
274 |
/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the |
19b3af477934
(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 |
* amount of sprites and add them to the end of the list, with the index of |
19b3af477934
(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 |
* the old sprite-count offset from SPR_OPENTTD_BASE. With this there is no |
19b3af477934
(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 |
* correspondence of any kind with the ID's in the grf file, but results in |
19b3af477934
(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 |
* a maximum use of sprite slots. */ |
2577
a122c0daa430
(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
|
279 |
#define OPENTTD_SPRITES_COUNT 95 |
2353 | 280 |
static const SpriteID _openttd_grf_indexes[] = { |
2571
ab7413dfe35a
(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 |
2353 | 282 |
134, 134, // euro symbol medium size |
283 |
582, 582, // euro symbol large size |
|
284 |
358, 358, // euro symbol tiny |
|
2571
ab7413dfe35a
(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 |
2353 | 286 |
648, 648, // nordic char: æ |
287 |
616, 616, // nordic char: Æ |
|
288 |
666, 666, // nordic char: ø |
|
289 |
634, 634, // nordic char: Ø |
|
2571
ab7413dfe35a
(svn r3108) Confine the use of SPR_OPENTTD_BASE to table/sprites.h by adding/using some sprite enums
tron
parents:
2565
diff
changeset
|
290 |
SPR_PIN_UP, SPR_CURSOR_CLONE, // more icons |
2353 | 291 |
382, 383, // ¼ ½ tiny |
292 |
158, 159, // ¼ ½ medium |
|
293 |
606, 607, // ¼ ½ large |
|
294 |
360, 360, // ¦ tiny |
|
295 |
362, 362, // ¨ tiny |
|
296 |
136, 136, // ¦ medium |
|
297 |
138, 138, // ¨ medium |
|
298 |
584, 584, // ¦ large |
|
299 |
586, 586, // ¨ large |
|
300 |
626, 626, // Ð large |
|
301 |
658, 658, // ð large |
|
302 |
374, 374, // ´ tiny |
|
303 |
378, 378, // ¸ tiny |
|
304 |
150, 150, // ´ medium |
|
305 |
154, 154, // ¸ medium |
|
306 |
598, 598, // ´ large |
|
307 |
602, 602, // ¸ large |
|
308 |
640, 640, // Þ large |
|
309 |
672, 672, // þ large |
|
310 |
380, 380, // º tiny |
|
311 |
156, 156, // º medium |
|
312 |
604, 604, // º large |
|
2411 | 313 |
317, 320, // { | } ~ tiny |
314 |
93, 96, // { | } ~ medium |
|
315 |
541, 544, // { | } ~ large |
|
2571
ab7413dfe35a
(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, |
9939
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
317 |
585, 585, // § large |
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
318 |
587, 587, // © large |
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
319 |
592, 592, // ® large |
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
320 |
594, 597, // ° ± ² ³ large |
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
321 |
633, 633, // × large |
c4797077028a
(svn r3970) - FS#56 - [Crash] Missing glyph(s) in big-font. Added several missing glyphs for the big font. Backport of r3940 from trunk
Darkvater
parents:
2639
diff
changeset
|
322 |
665, 665, // ÷ large |
2588
40d7dba79fc7
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
tron
parents:
2577
diff
changeset
|
323 |
END |
2353 | 324 |
}; |
325 |
||
2342
c19fb4f2df30
(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
|
326 |
static byte _sprite_page_to_load = 0xFF; |
c19fb4f2df30
(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
|
327 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
328 |
static void LoadSpriteTables(void) |
0 | 329 |
{ |
2639 | 330 |
const FileList* files = _use_dos_palette ? &files_dos : &files_win; |
331 |
uint load_index; |
|
1355 | 332 |
uint i; |
614
e016770cb781
(svn r1038) Feature: OpenTTD runs with the grf files of the DOS version
dominik
parents:
579
diff
changeset
|
333 |
|
2353 | 334 |
LoadGrfIndexed(files->basic[0].filename, trg1idx, 0); |
2407 | 335 |
DupSprite( 2, 130); // non-breaking space medium |
336 |
DupSprite(226, 354); // non-breaking space tiny |
|
337 |
DupSprite(450, 578); // non-breaking space large |
|
2353 | 338 |
load_index = 4793; |
339 |
||
340 |
for (i = 1; files->basic[i].filename != NULL; i++) { |
|
2309 | 341 |
load_index += LoadGrfFile(files->basic[i].filename, load_index, i); |
342 |
} |
|
0 | 343 |
|
2309 | 344 |
if (_sprite_page_to_load != 0) { |
345 |
LoadGrfIndexed( |
|
346 |
files->landscape[_sprite_page_to_load - 1].filename, |
|
347 |
_landscape_spriteindexes[_sprite_page_to_load - 1], |
|
348 |
i++ |
|
349 |
); |
|
350 |
} |
|
0 | 351 |
|
2512
fa66ff5ebf88
(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
|
352 |
assert(load_index == SPR_CANALS_BASE); |
fa66ff5ebf88
(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
|
353 |
load_index += LoadGrfFile("canalsw.grf", load_index, i++); |
fa66ff5ebf88
(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
|
354 |
|
fa66ff5ebf88
(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
|
355 |
assert(load_index == SPR_SLOPES_BASE); |
2309 | 356 |
LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++); |
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1019
diff
changeset
|
357 |
|
2309 | 358 |
load_index = SPR_AUTORAIL_BASE; |
359 |
load_index += LoadGrfFile("autorail.grf", load_index, i++); |
|
142 | 360 |
|
2512
fa66ff5ebf88
(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 |
assert(load_index == SPR_OPENTTD_BASE); |
fa66ff5ebf88
(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 |
LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++); |
2577
a122c0daa430
(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
|
363 |
load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT; |
142 | 364 |
|
2342
c19fb4f2df30
(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
|
365 |
LoadNewGRF(load_index, i); |
0 | 366 |
} |
367 |
||
368 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
369 |
void GfxLoadSprites(void) |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
370 |
{ |
0 | 371 |
// Need to reload the sprites only if the landscape changed |
372 |
if (_sprite_page_to_load != _opt.landscape) { |
|
373 |
_sprite_page_to_load = _opt.landscape; |
|
374 |
||
375 |
// Sprite cache |
|
376 |
DEBUG(spritecache, 1) ("Loading sprite set %d.", _sprite_page_to_load); |
|
377 |
||
2339
1c64119d5a3b
(svn r2865) Push the responsibility for allocating the sprite heap into GfxInitSpriteMem()
tron
parents:
2329
diff
changeset
|
378 |
GfxInitSpriteMem(); |
0 | 379 |
LoadSpriteTables(); |
380 |
GfxInitPalettes(); |
|
381 |
} |
|
382 |
} |