src/spritecache.cpp
changeset 7397 d371cc0fbb3c
parent 7392 a716551b0c7f
child 7398 4f7ae78d1212
equal deleted inserted replaced
7396:9376076d058e 7397:d371cc0fbb3c
    12 #include "spritecache.h"
    12 #include "spritecache.h"
    13 #include "table/sprites.h"
    13 #include "table/sprites.h"
    14 #include "fileio.h"
    14 #include "fileio.h"
    15 #include "helpers.hpp"
    15 #include "helpers.hpp"
    16 #include "spriteloader/grf.hpp"
    16 #include "spriteloader/grf.hpp"
       
    17 #ifdef WITH_PNG
    17 #include "spriteloader/png.hpp"
    18 #include "spriteloader/png.hpp"
       
    19 #endif /* WITH_PNG */
    18 #include "blitter/blitter.hpp"
    20 #include "blitter/blitter.hpp"
    19 
    21 
    20 /* Default of 4MB spritecache */
    22 /* Default of 4MB spritecache */
    21 uint _sprite_cache_size = 4;
    23 uint _sprite_cache_size = 4;
    22 
    24 
   135 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   137 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   136 		id = SPR_IMG_QUERY;
   138 		id = SPR_IMG_QUERY;
   137 		file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
   139 		file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
   138 	}
   140 	}
   139 
   141 
       
   142 #ifdef WITH_PNG
   140 	if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
   143 	if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
   141 		/* Try loading 32bpp graphics in case we are 32bpp output */
   144 		/* Try loading 32bpp graphics in case we are 32bpp output */
   142 		SpriteLoaderPNG sprite_loader;
   145 		SpriteLoaderPNG sprite_loader;
   143 		SpriteLoader::Sprite sprite;
   146 		SpriteLoader::Sprite sprite;
   144 
   147 
   148 
   151 
   149 			return sc->ptr;
   152 			return sc->ptr;
   150 		}
   153 		}
   151 		/* If the PNG couldn't be loaded, fall back to 8bpp grfs */
   154 		/* If the PNG couldn't be loaded, fall back to 8bpp grfs */
   152 	}
   155 	}
       
   156 #endif /* WITH_PNG */
   153 
   157 
   154 	FioSeekToFile(file_pos);
   158 	FioSeekToFile(file_pos);
   155 
   159 
   156 	/* Read the size and type */
   160 	/* Read the size and type */
   157 	int num  = FioReadWord();
   161 	int num  = FioReadWord();