diff options
author | belugas <belugas@openttd.org> | 2006-04-24 21:10:56 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-04-24 21:10:56 +0000 |
commit | ebf6797678b58aa558ab933fd3f5931fcf0406b9 (patch) | |
tree | d080bac8a9cda725440a23acb119e6257fe7731c /town_cmd.c | |
parent | 7aed9a62f2150f35b31b2ea52a4de07c1aa50ce2 (diff) | |
download | openttd-ebf6797678b58aa558ab933fd3f5931fcf0406b9.tar.xz |
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
Diffstat (limited to 'town_cmd.c')
-rw-r--r-- | town_cmd.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/town_cmd.c b/town_cmd.c index 359c780b7..ca92b1b28 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -26,6 +26,7 @@ #include "water_map.h" #include "variables.h" #include "bridge.h" +#include "table/town_land.h" enum { /* Max towns: 64000 (8 * 8000) */ @@ -54,21 +55,6 @@ static bool BuildTownHouse(Town *t, TileIndex tile); static void ClearTownHouse(Town *t, TileIndex tile); static void DoBuildTownHouse(Town *t, TileIndex tile); -typedef struct DrawTownTileStruct { - SpriteID sprite_1; - SpriteID sprite_2; - - byte subtile_x:4; - byte subtile_y:4; - byte width:4; - byte height:4; - byte dz; - byte proc; -} DrawTownTileStruct; - -#include "table/town_land.h" - - static void TownDrawHouseLift(const TileInfo *ti) { AddChildSpriteScreen(SPR_LIFT, 14, 60 - GetLiftPosition(ti->tile)); @@ -82,22 +68,20 @@ static TownDrawTileProc * const _town_draw_tile_procs[1] = { static void DrawTile_Town(TileInfo *ti) { - const DrawTownTileStruct *dcts; + const DrawBuildingsTileStruct *dcts; byte z; uint32 image; /* Retrieve pointer to the draw town tile struct */ { /* this "randomizes" on the (up to) 4 variants of a building */ - byte gfx = GetHouseType(ti->tile); - byte stage = GetHouseBuildingStage(ti->tile); uint variant; variant = ti->x >> 4; variant ^= ti->x >> 6; variant ^= ti->y >> 4; variant -= ti->y >> 6; variant &= 3; - dcts = &_town_draw_tile_data[gfx << 4 | variant << 2 | stage]; + dcts = &_town_draw_tile_data[GetHouseType(ti->tile) << 4 | variant << 2 | GetHouseBuildingStage(ti->tile)]; } z = ti->z; @@ -105,15 +89,15 @@ static void DrawTile_Town(TileInfo *ti) /* Add bricks below the house? */ if (ti->tileh != SLOPE_FLAT) { AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + ti->tileh, ti->x, ti->y, 16, 16, 7, z); - AddChildSpriteScreen(dcts->sprite_1, 31, 1); + AddChildSpriteScreen(dcts->ground, 31, 1); z += TILE_HEIGHT; } else { /* Else draw regular ground */ - DrawGroundSprite(dcts->sprite_1); + DrawGroundSprite(dcts->ground); } /* Add a house on top of the ground? */ - image = dcts->sprite_2; + image = dcts->building; if (image != 0) { if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); @@ -129,7 +113,7 @@ static void DrawTile_Town(TileInfo *ti) } { - int proc = dcts->proc - 1; + int proc = dcts->draw_proc - 1; if (proc >= 0) _town_draw_tile_procs[proc](ti); } |