summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-07-23 16:08:58 +0000
committertruelight <truelight@openttd.org>2007-07-23 16:08:58 +0000
commit98b23edeb3c789ea839a05424d2f802c1c0d6de0 (patch)
tree05a69e5a55f30ef9e0bf5a305d168df4935746bb /src
parent8367e16809067a09af4a54bec7fc79d6f1a35cbf (diff)
downloadopenttd-98b23edeb3c789ea839a05424d2f802c1c0d6de0.tar.xz
(svn r10659) -Codechange: updated documentation around RAIL_GROUND_FENCE_VERT[12] (frosch)
-Codechange: added documentation and SPR_ enums for track fences (frosch)
Diffstat (limited to 'src')
-rw-r--r--src/rail_cmd.cpp36
-rw-r--r--src/rail_map.h4
-rw-r--r--src/table/sprites.h10
3 files changed, 36 insertions, 14 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index b0cecc0fc..e2f3eb6d1 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 ff938d846..b20230dcd 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 777cb4261..486f935e1 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