diff options
Diffstat (limited to 'src/aircraft_gui.cpp')
-rw-r--r-- | src/aircraft_gui.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index 752e0da90..20fca9fc5 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -86,10 +86,11 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s VehicleSpriteSeq seq; v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq); - const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL); + Rect rect; + seq.GetBounds(&rect); - int width = UnScaleGUI(real_sprite->width); - int x_offs = UnScaleGUI(real_sprite->x_offs); + int width = UnScaleGUI(rect.right - rect.left + 1); + int x_offs = UnScaleGUI(rect.left); int x = rtl ? right - width - x_offs : left - x_offs; bool helicopter = v->subtype == AIR_HELICOPTER; @@ -97,18 +98,18 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s int heli_offs = 0; PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v); - DrawSprite(seq.sprite, pal, x, y + y_offs); + seq.Draw(x, y + y_offs, pal, v->vehstatus & VS_CRASHED); if (helicopter) { const Aircraft *a = Aircraft::From(v); VehicleSpriteSeq rotor_seq; GetCustomRotorSprite(a, true, image_type, &rotor_seq); if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED); heli_offs = ScaleGUITrad(5); - DrawSprite(rotor_seq.sprite, PAL_NONE, x, y + y_offs - heli_offs); + rotor_seq.Draw(x, y + y_offs - heli_offs, PAL_NONE, false); } if (v->index == selection) { x += x_offs; - y += UnScaleGUI(real_sprite->y_offs) + y_offs - heli_offs; - DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(real_sprite->height) + heli_offs + 1, COLOUR_WHITE, FR_BORDERONLY); + y += UnScaleGUI(rect.top) + y_offs - heli_offs; + DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(rect.bottom - rect.top + 1) + heli_offs + 1, COLOUR_WHITE, FR_BORDERONLY); } } |