aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/chargen.cpp10
-rw-r--r--engines/kyra/darkmoon.cpp9
-rw-r--r--engines/kyra/eobcommon.cpp14
-rw-r--r--engines/kyra/eobcommon.h2
-rw-r--r--engines/kyra/gui_eob.cpp12
-rw-r--r--engines/kyra/kyra_rpg.cpp10
-rw-r--r--engines/kyra/kyra_rpg.h5
-rw-r--r--engines/kyra/magic_eob.cpp2
-rw-r--r--engines/kyra/saveload_eob.cpp2
-rw-r--r--engines/kyra/scene_eob.cpp72
-rw-r--r--engines/kyra/scene_rpg.cpp76
-rw-r--r--engines/kyra/screen.cpp103
-rw-r--r--engines/kyra/screen.h16
-rw-r--r--engines/kyra/screen_eob.cpp254
-rw-r--r--engines/kyra/screen_eob.h9
15 files changed, 155 insertions, 441 deletions
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index 54e1abcc2c..23274349e7 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -1496,7 +1496,7 @@ TransferPartyWiz::~TransferPartyWiz() {
}
bool TransferPartyWiz::start() {
- _screen->copyPage(0, _vm->_useHiResDithering ? 1 : 12);
+ _screen->copyPage(0, 12);
if (!selectAndLoadTransferFile())
return false;
@@ -1536,7 +1536,7 @@ bool TransferPartyWiz::start() {
bool TransferPartyWiz::selectAndLoadTransferFile() {
do {
- _screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
+ _screen->copyPage(12, 0);
if (transferFileDialogue(_vm->_savegameFilename))
break;
} while (_vm->_gui->confirmDialogue2(15, 68, 1));
@@ -1566,7 +1566,7 @@ bool TransferPartyWiz::selectAndLoadTransferFile() {
return false;
Common::String target = _vm->_gui->transferTargetMenu(eobTargets);
- _screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
+ _screen->copyPage(12, 0);
if (target.empty())
return true;
@@ -1579,10 +1579,10 @@ bool TransferPartyWiz::selectAndLoadTransferFile() {
return true;
}
- _screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
+ _screen->copyPage(12, 0);
bool result = _vm->_gui->transferFileMenu(target, dest);
- _screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
+ _screen->copyPage(12, 0);
return result;
}
diff --git a/engines/kyra/darkmoon.cpp b/engines/kyra/darkmoon.cpp
index 16bd3dad58..054b2b285e 100644
--- a/engines/kyra/darkmoon.cpp
+++ b/engines/kyra/darkmoon.cpp
@@ -158,10 +158,7 @@ void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterInde
int colx = 302 + 3 * i;
for (int ii = 0; ii < 16; ii++) {
- // Don't use getPagePixel() here, since in EGA mode it will try to
- // undither the pixel (although the shape bitmap is undithered already)
- uint8 col = _screen->getCPagePtr(_screen->_curPage | 1)[(184 + ii) * Screen::SCREEN_W + colx];
-
+ uint8 col = _screen->getPagePixel(_screen->_curPage, colx, 184 + ii);
int iii = 0;
for (; iii < 16; iii++) {
if (tmpPal[iii] == col) {
@@ -178,9 +175,7 @@ void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterInde
memcpy(tmpPal, _monsterShapes[dci] + 4, 16);
for (int iii = 0; iii < 16; iii++) {
- // Don't use getPagePixel() here, since in EGA mode it will try to
- // undither the pixel (although the shape bitmap is undithered already)
- uint8 col = _screen->getCPagePtr(_screen->_curPage | 1)[(184 + iii) * Screen::SCREEN_W + colx + ii];
+ uint8 col = _screen->getPagePixel(_screen->_curPage, colx + ii, 184 + iii);
if (newPal[iii])
tmpPal[newPal[iii]] = col;
}
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index fadb1066e0..6c899b8c8e 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -57,7 +57,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_configMouse = true;
_loading = false;
- _useHiResDithering = false;
+ _enableHiResDithering = false;
_envAudioTimer = 0;
_flashShapeTimer = 0;
@@ -371,7 +371,7 @@ Common::Error EoBCoreEngine::init() {
if (ConfMan.hasKey("render_mode"))
_configRenderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
- _useHiResDithering = (_configRenderMode == Common::kRenderEGA && _flags.useHiRes);
+ _enableHiResDithering = (_configRenderMode == Common::kRenderEGA && _flags.useHiRes);
_screen = new Screen_EoB(this, _system);
assert(_screen);
@@ -417,12 +417,6 @@ Common::Error EoBCoreEngine::init() {
_screen->loadFont(Screen::FID_6_FNT, "FONT6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "FONT8.FNT");
- if (_useHiResDithering) {
- _vcnBlockWidth <<= 1;
- _vcnBlockHeight <<= 1;
- SWAP(_vcnFlip0, _vcnFlip1);
- }
-
Common::Error err = KyraRpgEngine::init();
if (err.getCode() != Common::kNoError)
return err;
@@ -1748,7 +1742,7 @@ void EoBCoreEngine::seq_portal() {
bool EoBCoreEngine::checkPassword() {
char answ[20];
Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
- _screen->copyPage(0, _useHiResDithering ? 4 : 10);
+ _screen->copyPage(0, 10);
_screen->setScreenDim(13);
gui_drawBox(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, guiSettings()->colors.frame1, guiSettings()->colors.frame2, -1);
@@ -1775,7 +1769,7 @@ bool EoBCoreEngine::checkPassword() {
_screen->modifyScreenDim(13, _screen->_curDim->sx - 1, _screen->_curDim->sy - 2, _screen->_curDim->w + 2, _screen->_curDim->h + 16);
_screen->setFont(of);
- _screen->copyPage(_useHiResDithering ? 4 : 10, 0);
+ _screen->copyPage(10, 0);
return true;
}
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index f60e755dd7..aca3a96d8c 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -845,7 +845,7 @@ protected:
const uint8 *_cgaMappingLevel[5];
const uint8 *_cgaLevelMappingIndex;
- bool _useHiResDithering;
+ bool _enableHiResDithering;
// Default parameters will import all present original save files and push them to the top of the save dialog.
bool importOriginalSaveFile(int destSlot, const char *sourceFile = 0);
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index e3c0743e5c..6668644f0c 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -777,11 +777,11 @@ int EoBCoreEngine::clickedCamp(Button *button) {
}
_screen->copyPage(0, 7);
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _useHiResDithering ? 1 : 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
_gui->runCampMenu();
- _screen->copyRegion(0, 0, 0, 120, 176, 24, _useHiResDithering ? 1 : 12, 2, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 0, 120, 176, 24, 12, 2, Screen::CR_NO_P_CHECK);
_screen->setScreenDim(cd);
drawScene(0);
@@ -1170,7 +1170,7 @@ int EoBCoreEngine::clickedSceneSpecial(Button *button) {
int EoBCoreEngine::clickedSpellbookAbort(Button *button) {
_updateFlags = 0;
- _screen->copyRegion(0, 0, 64, 121, 112, 56, _useHiResDithering ? 4 : 10, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 64, 121, 112, 56, 10, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
gui_drawCompass(true);
gui_toggleButtons();
@@ -2172,7 +2172,7 @@ void GUI_EoB::runCampMenu() {
if (cnt > 4) {
_vm->dropCharacter(selectCharacterDialogue(53));
_vm->gui_drawPlayField(false);
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _vm->_useHiResDithering ? 1 : 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
_screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawAllCharPortraitsWithStats();
_screen->setFont(Screen::FID_8_FNT);
@@ -2607,7 +2607,7 @@ Common::String GUI_EoB::transferTargetMenu(Common::Array<Common::String> &target
break;
} while (_saveSlotIdTemp[slot] == -1);
- _screen->copyRegion(72, 14, 72, 14, 176, 144, _vm->_useHiResDithering ? 7 : 12, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(72, 14, 72, 14, 176, 144, 12, 0, Screen::CR_NO_P_CHECK);
_screen->modifyScreenDim(11, xo, yo, dm->w, dm->h);
return (slot < 6) ? _savegameList[_savegameOffset + slot] : Common::String();
@@ -2650,7 +2650,7 @@ void GUI_EoB::createScreenThumbnail(Graphics::Surface &dst) {
_screen->getRealPalette(0, screenPal);
uint16 width = Screen::SCREEN_W;
uint16 height = Screen::SCREEN_H;
- if (_vm->_useHiResDithering) {
+ if (_vm->gameFlags().useHiRes) {
width <<= 1;
height <<= 1;
}
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index f1d9550e8f..df2297ebfd 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -46,12 +46,7 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_vcnTransitionMask = 0;
_vcnShift = 0;
_vcnColTable = 0;
- _vcnBlockWidth = 4;
- _vcnBlockHeight = 8;
- _vcnFlip0 = 0;
- _vcnFlip1 = 1;
_vmpPtr = 0;
- _vmpSize = 0;
_blockBrightness = _wllVcnOffset = 0;
_blockDrawingBuffer = 0;
_sceneWindowBuffer = 0;
@@ -173,9 +168,8 @@ Common::Error KyraRpgEngine::init() {
_blockDrawingBuffer = new uint16[1320];
memset(_blockDrawingBuffer, 0, 1320 * sizeof(uint16));
- uint32 swbSize = 22 * _vcnBlockWidth * 2 * 15 * _vcnBlockHeight;
- _sceneWindowBuffer = new uint8[swbSize];
- memset(_sceneWindowBuffer, 0, swbSize);
+ _sceneWindowBuffer = new uint8[21120];
+ memset(_sceneWindowBuffer, 0, 21120);
_lvlShapeTop = new int16[18];
memset(_lvlShapeTop, 0, 18 * sizeof(int16));
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 50a4c9bdc1..f4678e302a 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -222,7 +222,6 @@ protected:
uint16 _decorationCount;
int16 _mappedDecorationsCount;
uint16 *_vmpPtr;
- uint16 _vmpSize;
uint8 *_vcnBlocks;
uint8 *_vcfBlocks;
uint8 *_vcnTransitionMask;
@@ -232,10 +231,6 @@ protected:
uint8 *_sceneWindowBuffer;
uint8 _blockBrightness;
uint8 _wllVcnOffset;
- uint8 _vcnBlockWidth;
- uint8 _vcnBlockHeight;
- uint8 _vcnFlip0;
- uint8 _vcnFlip1;
uint8 **_doorShapes;
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index 985286854b..fbddd620d1 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -60,7 +60,7 @@ void EoBCoreEngine::useMagicBookOrSymbol(int charIndex, int type) {
}
if (!_updateFlags)
- _screen->copyRegion(64, 121, 0, 0, 112, 56, 0, _useHiResDithering ? 4 : 10, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(64, 121, 0, 0, 112, 56, 0, 10, Screen::CR_NO_P_CHECK);
_updateFlags = 1;
gui_setPlayFieldButtons();
gui_drawSpellbook();
diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp
index f7d7d95b57..7f20c124ff 100644
--- a/engines/kyra/saveload_eob.cpp
+++ b/engines/kyra/saveload_eob.cpp
@@ -298,7 +298,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
useMagicBookOrSymbol(_openBookChar, _openBookType);
}
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _useHiResDithering ? 1 : 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
gui_toggleButtons();
setHandItem(_itemInHand);
diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp
index 3db055db90..bf9eb01332 100644
--- a/engines/kyra/scene_eob.cpp
+++ b/engines/kyra/scene_eob.cpp
@@ -144,10 +144,10 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
const char *vmpPattern = (_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.EMP" : "%s.VMP";
Common::SeekableReadStream *s = _res->createReadStream(Common::String::format(vmpPattern, (const char *)pos));
- _vmpSize = s->readUint16LE();
+ uint16 size = s->readUint16LE();
delete[] _vmpPtr;
- _vmpPtr = new uint16[_vmpSize];
- for (int i = 0; i < _vmpSize; i++)
+ _vmpPtr = new uint16[size];
+ for (int i = 0; i < size; i++)
_vmpPtr[i] = s->readUint16LE();
delete s;
@@ -283,7 +283,7 @@ void EoBCoreEngine::loadVcnData(const char *file, const uint8 *cgaMapping) {
_screen->loadBitmap(Common::String::format(filePattern, _lastBlockDataFile).c_str(), 3, 3, 0);
const uint8 *pos = _screen->getCPagePtr(3);
- uint32 vcnSize = READ_LE_UINT16(pos) * _vcnBlockWidth * _vcnBlockHeight;
+ uint32 vcnSize = READ_LE_UINT16(pos) << 5;
pos += 2;
const uint8 *colMap = pos;
@@ -292,78 +292,28 @@ void EoBCoreEngine::loadVcnData(const char *file, const uint8 *cgaMapping) {
delete[] _vcnBlocks;
_vcnBlocks = new uint8[vcnSize];
- if (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) {
- const uint8 *egaTable = _screen->getEGADitheringTable();
- assert(_vmpPtr);
- assert(egaTable);
-
- delete[] _vcnTransitionMask;
- _vcnTransitionMask = new uint8[vcnSize];
-
- for (int i = 0; i < _vmpSize; i++) {
- uint16 vcnOffs = _vmpPtr[i] & 0x3FFF;
- const uint8 *src = &pos[vcnOffs << 5];
- uint8 *dst1 = &_vcnBlocks[vcnOffs << 7];
- uint8 *dst3 = &_vcnTransitionMask[vcnOffs << 7];
- int palOffset = (i < 330) ? 0 : _wllVcnOffset;
-
- for (int y = 0; y < 8; y++) {
- uint8 *dst2 = dst1 + 8;
- uint8 *dst4 = dst3 + 8;
-
- for (int x = 0; x < 4; x++) {
- uint8 in = *src++;
-
- dst1[0] = dst2[0] = egaTable[colMap[(in >> 4) + palOffset]];
- dst1[1] = dst2[1] = egaTable[colMap[(in & 0x0f) + palOffset]];
- dst3[0] = dst4[0] = (in & 0xf0) ? 0 : 0xff;
- dst3[1] = dst4[1] = (in & 0x0f) ? 0 : 0xff;
-
- dst1 += 2;
- dst2 += 2;
- dst3 += 2;
- dst4 += 2;
- }
-
- dst1 += 8;
- dst3 += 8;
- }
- }
- } else if (_configRenderMode == Common::kRenderCGA) {
+ if (_configRenderMode == Common::kRenderCGA) {
uint8 *tmp = _screen->encodeShape(0, 0, 1, 8, false, cgaMapping);
delete[] tmp;
delete[] _vcnTransitionMask;
_vcnTransitionMask = new uint8[vcnSize];
- uint8 tblSwitch = 0;
+ uint8 tblSwitch = 1;
uint8 *dst = _vcnBlocks;
uint8 *dst2 = _vcnTransitionMask;
while (dst < _vcnBlocks + vcnSize) {
const uint16 *table = _screen->getCGADitheringTable((tblSwitch++) & 1);
for (int ii = 0; ii < 2; ii++) {
- *dst++ = ((table[pos[0]] & 0x000f) << 4) | ((table[pos[0]] & 0x0f00) >> 8);
- *dst++= ((table[pos[1]] & 0x000f) << 4) | ((table[pos[1]] & 0x0f00) >> 8);
-
- uint8 msk = 0;
- if (pos[0] & 0xf0)
- msk |= 0x30;
- if (pos[0] & 0x0f)
- msk |= 0x03;
- *dst2++ = msk ^ 0x33;
-
- msk = 0;
- if (pos[1] & 0xf0)
- msk |= 0x30;
- if (pos[1] & 0x0f)
- msk |= 0x03;
- *dst2++ = msk ^ 0x33;
-
+ *dst++ = (table[pos[0]] & 0x000f) | ((table[pos[0]] & 0x0f00) >> 4);
+ *dst++ = (table[pos[1]] & 0x000f) | ((table[pos[1]] & 0x0f00) >> 4);
+ *dst2++ = ((pos[0] & 0xf0 ? 0x30 : 0) | (pos[0] & 0x0f ? 0x03 : 0)) ^ 0x33;
+ *dst2++ = ((pos[1] & 0xf0 ? 0x30 : 0) | (pos[1] & 0x0f ? 0x03 : 0)) ^ 0x33;
pos += 2;
}
}
} else {
- if (_configRenderMode != Common::kRenderEGA)
+ if (!(_flags.gameID == GI_EOB1 && _configRenderMode == Common::kRenderEGA))
memcpy(_vcnColTable, colMap, 32);
memcpy(_vcnBlocks, pos, vcnSize);
}
diff --git a/engines/kyra/scene_rpg.cpp b/engines/kyra/scene_rpg.cpp
index 3a694e05fe..5a0433323c 100644
--- a/engines/kyra/scene_rpg.cpp
+++ b/engines/kyra/scene_rpg.cpp
@@ -348,9 +348,6 @@ bool KyraRpgEngine::checkSceneUpdateNeed(int block) {
void KyraRpgEngine::drawVcnBlocks() {
uint8 *d = _sceneWindowBuffer;
uint16 *bdb = _blockDrawingBuffer;
- uint16 pitch = 22 * _vcnBlockWidth * 2;
- uint8 pxl[2];
- pxl[0] = pxl[1] = 0;
for (int y = 0; y < 15; y++) {
for (int x = 0; x < 22; x++) {
@@ -374,7 +371,7 @@ void KyraRpgEngine::drawVcnBlocks() {
uint8 *src = 0;
if (vcnOffset) {
- src = &_vcnBlocks[vcnOffset * _vcnBlockWidth * _vcnBlockHeight];
+ src = &_vcnBlocks[vcnOffset << 5];
wllVcnOffset = _wllVcnOffset;
} else {
// floor/ceiling blocks
@@ -384,37 +381,36 @@ void KyraRpgEngine::drawVcnBlocks() {
vcnOffset &= 0x3fff;
}
- src = (_vcfBlocks ? _vcfBlocks : _vcnBlocks) + (vcnOffset * _vcnBlockWidth * _vcnBlockHeight);
+ src = (_vcfBlocks ? _vcfBlocks : _vcnBlocks) + (vcnOffset << 5);
}
uint8 shift = _vcnShift ? _vcnShift[vcnOffset] : _blockBrightness;
if (horizontalFlip) {
- for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
- src += (_vcnBlockWidth - 1);
- for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ for (int blockY = 0; blockY < 8; blockY++) {
+ src += 3;
+ for (int blockX = 0; blockX < 4; blockX++) {
uint8 bl = *src--;
- d[_vcnFlip0] = _vcnColTable[((bl & 0x0f) + wllVcnOffset) | shift];
- d[_vcnFlip1] = _vcnColTable[((bl >> 4) + wllVcnOffset) | shift];
- d += 2;
+ *d++ = _vcnColTable[((bl & 0x0f) + wllVcnOffset) | shift];
+ *d++ = _vcnColTable[((bl >> 4) + wllVcnOffset) | shift];
}
- src += (_vcnBlockWidth + 1);
- d += (pitch - 2 * _vcnBlockWidth);
+ src += 5;
+ d += 168;
}
} else {
- for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
- for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ for (int blockY = 0; blockY < 8; blockY++) {
+ for (int blockX = 0; blockX < 4; blockX++) {
uint8 bl = *src++;
*d++ = _vcnColTable[((bl >> 4) + wllVcnOffset) | shift];
*d++ = _vcnColTable[((bl & 0x0f) + wllVcnOffset) | shift];
}
- d += (pitch - 2 * _vcnBlockWidth);
+ d += 168;
}
}
- d -= (pitch * _vcnBlockHeight - 2 * _vcnBlockWidth);
+ d -= 1400;
if (vcnExtraOffsetWll) {
- d -= (2 * _vcnBlockWidth);
+ d -= 8;
horizontalFlip = false;
if (vcnExtraOffsetWll & 0x4000) {
@@ -423,38 +419,38 @@ void KyraRpgEngine::drawVcnBlocks() {
}
shift = _vcnShift ? _vcnShift[vcnExtraOffsetWll] : _blockBrightness;
- src = &_vcnBlocks[vcnExtraOffsetWll * _vcnBlockWidth * _vcnBlockHeight];
- uint8 *maskTable = _vcnTransitionMask ? &_vcnTransitionMask[vcnExtraOffsetWll * _vcnBlockWidth * _vcnBlockHeight] : 0;
+ src = &_vcnBlocks[vcnExtraOffsetWll << 5];
+ uint8 *maskTable = _vcnTransitionMask ? &_vcnTransitionMask[vcnExtraOffsetWll << 5] : 0;
if (horizontalFlip) {
- for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
- src += (_vcnBlockWidth - 1);
- maskTable += (_vcnBlockWidth - 1);
- for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ for (int blockY = 0; blockY < 8; blockY++) {
+ src += 3;
+ maskTable += 3;
+ for (int blockX = 0; blockX < 4; blockX++) {
uint8 bl = *src--;
uint8 mask = _vcnTransitionMask ? *maskTable-- : 0;
- pxl[_vcnFlip0] = _vcnColTable[((bl & 0x0f) + wllVcnRmdOffset) | shift];
- pxl[_vcnFlip1] = _vcnColTable[((bl >> 4) + wllVcnRmdOffset) | shift];
+ uint8 h = _vcnColTable[((bl & 0x0f) + wllVcnRmdOffset) | shift];
+ uint8 l = _vcnColTable[((bl >> 4) + wllVcnRmdOffset) | shift];
if (_vcnTransitionMask)
- *d = (*d & (mask & 0x0f)) | pxl[0];
- else if (pxl[0])
- *d = pxl[0];
+ *d = (*d & (mask & 0x0f)) | h;
+ else if (h)
+ *d = h;
d++;
if (_vcnTransitionMask)
- *d = (*d & (mask >> 4)) | pxl[1];
- else if (pxl[1])
- *d = pxl[1];
+ *d = (*d & (mask >> 4)) | l;
+ else if (l)
+ *d = l;
d++;
}
- src += (_vcnBlockWidth + 1);
- maskTable += (_vcnBlockWidth + 1);
- d += (pitch - 2 * _vcnBlockWidth);
+ src += 5;
+ maskTable += 5;
+ d += 168;
}
} else {
- for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
- for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ for (int blockY = 0; blockY < 8; blockY++) {
+ for (int blockX = 0; blockX < 4; blockX++) {
uint8 bl = *src++;
uint8 mask = _vcnTransitionMask ? *maskTable++ : 0;
uint8 h = _vcnColTable[((bl >> 4) + wllVcnRmdOffset) | shift];
@@ -472,13 +468,13 @@ void KyraRpgEngine::drawVcnBlocks() {
*d = l;
d++;
}
- d += (pitch - 2 * _vcnBlockWidth);
+ d += 168;
}
}
- d -= (pitch * _vcnBlockHeight - 2 * _vcnBlockWidth);
+ d -= 1400;
}
}
- d += (pitch * (_vcnBlockHeight - 1));
+ d += 1232;
}
screen()->copyBlockToPage(_sceneDrawPage1, _sceneXoffset, 0, 176, 120, _sceneWindowBuffer);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 04d805737f..c400b330b9 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -51,8 +51,6 @@ 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;
@@ -114,7 +112,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;
}
@@ -154,9 +152,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 +163,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 +288,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 +299,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 +489,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 +503,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 +668,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 +877,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 +895,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 +915,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 +924,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 +944,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 +953,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 +987,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 +996,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;
}
}
@@ -1187,7 +1160,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 +1206,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();
@@ -1362,9 +1336,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 +1347,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, ...) {
@@ -3215,7 +3186,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 +3293,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 +3310,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 +3325,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.
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 60bfeb3241..159d415ea6 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -146,7 +146,7 @@ private:
*/
class OldDOSFont : public Font {
public:
- OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering);
+ OldDOSFont(Common::RenderMode mode);
~OldDOSFont();
bool load(Common::SeekableReadStream &file);
@@ -168,8 +168,6 @@ private:
int _numGlyphs;
Common::RenderMode _renderMode;
- bool _useHiResEGADithering;
- bool _useLoResEGA;
static uint16 *_cgaDitheringTable;
static int _numRef;
@@ -426,12 +424,12 @@ public:
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src);
void shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent);
- virtual void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
+ void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
void clearPage(int pageNum);
- virtual uint8 getPagePixel(int pageNum, int x, int y);
- virtual void setPagePixel(int pageNum, int x, int y, uint8 color);
+ uint8 getPagePixel(int pageNum, int x, int y);
+ void setPagePixel(int pageNum, int x, int y, uint8 color);
const uint8 *getCPagePtr(int pageNum) const;
uint8 *getPageRect(int pageNum, int x, int y, int w, int h);
@@ -457,7 +455,7 @@ public:
void copyPalette(const int dst, const int src);
// gui specific (processing on _curPage)
- virtual void drawLine(bool vertical, int x, int y, int length, int color);
+ void drawLine(bool vertical, int x, int y, int length, int color);
void drawClippedLine(int x1, int y1, int x2, int y2, int color);
virtual void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2);
void drawBox(int x1, int y1, int x2, int y2, int color);
@@ -472,7 +470,7 @@ public:
int getCharWidth(uint16 c) const;
int getTextWidth(const char *str) const;
- virtual void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
+ void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
virtual void setTextColorMap(const uint8 *cmap) = 0;
void setTextColor(const uint8 *cmap, int a, int b);
@@ -573,14 +571,12 @@ protected:
uint8 *_pagePtrs[16];
uint8 *_sjisOverlayPtrs[SCREEN_OVLS_NUM];
- uint8 _pageScaleFactor[SCREEN_PAGE_NUM];
uint8 _pageMapping[SCREEN_PAGE_NUM];
bool _useOverlays;
bool _useSJIS;
bool _use16ColorMode;
bool _useHiResEGADithering;
- bool _useLoResEGA;
bool _isAmiga;
Common::RenderMode _renderMode;
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index ae75c111b4..eed9647069 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -52,10 +52,9 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_cgaScaleTable = 0;
_gfxMaxY = 0;
_egaDitheringTable = 0;
- _egaPixelValueTable = 0;
_cgaMappingDefault = 0;
_cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
- _useLoResEGA = _useHiResEGADithering = false;
+ _useHiResEGADithering = false;
}
Screen_EoB::~Screen_EoB() {
@@ -63,18 +62,11 @@ Screen_EoB::~Screen_EoB() {
delete[] _dsTempPage;
delete[] _cgaScaleTable;
delete[] _egaDitheringTable;
- delete[] _egaPixelValueTable;
delete[] _cgaDitheringTables[0];
delete[] _cgaDitheringTables[1];
}
bool Screen_EoB::init() {
- // Define hi-res pages for EGA mode in EOB II
- if (_vm->gameFlags().useHiRes) {
- for (int i = 0; i < 8; i++)
- _pageScaleFactor[i] = 2;
- }
-
if (Screen::init()) {
int temp;
_gfxMaxY = _vm->staticres()->loadRawData(kEoBBaseExpObjectY, temp);
@@ -98,13 +90,8 @@ bool Screen_EoB::init() {
if (_vm->gameFlags().useHiRes && _renderMode == Common::kRenderEGA) {
_useHiResEGADithering = true;
_egaDitheringTable = new uint8[256];
- _egaPixelValueTable = new uint8[256];
- for (int i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++)
_egaDitheringTable[i] = i & 0x0f;
- _egaPixelValueTable[i] = i & 0x0f;
- }
- } else if (_renderMode == Common::kRenderEGA) {
- _useLoResEGA = true;
} else if (_renderMode == Common::kRenderCGA) {
_cgaMappingDefault = _vm->staticres()->loadRawData(kEoB1CgaMappingDefault, temp);
_cgaDitheringTables[0] = new uint16[256];
@@ -144,13 +131,19 @@ void Screen_EoB::setMouseCursor(int x, int y, const byte *shape, const uint8 *ov
int mouseH = (shape[3]);
int colorKey = (_renderMode == Common::kRenderCGA) ? 0 : _cursorColorKey;
- uint8 *cursor = new uint8[mouseW * _pageScaleFactor[6] * mouseH * _pageScaleFactor[6]];
+ int scaleFactor = _useHiResEGADithering ? 2 : 1;
+
+ uint8 *cursor = new uint8[mouseW * scaleFactor * mouseH * scaleFactor];
// We use memset and copyBlockToPage instead of fillRect to make sure that the
// color key 0xFF doesn't get converted into EGA color
- memset(cursor, colorKey, mouseW * _pageScaleFactor[6] * mouseH * _pageScaleFactor[6]);
+ memset(cursor, colorKey, mouseW * scaleFactor * mouseH * scaleFactor);
copyBlockToPage(6, 0, 0, mouseW, mouseH, cursor);
drawShape(6, shape, 0, 0, 0, 2, ovl);
CursorMan.showMouse(false);
+
+ if (_useHiResEGADithering) {
+ }
+
copyRegionToBuffer(6, 0, 0, mouseW, mouseH, cursor);
// Mouse cursor post processing for CGA mode. Unlike the original (which uses drawShape for the mouse cursor)
@@ -176,7 +169,7 @@ void Screen_EoB::setMouseCursor(int x, int y, const byte *shape, const uint8 *ov
}
}
- CursorMan.replaceCursor(cursor, mouseW * _pageScaleFactor[6], mouseH * _pageScaleFactor[6], x, y, colorKey);
+ CursorMan.replaceCursor(cursor, mouseW * scaleFactor, mouseH * scaleFactor, x, y, colorKey);
if (isMouseVisible())
CursorMan.showMouse(true);
delete[] cursor;
@@ -192,19 +185,6 @@ void Screen_EoB::loadFileDataToPage(Common::SeekableReadStream *s, int pageNum,
s->read(_pagePtrs[pageNum], size);
}
-void Screen_EoB::printText(const char *str, int x, int y, uint8 color1, uint8 color2) {
- if (_useHiResEGADithering) {
- // This is sort of an abuse of the text color map. But since EOB doesn't use it anyway
- // and the font drawing code needs access to both the original color values and the
- // EGA dithering colors we pass them on like this.
- uint8 cmap[2];
- cmap[0] = _egaDitheringTable[color2];
- cmap[1] = _egaDitheringTable[color1];
- setTextColor(cmap, 2, 3);
- }
- Screen::printText(str, x, y, color1, color2);
-}
-
void Screen_EoB::printShadedText(const char *string, int x, int y, int col1, int col2) {
printText(string, x - 1, y, 12, col2);
printText(string, x, y + 1, 12, 0);
@@ -281,23 +261,10 @@ void Screen_EoB::convertPage(int srcPage, int dstPage, const uint8 *cgaMapping)
src += 2;
}
}
-
- } else if (_useHiResEGADithering) {
- for (int height = SCREEN_H; height; height--) {
- uint8 *dst2 = dst + SCREEN_W * 2;
- for (int width = SCREEN_W; width; width--) {
- uint8 in = _egaDitheringTable[*src++];
- *dst++ = *dst2++ = in >> 4;
- *dst++ = *dst2++ = in & 0x0f;
- }
- dst += (SCREEN_W * 2);
- }
-
- } else if (_renderMode == Common::kRenderEGA) {
+ } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
uint32 len = SCREEN_W * SCREEN_H;
while (len--)
*dst++ = *src++ & 0x0f;
-
} else {
copyPage(srcPage, dstPage);
}
@@ -306,111 +273,6 @@ void Screen_EoB::convertPage(int srcPage, int dstPage, const uint8 *cgaMapping)
_forceFullUpdate = true;
}
-void Screen_EoB::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum, bool xored) {
- if (!_useHiResEGADithering) {
- Screen::fillRect(x1, y1, x2, y2, color, pageNum, xored);
- return;
- }
-
- assert(x2 < SCREEN_W && y2 < SCREEN_H);
- if (pageNum == -1)
- pageNum = _curPage;
-
- uint16 pitch = (SCREEN_W - (x2 - x1 + 1)) * _pageScaleFactor[pageNum];
- uint8 col1 = (_egaDitheringTable[color] >> 4);
- uint8 col2 = (_egaDitheringTable[color] & 0x0f);
-
- x1 *= _pageScaleFactor[pageNum];
- y1 *= _pageScaleFactor[pageNum];
- x2 *= _pageScaleFactor[pageNum];
- y2 *= _pageScaleFactor[pageNum];
- uint16 w = x2 - x1 + _pageScaleFactor[pageNum];
- uint16 h = y2 - y1 + _pageScaleFactor[pageNum];
-
- uint8 *dst = getPagePtr(pageNum) + y1 * SCREEN_W * _pageScaleFactor[pageNum] + x1;
- if (pageNum == 0 || pageNum == 1)
- addDirtyRect(x1, y1, w, h);
-
- while (h--) {
- for (uint16 w1 = w; w1; w1 -= 2) {
- *dst++ = col1;
- *dst++ = col2;
- }
- dst += pitch;
- }
-}
-
-void Screen_EoB::drawLine(bool vertical, int x, int y, int length, int color) {
- if (!_useHiResEGADithering) {
- Screen::drawLine(vertical, x, y, length, color);
- return;
- }
-
- uint16 pitch = (SCREEN_W - 1) * _pageScaleFactor[_curPage];
- uint8 col1 = (_egaDitheringTable[color] >> 4);
- uint8 col2 = (_egaDitheringTable[color] & 0x0f);
-
- x *= _pageScaleFactor[_curPage];
- y *= _pageScaleFactor[_curPage];
- length *= _pageScaleFactor[_curPage];
- uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W * _pageScaleFactor[_curPage] + x;
- uint8 *ptr2 = ptr + SCREEN_W * _pageScaleFactor[_curPage];
-
- if (vertical) {
- assert((y + length) <= SCREEN_H * _pageScaleFactor[_curPage]);
- int currLine = 0;
- while (currLine < length) {
- *ptr++ = col1;
- *ptr++ = col2;
- ptr += pitch;
- currLine++;
- }
- } else {
- assert((x + length) <= SCREEN_W * _pageScaleFactor[_curPage]);
- int currLine = 0;
- while (currLine < length) {
- *ptr++ = *ptr2++ = col1;
- *ptr++ = *ptr2++ = col2;
- currLine += 2;
- }
- }
-
- if (_curPage == 0 || _curPage == 1)
- addDirtyRect(x, y, (vertical) ? _pageScaleFactor[_curPage] : length, (vertical) ? length : _pageScaleFactor[_curPage]);
-}
-
-uint8 Screen_EoB::getPagePixel(int pageNum, int x, int y) {
- if (!_useHiResEGADithering)
- return Screen::getPagePixel(pageNum, x, y);
-
- x *= _pageScaleFactor[_curPage];
- y *= _pageScaleFactor[_curPage];
- uint8 *pos = &_pagePtrs[pageNum][y * SCREEN_W * _pageScaleFactor[_curPage] + x];
-
- return _egaPixelValueTable[(pos[0] << 4) | (pos[1] & 0x0f)];
-}
-
-void Screen_EoB::setPagePixel(int pageNum, int x, int y, uint8 color) {
- if (!_useHiResEGADithering) {
- Screen::setPagePixel(pageNum, x, y, color);
- return;
- }
-
- assert(pageNum < SCREEN_PAGE_NUM);
- assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H);
-
- x *= _pageScaleFactor[_curPage];
- y *= _pageScaleFactor[_curPage];
-
- if (pageNum == 0 || pageNum == 1)
- addDirtyRect(x, y, _pageScaleFactor[pageNum], _pageScaleFactor[pageNum]);
-
- uint8 *pos = &_pagePtrs[pageNum][y * SCREEN_W * _pageScaleFactor[_curPage] + x];
- uint8 *pos2 = pos + SCREEN_W * _pageScaleFactor[_curPage];
- pos[0] = pos2[0] = _egaDitheringTable[color] >> 4;
- pos[1] = pos2[1] = _egaDitheringTable[color] & 0x0f;
-}
-
void Screen_EoB::setScreenPalette(const Palette &pal) {
if (_useHiResEGADithering && pal.getNumColors() != 16) {
generateEGADitheringTable(pal);
@@ -444,7 +306,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco
uint8 *srcLineStart = getPagePtr(_curPage | 1) + y * 320 + (x << 3);
uint8 *src = srcLineStart;
- if (_useLoResEGA)
+ if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)
encode8bit = false;
if (_renderMode == Common::kRenderCGA) {
@@ -568,11 +430,11 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco
*dst++ = (w & 0xff);
*dst++ = (h & 0xff);
- if (_useLoResEGA) {
+ if (_renderMode != Common::kRenderEGA || _useHiResEGADithering) {
+ memset(dst, 0xff, 0x10);
+ } else {
for (int i = 0; i < 16; i++)
dst[i] = i;
- } else {
- memset(dst, 0xff, 0x10);
}
uint8 *pal = dst;
@@ -632,7 +494,7 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
y += _dsY1;
}
- dst += (_dsX1 << 3) * _pageScaleFactor[pageNum];
+ dst += (_dsX1 << 3);
int16 dX = x - (_dsX1 << 3);
int16 dY = y;
int16 dW = _dsX2 - _dsX1;
@@ -704,11 +566,11 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
marginRight = w2 - marginLeft - width;
}
- dst += (dY * SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum] + dX * _pageScaleFactor[pageNum]);
+ dst += (dY * SCREEN_W + dX);
uint8 *dstL = dst;
if (pageNum == 0 || pageNum == 1)
- addDirtyRect(rX * _pageScaleFactor[pageNum], rY * _pageScaleFactor[pageNum], rW * _pageScaleFactor[pageNum], rH * _pageScaleFactor[pageNum]);
+ addDirtyRect(rX, rY, rW, rH);
while (dH--) {
int16 xpos = (int16) marginLeft;
@@ -743,7 +605,7 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
} while (xpos > 0);
}
- dst -= (xpos * _pageScaleFactor[pageNum]);
+ dst -= xpos;
xpos += width;
while (xpos > 0) {
@@ -752,12 +614,12 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
src += pixelStep;
if (m) {
- drawShapeSetPixel(dst, c, SCREEN_W * _pageScaleFactor[pageNum]);
- dst += _pageScaleFactor[pageNum];
+ drawShapeSetPixel(dst, c);
+ dst++;
xpos--;
} else {
uint8 len = (flags & 1) ? src[1] : src[0];
- dst += (len * _pageScaleFactor[pageNum]);
+ dst += len;
xpos -= len;
src += pixelStep;
}
@@ -783,7 +645,7 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
} while (xpos > 0);
}
- dstL += SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum];
+ dstL += SCREEN_W;
dst = dstL;
if (flags & 1)
src = src2 + 1;
@@ -851,12 +713,12 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
if (d < width)
width = d;
- dst += (dY * _pageScaleFactor[pageNum] * SCREEN_W * _pageScaleFactor[pageNum] + dX * _pageScaleFactor[pageNum]);
+ dst += (dY * SCREEN_W + dX);
if (pageNum == 0 || pageNum == 1)
- addDirtyRect(rX * _pageScaleFactor[pageNum], rY * _pageScaleFactor[pageNum], rW * _pageScaleFactor[pageNum], rH * _pageScaleFactor[pageNum]);
+ addDirtyRect(rX, rY, rW, rH);
- int pitch = SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum] - width * _pageScaleFactor[pageNum];
+ int pitch = SCREEN_W - width;
int16 lineSrcStep = (w2 - width) / pixelsPerByte;
uint8 lineSrcStepRemainder = (w2 - width) % pixelsPerByte;
@@ -899,8 +761,8 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
}
uint8 col = (pixelsPerByte == 2) ? pal[(in >> shift) & pixelPackingMask] : (*dst & ((trans >> shift) & (pixelPackingMask))) | pal[(in >> shift) & pixelPackingMask];
if (col || pixelsPerByte == 4)
- drawShapeSetPixel(dst, col, SCREEN_W * _pageScaleFactor[pageNum]);
- dst += _pageScaleFactor[pageNum];
+ drawShapeSetPixel(dst, col);
+ dst++;
shift = ((shift - (pixelStep * pixelPacking)) & 7);
}
src += lineSrcStep;
@@ -1367,15 +1229,14 @@ const uint8 *Screen_EoB::getEGADitheringTable() {
return _egaDitheringTable;
}
-void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 col, uint16 pitch) {
+void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 col) {
if ((_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) || _useHiResEGADithering) {
if (_shapeFadeMode[0]) {
if (_shapeFadeMode[1]) {
- col = _useHiResEGADithering ? _egaPixelValueTable[(dst[0] << 4) | (dst[1] & 0x0f)] : *dst;
+ col = *dst;
} else {
_shapeFadeInternal &= 7;
- col = _useHiResEGADithering ? _egaPixelValueTable[(dst[_shapeFadeInternal] << 4) | (dst[_shapeFadeInternal + 1] & 0x0f)] : dst[_shapeFadeInternal];
- _shapeFadeInternal++;
+ col = *(dst + _shapeFadeInternal++);
}
}
@@ -1386,13 +1247,7 @@ void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 col, uint16 pitch) {
}
}
- if (_useHiResEGADithering) {
- col = _egaDitheringTable[col];
- dst[0] = dst[pitch] = col >> 4;
- dst[1] = dst[pitch + 1] = col & 0x0f;
- } else {
- *dst = col;
- }
+ *dst = col;
}
void Screen_EoB::scaleShapeProcessLine2Bit(uint8 *&shpDst, const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc) {
@@ -1479,10 +1334,6 @@ void Screen_EoB::generateEGADitheringTable(const Palette &pal) {
}
*dst++ = col;
}
-
- memset(_egaPixelValueTable, 0, 256);
- for (int i = 0; i < 256; i++)
- _egaPixelValueTable[_egaDitheringTable[i]] = i;
}
void Screen_EoB::generateCGADitheringTables(const uint8 *mappingData) {
@@ -1546,11 +1397,10 @@ const uint8 Screen_EoB::_egaMatchTable[] = {
uint16 *OldDOSFont::_cgaDitheringTable = 0;
int OldDOSFont::_numRef = 0;
-OldDOSFont::OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering) : _renderMode(mode), _useHiResEGADithering(useHiResEGADithering) {
+OldDOSFont::OldDOSFont(Common::RenderMode mode) : _renderMode(mode) {
_data = 0;
_width = _height = _numGlyphs = 0;
_bitmapOffsets = 0;
- _useLoResEGA = (_renderMode == Common::kRenderEGA && !_useHiResEGADithering);
_numRef++;
if (!_cgaDitheringTable && _numRef == 1) {
@@ -1662,22 +1512,14 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const {
int w = (_width - 1) >> 3;
pitch -= _width;
- if (_useHiResEGADithering)
- pitch *= 2;
-
uint8 color1 = _colorMap[1];
uint8 color2 = _colorMap[0];
- uint8 colEGA11 = _colorMap[3] >> 4;
- uint8 colEGA12 = _colorMap[3] & 0x0f;
- uint8 colEGA21 = _colorMap[2] >> 4;
- uint8 colEGA22 = _colorMap[2] & 0x0f;
-
static const uint16 cgaColorMask[] = { 0, 0x5555, 0xAAAA, 0xFFFF };
uint16 cgaMask1 = cgaColorMask[color1 & 3];
uint16 cgaMask2 = cgaColorMask[color2 & 3];
- if (_renderMode == Common::kRenderCGA || _useLoResEGA) {
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
color1 &= 0x0f;
color2 &= 0x0f;
}
@@ -1734,27 +1576,13 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const {
break;
}
- if (_useHiResEGADithering) {
- if (s & i) {
- if (color1) {
- dst[0] = dst2[0] = colEGA11;
- dst[1] = dst2[1] = colEGA12;
- }
- } else if (color2) {
- dst[0] = dst2[0] = colEGA21;
- dst[1] = dst2[1] = colEGA22;
- }
- dst += 2;
- dst2 += 2;
- } else {
- if (s & i) {
- if (color1)
- *dst = color1;
- } else if (color2) {
- *dst = color2;
- }
- dst++;
+ if (s & i) {
+ if (color1)
+ *dst = color1;
+ } else if (color2) {
+ *dst = color2;
}
+ dst++;
}
if (cW)
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index fc40cfe903..2e3cbde452 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -45,7 +45,6 @@ public:
void loadFileDataToPage(Common::SeekableReadStream *s, int pageNum, uint32 size);
- void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
void printShadedText(const char *string, int x, int y, int col1, int col2);
void loadEoBBitmap(const char *file, const uint8 *cgaMapping, int tempPage, int destPage, int convertToPage);
@@ -53,11 +52,6 @@ public:
void convertPage(int srcPage, int dstPage, const uint8 *cgaMapping);
- void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
- void drawLine(bool vertical, int x, int y, int length, int color);
- uint8 getPagePixel(int pageNum, int x, int y);
- void setPagePixel(int pageNum, int x, int y, uint8 color);
-
void setScreenPalette(const Palette &pal);
void getRealPalette(int num, uint8 *dst);
@@ -88,7 +82,7 @@ public:
const uint8 *getEGADitheringTable();
private:
- void drawShapeSetPixel(uint8 *dst, uint8 col, uint16 pitch);
+ void drawShapeSetPixel(uint8 *dst, uint8 col);
void scaleShapeProcessLine2Bit(uint8 *&shpDst, const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc);
void scaleShapeProcessLine4Bit(uint8 *&dst, const uint8 *&src);
bool posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2);
@@ -115,7 +109,6 @@ private:
const uint8 *_cgaMappingDefault;
uint8 *_egaDitheringTable;
- uint8 *_egaPixelValueTable;
static const uint8 _egaMatchTable[];
static const ScreenDim _screenDimTable[];