From 3c4b13ed33a928352634c4785fa92a5df10ff378 Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Fri, 28 Jul 2006 11:42:53 +0000 Subject: Moves the kyra2 code to kyra2.cpp and kyra2.h, renames WSAMovieV3 to WSAMovie2 (kyra2 uses the same format), renames a define in kyra3.h for consistency, and adds a case for CMDS in the VQA player to avoid the constant warning (the tag is always present and empty). Credit/blame for the last one goes to Clemmy :). Starting kyra2 will now show the title animation. svn-id: r23614 --- engines/kyra/kyra.cpp | 17 ------------- engines/kyra/kyra.h | 10 -------- engines/kyra/kyra2.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/kyra2.h | 40 ++++++++++++++++++++++++++++++ engines/kyra/kyra3.cpp | 6 ++--- engines/kyra/kyra3.h | 8 +++--- engines/kyra/module.mk | 1 + engines/kyra/plugin.cpp | 1 + engines/kyra/vqa.cpp | 3 +++ engines/kyra/wsamovie.cpp | 4 +-- engines/kyra/wsamovie.h | 8 ++---- 11 files changed, 118 insertions(+), 42 deletions(-) create mode 100644 engines/kyra/kyra2.cpp create mode 100644 engines/kyra/kyra2.h diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 3bf13b4e63..c8e868f4ae 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -111,10 +111,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system) : KyraEngine(system) { } -KyraEngine_v2::KyraEngine_v2(OSystem *system) - : KyraEngine(system) { -} - int KyraEngine::init() { // Setup mixer if (!_mixer->isReady()) { @@ -383,15 +379,11 @@ KyraEngine_v1::~KyraEngine_v1() { } -KyraEngine_v2::~KyraEngine_v2() { -} - void KyraEngine::errorString(const char *buf1, char *buf2) { strcpy(buf2, buf1); } int KyraEngine::go() { - _quitFlag = false; if (_features & GF_FLOPPY && !(_features & GF_AMIGA)) { _screen->loadFont(Screen::FID_6_FNT, "6.FNT"); @@ -419,15 +411,6 @@ int KyraEngine::go() { return 0; } -int KyraEngine_v2::go() { - // Kyra2 goes here :) - loadPalette("palette.col", _screen->_currentPalette); - _screen->setScreenPalette(_screen->_currentPalette); - _screen->loadBitmap("_playfld.cps", 0, 0, 0); - _screen->updateScreen(); - waitForEvent(); - return 0; -} void KyraEngine::startup() { debugC(9, kDebugLevelMain, "KyraEngine::startup()"); diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index f1eb7818d0..1dd4289907 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -1014,16 +1014,6 @@ public: int setupGameFlags(); }; -class KyraEngine_v2 : public KyraEngine { -public: - KyraEngine_v2(OSystem *system); - ~KyraEngine_v2(); - - int setupGameFlags() { _game = GI_KYRA2; return 0; } - - int go(); -}; - } // End of namespace Kyra #endif diff --git a/engines/kyra/kyra2.cpp b/engines/kyra/kyra2.cpp new file mode 100644 index 0000000000..2ec9dafdd7 --- /dev/null +++ b/engines/kyra/kyra2.cpp @@ -0,0 +1,62 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2006 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "kyra/kyra.h" +#include "kyra/kyra2.h" +#include "kyra/screen.h" +#include "kyra/wsamovie.h" + +#include "common/system.h" + +namespace Kyra { + +KyraEngine_v2::KyraEngine_v2(OSystem *system) + : KyraEngine(system) { +} + +KyraEngine_v2::~KyraEngine_v2() { +} + +int KyraEngine_v2::go() { + uint8 pal[768]; + + WSAMovieV2 *title = new WSAMovieV2(this); + title->open("title.WSA", 0, pal); + assert(title->opened()); + + _screen->setScreenPalette(pal); + title->setX(0); title->setY(0); + title->setDrawPage(0); + for (int i = 0; i < 26; ++i) { + uint32 nextRun = _system->getMillis() + 6 * _tickLength; + title->displayFrame(i); + _screen->updateScreen(); + delayUntil(nextRun); + } + + delete title; + + waitForEvent(); + return 0; +} + +} // end of namespace Kyra diff --git a/engines/kyra/kyra2.h b/engines/kyra/kyra2.h new file mode 100644 index 0000000000..8c0cb6d208 --- /dev/null +++ b/engines/kyra/kyra2.h @@ -0,0 +1,40 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2006 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef KYRA2_H +#define KYRA2_H + +namespace Kyra { + +class KyraEngine_v2 : public KyraEngine { +public: + KyraEngine_v2(OSystem *system); + ~KyraEngine_v2(); + + int setupGameFlags() { _game = GI_KYRA2; return 0; } + + int go(); +}; + +} // end of namespace Kyra + +#endif diff --git a/engines/kyra/kyra3.cpp b/engines/kyra/kyra3.cpp index 539c67d1a0..f007055d75 100644 --- a/engines/kyra/kyra3.cpp +++ b/engines/kyra/kyra3.cpp @@ -83,7 +83,7 @@ int KyraEngine_v3::setupGameFlags() { } Movie *KyraEngine_v3::createWSAMovie() { - return new WSAMovieV3(this); + return new WSAMovieV2(this); } int KyraEngine_v3::init() { @@ -105,7 +105,7 @@ int KyraEngine_v3::go() { uint8 *pal = _screen->getPalette(1); assert(pal); - WSAMovieV3 *logo = new WSAMovieV3(this); + WSAMovieV2 *logo = new WSAMovieV2(this); assert(logo); logo->open("REVENGE.WSA", 1, pal); assert(logo->opened()); @@ -293,7 +293,7 @@ int KyraEngine_v3::musicUpdate(int forceRestart) { #pragma mark - -int KyraEngine_v3::handleMainMenu(WSAMovieV3 *logo) { +int KyraEngine_v3::handleMainMenu(WSAMovieV2 *logo) { debugC(9, kDebugLevelMain, "KyraEngine::handleMainMenu(%p)", (const void*)logo); int command = -1; diff --git a/engines/kyra/kyra3.h b/engines/kyra/kyra3.h index 3538d25a12..f6ab4713d8 100644 --- a/engines/kyra/kyra3.h +++ b/engines/kyra/kyra3.h @@ -20,15 +20,15 @@ * */ -#ifndef KYRA_KYRA3_H -#define KYRA_KYRA3_H +#ifndef KYRA3_H +#define KYRA3_H #include "kyra/kyra.h" namespace Kyra { // maybe subclass KyraEngine_v2 later -class WSAMovieV3; +class WSAMovieV2; class KyraEngine_v3 : public KyraEngine { public: @@ -74,7 +74,7 @@ private: // gui/menu specific private: static const char *_mainMenuStrings[]; - int handleMainMenu(WSAMovieV3 *logo); + int handleMainMenu(WSAMovieV2 *logo); void drawMainMenu(const char * const *strings, int select); void drawMainBox(int x, int y, int w, int h, int fill); diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index 2b83e6dc26..5f04796575 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ gui.o \ items.o \ kyra.o \ + kyra2.o \ kyra3.o \ plugin.o \ resource.o \ diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp index dc98125f74..9ffcd08209 100644 --- a/engines/kyra/plugin.cpp +++ b/engines/kyra/plugin.cpp @@ -20,6 +20,7 @@ */ #include "kyra/kyra.h" +#include "kyra/kyra2.h" #include "kyra/kyra3.h" #include "common/config-manager.h" diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 0918066bc7..b31ea979bf 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -398,6 +398,9 @@ bool VQAMovie::open(const char *filename) { } break; + case MKID_BE('CMDS'): // Unused tag, always empty in kyra3 + debugC(9, kDebugLevelMovie, "VQAMovie::open: skipping CMDS tag"); + break; default: warning("VQAMovie::open: Unknown tag `%c%c%c%c'", (tag >> 24) & 0xFF, (tag >> 16) & 0xFF, (tag >> 8) & 0xFF, tag & 0xFF); diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp index d2fe5bad2a..f29875d931 100644 --- a/engines/kyra/wsamovie.cpp +++ b/engines/kyra/wsamovie.cpp @@ -208,9 +208,9 @@ void WSAMovieV1::processFrame(int frameNum, uint8 *dst) { #pragma mark - -WSAMovieV3::WSAMovieV3(KyraEngine_v3 *vm) : WSAMovieV1(vm), _vm3(vm), _xAdd(0), _yAdd(0) {} +WSAMovieV2::WSAMovieV2(KyraEngine *vm) : WSAMovieV1(vm), _xAdd(0), _yAdd(0) {} -void WSAMovieV3::open(const char *filename, int unk1, uint8 *palBuf) { +void WSAMovieV2::open(const char *filename, int unk1, uint8 *palBuf) { debugC(9, kDebugLevelMovie, "WSAMovieV3::open('%s', %d, %p)", filename, unk1, (const void *)palBuf); close(); diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h index 71402badb7..f543af9668 100644 --- a/engines/kyra/wsamovie.h +++ b/engines/kyra/wsamovie.h @@ -90,12 +90,9 @@ protected: uint8 *_frameData; }; -class KyraEngine_v3; - -// it could be possible that Kyrandia2 uses exactly the same format -class WSAMovieV3 : public WSAMovieV1 { +class WSAMovieV2 : public WSAMovieV1 { public: - WSAMovieV3(KyraEngine_v3 *vm); + WSAMovieV2(KyraEngine *vm); void open(const char *filename, int unk1, uint8 *palette); @@ -108,7 +105,6 @@ public: int width() const { return _width; } int height() const { return _height; } protected: - KyraEngine_v3 *_vm3; int16 _xAdd; int16 _yAdd; -- cgit v1.2.3