summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/data/2ccmap.grfbin66566 -> 0 bytes
-rw-r--r--bin/data/airports.grfbin9488 -> 0 bytes
-rw-r--r--bin/data/autorail.grfbin9747 -> 0 bytes
-rw-r--r--bin/data/canalsw.grfbin41639 -> 0 bytes
-rw-r--r--bin/data/chars.grfbin0 -> 2686 bytes
-rw-r--r--bin/data/elrailsw.grfbin7699 -> 0 bytes
-rw-r--r--bin/data/flags.grfbin2153 -> 0 bytes
-rw-r--r--bin/data/group.grfbin5704 -> 0 bytes
-rw-r--r--bin/data/halffndw.grfbin21613 -> 0 bytes
-rw-r--r--bin/data/halfselw.grfbin2844 -> 0 bytes
-rw-r--r--bin/data/nsignalsw.grfbin50012 -> 0 bytes
-rw-r--r--bin/data/oneway.grfbin581 -> 0 bytes
-rw-r--r--bin/data/openttd.grfbin34441 -> 0 bytes
-rw-r--r--bin/data/openttdd.grfbin0 -> 380052 bytes
-rw-r--r--bin/data/openttdw.grfbin0 -> 380212 bytes
-rw-r--r--bin/data/roadstops.grfbin2403 -> 0 bytes
-rw-r--r--bin/data/tramtrkw.grfbin42018 -> 0 bytes
-rw-r--r--bin/data/trkfoundw.grfbin91558 -> 0 bytes
-rw-r--r--src/gfxinit.cpp125
-rw-r--r--src/newgrf.cpp104
-rw-r--r--src/newgrf.h1
-rw-r--r--src/newgrf_config.cpp14
-rw-r--r--src/newgrf_config.h2
-rw-r--r--src/newgrf_gui.cpp4
-rw-r--r--src/rail_cmd.cpp7
-rw-r--r--src/table/files.h31
-rw-r--r--src/table/landscape_sprite.h67
-rw-r--r--src/table/sprites.h506
-rw-r--r--src/water_cmd.cpp6
29 files changed, 400 insertions, 467 deletions
diff --git a/bin/data/2ccmap.grf b/bin/data/2ccmap.grf
deleted file mode 100644
index 4e833c0e8..000000000
--- a/bin/data/2ccmap.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/airports.grf b/bin/data/airports.grf
deleted file mode 100644
index 8c35d18d0..000000000
--- a/bin/data/airports.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/autorail.grf b/bin/data/autorail.grf
deleted file mode 100644
index cd6fd293c..000000000
--- a/bin/data/autorail.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/canalsw.grf b/bin/data/canalsw.grf
deleted file mode 100644
index 045eae15e..000000000
--- a/bin/data/canalsw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/chars.grf b/bin/data/chars.grf
new file mode 100644
index 000000000..2b3b6aafc
--- /dev/null
+++ b/bin/data/chars.grf
Binary files differ
diff --git a/bin/data/elrailsw.grf b/bin/data/elrailsw.grf
deleted file mode 100644
index f722d1e3a..000000000
--- a/bin/data/elrailsw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/flags.grf b/bin/data/flags.grf
deleted file mode 100644
index c6d5831c5..000000000
--- a/bin/data/flags.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/group.grf b/bin/data/group.grf
deleted file mode 100644
index 586a2bfd1..000000000
--- a/bin/data/group.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/halffndw.grf b/bin/data/halffndw.grf
deleted file mode 100644
index 8fe4ad447..000000000
--- a/bin/data/halffndw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/halfselw.grf b/bin/data/halfselw.grf
deleted file mode 100644
index e80c14ea1..000000000
--- a/bin/data/halfselw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/nsignalsw.grf b/bin/data/nsignalsw.grf
deleted file mode 100644
index 03dee7863..000000000
--- a/bin/data/nsignalsw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/oneway.grf b/bin/data/oneway.grf
deleted file mode 100644
index 4c376e93a..000000000
--- a/bin/data/oneway.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/openttd.grf b/bin/data/openttd.grf
deleted file mode 100644
index 7dce5a2d3..000000000
--- a/bin/data/openttd.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/openttdd.grf b/bin/data/openttdd.grf
new file mode 100644
index 000000000..a3576278d
--- /dev/null
+++ b/bin/data/openttdd.grf
Binary files differ
diff --git a/bin/data/openttdw.grf b/bin/data/openttdw.grf
new file mode 100644
index 000000000..67ae95b78
--- /dev/null
+++ b/bin/data/openttdw.grf
Binary files differ
diff --git a/bin/data/roadstops.grf b/bin/data/roadstops.grf
deleted file mode 100644
index c9d5ef590..000000000
--- a/bin/data/roadstops.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/tramtrkw.grf b/bin/data/tramtrkw.grf
deleted file mode 100644
index d4a38d1f8..000000000
--- a/bin/data/tramtrkw.grf
+++ /dev/null
Binary files differ
diff --git a/bin/data/trkfoundw.grf b/bin/data/trkfoundw.grf
deleted file mode 100644
index 5fbfa36e9..000000000
--- a/bin/data/trkfoundw.grf
+++ /dev/null
Binary files differ
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 338dd92fa..1175c21a8 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -25,8 +25,11 @@ struct MD5File {
};
struct FileList {
- MD5File basic[2]; ///< grf files that always have to be loaded
- MD5File landscape[3]; ///< landscape specific grf files
+ MD5File basic[2]; ///< GRF files that always have to be loaded
+ MD5File landscape[3]; ///< Landscape specific grf files
+ MD5File sound; ///< Sound samples
+ MD5File chars; ///< GRF File with character replacements
+ MD5File openttd; ///< GRF File with OTTD specific graphics
};
#include "table/files.h"
@@ -38,21 +41,6 @@ static const SpriteID * const _landscape_spriteindexes[] = {
_landscape_spriteindexes_3,
};
-static const SpriteID * const _slopes_spriteindexes[] = {
- _slopes_spriteindexes_0,
- _slopes_spriteindexes_1,
- _slopes_spriteindexes_2,
- _slopes_spriteindexes_3,
-};
-
-static const SpriteID * const _halftile_foundation_spriteindexes[] = {
- _halftile_foundation_spriteindexes_0,
- _halftile_foundation_spriteindexes_1,
- _halftile_foundation_spriteindexes_2,
- _halftile_foundation_spriteindexes_3,
-};
-
-
static uint LoadGrfFile(const char *filename, uint load_index, int file_index)
{
uint load_index_org = load_index;
@@ -183,7 +171,7 @@ void CheckExternalFiles()
static const size_t ERROR_MESSAGE_LENGTH = 128;
const FileList *files = _use_dos_palette ? &files_dos : &files_win;
- char error_msg[ERROR_MESSAGE_LENGTH * (lengthof(files->basic) + lengthof(files->landscape) + lengthof(files_openttd) + 1)];
+ char error_msg[ERROR_MESSAGE_LENGTH * (lengthof(files->basic) + lengthof(files->landscape) + 3)];
error_msg[0] = '\0';
char *add_pos = error_msg;
@@ -199,14 +187,16 @@ void CheckExternalFiles()
}
}
- if (!FileMD5(sample_cat_win) && !FileMD5(sample_cat_dos)) {
+ if (!FileMD5(files_win.sound) && !FileMD5(files_dos.sound)) {
add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your 'sample.cat' file is corrupted or missing! You can find 'sample.cat' on your Transport Tycoon Deluxe CD-ROM.\n");
}
- for (uint i = 0; i < lengthof(files_openttd); i++) {
- if (!FileMD5(files_openttd[i])) {
- add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files_openttd[i].filename);
- }
+ if (!FileMD5(files->chars)) {
+ add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->chars.filename);
+ }
+
+ if (!FileMD5(files->openttd)) {
+ add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->openttd.filename);
}
if (add_pos != error_msg) ShowInfoF(error_msg);
@@ -293,22 +283,15 @@ static const SpriteID trg1idx[] = {
END
};
-/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
- * amount of sprites and add them to the end of the list, with the index of
- * the old sprite-count offset from SPR_OPENTTD_BASE. With this there is no
- * correspondence of any kind with the ID's in the grf file, but results in
- * a maximum use of sprite slots. */
-static const SpriteID _openttd_grf_indexes[] = {
- SPR_IMG_AUTORAIL, SPR_CURSOR_WAYPOINT, // icons etc
- 134, 134, ///< euro symbol medium size
- 582, 582, ///< euro symbol large size
- 358, 358, ///< euro symbol tiny
- SPR_CURSOR_CANAL, SPR_IMG_FASTFORWARD, // more icons
+/** Replace some letter sprites with some other letters */
+static const SpriteID _chars_grf_indexes[] = {
+ 134, 134, ///< euro symbol medium size
+ 582, 582, ///< euro symbol large size
+ 358, 358, ///< euro symbol tiny
648, 648, ///< nordic char: æ
616, 616, ///< nordic char: Æ
666, 666, ///< nordic char: ø
634, 634, ///< nordic char: Ø
- SPR_PIN_UP, SPR_CURSOR_CLONE_TRAIN, // more icons
382, 383, ///< Œ œ tiny
158, 159, ///< Œ œ medium
606, 607, ///< Œ œ large
@@ -334,18 +317,15 @@ static const SpriteID _openttd_grf_indexes[] = {
317, 320, ///< { | } ~ tiny
93, 96, ///< { | } ~ medium
541, 544, ///< { | } ~ large
- SPR_HOUSE_ICON, SPR_HOUSE_ICON,
585, 585, ///< § large
587, 587, ///< © large
592, 592, ///< ® large
594, 597, ///< ° ± ² ³ large
633, 633, ///< × large
665, 665, ///< ÷ large
- SPR_SELL_TRAIN, SPR_SHARED_ORDERS_ICON,
377, 377, ///< · small
153, 153, ///< · medium
601, 601, ///< · large
- SPR_WARNING_SIGN, SPR_CURSOR_ELRAIL_DEPOT,
END
};
@@ -353,7 +333,6 @@ static const SpriteID _openttd_grf_indexes[] = {
static void LoadSpriteTables()
{
const FileList *files = _use_dos_palette ? &files_dos : &files_win;
- uint load_index;
uint i = FIRST_GRF_SLOT;
LoadGrfIndexed(files->basic[0].filename, trg1idx, i++);
@@ -382,59 +361,29 @@ static void LoadSpriteTables()
);
}
- /* Start loading the extra, non-TTD, base GRFs for the given index. */
- load_index = SPR_SIGNALS_BASE;
- load_index += LoadGrfFile("nsignalsw.grf", load_index, i++);
-
- assert(load_index == SPR_CANALS_BASE);
- load_index += LoadGrfFile("canalsw.grf", load_index, i++);
-
- assert(load_index == SPR_SLOPES_BASE);
- LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++);
-
- load_index = SPR_AUTORAIL_BASE;
- load_index += LoadGrfFile("autorail.grf", load_index, i++);
-
- assert(load_index == SPR_ELRAIL_BASE);
- load_index += LoadGrfFile("elrailsw.grf", load_index, i++);
-
- assert(load_index == SPR_2CCMAP_BASE);
- load_index += LoadGrfFile("2ccmap.grf", load_index, i++);
-
- assert(load_index == SPR_OPENTTD_BASE);
- LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++);
- load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT;
-
- assert(load_index == SPR_AIRPORTX_BASE);
- load_index += LoadGrfFile("airports.grf", load_index, i++);
-
- assert(load_index == SPR_ROADSTOP_BASE);
- load_index += LoadGrfFile("roadstops.grf", load_index, i++);
-
- assert(load_index == SPR_GROUP_BASE);
- load_index += LoadGrfFile("group.grf", load_index, i++);
-
- assert(load_index == SPR_TRAMWAY_BASE);
- load_index += LoadGrfFile("tramtrkw.grf", load_index, i++);
-
- assert(load_index == SPR_ONEWAY_BASE);
- load_index += LoadGrfFile("oneway.grf", load_index, i++);
-
- load_index++; // SPR_EMPTY_BOUNDING_BOX
-
- assert(load_index == SPR_HALFTILE_FOUNDATION_BASE);
- LoadGrfIndexed("halffndw.grf", _halftile_foundation_spriteindexes[_opt.landscape], i++);
-
- load_index = SPR_HALFTILE_SELECTION_BASE;
- load_index += LoadGrfFile("halfselw.grf", load_index, i++);
-
- assert(load_index == SPR_FLAGS_BASE);
- load_index += LoadGrfFile("flags.grf", load_index, i++);
+ LoadGrfIndexed(files->chars.filename, _chars_grf_indexes, i++);
/* Initialize the unicode to sprite mapping table */
InitializeUnicodeGlyphMap();
- LoadNewGRF(load_index, i);
+ /*
+ * Load the base NewGRF with OTTD required graphics as first NewGRF.
+ * However, we do not want it to show up in the list of used NewGRFs,
+ * so we have to manually add it, and then remove it later.
+ */
+ GRFConfig *top = _grfconfig;
+ GRFConfig *master = CallocT<GRFConfig>(1);
+ master->filename = strdup(files->openttd.filename);
+ FillGRFDetails(master, false);
+ ClrBitT(master->flags, GCF_INIT_ONLY);
+ master->next = top;
+ _grfconfig = master;
+
+ LoadNewGRF(SPR_NEWGRFS_BASE, i);
+
+ /* Free and remove the top element. */
+ ClearGRFConfig(&master);
+ _grfconfig = top;
}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 3be403a67..5a0d9098b 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -61,7 +61,6 @@
static int _skip_sprites; // XXX
static uint _file_index; // XXX
-SpriteID _signal_base;
SpriteID _coast_base;
static GRFFile *_cur_grffile;
@@ -3241,6 +3240,34 @@ static void FeatureNewName(byte *buf, int len)
}
}
+/**
+ * Sanitize incoming sprite offsets for Action 5 graphics replacements.
+ * @param num the number of sprites to load.
+ * @param offset offset from the base.
+ * @param max_sprites the maximum number of sprites that can be loaded in this action 5.
+ * @param name used for error warnings.
+ * @return the number of sprites that is going to be skipped
+ */
+static uint16 SanitizeSpriteOffset(uint16& num, uint16 offset, int max_sprites, const char *name)
+{
+
+ if (offset >= max_sprites) {
+ grfmsg(1, "GraphicsNew: %s sprite offset must be less than %i, skipping", name, max_sprites);
+ uint orig_num = num;
+ num = 0;
+ return orig_num;
+ }
+
+ if (offset + num > max_sprites) {
+ grfmsg(4, "GraphicsNew: %s sprite overflow, truncating...", name);
+ uint orig_num = num;
+ num = max(max_sprites - offset, 0);
+ return orig_num - num;
+ }
+
+ return 0;
+}
+
/* Action 0x05 */
static void GraphicsNew(byte *buf, int len)
{
@@ -3252,50 +3279,52 @@ static void GraphicsNew(byte *buf, int len)
/* TODO */
SpriteID replace = 0;
- const SpriteID *index_tbl = NULL;
if (!check_length(len, 2, "GraphicsNew")) return;
buf++;
uint8 type = grf_load_byte(&buf);
uint16 num = grf_load_extended(&buf);
+ uint16 skip_num = 0;
+ uint16 offset = HASBIT(type, 7) ? grf_load_extended(&buf) : 0;
+ CLRBIT(type, 7); // Clear the high bit as that only indicates whether there is an offset.
switch (type) {
case 0x04: // Signal graphics
- if (num != 112 && num != 240) {
- grfmsg(1, "GraphicsNew: Signal graphics sprite count must be 112 or 240, skipping");
+ if (num != PRESIGNAL_SPRITE_COUNT && num != PRESIGNAL_AND_SEMAPHORE_SPRITE_COUNT && num != PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT) {
+ grfmsg(1, "GraphicsNew: Signal graphics sprite count must be 48, 112 or 240, skipping");
return;
}
- _signal_base = _cur_spriteid;
+ replace = SPR_SIGNALS_BASE;
break;
case 0x05: // Catenary graphics
- if (num != 48) {
+ if (num != ELRAIL_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: Catenary graphics sprite count must be 48, skipping");
return;
}
- replace = SPR_ELRAIL_BASE + 3;
+ replace = SPR_ELRAIL_BASE;
break;
case 0x06: // Foundations
- switch (num) {
- case 74: replace = SPR_SLOPES_BASE; break;
- case 90: index_tbl = _slopes_action05_90; break;
- default:
- grfmsg(1, "GraphicsNew: Foundation graphics sprite count must be 74 or 90, skipping");
- return;
+ if (num != NORMAL_FOUNDATION_SPRITE_COUNT && num != NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT) {
+ grfmsg(1, "GraphicsNew: Foundation graphics sprite count must be 74 or 90, skipping");
+ return;
}
+ replace = SPR_SLOPES_BASE; break;
break;
+ /* case 0x07: // TTDP GUI sprites. Not used by OTTD. */
+
case 0x08: // Canal graphics
- if (num != 65) {
+ if (num != CANALS_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: Canal graphics sprite count must be 65, skipping");
return;
}
- replace = SPR_CANALS_BASE + 5;
+ replace = SPR_CANALS_BASE;
break;
case 0x09: // One way graphics
- if (num != 6) {
+ if (num != ONEWAY_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: One way road graphics sprite count must be 6, skipping");
return;
}
@@ -3303,7 +3332,7 @@ static void GraphicsNew(byte *buf, int len)
break;
case 0x0A: // 2CC colour maps
- if (num != 256) {
+ if (num != TWOCCMAP_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: 2CC colour maps sprite count must be 256, skipping");
return;
}
@@ -3311,13 +3340,15 @@ static void GraphicsNew(byte *buf, int len)
break;
case 0x0B: // tramways
- if (num != 113) {
+ if (num != TRAMWAY_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: Tramway graphics sprite count must be 113, skipping");
return;
}
replace = SPR_TRAMWAY_BASE;
break;
+ /* case 0x0C: // Snowy temperate trees. Not yet used by OTTD. */
+
case 0x0D: // Coast graphics
if (num != 16) {
grfmsg(1, "GraphicsNew: Coast graphics sprite count must be 16, skipping");
@@ -3327,8 +3358,12 @@ static void GraphicsNew(byte *buf, int len)
_loaded_newgrf_features.has_newwater = true;
break;
+ /* case 0x0E: // New Signals. Not yet used by OTTD. */
+
+ /* case 0x0F: // Tracks for marking sloped rail. Not yet used by OTTD. */
+
case 0x10: // New airport sprites
- if (num != 15) {
+ if (num != AIRPORTX_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: Airport graphics sprite count must be 15, skipping");
return;
}
@@ -3336,13 +3371,33 @@ static void GraphicsNew(byte *buf, int len)
break;
case 0x11: // Road stop sprites
- if (num != 8) {
+ if (num != ROADSTOP_SPRITE_COUNT) {
grfmsg(1, "GraphicsNew: Road stop graphics sprite count must be 8, skipping");
return;
}
replace = SPR_ROADSTOP_BASE;
break;
+ /* case 0x12: // Aqueduct sprites. Not yet used by OTTD. */
+
+ case 0x13: // Autorail sprites
+ if (num != AUTORAIL_SPRITE_COUNT) {
+ grfmsg(1, "GraphicsNew: Autorail graphics sprite count must be 55, skipping");
+ return;
+ }
+ replace = SPR_AUTORAIL_BASE;
+ break;
+
+ case 0x14: // Flag sprites
+ skip_num = SanitizeSpriteOffset(num, offset, FLAGS_SPRITE_COUNT, "Flag graphics");
+ replace = SPR_FLAGS_BASE + offset;
+ break;
+
+ case 0x15: // OpenTTD GUI sprites
+ skip_num = SanitizeSpriteOffset(num, offset, OPENTTD_SPRITE_COUNT, "OpenTTD graphics");
+ replace = SPR_OPENTTD_BASE + offset;
+ break;
+
default:
grfmsg(2, "GraphicsNew: Custom graphics (type 0x%02X) sprite block of length %u (unimplemented, ignoring)",
type, num);
@@ -3350,12 +3405,6 @@ static void GraphicsNew(byte *buf, int len)
return;
}
- if (index_tbl != NULL) {
- grfmsg(2, "GraphicsNew: Loading %u sprites of type 0x%02X at indexed SpriteIDs", num, type);
- LoadSpritesIndexed(_file_index, &_nfo_line, index_tbl);
- return;
- }
-
if (replace == 0) {
grfmsg(2, "GraphicsNew: Loading %u sprites of type 0x%02X at SpriteID 0x%04X", num, type, _cur_spriteid);
} else {
@@ -3366,6 +3415,8 @@ static void GraphicsNew(byte *buf, int len)
LoadNextSprite(replace == 0 ? _cur_spriteid++ : replace++, _file_index, _nfo_line);
_nfo_line++;
}
+
+ _skip_sprites = skip_num;
}
/* Action 0x05 (SKIP) */
@@ -5028,7 +5079,6 @@ static void ResetNewGRFData()
_loaded_newgrf_features.has_newhouses = false;
_loaded_newgrf_features.has_newindustries = false;
_loaded_newgrf_features.has_newwater = false;
- _signal_base = 0;
_coast_base = 0;
InitializeSoundPool();
diff --git a/src/newgrf.h b/src/newgrf.h
index 93245b390..3785fcc5d 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -85,7 +85,6 @@ struct GRFFile {
extern GRFFile *_first_grffile;
-extern SpriteID _signal_base;
extern SpriteID _coast_base;
struct GRFLoadedFeatures {
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 169da02b7..18235e4ad 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -69,7 +69,7 @@ bool FillGRFDetails(GRFConfig *config, bool is_static)
LoadNewGRFFile(config, CONFIG_SLOT, GLS_FILESCAN);
/* Skip if the grfid is 0 (not read) or 0xFFFFFFFF (ttdp system grf) */
- if (config->grfid == 0 || config->grfid == 0xFFFFFFFF) return false;
+ if (config->grfid == 0 || config->grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false;
if (is_static) {
/* Perform a 'safety scan' for static GRFs */
@@ -522,6 +522,18 @@ char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last)
return dst;
}
+/** Base GRF ID for OpenTTD's base graphics GRFs. */
+static const uint32 OPENTTD_GRAPHICS_BASE_GRF_ID = BSWAP32(0xFF4F5400);
+
+/**
+ * Checks whether this GRF is a OpenTTD base graphic GRF.
+ * @return true if and only if it is a base GRF.
+ */
+bool GRFConfig::IsOpenTTDBaseGRF() const
+{
+ return (this->grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID;
+}
+
static const SaveLoad _grfconfig_desc[] = {
SLE_STR(GRFConfig, filename, SLE_STR, 0x40),
diff --git a/src/newgrf_config.h b/src/newgrf_config.h
index fe59d44c3..b5234723e 100644
--- a/src/newgrf_config.h
+++ b/src/newgrf_config.h
@@ -58,6 +58,8 @@ struct GRFConfig : public GRFIdentifier {
uint8 num_params;
struct GRFConfig *next;
+
+ bool IsOpenTTDBaseGRF() const;
};
/* First item in list of all scanned NewGRFs */
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 17e80656f..aa4e308a7 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -16,7 +16,6 @@
#include "strings.h"
#include "helpers.hpp"
-
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a
* comma or a space character
@@ -128,7 +127,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e)
w->vscroll.cap = (w->widget[3].bottom - w->widget[3].top) / 10;
SetVScrollCount(w, n);
- SetWindowWidgetDisabledState(w, 6, WP(w, newgrf_add_d).sel == NULL);
+ SetWindowWidgetDisabledState(w, 6, WP(w, newgrf_add_d).sel == NULL || WP(w, newgrf_add_d).sel->IsOpenTTDBaseGRF());
DrawWindowWidgets(w);
GfxFillRect(w->widget[3].left + 1, w->widget[3].top + 1, w->widget[3].right, w->widget[3].bottom, 0xD7);
@@ -283,6 +282,7 @@ static void SetupNewGRFState(Window *w)
/* All widgets are now enabled, so disable widgets we can't use */
if (WP(w, newgrf_d).sel == *WP(w, newgrf_d).list) DisableWindowWidget(w, SNGRFS_MOVE_UP);
if (WP(w, newgrf_d).sel->next == NULL) DisableWindowWidget(w, SNGRFS_MOVE_DOWN);
+ if (WP(w, newgrf_d).sel->IsOpenTTDBaseGRF()) DisableWindowWidget(w, SNGRFS_REMOVE);
}
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 957c37b07..a1b840dbd 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1376,13 +1376,10 @@ static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint i
SpriteID sprite;
- /* _signal_base is set by our NewGRF Action 5 loader. If it is 0 then we
- * just draw the standard signals, else we get the offset from _signal_base
- * and draw that sprite. All the signal sprites are loaded sequentially. */
- if (_signal_base == 0 || (GetSignalType(tile, track) == SIGTYPE_NORMAL && GetSignalVariant(tile, track) == SIG_ELECTRIC)) {
+ if (GetSignalType(tile, track) == SIGTYPE_NORMAL && GetSignalVariant(tile, track) == SIG_ELECTRIC) {
sprite = SignalBase[side][GetSignalVariant(tile, track)][GetSignalType(tile, track)] + image + condition;
} else {
- sprite = _signal_base + (GetSignalType(tile, track) - 1) * 16 + GetSignalVariant(tile, track) * 64 + image + condition;
+ sprite = SPR_SIGNALS_BASE + (GetSignalType(tile, track) - 1) * 16 + GetSignalVariant(tile, track) * 64 + image + condition;
}
AddSortableSpriteToDraw(sprite, PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, GetSaveSlopeZ(x, y, track));
diff --git a/src/table/files.h b/src/table/files.h
index 62b5bb51e..80c05843f 100644
--- a/src/table/files.h
+++ b/src/table/files.h
@@ -31,7 +31,10 @@ static FileList files_dos = {
{ "TRGC.GRF", {0xed, 0x44, 0x66, 0x37, 0xe0, 0x34, 0x10, 0x4c, 0x55, 0x59, 0xb3, 0x2c, 0x18, 0xaf, 0xe7, 0x8d} },
{ "TRGH.GRF", {0xee, 0x66, 0x16, 0xfb, 0x0e, 0x6e, 0xf6, 0xb2, 0x48, 0x92, 0xc5, 0x8c, 0x93, 0xd8, 0x6f, 0xc9} },
{ "TRGT.GRF", {0xfc, 0xde, 0x1d, 0x7e, 0x8a, 0x74, 0x19, 0x7d, 0x72, 0xa6, 0x26, 0x95, 0x88, 0x4b, 0x90, 0x9e} }
- }
+ },
+ { "SAMPLE.CAT", {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda} },
+ { "CHARS.GRF", {0x5f, 0x2e, 0xbf, 0x05, 0xb6, 0x12, 0x65, 0x81, 0xd2, 0x10, 0xa9, 0x19, 0x62, 0x41, 0x70, 0x64} },
+ { "OPENTTDD.GRF", {0x85, 0x5f, 0x38, 0xa6, 0xb2, 0xc9, 0xd7, 0x51, 0xaa, 0xca, 0x0d, 0xae, 0xd9, 0x8d, 0x71, 0x98} }
};
static FileList files_win = {
@@ -42,26 +45,8 @@ static FileList files_win = {
{ "TRGCR.GRF", {0x36, 0x68, 0xf4, 0x10, 0xc7, 0x61, 0xa0, 0x50, 0xb5, 0xe7, 0x09, 0x5a, 0x2b, 0x14, 0x87, 0x9b} },
{ "TRGHR.GRF", {0x06, 0xbf, 0x2b, 0x7a, 0x31, 0x76, 0x6f, 0x04, 0x8b, 0xaa, 0xc2, 0xeb, 0xe4, 0x34, 0x57, 0xb1} },
{ "TRGTR.GRF", {0xde, 0x53, 0x65, 0x05, 0x17, 0xfe, 0x66, 0x1c, 0xea, 0xa3, 0x13, 0x8c, 0x6e, 0xdb, 0x0e, 0xb8} }
- }
-};
-
-static MD5File sample_cat_win = { "SAMPLE.CAT", {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10} };
-static MD5File sample_cat_dos = { "SAMPLE.CAT", {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda} };
-
-static MD5File files_openttd[] = {
- { "nsignalsw.grf", { 0x65, 0xb9, 0xd7, 0x30, 0x56, 0x06, 0xcc, 0x9e, 0x27, 0x57, 0xc8, 0xe4, 0x9b, 0xb3, 0x66, 0x81 } },
- { "2ccmap.grf", { 0x20, 0x03, 0x32, 0x1a, 0x43, 0x6c, 0xc1, 0x05, 0x80, 0xbd, 0x43, 0xeb, 0xe1, 0xfd, 0x0c, 0x62 } },
- { "airports.grf", { 0xfd, 0xa4, 0x38, 0xd6, 0x9c, 0x81, 0x74, 0xfe, 0xa0, 0x98, 0xa2, 0x14, 0x4b, 0x15, 0xb8, 0x4b } },
- { "autorail.grf", { 0xed, 0x44, 0x7f, 0xbb, 0x19, 0x44, 0x48, 0x4c, 0x07, 0x8a, 0xb1, 0xc1, 0x5c, 0x12, 0x3a, 0x60 } },
- { "canalsw.grf", { 0x13, 0x9c, 0x98, 0xcf, 0xb8, 0x7c, 0xd7, 0x1f, 0xca, 0x34, 0xa5, 0x6b, 0x65, 0x31, 0xec, 0x0f } },
- { "elrailsw.grf", { 0x4f, 0xf9, 0xac, 0x79, 0x50, 0x28, 0x9b, 0xe2, 0x15, 0x30, 0xa8, 0x1e, 0xd5, 0xfd, 0xe1, 0xda } },
- { "openttd.grf", { 0x16, 0x5c, 0x0f, 0xba, 0x63, 0x6a, 0x77, 0x30, 0x44, 0xb0, 0x32, 0xe6, 0x4a, 0xc7, 0x90, 0x58 } },
- { "trkfoundw.grf", { 0x12, 0x33, 0x3f, 0xa3, 0xd1, 0x86, 0x8b, 0x04, 0x53, 0x18, 0x9c, 0xee, 0xf9, 0x2d, 0xf5, 0x95 } },
- { "roadstops.grf", { 0xa1, 0x5b, 0xb3, 0x52, 0x60, 0x12, 0x3c, 0xb7, 0x7b, 0x73, 0x09, 0xc1, 0x1a, 0xb4, 0xd0, 0xb8 } },
- { "group.grf", { 0xe8, 0x52, 0x5f, 0x1c, 0x3e, 0xf9, 0x91, 0x9d, 0x0f, 0x70, 0x8c, 0x8a, 0x21, 0xa4, 0xc7, 0x02 } },
- { "tramtrkw.grf", { 0x83, 0x0a, 0xf4, 0x9f, 0x29, 0x10, 0x48, 0xfd, 0x76, 0xe9, 0xda, 0xac, 0x5d, 0xa2, 0x30, 0x45 } },
- { "oneway.grf", { 0xbb, 0xc6, 0xa3, 0xb2, 0xb3, 0xa0, 0xc9, 0x3c, 0xc9, 0xee, 0x24, 0x7c, 0xb6, 0x51, 0x74, 0x63 } },
- { "halffndw.grf", { 0xf2, 0x10, 0xe0, 0xc1, 0xa1, 0xdc, 0xb3, 0x6e, 0x3f, 0xce, 0xb8, 0x98, 0x1a, 0x08, 0xb0, 0x67 } },
- { "halfselw.grf", { 0xf2, 0x12, 0x2e, 0x88, 0x58, 0x08, 0xc4, 0xa5, 0xbd, 0x91, 0xb3, 0xc2, 0x5b, 0x5a, 0xb9, 0xf4 } },
- { "flags.grf", { 0xa1, 0xd7, 0x72, 0x75, 0x0e, 0x81, 0x86, 0x0e, 0xc9, 0xcd, 0xc2, 0x57, 0xb2, 0x19, 0xe1, 0x0c } },
+ },
+ { "SAMPLE.CAT", {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10} },
+ { "CHARS.GRF", {0x5f, 0x2e, 0xbf, 0x05, 0xb6, 0x12, 0x65, 0x81, 0xd2, 0x10, 0xa9, 0x19, 0x62, 0x41, 0x70, 0x64} },
+ { "OPENTTDW.GRF", {0x3e, 0xff, 0xe8, 0x43, 0xc9, 0x31, 0xf6, 0x9d, 0x0b, 0x40, 0xb1, 0x64, 0xbf, 0x16, 0xde, 0x5a} }
};
diff --git a/src/table/landscape_sprite.h b/src/table/landscape_sprite.h
index b395c3a44..01b143077 100644
--- a/src/table/landscape_sprite.h
+++ b/src/table/landscape_sprite.h
@@ -137,70 +137,3 @@ static const SpriteID _landscape_spriteindexes_3[] = {
0x322, 0x322,
END
};
-
-
-/* Slope graphics indexes temperate climate
-Skip first 3 sprites and only load the proper set */
-static const SpriteID _slopes_spriteindexes_0[] = {
- SKIP, 3,
- SPR_SLOPES_VIRTUAL_BASE + 15, SPR_SLOPES_VIRTUAL_BASE + 4 * SPR_TRKFOUND_BLOCK_SIZE,
- END
-};
-
-/* Slope graphics indexes arctic climate
-Skip first 79 sprites and only load the proper set */
-static const SpriteID _slopes_spriteindexes_1[] = {
- SKIP, 79,
- SPR_SLOPES_VIRTUAL_BASE + 15, SPR_SLOPES_VIRTUAL_BASE + 4 * SPR_TRKFOUND_BLOCK_SIZE,
- END
-};
-
-/* Slope graphics indexes tropical climate
-Skip first 155 sprites and only load the proper set */
-static const SpriteID _slopes_spriteindexes_2[] = {
- SKIP, 155,
- SPR_SLOPES_VIRTUAL_BASE + 15, SPR_SLOPES_VIRTUAL_BASE + 4 * SPR_TRKFOUND_BLOCK_SIZE,
- END
-};
-
-/* Slope graphics indexes toyland climate
-Skip first 231 sprites and only load the proper set */
-static const SpriteID _slopes_spriteindexes_3[] = {
- SKIP, 231,
- SPR_SLOPES_VIRTUAL_BASE + 15, SPR_SLOPES_VIRTUAL_BASE + 4 * SPR_TRKFOUND_BLOCK_SIZE,
- END
-};
-
-/* Halftile foundation indexes for temperate climate */
-static const SpriteID _halftile_foundation_spriteindexes_0[] = {
- SPR_HALFTILE_FOUNDATION_BASE, SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE - 1,
- END
-};
-
-/* Halftile foundation indexes for arctic climate */
-static const SpriteID _halftile_foundation_spriteindexes_1[] = {
- SKIP, 16,
- SPR_HALFTILE_FOUNDATION_BASE, SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE - 1,
- END
-};
-
-/* Halftile foundation indexes for tropic climate */
-static const SpriteID _halftile_foundation_spriteindexes_2[] = {
- SKIP, 32,
- SPR_HALFTILE_FOUNDATION_BASE, SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE - 1,
- END
-};
-
-/* Halftile foundation indexes for toyland climate */
-static const SpriteID _halftile_foundation_spriteindexes_3[] = {
- SKIP, 48,
- SPR_HALFTILE_FOUNDATION_BASE, SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE - 1,
- END
-};
-
-/* Slope graphics indexes for Action 05 type 06, 90 sprites */
-static const SpriteID _slopes_action05_90[] = {
- SPR_SLOPES_VIRTUAL_BASE + 15, SPR_SLOPES_VIRTUAL_BASE + 4 * SPR_TRKFOUND_BLOCK_SIZE,
- SPR_HALFTILE_FOUNDATION_BASE, SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE - 1,
- END
-};
diff --git a/src/table/sprites.h b/src/table/sprites.h
index 39fee27b8..53caede35 100644
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -10,9 +10,6 @@
*
* @NOTE:
* ALL SPRITE NUMBERS BELOW 5126 are in the main files
- * SPR_CANALS_BASE is in canalsw.grf
- * SPR_SLOPES_BASE is in trkfoundw.grf
- * SPR_OPENTTD_BASE is in openttd.grf
*
* All elements which consist of two elements should
* have the same name and then suffixes
@@ -46,118 +43,133 @@ enum Sprites {
SPR_ASCII_SPACE_SMALL = 226,
SPR_ASCII_SPACE_BIG = 450,
+ SPR_LARGE_SMALL_WINDOW = 682,
+
/* Extra graphic spritenumbers */
- OPENTTD_SPRITES_COUNT = 122, // number of gfx-sprites in openttd.grf
- SPR_SIGNALS_BASE = 4896,
- SPR_CANALS_BASE = SPR_SIGNALS_BASE + 486,
-
- SPR_SLOPES_BASE = SPR_CANALS_BASE + 70,
- SPR_SLOPES_INCLINED_OFFSET = 15,
- SPR_SLOPES_VIRTUAL_BASE = SPR_SLOPES_BASE - SPR_SLOPES_INCLINED_OFFSET, // The original foundations (see SPR_FOUNDATION_BASE below) are mapped before the additional foundations.
- SPR_TRKFOUND_BLOCK_SIZE = 22, // The sprites in trkfoundw.grf are organized in blocks of 22.
-
- /* between slopes and autorail are 4 unused sprites */
-
- SPR_AUTORAIL_BASE = SPR_SLOPES_BASE + 78,
- SPR_ELRAIL_BASE = SPR_AUTORAIL_BASE + 55,
- SPR_2CCMAP_BASE = SPR_ELRAIL_BASE + 53,
- SPR_OPENTTD_BASE = SPR_2CCMAP_BASE + 256,
-
- SPR_BLOT = SPR_OPENTTD_BASE + 29, // colored circle (mainly used as vehicle profit marker and for sever compatibility)
-
- SPR_PIN_UP = SPR_OPENTTD_BASE + 55, // pin icon
- SPR_PIN_DOWN = SPR_OPENTTD_BASE + 56,
- SPR_BOX_EMPTY = SPR_OPENTTD_BASE + 59,
- SPR_BOX_CHECKED = SPR_OPENTTD_BASE + 60,
- SPR_WINDOW_RESIZE = SPR_OPENTTD_BASE + 82, // resize icon
- SPR_HOUSE_ICON = SPR_OPENTTD_BASE + 89,
- // arrow icons pointing in all 4 directions
- SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 83,
- SPR_ARROW_UP = SPR_OPENTTD_BASE + 84,
- SPR_ARROW_LEFT = SPR_OPENTTD_BASE + 85,
- SPR_ARROW_RIGHT = SPR_OPENTTD_BASE + 86,
+ SPR_OPENTTD_BASE = 4896,
+ OPENTTD_SPRITE_COUNT = 134,
- SPR_LARGE_SMALL_WINDOW = 682,
+ /* Halftile-selection sprites */
+ SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
+ SPR_HALFTILE_SELECTION_DOWN = SPR_OPENTTD_BASE + 4,
+ SPR_HALFTILE_SELECTION_UP = SPR_OPENTTD_BASE + 8,
+
+ SPR_SQUARE = SPR_OPENTTD_BASE + 38, // colored square (used for newgrf compatibility)
+ SPR_BLOT = SPR_OPENTTD_BASE + 39, // colored circle (mainly used as vehicle profit marker and for server compatibility)
+ SPR_LOCK = SPR_OPENTTD_BASE + 40, // lock icon (for password protected servers)
+ SPR_BOX_EMPTY = SPR_OPENTTD_BASE + 41,
+ SPR_BOX_CHECKED = SPR_OPENTTD_BASE + 42,
+ SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 43, // warning sign (shown if there are any newgrf errors)
+ SPR_WINDOW_RESIZE = SPR_OPENTTD_BASE + 44, // resize icon
+ /* Arrow icons pointing in all 4 directions */
+ SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 45,
+ SPR_ARROW_UP = SPR_OPENTTD_BASE + 46,
+ SPR_ARROW_LEFT = SPR_OPENTTD_BASE + 47,
+ SPR_ARROW_RIGHT = SPR_OPENTTD_BASE + 48,
+ SPR_HOUSE_ICON = SPR_OPENTTD_BASE + 49,
+ SPR_SHARED_ORDERS_ICON = SPR_OPENTTD_BASE + 50,
+ SPR_PIN_UP = SPR_OPENTTD_BASE + 51, // pin icon
+ SPR_PIN_DOWN = SPR_OPENTTD_BASE + 52,
/* Clone vehicles stuff */
- SPR_CLONE_TRAIN = SPR_OPENTTD_BASE + 87,
- SPR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 104,
- SPR_CLONE_SHIP = SPR_OPENTTD_BASE + 106,
- SPR_CLONE_AIRCRAFT = SPR_OPENTTD_BASE + 108,
-
- SPR_SELL_TRAIN = SPR_OPENTTD_BASE + 91,
- SPR_SELL_ROADVEH = SPR_OPENTTD_BASE + 92,
- SPR_SELL_SHIP = SPR_OPENTTD_BASE + 93,
- SPR_SELL_AIRCRAFT = SPR_OPENTTD_BASE + 94,
- SPR_SELL_ALL_TRAIN = SPR_OPENTTD_BASE + 95,
- SPR_SELL_ALL_ROADVEH = SPR_OPENTTD_BASE + 96,
- SPR_SELL_ALL_SHIP = SPR_OPENTTD_BASE + 97,
- SPR_SELL_ALL_AIRCRAFT = SPR_OPENTTD_BASE + 98,
- SPR_REPLACE_TRAIN = SPR_OPENTTD_BASE + 99,
- SPR_REPLACE_ROADVEH = SPR_OPENTTD_BASE + 100,
- SPR_REPLACE_SHIP = SPR_OPENTTD_BASE + 101,
- SPR_REPLACE_AIRCRAFT = SPR_OPENTTD_BASE + 102,
- SPR_SELL_CHAIN_TRAIN = SPR_OPENTTD_BASE + 103,
-
- SPR_SHARED_ORDERS_ICON = SPR_OPENTTD_BASE + 110,
-
- SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 111, // warning sign (shown if there are any newgrf errors)
-
- /* Network GUI sprites */
- SPR_SQUARE = SPR_OPENTTD_BASE + 20, // colored square (used for newgrf compatibility)
- SPR_LOCK = SPR_OPENTTD_BASE + 19, // lock icon (for password protected servers)
-
- SPR_AIRPORTX_BASE = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT, // The sprites used for other airport angles
+ SPR_CLONE_TRAIN = SPR_OPENTTD_BASE + 106,
+ SPR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 107,
+ SPR_CLONE_SHIP = SPR_OPENTTD_BASE + 108,
+ SPR_CLONE_AIRCRAFT = SPR_OPENTTD_BASE + 109,
+
+ SPR_SELL_TRAIN = SPR_OPENTTD_BASE + 93,
+ SPR_SELL_ROADVEH = SPR_OPENTTD_BASE + 94,
+ SPR_SELL_SHIP = SPR_OPENTTD_BASE + 95,
+ SPR_SELL_AIRCRAFT = SPR_OPENTTD_BASE + 96,
+ SPR_SELL_ALL_TRAIN = SPR_OPENTTD_BASE + 97,
+ SPR_SELL_ALL_ROADVEH = SPR_OPENTTD_BASE + 98,
+ SPR_SELL_ALL_SHIP = SPR_OPENTTD_BASE + 99,
+ SPR_SELL_ALL_AIRCRAFT = SPR_OPENTTD_BASE + 100,
+ SPR_REPLACE_TRAIN = SPR_OPENTTD_BASE + 101,
+ SPR_REPLACE_ROADVEH = SPR_OPENTTD_BASE + 102,
+ SPR_REPLACE_SHIP = SPR_OPENTTD_BASE + 103,
+ SPR_REPLACE_AIRCRAFT = SPR_OPENTTD_BASE + 104,
+ SPR_SELL_CHAIN_TRAIN = SPR_OPENTTD_BASE + 105,
+
+ SPR_GROUP_CREATE_TRAIN = SPR_OPENTTD_BASE + 114,
+ SPR_GROUP_CREATE_ROADVEH = SPR_OPENTTD_BASE + 115,
+ SPR_GROUP_CREATE_SHIP = SPR_OPENTTD_BASE + 116,
+ SPR_GROUP_CREATE_AIRCRAFT = SPR_OPENTTD_BASE + 117,
+ SPR_GROUP_DELETE_TRAIN = SPR_OPENTTD_BASE + 118,
+ SPR_GROUP_DELETE_ROADVEH = SPR_OPENTTD_BASE + 119,
+ SPR_GROUP_DELETE_SHIP = SPR_OPENTTD_BASE + 120,
+ SPR_GROUP_DELETE_AIRCRAFT = SPR_OPENTTD_BASE + 121,
+ SPR_GROUP_RENAME_TRAIN = SPR_OPENTTD_BASE + 122,
+ SPR_GROUP_RENAME_ROADVEH = SPR_OPENTTD_BASE + 123,
+ SPR_GROUP_RENAME_SHIP = SPR_OPENTTD_BASE + 124,
+ SPR_GROUP_RENAME_AIRCRAFT = SPR_OPENTTD_BASE + 125,
+ SPR_GROUP_REPLACE_ON_TRAIN = SPR_OPENTTD_BASE + 126,
+ SPR_GROUP_REPLACE_ON_ROADVEH = SPR_OPENTTD_BASE + 127,
+ SPR_GROUP_REPLACE_ON_SHIP = SPR_OPENTTD_BASE + 128,
+ SPR_GROUP_REPLACE_ON_AIRCRAFT = SPR_OPENTTD_BASE + 129,
+ SPR_GROUP_REPLACE_OFF_TRAIN = SPR_OPENTTD_BASE + 130,
+ SPR_GROUP_REPLACE_OFF_ROADVEH = SPR_OPENTTD_BASE + 131,
+ SPR_GROUP_REPLACE_OFF_SHIP = SPR_OPENTTD_BASE + 132,
+ SPR_GROUP_REPLACE_OFF_AIRCRAFT = SPR_OPENTTD_BASE + 133,
+
+ SPR_SIGNALS_BASE = SPR_OPENTTD_BASE + OPENTTD_SPRITE_COUNT,
+ PRESIGNAL_SPRITE_COUNT = 48,
+ PRESIGNAL_AND_SEMAPHORE_SPRITE_COUNT = 112,
+ PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT = 240,
+
+ SPR_CANALS_BASE = SPR_SIGNALS_BASE + PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT,
+ CANALS_SPRITE_COUNT = 65,
+
+ SPR_SLOPES_BASE = SPR_CANALS_BASE + CANALS_SPRITE_COUNT,
+ SPR_SLOPES_INCLINED_OFFSET = 15,
+ SPR_SLOPES_VIRTUAL_BASE = SPR_SLOPES_BASE - SPR_SLOPES_INCLINED_OFFSET, // The original foundations (see SPR_FOUNDATION_BASE below) are mapped before the additional foundations.
+ SPR_TRKFOUND_BLOCK_SIZE = 22, // The normal track foundation sprites are organized in blocks of 22.
+ NORMAL_FOUNDATION_SPRITE_COUNT = 74,
+ /* Halftile foundations */
+ SPR_HALFTILE_FOUNDATION_BASE = SPR_SLOPES_BASE + NORMAL_FOUNDATION_SPRITE_COUNT,
+ SPR_HALFTILE_BLOCK_SIZE = 4, // The half tile foundation sprites are organized in blocks of 4.
+ NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT = 90,
+
+ SPR_AUTORAIL_BASE = SPR_HALFTILE_FOUNDATION_BASE + NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT,
+ AUTORAIL_SPRITE_COUNT = 55,
+
+ SPR_ELRAIL_BASE = SPR_AUTORAIL_BASE + AUTORAIL_SPRITE_COUNT,
+ ELRAIL_SPRITE_COUNT = 48,
+
+ SPR_2CCMAP_BASE = SPR_ELRAIL_BASE + ELRAIL_SPRITE_COUNT,
+ TWOCCMAP_SPRITE_COUNT = 256,
+
+ SPR_AIRPORTX_BASE = SPR_2CCMAP_BASE + TWOCCMAP_SPRITE_COUNT, // The sprites used for other airport angles
SPR_NEWAIRPORT_TARMAC = SPR_AIRPORTX_BASE,
- SPR_NSRUNWAY1 = SPR_AIRPORTX_BASE + 1,
- SPR_NSRUNWAY2 = SPR_AIRPORTX_BASE + 2,
- SPR_NSRUNWAY3 = SPR_AIRPORTX_BASE + 3,
- SPR_NSRUNWAY4 = SPR_AIRPORTX_BASE + 4,
- SPR_NSRUNWAY_END = SPR_AIRPORTX_BASE + 5,
- SPR_NEWHANGAR_S = SPR_AIRPORTX_BASE + 6,
- SPR_NEWHANGAR_S_WALL = SPR_AIRPORTX_BASE + 7,
- SPR_NEWHANGAR_W = SPR_AIRPORTX_BASE + 8,
- SPR_NEWHANGAR_W_WALL = SPR_AIRPORTX_BASE + 9,
- SPR_NEWHANGAR_N = SPR_AIRPORTX_BASE + 10,
- SPR_NEWHANGAR_E = SPR_AIRPORTX_BASE + 11,
- SPR_NEWHELIPAD = SPR_AIRPORTX_BASE + 12,
- SPR_GRASS_RIGHT = SPR_AIRPORTX_BASE + 13,
- SPR_GRASS_LEFT = SPR_AIRPORTX_BASE + 14,
-
- SPR_ROADSTOP_BASE = SPR_AIRPORTX_BASE + 15, // The sprites used for drive-through road stops
- SPR_BUS_STOP_DT_Y_W = SPR_ROADSTOP_BASE,
- SPR_BUS_STOP_DT_Y_E = SPR_ROADSTOP_BASE + 1,
- SPR_BUS_STOP_DT_X_W = SPR_ROADSTOP_BASE + 2,
- SPR_BUS_STOP_DT_X_E = SPR_ROADSTOP_BASE + 3,
+ SPR_NSRUNWAY1 = SPR_AIRPORTX_BASE + 1,
+ SPR_NSRUNWAY2 = SPR_AIRPORTX_BASE + 2,
+ SPR_NSRUNWAY3 = SPR_AIRPORTX_BASE + 3,
+ SPR_NSRUNWAY4 = SPR_AIRPORTX_BASE + 4,
+ SPR_NSRUNWAY_END = SPR_AIRPORTX_BASE + 5,
+ SPR_NEWHANGAR_S = SPR_AIRPORTX_BASE + 6,
+ SPR_NEWHANGAR_S_WALL = SPR_AIRPORTX_BASE + 7,
+ SPR_NEWHANGAR_W = SPR_AIRPORTX_BASE + 8,
+ SPR_NEWHANGAR_W_WALL = SPR_AIRPORTX_BASE + 9,
+ SPR_NEWHANGAR_N = SPR_AIRPORTX_BASE + 10,
+ SPR_NEWHANGAR_E = SPR_AIRPORTX_BASE + 11,
+ SPR_NEWHELIPAD = SPR_AIRPORTX_BASE + 12,
+ SPR_GRASS_RIGHT = SPR_AIRPORTX_BASE + 13,
+ SPR_GRASS_LEFT = SPR_AIRPORTX_BASE + 14,
+ AIRPORTX_SPRITE_COUNT = 15,
+
+ SPR_ROADSTOP_BASE = SPR_AIRPORTX_BASE + AIRPORTX_SPRITE_COUNT, // The sprites used for drive-through road stops
+ SPR_BUS_STOP_DT_Y_W = SPR_ROADSTOP_BASE,
+ SPR_BUS_STOP_DT_Y_E = SPR_ROADSTOP_BASE + 1,
+ SPR_BUS_STOP_DT_X_W = SPR_ROADSTOP_BASE + 2,
+ SPR_BUS_STOP_DT_X_E = SPR_ROADSTOP_BASE + 3,
SPR_TRUCK_STOP_DT_Y_W = SPR_ROADSTOP_BASE + 4,
SPR_TRUCK_STOP_DT_Y_E = SPR_ROADSTOP_BASE + 5,
SPR_TRUCK_STOP_DT_X_W = SPR_ROADSTOP_BASE + 6,
SPR_TRUCK_STOP_DT_X_E = SPR_ROADSTOP_BASE + 7,
-
- SPR_GROUP_BASE = SPR_ROADSTOP_BASE + 8, // The sprites used for the group interface
- SPR_GROUP_CREATE_TRAIN = SPR_GROUP_BASE,
- SPR_GROUP_CREATE_ROADVEH = SPR_GROUP_BASE + 1,
- SPR_GROUP_CREATE_SHIP = SPR_GROUP_BASE + 2,
- SPR_GROUP_CREATE_AIRCRAFT = SPR_GROUP_BASE + 3,
- SPR_GROUP_DELETE_TRAIN = SPR_GROUP_BASE + 4,
- SPR_GROUP_DELETE_ROADVEH = SPR_GROUP_BASE + 5,
- SPR_GROUP_DELETE_SHIP = SPR_GROUP_BASE + 6,
- SPR_GROUP_DELETE_AIRCRAFT = SPR_GROUP_BASE + 7,
- SPR_GROUP_RENAME_TRAIN = SPR_GROUP_BASE + 8,
- SPR_GROUP_RENAME_ROADVEH = SPR_GROUP_BASE + 9,
- SPR_GROUP_RENAME_SHIP = SPR_GROUP_BASE + 10,
- SPR_GROUP_RENAME_AIRCRAFT = SPR_GROUP_BASE + 11,
- SPR_GROUP_REPLACE_ON_TRAIN = SPR_GROUP_BASE + 12,
- SPR_GROUP_REPLACE_ON_ROADVEH = SPR_GROUP_BASE + 13,
- SPR_GROUP_REPLACE_ON_SHIP = SPR_GROUP_BASE + 14,
- SPR_GROUP_REPLACE_ON_AIRCRAFT = SPR_GROUP_BASE + 15,
- SPR_GROUP_REPLACE_OFF_TRAIN = SPR_GROUP_BASE + 16,
- SPR_GROUP_REPLACE_OFF_ROADVEH = SPR_GROUP_BASE + 17,
- SPR_GROUP_REPLACE_OFF_SHIP = SPR_GROUP_BASE + 18,
- SPR_GROUP_REPLACE_OFF_AIRCRAFT = SPR_GROUP_BASE + 19,
+ ROADSTOP_SPRITE_COUNT = 8,
/* Tramway sprites */
- SPR_TRAMWAY_BASE = SPR_GROUP_BASE + 20,
+ SPR_TRAMWAY_BASE = SPR_ROADSTOP_BASE + ROADSTOP_SPRITE_COUNT,
SPR_TRAMWAY_OVERLAY = SPR_TRAMWAY_BASE + 4,
SPR_TRAMWAY_TRAM = SPR_TRAMWAY_BASE + 27,
SPR_TRAMWAY_SLOPED_OFFSET = 11,
@@ -173,25 +185,22 @@ enum Sprites {
SPR_TRAMWAY_FRONT_WIRES_SLOPED = SPR_TRAMWAY_BASE + 68,
SPR_TRAMWAY_TUNNEL_WIRES = SPR_TRAMWAY_BASE + 80,
SPR_TRAMWAY_BRIDGE = SPR_TRAMWAY_BASE + 107,
+ TRAMWAY_SPRITE_COUNT = 113,
/* One way road sprites */
- SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + 113,
-
- /* 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. */
- SPR_EMPTY_BOUNDING_BOX = SPR_ONEWAY_BASE + 6,
+ SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + TRAMWAY_SPRITE_COUNT,
+ ONEWAY_SPRITE_COUNT = 6,
- /* Halftile foundations */
- SPR_HALFTILE_FOUNDATION_BASE = SPR_EMPTY_BOUNDING_BOX + 1,
- SPR_HALFTILE_BLOCK_SIZE = 4, // The sprites in halffndw.grf are organized in blocks of 4.
+ /* Flags sprites (in same order as enum NetworkLanguage) */
+ SPR_FLAGS_BASE = SPR_ONEWAY_BASE + ONEWAY_SPRITE_COUNT,
+ FLAGS_SPRITE_COUNT = 29,
- /* Halftile-selection sprites */
- SPR_HALFTILE_SELECTION_BASE = SPR_HALFTILE_FOUNDATION_BASE + 4 * SPR_HALFTILE_BLOCK_SIZE,
- SPR_HALFTILE_SELECTION_FLAT = SPR_HALFTILE_SELECTION_BASE,
- SPR_HALFTILE_SELECTION_DOWN = SPR_HALFTILE_SELECTION_BASE + 4,
- SPR_HALFTILE_SELECTION_UP = SPR_HALFTILE_SELECTION_BASE + 8,
+ /* 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. */
+ SPR_EMPTY_BOUNDING_BOX = SPR_FLAGS_BASE + FLAGS_SPRITE_COUNT,
+ EMPTY_BOUNDING_BOX_SPRITE_COUNT = 1,
- /* Flags sprites (in same order as enum NetworkLanguage) */
- SPR_FLAGS_BASE = SPR_HALFTILE_SELECTION_BASE + 12,
+ /* From where can we start putting NewGRFs? */
+ SPR_NEWGRFS_BASE = SPR_EMPTY_BOUNDING_BOX + EMPTY_BOUNDING_BOX_SPRITE_COUNT,
/* Manager face sprites */
SPR_GRADIENT = 874, // background gradient behind manager face
@@ -205,11 +214,6 @@ enum Sprites {
/* Shadow cell */
SPR_SHADOW_CELL = 1004,
- /* Sliced view shadow cells */
- /* Maybe we have different ones in the future */
- SPR_MAX_SLICE = SPR_OPENTTD_BASE + 64,
- SPR_MIN_SLICE = SPR_OPENTTD_BASE + 64,
-
/* Unmovables spritenumbers */
SPR_UNMOVABLE_TRANSMITTER = 2601,
SPR_UNMOVABLE_LIGHTHOUSE = 2602,
@@ -305,10 +309,10 @@ enum Sprites {
SPR_MGLV_TRACK_Y = 1175,
SPR_MGLV_TRACK_BASE = 1182,
SPR_MGLV_TRACK_N_S = 1199,
- SPR_WAYPOINT_X_1 = SPR_OPENTTD_BASE + 15,
- SPR_WAYPOINT_X_2 = SPR_OPENTTD_BASE + 16,
- SPR_WAYPOINT_Y_1 = SPR_OPENTTD_BASE + 17,
- SPR_WAYPOINT_Y_2 = SPR_OPENTTD_BASE + 18,
+ SPR_WAYPOINT_X_1 = SPR_OPENTTD_BASE + 78,
+ SPR_WAYPOINT_X_2 = SPR_OPENTTD_BASE + 79,
+ SPR_WAYPOINT_Y_1 = SPR_OPENTTD_BASE + 80,
+ SPR_WAYPOINT_Y_2 = SPR_OPENTTD_BASE + 81,
OFFSET_TILEH_IMPOSSIBLE = 0,
OFFSET_TILEH_1 = 14,
OFFSET_TILEH_2 = 15,
@@ -337,55 +341,55 @@ enum Sprites {
/* Wires. First identifier is the direction of the track, second is the required placement of the pylon.
* "short" denotes a wire that requires a pylon on each end. Third identifier is the direction of the slope
* (in positive coordinate direction) */
- SPR_WIRE_X_SHORT = SPR_ELRAIL_BASE + 3,
- SPR_WIRE_Y_SHORT = SPR_ELRAIL_BASE + 4,
- SPR_WIRE_EW_SHORT = SPR_ELRAIL_BASE + 5,
- SPR_WIRE_NS_SHORT = SPR_ELRAIL_BASE + 6,
- SPR_WIRE_X_SHORT_DOWN = SPR_ELRAIL_BASE + 7,
- SPR_WIRE_Y_SHORT_UP = SPR_ELRAIL_BASE + 8,
- SPR_WIRE_X_SHORT_UP = SPR_ELRAIL_BASE + 9,
- SPR_WIRE_Y_SHORT_DOWN = SPR_ELRAIL_BASE + 10,
-
- SPR_WIRE_X_SW = SPR_ELRAIL_BASE + 11,
- SPR_WIRE_Y_SE = SPR_ELRAIL_BASE + 12,
- SPR_WIRE_EW_E = SPR_ELRAIL_BASE + 13,
- SPR_WIRE_NS_S = SPR_ELRAIL_BASE + 14,
- SPR_WIRE_X_SW_DOWN = SPR_ELRAIL_BASE + 15,
- SPR_WIRE_Y_SE_UP = SPR_ELRAIL_BASE + 16,
- SPR_WIRE_X_SW_UP = SPR_ELRAIL_BASE + 17,
- SPR_WIRE_Y_SE_DOWN = SPR_ELRAIL_BASE + 18,
-
- SPR_WIRE_X_NE = SPR_ELRAIL_BASE + 19,
- SPR_WIRE_Y_NW = SPR_ELRAIL_BASE + 20,
- SPR_WIRE_EW_W = SPR_ELRAIL_BASE + 21,
- SPR_WIRE_NS_N = SPR_ELRAIL_BASE + 22,
- SPR_WIRE_X_NE_DOWN = SPR_ELRAIL_BASE + 23,
- SPR_WIRE_Y_NW_UP = SPR_ELRAIL_BASE + 24,
- SPR_WIRE_X_NE_UP = SPR_ELRAIL_BASE + 25,
- SPR_WIRE_Y_NW_DOWN = SPR_ELRAIL_BASE + 26,
+ SPR_WIRE_X_SHORT = SPR_ELRAIL_BASE + 0,
+ SPR_WIRE_Y_SHORT = SPR_ELRAIL_BASE + 1,
+ SPR_WIRE_EW_SHORT = SPR_ELRAIL_BASE + 2,
+ SPR_WIRE_NS_SHORT = SPR_ELRAIL_BASE + 3,
+ SPR_WIRE_X_SHORT_DOWN = SPR_ELRAIL_BASE + 4,
+ SPR_WIRE_Y_SHORT_UP = SPR_ELRAIL_BASE + 5,
+ SPR_WIRE_X_SHORT_UP = SPR_ELRAIL_BASE + 6,
+ SPR_WIRE_Y_SHORT_DOWN = SPR_ELRAIL_BASE + 7,
+
+ SPR_WIRE_X_SW = SPR_ELRAIL_BASE + 8,
+ SPR_WIRE_Y_SE = SPR_ELRAIL_BASE + 9,
+ SPR_WIRE_EW_E = SPR_ELRAIL_BASE + 10,
+ SPR_WIRE_NS_S = SPR_ELRAIL_BASE + 11,
+ SPR_WIRE_X_SW_DOWN = SPR_ELRAIL_BASE + 12,
+ SPR_WIRE_Y_SE_UP = SPR_ELRAIL_BASE + 13,
+ SPR_WIRE_X_SW_UP = SPR_ELRAIL_BASE + 14,
+ SPR_WIRE_Y_SE_DOWN = SPR_ELRAIL_BASE + 15,
+
+ SPR_WIRE_X_NE = SPR_ELRAIL_BASE + 16,
+ SPR_WIRE_Y_NW = SPR_ELRAIL_BASE + 17,
+ SPR_WIRE_EW_W = SPR_ELRAIL_BASE + 18,
+ SPR_WIRE_NS_N = SPR_ELRAIL_BASE + 19,
+ SPR_WIRE_X_NE_DOWN = SPR_ELRAIL_BASE + 20,
+ SPR_WIRE_Y_NW_UP = SPR_ELRAIL_BASE + 21,
+ SPR_WIRE_X_NE_UP = SPR_ELRAIL_BASE + 22,
+ SPR_WIRE_Y_NW_DOWN = SPR_ELRAIL_BASE + 23,
/* Tunnel entries */
- SPR_WIRE_TUNNEL_NE = SPR_ELRAIL_BASE + 27,
- SPR_WIRE_TUNNEL_SE = SPR_ELRAIL_BASE + 28,
- SPR_WIRE_TUNNEL_SW = SPR_ELRAIL_BASE + 29,
- SPR_WIRE_TUNNEL_NW = SPR_ELRAIL_BASE + 30,
+ SPR_WIRE_TUNNEL_NE = SPR_ELRAIL_BASE + 24,
+ SPR_WIRE_TUNNEL_SE = SPR_ELRAIL_BASE + 25,
+ SPR_WIRE_TUNNEL_SW = SPR_ELRAIL_BASE + 26,
+ SPR_WIRE_TUNNEL_NW = SPR_ELRAIL_BASE + 27,
/* Depot entries */
- SPR_WIRE_DEPOT_SW = SPR_ELRAIL_BASE + 27,
- SPR_WIRE_DEPOT_NW = SPR_ELRAIL_BASE + 28,
- SPR_WIRE_DEPOT_NE = SPR_ELRAIL_BASE + 29,
- SPR_WIRE_DEPOT_SE = SPR_ELRAIL_BASE + 30,
+ SPR_WIRE_DEPOT_SW = SPR_ELRAIL_BASE + 24,
+ SPR_WIRE_DEPOT_NW = SPR_ELRAIL_BASE + 25,
+ SPR_WIRE_DEPOT_NE = SPR_ELRAIL_BASE + 26,
+ SPR_WIRE_DEPOT_SE = SPR_ELRAIL_BASE + 27,
/* Pylons, first identifier is the direction of the track, second the placement relative to the track */
- SPR_PYLON_Y_NE = SPR_ELRAIL_BASE + 31,
- SPR_PYLON_Y_SW = SPR_ELRAIL_BASE + 32,
- SPR_PYLON_X_NW = SPR_ELRAIL_BASE + 33,
- SPR_PYLON_X_SE = SPR_ELRAIL_BASE + 34,
- SPR_PYLON_EW_N = SPR_ELRAIL_BASE + 35,
- SPR_PYLON_EW_S = SPR_ELRAIL_BASE + 36,
- SPR_PYLON_NS_W = SPR_ELRAIL_BASE + 37,
- SPR_PYLON_NS_E = SPR_ELRAIL_BASE + 38,
+ SPR_PYLON_Y_NE = SPR_ELRAIL_BASE + 28,
+ SPR_PYLON_Y_SW = SPR_ELRAIL_BASE + 29,
+ SPR_PYLON_X_NW = SPR_ELRAIL_BASE + 30,
+ SPR_PYLON_X_SE = SPR_ELRAIL_BASE + 31,
+ SPR_PYLON_EW_N = SPR_ELRAIL_BASE + 32,
+ SPR_PYLON_EW_S = SPR_ELRAIL_BASE + 33,
+ SPR_PYLON_NS_W = SPR_ELRAIL_BASE + 34,
+ SPR_PYLON_NS_E = SPR_ELRAIL_BASE + 35,
/* sprites for roads */
SPR_ROAD_PAVED_STRAIGHT_Y = 1313,
@@ -452,7 +456,7 @@ enum Sprites {
SPR_AIRPORT_RADAR_A = 2689,
SPR_AIRPORT_RADAR_B = 2690,
SPR_AIRPORT_RADAR_C = 2691,
- SPR_AIRPORT_HELIPAD = SPR_OPENTTD_BASE + 28,
+ SPR_AIRPORT_HELIPAD = SPR_OPENTTD_BASE + 82,
SPR_AIRPORT_HELIDEPOT_OFFICE = 2095,
/* Road Stops */
@@ -566,40 +570,42 @@ enum Sprites {
SPR_SHIP_DEPOT_SE_REAR = 4074,
SPR_SHIP_DEPOT_SW_REAR = 4075,
//here come sloped water sprites
- SPR_WATER_SLOPE_Y_UP = SPR_CANALS_BASE + 5, //Water flowing negative Y direction
- SPR_WATER_SLOPE_X_DOWN = SPR_CANALS_BASE + 6, //positive X
- SPR_WATER_SLOPE_X_UP = SPR_CANALS_BASE + 7, //negative X
- SPR_WATER_SLOPE_Y_DOWN = SPR_CANALS_BASE + 8, //positive Y
+ SPR_WATER_SLOPE_Y_UP = SPR_CANALS_BASE + 0, //Water flowing negative Y direction
+ SPR_WATER_SLOPE_X_DOWN = SPR_CANALS_BASE + 1, //positive X
+ SPR_WATER_SLOPE_X_UP = SPR_CANALS_BASE + 2, //negative X
+ SPR_WATER_SLOPE_Y_DOWN = SPR_CANALS_BASE + 3, //positive Y
//sprites for the shiplifts
//there are 4 kinds of shiplifts, each of them is 3 tiles long.
//the four kinds are running in the X and Y direction and
//are "lowering" either in the "+" or the "-" direction.
//the three tiles are the center tile (where the slope is)
//and a bottom and a top tile
- SPR_SHIPLIFT_Y_UP_CENTER_REAR = SPR_CANALS_BASE + 9,
- SPR_SHIPLIFT_X_DOWN_CENTER_REAR = SPR_CANALS_BASE + 10,
- SPR_SHIPLIFT_X_UP_CENTER_REAR = SPR_CANALS_BASE + 11,
- SPR_SHIPLIFT_Y_DOWN_CENTER_REAR = SPR_CANALS_BASE + 12,
- SPR_SHIPLIFT_Y_UP_CENTER_FRONT = SPR_CANALS_BASE + 13,
- SPR_SHIPLIFT_X_DOWN_CENTER_FRONT = SPR_CANALS_BASE + 14,
- SPR_SHIPLIFT_X_UP_CENTER_FRONT = SPR_CANALS_BASE + 15,
- SPR_SHIPLIFT_Y_DOWN_CENTER_FRONT = SPR_CANALS_BASE + 16,
- SPR_SHIPLIFT_Y_UP_BOTTOM_REAR = SPR_CANALS_BASE + 17,
- SPR_SHIPLIFT_X_DOWN_BOTTOM_REAR = SPR_CANALS_BASE + 18,
- SPR_SHIPLIFT_X_UP_BOTTOM_REAR = SPR_CANALS_BASE + 19,
- SPR_SHIPLIFT_Y_DOWN_BOTTOM_REAR = SPR_CANALS_BASE + 20,
- SPR_SHIPLIFT_Y_UP_BOTTOM_FRONT = SPR_CANALS_BASE + 21,
- SPR_SHIPLIFT_X_DOWN_BOTTOM_FRONT = SPR_CANALS_BASE + 22,
- SPR_SHIPLIFT_X_UP_BOTTOM_FRONT = SPR_CANALS_BASE + 23,
- SPR_SHIPLIFT_Y_DOWN_BOTTOM_FRONT = SPR_CANALS_BASE + 24,
- SPR_SHIPLIFT_Y_UP_TOP_REAR = SPR_CANALS_BASE + 25,
- SPR_SHIPLIFT_X_DOWN_TOP_REAR = SPR_CANALS_BASE + 26,
- SPR_SHIPLIFT_X_UP_TOP_REAR = SPR_CANALS_BASE + 27,
- SPR_SHIPLIFT_Y_DOWN_TOP_REAR = SPR_CANALS_BASE + 28,
- SPR_SHIPLIFT_Y_UP_TOP_FRONT = SPR_CANALS_BASE + 29,
- SPR_SHIPLIFT_X_DOWN_TOP_FRONT = SPR_CANALS_BASE + 30,
- SPR_SHIPLIFT_X_UP_TOP_FRONT = SPR_CANALS_BASE + 31,
- SPR_SHIPLIFT_Y_DOWN_TOP_FRONT = SPR_CANALS_BASE + 32,
+ SPR_SHIPLIFT_BASE = SPR_CANALS_BASE + 4,
+ SPR_SHIPLIFT_Y_UP_CENTER_REAR = SPR_CANALS_BASE + 4,
+ SPR_SHIPLIFT_X_DOWN_CENTER_REAR = SPR_CANALS_BASE + 5,
+ SPR_SHIPLIFT_X_UP_CENTER_REAR = SPR_CANALS_BASE + 6,
+ SPR_SHIPLIFT_Y_DOWN_CENTER_REAR = SPR_CANALS_BASE + 7,
+ SPR_SHIPLIFT_Y_UP_CENTER_FRONT = SPR_CANALS_BASE + 8,
+ SPR_SHIPLIFT_X_DOWN_CENTER_FRONT = SPR_CANALS_BASE + 9,
+ SPR_SHIPLIFT_X_UP_CENTER_FRONT = SPR_CANALS_BASE + 10,
+ SPR_SHIPLIFT_Y_DOWN_CENTER_FRONT = SPR_CANALS_BASE + 11,
+ SPR_SHIPLIFT_Y_UP_BOTTOM_REAR = SPR_CANALS_BASE + 12,
+ SPR_SHIPLIFT_X_DOWN_BOTTOM_REAR = SPR_CANALS_BASE + 13,
+ SPR_SHIPLIFT_X_UP_BOTTOM_REAR = SPR_CANALS_BASE + 14,
+ SPR_SHIPLIFT_Y_DOWN_BOTTOM_REAR = SPR_CANALS_BASE + 15,
+ SPR_SHIPLIFT_Y_UP_BOTTOM_FRONT = SPR_CANALS_BASE + 16,
+ SPR_SHIPLIFT_X_DOWN_BOTTOM_FRONT = SPR_CANALS_BASE + 17,
+ SPR_SHIPLIFT_X_UP_BOTTOM_FRONT = SPR_CANALS_BASE + 18,
+ SPR_SHIPLIFT_Y_DOWN_BOTTOM_FRONT = SPR_CANALS_BASE + 19,
+ SPR_SHIPLIFT_Y_UP_TOP_REAR = SPR_CANALS_BASE + 20,
+ SPR_SHIPLIFT_X_DOWN_TOP_REAR = SPR_CANALS_BASE + 21,
+ SPR_SHIPLIFT_X_UP_TOP_REAR = SPR_CANALS_BASE + 22,
+ SPR_SHIPLIFT_Y_DOWN_TOP_REAR = SPR_CANALS_BASE + 23,
+ SPR_SHIPLIFT_Y_UP_TOP_FRONT = SPR_CANALS_BASE + 24,
+ SPR_SHIPLIFT_X_DOWN_TOP_FRONT = SPR_CANALS_BASE + 25,
+ SPR_SHIPLIFT_X_UP_TOP_FRONT = SPR_CANALS_BASE + 26,
+ SPR_SHIPLIFT_Y_DOWN_TOP_FRONT = SPR_CANALS_BASE + 27,
+ SPR_CANAL_DIKES_BASE = SPR_CANALS_BASE + 52,
/* Sprites for tunnels and bridges */
SPR_TUNNEL_ENTRY_REAR_RAIL = 2365,
@@ -613,7 +619,7 @@ enum Sprites {
SPR_CROSSING_OFF_X_MAGLEV = 1394,
/* bridge type sprites */
- SPR_PILLARS_BASE = SPR_OPENTTD_BASE + 30,
+ SPR_PILLARS_BASE = SPR_OPENTTD_BASE + 14,
/* Wooden bridge (type 0) */
SPR_BTWDN_RAIL_Y_REAR = 2545,
@@ -1012,11 +1018,11 @@ enum Sprites {
SPR_IMG_ROCKS = 4084,
SPR_IMG_LIGHTHOUSE_DESERT = 4085, // XXX - is Desert image on the desert-climate
SPR_IMG_TRANSMITTER = 4086,
- SPR_IMG_LEVEL_LAND = SPR_OPENTTD_BASE + 61,
- SPR_IMG_BUILD_CANAL = SPR_OPENTTD_BASE + 58,
- SPR_IMG_BUILD_LOCK = SPR_CANALS_BASE + 69,
+ SPR_IMG_LEVEL_LAND = SPR_OPENTTD_BASE + 91,
+ SPR_IMG_BUILD_CANAL = SPR_OPENTTD_BASE + 88,
+ SPR_IMG_BUILD_LOCK = SPR_CANALS_BASE + 64,
SPR_IMG_PAUSE = 726,
- SPR_IMG_FASTFORWARD = SPR_OPENTTD_BASE + 54,
+ SPR_IMG_FASTFORWARD = SPR_OPENTTD_BASE + 90,
SPR_IMG_SETTINGS = 751,
SPR_IMG_SAVE = 724,
SPR_IMG_SMALLMAP = 708,
@@ -1052,8 +1058,8 @@ enum Sprites {
/* OPEN TRANSPORT TYCOON in gamescreen */
SPR_OTTD_O = 4842,
SPR_OTTD_P = 4841,
- SPR_OTTD_E = SPR_OPENTTD_BASE + 13,
- SPR_OTTD_D = SPR_OPENTTD_BASE + 14,
+ SPR_OTTD_E = SPR_OPENTTD_BASE + 12,
+ SPR_OTTD_D = SPR_OPENTTD_BASE + 13,
SPR_OTTD_N = 4839,
SPR_OTTD_T = 4836,
SPR_OTTD_R = 4837,
@@ -1202,11 +1208,11 @@ enum Sprites {
SPR_BUBBLE_ABSORB_4 = 4762,
/* Electrified rail build menu */
- SPR_BUILD_NS_ELRAIL = SPR_ELRAIL_BASE + 39,
- SPR_BUILD_X_ELRAIL = SPR_ELRAIL_BASE + 40,
- SPR_BUILD_EW_ELRAIL = SPR_ELRAIL_BASE + 41,
- SPR_BUILD_Y_ELRAIL = SPR_ELRAIL_BASE + 42,
- SPR_BUILD_TUNNEL_ELRAIL = SPR_ELRAIL_BASE + 47,
+ SPR_BUILD_NS_ELRAIL = SPR_ELRAIL_BASE + 36,
+ SPR_BUILD_X_ELRAIL = SPR_ELRAIL_BASE + 37,
+ SPR_BUILD_EW_ELRAIL = SPR_ELRAIL_BASE + 38,
+ SPR_BUILD_Y_ELRAIL = SPR_ELRAIL_BASE + 39,
+ SPR_BUILD_TUNNEL_ELRAIL = SPR_ELRAIL_BASE + 44,
/* airport_gui.c */
SPR_IMG_AIRPORT = 744,
@@ -1225,7 +1231,7 @@ enum Sprites {
/* road_gui.c */
SPR_IMG_ROAD_NW = 1309,
SPR_IMG_ROAD_NE = 1310,
- SPR_IMG_AUTOROAD = SPR_OPENTTD_BASE + 112,
+ SPR_IMG_AUTOROAD = SPR_OPENTTD_BASE + 82,
SPR_IMG_ROAD_DEPOT = 1295,
SPR_IMG_BUS_STATION = 749,
SPR_IMG_TRUCK_BAY = 750,
@@ -1234,24 +1240,24 @@ enum Sprites {
SPR_IMG_REMOVE = 714,
SPR_IMG_TRAMWAY_NW = SPR_TRAMWAY_BASE + 0,
SPR_IMG_TRAMWAY_NE = SPR_TRAMWAY_BASE + 1,
- SPR_IMG_AUTOTRAM = SPR_OPENTTD_BASE + 114,
+ SPR_IMG_AUTOTRAM = SPR_OPENTTD_BASE + 84,
/* rail_gui.c */
SPR_IMG_RAIL_NS = 1251,
SPR_IMG_RAIL_NE = 1252,
SPR_IMG_RAIL_EW = 1253,
SPR_IMG_RAIL_NW = 1254,
- SPR_IMG_AUTORAIL = SPR_OPENTTD_BASE + 0,
- SPR_IMG_AUTOELRAIL = SPR_OPENTTD_BASE + 116,
- SPR_IMG_AUTOMONO = SPR_OPENTTD_BASE + 1,
- SPR_IMG_AUTOMAGLEV = SPR_OPENTTD_BASE + 2,
+ SPR_IMG_AUTORAIL = SPR_OPENTTD_BASE + 53,
+ SPR_IMG_AUTOELRAIL = SPR_OPENTTD_BASE + 57,
+ SPR_IMG_AUTOMONO = SPR_OPENTTD_BASE + 63,
+ SPR_IMG_AUTOMAGLEV = SPR_OPENTTD_BASE + 69,
- SPR_IMG_WAYPOINT = SPR_OPENTTD_BASE + 3,
+ SPR_IMG_WAYPOINT = SPR_OPENTTD_BASE + 76,
SPR_IMG_DEPOT_RAIL = 1294,
- SPR_IMG_DEPOT_ELRAIL = SPR_OPENTTD_BASE + 120,
- SPR_IMG_DEPOT_MONO = SPR_OPENTTD_BASE + 9,
- SPR_IMG_DEPOT_MAGLEV = SPR_OPENTTD_BASE + 10,
+ SPR_IMG_DEPOT_ELRAIL = SPR_OPENTTD_BASE + 61,
+ SPR_IMG_DEPOT_MONO = SPR_OPENTTD_BASE + 67,
+ SPR_IMG_DEPOT_MAGLEV = SPR_OPENTTD_BASE + 73,
SPR_IMG_RAIL_STATION = 1298,
SPR_IMG_RAIL_SIGNALS = 1291,
@@ -1260,10 +1266,10 @@ enum Sprites {
SPR_IMG_TUNNEL_MONO = 2431,
SPR_IMG_TUNNEL_MAGLEV = 2432,
- SPR_IMG_CONVERT_RAIL = SPR_OPENTTD_BASE + 22,
- SPR_IMG_CONVERT_ELRAIL = SPR_OPENTTD_BASE + 118,
- SPR_IMG_CONVERT_MONO = SPR_OPENTTD_BASE + 24,
- SPR_IMG_CONVERT_MAGLEV = SPR_OPENTTD_BASE + 26,
+ SPR_IMG_CONVERT_RAIL = SPR_OPENTTD_BASE + 55,
+ SPR_IMG_CONVERT_ELRAIL = SPR_OPENTTD_BASE + 59,
+ SPR_IMG_CONVERT_MONO = SPR_OPENTTD_BASE + 65,
+ SPR_IMG_CONVERT_MAGLEV = SPR_OPENTTD_BASE + 71,
/* intro_gui.c, genworld_gui.c */
SPR_SELECT_TEMPERATE = 4882,
@@ -1290,7 +1296,7 @@ enum CursorSprite {
SPR_CURSOR_TREE = 2010,
SPR_CURSOR_BUY_LAND = 4792,
- SPR_CURSOR_LEVEL_LAND = SPR_OPENTTD_BASE + 62,
+ SPR_CURSOR_LEVEL_LAND = SPR_OPENTTD_BASE + 92,
SPR_CURSOR_TOWN = 4080,
SPR_CURSOR_INDUSTRY = 4081,
@@ -1303,8 +1309,8 @@ enum CursorSprite {
/* dock cursors */
SPR_CURSOR_DOCK = 3668,
- SPR_CURSOR_CANAL = SPR_OPENTTD_BASE + 8,
- SPR_CURSOR_LOCK = SPR_OPENTTD_BASE + 57,
+ SPR_CURSOR_CANAL = SPR_OPENTTD_BASE + 89,
+ SPR_CURSOR_LOCK = SPR_OPENTTD_BASE + 87,
/* shared road & rail cursors */
SPR_CURSOR_BRIDGE = 2593,
@@ -1325,52 +1331,52 @@ enum CursorSprite {
SPR_CURSOR_EW_MAGLEV = 1273,
SPR_CURSOR_NWSE_MAGLEV = 1274,
- SPR_CURSOR_NS_ELRAIL = SPR_ELRAIL_BASE + 43,
- SPR_CURSOR_SWNE_ELRAIL = SPR_ELRAIL_BASE + 44,
- SPR_CURSOR_EW_ELRAIL = SPR_ELRAIL_BASE + 45,
- SPR_CURSOR_NWSE_ELRAIL = SPR_ELRAIL_BASE + 46,
+ SPR_CURSOR_NS_ELRAIL = SPR_ELRAIL_BASE + 40,
+ SPR_CURSOR_SWNE_ELRAIL = SPR_ELRAIL_BASE + 41,
+ SPR_CURSOR_EW_ELRAIL = SPR_ELRAIL_BASE + 42,
+ SPR_CURSOR_NWSE_ELRAIL = SPR_ELRAIL_BASE + 43,
SPR_CURSOR_RAIL_STATION = 1300,
SPR_CURSOR_TUNNEL_RAIL = 2434,
- SPR_CURSOR_TUNNEL_ELRAIL = SPR_ELRAIL_BASE + 48,
+ SPR_CURSOR_TUNNEL_ELRAIL = SPR_ELRAIL_BASE + 45,
SPR_CURSOR_TUNNEL_MONO = 2435,
SPR_CURSOR_TUNNEL_MAGLEV = 2436,
- SPR_CURSOR_AUTORAIL = SPR_OPENTTD_BASE + 4,
- SPR_CURSOR_AUTOELRAIL = SPR_OPENTTD_BASE + 117,
- SPR_CURSOR_AUTOMONO = SPR_OPENTTD_BASE + 5,
- SPR_CURSOR_AUTOMAGLEV = SPR_OPENTTD_BASE + 6,
+ SPR_CURSOR_AUTORAIL = SPR_OPENTTD_BASE + 54,
+ SPR_CURSOR_AUTOELRAIL = SPR_OPENTTD_BASE + 58,
+ SPR_CURSOR_AUTOMONO = SPR_OPENTTD_BASE + 64,
+ SPR_CURSOR_AUTOMAGLEV = SPR_OPENTTD_BASE + 70,
- SPR_CURSOR_WAYPOINT = SPR_OPENTTD_BASE + 7,
+ SPR_CURSOR_WAYPOINT = SPR_OPENTTD_BASE + 77,
SPR_CURSOR_RAIL_DEPOT = 1296,
- SPR_CURSOR_ELRAIL_DEPOT = SPR_OPENTTD_BASE + 121,
- SPR_CURSOR_MONO_DEPOT = SPR_OPENTTD_BASE + 11,
- SPR_CURSOR_MAGLEV_DEPOT = SPR_OPENTTD_BASE + 12,
+ SPR_CURSOR_ELRAIL_DEPOT = SPR_OPENTTD_BASE + 62,
+ SPR_CURSOR_MONO_DEPOT = SPR_OPENTTD_BASE + 68,
+ SPR_CURSOR_MAGLEV_DEPOT = SPR_OPENTTD_BASE + 74,
- SPR_CURSOR_CONVERT_RAIL = SPR_OPENTTD_BASE + 23,
- SPR_CURSOR_CONVERT_ELRAIL = SPR_OPENTTD_BASE + 119,
- SPR_CURSOR_CONVERT_MONO = SPR_OPENTTD_BASE + 25,
- SPR_CURSOR_CONVERT_MAGLEV = SPR_OPENTTD_BASE + 27,
+ SPR_CURSOR_CONVERT_RAIL = SPR_OPENTTD_BASE + 56,
+ SPR_CURSOR_CONVERT_ELRAIL = SPR_OPENTTD_BASE + 60,
+ SPR_CURSOR_CONVERT_MONO = SPR_OPENTTD_BASE + 66,
+ SPR_CURSOR_CONVERT_MAGLEV = SPR_OPENTTD_BASE + 72,
/* road cursors */
SPR_CURSOR_ROAD_NESW = 1311,
SPR_CURSOR_ROAD_NWSE = 1312,
- SPR_CURSOR_AUTOROAD = SPR_OPENTTD_BASE + 113,
+ SPR_CURSOR_AUTOROAD = SPR_OPENTTD_BASE + 83,
SPR_CURSOR_TRAMWAY_NESW = SPR_TRAMWAY_BASE + 2,
SPR_CURSOR_TRAMWAY_NWSE = SPR_TRAMWAY_BASE + 3,
- SPR_CURSOR_AUTOTRAM = SPR_OPENTTD_BASE + 115,
+ SPR_CURSOR_AUTOTRAM = SPR_OPENTTD_BASE + 85,
SPR_CURSOR_ROAD_DEPOT = 1297,
SPR_CURSOR_BUS_STATION = 2725,
SPR_CURSOR_TRUCK_STATION = 2726,
SPR_CURSOR_ROAD_TUNNEL = 2433,
- SPR_CURSOR_CLONE_TRAIN = SPR_OPENTTD_BASE + 88,
- SPR_CURSOR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 105,
- SPR_CURSOR_CLONE_SHIP = SPR_OPENTTD_BASE + 107,
- SPR_CURSOR_CLONE_AIRPLANE = SPR_OPENTTD_BASE + 109
+ SPR_CURSOR_CLONE_TRAIN = SPR_OPENTTD_BASE + 110,
+ SPR_CURSOR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 111,
+ SPR_CURSOR_CLONE_SHIP = SPR_OPENTTD_BASE + 112,
+ SPR_CURSOR_CLONE_AIRPLANE = SPR_OPENTTD_BASE + 113,
};
/// Animation macro in table/animcursors.h (_animcursors[])
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 14b570dd7..ce6329ca0 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -378,7 +378,7 @@ void DrawCanalWater(TileIndex tile)
/* Test for custom graphics, else use the default */
SpriteID dikes_base = GetCanalSprite(CF_DIKES, tile);
- if (dikes_base == 0) dikes_base = SPR_CANALS_BASE + 57;
+ if (dikes_base == 0) dikes_base = SPR_CANAL_DIKES_BASE;
/* determine the edges around with water. */
wa = IsWateredTile(TILE_ADDXY(tile, -1, 0)) << 0;
@@ -433,9 +433,9 @@ static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
SpriteID locks_base = GetCanalSprite(CF_LOCKS, ti->tile);
/* If no custom graphics, use defaults */
- if (water_base == 0) water_base = SPR_CANALS_BASE + 5;
+ if (water_base == 0) water_base = SPR_CANALS_BASE;
if (locks_base == 0) {
- locks_base = SPR_CANALS_BASE + 9;
+ locks_base = SPR_SHIPLIFT_BASE;
} else {
/* If using custom graphics, ignore the variation on height */
base = 0;