|
@@ -497,77 +497,81 @@ void DrawFoundation(TileInfo *ti, Founda
|
|
|
SpriteID halftile_base = SPR_HALFTILE_FOUNDATION_BASE + sprite_block * SPR_HALFTILE_BLOCK_SIZE;
|
|
|
|
|
|
if (IsSteepSlope(ti->tileh)) {
|
|
|
if (!IsNonContinuousFoundation(f)) {
|
|
|
/* Lower part of foundation */
|
|
|
AddSortableSpriteToDraw(
|
|
|
leveled_base + (ti->tileh & ~SLOPE_STEEP), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z
|
|
|
leveled_base + (ti->tileh & ~SLOPE_STEEP), PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z
|
|
|
);
|
|
|
}
|
|
|
|
|
|
Corner highest_corner = GetHighestSlopeCorner(ti->tileh);
|
|
|
ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh);
|
|
|
|
|
|
if (IsInclinedFoundation(f)) {
|
|
|
/* inclined foundation */
|
|
|
byte inclined = highest_corner * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0);
|
|
|
|
|
|
AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y,
|
|
|
f == FOUNDATION_INCLINED_X ? 16 : 1,
|
|
|
f == FOUNDATION_INCLINED_Y ? 16 : 1,
|
|
|
f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1,
|
|
|
f == FOUNDATION_INCLINED_Y ? TILE_SIZE : 1,
|
|
|
TILE_HEIGHT, ti->z
|
|
|
);
|
|
|
OffsetGroundSprite(0, 0);
|
|
|
} else if (IsLeveledFoundation(f)) {
|
|
|
AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT);
|
|
|
OffsetGroundSprite(0, -8);
|
|
|
AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z - TILE_HEIGHT);
|
|
|
OffsetGroundSprite(0, -(int)TILE_HEIGHT);
|
|
|
} else if (f == FOUNDATION_STEEP_LOWER) {
|
|
|
/* one corner raised */
|
|
|
OffsetGroundSprite(0, -8);
|
|
|
OffsetGroundSprite(0, -(int)TILE_HEIGHT);
|
|
|
} else {
|
|
|
/* halftile foundation */
|
|
|
int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? 8 : 0);
|
|
|
int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? 8 : 0);
|
|
|
int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? TILE_SIZE / 2 : 0);
|
|
|
int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? TILE_SIZE / 2 : 0);
|
|
|
|
|
|
AddSortableSpriteToDraw(halftile_base + highest_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z + TILE_HEIGHT);
|
|
|
AddSortableSpriteToDraw(halftile_base + highest_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, TILE_SIZE / 2, TILE_SIZE / 2, TILE_HEIGHT - 1, ti->z + TILE_HEIGHT);
|
|
|
/* Reposition ground sprite back to original position after bounding box change above. This is similar to
|
|
|
* RemapCoords() but without zoom scaling. */
|
|
|
Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb};
|
|
|
OffsetGroundSprite(-pt.x, -pt.y);
|
|
|
}
|
|
|
} else {
|
|
|
if (IsLeveledFoundation(f)) {
|
|
|
/* leveled foundation */
|
|
|
AddSortableSpriteToDraw(leveled_base + ti->tileh, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z);
|
|
|
OffsetGroundSprite(0, -8);
|
|
|
AddSortableSpriteToDraw(leveled_base + ti->tileh, PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z);
|
|
|
OffsetGroundSprite(0, -(int)TILE_HEIGHT);
|
|
|
} else if (IsNonContinuousFoundation(f)) {
|
|
|
/* halftile foundation */
|
|
|
Corner halftile_corner = GetHalftileFoundationCorner(f);
|
|
|
int x_bb = (((halftile_corner == CORNER_W) || (halftile_corner == CORNER_S)) ? 8 : 0);
|
|
|
int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? 8 : 0);
|
|
|
int x_bb = (((halftile_corner == CORNER_W) || (halftile_corner == CORNER_S)) ? TILE_SIZE / 2 : 0);
|
|
|
int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? TILE_SIZE / 2 : 0);
|
|
|
|
|
|
AddSortableSpriteToDraw(halftile_base + halftile_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z);
|
|
|
AddSortableSpriteToDraw(halftile_base + halftile_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, TILE_SIZE / 2, TILE_SIZE / 2, TILE_HEIGHT - 1, ti->z);
|
|
|
/* Reposition ground sprite back to original position after bounding box change above. This is similar to
|
|
|
* RemapCoords() but without zoom scaling. */
|
|
|
Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb};
|
|
|
OffsetGroundSprite(-pt.x, -pt.y);
|
|
|
} else if (IsSpecialRailFoundation(f)) {
|
|
|
/* anti-zig-zag foundation */
|
|
|
SpriteID spr;
|
|
|
if (ti->tileh == SLOPE_NS || ti->tileh == SLOPE_EW) {
|
|
|
/* half of leveled foundation under track corner */
|
|
|
spr = leveled_base + SlopeWithThreeCornersRaised(GetRailFoundationCorner(f));
|
|
|
} else {
|
|
|
/* tile-slope = sloped along X/Y, foundation-slope = three corners raised */
|
|
|
spr = inclined_base + 2 * GetRailFoundationCorner(f) + ((ti->tileh == SLOPE_SW || ti->tileh == SLOPE_NE) ? 1 : 0);
|
|
|
}
|
|
|
AddSortableSpriteToDraw(spr, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z);
|
|
|
AddSortableSpriteToDraw(spr, PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z);
|
|
|
OffsetGroundSprite(0, 0);
|
|
|
} else {
|
|
|
/* inclined foundation */
|
|
|
byte inclined = GetHighestSlopeCorner(ti->tileh) * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0);
|
|
|
|
|
|
AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y,
|
|
|
f == FOUNDATION_INCLINED_X ? 16 : 1,
|
|
|
f == FOUNDATION_INCLINED_Y ? 16 : 1,
|
|
|
f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1,
|
|
|
f == FOUNDATION_INCLINED_Y ? TILE_SIZE : 1,
|
|
|
TILE_HEIGHT, ti->z
|
|
|
);
|
|
|
OffsetGroundSprite(0, 0);
|
|
|
}
|
|
|
ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh);
|
|
|
}
|