[Scummvm-cvs-logs] SF.net SVN: scummvm:[44709] scummvm/trunk

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Tue Oct 6 19:22:40 CEST 2009


Revision: 44709
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44709&view=rev
Author:   athrxx
Date:     2009-10-06 17:22:40 +0000 (Tue, 06 Oct 2009)

Log Message:
-----------
KYRA/LOL: - get rid of ascii/sjis detection which could cause problems when typing savegame names
- fixed some minor bugs

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui_hof.cpp
    scummvm/trunk/engines/kyra/gui_lok.cpp
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/kyra_lok.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/script_hof.cpp
    scummvm/trunk/engines/kyra/script_lok.cpp
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/sequences_hof.cpp
    scummvm/trunk/engines/kyra/sequences_lok.cpp
    scummvm/trunk/engines/kyra/sequences_lol.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/kyra/text.cpp
    scummvm/trunk/engines/kyra/text.h
    scummvm/trunk/engines/kyra/text_mr.cpp
    scummvm/trunk/engines/kyra/text_mr.h
    scummvm/trunk/graphics/sjis.h

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/gui.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -143,13 +143,19 @@
 				else
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 			} else {
+				Screen::FontId of = _screen->_currentFont;
+				if (_vm->_flags.gameID != GI_LOL && menu.item[i].saveSlot > 0)
+					_screen->setFont(Screen::FID_8_FNT);
+
 				if (_vm->gameFlags().platform != Common::kPlatformAmiga)
-					printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
+					printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0, Screen::FID_8_FNT);
 
 				if (i == menu.highlightedItem)
-					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
+					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0, Screen::FID_8_FNT);
 				else
-					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0);
+					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0, Screen::FID_8_FNT);
+
+				_screen->setFont(of);
 			}
 		}
 	}
@@ -258,9 +264,13 @@
 		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 	} else {
+		Screen::FontId of = _screen->_currentFont;
+		if (menu.item[i].saveSlot > 0)
+			_screen->setFont(Screen::FID_8_FNT);
 		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
 			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0);
+		_screen->setFont(of);
 	}
 }
 
@@ -284,9 +294,13 @@
 		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8);
 	} else {
+		Screen::FontId of = _screen->_currentFont;
+		if (menu.item[i].saveSlot > 0)
+			_screen->setFont(Screen::FID_8_FNT);
 		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
 			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
+		_screen->setFont(of);
 	}
 }
 
@@ -447,7 +461,7 @@
 }
 
 void GUI::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) {
-	_text->printText(str, x, y, c0, c1, c2, font);
+	_text->printText(str, x, y, c0, c1, c2/*, font*/);
 }
 
 int GUI::getMenuCenterStringX(const char *str, int x1, int x2) {
@@ -551,6 +565,9 @@
 		_screen->showMouse();
 
 	int fh = _screen->getFontHeight();
+	if (_vm->gameFlags().lang == Common::JA_JPN)
+		fh++;
+
 	int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3;
 
 	Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * _static.menuTable[3]);
@@ -599,9 +616,12 @@
 void MainMenu::draw(int select) {
 	int top = _screen->_curDim->sy;
 	top += _static.menuTable[1];
+	int fh = _screen->getFontHeight();
+	if (_vm->gameFlags().lang == Common::JA_JPN)
+		fh++;
 
 	for (int i = 0; i < _static.menuTable[3]; ++i) {
-		int curY = top + i * _screen->getFontHeight();
+		int curY = top + i * fh;
 		int color = (i == select) ? _static.menuTable[6] : _static.menuTable[5];
 		printString("%s", ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5, _static.strings[i]);
 	}
@@ -638,6 +658,9 @@
 	if (flags & 2)
 		x -= _screen->getTextWidth(string);
 
+	if (_vm->gameFlags().use16ColorMode)
+		flags &= 3;
+
 	if (flags & 4) {
 		_screen->printText(string, x - 1, y, _static.altColor, col2);
 		_screen->printText(string, x, y + 1, _static.altColor, col2);

Modified: scummvm/trunk/engines/kyra/gui_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_hof.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/gui_hof.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -552,7 +552,7 @@
 	_screen->_curPage = dstPage;
 
 	_screen->setTextColor(_bookTextColorMap, 0, 3);
-	Screen::FontId oldFont = _screen->setFont(Screen::FID_BOOKFONT_FNT);
+	Screen::FontId oldFont = _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_BOOKFONT_FNT);
 	_screen->_charWidth = -2;
 
 	_screen->hideMouse();

Modified: scummvm/trunk/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/gui_lok.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -682,15 +682,17 @@
 }
 
 void GUI_LoK::redrawTextfield() {
+	Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
 	_screen->fillRect(38, 91, 287, 102, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250);
 	_text->printText(_savegameName, 38, 92, 253, 0, 0);
-
+	
 	_screen->_charWidth = -2;
 	int width = _screen->getTextWidth(_savegameName);
 	_screen->fillRect(39 + width, 93, 45 + width, 100, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254);
 	_screen->_charWidth = 0;
 
 	_screen->updateScreen();
+	_screen->setFont(of);
 }
 
 void GUI_LoK::updateSavegameString() {
@@ -702,7 +704,7 @@
 		char inputKey = _keyPressed.ascii;
 		Util::convertISOToDOS(inputKey);
 
-		if ((uint8)inputKey > 31 && (uint8)inputKey < 226) {
+		if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226)) {
 			if (length < ARRAYSIZE(_savegameName)-1) {
 				_savegameName[length] = inputKey;
 				_savegameName[length+1] = 0;
@@ -749,7 +751,7 @@
 	}
 	redrawTextfield();
 
-	while (_displaySubMenu && !_vm->shouldQuit()) {
+	while (_displaySubMenu && !_vm->shouldQuit()) {		
 		checkTextfieldInput();
 		updateSavegameString();
 		processHighlights(_menu[3]);

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -104,6 +104,7 @@
 
 void LoLEngine::gui_drawScroll() {
 	_screen->copyRegion(112, 0, 12, 0, 87, 15, 2, 2, Screen::CR_NO_P_CHECK);
+	Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
 	int h = 0;
 
 	for (int i = 0; i < 7; i++) {
@@ -130,10 +131,12 @@
 		_screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
 		y += 9;
 	}
+	_screen->setFont(of);
 }
 
 void LoLEngine::gui_highlightSelectedSpell(bool mode) {
 	int y = 15;
+	Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
 	for (int i = 0; i < 7; i++) {
 		if (_availableSpells[i] == -1)
 			continue;
@@ -141,6 +144,7 @@
 		_screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
 		y += 9;
 	}
+	_screen->setFont(of);
 }
 
 void LoLEngine::gui_displayCharInventory(int charNum) {
@@ -175,7 +179,9 @@
 	for (int i = 0; i < 11; i++)
 		gui_drawCharInventoryItem(i);
 
+	Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
 	_screen->fprintString("%s", 182, 103, _flags.use16ColorMode ? 0xbb : 172, 0, 5, getLangString(0x4033));
+	_screen->setFont(of);
 
 	static const uint16 statusFlags[] = { 0x0080, 0x0000, 0x1000, 0x0002, 0x100, 0x0001, 0x0000, 0x0000 };
 
@@ -2277,7 +2283,10 @@
 	const ScreenDim *d = _screen->getScreenDim(8);
 	uint32 textCursorTimer = 0;
 	uint8 textCursorStatus = 1;
+	Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
 	int wW = _screen->getCharWidth('W');
+	_screen->setFont(of);
+
 	int fW = (d->w << 3) - wW;
 	int fC = 0;
 
@@ -2287,8 +2296,6 @@
 	// a menu has scroll buttons or slider bars.
 	uint8 hasSpecialButtons = 0;
 
-	Screen::FontId of = _vm->gameFlags().use16ColorMode ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont;
-
 	while (_displayMenu) {
 		_vm->_mouseX = _vm->_mouseY = 0;
 
@@ -2516,8 +2523,6 @@
 		_newMenu = 0;
 	}
 
-	_screen->setFont(of);
-
 	return _menuResult;
 }
 
@@ -2629,7 +2634,7 @@
 		char inputKey = _keyPressed.ascii;
 		Util::convertISOToDOS(inputKey);
 
-		if ((uint8)inputKey > 31 && (uint8)inputKey < 226) {
+		if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) {
 			_saveDescription[strlen(_saveDescription) + 1] = 0;
 			_saveDescription[strlen(_saveDescription)] = inputKey;
 			inputFlag |= 0x8000;

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -746,17 +746,21 @@
 	int curPos = strlen(buffer);
 
 	int x2 = x, y2 = y;
+	Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
 	_text->printText(buffer, x, y, c1, c2, c2);
-
+	
 	for (int i = 0; i < curPos; ++i)
 		x2 += getCharWidth(buffer[i]);
 
 	drawTextfieldBlock(x2, y2, c3);
+	_screen->setFont(of);
 
 	_keyPressed.reset();
 	_cancelNameInput = _finishNameInput = false;
 	while (running && !_vm->shouldQuit()) {
+		of = _screen->setFont(Screen::FID_8_FNT);
 		checkTextfieldInput();
+		_screen->setFont(of);
 		processHighlights(_savenameMenu);
 
 		char inputKey = _keyPressed.ascii;
@@ -779,7 +783,8 @@
 			drawTextfieldBlock(x2, y2, c3);
 			_screen->updateScreen();
 			_lastScreenUpdate = _vm->_system->getMillis();
-		} else if ((uint8)inputKey > 31 && (uint8)inputKey < 226 && curPos < bufferSize) {
+		} else if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226) && curPos < bufferSize) {
+			of = _screen->setFont(Screen::FID_8_FNT);
 			if (x2 + getCharWidth(inputKey) + 7 < 0x11F) {
 				buffer[curPos] = inputKey;
 				const char text[2] = { buffer[curPos], 0 };
@@ -790,6 +795,7 @@
 				_screen->updateScreen();
 				_lastScreenUpdate = _vm->_system->getMillis();
 			}
+			_screen->setFont(of);
 		}
 
 		_keyPressed.reset();

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -246,7 +246,7 @@
 	}
 	_screen->loadFont(_screen->FID_GOLDFONT_FNT, "GOLDFONT.FNT");
 
-	_screen->setFont(_screen->FID_8_FNT);
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : _screen->FID_8_FNT);
 
 	_screen->setAnimBlockPtr(3504);
 	_screen->setScreenDim(0);

Modified: scummvm/trunk/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/kyra_lok.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -297,6 +297,9 @@
 	if (_res->getFileSize("6.FNT"))
 		_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
 	_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
+
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
+
 	_screen->setScreenDim(0);
 
 	_abortIntroFlag = false;
@@ -419,7 +422,7 @@
 			saveGameState(0, "New game", 0);
 		}
 	} else {
-		_screen->setFont(Screen::FID_8_FNT);
+		_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 		loadGameStateCheck(_gameToLoad);
 		_gameToLoad = -1;
 	}

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -563,7 +563,7 @@
 	// the prologue code we need to setup them manually here.
 	if (_gameToLoad != -1 && action != 3) {
 		preInit();
-		_screen->setFont(Screen::FID_9_FNT);
+		_screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 	}
 
 	// We have three sound.dat files, one for the intro, one for the
@@ -738,7 +738,7 @@
 			{ 0, 0, 0, 0, 0 },
 			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0xC1, 0xE1 },
 			{ 0xCC, 0xDD, 0xDD, 0xDD },
-			Screen::FID_9_FNT, 1
+			Screen::FID_SJIS_FNT, 1
 		}
 	};
 
@@ -4434,7 +4434,9 @@
 
 void LoLEngine::printMapExitButtonText() {
 	int cp = _screen->setCurPage(2);
+	Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
 	_screen->fprintString("%s", 295, 182, _flags.use16ColorMode ? 0xbb : 172, 0, 5, getLangString(0x4033));
+	_screen->setFont(of);
 	_screen->setCurPage(cp);
 }
 

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -1134,7 +1134,8 @@
 
 int Screen::getCharWidth(uint16 c) const {
 	if (isSJISChar(c))
-		return _fonts[FID_SJIS_FNT]->getCharWidth(c) + _charWidth;
+		// _charWidth does not apply to sjis (rom) fonts 
+		return _fonts[FID_SJIS_FNT]->getCharWidth(c);
 	else
 		return _fonts[_currentFont]->getCharWidth(c) + _charWidth;
 }
@@ -1167,9 +1168,9 @@
 	cmap[1] = color1;
 	setTextColor(cmap, 0, 1);
 
-	FontId oldFont = FID_NUM;
+	/*FontId oldFont = FID_NUM;
 	if (requiresSJISFont(str))
-		oldFont = setFont(FID_SJIS_FNT);
+		oldFont = setFont(FID_SJIS_FNT);*/
 
 	const uint8 charHeightFnt = getFontHeight();
 
@@ -1206,8 +1207,8 @@
 		}
 	}
 
-	if (oldFont != FID_NUM)
-		setFont(oldFont);
+	/*if (oldFont != FID_NUM)
+		setFont(oldFont);*/
 }
 
 bool Screen::isSJISChar(uint16 c) const {
@@ -1235,7 +1236,7 @@
 }
 
 uint16 Screen::fetchChar(const char *&s) const {
-	if (!_useSJIS)
+	if (_currentFont != FID_SJIS_FNT)
 		return (uint8)*s++;
 
 	uint16 ch = (uint8)*s++;
@@ -3333,6 +3334,7 @@
     : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) {
 	assert(_font);
 	_font->enableOutline(!is16Color);
+	_font->toggleCharSize(is16Color);
 }
 
 void SJISFont::unload() {

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -162,7 +162,7 @@
 	drawClippedLine(x1, y2, x2, y2, color2);
 
 	if (_use16ColorMode && color1 > color2)
-		drawBox(x1, y1, x2, y2, 0);
+		drawBox(x1, y1, x2, y2, 0x44);
 
 	showMouse();
 }

Modified: scummvm/trunk/engines/kyra/script_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_hof.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/script_hof.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -152,7 +152,7 @@
 	_screen->setScreenPalette(_screen->getPalette(2));
 	_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
 	if (!scumm_stricmp(cpsfile, "_MEANWIL.CPS") && _flags.lang == Common::JA_JPN) {
-		Screen::FontId o = _screen->setFont(Screen::FID_6_FNT);
+		Screen::FontId o = _screen->setFont(Screen::FID_SJIS_FNT);
 		_screen->printText((const char *)jpSubtitle, 140, 176, 255, 132);
 		_screen->setFont(o);
 	}

Modified: scummvm/trunk/engines/kyra/script_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lok.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/script_lok.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -1029,7 +1029,7 @@
 	_screen->updateScreen();
 	_screen->showMouse();
 
-	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie)
+	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN)
 		_screen->setFont(Screen::FID_6_FNT);
 	return 0;
 }
@@ -1042,7 +1042,7 @@
 	_screen->updateScreen();
 	_screen->showMouse();
 
-	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie)
+	if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN)
 		_screen->setFont(Screen::FID_8_FNT);
 	return 0;
 }

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -320,7 +320,7 @@
 	if (flags < 0) {
 		static const uint8 colorMap[] = { 0x00, 0xF0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
-		_screen->setFont(Screen::FID_8_FNT);
+		_screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 		_screen->setTextColorMap(colorMap);
 		_screen->_charWidth = -2;
 	}
@@ -369,7 +369,7 @@
 	if (flags < 0) {
 		static const uint8 colorMap[] = { 0x00, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x00, 0x00, 0x00, 0x00 };
 
-		_screen->setFont(Screen::FID_INTRO_FNT);
+		_screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
 		_screen->setTextColorMap(colorMap);
 		_screen->_charWidth = 0;
 	}
@@ -387,7 +387,7 @@
 	if (flags == 255)
 		return;
 
-	_screen->setFont(Screen::FID_INTRO_FNT);
+	_screen->setFont(_vm->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
 
 	static const uint8 colorMap[] = { 0x00, 0xA0, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 	_screen->setTextColorMap(colorMap);

Modified: scummvm/trunk/engines/kyra/sequences_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_hof.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/sequences_hof.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -107,7 +107,7 @@
 
 		if (cseq.flags & 4) {
 			int cp = _screen->setCurPage(2);
-			Screen::FontId cf =	_screen->setFont(Screen::FID_GOLDFONT_FNT);
+			Screen::FontId cf =	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_GOLDFONT_FNT);
 			if (cseq.stringIndex1 != -1) {
 				int sX = (320 - _screen->getTextWidth(_sequenceStrings[cseq.stringIndex1])) / 2;
 				_screen->printText(_sequenceStrings[cseq.stringIndex1], sX, 100 - _screen->getFontHeight(), 1, 0);
@@ -1987,7 +1987,6 @@
 }
 
 void KyraEngine_HoF::seq_processText() {
-	Screen::FontId curFont = _screen->setFont(Screen::FID_GOLDFONT_FNT);
 	int curPage = _screen->setCurPage(2);
 	char outputStr[70];
 
@@ -2019,7 +2018,6 @@
 	}
 
 	_screen->setCurPage(curPage);
-	_screen->setFont(curFont);
 }
 
 char *KyraEngine_HoF::seq_preprocessString(const char *srcStr, int width) {
@@ -2417,6 +2415,8 @@
 	if (skipFlag() || shouldQuit() || _abortIntroFlag || _menuChoice)
 		return;
 
+	Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+
 	memset(&_screen->getPalette(0)[0x2fa], 0x3f, 6);
 	_screen->getPalette(0)[0x2f6] = 0x3f;
 	_screen->getPalette(0)[0x2f5] = 0x20;
@@ -2451,6 +2451,8 @@
 	seq_resetAllTextEntries();
 
 	_seqTextColor[0] = seqTextColor0;
+
+	_screen->setFont(of);
 }
 
 void KyraEngine_HoF::seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, WSAMovie_v2 *wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos) {
@@ -2774,6 +2776,8 @@
 
 	int numShp = -1;
 
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_GOLDFONT_FNT);
+
 	if (_flags.gameID == GI_LOL)
 		return;
 
@@ -2790,14 +2794,21 @@
 			addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, numShp), numShp);
 		} while (getShapePtr(numShp));
 	} else {
-		MainMenu::StaticData data = {
+		MainMenu::StaticData dataEN = {
 			{ _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 },
 			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 },
 			{ 0xd8, 0xda, 0xd9, 0xd8 },
 			Screen::FID_8_FNT, 240
 		};
+		
+		MainMenu::StaticData dataJPN = {
+			{ _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 },
+			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 },
+			{ 0xd8, 0xda, 0xd9, 0xd8 },
+			Screen::FID_SJIS_FNT, 240
+		};
 		_menu = new MainMenu(this);
-		_menu->init(data, MainMenu::Animation());
+		_menu->init(_flags.lang == Common::JA_JPN ? dataJPN : dataEN, MainMenu::Animation());
 	}
 }
 
@@ -2822,6 +2833,7 @@
 
 	delete _menu;
 	_menu = 0;
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 }
 
 #pragma mark -

Modified: scummvm/trunk/engines/kyra/sequences_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lok.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/sequences_lok.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -109,7 +109,7 @@
 	}
 
 	_seq->setCopyViewOffs(true);
-	_screen->setFont(Screen::FID_8_FNT);
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 	if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98 && _flags.platform != Common::kPlatformAmiga)
 		snd_playTheme(0, 2);
 	_text->setTalkCoords(144);
@@ -164,6 +164,7 @@
 		_screen->clearPage(0);
 		return;
 	}
+
 	delay(60 * _tickLength);
 
 	if (_flags.platform == Common::kPlatformAmiga) {
@@ -171,11 +172,14 @@
 		_screen->setScreenPalette(_screen->getPalette(0));
 	}
 
+	Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+	
 	if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) {
 		_screen->fadeToBlack();
 		_screen->clearPage(0);
 		return;
 	}
+	_screen->setFont(of);
 	_screen->fillRect(0, 179, 319, 199, 0);
 
 	if (shouldQuit())

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -64,7 +64,7 @@
 		// Original version: (260|193) "V CD1.02 D"
 		const int width = _screen->getTextWidth(gScummVMVersion);
 		_screen->fprintString("SVM %s", 300 - width, 193, 0x67, 0x00, 0x04, gScummVMVersion);
-		_screen->setFont(Screen::FID_9_FNT);
+		_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 
 		_screen->fadePalette(_screen->getPalette(0), 0x1E);
 		_screen->updateScreen();
@@ -216,7 +216,7 @@
 
 	_screen->loadFont(Screen::FID_8_FNT, "NEW8P.FNT");
 	_screen->loadFont(Screen::FID_INTRO_FNT, "INTRO.FNT");
-	_screen->setFont(Screen::FID_8_FNT);
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 
 	_tim->resetFinishedFlag();
 	_tim->setLangData("LOLINTRO.DIP");
@@ -286,7 +286,7 @@
 
 	_chargenWSA->displayFrame(0, 2, 113, 0, 0, 0, 0);
 
-	_screen->setFont(Screen::FID_9_FNT);
+	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 	_screen->_curPage = 2;
 
 	if (_flags.platform == Common::kPlatformPC98) {

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -2794,7 +2794,7 @@
 		GUI_V2_MENU_ITEM(_gameOptions.item[1], 0, 0x2C, 0xA0, 0x2F, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x20, 0x10, 0x31, 0);
 		GUI_V2_MENU_ITEM(_gameOptions.item[2], 0, 0x2D, 0xA0, 0x40, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x1D, 0x10, 0x42, 0);
 		GUI_V2_MENU_ITEM(_gameOptions.item[3], 0, 0x2E, 0xA0, 0x51, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x1E, 0x10, 0x53, 0);
-		GUI_V2_MENU_ITEM(_gameOptions.item[4], 1, 0x18, 0xA0, 0x6E, 0x6C, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+		GUI_V2_MENU_ITEM(_gameOptions.item[4], 1, 0x18, -1, 0x6E, 0x6C, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
 		_gameOptions.item[4].callback = clickQuitOptionsFunctor;
 	}
 

Modified: scummvm/trunk/engines/kyra/text.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/text.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -50,9 +50,7 @@
 
 int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) {
 	_screen->_charWidth = -2;
-	Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
 	int strWidth = _screen->getTextWidth(str);
-	_screen->setFont(curFont);
 	_screen->_charWidth = 0;
 	int w = x2 - x1 + 1;
 	return x1 + (w - strWidth) / 2;
@@ -62,7 +60,6 @@
 	int charsCount = 0;
 	if (*str) {
 		_screen->_charWidth = -2;
-		Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
 		int i = 0;
 		while (i <= len && *str) {
 			uint c = *str++;
@@ -74,7 +71,6 @@
 			i += _screen->getCharWidth(c);
 			++charsCount;
 		}
-		_screen->setFont(curFont);
 		_screen->_charWidth = 0;
 	}
 	return charsCount;
@@ -214,15 +210,13 @@
 	_talkMessagePrinted = true;
 }
 
-void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) {
+void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
 	uint8 colorMap[] = { 0, 15, 12, 12 };
 	colorMap[3] = c1;
 	_screen->setTextColor(colorMap, 0, 3);
-	Screen::FontId curFont = _screen->setFont(font);
 	_screen->_charWidth = -2;
 	_screen->printText(str, x, y, c0, c2);
 	_screen->_charWidth = 0;
-	_screen->setFont(curFont);
 }
 
 void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX) {

Modified: scummvm/trunk/engines/kyra/text.h
===================================================================
--- scummvm/trunk/engines/kyra/text.h	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/text.h	2009-10-06 17:22:40 UTC (rev 44709)
@@ -50,12 +50,13 @@
 	virtual void calcWidestLineBounds(int &x1, int &x2, int w, int cx);
 	virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
 	void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
-	virtual void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT);
+	virtual void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
 	void printCharacterText(const char *text, int8 charNum, int charX);
 
 	uint16 _talkMessageY;
 	uint16 _talkMessageH;
 	bool printed() const { return _talkMessagePrinted; }
+
 protected:
 	Screen *_screen;
 	KyraEngine_v1 *_vm;

Modified: scummvm/trunk/engines/kyra/text_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_mr.cpp	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/text_mr.cpp	2009-10-06 17:22:40 UTC (rev 44709)
@@ -127,7 +127,7 @@
 	return 0;
 }
 
-void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) {
+void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
 	if (_vm->_albumChatActive) {
 		c0 = 0xEE;
 		c1 = 0xE3;
@@ -137,11 +137,9 @@
 	uint8 colorMap[] = { 0, 255, 240, 240 };
 	colorMap[3] = c1;
 	_screen->setTextColor(colorMap, 0, 3);
-	Screen::FontId curFont = _screen->setFont(font);
 	_screen->_charWidth = -2;
 	_screen->printText(str, x, y, c0, c2);
 	_screen->_charWidth = 0;
-	_screen->setFont(curFont);
 }
 
 void TextDisplayer_MR::restoreScreen() {

Modified: scummvm/trunk/engines/kyra/text_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/text_mr.h	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/engines/kyra/text_mr.h	2009-10-06 17:22:40 UTC (rev 44709)
@@ -40,7 +40,7 @@
 	char *preprocessString(const char *str);
 	int dropCRIntoString(char *str, int minOffs, int maxOffs);
 
-	void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT);
+	void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
 
 	void restoreScreen();
 

Modified: scummvm/trunk/graphics/sjis.h
===================================================================
--- scummvm/trunk/graphics/sjis.h	2009-10-06 17:18:44 UTC (rev 44708)
+++ scummvm/trunk/graphics/sjis.h	2009-10-06 17:22:40 UTC (rev 44709)
@@ -72,13 +72,20 @@
 
 	/**
 	 * Enable outline drawing.
-	 *
-	 * After changing outline state, getFontHeight and getMaxFontWidth / getCharWidth might return
-	 * different values!
 	 */
 	virtual void enableOutline(bool enable) {}
 
 	/**
+	 * Toggle values returned by getFontHeight and getMaxFontWidth / getCharWidth.
+	 * These methods have to return different values when emulating	PC-98 text mode.
+	 * We cannot simply match this with enableOutline(), since there are situations
+	 * where outlines get disabled in graphic mode, too. In these admittedly rare
+	 * cases (Kyra 1: Brynn's note, Kyra 2: spell book) the values returned by
+	 * getFontHeight and getMaxFontWidth / getCharWidth have to remain the same.
+	 */
+	virtual void toggleCharSize(bool textMode) {}
+
+	/**
 	 * Returns the height of the font.
 	 */
 	virtual uint getFontHeight() const = 0;
@@ -122,12 +129,13 @@
  */
 class FontSJIS16x16 : public FontSJIS {
 public:
-	FontSJIS16x16() : _outlineEnabled(false) {}
+	FontSJIS16x16() : _outlineEnabled(false), _pc98TextModeCharSize(false) {}
 
 	void enableOutline(bool enable) { _outlineEnabled = enable; }
+	void toggleCharSize(bool textMode) { _pc98TextModeCharSize = textMode; }
 
-	uint getFontHeight() const { return _outlineEnabled ? 18 : 16; }
-	uint getMaxFontWidth() const { return _outlineEnabled ? 18 : 16; }
+	uint getFontHeight() const { return _pc98TextModeCharSize ? 16 : 18; }
+	uint getMaxFontWidth() const { return _pc98TextModeCharSize ? 16 : 18; }
 
 	virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const;
 
@@ -140,6 +148,7 @@
 
 protected:
 	bool _outlineEnabled;
+	bool _pc98TextModeCharSize;
 
 	virtual const uint16 *getCharData(uint16 c) const = 0;
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list