1
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
Peter Nelson a2a7ecf88e
Fix 9ce1626b: Some blitters have `bp->remap` aliased to `remap` for performance. (#11626)
While this probably doesn't make a huge difference for the custom transparent remap code path, the alias is there so use it.
2023-12-25 20:59:37 +00:00
Peter Nelson fdf6cbf848
Change: Scale sprites to requested highest resolution level. (#11600)
Sprites from graphics sets which only provide high resolution sprites are now scaled up from scaled down versions.
2023-12-25 20:08:13 +00:00
SamuXarick 947e77267a
Doc 0ca4b4e: Script debug window numbers are now ascending (#11623) 2023-12-25 18:42:29 +01:00
Loïc Guilloux 6c5a4aa2cb
Fix 2d3af14: Don't draw script log over panel borders (#11621) 2023-12-25 18:42:13 +01:00
8 changed files with 30 additions and 12 deletions

View File

@ -218,7 +218,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
if (src_px->a != 0) {
src_px += n;
do {
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
*dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
*anim = 0;
anim++;
dst++;

View File

@ -322,7 +322,7 @@ bmcr_alpha_blend_single:
/* Apply custom transparency remap. */
for (uint x = (uint) bp->width; x > 0; x--) {
if (src->a != 0) {
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
*dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
*anim = 0;
}
src_mv++;

View File

@ -209,7 +209,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
if (src_px->a != 0) {
src_px += n;
do {
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
*dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
dst++;
} while (--n != 0);
} else {

View File

@ -396,7 +396,7 @@ bmcr_alpha_blend_single:
/* Apply custom transparency remap. */
for (uint x = (uint) bp->width; x > 0; x--) {
if (src->a != 0) {
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
*dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
}
src_mv++;
dst++;

View File

@ -267,9 +267,9 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
src_px += n;
do {
if (*anim != 0) {
*anim = bp->remap[*anim];
*anim = remap[*anim];
} else {
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
*dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
*anim = 0;
}
anim++;

View File

@ -899,8 +899,19 @@ struct ScriptDebugWindow : public Window {
ScriptLogTypes::LogData &log = this->GetLogData();
if (log.empty()) return;
Rect br = r.Shrink(WidgetDimensions::scaled.bevel);
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
Rect fr = r.Shrink(WidgetDimensions::scaled.framerect);
/* Setup a clipping rectangle... */
DrawPixelInfo tmp_dpi;
if (!FillDrawPixelInfo(&tmp_dpi, fr)) return;
/* ...but keep coordinates relative to the window. */
tmp_dpi.left += fr.left;
tmp_dpi.top += fr.top;
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
fr.left -= this->hscroll->GetPosition();
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && (size_t)i < log.size(); i++) {
const ScriptLogTypes::LogLine &line = log[i];
@ -916,12 +927,13 @@ struct ScriptDebugWindow : public Window {
/* Check if the current line should be highlighted */
if (i == this->highlight_row) {
GfxFillRect(br.left, tr.top, br.right, tr.top + this->resize.step_height - 1, PC_BLACK);
fr.bottom = fr.top + this->resize.step_height - 1;
GfxFillRect(fr, PC_BLACK);
if (colour == TC_BLACK) colour = TC_WHITE; // Make black text readable by inverting it to white.
}
DrawString(-this->hscroll->GetPosition(), tr.right, tr.top, line.text, colour, SA_LEFT | SA_FORCE);
tr.top += this->resize.step_height;
DrawString(fr, line.text, colour, SA_LEFT | SA_FORCE);
fr.top += this->resize.step_height;
}
}

View File

@ -397,6 +397,12 @@ static bool ResizeSprites(SpriteLoader::SpriteCollection &sprite, uint8_t sprite
if (!HasBit(sprite_avail, zoom)) ResizeSpriteOut(sprite, zoom);
}
/* Upscale to desired sprite_min_zoom if provided sprite only had zoomed in versions. */
if (first_avail < _settings_client.gui.sprite_zoom_min) {
if (_settings_client.gui.sprite_zoom_min >= ZOOM_LVL_OUT_4X) ResizeSpriteIn(sprite, ZOOM_LVL_OUT_4X, ZOOM_LVL_OUT_2X);
if (_settings_client.gui.sprite_zoom_min >= ZOOM_LVL_OUT_2X) ResizeSpriteIn(sprite, ZOOM_LVL_OUT_2X, ZOOM_LVL_NORMAL);
}
return true;
}

View File

@ -657,7 +657,7 @@ enum WindowClass {
/**
* Script debug window; %Window numbers:
* - 0 = #ScriptDebugWidgets
* - Ascending value = #ScriptDebugWidgets
*/
WC_SCRIPT_DEBUG,