From 98b23edeb3c789ea839a05424d2f802c1c0d6de0 Mon Sep 17 00:00:00 2001 From: truelight Date: Mon, 23 Jul 2007 16:08:58 +0000 Subject: [PATCH] (svn r10659) -Codechange: updated documentation around RAIL_GROUND_FENCE_VERT[12] (frosch) -Codechange: added documentation and SPR_ enums for track fences (frosch) --- src/rail_cmd.cpp | 36 ++++++++++++++++++++++++------------ src/rail_map.h | 4 ++-- src/table/sprites.h | 10 ++++++++++ 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index b0cecc0fc5..e2f3eb6d1f 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1225,16 +1225,16 @@ static uint32 _drawtile_track_palette; static void DrawTrackFence_NW(const TileInfo *ti) { - SpriteID image = 0x515; - if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? 0x519 : 0x51B; + SpriteID image = SPR_TRACK_FENCE_FLAT_X; + if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? SPR_TRACK_FENCE_SLOPE_SW : SPR_TRACK_FENCE_SLOPE_NE; AddSortableSpriteToDraw(image, _drawtile_track_palette, ti->x, ti->y + 1, 16, 1, 4, ti->z); } static void DrawTrackFence_SE(const TileInfo *ti) { - SpriteID image = 0x515; - if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? 0x519 : 0x51B; + SpriteID image = SPR_TRACK_FENCE_FLAT_X; + if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? SPR_TRACK_FENCE_SLOPE_SW : SPR_TRACK_FENCE_SLOPE_NE; AddSortableSpriteToDraw(image, _drawtile_track_palette, ti->x, ti->y + TILE_SIZE - 1, 16, 1, 4, ti->z); } @@ -1247,16 +1247,16 @@ static void DrawTrackFence_NW_SE(const TileInfo *ti) static void DrawTrackFence_NE(const TileInfo *ti) { - SpriteID image = 0x516; - if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? 0x51A : 0x51C; + SpriteID image = SPR_TRACK_FENCE_FLAT_Y; + if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? SPR_TRACK_FENCE_SLOPE_SE : SPR_TRACK_FENCE_SLOPE_NW; AddSortableSpriteToDraw(image, _drawtile_track_palette, ti->x + 1, ti->y, 1, 16, 4, ti->z); } static void DrawTrackFence_SW(const TileInfo *ti) { - SpriteID image = 0x516; - if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? 0x51A : 0x51C; + SpriteID image = SPR_TRACK_FENCE_FLAT_Y; + if (ti->tileh != SLOPE_FLAT) image = (ti->tileh & SLOPE_S) ? SPR_TRACK_FENCE_SLOPE_SE : SPR_TRACK_FENCE_SLOPE_NW; AddSortableSpriteToDraw(image, _drawtile_track_palette, ti->x + TILE_SIZE - 1, ti->y, 1, 16, 4, ti->z); } @@ -1267,35 +1267,47 @@ static void DrawTrackFence_NE_SW(const TileInfo *ti) DrawTrackFence_SW(ti); } +/** + * Draw fence at eastern side of track. + */ static void DrawTrackFence_NS_1(const TileInfo *ti) { int z = ti->z; if (ti->tileh & SLOPE_W) z += TILE_HEIGHT; - AddSortableSpriteToDraw(0x517, _drawtile_track_palette, + AddSortableSpriteToDraw(SPR_TRACK_FENCE_FLAT_VERT, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } +/** + * Draw fence at western side of track. + */ static void DrawTrackFence_NS_2(const TileInfo *ti) { int z = ti->z; if (ti->tileh & SLOPE_E) z += TILE_HEIGHT; - AddSortableSpriteToDraw(0x517, _drawtile_track_palette, + AddSortableSpriteToDraw(SPR_TRACK_FENCE_FLAT_VERT, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } +/** + * Draw fence at southern side of track. + */ static void DrawTrackFence_WE_1(const TileInfo *ti) { int z = ti->z; if (ti->tileh & SLOPE_N) z += TILE_HEIGHT; - AddSortableSpriteToDraw(0x518, _drawtile_track_palette, + AddSortableSpriteToDraw(SPR_TRACK_FENCE_FLAT_HORZ, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } +/** + * Draw fence at northern side of track. + */ static void DrawTrackFence_WE_2(const TileInfo *ti) { int z = ti->z; if (ti->tileh & SLOPE_S) z += TILE_HEIGHT; - AddSortableSpriteToDraw(0x518, _drawtile_track_palette, + AddSortableSpriteToDraw(SPR_TRACK_FENCE_FLAT_HORZ, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } diff --git a/src/rail_map.h b/src/rail_map.h index ff938d846a..b20230dcd9 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -389,8 +389,8 @@ enum RailGroundType { RAIL_GROUND_FENCE_NE = 5, ///< Grass with a fence at the NE edge RAIL_GROUND_FENCE_SW = 6, ///< Grass with a fence at the SW edge RAIL_GROUND_FENCE_NESW = 7, ///< Grass with a fence at the NE and SW edges - RAIL_GROUND_FENCE_VERT1 = 8, ///< Grass with a fence at the western side - RAIL_GROUND_FENCE_VERT2 = 9, ///< Grass with a fence at the eastern side + RAIL_GROUND_FENCE_VERT1 = 8, ///< Grass with a fence at the eastern side + RAIL_GROUND_FENCE_VERT2 = 9, ///< Grass with a fence at the western side RAIL_GROUND_FENCE_HORIZ1 = 10, ///< Grass with a fence at the southern side RAIL_GROUND_FENCE_HORIZ2 = 11, ///< Grass with a fence at the northern side RAIL_GROUND_ICE_DESERT = 12, ///< Icy or sandy diff --git a/src/table/sprites.h b/src/table/sprites.h index 777cb42615..486f935e14 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -303,6 +303,16 @@ enum Sprites { OFFSET_TILEH_13 = 19, OFFSET_TILEH_14 = 16, + /* Track fences */ + SPR_TRACK_FENCE_FLAT_X = 1301, + SPR_TRACK_FENCE_FLAT_Y = 1302, + SPR_TRACK_FENCE_FLAT_VERT = 1303, + SPR_TRACK_FENCE_FLAT_HORZ = 1304, + SPR_TRACK_FENCE_SLOPE_SW = 1305, + SPR_TRACK_FENCE_SLOPE_SE = 1306, + SPR_TRACK_FENCE_SLOPE_NE = 1307, + SPR_TRACK_FENCE_SLOPE_NW = 1308, + /* Elrail stuff */ /* Wires. First identifier is the direction of the track, second is the required placement of the pylon. * "short" denotes a wire that requires a pylon on each end. Third identifier is the direction of the slope