(svn r27666) -Codechange: Pass vehicle sprites around using a struct VehicleSpriteSeq.

This commit is contained in:
frosch
2016-10-16 14:57:56 +00:00
parent f5409c713b
commit d2393b4f6c
22 changed files with 249 additions and 161 deletions

View File

@@ -35,15 +35,17 @@ void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selec
{
bool rtl = _current_text_dir == TD_RTL;
SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
VehicleSpriteSeq seq;
v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq);
const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL);
int width = UnScaleGUI(real_sprite->width);
int x_offs = UnScaleGUI(real_sprite->x_offs);
int x = rtl ? right - width - x_offs : left - x_offs;
y += ScaleGUITrad(10);
DrawSprite(sprite, GetVehiclePalette(v), x, y);
DrawSprite(seq.sprite, GetVehiclePalette(v), x, y);
if (v->index == selection) {
x += x_offs;