mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 23:26:34 +00:00
(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
This commit is contained in:
parent
d37639ac3e
commit
7520ef8f33
2
rail.h
2
rail.h
@ -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
|
||||
|
15
railtypes.h
15
railtypes.h
@ -10,7 +10,10 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
|
||||
/** 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_END] = {
|
||||
/** 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_END] = {
|
||||
/** 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,
|
||||
|
@ -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);
|
||||
|
@ -408,8 +408,15 @@ enum Sprites {
|
||||
|
||||
/* Sprites for tunnels and bridges */
|
||||
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 */
|
||||
|
||||
/* Wooden bridge (type 0) */
|
||||
|
@ -1,5 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
static const SpriteID _draw_tunnel_table_1[] = {
|
||||
0x93D, 0x955,
|
||||
};
|
@ -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(TileInfo *ti)
|
||||
|
||||
// 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user