From 758ae7e8f63edbcc193443963e7a8cbe7dcac675 Mon Sep 17 00:00:00 2001 From: tron Date: Wed, 19 Oct 2005 06:46:41 +0000 Subject: [PATCH] (svn r3064) Replace some numbers by sprite names --- disaster_cmd.c | 14 +++++++------- industry_cmd.c | 2 +- landscape.c | 4 ++-- misc_gui.c | 3 +-- players.c | 2 +- road_cmd.c | 2 +- table/sprites.h | 8 ++++++++ town_cmd.c | 2 +- tunnelbridge_cmd.c | 6 +++--- 9 files changed, 25 insertions(+), 18 deletions(-) diff --git a/disaster_cmd.c b/disaster_cmd.c index 842f35df83..c9cc78db25 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 953c0fa4f6..0a228343ac 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 c884b0b3df..8bdd289d22 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 e040c96ea6..e3053a23c6 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 7169713cf0..6c6ec6ae73 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 6064e2204e..295c08bf10 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 00d92bd5c4..600f29f930 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 6ee7472174..ebf2e87192 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 aa509b4283..dec5e6a3c0 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? }