aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/screen.cpp')
-rw-r--r--engines/kyra/screen.cpp179
1 files changed, 81 insertions, 98 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 04d805737f..419b630714 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -51,13 +51,12 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
memset(_fonts, 0, sizeof(_fonts));
memset(_pagePtrs, 0, sizeof(_pagePtrs));
- // Set scale factor to 1 (no scaling) for all pages
- memset(_pageScaleFactor, 1, sizeof(_pageScaleFactor));
// In VGA mode the odd and even page pointers point to the same buffers.
for (int i = 0; i < SCREEN_PAGE_NUM; i++)
_pageMapping[i] = i & ~1;
_renderMode = Common::kRenderDefault;
+ _sjisMixedFontMode = false;
_currentFont = FID_8_FNT;
_paletteChanged = true;
@@ -114,7 +113,7 @@ bool Screen::init() {
}
// CGA and EGA modes use additional pages to do the CGA/EGA specific graphics conversions.
- if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
+ if (_vm->game() == GI_EOB1 && (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA)) {
for (int i = 0; i < 8; i++)
_pageMapping[i] = i;
}
@@ -126,6 +125,7 @@ bool Screen::init() {
if (_useOverlays) {
_useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
_sjisInvisibleColor = (_vm->game() == GI_KYRA1) ? 0x80 : 0xF6;
+ _sjisMixedFontMode = !_use16ColorMode;
for (int i = 0; i < SCREEN_OVLS_NUM; ++i) {
if (!_sjisOverlayPtrs[i]) {
@@ -141,7 +141,7 @@ bool Screen::init() {
if (!font)
error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'");
- _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode);
+ _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode && _vm->game() != GI_LOL, _vm->game() == GI_LOL ? 1 : 0);
}
}
@@ -154,9 +154,7 @@ bool Screen::init() {
}
int numPages = realPages.size();
- uint32 bufferSize = 0;
- for (int i = 0; i < numPages; i++)
- bufferSize += (SCREEN_PAGE_SIZE * _pageScaleFactor[realPages[i]] * _pageScaleFactor[realPages[i]]);
+ uint32 bufferSize = numPages * SCREEN_PAGE_SIZE;
uint8 *pagePtr = new uint8[bufferSize];
memset(pagePtr, 0, bufferSize);
@@ -167,7 +165,7 @@ bool Screen::init() {
_pagePtrs[i] = _pagePtrs[_pageMapping[i]];
} else {
_pagePtrs[i] = pagePtr;
- pagePtr += (SCREEN_PAGE_SIZE * _pageScaleFactor[i] * _pageScaleFactor[i]);
+ pagePtr += SCREEN_PAGE_SIZE;
}
}
@@ -292,7 +290,7 @@ void Screen::updateScreen() {
needRealUpdate = true;
if (!_useOverlays)
- _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W * _pageScaleFactor[2], SCREEN_H * _pageScaleFactor[2]);
+ _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H);
else
_system->copyRectToScreen(getPagePtr(2), SCREEN_W, 640, 0, SCREEN_W, SCREEN_H);
}
@@ -303,12 +301,12 @@ void Screen::updateScreen() {
void Screen::updateDirtyRects() {
if (_forceFullUpdate) {
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W * _pageScaleFactor[0], 0, 0, SCREEN_W * _pageScaleFactor[0], SCREEN_H * _pageScaleFactor[0]);
+ _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
} else {
const byte *page0 = getCPagePtr(0);
Common::List<Common::Rect>::iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- _system->copyRectToScreen(page0 + it->top * SCREEN_W * _pageScaleFactor[0] + it->left, SCREEN_W * _pageScaleFactor[0], it->left, it->top, it->width(), it->height());
+ _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
}
}
_forceFullUpdate = false;
@@ -493,7 +491,7 @@ void Screen::clearPage(int pageNum) {
assert(pageNum < SCREEN_PAGE_NUM);
if (pageNum == 0 || pageNum == 1)
_forceFullUpdate = true;
- memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE * _pageScaleFactor[_curPage] * _pageScaleFactor[_curPage]);
+ memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE);
clearOverlayPage(pageNum);
}
@@ -507,7 +505,7 @@ int Screen::setCurPage(int pageNum) {
void Screen::clearCurPage() {
if (_curPage == 0 || _curPage == 1)
_forceFullUpdate = true;
- memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE * _pageScaleFactor[_curPage] * _pageScaleFactor[_curPage]);
+ memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE);
clearOverlayPage(_curPage);
}
@@ -672,7 +670,7 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA) {
+ } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
color &= 0x0F;
}
@@ -881,26 +879,16 @@ void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
}
void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags) {
- // Since we don't (need to) do any actual scaling, we check for compatible pages here
- assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
-
- x1 *= _pageScaleFactor[srcPage];
- y1 *= _pageScaleFactor[srcPage];
- x2 *= _pageScaleFactor[dstPage];
- y2 *= _pageScaleFactor[dstPage];
- w *= _pageScaleFactor[srcPage];
- h *= _pageScaleFactor[srcPage];
-
if (x2 < 0) {
if (x2 <= -w)
return;
w += x2;
x1 -= x2;
x2 = 0;
- } else if (x2 + w >= SCREEN_W * _pageScaleFactor[dstPage]) {
- if (x2 > SCREEN_W * _pageScaleFactor[dstPage])
+ } else if (x2 + w >= SCREEN_W) {
+ if (x2 > SCREEN_W)
return;
- w = SCREEN_W * _pageScaleFactor[srcPage] - x2;
+ w = SCREEN_W - x2;
}
if (y2 < 0) {
@@ -909,14 +897,14 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
h += y2;
y1 -= y2;
y2 = 0;
- } else if (y2 + h >= SCREEN_H * _pageScaleFactor[dstPage]) {
- if (y2 > SCREEN_H * _pageScaleFactor[dstPage])
+ } else if (y2 + h >= SCREEN_H) {
+ if (y2 > SCREEN_H)
return;
- h = SCREEN_H * _pageScaleFactor[srcPage] - y2;
+ h = SCREEN_H - y2;
}
- const uint8 *src = getPagePtr(srcPage) + y1 * SCREEN_W * _pageScaleFactor[srcPage] + x1;
- uint8 *dst = getPagePtr(dstPage) + y2 * SCREEN_W * _pageScaleFactor[dstPage] + x2;
+ const uint8 *src = getPagePtr(srcPage) + y1 * SCREEN_W + x1;
+ uint8 *dst = getPagePtr(dstPage) + y2 * SCREEN_W + x2;
if (src == dst)
return;
@@ -929,8 +917,8 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
if (flags & CR_NO_P_CHECK) {
while (h--) {
memmove(dst, src, w);
- src += SCREEN_W * _pageScaleFactor[srcPage];
- dst += SCREEN_W * _pageScaleFactor[dstPage];
+ src += SCREEN_W;
+ dst += SCREEN_W;
}
} else {
while (h--) {
@@ -938,24 +926,19 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
if (src[i])
dst[i] = src[i];
}
- src += SCREEN_W * _pageScaleFactor[srcPage];
- dst += SCREEN_W * _pageScaleFactor[dstPage];
+ src += SCREEN_W;
+ dst += SCREEN_W;
}
}
}
void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest) {
- x *= _pageScaleFactor[pageNum];
- y *= _pageScaleFactor[pageNum];
- w *= _pageScaleFactor[pageNum];
- h *= _pageScaleFactor[pageNum];
-
if (y < 0) {
dest += (-y) * w;
h += y;
y = 0;
} else if (y + h > SCREEN_H) {
- h = SCREEN_H * _pageScaleFactor[pageNum] - y;
+ h = SCREEN_H - y;
}
if (x < 0) {
@@ -963,7 +946,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
w += x;
x = 0;
} else if (x + w > SCREEN_W) {
- w = SCREEN_W * _pageScaleFactor[pageNum] - x;
+ w = SCREEN_W - x;
}
if (w < 0 || h < 0)
@@ -972,17 +955,14 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
uint8 *pagePtr = getPagePtr(pageNum);
for (int i = y; i < y + h; ++i)
- memcpy(dest + (i - y) * w, pagePtr + i * SCREEN_W * _pageScaleFactor[pageNum] + x, w);
+ memcpy(dest + (i - y) * w, pagePtr + i * SCREEN_W + x, w);
}
void Screen::copyPage(uint8 srcPage, uint8 dstPage) {
- // Since we don't (need to) do any actual scaling, we check for compatible pages here
- assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
-
uint8 *src = getPagePtr(srcPage);
uint8 *dst = getPagePtr(dstPage);
if (src != dst)
- memcpy(dst, src, SCREEN_W * _pageScaleFactor[srcPage] * SCREEN_H * _pageScaleFactor[srcPage]);
+ memcpy(dst, src, SCREEN_W * SCREEN_H);
copyOverlayRegion(0, 0, 0, 0, SCREEN_W, SCREEN_H, srcPage, dstPage);
if (dstPage == 0 || dstPage == 1)
@@ -1009,12 +989,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
if (w < 0 || h < 0)
return;
- x *= _pageScaleFactor[pageNum];
- y *= _pageScaleFactor[pageNum];
- w *= _pageScaleFactor[pageNum];
- h *= _pageScaleFactor[pageNum];
-
- uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W * _pageScaleFactor[pageNum] + x;
+ uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W + x;
if (pageNum == 0 || pageNum == 1)
addDirtyRect(x, y, w, h);
@@ -1023,7 +998,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
while (h--) {
memcpy(dst, src, w);
- dst += SCREEN_W * _pageScaleFactor[pageNum];
+ dst += SCREEN_W;
src += w;
}
}
@@ -1101,7 +1076,7 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum,
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA) {
+ } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
color &= 0x0F;
}
@@ -1178,7 +1153,7 @@ void Screen::drawLine(bool vertical, int x, int y, int length, int color) {
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA) {
+ } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
color &= 0x0F;
}
@@ -1187,7 +1162,7 @@ void Screen::drawLine(bool vertical, int x, int y, int length, int color) {
int currLine = 0;
while (currLine < length) {
*ptr = color;
- ptr += SCREEN_W * _pageScaleFactor[_curPage];
+ ptr += SCREEN_W;
currLine++;
}
} else {
@@ -1233,7 +1208,8 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
fnt = new AMIGAFont();
#ifdef ENABLE_EOB
else if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2)
- fnt = new OldDOSFont(_renderMode, _vm->gameFlags().useHiRes);
+ // We use normal VGA rendering in EOB II, since we do the complete EGA dithering in updateScreen().
+ fnt = new OldDOSFont(_useHiResEGADithering ? Common::kRenderVGA : _renderMode);
#endif // ENABLE_EOB
else
fnt = new DOSFont();
@@ -1272,11 +1248,16 @@ int Screen::getCharWidth(uint16 c) const {
return width + ((_currentFont != FID_SJIS_FNT) ? _charWidth : 0);
}
-int Screen::getTextWidth(const char *str) const {
+int Screen::getTextWidth(const char *str) {
int curLineLen = 0;
int maxLineLen = 0;
+ FontId curFont = _currentFont;
+
while (1) {
+ if (_sjisMixedFontMode)
+ setFont(*str < 0 ? FID_SJIS_FNT : curFont);
+
uint c = fetchChar(str);
if (c == 0) {
@@ -1300,7 +1281,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
cmap[1] = color1;
setTextColor(cmap, 0, 1);
- const uint8 charHeightFnt = getFontHeight();
+ FontId curFont = _currentFont;
if (x < 0)
x = 0;
@@ -1314,6 +1295,11 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
return;
while (1) {
+ if (_sjisMixedFontMode)
+ setFont(*str < 0 ? FID_SJIS_FNT : curFont);
+
+ uint8 charHeightFnt = getFontHeight();
+
uint c = fetchChar(str);
if (c == 0) {
@@ -1362,9 +1348,6 @@ void Screen::drawChar(uint16 c, int x, int y) {
if (x + charWidth > SCREEN_W || y + charHeight > SCREEN_H)
return;
- x *= _pageScaleFactor[_curPage];
- y *= _pageScaleFactor[_curPage];
-
if (useOverlay) {
uint8 *destPage = getOverlayPtr(_curPage);
if (!destPage) {
@@ -1376,11 +1359,11 @@ void Screen::drawChar(uint16 c, int x, int y) {
fnt->drawChar(c, destPage, 640);
} else {
- fnt->drawChar(c, getPagePtr(_curPage) + y * SCREEN_W * _pageScaleFactor[_curPage] + x, SCREEN_W * _pageScaleFactor[_curPage]);
+ fnt->drawChar(c, getPagePtr(_curPage) + y * SCREEN_W + x, SCREEN_W);
}
if (_curPage == 0 || _curPage == 1)
- addDirtyRect(x, y, charWidth * _pageScaleFactor[_curPage], charHeight * _pageScaleFactor[_curPage]);
+ addDirtyRect(x, y, charWidth, charHeight);
}
void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {
@@ -1519,7 +1502,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
int scaleCounterV = 0;
- const int drawFunc = flags & 0x0f;
+ const int drawFunc = flags & 0x0F;
_dsProcessMargin = dsMarginFunc[drawFunc];
_dsScaleSkip = dsSkipFunc[drawFunc];
_dsProcessLine = dsLineFunc[drawFunc];
@@ -1776,7 +1759,7 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt)
_dsTmpWidth += cnt;
int i = (_dsOffscreenLeft - cnt) * _dsScaleW;
- int res = i & 0xff;
+ int res = i & 0xFF;
i >>= 8;
i -= _dsOffscreenScaleVal2;
dst += i;
@@ -1802,7 +1785,7 @@ int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cn
_dsTmpWidth += cnt;
int i = (_dsOffscreenLeft - cnt) * _dsScaleW;
- int res = i & 0xff;
+ int res = i & 0xFF;
i >>= 8;
i -= _dsOffscreenScaleVal2;
dst -= i;
@@ -1891,7 +1874,7 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int
int r = c * _dsScaleW + scaleState;
dst += (r >> 8);
cnt -= (r >> 8);
- scaleState = r & 0xff;
+ scaleState = r & 0xFF;
}
} else if (scaleState) {
(this->*_dsPlot)(dst++, c);
@@ -1919,7 +1902,7 @@ void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, i
int r = c * _dsScaleW + scaleState;
dst -= (r >> 8);
cnt -= (r >> 8);
- scaleState = r & 0xff;
+ scaleState = r & 0xFF;
}
} else {
(this->*_dsPlot)(dst--, c);
@@ -1967,9 +1950,9 @@ void Screen::drawShapePlotType5(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType6(uint8 *dst, uint8 cmd) {
int t = _drawShapeVar4 + _drawShapeVar5;
- if (t & 0xff00) {
+ if (t & 0xFF00) {
cmd = dst[_drawShapeVar3];
- t &= 0xff;
+ t &= 0xFF;
} else {
cmd = _dsTable2[cmd];
}
@@ -1980,7 +1963,7 @@ void Screen::drawShapePlotType6(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType8(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t)
cmd = _shapePages[1][relOffs];
@@ -1989,7 +1972,7 @@ void Screen::drawShapePlotType8(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType9(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t) {
cmd = _shapePages[1][relOffs];
} else {
@@ -2003,7 +1986,7 @@ void Screen::drawShapePlotType9(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType11_15(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t) {
cmd = _shapePages[1][relOffs];
@@ -2019,7 +2002,7 @@ void Screen::drawShapePlotType11_15(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType12(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t) {
cmd = _shapePages[1][relOffs];
} else {
@@ -2031,7 +2014,7 @@ void Screen::drawShapePlotType12(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType13(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t) {
cmd = _shapePages[1][relOffs];
} else {
@@ -2046,14 +2029,14 @@ void Screen::drawShapePlotType13(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType14(uint8 *dst, uint8 cmd) {
uint32 relOffs = dst - _dsDstPage;
- int t = (_shapePages[0][relOffs] & 0x7f) & 0x87;
+ int t = (_shapePages[0][relOffs] & 0x7F) & 0x87;
if (_dsDrawLayer < t) {
cmd = _shapePages[1][relOffs];
} else {
t = _drawShapeVar4 + _drawShapeVar5;
- if (t & 0xff00) {
+ if (t & 0xFF00) {
cmd = dst[_drawShapeVar3];
- t &= 0xff;
+ t &= 0xFF;
} else {
cmd = _dsTable2[cmd];
}
@@ -2147,7 +2130,7 @@ void Screen::decodeFrame1(const uint8 *src, uint8 *dst, uint32 size) {
uint8 nib = 0;
uint16 code = decodeEGAGetCode(src, nib);
- uint8 last = code & 0xff;
+ uint8 last = code & 0xFF;
uint8 *dstPrev = dst;
uint16 count = 1;
@@ -2160,7 +2143,7 @@ void Screen::decodeFrame1(const uint8 *src, uint8 *dst, uint32 size) {
uint8 cmd = code >> 8;
if (cmd--) {
- code = (cmd << 8) | (code & 0xff);
+ code = (cmd << 8) | (code & 0xFF);
uint8 *tmpDst = dst;
if (code < numPatterns) {
@@ -2188,7 +2171,7 @@ void Screen::decodeFrame1(const uint8 *src, uint8 *dst, uint32 size) {
count = countPrev;
} else {
- *dst++ = last = (code & 0xff);
+ *dst++ = last = (code & 0xFF);
if (numPatterns < 3840) {
patterns[numPatterns].pos = dstPrev;
@@ -2209,7 +2192,7 @@ uint16 Screen::decodeEGAGetCode(const uint8 *&pos, uint8 &nib) {
res >>= 4;
} else {
pos++;
- res &= 0xfff;
+ res &= 0xFFF;
}
return res;
}
@@ -2891,8 +2874,6 @@ void Screen::setShapePages(int page1, int page2, int minY, int maxY) {
void Screen::setMouseCursor(int x, int y, const byte *shape) {
if (!shape)
return;
- // if mouseDisabled
- // return _mouseShape
if (_vm->gameFlags().useAltShapeHeader)
shape += 2;
@@ -3215,7 +3196,7 @@ void Screen::addDirtyRect(int x, int y, int w, int h) {
Common::Rect r(x, y, x + w, y + h);
// Clip rectangle
- r.clip(SCREEN_W * _pageScaleFactor[0], SCREEN_H * _pageScaleFactor[0]);
+ r.clip(SCREEN_W, SCREEN_H);
// If it is empty after clipping, we are done
if (r.isEmpty())
@@ -3322,8 +3303,6 @@ void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int s
if (srcPage > 13 || dstPage > 13)
error("Screen::crossFadeRegion(): attempting to use temp page as source or dest page.");
- assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
-
hideMouse();
uint16 *wB = (uint16 *)_pagePtrs[14];
@@ -3341,6 +3320,9 @@ void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int s
for (int i = 0; i < h; i++)
SWAP(hB[_vm->_rnd.getRandomNumberRng(0, h - 1)], hB[i]);
+ uint8 *s = _pagePtrs[srcPage];
+ uint8 *d = _pagePtrs[dstPage];
+
for (int i = 0; i < h; i++) {
int iH = i;
uint32 end = _system->getMillis() + 3;
@@ -3353,7 +3335,8 @@ void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int s
if (++iH >= h)
iH = 0;
- setPagePixel(dstPage, dX, dY, getPagePixel(srcPage, sX, sY));
+ d[dY * 320 + dX] = s[sY * 320 + sX];
+ addDirtyRect(dX, dY, 1, 1);
}
// This tries to speed things up, to get similiar speeds as in DOSBox etc.
@@ -3595,11 +3578,11 @@ void AMIGAFont::unload() {
memset(_chars, 0, sizeof(_chars));
}
-SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize)
- : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) {
+SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing)
+ : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) {
assert(_font);
- _font->setDrawingMode(outlineSize ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
+ _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
_sjisWidth = _font->getMaxFontWidth() >> 1;
_fontHeight = _font->getFontHeight() >> 1;
@@ -3616,14 +3599,14 @@ int SJISFont::getHeight() const {
}
int SJISFont::getWidth() const {
- return _sjisWidth;
+ return _sjisWidth + _sjisWidthOffset;
}
int SJISFont::getCharWidth(uint16 c) const {
if (c <= 0x7F || (c >= 0xA1 && c <= 0xDF))
return _asciiWidth;
else
- return _sjisWidth;
+ return _sjisWidth + _sjisWidthOffset;
}
void SJISFont::setColorMap(const uint8 *src) {
@@ -3633,7 +3616,7 @@ void SJISFont::setColorMap(const uint8 *src) {
if (_colorMap[0] == _invisColor)
_font->setDrawingMode(Graphics::FontSJIS::kDefaultMode);
else
- _font->setDrawingMode(Graphics::FontSJIS::kOutlineMode);
+ _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
}
}
@@ -3672,7 +3655,7 @@ void Palette::loadVGAPalette(Common::ReadStream &stream, int startIndex, int col
uint8 *pos = _palData + startIndex * 3;
for (int i = 0 ; i < colors * 3; i++)
- *pos++ = stream.readByte() & 0x3f;
+ *pos++ = stream.readByte() & 0x3F;
}
void Palette::loadEGAPalette(Common::ReadStream &stream, int startIndex, int colors) {