From 5d55a9435b604c861b91c0bb64f4202a9006f384 Mon Sep 17 00:00:00 2001 From: truelight Date: Thu, 14 Jun 2007 14:31:48 +0000 Subject: (svn r10157) -Fix: use as indentified for PNGs, the place of the image as it was in the grf, not the internal SpriteID --- src/gfxinit.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/gfxinit.cpp') diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 2fe58ca0b..6212badfd 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -53,13 +53,15 @@ static const SpriteID * const _slopes_spriteindexes[] = { static uint LoadGrfFile(const char* filename, uint load_index, int file_index) { uint load_index_org = load_index; + uint sprite_id = 0; FioOpenFile(file_index, filename); DEBUG(sprite, 2, "Reading grf-file '%s'", filename); - while (LoadNextSprite(load_index, file_index)) { + while (LoadNextSprite(load_index, file_index, sprite_id)) { load_index++; + sprite_id++; if (load_index >= MAX_SPRITES) { error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files."); } @@ -73,6 +75,7 @@ static uint LoadGrfFile(const char* filename, uint load_index, int file_index) static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index) { uint start; + uint sprite_id = 0; FioOpenFile(file_index, filename); @@ -83,14 +86,16 @@ static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int if (start == SKIP) { // skip sprites (amount in second var) SkipSprites(end); + sprite_id += end; } else { // load sprites and use indexes from start to end do { #ifdef NDEBUG - LoadNextSprite(start, file_index); + LoadNextSprite(start, file_index, sprite_id); #else - bool b = LoadNextSprite(start, file_index); + bool b = LoadNextSprite(start, file_index, sprite_id); assert(b); #endif + sprite_id++; } while (++start <= end); } } -- cgit v1.2.3-54-g00ecf