summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-09-07 13:38:57 +0000
committeryexo <yexo@openttd.org>2009-09-07 13:38:57 +0000
commitec63a0fc142b7013f249e762696e9cb662c1d3f2 (patch)
tree68760360e01c871eb36453197654f0c36dc52170 /src
parent6e3591700fd1543a91c067624b15ee927cca996e (diff)
downloadopenttd-ec63a0fc142b7013f249e762696e9cb662c1d3f2.tar.xz
(svn r17455) -Codechange: use sprite names instead of magic numbers in table/clear_land.h and change some names
Diffstat (limited to 'src')
-rw-r--r--src/clear_cmd.cpp13
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/table/clear_land.h73
-rw-r--r--src/table/sprites.h32
-rw-r--r--src/table/tree_land.h7
-rw-r--r--src/tree_cmd.cpp3
-rw-r--r--src/tunnelbridge_cmd.cpp2
7 files changed, 59 insertions, 75 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 2af9698cd..8bd2a745c 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -58,7 +58,7 @@ void DrawHillyLandTile(const TileInfo *ti)
if (ti->tileh != SLOPE_FLAT) {
DrawGroundSprite(SPR_FLAT_ROUGH_LAND + _tileh_to_sprite[ti->tileh], PAL_NONE);
} else {
- DrawGroundSprite(_landscape_clear_sprites[GB(ti->x ^ ti->y, 4, 3)], PAL_NONE);
+ DrawGroundSprite(_landscape_clear_sprites_rough[GB(ti->x ^ ti->y, 4, 3)], PAL_NONE);
}
}
@@ -72,11 +72,11 @@ void DrawClearLandFence(const TileInfo *ti)
}
if (GetFenceSW(ti->tile) != 0) {
- DrawGroundSpriteAt(_clear_land_fence_sprites_1[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh[ti->tileh], PAL_NONE, ti->x, ti->y, z);
+ DrawGroundSpriteAt(_clear_land_fence_sprites[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh_sw[ti->tileh], PAL_NONE, ti->x, ti->y, z);
}
if (GetFenceSE(ti->tile) != 0) {
- DrawGroundSpriteAt(_clear_land_fence_sprites_1[GetFenceSE(ti->tile) - 1] + _fence_mod_by_tileh_2[ti->tileh], PAL_NONE, ti->x, ti->y, z);
+ DrawGroundSpriteAt(_clear_land_fence_sprites[GetFenceSE(ti->tile) - 1] + _fence_mod_by_tileh_se[ti->tileh], PAL_NONE, ti->x, ti->y, z);
}
}
@@ -96,15 +96,12 @@ static void DrawTile_Clear(TileInfo *ti)
break;
case CLEAR_FIELDS:
- DrawGroundSprite(_clear_land_sprites_1[GetFieldType(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE);
+ DrawGroundSprite(_clear_land_sprites_farmland[GetFieldType(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE);
break;
case CLEAR_SNOW:
- DrawGroundSprite(_clear_land_sprites_2[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE);
- break;
-
case CLEAR_DESERT:
- DrawGroundSprite(_clear_land_sprites_3[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE);
+ DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE);
break;
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 165afcc68..6b875f843 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1733,7 +1733,7 @@ static void DrawTrackBits(TileInfo *ti, TrackBits track)
} else {
switch (rgt) {
case RAIL_GROUND_BARREN: image = SPR_FLAT_BARE_LAND; break;
- case RAIL_GROUND_ICE_DESERT: image = SPR_FLAT_SNOWY_TILE; break;
+ case RAIL_GROUND_ICE_DESERT: image = SPR_FLAT_SNOW_DESERT_TILE; break;
default: image = SPR_FLAT_GRASS_TILE; break;
}
image += _tileh_to_sprite[ti->tileh];
@@ -1927,7 +1927,7 @@ static void DrawTile_Track(TileInfo *ti)
if (image != SPR_FLAT_GRASS_TILE) {
image += rti->snow_offset; // tile with tracks
} else {
- image = SPR_FLAT_SNOWY_TILE; // flat ground
+ image = SPR_FLAT_SNOW_DESERT_TILE; // flat ground
}
}
diff --git a/src/table/clear_land.h b/src/table/clear_land.h
index 927a3abb7..86c0bb582 100644
--- a/src/table/clear_land.h
+++ b/src/table/clear_land.h
@@ -9,25 +9,25 @@
/** @file clear_land.h Tables with sprites for clear land and fences. */
-static const SpriteID _landscape_clear_sprites[8] = {
- 0xFA0,
- 0xFB3,
- 0xFB4,
- 0xFB5,
- 0xFB6,
- 0xFA0,
- 0xFB3,
- 0xFB4,
+static const SpriteID _landscape_clear_sprites_rough[8] = {
+ SPR_FLAT_ROUGH_LAND,
+ SPR_FLAT_ROUGH_LAND_1,
+ SPR_FLAT_ROUGH_LAND_2,
+ SPR_FLAT_ROUGH_LAND_3,
+ SPR_FLAT_ROUGH_LAND_4,
+ SPR_FLAT_ROUGH_LAND,
+ SPR_FLAT_ROUGH_LAND_1,
+ SPR_FLAT_ROUGH_LAND_2,
};
-static const byte _fence_mod_by_tileh[32] = {
+static const byte _fence_mod_by_tileh_sw[32] = {
0, 2, 4, 0, 0, 2, 4, 0,
0, 2, 4, 0, 0, 2, 4, 0,
0, 2, 4, 0, 0, 2, 4, 4,
0, 2, 4, 2, 0, 2, 4, 0,
};
-static const byte _fence_mod_by_tileh_2[32] = {
+static const byte _fence_mod_by_tileh_se[32] = {
1, 1, 5, 5, 3, 3, 1, 1,
1, 1, 5, 5, 3, 3, 1, 1,
1, 1, 5, 5, 3, 3, 1, 5,
@@ -35,37 +35,30 @@ static const byte _fence_mod_by_tileh_2[32] = {
};
-static const SpriteID _clear_land_fence_sprites_1[7] = {
- 0xFFA,
- 0x1000,
- 0x1006,
- 0x100C,
- 0x1012,
- 0x1018,
+static const SpriteID _clear_land_fence_sprites[7] = {
+ SPR_HEDGE_BUSHES,
+ SPR_HEDGE_BUSHES_WITH_GATE,
+ SPR_HEDGE_FENCE,
+ SPR_HEDGE_BLOOMBUSH_YELLOW,
+ SPR_HEDGE_BLOOMBUSH_RED,
+ SPR_HEDGE_STONE,
};
-static const SpriteID _clear_land_sprites_1[16] = {
- 0x101E,
- 0x1031,
- 0x1044,
- 0x1057,
- 0x106A,
- 0x107D,
- 0x1090,
- 0x10A3,
- 0x10B6,
+static const SpriteID _clear_land_sprites_farmland[16] = {
+ SPR_FARMLAND_BARE,
+ SPR_FARMLAND_STATE_1,
+ SPR_FARMLAND_STATE_2,
+ SPR_FARMLAND_STATE_3,
+ SPR_FARMLAND_STATE_4,
+ SPR_FARMLAND_STATE_5,
+ SPR_FARMLAND_STATE_6,
+ SPR_FARMLAND_STATE_7,
+ SPR_FARMLAND_HAYPACKS,
};
-static const SpriteID _clear_land_sprites_2[8] = {
- 0x118D,
- 0x11A0,
- 0x11B3,
- 0x11C6,
-};
-
-static const SpriteID _clear_land_sprites_3[8] = {
- 0x118D,
- 0x11A0,
- 0x11B3,
- 0x11C6,
+static const SpriteID _clear_land_sprites_snow_desert[8] = {
+ SPR_FLAT_1_QUART_SNOW_DESERT_TILE,
+ SPR_FLAT_2_QUART_SNOW_DESERT_TILE,
+ SPR_FLAT_3_QUART_SNOW_DESERT_TILE,
+ SPR_FLAT_SNOW_DESERT_TILE,
};
diff --git a/src/table/sprites.h b/src/table/sprites.h
index 44d74e53a..4a1a67876 100644
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -518,22 +518,22 @@ enum Sprites {
SPR_EXCAVATION_Y = 1415,
/* Landscape sprites */
- SPR_FLAT_BARE_LAND = 3924,
- SPR_FLAT_1_THIRD_GRASS_TILE = 3943,
- SPR_FLAT_2_THIRD_GRASS_TILE = 3962,
- SPR_FLAT_GRASS_TILE = 3981,
- SPR_FLAT_ROUGH_LAND = 4000,
- SPR_FLAT_ROUGH_LAND_1 = 4019,
- SPR_FLAT_ROUGH_LAND_2 = 4020,
- SPR_FLAT_ROUGH_LAND_3 = 4021,
- SPR_FLAT_ROUGH_LAND_4 = 4022,
- SPR_FLAT_ROCKY_LAND_1 = 4023,
- SPR_FLAT_ROCKY_LAND_2 = 4042,
- SPR_FLAT_WATER_TILE = 4061,
- SPR_FLAT_1_QUART_SNOWY_TILE = 4493,
- SPR_FLAT_2_QUART_SNOWY_TILE = 4512,
- SPR_FLAT_3_QUART_SNOWY_TILE = 4531,
- SPR_FLAT_SNOWY_TILE = 4550,
+ SPR_FLAT_BARE_LAND = 3924,
+ SPR_FLAT_1_THIRD_GRASS_TILE = 3943,
+ SPR_FLAT_2_THIRD_GRASS_TILE = 3962,
+ SPR_FLAT_GRASS_TILE = 3981,
+ SPR_FLAT_ROUGH_LAND = 4000,
+ SPR_FLAT_ROUGH_LAND_1 = 4019,
+ SPR_FLAT_ROUGH_LAND_2 = 4020,
+ SPR_FLAT_ROUGH_LAND_3 = 4021,
+ SPR_FLAT_ROUGH_LAND_4 = 4022,
+ SPR_FLAT_ROCKY_LAND_1 = 4023,
+ SPR_FLAT_ROCKY_LAND_2 = 4042,
+ SPR_FLAT_WATER_TILE = 4061,
+ SPR_FLAT_1_QUART_SNOW_DESERT_TILE = 4493,
+ SPR_FLAT_2_QUART_SNOW_DESERT_TILE = 4512,
+ SPR_FLAT_3_QUART_SNOW_DESERT_TILE = 4531,
+ SPR_FLAT_SNOW_DESERT_TILE = 4550,
/* Hedge, Farmland-fence sprites */
SPR_HEDGE_BUSHES = 4090,
diff --git a/src/table/tree_land.h b/src/table/tree_land.h
index d65282c90..64757267e 100644
--- a/src/table/tree_land.h
+++ b/src/table/tree_land.h
@@ -12,13 +12,6 @@
#ifndef TREE_LAND_H
#define TREE_LAND_H
-static const SpriteID _tree_sprites_1[] = {
- SPR_FLAT_1_QUART_SNOWY_TILE,
- SPR_FLAT_2_QUART_SNOWY_TILE,
- SPR_FLAT_3_QUART_SNOWY_TILE,
- SPR_FLAT_SNOWY_TILE
-};
-
static const byte _tree_base_by_landscape[4] = {0, 12, 20, 32};
static const byte _tree_count_by_landscape[4] = {12, 8, 12, 9};
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 9a9796826..962b486ae 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -32,6 +32,7 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "table/tree_land.h"
+#include "table/clear_land.h"
/**
* List of tree placer algorithm.
@@ -446,7 +447,7 @@ static void DrawTile_Trees(TileInfo *ti)
case TREE_GROUND_SHORE: DrawShoreTile(ti->tileh); break;
case TREE_GROUND_GRASS: DrawClearLandTile(ti, GetTreeDensity(ti->tile)); break;
case TREE_GROUND_ROUGH: DrawHillyLandTile(ti); break;
- default: DrawGroundSprite(_tree_sprites_1[GetTreeDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE); break;
+ default: DrawGroundSprite(_clear_land_sprites_snow_desert[GetTreeDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE); break;
}
DrawClearLandFence(ti);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index d0430b259..c705e5a70 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -974,7 +974,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (!ice) {
DrawClearLandTile(ti, 3);
} else {
- DrawGroundSprite(SPR_FLAT_SNOWY_TILE + _tileh_to_sprite[ti->tileh], PAL_NONE);
+ DrawGroundSprite(SPR_FLAT_SNOW_DESERT_TILE + _tileh_to_sprite[ti->tileh], PAL_NONE);
}
/* draw ramp */