summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-19 06:46:41 +0000
committertron <tron@openttd.org>2005-10-19 06:46:41 +0000
commit758ae7e8f63edbcc193443963e7a8cbe7dcac675 (patch)
treeb1be08aaabd03b45d086543edd2c1e7ae8031d8e
parentcb67ee9bf50e46d194b62920775e2a5998a1318b (diff)
downloadopenttd-758ae7e8f63edbcc193443963e7a8cbe7dcac675.tar.xz
(svn r3064) Replace some numbers by sprite names
-rw-r--r--disaster_cmd.c14
-rw-r--r--industry_cmd.c2
-rw-r--r--landscape.c4
-rw-r--r--misc_gui.c3
-rw-r--r--players.c2
-rw-r--r--road_cmd.c2
-rw-r--r--table/sprites.h8
-rw-r--r--town_cmd.c2
-rw-r--r--tunnelbridge_cmd.c6
9 files changed, 25 insertions, 18 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index 842f35df8..c9cc78db2 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -17,6 +17,7 @@
#include "airport_movement.h"
#include "sound.h"
#include "variables.h"
+#include "table/sprites.h"
static void DisasterClearSquare(TileIndex tile)
{
@@ -223,9 +224,9 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
if (++v->age == 1) {
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, v);
- v->u.disaster.image_override = 0xF42;
+ v->u.disaster.image_override = SPR_BLIMP_CRASHING;
} else if (v->age == 70) {
- v->u.disaster.image_override = 0xF43;
+ v->u.disaster.image_override = SPR_BLIMP_CRASHED;
} else if (v->age <= 300) {
if (!(v->tick_counter&7)) {
uint32 r = Random();
@@ -261,7 +262,7 @@ static void DisasterTick_UFO(Vehicle *v)
uint dist;
byte z;
- v->u.disaster.image_override = (++v->tick_counter & 8) ? 0xF45 : 0xF44;
+ v->u.disaster.image_override = (++v->tick_counter & 8) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT;
if (v->current_order.station == 0) {
// fly around randomly
@@ -351,7 +352,7 @@ static void DisasterTick_2(Vehicle *v)
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.station == 1 && v->tick_counter&4) ? 0xF4F : 0;
+ (v->current_order.station == 1 && v->tick_counter&4) ? SPR_F_15_FIRING : 0;
GetNewVehiclePos(v, &gp);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -422,7 +423,7 @@ static void DisasterTick_3(Vehicle *v)
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.station == 1 && v->tick_counter&4) ? 0xF53 : 0;
+ (v->current_order.station == 1 && v->tick_counter&4) ? SPR_AH_64A_FIRING : 0;
GetNewVehiclePos(v, &gp);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -492,8 +493,7 @@ static void DisasterTick_3b(Vehicle *v)
if (++v->tick_counter & 1)
return;
- if (++v->cur_image == 0xF40 + 1)
- v->cur_image = 0xF3E;
+ if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
VehiclePositionChanged(v);
BeginVehicleMove(v);
diff --git a/industry_cmd.c b/industry_cmd.c
index 953c0fa4f..0a228343a 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -360,7 +360,7 @@ static void DrawTile_Industry(TileInfo *ti)
z = ti->z;
/* Add bricks below the industry? */
if (ti->tileh & 0xF) {
- AddSortableSpriteToDraw((ti->tileh & 0xF) + 0x3DD, ti->x, ti->y, 16, 16, 7, z);
+ AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + (ti->tileh & 0xF), ti->x, ti->y, 16, 16, 7, z);
AddChildSpriteScreen(image, 0x1F, 1);
z += 8;
} else {
diff --git a/landscape.c b/landscape.c
index c884b0b3d..8bdd289d2 100644
--- a/landscape.c
+++ b/landscape.c
@@ -215,7 +215,7 @@ void DrawFoundation(TileInfo *ti, uint f)
if (f < 15) {
// leveled foundation
- if( sprite_base < SPR_SLOPES_BASE ) sprite_base = 990; // use original slope sprites
+ if (sprite_base < SPR_SLOPES_BASE) sprite_base = SPR_FOUNDATION_BASE + 1; // use original slope sprites
AddSortableSpriteToDraw(f-1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z);
ti->z += 8;
@@ -226,7 +226,7 @@ void DrawFoundation(TileInfo *ti, uint f)
sprite_base += 14;
AddSortableSpriteToDraw(
- HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : ti->tileh + 0x3DE - 1,
+ HASBIT((1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : SPR_FOUNDATION_BASE + ti->tileh,
ti->x, ti->y, 1, 1, 1, ti->z
);
diff --git a/misc_gui.c b/misc_gui.c
index e040c96ea..e3053a23c 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1753,8 +1753,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
y=45;
for(i=0; i!=lengthof(_cheats_ui); i++,ce++) {
-
- DrawSprite((SPR_OPENTTD_BASE + ((*ce->been_used)?67:66)), x+5, y+2);
+ DrawSprite((*ce->been_used) ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, x + 5, y + 2);
if (ce->type == CE_BOOL) {
DrawFrameRect(x+20, y+1, x+30+9, y+9, (*(bool*)ce->variable) ? 6 : 4, (*(bool*)ce->variable) ? FR_LOWERED : 0);
diff --git a/players.c b/players.c
index 7169713cf..6c6ec6ae7 100644
--- a/players.c
+++ b/players.c
@@ -44,7 +44,7 @@ void DrawPlayerFace(uint32 face, int color, int x, int y)
flag |= 2;
/* draw the gradient */
- DrawSprite( (color + 0x307) << PALETTE_SPRITE_START | PALETTE_MODIFIER_COLOR | 0x36A, x, y);
+ DrawSprite((color + 0x307) << PALETTE_SPRITE_START | PALETTE_MODIFIER_COLOR | SPR_GRADIENT, x, y);
/* draw the cheeks */
DrawSprite(cheeks_table[flag&3], x, y);
diff --git a/road_cmd.c b/road_cmd.c
index 6064e2204..295c08bf1 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -822,7 +822,7 @@ void DrawRoadBits(TileInfo *ti, byte road, byte ground_type, bool snow, bool fla
if (ground_type >= 6) {
// Road works
- DrawGroundSprite(0x586 + (HASBIT(road, 4) ? 0 : 1));
+ DrawGroundSprite(HASBIT(road, 4) ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y);
return;
}
diff --git a/table/sprites.h b/table/sprites.h
index 00d92bd5c..600f29f93 100644
--- a/table/sprites.h
+++ b/table/sprites.h
@@ -57,6 +57,8 @@ enum Sprites {
SPR_PIN_UP = SPR_OPENTTD_BASE + 62, // pin icon
SPR_PIN_DOWN = SPR_OPENTTD_BASE + 63,
+ SPR_BOX_EMPTY = SPR_OPENTTD_BASE + 66,
+ SPR_BOX_CHECKED = SPR_OPENTTD_BASE + 67,
SPR_WINDOW_RESIZE = SPR_OPENTTD_BASE + 94, // resize icon
// arrow icons pointing in all 4 directions
SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 95,
@@ -78,6 +80,9 @@ enum Sprites {
/* Manager face sprites */
SPR_GRADIENT = 874, // background gradient behind manager face
+ /* is itself no foundation sprite, because tileh 0 has no foundation */
+ SPR_FOUNDATION_BASE = 989,
+
/* Shadow cell */
SPR_SHADOW_CELL = 1004,
@@ -315,6 +320,9 @@ enum Sprites {
SPR_ROAD_Y_SNOW = 1351,
SPR_ROAD_X_SNOW = 1352,
+ SPR_EXCAVATION_X = 1414,
+ SPR_EXCAVATION_Y = 1415,
+
/* Landscape sprites */
SPR_FLAT_BARE_LAND = 3924,
SPR_FLAT_1_THIRD_GRASS_TILE = 3943,
diff --git a/town_cmd.c b/town_cmd.c
index 6ee747217..ebf2e8719 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -111,7 +111,7 @@ static void DrawTile_Town(TileInfo *ti)
/* Add bricks below the house? */
if (ti->tileh) {
- AddSortableSpriteToDraw(0x3DD + ti->tileh, ti->x, ti->y, 16, 16, 7, z);
+ AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + ti->tileh, ti->x, ti->y, 16, 16, 7, z);
AddChildSpriteScreen(dcts->sprite_1, 0x1F, 1);
z += 8;
} else {
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index aa509b428..dec5e6a3c 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1126,13 +1126,13 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (!(image&1)) {
const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4));
// railway
- image = 0x3F3 + (ti->map5 & 1);
- if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
+ image = SPR_RAIL_TRACK_Y + (ti->map5 & 1);
+ if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
image += rti->total_offset;
if (ice) image += rti->snow_offset;
} else {
// road
- image = 1332 + (ti->map5 & 1);
+ image = SPR_ROAD_Y + (ti->map5 & 1);
if (ti->tileh != 0) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
if (ice) image += 19; // ice?
}