From 6f4a6daaa27645a1c88fd754b2cd45f6c65fcba2 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Thu, 28 Nov 2019 22:37:19 +0900 Subject: [PATCH] Scale status text --- source/exhumed/src/enginesubs.cpp | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/source/exhumed/src/enginesubs.cpp b/source/exhumed/src/enginesubs.cpp index 9eb36ef41..905e76511 100644 --- a/source/exhumed/src/enginesubs.cpp +++ b/source/exhumed/src/enginesubs.cpp @@ -97,16 +97,45 @@ void kensetpalette(unsigned char *vgapal) #endif } +static int32_t xdim_to_320_16(int32_t x) +{ + const int32_t screenwidth = scale(240<<16, xdim, ydim); + return scale(x, screenwidth, xdim) + (160<<16) - (screenwidth>>1); +} + +static int32_t ydim_to_200_16(int32_t y) +{ + y = scale(y, 200<<16, ydim); + return divscale16(y - (200<<15), rotatesprite_yxaspect) - rotatesprite_y_offset + (200<<15); +} + +static int32_t xdim_from_320_16(int32_t x) +{ + const int32_t screenwidth = scale(240<<16, xdim, ydim); + return scale(x + (screenwidth>>1) - (160<<16), xdim, screenwidth); +} + +static int32_t ydim_from_200_16(int32_t y) +{ + y = mulscale16(y + rotatesprite_y_offset - (200<<15), rotatesprite_yxaspect) + (200<<15); + return scale(y, ydim, 200<<16); +} + void printext(int x, int y, const char *buffer, short tilenum, char invisiblecol) { int i; unsigned char ch; + const int32_t screenwidth = scale(240<<16, xdim, ydim); + + x = xdim_to_320_16(x<<16); + y = ydim_to_200_16(y<<16); for (i = 0; buffer[i] != 0; i++) { ch = (unsigned char)buffer[i]; - rotatesprite((x - ((ch & 15) << 3)) << 16, (y - ((ch >> 4) << 3)) << 16, 65536L, 0, tilenum, 0, 0, 8 + 16 + 128, x, y, x + 7, y + 7); - x += 8; + rotatesprite(x - ((ch & 15) << (3+16)), y - ((ch >> 4) << (3+16)), 65536L, 0, tilenum, 0, 0, 2 + 8 + 16 + 128, xdim_from_320_16(x), ydim_from_200_16(y), + xdim_from_320_16(x + (8<<16))-1, ydim_from_200_16(y + (8<<16))-1); + x += (8<<16); } #if 0