[Scummvm-cvs-logs] scummvm master -> 30fa5e166379b9e0764b437c6925c22d908d7122

athrxx athrxx at scummvm.org
Fri Feb 24 18:11:47 CET 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ecd1a9f943 KYRA: (EOB) - cleanup CGA/EGA code a bit
3b574466fa COMMON: distinguish between 256 colors and 16 colors PC-98 rendering modes
30fa5e1663 KYRA: (EOB) - fix save file thumbnail generation in CGA/EGA mode


Commit: ecd1a9f9435c5fc5d502d75dd256394b5f3283f3
    https://github.com/scummvm/scummvm/commit/ecd1a9f9435c5fc5d502d75dd256394b5f3283f3
Author: athrxx (athrxx at scummvm.org)
Date: 2012-02-24T09:09:37-08:00

Commit Message:
KYRA: (EOB) - cleanup CGA/EGA code a bit

Changed paths:
    engines/kyra/chargen.cpp
    engines/kyra/detection.cpp
    engines/kyra/eobcommon.cpp
    engines/kyra/eobcommon.h
    engines/kyra/gui_eob.cpp
    engines/kyra/kyra_hof.cpp
    engines/kyra/kyra_lok.cpp
    engines/kyra/kyra_mr.cpp
    engines/kyra/kyra_rpg.cpp
    engines/kyra/kyra_v1.cpp
    engines/kyra/kyra_v1.h
    engines/kyra/lol.cpp
    engines/kyra/magic_eob.cpp
    engines/kyra/saveload_eob.cpp
    engines/kyra/screen.cpp
    engines/kyra/screen.h
    engines/kyra/screen_eob.cpp
    engines/kyra/screen_eob.h



diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index 73f5fcc..54e1abc 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -1496,7 +1496,7 @@ TransferPartyWiz::~TransferPartyWiz() {
 }
 
 bool TransferPartyWiz::start() {
-	_screen->copyPage(0, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12);
+	_screen->copyPage(0, _vm->_useHiResDithering ? 1 : 12);
 
 	if (!selectAndLoadTransferFile())
 		return false;
@@ -1536,7 +1536,7 @@ bool TransferPartyWiz::start() {
 
 bool TransferPartyWiz::selectAndLoadTransferFile() {
 	do {
-		_screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
+		_screen->copyPage(_vm->_useHiResDithering ? 1 : 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((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
+	_screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
 
 	if (target.empty())
 		return true;
@@ -1579,10 +1579,10 @@ bool TransferPartyWiz::selectAndLoadTransferFile() {
 			return true;
 	}
 
-	_screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
+	_screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
 
 	bool result = _vm->_gui->transferFileMenu(target, dest);
-	_screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
+	_screen->copyPage(_vm->_useHiResDithering ? 1 : 12, 0);
 
 	return result;
 }
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 1a4fd3b..46dfec8 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -140,6 +140,8 @@ bool KyraMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame
 		*engine = new Kyra::EoBEngine(syst, flags);
 		break;
 	case Kyra::GI_EOB2:
+		 if (Common::parseRenderMode(ConfMan.get("render_mode")) == Common::kRenderEGA)
+			 flags.useHiRes = true;
 		*engine = new Kyra::DarkMoonEngine(syst, flags);
 		break;
 #endif // ENABLE_EOB
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index ff53ba8..1489e4f 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -57,6 +57,8 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
 	_configMouse = true;
 	_loading = false;
 
+	_useHiResDithering = false;
+
 	_envAudioTimer = 0;
 	_flashShapeTimer = 0;
 	_drawSceneTimer = 0;
@@ -369,9 +371,11 @@ Common::Error EoBCoreEngine::init() {
 	if (ConfMan.hasKey("render_mode"))
 		_configRenderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
 
+	_useHiResDithering = (_configRenderMode == Common::kRenderEGA && _flags.useHiRes);
+
 	_screen = new Screen_EoB(this, _system);
 	assert(_screen);
-	_screen->setResolution(_flags.useHiResOverlay || (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA));
+	_screen->setResolution();
 
 	//MidiDriverType midiDriver = MidiDriver::detectDevice(MDT_PCSPK | MDT_ADLIB);
 	_sound = new SoundAdLibPC(this, _mixer);
@@ -390,7 +394,7 @@ Common::Error EoBCoreEngine::init() {
 	if (!_staticres->init())
 		error("_staticres->init() failed");
 
-	if (!_screen->init(_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA))
+	if (!_screen->init())
 		error("screen()->init() failed");
 
 	if (ConfMan.hasKey("save_slot")) {
@@ -413,6 +417,12 @@ 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;
@@ -1738,7 +1748,7 @@ void EoBCoreEngine::seq_portal() {
 bool EoBCoreEngine::checkPassword() {
 	char answ[20];
 	Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
-	_screen->copyPage(0, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10);
+	_screen->copyPage(0, _useHiResDithering ? 4 : 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);
@@ -1765,7 +1775,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((_screen->getPageScaleFactor(0) == 2) ? 4 : 10, 0);
+	_screen->copyPage(_useHiResDithering ? 4 : 10, 0);
 	return true;
 }
 
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 38be2a6..050fe2b 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -845,6 +845,8 @@ protected:
 	const uint8 *_cgaMappingLevel[5];
 	const uint8 *_cgaLevelMappingIndex;
 
+	bool _useHiResDithering;
+
 	// 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);
 	Common::String readOriginalSaveFile(Common::String &file);
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index eadfd10..ec9b674 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, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
+	_screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _useHiResDithering ? 1 : 12, Screen::CR_NO_P_CHECK);
 
 	_gui->runCampMenu();
 
-	_screen->copyRegion(0, 0, 0, 120, 176, 24, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 2, Screen::CR_NO_P_CHECK);
+	_screen->copyRegion(0, 0, 0, 120, 176, 24, _useHiResDithering ? 1 : 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, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10, 0, Screen::CR_NO_P_CHECK);
+	_screen->copyRegion(0, 0, 64, 121, 112, 56, _useHiResDithering ? 4 : 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, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
+					_screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _vm->_useHiResDithering ? 1 : 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, (_screen->getPageScaleFactor(0) == 2) ? 7 : 12, 0, Screen::CR_NO_P_CHECK);
+	_screen->copyRegion(72, 14, 72, 14, 176, 144, _vm->_useHiResDithering ? 7 : 12, 0, Screen::CR_NO_P_CHECK);
 	_screen->modifyScreenDim(11, xo, yo, dm->w, dm->h);
 
 	return (slot < 6) ? _savegameList[_savegameOffset + slot] : Common::String();
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index b07e3a4..0ba173d 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -221,7 +221,7 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) {
 Common::Error KyraEngine_HoF::init() {
 	_screen = new Screen_HoF(this, _system);
 	assert(_screen);
-	_screen->setResolution(_flags.useHiResOverlay);
+	_screen->setResolution();
 
 	_debugger = new Debugger_HoF(this);
 	assert(_debugger);
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index e8a2c02..1dd5390 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -167,12 +167,12 @@ KyraEngine_LoK::~KyraEngine_LoK() {
 }
 
 Common::Error KyraEngine_LoK::init() {
-	if (_flags.platform == Common::kPlatformPC98 && _flags.useHiResOverlay && ConfMan.getBool("16_color"))
+	if (_flags.platform == Common::kPlatformPC98 && _flags.useHiRes && ConfMan.getBool("16_color"))
 		_screen = new Screen_LoK_16(this, _system);
 	else
 		_screen = new Screen_LoK(this, _system);
 	assert(_screen);
-	_screen->setResolution(_flags.useHiResOverlay);
+	_screen->setResolution();
 
 	_debugger = new Debugger_LoK(this);
 	assert(_debugger);
@@ -961,7 +961,7 @@ void KyraEngine_LoK::registerDefaultSettings() {
 	// specific to the Kyra engine.
 	ConfMan.registerDefault("walkspeed", 2);
 
-	if (_flags.platform == Common::kPlatformPC98 && _flags.useHiResOverlay)
+	if (_flags.platform == Common::kPlatformPC98 && _flags.useHiRes)
 		ConfMan.registerDefault("16_color", false);
 }
 
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 38f473a..39ed0d0 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -203,7 +203,7 @@ KyraEngine_MR::~KyraEngine_MR() {
 Common::Error KyraEngine_MR::init() {
 	_screen = new Screen_MR(this, _system);
 	assert(_screen);
-	_screen->setResolution(_flags.useHiResOverlay);
+	_screen->setResolution();
 
 	_debugger = new Debugger_v2(this);
 	assert(_debugger);
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index 121731e..8857f64 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -171,12 +171,6 @@ Common::Error KyraRpgEngine::init() {
 	_wllWallFlags = new uint8[256];
 	memset(_wllWallFlags, 0, 256);
 
-	if (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) {
-		_vcnBlockWidth <<= 1;
-		_vcnBlockHeight <<= 1;
-		SWAP(_vcnFlip0, _vcnFlip1);
-	}
-
 	_blockDrawingBuffer = new uint16[1320];
 	memset(_blockDrawingBuffer, 0, 1320 * sizeof(uint16));
 	uint32 swbSize = 22 * _vcnBlockWidth * 2 * 15 * _vcnBlockHeight;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 7c67af2..2672618 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -233,19 +233,16 @@ KyraEngine_v1::~KyraEngine_v1() {
 Common::Point KyraEngine_v1::getMousePos() {
 	Common::Point mouse = _eventMan->getMousePos();
 
-	if (_flags.useHiResOverlay) {
+	if (_flags.useHiRes) {
 		mouse.x >>= 1;
 		mouse.y >>= 1;
 	}
 
-	mouse.x /= screen()->getPageScaleFactor(0);
-	mouse.y /= screen()->getPageScaleFactor(0);
-
 	return mouse;
 }
 
 void KyraEngine_v1::setMousePos(int x, int y) {
-	if (_flags.useHiResOverlay) {
+	if (_flags.useHiRes) {
 		x <<= 1;
 		y <<= 1;
 	}
@@ -312,12 +309,10 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
 		case Common::EVENT_LBUTTONUP: {
 			_mouseX = event.mouse.x;
 			_mouseY = event.mouse.y;
-			if (_flags.useHiResOverlay) {
+			if (_flags.useHiRes) {
 				_mouseX >>= 1;
 				_mouseY >>= 1;
 			}
-			_mouseX /= screen()->getPageScaleFactor(0);
-			_mouseY /= screen()->getPageScaleFactor(0);
 			keys = (event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800));
 			breakLoop = true;
 			} break;
@@ -326,12 +321,10 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
 		case Common::EVENT_RBUTTONUP: {
 			_mouseX = event.mouse.x;
 			_mouseY = event.mouse.y;
-			if (_flags.useHiResOverlay) {
+			if (_flags.useHiRes) {
 				_mouseX >>= 1;
 				_mouseY >>= 1;
 			}
-			_mouseX /= screen()->getPageScaleFactor(0);
-			_mouseY /= screen()->getPageScaleFactor(0);
 			keys = (event.type == Common::EVENT_RBUTTONDOWN ? 201 : (202 | 0x800));
 			breakLoop = true;
 			} break;
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 95d58d4..499f575 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -118,7 +118,7 @@ struct GameFlags {
 	bool useAltShapeHeader    : 1;    // alternative shape header (uses 2 bytes more, those are unused though)
 	bool isTalkie             : 1;
 	bool isOldFloppy          : 1;
-	bool useHiResOverlay      : 1;
+	bool useHiRes      : 1;
 	bool use16ColorMode       : 1;
 	bool useDigSound          : 1;
 	bool useInstallerPackage  : 1;
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 022a878..38e9d33 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -364,7 +364,7 @@ GUI *LoLEngine::gui() const {
 Common::Error LoLEngine::init() {
 	_screen = new Screen_LoL(this, _system);
 	assert(_screen);
-	_screen->setResolution(_flags.useHiResOverlay);
+	_screen->setResolution();
 
 	_debugger = new Debugger_LoL(this);
 	assert(_debugger);
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index b2949ce..9852868 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, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10, Screen::CR_NO_P_CHECK);
+		_screen->copyRegion(64, 121, 0, 0, 112, 56, 0, _useHiResDithering ? 4 : 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 4a446aa..f7d7d95 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, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
+	_screen->copyRegion(0, 120, 0, 0, 176, 24, 0, _useHiResDithering ? 1 : 12, Screen::CR_NO_P_CHECK);
 
 	gui_toggleButtons();
 	setHandItem(_itemInHand);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index ef6333b..d3b4d6f 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -106,8 +106,9 @@ bool Screen::init() {
 
 	memset(_fonts, 0, sizeof(_fonts));
 
-	if (_vm->gameFlags().useHiResOverlay) {
-		_useOverlays = true;
+	_useOverlays = (_vm->gameFlags().useHiRes && _renderMode != Common::kRenderEGA);
+
+	if (_useOverlays) {
 		_useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
 		_sjisInvisibleColor = (_vm->game() == GI_KYRA1) ? 0x80 : 0xF6;
 
@@ -226,7 +227,7 @@ bool Screen::enableScreenDebug(bool enable) {
 
 	if (_debugEnabled != enable) {
 		_debugEnabled = enable;
-		setResolution(_vm->gameFlags().useHiResOverlay);
+		setResolution();
 		_forceFullUpdate = true;
 		updateScreen();
 	}
@@ -234,14 +235,14 @@ bool Screen::enableScreenDebug(bool enable) {
 	return temp;
 }
 
-void Screen::setResolution(bool hiRes) {
+void Screen::setResolution() {
 	byte palette[3*256];
 	_system->getPaletteManager()->grabPalette(palette, 0, 256);
 
 	int width = 320, height = 200;
 	bool defaultTo1xScaler = false;
 
-	if (hiRes) {
+	if (_vm->gameFlags().useHiRes) {
 		defaultTo1xScaler = true;
 		height = 400;
 
@@ -466,11 +467,6 @@ const uint8 *Screen::getCPagePtr(int pageNum) const {
 	return _pagePtrs[pageNum];
 }
 
-int Screen::getPageScaleFactor(int pageNum) {
-	assert(pageNum < SCREEN_PAGE_NUM);
-	return _pageScaleFactor[pageNum];
-}
-
 uint8 *Screen::getPageRect(int pageNum, int x, int y, int w, int h) {
 	assert(pageNum < SCREEN_PAGE_NUM);
 	if (pageNum == 0 || pageNum == 1)
@@ -1226,7 +1222,7 @@ 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->game() == GI_EOB2) && (_renderMode == Common::kRenderEGA));
+			fnt = new OldDOSFont(_renderMode, _vm->gameFlags().useHiRes);
 #endif // ENABLE_EOB
 		else
 			fnt = new DOSFont();
@@ -2896,21 +2892,20 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) {
 	if (_vm->gameFlags().useAltShapeHeader)
 		shape -= 2;
 
-	if (_vm->gameFlags().useHiResOverlay) {
+	if (_vm->gameFlags().useHiRes) {
 		x <<= 1;
 		y <<= 1;
 		mouseWidth <<= 1;
 		mouseHeight <<= 1;
 	}
 
-
 	uint8 *cursor = new uint8[mouseHeight * mouseWidth];
 	fillRect(0, 0, mouseWidth, mouseHeight, _cursorColorKey, 8);
 	drawShape(8, shape, 0, 0, 0, 0);
 
 	int xOffset = 0;
 
-	if (_vm->gameFlags().useHiResOverlay) {
+	if (_vm->gameFlags().useHiRes) {
 		xOffset = mouseWidth;
 		scale2x(getPagePtr(8) + mouseWidth, SCREEN_W, getPagePtr(8), SCREEN_W, mouseWidth, mouseHeight);
 		postProcessCursor(getPagePtr(8) + mouseWidth, mouseWidth, mouseHeight, SCREEN_W);
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 18c0aa9..4f7f6d4 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -168,6 +168,7 @@ private:
 
 	Common::RenderMode _renderMode;
 	bool _useHiResEGADithering;
+	bool _useLoResEGA;
 
 	static uint16 *_cgaDitheringTable;
 	static int _numRef;
@@ -398,7 +399,7 @@ public:
 
 	// init
 	virtual bool init();
-	virtual void setResolution(bool hiRes = false);
+	virtual void setResolution();
 
 	void updateScreen();
 
@@ -433,8 +434,6 @@ public:
 	virtual void setPagePixel(int pageNum, int x, int y, uint8 color);
 
 	const uint8 *getCPagePtr(int pageNum) const;
-	int getPageScaleFactor(int pageNum);
-
 	uint8 *getPageRect(int pageNum, int x, int y, int w, int h);
 
 	// palette handling
@@ -580,6 +579,8 @@ protected:
 	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 38521d7..dc53e8a 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -55,7 +55,7 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
 	_egaPixelValueTable = 0;
 	_cgaMappingDefault = 0;
 	_cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
-	_useHiResEGADithering = false;
+	_useLoResEGA = _useHiResEGADithering = false;
 }
 
 Screen_EoB::~Screen_EoB() {
@@ -69,12 +69,8 @@ Screen_EoB::~Screen_EoB() {
 }
 
 bool Screen_EoB::init() {
-	return init(false);
-}
-
-bool Screen_EoB::init(bool useHiResEGADithering) {
 	// Define hi-res pages for EGA mode in EOB II
-	if (useHiResEGADithering) {
+	if (_vm->gameFlags().useHiRes) {
 		for (int i = 0; i < 8; i++)
 			_pageScaleFactor[i] = 2;
 	}
@@ -99,15 +95,16 @@ bool Screen_EoB::init(bool useHiResEGADithering) {
 
 		_dsTempPage = new uint8[12000];
 
-		if (_renderMode == Common::kRenderEGA) {
-			_useHiResEGADithering = useHiResEGADithering;
+		if (_vm->gameFlags().useHiRes && _renderMode == Common::kRenderEGA) {
+			_useHiResEGADithering = true;
 			_egaDitheringTable = new uint8[256];
 			_egaPixelValueTable = new uint8[256];
 			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];
@@ -432,7 +429,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 (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)
+	if (_useLoResEGA)
 		encode8bit = false;
 
 	if (_renderMode == Common::kRenderCGA) {
@@ -556,7 +553,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco
 		*dst++ = (w & 0xff);
 		*dst++ = (h & 0xff);
 
-		if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
+		if (_useLoResEGA) {
 			for (int i = 0; i < 16; i++)
 				dst[i] = i;
 		} else {
@@ -1538,6 +1535,7 @@ OldDOSFont::OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering) : _re
 	_data = 0;
 	_width = _height = _numGlyphs = 0;
 	_bitmapOffsets = 0;
+	_useLoResEGA = (_renderMode == Common::kRenderEGA && !_useHiResEGADithering);
 
 	_numRef++;
 	if (!_cgaDitheringTable && _numRef == 1) {
@@ -1664,7 +1662,7 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const {
 	uint16 cgaMask1 = cgaColorMask[color1 & 3];
 	uint16 cgaMask2 = cgaColorMask[color2 & 3];
 
-	if (_renderMode == Common::kRenderCGA || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) {
+	if (_renderMode == Common::kRenderCGA || _useLoResEGA) {
 		color1 &= 0x0f;
 		color2 &= 0x0f;
 	}
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 2bcfbd8..92de5c8 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -36,7 +36,6 @@ public:
 	virtual ~Screen_EoB();
 
 	bool init();
-	bool init(bool useHiResEGADithering);
 
 	void setClearScreenDim(int dim);
 	void clearCurDim();
@@ -116,7 +115,6 @@ private:
 
 	uint8 *_egaDitheringTable;
 	uint8 *_egaPixelValueTable;
-	bool _useHiResEGADithering;
 
 	static const uint8 _egaMatchTable[];
 	static const ScreenDim _screenDimTable[];


Commit: 3b574466fa3cb28c521234f5460164ade91a8d50
    https://github.com/scummvm/scummvm/commit/3b574466fa3cb28c521234f5460164ade91a8d50
Author: athrxx (athrxx at scummvm.org)
Date: 2012-02-24T09:09:38-08:00

Commit Message:
COMMON: distinguish between 256 colors and 16 colors PC-98 rendering modes

KYRA 1 PC-98 supports both modes in the same target. The desired mode can now be selected in the rendering options. We did have good support for the 16 colors mode of KYRA 1 already. This mode could not really be selected though (except by manually modifying the config file or the code).

Changed paths:
    common/util.cpp
    common/util.h
    engines/kyra/detection_tables.h
    engines/kyra/kyra_lok.cpp
    gui/options.cpp



diff --git a/common/util.cpp b/common/util.cpp
index 05d29fa..5911f9b 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -289,7 +289,8 @@ const RenderModeDescription g_renderModes[] = {
 	{ "vga", "VGA", kRenderVGA },
 	{ "amiga", "Amiga", kRenderAmiga },
 	{ "fmtowns", "FM-Towns", kRenderFMTowns },
-	{ "pc98", "PC-98", kRenderPC98 },
+	{ "pc9821", "PC-9821 (256 Colors)", kRenderPC9821 },
+	{ "pc9801", "PC-9801 (16 Colors)", kRenderPC9801 },
 	{0, 0, kRenderDefault}
 };
 
@@ -361,7 +362,8 @@ const struct GameOpt {
 	{ GUIO_RENDERVGA,		"vga" },
 	{ GUIO_RENDERAMIGA,		"amiga" },
 	{ GUIO_RENDERFMTOWNS,	"fmtowns" },
-	{ GUIO_RENDERPC98,		"pc98" },
+	{ GUIO_RENDERPC9821,	"pc9821" },
+	{ GUIO_RENDERPC9801,	"pc9801" },
 
 	{ GUIO_NONE, 0 }
 };
diff --git a/common/util.h b/common/util.h
index b6f6370..841280f 100644
--- a/common/util.h
+++ b/common/util.h
@@ -108,7 +108,8 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
 #define GUIO_RENDERVGA		"\034"
 #define GUIO_RENDERAMIGA	"\035"
 #define GUIO_RENDERFMTOWNS	"\036"
-#define GUIO_RENDERPC98		"\037"
+#define GUIO_RENDERPC9821	"\037"
+#define GUIO_RENDERPC9801	"\040"
 
 #define GUIO0() (GUIO_NONE)
 #define GUIO1(a) (a)
@@ -316,7 +317,8 @@ enum RenderMode {
 	kRenderHercA = 5,
 	kRenderAmiga = 6,
 	kRenderFMTowns = 7,
-	kRenderPC98 = 8
+	kRenderPC9821 = 8,
+	kRenderPC9801 = 9
 };
 
 struct RenderModeDescription {
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 44e604c..204c49c 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -297,7 +297,7 @@ const KYRAGameDescription adGameDescs[] = {
 			Common::JA_JPN,
 			Common::kPlatformPC98,
 			ADGF_NO_FLAGS,
-			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
+			GUIO4(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9821, GUIO_RENDERPC9801)
 		},
 		KYRA1_TOWNS_SJIS_FLAGS
 	},
@@ -743,7 +743,7 @@ const KYRAGameDescription adGameDescs[] = {
 			Common::EN_ANY,
 			Common::kPlatformPC98,
 			ADGF_CD,
-			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
+			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9821)
 		},
 		KYRA2_TOWNS_FLAGS
 	},
@@ -755,7 +755,7 @@ const KYRAGameDescription adGameDescs[] = {
 			Common::JA_JPN,
 			Common::kPlatformPC98,
 			ADGF_CD,
-			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
+			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9821)
 		},
 		KYRA2_TOWNS_SJIS_FLAGS
 	},
@@ -1418,7 +1418,7 @@ const KYRAGameDescription adGameDescs[] = {
 			Common::JA_JPN,
 			Common::kPlatformPC98,
 			ADGF_NO_FLAGS,
-			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
+			GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9801)
 		},
 		LOL_PC98_SJIS_FLAGS
 	},
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index 1dd5390..4ea686a 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -167,7 +167,7 @@ KyraEngine_LoK::~KyraEngine_LoK() {
 }
 
 Common::Error KyraEngine_LoK::init() {
-	if (_flags.platform == Common::kPlatformPC98 && _flags.useHiRes && ConfMan.getBool("16_color"))
+	if (Common::parseRenderMode(ConfMan.get("render_mode")) == Common::kRenderPC9801)
 		_screen = new Screen_LoK_16(this, _system);
 	else
 		_screen = new Screen_LoK(this, _system);
diff --git a/gui/options.cpp b/gui/options.cpp
index bfad81c..be1c091 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1050,7 +1050,8 @@ Common::String OptionsDialog::renderType2GUIO(uint32 renderType) {
 		{ Common::kRenderVGA,		GUIO_RENDERVGA },
 		{ Common::kRenderAmiga,		GUIO_RENDERAMIGA },
 		{ Common::kRenderFMTowns,	GUIO_RENDERFMTOWNS },
-		{ Common::kRenderPC98,		GUIO_RENDERPC98 }
+		{ Common::kRenderPC9821,	GUIO_RENDERPC9821 },
+		{ Common::kRenderPC9801,	GUIO_RENDERPC9801 }
 	};
 	Common::String res;
 


Commit: 30fa5e166379b9e0764b437c6925c22d908d7122
    https://github.com/scummvm/scummvm/commit/30fa5e166379b9e0764b437c6925c22d908d7122
Author: athrxx (athrxx at scummvm.org)
Date: 2012-02-24T09:09:39-08:00

Commit Message:
KYRA: (EOB) - fix save file thumbnail generation in CGA/EGA mode

Changed paths:
    engines/kyra/gui_eob.cpp
    engines/kyra/screen.h
    engines/kyra/screen_eob.cpp
    engines/kyra/screen_eob.h



diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index ec9b674..e8e69d5 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -2648,7 +2648,14 @@ bool GUI_EoB::transferFileMenu(Common::String &targetName, Common::String &selec
 void GUI_EoB::createScreenThumbnail(Graphics::Surface &dst) {
 	uint8 *screenPal = new uint8[768];
 	_screen->getRealPalette(0, screenPal);
-	::createThumbnail(&dst, _screen->getCPagePtr(7), Screen::SCREEN_W, Screen::SCREEN_H, screenPal);
+	uint16 width = Screen::SCREEN_W;
+	uint16 height = Screen::SCREEN_H;
+	if (_vm->_useHiResDithering) {
+		width <<= 1;
+		height <<= 1;
+	}
+
+	::createThumbnail(&dst, _screen->getCPagePtr(7), width, height, screenPal);
 	delete[] screenPal;
 }
 
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 4f7f6d4..a0cf574 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -452,7 +452,7 @@ public:
 	void enableInterfacePalette(bool e);
 	void setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b);
 
-	void getRealPalette(int num, uint8 *dst);
+	virtual void getRealPalette(int num, uint8 *dst);
 	Palette &getPalette(int num);
 	void copyPalette(const int dst, const int src);
 
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index dc53e8a..9fae729 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -422,6 +422,21 @@ void Screen_EoB::setScreenPalette(const Palette &pal) {
 	}
 }
 
+void Screen_EoB::getRealPalette(int num, uint8 *dst) {
+	if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
+		const uint8 *pal = _screenPalette->getData();
+		for (int i = 0; i < 16; ++i) {
+			dst[0] = (pal[0] << 2) | (pal[0] & 3);
+			dst[1] = (pal[1] << 2) | (pal[1] & 3);
+			dst[2] = (pal[2] << 2) | (pal[2] & 3);
+			dst += 3;
+			pal += 3;
+		}
+	} else {
+		Screen::getRealPalette(num, dst);
+	}
+}
+
 uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit, const uint8 *cgaMapping) {
 	uint8 *shp = 0;
 	uint16 shapesize = 0;
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 92de5c8..fc40cfe 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -59,6 +59,7 @@ public:
 	void setPagePixel(int pageNum, int x, int y, uint8 color);
 
 	void setScreenPalette(const Palette &pal);
+	void getRealPalette(int num, uint8 *dst);
 
 	uint8 *encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit = false, const uint8 *cgaMapping = 0);
 	void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd = -1, int flags = 0, ...);






More information about the Scummvm-git-logs mailing list