@@ -134,23 +134,23 @@ static void* ReadSprite(SpriteCache *sc,
/* SPR_IMG_QUERY is a BIG FAT RED ? */
id = SPR_IMG_QUERY;
file_slot = GetSpriteCache(SPR_IMG_QUERY)->file_slot;
file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
}
if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
if (real_sprite && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
#ifdef WITH_PNG
/* Try loading 32bpp graphics in case we are 32bpp output */
SpriteLoaderPNG sprite_loader;
SpriteLoader::Sprite sprite;
if (sprite_loader.LoadSprite(&sprite, file_slot, sc->id)) {
sc->ptr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&sprite, &AllocSprite);
free(sprite.data);
sc->real_sprite = true;
sc->real_sprite = real_sprite;
return sc->ptr;
/* If the PNG couldn't be loaded, fall back to 8bpp grfs */
#else
static bool show_once = true;
@@ -170,19 +170,19 @@ static void* ReadSprite(SpriteCache *sc,
if (type == 0xFF) {
if (real_sprite) {
static byte warning_level = 0;
DEBUG(sprite, warning_level, "Tried to load non sprite #%d as a real sprite. Probable cause: NewGRF interference", id);
warning_level = 6;
if (id == SPR_IMG_QUERY) usererror("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non- sprite?");
return (void*)GetSprite(SPR_IMG_QUERY);
return (void*)GetRawSprite(SPR_IMG_QUERY, true);
byte *dest = (byte *)AllocSprite(num);
sc->ptr = dest;
sc->real_sprite = false;
FioReadBlock(dest, num);
/* Ugly hack to work around the problem that the old landscape
* generator assumes that those sprites are stored uncompressed in
@@ -191,12 +191,13 @@ static void* ReadSprite(SpriteCache *sc,
* result in a data array in the format the blitter likes most), but
* read the data directly from disk and store that as sprite.
* Ugly: yes. Other solution: no. Blame the original author or
* something ;) The image should really have been a data-stream
* (so type = 0xFF basicly). */
if (id >= 4845 && id <= 4881) {
assert(real_sprite);
uint height = FioReadByte();
uint width = FioReadWord();
Sprite *sprite;
byte *dest;
num = width * height;
@@ -218,28 +219,29 @@ static void* ReadSprite(SpriteCache *sc,
i = -(i >> 3);
num -= i;
for (; i > 0; --i) *dest++ = *rel++;
if (!real_sprite) {
DEBUG(sprite, warning_level, "Tried to load real sprite #%d as a non sprite. Probable cause: NewGRF interference", id);
return (void*)GetRawSprite(id, true);
SpriteLoaderGrf sprite_loader;
if (!sprite_loader.LoadSprite(&sprite, file_slot, file_pos)) return NULL;
if (id == 142) sprite.height = 10; // Compensate for a TTD bug
Status change: