aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/script_tim.cpp
diff options
context:
space:
mode:
authorFlorian Kagerer2009-05-10 13:40:28 +0000
committerFlorian Kagerer2009-05-10 13:40:28 +0000
commitdd84aaf648b57220180b84a9aa0825d16bcea5bc (patch)
tree2be68b4e4892d1a4d19509a46ebe64206e83e3f4 /engines/kyra/script_tim.cpp
parent3592801a5707f42c71971321b26e2cc1da775c25 (diff)
downloadscummvm-rg350-dd84aaf648b57220180b84a9aa0825d16bcea5bc.tar.gz
scummvm-rg350-dd84aaf648b57220180b84a9aa0825d16bcea5bc.tar.bz2
scummvm-rg350-dd84aaf648b57220180b84a9aa0825d16bcea5bc.zip
LOL: - added some spell casting (spark, heal, swarm)
- fixed several bugs (not the one in the fighting system though) - added several opcodes. there shouldn't be any real show stoppers in the draracle cave now. - simplified wsa code (which required 4 lines of code for displaying a frame) - added support for wsa animations that don't have a last frame (apparently kyra 2 and 3 don't have this type of wsa file) svn-id: r40420
Diffstat (limited to 'engines/kyra/script_tim.cpp')
-rw-r--r--engines/kyra/script_tim.cpp52
1 files changed, 13 insertions, 39 deletions
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 4165053c15..cae74ef82b 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -420,10 +420,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
screen()->updateScreen();
}
- anim->wsa->setX(x);
- anim->wsa->setY(y);
- anim->wsa->setDrawPage(0);
- anim->wsa->displayFrame(0, 0, 0, 0);
+ anim->wsa->displayFrame(0, 0, 0, 0, 0);
}
if (wsaFlags & 2)
@@ -581,12 +578,9 @@ int TIMInterpreter::cmd_stopFunc(const uint16 *param) {
int TIMInterpreter::cmd_wsaDisplayFrame(const uint16 *param) {
Animation &anim = _animations[param[0]];
const int frame = param[1];
-
- anim.wsa->setX(anim.x);
- anim.wsa->setY(anim.y);
- anim.wsa->setDrawPage((anim.wsaCopyParams & 0x4000) != 0 ? 2 : _drawPage2);
- anim.wsa->displayFrame(frame, anim.wsaCopyParams & 0xF0FF, 0, 0);
- if (!_drawPage2)
+ int page = (anim.wsaCopyParams & 0x4000) != 0 ? 2 : _drawPage2;
+ anim.wsa->displayFrame(frame, page, anim.x, anim.y, anim.wsaCopyParams & 0xF0FF, 0, 0);
+ if (!page)
screen()->updateScreen();
return 1;
}
@@ -829,17 +823,11 @@ TIMInterpreter::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const c
_screen->fadeToBlack(10);
}
- if (wsaFlags & 7) {
- _screen->hideMouse();
- anim->wsa->setDrawPage(0);
- anim->wsa->setX(x);
- anim->wsa->setY(y);
- anim->wsa->displayFrame(0, 0);
- _screen->showMouse();
- }
+ if (wsaFlags & 7)
+ anim->wsa->displayFrame(0, 0, x, y, 0);
if (wsaFlags & 3) {
- _screen->loadSpecialColours(_screen->getPalette(3));
+ _screen->loadSpecialColors(_screen->getPalette(3));
_screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
}
@@ -938,12 +926,8 @@ void TIMInterpreter_LoL::startBackgroundAnimation(int animIndex, int part) {
anim->curFrame = p->firstFrame;
anim->cyclesCompleted = 0;
- if (anim->wsa) {
- anim->wsa->setX(anim->x);
- anim->wsa->setY(anim->y);
- anim->wsa->setDrawPage(0);
- anim->wsa->displayFrame(anim->curFrame - 1, 0, 0);
- }
+ if (anim->wsa)
+ anim->wsa->displayFrame(anim->curFrame - 1, 0, anim->x, anim->y, 0);
}
void TIMInterpreter_LoL::stopBackgroundAnimation(int animIndex) {
@@ -1002,36 +986,26 @@ void TIMInterpreter_LoL::updateBackgroundAnimation(int animIndex) {
anim->nextFrame += (anim->frameDelay * _vm->_tickLength);
- anim->wsa->setX(anim->x);
- anim->wsa->setY(anim->y);
- anim->wsa->setDrawPage(0);
- anim->wsa->displayFrame(anim->curFrame - 1, 0);
+ anim->wsa->displayFrame(anim->curFrame - 1, 0, anim->x, anim->y, 0);
anim->nextFrame += _system->getMillis();
}
void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) {
Animation *anim = &_animations[animIndex];
- anim->wsa->setX(anim->x);
- anim->wsa->setY(anim->y);
int step = (lastFrame >= firstFrame) ? 1 : -1;
for (int i = firstFrame; i != (lastFrame + step) ; i += step) {
uint32 next = _system->getMillis() + delay * _vm->_tickLength;
if (anim->wsaCopyParams & 0x4000) {
_screen->copyRegion(112, 0, 112, 0, 176, 120, 6, 2);
- anim->wsa->setDrawPage(2);
- anim->wsa->displayFrame(i - 1, anim->wsaCopyParams & 0x1000 ? 0x5000 : 0x4000, _vm->_trueLightTable1, _vm->_trueLightTable2);
+ anim->wsa->displayFrame(i - 1, 2, anim->x, anim->y, anim->wsaCopyParams & 0x1000 ? 0x5000 : 0x4000, _vm->_trueLightTable1, _vm->_trueLightTable2);
_screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
_screen->updateScreen();
} else {
- anim->wsa->setDrawPage(0);
- anim->wsa->displayFrame(i - 1, 0);
+ anim->wsa->displayFrame(i - 1, 0, anim->x, anim->y, 0);
_screen->updateScreen();
}
- while ((int)(next - _system->getMillis()) > 0) {
- _vm->updateInput();
- _vm->delay(_vm->_tickLength);
- }
+ _vm->delayUntil(next);
}
}