mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-08 23:19:40 +00:00
(svn r4719) - Newstations: instead of drawing nothing, fall back to the default sprite layout if a station layout specifies so.
This commit is contained in:
parent
6b01384faf
commit
76411cef63
20
newgrf.c
20
newgrf.c
@ -810,12 +810,9 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||||||
uint seq_count = 0;
|
uint seq_count = 0;
|
||||||
PalSpriteID ground_sprite;
|
PalSpriteID ground_sprite;
|
||||||
|
|
||||||
|
dts->seq = NULL;
|
||||||
ground_sprite = grf_load_dword(&buf);
|
ground_sprite = grf_load_dword(&buf);
|
||||||
if (ground_sprite == 0) {
|
if (ground_sprite == 0) continue;
|
||||||
static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
|
|
||||||
dts->seq = ∅
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HASBIT(ground_sprite, 31)) {
|
if (HASBIT(ground_sprite, 31)) {
|
||||||
// Bit 31 indicates that we should use a custom sprite.
|
// Bit 31 indicates that we should use a custom sprite.
|
||||||
@ -825,7 +822,6 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||||||
dts->ground_sprite = ground_sprite;
|
dts->ground_sprite = ground_sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
dts->seq = NULL;
|
|
||||||
while (buf < *bufp + len) {
|
while (buf < *bufp + len) {
|
||||||
DrawTileSeqStruct *dtss;
|
DrawTileSeqStruct *dtss;
|
||||||
|
|
||||||
@ -861,15 +857,11 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||||||
DrawTileSeqStruct const *sdtss = sdts->seq;
|
DrawTileSeqStruct const *sdtss = sdts->seq;
|
||||||
int seq_count = 0;
|
int seq_count = 0;
|
||||||
|
|
||||||
dts->ground_sprite = sdts->ground_sprite;
|
|
||||||
if (dts->ground_sprite == 0) {
|
|
||||||
static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
|
|
||||||
dts->seq = ∅
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dts->seq = NULL;
|
dts->seq = NULL;
|
||||||
while (1) {
|
dts->ground_sprite = sdts->ground_sprite;
|
||||||
|
if (dts->ground_sprite == 0) continue;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
DrawTileSeqStruct *dtss;
|
DrawTileSeqStruct *dtss;
|
||||||
|
|
||||||
// no relative bounding box support
|
// no relative bounding box support
|
||||||
|
27
rail_cmd.c
27
rail_cmd.c
@ -1335,21 +1335,24 @@ static void DrawTile_Track(TileInfo *ti)
|
|||||||
* should be drawn in company colors, and it's
|
* should be drawn in company colors, and it's
|
||||||
* up to the GRF file to decide that. */
|
* up to the GRF file to decide that. */
|
||||||
|
|
||||||
image = cust->ground_sprite;
|
/* If there is no sprite layout, we fall back to the default waypoint graphics. */
|
||||||
image += (image < _custom_sprites_base) ? rti->total_offset : rti->custom_ground_offset;
|
if (cust != NULL && cust->seq != NULL) {
|
||||||
|
image = cust->ground_sprite;
|
||||||
|
image += (image < _custom_sprites_base) ? rti->total_offset : rti->custom_ground_offset;
|
||||||
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
||||||
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
|
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
|
||||||
|
|
||||||
foreach_draw_tile_seq(seq, cust->seq) {
|
foreach_draw_tile_seq(seq, cust->seq) {
|
||||||
DrawSpecialBuilding(
|
DrawSpecialBuilding(
|
||||||
seq->image + relocation, 0, ti,
|
seq->image + relocation, 0, ti,
|
||||||
seq->delta_x, seq->delta_y, seq->delta_z,
|
seq->delta_x, seq->delta_y, seq->delta_z,
|
||||||
seq->width, seq->height, seq->unk
|
seq->width, seq->height, seq->unk
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,7 +1360,7 @@ static void DrawTile_Track(TileInfo *ti)
|
|||||||
|
|
||||||
image = drss++->image;
|
image = drss++->image;
|
||||||
/* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates
|
/* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates
|
||||||
* whether the sprite is railtype dependent. Rewrite this asap */
|
* whether the sprite is railtype dependent. Rewrite this asap */
|
||||||
if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset;
|
if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset;
|
||||||
|
|
||||||
// adjust ground tile for desert
|
// adjust ground tile for desert
|
||||||
|
@ -1996,7 +1996,7 @@ static void DrawTile_Station(TileInfo *ti)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t == NULL) t = &_station_display_datas[GetStationGfx(ti->tile)];
|
if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationGfx(ti->tile)];
|
||||||
|
|
||||||
image = t->ground_sprite;
|
image = t->ground_sprite;
|
||||||
if (image & PALETTE_MODIFIER_COLOR) image |= image_or_modificator;
|
if (image & PALETTE_MODIFIER_COLOR) image |= image_or_modificator;
|
||||||
|
Loading…
Reference in New Issue
Block a user