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_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_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)
const KYRAGameDescription adGameDescs[] = {
@ -1036,9 +1036,8 @@ const KYRAGameDescription adGameDescs[] = {
LOL_PC98_SJIS_FLAGS
},
// TODO: It looks like this demo version does not use WSA v2 files, that means
// it is probably being quite old... Since our TIM player relies on WSA v2 features,
// we disable the detection entry for now.
// TODO: It looks like this demo version does use something between
// WSA v1 and WSA v2 files, that means it is probably being quite old...
/*{
{
"lol",

View file

@ -2022,7 +2022,8 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) {
int h2 = (h1 * factor) / 100;
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);
if (!_flags.isDemo)
_screen->checkedPageUpdate(8, 4);
_screen->updateScreen();

View file

@ -53,7 +53,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
COMMAND(cmd_initFunc),
COMMAND(cmd_stopFunc),
COMMAND(cmd_wsaDisplayFrame),
COMMAND_UNIMPL(),
COMMAND(cmd_displayText),
// 0x08
COMMAND(cmd_loadVocFile),
COMMAND(cmd_unloadVocFile),
@ -98,7 +98,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
_textDisplayed = false;
_textAreaBuffer = new uint8[320*40];
assert(_textAreaBuffer);
_drawPage2 = 8;
_drawPage2 = (vm()->gameFlags().isDemo && vm()->gameFlags().gameID == GI_LOL) ? 0 : 8;
_palDelayInc = _palDiff = _palDelayAcc = 0;
_abortFlag = 0;
@ -401,7 +401,9 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
anim->x = x;
anim->y = y;
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;
@ -409,6 +411,9 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
snprintf(file, 32, "%s.WSA", filename);
if (vm()->resource()->exists(file)) {
if (isLoLDemo)
anim->wsa = new WSAMovie_v1(_vm);
else
anim->wsa = new WSAMovie_v2(_vm, _screen);
assert(anim->wsa);
@ -416,14 +421,31 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
}
if (anim->wsa && anim->wsa->opened()) {
if (isLoLDemo) {
if (x == -1) {
int16 t = int8(320 - anim->wsa->width());
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) {
screen()->fadePalette(screen()->getPalette(1), 15, 0);
screen()->clearPage(8);
screen()->clearPage(_drawPage2);
if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen();
}
@ -433,12 +455,13 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
if (vm()->resource()->exists(file)) {
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);
if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen();
}
anim->wsa->displayFrame(0, 0, 0, 0, 0);
anim->wsa->displayFrame(0, x, y, 0, 0);
}
if (wsaFlags & 2)
@ -446,7 +469,8 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
} else {
if (wsaFlags & 2) {
screen()->fadePalette(screen()->getPalette(1), 15, 0);
screen()->clearPage(8);
screen()->clearPage(_drawPage2);
if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen();
}
@ -455,7 +479,8 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
if (vm()->resource()->exists(file)) {
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);
if (_drawPage2)
screen()->checkedPageUpdate(8, 4);
screen()->updateScreen();
}

View file

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

View file

@ -43,8 +43,17 @@ int LoLEngine::processPrologue() {
if (!saveFileLoadable(0) || _flags.isDemo)
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;
}
preInit();
@ -219,6 +228,7 @@ void LoLEngine::showIntro() {
while (!_tim->finished() && !shouldQuit() && !skipFlag()) {
updateInput();
_tim->exec(intro, false);
if (!_flags.isDemo)
_screen->checkedPageUpdate(8, 4);
if (_tim->_palDiff) {

View file

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