summaryrefslogtreecommitdiff
path: root/src/aircraft_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2011-11-24 12:38:48 +0000
committerpeter1138 <peter1138@openttd.org>2011-11-24 12:38:48 +0000
commit81598273e9b6bb2ee20ebdd82f3d4646a02999ba (patch)
tree2d13cc93dc84f2d99cff6fc2bb02214d4453f033 /src/aircraft_gui.cpp
parent15d0a22aac6b90a2055e68d019cab4350376a8fd (diff)
downloadopenttd-81598273e9b6bb2ee20ebdd82f3d4646a02999ba.tar.xz
(svn r23316) -Feature: Add ability to zoom in to 2x and 4x level.
Diffstat (limited to 'src/aircraft_gui.cpp')
-rw-r--r--src/aircraft_gui.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index 360c02a7f..faefaa907 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -17,6 +17,7 @@
#include "vehicle_func.h"
#include "window_gui.h"
#include "spritecache.h"
+#include "zoom_func.h"
#include "table/strings.h"
@@ -83,7 +84,9 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
- int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
+ int width = UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI);
+ int x_offs = UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI);
+ int x = rtl ? right - width - x_offs : left - x_offs;
bool helicopter = v->subtype == AIR_HELICOPTER;
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
@@ -95,8 +98,8 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
DrawSprite(rotor_sprite, PAL_NONE, x, y + 5);
}
if (v->index == selection) {
- x += real_sprite->x_offs;
- y += real_sprite->y_offs + 10 - (helicopter ? 5 : 0);
- DrawFrameRect(x - 1, y - 1, x + real_sprite->width + 1, y + real_sprite->height + (helicopter ? 5 : 0) + 1, COLOUR_WHITE, FR_BORDERONLY);
+ x += x_offs;
+ y += UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI) + 10 - (helicopter ? 5 : 0);
+ DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleByZoom(real_sprite->height, ZOOM_LVL_GUI) + (helicopter ? 5 : 0) + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}