summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-12-04 09:15:13 +0000
committerrubidium <rubidium@openttd.org>2011-12-04 09:15:13 +0000
commit5fc4ce1eb164e9abe15491924d8a7eaacec8c933 (patch)
tree20433c5e8fedac61d983bd18e657bdece4fd1314
parent432c16d5b9f6d675db0c82d4c0f8f696fbf537b0 (diff)
downloadopenttd-5fc4ce1eb164e9abe15491924d8a7eaacec8c933.tar.xz
(svn r23419) -Fix [FS#4864] (r23316): the sprite aligner was broken as it didn't scale properly to 'GUI' scale
-rw-r--r--src/newgrf_debug_gui.cpp26
1 files changed, 13 insertions, 13 deletions
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<Sprite *>(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. */