diff options
author | Florian Kagerer | 2009-03-28 12:58:34 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-03-28 12:58:34 +0000 |
commit | 7bfa1455bcc4461286ebb1395a66f6c3b713277b (patch) | |
tree | 24f7d232cc098cd81fca1184bb117ebb7712ffd3 | |
parent | 8dda5f4070609863e98a7e9294c2f3e5b906f5ed (diff) | |
download | scummvm-rg350-7bfa1455bcc4461286ebb1395a66f6c3b713277b.tar.gz scummvm-rg350-7bfa1455bcc4461286ebb1395a66f6c3b713277b.tar.bz2 scummvm-rg350-7bfa1455bcc4461286ebb1395a66f6c3b713277b.zip |
LOL: - implemented opcode required for operating the floor plates in the thugs' cave)
- fixed bug (only one of the two thugs in front of the cave was deleted when sneaking into the cave)
svn-id: r39721
-rw-r--r-- | engines/kyra/lol.h | 3 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 24 |
4 files changed, 32 insertions, 15 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a914f7fdeb..dbd4688ca7 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -617,6 +617,7 @@ private: int olol_drawExitButton(EMCState *script); int olol_loadSoundFile(EMCState *script); int olol_playMusicTrack(EMCState *script); + int olol_countBlockItems(EMCState *script); int olol_stopCharacterSpeech(EMCState *script); int olol_setPaletteBrightness(EMCState *script); int olol_printMessage(EMCState *script); @@ -1061,7 +1062,7 @@ private: // monsters void loadMonsterShapes(const char *file, int monsterIndex, int b); void releaseMonsterShapes(int monsterIndex); - int disableMonstersForBlock(int block); + int deleteMonstersForBlock(int block); void setMonsterMode(MonsterInPlay *monster, int mode); bool updateMonsterAdjustBlocks(MonsterInPlay *monster); void placeMonster(MonsterInPlay *monster, uint16 x, uint16 y); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index c95740e2c2..a764839d2f 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -84,7 +84,7 @@ void LoLEngine::loadLevel(int index) { runInfScript(filename); addLevelItems(); - disableMonstersForBlock(_currentBlock); + deleteMonstersForBlock(_currentBlock); _screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay, 32, 16, 0, 0, 128, true); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 8b7cd732f9..76f8ec7413 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -115,7 +115,7 @@ bool LoLEngine::checkSceneUpdateNeed(int func) { int LoLEngine::olol_setWallType(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setWallType(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (_wllWallFlags[stackPos(2)] & 4) - disableMonstersForBlock(stackPos(0)); + deleteMonstersForBlock(stackPos(0)); setWallType(stackPos(0), stackPos(1), stackPos(2)); return 1; } @@ -1134,6 +1134,20 @@ int LoLEngine::olol_playMusicTrack(EMCState *script) { return snd_playTrack(stackPos(0)); } +int LoLEngine::olol_countBlockItems(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_countBlockItems(%p) (%d)", (const void *)script, stackPos(0)); + uint16 o = _levelBlockProperties[stackPos(0)].assignedObjects; + int res = 0; + + while (o) { + if (!(o & 0x8000)) + res++; + o = findObject(o)->nextAssignedObject; + } + + return res; +} + int LoLEngine::olol_stopCharacterSpeech(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopCharacterSpeech(%p)", (const void *)script); snd_stopSpeech(1); @@ -1727,7 +1741,7 @@ void LoLEngine::setupOpcodeTable() { // 0x64 Opcode(olol_playMusicTrack); OpcodeUnImpl(); - OpcodeUnImpl(); + Opcode(olol_countBlockItems); OpcodeUnImpl(); // 0x68 diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index c5f269a5ee..c6a1645efd 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -135,26 +135,28 @@ void LoLEngine::releaseMonsterShapes(int monsterIndex) { } } -int LoLEngine::disableMonstersForBlock(int block) { +int LoLEngine::deleteMonstersForBlock(int block) { int i = _levelBlockProperties[block].assignedObjects; int cnt = 0; - MonsterInPlay *t = 0; + uint16 next = 0; while (i) { - t = (MonsterInPlay *)findObject(i); - i = t->nextAssignedObject; - if (!(i & 0x8000)) + next = findObject(i)->nextAssignedObject; + if (!(i & 0x8000)) { + i = next; continue; + } - i &= 0x7fff; - t = &_monsters[i]; + MonsterInPlay *m = &_monsters[i & 0x7fff]; cnt++; - setMonsterMode(t, 14); + setMonsterMode(m, 14); + + checkSceneUpdateNeed(m->blockPropertyIndex); - checkSceneUpdateNeed(t->blockPropertyIndex); + placeMonster(m, 0, 0); - placeMonster(t, 0, 0); + i = next; } return cnt; } @@ -1077,7 +1079,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) { _unkDrawLevelBool = true; monster->fightCurTick--; if ((monster->fightCurTick <= 0) || (checkDrawObjectSpace(_partyPosX, _partyPosY, monster->x, monster->y) > 256) || (monster->flags & 8)) - setMonsterMode(monster, 7); + setMonsterMode(monster, 13/*7*/); else rearrangeAttackingMonster(monster); break; |