(svn r23952) -Feature: [NewGRF] Customisable tunnel portals for rail types (sprites by Snail).

This commit is contained in:
michi_cc 2012-02-15 21:23:48 +00:00
parent 84b3e67bb5
commit 9101d2e2d2
11 changed files with 100 additions and 8 deletions

Binary file not shown.

View File

@ -55,7 +55,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
OPENTTD.GRF = 6d77e27c7d1f318c07c3656d1649c87e
OPENTTD.GRF = 8bcc7d7b6c7fdfba27af872743e9efd6
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@ -55,7 +55,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
OPENTTD.GRF = 6d77e27c7d1f318c07c3656d1649c87e
OPENTTD.GRF = 8bcc7d7b6c7fdfba27af872743e9efd6
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@ -55,7 +55,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
OPENTTD.GRF = 6d77e27c7d1f318c07c3656d1649c87e
OPENTTD.GRF = 8bcc7d7b6c7fdfba27af872743e9efd6
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@ -110,3 +110,4 @@
#include "rivers/arctic.nfo"
#include "rivers/tropic.nfo"
#include "rivers/toyland.nfo"
#include "tunnel_portals.nfo"

View File

@ -0,0 +1,74 @@
//
// $Id$
//
// This file is part of OpenTTD.
// OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
// OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// 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 * 63 0C "Tunnel portal overlays for railtypes by Snail (Jacopo Coletto)"
// Tropical sprites.
-1 * 6 07 83 01 \7! 02 11
-1 * 3 05 17 10
-1 sprites/tunnel_portals.png 5 88 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 88 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 88 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 88 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 88 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 88 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 88 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 88 01 37 40 -31 -38
-1 sprites/tunnel_portals.png 5 170 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 170 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 170 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 170 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 170 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 170 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 170 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 170 01 37 40 -31 -38
// Temperate grass + snow sprites.
-1 * 6 07 83 01 \7= 02 25
-1 * 3 05 17 10
-1 sprites/tunnel_portals.png 5 6 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 6 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 6 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 6 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 6 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 6 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 6 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 6 01 37 40 -31 -38
-1 sprites/tunnel_portals.png 5 129 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 129 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 129 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 129 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 129 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 129 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 129 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 129 01 37 40 -31 -38
// Arctic grass sprites.
-1 * 6 07 83 01 \7! 01 09
-1 * 4 05 97 08 00
-1 sprites/tunnel_portals.png 5 47 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 47 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 47 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 47 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 47 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 47 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 47 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 47 01 37 40 -31 -38
// Toyland sprites.
-1 * 6 07 83 01 \7! 03 09
-1 * 4 05 97 08 00
-1 sprites/tunnel_portals.png 5 211 01 33 35 -31 -2
-1 sprites/tunnel_portals.png 43 211 01 37 40 -7 -38
-1 sprites/tunnel_portals.png 86 211 01 21 35 -31 0
-1 sprites/tunnel_portals.png 124 211 01 22 40 -7 -29
-1 sprites/tunnel_portals.png 168 211 01 21 35 -2 0
-1 sprites/tunnel_portals.png 206 211 01 22 40 -31 -29
-1 sprites/tunnel_portals.png 249 211 01 33 35 -2 -2
-1 sprites/tunnel_portals.png 287 211 01 37 40 -31 -38

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -5458,6 +5458,7 @@ static const Action5Type _action5_types[] = {
/* 0x14 */ { A5BLOCK_ALLOW_OFFSET, SPR_FLAGS_BASE, 1, FLAGS_SPRITE_COUNT, "Flag graphics" },
/* 0x15 */ { A5BLOCK_ALLOW_OFFSET, SPR_OPENTTD_BASE, 1, OPENTTD_SPRITE_COUNT, "OpenTTD GUI graphics" },
/* 0x16 */ { A5BLOCK_ALLOW_OFFSET, SPR_AIRPORT_PREVIEW_BASE, 1, SPR_AIRPORT_PREVIEW_COUNT, "Airport preview graphics" },
/* 0x17 */ { A5BLOCK_ALLOW_OFFSET, SPR_RAILTYPE_TUNNEL_BASE, 1, RAILTYPE_TUNNEL_BASE_COUNT, "Railtype tunnel base" },
};
/* Action 0x05 */

View File

@ -46,6 +46,7 @@ enum RailTypeSpriteGroup {
RTSG_CROSSING, ///< Level crossing overlay images
RTSG_DEPOT, ///< Depot images
RTSG_FENCES, ///< Fence images
RTSG_TUNNEL_PORTAL, ///< Tunnel portal overlay
RTSG_END,
};

View File

@ -270,8 +270,12 @@ static const uint16 ONEWAY_SPRITE_COUNT = 6;
static const SpriteID SPR_FLAGS_BASE = SPR_ONEWAY_BASE + ONEWAY_SPRITE_COUNT;
static const uint16 FLAGS_SPRITE_COUNT = 36;
/** Tunnel sprites with grass only for custom railtype tunnel. */
static const SpriteID SPR_RAILTYPE_TUNNEL_BASE = SPR_FLAGS_BASE + FLAGS_SPRITE_COUNT;
static const uint16 RAILTYPE_TUNNEL_BASE_COUNT = 16;
/* Not really a sprite, but an empty bounding box. Used to construct bounding boxes that help sorting the sprites, but do not have a sprite associated. */
static const SpriteID SPR_EMPTY_BOUNDING_BOX = SPR_FLAGS_BASE + FLAGS_SPRITE_COUNT;
static const SpriteID SPR_EMPTY_BOUNDING_BOX = SPR_RAILTYPE_TUNNEL_BASE + RAILTYPE_TUNNEL_BASE_COUNT;
static const uint16 EMPTY_BOUNDING_BOX_SPRITE_COUNT = 1;
/* From where can we start putting NewGRFs? */

View File

@ -1115,13 +1115,20 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
bool catenary = false;
SpriteID image;
SpriteID railtype_overlay = 0;
if (transport_type == TRANSPORT_RAIL) {
image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.tunnel;
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
image = rti->base_sprites.tunnel;
if (rti->UsesOverlay()) {
/* Check if the railtype has custom tunnel portals. */
railtype_overlay = GetCustomRailSprite(rti, ti->tile, RTSG_TUNNEL_PORTAL);
if (railtype_overlay != 0) image = SPR_RAILTYPE_TUNNEL_BASE; // Draw blank grass tunnel base.
}
} else {
image = SPR_TUNNEL_ENTRY_REAR_ROAD;
}
if (HasTunnelBridgeSnowOrDesert(ti->tile)) image += 32;
if (HasTunnelBridgeSnowOrDesert(ti->tile)) image += railtype_overlay != 0 ? 8 : 32;
image += tunnelbridge_direction * 2;
DrawGroundSprite(image, PAL_NONE);
@ -1164,9 +1171,13 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
}
}
AddSortableSpriteToDraw(image + 1, PAL_NONE, ti->x + TILE_SIZE - 1, ti->y + TILE_SIZE - 1, BB_data[0], BB_data[1], TILE_HEIGHT, ti->z, false, BB_data[2], BB_data[3], BB_Z_SEPARATOR);
if (railtype_overlay != 0 && !catenary) StartSpriteCombine();
if (catenary) EndSpriteCombine();
AddSortableSpriteToDraw(image + 1, PAL_NONE, ti->x + TILE_SIZE - 1, ti->y + TILE_SIZE - 1, BB_data[0], BB_data[1], TILE_HEIGHT, ti->z, false, BB_data[2], BB_data[3], BB_Z_SEPARATOR);
/* Draw railtype tunnel portal overlay if defined. */
if (railtype_overlay != 0) AddSortableSpriteToDraw(railtype_overlay + tunnelbridge_direction, PAL_NONE, ti->x + TILE_SIZE - 1, ti->y + TILE_SIZE - 1, BB_data[0], BB_data[1], TILE_HEIGHT, ti->z, false, BB_data[2], BB_data[3], BB_Z_SEPARATOR);
if (catenary || railtype_overlay != 0) EndSpriteCombine();
/* Add helper BB for sprite sorting that separates the tunnel from things beside of it. */
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, ti->x, ti->y, BB_data[6], BB_data[7], TILE_HEIGHT, ti->z);