diff options
author | Johannes Schickel | 2005-12-31 17:25:47 +0000 |
---|---|---|
committer | Johannes Schickel | 2005-12-31 17:25:47 +0000 |
commit | 22055730de26b895265eab1cf37b8dad9ebc6eb5 (patch) | |
tree | ef39f57e6df1287b8553c1293ac60a83eb0dc758 /kyra | |
parent | a10097eaa41357beb2dc4be4f790717fe9fe70a3 (diff) | |
download | scummvm-rg350-22055730de26b895265eab1cf37b8dad9ebc6eb5.tar.gz scummvm-rg350-22055730de26b895265eab1cf37b8dad9ebc6eb5.tar.bz2 scummvm-rg350-22055730de26b895265eab1cf37b8dad9ebc6eb5.zip |
Implemented:
- cmd_drinkPotionAnimation
- cmd_fillFlaskWithWater
- cmd_getIdolGem
- cmd_itemOnGroundHere
- cmd_queryCrystalState
- cmd_setCrystalState
- cmd_setBrandonScaleXAndY
- cmd_resetScaleMode
- cmd_getScaleDepthTableValue
- cmd_setScaleDepthTableValue
- cmd_brandonHealingSequence
svn-id: r19871
Diffstat (limited to 'kyra')
-rw-r--r-- | kyra/kyra.cpp | 82 | ||||
-rw-r--r-- | kyra/kyra.h | 7 | ||||
-rw-r--r-- | kyra/script_v1.cpp | 57 | ||||
-rw-r--r-- | kyra/staticres.cpp | 8 |
4 files changed, 137 insertions, 17 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index da496cf88c..c24d4ada97 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -189,9 +189,18 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *system) _itemList_Size = _takenList_Size = _placedList_Size = _droppedList_Size = _noDropList_Size = 0; _putDownFirst = _waitForAmulet = _blackJewel = _poisonGone = _healingTip = 0; _putDownFirst_Size = _waitForAmulet_Size = _blackJewel_Size = _poisonGone_Size = _healingTip_Size = 0; + _thePoison = _fluteString = _wispJewelStrings = _magicJewelString = _flaskFull = _fullFlask = 0; + _thePoison_Size = _fluteString_Size = _wispJewelStrings_Size = 0; + _magicJewelString_Size = _flaskFull_Size = _fullFlask_Size = 0; _defaultShapeTable = _healingShapeTable = _healingShape2Table = 0; _defaultShapeTableSize = _healingShapeTableSize = _healingShape2TableSize = 0; + _posionDeathShapeTable = _fluteAnimShapeTable = 0; + _posionDeathShapeTableSize = _fluteAnimShapeTableSize = 0; + _winterScrollTable = _winterScroll1Table = _winterScroll2Table = 0; + _winterScrollTableSize = _winterScroll1TableSize = _winterScroll2TableSize = 0; + _drinkAnimationTable = _brandonToWispTable = _magicAnimationTable = _brandonStoneTable = 0; + _drinkAnimationTableSize = _brandonToWispTableSize = _magicAnimationTableSize = _brandonStoneTableSize = 0; // Setup mixer if (!_mixer->isReady()) { @@ -352,6 +361,7 @@ int KyraEngine::init(GameDetector &detector) { _noDrawShapesFlag = 0; _cauldronState = 0; + _crystalState[0] = _crystalState[1] = -1; _brandonStatusBit = 0; _brandonStatusBit0x02Flag = _brandonStatusBit0x20Flag = 10; @@ -1420,6 +1430,78 @@ void KyraEngine::seq_dispelMagicAnimation() { _screen->showMouse(); } +void KyraEngine::seq_fillFlaskWithWater(int item, int type) { + debug(9, "seq_fillFlaskWithWater(%d, %d)", item, type); + int newItem = -1; + static const uint8 flaskTable1[] = { 0x46, 0x48, 0x4A, 0x4C }; + static const uint8 flaskTable2[] = { 0x47, 0x49, 0x4B, 0x4D }; + + if (item >= 60 && item <= 77) { + assert(_flaskFull); + characterSays(_flaskFull[0], 0, -2); + } else if (item == 78) { + assert(type >= 0 && type < ARRAYSIZE(flaskTable1)); + newItem = flaskTable1[type]; + } else if (item == 79) { + assert(type >= 0 && type < ARRAYSIZE(flaskTable2)); + newItem = flaskTable2[type]; + } + + if (newItem == -1) + return; + + _screen->hideMouse(); + setMouseItem(newItem); + _screen->showMouse(); + _itemInHand = newItem; + assert(_fullFlask); + assert(type < _fullFlask_Size && type >= 0); + characterSays(_fullFlask[type], 0, -2); +} + +void KyraEngine::seq_playDrinkPotionAnim(int unk1, int unk2, int flags) { + debug(9, "seq_playDrinkPotionAnim(%d, %d, %d)", unk1, unk2, flags); + // XXX + _screen->hideMouse(); + checkAmuletAnimFlags(); + _currentCharacter->facing = 5; + animRefreshNPC(0); + assert(_drinkAnimationTable); + setupShapes123(_drinkAnimationTable, 9, flags); + setBrandonAnimSeqSize(5, 54); + + for (int i = 123; i <= 131; ++i) { + _currentCharacter->currentAnimFrame = i; + animRefreshNPC(0); + delayWithTicks(5); + } + // snd_playSoundEffect(0x34); + for (int i = 0; i < 2; ++i) { + _currentCharacter->currentAnimFrame = 130; + animRefreshNPC(0); + delayWithTicks(7); + _currentCharacter->currentAnimFrame = 131; + animRefreshNPC(0); + delayWithTicks(7); + } + + if (unk2) { + // XXX + } + + for (int i = 131; i >= 123; --i) { + _currentCharacter->currentAnimFrame = i; + animRefreshNPC(0); + delayWithTicks(5); + } + + resetBrandonAnimSeqSize(); + _currentCharacter->currentAnimFrame = 7; + animRefreshNPC(0); + freeShapes123(); + _screen->showMouse(); +} + bool KyraEngine::seq_skipSequence() const { debug(9, "KyraEngine::seq_skipSequence()"); return _quitFlag || _abortIntroFlag; diff --git a/kyra/kyra.h b/kyra/kyra.h index 878f51dd4f..57d621ab85 100644 --- a/kyra/kyra.h +++ b/kyra/kyra.h @@ -573,6 +573,8 @@ protected: void seq_makeBrandonNormal2(); void seq_makeBrandonWisp(); void seq_dispelMagicAnimation(); + void seq_fillFlaskWithWater(int item, int type); + void seq_playDrinkPotionAnim(int unk1, int unk2, int flags); void wsa_processFrame(WSAMovieV1 *wsa, int frameNum, uint8 *dst); @@ -686,6 +688,7 @@ protected: int8 _foyerItemTable[3]; int8 _cauldronState; + int8 _crystalState[2]; uint16 _brandonStatusBit; int _brandonStatusBit0x02Flag; @@ -805,6 +808,8 @@ protected: char **_fluteString; char **_wispJewelStrings; char **_magicJewelString; + char **_flaskFull; + char **_fullFlask; int _itemList_Size; int _takenList_Size; @@ -820,6 +825,8 @@ protected: int _fluteString_Size; int _wispJewelStrings_Size; int _magicJewelString_Size; + int _flaskFull_Size; + int _fullFlask_Size; char **_characterImageTable; int _characterImageTableSize; diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp index 8a28ad6837..d9906dc06b 100644 --- a/kyra/script_v1.cpp +++ b/kyra/script_v1.cpp @@ -1441,7 +1441,8 @@ int KyraEngine::cmd_setDeathHandlerFlag(ScriptState *script) { } int KyraEngine::cmd_drinkPotionAnimation(ScriptState *script) { - warning("STUB: cmd_drinkPotionAnimation"); + debug(3, "cmd_drinkPotionAnimation(0x%X) (%d, %d, %d)", script); + seq_playDrinkPotionAnim(stackPos(0), stackPos(1), stackPos(2)); return 0; } @@ -1594,7 +1595,8 @@ int KyraEngine::cmd_poisonBrandonAndRemaps(ScriptState *script) { } int KyraEngine::cmd_fillFlaskWithWater(ScriptState *script) { - warning("STUB: cmd_fillFlaskWithWater"); + debug(3, "cmd_fillFlaskWithWater(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + seq_fillFlaskWithWater(stackPos(0), stackPos(1)); return 0; } @@ -1636,8 +1638,8 @@ int KyraEngine::cmd_playWinterScrollSequence(ScriptState *script) { } int KyraEngine::cmd_getIdolGem(ScriptState *script) { - warning("STUB: cmd_getIdolGem"); - return 0; + debug(3, "cmd_getIdolGem(0x%X) (%d)", script, stackPos(0)); + return _idolGemsTable[stackPos(0)];; } int KyraEngine::cmd_setIdolGem(ScriptState *script) { @@ -1697,7 +1699,13 @@ int KyraEngine::cmd_fadeEntirePalette(ScriptState *script) { } int KyraEngine::cmd_itemOnGroundHere(ScriptState *script) { - warning("STUB: cmd_itemOnGroundHere"); + debug(3, "cmd_itemOnGroundHere(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + assert(stackPos(0) < _roomTableSize); + Room *curRoom = &_roomTable[stackPos(0)]; + for (int i = 0; i < 12; ++i) { + if (curRoom->itemsTable[i] == stackPos(1)) + return 1; + } return 0; } @@ -1713,13 +1721,23 @@ int KyraEngine::cmd_setCauldronState(ScriptState *script) { } int KyraEngine::cmd_queryCrystalState(ScriptState *script) { - warning("STUB: cmd_queryCrystalState"); - return 0; + debug(3, "cmd_queryCrystalState(0x%X) (%d)", script, stackPos(0)); + if (!stackPos(0)) { + return _crystalState[0]; + } else if (stackPos(0) == 1) { + return _crystalState[1]; + } + return -1; } int KyraEngine::cmd_setCrystalState(ScriptState *script) { - warning("STUB: cmd_setCrystalState"); - return 0; + debug(3, "cmd_setCrystalState(0x%X) (%d)", script, stackPos(0), stackPos(1)); + if (!stackPos(0)) { + _crystalState[0] = stackPos(1); + } else if (stackPos(0) == 1) { + _crystalState[1] = stackPos(1); + } + return stackPos(1); } int KyraEngine::cmd_setPaletteRange(ScriptState *script) { @@ -1738,23 +1756,29 @@ int KyraEngine::cmd_growBrandonUp(ScriptState *script) { } int KyraEngine::cmd_setBrandonScaleXAndY(ScriptState *script) { - warning("STUB: cmd_setBrandonScaleXAndY"); + debug(3, "cmd_setBrandonScaleXAndY(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + _brandonScaleX = stackPos(0); + _brandonScaleY = stackPos(1); return 0; } int KyraEngine::cmd_resetScaleMode(ScriptState *script) { - warning("STUB: cmd_resetScaleMode"); + debug(3, "cmd_setBrandonScaleXAndY(0x%X) ()", script); + _scaleMode = 0; return 0; } int KyraEngine::cmd_getScaleDepthTableValue(ScriptState *script) { - warning("STUB: cmd_getScaleDepthTableValue"); - return 0; + debug(3, "cmd_getScaleDepthTableValue(0x%X) (%d)", script, stackPos(0)); + assert(stackPos(0) < ARRAYSIZE(_scaleTable)); + return _scaleTable[stackPos(0)]; } int KyraEngine::cmd_setScaleDepthTableValue(ScriptState *script) { - warning("STUB: cmd_setScaleDepthTableValue"); - return 0; + debug(3, "cmd_setScaleDepthTableValue(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + assert(stackPos(0) < ARRAYSIZE(_scaleTable)); + _scaleTable[stackPos(0)] = stackPos(1); + return stackPos(1); } int KyraEngine::cmd_message(ScriptState *script) { @@ -1814,7 +1838,8 @@ int KyraEngine::cmd_brandonToStoneSequence(ScriptState *script) { } int KyraEngine::cmd_brandonHealingSequence(ScriptState *script) { - warning("STUB: cmd_brandonHealingSequence"); + debug(3, "cmd_brandonHealingSequence(0x%X) ()", script); + seq_brandonHealing(); return 0; } diff --git a/kyra/staticres.cpp b/kyra/staticres.cpp index 04dece3f1f..626fffc230 100644 --- a/kyra/staticres.cpp +++ b/kyra/staticres.cpp @@ -26,7 +26,7 @@ namespace Kyra { -#define RESFILE_VERSION 9 +#define RESFILE_VERSION 10 #define GAME_FLAGS (GF_FLOPPY | GF_TALKIE | GF_DEMO | GF_AUDIOCD) #define LANGUAGE_FLAGS (GF_ENGLISH | GF_FRENCH | GF_GERMAN | GF_SPANISH | GF_LNGUNK) @@ -238,6 +238,9 @@ void KyraEngine::res_loadResources(int type) { res_loadLangTable("WISPJEWEL.", &resFile, (byte***)&_wispJewelStrings, &_wispJewelStrings_Size, loadNativeLanguage); res_loadLangTable("MAGICJEWEL.", &resFile, (byte***)&_magicJewelString, &_magicJewelString_Size, loadNativeLanguage); + + res_loadLangTable("FLASKFULL.", &resFile, (byte***)&_flaskFull, &_fullFlask_Size, loadNativeLanguage); + res_loadLangTable("FULLFLASK.", &resFile, (byte***)&_fullFlask, &_fullFlask_Size, loadNativeLanguage); } #undef loadRooms @@ -344,6 +347,9 @@ void KyraEngine::res_unloadResources(int type) { delete [] _brandonStoneTable; _brandonStoneTable = 0; _brandonStoneTableSize = 0; + + res_freeLangTable(&_flaskFull, &_flaskFull_Size); + res_freeLangTable(&_fullFlask, &_fullFlask_Size); } } |