mirror of https://github.com/OpenTTD/OpenTTD
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
parent
132ce0a598
commit
fcf5ace08f
|
@ -465,12 +465,6 @@ enum {
|
||||||
EXPENSES_OTHER = 12,
|
EXPENSES_OTHER = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tile type misc constants, don't know where to put these
|
|
||||||
enum {
|
|
||||||
TRACKTYPE_SPRITE_PITCH = 0x52,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// special string constants
|
// special string constants
|
||||||
enum SpecialStrings {
|
enum SpecialStrings {
|
||||||
|
|
||||||
|
|
10
rail.h
10
rail.h
|
@ -159,6 +159,16 @@ typedef struct RailtypeInfo {
|
||||||
|
|
||||||
/** bitmask to the OTHER railtypes that can be used by an engine of THIS railtype */
|
/** bitmask to the OTHER railtypes that can be used by an engine of THIS railtype */
|
||||||
byte compatible_railtypes;
|
byte compatible_railtypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offset between the current railtype and normal rail. This means that:<p>
|
||||||
|
* 1) All the sprites in a railset MUST be in the same order. This order
|
||||||
|
* is determined by normal rail. Check sprites 1005 and following for this order<p>
|
||||||
|
* 2) The position where the railtype is loaded must always be the same, otherwise
|
||||||
|
* the offset will fail.<p>
|
||||||
|
* @note: Something more flexible might be desirable in the future.
|
||||||
|
*/
|
||||||
|
SpriteID total_offset;
|
||||||
} RailtypeInfo;
|
} RailtypeInfo;
|
||||||
|
|
||||||
extern const RailtypeInfo _railtypes[RAILTYPE_END];
|
extern const RailtypeInfo _railtypes[RAILTYPE_END];
|
||||||
|
|
56
rail_cmd.c
56
rail_cmd.c
|
@ -1347,14 +1347,14 @@ DetailedTrackProc * const _detailed_track_proc[16] = {
|
||||||
DetTrackDrawProc_Null,
|
DetTrackDrawProc_Null,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void DrawSpecialBuilding(uint32 image, uint32 tracktype_offs,
|
static void DrawSpecialBuilding(uint32 image, uint32 offset,
|
||||||
TileInfo *ti,
|
TileInfo *ti,
|
||||||
byte x, byte y, byte z,
|
byte x, byte y, byte z,
|
||||||
byte xsize, byte ysize, byte zsize)
|
byte xsize, byte ysize, byte zsize)
|
||||||
{
|
{
|
||||||
if (image & PALETTE_MODIFIER_COLOR)
|
if (image & PALETTE_MODIFIER_COLOR)
|
||||||
image |= _drawtile_track_palette;
|
image |= _drawtile_track_palette;
|
||||||
image += tracktype_offs;
|
image += offset;
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) // show transparent depots
|
if (_display_opt & DO_TRANS_BUILDINGS) // show transparent depots
|
||||||
MAKE_TRANSPARENT(image);
|
MAKE_TRANSPARENT(image);
|
||||||
AddSortableSpriteToDraw(image, ti->x + x, ti->y + y, xsize, ysize, zsize, ti->z + z);
|
AddSortableSpriteToDraw(image, ti->x + x, ti->y + y, xsize, ysize, zsize, ti->z + z);
|
||||||
|
@ -1362,15 +1362,12 @@ static void DrawSpecialBuilding(uint32 image, uint32 tracktype_offs,
|
||||||
|
|
||||||
static void DrawTile_Track(TileInfo *ti)
|
static void DrawTile_Track(TileInfo *ti)
|
||||||
{
|
{
|
||||||
uint32 tracktype_offs;
|
|
||||||
byte m5;
|
byte m5;
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||||
uint32 image; //XXX ok why the hell is SpriteID 16 bit when all the drawing routines need 32?
|
uint32 image; //XXX ok why the hell is SpriteID 16 bit when all the drawing routines need 32?
|
||||||
|
|
||||||
_drawtile_track_palette = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)));
|
_drawtile_track_palette = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)));
|
||||||
|
|
||||||
tracktype_offs = (_m[ti->tile].m3 & 0xF) * TRACKTYPE_SPRITE_PITCH;
|
|
||||||
|
|
||||||
m5 = (byte)ti->map5;
|
m5 = (byte)ti->map5;
|
||||||
if (!(m5 & RAIL_TYPE_SPECIAL)) {
|
if (!(m5 & RAIL_TYPE_SPECIAL)) {
|
||||||
bool special;
|
bool special;
|
||||||
|
@ -1407,9 +1404,9 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
|
if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK)==RAIL_GROUND_BROWN) {
|
if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_BROWN) {
|
||||||
image = (image & SPRITE_MASK) | PALETTE_TO_BARE_LAND; // use a brown palette
|
image = (image & SPRITE_MASK) | PALETTE_TO_BARE_LAND; // use a brown palette
|
||||||
} else if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK)==RAIL_GROUND_ICE_DESERT) {
|
} else if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT) {
|
||||||
image += rti->snow_offset;
|
image += rti->snow_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1491,7 +1488,7 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
|
|
||||||
if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); }
|
if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); }
|
||||||
|
|
||||||
if (IsRailWaypoint(m5) && _m[ti->tile].m3 & 16) {
|
if (IsRailWaypoint(m5) && HASBIT(_m[ti->tile].m3, 4)) {
|
||||||
// look for customization
|
// look for customization
|
||||||
StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4);
|
StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4);
|
||||||
|
|
||||||
|
@ -1500,7 +1497,6 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
// emulate station tile - open with building
|
// emulate station tile - open with building
|
||||||
DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
|
DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
|
||||||
uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
|
uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
|
||||||
int railtype=(_m[ti->tile].m3 & 0xF);
|
|
||||||
|
|
||||||
/* We don't touch the 0x8000 bit. In all this
|
/* We don't touch the 0x8000 bit. In all this
|
||||||
* waypoint code, it is used to indicate that
|
* waypoint code, it is used to indicate that
|
||||||
|
@ -1512,7 +1508,7 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
* up to the GRF file to decide that. */
|
* up to the GRF file to decide that. */
|
||||||
|
|
||||||
image = cust->ground_sprite;
|
image = cust->ground_sprite;
|
||||||
image += railtype*((image<_custom_sprites_base)?TRACKTYPE_SPRITE_PITCH:1);
|
image += (image < _custom_sprites_base) ? rti->total_offset : GetRailType(ti->tile);
|
||||||
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
||||||
|
@ -1529,32 +1525,34 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
drss = _track_depot_layout_table[type];
|
drss = _track_depot_layout_table[type];
|
||||||
|
|
||||||
image = drss++->image;
|
image = drss++->image;
|
||||||
if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + tracktype_offs;
|
/* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates
|
||||||
|
* whether the sprite is railtype dependent. Rewrite this asap */
|
||||||
|
if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset;
|
||||||
|
|
||||||
// adjust ground tile for desert
|
// adjust ground tile for desert
|
||||||
// (don't adjust for arctic depots, because snow in depots looks weird)
|
// (don't adjust for arctic depots, because snow in depots looks weird)
|
||||||
if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK)==RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type>=4))
|
// type >= 4 means waypoints
|
||||||
{
|
if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type >= 4)) {
|
||||||
if(image!=3981)
|
if (image != SPR_FLAT_GRASS_TILE)
|
||||||
image += 26; // tile with tracks
|
image += rti->snow_offset; // tile with tracks
|
||||||
else
|
else
|
||||||
image = 4550; // flat ground
|
image = SPR_FLAT_SNOWY_TILE; // flat ground
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
||||||
if (_debug_pbs_level >= 1) {
|
if (_debug_pbs_level >= 1) {
|
||||||
byte pbs = PBSTileReserved(ti->tile);
|
byte pbs = PBSTileReserved(ti->tile);
|
||||||
if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite((0x3ED + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite(rti->base_sprites.single_y | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite((0x3EE + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite(rti->base_sprites.single_x | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_UPPER) DrawGroundSprite((0x3EF + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_UPPER) DrawGroundSprite(rti->base_sprites.single_n | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_LOWER) DrawGroundSprite((0x3F0 + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_LOWER) DrawGroundSprite(rti->base_sprites.single_s | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_LEFT) DrawGroundSprite((0x3F2 + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite((0x3F1 + tracktype_offs) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e | PALETTE_CRASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((image=drss->image) != 0) {
|
while ((image = drss->image) != 0) {
|
||||||
DrawSpecialBuilding(image, type < 4 ? tracktype_offs : 0, ti,
|
DrawSpecialBuilding(image, type < 4 ? rti->total_offset : 0, ti,
|
||||||
drss->subcoord_x, drss->subcoord_y, 0,
|
drss->subcoord_x, drss->subcoord_y, 0,
|
||||||
drss->width, drss->height, 0x17);
|
drss->width, drss->height, 0x17);
|
||||||
drss++;
|
drss++;
|
||||||
|
@ -1565,11 +1563,9 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
||||||
{
|
{
|
||||||
uint32 ormod, img;
|
uint32 ormod, img;
|
||||||
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
const DrawTrackSeqStruct *dtss;
|
const DrawTrackSeqStruct *dtss;
|
||||||
|
|
||||||
/* baseimage */
|
|
||||||
railtype *= TRACKTYPE_SPRITE_PITCH;
|
|
||||||
|
|
||||||
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
||||||
|
|
||||||
dtss = _track_depot_layout_table[image];
|
dtss = _track_depot_layout_table[image];
|
||||||
|
@ -1578,14 +1574,16 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
||||||
y+=17;
|
y+=17;
|
||||||
|
|
||||||
img = dtss++->image;
|
img = dtss++->image;
|
||||||
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + railtype;
|
/* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates
|
||||||
|
* whether the sprite is railtype dependent. Rewrite this asap */
|
||||||
|
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + rti->total_offset;
|
||||||
DrawSprite(img, x, y);
|
DrawSprite(img, x, y);
|
||||||
|
|
||||||
for (; dtss->image != 0; dtss++) {
|
for (; dtss->image != 0; dtss++) {
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||||
image = dtss->image;
|
image = dtss->image;
|
||||||
if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
|
if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
|
||||||
DrawSprite(image + railtype, x + pt.x, y + pt.y);
|
DrawSprite(image + rti->total_offset, x + pt.x, y + pt.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
|
||||||
},
|
},
|
||||||
SPR_RAIL_SNOW_OFFSET,
|
SPR_RAIL_SNOW_OFFSET,
|
||||||
(1 << RAILTYPE_RAIL),
|
(1 << RAILTYPE_RAIL),
|
||||||
|
0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -36,6 +37,7 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
|
||||||
},
|
},
|
||||||
SPR_MONO_SNOW_OFFSET,
|
SPR_MONO_SNOW_OFFSET,
|
||||||
(1 << RAILTYPE_MONO),
|
(1 << RAILTYPE_MONO),
|
||||||
|
82,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -51,6 +53,7 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
|
||||||
},
|
},
|
||||||
SPR_MGLV_SNOW_OFFSET,
|
SPR_MGLV_SNOW_OFFSET,
|
||||||
(1 << RAILTYPE_MAGLEV),
|
(1 << RAILTYPE_MAGLEV),
|
||||||
|
164,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2137,7 +2137,8 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
const DrawTileSeqStruct *dtss;
|
const DrawTileSeqStruct *dtss;
|
||||||
const DrawTileSprites *t = NULL;
|
const DrawTileSprites *t = NULL;
|
||||||
byte railtype = _m[ti->tile].m3 & 0xF;
|
byte railtype = _m[ti->tile].m3 & 0xF;
|
||||||
int type_offset;
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
|
SpriteID offset;
|
||||||
uint32 relocation = 0;
|
uint32 relocation = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2173,26 +2174,26 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
image |= image_or_modificator;
|
image |= image_or_modificator;
|
||||||
|
|
||||||
// For custom sprites, there's no railtype-based pitching.
|
// For custom sprites, there's no railtype-based pitching.
|
||||||
type_offset = railtype * ((image & SPRITE_MASK) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1);
|
offset = (image & SPRITE_MASK) < _custom_sprites_base ? rti->total_offset : railtype;
|
||||||
|
image += offset;
|
||||||
|
|
||||||
// station_land array has been increased from 82 elements to 114
|
// station_land array has been increased from 82 elements to 114
|
||||||
// but this is something else. If AI builds station with 114 it looks all weird
|
// but this is something else. If AI builds station with 114 it looks all weird
|
||||||
image += type_offset;
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
||||||
if (_debug_pbs_level >= 1) {
|
if (_debug_pbs_level >= 1) {
|
||||||
byte pbs = PBSTileReserved(ti->tile);
|
byte pbs = PBSTileReserved(ti->tile);
|
||||||
if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite((0x3ED + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite(rti->base_sprites.single_y | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite((0x3EE + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite(rti->base_sprites.single_x | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_UPPER) DrawGroundSprite((0x3EF + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_UPPER) DrawGroundSprite(rti->base_sprites.single_n | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_LOWER) DrawGroundSprite((0x3F0 + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_LOWER) DrawGroundSprite(rti->base_sprites.single_s | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_LEFT) DrawGroundSprite((0x3F2 + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w | PALETTE_CRASH);
|
||||||
if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite((0x3F1 + type_offset) | PALETTE_CRASH);
|
if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e | PALETTE_CRASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach_draw_tile_seq(dtss, t->seq) {
|
foreach_draw_tile_seq(dtss, t->seq) {
|
||||||
image = dtss->image + relocation;
|
image = dtss->image + relocation;
|
||||||
image += type_offset;
|
image += offset;
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) {
|
if (_display_opt & DO_TRANS_BUILDINGS) {
|
||||||
MAKE_TRANSPARENT(image);
|
MAKE_TRANSPARENT(image);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2212,9 +2213,7 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image)
|
||||||
uint32 ormod, img;
|
uint32 ormod, img;
|
||||||
const DrawTileSeqStruct *dtss;
|
const DrawTileSeqStruct *dtss;
|
||||||
const DrawTileSprites *t;
|
const DrawTileSprites *t;
|
||||||
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
/* baseimage */
|
|
||||||
railtype *= TRACKTYPE_SPRITE_PITCH;
|
|
||||||
|
|
||||||
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
||||||
|
|
||||||
|
@ -2223,11 +2222,11 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image)
|
||||||
img = t->ground_sprite;
|
img = t->ground_sprite;
|
||||||
if (img & PALETTE_MODIFIER_COLOR)
|
if (img & PALETTE_MODIFIER_COLOR)
|
||||||
img |= ormod;
|
img |= ormod;
|
||||||
DrawSprite(img + railtype, x, y);
|
DrawSprite(img + rti->total_offset, x, y);
|
||||||
|
|
||||||
foreach_draw_tile_seq(dtss, t->seq) {
|
foreach_draw_tile_seq(dtss, t->seq) {
|
||||||
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
|
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
|
||||||
DrawSprite((dtss->image | ormod) + railtype, x + pt.x, y + pt.y);
|
DrawSprite((dtss->image | ormod) + rti->total_offset, x + pt.x, y + pt.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1022,7 +1022,6 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
||||||
/* railway type */
|
/* railway type */
|
||||||
image = GB(_m[ti->tile].m3, 0, 4) * 8;
|
image = GB(_m[ti->tile].m3, 0, 4) * 8;
|
||||||
|
|
||||||
/* ice? */
|
|
||||||
if (ice)
|
if (ice)
|
||||||
image += 32;
|
image += 32;
|
||||||
|
|
||||||
|
@ -1085,7 +1084,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
||||||
|
|
||||||
if (!(ti->map5 & 0x20)) {
|
if (!(ti->map5 & 0x20)) {
|
||||||
// draw land under bridge
|
// draw land under bridge
|
||||||
if (ice) image += 2; // ice too?
|
if (ice) image += 2;
|
||||||
|
|
||||||
if (image != 1 || ti->tileh == 0)
|
if (image != 1 || ti->tileh == 0)
|
||||||
DrawGroundSprite(_bridge_land_below[image] + _tileh_to_sprite[ti->tileh]);
|
DrawGroundSprite(_bridge_land_below[image] + _tileh_to_sprite[ti->tileh]);
|
||||||
|
@ -1104,11 +1103,12 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(image&1)) {
|
if (!(image&1)) {
|
||||||
|
const RailtypeInfo *rti = GetRailTypeInfo(_m[ti->tile].m3 & 0xF);
|
||||||
// railway
|
// railway
|
||||||
image = 0x3F3 + (ti->map5 & 1);
|
image = 0x3F3 + (ti->map5 & 1);
|
||||||
if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
|
if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
|
||||||
image += (_m[ti->tile].m3 & 0xF) * TRACKTYPE_SPRITE_PITCH;
|
image += rti->total_offset;
|
||||||
if (ice) image += 26; // ice?
|
if (ice) image += rti->snow_offset;
|
||||||
} else {
|
} else {
|
||||||
// road
|
// road
|
||||||
image = 1332 + (ti->map5 & 1);
|
image = 1332 + (ti->map5 & 1);
|
||||||
|
|
|
@ -360,12 +360,13 @@ Station *ComposeWaypointStation(TileIndex tile)
|
||||||
extern uint16 _custom_sprites_base;
|
extern uint16 _custom_sprites_base;
|
||||||
|
|
||||||
/* Draw a waypoint */
|
/* Draw a waypoint */
|
||||||
void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
|
void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
|
||||||
{
|
{
|
||||||
StationSpec *stat;
|
StationSpec *stat;
|
||||||
uint32 relocation;
|
uint32 relocation;
|
||||||
DrawTileSprites *cust;
|
DrawTileSprites *cust;
|
||||||
DrawTileSeqStruct const *seq;
|
DrawTileSeqStruct const *seq;
|
||||||
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
uint32 ormod, img;
|
uint32 ormod, img;
|
||||||
|
|
||||||
ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player));
|
ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player));
|
||||||
|
@ -378,7 +379,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
|
||||||
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
|
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
|
||||||
|
|
||||||
img = dtss++->image;
|
img = dtss++->image;
|
||||||
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + railtype*TRACKTYPE_SPRITE_PITCH;
|
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + rti->total_offset;
|
||||||
DrawSprite(img, x, y);
|
DrawSprite(img, x, y);
|
||||||
|
|
||||||
for (; dtss->image != 0; dtss++) {
|
for (; dtss->image != 0; dtss++) {
|
||||||
|
@ -398,7 +399,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
|
||||||
cust = &stat->renderdata[2];
|
cust = &stat->renderdata[2];
|
||||||
|
|
||||||
img = cust->ground_sprite;
|
img = cust->ground_sprite;
|
||||||
img += railtype * ((img < _custom_sprites_base) ? TRACKTYPE_SPRITE_PITCH : 1);
|
img += (img < _custom_sprites_base) ? rti->total_offset : railtype;
|
||||||
|
|
||||||
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK);
|
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK);
|
||||||
DrawSprite(img, x, y);
|
DrawSprite(img, x, y);
|
||||||
|
|
|
@ -59,7 +59,7 @@ int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);
|
||||||
Station *ComposeWaypointStation(TileIndex tile);
|
Station *ComposeWaypointStation(TileIndex tile);
|
||||||
Waypoint *GetWaypointByTile(TileIndex tile);
|
Waypoint *GetWaypointByTile(TileIndex tile);
|
||||||
void ShowRenameWaypointWindow(const Waypoint *cp);
|
void ShowRenameWaypointWindow(const Waypoint *cp);
|
||||||
void DrawWaypointSprite(int x, int y, int image, int railtype);
|
void DrawWaypointSprite(int x, int y, int image, uint railtype);
|
||||||
void UpdateWaypointSign(Waypoint *cp);
|
void UpdateWaypointSign(Waypoint *cp);
|
||||||
void FixOldWaypoints(void);
|
void FixOldWaypoints(void);
|
||||||
void UpdateAllWaypointSigns(void);
|
void UpdateAllWaypointSigns(void);
|
||||||
|
|
Loading…
Reference in New Issue