|
@@ -44,12 +44,13 @@
|
|
|
#include "waypoint_func.h"
|
|
|
#include "window_func.h"
|
|
|
#include "tilehighlight_func.h"
|
|
|
#include "window_gui.h"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
#include "table/palettes.h"
|
|
|
|
|
|
Point _tile_fract_coords;
|
|
|
|
|
|
struct StringSpriteToDraw {
|
|
|
StringID string;
|
|
|
Colours colour;
|
|
@@ -145,12 +146,14 @@ struct ViewportDrawer {
|
|
|
|
|
|
static ViewportDrawer _vd;
|
|
|
|
|
|
TileHighlightData _thd;
|
|
|
static TileInfo *_cur_ti;
|
|
|
bool _draw_bounding_boxes = false;
|
|
|
bool _draw_dirty_blocks = false;
|
|
|
uint _dirty_block_colour = 0;
|
|
|
|
|
|
static Point MapXYZToViewport(const ViewPort *vp, int x, int y, int z)
|
|
|
{
|
|
|
Point p = RemapCoords(x, y, z);
|
|
|
p.x -= vp->virtual_width / 2;
|
|
|
p.y -= vp->virtual_height / 2;
|
|
@@ -1358,12 +1361,34 @@ static void ViewportDrawBoundingBoxes(co
|
|
|
pt2.x - pt1.x, pt2.y - pt1.y,
|
|
|
pt3.x - pt1.x, pt3.y - pt1.y,
|
|
|
pt4.x - pt1.x, pt4.y - pt1.y);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Draw/colour the blocks that have been redrawn.
|
|
|
*/
|
|
|
static void ViewportDrawDirtyBlocks()
|
|
|
{
|
|
|
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
|
|
|
const DrawPixelInfo *dpi = _cur_dpi;
|
|
|
void *dst;
|
|
|
int right = UnScaleByZoom(dpi->width, dpi->zoom);
|
|
|
int bottom = UnScaleByZoom(dpi->height, dpi->zoom);
|
|
|
|
|
|
int colour = _string_colourmap[_dirty_block_colour & 0xF];
|
|
|
|
|
|
dst = dpi->dst_ptr;
|
|
|
|
|
|
byte bo = UnScaleByZoom(dpi->left + dpi->top, dpi->zoom) & 1;
|
|
|
do {
|
|
|
for (int i = (bo ^= 1); i < right; i += 2) blitter->SetPixel(dst, i, 0, (uint8)colour);
|
|
|
dst = blitter->MoveTo(dst, 0, 1);
|
|
|
} while (--bottom > 0);
|
|
|
}
|
|
|
|
|
|
static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDrawVector *sstdv)
|
|
|
{
|
|
|
DrawPixelInfo dp;
|
|
|
ZoomLevel zoom;
|
|
|
|
|
|
_cur_dpi = &dp;
|
|
@@ -1454,12 +1479,13 @@ void ViewportDoDraw(const ViewPort *vp,
|
|
|
}
|
|
|
|
|
|
ViewportSortParentSprites(&_vd.parent_sprites_to_sort);
|
|
|
ViewportDrawParentSprites(&_vd.parent_sprites_to_sort, &_vd.child_screen_sprites_to_draw);
|
|
|
|
|
|
if (_draw_bounding_boxes) ViewportDrawBoundingBoxes(&_vd.parent_sprites_to_sort);
|
|
|
if (_draw_dirty_blocks) ViewportDrawDirtyBlocks();
|
|
|
|
|
|
if (_vd.string_sprites_to_draw.Length() != 0) ViewportDrawStrings(&_vd.dpi, &_vd.string_sprites_to_draw);
|
|
|
|
|
|
_cur_dpi = old_dpi;
|
|
|
|
|
|
_vd.string_sprites_to_draw.Clear();
|