mirror of https://github.com/OpenTTD/OpenTTD
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
parent
e80d448478
commit
7c40462d24
157
gfxinit.c
157
gfxinit.c
|
@ -24,6 +24,11 @@ typedef struct FileList {
|
||||||
const MD5File landscape[3]; // landscape specific grf files
|
const MD5File landscape[3]; // landscape specific grf files
|
||||||
} FileList;
|
} FileList;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SKIP = 0xFFFE,
|
||||||
|
END = 0xFFFF
|
||||||
|
};
|
||||||
|
|
||||||
#include "table/files.h"
|
#include "table/files.h"
|
||||||
#include "table/landscape_sprite.h"
|
#include "table/landscape_sprite.h"
|
||||||
|
|
||||||
|
@ -69,10 +74,10 @@ static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int
|
||||||
|
|
||||||
DEBUG(spritecache, 2) ("Reading indexed grf-file ``%s''", filename);
|
DEBUG(spritecache, 2) ("Reading indexed grf-file ``%s''", filename);
|
||||||
|
|
||||||
for (; (start = *index_tbl++) != 0xffff;) {
|
while ((start = *index_tbl++) != END) {
|
||||||
uint end = *index_tbl++;
|
uint end = *index_tbl++;
|
||||||
|
|
||||||
if (start == 0xfffe) { // skip sprites (amount in second var)
|
if (start == SKIP) { // skip sprites (amount in second var)
|
||||||
SkipSprites(end);
|
SkipSprites(end);
|
||||||
} else { // load sprites and use indexes from start to end
|
} else { // load sprites and use indexes from start to end
|
||||||
do {
|
do {
|
||||||
|
@ -187,83 +192,83 @@ void CheckExternalFiles(void)
|
||||||
|
|
||||||
|
|
||||||
static const SpriteID trg1idx[] = {
|
static const SpriteID trg1idx[] = {
|
||||||
0, 1, // Mouse cursor, ZZZ
|
0, 1, // Mouse cursor, ZZZ
|
||||||
/* Medium font */
|
/* Medium font */
|
||||||
2, 92, // ' ' till 'z'
|
2, 92, // ' ' till 'z'
|
||||||
0xFFFE, 36,
|
SKIP, 36,
|
||||||
160, 160, // Move ¾ to the correct position
|
160, 160, // Move ¾ to the correct position
|
||||||
98, 98, // Up arrow
|
98, 98, // Up arrow
|
||||||
131, 133,
|
131, 133,
|
||||||
0xFFFE, 1, // skip currency sign
|
SKIP, 1, // skip currency sign
|
||||||
135, 135,
|
135, 135,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
137, 137,
|
137, 137,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
139, 139,
|
139, 139,
|
||||||
140, 140, // TODO Down arrow
|
140, 140, // TODO Down arrow
|
||||||
141, 141,
|
141, 141,
|
||||||
142, 142, // TODO Check mark
|
142, 142, // TODO Check mark
|
||||||
143, 143, // TODO Cross
|
143, 143, // TODO Cross
|
||||||
144, 144,
|
144, 144,
|
||||||
145, 145, // TODO Right arrow
|
145, 145, // TODO Right arrow
|
||||||
146, 149,
|
146, 149,
|
||||||
118, 122, // Transport markers
|
118, 122, // Transport markers
|
||||||
0xFFFE, 2,
|
SKIP, 2,
|
||||||
157, 157,
|
157, 157,
|
||||||
114, 115, // Small up/down arrows
|
114, 115, // Small up/down arrows
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
161, 225,
|
161, 225,
|
||||||
/* Small font */
|
/* Small font */
|
||||||
226, 316, // ' ' till 'z'
|
226, 316, // ' ' till 'z'
|
||||||
0xFFFE, 36,
|
SKIP, 36,
|
||||||
384, 384, // Move ¾ to the correct position
|
384, 384, // Move ¾ to the correct position
|
||||||
322, 322, // Up arrow
|
322, 322, // Up arrow
|
||||||
355, 357,
|
355, 357,
|
||||||
0xFFFE, 1, // skip currency sign
|
SKIP, 1, // skip currency sign
|
||||||
359, 359,
|
359, 359,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
361, 361,
|
361, 361,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
363, 363,
|
363, 363,
|
||||||
364, 364, // TODO Down arrow
|
364, 364, // TODO Down arrow
|
||||||
365, 366,
|
365, 366,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
368, 368,
|
368, 368,
|
||||||
369, 369, // TODO Right arrow
|
369, 369, // TODO Right arrow
|
||||||
370, 373,
|
370, 373,
|
||||||
0xFFFE, 7,
|
SKIP, 7,
|
||||||
381, 381,
|
381, 381,
|
||||||
0xFFFE, 3,
|
SKIP, 3,
|
||||||
385, 449,
|
385, 449,
|
||||||
/* Big font */
|
/* Big font */
|
||||||
450, 540, // ' ' till 'z'
|
450, 540, // ' ' till 'z'
|
||||||
0xFFFE, 36,
|
SKIP, 36,
|
||||||
608, 608, // Move ¾ to the correct position
|
608, 608, // Move ¾ to the correct position
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
579, 581,
|
579, 581,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
583, 583,
|
583, 583,
|
||||||
0xFFFE, 5,
|
SKIP, 5,
|
||||||
589, 589,
|
589, 589,
|
||||||
0xFFFE, 15,
|
SKIP, 15,
|
||||||
605, 605,
|
605, 605,
|
||||||
0xFFFE, 3,
|
SKIP, 3,
|
||||||
609, 625,
|
609, 625,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
627, 632,
|
627, 632,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
634, 639,
|
634, 639,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
641, 657,
|
641, 657,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
659, 664,
|
659, 664,
|
||||||
0xFFFE, 2,
|
SKIP, 2,
|
||||||
667, 671,
|
667, 671,
|
||||||
0xFFFE, 1,
|
SKIP, 1,
|
||||||
673, 673,
|
673, 673,
|
||||||
/* Graphics */
|
/* Graphics */
|
||||||
674, 4792,
|
674, 4792,
|
||||||
0xFFFF
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
|
/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
|
||||||
|
@ -309,7 +314,7 @@ static const SpriteID _openttd_grf_indexes[] = {
|
||||||
93, 96, // { | } ~ medium
|
93, 96, // { | } ~ medium
|
||||||
541, 544, // { | } ~ large
|
541, 544, // { | } ~ large
|
||||||
SPR_HOUSE_ICON, SPR_HOUSE_ICON,
|
SPR_HOUSE_ICON, SPR_HOUSE_ICON,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
static byte _sprite_page_to_load = 0xFF;
|
static byte _sprite_page_to_load = 0xFF;
|
||||||
|
|
|
@ -23,7 +23,7 @@ static const SpriteID _landscape_spriteindexes_1[] = {
|
||||||
0x818, 0x81D,
|
0x818, 0x81D,
|
||||||
0x3DE, 0x3EB,
|
0x3DE, 0x3EB,
|
||||||
0x1212, 0x1212,
|
0x1212, 0x1212,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpriteID _landscape_spriteindexes_2[] = {
|
static const SpriteID _landscape_spriteindexes_2[] = {
|
||||||
|
@ -60,7 +60,7 @@ static const SpriteID _landscape_spriteindexes_2[] = {
|
||||||
0xFF5, 0xFF5,
|
0xFF5, 0xFF5,
|
||||||
0xFF8, 0xFF8,
|
0xFF8, 0xFF8,
|
||||||
0x1212, 0x1212,
|
0x1212, 0x1212,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpriteID _landscape_spriteindexes_3[] = {
|
static const SpriteID _landscape_spriteindexes_3[] = {
|
||||||
|
@ -130,38 +130,38 @@ static const SpriteID _landscape_spriteindexes_3[] = {
|
||||||
0x514, 0x514,
|
0x514, 0x514,
|
||||||
0x511, 0x511,
|
0x511, 0x511,
|
||||||
0x322, 0x322,
|
0x322, 0x322,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Slope graphics indexes temperate climate
|
/* Slope graphics indexes temperate climate
|
||||||
Skip first 3 sprites and only load the proper set */
|
Skip first 3 sprites and only load the proper set */
|
||||||
static const SpriteID _slopes_spriteindexes_0[] = {
|
static const SpriteID _slopes_spriteindexes_0[] = {
|
||||||
0xfffe, 3,
|
SKIP, 3,
|
||||||
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Slope graphics indexes arctic climate
|
/* Slope graphics indexes arctic climate
|
||||||
Skip first 79 sprites and only load the proper set */
|
Skip first 79 sprites and only load the proper set */
|
||||||
static const SpriteID _slopes_spriteindexes_1[] = {
|
static const SpriteID _slopes_spriteindexes_1[] = {
|
||||||
0xfffe, 79,
|
SKIP, 79,
|
||||||
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Slope graphics indexes tropical climate
|
/* Slope graphics indexes tropical climate
|
||||||
Skip first 155 sprites and only load the proper set */
|
Skip first 155 sprites and only load the proper set */
|
||||||
static const SpriteID _slopes_spriteindexes_2[] = {
|
static const SpriteID _slopes_spriteindexes_2[] = {
|
||||||
0xfffe, 155,
|
SKIP, 155,
|
||||||
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Slope graphics indexes toyland climate
|
/* Slope graphics indexes toyland climate
|
||||||
Skip first 231 sprites and only load the proper set */
|
Skip first 231 sprites and only load the proper set */
|
||||||
static const SpriteID _slopes_spriteindexes_3[] = {
|
static const SpriteID _slopes_spriteindexes_3[] = {
|
||||||
0xfffe, 231,
|
SKIP, 231,
|
||||||
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
|
SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
|
||||||
0xffff,
|
END
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue