From 5fc4ce1eb164e9abe15491924d8a7eaacec8c933 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 4 Dec 2011 09:15:13 +0000 Subject: (svn r23419) -Fix [FS#4864] (r23316): the sprite aligner was broken as it didn't scale properly to 'GUI' scale --- src/newgrf_debug_gui.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index c5c1705f3..03c811057 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -685,8 +685,8 @@ struct SpriteAlignerWindow : Window { case SAW_OFFSETS: { const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL); - SetDParam(0, spr->x_offs); - SetDParam(1, spr->y_offs); + SetDParam(0, spr->x_offs / ZOOM_LVL_BASE); + SetDParam(1, spr->y_offs / ZOOM_LVL_BASE); break; } @@ -714,18 +714,18 @@ struct SpriteAlignerWindow : Window { const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL); int width = r.right - r.left + 1; int height = r.bottom - r.top + 1; - int x = r.left - spr->x_offs + (width - spr->width) / 2; - int y = r.top - spr->y_offs + (height - spr->height) / 2; + int x = r.left - spr->x_offs / ZOOM_LVL_BASE + (width - spr->width / ZOOM_LVL_BASE) / 2; + int y = r.top - spr->y_offs / ZOOM_LVL_BASE + (height - spr->height / ZOOM_LVL_BASE) / 2; /* And draw only the part within the sprite area */ SubSprite subspr = { - spr->x_offs + (spr->width - width) / 2 + 1, - spr->y_offs + (spr->height - height) / 2 + 1, - spr->x_offs + (spr->width + width) / 2 - 1, - spr->y_offs + (spr->height + height) / 2 - 1, + spr->x_offs + (spr->width - width * ZOOM_LVL_BASE) / 2 + 1, + spr->y_offs + (spr->height - height * ZOOM_LVL_BASE) / 2 + 1, + spr->x_offs + (spr->width + width * ZOOM_LVL_BASE) / 2 - 1, + spr->y_offs + (spr->height + height * ZOOM_LVL_BASE) / 2 - 1, }; - DrawSprite(this->current_sprite, PAL_NONE, x, y, &subspr, ZOOM_LVL_NORMAL); + DrawSprite(this->current_sprite, PAL_NONE, x, y, &subspr, ZOOM_LVL_GUI); break; } @@ -806,10 +806,10 @@ struct SpriteAlignerWindow : Window { */ Sprite *spr = const_cast(GetSprite(this->current_sprite, ST_NORMAL)); switch (widget) { - case SAW_UP: spr->y_offs--; break; - case SAW_DOWN: spr->y_offs++; break; - case SAW_LEFT: spr->x_offs--; break; - case SAW_RIGHT: spr->x_offs++; break; + case SAW_UP: spr->y_offs -= ZOOM_LVL_BASE; break; + case SAW_DOWN: spr->y_offs += ZOOM_LVL_BASE; break; + case SAW_LEFT: spr->x_offs -= ZOOM_LVL_BASE; break; + case SAW_RIGHT: spr->x_offs += ZOOM_LVL_BASE; break; } /* Ofcourse, we need to redraw the sprite, but where is it used? * Everywhere is a safe bet. */ -- cgit v1.2.3-54-g00ecf