mirror of https://github.com/OpenTTD/OpenTTD
Codefix: Sprite offsets and counts are not SpriteIDs. (#13336)
parent
0aa9faf187
commit
d22fd78b1c
|
@ -442,9 +442,9 @@ void DrawFoundation(TileInfo *ti, Foundation f)
|
|||
if (!HasFoundationNE(ti->tile, slope, z)) sprite_block += 2;
|
||||
|
||||
/* Use the original slope sprites if NW and NE borders should be visible */
|
||||
SpriteID leveled_base = (sprite_block == 0 ? (int)SPR_FOUNDATION_BASE : (SPR_SLOPES_VIRTUAL_BASE + sprite_block * SPR_TRKFOUND_BLOCK_SIZE));
|
||||
SpriteID inclined_base = SPR_SLOPES_VIRTUAL_BASE + SPR_SLOPES_INCLINED_OFFSET + sprite_block * SPR_TRKFOUND_BLOCK_SIZE;
|
||||
SpriteID halftile_base = SPR_HALFTILE_FOUNDATION_BASE + sprite_block * SPR_HALFTILE_BLOCK_SIZE;
|
||||
SpriteID leveled_base = (sprite_block == 0 ? (int)SPR_FOUNDATION_BASE : (SPR_SLOPES_VIRTUAL_BASE + sprite_block * TRKFOUND_BLOCK_SIZE));
|
||||
SpriteID inclined_base = SPR_SLOPES_VIRTUAL_BASE + SLOPES_INCLINED_OFFSET + sprite_block * TRKFOUND_BLOCK_SIZE;
|
||||
SpriteID halftile_base = SPR_HALFTILE_FOUNDATION_BASE + sprite_block * HALFTILE_BLOCK_SIZE;
|
||||
|
||||
if (IsSteepSlope(ti->tileh)) {
|
||||
if (!IsNonContinuousFoundation(f)) {
|
||||
|
|
|
@ -6448,7 +6448,7 @@ static constexpr auto _action5_types = std::to_array<Action5Type>({
|
|||
/* 0x0A */ { A5BLOCK_ALLOW_OFFSET, SPR_2CCMAP_BASE, 1, TWOCCMAP_SPRITE_COUNT, "2CC colour maps" },
|
||||
/* 0x0B */ { A5BLOCK_ALLOW_OFFSET, SPR_TRAMWAY_BASE, 1, TRAMWAY_SPRITE_COUNT, "Tramway graphics" },
|
||||
/* 0x0C */ { A5BLOCK_INVALID, 0, 133, 0, "Snowy temperate tree" }, // Not yet used by OTTD.
|
||||
/* 0x0D */ { A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SPR_SHORE_SPRITE_COUNT, "Shore graphics" },
|
||||
/* 0x0D */ { A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SHORE_SPRITE_COUNT, "Shore graphics" },
|
||||
/* 0x0E */ { A5BLOCK_INVALID, 0, 0, 0, "New Signals graphics" }, // Not yet used by OTTD.
|
||||
/* 0x0F */ { A5BLOCK_ALLOW_OFFSET, SPR_TRACKS_FOR_SLOPES_BASE, 1, TRACKS_FOR_SLOPES_SPRITE_COUNT, "Sloped rail track" },
|
||||
/* 0x10 */ { A5BLOCK_ALLOW_OFFSET, SPR_AIRPORTX_BASE, 1, AIRPORTX_SPRITE_COUNT, "Airport graphics" },
|
||||
|
@ -6457,7 +6457,7 @@ static constexpr auto _action5_types = std::to_array<Action5Type>({
|
|||
/* 0x13 */ { A5BLOCK_ALLOW_OFFSET, SPR_AUTORAIL_BASE, 1, AUTORAIL_SPRITE_COUNT, "Autorail graphics" },
|
||||
/* 0x14 */ { A5BLOCK_INVALID, 0, 1, 0, "Flag graphics" }, // deprecated, no longer used.
|
||||
/* 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" },
|
||||
/* 0x16 */ { A5BLOCK_ALLOW_OFFSET, SPR_AIRPORT_PREVIEW_BASE, 1, AIRPORT_PREVIEW_SPRITE_COUNT, "Airport preview graphics" },
|
||||
/* 0x17 */ { A5BLOCK_ALLOW_OFFSET, SPR_RAILTYPE_TUNNEL_BASE, 1, RAILTYPE_TUNNEL_BASE_COUNT, "Railtype tunnel base" },
|
||||
/* 0x18 */ { A5BLOCK_ALLOW_OFFSET, SPR_PALETTE_BASE, 1, PALETTE_SPRITE_COUNT, "Palette" },
|
||||
/* 0x19 */ { A5BLOCK_ALLOW_OFFSET, SPR_ROAD_WAYPOINTS_BASE, 1, ROAD_WAYPOINTS_SPRITE_COUNT, "Road waypoints" },
|
||||
|
@ -6546,15 +6546,15 @@ static void GraphicsNew(ByteReader &buf)
|
|||
}
|
||||
|
||||
/* If the baseset or grf only provides sprites for flat tiles (pre #10282), duplicate those for use on slopes. */
|
||||
bool dup_oneway_sprites = ((type == 0x09) && (offset + num <= SPR_ONEWAY_SLOPE_N_OFFSET));
|
||||
bool dup_oneway_sprites = ((type == 0x09) && (offset + num <= ONEWAY_SLOPE_N_OFFSET));
|
||||
|
||||
for (; num > 0; num--) {
|
||||
_cur.nfo_line++;
|
||||
SpriteID load_index = (replace == 0 ? _cur.spriteid++ : replace++);
|
||||
LoadNextSprite(load_index, *_cur.file, _cur.nfo_line);
|
||||
if (dup_oneway_sprites) {
|
||||
DupSprite(load_index, load_index + SPR_ONEWAY_SLOPE_N_OFFSET);
|
||||
DupSprite(load_index, load_index + SPR_ONEWAY_SLOPE_S_OFFSET);
|
||||
DupSprite(load_index, load_index + ONEWAY_SLOPE_N_OFFSET);
|
||||
DupSprite(load_index, load_index + ONEWAY_SLOPE_S_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1646,9 +1646,9 @@ static void DrawRoadBits(TileInfo *ti)
|
|||
if (oneway == 0) oneway = SPR_ONEWAY_BASE;
|
||||
|
||||
if ((ti->tileh == SLOPE_NE) || (ti->tileh == SLOPE_NW)) {
|
||||
oneway += SPR_ONEWAY_SLOPE_N_OFFSET;
|
||||
oneway += ONEWAY_SLOPE_N_OFFSET;
|
||||
} else if ((ti->tileh == SLOPE_SE) || (ti->tileh == SLOPE_SW)) {
|
||||
oneway += SPR_ONEWAY_SLOPE_S_OFFSET;
|
||||
oneway += ONEWAY_SLOPE_S_OFFSET;
|
||||
}
|
||||
|
||||
DrawGroundSpriteAt(oneway + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialPixelZ(8, 8, ti->tileh));
|
||||
|
|
|
@ -202,13 +202,13 @@ static const SpriteID SPR_TRACKS_FOR_SLOPES_MAGLEV_BASE = SPR_TRACKS_FOR_SLOPES_
|
|||
static const uint16_t TRACKS_FOR_SLOPES_SPRITE_COUNT = 12;
|
||||
|
||||
static const SpriteID SPR_SLOPES_BASE = SPR_TRACKS_FOR_SLOPES_BASE + TRACKS_FOR_SLOPES_SPRITE_COUNT;
|
||||
static const SpriteID SPR_SLOPES_INCLINED_OFFSET = 15;
|
||||
static const SpriteID 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.
|
||||
static const SpriteID SPR_TRKFOUND_BLOCK_SIZE = 22; // The normal track foundation sprites are organized in blocks of 22.
|
||||
static const uint16_t SLOPES_INCLINED_OFFSET = 15;
|
||||
static const SpriteID SPR_SLOPES_VIRTUAL_BASE = SPR_SLOPES_BASE - SLOPES_INCLINED_OFFSET; // The original foundations (see SPR_FOUNDATION_BASE below) are mapped before the additional foundations.
|
||||
static const uint16_t TRKFOUND_BLOCK_SIZE = 22; // The normal track foundation sprites are organized in blocks of 22.
|
||||
static const uint16_t NORMAL_FOUNDATION_SPRITE_COUNT = 74;
|
||||
/** Halftile foundations */
|
||||
static const SpriteID SPR_HALFTILE_FOUNDATION_BASE = SPR_SLOPES_BASE + NORMAL_FOUNDATION_SPRITE_COUNT;
|
||||
static const SpriteID SPR_HALFTILE_BLOCK_SIZE = 4; // The half tile foundation sprites are organized in blocks of 4.
|
||||
static const uint16_t HALFTILE_BLOCK_SIZE = 4; // The half tile foundation sprites are organized in blocks of 4.
|
||||
static const uint16_t NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT = 90;
|
||||
|
||||
static const SpriteID SPR_AUTORAIL_BASE = SPR_HALFTILE_FOUNDATION_BASE + NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT;
|
||||
|
@ -222,11 +222,11 @@ static const uint16_t TWOCCMAP_SPRITE_COUNT = 256;
|
|||
|
||||
/** shore tiles - action 05-0D */
|
||||
static const SpriteID SPR_SHORE_BASE = SPR_2CCMAP_BASE + TWOCCMAP_SPRITE_COUNT;
|
||||
static const SpriteID SPR_SHORE_SPRITE_COUNT = 18;
|
||||
static const uint16_t SHORE_SPRITE_COUNT = 18;
|
||||
static const SpriteID SPR_ORIGINALSHORE_START = 4062;
|
||||
static const SpriteID SPR_ORIGINALSHORE_END = 4069;
|
||||
|
||||
static const SpriteID SPR_AIRPORTX_BASE = SPR_SHORE_BASE + SPR_SHORE_SPRITE_COUNT; // The sprites used for other airport angles
|
||||
static const SpriteID SPR_AIRPORTX_BASE = SPR_SHORE_BASE + SHORE_SPRITE_COUNT; // The sprites used for other airport angles
|
||||
static const SpriteID SPR_NEWAIRPORT_TARMAC = SPR_AIRPORTX_BASE;
|
||||
static const SpriteID SPR_NSRUNWAY1 = SPR_AIRPORTX_BASE + 1;
|
||||
static const SpriteID SPR_NSRUNWAY2 = SPR_AIRPORTX_BASE + 2;
|
||||
|
@ -255,9 +255,9 @@ static const SpriteID SPR_AIRPORT_PREVIEW_COMMUTER = SPR_AIRPORT_PREVIEW
|
|||
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 uint16_t AIRPORT_PREVIEW_SPRITE_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_ROADSTOP_BASE = SPR_AIRPORT_PREVIEW_BASE + AIRPORT_PREVIEW_SPRITE_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;
|
||||
|
@ -272,7 +272,7 @@ static const uint16_t ROADSTOP_SPRITE_COUNT = 8;
|
|||
static const SpriteID SPR_TRAMWAY_BASE = SPR_ROADSTOP_BASE + ROADSTOP_SPRITE_COUNT;
|
||||
static const SpriteID SPR_TRAMWAY_OVERLAY = SPR_TRAMWAY_BASE + 4;
|
||||
static const SpriteID SPR_TRAMWAY_TRAM = SPR_TRAMWAY_BASE + 27;
|
||||
static const SpriteID SPR_TRAMWAY_SLOPED_OFFSET = 11;
|
||||
static const uint16_t TRAMWAY_SLOPED_OFFSET = 11;
|
||||
static const SpriteID SPR_TRAMWAY_BUS_STOP_DT_Y_W = SPR_TRAMWAY_BASE + 25;
|
||||
static const SpriteID SPR_TRAMWAY_BUS_STOP_DT_Y_E = SPR_TRAMWAY_BASE + 23;
|
||||
static const SpriteID SPR_TRAMWAY_BUS_STOP_DT_X_W = SPR_TRAMWAY_BASE + 24;
|
||||
|
@ -291,8 +291,8 @@ static const uint16_t TRAMWAY_SPRITE_COUNT = 119;
|
|||
|
||||
/** One way road sprites */
|
||||
static const SpriteID SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + TRAMWAY_SPRITE_COUNT;
|
||||
static const SpriteID SPR_ONEWAY_SLOPE_N_OFFSET = 6;
|
||||
static const SpriteID SPR_ONEWAY_SLOPE_S_OFFSET = 12;
|
||||
static const uint16_t ONEWAY_SLOPE_N_OFFSET = 6;
|
||||
static const uint16_t ONEWAY_SLOPE_S_OFFSET = 12;
|
||||
static const uint16_t ONEWAY_SPRITE_COUNT = 18;
|
||||
|
||||
/** Tunnel sprites with grass only for custom railtype tunnel. */
|
||||
|
@ -367,9 +367,9 @@ static const SpriteID SPR_STATUE_COMPANY = 2632;
|
|||
static const SpriteID SPR_BOUGHT_LAND = 4790;
|
||||
|
||||
/* sprites for rail and rail stations*/
|
||||
static const SpriteID SPR_RAIL_SNOW_OFFSET = 26;
|
||||
static const SpriteID SPR_MONO_SNOW_OFFSET = 26;
|
||||
static const SpriteID SPR_MGLV_SNOW_OFFSET = 26;
|
||||
static const uint16_t SPR_RAIL_SNOW_OFFSET = 26;
|
||||
static const uint16_t SPR_MONO_SNOW_OFFSET = 26;
|
||||
static const uint16_t SPR_MGLV_SNOW_OFFSET = 26;
|
||||
|
||||
static const SpriteID SPR_ORIGINAL_SIGNALS_BASE = 1275;
|
||||
|
||||
|
|
Loading…
Reference in New Issue