[Scummvm-cvs-logs] SF.net SVN: scummvm:[35608] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Dec 29 15:37:52 CET 2008


Revision: 35608
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35608&view=rev
Author:   lordhoto
Date:     2008-12-29 14:37:51 +0000 (Mon, 29 Dec 2008)

Log Message:
-----------
- Cleanup
- Implemented Screen_LoL::fprintString

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.h

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2008-12-29 14:11:26 UTC (rev 35607)
+++ scummvm/trunk/engines/kyra/gui.cpp	2008-12-29 14:37:51 UTC (rev 35608)
@@ -448,9 +448,6 @@
 		_screen->_charWidth = -2;
 	_screen->setScreenDim(dim);
 
-	while (!_screen->isMouseVisible())
-		_screen->showMouse();
-
 	int backUpX = _screen->_curDim->sx;
 	int backUpY = _screen->_curDim->sy;
 	int backUpWidth = _screen->_curDim->w;
@@ -469,7 +466,8 @@
 
 	draw(selected);
 
-	_screen->showMouse();
+	while (!_screen->isMouseVisible())
+		_screen->showMouse();
 
 	int fh = _screen->getFontHeight();
 	int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3;

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2008-12-29 14:11:26 UTC (rev 35607)
+++ scummvm/trunk/engines/kyra/lol.cpp	2008-12-29 14:37:51 UTC (rev 35608)
@@ -30,6 +30,7 @@
 #include "kyra/util.h"
 
 #include "common/endian.h"
+#include "base/version.h"
 
 namespace Kyra {
 
@@ -103,9 +104,7 @@
 }
 
 Common::Error LoLEngine::go() {
-	bool hasSave = saveFileLoadable(0);
-
-	if (!hasSave) {
+	if (!saveFileLoadable(0)) {
 		setupPrologueData(true);
 		showIntro();
 		setupPrologueData(false);
@@ -117,24 +116,31 @@
 	while (!shouldQuit() && processSelection == -1) {
 		_screen->loadBitmap("TITLE.CPS", 2, 2, _screen->getPalette(0));
 		_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
+
+		_screen->setFont(Screen::FID_6_FNT);
+		// Original version: (260|193) "V CD1.02 D"
+		_screen->fprintString("SVM %s", 255, 193, 0x67, 0x00, 0x04, gScummVMVersion);
+		_screen->setFont(Screen::FID_9_FNT);
+
 		_screen->fadePalette(_screen->getPalette(0), 0x1E);
+		_screen->updateScreen();
 
 		_eventList.clear();
 		int selection = mainMenu();
+		_screen->hideMouse();
 
+		// Unlike the original, we add a nice fade to black
+		memset(_screen->getPalette(0), 0, 768);
+		_screen->fadePalette(_screen->getPalette(0), 0x54);
+
 		switch (selection) {
 		case 0:		// New game
 			processSelection = 0;
 			break;
 
 		case 1:		// Show intro
-			memset(_screen->getPalette(0), 0, 768);
-			_screen->fadePalette(_screen->getPalette(0), 0x54);
-
 			setupPrologueData(true);
-			_screen->hideMouse();
 			showIntro();
-			_screen->showMouse();
 			setupPrologueData(true);
 			break;
 
@@ -149,6 +155,7 @@
 		case 4:		// Quit game
 		default:
 			quitGame();
+			updateInput();
 			break;
 		}
 	}
@@ -157,12 +164,6 @@
 		return Common::kNoError;
 
 	if (processSelection == 0) {
-		// Unlike the original, we add a nice fade to black
-		memset(_screen->getPalette(0), 0, 768);
-		_screen->fadePalette(_screen->getPalette(0), 0x54);
-
-		_screen->clearPage(0);
-
 		setupPrologueData(true);
 		_sound->loadSoundFile("LOREINTR");
 		_sound->playTrack(6);
@@ -193,8 +194,8 @@
 	_screen->setScreenPalette(pal);
 
 	// TODO: We need to check if the SYSEX events of intro and ingame differ.
-	// If they really need to setup the proper ingame sysex when starting
-	// the game. But the place to do it would not be here in our code!
+	// If they differ, we really need to setup the proper ingame SYSEX when starting
+	// the game. But the proper place to do it would not be in this function.
 	/*if (_sound->getMusicType() == Sound::kMidiMT32 || _sound->getSfxType() == Sound::kMidiMT32) {
 		_sound->loadSoundFile("LOLSYSEX");
 		_sound->playTrack(0);
@@ -212,13 +213,10 @@
 	
 	char filename[32];
 	snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]);	
+	_res->exists(filename, true);
 	_landsFile = _res->fileData(filename, 0);
 
 	initializeCursors();
-
-	/*_screen->setFont(Screen::FID_6_FNT);
-	_screen->fprintString("V CD1.02 D", 260, 301, 0x67, 0x00, 0x04);*/
-	_screen->setFont(Screen::FID_9_FNT);
 }
 
 void LoLEngine::initializeCursors() {

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2008-12-29 14:11:26 UTC (rev 35607)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2008-12-29 14:37:51 UTC (rev 35608)
@@ -43,13 +43,43 @@
 	return &_screenDimTable[dim];
 }
 
+void Screen_LoL::fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) {
+	debugC(9, kDebugLevelScreen, "Screen_LoL::fprintString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags);
+	if (!format)
+		return;
+
+	char string[240];
+	va_list vaList;
+	va_start(vaList, flags);
+	vsnprintf(string, sizeof(string), format, vaList);
+	va_end(vaList);
+
+	if (flags & 1)
+		x -= getTextWidth(string) >> 1;
+
+	if (flags & 2)
+		x -= getTextWidth(string);
+
+	if (flags & 4) {
+		printText(string, x - 1, y, 1, col2);
+		printText(string, x, y + 1, 1, col2);
+	}
+
+	if (flags & 8) {
+		printText(string, x - 1, y, 227, col2);
+		printText(string, x, y + 1, 227, col2);
+	}
+
+	printText(string, x, y, col1, col2);
+}
+
 void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) {
 	debugC(9, kDebugLevelScreen, "Screen_LoL::fprintStringIntro('%s', %d, %d, %d, %d, %d, %d, ...)", format, x, y, c1, c2, c3, flags);
 	char buffer[400];
 
 	va_list args;
 	va_start(args, flags);
-	vsprintf(buffer, format, args);	
+	vsnprintf(buffer, sizeof(buffer), format, args);	
 	va_end(args);
 	
 	if ((flags & 0x0F00) == 0x100)

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2008-12-29 14:11:26 UTC (rev 35607)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2008-12-29 14:37:51 UTC (rev 35608)
@@ -39,6 +39,7 @@
 	void setScreenDim(int dim);
 	const ScreenDim *getScreenDim(int dim);
 
+	void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...);
 	void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...);
 private:
 	LoLEngine *_vm;


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