Add some code differences for LoL intro demo.

svn-id: r40696
This commit is contained in:
Johannes Schickel 2009-05-18 19:53:57 +00:00
parent a652e1ae3d
commit b1bdbef419
7 changed files with 68 additions and 30 deletions

View file

@ -71,7 +71,7 @@ namespace {
#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, Kyra::GI_LOL) #define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, Kyra::GI_LOL)
#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, true, Kyra::GI_LOL) #define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, true, Kyra::GI_LOL)
#define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, true, true, false, false, Kyra::GI_LOL) #define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, true, true, false, false, Kyra::GI_LOL)
#define LOL_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, Kyra::GI_LOL) #define LOL_DEMO_FLAGS FLAGS(true, true, false, false, false, false, false, Kyra::GI_LOL)
#define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, Kyra::GI_KYRA2) #define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, Kyra::GI_KYRA2)
const KYRAGameDescription adGameDescs[] = { const KYRAGameDescription adGameDescs[] = {
@ -1036,9 +1036,8 @@ const KYRAGameDescription adGameDescs[] = {
LOL_PC98_SJIS_FLAGS LOL_PC98_SJIS_FLAGS
}, },
// TODO: It looks like this demo version does not use WSA v2 files, that means // TODO: It looks like this demo version does use something between
// it is probably being quite old... Since our TIM player relies on WSA v2 features, // WSA v1 and WSA v2 files, that means it is probably being quite old...
// we disable the detection entry for now.
/*{ /*{
{ {
"lol", "lol",

View file

@ -71,7 +71,7 @@ public:
virtual int getLayer(int x, int y); virtual int getLayer(int x, int y);
// special WSA handling // special WSA handling
void wsaFrameAnimationStep(int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim); void wsaFrameAnimationStep(int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim);
protected: protected:
uint8 *_wsaFrameAnimBuffer; uint8 *_wsaFrameAnimBuffer;
}; };

View file

@ -2022,8 +2022,9 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) {
int h2 = (h1 * factor) / 100; int h2 = (h1 * factor) / 100;
anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0); anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0);
_screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, 8, 0); _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo ? 0 : 8, 0);
_screen->checkedPageUpdate(8, 4); if (!_flags.isDemo)
_screen->checkedPageUpdate(8, 4);
_screen->updateScreen(); _screen->updateScreen();
return 1; return 1;

View file

@ -53,7 +53,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
COMMAND(cmd_initFunc), COMMAND(cmd_initFunc),
COMMAND(cmd_stopFunc), COMMAND(cmd_stopFunc),
COMMAND(cmd_wsaDisplayFrame), COMMAND(cmd_wsaDisplayFrame),
COMMAND_UNIMPL(), COMMAND(cmd_displayText),
// 0x08 // 0x08
COMMAND(cmd_loadVocFile), COMMAND(cmd_loadVocFile),
COMMAND(cmd_unloadVocFile), COMMAND(cmd_unloadVocFile),
@ -98,7 +98,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
_textDisplayed = false; _textDisplayed = false;
_textAreaBuffer = new uint8[320*40]; _textAreaBuffer = new uint8[320*40];
assert(_textAreaBuffer); assert(_textAreaBuffer);
_drawPage2 = 8; _drawPage2 = (vm()->gameFlags().isDemo && vm()->gameFlags().gameID == GI_LOL) ? 0 : 8;
_palDelayInc = _palDiff = _palDelayAcc = 0; _palDelayInc = _palDiff = _palDelayAcc = 0;
_abortFlag = 0; _abortFlag = 0;
@ -401,7 +401,9 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
anim->x = x; anim->x = x;
anim->y = y; anim->y = y;
anim->wsaCopyParams = wsaFlags; anim->wsaCopyParams = wsaFlags;
_drawPage2 = 8; const bool isLoLDemo = vm()->gameFlags().isDemo && vm()->gameFlags().gameID == GI_LOL;
_drawPage2 = isLoLDemo ? 0 : 8;
uint16 wsaOpenFlags = ((wsaFlags & 0x10) != 0) ? 2 : 0; uint16 wsaOpenFlags = ((wsaFlags & 0x10) != 0) ? 2 : 0;
@ -409,22 +411,42 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
snprintf(file, 32, "%s.WSA", filename); snprintf(file, 32, "%s.WSA", filename);
if (vm()->resource()->exists(file)) { if (vm()->resource()->exists(file)) {
anim->wsa = new WSAMovie_v2(_vm, _screen); if (isLoLDemo)
anim->wsa = new WSAMovie_v1(_vm);
else
anim->wsa = new WSAMovie_v2(_vm, _screen);
assert(anim->wsa); assert(anim->wsa);
anim->wsa->open(file, wsaOpenFlags, (index == 1) ? screen()->getPalette(0) : 0); anim->wsa->open(file, wsaOpenFlags, (index == 1) ? screen()->getPalette(0) : 0);
} }
if (anim->wsa && anim->wsa->opened()) { if (anim->wsa && anim->wsa->opened()) {
if (x == -1) if (isLoLDemo) {
anim->x = x = 0; if (x == -1) {
if (y == -1) int16 t = int8(320 - anim->wsa->width());
anim->y = y = 0; uint8 v = int8(t & 0x00FF) - int8((t & 0xFF00) >> 8);
v >>= 1;
anim->x = x = v;
}
if (y == -1) {
int16 t = int8(200 - anim->wsa->height());
uint8 v = int8(t & 0x00FF) - int8((t & 0xFF00) >> 8);
v >>= 1;
anim->y = y = v;
}
} else {
if (x == -1)
anim->x = x = 0;
if (y == -1)
anim->y = y = 0;
}
if (wsaFlags & 2) { if (wsaFlags & 2) {
screen()->fadePalette(screen()->getPalette(1), 15, 0); screen()->fadePalette(screen()->getPalette(1), 15, 0);
screen()->clearPage(8); screen()->clearPage(_drawPage2);
screen()->checkedPageUpdate(8, 4); if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen(); screen()->updateScreen();
} }
@ -433,12 +455,13 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
if (vm()->resource()->exists(file)) { if (vm()->resource()->exists(file)) {
screen()->loadBitmap(file, 3, 3, screen()->getPalette(0)); screen()->loadBitmap(file, 3, 3, screen()->getPalette(0));
screen()->copyRegion(0, 0, 0, 0, 320, 200, 2, 8, Screen::CR_NO_P_CHECK); screen()->copyRegion(0, 0, 0, 0, 320, 200, 2, _drawPage2, Screen::CR_NO_P_CHECK);
screen()->checkedPageUpdate(8, 4); if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen(); screen()->updateScreen();
} }
anim->wsa->displayFrame(0, 0, 0, 0, 0); anim->wsa->displayFrame(0, x, y, 0, 0);
} }
if (wsaFlags & 2) if (wsaFlags & 2)
@ -446,8 +469,9 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
} else { } else {
if (wsaFlags & 2) { if (wsaFlags & 2) {
screen()->fadePalette(screen()->getPalette(1), 15, 0); screen()->fadePalette(screen()->getPalette(1), 15, 0);
screen()->clearPage(8); screen()->clearPage(_drawPage2);
screen()->checkedPageUpdate(8, 4); if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen(); screen()->updateScreen();
} }
@ -455,8 +479,9 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
if (vm()->resource()->exists(file)) { if (vm()->resource()->exists(file)) {
screen()->loadBitmap(file, 3, 3, screen()->getPalette(0)); screen()->loadBitmap(file, 3, 3, screen()->getPalette(0));
screen()->copyRegion(0, 0, 0, 0, 320, 200, 2, 8, Screen::CR_NO_P_CHECK); screen()->copyRegion(0, 0, 0, 0, 320, 200, 2, _drawPage2, Screen::CR_NO_P_CHECK);
screen()->checkedPageUpdate(8, 4); if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen(); screen()->updateScreen();
} }

View file

@ -96,7 +96,7 @@ public:
}; };
struct Animation { struct Animation {
WSAMovie_v2 *wsa; Movie *wsa;
int16 x, y; int16 x, y;
uint32 nextFrame; uint32 nextFrame;
uint8 enable; uint8 enable;

View file

@ -43,8 +43,17 @@ int LoLEngine::processPrologue() {
if (!saveFileLoadable(0) || _flags.isDemo) if (!saveFileLoadable(0) || _flags.isDemo)
showIntro(); showIntro();
if (_flags.isDemo) if (_flags.isDemo) {
_screen->fadePalette(_screen->getPalette(1), 30, 0);
_screen->loadBitmap("FINAL.CPS", 2, 2, _screen->getPalette(0));
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->fadePalette(_screen->getPalette(0), 30, 0);
delayWithTicks(300);
_screen->fadePalette(_screen->getPalette(1), 60, 0);
setupPrologueData(false);
return -1; return -1;
}
preInit(); preInit();
@ -219,7 +228,8 @@ void LoLEngine::showIntro() {
while (!_tim->finished() && !shouldQuit() && !skipFlag()) { while (!_tim->finished() && !shouldQuit() && !skipFlag()) {
updateInput(); updateInput();
_tim->exec(intro, false); _tim->exec(intro, false);
_screen->checkedPageUpdate(8, 4); if (!_flags.isDemo)
_screen->checkedPageUpdate(8, 4);
if (_tim->_palDiff) { if (_tim->_palDiff) {
if (palNextFadeStep < _system->getMillis()) { if (palNextFadeStep < _system->getMillis()) {

View file

@ -42,6 +42,9 @@ public:
virtual bool opened() { return _opened; } virtual bool opened() { return _opened; }
virtual int width() const = 0;
virtual int height() const = 0;
virtual int open(const char *filename, int offscreen, uint8 *palette) = 0; virtual int open(const char *filename, int offscreen, uint8 *palette) = 0;
virtual void close() = 0; virtual void close() = 0;
@ -62,6 +65,9 @@ public:
WSAMovie_v1(KyraEngine_v1 *vm); WSAMovie_v1(KyraEngine_v1 *vm);
virtual ~WSAMovie_v1(); virtual ~WSAMovie_v1();
int width() const { return _width; }
int height() const { return _height; }
virtual int open(const char *filename, int offscreen, uint8 *palette); virtual int open(const char *filename, int offscreen, uint8 *palette);
virtual void close(); virtual void close();
@ -115,9 +121,6 @@ public:
int xAdd() const { return _xAdd; } int xAdd() const { return _xAdd; }
int yAdd() const { return _yAdd; } int yAdd() const { return _yAdd; }
int width() const { return _width; }
int height() const { return _height; }
void setWidth(int w) { _width = w; } void setWidth(int w) { _width = w; }
void setHeight(int h) { _height = h; } void setHeight(int h) { _height = h; }
protected: protected: