diff options
-rw-r--r-- | engines/kyra/lol.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/lol.h | 6 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 33 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 28 | ||||
-rw-r--r-- | engines/kyra/screen.h | 2 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 3 |
6 files changed, 66 insertions, 24 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 39428f29e1..526cfc01ac 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -89,7 +89,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _hideControls = 0; _lastCharInventory = -1; - _itemIconShapes = _itemShapes = _gameShapes = _thrownShapes = _iceShapes = _fireballShapes = 0; + _itemIconShapes = _itemShapes = _gameShapes = _thrownShapes = _effectShapes = _fireballShapes = 0; _levelShpList = _levelDatList = 0; _monsterShapes = _monsterPalettes = 0; _monsterShapesEx = 0; @@ -254,10 +254,10 @@ LoLEngine::~LoLEngine() { delete[] _thrownShapes[i]; delete[] _thrownShapes; } - if (_iceShapes) { - for (int i = 0; i < _numIceShapes; i++) - delete[] _iceShapes[i]; - delete[] _iceShapes; + if (_effectShapes) { + for (int i = 0; i < _numEffectShapes; i++) + delete[] _effectShapes[i]; + delete[] _effectShapes; } if (_fireballShapes) { for (int i = 0; i < _numFireballShapes; i++) @@ -695,10 +695,10 @@ void LoLEngine::startup() { _screen->loadBitmap("ICE.SHP", 3, 3, 0); shp = _screen->getCPagePtr(3); - _numIceShapes = READ_LE_UINT16(shp); - _iceShapes = new uint8*[_numIceShapes]; - for (int i = 0; i < _numIceShapes; i++) - _iceShapes[i] = _screen->makeShapeCopy(shp, i); + _numEffectShapes = READ_LE_UINT16(shp); + _effectShapes = new uint8*[_numEffectShapes]; + for (int i = 0; i < _numEffectShapes; i++) + _effectShapes[i] = _screen->makeShapeCopy(shp, i); _screen->loadBitmap("FIREBALL.SHP", 3, 3, 0); shp = _screen->getCPagePtr(3); diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a329fbfe39..593b04c01b 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -685,8 +685,8 @@ private: int _numGameShapes; uint8 **_thrownShapes; int _numThrownShapes; - uint8 **_iceShapes; - int _numIceShapes; + uint8 **_effectShapes; + int _numEffectShapes; uint8 **_fireballShapes; int _numFireballShapes; @@ -793,7 +793,7 @@ private: void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim); void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2); void drawDecorations(int index); - void drawIceShapes(int index, int iceShapeIndex); + void drawBlockEffects(int index, int type); void drawScriptShapes(int pageNum); void setWallType(int block, int wall, int val); void updateSceneWindow(); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index ce3393fc62..429223101e 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -86,7 +86,7 @@ void LoLEngine::loadLevel(int index) { addLevelItems(); disableMonstersForBlock(_currentBlock); - _screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay,32, 16, 0, 0, 128, true); + _screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay, 32, 16, 0, 0, 128, true); _sceneDefaultUpdate = 0; if (_screen->_fadeFlag == 3) @@ -1525,12 +1525,12 @@ void LoLEngine::drawSceneShapes() { if (i == 16) w |= 0x80; - drawIceShapes(t, 0); + drawBlockEffects(t, 0); if (_curBlockCaps[t]->assignedObjects && (w & 0x80)) drawBlockObjects(t); - drawIceShapes(t, 1); + drawBlockEffects(t, 1); if (!(w & 8)) continue; @@ -1714,10 +1714,31 @@ void LoLEngine::drawDecorations(int index) { } } -void LoLEngine::drawIceShapes(int index, int iceShapeIndex) { - uint8 f = _curBlockCaps[index]->flags; - if (!(f & 0xf0)) +void LoLEngine::drawBlockEffects(int index, int type) { + static const int16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 }; + uint8 flg = _curBlockCaps[index]->flags; + // flags: 0x10 = ice wall, 0x20 = teleporter, 0x40 = blue slime spot, 0x80 = blood spot + if (!(flg & 0xf0)) return; + + type = (type == 0) ? 2 : 0; + + for (int i = 0; i < 2; i++, type++) { + if (!((0x10 << type) & flg)) + continue; + + int16 x = 0x80; + int16 y = yOffs[type]; + uint16 drawFlag = (type == 3) ? 0x80 : 0x20; + uint8 *ovl = (type == 3) ? _screen->_grayOverlay : 0; + + calcCoordinatesAddDirectionOffset(x, y, _currentDirection); + + x |= ((_currentBlockPropertyIndex[index] & 0x1f) << 8); + y |= ((_currentBlockPropertyIndex[index] & 0xffe0) << 3); + + drawItemOrMonster(_effectShapes[type], ovl, x, y, 0, (type == 1) ? -20 : 0, drawFlag, -1, false); + } } void LoLEngine::drawScriptShapes(int pageNum) { diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index ec0a899dcc..6178552450 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1248,12 +1248,14 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int &Screen::drawShapePlotType14, // used by Kyra 1 (invisibility) &Screen::drawShapePlotType11_15, // used by Kyra 1 (invisibility) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, + 0, 0, 0, 0, 0, 0, 0, + &Screen::drawShapePlotType33, // used by LoL (blood spots on the floor) + 0, 0, 0, &Screen::drawShapePlotType37, // used by LoL (monsters) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, - &Screen::drawShapePlotType52, + &Screen::drawShapePlotType48, // used by LoL (slime spots on the floor) + 0, 0, 0, + &Screen::drawShapePlotType52, // used by LoL (projectiles) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1815,6 +1817,17 @@ void Screen::drawShapePlotType14(uint8 *dst, uint8 cmd) { *dst = cmd; } +void Screen::drawShapePlotType33(uint8 *dst, uint8 cmd) { + if (cmd == 255) { + *dst = _dsTable5[*dst]; + } else { + for (int i = 0; i < _dsTableLoopCount; ++i) + cmd = _dsTable[cmd]; + if (cmd) + *dst = cmd; + } +} + void Screen::drawShapePlotType37(uint8 *dst, uint8 cmd) { cmd = _dsTable2[cmd]; @@ -1829,6 +1842,13 @@ void Screen::drawShapePlotType37(uint8 *dst, uint8 cmd) { *dst = cmd; } +void Screen::drawShapePlotType48(uint8 *dst, uint8 cmd) { + uint8 offs = _dsTable3[cmd]; + if (!(offs & 0x80)) + cmd = _dsTable4[(offs << 8) | *dst]; + *dst = cmd; +} + void Screen::drawShapePlotType52(uint8 *dst, uint8 cmd) { cmd = _dsTable2[cmd]; uint8 offs = _dsTable3[cmd]; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 8fa098e2eb..779887004c 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -332,7 +332,9 @@ protected: void drawShapePlotType12(uint8 *dst, uint8 cmd); void drawShapePlotType13(uint8 *dst, uint8 cmd); void drawShapePlotType14(uint8 *dst, uint8 cmd); + void drawShapePlotType33(uint8 *dst, uint8 cmd); void drawShapePlotType37(uint8 *dst, uint8 cmd); + void drawShapePlotType48(uint8 *dst, uint8 cmd); void drawShapePlotType52(uint8 *dst, uint8 cmd); typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt); diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index a2adbf9fb0..c7cbe98bfb 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -989,8 +989,7 @@ int LoLEngine::calcDrawingLayerParameters(int x1, int y1, int &x2, int &y2, uint int l = y1 >> 5; y2 = _monsterScaleY[l]; x2 = ((_monsterScaleX[l] * x1) >> 8) + 200; - assert (_shpDmY - 56 < 66); - w = h = _monsterScaleWH[_shpDmY - 56]; + w = h = (_shpDmY > 120) ? 0x100 : _monsterScaleWH[_shpDmY - 56]; if (flip) y2 = ((120 - y2) >> 1) + _screen->getShapeScaledHeight(shape, _dmScaleH); |