diff options
author | rubidium <rubidium@openttd.org> | 2007-10-20 21:39:50 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-20 21:39:50 +0000 |
commit | 1d9542ce2d69ddccdf6c03ca5936e33b7107ef54 (patch) | |
tree | bde509eab266c280a8bc2b89c5cefb919aee7a8e /src/newgrf.cpp | |
parent | d1a51ebb36c8e217c3c3ea6844532202bd2dd1c4 (diff) | |
download | openttd-1d9542ce2d69ddccdf6c03ca5936e33b7107ef54.tar.xz |
(svn r11321) -Codechange: add support to load different graphics for halftile slopes using a NewGRF. Patch by frosch.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f8d5b788c..307fc48ed 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -45,6 +45,8 @@ #include "newgrf_commons.h" #include "newgrf_townname.h" #include "newgrf_industries.h" +#include "table/landscape_sprite.h" +#include "gfxinit.h" /* TTDPatch extended GRF format codec * (c) Petr Baudis 2004 (GPL'd) @@ -3232,6 +3234,7 @@ static void GraphicsNew(byte *buf, int len) /* TODO */ SpriteID replace = 0; + const SpriteID *index_tbl = NULL; if (!check_length(len, 2, "GraphicsNew")) return; buf++; @@ -3256,11 +3259,13 @@ static void GraphicsNew(byte *buf, int len) break; case 0x06: // Foundations - if (num != 74) { - grfmsg(1, "GraphicsNew: Foundation graphics sprite count must be 74, skipping"); - return; + 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; } - replace = SPR_SLOPES_BASE; break; case 0x08: // Canal graphics @@ -3326,6 +3331,12 @@ 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 { |