mirror of https://github.com/OpenTTD/OpenTTD
(svn r26870) -Fix (r15190): since freeform edges the 'tile height' at southern edge * 8 pixels just 'south' of the edge tile would not be drawn and would as a result not be refreshed causing artefacts to remain there. This adds a virtual slope to level 0 so it can be redrawn appropriately. Loosely based on patch by ic111
parent
2361aaf601
commit
c9d7e89138
|
@ -1046,38 +1046,28 @@ static void ViewportAddLandscape()
|
||||||
|
|
||||||
direction = false;
|
direction = false;
|
||||||
|
|
||||||
|
int min_xy = _settings_game.construction.freeform_edges ? TILE_SIZE : 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int width_cur = width;
|
int width_cur = width;
|
||||||
uint x_cur = x;
|
int x_cur = x;
|
||||||
uint y_cur = y;
|
int y_cur = y;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
TileType tt = MP_VOID;
|
TileType tt;
|
||||||
|
|
||||||
ti.x = x_cur;
|
ti.x = x_cur;
|
||||||
ti.y = y_cur;
|
ti.y = y_cur;
|
||||||
|
|
||||||
ti.z = 0;
|
if (IsInsideMM(x_cur, min_xy, MapMaxX() * TILE_SIZE) &&
|
||||||
|
IsInsideMM(y_cur, min_xy, MapMaxY() * TILE_SIZE)) {
|
||||||
ti.tileh = SLOPE_FLAT;
|
ti.tile = TileVirtXY(x_cur, y_cur);
|
||||||
ti.tile = INVALID_TILE;
|
ti.tileh = GetTilePixelSlope(ti.tile, &ti.z);
|
||||||
|
tt = GetTileType(ti.tile);
|
||||||
if (x_cur < MapMaxX() * TILE_SIZE &&
|
} else {
|
||||||
y_cur < MapMaxY() * TILE_SIZE) {
|
/* We are outside the map => paint black. */
|
||||||
TileIndex tile = TileVirtXY(x_cur, y_cur);
|
ti.tile = 0;
|
||||||
|
ti.tileh = GetTilePixelSlopeOutsideMap(x_cur / (int)TILE_SIZE, y_cur / (int)TILE_SIZE, &ti.z);
|
||||||
if (!_settings_game.construction.freeform_edges || (TileX(tile) != 0 && TileY(tile) != 0)) {
|
tt = MP_VOID;
|
||||||
if (x_cur == ((int)MapMaxX() - 1) * TILE_SIZE || y_cur == ((int)MapMaxY() - 1) * TILE_SIZE) {
|
|
||||||
uint maxh = max<uint>(TileHeight(tile), 1);
|
|
||||||
for (uint h = 0; h < maxh; h++) {
|
|
||||||
AddTileSpriteToDraw(SPR_SHADOW_CELL, PAL_NONE, ti.x, ti.y, h * TILE_HEIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ti.tile = tile;
|
|
||||||
ti.tileh = GetTilePixelSlope(tile, &ti.z);
|
|
||||||
tt = GetTileType(tile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_vd.foundation_part = FOUNDATION_PART_NONE;
|
_vd.foundation_part = FOUNDATION_PART_NONE;
|
||||||
|
@ -1088,8 +1078,8 @@ static void ViewportAddLandscape()
|
||||||
|
|
||||||
_tile_type_procs[tt]->draw_tile_proc(&ti);
|
_tile_type_procs[tt]->draw_tile_proc(&ti);
|
||||||
|
|
||||||
if ((x_cur == (int)MapMaxX() * TILE_SIZE && IsInsideMM(y_cur, 0, MapMaxY() * TILE_SIZE + 1)) ||
|
if (((uint)x_cur == MapMaxX() * TILE_SIZE && IsInsideMM(y_cur, 0, MapMaxY() * TILE_SIZE + 1)) ||
|
||||||
(y_cur == (int)MapMaxY() * TILE_SIZE && IsInsideMM(x_cur, 0, MapMaxX() * TILE_SIZE + 1))) {
|
((uint)y_cur == MapMaxY() * TILE_SIZE && IsInsideMM(x_cur, 0, MapMaxX() * TILE_SIZE + 1))) {
|
||||||
TileIndex tile = TileVirtXY(x_cur, y_cur);
|
TileIndex tile = TileVirtXY(x_cur, y_cur);
|
||||||
ti.tile = tile;
|
ti.tile = tile;
|
||||||
ti.tileh = GetTilePixelSlope(tile, &ti.z);
|
ti.tileh = GetTilePixelSlope(tile, &ti.z);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "tile_cmd.h"
|
#include "tile_cmd.h"
|
||||||
#include "command_func.h"
|
#include "command_func.h"
|
||||||
#include "viewport_func.h"
|
#include "viewport_func.h"
|
||||||
|
#include "slope_func.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
|
|
||||||
static void DrawTile_Void(TileInfo *ti)
|
static void DrawTile_Void(TileInfo *ti)
|
||||||
{
|
{
|
||||||
DrawGroundSprite(SPR_SHADOW_CELL, PAL_NONE);
|
DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PALETTE_ALL_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue