diff options
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index a4b84ae87..2a760e2ca 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -91,11 +91,13 @@ void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine VehicleSpriteSeq seq; GetShipIcon(engine, image_type, &seq); - const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL); + Rect rect; + seq.GetBounds(&rect); preferred_x = Clamp(preferred_x, - left - UnScaleGUI(real_sprite->x_offs), - right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs)); - DrawSprite(seq.sprite, pal, preferred_x, y); + left - UnScaleGUI(rect.left), + right - UnScaleGUI(rect.right)); + + seq.Draw(preferred_x, y, pal, pal == PALETTE_CRASH); } /** @@ -112,12 +114,13 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, i VehicleSpriteSeq seq; GetShipIcon(engine, image_type, &seq); - const Sprite *spr = GetSprite(seq.sprite, ST_NORMAL); + Rect rect; + seq.GetBounds(&rect); - width = UnScaleGUI(spr->width); - height = UnScaleGUI(spr->height); - xoffs = UnScaleGUI(spr->x_offs); - yoffs = UnScaleGUI(spr->y_offs); + width = UnScaleGUI(rect.right - rect.left + 1); + height = UnScaleGUI(rect.bottom - rect.top + 1); + xoffs = UnScaleGUI(rect.left); + yoffs = UnScaleGUI(rect.top); } void Ship::GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const |