From a48dbd7c517e494cfff754caad96d5b2ea2db9e8 Mon Sep 17 00:00:00 2001 From: yexo Date: Thu, 5 Aug 2010 12:03:58 +0000 Subject: (svn r20370) -Add: [NewGRF] new action 5 block to add airport preview sprites --- src/newgrf.cpp | 1 + src/table/airport_defaults.h | 34 +++++++++++++++++----------------- src/table/sprites.h | 15 ++++++++++++++- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 167aac5e6..94a2e56b8 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4333,6 +4333,7 @@ static void GraphicsNew(ByteReader *buf) /* 0x13 */ { A5BLOCK_FIXED, SPR_AUTORAIL_BASE, 55, AUTORAIL_SPRITE_COUNT, "Autorail graphics" }, /* 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" }, }; uint8 type = buf->ReadByte(); diff --git a/src/table/airport_defaults.h b/src/table/airport_defaults.h index c9cb88c16..13e888dd0 100644 --- a/src/table/airport_defaults.h +++ b/src/table/airport_defaults.h @@ -381,36 +381,36 @@ static Direction _default_airports_rotation[] = { #undef MKEND /** General AirportSpec definition. */ -#define AS_GENERIC(fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, enabled) \ - {fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, name, ttdpatch_type, class_id, 0, enabled, {AT_INVALID, 0, NULL, NULL, AT_INVALID}} +#define AS_GENERIC(fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, preview, enabled) \ + {fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, name, ttdpatch_type, class_id, preview, enabled, {AT_INVALID, 0, NULL, NULL, AT_INVALID}} /** AirportSpec definition for airports without any depot. */ -#define AS_ND(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name) \ +#define AS_ND(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name, preview) \ AS_GENERIC(&_airportfta_##ap_name, _tile_table_##ap_name, _default_airports_rotation, lengthof(_tile_table_##ap_name), NULL, 0, \ - size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, true) + size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, preview, true) /** AirportSpec definition for airports with at least one depot. */ -#define AS(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name) \ +#define AS(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name, preview) \ AS_GENERIC(&_airportfta_##ap_name, _tile_table_##ap_name, _default_airports_rotation, lengthof(_tile_table_##ap_name), _airport_depots_##ap_name, lengthof(_airport_depots_##ap_name), \ - size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, true) + size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, preview, true) /* The helidepot and helistation have ATP_TTDP_SMALL because they are at ground level */ extern const AirportSpec _origin_airport_specs[] = { - AS(country, 4, 3, 0, 1959, 4, 3, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_SMALL), - AS(city, 6, 6, 1955, MAX_YEAR, 5, 5, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_CITY), - AS_ND(heliport, 1, 1, 1963, MAX_YEAR, 4, 1, ATP_TTDP_HELIPORT, APC_HELIPORT, STR_AIRPORT_HELIPORT), - AS(metropolitan, 6, 6, 1980, MAX_YEAR, 6, 8, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_METRO), - AS(international, 7, 7, 1990, MAX_YEAR, 8, 17, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERNATIONAL), - AS(commuter, 5, 4, 1983, MAX_YEAR, 4, 4, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_COMMUTER), - AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT), - AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL), - AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION), - AS_GENERIC(&_airportfta_oilrig, NULL, _default_airports_rotation, 0, NULL, 0, 1, 1, 0, 4, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, false), + AS(country, 4, 3, 0, 1959, 4, 3, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_SMALL, SPR_AIRPORT_PREVIEW_SMALL), + AS(city, 6, 6, 1955, MAX_YEAR, 5, 5, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_CITY, SPR_AIRPORT_PREVIEW_LARGE), + AS_ND(heliport, 1, 1, 1963, MAX_YEAR, 4, 1, ATP_TTDP_HELIPORT, APC_HELIPORT, STR_AIRPORT_HELIPORT, SPR_AIRPORT_PREVIEW_HELIPORT), + AS(metropolitan, 6, 6, 1980, MAX_YEAR, 6, 8, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_METRO, SPR_AIRPORT_PREVIEW_METROPOLITAN), + AS(international, 7, 7, 1990, MAX_YEAR, 8, 17, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERNATIONAL, SPR_AIRPORT_PREVIEW_INTERNATIONAL), + AS(commuter, 5, 4, 1983, MAX_YEAR, 4, 4, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_COMMUTER, SPR_AIRPORT_PREVIEW_COMMUTER), + AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT, SPR_AIRPORT_PREVIEW_HELIDEPOT), + AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL, SPR_AIRPORT_PREVIEW_INTERCONTINENTAL), + AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION, SPR_AIRPORT_PREVIEW_HELISTATION), + AS_GENERIC(&_airportfta_oilrig, NULL, _default_airports_rotation, 0, NULL, 0, 1, 1, 0, 4, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, 0, false), }; assert_compile(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs)); -AirportSpec AirportSpec::dummy = AS_GENERIC(&_airportfta_dummy, NULL, _default_airports_rotation, 0, NULL, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, false); +AirportSpec AirportSpec::dummy = AS_GENERIC(&_airportfta_dummy, NULL, _default_airports_rotation, 0, NULL, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, 0, false); #undef AS #undef AS_ND diff --git a/src/table/sprites.h b/src/table/sprites.h index 636b8ebaa..78eb0080c 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -209,7 +209,20 @@ static const SpriteID SPR_GRASS_RIGHT = SPR_AIRPORTX_BASE + 13; static const SpriteID SPR_GRASS_LEFT = SPR_AIRPORTX_BASE + 14; static const uint16 AIRPORTX_SPRITE_COUNT = 15; -static const SpriteID SPR_ROADSTOP_BASE = SPR_AIRPORTX_BASE + AIRPORTX_SPRITE_COUNT; // The sprites used for drive-through road stops +/* Airport preview sprites */ +static const SpriteID SPR_AIRPORT_PREVIEW_BASE = SPR_AIRPORTX_BASE + AIRPORTX_SPRITE_COUNT; +static const SpriteID SPR_AIRPORT_PREVIEW_SMALL = SPR_AIRPORT_PREVIEW_BASE; +static const SpriteID SPR_AIRPORT_PREVIEW_LARGE = SPR_AIRPORT_PREVIEW_BASE + 1; +static const SpriteID SPR_AIRPORT_PREVIEW_HELIPORT = SPR_AIRPORT_PREVIEW_BASE + 2; +static const SpriteID SPR_AIRPORT_PREVIEW_METROPOLITAN = SPR_AIRPORT_PREVIEW_BASE + 3; +static const SpriteID SPR_AIRPORT_PREVIEW_INTERNATIONAL = SPR_AIRPORT_PREVIEW_BASE + 4; +static const SpriteID SPR_AIRPORT_PREVIEW_COMMUTER = SPR_AIRPORT_PREVIEW_BASE + 5; +static const SpriteID SPR_AIRPORT_PREVIEW_HELIDEPOT = SPR_AIRPORT_PREVIEW_BASE + 6; +static const SpriteID SPR_AIRPORT_PREVIEW_INTERCONTINENTAL = SPR_AIRPORT_PREVIEW_BASE + 7; +static const SpriteID SPR_AIRPORT_PREVIEW_HELISTATION = SPR_AIRPORT_PREVIEW_BASE + 8; +static const SpriteID SPR_AIRPORT_PREVIEW_COUNT = 9; + +static const SpriteID SPR_ROADSTOP_BASE = SPR_AIRPORT_PREVIEW_BASE + SPR_AIRPORT_PREVIEW_COUNT; // The sprites used for drive-through road stops static const SpriteID SPR_BUS_STOP_DT_Y_W = SPR_ROADSTOP_BASE; static const SpriteID SPR_BUS_STOP_DT_Y_E = SPR_ROADSTOP_BASE + 1; static const SpriteID SPR_BUS_STOP_DT_X_W = SPR_ROADSTOP_BASE + 2; -- cgit v1.2.3-54-g00ecf