Changeset - r14479:0b37c3cf82f1
[Not reviewed]
master
0 1 0
peter1138 - 15 years ago 2010-02-08 16:07:46
peter1138@openttd.org
(svn r19060) -Codechange: Draw custom depot sprites in GUI.
1 file changed with 17 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -2221,34 +2221,49 @@ static void DrawTile_Track(TileInfo *ti)
 
		}
 

	
 
		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 

	
 
		DrawRailTileSeq(ti, dts, TO_BUILDINGS, relocation, 0, _drawtile_track_palette);
 
	}
 
	DrawBridgeMiddle(ti);
 
}
 

	
 
void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
 
{
 
	const DrawTileSprites *dts = &_depot_gfx_table[dir];
 
	SpriteID image = dts->ground.sprite;
 
	uint32 offset = GetRailTypeInfo(railtype)->total_offset;
 
	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
 
	SpriteID image = rti->UsesOverlay() ? SPR_FLAT_GRASS_TILE : dts->ground.sprite;
 
	uint32 offset = rti->total_offset;
 

	
 
	x += 33;
 
	y += 17;
 

	
 
	if (image != SPR_FLAT_GRASS_TILE) image += offset;
 
	PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
 

	
 
	DrawSprite(image, PAL_NONE, x, y);
 

	
 
	if (rti->UsesOverlay()) {
 
		SpriteID ground = GetCustomRailSprite(rti, INVALID_TILE, RTSG_GROUND);
 

	
 
		switch (dir) {
 
			case DIAGDIR_SW: DrawSprite(ground + RTO_X, PAL_NONE, x, y); break;
 
			case DIAGDIR_SE: DrawSprite(ground + RTO_Y, PAL_NONE, x, y); break;
 
			default: break;
 
		}
 

	
 
		offset  = GetCustomRailSprite(rti, INVALID_TILE, RTSG_DEPOT);
 
		offset -= SPR_RAIL_DEPOT_SE_1;
 
	}
 

	
 
	DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette);
 
}
 

	
 
static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y)
 
{
 
	uint z;
 
	Slope tileh = GetTileSlope(tile, &z);
 

	
 
	if (tileh == SLOPE_FLAT) return z;
 
	if (IsPlainRail(tile)) {
 
		z += ApplyFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh);
 
		return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
0 comments (0 inline, 0 general)