From bcb3313e134e0e8cf12366ec9d1340e9986ccc57 Mon Sep 17 00:00:00 2001 From: Matt Kimber Date: Sat, 13 Mar 2021 09:00:53 +0000 Subject: Feature: allow setting maximum zoom level at which sprites are drawn (#8604) --- src/spriteloader/grf.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/spriteloader') diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index f3c3ed8ac..30ea09444 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -11,6 +11,7 @@ #include "../gfx_func.h" #include "../fileio_func.h" #include "../debug.h" +#include "../settings_type.h" #include "../strings_func.h" #include "table/strings.h" #include "../error.h" @@ -265,7 +266,16 @@ uint8 LoadSpriteV2(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_po byte colour = type & SCC_MASK; byte zoom = FioReadByte(); - if (colour != 0 && (load_32bpp ? colour != SCC_PAL : colour == SCC_PAL) && (sprite_type != ST_MAPGEN ? zoom < lengthof(zoom_lvl_map) : zoom == 0)) { + bool is_wanted_colour_depth = (colour != 0 && (load_32bpp ? colour != SCC_PAL : colour == SCC_PAL)); + bool is_wanted_zoom_lvl; + + if (sprite_type != ST_MAPGEN) { + is_wanted_zoom_lvl = (zoom < lengthof(zoom_lvl_map) && zoom_lvl_map[zoom] >= _settings_client.gui.sprite_zoom_min); + } else { + is_wanted_zoom_lvl = (zoom == 0); + } + + if (is_wanted_colour_depth && is_wanted_zoom_lvl) { ZoomLevel zoom_lvl = (sprite_type != ST_MAPGEN) ? zoom_lvl_map[zoom] : ZOOM_LVL_NORMAL; if (HasBit(loaded_sprites, zoom_lvl)) { -- cgit v1.2.3-70-g09d2