src/spritecache.cpp
changeset 6903 091fb25052ac
parent 6902 9099f49052f4
child 6908 6b1324d7a2c9
equal deleted inserted replaced
6902:9099f49052f4 6903:091fb25052ac
   137 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   137 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   138 		id = SPR_IMG_QUERY;
   138 		id = SPR_IMG_QUERY;
   139 		file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
   139 		file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
   140 	}
   140 	}
   141 
   141 
       
   142 	if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
   142 #ifdef WITH_PNG
   143 #ifdef WITH_PNG
   143 	if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
       
   144 		/* Try loading 32bpp graphics in case we are 32bpp output */
   144 		/* Try loading 32bpp graphics in case we are 32bpp output */
   145 		SpriteLoaderPNG sprite_loader;
   145 		SpriteLoaderPNG sprite_loader;
   146 		SpriteLoader::Sprite sprite;
   146 		SpriteLoader::Sprite sprite;
   147 
   147 
   148 		if (sprite_loader.LoadSprite(&sprite, sc->grf_name, sc->id)) {
   148 		if (sprite_loader.LoadSprite(&sprite, sc->grf_name, sc->id)) {
   150 			free(sprite.data);
   150 			free(sprite.data);
   151 
   151 
   152 			return sc->ptr;
   152 			return sc->ptr;
   153 		}
   153 		}
   154 		/* 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 */
   155 	}
   155 #else
       
   156 		static bool show_once = true;
       
   157 		if (show_once) {
       
   158 			DEBUG(misc, 0, "You are running a 32bpp blitter, but this build is without libpng support; falling back to 8bpp graphics");
       
   159 			show_once = false;
       
   160 		}
   156 #endif /* WITH_PNG */
   161 #endif /* WITH_PNG */
       
   162 	}
   157 
   163 
   158 	FioSeekToFile(file_pos);
   164 	FioSeekToFile(file_pos);
   159 
   165 
   160 	/* Read the size and type */
   166 	/* Read the size and type */
   161 	int num  = FioReadWord();
   167 	int num  = FioReadWord();