aboutsummaryrefslogtreecommitdiff
path: root/kyra
diff options
context:
space:
mode:
authorTravis Howell2005-09-10 06:40:20 +0000
committerTravis Howell2005-09-10 06:40:20 +0000
commitb7e2486b6db5d9112fbc5e34bf75d0d20e42917f (patch)
tree54dde6728c8fb6e5d7bbd086d7fac0032dcdef5c /kyra
parent689b89b2be74df1d48bb60184f441dba7b88f147 (diff)
downloadscummvm-rg350-b7e2486b6db5d9112fbc5e34bf75d0d20e42917f.tar.gz
scummvm-rg350-b7e2486b6db5d9112fbc5e34bf75d0d20e42917f.tar.bz2
scummvm-rg350-b7e2486b6db5d9112fbc5e34bf75d0d20e42917f.zip
Add support for non-interactive demo version.
svn-id: r18801
Diffstat (limited to 'kyra')
-rw-r--r--kyra/kyra.cpp72
-rw-r--r--kyra/kyra.h25
-rw-r--r--kyra/resource.cpp4
-rw-r--r--kyra/staticres.cpp63
4 files changed, 151 insertions, 13 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp
index d5f3fdea84..86adb9340b 100644
--- a/kyra/kyra.cpp
+++ b/kyra/kyra.cpp
@@ -56,6 +56,7 @@ struct KyraGameSettings {
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 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *system)
// 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 @@ int KyraEngine::go() {
_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 @@ void KyraEngine::waitTicks(int ticks) {
} 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 @@ bool KyraEngine::seq_playSpecialSequence(const uint8 *seqData, bool skipSeq) {
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 @@ bool KyraEngine::seq_playSpecialSequence(const uint8 *seqData, bool skipSeq) {
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 @@ bool KyraEngine::seq_playSpecialSequence(const uint8 *seqData, bool skipSeq) {
}
break;
case 26:
- // allocate offscreen buffer, not needed
+ if (_game == KYRA1DEMO) {
+ quitFlag = true;
+ } else {
+ // allocate offscreen buffer, not needed
+ }
break;
case 27:
displayTextFlag = true;
diff --git a/kyra/kyra.h b/kyra/kyra.h
index 67861fe3cd..f433ef4656 100644
--- a/kyra/kyra.h
+++ b/kyra/kyra.h
@@ -33,15 +33,17 @@ enum {
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 @@ protected:
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 @@ protected:
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[];
diff --git a/kyra/resource.cpp b/kyra/resource.cpp
index ceba14ae06..cf61818d55 100644
--- a/kyra/resource.cpp
+++ b/kyra/resource.cpp
@@ -29,6 +29,10 @@ namespace Kyra {
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
diff --git a/kyra/staticres.cpp b/kyra/staticres.cpp
index 399b111613..3f8e1d4f71 100644
--- a/kyra/staticres.cpp
+++ b/kyra/staticres.cpp
@@ -304,6 +304,49 @@ const uint8 KyraEngine::_seq_introData_WestwoodLogo[] = {
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 @@ const char *KyraEngine::_seq_WSATable[] = {
"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 @@ const char *KyraEngine::_seq_COLTable[] = {
"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",