diff options
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/lol.cpp | 108 | ||||
-rw-r--r-- | engines/kyra/lol.h | 28 | ||||
-rw-r--r-- | engines/kyra/saveload_lol.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 27 |
5 files changed, 141 insertions, 36 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 564e64c8d7..5c494b5180 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -536,7 +536,7 @@ Common::Error LoLEngine::init() { _spellProcs.push_back(new SpellProc(this, &LoLEngine::castSwarm)); _spellProcs.push_back(new SpellProc(this, 0)); _spellProcs.push_back(new SpellProc(this, 0)); - _spellProcs.push_back(new SpellProc(this, &LoLEngine::castUnk)); + _spellProcs.push_back(new SpellProc(this, &LoLEngine::castVaelansCube)); _spellProcs.push_back(new SpellProc(this, 0)); _spellProcs.push_back(new SpellProc(this, 0)); _spellProcs.push_back(new SpellProc(this, 0)); @@ -1910,13 +1910,12 @@ int LoLEngine::castSwarm(ActiveSpell *a) { return 1; } -int LoLEngine::castUnk(ActiveSpell *a) { - return 1; +int LoLEngine::castVaelansCube(ActiveSpell *a) { + return processMagicVaelansCube(); } int LoLEngine::castGuardian(ActiveSpell *a) { - processMagicGuardian(a->charNum); - return 1; + return processMagicGuardian(a->charNum); } int LoLEngine::castHealOnSingleCharacter(ActiveSpell *a) { @@ -1924,7 +1923,7 @@ int LoLEngine::castHealOnSingleCharacter(ActiveSpell *a) { return 1; } -void LoLEngine::processMagicSpark(int charNum, int spellLevel) { +int LoLEngine::processMagicSpark(int charNum, int spellLevel) { WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen); _screen->copyPage(0, 12); @@ -1994,16 +1993,18 @@ void LoLEngine::processMagicSpark(int charNum, int spellLevel) { _sceneUpdateRequired = true; delete mov; + return 1; } -void LoLEngine::processMagicHealSelectTarget() { +int LoLEngine::processMagicHealSelectTarget() { _txt->printMessage(0, getLangString(0x4040)); gui_resetButtonList(); gui_setFaceFramesControlButtons(81, 0); gui_initButtonsFromList(_buttonList8); + return 1; } -void LoLEngine::processMagicHeal(int charNum, int spellLevel) { +int LoLEngine::processMagicHeal(int charNum, int spellLevel) { if (!_healOverlay) { _healOverlay = new uint8[256]; _screen->generateGrayOverlay(_screen->getPalette(1), _healOverlay, 52, 22, 20, 0, 256, true); @@ -2113,9 +2114,10 @@ void LoLEngine::processMagicHeal(int charNum, int spellLevel) { _screen->setCurPage(cp); updateDrawPage2(); + return 1; } -void LoLEngine::processMagicIce(int charNum, int spellLevel) { +int LoLEngine::processMagicIce(int charNum, int spellLevel) { int cp = _screen->setCurPage(2); disableSysTimer(2); @@ -2261,9 +2263,10 @@ void LoLEngine::processMagicIce(int charNum, int spellLevel) { delete[] swampCol; delete[] tpal; _screen->setCurPage(cp); + return 1; } -void LoLEngine::processMagicFireball(int charNum, int spellLevel) { +int LoLEngine::processMagicFireball(int charNum, int spellLevel) { int fbCnt = 0; int d = 1; @@ -2412,9 +2415,10 @@ void LoLEngine::processMagicFireball(int charNum, int spellLevel) { updateDrawPage2(); snd_playQueuedEffects(); runLevelScriptCustom(bl, 0x20, charNum, 3, 0, 0); + return 1; } -void LoLEngine::processMagicHandOfFate(int spellLevel) { +int LoLEngine::processMagicHandOfFate(int spellLevel) { int cp = _screen->setCurPage(2); _screen->copyPage(0, 12); @@ -2491,9 +2495,10 @@ void LoLEngine::processMagicHandOfFate(int spellLevel) { gui_drawScene(2); updateDrawPage2(); + return 1; } -void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) { +int LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) { static const uint8 mistDamage[] = { 30, 70, 110, 200 }; _envSfxUseQueue = true; @@ -2525,10 +2530,11 @@ void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) { _screen->copyPage(12, 0); updateDrawPage2(); - this->snd_playQueuedEffects(); + this->snd_playQueuedEffects(); + return 1; } -void LoLEngine::processMagicLightning(int charNum, int spellLevel) { +int LoLEngine::processMagicLightning(int charNum, int spellLevel) { _screen->hideMouse(); _screen->copyPage(0, 2); gui_drawScene(2); @@ -2562,9 +2568,10 @@ void LoLEngine::processMagicLightning(int charNum, int spellLevel) { _sceneUpdateRequired = true; gui_drawScene(0); _screen->showMouse(); + return 1; } -void LoLEngine::processMagicFog() { +int LoLEngine::processMagicFog() { int cp = _screen->setCurPage(2); _screen->copyPage(0, 12); @@ -2598,9 +2605,10 @@ void LoLEngine::processMagicFog() { } gui_drawScene(0); + return 1; } -void LoLEngine::processMagicSwarm(int charNum, int damage) { +int LoLEngine::processMagicSwarm(int charNum, int damage) { int cp = _screen->setCurPage(2); _screen->copyPage(0, 12); snd_playSoundEffect(74, -1); @@ -2662,12 +2670,71 @@ void LoLEngine::processMagicSwarm(int charNum, int damage) { _screen->setCurPage(cp); delete mov; + return 1; } -void LoLEngine::processMagicGuardian(int charNum) { - //uint16 targetBlock = 0; - //int dist = getSpellTargetBlock(_currentBlock, _currentDirection, 3, targetBlock); +int LoLEngine::processMagicVaelansCube() { + uint8 *tmpPal1 = new uint8[768]; + uint8 *tmpPal2 = new uint8[768]; + uint8 *sp1 = _screen->getPalette(1); + + memcpy(tmpPal1, sp1, 768); + memcpy(tmpPal2, sp1, 768); + + for (int i = 0; i < 128; i++) { + uint16 a = sp1[i * 3] + 16; + tmpPal2[i * 3] = (a > 60) ? 60 : a; + tmpPal2[i * 3 + 1] = sp1[i * 3 + 1]; + a = sp1[i * 3 + 2] + 19; + tmpPal2[i * 3 + 2] = (a > 60) ? 60 : a; + } + + snd_playSoundEffect(146, -1); + + uint32 ctime = _system->getMillis(); + uint32 endTime = _system->getMillis() + 70 * _tickLength; + + while (_system->getMillis() < endTime) { + _screen->fadePaletteStep(tmpPal1, tmpPal2, _system->getMillis() - ctime, 70 * _tickLength); + updateInput(); + } + uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection); + uint8 s = _levelBlockProperties[bl].walls[_currentDirection ^ 2]; + uint8 flg = _wllWallFlags[s]; + + int v = (s == 47 && (_currentLevel == 17 || _currentLevel == 24)) ? 1 : 0; + if ((_wllVmpMap[s] == 1 || _wllVmpMap[s] == 2) && (flg & 1) && (_currentLevel == 22)) { + memset(_levelBlockProperties[bl].walls, 0, 4); + gui_drawScene(0); + v = 1; + } + + uint16 o = _levelBlockProperties[bl].assignedObjects; + while (o & 0x8000) { + MonsterInPlay *m = &_monsters[o & 0x7fff]; + o = m->nextAssignedObject; + if (m->properties->flags & 0x1000) { + inflictDamage(o, 100, 0xffff, 0, 0x80); + v = 1; + } + } + + ctime = _system->getMillis(); + endTime = _system->getMillis() + 70 * _tickLength; + + while (_system->getMillis() < endTime) { + _screen->fadePaletteStep(tmpPal2, tmpPal1, _system->getMillis() - ctime, 70 * _tickLength); + updateInput(); + } + + delete[] tmpPal1; + delete[] tmpPal2; + + return v; +} + +int LoLEngine::processMagicGuardian(int charNum) { int cp = _screen->setCurPage(2); _screen->copyPage(0, 2); _screen->copyPage(2, 12); @@ -2682,7 +2749,7 @@ void LoLEngine::processMagicGuardian(int charNum) { _screen->copyPage(2, 12); uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection); - //bool a = (_levelBlockProperties[bl].assignedObjects & 0x8000) ? true : false; + int res = (_levelBlockProperties[bl].assignedObjects & 0x8000) ? 1 : 0; inflictMagicalDamageForBlock(bl, charNum, 200, 0x80); _screen->copyPage(12, 2); @@ -2699,6 +2766,7 @@ void LoLEngine::processMagicGuardian(int charNum) { _screen->setCurPage(cp); gui_drawPlayField(); updateDrawPage2(); + return res; } void LoLEngine::callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y) { diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 4e9b39b88d..be734d083c 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -69,7 +69,7 @@ struct LoLCharacter { int16 nextAnimUpdateCountdown; uint16 items[11]; uint8 skillLevels[3]; - uint8 skillModifiers[3]; + int8 skillModifiers[3]; int32 experiencePts[3]; uint8 characterUpdateEvents[5]; uint8 characterUpdateDelay[5]; @@ -771,6 +771,7 @@ private: int olol_getNextActiveCharacter(EMCState *script); int olol_paralyzePoisonCharacter(EMCState *script); int olol_drawCharPortrait(EMCState *script); + int olol_removeInventoryItem(EMCState *script); int olol_getAnimationLastPart(EMCState *script); int olol_assignSpecialGuiShape(EMCState *script); int olol_findInventoryItem(EMCState *script); @@ -1326,21 +1327,22 @@ private: int castLightning(ActiveSpell *a); int castFog(ActiveSpell *a); int castSwarm(ActiveSpell *a); - int castUnk(ActiveSpell *a); + int castVaelansCube(ActiveSpell *a); int castGuardian(ActiveSpell *a); int castHealOnSingleCharacter(ActiveSpell *a); - void processMagicSpark(int charNum, int spellLevel); - void processMagicHealSelectTarget(); - void processMagicHeal(int charNum, int spellLevel); - void processMagicIce(int charNum, int spellLevel); - void processMagicFireball(int charNum, int spellLevel); - void processMagicHandOfFate(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 processMagicSpark(int charNum, int spellLevel); + int processMagicHealSelectTarget(); + int processMagicHeal(int charNum, int spellLevel); + int processMagicIce(int charNum, int spellLevel); + int processMagicFireball(int charNum, int spellLevel); + int processMagicHandOfFate(int spellLevel); + int processMagicMistOfDoom(int charNum, int spellLevel); + int processMagicLightning(int charNum, int spellLevel); + int processMagicFog(); + int processMagicSwarm(int charNum, int damage); + int processMagicVaelansCube(); + int processMagicGuardian(int charNum); void callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y); void callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y); diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index 4998795f73..248c46c2a3 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -85,7 +85,7 @@ Common::Error LoLEngine::loadGameState(int slot) { for (int ii = 0; ii < 3; ii++) c->skillLevels[ii] = in.readByte(); for (int ii = 0; ii < 3; ii++) - c->skillModifiers[ii] = in.readByte(); + c->skillModifiers[ii] = in.readSByte(); for (int ii = 0; ii < 3; ii++) c->experiencePts[ii] = in.readUint32BE(); for (int ii = 0; ii < 5; ii++) @@ -294,7 +294,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra for (int ii = 0; ii < 3; ii++) out->writeByte(c->skillLevels[ii]); for (int ii = 0; ii < 3; ii++) - out->writeByte(c->skillModifiers[ii]); + out->writeSByte(c->skillModifiers[ii]); for (int ii = 0; ii < 3; ii++) out->writeUint32BE(c->experiencePts[ii]); for (int ii = 0; ii < 5; ii++) diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index b834123d2f..5f64a1cddd 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -589,6 +589,16 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in va_end(args); } + // _internDimH: h0 +// _internDimW: w0 +// _internDimDstX: x1 +// _internDimDstY: y1 +// _internBlockWidth: w1 +// _internBlockHeight: h1 +// _internDimU5: x2 +// _internDimU6: y2 +// _internBlockWidth2: w2 + _internDimX = _internDimY = 0; _internDimW = w1; _internDimH = h1; diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 75651a2a9a..33edfa0e24 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -1896,6 +1896,31 @@ int LoLEngine::olol_drawCharPortrait(EMCState *script) { return 1; } +int LoLEngine::olol_removeInventoryItem(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_removeInventoryItem(%p) (%d)", (const void *)script, stackPos(0)); + int itemType = stackPos(0); + for (int i = 0; i < 48; i++) { + if (!_inventory[i] || _itemsInPlay[_inventory[i]].itemPropertyIndex != itemType) + continue; + _inventory[i] = 0; + gui_drawInventory(); + return 1; + } + + for (int i = 0; i < 4; i++) { + if (!(_characters[i].flags & 1)) + continue; + + for (int ii = 0; ii < 11; ii++) { + if (!_characters[i].items[ii] || _itemsInPlay[_characters[i].items[ii]].itemPropertyIndex != itemType) + continue; + _characters[i].items[ii] = 0; + return 1; + } + } + return 0; +} + int LoLEngine::olol_getAnimationLastPart(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getAnimationLastPart(%p) (%d)", (const void *)script, stackPos(0)); return _tim->resetAnimationLastPart(stackPos(0)); @@ -2730,7 +2755,7 @@ void LoLEngine::setupOpcodeTable() { Opcode(olol_drawCharPortrait); // 0xA0 - OpcodeUnImpl(); + Opcode(olol_removeInventoryItem); OpcodeUnImpl(); OpcodeUnImpl(); Opcode(olol_getAnimationLastPart); |