Changeset - r2511:38fead3e8cf3
[Not reviewed]
master
1 5 0
tron - 19 years ago 2005-10-13 16:00:14
tron@openttd.org
(svn r3037) Don't deduce the sprites for tunnels and level crossings from magic numbers, but fetch them from the central rail info array. This is a preparation step for electrified rails
6 files changed with 32 insertions and 20 deletions:
0 comments (0 inline, 0 general)
rail.h
Show inline comments
 
@@ -154,6 +154,8 @@ typedef struct RailtypeInfo {
 
		SpriteID single_s;     ///< single piece of rail in the southern corner
 
		SpriteID single_e;     ///< single piece of rail in the eastern corner
 
		SpriteID single_w;     ///< single piece of rail in the western corner
 
		SpriteID crossing;     ///< level crossing, rail in X direction
 
		SpriteID tunnel;       ///< tunnel sprites base
 
	} base_sprites;
 

	
 
	/** struct containing the sprites for the rail GUI. @note only sprites referred to
railtypes.h
Show inline comments
 
@@ -10,7 +10,10 @@ const RailtypeInfo _railtypes[RAILTYPE_E
 
	/** Railway */
 
	{ /* Main Sprites */
 
		{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_Y, SPR_RAIL_SINGLE_X,
 
			SPR_RAIL_SINGLE_NORTH, SPR_RAIL_SINGLE_SOUTH, SPR_RAIL_SINGLE_EAST, SPR_RAIL_SINGLE_WEST },
 
			SPR_RAIL_SINGLE_NORTH, SPR_RAIL_SINGLE_SOUTH, SPR_RAIL_SINGLE_EAST, SPR_RAIL_SINGLE_WEST,
 
			SPR_CROSSING_OFF_X_RAIL,
 
			SPR_TUNNEL_ENTRY_REAR_RAIL
 
		},
 

	
 
		/* GUI sprites */
 
		{ 0x4E3, 0x4E4, 0x4E5, 0x4E6,
 
@@ -32,7 +35,10 @@ const RailtypeInfo _railtypes[RAILTYPE_E
 
	/** Monorail */
 
	{ /* Main Sprites */
 
		{ SPR_MONO_TRACK_Y, SPR_MONO_TRACK_N_S, SPR_MONO_TRACK_BASE, SPR_MONO_SINGLE_Y, SPR_MONO_SINGLE_X,
 
			SPR_MONO_SINGLE_NORTH, SPR_MONO_SINGLE_SOUTH, SPR_MONO_SINGLE_EAST, SPR_MONO_SINGLE_WEST },
 
			SPR_MONO_SINGLE_NORTH, SPR_MONO_SINGLE_SOUTH, SPR_MONO_SINGLE_EAST, SPR_MONO_SINGLE_WEST,
 
			SPR_CROSSING_OFF_X_MONO,
 
			SPR_TUNNEL_ENTRY_REAR_MONO
 
		},
 

	
 
		/* GUI sprites */
 
		{ 0x4E7, 0x4E8, 0x4E9, 0x4EA,
 
@@ -54,7 +60,10 @@ const RailtypeInfo _railtypes[RAILTYPE_E
 
	/** Maglev */
 
	{ /* Main sprites */
 
		{ SPR_MGLV_TRACK_Y, SPR_MGLV_TRACK_N_S, SPR_MGLV_TRACK_BASE, SPR_MGLV_SINGLE_Y, SPR_MGLV_SINGLE_X,
 
			SPR_MGLV_SINGLE_NORTH, SPR_MGLV_SINGLE_SOUTH, SPR_MGLV_SINGLE_EAST, SPR_MGLV_SINGLE_WEST },
 
			SPR_MGLV_SINGLE_NORTH, SPR_MGLV_SINGLE_SOUTH, SPR_MGLV_SINGLE_EAST, SPR_MGLV_SINGLE_WEST,
 
			SPR_CROSSING_OFF_X_MAGLEV,
 
			SPR_TUNNEL_ENTRY_REAR_MAGLEV
 
		},
 

	
 
		/* GUI sprites */
 
		{ 0x4EB, 0x4EC, 0x4EE, 0x4ED,
road_cmd.c
Show inline comments
 
@@ -850,10 +850,9 @@ static void DrawTile_Road(TileInfo *ti)
 
		int f = GetRoadFoundation(ti->tileh, ti->map5 & 0xF);
 
		if (f) DrawFoundation(ti, f);
 

	
 
		image = 0x55B;
 
		image = GetRailTypeInfo(GB(_m[ti->tile].m4, 0, 4))->base_sprites.crossing;
 

	
 
		if ( (ti->map5 & 8) != 0)
 
			image--;
 
		if (GB(ti->map5, 3, 1) == 0) image++; /* direction */
 

	
 
		if ( (ti->map5 & 4) != 0)
 
			image += 2;
 
@@ -866,7 +865,7 @@ static void DrawTile_Road(TileInfo *ti)
 
			if (m2 > 1) image += 4;
 
		}
 

	
 
		DrawGroundSprite(image + GB(_m[ti->tile].m4, 0, 4) * 12);
 
		DrawGroundSprite(image);
 

	
 
		if (_debug_pbs_level >= 1) {
 
			byte pbs = PBSTileReserved(ti->tile);
table/sprites.h
Show inline comments
 
@@ -407,8 +407,15 @@ enum Sprites {
 
	SPR_SHIPLIFT_Y_DOWN_TOP_FRONT			= SPR_CANALS_BASE + 32,
 

	
 
	/* Sprites for tunnels and bridges */
 
	SPR_TUNNEL_ENTRY_REAR_RAIL	= 2365,
 
	SPR_TUNNEL_ENTRY_REAR_ROAD	= 2389,
 
	SPR_TUNNEL_ENTRY_REAR_RAIL   = 2365,
 
	SPR_TUNNEL_ENTRY_REAR_MONO   = 2373,
 
	SPR_TUNNEL_ENTRY_REAR_MAGLEV = 2381,
 
	SPR_TUNNEL_ENTRY_REAR_ROAD   = 2389,
 

	
 
	/* Level crossings */
 
	SPR_CROSSING_OFF_X_RAIL   = 1370,
 
	SPR_CROSSING_OFF_X_MONO   = 1382,
 
	SPR_CROSSING_OFF_X_MAGLEV = 1394,
 

	
 
		/* bridge type sprites */
 

	
table/tunnel_land.h
Show inline comments
 
deleted file
tunnelbridge_cmd.c
Show inline comments
 
@@ -24,7 +24,6 @@
 
#include "bridge.h"
 

	
 
#include "table/bridge_land.h"
 
#include "table/tunnel_land.h"
 

	
 
extern const byte _track_sloped_sprites[14];
 
extern const SpriteID _water_shore_sprites[15];
 
@@ -1040,13 +1039,14 @@ static void DrawTile_TunnelBridge(TileIn
 

	
 
	// draw tunnel?
 
	if ((ti->map5 & 0xF0) == 0) {
 
		/* railway type */
 
		image = GB(_m[ti->tile].m3, 0, 4) * 8;
 
		if (GB(ti->map5, 2, 2) == 0) { /* Rail tunnel? */
 
			image = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4))->base_sprites.tunnel;
 
		} else {
 
			image = SPR_TUNNEL_ENTRY_REAR_ROAD;
 
		}
 

	
 
		if (ice)
 
			image += 32;
 
		if (ice) image += 32;
 

	
 
		image += _draw_tunnel_table_1[GB(ti->map5, 2, 2)];
 
		image += GB(ti->map5, 0, 2) * 2;
 
		DrawGroundSprite(image);
 

	
0 comments (0 inline, 0 general)