[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.41,1.42 kyra.h,1.16,1.17 resource.cpp,1.16,1.17 staticres.cpp,1.3,1.4

kirben kirben at users.sourceforge.net
Fri Sep 9 23:41:06 CEST 2005


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3792/kyra

Modified Files:
	kyra.cpp kyra.h resource.cpp staticres.cpp 
Log Message:

Add support for non-interactive demo version.


Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- kyra.cpp	10 Sep 2005 00:15:40 -0000	1.41
+++ kyra.cpp	10 Sep 2005 06:40:20 -0000	1.42
@@ -56,6 +56,7 @@
 static const KyraGameSettings kyra_settings[] = {
 	{ "kyra1", "Legend of Kyrandia (Floppy)", GF_FLOPPY | GF_KYRA1, "INTRO.SND" },
 	{ "kyra1cd", "Legend of Kyrandia (CD)",  GF_TALKIE | GF_KYRA1,  "CHAPTER1.VRM" },
+	{ "kyra1demo", "Legend of Kyrandia (Demo)", GF_DEMO | GF_FLOPPY | GF_KYRA1, "DEMO1.WSA" },
 //	{ "kyra2", "Hand of Fate (Floppy)", GF_FLOPPY | GF_KYRA2, 0 },
 //	{ "kyra2cd", "Hand of Fate (CD)", GF_TALKIE | GF_KYRA2, "AUDIO.PAK" },
 //	{ "kyra3", "Malcolm's Revenge", GF_TALKIE | GF_KYRA3, "K3INTRO0.VQA" },
@@ -115,7 +116,9 @@
 
 	// gets the game
 	if (detector->_game.features & GF_KYRA1) {
-		if (detector->_game.features & GF_FLOPPY) {
+		if (detector->_game.features & GF_DEMO) {
+			_game = KYRA1DEMO;
+		} else if (detector->_game.features & GF_FLOPPY) {
 			_game = KYRA1;
 		} else {
 			_game = KYRA1CD;
@@ -188,9 +191,15 @@
 	_screen->loadFont(Screen::FID_6_FNT, _res->fileData("6.FNT", &sz));
 	_screen->loadFont(Screen::FID_8_FNT, _res->fileData("8FAT.FNT", &sz));
 	_screen->setScreenDim(0);
-	seq_intro();
-	startup();
-	mainLoop();
+
+	if (_game == KYRA1DEMO) {
+		seq_demo();
+	} else {
+		seq_intro();
+		startup();
+		mainLoop();
+	}
+
 	return 0;
 }
 
@@ -443,6 +452,42 @@
 	} while (!_fastMode && _system->getMillis() < end);
 }
 
+void KyraEngine::seq_demo() {
+	debug(9, "KyraEngine::seq_demo()");
+
+	// TODO: Display START.CPS
+
+	_screen->clearPage(0);
+	loadBitmap("TOP.CPS", 7, 7, _screen->_currentPalette);
+	loadBitmap("BOTTOM.CPS", 5, 5, _screen->_currentPalette);
+	_screen->_curPage = 0;
+	_screen->copyRegion(0, 91, 0, 8, 320, 103, 6, 0);
+	_screen->copyRegion(0, 0, 0, 111, 320, 64, 6, 0);
+	_screen->fadeFromBlack();
+	
+	seq_playSpecialSequence(_seq_demoData_WestwoodLogo, true);
+	waitTicks(60);
+
+	seq_playSpecialSequence(_seq_demoData_KyrandiaLogo, true);
+
+	_screen->fadeToBlack();
+	_screen->clearPage(2);
+	_screen->clearPage(0);
+
+	seq_playSpecialSequence(_seq_demoData_Demo1, true);
+
+	_screen->clearPage(0);
+	seq_playSpecialSequence(_seq_demoData_Demo2, true);
+
+	_screen->clearPage(0);
+	seq_playSpecialSequence(_seq_demoData_Demo3, true);
+
+	_screen->clearPage(0);
+	seq_playSpecialSequence(_seq_demoData_Demo4, true);
+
+	// TODO: Display FINAL.CPS
+}
+
 void KyraEngine::seq_intro() {
 	debug(9, "KyraEngine::seq_intro()");
 	static const IntroProc introProcTable[] = {
@@ -660,7 +705,11 @@
 				assert(wsaObj < 12);
 				uint8 offscreenDecode = *seqData++;
 				wsaCurDecodePage = wsaDecodePage[wsaObj] = (offscreenDecode == 0) ? 0 : 3;				
-				wsaMovieTable[wsaObj] = wsa_open(_seq_WSATable[wsaObj], offscreenDecode, 0);
+				if (_game == KYRA1DEMO) {
+					wsaMovieTable[wsaObj] = wsa_open(_seq_demo_WSATable[wsaObj], offscreenDecode, 0);
+				} else {
+					wsaMovieTable[wsaObj] = wsa_open(_seq_WSATable[wsaObj], offscreenDecode, 0);
+				}
 				wsaCurFramesTable[wsaObj] = 0;
 				wsaNumFramesTable[wsaObj] = wsa_getNumFrames(wsaMovieTable[wsaObj]) - 1;
 			}
@@ -759,7 +808,12 @@
 		case 12: {
 				uint8 colNum = *seqData++;
 				uint32 fileSize;
-				uint8 *srcData = _res->fileData(_seq_COLTable[colNum], &fileSize);
+				uint8 *srcData;
+				if (_game == KYRA1DEMO) {
+					srcData = _res->fileData(_seq_demo_COLTable[colNum], &fileSize);
+				} else {
+					srcData = _res->fileData(_seq_COLTable[colNum], &fileSize);
+				}
 				memcpy(_screen->_currentPalette, srcData, fileSize);
 				delete[] srcData;
 			}
@@ -899,7 +953,11 @@
 			}
 			break;
 		case 26:
-			// allocate offscreen buffer, not needed
+			if (_game == KYRA1DEMO) {
+				quitFlag = true;
+			} else {
+				// allocate offscreen buffer, not needed
+			}
 			break;
 		case 27:
 			displayTextFlag = true;

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- kyra.h	10 Sep 2005 00:15:40 -0000	1.16
+++ kyra.h	10 Sep 2005 06:40:20 -0000	1.17
@@ -33,15 +33,17 @@
 	GF_KYRA1   = 1 << 2,
 	GF_KYRA2   = 1 << 3,
 	GF_KYRA3   = 1 << 4,
-	GF_AUDIOCD = 1 << 5  // FM-Towns versions seems to use audio CD
+	GF_AUDIOCD = 1 << 5,  // FM-Towns versions seems to use audio CD
+	GF_DEMO    = 1 << 6
 };
 
 enum {
-	KYRA1   = 0,
-	KYRA1CD = 1,
-	KYRA2   = 2,
-	KYRA2CD = 3,
-	KYRA3   = 4
+	KYRA1     = 0,
+	KYRA1CD   = 1,
+	KYRA1DEMO = 2,
+	KYRA2     = 3,
+	KYRA2CD   = 4,
+	KYRA3     = 5
 };
 
 struct Character {
@@ -128,6 +130,7 @@
 	void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
 	void waitTicks(int ticks);
 	
+	void seq_demo();
 	void seq_intro();
 	void seq_introLogos();
 	void seq_introStory();
@@ -166,6 +169,16 @@
 	Screen *_screen;
 	MusicPlayer *_midi;
 
+	// these tables are specific to the demo version
+	static const uint8 _seq_demoData_WestwoodLogo[];
+	static const uint8 _seq_demoData_KyrandiaLogo[];
+	static const uint8 _seq_demoData_Demo1[];
+	static const uint8 _seq_demoData_Demo2[];
+	static const uint8 _seq_demoData_Demo3[];
+	static const uint8 _seq_demoData_Demo4[];
+	static const char *_seq_demo_WSATable[];
+	static const char *_seq_demo_COLTable[];
+
 	// these tables are specific to the floppy version
 	static const uint8 _seq_introData_Forest[];
 	static const uint8 _seq_introData_KallakWriting[];

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/resource.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- resource.cpp	8 Sep 2005 19:09:52 -0000	1.16
+++ resource.cpp	10 Sep 2005 06:40:20 -0000	1.17
@@ -29,6 +29,10 @@
 Resource::Resource(KyraEngine* engine) {
 	_engine = engine;
 
+	// No PAK files in the demo version
+	if (_engine->game() == KYRA1DEMO)
+		return;
+
 	// prefetches all PAK Files
 
 	// ugly a hardcoded list

Index: staticres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/staticres.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- staticres.cpp	8 Sep 2005 19:09:52 -0000	1.3
+++ staticres.cpp	10 Sep 2005 06:40:20 -0000	1.4
@@ -304,6 +304,49 @@
 	0x03, 0x16, 0x01, 0x0B, 0x02, 0x09, 0x00, 0x13, 0x01, 0x03, 0x1D
 };
 
+const uint8 KyraEngine::_seq_demoData_WestwoodLogo[] = {
+	0x00, 0x02, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x06, 0x06, 0x00, 0x06, 0x3C,
+	0x00, 0x0A, 0x00, 0x03, 0x02, 0x16, 0x01, 0x0B, 0x00, 0x08, 0x00, 0x06, 0x3C, 0x00, 0x0A, 0x01,
+	0x03, 0x02, 0x16, 0x01, 0x0B, 0x01, 0x0B, 0x00, 0x06, 0x78, 0x00, 0x02, 0x02, 0x0A, 0x00, 0x00,
+	0x00, 0x16, 0x01, 0x06, 0x06, 0x00, 0x0A, 0x02, 0x04, 0x02, 0x16, 0x01, 0x0B, 0x02, 0x09, 0x00, 
+	0x13, 0x01, 0x02, 0x1A
+};
+
+const uint8 KyraEngine::_seq_demoData_KyrandiaLogo[] = {
+	0x15, 0x00, 0x02, 0x00, 0x05, 0x01, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x06, 0x06,
+	0x00, 0x06, 0x3C, 0x00, 0x0A, 0x00, 0x03, 0x05, 0x16, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x06, 0x3C,
+	0x00, 0x0A, 0x01, 0x03, 0x05, 0x16, 0x00, 0x0B, 0x01, 0x0F, 0x00, 0x06,	0x3C, 0x00, 0x0A, 0x02, 
+	0x04, 0x05, 0x16, 0x00, 0x0B, 0x02, 0x0F, 0x00, 0x02, 0x05, 0x0D, 0x00, 0x00, 0x00, 0x16, 0x00, 
+	0x06, 0x06, 0x00, 0x06, 0x78, 0x00, 0x0A, 0x02, 0x04, 0x05, 0x16, 0x00, 0x0B, 0x02, 0x0C, 0x00, 
+	0x13, 0x01, 0x05, 0x1A
+};
+
+const uint8 KyraEngine::_seq_demoData_Demo1[] = {
+	0x00, 0x01, 0x00, 0x0C, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x06, 0x01, 0x00,
+	0x06, 0x3C, 0x00, 0x0A, 0x00, 0x03, 0x01, 0x06, 0x04, 0x00, 0x0B, 0x00, 0x19, 0x00, 0x06, 0x78,
+	0x00, 0x13, 0x0E, 0x01, 0x01, 0x1A
+};
+
+const uint8 KyraEngine::_seq_demoData_Demo2[] = {
+	0x00, 0x03, 0x00, 0x0C, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x06, 0x01, 0x00,
+	0x06, 0x3C, 0x00, 0x0A, 0x00, 0x03, 0x03, 0x06, 0x04, 0x00, 0x0B, 0x00, 0x71, 0x00, 0x13, 0x0E, 
+	0x01, 0x03, 0x1A
+};
+
+const uint8 KyraEngine::_seq_demoData_Demo3[] = {
+	0x00, 0x04, 0x00, 0x0C, 0x03, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x0A, 0x00, 0x03,
+	0x04, 0x06, 0x07, 0x00, 0x03, 0x04, 0x06, 0x07, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x06, 
+	0x07, 0x00, 0x0B, 0x00, 0x0E, 0x00, 0x03, 0x04, 0x06, 0x07, 0x00, 0x03, 0x04, 0x06, 0x07, 0x00,
+	0x0A, 0x01, 0x03, 0x04, 0x06, 0x07, 0x00, 0x0B, 0x01, 0x0B, 0x00, 0x0A, 0x02, 0x02, 0x04, 0x0F,
+	0x00, 0x00, 0x00, 0x06, 0x07, 0x00, 0x03, 0x04, 0x06, 0x07, 0x00, 0x03, 0x04, 0x06, 0x07, 0x00, 
+	0x0B, 0x02, 0x13, 0x00, 0x13, 0x0E, 0x01, 0x04, 0x1A
+};
+
+const uint8 KyraEngine::_seq_demoData_Demo4[] = {
+	0x00, 0x06, 0x00, 0x0C, 0x04, 0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x0A, 0x00, 0x03,
+	0x06, 0x06, 0x04, 0x00, 0x0B, 0x00, 0x39, 0x00, 0x06, 0x5A, 0x00, 0x13, 0x0E, 0x01, 0x06, 0x1A
+};
+
 const uint8 KyraEngine::_seq_codeSizeTable[] = {
 	2, 1, 5, 1, 1, 4, 2, 2, 0, 0, 1, 3, 1, 1, 0, 1,
 	5, 0, 0, 0, 0, 2, 1, 8, 1, 1, 0, 0, 0, 0, 0, 0
@@ -323,6 +366,16 @@
 	"latern.wsa"
 };
 
+const char *KyraEngine::_seq_demo_WSATable[] = {
+	"kallak.wsa",
+	"demo1.wsa",
+	"westwood.wsa",
+	"demo2.wsa",
+	"demo3.wsa",
+	"kyrandia.wsa",
+	"demo4.wsa",
+};
+
 const char *KyraEngine::_seq_CPSTable[] = {
 	"gemcut.cps",
 	"tree.cps"
@@ -335,6 +388,16 @@
 	"mal-kal.col"
 };
 
+const char *KyraEngine::_seq_demo_COLTable[] = {
+	"kallak.col",
+	"demo1.col",
+	"demo2.col",
+	"demo3.col",
+	"demo4.col",
+	"ww.col",
+	"mal-kal.col"
+};
+
 const char *KyraEngine::_seq_textsTableEN[] = {
 	"This is a text test - 1",
 	"This is a text test - 2",





More information about the Scummvm-git-logs mailing list