aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-05-18 01:39:58 +0000
committerFlorian Kagerer2009-05-18 01:39:58 +0000
commit80ed10fc7244478aa98f9fd86e07f548ae2532e8 (patch)
tree57fb21b8aa82b04435432504e4db6387f71dc7e0 /engines
parent50805cb7ea26d2d2220d1a61d943b1ea7086048c (diff)
downloadscummvm-rg350-80ed10fc7244478aa98f9fd86e07f548ae2532e8.tar.gz
scummvm-rg350-80ed10fc7244478aa98f9fd86e07f548ae2532e8.tar.bz2
scummvm-rg350-80ed10fc7244478aa98f9fd86e07f548ae2532e8.zip
LOL: - implemented fog spell
svn-id: r40673
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_lol.cpp4
-rw-r--r--engines/kyra/lol.cpp55
-rw-r--r--engines/kyra/lol.h4
-rw-r--r--engines/kyra/script_tim.cpp2
4 files changed, 61 insertions, 4 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 673b2832a7..96cf88ffb4 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1308,7 +1308,7 @@ int LoLEngine::clickedScenePickupItem(Button *button) {
int p = 0;
for (int i = 0; i < len; i++) {
- p = _screen->getPagePixel(_screen->_curPage, _mouseX + checkX[i], _mouseY + checkY[i]);
+ p = _screen->getPagePixel(_screen->_curPage, CLIP(_mouseX + checkX[i], 0, 320), CLIP(_mouseY + checkY[i], 0, 200));
if (p)
break;
}
@@ -2115,7 +2115,7 @@ int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseW
buttonList->flags2 |= flags;
if (buttonList->buttonCallback) {
- _vm->removeInputTop();
+ //_vm->removeInputTop();
if ((*buttonList->buttonCallback.get())(buttonList))
break;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 2d9bb388dd..dbf3702b1f 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -2185,6 +2185,7 @@ int LoLEngine::castFireball(ActiveSpell *a) {
}
int LoLEngine::castHandOfFate(ActiveSpell *a) {
+ processMagicHandOfFate(a->charNum, a->level);
return 1;
}
@@ -2194,10 +2195,12 @@ int LoLEngine::castMistOfDoom(ActiveSpell *a) {
}
int LoLEngine::castLightning(ActiveSpell *a) {
+ processMagicLightning(a->charNum, a->level);
return 1;
}
int LoLEngine::castFog(ActiveSpell *a) {
+ processMagicFog();
return 1;
}
@@ -2211,6 +2214,7 @@ int LoLEngine::castUnk(ActiveSpell *a) {
}
int LoLEngine::castGuardian(ActiveSpell *a) {
+ processMagicGuardian(a->charNum, a->level);
return 1;
}
@@ -2330,7 +2334,6 @@ void LoLEngine::processMagicHeal(int charNum, int spellLevel) {
points = 10000;
healShpFrames = _healShapeFrames + 16;
healiShpFrames = _healShapeFrames + 64;
-
}
int ch = 0;
@@ -2377,7 +2380,7 @@ void LoLEngine::processMagicHeal(int charNum, int spellLevel) {
pts[charNum] &= 0xff;
pts[charNum] += ((diff[charNum] << 8) / 16);
- increaseCharacterHitpoints(ch, pts[charNum] / 256, true);
+ increaseCharacterHitpoints(charNum, pts[charNum] / 256, true);
gui_drawCharPortraitWithStats(charNum);
_screen->drawShape(2, _healShapes[healShpFrames[i]], pX[charNum], pY, 0, 0x1000, _trueLightTable1, _trueLightTable2);
@@ -2446,10 +2449,54 @@ void LoLEngine::processMagicFireball(int charNum, int spellLevel) {
}
+void LoLEngine::processMagicHandOfFate(int charNum, int spellLevel) {
+
+}
+
void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
}
+void LoLEngine::processMagicLightning(int charNum, int spellLevel) {
+
+}
+
+void LoLEngine::processMagicFog() {
+ int cp = _screen->setCurPage(2);
+ _screen->copyPage(0, 12);
+
+ WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen);
+ int numFrames = mov->open("fog.wsa", 0, 0);
+ if (!mov->opened())
+ error("Fog: Unable to load fog.wsa");
+
+ snd_playSoundEffect(145, -1);
+
+ for (int curFrame = 0; curFrame < numFrames; curFrame++) {
+ _smoothScrollTimer = _system->getMillis() + 3 * _tickLength;
+ _screen->copyPage(12, 2);
+ mov->displayFrame(curFrame % numFrames, 2, 112, 0, 0x5000, _trueLightTable1, _trueLightTable2);
+ _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ delayUntil(_smoothScrollTimer);
+ }
+
+ mov->close();
+ delete mov;
+
+ _screen->copyPage(12, 2);
+ _screen->setCurPage(cp);
+ updateDrawPage2();
+
+ uint16 o = _levelBlockProperties[calcNewBlockPosition(_currentBlock, _currentDirection)].assignedObjects;
+ while (o & 0x8000) {
+ inflictMagicalDamage(o, -1, 15, 6, 0);
+ o = _monsters[o & 0x7fff].nextAssignedObject;
+ }
+
+ gui_drawScene(0);
+}
+
void LoLEngine::processMagicSwarm(int charNum, int damage) {
int cp = _screen->setCurPage(2);
_screen->copyPage(0, 12);
@@ -2513,6 +2560,10 @@ void LoLEngine::processMagicSwarm(int charNum, int damage) {
delete mov;
}
+void LoLEngine::processMagicGuardian(int charNum, int spellLevel) {
+
+}
+
void LoLEngine::callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y) {
if (_swarmSpellStatus)
_screen->copyRegion(112, 0, 112, 0, 176, 120, 6, _screen->_curPage);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 703e4a6c3d..525b763a67 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -1254,8 +1254,12 @@ private:
void processMagicHeal(int charNum, int spellLevel);
void processMagicIce(int charNum, int spellLevel);
void processMagicFireball(int charNum, int spellLevel);
+ void processMagicHandOfFate(int charNum, int spellLevel);
void processMagicMistOfDoom(int charNum, int spellLevel);
+ void processMagicLightning(int charNum, int spellLevel);
+ void processMagicFog();
void processMagicSwarm(int charNum, int damage);
+ void processMagicGuardian(int charNum, int spellLevel);
void callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y);
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index ce45dc4926..71a183d7a8 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -597,6 +597,7 @@ int TIMInterpreter::cmd_wsaDisplayFrame(const uint16 *param) {
Animation &anim = _animations[param[0]];
const int frame = param[1];
int page = (anim.wsaCopyParams & 0x4000) != 0 ? 2 : _drawPage2;
+ // WORKAROUND for some bugged scripts that will try to display frames of non-existent animations
if (anim.wsa)
anim.wsa->displayFrame(frame, page, anim.x, anim.y, anim.wsaCopyParams & 0xF0FF, 0, 0);
if (!page)
@@ -945,6 +946,7 @@ void TIMInterpreter_LoL::startBackgroundAnimation(int animIndex, int part) {
anim->curFrame = p->firstFrame;
anim->cyclesCompleted = 0;
+ // WORKAROUND for some bugged scripts that will try to display frames of non-existent animations
if (anim->wsa)
anim->wsa->displayFrame(anim->curFrame - 1, 0, anim->x, anim->y, 0);
}