(svn r3064) Replace some numbers by sprite names
authortron
Wed, 19 Oct 2005 06:46:41 +0000
changeset 2535 ed8b9592dc64
parent 2534 2f12f7374039
child 2536 8c4e298f4886
(svn r3064) Replace some numbers by sprite names
disaster_cmd.c
industry_cmd.c
landscape.c
misc_gui.c
players.c
road_cmd.c
table/sprites.h
town_cmd.c
tunnelbridge_cmd.c
--- a/disaster_cmd.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/disaster_cmd.c	Wed Oct 19 06:46:41 2005 +0000
@@ -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 @@
 	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 @@
 	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 @@
 
 	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 @@
 
 	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 @@
 	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);
--- a/industry_cmd.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/industry_cmd.c	Wed Oct 19 06:46:41 2005 +0000
@@ -360,7 +360,7 @@
 	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 {
--- a/landscape.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/landscape.c	Wed Oct 19 06:46:41 2005 +0000
@@ -215,7 +215,7 @@
 
 	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 @@
 		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
 		);
 
--- a/misc_gui.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/misc_gui.c	Wed Oct 19 06:46:41 2005 +0000
@@ -1753,8 +1753,7 @@
 		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);
--- a/players.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/players.c	Wed Oct 19 06:46:41 2005 +0000
@@ -44,7 +44,7 @@
 		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);
--- a/road_cmd.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/road_cmd.c	Wed Oct 19 06:46:41 2005 +0000
@@ -822,7 +822,7 @@
 
 	if (ground_type >= 6) {
 		// Road works
-		DrawGroundSprite(0x586 + (HASBIT(road, 4) ? 0 : 1));
+		DrawGroundSprite(HASBIT(road, 4) ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y);
 		return;
 	}
 
--- a/table/sprites.h	Wed Oct 19 06:17:11 2005 +0000
+++ b/table/sprites.h	Wed Oct 19 06:46:41 2005 +0000
@@ -57,6 +57,8 @@
 
 	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 @@
 	/* 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 @@
 	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,
--- a/town_cmd.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/town_cmd.c	Wed Oct 19 06:46:41 2005 +0000
@@ -111,7 +111,7 @@
 
 	/* 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 {
--- a/tunnelbridge_cmd.c	Wed Oct 19 06:17:11 2005 +0000
+++ b/tunnelbridge_cmd.c	Wed Oct 19 06:46:41 2005 +0000
@@ -1126,13 +1126,13 @@
 				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?
 				}