diff options
author | michi_cc <michi_cc@openttd.org> | 2012-02-15 21:23:48 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2012-02-15 21:23:48 +0000 |
commit | 9101d2e2d2d6c80506f089d6dae418a8c4b9257c (patch) | |
tree | e892a8a91ba7debe7bbad1bac5655d785c7f56b5 | |
parent | 84b3e67bb56bf6a7dfc7192f58339998e8bde81a (diff) | |
download | openttd-9101d2e2d2d6c80506f089d6dae418a8c4b9257c.tar.xz |
(svn r23952) -Feature: [NewGRF] Customisable tunnel portals for rail types (sprites by Snail).
-rw-r--r-- | bin/baseset/openttd.grf | bin | 831219 -> 852958 bytes | |||
-rw-r--r-- | bin/baseset/orig_dos.obg | 2 | ||||
-rw-r--r-- | bin/baseset/orig_dos_de.obg | 2 | ||||
-rw-r--r-- | bin/baseset/orig_win.obg | 2 | ||||
-rw-r--r-- | media/extra_grf/openttd.nfo | 1 | ||||
-rw-r--r-- | media/extra_grf/tunnel_portals.nfo | 74 | ||||
-rw-r--r-- | media/extra_grf/tunnel_portals.png | bin | 0 -> 18680 bytes | |||
-rw-r--r-- | src/newgrf.cpp | 1 | ||||
-rw-r--r-- | src/rail.h | 1 | ||||
-rw-r--r-- | src/table/sprites.h | 6 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 17 |
11 files changed, 99 insertions, 7 deletions
diff --git a/bin/baseset/openttd.grf b/bin/baseset/openttd.grf Binary files differindex 4fa97ccac..9b5c9badb 100644 --- a/bin/baseset/openttd.grf +++ b/bin/baseset/openttd.grf diff --git a/bin/baseset/orig_dos.obg b/bin/baseset/orig_dos.obg index c5a8667ba..349823dc2 100644 --- a/bin/baseset/orig_dos.obg +++ b/bin/baseset/orig_dos.obg @@ -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. diff --git a/bin/baseset/orig_dos_de.obg b/bin/baseset/orig_dos_de.obg index 3955c205d..60e3a6a17 100644 --- a/bin/baseset/orig_dos_de.obg +++ b/bin/baseset/orig_dos_de.obg @@ -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. diff --git a/bin/baseset/orig_win.obg b/bin/baseset/orig_win.obg index 744cccfc3..e377c2301 100644 --- a/bin/baseset/orig_win.obg +++ b/bin/baseset/orig_win.obg @@ -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. diff --git a/media/extra_grf/openttd.nfo b/media/extra_grf/openttd.nfo index 62cb91e35..6fdcd6cb1 100644 --- a/media/extra_grf/openttd.nfo +++ b/media/extra_grf/openttd.nfo @@ -110,3 +110,4 @@ #include "rivers/arctic.nfo" #include "rivers/tropic.nfo" #include "rivers/toyland.nfo" +#include "tunnel_portals.nfo" diff --git a/media/extra_grf/tunnel_portals.nfo b/media/extra_grf/tunnel_portals.nfo new file mode 100644 index 000000000..2622ca628 --- /dev/null +++ b/media/extra_grf/tunnel_portals.nfo @@ -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 diff --git a/media/extra_grf/tunnel_portals.png b/media/extra_grf/tunnel_portals.png Binary files differnew file mode 100644 index 000000000..00abd9c7f --- /dev/null +++ b/media/extra_grf/tunnel_portals.png diff --git a/src/newgrf.cpp b/src/newgrf.cpp index cce56ccaa..feccc2363 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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 */ diff --git a/src/rail.h b/src/rail.h index 03bc69364..eb0b46c4c 100644 --- a/src/rail.h +++ b/src/rail.h @@ -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, }; diff --git a/src/table/sprites.h b/src/table/sprites.h index 4953070b3..8320e2c52 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -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? */ diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 797aa4725..945563fb5 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -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) } } + if (railtype_overlay != 0 && !catenary) StartSpriteCombine(); + 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) EndSpriteCombine(); + 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); |