(svn r3064) Replace some numbers by sprite names

This commit is contained in:
tron 2005-10-19 06:46:41 +00:00
parent cb67ee9bf5
commit 758ae7e8f6
9 changed files with 25 additions and 18 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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
);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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,

View File

@ -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 {

View File

@ -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?
}