src/town_cmd.cpp
changeset 5919 2b58160d667d
parent 5838 9c3129cb019b
child 6268 4b5241e5dd10
child 6386 b5b33c834335
equal deleted inserted replaced
5918:602e158900a2 5919:2b58160d667d
    92 static void ClearTownHouse(Town *t, TileIndex tile);
    92 static void ClearTownHouse(Town *t, TileIndex tile);
    93 static void DoBuildTownHouse(Town *t, TileIndex tile);
    93 static void DoBuildTownHouse(Town *t, TileIndex tile);
    94 
    94 
    95 static void TownDrawHouseLift(const TileInfo *ti)
    95 static void TownDrawHouseLift(const TileInfo *ti)
    96 {
    96 {
    97 	AddChildSpriteScreen(SPR_LIFT, 14, 60 - GetLiftPosition(ti->tile));
    97 	AddChildSpriteScreen(SPR_LIFT, PAL_NONE, 14, 60 - GetLiftPosition(ti->tile));
    98 }
    98 }
    99 
    99 
   100 typedef void TownDrawTileProc(const TileInfo *ti);
   100 typedef void TownDrawTileProc(const TileInfo *ti);
   101 static TownDrawTileProc * const _town_draw_tile_procs[1] = {
   101 static TownDrawTileProc * const _town_draw_tile_procs[1] = {
   102 	TownDrawHouseLift
   102 	TownDrawHouseLift
   104 
   104 
   105 
   105 
   106 static void DrawTile_Town(TileInfo *ti)
   106 static void DrawTile_Town(TileInfo *ti)
   107 {
   107 {
   108 	const DrawBuildingsTileStruct *dcts;
   108 	const DrawBuildingsTileStruct *dcts;
   109 	uint32 image;
   109 	SpriteID image;
       
   110 	SpriteID pal;
   110 
   111 
   111 	/* Retrieve pointer to the draw town tile struct */
   112 	/* Retrieve pointer to the draw town tile struct */
   112 	{
   113 	{
   113 		/* this "randomizes" on the (up to) 4 variants of a building */
   114 		/* this "randomizes" on the (up to) 4 variants of a building */
   114 		uint variant;
   115 		uint variant;
   119 		variant &= 3;
   120 		variant &= 3;
   120 		dcts = &_town_draw_tile_data[GetHouseType(ti->tile) << 4 | variant << 2 | GetHouseBuildingStage(ti->tile)];
   121 		dcts = &_town_draw_tile_data[GetHouseType(ti->tile) << 4 | variant << 2 | GetHouseBuildingStage(ti->tile)];
   121 	}
   122 	}
   122 
   123 
   123 	if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
   124 	if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
   124 	DrawGroundSprite(dcts->ground);
   125 
       
   126 	image = dcts->ground.sprite;
       
   127 	pal   = dcts->ground.pal;
       
   128 	DrawGroundSprite(image, pal);
   125 
   129 
   126 	/* Add a house on top of the ground? */
   130 	/* Add a house on top of the ground? */
   127 	image = dcts->building;
   131 	image = dcts->building.sprite;
   128 	if (image != 0) {
   132 	if (image != 0) {
   129 		if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
   133 		if (_display_opt & DO_TRANS_BUILDINGS) {
   130 
   134 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
   131 		AddSortableSpriteToDraw(image,
   135 			pal = PALETTE_TO_TRANSPARENT;
       
   136 		} else {
       
   137 			pal = dcts->building.pal;
       
   138 		}
       
   139 
       
   140 		AddSortableSpriteToDraw(image, pal,
   132 			ti->x + dcts->subtile_x,
   141 			ti->x + dcts->subtile_x,
   133 			ti->y + dcts->subtile_y,
   142 			ti->y + dcts->subtile_y,
   134 			dcts->width + 1,
   143 			dcts->width + 1,
   135 			dcts->height + 1,
   144 			dcts->height + 1,
   136 			dcts->dz,
   145 			dcts->dz,