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
This commit is contained in:
Oystein Eftevaag 2006-07-28 11:42:53 +00:00
parent a69ac7717d
commit 3c4b13ed33
11 changed files with 118 additions and 42 deletions

View File

@ -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()");

View File

@ -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

62
engines/kyra/kyra2.cpp Normal file
View File

@ -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

40
engines/kyra/kyra2.h Normal file
View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -6,6 +6,7 @@ MODULE_OBJS := \
gui.o \
items.o \
kyra.o \
kyra2.o \
kyra3.o \
plugin.o \
resource.o \

View File

@ -20,6 +20,7 @@
*/
#include "kyra/kyra.h"
#include "kyra/kyra2.h"
#include "kyra/kyra3.h"
#include "common/config-manager.h"

View File

@ -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);

View File

@ -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();

View File

@ -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;