aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audio/audiostream.cpp8
-rw-r--r--backends/events/default/default-events.cpp2
-rw-r--r--engines/agi/agi.cpp6
-rw-r--r--engines/agi/preagi_winnie.cpp1
-rw-r--r--engines/agi/sound.cpp13
-rw-r--r--engines/agi/sound.h2
-rw-r--r--engines/hugo/intro.cpp2
-rw-r--r--engines/kyra/darkmoon.cpp16
-rw-r--r--engines/kyra/debugger.cpp19
-rw-r--r--engines/kyra/debugger.h1
-rw-r--r--engines/kyra/eob.cpp8
-rw-r--r--engines/kyra/eob.h1
-rw-r--r--engines/kyra/eobcommon.h2
-rw-r--r--engines/kyra/sprites_eob.cpp9
-rw-r--r--engines/scumm/insane/insane.cpp2
-rw-r--r--engines/testbed/midi.cpp4
-rw-r--r--gui/ThemeParser.cpp3
17 files changed, 66 insertions, 33 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 2d65d4afef..8bd4b95c49 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -98,6 +98,10 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops
// TODO: Properly indicate error
_loops = _completeIterations = 1;
}
+ if (stream->endOfData()) {
+ // Apparently this is an empty stream
+ _loops = _completeIterations = 1;
+ }
}
int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
@@ -118,6 +122,10 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
_loops = _completeIterations = 1;
return samplesRead;
}
+ if (_parent->endOfData()) {
+ // Apparently this is an empty stream
+ _loops = _completeIterations = 1;
+ }
return samplesRead + readBuffer(buffer + samplesRead, remainingSamples);
}
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 99d12c73dc..38a0c8d46f 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -51,6 +51,8 @@ DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
// Reset key repeat
_currentKeyDown.keycode = 0;
+ _currentKeyDown.ascii = 0;
+ _currentKeyDown.flags = 0;
#ifdef ENABLE_VKEYBD
_vk = new Common::VirtualKeyboard();
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 98ffca22ed..f79dfa35c2 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -513,10 +513,7 @@ AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(sys
AgiBase::~AgiBase() {
delete _rnd;
- if (_sound) {
- _sound->deinitSound();
- delete _sound;
- }
+ delete _sound;
}
void AgiBase::initRenderMode() {
@@ -650,7 +647,6 @@ void AgiEngine::initialize() {
_game.sbuf = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default
_gfx->initVideo();
- _sound->initSound();
_lastSaveTime = 0;
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index 37f8661367..06a6988bc5 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -1334,7 +1334,6 @@ void WinnieEngine::init() {
}
_sound = new SoundMgr(this, _mixer);
- _sound->initSound();
setflag(fSoundOn, true); // enable sound
memset(&_gameStateWinnie, 0, sizeof(_gameStateWinnie));
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 3ae4d548dc..56c7ebcb0b 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -167,16 +167,6 @@ void SoundMgr::stopSound() {
_endflag = -1;
}
-int SoundMgr::initSound() {
- return -1;
-}
-
-void SoundMgr::deinitSound() {
- stopSound();
-
- delete _soundGen;
-}
-
void SoundMgr::soundIsFinished() {
if (_endflag != -1)
_vm->setflag(_endflag, true);
@@ -219,6 +209,9 @@ void SoundMgr::setVolume(uint8 volume) {
}
SoundMgr::~SoundMgr() {
+ stopSound();
+
+ delete _soundGen;
}
} // End of namespace Agi
diff --git a/engines/agi/sound.h b/engines/agi/sound.h
index 528becbb58..f300af83a3 100644
--- a/engines/agi/sound.h
+++ b/engines/agi/sound.h
@@ -139,8 +139,6 @@ public:
void unloadSound(int);
void playSound();
- int initSound();
- void deinitSound();
void startSound(int, int);
void stopSound();
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index f2ae06eb39..505e356049 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -41,6 +41,7 @@ namespace Hugo {
IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm), _introX(0), _introY(0) {
_introXSize = 0;
+ _introTicks = 0;
}
IntroHandler::~IntroHandler() {
@@ -76,6 +77,7 @@ void IntroHandler::freeIntroData() {
}
intro_v1d::intro_v1d(HugoEngine *vm) : IntroHandler(vm) {
+ _introState = 0;
}
intro_v1d::~intro_v1d() {
diff --git a/engines/kyra/darkmoon.cpp b/engines/kyra/darkmoon.cpp
index 130fb10df3..a694a4aba5 100644
--- a/engines/kyra/darkmoon.cpp
+++ b/engines/kyra/darkmoon.cpp
@@ -243,6 +243,17 @@ void DarkMoonEngine::replaceMonster(int unit, uint16 block, int pos, int dir, in
if (_monsters[i].flags & 0x40)
continue;
+ // WORKAROUND for bug #3611077 (Dran's dragon transformation sequence triggered prematurely):
+ // The boss level and the mindflayer level share the same monster data. If you hang around
+ // long enough in the mindflayer level all 30 monster slots will be used up. When this
+ // happens it will trigger the dragon transformation sequence when Dran is moved around by script.
+ // We avoid removing Dran here by prefering monster slots occupied by monsters from another
+ // sub level.
+ if (_monsters[i].sub != _currentSub) {
+ index = i;
+ break;
+ }
+
int dist = getBlockDistance(_monsters[i].block, _currentBlock);
if (dist > maxDist) {
@@ -261,7 +272,10 @@ void DarkMoonEngine::replaceMonster(int unit, uint16 block, int pos, int dir, in
}
bool DarkMoonEngine::killMonsterExtra(EoBMonsterInPlay *m) {
- if (_currentLevel == 16 && _currentSub == 1 && (_monsterProps[m->type].capsFlags & 4)) {
+ // WORKAROUND for bug #3611077 (see DarkMoonEngine::replaceMonster())
+ // The mindflayers have monster type 0, just like Dran. Using a monster slot occupied by a mindflayer would trigger the dragon transformation
+ // sequence when all 30 monster slots are used up. We avoid this by checking for m->sub == 1.
+ if (_currentLevel == 16 && _currentSub == 1 && m->sub == 1 && (_monsterProps[m->type].capsFlags & 4)) {
if (m->type) {
_playFinale = true;
_runFlag = false;
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 75981958d6..084c436831 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -482,8 +482,9 @@ Debugger_EoB::Debugger_EoB(EoBCoreEngine *vm) : Debugger(vm), _vm(vm) {
}
void Debugger_EoB::initialize() {
- DCmd_Register("import_savefile", WRAP_METHOD(Debugger_EoB, cmd_importSaveFile));
- DCmd_Register("save_original", WRAP_METHOD(Debugger_EoB, cmd_saveOriginal));
+ DCmd_Register("import_savefile", WRAP_METHOD(Debugger_EoB, cmd_importSaveFile));
+ DCmd_Register("save_original", WRAP_METHOD(Debugger_EoB, cmd_saveOriginal));
+ DCmd_Register("list_monsters", WRAP_METHOD(Debugger_EoB, cmd_listMonsters));
}
bool Debugger_EoB::cmd_importSaveFile(int argc, const char **argv) {
@@ -558,6 +559,20 @@ bool Debugger_EoB::cmd_saveOriginal(int argc, const char **argv) {
return true;
}
+bool Debugger_EoB::cmd_listMonsters(int, const char **) {
+ DebugPrintf("\nCurrent level: %d\n----------------------\n\n", _vm->_currentLevel);
+ DebugPrintf("Id Type Unit Block Position Direction Sub Level Mode Dst.block HP Flags\n--------------------------------------------------------------------------------------------------------------\n");
+
+ for (int i = 0; i < 30; i++) {
+ EoBMonsterInPlay *m = &_vm->_monsters[i];
+ DebugPrintf("%.02d %.02d %.02d 0x%.04x %d %d %d %.02d 0x%.04x %.03d/%.03d 0x%.02x\n", i, m->type, m->unit, m->block, m->pos, m->dir, m->sub, m->mode, m->dest, m->hitPointsCur, m->hitPointsMax, m->flags);
+ }
+
+ DebugPrintf("\n");
+
+ return true;
+}
+
#endif // ENABLE_EOB
} // End of namespace Kyra
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index e4ab39102a..d741e195a7 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -121,6 +121,7 @@ protected:
bool cmd_importSaveFile(int argc, const char **argv);
bool cmd_saveOriginal(int argc, const char **argv);
+ bool cmd_listMonsters(int argc, const char **argv);
};
#endif // ENABLE_EOB
diff --git a/engines/kyra/eob.cpp b/engines/kyra/eob.cpp
index 1fb4d0a790..05b1e03b96 100644
--- a/engines/kyra/eob.cpp
+++ b/engines/kyra/eob.cpp
@@ -338,6 +338,14 @@ void EoBEngine::replaceMonster(int unit, uint16 block, int pos, int dir, int typ
}
}
+bool EoBEngine::killMonsterExtra(EoBMonsterInPlay *m) {
+ if (m->type == 21) {
+ _playFinale = true;
+ _runFlag = false;
+ }
+ return true;
+}
+
void EoBEngine::updateScriptTimersExtra() {
int cnt = 0;
for (int i = 1; i < 30; i++) {
diff --git a/engines/kyra/eob.h b/engines/kyra/eob.h
index bf5440b942..b423b0da9d 100644
--- a/engines/kyra/eob.h
+++ b/engines/kyra/eob.h
@@ -74,6 +74,7 @@ private:
// Monsters
void replaceMonster(int unit, uint16 block, int d, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem);
+ bool killMonsterExtra(EoBMonsterInPlay *m);
void updateScriptTimersExtra();
// Level
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 1a74321364..6421159dbe 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -487,7 +487,7 @@ protected:
void placeMonster(EoBMonsterInPlay *m, uint16 block, int dir);
virtual void replaceMonster(int b, uint16 block, int pos, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem) = 0;
void killMonster(EoBMonsterInPlay *m, bool giveExperience);
- virtual bool killMonsterExtra(EoBMonsterInPlay *m);
+ virtual bool killMonsterExtra(EoBMonsterInPlay *m) = 0;
int countSpecificMonsters(int type);
void updateAttackingMonsterFlags();
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index 1d4c143185..b96f2eca08 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -213,20 +213,11 @@ void EoBCoreEngine::killMonster(EoBMonsterInPlay *m, bool giveExperience) {
if (killMonsterExtra(m)) {
placeMonster(m, 0, -1);
- if ((_flags.gameID == GI_EOB1) && (m->type == 21)) {
- _playFinale = true;
- _runFlag = false;
- }
-
if (m->mode == 8)
updateAttackingMonsterFlags();
}
}
-bool EoBCoreEngine::killMonsterExtra(EoBMonsterInPlay *) {
- return true;
-}
-
int EoBCoreEngine::countSpecificMonsters(int type) {
int res = 0;
for (int i = 0; i < 30; i++) {
diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp
index b8089ff226..d76f7b549b 100644
--- a/engines/scumm/insane/insane.cpp
+++ b/engines/scumm/insane/insane.cpp
@@ -466,7 +466,7 @@ void Insane::init_enemyStruct(int n, int32 handler, int32 initializer,
_enemy[n].isEmpty = isEmpty;
_enemy[n].weapon = weapon;
_enemy[n].sound = sound;
- strncpy(_enemy[n].filename, filename, 20);
+ Common::strlcpy(_enemy[n].filename, filename, 20);
_enemy[n].costume4 = costume4;
_enemy[n].costume6 = costume6;
_enemy[n].costume5 = costume5;
diff --git a/engines/testbed/midi.cpp b/engines/testbed/midi.cpp
index 69d361b0d6..70ede406d5 100644
--- a/engines/testbed/midi.cpp
+++ b/engines/testbed/midi.cpp
@@ -96,6 +96,10 @@ TestExitStatus MidiTests::playMidiMusic() {
Common::String errMsg = MidiDriver::getErrorName(errCode);
Testsuite::writeOnScreen(errMsg, Common::Point(0, 100));
Testsuite::logPrintf("Error! %s", errMsg.c_str());
+
+ delete smfParser;
+ delete driver;
+
return kTestFailed;
}
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 8285aff7ca..418ec2c283 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -691,7 +691,8 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) {
return false;
}
- Common::parseBool(node->values["center"], center);
+ if (!Common::parseBool(node->values["center"], center))
+ return false;
if (node->values["type"] == "vertical")
_theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutVertical, spacing, center);