(svn r2990) Remove _engine_original_sprites and replace all uses with references to our (new) original engine/vehicle tables.

This commit is contained in:
peter1138 2005-09-26 19:01:49 +00:00
parent 2314431a59
commit fbf06041ca
6 changed files with 9 additions and 27 deletions

View File

@ -97,7 +97,7 @@ int GetAircraftImage(const Vehicle *v, byte direction)
int sprite = GetCustomVehicleSprite(v, direction);
if (sprite) return sprite;
spritenum = _engine_original_sprites[v->engine_type];
spritenum = orig_aircraft_vehicle_info[v->engine_type - AIRCRAFT_ENGINES_INDEX].image_index;
}
return direction + _aircraft_sprite[spritenum];
}
@ -110,7 +110,7 @@ void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod)
if (is_custom_sprite(spritenum)) {
sprite = GetCustomVehicleIcon(engine, 6);
if (!sprite)
sprite = _engine_original_sprites[engine];
spritenum = orig_aircraft_vehicle_info[engine - AIRCRAFT_ENGINES_INDEX].image_index;
}
DrawSprite(sprite | image_ormod, x, y);

View File

@ -172,7 +172,6 @@ VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE];
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
VARDEF uint32 _engine_refit_masks[256];
VARDEF byte _engine_original_sprites[256];
void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group, byte *train_id, int trains);
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group);
// loaded is in percents, overriding_engine 0xffff is none

View File

@ -272,8 +272,6 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 spriteid = grf_load_byte(&buf);
if (spriteid == 0xFD && rvi[i].image_index != 0xFD)
_engine_original_sprites[engine + i] = rvi[i].image_index;
rvi[i].image_index = spriteid;
}
} break;
@ -448,11 +446,6 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (spriteid == 0xFF)
spriteid = 0xFD; // cars have different custom id in the GRF file
// This is currently not used but there's no reason
// in not having it here for the future.
if (spriteid == 0xFD && rvi[i].image_index != 0xFD)
_engine_original_sprites[ROAD_ENGINES_INDEX + engine + i] = rvi[i].image_index;
rvi[i].image_index = spriteid;
}
} break;
@ -539,11 +532,6 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (spriteid == 0xFF)
spriteid = 0xFD; // ships have different custom id in the GRF file
// This is currently not used but there's no reason
// in not having it here for the future.
if (spriteid == 0xFD && svi[i].image_index != 0xFD)
_engine_original_sprites[SHIP_ENGINES_INDEX + engine + i] = svi[i].image_index;
svi[i].image_index = spriteid;
}
} break;
@ -646,11 +634,6 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
if (spriteid == 0xFF)
spriteid = 0xFD; // ships have different custom id in the GRF file
// This is currently not used but there's no reason
// in not having it here for the future.
if (spriteid == 0xFD && avi[i].image_index != 0xFD)
_engine_original_sprites[AIRCRAFT_ENGINES_INDEX + engine + i] = avi[i].image_index;
avi[i].image_index = spriteid;
}
} break;

View File

@ -68,7 +68,7 @@ int GetRoadVehImage(const Vehicle *v, byte direction)
if (is_custom_sprite(img)) {
image = GetCustomVehicleSprite(v, direction);
if (image) return image;
img = _engine_original_sprites[v->engine_type];
img = orig_road_vehicle_info[v->engine_type - ROAD_ENGINES_INDEX].image_index;
}
image = direction + _roadveh_images[img];
@ -88,7 +88,7 @@ void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
DrawSprite(sprite | image_ormod, x, y);
return;
}
spritenum = _engine_original_sprites[engine];
spritenum = orig_road_vehicle_info[engine - ROAD_ENGINES_INDEX].image_index;
}
DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y);
}

View File

@ -39,7 +39,7 @@ void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
DrawSprite(sprite | image_ormod, x, y);
return;
}
spritenum = _engine_original_sprites[engine];
spritenum = orig_ship_vehicle_info[engine - SHIP_ENGINES_INDEX].image_index;
}
DrawSprite((6 + _ship_sprites[spritenum]) | image_ormod, x, y);
}
@ -52,7 +52,7 @@ int GetShipImage(const Vehicle *v, byte direction)
int sprite = GetCustomVehicleSprite(v, direction);
if (sprite) return sprite;
spritenum = _engine_original_sprites[v->engine_type];
spritenum = orig_ship_vehicle_info[v->engine_type - SHIP_ENGINES_INDEX].image_index;
}
return _ship_sprites[spritenum] + direction;
}

View File

@ -354,7 +354,7 @@ int GetTrainImage(const Vehicle *v, byte direction)
if (is_custom_sprite(img)) {
base = GetCustomVehicleSprite(v, direction + 4 * IS_CUSTOM_SECONDHEAD_SPRITE(img));
if (base != 0) return base;
img = _engine_original_sprites[v->engine_type];
img = orig_rail_vehicle_info[v->engine_type].image_index;
}
base = _engine_sprite_base[img] + ((direction + _engine_sprite_add[img]) & _engine_sprite_and[img]);
@ -373,7 +373,7 @@ void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
if (is_custom_sprite(img)) {
image = GetCustomVehicleIcon(engine, 6);
if (image == 0) img = _engine_original_sprites[engine];
if (image == 0) img = orig_rail_vehicle_info[engine].image_index;
}
if (image == 0) {
image = (6 & _engine_sprite_and[img]) + _engine_sprite_base[img];
@ -385,7 +385,7 @@ void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
image = 0;
if (is_custom_sprite(img)) {
image = GetCustomVehicleIcon(engine, 2);
if (image == 0) img = _engine_original_sprites[engine];
if (image == 0) img = orig_rail_vehicle_info[engine].image_index;
}
if (image == 0) {
image =