(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
authortron
Sat, 15 Oct 2005 11:06:54 +0000
changeset 2517 6e3832ddd0f6
parent 2516 4659ceee4dcb
child 2518 bec1f669b1ff
(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
aircraft_cmd.c
aircraft_gui.c
clear_cmd.c
dummy_land.c
roadveh_gui.c
ship_gui.c
station_cmd.c
table/sprites.h
train_gui.c
tunnelbridge_cmd.c
unmovable_cmd.c
water_cmd.c
window.c
--- a/aircraft_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/aircraft_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -17,6 +17,7 @@
 #include "player.h"
 #include "airport.h"
 #include "vehicle_gui.h"
+#include "table/sprites.h"
 
 static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport);
 static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport);
@@ -116,7 +117,7 @@
 	DrawSprite(sprite | image_ormod, x, y);
 
 	if ((AircraftVehInfo(engine)->subtype & 1) == 0) {
-		DrawSprite(0xF3D, x, y-5);
+		DrawSprite(SPR_ROTOR_STOPPED, x, y - 5);
 	}
 }
 
@@ -305,7 +306,7 @@
 			w->z_height = 1;
 			w->vehstatus = VS_HIDDEN | VS_UNCLICKABLE;
 			w->subtype = 6;
-			w->cur_image = 0xF3D;
+			w->cur_image = SPR_ROTOR_STOPPED;
 			VehiclePositionChanged(w);
 		}
 
@@ -672,7 +673,7 @@
 	if (v->current_order.type == OT_LOADING || (v->vehstatus & VS_STOPPED)) {
 		if (u->cur_speed != 0) {
 			u->cur_speed++;
-			if (u->cur_speed >= 0x80 && u->cur_image == 0xF40) {
+			if (u->cur_speed >= 0x80 && u->cur_image == SPR_ROTOR_MOVING_3) {
 				u->cur_speed = 0;
 			}
 		}
@@ -688,14 +689,13 @@
 	spd = u->cur_speed >> 4;
 
 	if (spd == 0) {
-		img = 0xF3D;
+		img = SPR_ROTOR_STOPPED;
 		if (u->cur_image == img)
 			return;
 	} else if (tick >= spd) {
 		u->tick_counter = 0;
 		img = u->cur_image + 1;
-		if (img > 0xF40)
-			img = 0xF3E;
+		if (img > SPR_ROTOR_MOVING_3) img = SPR_ROTOR_MOVING_1;
 	} else
 		return;
 
--- a/aircraft_gui.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/aircraft_gui.c	Sat Oct 15 11:06:54 2005 +0000
@@ -69,7 +69,7 @@
 		ormod = PALETTE_CRASH;
 	DrawSprite(image | ormod, x+25, y+10);
 	if (v->subtype == 0)
-		DrawSprite(0xF3D, x+25, y+5);
+		DrawSprite(SPR_ROTOR_STOPPED, x + 25, y + 5);
 	if (v->index == selection) {
 		DrawFrameRect(x-1, y-1, x+58, y+21, 0xF, FR_BORDERONLY);
 	}
@@ -565,7 +565,7 @@
 		}
 
 		/* draw the flag plus orders */
-		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
+		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
 		DrawWindowViewport(w);
 	} break;
@@ -690,7 +690,7 @@
 			SetDParam(0, v->unitnumber);
 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
 
-			DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y+12);
+			DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x, y + 12);
 
 			if ((x+=74) == 2 + 74 * w->hscroll.cap) {
 				x = 2;
--- a/clear_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/clear_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -10,6 +10,7 @@
 #include "viewport.h"
 #include "command.h"
 #include "variables.h"
+#include "table/sprites.h"
 
 typedef struct TerraformerHeightMod {
 	TileIndex tile;
@@ -485,13 +486,13 @@
 
 void DrawClearLandTile(const TileInfo *ti, byte set)
 {
-	DrawGroundSprite(0xF54 + _tileh_to_sprite[ti->tileh] + set * 19);
+	DrawGroundSprite(SPR_FLAT_BARE_LAND + _tileh_to_sprite[ti->tileh] + set * 19);
 }
 
 void DrawHillyLandTile(const TileInfo *ti)
 {
 	if (ti->tileh != 0) {
-		DrawGroundSprite(0xFA0 + _tileh_to_sprite[ti->tileh]);
+		DrawGroundSprite(SPR_FLAT_ROUGH_LAND + _tileh_to_sprite[ti->tileh]);
 	} else {
 		DrawGroundSprite(_landscape_clear_sprites[GB(ti->x ^ ti->y, 4, 3)]);
 	}
@@ -529,7 +530,7 @@
 		break;
 
 	case 2:
-		DrawGroundSprite(0xFB7 + _tileh_to_sprite[ti->tileh]);
+		DrawGroundSprite(SPR_FLAT_ROCKY_LAND_1 + _tileh_to_sprite[ti->tileh]);
 		break;
 
 	case 3:
--- a/dummy_land.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/dummy_land.c	Sat Oct 15 11:06:54 2005 +0000
@@ -6,10 +6,11 @@
 #include "functions.h"
 #include "viewport.h"
 #include "command.h"
+#include "table/sprites.h"
 
 static void DrawTile_Dummy(TileInfo *ti)
 {
-	DrawGroundSpriteAt(0x3EC, ti->x, ti->y, ti->z);
+	DrawGroundSpriteAt(SPR_SHADOW_CELL, ti->x, ti->y, ti->z);
 }
 
 
--- a/roadveh_gui.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/roadveh_gui.c	Sat Oct 15 11:06:54 2005 +0000
@@ -284,7 +284,7 @@
 		}
 
 		/* draw the flag plus orders */
-		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
+		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
 		DrawWindowViewport(w);
 	} break;
@@ -587,7 +587,7 @@
 			SetDParam(0, v->unitnumber);
 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
 
-			DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x + 16, y);
+			DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 16, y);
 
 			if ((x+=56) == 2 + 56 * w->hscroll.cap) {
 				x = 2;
--- a/ship_gui.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/ship_gui.c	Sat Oct 15 11:06:54 2005 +0000
@@ -523,7 +523,7 @@
 			}
 
 		/* draw the flag plus orders */
-		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
+		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
 		DrawWindowViewport(w);
 	} break;
@@ -663,7 +663,7 @@
 			SetDParam(0, v->unitnumber);
 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
 
-			DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y + 9);
+			DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x, y + 9);
 
 			if ((x+=90) == 2 + 90 * w->hscroll.cap) {
 				x = 2;
--- a/station_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/station_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -1359,7 +1359,7 @@
 	/* This is what gets subscribed of dtss->image in newgrf.c,
 	 * so it's probably kinda "default offset". Try to use it as
 	 * emergency measure. */
-	return 0x42D;
+	return SPR_RAIL_PLATFORM_Y_FRONT;
 }
 
 int GetCustomStationsCount(StationClass sclass)
--- a/table/sprites.h	Sat Oct 15 07:40:22 2005 +0000
+++ b/table/sprites.h	Sat Oct 15 11:06:54 2005 +0000
@@ -119,7 +119,7 @@
 	SPR_HUGEHQ_WEST_BUILD				= 2630,
 	SPR_HUGEHQ_SOUTH						= 2631,
 	SPR_STATUE_GROUND						= 1420,
-	SPR_STATUE_COMPANY					=	2623,
+	SPR_STATUE_COMPANY          = 2632,
 	SPR_BOUGHT_LAND							= 4790,
 
 	/* sprites for rail and rail stations*/
--- a/train_gui.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/train_gui.c	Sat Oct 15 11:06:54 2005 +0000
@@ -442,7 +442,7 @@
 			DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0);	//Draw the counter
 
 			/* Draw the pretty flag */
-			DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
+			DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 15, y);
 
 			y += 14;
 		}
@@ -984,7 +984,7 @@
 		}
 
 		/* draw the flag plus orders */
-		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
+		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1);
 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
 		DrawWindowViewport(w);
 	}	break;
--- a/tunnelbridge_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/tunnelbridge_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -1074,7 +1074,7 @@
 				if (f) DrawFoundation(ti, f);
 
 				// default sloped sprites..
-				if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
+				if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
 			}
 
 			// bridge ending.
@@ -1089,7 +1089,7 @@
 			if (!ice) {
 				DrawClearLandTile(ti, 3);
 			} else {
-				DrawGroundSprite(0x11C6 + _tileh_to_sprite[ti->tileh]);
+				DrawGroundSprite(SPR_FLAT_SNOWY_TILE + _tileh_to_sprite[ti->tileh]);
 			}
 
 			// draw ramp
--- a/unmovable_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/unmovable_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -117,10 +117,10 @@
 		if (ti->map5 == 2) {
 
 			// statue
-			DrawGroundSprite(0x58C);
+			DrawGroundSprite(SPR_STATUE_GROUND);
 
 			image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
-			image += 0x8A48;
+			image += PALETTE_MODIFIER_COLOR | SPR_STATUE_COMPANY;
 			if (_display_opt & DO_TRANS_BUILDINGS)
 				MAKE_TRANSPARENT(image);
 			AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
@@ -130,7 +130,7 @@
 			DrawClearLandTile(ti, 0);
 
 			AddSortableSpriteToDraw(
-				PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + 0x92B6,
+				PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + PALETTE_MODIFIER_COLOR + SPR_BOUGHT_LAND,
 				ti->x+8, ti->y+8,
 				1, 1,
 				10,
--- a/water_cmd.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/water_cmd.c	Sat Oct 15 11:06:54 2005 +0000
@@ -17,7 +17,21 @@
 #include "vehicle_gui.h"
 
 const SpriteID _water_shore_sprites[15] = {
-	0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
+	0,
+	SPR_SHORE_TILEH_1,
+	SPR_SHORE_TILEH_2,
+	SPR_SHORE_TILEH_3,
+	SPR_SHORE_TILEH_4,
+	0,
+	SPR_SHORE_TILEH_6,
+	0,
+	SPR_SHORE_TILEH_8,
+	SPR_SHORE_TILEH_9,
+	0,
+	0,
+	SPR_SHORE_TILEH_12,
+	0,
+	0
 };
 
 
@@ -411,7 +425,7 @@
 {
 	// draw water tile
 	if (ti->map5 == 0) {
-		DrawGroundSprite(0xFDD);
+		DrawGroundSprite(SPR_FLAT_WATER_TILE);
 		if (ti->z != 0) DrawCanalWater(ti->tile);
 		return;
 	}
--- a/window.c	Sat Oct 15 07:40:22 2005 +0000
+++ b/window.c	Sat Oct 15 11:06:54 2005 +0000
@@ -11,6 +11,7 @@
 #include "viewport.h"
 #include "console.h"
 #include "variables.h"
+#include "table/sprites.h"
 
 // delta between mouse cursor and upper left corner of dragged window
 static Point _drag_delta;
@@ -1430,7 +1431,8 @@
 			DEBUG(misc, 2) ("cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
 			if (_thd.place_mode != 0 &&
 					// query button and place sign button work in pause mode
-					!(_cursor.sprite == 0x2CF || _cursor.sprite == 0x2D2) &&
+					_cursor.sprite != SPR_CURSOR_QUERY &&
+					_cursor.sprite != SPR_CURSOR_SIGN &&
 					_pause != 0 &&
 					!_cheats.build_in_pause.value)
 						return;