mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
Add: Slope-aware and roadtype-specific one-way sprites. (#10282)
This commit is contained in:
parent
7a18631291
commit
6caed5f15e
Binary file not shown.
@ -4,10 +4,24 @@
|
||||
// See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
-1 * 0 0C "One way road graphics"
|
||||
-1 * 3 05 09 06
|
||||
-1 sprites/oneway.png 8bpp 34 8 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 66 8 24 16 -12 -8 normal
|
||||
-1 * 3 05 09 12
|
||||
-1 sprites/oneway.png 8bpp 34 8 24 16 -10 -9 normal
|
||||
-1 sprites/oneway.png 8bpp 66 8 24 16 -13 -7 normal
|
||||
-1 sprites/oneway.png 8bpp 98 8 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 130 8 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 162 8 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 194 8 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 130 8 24 16 -15 -10 normal
|
||||
-1 sprites/oneway.png 8bpp 162 8 24 16 -12 -9 normal
|
||||
-1 sprites/oneway.png 8bpp 194 8 24 16 -11 -8 normal
|
||||
|
||||
-1 sprites/oneway.png 8bpp 34 40 24 16 -13 -10 normal
|
||||
-1 sprites/oneway.png 8bpp 66 40 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 98 40 24 16 -12 -9 normal
|
||||
-1 sprites/oneway.png 8bpp 130 40 24 16 -11 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 162 40 24 16 -9 -10 normal
|
||||
-1 sprites/oneway.png 8bpp 194 40 24 16 -10 -9 normal
|
||||
|
||||
-1 sprites/oneway.png 8bpp 34 72 24 16 -8 -11 normal
|
||||
-1 sprites/oneway.png 8bpp 66 72 24 16 -11 -5 normal
|
||||
-1 sprites/oneway.png 8bpp 98 72 24 16 -12 -8 normal
|
||||
-1 sprites/oneway.png 8bpp 130 72 24 16 -12 -5 normal
|
||||
-1 sprites/oneway.png 8bpp 162 72 24 16 -14 -10 normal
|
||||
-1 sprites/oneway.png 8bpp 194 72 24 16 -12 -8 normal
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 7.7 KiB |
@ -6274,9 +6274,17 @@ static void GraphicsNew(ByteReader *buf)
|
||||
if (offset <= depot_no_track_offset && offset + num > depot_no_track_offset) _loaded_newgrf_features.tram = TRAMWAY_REPLACE_DEPOT_NO_TRACK;
|
||||
}
|
||||
|
||||
/* If the baseset or grf only provides sprites for flat tiles (pre #10282), duplicate those for use on slopes. */
|
||||
bool dup_oneway_sprites = ((type == 0x09) && (offset + num <= SPR_ONEWAY_SLOPE_N_OFFSET));
|
||||
|
||||
for (; num > 0; num--) {
|
||||
_cur.nfo_line++;
|
||||
LoadNextSprite(replace == 0 ? _cur.spriteid++ : replace++, *_cur.file, _cur.nfo_line);
|
||||
int load_index = (replace == 0 ? _cur.spriteid++ : replace++);
|
||||
LoadNextSprite(load_index, *_cur.file, _cur.nfo_line);
|
||||
if (dup_oneway_sprites) {
|
||||
DupSprite(load_index, load_index + SPR_ONEWAY_SLOPE_N_OFFSET);
|
||||
DupSprite(load_index, load_index + SPR_ONEWAY_SLOPE_S_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
_cur.skip_sprites = skip_num;
|
||||
|
@ -66,6 +66,7 @@ enum RoadTypeSpriteGroup {
|
||||
ROTSG_DEPOT, ///< Optional: Depot images
|
||||
ROTSG_reserved3, ///< Placeholder, if we add road fences (for highways).
|
||||
ROTSG_ROADSTOP, ///< Required: Drive-in stop surface
|
||||
ROTSG_ONEWAY, ///< Optional: One-way indicator images
|
||||
ROTSG_END,
|
||||
};
|
||||
|
||||
|
@ -1606,7 +1606,17 @@ static void DrawRoadBits(TileInfo *ti)
|
||||
if (road_rti != nullptr) {
|
||||
DisallowedRoadDirections drd = GetDisallowedRoadDirections(ti->tile);
|
||||
if (drd != DRD_NONE) {
|
||||
DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialPixelZ(8, 8, ti->tileh));
|
||||
SpriteID oneway = GetCustomRoadSprite(road_rti, ti->tile, ROTSG_ONEWAY);
|
||||
|
||||
if (oneway == 0) oneway = SPR_ONEWAY_BASE;
|
||||
|
||||
if ((ti->tileh == SLOPE_NE) || (ti->tileh == SLOPE_NW)) {
|
||||
oneway += SPR_ONEWAY_SLOPE_N_OFFSET;
|
||||
} else if ((ti->tileh == SLOPE_SE) || (ti->tileh == SLOPE_SW)) {
|
||||
oneway += SPR_ONEWAY_SLOPE_S_OFFSET;
|
||||
}
|
||||
|
||||
DrawGroundSpriteAt(oneway + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialPixelZ(8, 8, ti->tileh));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,9 @@ static const uint16 TRAMWAY_SPRITE_COUNT = 119;
|
||||
|
||||
/** One way road sprites */
|
||||
static const SpriteID SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + TRAMWAY_SPRITE_COUNT;
|
||||
static const uint16 ONEWAY_SPRITE_COUNT = 6;
|
||||
static const SpriteID SPR_ONEWAY_SLOPE_N_OFFSET = 6;
|
||||
static const SpriteID SPR_ONEWAY_SLOPE_S_OFFSET = 12;
|
||||
static const uint16 ONEWAY_SPRITE_COUNT = 18;
|
||||
|
||||
/** Tunnel sprites with grass only for custom railtype tunnel. */
|
||||
static const SpriteID SPR_RAILTYPE_TUNNEL_BASE = SPR_ONEWAY_BASE + ONEWAY_SPRITE_COUNT;
|
||||
|
Loading…
Reference in New Issue
Block a user