(svn r7325) -Feature: Add support for action 5 type 0x0D, coast sprites.

This commit is contained in:
peter1138 2006-12-02 09:54:49 +00:00
parent 0d5b0eb4f7
commit 6a4d8fdd33
3 changed files with 17 additions and 1 deletions

View File

@ -43,6 +43,7 @@
static int _skip_sprites; // XXX static int _skip_sprites; // XXX
static uint _file_index; // XXX static uint _file_index; // XXX
SpriteID _signal_base; SpriteID _signal_base;
SpriteID _coast_base;
static GRFFile *_cur_grffile; static GRFFile *_cur_grffile;
GRFFile *_first_grffile; GRFFile *_first_grffile;
@ -2159,6 +2160,14 @@ static void GraphicsNew(byte *buf, int len)
replace = SPR_CANALS_BASE + 5; replace = SPR_CANALS_BASE + 5;
break; break;
case 0x0D: /* Coast graphics */
if (num != 16) {
grfmsg(GMS_WARN, "GraphicsNews: Coast graphics sprite count must be 16, skipping.");
return;
}
_coast_base = _cur_spriteid;
break;
default: default:
grfmsg(GMS_NOTICE, "GraphicsNew: Custom graphics (type 0x%02X) sprite block of length %u (unimplemented, ignoring).\n", grfmsg(GMS_NOTICE, "GraphicsNew: Custom graphics (type 0x%02X) sprite block of length %u (unimplemented, ignoring).\n",
type, num); type, num);
@ -3326,6 +3335,7 @@ static void ResetNewGRFData(void)
_traininfo_vehicle_width = 29; _traininfo_vehicle_width = 29;
_have_2cc = false; _have_2cc = false;
_signal_base = 0; _signal_base = 0;
_coast_base = 0;
InitializeSoundPool(); InitializeSoundPool();
InitializeSpriteGroupPool(); InitializeSpriteGroupPool();

View File

@ -61,6 +61,7 @@ typedef struct GRFConfig {
extern GRFConfig *_first_grfconfig; extern GRFConfig *_first_grfconfig;
extern SpriteID _signal_base; extern SpriteID _signal_base;
extern SpriteID _coast_base;
extern bool _have_2cc; extern bool _have_2cc;
void LoadNewGRF(uint load_index, uint file_index); void LoadNewGRF(uint load_index, uint file_index);

View File

@ -19,6 +19,7 @@
#include "vehicle_gui.h" #include "vehicle_gui.h"
#include "train.h" #include "train.h"
#include "water_map.h" #include "water_map.h"
#include "newgrf.h"
const SpriteID _water_shore_sprites[15] = { const SpriteID _water_shore_sprites[15] = {
0, 0,
@ -452,7 +453,11 @@ static void DrawTile_Water(TileInfo *ti)
case WATER_COAST: case WATER_COAST:
assert(!IsSteepSlope(ti->tileh)); assert(!IsSteepSlope(ti->tileh));
DrawGroundSprite(_water_shore_sprites[ti->tileh]); if (_coast_base != 0) {
DrawGroundSprite(_coast_base + ti->tileh);
} else {
DrawGroundSprite(_water_shore_sprites[ti->tileh]);
}
break; break;
case WATER_LOCK: { case WATER_LOCK: {