(svn r27667) -Codechange: Add VehicleSpriteSeq::GetBounds and Draw.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user