From 20e9a8061d797bdc17657831ca7182954e5c898a Mon Sep 17 00:00:00 2001 From: celestar Date: Sat, 13 Nov 2004 18:01:33 +0000 Subject: (svn r567) -newgrf: Support for road vehicles customization (seems to work at least with tropicset). (pasky) --- roadveh_cmd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'roadveh_cmd.c') diff --git a/roadveh_cmd.c b/roadveh_cmd.c index f4a66bcd9..becb2605e 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -56,13 +56,11 @@ int GetRoadVehImage(Vehicle *v, byte direction) int img = v->spritenum; int image; -#ifdef ROADVEH_CUSTOM_SPRITES // TODO --pasky if (is_custom_sprite(img)) { image = GetCustomVehicleSprite(v, direction); if (image) return image; img = _engine_original_sprites[v->engine_type]; } -#endif image = direction + _roadveh_images[img]; if (v->cargo_count >= (v->cargo_cap >> 1)) @@ -72,7 +70,18 @@ int GetRoadVehImage(Vehicle *v, byte direction) void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod) { - DrawSprite((6 + _roadveh_images[road_vehicle_info(engine)->image_index]) | image_ormod, x, y); + int spritenum = road_vehicle_info(engine)->image_index; + + if (is_custom_sprite(spritenum)) { + int sprite = GetCustomVehicleIcon(engine, 6); + + if (sprite) { + DrawSprite(sprite | image_ormod, x, y); + return; + } + spritenum = _engine_original_sprites[engine]; + } + DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y); } void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw) -- cgit v1.2.3-54-g00ecf