aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/detection.cpp7
-rw-r--r--engines/agi/preagi_winnie.h2
-rw-r--r--engines/agi/saveload.cpp6
-rw-r--r--engines/agos/agos.cpp36
-rw-r--r--engines/agos/agos.h15
-rw-r--r--engines/agos/charset-fontdata.cpp3
-rw-r--r--engines/agos/charset.cpp4
-rw-r--r--engines/agos/contain.cpp2
-rw-r--r--engines/agos/cursor.cpp4
-rw-r--r--engines/agos/debug.cpp1
-rw-r--r--engines/agos/debug.h1
-rw-r--r--engines/agos/debugger.cpp8
-rw-r--r--engines/agos/draw.cpp3
-rw-r--r--engines/agos/event.cpp2
-rw-r--r--engines/agos/gfx.cpp3
-rw-r--r--engines/agos/icons.cpp2
-rw-r--r--engines/agos/input.cpp11
-rw-r--r--engines/agos/input_pn.cpp2
-rw-r--r--engines/agos/items.cpp2
-rw-r--r--engines/agos/menus.cpp2
-rw-r--r--engines/agos/midi.cpp4
-rw-r--r--engines/agos/oracle.cpp1
-rw-r--r--engines/agos/res_ami.cpp2
-rw-r--r--engines/agos/res_snd.cpp42
-rw-r--r--engines/agos/saveload.cpp1
-rw-r--r--engines/agos/script.cpp3
-rw-r--r--engines/agos/script_dp.cpp2
-rw-r--r--engines/agos/script_pn.cpp1
-rw-r--r--engines/agos/script_s1.cpp1
-rw-r--r--engines/agos/script_s2.cpp5
-rw-r--r--engines/agos/script_ww.cpp2
-rw-r--r--engines/agos/sound.cpp14
-rw-r--r--engines/agos/sound.h4
-rw-r--r--engines/agos/verb.cpp1
-rw-r--r--engines/agos/vga.cpp1
-rw-r--r--engines/agos/vga_e2.cpp1
-rw-r--r--engines/agos/vga_s2.cpp17
-rw-r--r--engines/agos/window.cpp1
-rw-r--r--engines/agos/zones.cpp2
-rw-r--r--engines/composer/detection.cpp28
-rw-r--r--engines/composer/graphics.cpp2
-rw-r--r--engines/composer/resource.cpp1
-rw-r--r--engines/cruise/cruise.h10
-rw-r--r--engines/cruise/cruise_main.cpp32
-rw-r--r--engines/cruise/module.mk1
-rw-r--r--engines/cruise/saveload.cpp7
-rw-r--r--engines/cruise/sound.cpp1
-rw-r--r--engines/cruise/sound.h4
-rw-r--r--engines/dialogs.cpp1
-rw-r--r--engines/draci/saveload.cpp8
-rw-r--r--engines/drascula/drascula.h5
-rw-r--r--engines/drascula/resource.cpp9
-rw-r--r--engines/dreamweb/dreamweb.cpp6
-rw-r--r--engines/dreamweb/runtime.h1
-rw-r--r--engines/dreamweb/stubs.cpp1
-rw-r--r--engines/engine.cpp12
-rw-r--r--engines/engines.mk1
-rw-r--r--engines/gob/draw_v2.cpp1
-rw-r--r--engines/groovie/groovie.cpp3
-rw-r--r--engines/groovie/music.cpp5
-rw-r--r--engines/groovie/music.h2
-rw-r--r--engines/groovie/script.cpp3
-rw-r--r--engines/hugo/detection.cpp7
-rw-r--r--engines/hugo/display.cpp1
-rw-r--r--engines/hugo/file.cpp1
-rw-r--r--engines/hugo/file_v1d.cpp1
-rw-r--r--engines/hugo/file_v1w.cpp1
-rw-r--r--engines/hugo/file_v2d.cpp1
-rw-r--r--engines/hugo/file_v2w.cpp1
-rw-r--r--engines/hugo/file_v3d.cpp1
-rw-r--r--engines/hugo/sound.cpp4
-rw-r--r--engines/kyra/animator_hof.cpp1
-rw-r--r--engines/kyra/animator_lok.cpp1
-rw-r--r--engines/kyra/animator_lok.h1
-rw-r--r--engines/kyra/animator_mr.cpp1
-rw-r--r--engines/kyra/animator_v2.cpp1
-rw-r--r--engines/kyra/debugger.cpp1
-rw-r--r--engines/kyra/debugger.h1
-rw-r--r--engines/kyra/detection.cpp1
-rw-r--r--engines/kyra/gui.cpp3
-rw-r--r--engines/kyra/gui.h1
-rw-r--r--engines/kyra/gui_hof.cpp1
-rw-r--r--engines/kyra/gui_hof.h1
-rw-r--r--engines/kyra/gui_lok.cpp1
-rw-r--r--engines/kyra/gui_lok.h1
-rw-r--r--engines/kyra/gui_lol.cpp1
-rw-r--r--engines/kyra/gui_lol.h1
-rw-r--r--engines/kyra/gui_mr.cpp1
-rw-r--r--engines/kyra/gui_mr.h1
-rw-r--r--engines/kyra/gui_v2.cpp1
-rw-r--r--engines/kyra/gui_v2.h1
-rw-r--r--engines/kyra/item.h1
-rw-r--r--engines/kyra/items_hof.cpp1
-rw-r--r--engines/kyra/items_lok.cpp1
-rw-r--r--engines/kyra/items_lol.cpp1
-rw-r--r--engines/kyra/items_mr.cpp1
-rw-r--r--engines/kyra/items_v2.cpp1
-rw-r--r--engines/kyra/kyra_hof.cpp8
-rw-r--r--engines/kyra/kyra_hof.h1
-rw-r--r--engines/kyra/kyra_lok.h1
-rw-r--r--engines/kyra/kyra_mr.cpp1
-rw-r--r--engines/kyra/kyra_mr.h1
-rw-r--r--engines/kyra/kyra_v1.cpp1
-rw-r--r--engines/kyra/kyra_v1.h1
-rw-r--r--engines/kyra/kyra_v2.cpp1
-rw-r--r--engines/kyra/kyra_v2.h1
-rw-r--r--engines/kyra/lol.cpp1
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/resource.cpp3
-rw-r--r--engines/kyra/resource.h4
-rw-r--r--engines/kyra/saveload.cpp8
-rw-r--r--engines/kyra/saveload_hof.cpp1
-rw-r--r--engines/kyra/saveload_lok.cpp1
-rw-r--r--engines/kyra/saveload_lol.cpp1
-rw-r--r--engines/kyra/saveload_mr.cpp1
-rw-r--r--engines/kyra/scene_hof.cpp3
-rw-r--r--engines/kyra/scene_lok.cpp1
-rw-r--r--engines/kyra/scene_lol.cpp1
-rw-r--r--engines/kyra/scene_mr.cpp4
-rw-r--r--engines/kyra/scene_v2.cpp1
-rw-r--r--engines/kyra/screen.cpp1
-rw-r--r--engines/kyra/screen.h1
-rw-r--r--engines/kyra/screen_hof.cpp1
-rw-r--r--engines/kyra/screen_hof.h1
-rw-r--r--engines/kyra/screen_lol.cpp1
-rw-r--r--engines/kyra/screen_lol.h1
-rw-r--r--engines/kyra/screen_v2.cpp1
-rw-r--r--engines/kyra/screen_v2.h1
-rw-r--r--engines/kyra/script.cpp1
-rw-r--r--engines/kyra/script.h1
-rw-r--r--engines/kyra/script_hof.cpp1
-rw-r--r--engines/kyra/script_lok.cpp1
-rw-r--r--engines/kyra/script_lol.cpp1
-rw-r--r--engines/kyra/script_tim.cpp1
-rw-r--r--engines/kyra/script_tim.h1
-rw-r--r--engines/kyra/script_v1.cpp1
-rw-r--r--engines/kyra/script_v2.cpp1
-rw-r--r--engines/kyra/seqplayer.cpp1
-rw-r--r--engines/kyra/seqplayer.h1
-rw-r--r--engines/kyra/sequences_hof.cpp2
-rw-r--r--engines/kyra/sequences_lok.cpp1
-rw-r--r--engines/kyra/sequences_lol.cpp1
-rw-r--r--engines/kyra/sequences_mr.cpp1
-rw-r--r--engines/kyra/sequences_v2.cpp1
-rw-r--r--engines/kyra/sound.cpp2
-rw-r--r--engines/kyra/sound_adlib.cpp1
-rw-r--r--engines/kyra/sound_adlib.h1
-rw-r--r--engines/kyra/sound_amiga.cpp1
-rw-r--r--engines/kyra/sound_digital.cpp1
-rw-r--r--engines/kyra/sound_lol.cpp1
-rw-r--r--engines/kyra/sound_midi.cpp1
-rw-r--r--engines/kyra/sound_pcspk.cpp1
-rw-r--r--engines/kyra/sound_towns.cpp1
-rw-r--r--engines/kyra/sprites.cpp1
-rw-r--r--engines/kyra/sprites.h1
-rw-r--r--engines/kyra/sprites_lol.cpp1
-rw-r--r--engines/kyra/staticres.cpp7
-rw-r--r--engines/kyra/staticres_lol.cpp1
-rw-r--r--engines/kyra/text.h1
-rw-r--r--engines/kyra/text_hof.h1
-rw-r--r--engines/kyra/text_lol.cpp1
-rw-r--r--engines/kyra/text_lol.h1
-rw-r--r--engines/kyra/text_mr.cpp1
-rw-r--r--engines/kyra/timer.h1
-rw-r--r--engines/kyra/timer_lok.cpp1
-rw-r--r--engines/kyra/timer_lol.cpp1
-rw-r--r--engines/kyra/util.cpp1
-rw-r--r--engines/kyra/util.h1
-rw-r--r--engines/kyra/wsamovie.cpp2
-rw-r--r--engines/kyra/wsamovie.h2
-rw-r--r--engines/lastexpress/lastexpress.cpp3
-rw-r--r--engines/lastexpress/lastexpress.h1
-rw-r--r--engines/lastexpress/module.mk2
-rw-r--r--engines/lure/module.mk1
-rw-r--r--engines/lure/sound.h3
-rw-r--r--engines/m4/converse.cpp6
-rw-r--r--engines/m4/m4.h1
-rw-r--r--engines/m4/midi.h1
-rw-r--r--engines/m4/saveload.cpp3
-rw-r--r--engines/m4/scripttab.h1
-rw-r--r--engines/mohawk/console.cpp2
-rw-r--r--engines/mohawk/cstime.h2
-rw-r--r--engines/mohawk/dialogs.cpp4
-rw-r--r--engines/mohawk/livingbooks.h2
-rw-r--r--engines/mohawk/mohawk.cpp2
-rw-r--r--engines/mohawk/myst.cpp8
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp2
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp17
-rw-r--r--engines/mohawk/myst_stacks/slides.h2
-rw-r--r--engines/mohawk/myst_state.cpp8
-rw-r--r--engines/mohawk/sound.cpp5
-rw-r--r--engines/mohawk/sound.h7
-rw-r--r--engines/parallaction/graphics.h9
-rw-r--r--engines/parallaction/gui_br.cpp1
-rw-r--r--engines/parallaction/sound.h3
-rw-r--r--engines/queen/command.h1
-rw-r--r--engines/queen/credits.cpp1
-rw-r--r--engines/saga/detection.cpp8
-rw-r--r--engines/saga/input.cpp1
-rw-r--r--engines/saga/interface.cpp6
-rw-r--r--engines/saga/music.cpp3
-rw-r--r--engines/saga/palanim.h1
-rw-r--r--engines/saga/puzzle.cpp18
-rw-r--r--engines/saga/render.cpp2
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/saga/saveload.cpp7
-rw-r--r--engines/saga/shorten.cpp1
-rw-r--r--engines/saga/shorten.h1
-rw-r--r--engines/saga/sthread.cpp1
-rw-r--r--engines/savestate.cpp1
-rw-r--r--engines/sci/decompressor.h1
-rw-r--r--engines/sci/detection.cpp29
-rw-r--r--engines/sci/graphics/palette.cpp2
-rw-r--r--engines/sci/graphics/screen.cpp2
-rw-r--r--engines/sci/parser/said.cpp1
-rw-r--r--engines/sci/sound/drivers/cms.cpp1
-rw-r--r--engines/scumm/detection.cpp4
-rw-r--r--engines/scumm/detection_tables.h10
-rw-r--r--engines/scumm/gfx.cpp1
-rw-r--r--engines/scumm/he/script_v72he.cpp9
-rw-r--r--engines/scumm/he/sprite_he.h1
-rw-r--r--engines/scumm/he/wiz_he.cpp2
-rw-r--r--engines/scumm/help.h1
-rw-r--r--engines/scumm/imuse/pcspk.cpp1
-rw-r--r--engines/scumm/imuse/pcspk.h1
-rw-r--r--engines/scumm/imuse/sysex.h1
-rw-r--r--engines/scumm/imuse_digi/dimuse.cpp2
-rw-r--r--engines/scumm/insane/insane_enemy.cpp1
-rw-r--r--engines/scumm/insane/insane_iact.cpp1
-rw-r--r--engines/scumm/insane/insane_scenes.cpp1
-rw-r--r--engines/scumm/player_v2.h5
-rw-r--r--engines/scumm/player_v2base.h6
-rw-r--r--engines/scumm/player_v2cms.cpp533
-rw-r--r--engines/scumm/player_v2cms.h64
-rw-r--r--engines/scumm/saveload.cpp7
-rw-r--r--engines/scumm/scumm-md5.h6
-rw-r--r--engines/scumm/scumm.cpp49
-rw-r--r--engines/scumm/scumm.h6
-rw-r--r--engines/scumm/smush/codec37.cpp1
-rw-r--r--engines/scumm/smush/smush_font.cpp1
-rw-r--r--engines/scumm/sound.cpp51
-rw-r--r--engines/scumm/sound.h3
-rw-r--r--engines/scumm/string.cpp10
-rw-r--r--engines/scumm/vars.cpp5
-rw-r--r--engines/sky/autoroute.h1
-rw-r--r--engines/sword1/control.h1
-rw-r--r--engines/sword1/debug.h1
-rw-r--r--engines/sword1/detection.cpp8
-rw-r--r--engines/sword1/object.h1
-rw-r--r--engines/sword1/screen.h3
-rw-r--r--engines/sword25/detection.cpp1
-rw-r--r--engines/sword25/sfx/soundengine.cpp2
-rw-r--r--engines/sword25/util/lua/lapi.cpp1
-rw-r--r--engines/sword25/util/lua/lauxlib.cpp1
-rw-r--r--engines/sword25/util/lua/lauxlib.h2
-rw-r--r--engines/sword25/util/lua/lbaselib.cpp1
-rw-r--r--engines/sword25/util/lua/lcode.cpp1
-rw-r--r--engines/sword25/util/lua/ldblib.cpp1
-rw-r--r--engines/sword25/util/lua/ldebug.cpp1
-rw-r--r--engines/sword25/util/lua/ldo.cpp2
-rw-r--r--engines/sword25/util/lua/ldo.h1
-rw-r--r--engines/sword25/util/lua/lfunc.cpp1
-rw-r--r--engines/sword25/util/lua/lgc.cpp1
-rw-r--r--engines/sword25/util/lua/linit.cpp1
-rw-r--r--engines/sword25/util/lua/liolib.cpp1
-rw-r--r--engines/sword25/util/lua/llex.cpp1
-rw-r--r--engines/sword25/util/lua/lmathlib.cpp1
-rw-r--r--engines/sword25/util/lua/lmem.cpp1
-rw-r--r--engines/sword25/util/lua/lmem.h1
-rw-r--r--engines/sword25/util/lua/loadlib.cpp1
-rw-r--r--engines/sword25/util/lua/lobject.h1
-rw-r--r--engines/sword25/util/lua/lopcodes.cpp1
-rw-r--r--engines/sword25/util/lua/loslib.cpp1
-rw-r--r--engines/sword25/util/lua/lstate.cpp1
-rw-r--r--engines/sword25/util/lua/lstate.h1
-rw-r--r--engines/sword25/util/lua/lstring.cpp1
-rw-r--r--engines/sword25/util/lua/lstrlib.cpp1
-rw-r--r--engines/sword25/util/lua/ltablib.cpp1
-rw-r--r--engines/sword25/util/lua/ltm.cpp1
-rw-r--r--engines/sword25/util/lua/luaconf.h1
-rw-r--r--engines/sword25/util/lua/lvm.cpp1
-rw-r--r--engines/sword25/util/lua/lzio.cpp2
-rw-r--r--engines/sword25/util/pluto/CHANGELOG1
-rw-r--r--engines/sword25/util/pluto/FILEFORMAT2
-rw-r--r--engines/sword25/util/pluto/THANKS1
-rw-r--r--engines/sword25/util/pluto/plzio.cpp2
-rw-r--r--engines/teenagent/animation.cpp28
-rw-r--r--engines/teenagent/animation.h2
-rw-r--r--engines/teenagent/detection.cpp5
-rw-r--r--engines/teenagent/font.h1
-rw-r--r--engines/teenagent/inventory.cpp6
-rw-r--r--engines/teenagent/scene.cpp14
-rw-r--r--engines/teenagent/surface.cpp14
-rw-r--r--engines/teenagent/surface.h2
-rw-r--r--engines/teenagent/surface_list.cpp14
-rw-r--r--engines/teenagent/surface_list.h3
-rw-r--r--engines/teenagent/teenagent.cpp2
-rw-r--r--engines/testbed/misc.cpp4
-rw-r--r--engines/tinsel/coroutine.cpp1
-rw-r--r--engines/tinsel/detection.cpp16
-rw-r--r--engines/tinsel/saveload.cpp9
-rw-r--r--engines/tinsel/strres.h1
-rw-r--r--engines/tinsel/tinsel.h4
-rw-r--r--engines/toon/audio.cpp1
-rw-r--r--engines/toon/character.cpp1
-rw-r--r--engines/toon/detection.cpp7
-rw-r--r--engines/toon/drew.cpp1
-rw-r--r--engines/toon/hotspot.cpp1
-rw-r--r--engines/toon/script.cpp1
-rw-r--r--engines/toon/script.h1
-rw-r--r--engines/tsage/blueforce_logic.cpp3
-rw-r--r--engines/tsage/blueforce_scenes0.cpp196
-rw-r--r--engines/tsage/blueforce_scenes0.h56
-rw-r--r--engines/tsage/detection.cpp2
-rw-r--r--engines/tsage/detection_tables.h16
-rw-r--r--engines/tsage/events.cpp10
-rw-r--r--engines/tsage/events.h1
-rw-r--r--engines/tsage/module.mk2
-rw-r--r--engines/tsage/ringworld_scenes10.cpp3
-rw-r--r--engines/tsage/ringworld_scenes3.cpp6
-rw-r--r--engines/tsage/ringworld_scenes8.cpp2
-rw-r--r--engines/tsage/saveload.cpp7
-rw-r--r--engines/tsage/scenes.cpp19
-rw-r--r--engines/tsage/scenes.h1
-rw-r--r--engines/tsage/sound.cpp58
-rw-r--r--engines/tsage/sound.h13
326 files changed, 1095 insertions, 982 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index a0736d0cc3..93fcd2d283 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -258,12 +258,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
char saveVersion = in->readByte();
if (saveVersion >= 4) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h
index 002eada65c..07a1a13e2e 100644
--- a/engines/agi/preagi_winnie.h
+++ b/engines/agi/preagi_winnie.h
@@ -355,5 +355,3 @@ private:
} // End of namespace Agi
#endif
-
-
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index dae3dd42c1..f0d976bbbb 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -290,11 +290,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) {
if (saveVersion >= 4) {
// We don't need the thumbnail here, so just read it and discard it
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- Graphics::loadThumbnail(*in, *thumbnail);
- delete thumbnail;
- thumbnail = 0;
+ Graphics::skipThumbnail(*in);
in->readUint32BE(); // save date
in->readUint16BE(); // save time
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 4d879909c4..300cd28ee4 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -24,13 +24,13 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/textconsole.h"
-#include "common/system.h"
#include "engines/util.h"
#include "agos/debugger.h"
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "backends/audiocd/audiocd.h"
@@ -541,16 +541,18 @@ Common::Error AGOSEngine::init() {
initGraphics(_screenWidth, _screenHeight, getGameType() == GType_FF || getGameType() == GType_PP);
+ _midi = new MidiPlayer();
+
if ((getGameType() == GType_SIMON2 && getPlatform() == Common::kPlatformWindows) ||
(getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
(getPlatform() == Common::kPlatformPC)) {
- int ret = _midi.open(getGameType());
+ int ret = _midi->open(getGameType());
if (ret)
warning("MIDI Player init failed: \"%s\"", MidiDriver::getErrorName(ret));
- _midi.setVolume(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
+ _midi->setVolume(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
_midiEnabled = true;
}
@@ -597,14 +599,14 @@ Common::Error AGOSEngine::init() {
if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1) {
_musicPaused = true;
if (_midiEnabled) {
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 0);
}
if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
if (getGameId() == GID_SIMON1DOS)
- _midi._enable_sfx = !_midi._enable_sfx;
+ _midi->_enable_sfx = !_midi->_enable_sfx;
else {
_effectsPaused = !_effectsPaused;
_sound->effectsPause(_effectsPaused);
@@ -640,14 +642,12 @@ Common::Error AGOSEngine::init() {
// TODO: Use special debug levels instead of the following hack.
_debugMode = (gDebugLevel >= 0);
- if (gDebugLevel == 2)
- _dumpOpcodes = true;
- if (gDebugLevel == 3)
- _dumpVgaOpcodes = true;
- if (gDebugLevel == 4)
- _dumpScripts = true;
- if (gDebugLevel == 5)
- _dumpVgaScripts = true;
+ switch (gDebugLevel) {
+ case 2: _dumpOpcodes = true; break;
+ case 3: _dumpVgaOpcodes = true; break;
+ case 4: _dumpScripts = true; break;
+ case 5: _dumpVgaScripts = true; break;
+ }
return Common::kNoError;
}
@@ -708,7 +708,7 @@ void AGOSEngine_Simon2::setupGame() {
_itemMemSize = 20000;
_tableMemSize = 100000;
// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
- if (getGameType() == GType_SIMON2 && _midi.hasNativeMT32())
+ if (getGameType() == GType_SIMON2 && _midi->hasNativeMT32())
_musicIndexBase = (1128 + 612) / 4;
else
_musicIndexBase = 1128 / 4;
@@ -911,6 +911,8 @@ AGOSEngine::~AGOSEngine() {
_window6BackScn->free();
delete _window6BackScn;
+ free(_midi);
+
free(_firstTimeStruct);
free(_pendingDeleteTimeEvent);
@@ -938,12 +940,12 @@ void AGOSEngine::pauseEngineIntern(bool pauseIt) {
_keyPressed.reset();
_pause = true;
- _midi.pause(true);
+ _midi->pause(true);
_mixer->pauseAll(true);
} else {
_pause = false;
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
_mixer->pauseAll(false);
}
}
@@ -1027,7 +1029,7 @@ void AGOSEngine::syncSoundSettings() {
int soundVolumeSFX = ConfMan.getInt("sfx_volume");
if (_midiEnabled)
- _midi.setVolume((mute ? 0 : soundVolumeMusic), (mute ? 0 : soundVolumeSFX));
+ _midi->setVolume((mute ? 0 : soundVolumeMusic), (mute ? 0 : soundVolumeSFX));
}
} // End of namespace AGOS
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index aa68a05eee..b1d2e6d735 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -33,7 +33,6 @@
#include "common/stack.h"
#include "common/util.h"
-#include "agos/midi.h"
#include "agos/sound.h"
#include "agos/vga.h"
@@ -50,6 +49,16 @@
* - Simon the Sorcerer 2
* - Simon the Sorcerer Puzzle Pack
*/
+
+namespace Common {
+class File;
+class SeekableReadStream;
+}
+
+namespace Graphics {
+class Surface;
+}
+
namespace AGOS {
uint fileReadItemID(Common::SeekableReadStream *in);
@@ -60,6 +69,8 @@ uint fileReadItemID(Common::SeekableReadStream *in);
class MoviePlayer;
#endif
+class MidiPlayer;
+
struct Child;
struct SubObject;
@@ -548,7 +559,7 @@ protected:
byte _lettersToPrintBuf[80];
- MidiPlayer _midi;
+ MidiPlayer *_midi;
bool _midiEnabled;
int _vgaTickCounter;
diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index b708b4890b..e6b81f54ee 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/system.h"
#include "common/textconsole.h"
@@ -2454,4 +2452,3 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
}
} // End of namespace AGOS
-
diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp
index 9d27afaa27..54aef99a47 100644
--- a/engines/agos/charset.cpp
+++ b/engines/agos/charset.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "agos/agos.h"
@@ -655,4 +654,3 @@ void AGOSEngine::windowScroll(WindowBlock *window) {
_videoLockOut &= ~0x8000;
}
} // End of namespace AGOS
-
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index ba60c65ff3..173194d45e 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp
index ef4a1406c9..7c64d68048 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.cpp
@@ -20,10 +20,8 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/events.h"
-#include "common/system.h"
#include "graphics/cursorman.h"
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index 9c44342975..18c4736031 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -22,7 +22,6 @@
// AGOS debug functions
-
#include "common/file.h"
#include "common/textconsole.h"
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index fd5908997f..fe14ae4860 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.h
@@ -2843,4 +2843,3 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
} // End of namespace AGOS
#endif
-
diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp
index a313dbbd1e..fc24c6d363 100644
--- a/engines/agos/debugger.cpp
+++ b/engines/agos/debugger.cpp
@@ -20,12 +20,11 @@
*
*/
-
-
#include "common/config-manager.h"
#include "agos/debugger.h"
#include "agos/agos.h"
+#include "agos/midi.h"
namespace AGOS {
@@ -58,7 +57,7 @@ bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
- if (gDebugLevel >= 0 && gDebugLevel < 10) {
+ if (0 <= gDebugLevel && gDebugLevel < 11) {
_vm->_debugMode = true;
DebugPrintf("Debug level set to level %d\n", gDebugLevel);
} else if (gDebugLevel < 0) {
@@ -79,7 +78,7 @@ bool Debugger::Cmd_PlayMusic(int argc, const char **argv) {
// TODO
} else if (_vm->getGameType() == GType_SIMON2) {
_vm->loadMusic(music);
- _vm->_midi.startTrack(0);
+ _vm->_midi->startTrack(0);
} else {
_vm->playMusic(music, 0);
}
@@ -287,4 +286,3 @@ bool Debugger::Cmd_dumpScript(int argc, const char **argv) {
}
} // End of namespace AGOS
-
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 4d66b56a96..9fc5cedbf9 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 3411e6d632..ed26b96381 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/animation.h"
#include "agos/debugger.h"
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 0b045bae01..fbf7f416ed 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index ead4e49ebb..7db2d85f21 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 2ab543a943..24e5339420 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -20,13 +20,12 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/file.h"
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "agos/vga.h"
namespace AGOS {
@@ -582,14 +581,14 @@ bool AGOSEngine::processSpecialKeys() {
break;
case '+':
if (_midiEnabled) {
- _midi.setVolume(_midi.getMusicVolume() + 16, _midi.getSFXVolume() + 16);
+ _midi->setVolume(_midi->getMusicVolume() + 16, _midi->getSFXVolume() + 16);
}
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
syncSoundSettings();
break;
case '-':
if (_midiEnabled) {
- _midi.setVolume(_midi.getMusicVolume() - 16, _midi.getSFXVolume() - 16);
+ _midi->setVolume(_midi->getMusicVolume() - 16, _midi->getSFXVolume() - 16);
}
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
syncSoundSettings();
@@ -597,13 +596,13 @@ bool AGOSEngine::processSpecialKeys() {
case 'm':
_musicPaused = !_musicPaused;
if (_midiEnabled) {
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
}
syncSoundSettings();
break;
case 's':
if (getGameId() == GID_SIMON1DOS) {
- _midi._enable_sfx = !_midi._enable_sfx;
+ _midi->_enable_sfx = !_midi->_enable_sfx;
} else {
_effectsPaused = !_effectsPaused;
_sound->effectsPause(_effectsPaused);
diff --git a/engines/agos/input_pn.cpp b/engines/agos/input_pn.cpp
index 9cc97ff10f..b3a44f2b2f 100644
--- a/engines/agos/input_pn.cpp
+++ b/engines/agos/input_pn.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 0fb873a733..3bb5a132ef 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/textconsole.h"
diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp
index 4d62e34820..a0d2bdcaa0 100644
--- a/engines/agos/menus.cpp
+++ b/engines/agos/menus.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 88f6dd80d1..9a93e0a273 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -20,14 +20,12 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/file.h"
-#include "common/system.h"
#include "common/textconsole.h"
#include "agos/agos.h"
+#include "agos/midi.h"
namespace AGOS {
diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp
index 2a3c668c08..025a833b77 100644
--- a/engines/agos/oracle.cpp
+++ b/engines/agos/oracle.cpp
@@ -25,7 +25,6 @@
#ifdef ENABLE_AGOS2
#include "common/savefile.h"
-#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index b83d10364a..32adfa29e6 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.cpp
@@ -26,6 +26,8 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "common/endian.h"
+
namespace AGOS {
enum {
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 819af4fa40..9a04ce2d26 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -27,12 +27,12 @@
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "agos/vga.h"
#include "backends/audiocd/audiocd.h"
#include "audio/audiostream.h"
-#include "audio/mididrv.h"
#include "audio/mods/protracker.h"
namespace AGOS {
@@ -125,10 +125,10 @@ void AGOSEngine::loadMusic(uint16 music) {
_gameFile->read(buf, 4);
if (!memcmp(buf, "FORM", 4)) {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
- _midi.loadXMIDI(_gameFile);
+ _midi->loadXMIDI(_gameFile);
} else {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
- _midi.loadMultipleSMF(_gameFile);
+ _midi->loadMultipleSMF(_gameFile);
}
_lastMusicPlayed = music;
@@ -242,20 +242,20 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
if (music == 35)
return;
- _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
+ _midi->setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
_gameFile->read(buf, 4);
if (!memcmp(buf, "GMF\x1", 4)) {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
- _midi.loadSMF(_gameFile, music);
+ _midi->loadSMF(_gameFile, music);
} else {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
- _midi.loadMultipleSMF(_gameFile);
+ _midi->loadMultipleSMF(_gameFile);
}
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
} else if (getPlatform() == Common::kPlatformAcorn) {
// TODO: Add support for Desktop Tracker format in Acorn disk version
} else {
@@ -266,15 +266,15 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
if (f.isOpen() == false)
error("playMusic: Can't load music from '%s'", filename);
- _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
+ _midi->setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
if (getFeatures() & GF_DEMO)
- _midi.loadS1D(&f);
+ _midi->loadS1D(&f);
else
- _midi.loadSMF(&f, music);
+ _midi->loadSMF(&f, music);
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
}
}
@@ -286,7 +286,7 @@ void AGOSEngine::playMusic(uint16 music, uint16 track) {
} else if (getPlatform() == Common::kPlatformAtariST) {
// TODO: Add support for music formats used
} else {
- _midi.setLoop(true); // Must do this BEFORE loading music.
+ _midi->setLoop(true); // Must do this BEFORE loading music.
char filename[15];
Common::File f;
@@ -295,21 +295,21 @@ void AGOSEngine::playMusic(uint16 music, uint16 track) {
if (f.isOpen() == false)
error("playMusic: Can't load music from '%s'", filename);
- _midi.loadS1D(&f);
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->loadS1D(&f);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
}
}
void AGOSEngine::stopMusic() {
if (_midiEnabled) {
- _midi.stop();
+ _midi->stop();
}
_mixer->stopHandle(_modHandle);
}
void AGOSEngine::playSting(uint16 soundId) {
- if (!_midi._enable_sfx)
+ if (!_midi->_enable_sfx)
return;
char filename[15];
@@ -328,8 +328,8 @@ void AGOSEngine::playSting(uint16 soundId) {
error("playSting: Can't read sting %d offset", soundId);
mus_file.seek(mus_offset, SEEK_SET);
- _midi.loadSMF(&mus_file, soundId, true);
- _midi.startTrack(0);
+ _midi->loadSMF(&mus_file, soundId, true);
+ _midi->startTrack(0);
}
static const byte elvira1_soundTable[100] = {
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index e6cce36b22..10830db002 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -22,7 +22,6 @@
#include "common/file.h"
#include "common/savefile.h"
-#include "common/system.h"
#include "common/textconsole.h"
#include "common/translation.h"
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 68a90e405b..1c36454278 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -22,8 +22,7 @@
// Item script opcodes for Simon1/Simon2
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/script_dp.cpp b/engines/agos/script_dp.cpp
index a4ee249f47..f51e15dc67 100644
--- a/engines/agos/script_dp.cpp
+++ b/engines/agos/script_dp.cpp
@@ -24,8 +24,6 @@
#ifdef ENABLE_AGOS2
-#include "common/system.h"
-
#include "agos/agos.h"
namespace AGOS {
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 3bd8ce19a3..196350b9bf 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -23,6 +23,7 @@
#include "agos/agos.h"
#include "agos/vga.h"
+#include "common/endian.h"
#include "common/textconsole.h"
namespace AGOS {
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 0e7e66778e..350ed31068 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -20,7 +20,6 @@
*
*/
-
#include "common/system.h"
#include "graphics/palette.h"
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index c646397ac3..c35771f8ec 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -23,6 +23,7 @@
#include "agos/agos.h"
+#include "agos/midi.h"
#include "common/textconsole.h"
@@ -342,11 +343,11 @@ void AGOSEngine_Simon2::os2_playTune() {
// effectively preloaded so there's no latency when
// starting playback).
- _midi.setLoop(loop != 0);
+ _midi->setLoop(loop != 0);
if (_lastMusicPlayed != music)
_nextMusicToPlay = music;
else
- _midi.startTrack(track);
+ _midi->startTrack(track);
}
void AGOSEngine_Simon2::os2_screenTextPObj() {
diff --git a/engines/agos/script_ww.cpp b/engines/agos/script_ww.cpp
index 29a91a15aa..873f258743 100644
--- a/engines/agos/script_ww.cpp
+++ b/engines/agos/script_ww.cpp
@@ -22,8 +22,6 @@
-#include "common/system.h"
-
#include "agos/agos.h"
namespace AGOS {
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 03932aa4de..11a1cd792e 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -22,6 +22,7 @@
#include "common/file.h"
#include "common/memstream.h"
+#include "common/ptr.h"
#include "common/textconsole.h"
#include "common/util.h"
@@ -43,11 +44,10 @@ namespace AGOS {
class BaseSound : Common::NonCopyable {
protected:
- Common::File *_file;
+ Common::DisposablePtr<Common::File> _file;
uint32 *_offsets;
Audio::Mixer *_mixer;
bool _freeOffsets;
- DisposeAfterUse::Flag _disposeFile;
public:
BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES);
@@ -62,7 +62,7 @@ public:
};
BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file), _disposeFile(disposeFileAfterUse) {
+ : _mixer(mixer), _file(file, disposeFileAfterUse) {
uint res = 0;
uint32 size;
@@ -96,7 +96,7 @@ BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool
}
BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file), _disposeFile(disposeFileAfterUse) {
+ : _mixer(mixer), _file(file, disposeFileAfterUse) {
_offsets = offsets;
_freeOffsets = false;
@@ -105,8 +105,6 @@ BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, D
BaseSound::~BaseSound() {
if (_freeOffsets)
free(_offsets);
- if (_disposeFile == DisposeAfterUse::YES)
- delete _file;
}
///////////////////////////////////////////////////////////////////////////////
@@ -234,7 +232,7 @@ Audio::AudioStream *WavSound::makeAudioStream(uint sound) {
return NULL;
_file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeWAVStream(_file, DisposeAfterUse::NO);
+ return Audio::makeWAVStream(_file.get(), DisposeAfterUse::NO);
}
void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
@@ -257,7 +255,7 @@ public:
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
assert(_offsets);
_file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeVOCStream(_file, _flags);
+ return Audio::makeVOCStream(_file.get(), _flags);
}
void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
diff --git a/engines/agos/sound.h b/engines/agos/sound.h
index a7c4cd73db..ab4a3a963d 100644
--- a/engines/agos/sound.h
+++ b/engines/agos/sound.h
@@ -28,6 +28,10 @@
#include "agos/intern.h"
#include "common/str.h"
+namespace Common {
+class File;
+}
+
namespace AGOS {
class BaseSound;
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index abc45c1ace..dec05f6703 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.cpp
@@ -22,7 +22,6 @@
// Verb and hitarea handling
-
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index de6a6976e5..8541f579d6 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -27,6 +27,7 @@
#include "agos/intern.h"
#include "agos/vga.h"
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index 1bde6945f0..d4aafd3d7b 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -26,6 +26,7 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "common/endian.h"
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/vga_s2.cpp b/engines/agos/vga_s2.cpp
index 1021ea8f94..9b9ed4e297 100644
--- a/engines/agos/vga_s2.cpp
+++ b/engines/agos/vga_s2.cpp
@@ -20,10 +20,9 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
+#include "agos/midi.h"
#include "graphics/surface.h"
@@ -146,8 +145,8 @@ void AGOSEngine::vc69_playSeq() {
// specifying a non-valid track number (999 or -1)
// as a means of stopping what music is currently
// playing.
- _midi.setLoop(loop != 0);
- _midi.startTrack(track);
+ _midi->setLoop(loop != 0);
+ _midi->startTrack(track);
}
void AGOSEngine::vc70_joinSeq() {
@@ -161,9 +160,9 @@ void AGOSEngine::vc70_joinSeq() {
// track and, if not, whether to switch to
// a different track upon completion.
if (track != 0xFFFF && track != 999)
- _midi.queueTrack(track, loop != 0);
+ _midi->queueTrack(track, loop != 0);
else
- _midi.setLoop(loop != 0);
+ _midi->setLoop(loop != 0);
}
void AGOSEngine::vc71_ifSeqWaiting() {
@@ -171,7 +170,7 @@ void AGOSEngine::vc71_ifSeqWaiting() {
// This command skips the next instruction
// unless (1) there is a track playing, AND
// (2) there is a track queued to play after it.
- if (!_midi.isPlaying(true))
+ if (!_midi->isPlaying(true))
vcSkipNextInstruction();
}
@@ -195,8 +194,8 @@ void AGOSEngine::vc72_segue() {
if (track == -1 || track == 999) {
stopMusic();
} else {
- _midi.setLoop(loop != 0);
- _midi.startTrack(track);
+ _midi->setLoop(loop != 0);
+ _midi->startTrack(track);
}
}
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index c55e3dcdda..0365c736d8 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -21,7 +21,6 @@
*/
-
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/zones.cpp b/engines/agos/zones.cpp
index 61efbcb89a..483b9949eb 100644
--- a/engines/agos/zones.cpp
+++ b/engines/agos/zones.cpp
@@ -214,5 +214,3 @@ void AGOSEngine::checkZonePtrs() {
}
} // End of namespace AGOS
-
-
diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp
index cbd4dd1ebd..c4e98fadd7 100644
--- a/engines/composer/detection.cpp
+++ b/engines/composer/detection.cpp
@@ -56,6 +56,8 @@ static const PlainGameDescriptor composerGames[] = {
{"darby", "Darby the Dragon"},
{"gregory", "Gregory and the Hot Air Balloon"},
{"liam", "Magic Tales: Liam Finds a Story"},
+ {"princess", "The Princess and the Crab"},
+ {"sleepingcub", "Sleeping Cub's Test of Courage"},
{0, 0}
};
@@ -131,6 +133,32 @@ static const ComposerGameDescription gameDescriptions[] = {
GType_ComposerV2
},
+ {
+ {
+ "princess",
+ 0,
+ AD_ENTRY1s("install.inf", "f1cf45db3c4c54a0d2d89d359af8f334", 244),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_ComposerV2
+ },
+
+ {
+ {
+ "sleepingcub",
+ 0,
+ AD_ENTRY1s("install.inf", "1092e753b8692463f41b8c0b1931398e", 251),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_ComposerV2
+ },
+
{ AD_TABLE_END_MARKER, 0 }
};
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index 3de244970e..5c9fc6e1f7 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -506,7 +506,7 @@ void ComposerEngine::loadCTBL(uint16 id, uint fadePercent) {
stream->read(buffer, numEntries * 3);
delete stream;
- for (uint i = 0; i < numEntries * 3; i++)
+ for (uint16 i = 0; i < numEntries * 3; i++)
buffer[i] = ((unsigned int)buffer[i] * fadePercent) / 100;
_system->getPaletteManager()->setPalette(buffer, 0, numEntries);
diff --git a/engines/composer/resource.cpp b/engines/composer/resource.cpp
index e0893380bf..b40bdb379b 100644
--- a/engines/composer/resource.cpp
+++ b/engines/composer/resource.cpp
@@ -251,6 +251,7 @@ bool ComposerArchive::openStream(Common::SeekableReadStream *stream) {
Pipe::Pipe(Common::SeekableReadStream *stream) {
_offset = 0;
_stream = stream;
+ _anim = NULL;
nextFrame();
}
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index 900f677975..94f8759d01 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -108,7 +108,15 @@ public:
Common::RandomSource _rnd;
- Common::List<byte *> _memList;
+ struct MemInfo {
+ int32 lineNum;
+ char fname[64];
+ uint32 magic;
+
+ static uint32 const cookie = 0x41424344;
+ };
+
+ Common::List<MemInfo*> _memList;
typedef Common::List<Common::Rect> RectList;
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 031c53b96a..ff4669607d 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -40,19 +40,21 @@ unsigned int timer = 0;
gfxEntryStruct* linkedMsgList = NULL;
+typedef CruiseEngine::MemInfo MemInfo;
+
void MemoryList() {
if (!_vm->_memList.empty()) {
debug("Current list of un-freed memory blocks:");
- Common::List<byte *>::iterator i;
+ Common::List<MemInfo*>::iterator i;
for (i = _vm->_memList.begin(); i != _vm->_memList.end(); ++i) {
- byte *v = *i;
- debug("%s - %d", (const char *)(v - 68), *((int32 *)(v - 72)));
+ MemInfo const *const v = *i;
+ debug("%s - %d", v->fname, v->lineNum);
}
}
}
void *MemoryAlloc(uint32 size, bool clearFlag, int32 lineNum, const char *fname) {
- byte *result;
+ void *result;
if (gDebugLevel > 0) {
// Find the point after the final slash
@@ -61,17 +63,17 @@ void *MemoryAlloc(uint32 size, bool clearFlag, int32 lineNum, const char *fname)
--fnameP;
// Create the new memory block and add it to the memory list
- byte *v = (byte *)malloc(size + 64 + 8);
- *((int32 *) v) = lineNum;
- strncpy((char *)v + 4, fnameP, 63);
- *((char *)v + 4 + 63) = '\0';
- *((uint32 *) (v + 68)) = 0x41424344;
+ MemInfo *const v = (MemInfo *)malloc(sizeof(MemInfo) + size);
+ v->lineNum = lineNum;
+ strncpy(v->fname, fnameP, sizeof(v->fname));
+ v->fname[ARRAYSIZE(v->fname) - 1] = '\0';
+ v->magic = MemInfo::cookie;
// Add the block to the memory list
- result = v + 64 + 8;
- _vm->_memList.push_back(result);
+ _vm->_memList.push_back(v);
+ result = v + 1;
} else
- result = (byte *)malloc(size);
+ result = malloc(size);
if (clearFlag)
memset(result, 0, size);
@@ -84,11 +86,11 @@ void MemoryFree(void *v) {
return;
if (gDebugLevel > 0) {
- byte *p = (byte *)v;
- assert(*((uint32 *) (p - 4)) == 0x41424344);
+ MemInfo *const p = (MemInfo *)v - 1;
+ assert(p->magic == MemInfo::cookie);
_vm->_memList.remove(p);
- free(p - 8 - 64);
+ free(p);
} else
free(v);
}
diff --git a/engines/cruise/module.mk b/engines/cruise/module.mk
index 5c36b2a7c1..ae07d20956 100644
--- a/engines/cruise/module.mk
+++ b/engines/cruise/module.mk
@@ -40,4 +40,3 @@ endif
# Include common rules
include $(srcdir)/rules.mk
-
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index 6392009373..c3d1ea6643 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -62,12 +62,9 @@ bool readSavegameHeader(Common::InSaveFile *in, CruiseSavegameHeader &header) {
while ((ch = (char)in->readByte()) != '\0') header.saveName += ch;
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
return true;
}
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 290cc220d4..21d9a75297 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -31,6 +31,7 @@
#include "audio/audiostream.h"
#include "audio/fmopl.h"
+#include "audio/mixer.h"
#include "audio/mods/soundfx.h"
namespace Cruise {
diff --git a/engines/cruise/sound.h b/engines/cruise/sound.h
index 11aec0b04e..c1975dc579 100644
--- a/engines/cruise/sound.h
+++ b/engines/cruise/sound.h
@@ -23,10 +23,6 @@
#ifndef CRUISE_SOUND_H
#define CRUISE_SOUND_H
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
-#include "audio/mixer.h"
-
#include "common/config-manager.h"
#include "common/serializer.h"
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 1a077e5bf7..58bf629dc4 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -338,4 +338,3 @@ void ConfigDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32
GUI::OptionsDialog::handleCommand (sender, cmd, data);
}
}
-
diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp
index 1479dd3c77..78315d1a97 100644
--- a/engines/draci/saveload.cpp
+++ b/engines/draci/saveload.cpp
@@ -58,13 +58,9 @@ bool readSavegameHeader(Common::InSaveFile *in, DraciSavegameHeader &header) {
header.playtime = in->readUint32LE();
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- header.thumbnail->free();
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
return true;
}
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 2b6aa0f291..5ec4684723 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/hash-str.h"
#include "common/keyboard.h"
+#include "common/ptr.h"
#include "common/random.h"
#include "common/savefile.h"
#include "common/system.h"
@@ -264,15 +265,13 @@ private:
};
class TextResourceParser {
- Common::SeekableReadStream *_stream;
- DisposeAfterUse::Flag _dispose;
+ Common::DisposablePtr<Common::SeekableReadStream> _stream;
int _maxLen;
void getLine(char *buf);
public:
TextResourceParser(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose);
- ~TextResourceParser();
void parseInt(int &result);
void parseString(char *result);
diff --git a/engines/drascula/resource.cpp b/engines/drascula/resource.cpp
index 6da43e7cba..95a95e3487 100644
--- a/engines/drascula/resource.cpp
+++ b/engines/drascula/resource.cpp
@@ -42,7 +42,7 @@ Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
}
TextResourceParser::TextResourceParser(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose) :
- _stream(stream), _dispose(dispose) {
+ _stream(stream, dispose) {
// NOTE: strangely enough, the code before this refactoring used the size of
// the stream as a fixed maximum length for the parser. Using an updated
@@ -50,12 +50,6 @@ TextResourceParser::TextResourceParser(Common::SeekableReadStream *stream, Dispo
_maxLen = _stream->size();
}
-TextResourceParser::~TextResourceParser() {
- if (_dispose == DisposeAfterUse::YES) {
- delete _stream;
- }
-}
-
void TextResourceParser::getLine(char *buf) {
byte c;
char *b;
@@ -101,4 +95,3 @@ void TextResourceParser::parseString(char* result) {
} // End of namespace Drascula
-
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index caf3a987c4..a2205824c1 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -224,7 +224,7 @@ Common::Error DreamWebEngine::run() {
_loadSavefile = -1;
}
- getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this);
+ getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
_context.__start();
_context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0;
@@ -237,7 +237,7 @@ void DreamWebEngine::setSpeed(uint speed) {
debug(0, "setting speed %u", speed);
_speed = speed;
getTimerManager()->removeTimerProc(vSyncInterrupt);
- getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this);
+ getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this, "dreamwebVSync");
}
void DreamWebEngine::openFile(const Common::String &name) {
@@ -644,5 +644,3 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
}
} // End of namespace DreamWeb
-
-
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h
index 714a8d5850..0c27c12e3c 100644
--- a/engines/dreamweb/runtime.h
+++ b/engines/dreamweb/runtime.h
@@ -580,4 +580,3 @@ public:
}
#endif
-
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 00d082b4d3..5ba3796e30 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1655,4 +1655,3 @@ void DreamGenContext::cancelch1() {
}
} /*namespace dreamgen */
-
diff --git a/engines/engine.cpp b/engines/engine.cpp
index b19daa2611..ee1d53fa9c 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -41,6 +41,7 @@
#include "common/list.h"
#include "common/list_intern.h"
#include "common/scummsys.h"
+#include "common/taskbar.h"
#include "common/textconsole.h"
#include "common/translation.h"
@@ -79,10 +80,21 @@ static void defaultErrorHandler(const char *msg) {
if (isSmartphone())
debugger = 0;
#endif
+
+#if defined(USE_TASKBAR)
+ g_system->getTaskbarManager()->notifyError();
+#endif
+
if (debugger && !debugger->isActive()) {
debugger->attach(msg);
debugger->onFrame();
}
+
+
+#if defined(USE_TASKBAR)
+ g_system->getTaskbarManager()->clearError();
+#endif
+
}
}
diff --git a/engines/engines.mk b/engines/engines.mk
index de11496b7b..063ed75919 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -207,4 +207,3 @@ ifdef ENABLE_TUCKER
DEFINES += -DENABLE_TUCKER=$(ENABLE_TUCKER)
MODULES += engines/tucker
endif
-
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index cc8f6b5e3c..151ed42526 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -916,4 +916,3 @@ void Draw_v2::spriteOperation(int16 operation) {
}
} // End of namespace Gob
-
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index 5f95de649a..f5f02b5cdd 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/groovie.h"
#include "groovie/cursor.h"
#include "groovie/detection.h"
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index c6e990dfcf..af929d439b 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/music.h"
#include "groovie/groovie.h"
#include "groovie/resource.h"
@@ -766,7 +769,7 @@ Common::SeekableReadStream *MusicPlayerMac::decompressMidi(Common::SeekableReadS
}
MusicPlayerIOS::MusicPlayerIOS(GroovieEngine *vm) : MusicPlayer(vm) {
- vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this);
+ vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this, "groovieMusic");
}
MusicPlayerIOS::~MusicPlayerIOS() {
diff --git a/engines/groovie/music.h b/engines/groovie/music.h
index 7af482e45d..cc852aa8dc 100644
--- a/engines/groovie/music.h
+++ b/engines/groovie/music.h
@@ -25,8 +25,6 @@
#include "common/array.h"
#include "common/mutex.h"
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
class MidiParser;
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 5a24559e8b..9003a58ab8 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/script.h"
#include "groovie/cell.h"
#include "groovie/cursor.h"
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index f70a21aa8f..5d972f5658 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -241,12 +241,7 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s
SaveStateDescriptor desc(slot, saveName);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*file, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index 2d35bb0448..fa18d6b791 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -813,4 +813,3 @@ overlayState_t Screen_v1w::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) {
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index cde6e108ea..2217cef92a 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -695,4 +695,3 @@ void FileManager::readUIFImages() {
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp
index 0795923536..c3bb0e275f 100644
--- a/engines/hugo/file_v1d.cpp
+++ b/engines/hugo/file_v1d.cpp
@@ -128,4 +128,3 @@ void FileManager_v1d::instructions() const {
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp
index 162019dd2e..8a06cef939 100644
--- a/engines/hugo/file_v1w.cpp
+++ b/engines/hugo/file_v1w.cpp
@@ -87,4 +87,3 @@ void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t ove
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp
index 7e44e756d5..520e1b77b6 100644
--- a/engines/hugo/file_v2d.cpp
+++ b/engines/hugo/file_v2d.cpp
@@ -187,4 +187,3 @@ const char *FileManager_v2d::fetchString(const int index) {
return _fetchStringBuf;
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file_v2w.cpp b/engines/hugo/file_v2w.cpp
index 1384f02df6..98a15526fa 100644
--- a/engines/hugo/file_v2w.cpp
+++ b/engines/hugo/file_v2w.cpp
@@ -49,4 +49,3 @@ void FileManager_v2w::instructions() const {
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp
index 69371bb030..d86003a040 100644
--- a/engines/hugo/file_v3d.cpp
+++ b/engines/hugo/file_v3d.cpp
@@ -205,4 +205,3 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove
}
}
} // End of namespace Hugo
-
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 1fea1f4343..fe34e6ff2d 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -270,7 +270,7 @@ void SoundHandler::pcspkr_player() {
static const uint16 pcspkrFlats[8] = {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb
_vm->getTimerManager()->removeTimerProc(&loopPlayer);
- _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this);
+ _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop");
uint16 count; // Value to set timer chip to for note
bool cmd_note;
@@ -372,7 +372,7 @@ void SoundHandler::loadIntroSong(Common::ReadStream &in) {
}
void SoundHandler::initPcspkrPlayer() {
- _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this);
+ _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop");
}
} // End of namespace Hugo
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp
index 4cdb622501..741e358143 100644
--- a/engines/kyra/animator_hof.cpp
+++ b/engines/kyra/animator_hof.cpp
@@ -314,4 +314,3 @@ void KyraEngine_HoF::resetCharacterAnimDim() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/animator_lok.cpp b/engines/kyra/animator_lok.cpp
index 3e9dd7aa66..4126681bbe 100644
--- a/engines/kyra/animator_lok.cpp
+++ b/engines/kyra/animator_lok.cpp
@@ -649,4 +649,3 @@ void Animator_LoK::setCharactersHeight() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/animator_lok.h b/engines/kyra/animator_lok.h
index 21d24866c8..74b8305468 100644
--- a/engines/kyra/animator_lok.h
+++ b/engines/kyra/animator_lok.h
@@ -125,4 +125,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index 84bda3f3fd..6414b99ffd 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -459,4 +459,3 @@ void KyraEngine_MR::showIdleAnim() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/animator_v2.cpp b/engines/kyra/animator_v2.cpp
index ad7057f11a..334356e261 100644
--- a/engines/kyra/animator_v2.cpp
+++ b/engines/kyra/animator_v2.cpp
@@ -185,4 +185,3 @@ void KyraEngine_v2::deleteItemAnimEntry(int item) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 4a48ac0674..dfc2a9f868 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -461,4 +461,3 @@ Debugger_LoL::Debugger_LoL(LoLEngine *vm) : Debugger(vm), _vm(vm) {
#endif // ENABLE_LOL
} // End of namespace Kyra
-
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 70c547381e..09ddd89a7a 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -106,4 +106,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index a6af584fb8..0a49483f12 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -221,4 +221,3 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
#else
REGISTER_PLUGIN_STATIC(KYRA, PLUGIN_TYPE_ENGINE, KyraMetaEngine);
#endif
-
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 29cbe20b23..7fd9880dce 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -415,7 +415,7 @@ void GUI::checkTextfieldInput() {
bool running = true;
int keys = 0;
- while (_vm->_eventMan->pollEvent(event) && running) {
+ while (running && _vm->_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL))
@@ -671,4 +671,3 @@ void MainMenu::printString(const char *format, int x, int y, int col1, int col2,
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index 6afdc431ed..1efbdde394 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -263,4 +263,3 @@ private:
} // end of namesapce Kyra
#endif
-
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 1666cdd0e4..a1e0ce66bf 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -1195,4 +1195,3 @@ int GUI_HoF::loadMenu(Button *caller) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/gui_hof.h b/engines/kyra/gui_hof.h
index a02d14e9f1..c228c35551 100644
--- a/engines/kyra/gui_hof.h
+++ b/engines/kyra/gui_hof.h
@@ -82,4 +82,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index eba2f8f279..4a2d51faa3 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -1137,4 +1137,3 @@ void KyraEngine_LoK::drawAmulet() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h
index 4d7bfa1ada..5a8d6ab532 100644
--- a/engines/kyra/gui_lok.h
+++ b/engines/kyra/gui_lok.h
@@ -182,4 +182,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 9b70e536b8..3ab52b9940 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -3007,4 +3007,3 @@ const char *GUI_LoL::getMenuItemLabel(const MenuItem &menuItem) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h
index bc49b21299..0686926534 100644
--- a/engines/kyra/gui_lol.h
+++ b/engines/kyra/gui_lol.h
@@ -182,4 +182,3 @@ private:
#endif
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 32eb02e06d..82082961e9 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -1607,4 +1607,3 @@ void GUI_MR::drawSliderBar(int slider, const uint8 *shape) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/gui_mr.h b/engines/kyra/gui_mr.h
index 9c8d79b321..6303dff83f 100644
--- a/engines/kyra/gui_mr.h
+++ b/engines/kyra/gui_mr.h
@@ -85,4 +85,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index dcc53b7c9e..c0477f29f1 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -887,4 +887,3 @@ int GUI_v2::choiceNo(Button *caller) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h
index 0009bf8e54..ef95c0301a 100644
--- a/engines/kyra/gui_v2.h
+++ b/engines/kyra/gui_v2.h
@@ -231,4 +231,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/item.h b/engines/kyra/item.h
index 86b6fc7d46..4b236372a2 100644
--- a/engines/kyra/item.h
+++ b/engines/kyra/item.h
@@ -39,4 +39,3 @@ enum {
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/items_hof.cpp b/engines/kyra/items_hof.cpp
index 73aed2e067..711e1b8f7c 100644
--- a/engines/kyra/items_hof.cpp
+++ b/engines/kyra/items_hof.cpp
@@ -427,4 +427,3 @@ void KyraEngine_HoF::setMouseCursor(Item item) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/items_lok.cpp b/engines/kyra/items_lok.cpp
index 105a8efa0d..d598a17cf1 100644
--- a/engines/kyra/items_lok.cpp
+++ b/engines/kyra/items_lok.cpp
@@ -976,4 +976,3 @@ int KyraEngine_LoK::getItemListIndex(Item item) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp
index 2cf2cb2c70..7e9ae439fc 100644
--- a/engines/kyra/items_lol.cpp
+++ b/engines/kyra/items_lol.cpp
@@ -551,4 +551,3 @@ int LoLEngine::checkSceneForItems(uint16 *blockDrawObjects, int color) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp
index 88c02f56c8..c731627026 100644
--- a/engines/kyra/items_mr.cpp
+++ b/engines/kyra/items_mr.cpp
@@ -544,4 +544,3 @@ int KyraEngine_MR::getItemCommandStringInv(uint16 item) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp
index 29dddc6772..c191c2e62b 100644
--- a/engines/kyra/items_v2.cpp
+++ b/engines/kyra/items_v2.cpp
@@ -105,4 +105,3 @@ void KyraEngine_v2::removeHandItem() {
}
} // end of namesapce Kyra
-
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 5c58e6e3ed..b82099f058 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -1052,8 +1052,7 @@ void KyraEngine_HoF::runStartScript(int script, int unk1) {
void KyraEngine_HoF::loadNPCScript() {
_emc->unload(&_npcScriptData);
- char filename[12];
- strcpy(filename, "_NPC.EMC");
+ char filename[] = "_NPC.EMC";
if (_flags.platform != Common::kPlatformPC || _flags.isTalkie) {
switch (_lang) {
@@ -1084,7 +1083,7 @@ void KyraEngine_HoF::loadNPCScript() {
#pragma mark -
void KyraEngine_HoF::resetScaleTable() {
- Common::set_to(_scaleTable, _scaleTable + ARRAYSIZE(_scaleTable), 0x100);
+ Common::set_to(_scaleTable, ARRAYEND(_scaleTable), 0x100);
}
void KyraEngine_HoF::setScaleTableItem(int item, int data) {
@@ -1674,7 +1673,7 @@ void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
}
void KyraEngine_HoF::clearCauldronTable() {
- Common::set_to(_cauldronTable, _cauldronTable+ARRAYSIZE(_cauldronTable), -1);
+ Common::set_to(_cauldronTable, ARRAYEND(_cauldronTable), -1);
}
void KyraEngine_HoF::addFrontCauldronTable(int item) {
@@ -1998,4 +1997,3 @@ void KyraEngine_HoF::readSettings() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index da7486bc29..2561171598 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -925,4 +925,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index 066c27c69a..57e6bd39ab 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -826,4 +826,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index f5bcd04ea0..5798e99a1f 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -1426,4 +1426,3 @@ void KyraEngine_MR::readSettings() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index b762648d29..ec76340638 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -668,4 +668,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 3b2c9b67eb..c950612a42 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -650,4 +650,3 @@ void KyraEngine_v1::syncSoundSettings() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 43a709456d..584176e08c 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -423,4 +423,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index d0f8d78bd1..e8cb9b4370 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -243,4 +243,3 @@ int KyraEngine_v2::updateCharPos(int *table, int force) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index f21458ab5d..56391d151a 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -398,4 +398,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 7d7bb0ed4a..5aba264ceb 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -4598,4 +4598,3 @@ void LoLEngine::generateTempData() {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 3b887c2a86..164f030a1d 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -1527,4 +1527,3 @@ private:
#endif
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index bc9c93f8ca..a35ec3d81b 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -366,6 +366,3 @@ void Resource::initializeLoaders() {
}
} // End of namespace Kyra
-
-
-
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 3f64442858..c2a697f18d 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -480,7 +480,3 @@ private:
} // End of namespace Kyra
#endif
-
-
-
-
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index 80182d949b..42c5d3e8a8 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -113,12 +113,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
if (header.version >= 14) {
if (loadThumbnail) {
- header.thumbnail = new Graphics::Surface();
- assert(header.thumbnail);
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = 0;
- }
+ header.thumbnail = Graphics::loadThumbnail(*in);
} else {
Graphics::skipThumbnail(*in);
}
@@ -268,4 +263,3 @@ void KyraEngine_v1::loadGameStateCheck(int slot) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp
index 645bd2903f..1d28b6bc13 100644
--- a/engines/kyra/saveload_hof.cpp
+++ b/engines/kyra/saveload_hof.cpp
@@ -329,4 +329,3 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp
index 34762d4c92..22d412e7f6 100644
--- a/engines/kyra/saveload_lok.cpp
+++ b/engines/kyra/saveload_lok.cpp
@@ -317,4 +317,3 @@ Common::Error KyraEngine_LoK::saveGameStateIntern(int slot, const char *saveName
return Common::kNoError;
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 07842ea358..1bf26477e6 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -472,4 +472,3 @@ Graphics::Surface *LoLEngine::generateSaveThumbnail() const {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp
index 139375264f..c49a528d02 100644
--- a/engines/kyra/saveload_mr.cpp
+++ b/engines/kyra/saveload_mr.cpp
@@ -327,4 +327,3 @@ Common::Error KyraEngine_MR::loadGameState(int slot) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 197ef38bf1..f6cd77ca89 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -95,7 +95,7 @@ void KyraEngine_HoF::enterNewScene(uint16 newScene, int facing, int unk1, int un
_emc->run(&_sceneScriptState);
}
- Common::for_each(_wsaSlots, _wsaSlots+ARRAYSIZE(_wsaSlots), Common::mem_fun(&WSAMovie_v2::close));
+ Common::for_each(_wsaSlots, ARRAYEND(_wsaSlots), Common::mem_fun(&WSAMovie_v2::close));
_specialExitCount = 0;
memset(_specialExitTable, -1, sizeof(_specialExitTable));
@@ -735,4 +735,3 @@ bool KyraEngine_HoF::lineIsPassable(int x, int y) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index 6cb3e2a98a..a926f8493f 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -1299,4 +1299,3 @@ void KyraEngine_LoK::setupSceneResource(int sceneId) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 165919dff2..a5a2562448 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -2192,4 +2192,3 @@ void LoLEngine::drawSpecialGuiShape(int pageNum) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 6b234d9a73..74d2e89e6e 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -83,7 +83,7 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2
}
_specialExitCount = 0;
- Common::set_to(_specialExitTable, _specialExitTable+ARRAYSIZE(_specialExitTable), 0xFFFF);
+ Common::set_to(_specialExitTable, ARRAYEND(_specialExitTable), 0xFFFF);
_mainCharacter.sceneId = sceneId;
_sceneList[sceneId].flags &= ~1;
@@ -388,7 +388,7 @@ void KyraEngine_MR::initSceneScript(int unk1) {
strcat(filename, ".CPS");
_screen->loadBitmap(filename, 3, 3, 0);
- Common::set_to(_specialSceneScriptState, _specialSceneScriptState+ARRAYSIZE(_specialSceneScriptState), false);
+ Common::set_to(_specialSceneScriptState, ARRAYEND(_specialSceneScriptState), false);
_sceneEnterX1 = 160;
_sceneEnterY1 = 0;
_sceneEnterX2 = 296;
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index fbddb6604e..061ce4c21a 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -225,4 +225,3 @@ void KyraEngine_v2::pathfinderFinializePath(int *moveTable, int tableLen, int x,
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 8f008a58b6..4eae89e0d4 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -3459,4 +3459,3 @@ uint8 *Palette::fetchRealPalette() const {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index e23f104760..51a9a7f744 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -616,4 +616,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/screen_hof.cpp b/engines/kyra/screen_hof.cpp
index 1282447411..24e0751c0e 100644
--- a/engines/kyra/screen_hof.cpp
+++ b/engines/kyra/screen_hof.cpp
@@ -146,4 +146,3 @@ void Screen_HoF::copyRegionEx(int srcPage, int srcW, int srcH, int dstPage, int
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/screen_hof.h b/engines/kyra/screen_hof.h
index 08a9133809..edcb339da9 100644
--- a/engines/kyra/screen_hof.h
+++ b/engines/kyra/screen_hof.h
@@ -53,4 +53,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index c6874ca0ed..6d0460e0a1 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -959,4 +959,3 @@ void Screen_LoL::postProcessCursor(uint8 *data, int w, int h, int pitch) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index 926183225f..02b78606b9 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -119,4 +119,3 @@ private:
#endif
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index 64fbe2b834..57581fa750 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -388,4 +388,3 @@ void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index eb8415be78..d85c762038 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -73,4 +73,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index b185b8ed6f..303cbb45aa 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -443,4 +443,3 @@ void EMCInterpreter::op_setRetAndJmp(EMCState *script) {
}
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/script.h b/engines/kyra/script.h
index 4250732c7c..5bd75f7b80 100644
--- a/engines/kyra/script.h
+++ b/engines/kyra/script.h
@@ -140,4 +140,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index 27cfc808cc..296cd4002b 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -1730,4 +1730,3 @@ void KyraEngine_HoF::setupOpcodeTable() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index ea46958b50..4d40971124 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -1959,4 +1959,3 @@ void KyraEngine_LoK::setupOpcodeTable() {
#undef Opcode
} // End of namespace Kyra
-
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 1afefcffa4..b4b8f00022 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -3071,4 +3071,3 @@ void LoLEngine::setupOpcodeTable() {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 6f0f0ab083..83d03d1f63 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -1246,4 +1246,3 @@ int TIMInterpreter_LoL::cmd_dialogueBox(const uint16 *param) {
#endif // ENABLE_LOL
} // End of namespace Kyra
-
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index 89040720c2..11b716c3a9 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -317,4 +317,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index b12a08a417..4cfbdf8ab8 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -123,4 +123,3 @@ int KyraEngine_v1::o1_playSoundEffect(EMCState *script) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 2e3a3d2bc4..e42cdf9ff4 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -340,4 +340,3 @@ int KyraEngine_v2::o2a_setResetFrame(EMCState *script) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index ce2eafcea5..531d864293 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -657,4 +657,3 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
} // End of namespace Kyra
-
diff --git a/engines/kyra/seqplayer.h b/engines/kyra/seqplayer.h
index 1f030cde19..12d94e3f6d 100644
--- a/engines/kyra/seqplayer.h
+++ b/engines/kyra/seqplayer.h
@@ -122,4 +122,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index e504278047..50b5db78fc 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -2920,5 +2920,3 @@ void KyraEngine_HoF::seq_makeBookAppear() {
}
} // End of namespace Kyra
-
-
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index c26d2e352b..2de0565a74 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -2112,4 +2112,3 @@ void KyraEngine_LoK::drawJewelsFadeOutEnd(int jewel) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index d887133b70..83d525d400 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -1519,4 +1519,3 @@ void LoLEngine::loadOutroShapes(int file, uint8 **storage) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/sequences_mr.cpp b/engines/kyra/sequences_mr.cpp
index b3adc687c2..d546d9c25b 100644
--- a/engines/kyra/sequences_mr.cpp
+++ b/engines/kyra/sequences_mr.cpp
@@ -235,4 +235,3 @@ void KyraEngine_MR::uninitAnimationShapes(int count, uint8 *filedata) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp
index fb61d7cddf..e431e45f10 100644
--- a/engines/kyra/sequences_v2.cpp
+++ b/engines/kyra/sequences_v2.cpp
@@ -128,4 +128,3 @@ void KyraEngine_v2::processAnimationScript(int allowSkip, int resetChar) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 4da35cc28b..b4fcea784e 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -276,5 +276,3 @@ const Sound::SpeechCodecs Sound::_supportedCodecs[] = {
};
} // End of namespace Kyra
-
-
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 75041b8161..12c980486c 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -2445,4 +2445,3 @@ void SoundAdLibPC::unk2() {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h
index 58b97e3474..962df40de8 100644
--- a/engines/kyra/sound_adlib.h
+++ b/engines/kyra/sound_adlib.h
@@ -108,4 +108,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp
index dc09670408..dfb0aa8bf3 100644
--- a/engines/kyra/sound_amiga.cpp
+++ b/engines/kyra/sound_amiga.cpp
@@ -214,4 +214,3 @@ void SoundAmiga::playSoundEffect(uint8 track) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp
index 3f8eddbb0d..fe0f1fb9bc 100644
--- a/engines/kyra/sound_digital.cpp
+++ b/engines/kyra/sound_digital.cpp
@@ -544,4 +544,3 @@ const SoundDigital::AudioCodecs SoundDigital::_supportedCodecs[] = {
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 7262635728..efa844968d 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -312,4 +312,3 @@ int LoLEngine::convertVolumeFromMixer(int value) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 26b6b31d0a..1a5c2f94ac 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -787,4 +787,3 @@ Common::String SoundMidiPC::getFileName(const Common::String &str) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound_pcspk.cpp b/engines/kyra/sound_pcspk.cpp
index 051f36dd1b..8664e2a22e 100644
--- a/engines/kyra/sound_pcspk.cpp
+++ b/engines/kyra/sound_pcspk.cpp
@@ -364,4 +364,3 @@ const uint8 MidiDriver_PCSpeaker::_noteTable2[] = {
};
} // End of namespace Kyra
-
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index 012f1f5d7d..c851842f22 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -673,4 +673,3 @@ void SoundTownsPC98_v2::updateVolumeSettings() {
} // End of namespace Kyra
#undef EUPHONY_FADEOUT_TICKS
-
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index e0d1142905..f4cebf6470 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -573,4 +573,3 @@ int Sprites::getDrawLayer(int y) {
return returnValue;
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/sprites.h b/engines/kyra/sprites.h
index 6a4241f13e..93cdcdbbcb 100644
--- a/engines/kyra/sprites.h
+++ b/engines/kyra/sprites.h
@@ -97,4 +97,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index a77fda043c..fbf4c7c5c2 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -1632,4 +1632,3 @@ void LoLEngine::killMonster(MonsterInPlay *monster) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index ecb32e68d9..f6d59922b1 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -80,7 +80,7 @@ const IndexTable iGameTable[] = {
};
byte getGameID(const GameFlags &flags) {
- return Common::find(iGameTable, iGameTable + ARRAYSIZE(iGameTable) - 1, flags.gameID)->value;
+ return Common::find(iGameTable, ARRAYEND(iGameTable) - 1, flags.gameID)->value;
}
const IndexTable iLanguageTable[] = {
@@ -95,7 +95,7 @@ const IndexTable iLanguageTable[] = {
};
byte getLanguageID(const GameFlags &flags) {
- return Common::find(iLanguageTable, iLanguageTable + ARRAYSIZE(iLanguageTable) - 1, flags.lang)->value;
+ return Common::find(iLanguageTable, ARRAYEND(iLanguageTable) - 1, flags.lang)->value;
}
const IndexTable iPlatformTable[] = {
@@ -108,7 +108,7 @@ const IndexTable iPlatformTable[] = {
};
byte getPlatformID(const GameFlags &flags) {
- return Common::find(iPlatformTable, iPlatformTable + ARRAYSIZE(iPlatformTable) - 1, flags.platform)->value;
+ return Common::find(iPlatformTable, ARRAYEND(iPlatformTable) - 1, flags.platform)->value;
}
byte getSpecialID(const GameFlags &flags) {
@@ -2142,4 +2142,3 @@ const int8 KyraEngine_MR::_albumWSAY[] = {
};
} // End of namespace Kyra
-
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index e4029505bf..ca35569afa 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -891,4 +891,3 @@ const int LoLEngine::_outroMonsterScaleTableY[] = {
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/text.h b/engines/kyra/text.h
index a95c2c4abc..199029469e 100644
--- a/engines/kyra/text.h
+++ b/engines/kyra/text.h
@@ -79,4 +79,3 @@ protected:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/text_hof.h b/engines/kyra/text_hof.h
index f371fb1898..414d02fe4b 100644
--- a/engines/kyra/text_hof.h
+++ b/engines/kyra/text_hof.h
@@ -50,4 +50,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 346d5100b8..1c2167b892 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -830,4 +830,3 @@ void TextDisplayer_LoL::clearCurDim() {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 020d4b5e89..3e59bc90fe 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -97,4 +97,3 @@ private:
#endif
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp
index d690b70266..fd4a00b73c 100644
--- a/engines/kyra/text_mr.cpp
+++ b/engines/kyra/text_mr.cpp
@@ -898,4 +898,3 @@ void KyraEngine_MR::doDialog(int dlgIndex, int funcNum) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h
index e9cb8b2b0c..205be5957d 100644
--- a/engines/kyra/timer.h
+++ b/engines/kyra/timer.h
@@ -104,4 +104,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/timer_lok.cpp b/engines/kyra/timer_lok.cpp
index e1825d027d..555b3680e2 100644
--- a/engines/kyra/timer_lok.cpp
+++ b/engines/kyra/timer_lok.cpp
@@ -190,4 +190,3 @@ void KyraEngine_LoK::setWalkspeed(uint8 newSpeed) {
}
} // End of namespace Kyra
-
diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp
index 4f450f570f..3221556e6d 100644
--- a/engines/kyra/timer_lol.cpp
+++ b/engines/kyra/timer_lol.cpp
@@ -255,4 +255,3 @@ void LoLEngine::timerFadeMessageText(int timerNum) {
} // End of namespace Kyra
#endif // ENABLE_LOL
-
diff --git a/engines/kyra/util.cpp b/engines/kyra/util.cpp
index 3776bdc705..f71978d03e 100644
--- a/engines/kyra/util.cpp
+++ b/engines/kyra/util.cpp
@@ -146,4 +146,3 @@ const uint8 Util::_charMapISOToDOS[128] = {
};
} // End of namespace Kyra
-
diff --git a/engines/kyra/util.h b/engines/kyra/util.h
index 042da74cd9..b91f84ad36 100644
--- a/engines/kyra/util.h
+++ b/engines/kyra/util.h
@@ -46,4 +46,3 @@ private:
} // End of namespace Kyra
#endif
-
diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp
index 37102744a8..21ff80f033 100644
--- a/engines/kyra/wsamovie.cpp
+++ b/engines/kyra/wsamovie.cpp
@@ -459,5 +459,3 @@ int WSAMovie_v2::open(const char *filename, int unk1, Palette *palBuf) {
}
} // End of namespace Kyra
-
-
diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h
index 0d8bfdc869..7dadc9319b 100644
--- a/engines/kyra/wsamovie.h
+++ b/engines/kyra/wsamovie.h
@@ -132,5 +132,3 @@ protected:
} // End of namespace Kyra
#endif
-
-
diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp
index 885ca8b212..250fa0f2d0 100644
--- a/engines/lastexpress/lastexpress.cpp
+++ b/engines/lastexpress/lastexpress.cpp
@@ -42,6 +42,7 @@
#include "common/debug-channels.h"
#include "common/error.h"
#include "common/fs.h"
+#include "common/timer.h"
#include "engines/util.h"
@@ -146,7 +147,7 @@ Common::Error LastExpressEngine::run() {
// Start sound manager and setup timer
_soundMan = new SoundManager(this);
- _timer->installTimerProc(&soundTimer, 17000, this);
+ _timer->installTimerProc(&soundTimer, 17000, this, "lastexpressSound");
// Menu
_menu = new Menu(this);
diff --git a/engines/lastexpress/lastexpress.h b/engines/lastexpress/lastexpress.h
index f8f38788a0..1431b79b9f 100644
--- a/engines/lastexpress/lastexpress.h
+++ b/engines/lastexpress/lastexpress.h
@@ -27,7 +27,6 @@
#include "lastexpress/eventhandler.h"
#include "common/random.h"
-#include "common/timer.h"
#include "engines/engine.h"
diff --git a/engines/lastexpress/module.mk b/engines/lastexpress/module.mk
index a11a7c4b67..8b3287d5d7 100644
--- a/engines/lastexpress/module.mk
+++ b/engines/lastexpress/module.mk
@@ -80,4 +80,4 @@ PLUGIN := 1
endif
# Include common rules
-include $(srcdir)/rules.mk \ No newline at end of file
+include $(srcdir)/rules.mk
diff --git a/engines/lure/module.mk b/engines/lure/module.mk
index ba158756b4..57126a6491 100644
--- a/engines/lure/module.mk
+++ b/engines/lure/module.mk
@@ -31,4 +31,3 @@ endif
# Include common rules
include $(srcdir)/rules.mk
-
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index 9fa9a91260..365a7ccdb6 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -30,10 +30,11 @@
#include "common/mutex.h"
#include "common/singleton.h"
#include "common/ptr.h"
+
#include "audio/mididrv.h"
-#include "audio/mixer.h"
class MidiParser;
+class MidiChannel;
namespace Lure {
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 4630d2e2d6..bdce7928ac 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -609,7 +609,7 @@ void Converse::loadConversation(const char *convName) {
// ----------------------------------------------------------------------------
// Entry action chunks
case CHUNK_CASN: // Conditional assign
- case CHUNK_ASGN: // Assign
+ case CHUNK_ASGN: { // Assign
curAction = new EntryAction();
if (debugFlag) debugCN(kDebugConversations, "ASGN chunk\n");
curAction->actionType = kAssignValue;
@@ -625,9 +625,11 @@ void Converse::loadConversation(const char *convName) {
}
curAction->targetOffset = convS->readUint32LE();
- assert(convS->readUint32LE() == kOpAssign);
+ int op = convS->readUint32LE();
+ assert(op == kOpAssign);
curAction->value = convS->readUint32LE();
break;
+ }
case CHUNK_CCGO: // Conditional go to entry
case CHUNK_CHDE: // Conditional hide entry
case CHUNK_CUHD: // Conditional unhide entry
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 46107cb20a..b40ba0e878 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -26,7 +26,6 @@
#include "common/scummsys.h"
#include "common/util.h"
#include "common/random.h"
-#include "audio/mididrv.h"
#include "engines/engine.h"
diff --git a/engines/m4/midi.h b/engines/m4/midi.h
index 6eef907ce3..817150fd81 100644
--- a/engines/m4/midi.h
+++ b/engines/m4/midi.h
@@ -57,4 +57,3 @@ protected:
} // End of namespace M4
#endif
-
diff --git a/engines/m4/saveload.cpp b/engines/m4/saveload.cpp
index aa35385bfe..a7615fa4b6 100644
--- a/engines/m4/saveload.cpp
+++ b/engines/m4/saveload.cpp
@@ -96,7 +96,8 @@ SaveGameList *SaveLoad::getSaves() {
result->push_back(Common::String());
} else {
// Skip over byte offset
- assert(saveFile->readUint32LE() < 0x100);
+ uint32 offset = saveFile->readUint32LE();
+ assert(offset < 0x100);
// Read in savegame name
saveFile->read(&saveName[0], MAX_SAVEGAME_NAME);
diff --git a/engines/m4/scripttab.h b/engines/m4/scripttab.h
index b6156f0b82..3264ae743c 100644
--- a/engines/m4/scripttab.h
+++ b/engines/m4/scripttab.h
@@ -133,4 +133,3 @@
VARIABLE(kInterfaceVisible)
};
#undef VARIABLE
-
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index e7dc84606c..0234c86c7e 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -117,7 +117,7 @@ static const char *mystStackNames[12] = {
static const uint16 default_start_card[12] = {
3137,
10000,
- 2001, // TODO: Should be 2000?
+ 2000,
5038,
2, // TODO: Should be 1?
1,
diff --git a/engines/mohawk/cstime.h b/engines/mohawk/cstime.h
index 3a1de6a137..0bc236f930 100644
--- a/engines/mohawk/cstime.h
+++ b/engines/mohawk/cstime.h
@@ -30,8 +30,6 @@
#include "common/random.h"
#include "common/list.h"
-#include "audio/mixer.h"
-
namespace Mohawk {
class CSTimeCase;
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index 6cb455917e..11e050aa72 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -113,6 +113,10 @@ void MystOptionsDialog::open() {
_showMapButton->setEnabled(_vm->_scriptParser &&
_vm->_scriptParser->getMap());
+ // Zip mode is disabled in the demo
+ if (_vm->getFeatures() & GF_DEMO)
+ _zipModeCheckbox->setEnabled(false);
+
_zipModeCheckbox->setState(_vm->_gameState->_globals.zipMode);
_transitionsCheckbox->setState(_vm->_gameState->_globals.transitions);
}
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 27e703a578..008a7dbf23 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -33,8 +33,6 @@
#include "common/queue.h"
#include "common/random.h"
-#include "audio/mixer.h"
-
#include "livingbooks_code.h"
namespace Common {
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index faf52595b7..cb419064c0 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -31,8 +31,6 @@
#include "mohawk/sound.h"
#include "mohawk/video.h"
-#include "audio/mixer.h"
-
namespace Mohawk {
MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc) {
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 6bdf163a91..342fa4e78c 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -441,6 +441,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
_scriptParser = new MystStacks::Credits(this);
break;
case kDemoStack:
+ _gameState->_globals.currentAge = 0;
_scriptParser = new MystStacks::Demo(this);
break;
case kDniStack:
@@ -469,6 +470,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
_scriptParser = new MystStacks::Selenitic(this);
break;
case kDemoSlidesStack:
+ _gameState->_globals.currentAge = 1;
_scriptParser = new MystStacks::Slides(this);
break;
case kStoneshipStack:
@@ -645,7 +647,11 @@ void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) {
for (uint16 i = 0; i < _resources.size(); i++)
_resources[i]->handleCardChange();
- // TODO: Handle Script Resources
+ // The demo resets the cursor at each card change except when in the library
+ if (getFeatures() & GF_DEMO
+ && _gameState->_globals.currentAge != 2) {
+ _cursor->setDefaultCursor();
+ }
// Make sure the screen is updated
if (updateScreen) {
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index 37b749f100..07e4fa6e57 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "mohawk/cursors.h"
#include "mohawk/myst.h"
#include "mohawk/graphics.h"
#include "mohawk/myst_areas.h"
@@ -35,6 +36,7 @@ namespace MystStacks {
Preview::Preview(MohawkEngine_Myst *vm) : Myst(vm) {
setupOpcodes();
+ _vm->_cursor->hideCursor();
}
Preview::~Preview() {
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index 72b299ee6d..e9bb91c84d 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "mohawk/cursors.h"
#include "mohawk/myst.h"
#include "mohawk/graphics.h"
#include "mohawk/myst_areas.h"
@@ -35,6 +36,7 @@ namespace MystStacks {
Slides::Slides(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
setupOpcodes();
+ _vm->_cursor->hideCursor();
}
Slides::~Slides() {
@@ -59,23 +61,20 @@ void Slides::disablePersistentScripts() {
void Slides::runPersistentScripts() {
if (_cardSwapEnabled) {
// Used on Cards...
- if (_vm->_system->getMillis() - _lastCardTime >= 2 * 1000)
+ if (_vm->_system->getMillis() > _nextCardTime)
_vm->changeToCard(_nextCardID, true);
}
}
void Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- _vm->changeToStack(kDemoStack, 2001, 0, 0);
+ // Go to the information screens of the menu
+ _vm->changeToStack(kDemoStack, 2002, 0, 0);
}
void Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Cards...
- if (argc == 1) {
- _nextCardID = argv[0];
- _lastCardTime = _vm->_system->getMillis();
- _cardSwapEnabled = true;
- } else
- unknown(op, var, argc, argv);
+ _nextCardID = argv[0];
+ _nextCardTime = _vm->_system->getMillis() + 5000;
+ _cardSwapEnabled = true;
}
} // End of namespace MystStacks
diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h
index 8bc61d0e24..9fb76728b6 100644
--- a/engines/mohawk/myst_stacks/slides.h
+++ b/engines/mohawk/myst_stacks/slides.h
@@ -52,7 +52,7 @@ private:
bool _cardSwapEnabled;
uint16 _nextCardID;
- uint32 _lastCardTime;
+ uint32 _nextCardTime;
};
} // End of namespace MystStacks
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index bab4b8dd51..3a8d233a26 100644
--- a/engines/mohawk/myst_state.cpp
+++ b/engines/mohawk/myst_state.cpp
@@ -320,6 +320,10 @@ void MystGameState::deleteSave(const Common::String &saveName) {
void MystGameState::addZipDest(uint16 stack, uint16 view) {
ZipDests *zipDests = 0;
+ // The demo has no zip dest storage
+ if (_vm->getFeatures() & GF_DEMO)
+ return;
+
// Select stack
switch (stack) {
case kChannelwoodStack:
@@ -362,6 +366,10 @@ bool MystGameState::isReachableZipDest(uint16 stack, uint16 view) {
if (!_globals.zipMode)
return false;
+ // The demo has no zip dest storage
+ if (_vm->getFeatures() & GF_DEMO)
+ return false;
+
// Select stack
ZipDests *zipDests;
switch (stack) {
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 791b18db49..68b60515be 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -20,19 +20,20 @@
*
*/
-#include "mohawk/sound.h"
-
#include "common/debug.h"
#include "common/system.h"
#include "common/util.h"
#include "common/textconsole.h"
+#include "audio/midiparser.h"
#include "audio/musicplugin.h"
#include "audio/audiostream.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
+#include "mohawk/sound.h"
+
namespace Mohawk {
Sound::Sound(MohawkEngine* vm) : _vm(vm) {
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 593f2fcd0b..12a59cdedf 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -27,14 +27,15 @@
#include "common/str.h"
#include "audio/audiostream.h"
-#include "audio/decoders/adpcm.h"
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
#include "audio/mixer.h"
+#include "audio/decoders/adpcm.h"
#include "mohawk/mohawk.h"
#include "mohawk/resource.h"
+class MidiDriver;
+class MidiParser;
+
namespace Mohawk {
#define MAX_CHANNELS 2 // Can there be more than 2?
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 3eea1e871a..dacf7715ae 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -560,12 +560,3 @@ protected:
#endif
-
-
-
-
-
-
-
-
-
diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index d1361a6e8c..56148d78d8 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -548,4 +548,3 @@ void Parallaction_br::startIngameMenu() {
} // namespace Parallaction
-
diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h
index d0b5e5c175..e875e69334 100644
--- a/engines/parallaction/sound.h
+++ b/engines/parallaction/sound.h
@@ -26,10 +26,9 @@
#include "common/util.h"
#include "common/mutex.h"
+#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "audio/decoders/iff_sound.h"
-#include "audio/mixer.h"
-#include "audio/mididrv.h"
#define PATH_LEN 200
diff --git a/engines/queen/command.h b/engines/queen/command.h
index aa72537a9f..6865aa80a2 100644
--- a/engines/queen/command.h
+++ b/engines/queen/command.h
@@ -234,4 +234,3 @@ private:
} // End of namespace Queen
#endif
-
diff --git a/engines/queen/credits.cpp b/engines/queen/credits.cpp
index d503562601..43e3bc7c6a 100644
--- a/engines/queen/credits.cpp
+++ b/engines/queen/credits.cpp
@@ -141,4 +141,3 @@ void Credits::update() {
} // End of namespace Queen
-
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 2f1b61eed8..091ec8d427 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -256,13 +256,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s
desc.setWriteProtectedFlag(false);
if (version >= 6) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
uint32 saveDate = in->readUint32BE();
diff --git a/engines/saga/input.cpp b/engines/saga/input.cpp
index 69a353da9f..8576a3e536 100644
--- a/engines/saga/input.cpp
+++ b/engines/saga/input.cpp
@@ -158,4 +158,3 @@ Point SagaEngine::mousePos() const {
}
} // End of namespace Saga
-
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 08c5ddc6f9..fe37ed8995 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -320,7 +320,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
_disableAbortSpeeches = false;
// set save game reminder alarm
- _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
+ _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this, "sagaSaveReminder");
}
Interface::~Interface() {
@@ -335,7 +335,7 @@ void Interface::updateSaveReminder() {
_saveReminderState = _saveReminderState % _vm->getDisplayInfo().saveReminderNumSprites + 1;
drawStatusBar();
_vm->getTimerManager()->removeTimerProc(&saveReminderCallback);
- _vm->getTimerManager()->installTimerProc(&saveReminderCallback, ((_vm->getGameId() == GID_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this);
+ _vm->getTimerManager()->installTimerProc(&saveReminderCallback, ((_vm->getGameId() == GID_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this, "sagaSaveReminder");
}
}
@@ -1390,7 +1390,7 @@ void Interface::setSave(PanelButton *panelButton) {
void Interface::resetSaveReminder() {
_vm->getTimerManager()->removeTimerProc(&saveReminderCallback);
- _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
+ _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this, "sagaSaveReminder");
setSaveReminderState(1);
}
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index 49d3f91d77..13850a0b6d 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -213,7 +213,7 @@ void Music::setVolume(int volume, int time) {
return;
}
- _vm->getTimerManager()->installTimerProc(&musicVolumeGaugeCallback, time * 3000L, this);
+ _vm->getTimerManager()->installTimerProc(&musicVolumeGaugeCallback, time * 3000L, this, "sagaMusicVolume");
}
bool Music::isPlaying() {
@@ -386,4 +386,3 @@ void Music::stop() {
}
} // End of namespace Saga
-
diff --git a/engines/saga/palanim.h b/engines/saga/palanim.h
index 9959d08e2f..920cbec65a 100644
--- a/engines/saga/palanim.h
+++ b/engines/saga/palanim.h
@@ -53,4 +53,3 @@ class PalAnim {
} // End of namespace Saga
#endif
-
diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp
index d5d83c706f..63d9a88fee 100644
--- a/engines/saga/puzzle.cpp
+++ b/engines/saga/puzzle.cpp
@@ -140,7 +140,7 @@ void Puzzle::initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY,
void Puzzle::execute() {
_active = true;
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint");
initPieces();
@@ -408,12 +408,12 @@ void Puzzle::solicitHint() {
switch (_hintRqState) {
case kRQSpeaking:
if (_vm->_actor->isSpeaking()) {
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50 * 1000000, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50 * 1000000, this, "sagaPuzzleHint");
break;
}
_hintRqState = _hintNextRqState;
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 100*1000000/3, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 100*1000000/3, this, "sagaPuzzleHint");
break;
case kRQNoHint:
@@ -436,11 +436,11 @@ void Puzzle::solicitHint() {
// Roll to see if Sakka scolds
if (_vm->_rnd.getRandomNumber(1)) {
_hintRqState = kRQSakkaDenies;
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 200*1000000, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 200*1000000, this, "sagaPuzzleHint");
} else {
_hintRqState = kRQSpeaking;
_hintNextRqState = kRQHintRequested;
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this, "sagaPuzzleHint");
}
break;
@@ -453,7 +453,7 @@ void Puzzle::solicitHint() {
_hintRqState = kRQSpeaking;
_hintNextRqState = kRQHintRequestedStage2;
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this, "sagaPuzzleHint");
_vm->_interface->converseClear();
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0);
@@ -480,7 +480,7 @@ void Puzzle::solicitHint() {
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
_vm->_interface->converseDisplayText();
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint");
_hintRqState = kRQSkipEverything;
break;
@@ -504,7 +504,7 @@ void Puzzle::handleReply(int reply) {
_vm->_actor->abortSpeech();
_hintRqState = kRQNoHint;
_vm->getTimerManager()->removeTimerProc(&hintTimerCallback);
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this, "sagaPuzzleHint");
clearHint();
break;
}
@@ -566,7 +566,7 @@ void Puzzle::giveHint() {
_vm->_interface->converseDisplayText();
_vm->getTimerManager()->removeTimerProc(&hintTimerCallback);
- _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint");
}
void Puzzle::clearHint() {
diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp
index 757374a3a3..a9ef23381e 100644
--- a/engines/saga/render.cpp
+++ b/engines/saga/render.cpp
@@ -50,7 +50,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
#ifdef SAGA_DEBUG
// Initialize FPS timer callback
- _vm->getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this);
+ _vm->getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this, "sagaFPS");
#endif
_backGroundSurface.create(_vm->getDisplayInfo().width, _vm->getDisplayInfo().height, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 336883680a..fb01b1ac5d 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -29,7 +29,6 @@
#include "common/random.h"
#include "common/memstream.h"
#include "common/textconsole.h"
-#include "audio/mididrv.h"
#include "saga/gfx.h"
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 8d7b718c09..9e0789fdaf 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -295,12 +295,7 @@ void SagaEngine::load(const char *fileName) {
if (_saveHeader.version >= 6) {
// We don't need the thumbnail here, so just read it and discard it
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- Graphics::loadThumbnail(*in, *thumbnail);
- thumbnail->free();
- delete thumbnail;
- thumbnail = 0;
+ Graphics::skipThumbnail(*in);
in->readUint32BE(); // save date
in->readUint16BE(); // save time
diff --git a/engines/saga/shorten.cpp b/engines/saga/shorten.cpp
index 39af7aa3db..5efc8d1f67 100644
--- a/engines/saga/shorten.cpp
+++ b/engines/saga/shorten.cpp
@@ -541,4 +541,3 @@ Audio::AudioStream *makeShortenStream(Common::SeekableReadStream &stream) {
} // End of namespace Audio
#endif // defined(SOUND_SHORTEN_H)
-
diff --git a/engines/saga/shorten.h b/engines/saga/shorten.h
index f2114bedeb..77feafa54d 100644
--- a/engines/saga/shorten.h
+++ b/engines/saga/shorten.h
@@ -57,4 +57,3 @@ Audio::AudioStream *makeShortenStream(Common::ReadStream &stream);
#endif
#endif // engine and dynamic plugins guard
-
diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp
index ec81d8d733..afd528f4b5 100644
--- a/engines/saga/sthread.cpp
+++ b/engines/saga/sthread.cpp
@@ -236,4 +236,3 @@ bool Script::runThread(ScriptThread &thread) {
}
} // End of namespace Saga
-
diff --git a/engines/savestate.cpp b/engines/savestate.cpp
index 0b187ce630..260c7cd3ff 100644
--- a/engines/savestate.cpp
+++ b/engines/savestate.cpp
@@ -58,4 +58,3 @@ void SaveStateDescriptor::setPlayTime(uint32 msecs) {
uint minutes = msecs / 60000;
setPlayTime(minutes / 60, minutes % 60);
}
-
diff --git a/engines/sci/decompressor.h b/engines/sci/decompressor.h
index 37a5b5d7cb..5753026709 100644
--- a/engines/sci/decompressor.h
+++ b/engines/sci/decompressor.h
@@ -197,4 +197,3 @@ protected:
} // End of namespace Sci
#endif // SCI_SCICORE_DECOMPRESSOR_H
-
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 2285e512bd..33ca3a6c9c 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -285,7 +285,7 @@ static const OldNewIdTableEntry s_oldNewTable[] = {
* @param[in] gameFlags The game's flags, which are adjusted accordingly for demos
* @return The equivalent ScummVM game id
*/
-Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, ResourceManager *resMan) {
+Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, ResourceManager &resMan) {
// Convert the id to lower case, so that we match all upper/lower case variants.
sierraId.toLowercase();
@@ -301,7 +301,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
if (sierraId == "fp" || sierraId == "gk" || sierraId == "pq4")
demoThreshold = 150;
- Common::ScopedPtr<Common::List<ResourceId> > resources(resMan->listResources(kResourceTypeScript, -1));
+ Common::ScopedPtr<Common::List<ResourceId> > resources(resMan.listResources(kResourceTypeScript, -1));
if (resources->size() < demoThreshold) {
*gameFlags |= ADGF_DEMO;
@@ -337,7 +337,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
// This could either be qfg1 VGA, qfg3 or qfg4 demo (all SCI1.1),
// or qfg4 full (SCI2)
// qfg1 VGA doesn't have view 1
- if (!resMan->testResource(ResourceId(kResourceTypeView, 1)))
+ if (!resMan.testResource(ResourceId(kResourceTypeView, 1)))
return "qfg1vga";
// qfg4 full is SCI2
@@ -480,10 +480,9 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
return 0;
}
- Common::ScopedPtr<ResourceManager> resMan(new ResourceManager());
- assert(resMan);
- resMan->addAppropriateSources(fslist);
- resMan->init(true);
+ ResourceManager resMan;
+ resMan.addAppropriateSources(fslist);
+ resMan.init(true);
// TODO: Add error handling.
#ifndef ENABLE_SCI32
@@ -494,7 +493,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
}
#endif
- ViewType gameViews = resMan->getViewType();
+ ViewType gameViews = resMan.getViewType();
// Have we identified the game views? If not, stop here
// Can't be SCI (or unsupported SCI views). Pinball Creep by sierra also uses resource.map/resource.000 files
@@ -508,7 +507,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
s_fallbackDesc.platform = Common::kPlatformAmiga;
// Determine the game id
- Common::String sierraGameId = resMan->findSierraGameId();
+ Common::String sierraGameId = resMan.findSierraGameId();
// If we don't have a game id, the game is not SCI
if (sierraGameId.empty()) {
@@ -530,7 +529,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
// As far as we know, these games store the messages of each language in separate
// resources, and it's not possible to detect that easily
// Also look for "%J" which is used in japanese games
- Resource *text = resMan->findResource(ResourceId(kResourceTypeText, 0), 0);
+ Resource *text = resMan.findResource(ResourceId(kResourceTypeText, 0), 0);
uint seeker = 0;
if (text) {
while (seeker < text->size) {
@@ -588,7 +587,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
s_fallbackDesc.extra = "CD";
}
- return (const ADGameDescription *)&s_fallbackDesc;
+ return &s_fallbackDesc;
}
bool SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@@ -677,13 +676,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
SaveStateDescriptor desc(slot, meta.name);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index c5a3545701..38919593b4 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -683,7 +683,7 @@ bool GfxPalette::palVaryLoadTargetPalette(GuiResourceId resourceId) {
void GfxPalette::palVaryInstallTimer() {
int16 ticks = _palVaryTicks > 0 ? _palVaryTicks : 1;
// Call signal increase every [ticks]
- g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this);
+ g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this, "sciPalette");
}
void GfxPalette::palVaryRemoveTimer() {
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index dbe2135143..6469bc0cb3 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "common/timer.h"
#include "common/util.h"
#include "common/system.h"
+#include "common/timer.h"
#include "graphics/surface.h"
#include "engines/util.h"
diff --git a/engines/sci/parser/said.cpp b/engines/sci/parser/said.cpp
index 01c25ef401..d44109faec 100644
--- a/engines/sci/parser/said.cpp
+++ b/engines/sci/parser/said.cpp
@@ -1147,4 +1147,3 @@ True
} // End of namespace Sci
-
diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index ace96ba499..dbcbf3d431 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -813,4 +813,3 @@ MidiPlayer *MidiPlayer_CMS_create(SciVersion version) {
}
} // End of namespace SCI
-
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index d3514645d3..037c12bdbf 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -33,6 +33,8 @@
#include "common/savefile.h"
#include "common/system.h"
+#include "audio/mididrv.h"
+
#include "scumm/detection.h"
#include "scumm/detection_tables.h"
#include "scumm/he/intern_he.h"
@@ -145,7 +147,7 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
Common::String bPattern = _filenamePattern.pattern;
// Special cases for Blue's games, which share common (b) files
- if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO))
+ if (_game.id == GID_BIRTHDAYYELLOW || _game.id == GID_BIRTHDAYRED)
bPattern = "Blue'sBirthday";
else if (_game.id == GID_TREASUREHUNT)
bPattern = "Blue'sTreasureHunt";
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 11901f7565..78645ea8d5 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -222,7 +222,7 @@ static const GameSettings gameVariantsTable[] = {
{"indy3", "EGA", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
{"indy3", "No AdLib", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"indy3", "VGA", "vga", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"indy3", "VGA", "vga", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
{"indy3", "FM-TOWNS", 0, GID_INDY3, 3, 0, MDT_TOWNS, GF_OLD256 | GF_FEW_LOCALS | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
{"loom", "EGA", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
@@ -233,9 +233,9 @@ static const GameSettings gameVariantsTable[] = {
{"loom", "FM-TOWNS", 0, GID_LOOM, 3, 0, MDT_TOWNS, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
{"loom", "VGA", "vga", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"monkey", "VGA", "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
+ {"monkey", "VGA", "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
{"monkey", "EGA", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH},
{"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR, GF_16COLOR, Common::kPlatformAtariST, GUIO_NOSPEECH | GUIO_NOMIDI},
{"monkey", "Demo", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
@@ -343,7 +343,9 @@ static const GameSettings gameVariantsTable[] = {
{"puttrace", "HE 99", 0, GID_PUTTRACE, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
{"bluesabctime", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"BluesBirthday", 0, 0, GID_BIRTHDAY, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"BluesBirthday", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"BluesBirthday", "Red", 0, GID_BIRTHDAYRED, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"BluesBirthday", "Yellow", 0, GID_BIRTHDAYYELLOW, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
{"soccer", "", 0, GID_SOCCER, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
// Global scripts increased to 2048
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index f22547f193..8a32b963cd 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -4111,4 +4111,3 @@ void ScummEngine::unkScreenEffect6() {
}
} // End of namespace Scumm
-
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index 5af4035930..0510f77740 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -1831,6 +1831,15 @@ void ScummEngine_v72he::o72_readINI() {
push(1);
} else if (!strcmp((char *)option, "TextOn")) {
push(ConfMan.getBool("subtitles"));
+ } else if (!strcmp((char *)option, "Disk") && (_game.id == GID_BIRTHDAYRED || _game.id == GID_BIRTHDAYYELLOW)) {
+ // WORKAROUND: Override the disk detection
+ // This removes the reliance on having the binary file around (which is
+ // very bad for the Mac version) just for the scripts to figure out if
+ // we're running Yellow or Red
+ if (_game.id == GID_BIRTHDAYRED)
+ push(4);
+ else
+ push(2);
} else {
push(ConfMan.getInt((char *)option));
}
diff --git a/engines/scumm/he/sprite_he.h b/engines/scumm/he/sprite_he.h
index d28c9f1944..be6717faa5 100644
--- a/engines/scumm/he/sprite_he.h
+++ b/engines/scumm/he/sprite_he.h
@@ -218,4 +218,3 @@ private:
} // End of namespace Scumm
#endif
-
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 4107034fe6..f67922c81c 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1755,7 +1755,7 @@ void Wiz::captureWizPolygon(int resNum, int maskNum, int maskState, int id1, int
uint8 *tmpPtr = imageBuffer;
for (i = 0; i < dsth; i++) {
for (j = 0; j < dstw; j++)
- WRITE_UINT16(tmpPtr + j * 2, transColor);
+ WRITE_LE_UINT16(tmpPtr + j * 2, transColor);
tmpPtr += dstpitch;
}
} else {
diff --git a/engines/scumm/help.h b/engines/scumm/help.h
index 9763da8c00..5ba6bdc65c 100644
--- a/engines/scumm/help.h
+++ b/engines/scumm/help.h
@@ -42,4 +42,3 @@ public:
} // End of namespace Scumm
#endif
-
diff --git a/engines/scumm/imuse/pcspk.cpp b/engines/scumm/imuse/pcspk.cpp
index 01e2ab3b7d..668defefba 100644
--- a/engines/scumm/imuse/pcspk.cpp
+++ b/engines/scumm/imuse/pcspk.cpp
@@ -832,4 +832,3 @@ const uint16 PcSpkDriver::_frequencyTable[] = {
};
} // End of namespace Scumm
-
diff --git a/engines/scumm/imuse/pcspk.h b/engines/scumm/imuse/pcspk.h
index e77ac8c1bf..b87110c412 100644
--- a/engines/scumm/imuse/pcspk.h
+++ b/engines/scumm/imuse/pcspk.h
@@ -158,4 +158,3 @@ private:
} // End of namespace Scumm
#endif
-
diff --git a/engines/scumm/imuse/sysex.h b/engines/scumm/imuse/sysex.h
index 7dd38e785e..06ac483afd 100644
--- a/engines/scumm/imuse/sysex.h
+++ b/engines/scumm/imuse/sysex.h
@@ -35,4 +35,3 @@ extern void sysexHandler_SamNMax(Player *, const byte *, uint16);
} // End of namespace Scumm
#endif
-
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp
index 23f57a01b9..eb3717494f 100644
--- a/engines/scumm/imuse_digi/dimuse.cpp
+++ b/engines/scumm/imuse_digi/dimuse.cpp
@@ -58,7 +58,7 @@ IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, int fps)
memset(_track[l], 0, sizeof(Track));
_track[l]->trackId = l;
}
- _vm->getTimerManager()->installTimerProc(timer_handler, 1000000 / _callbackFps, this);
+ _vm->getTimerManager()->installTimerProc(timer_handler, 1000000 / _callbackFps, this, "IMuseDigital");
_audioNames = NULL;
_numAudioNames = 0;
diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp
index 68766ab72c..913f761f31 100644
--- a/engines/scumm/insane/insane_enemy.cpp
+++ b/engines/scumm/insane/insane_enemy.cpp
@@ -2779,4 +2779,3 @@ int32 Insane::actionEnemy() {
}
}
-
diff --git a/engines/scumm/insane/insane_iact.cpp b/engines/scumm/insane/insane_iact.cpp
index 3592d67c18..48c96b537c 100644
--- a/engines/scumm/insane/insane_iact.cpp
+++ b/engines/scumm/insane/insane_iact.cpp
@@ -520,4 +520,3 @@ void Insane::iactScene21(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
}
-
diff --git a/engines/scumm/insane/insane_scenes.cpp b/engines/scumm/insane/insane_scenes.cpp
index 841fedafe2..6db1cb5059 100644
--- a/engines/scumm/insane/insane_scenes.cpp
+++ b/engines/scumm/insane/insane_scenes.cpp
@@ -1506,4 +1506,3 @@ void Insane::postCaseMore(byte *renderBitmap, int32 codecparam, int32 setupsan12
}
}
-
diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h
index 14a0b9c1e0..d932585b8e 100644
--- a/engines/scumm/player_v2.h
+++ b/engines/scumm/player_v2.h
@@ -46,10 +46,7 @@ public:
virtual int getSoundStatus(int sound) const;
// AudioStream API
- int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
+ virtual int readBuffer(int16 *buffer, const int numSamples);
protected:
unsigned int _update_step;
diff --git a/engines/scumm/player_v2base.h b/engines/scumm/player_v2base.h
index 2f048070ad..eb9ed941ca 100644
--- a/engines/scumm/player_v2base.h
+++ b/engines/scumm/player_v2base.h
@@ -86,9 +86,9 @@ public:
return numSamples;
}
*/
- bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
+ virtual bool isStereo() const { return true; }
+ virtual bool endOfData() const { return false; }
+ virtual int getRate() const { return _sampleRate; }
protected:
enum {
diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp
index 21e7f193b5..d16f9d2be7 100644
--- a/engines/scumm/player_v2cms.cpp
+++ b/engines/scumm/player_v2cms.cpp
@@ -28,162 +28,45 @@
namespace Scumm {
-#define PROCESS_ATTACK 1
-#define PROCESS_RELEASE 2
-#define PROCESS_SUSTAIN 3
-#define PROCESS_DECAY 4
-#define PROCESS_VIBRATO 5
-
-#define CMS_RATE 22050
-
-static const byte freqTable[] = {
- 3, 10, 17, 24, 31, 38, 45, 51,
- 58, 65, 71, 77, 83, 90, 96, 102,
- 107, 113, 119, 125, 130, 136, 141, 146,
- 151, 157, 162, 167, 172, 177, 181, 186,
- 191, 195, 200, 204, 209, 213, 217, 221,
- 226, 230, 234, 238, 242, 246, 249, 253
-};
-
-/*static const byte amplTable[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 %
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 %
- 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, // 20 %
- 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x20, // 30%
- 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0x40, 0x40,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x20, 0x20, // 40 %
- 0x30, 0x30, 0x40, 0x40, 0x40, 0x50, 0x50, 0x60,
- 0x00, 0x00, 0x10, 0x10, 0x20, 0x20, 0x30, 0x30, // 50%
- 0x40, 0x40, 0x50, 0x50, 0x60, 0x60, 0x70, 0x70,
- 0x00, 0x00, 0x10, 0x10, 0x20, 0x30, 0x30, 0x40, // 60 %
- 0x40, 0x50, 0x60, 0x60, 0x70, 0x70, 0x80, 0x90,
- 0x00, 0x00, 0x10, 0x20, 0x20, 0x30, 0x40, 0x40, // 70 %
- 0x50, 0x60, 0x70, 0x70, 0x80, 0x90, 0x90, 0xA0,
- 0x00, 0x00, 0x10, 0x20, 0x30, 0x40, 0x40, 0x50, // 80 %
- 0x60, 0x70, 0x80, 0x80, 0x90, 0xA0, 0xB0, 0xC0,
- 0x00, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, // 90 %
- 0x70, 0x80, 0x90, 0x90, 0xA0, 0xB0, 0xC0, 0xD0,
- 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, // 100 %
- 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0
-};*/
-
-static const byte octaveTable[] = {
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03,
- 0x00, 0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07,
- 0x00, 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B,
- 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03,
- 0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07,
- 0x01, 0x08, 0x01, 0x09, 0x01, 0x0A, 0x01, 0x0B,
- 0x02, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x03,
- 0x02, 0x04, 0x02, 0x05, 0x02, 0x06, 0x02, 0x07,
- 0x02, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x0B,
- 0x03, 0x00, 0x03, 0x01, 0x03, 0x02, 0x03, 0x03,
- 0x03, 0x04, 0x03, 0x05, 0x03, 0x06, 0x03, 0x07,
- 0x03, 0x08, 0x03, 0x09, 0x03, 0x0A, 0x03, 0x0B,
- 0x04, 0x00, 0x04, 0x01, 0x04, 0x02, 0x04, 0x03,
- 0x04, 0x04, 0x04, 0x05, 0x04, 0x06, 0x04, 0x07,
- 0x04, 0x08, 0x04, 0x09, 0x04, 0x0A, 0x04, 0x0B,
- 0x05, 0x00, 0x05, 0x01, 0x05, 0x02, 0x05, 0x03,
- 0x05, 0x04, 0x05, 0x05, 0x05, 0x06, 0x05, 0x07,
- 0x05, 0x08, 0x05, 0x09, 0x05, 0x0A, 0x05, 0x0B,
- 0x06, 0x00, 0x06, 0x01, 0x06, 0x02, 0x06, 0x03,
- 0x06, 0x04, 0x06, 0x05, 0x06, 0x06, 0x06, 0x07,
- 0x06, 0x08, 0x06, 0x09, 0x06, 0x0A, 0x06, 0x0B,
- 0x07, 0x00, 0x07, 0x01, 0x07, 0x02, 0x07, 0x03,
- 0x07, 0x04, 0x07, 0x05, 0x07, 0x06, 0x07, 0x07,
- 0x07, 0x08, 0x07, 0x09, 0x07, 0x0A, 0x07, 0x0B,
- 0x08, 0x00, 0x08, 0x01, 0x08, 0x02, 0x08, 0x03,
- 0x08, 0x04, 0x08, 0x05, 0x08, 0x06, 0x08, 0x07,
- 0x08, 0x08, 0x08, 0x09, 0x08, 0x0A, 0x08, 0x0B,
- 0x09, 0x00, 0x09, 0x01, 0x09, 0x02, 0x09, 0x03,
- 0x09, 0x04, 0x09, 0x05, 0x09, 0x06, 0x09, 0x07,
- 0x09, 0x08, 0x09, 0x09, 0x09, 0x0A, 0x09, 0x0B,
- 0x0A, 0x00, 0x0A, 0x01, 0x0A, 0x02, 0x0A, 0x03,
- 0x0A, 0x04, 0x0A, 0x05, 0x0A, 0x06, 0x0A, 0x07,
- 0x0A, 0x08, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, 0x0B
-};
-
-static const byte attackRate[] = {
- 0, 2, 4, 7, 14, 26, 48, 82,
- 128, 144, 160, 176, 192, 208, 224, 255
-};
-
-static const byte decayRate[] = {
- 0, 1, 2, 3, 4, 6, 12, 24,
- 48, 96, 192, 215, 255, 255, 255, 255
-};
-
-static const byte sustainRate[] = {
- 255, 180, 128, 96, 80, 64, 56, 48,
- 42, 36, 32, 28, 24, 20, 16, 0
-};
-
-static const byte releaseRate[] = {
- 0, 1, 2, 4, 6, 9, 14, 22,
- 36, 56, 80, 100, 120, 140, 160, 255
-};
-
-static const byte volumeTable[] = {
- 0x00, 0x10, 0x10, 0x11, 0x11, 0x21, 0x22, 0x22,
- 0x33, 0x44, 0x55, 0x66, 0x88, 0xAA, 0xCC, 0xFF
-};
-
Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer)
- : Player_V2Base(scumm, mixer, true) {
- int i;
-
+ : Player_V2Base(scumm, mixer, true), _cmsVoicesBase(), _cmsVoices(),
+ _cmsChips(), _midiDelay(0), _octaveMask(0), _looping(0), _tempo(0),
+ _tempoSum(0), _midiData(0), _midiSongBegin(0), _musicTimer(0),
+ _musicTimerTicks(0), _voiceTimer(0), _loadedMidiSong(0),
+ _outputTableReady(0), _midiChannel(), _midiChannelUse() {
setMusicVolume(255);
- memset(_cmsVoicesBase, 0, sizeof(Voice)*16);
- memset(_cmsVoices, 0, sizeof(Voice2)*8);
- memset(_cmsChips, 0, sizeof(MusicChip)*2);
- _midiDelay = _octaveMask = _looping = _tempo = 0;
- _midiData = _midiSongBegin = 0;
- _loadedMidiSong = 0;
- memset(_midiChannel, 0, sizeof(Voice2*)*16);
- memset(_midiChannelUse, 0, sizeof(byte)*16);
-
- _cmsVoices[0].amplitudeOutput = &(_cmsChips[0].ampl[0]);
- _cmsVoices[0].freqOutput = &(_cmsChips[0].freq[0]);
- _cmsVoices[0].octaveOutput = &(_cmsChips[0].octave[0]);
- _cmsVoices[1].amplitudeOutput = &(_cmsChips[0].ampl[1]);
- _cmsVoices[1].freqOutput = &(_cmsChips[0].freq[1]);
- _cmsVoices[1].octaveOutput = &(_cmsChips[0].octave[0]);
- _cmsVoices[2].amplitudeOutput = &(_cmsChips[0].ampl[2]);
- _cmsVoices[2].freqOutput = &(_cmsChips[0].freq[2]);
- _cmsVoices[2].octaveOutput = &(_cmsChips[0].octave[1]);
- _cmsVoices[3].amplitudeOutput = &(_cmsChips[0].ampl[3]);
- _cmsVoices[3].freqOutput = &(_cmsChips[0].freq[3]);
- _cmsVoices[3].octaveOutput = &(_cmsChips[0].octave[1]);
- _cmsVoices[4].amplitudeOutput = &(_cmsChips[1].ampl[0]);
- _cmsVoices[4].freqOutput = &(_cmsChips[1].freq[0]);
- _cmsVoices[4].octaveOutput = &(_cmsChips[1].octave[0]);
- _cmsVoices[5].amplitudeOutput = &(_cmsChips[1].ampl[1]);
- _cmsVoices[5].freqOutput = &(_cmsChips[1].freq[1]);
- _cmsVoices[5].octaveOutput = &(_cmsChips[1].octave[0]);
- _cmsVoices[6].amplitudeOutput = &(_cmsChips[1].ampl[2]);
- _cmsVoices[6].freqOutput = &(_cmsChips[1].freq[2]);
- _cmsVoices[6].octaveOutput = &(_cmsChips[1].octave[1]);
- _cmsVoices[7].amplitudeOutput = &(_cmsChips[1].ampl[3]);
- _cmsVoices[7].freqOutput = &(_cmsChips[1].freq[3]);
- _cmsVoices[7].octaveOutput = &(_cmsChips[1].octave[1]);
+ _cmsVoices[0].amplitudeOutput = &_cmsChips[0].ampl[0];
+ _cmsVoices[0].freqOutput = &_cmsChips[0].freq[0];
+ _cmsVoices[0].octaveOutput = &_cmsChips[0].octave[0];
+ _cmsVoices[1].amplitudeOutput = &_cmsChips[0].ampl[1];
+ _cmsVoices[1].freqOutput = &_cmsChips[0].freq[1];
+ _cmsVoices[1].octaveOutput = &_cmsChips[0].octave[0];
+ _cmsVoices[2].amplitudeOutput = &_cmsChips[0].ampl[2];
+ _cmsVoices[2].freqOutput = &_cmsChips[0].freq[2];
+ _cmsVoices[2].octaveOutput = &_cmsChips[0].octave[1];
+ _cmsVoices[3].amplitudeOutput = &_cmsChips[0].ampl[3];
+ _cmsVoices[3].freqOutput = &_cmsChips[0].freq[3];
+ _cmsVoices[3].octaveOutput = &_cmsChips[0].octave[1];
+ _cmsVoices[4].amplitudeOutput = &_cmsChips[1].ampl[0];
+ _cmsVoices[4].freqOutput = &_cmsChips[1].freq[0];
+ _cmsVoices[4].octaveOutput = &_cmsChips[1].octave[0];
+ _cmsVoices[5].amplitudeOutput = &_cmsChips[1].ampl[1];
+ _cmsVoices[5].freqOutput = &_cmsChips[1].freq[1];
+ _cmsVoices[5].octaveOutput = &_cmsChips[1].octave[0];
+ _cmsVoices[6].amplitudeOutput = &_cmsChips[1].ampl[2];
+ _cmsVoices[6].freqOutput = &_cmsChips[1].freq[2];
+ _cmsVoices[6].octaveOutput = &_cmsChips[1].octave[1];
+ _cmsVoices[7].amplitudeOutput = &_cmsChips[1].ampl[3];
+ _cmsVoices[7].freqOutput = &_cmsChips[1].freq[3];
+ _cmsVoices[7].octaveOutput = &_cmsChips[1].octave[1];
// inits the CMS Emulator like in the original
_cmsEmu = new CMSEmulator(_sampleRate);
- static const byte cmsInitData[13*2] = {
- 0x1C, 0x02,
- 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00,
- 0x14, 0x3F, 0x15, 0x00, 0x16, 0x00, 0x18, 0x00, 0x19, 0x00, 0x1C, 0x01
- };
-
- i = 0;
- for (int cmsPort = 0x220; i < 2; cmsPort += 2, ++i) {
+ for (int i = 0, cmsPort = 0x220; i < 2; cmsPort += 2, ++i) {
for (int off = 0; off < 13; ++off) {
- _cmsEmu->portWrite(cmsPort+1, cmsInitData[off*2]);
- _cmsEmu->portWrite(cmsPort, cmsInitData[off*2+1]);
+ _cmsEmu->portWrite(cmsPort+1, _cmsInitData[off*2]);
+ _cmsEmu->portWrite(cmsPort, _cmsInitData[off*2+1]);
}
}
@@ -200,6 +83,10 @@ Player_V2CMS::~Player_V2CMS() {
void Player_V2CMS::setMusicVolume(int vol) {
}
+int Player_V2CMS::getMusicTimer() {
+ return _midiData ? _musicTimer : Player_V2Base::getMusicTimer();
+}
+
void Player_V2CMS::stopAllSounds() {
Common::StackLock lock(_mutex);
@@ -211,6 +98,7 @@ void Player_V2CMS::stopAllSounds() {
_midiData = 0;
_midiSongBegin = 0;
_midiDelay = 0;
+ _musicTimer = _musicTimerTicks = 0;
offAllChannels();
}
@@ -244,6 +132,7 @@ void Player_V2CMS::startSound(int nr) {
assert(data);
if (data[6] == 0x80) {
+ _musicTimer = _musicTimerTicks = 0;
loadMidiData(data, nr);
} else {
int cprio = _current_data ? *(_current_data + _header_len) : 0;
@@ -282,7 +171,8 @@ void Player_V2CMS::startSound(int nr) {
}
void Player_V2CMS::loadMidiData(byte *data, int sound) {
- memset(_midiChannelUse, 0, sizeof(byte)*16);
+ memset(_midiChannelUse, 0, sizeof(_midiChannelUse));
+ memset(_midiChannel, 0, sizeof(_midiChannel));
_tempo = data[7];
_looping = data[8];
@@ -299,11 +189,11 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) {
Voice *voiceDef = &_cmsVoicesBase[channel];
byte attackDecay = voice2[10];
- voiceDef->attack = attackRate[attackDecay >> 4];
- voiceDef->decay = decayRate[attackDecay & 0x0F];
+ voiceDef->attack = _attackRate[attackDecay >> 4];
+ voiceDef->decay = _decayRate[attackDecay & 0x0F];
byte sustainRelease = voice2[11];
- voiceDef->sustain = sustainRate[sustainRelease >> 4];
- voiceDef->release = releaseRate[sustainRelease & 0x0F];
+ voiceDef->sustain = _sustainRate[sustainRelease >> 4];
+ voiceDef->release = _releaseRate[sustainRelease & 0x0F];
if (voice2[3] & 0x40) {
voiceDef->vibrato = 0x0301;
@@ -331,12 +221,10 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) {
}
}
- for (int i = 0, channel = 0; i < 8; ++i, channel += 2) {
+ for (int i = 0; i < 8; ++i) {
_cmsVoices[i].chanNumber = 0xFF;
_cmsVoices[i].curVolume = 0;
_cmsVoices[i].nextVoice = 0;
-
- _midiChannel[channel] = 0;
}
_midiDelay = 0;
@@ -351,11 +239,17 @@ int Player_V2CMS::getSoundStatus(int nr) const {
return _current_nr == nr || _next_nr == nr || _loadedMidiSong == nr;
}
-void Player_V2CMS::processMidiData(uint ticks) {
+void Player_V2CMS::processMidiData() {
byte *currentData = _midiData;
byte command = 0x00;
int16 temp = 0;
+ ++_musicTimerTicks;
+ if (_musicTimerTicks > 60) {
+ _musicTimerTicks = 0;
+ ++_musicTimer;
+ }
+
if (!_midiDelay) {
while (true) {
if ((command = *currentData++) == 0xFF) {
@@ -365,6 +259,8 @@ void Player_V2CMS::processMidiData(uint ticks) {
continue;
}
_midiData = _midiSongBegin = 0;
+ _midiDelay = 0;
+ _loadedMidiSong = 0;
offAllChannels();
return;
} else {
@@ -400,7 +296,7 @@ void Player_V2CMS::processMidiData(uint ticks) {
_midiDelay = temp;
}
- _midiDelay -= ticks;
+ --_midiDelay;
if (_midiDelay < 0)
_midiDelay = 0;
@@ -415,27 +311,21 @@ int Player_V2CMS::readBuffer(int16 *buffer, const int numSamples) {
// maybe this needs a complete rewrite
do {
- if (_midiData) {
- --_clkFrequenz;
- if (!(_clkFrequenz & 0x01)) {
- playVoice();
- }
-
- _tempoSum += _tempo;
- // FIXME: _tempoSum is declared as char; on some systems char is unsigned.
- // E.g. on OS X. Hence the following check is always false.
- // Moral of the story: Use uint8, int8 or any of the other types provided by
- // ScummVM if you want to ensure signedness and number of available bits.
- if (_tempoSum < 0) {
- // this have to be called in the same rate as in the original (I think)
- processMidiData(1);
+ if (!(_next_tick >> FIXP_SHIFT)) {
+ if (_midiData) {
+ --_voiceTimer;
+ if (!(_voiceTimer & 0x01))
+ playVoice();
+
+ int newTempoSum = _tempo + _tempoSum;
+ _tempoSum = newTempoSum & 0xFF;
+ if (newTempoSum > 0xFF)
+ processMidiData();
+ } else {
+ nextTick();
+ play();
}
- }
-
- if (!(_next_tick >> FIXP_SHIFT) && !_midiData) {
_next_tick += _tick_len;
- nextTick();
- play();
}
step = len;
@@ -456,99 +346,95 @@ void Player_V2CMS::playVoice() {
}
_octaveMask = 0xF0;
- Voice2 *voice =0;
+ Voice2 *voice = 0;
for (int i = 0; i < 8; ++i) {
voice = &_cmsVoices[i];
_octaveMask = ~_octaveMask;
if (voice->chanNumber != 0xFF) {
processChannel(voice);
- continue;
- }
-
- if (!voice->curVolume) {
- *(voice->amplitudeOutput) = 0;
- }
+ } else {
+ if (!voice->curVolume) {
+ *(voice->amplitudeOutput) = 0;
+ }
- int volume = voice->curVolume - voice->releaseRate;
- voice->curVolume = volume;
+ int volume = voice->curVolume - voice->releaseRate;
+ if (volume < 0)
+ volume = 0;
- if (volume < 0) {
- volume = voice->curVolume = 0;
+ voice->curVolume = volume;
+ *(voice->amplitudeOutput) = ((volume >> 4) | (volume & 0xF0)) & voice->channel;
+ ++_outputTableReady;
}
-
- *(voice->amplitudeOutput) = ((volume >> 4) | (volume & 0xF0)) & voice->channel;
- ++_outputTableReady;
}
}
void Player_V2CMS::processChannel(Voice2 *channel) {
++_outputTableReady;
switch (channel->nextProcessState) {
- case PROCESS_RELEASE:
- processRelease(channel);
- break;
-
- case PROCESS_ATTACK:
+ case Voice2::kEnvelopeAttack:
processAttack(channel);
break;
- case PROCESS_DECAY:
+ case Voice2::kEnvelopeDecay:
processDecay(channel);
break;
- case PROCESS_SUSTAIN:
+ case Voice2::kEnvelopeSustain:
processSustain(channel);
break;
- case PROCESS_VIBRATO:
- processVibrato(channel);
- break;
-
- default:
+ case Voice2::kEnvelopeRelease:
+ processRelease(channel);
break;
}
}
void Player_V2CMS::processRelease(Voice2 *channel) {
- channel->curVolume -= channel->releaseRate;
- if (channel->curVolume < 0)
- channel->curVolume = 0;
+ int newVolume = channel->curVolume - channel->releaseRate;
+ if (newVolume < 0)
+ newVolume = 0;
+
+ channel->curVolume = newVolume;
processVibrato(channel);
}
void Player_V2CMS::processAttack(Voice2 *channel) {
- channel->curVolume += channel->attackRate;
- if (channel->curVolume >= 0) {
- if (channel->curVolume <= channel->maxAmpl)
- return processVibrato(channel);
+ int newVolume = channel->curVolume + channel->attackRate;
+ if (newVolume > channel->maxAmpl) {
+ channel->curVolume = channel->maxAmpl;
+ channel->nextProcessState = Voice2::kEnvelopeDecay;
+ } else {
+ channel->curVolume = newVolume;
}
- channel->curVolume = channel->maxAmpl;
- channel->nextProcessState = PROCESS_DECAY;
+
processVibrato(channel);
}
void Player_V2CMS::processDecay(Voice2 *channel) {
- channel->curVolume -= channel->decayRate;
- if (channel->curVolume >= 0) {
- if (channel->curVolume > channel->sustainRate)
- return processVibrato(channel);
+ int newVolume = channel->curVolume - channel->decayRate;
+ if (newVolume <= channel->sustainRate) {
+ channel->curVolume = channel->sustainRate;
+ channel->nextProcessState = Voice2::kEnvelopeSustain;
+ } else {
+ channel->curVolume = newVolume;
}
- channel->curVolume = channel->sustainRate;
- channel->nextProcessState = PROCESS_SUSTAIN;
+
processVibrato(channel);
}
void Player_V2CMS::processSustain(Voice2 *channel) {
if (channel->unkVibratoRate) {
- int volume = (int)channel->curVolume + (int)channel->unkRate;
+ int16 volume = channel->curVolume + channel->unkRate;
if (volume & 0xFF00) {
- volume = ((~volume) >> 8) & 0xFF;
+ volume = int8(volume >> 8);
+ volume = -volume;
}
+
channel->curVolume = volume;
- --(channel->unkCount);
+ --channel->unkCount;
if (!channel->unkCount) {
- channel->unkRate = ~(channel->unkRate);
+ channel->unkRate = -channel->unkRate;
channel->unkCount = (channel->unkVibratoDepth & 0x0F) << 1;
}
}
@@ -557,12 +443,13 @@ void Player_V2CMS::processSustain(Voice2 *channel) {
void Player_V2CMS::processVibrato(Voice2 *channel) {
if (channel->vibratoRate) {
- uint16 temp = channel->curFreq + channel->curVibratoRate;
+ int16 temp = channel->curFreq + channel->curVibratoRate;
channel->curOctave += (temp & 0xFF00) >> 8;
channel->curFreq = temp & 0xFF;
- --(channel->curVibratoUnk);
+
+ --channel->curVibratoUnk;
if (!channel->curVibratoUnk) {
- channel->curVibratoRate = ~(channel->curVibratoRate);
+ channel->curVibratoRate = -channel->curVibratoRate;
channel->curVibratoUnk = (channel->vibratoDepth & 0x0F) << 1;
}
}
@@ -572,25 +459,16 @@ void Player_V2CMS::processVibrato(Voice2 *channel) {
output = channel->freqOutput;
*output = channel->curFreq;
output = channel->octaveOutput;
- *output = ((((channel->curOctave >> 4) | (channel->curOctave & 0x0F)) & _octaveMask) | ((~_octaveMask) & *output));
+ *output = (((channel->curOctave << 4) | (channel->curOctave & 0x0F)) & _octaveMask) | ((~_octaveMask) & *output);
}
void Player_V2CMS::offAllChannels() {
- warning("offAllChannels STUB");
-/*
- // after using this sound can not be played anymore (since it would deinit the emulator)
- static const byte cmsOffData[10*2] = {
- 0x1C, 0x02,
- 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00,
- 0x14, 0x3F, 0x15, 0x00, 0x16, 0x00
- };
-
for (int cmsPort = 0x220, i = 0; i < 2; cmsPort += 2, ++i) {
- for (int off = 0; off < 10; ++off) {
- _cmsEmu->portWrite(cmsPort+1, cmsOffData[off*2]);
- _cmsEmu->portWrite(cmsPort, cmsOffData[off*2+1]);
+ for (int off = 1; off <= 10; ++off) {
+ _cmsEmu->portWrite(cmsPort+1, _cmsInitData[off*2]);
+ _cmsEmu->portWrite(cmsPort, _cmsInitData[off*2+1]);
}
- }*/
+ }
}
Player_V2CMS::Voice2 *Player_V2CMS::getFreeVoice() {
@@ -637,8 +515,10 @@ void Player_V2CMS::playNote(byte *&data) {
freeVoice->sustainRate = voice->sustain;
freeVoice->releaseRate = voice->release;
freeVoice->octaveAdd = voice->octadd;
- freeVoice->vibratoRate = freeVoice->curVibratoRate = voice->vibrato;
- freeVoice->unkVibratoRate = freeVoice->unkRate = voice->vibrato2;
+ freeVoice->vibratoRate = freeVoice->curVibratoRate = voice->vibrato & 0xFF;
+ freeVoice->vibratoDepth = freeVoice->curVibratoUnk = voice->vibrato >> 8;
+ freeVoice->unkVibratoRate = freeVoice->unkRate = voice->vibrato2 & 0xFF;
+ freeVoice->unkVibratoDepth = freeVoice->unkCount = voice->vibrato2 >> 8;
freeVoice->maxAmpl = 0xFF;
uint8 rate = freeVoice->attackRate;
@@ -650,7 +530,14 @@ void Player_V2CMS::playNote(byte *&data) {
rate -= freeVoice->attackRate;
freeVoice->curVolume = rate;
freeVoice->playingNote = *data;
- int octave = octaveTable[(*data + 3) << 1] + freeVoice->octaveAdd - 3;
+
+ int effectiveNote = freeVoice->playingNote + 3;
+ if (effectiveNote < 0 || effectiveNote >= ARRAYSIZE(_midiNotes)) {
+ warning("Player_V2CMS::playNote: Note %d out of bounds", effectiveNote);
+ effectiveNote = CLIP<int>(effectiveNote, 0, ARRAYSIZE(_midiNotes) - 1);
+ }
+
+ int octave = _midiNotes[effectiveNote].baseOctave + freeVoice->octaveAdd - 3;
if (octave < 0)
octave = 0;
if (octave > 7)
@@ -658,10 +545,10 @@ void Player_V2CMS::playNote(byte *&data) {
if (!octave)
++octave;
freeVoice->curOctave = octave;
- freeVoice->curFreq = freqTable[volume << 2];
+ freeVoice->curFreq = _midiNotes[effectiveNote].frequency;
freeVoice->curVolume = 0;
- freeVoice->nextProcessState = PROCESS_ATTACK;
- if (_lastMidiCommand & 1)
+ freeVoice->nextProcessState = Voice2::kEnvelopeAttack;
+ if (!(_lastMidiCommand & 1))
freeVoice->channel = 0xF0;
else
freeVoice->channel = 0x0F;
@@ -672,35 +559,27 @@ void Player_V2CMS::playNote(byte *&data) {
Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) {
byte channelNum = _lastMidiCommand & 0x0F;
- Voice2 *channel = _midiChannel[channelNum];
+ Voice2 *curVoice = _midiChannel[channelNum];
- if (channel) {
- Voice2 *backUp = 0;
+ if (curVoice) {
+ Voice2 *prevVoice = 0;
while (true) {
- if (channel->playingNote == param)
+ if (curVoice->playingNote == param)
break;
- backUp = channel;
- channel = channel->nextVoice;
- if (!channel)
+ prevVoice = curVoice;
+ curVoice = curVoice->nextVoice;
+ if (!curVoice)
return 0;
}
- Voice2 *backUp2 = channel->nextVoice;
- {
- Voice2 *temp = backUp;
- backUp = channel;
- channel = temp;
- }
- if (channel) {
- channel->nextVoice = backUp2;
- } else {
- _midiChannel[channelNum] = backUp2;
- }
- channel = backUp;
+ if (prevVoice)
+ prevVoice->nextVoice = curVoice->nextVoice;
+ else
+ _midiChannel[channelNum] = curVoice->nextVoice;
}
- return channel;
+ return curVoice;
}
void Player_V2CMS::clearNote(byte *&data) {
@@ -708,22 +587,18 @@ void Player_V2CMS::clearNote(byte *&data) {
if (voice) {
voice->chanNumber = 0xFF;
voice->nextVoice = 0;
- voice->nextProcessState = PROCESS_RELEASE;
+ voice->nextProcessState = Voice2::kEnvelopeRelease;
}
data += 2;
}
void Player_V2CMS::play() {
_octaveMask = 0xF0;
- channel_data *chan = &(_channels[0].d);
+ channel_data *chan = &_channels[0].d;
- static byte volumeReg[4] = { 0x00, 0x00, 0x00, 0x00 };
- static byte octaveReg[4] = { 0x66, 0x66, 0x66, 0x66 };
- static byte freqReg[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
+ MusicChip &cms = _cmsChips[0];
+ byte noiseGen = 3;
- static byte freqEnable = 0x3E;
- static byte noiseEnable = 0x01;
- static byte noiseGen = 0x02;
for (int i = 1; i <= 4; ++i) {
if (chan->time_left) {
uint16 freq = chan->freq;
@@ -733,8 +608,8 @@ void Player_V2CMS::play() {
noiseGen = freq & 0xFF;
} else {
noiseGen = 3;
- freqReg[0] = freqReg[3];
- octaveReg[0] = (octaveReg[0] & 0xF0) | ((octaveReg[1] & 0xF0) >> 4);
+ cms.freq[0] = cms.freq[3];
+ cms.octave[0] = (cms.octave[0] & 0xF0) | ((cms.octave[1] & 0xF0) >> 4);
}
} else {
if (freq == 0) {
@@ -760,17 +635,18 @@ void Player_V2CMS::play() {
oct |= cmsOct;
oct &= _octaveMask;
- oct |= ((~_octaveMask) & octaveReg[((i & 3) >> 1)]);
- octaveReg[((i & 3) >> 1)] = oct;
+ oct |= (~_octaveMask) & cms.octave[(i & 3) >> 1];
+ cms.octave[(i & 3) >> 1] = oct;
- freq >>= -(cmsOct-9);
- freqReg[(i&3)] = (-(freq-511)) & 0xFF;
+ freq >>= -(cmsOct - 9);
+ cms.freq[i & 3] = (-(freq - 511)) & 0xFF;
}
- volumeReg[i & 3] = volumeTable[chan->volume >> 12];
+ cms.ampl[i & 3] = _volumeTable[chan->volume >> 12];
} else {
- volumeReg[i & 3] = 0;
+ cms.ampl[i & 3] = 0;
}
- chan = &(_channels[i].d);
+
+ chan = &_channels[i].d;
_octaveMask ^= 0xFF;
}
@@ -778,29 +654,29 @@ void Player_V2CMS::play() {
// the right channels amplitude is set
// with the low value the left channels amplitude
_cmsEmu->portWrite(0x221, 0);
- _cmsEmu->portWrite(0x220, volumeReg[0]);
+ _cmsEmu->portWrite(0x220, cms.ampl[0]);
_cmsEmu->portWrite(0x221, 1);
- _cmsEmu->portWrite(0x220, volumeReg[1]);
+ _cmsEmu->portWrite(0x220, cms.ampl[1]);
_cmsEmu->portWrite(0x221, 2);
- _cmsEmu->portWrite(0x220, volumeReg[2]);
+ _cmsEmu->portWrite(0x220, cms.ampl[2]);
_cmsEmu->portWrite(0x221, 3);
- _cmsEmu->portWrite(0x220, volumeReg[3]);
+ _cmsEmu->portWrite(0x220, cms.ampl[3]);
_cmsEmu->portWrite(0x221, 8);
- _cmsEmu->portWrite(0x220, freqReg[0]);
+ _cmsEmu->portWrite(0x220, cms.freq[0]);
_cmsEmu->portWrite(0x221, 9);
- _cmsEmu->portWrite(0x220, freqReg[1]);
+ _cmsEmu->portWrite(0x220, cms.freq[1]);
_cmsEmu->portWrite(0x221, 10);
- _cmsEmu->portWrite(0x220, freqReg[2]);
+ _cmsEmu->portWrite(0x220, cms.freq[2]);
_cmsEmu->portWrite(0x221, 11);
- _cmsEmu->portWrite(0x220, freqReg[3]);
+ _cmsEmu->portWrite(0x220, cms.freq[3]);
_cmsEmu->portWrite(0x221, 0x10);
- _cmsEmu->portWrite(0x220, octaveReg[0]);
+ _cmsEmu->portWrite(0x220, cms.octave[0]);
_cmsEmu->portWrite(0x221, 0x11);
- _cmsEmu->portWrite(0x220, octaveReg[1]);
+ _cmsEmu->portWrite(0x220, cms.octave[1]);
_cmsEmu->portWrite(0x221, 0x14);
- _cmsEmu->portWrite(0x220, freqEnable);
+ _cmsEmu->portWrite(0x220, 0x3E);
_cmsEmu->portWrite(0x221, 0x15);
- _cmsEmu->portWrite(0x220, noiseEnable);
+ _cmsEmu->portWrite(0x220, 0x01);
_cmsEmu->portWrite(0x221, 0x16);
_cmsEmu->portWrite(0x220, noiseGen);
}
@@ -838,4 +714,71 @@ void Player_V2CMS::playMusicChips(const MusicChip *table) {
} while ((cmsPort & 2) == 0);
}
+const Player_V2CMS::MidiNote Player_V2CMS::_midiNotes[132] = {
+ { 3, 0 }, { 31, 0 }, { 58, 0 }, { 83, 0 },
+ { 107, 0 }, { 130, 0 }, { 151, 0 }, { 172, 0 },
+ { 191, 0 }, { 209, 0 }, { 226, 0 }, { 242, 0 },
+ { 3, 1 }, { 31, 1 }, { 58, 1 }, { 83, 1 },
+ { 107, 1 }, { 130, 1 }, { 151, 1 }, { 172, 1 },
+ { 191, 1 }, { 209, 1 }, { 226, 1 }, { 242, 1 },
+ { 3, 2 }, { 31, 2 }, { 58, 2 }, { 83, 2 },
+ { 107, 2 }, { 130, 2 }, { 151, 2 }, { 172, 2 },
+ { 191, 2 }, { 209, 2 }, { 226, 2 }, { 242, 2 },
+ { 3, 3 }, { 31, 3 }, { 58, 3 }, { 83, 3 },
+ { 107, 3 }, { 130, 3 }, { 151, 3 }, { 172, 3 },
+ { 191, 3 }, { 209, 3 }, { 226, 3 }, { 242, 3 },
+ { 3, 4 }, { 31, 4 }, { 58, 4 }, { 83, 4 },
+ { 107, 4 }, { 130, 4 }, { 151, 4 }, { 172, 4 },
+ { 191, 4 }, { 209, 4 }, { 226, 4 }, { 242, 4 },
+ { 3, 5 }, { 31, 5 }, { 58, 5 }, { 83, 5 },
+ { 107, 5 }, { 130, 5 }, { 151, 5 }, { 172, 5 },
+ { 191, 5 }, { 209, 5 }, { 226, 5 }, { 242, 5 },
+ { 3, 6 }, { 31, 6 }, { 58, 6 }, { 83, 6 },
+ { 107, 6 }, { 130, 6 }, { 151, 6 }, { 172, 6 },
+ { 191, 6 }, { 209, 6 }, { 226, 6 }, { 242, 6 },
+ { 3, 7 }, { 31, 7 }, { 58, 7 }, { 83, 7 },
+ { 107, 7 }, { 130, 7 }, { 151, 7 }, { 172, 7 },
+ { 191, 7 }, { 209, 7 }, { 226, 7 }, { 242, 7 },
+ { 3, 8 }, { 31, 8 }, { 58, 8 }, { 83, 8 },
+ { 107, 8 }, { 130, 8 }, { 151, 8 }, { 172, 8 },
+ { 191, 8 }, { 209, 8 }, { 226, 8 }, { 242, 8 },
+ { 3, 9 }, { 31, 9 }, { 58, 9 }, { 83, 9 },
+ { 107, 9 }, { 130, 9 }, { 151, 9 }, { 172, 9 },
+ { 191, 9 }, { 209, 9 }, { 226, 9 }, { 242, 9 },
+ { 3, 10 }, { 31, 10 }, { 58, 10 }, { 83, 10 },
+ { 107, 10 }, { 130, 10 }, { 151, 10 }, { 172, 10 },
+ { 191, 10 }, { 209, 10 }, { 226, 10 }, { 242, 10 }
+};
+
+const byte Player_V2CMS::_attackRate[16] = {
+ 0, 2, 4, 7, 14, 26, 48, 82,
+ 128, 144, 160, 176, 192, 208, 224, 255
+};
+
+const byte Player_V2CMS::_decayRate[16] = {
+ 0, 1, 2, 3, 4, 6, 12, 24,
+ 48, 96, 192, 215, 255, 255, 255, 255
+};
+
+const byte Player_V2CMS::_sustainRate[16] = {
+ 255, 180, 128, 96, 80, 64, 56, 48,
+ 42, 36, 32, 28, 24, 20, 16, 0
+};
+
+const byte Player_V2CMS::_releaseRate[16] = {
+ 0, 1, 2, 4, 6, 9, 14, 22,
+ 36, 56, 80, 100, 120, 140, 160, 255
+};
+
+const byte Player_V2CMS::_volumeTable[16] = {
+ 0x00, 0x10, 0x10, 0x11, 0x11, 0x21, 0x22, 0x22,
+ 0x33, 0x44, 0x55, 0x66, 0x88, 0xAA, 0xCC, 0xFF
+};
+
+const byte Player_V2CMS::_cmsInitData[26] = {
+ 0x1C, 0x02,
+ 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00,
+ 0x14, 0x3F, 0x15, 0x00, 0x16, 0x00, 0x18, 0x00, 0x19, 0x00, 0x1C, 0x01
+};
+
} // End of namespace Scumm
diff --git a/engines/scumm/player_v2cms.h b/engines/scumm/player_v2cms.h
index f7dc0c16b1..cbad46fe5d 100644
--- a/engines/scumm/player_v2cms.h
+++ b/engines/scumm/player_v2cms.h
@@ -42,17 +42,14 @@ public:
virtual void startSound(int sound);
virtual void stopSound(int sound);
virtual void stopAllSounds();
-// virtual int getMusicTimer();
+ virtual int getMusicTimer();
virtual int getSoundStatus(int sound) const;
// AudioStream API
- int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
-
-protected:
+ virtual int readBuffer(int16 *buffer, const int numSamples);
+ virtual bool isStereo() const { return true; }
+private:
#include "common/pack-start.h" // START STRUCT PACKING
struct Voice {
byte attack;
@@ -72,12 +69,12 @@ protected:
uint8 channel;
int8 sustainLevel;
- int8 attackRate;
+ uint8 attackRate;
uint8 maxAmpl;
- int8 decayRate;
- int8 sustainRate;
- int8 releaseRate;
- int8 releaseTime;
+ uint8 decayRate;
+ uint8 sustainRate;
+ uint8 releaseRate;
+ uint8 releaseTime;
int8 vibratoRate;
int8 vibratoDepth;
@@ -90,10 +87,17 @@ protected:
int8 unkRate;
int8 unkCount;
- int nextProcessState;
- int8 curVolume;
- int8 curOctave;
- int8 curFreq;
+ enum EnvelopeState {
+ kEnvelopeAttack,
+ kEnvelopeDecay,
+ kEnvelopeSustain,
+ kEnvelopeRelease
+ };
+
+ EnvelopeState nextProcessState;
+ uint8 curVolume;
+ uint8 curOctave;
+ uint8 curFreq;
int8 octaveAdd;
@@ -114,8 +118,8 @@ protected:
Voice2 _cmsVoices[8];
MusicChip _cmsChips[2];
- int8 _tempo;
- int8 _tempoSum;
+ uint8 _tempo;
+ uint8 _tempoSum;
byte _looping;
byte _octaveMask;
int16 _midiDelay;
@@ -128,9 +132,9 @@ protected:
byte _lastMidiCommand;
uint _outputTableReady;
- byte _clkFrequenz;
- byte _restart;
- byte _curSno;
+ byte _voiceTimer;
+
+ int _musicTimer, _musicTimerTicks;
void loadMidiData(byte *data, int sound);
void play();
@@ -147,15 +151,25 @@ protected:
void clearNote(byte *&data);
void offAllChannels();
void playVoice();
- void processMidiData(uint ticks);
+ void processMidiData();
Voice2 *getFreeVoice();
Voice2 *getPlayVoice(byte param);
- // from Player_V2
-protected:
- CMSEmulator *_cmsEmu;
+ struct MidiNote {
+ byte frequency;
+ byte baseOctave;
+ };
+
+ static const MidiNote _midiNotes[132];
+ static const byte _attackRate[16];
+ static const byte _decayRate[16];
+ static const byte _sustainRate[16];
+ static const byte _releaseRate[16];
+ static const byte _volumeTable[16];
+ static const byte _cmsInitData[26];
+ CMSEmulator *_cmsEmu;
};
} // End of namespace Scumm
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 3cc710c207..870ec8cdf7 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -686,12 +686,7 @@ Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int sl
Graphics::Surface *thumb = 0;
if (Graphics::checkThumbnailHeader(*in)) {
- thumb = new Graphics::Surface();
- assert(thumb);
- if (!Graphics::loadThumbnail(*in, *thumb)) {
- delete thumb;
- thumb = 0;
- }
+ thumb = Graphics::loadThumbnail(*in);
}
delete in;
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 8f555818f4..319eddf871 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Sun Apr 17 10:46:26 2011
+ This file was generated by the md5table tool on Wed Aug 3 03:14:00 2011
DO NOT EDIT MANUALLY!
*/
@@ -99,7 +99,7 @@ static const MD5Table md5table[] = {
{ "1ed22f601f8b3695804a6583cc3083f1", "puttrace", "HE 98.5", "", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "1f2e62b5a9c50589fc342285a6bb3a27", "freddi", "HE 73", "", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "1fbebd7b2b692df5297870447a80cfed", "atlantis", "Floppy", "Floppy", 12030, Common::DE_DEU, Common::kPlatformPC },
- { "1ff5997c78fbd0a841a75ef15a05d9d5", "BluesBirthday", "", "Red", -1, Common::EN_ANY, Common::kPlatformWindows },
+ { "1ff5997c78fbd0a841a75ef15a05d9d5", "BluesBirthday", "Red", "Red", -1, Common::EN_ANY, Common::kPlatformUnknown },
{ "2012f854d83d9cc6f73b2b544cd8bbf8", "water", "HE 80", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "20176076d708bf14407bcc9bdcd7a418", "pajama3", "", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "204453e33456c4faa26e276229fe5b76", "spyfox2", "", "Demo", 14689, Common::DE_DEU, Common::kPlatformWindows },
@@ -403,7 +403,7 @@ static const MD5Table md5table[] = {
{ "9781422e4288dbc090720e4563168ba7", "puttzoo", "", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "981e1e1891f2be7e25a01f50ae55a5af", "puttrace", "HE 98", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "98744fe66ff730e8c2b3b1f58803ab0b", "atlantis", "Floppy", "Demo", -1, Common::EN_ANY, Common::kPlatformPC },
- { "99128b6a5bdd9831d9682fb8b5cbf8d4", "BluesBirthday", "", "Yellow", -1, Common::EN_ANY, Common::kPlatformUnknown },
+ { "99128b6a5bdd9831d9682fb8b5cbf8d4", "BluesBirthday", "Yellow", "Yellow", -1, Common::EN_ANY, Common::kPlatformUnknown },
{ "99a3699f80b8f776efae592b44b9b991", "maniac", "V2", "V2", -1, Common::FR_FRA, Common::kPlatformPC },
{ "99b6f822b0b2612415407865438697d6", "atlantis", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC },
{ "9b7452b5cd6d3ffb2b2f5118010af84f", "ft", "Demo", "Demo", 116463537, Common::EN_ANY, Common::kPlatformMacintosh },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 0f01e39459..283b527878 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -299,7 +299,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_haveActorSpeechMsg = false;
_useTalkAnims = false;
_defaultTalkDelay = 0;
- _musicType = MDT_NONE;
_saveSound = 0;
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
memset(_scaleSlots, 0, sizeof(_scaleSlots));
@@ -1746,40 +1745,36 @@ void ScummEngine::setupMusic(int midi) {
switch (MidiDriver::getMusicType(dev)) {
case MT_NULL:
- _musicType = MDT_NONE;
+ _sound->_musicType = MDT_NONE;
break;
case MT_PCSPK:
- _musicType = MDT_PCSPK;
+ _sound->_musicType = MDT_PCSPK;
break;
case MT_PCJR:
- _musicType = MDT_PCJR;
+ _sound->_musicType = MDT_PCJR;
break;
- //case MT_CMS:
-#if 1
- _musicType = MDT_ADLIB;
-#else
- _musicType = MDT_CMS; // Still has number of bugs, disable by default
-#endif
+ case MT_CMS:
+ _sound->_musicType = MDT_CMS;
break;
case MT_TOWNS:
- _musicType = MDT_TOWNS;
+ _sound->_musicType = MDT_TOWNS;
break;
case MT_ADLIB:
- _musicType = MDT_ADLIB;
+ _sound->_musicType = MDT_ADLIB;
break;
case MT_C64:
- _musicType = MDT_C64;
+ _sound->_musicType = MDT_C64;
break;
case MT_APPLEIIGS:
- _musicType = MDT_APPLEIIGS;
+ _sound->_musicType = MDT_APPLEIIGS;
break;
default:
- _musicType = MDT_MIDI;
+ _sound->_musicType = MDT_MIDI;
break;
}
if ((_game.id == GID_MONKEY_EGA || (_game.id == GID_LOOM && _game.version == 3))
- && (_game.platform == Common::kPlatformPC) && _musicType == MDT_MIDI) {
+ && (_game.platform == Common::kPlatformPC) && _sound->_musicType == MDT_MIDI) {
Common::String fileName;
bool missingFile = false;
if (_game.id == GID_LOOM) {
@@ -1809,7 +1804,7 @@ void ScummEngine::setupMusic(int midi) {
"but %s is missing. Using AdLib instead."), fileName.c_str()),
_("OK"));
dialog.runModal();
- _musicType = MDT_ADLIB;
+ _sound->_musicType = MDT_ADLIB;
}
}
@@ -1823,9 +1818,9 @@ void ScummEngine::setupMusic(int midi) {
* automatically when samples need to be generated */
if (!_mixer->isReady()) {
warning("Sound mixer initialization failed");
- if (_musicType == MDT_ADLIB || _musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) {
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) {
dev = 0;
- _musicType = MDT_NONE;
+ _sound->_musicType = MDT_NONE;
warning("MIDI driver depends on sound mixer, switching to null MIDI driver");
}
}
@@ -1857,9 +1852,9 @@ void ScummEngine::setupMusic(int midi) {
_musicEngine = new Player_V1(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
} else if (_game.version <= 2) {
_musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
- } else if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) {
+ } else if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) {
_musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
- } else if (_musicType == MDT_CMS) {
+ } else if (_sound->_musicType == MDT_CMS) {
_musicEngine = new Player_V2CMS(this, _mixer);
} else if (_game.platform == Common::kPlatform3DO && _game.heversion <= 62) {
// 3DO versions use digital music and sound samples.
@@ -1871,15 +1866,15 @@ void ScummEngine::setupMusic(int midi) {
MidiDriver *nativeMidiDriver = 0;
MidiDriver *adlibMidiDriver = 0;
- if (_musicType != MDT_ADLIB && _musicType != MDT_TOWNS && _musicType != MDT_PCSPK)
+ if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK)
nativeMidiDriver = MidiDriver::createMidi(dev);
if (nativeMidiDriver != NULL && _native_mt32)
nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
- bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && _musicType != MDT_PCSPK && (midi & MDT_ADLIB);
- if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS || multi_midi) {
- adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
+ bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB);
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS || multi_midi) {
+ adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_sound->_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0);
- } else if (_musicType == MDT_PCSPK) {
+ } else if (_sound->_musicType == MDT_PCSPK) {
adlibMidiDriver = new PcSpkDriver(_mixer);
}
@@ -1909,7 +1904,7 @@ void ScummEngine::setupMusic(int midi) {
_imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1);
_imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1);
}
- if (_musicType == MDT_PCSPK)
+ if (_sound->_musicType == MDT_PCSPK)
_imuse->property(IMuse::PROP_PC_SPEAKER, 1);
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index e503af750d..04a175e732 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -40,8 +40,6 @@
#include "scumm/detection.h"
#include "scumm/script.h"
-#include "audio/mididrv.h"
-
#ifdef __DS__
/* This disables the dual layer mode which is used in FM-Towns versions
* of SCUMM games and which emulates the behavior of the original code.
@@ -235,7 +233,8 @@ enum ScummGameId {
GID_PUTTMOON,
GID_FUNPACK,
GID_FREDDI3,
- GID_BIRTHDAY,
+ GID_BIRTHDAYRED,
+ GID_BIRTHDAYYELLOW,
GID_TREASUREHUNT,
GID_PUTTRACE,
GID_FUNSHOP, // Used for all three funshops
@@ -1084,7 +1083,6 @@ protected:
int _saveSound;
bool _native_mt32;
bool _enable_gs;
- MidiDriverFlags _musicType;
bool _copyProtection;
public:
diff --git a/engines/scumm/smush/codec37.cpp b/engines/scumm/smush/codec37.cpp
index dcc8ee3c19..344057e3ac 100644
--- a/engines/scumm/smush/codec37.cpp
+++ b/engines/scumm/smush/codec37.cpp
@@ -571,4 +571,3 @@ void Codec37Decoder::decode(byte *dst, const byte *src) {
}
} // End of namespace Scumm
-
diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp
index 7765bf1292..5cfa0ea519 100644
--- a/engines/scumm/smush/smush_font.cpp
+++ b/engines/scumm/smush/smush_font.cpp
@@ -258,4 +258,3 @@ void SmushFont::drawStringWrap(const char *str, byte *buffer, int dst_width, int
}
} // End of namespace Scumm
-
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index c3cad19fdc..33db70985d 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -84,6 +84,8 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
memset(_soundQue, 0, sizeof(_soundQue));
memset(_soundQue2, 0, sizeof(_soundQue2));
memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
+
+ _musicType = MDT_NONE;
}
Sound::~Sound() {
@@ -1016,7 +1018,7 @@ void Sound::startCDTimer() {
// appears.
_vm->getTimerManager()->removeTimerProc(&cd_timer_handler);
- _vm->getTimerManager()->installTimerProc(&cd_timer_handler, 100700, _vm);
+ _vm->getTimerManager()->installTimerProc(&cd_timer_handler, 100700, _vm, "scummCDtimer");
}
void Sound::stopCDTimer() {
@@ -1094,7 +1096,7 @@ int ScummEngine::readSoundResource(ResId idx) {
switch (basetag) {
case MKTAG('M','I','D','I'):
case MKTAG('i','M','U','S'):
- if (_musicType != MDT_PCSPK && _musicType != MDT_PCJR) {
+ if (_sound->_musicType != MDT_PCSPK && _sound->_musicType != MDT_PCJR) {
_fileHandle->seek(-8, SEEK_CUR);
_fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8);
return 1;
@@ -1118,7 +1120,7 @@ int ScummEngine::readSoundResource(ResId idx) {
break;
case MKTAG('A','D','L',' '):
pri = 1;
- if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS)
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS)
pri = 10;
break;
case MKTAG('A','M','I',' '):
@@ -1137,7 +1139,7 @@ int ScummEngine::readSoundResource(ResId idx) {
break;
case MKTAG('S','P','K',' '):
pri = -1;
- if (_musicType == MDT_PCSPK || _musicType == MDT_PCJR)
+ if (_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR)
pri = 11;
break;
}
@@ -1145,7 +1147,7 @@ int ScummEngine::readSoundResource(ResId idx) {
// We only allow SPK resources for PC Speaker, PCJr and CMS here
// since other resource would sound horribly with their output
// drivers.
- if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) && pri != 11)
+ if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) && pri != 11)
pri = -1;
// We only allow ADL resources when AdLib or FM-Towns is used as
@@ -1155,7 +1157,7 @@ int ScummEngine::readSoundResource(ResId idx) {
// only contains a ROL resource for sound id 60. Formerly we tried
// to play that via the AdLib or FM-Towns audio driver resulting
// in strange noises. Now we behave like the original did.
- if ((_musicType == MDT_ADLIB || _musicType == MDT_TOWNS) && pri != 10)
+ if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 10)
pri = -1;
debugC(DEBUG_RESOURCE, " tag: %s, total_size=%d, pri=%d", tag2str(tag), size, pri);
@@ -1997,6 +1999,14 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, Re
break;
case 0x80:
+ // FIXME: This is incorrect. The original uses 0x80 for
+ // looping a single channel. We currently interpret it as stop
+ // thus we won't get looping for sound effects. It should
+ // always jump to the start of the channel.
+ //
+ // Since we convert the data to MIDI and we cannot only loop a
+ // single channel via MIDI fixing this will require some more
+ // thought.
track_time[ch] = -1;
src_ptr ++;
break;
@@ -2087,7 +2097,7 @@ int ScummEngine::readSoundResourceSmallHeader(ResId idx) {
}
}
- if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && wa_offs != 0) {
+ if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && wa_offs != 0) {
if (_game.features & GF_OLD_BUNDLE) {
_fileHandle->seek(wa_offs, SEEK_SET);
_fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size);
@@ -2096,18 +2106,37 @@ int ScummEngine::readSoundResourceSmallHeader(ResId idx) {
_fileHandle->read(_res->createResource(rtSound, idx, wa_size + 6), wa_size + 6);
}
return 1;
- } else if (_musicType == MDT_CMS && ad_offs != 0) {
+ } else if (_sound->_musicType == MDT_CMS) {
if (_game.features & GF_OLD_BUNDLE) {
- _fileHandle->seek(wa_offs + wa_size + 6, SEEK_SET);
- byte musType = _fileHandle->readByte();
+ bool hasAdLibMusicTrack = false;
+
+ if (ad_offs) {
+ _fileHandle->seek(ad_offs + 4 + 2, SEEK_SET);
+ hasAdLibMusicTrack = (_fileHandle->readByte() == 0x80);
+ }
- if (musType == 0x80) {
+ if (hasAdLibMusicTrack) {
_fileHandle->seek(ad_offs, SEEK_SET);
_fileHandle->read(_res->createResource(rtSound, idx, ad_size), ad_size);
} else {
_fileHandle->seek(wa_offs, SEEK_SET);
_fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size);
}
+ } else {
+ bool hasAdLibMusicTrack = false;
+
+ if (ad_offs) {
+ _fileHandle->seek(ad_offs + 2, SEEK_SET);
+ hasAdLibMusicTrack = (_fileHandle->readByte() == 0x80);
+ }
+
+ if (hasAdLibMusicTrack) {
+ _fileHandle->seek(ad_offs - 4, SEEK_SET);
+ _fileHandle->read(_res->createResource(rtSound, idx, ad_size + 4), ad_size + 4);
+ } else {
+ _fileHandle->seek(wa_offs - 6, SEEK_SET);
+ _fileHandle->read(_res->createResource(rtSound, idx, wa_size + 6), wa_size + 6);
+ }
}
} else if (ad_offs != 0) {
// AD resources have a header, instrument definitions and one MIDI track.
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index 03659ceff1..e9a37ac9fa 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
#include "audio/audiostream.h"
+#include "audio/mididrv.h"
#include "audio/mixer.h"
#include "scumm/saveload.h"
@@ -90,6 +91,8 @@ public:
byte _sfxMode;
uint _lastSound;
+ MidiDriverFlags _musicType;
+
public:
Sound(ScummEngine *parent, Audio::Mixer *mixer);
virtual ~Sound();
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 2d2209c155..61bb89328d 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1127,8 +1127,6 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
}
num += (_game.version == 8) ? 4 : 2;
}
- } else if (_game.id == GID_DIG && (chr == 1 || chr == 2 || chr == 3 || chr == 8)) {
- // Skip these characters
} else {
if ((chr != '@') || (_game.id == GID_CMI && _language == Common::ZH_TWN) ||
(_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine && _language == Common::JA_JPN) ||
@@ -1142,6 +1140,14 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
if (dst >= end)
error("convertMessageToString: buffer overflow");
}
+
+ // WORKAROUND: Russian The Dig pads messages with 03. No idea why
+ // it does not work as is with our rendering code, thus fixing it
+ // with a workaround.
+ if (_game.id == GID_DIG) {
+ while (*(dst - 1) == 0x03)
+ dst--;
+ }
*dst = 0;
return dstSize - (end - dst);
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 4527d7a121..26a6a2f3b1 100644
--- a/engines/scumm/vars.cpp
+++ b/engines/scumm/vars.cpp
@@ -25,9 +25,12 @@
#include "scumm/scumm.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v8.h"
+#include "scumm/sound.h"
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
+#include "audio/mididrv.h"
+
namespace Scumm {
void ScummEngine::setupScummVars() {
@@ -722,7 +725,7 @@ void ScummEngine::resetScummVars() {
// 2 CMS
// 3 AdLib
// 4 Roland
- switch (_musicType) {
+ switch (_sound->_musicType) {
case MDT_NONE:
case MDT_PCSPK:
VAR(VAR_SOUNDCARD) = 0;
diff --git a/engines/sky/autoroute.h b/engines/sky/autoroute.h
index 2d01be01ec..8721ba6c54 100644
--- a/engines/sky/autoroute.h
+++ b/engines/sky/autoroute.h
@@ -56,4 +56,3 @@ private:
} // End of namespace Sky
#endif // AUTOROUTE_H
-
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index 6c0cf8b1ef..c3550e6f02 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -162,4 +162,3 @@ private:
} // End of namespace Sword1
#endif //BSCONTROL_H
-
diff --git a/engines/sword1/debug.h b/engines/sword1/debug.h
index e4f004dc63..1505ae28dd 100644
--- a/engines/sword1/debug.h
+++ b/engines/sword1/debug.h
@@ -39,4 +39,3 @@ private:
} // End of namespace Sword1
#endif // BSDEBUG_H
-
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 0c1e74082f..4da636bce9 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -274,13 +274,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
in->skip(1);
if (Graphics::checkThumbnailHeader(*in)) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
}
diff --git a/engines/sword1/object.h b/engines/sword1/object.h
index 5a6fd49c0b..4f5371fa72 100644
--- a/engines/sword1/object.h
+++ b/engines/sword1/object.h
@@ -123,4 +123,3 @@ struct Object {
} // End of namespace Sword1
#endif //BSOBJECT_H
-
diff --git a/engines/sword1/screen.h b/engines/sword1/screen.h
index ece37b0ecc..ff4df8c7c6 100644
--- a/engines/sword1/screen.h
+++ b/engines/sword1/screen.h
@@ -169,6 +169,3 @@ private:
} // End of namespace Sword1
#endif //BSSCREEN_H
-
-
-
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index b2f5795663..25a3df167b 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -99,4 +99,3 @@ SaveStateList Sword25MetaEngine::listSaves(const char *target) const {
#else
REGISTER_PLUGIN_STATIC(SWORD25, PLUGIN_TYPE_ENGINE, Sword25MetaEngine);
#endif
-
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 1b424dac65..78b2db19eb 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -209,7 +209,7 @@ uint SoundEngine::playSoundEx(const Common::String &fileName, SOUND_TYPES type,
#ifdef USE_VORBIS
Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(in, DisposeAfterUse::YES);
#endif
- uint id;
+ uint id = handleId;
SndHandle *handle;
if (handleId == 0x1337)
diff --git a/engines/sword25/util/lua/lapi.cpp b/engines/sword25/util/lua/lapi.cpp
index ff25cfc653..b97e90012c 100644
--- a/engines/sword25/util/lua/lapi.cpp
+++ b/engines/sword25/util/lua/lapi.cpp
@@ -1074,4 +1074,3 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
lua_unlock(L);
return name;
}
-
diff --git a/engines/sword25/util/lua/lauxlib.cpp b/engines/sword25/util/lua/lauxlib.cpp
index 1261777315..116d19dfce 100644
--- a/engines/sword25/util/lua/lauxlib.cpp
+++ b/engines/sword25/util/lua/lauxlib.cpp
@@ -655,4 +655,3 @@ LUALIB_API lua_State *luaL_newstate (void) {
if (L) lua_atpanic(L, &panic);
return L;
}
-
diff --git a/engines/sword25/util/lua/lauxlib.h b/engines/sword25/util/lua/lauxlib.h
index d58f290527..d3c1d5ca35 100644
--- a/engines/sword25/util/lua/lauxlib.h
+++ b/engines/sword25/util/lua/lauxlib.h
@@ -170,5 +170,3 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
#define luaL_reg luaL_Reg
#endif
-
-
diff --git a/engines/sword25/util/lua/lbaselib.cpp b/engines/sword25/util/lua/lbaselib.cpp
index 5032e6322a..3f0b645164 100644
--- a/engines/sword25/util/lua/lbaselib.cpp
+++ b/engines/sword25/util/lua/lbaselib.cpp
@@ -651,4 +651,3 @@ LUALIB_API int luaopen_base (lua_State *L) {
luaL_register(L, LUA_COLIBNAME, co_funcs);
return 2;
}
-
diff --git a/engines/sword25/util/lua/lcode.cpp b/engines/sword25/util/lua/lcode.cpp
index 6e7e10017f..ead780d359 100644
--- a/engines/sword25/util/lua/lcode.cpp
+++ b/engines/sword25/util/lua/lcode.cpp
@@ -836,4 +836,3 @@ void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
}
fs->freereg = base + 1; /* free registers with list values */
}
-
diff --git a/engines/sword25/util/lua/ldblib.cpp b/engines/sword25/util/lua/ldblib.cpp
index 618e9a843f..e5cb8231c0 100644
--- a/engines/sword25/util/lua/ldblib.cpp
+++ b/engines/sword25/util/lua/ldblib.cpp
@@ -398,4 +398,3 @@ LUALIB_API int luaopen_debug (lua_State *L) {
luaL_register(L, LUA_DBLIBNAME, dblib);
return 1;
}
-
diff --git a/engines/sword25/util/lua/ldebug.cpp b/engines/sword25/util/lua/ldebug.cpp
index 85c492cc77..e89ae9cad5 100644
--- a/engines/sword25/util/lua/ldebug.cpp
+++ b/engines/sword25/util/lua/ldebug.cpp
@@ -619,4 +619,3 @@ void luaG_runerror (lua_State *L, const char *fmt, ...) {
va_end(argp);
luaG_errormsg(L);
}
-
diff --git a/engines/sword25/util/lua/ldo.cpp b/engines/sword25/util/lua/ldo.cpp
index 49e0881a45..5d9667f4f0 100644
--- a/engines/sword25/util/lua/ldo.cpp
+++ b/engines/sword25/util/lua/ldo.cpp
@@ -534,5 +534,3 @@ int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
luaZ_freebuffer(L, &p.buff);
return status;
}
-
-
diff --git a/engines/sword25/util/lua/ldo.h b/engines/sword25/util/lua/ldo.h
index 4c97134805..e57b08dec0 100644
--- a/engines/sword25/util/lua/ldo.h
+++ b/engines/sword25/util/lua/ldo.h
@@ -54,4 +54,3 @@ LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
#endif
-
diff --git a/engines/sword25/util/lua/lfunc.cpp b/engines/sword25/util/lua/lfunc.cpp
index ce7acf4e77..f8fa19e25a 100644
--- a/engines/sword25/util/lua/lfunc.cpp
+++ b/engines/sword25/util/lua/lfunc.cpp
@@ -171,4 +171,3 @@ const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
}
return NULL; /* not found */
}
-
diff --git a/engines/sword25/util/lua/lgc.cpp b/engines/sword25/util/lua/lgc.cpp
index 71e581ad30..54f7b548dd 100644
--- a/engines/sword25/util/lua/lgc.cpp
+++ b/engines/sword25/util/lua/lgc.cpp
@@ -708,4 +708,3 @@ void luaC_linkupval (lua_State *L, UpVal *uv) {
}
}
}
-
diff --git a/engines/sword25/util/lua/linit.cpp b/engines/sword25/util/lua/linit.cpp
index 93f41d0350..a01f28d1ff 100644
--- a/engines/sword25/util/lua/linit.cpp
+++ b/engines/sword25/util/lua/linit.cpp
@@ -35,4 +35,3 @@ LUALIB_API void luaL_openlibs (lua_State *L) {
lua_call(L, 1, 0);
}
}
-
diff --git a/engines/sword25/util/lua/liolib.cpp b/engines/sword25/util/lua/liolib.cpp
index 6c00de5094..0d27f9677f 100644
--- a/engines/sword25/util/lua/liolib.cpp
+++ b/engines/sword25/util/lua/liolib.cpp
@@ -590,4 +590,3 @@ LUALIB_API int luaopen_io (lua_State *L) {
lua_pop(L, 1); /* pop 'popen' */
return 1;
}
-
diff --git a/engines/sword25/util/lua/llex.cpp b/engines/sword25/util/lua/llex.cpp
index b456ee2dfe..464ab3ec15 100644
--- a/engines/sword25/util/lua/llex.cpp
+++ b/engines/sword25/util/lua/llex.cpp
@@ -472,4 +472,3 @@ void luaX_lookahead (LexState *ls) {
lua_assert(ls->lookahead.token == TK_EOS);
ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
}
-
diff --git a/engines/sword25/util/lua/lmathlib.cpp b/engines/sword25/util/lua/lmathlib.cpp
index 6c36bbcf4e..c1a645b296 100644
--- a/engines/sword25/util/lua/lmathlib.cpp
+++ b/engines/sword25/util/lua/lmathlib.cpp
@@ -274,4 +274,3 @@ LUALIB_API int luaopen_math (lua_State *L) {
#endif
return 1;
}
-
diff --git a/engines/sword25/util/lua/lmem.cpp b/engines/sword25/util/lua/lmem.cpp
index ccd69357e0..004a467dc8 100644
--- a/engines/sword25/util/lua/lmem.cpp
+++ b/engines/sword25/util/lua/lmem.cpp
@@ -83,4 +83,3 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
g->totalbytes = (g->totalbytes - osize) + nsize;
return block;
}
-
diff --git a/engines/sword25/util/lua/lmem.h b/engines/sword25/util/lua/lmem.h
index 97a888c7f8..6430912b41 100644
--- a/engines/sword25/util/lua/lmem.h
+++ b/engines/sword25/util/lua/lmem.h
@@ -46,4 +46,3 @@ LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
const char *errormsg);
#endif
-
diff --git a/engines/sword25/util/lua/loadlib.cpp b/engines/sword25/util/lua/loadlib.cpp
index f4cdd70a78..49934ce059 100644
--- a/engines/sword25/util/lua/loadlib.cpp
+++ b/engines/sword25/util/lua/loadlib.cpp
@@ -329,4 +329,3 @@ LUALIB_API int luaopen_package (lua_State *L) {
lua_pop(L, 1);
return 1; /* return 'package' table */
}
-
diff --git a/engines/sword25/util/lua/lobject.h b/engines/sword25/util/lua/lobject.h
index 5418a918b1..70b2c754ea 100644
--- a/engines/sword25/util/lua/lobject.h
+++ b/engines/sword25/util/lua/lobject.h
@@ -378,4 +378,3 @@ LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
#endif
-
diff --git a/engines/sword25/util/lua/lopcodes.cpp b/engines/sword25/util/lua/lopcodes.cpp
index d9da16f689..255b2029e9 100644
--- a/engines/sword25/util/lua/lopcodes.cpp
+++ b/engines/sword25/util/lua/lopcodes.cpp
@@ -99,4 +99,3 @@ const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
};
-
diff --git a/engines/sword25/util/lua/loslib.cpp b/engines/sword25/util/lua/loslib.cpp
index b61f8c65e1..25bfa2d1b5 100644
--- a/engines/sword25/util/lua/loslib.cpp
+++ b/engines/sword25/util/lua/loslib.cpp
@@ -243,4 +243,3 @@ LUALIB_API int luaopen_os (lua_State *L) {
luaL_register(L, LUA_OSLIBNAME, syslib);
return 1;
}
-
diff --git a/engines/sword25/util/lua/lstate.cpp b/engines/sword25/util/lua/lstate.cpp
index e542bcbacc..26bed7bec2 100644
--- a/engines/sword25/util/lua/lstate.cpp
+++ b/engines/sword25/util/lua/lstate.cpp
@@ -211,4 +211,3 @@ LUA_API void lua_close (lua_State *L) {
luai_userstateclose(L);
close_state(L);
}
-
diff --git a/engines/sword25/util/lua/lstate.h b/engines/sword25/util/lua/lstate.h
index 94a6249461..05ccb43d5e 100644
--- a/engines/sword25/util/lua/lstate.h
+++ b/engines/sword25/util/lua/lstate.h
@@ -166,4 +166,3 @@ LUAI_FUNC lua_State *luaE_newthread (lua_State *L);
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
#endif
-
diff --git a/engines/sword25/util/lua/lstring.cpp b/engines/sword25/util/lua/lstring.cpp
index cd55cc63bf..046b87ee1c 100644
--- a/engines/sword25/util/lua/lstring.cpp
+++ b/engines/sword25/util/lua/lstring.cpp
@@ -108,4 +108,3 @@ Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
G(L)->mainthread->next = obj2gco(u);
return u;
}
-
diff --git a/engines/sword25/util/lua/lstrlib.cpp b/engines/sword25/util/lua/lstrlib.cpp
index 2a1b8690e2..bcc869cb98 100644
--- a/engines/sword25/util/lua/lstrlib.cpp
+++ b/engines/sword25/util/lua/lstrlib.cpp
@@ -865,4 +865,3 @@ LUALIB_API int luaopen_string (lua_State *L) {
createmetatable(L);
return 1;
}
-
diff --git a/engines/sword25/util/lua/ltablib.cpp b/engines/sword25/util/lua/ltablib.cpp
index 607c09ae71..93be9e6077 100644
--- a/engines/sword25/util/lua/ltablib.cpp
+++ b/engines/sword25/util/lua/ltablib.cpp
@@ -276,4 +276,3 @@ LUALIB_API int luaopen_table (lua_State *L) {
luaL_register(L, LUA_TABLIBNAME, tab_funcs);
return 1;
}
-
diff --git a/engines/sword25/util/lua/ltm.cpp b/engines/sword25/util/lua/ltm.cpp
index 02856a58fc..60ca76689a 100644
--- a/engines/sword25/util/lua/ltm.cpp
+++ b/engines/sword25/util/lua/ltm.cpp
@@ -72,4 +72,3 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
}
return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
}
-
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index f3509e969b..f5affe9fd7 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -723,4 +723,3 @@ union luai_Cast { double l_d; long l_l; };
#endif
-
diff --git a/engines/sword25/util/lua/lvm.cpp b/engines/sword25/util/lua/lvm.cpp
index d0f2198651..d538d0b349 100644
--- a/engines/sword25/util/lua/lvm.cpp
+++ b/engines/sword25/util/lua/lvm.cpp
@@ -760,4 +760,3 @@ void luaV_execute (lua_State *L, int nexeccalls) {
}
}
}
-
diff --git a/engines/sword25/util/lua/lzio.cpp b/engines/sword25/util/lua/lzio.cpp
index e1e7b28a29..d05c613897 100644
--- a/engines/sword25/util/lua/lzio.cpp
+++ b/engines/sword25/util/lua/lzio.cpp
@@ -78,5 +78,3 @@ char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
}
return buff->buffer;
}
-
-
diff --git a/engines/sword25/util/pluto/CHANGELOG b/engines/sword25/util/pluto/CHANGELOG
index e31ed26044..1be321f898 100644
--- a/engines/sword25/util/pluto/CHANGELOG
+++ b/engines/sword25/util/pluto/CHANGELOG
@@ -35,4 +35,3 @@ Earlier versions are changelogged on the LuaForge site.
* Fixed all outstanding 5.0->5.1 conversion issues
* Made heavier use of size_t in preference to int
* Fixed GC/Upval issue (thanks to Eric Jacobs)
-
diff --git a/engines/sword25/util/pluto/FILEFORMAT b/engines/sword25/util/pluto/FILEFORMAT
index b3f10ee603..e7716675c7 100644
--- a/engines/sword25/util/pluto/FILEFORMAT
+++ b/engines/sword25/util/pluto/FILEFORMAT
@@ -165,4 +165,4 @@ struct LocVar {
Object name; /* Name of the local variable */
int startpc; /* Point where variable is active */
int endpc; /* Point where variable is dead */
-}; \ No newline at end of file
+};
diff --git a/engines/sword25/util/pluto/THANKS b/engines/sword25/util/pluto/THANKS
index fea3595dbf..443713fa61 100644
--- a/engines/sword25/util/pluto/THANKS
+++ b/engines/sword25/util/pluto/THANKS
@@ -7,4 +7,3 @@ Goran Adrinek
Eric Jacobs
Anolan Milanes
Malte Thiesen
-
diff --git a/engines/sword25/util/pluto/plzio.cpp b/engines/sword25/util/pluto/plzio.cpp
index 0efc3dfcf2..21f69a9e8d 100644
--- a/engines/sword25/util/pluto/plzio.cpp
+++ b/engines/sword25/util/pluto/plzio.cpp
@@ -72,5 +72,3 @@ char *pdep_openspace (lua_State *L, Mbuffer *buff, size_t n) {
}
return buff->buffer;
}
-
-
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp
index e945bda1e5..56107b67ca 100644
--- a/engines/teenagent/animation.cpp
+++ b/engines/teenagent/animation.cpp
@@ -106,11 +106,11 @@ void Animation::free() {
index = 0;
}
-void Animation::load(Common::SeekableReadStream *s, Type type) {
+void Animation::load(Common::SeekableReadStream &s, Type type) {
//fixme: do not reload the same animation each time
free();
- if (s == NULL || s->size() <= 1) {
+ if (s.size() <= 1) {
debug(1, "empty animation");
return;
}
@@ -119,29 +119,29 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
int off = 0;
switch (type) {
case kTypeLan:
- data_size = s->readUint16LE();
- if (s->eos()) {
+ data_size = s.readUint16LE();
+ if (s.eos()) {
debug(1, "empty animation");
return;
}
data_size -= 2;
data = new byte[data_size];
- data_size = s->read(data, data_size);
+ data_size = s.read(data, data_size);
/* for (int i = 0; i < data_size; ++i) {
debug(0, "%02x ", data[i]);
}
debug(0, ", %u frames", data_size / 3);
*/
- frames_count = s->readByte();
+ frames_count = s.readByte();
debug(1, "%u physical frames", frames_count);
if (frames_count == 0)
return;
frames = new Surface[frames_count];
- s->skip(frames_count * 2 - 2); //sizes
- /*pos = */s->readUint16LE();
+ s.skip(frames_count * 2 - 2); //sizes
+ /*pos = */s.readUint16LE();
//debug(0, "pos?: %04x", pos);
for (uint16 i = 0; i < frames_count; ++i) {
@@ -152,15 +152,15 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
break;
case kTypeInventory: {
- data_size = 3 * s->readByte();
+ data_size = 3 * s.readByte();
data = new byte[data_size];
frames_count = 0;
for (byte i = 0; i < data_size / 3; ++i) {
int idx = i * 3;
/* byte unk = */
- s->readByte();
- data[idx] = s->readByte();
+ s.readByte();
+ data[idx] = s.readByte();
if (data[idx] == 0)
data[idx] = 1; //fixme: investigate
if (data[idx] > frames_count)
@@ -179,17 +179,17 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
break;
case kTypeVaria:
- frames_count = s->readByte();
+ frames_count = s.readByte();
debug(1, "loading varia resource, %u physical frames", frames_count);
uint16 offset[255];
for (byte i = 0; i < frames_count; ++i) {
- offset[i] = s->readUint16LE();
+ offset[i] = s.readUint16LE();
//debug(0, "%u: %04x", i, offset[i]);
}
frames = new Surface[frames_count];
for (uint16 i = 0; i < frames_count; ++i) {
//debug(0, "%04x", offset[i]);
- s->seek(offset[i] + off);
+ s.seek(offset[i] + off);
frames[i].load(s, Surface::kTypeOns);
}
diff --git a/engines/teenagent/animation.h b/engines/teenagent/animation.h
index e98bb42ea0..d9092d1707 100644
--- a/engines/teenagent/animation.h
+++ b/engines/teenagent/animation.h
@@ -35,7 +35,7 @@ public:
enum Type {kTypeLan, kTypeVaria, kTypeInventory};
Animation();
- void load(Common::SeekableReadStream *s, Type type = kTypeLan);
+ void load(Common::SeekableReadStream&, Type type = kTypeLan);
void free();
Surface *firstFrame();
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index 72a338664b..fa5a578636 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -177,9 +177,8 @@ public:
ssd.setDeletableFlag(true);
//checking for the thumbnail
- Common::ScopedPtr<Graphics::Surface> thumb(new Graphics::Surface);
- if (Graphics::loadThumbnail(*in, *thumb))
- ssd.setThumbnail(thumb.release());
+ if (Graphics::Surface *const thumb = Graphics::loadThumbnail(*in))
+ ssd.setThumbnail(thumb);
return ssd;
}
diff --git a/engines/teenagent/font.h b/engines/teenagent/font.h
index 773edaf4e2..5146ace21f 100644
--- a/engines/teenagent/font.h
+++ b/engines/teenagent/font.h
@@ -47,4 +47,3 @@ private:
} // End of namespace TeenAgent
#endif
-
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index 4951b2d940..2b858bbb4d 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -43,7 +43,7 @@ Inventory::Inventory(TeenAgentEngine *engine) {
if (!s)
error("no inventory background");
debug(0, "loading inventory background...");
- _background.load(s, Surface::kTypeOns);
+ _background.load(*s, Surface::kTypeOns);
}
uint32 items_size = varia.getSize(4);
@@ -300,13 +300,13 @@ void Inventory::Item::load(Inventory *inventory, uint item_id) {
if (_animation.empty()) {
debug(0, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
Common::MemoryReadStream s(inventory->_items + inventory->_offset[obj->id - 1], inventory->_offset[obj->id] - inventory->_offset[obj->id - 1]);
- _animation.load(&s, Animation::kTypeInventory);
+ _animation.load(s, Animation::kTypeInventory);
}
} else {
if (_surface.empty()) {
debug(0, "loading item %d from offset %x", obj->id, inventory->_offset[obj->id - 1]);
Common::MemoryReadStream s(inventory->_items + inventory->_offset[obj->id - 1], inventory->_offset[obj->id] - inventory->_offset[obj->id - 1]);
- _surface.load(&s, Surface::kTypeOns);
+ _surface.load(s, Surface::kTypeOns);
}
}
}
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 4be6c9c31a..39b77ea447 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -57,7 +57,7 @@ Scene::Scene(TeenAgentEngine *engine, OSystem *system) : intro(false), _id(0), o
if (!s)
error("invalid resource data");
- teenagent.load(s, Animation::kTypeVaria);
+ teenagent.load(*s, Animation::kTypeVaria);
if (teenagent.empty())
error("invalid mark animation");
@@ -65,7 +65,7 @@ Scene::Scene(TeenAgentEngine *engine, OSystem *system) : intro(false), _id(0), o
if (!s)
error("invalid resource data");
- teenagent_idle.load(s, Animation::kTypeVaria);
+ teenagent_idle.load(*s, Animation::kTypeVaria);
if (teenagent_idle.empty())
error("invalid mark animation");
@@ -340,7 +340,7 @@ void Scene::loadOns() {
for (uint32 i = 0; i < ons_count; ++i) {
Common::ScopedPtr<Common::SeekableReadStream> s(res->ons.getStream(on_id[i]));
if (s) {
- ons[i].load(s, Surface::kTypeOns);
+ ons[i].load(*s, Surface::kTypeOns);
}
}
}
@@ -363,7 +363,7 @@ void Scene::loadLans() {
Common::ScopedPtr<Common::SeekableReadStream> s(res->loadLan000(res_id));
if (s) {
- animation[i].load(s, Animation::kTypeLan);
+ animation[i].load(*s, Animation::kTypeLan);
if (bxv != 0 && bxv != 0xff)
animation[i].id = bxv;
}
@@ -412,7 +412,7 @@ void Scene::init(int id, const Common::Point &pos) {
sub_hack = 2;
}
}
- on.load(stream, SurfaceList::kTypeOn, sub_hack);
+ on.load(*stream, SurfaceList::kTypeOn, sub_hack);
loadOns();
loadLans();
@@ -434,7 +434,7 @@ void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore
if (!s)
error("playing animation %u failed", id);
- custom_animation[idx].load(s);
+ custom_animation[idx].load(*s);
custom_animation[idx].loop = loop;
custom_animation[idx].paused = paused;
custom_animation[idx].ignore = ignore;
@@ -446,7 +446,7 @@ void Scene::playActorAnimation(uint id, bool loop, bool ignore) {
if (!s)
error("playing animation %u failed", id);
- actor_animation.load(s);
+ actor_animation.load(*s);
actor_animation.loop = loop;
actor_animation.ignore = ignore;
actor_animation.id = id;
diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp
index 2e23c7a8ed..e8b5a8ad59 100644
--- a/engines/teenagent/surface.cpp
+++ b/engines/teenagent/surface.cpp
@@ -33,26 +33,26 @@ Surface::~Surface() {
free();
}
-void Surface::load(Common::SeekableReadStream *stream, Type type) {
+void Surface::load(Common::SeekableReadStream &stream, Type type) {
//debug(0, "load()");
free();
x = y = 0;
- uint16 w_ = stream->readUint16LE();
- uint16 h_ = stream->readUint16LE();
+ uint16 w_ = stream.readUint16LE();
+ uint16 h_ = stream.readUint16LE();
if (type != kTypeLan) {
- uint16 pos = stream->readUint16LE();
+ uint16 pos = stream.readUint16LE();
x = pos % 320;
y = pos / 320;
}
//debug(0, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y);
- if (stream->eos() || w_ == 0)
+ if (stream.eos() || w_ == 0)
return;
- if (w_ * h_ > stream->size()) {
+ if (w_ * h_ > stream.size()) {
debug(0, "invalid surface %ux%u -> %u,%u", w_, h_, x, y);
return;
}
@@ -60,7 +60,7 @@ void Surface::load(Common::SeekableReadStream *stream, Type type) {
//debug(0, "creating surface %ux%u -> %u,%u", w_, h_, x, y);
create(w_, h_, Graphics::PixelFormat::createFormatCLUT8());
- stream->read(pixels, w_ * h_);
+ stream.read(pixels, w_ * h_);
}
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect, uint zoom) const {
diff --git a/engines/teenagent/surface.h b/engines/teenagent/surface.h
index 5f74176c68..64e45a7330 100644
--- a/engines/teenagent/surface.h
+++ b/engines/teenagent/surface.h
@@ -40,7 +40,7 @@ public:
Surface();
~Surface();
- void load(Common::SeekableReadStream *stream, Type type);
+ void load(Common::SeekableReadStream&, Type type);
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect(), uint zoom = 256) const;
bool empty() const { return pixels == NULL; }
diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp
index e98153a935..7f7eb1dc38 100644
--- a/engines/teenagent/surface_list.cpp
+++ b/engines/teenagent/surface_list.cpp
@@ -31,11 +31,11 @@ SurfaceList::~SurfaceList() {
free();
}
-void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_hack) {
+void SurfaceList::load(Common::SeekableReadStream &stream, Type type, int sub_hack) {
free();
- byte fn = stream->readByte();
- if (stream->eos())
+ byte fn = stream.readByte();
+ if (stream.eos())
return;
surfaces_n = fn - sub_hack;
@@ -47,11 +47,11 @@ void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_ha
surfaces = new Surface[surfaces_n];
for (byte i = 0; i < surfaces_n; ++i) {
- uint offset = stream->readUint16LE();
- uint pos = stream->pos();
- stream->seek(offset);
+ uint offset = stream.readUint16LE();
+ uint pos = stream.pos();
+ stream.seek(offset);
surfaces[i].load(stream, Surface::kTypeOns);
- stream->seek(pos);
+ stream.seek(pos);
}
}
diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h
index d949a722d6..fcb4fb25c5 100644
--- a/engines/teenagent/surface_list.h
+++ b/engines/teenagent/surface_list.h
@@ -33,7 +33,7 @@ public:
SurfaceList();
~SurfaceList();
- void load(Common::SeekableReadStream *stream, Type type, int sub_hack = 0);
+ void load(Common::SeekableReadStream&, Type type, int sub_hack = 0);
void free();
void render(Graphics::Surface *surface, const Common::Rect & clip) const;
@@ -45,4 +45,3 @@ protected:
}
#endif
-
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 0289b994e6..e6a248334c 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -386,7 +386,7 @@ bool TeenAgentEngine::showLogo() {
}
Surface s;
- s.load(frame, Surface::kTypeOns);
+ s.load(*frame, Surface::kTypeOns);
if (s.empty()) {
free(bg);
return true;
diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp
index 034d3eb27e..aee3ccd294 100644
--- a/engines/testbed/misc.cpp
+++ b/engines/testbed/misc.cpp
@@ -110,7 +110,7 @@ TestExitStatus MiscTests::testDateTime() {
TestExitStatus MiscTests::testTimers() {
int valToModify = 0;
- if (g_system->getTimerManager()->installTimerProc(timerCallback, 100000, &valToModify)) {
+ if (g_system->getTimerManager()->installTimerProc(timerCallback, 100000, &valToModify, "testbedTimer")) {
g_system->delayMillis(150);
g_system->getTimerManager()->removeTimerProc(timerCallback);
@@ -133,7 +133,7 @@ TestExitStatus MiscTests::testMutexes() {
SharedVars sv = {1, 1, true, g_system->createMutex()};
- if (g_system->getTimerManager()->installTimerProc(criticalSection, 100000, &sv)) {
+ if (g_system->getTimerManager()->installTimerProc(criticalSection, 100000, &sv, "testbedMutex")) {
g_system->delayMillis(150);
}
diff --git a/engines/tinsel/coroutine.cpp b/engines/tinsel/coroutine.cpp
index 998d98b52a..ef0097f043 100644
--- a/engines/tinsel/coroutine.cpp
+++ b/engines/tinsel/coroutine.cpp
@@ -80,4 +80,3 @@ CoroBaseContext::~CoroBaseContext() {
}
} // End of namespace Tinsel
-
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 9c52305a1c..1fce032633 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -322,9 +322,21 @@ int TinselMetaEngine::getMaximumSaveSlot() const { return 99; }
void TinselMetaEngine::removeSaveState(const char *target, int slot) const {
Tinsel::setNeedLoad();
- Tinsel::getList(g_system->getSavefileManager(), target);
+ // Same issue here as with loadGameState(): we need the physical savegame
+ // slot. Refer to bug #3387551.
+ int listSlot = -1;
+ const int numStates = Tinsel::getList(g_system->getSavefileManager(), target);
+ for (int i = 0; i < numStates; ++i) {
+ const char *fileName = Tinsel::ListEntry(i, Tinsel::LE_NAME);
+ const int saveSlot = atoi(fileName + strlen(fileName) - 3);
+
+ if (saveSlot == slot) {
+ listSlot = i;
+ break;
+ }
+ }
- g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(slot, Tinsel::LE_NAME));
+ g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(listSlot, Tinsel::LE_NAME));
Tinsel::setNeedLoad();
Tinsel::getList(g_system->getSavefileManager(), target);
}
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 7a973ba4be..4ac172be43 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -154,8 +154,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
syncTime(s, hdr.dateTime);
int tmp = hdr.size - s.bytesSynced();
+
+ // NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
+ // as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
+ // or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
+ // deleted anyway. Refer to bug #3387551.
+ bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);
+
// Perform sanity check
- if (tmp < 0 || hdr.id != SAVEGAME_ID || hdr.ver > CURRENT_VER || hdr.size > 1024)
+ if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
return false;
// Skip over any extra bytes
s.skip(tmp);
diff --git a/engines/tinsel/strres.h b/engines/tinsel/strres.h
index a63824a863..f6e86951b6 100644
--- a/engines/tinsel/strres.h
+++ b/engines/tinsel/strres.h
@@ -96,4 +96,3 @@ SCNHANDLE LanguageFlag(LANGUAGE thisOne);
} // End of namespace Tinsel
#endif
-
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 30b060766e..e18216cdf7 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -31,9 +31,6 @@
#include "common/random.h"
#include "common/util.h"
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
-
#include "engines/engine.h"
#include "tinsel/debugger.h"
#include "tinsel/graphics.h"
@@ -53,6 +50,7 @@ namespace Tinsel {
class BMVPlayer;
class Config;
+class MidiDriver;
class MidiMusicPlayer;
class PCMMusicPlayer;
class Scheduler;
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 0bf3316209..4a4a84e62c 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -613,4 +613,3 @@ void AudioManager::updateAmbientSFX()
}
} // End of namespace Toon
-
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 022214157a..7d9a31c170 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -1109,4 +1109,3 @@ void Character::updateIdle() {
}
}
} // End of namespace Toon
-
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index 810a37720a..ac4caae8b2 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -224,12 +224,7 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s
SaveStateDescriptor desc(slot, saveName);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*file, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp
index 89438fb35c..df5cfcfa03 100644
--- a/engines/toon/drew.cpp
+++ b/engines/toon/drew.cpp
@@ -129,4 +129,3 @@ void CharacterDrew::resetScale()
setPosition(_x, _y);
}
} // End of namespace Toon
-
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 62458ad800..ee81b87417 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -149,4 +149,3 @@ HotspotData *Hotspots::Get(int32 id) {
}
} // End of namespace Toon
-
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index eed781295a..69ae727bb5 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -502,4 +502,3 @@ void EMCInterpreter::loadState(EMCState *script, Common::ReadStream *stream) {
}
} // End of namespace Toon
-
diff --git a/engines/toon/script.h b/engines/toon/script.h
index 9dd00dca80..8ef085f383 100644
--- a/engines/toon/script.h
+++ b/engines/toon/script.h
@@ -148,4 +148,3 @@ private:
} // End of namespace Toon
#endif
-
diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp
index d266d5e1d9..3cf31b0b0a 100644
--- a/engines/tsage/blueforce_logic.cpp
+++ b/engines/tsage/blueforce_logic.cpp
@@ -21,6 +21,7 @@
*/
#include "tsage/blueforce_logic.h"
+#include "tsage/blueforce_scenes0.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
@@ -37,6 +38,8 @@ void BlueForceGame::start() {
Scene *BlueForceGame::createScene(int sceneNumber) {
switch (sceneNumber) {
case 20:
+ // Tsunami Title Screen
+ return new BF_Scene20();
case 50:
case 60:
error("Scene group 0 not implemented");
diff --git a/engines/tsage/blueforce_scenes0.cpp b/engines/tsage/blueforce_scenes0.cpp
new file mode 100644
index 0000000000..4a0259cb98
--- /dev/null
+++ b/engines/tsage/blueforce_scenes0.cpp
@@ -0,0 +1,196 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "tsage/blueforce_scenes0.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace tSage {
+
+/*--------------------------------------------------------------------------
+ * Scene 20 - Tsunami Title Screen
+ *
+ *--------------------------------------------------------------------------*/
+
+void BF_Scene20::Action1::signal() {
+ BF_Scene20 *scene = (BF_Scene20 *)_globals->_sceneManager._scene;
+ static byte black[3] = { 0, 0, 0 };
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(2);
+ break;
+ case 1:
+ _sound.play(1);
+ _globals->_scenePalette.addRotation(64, 127, -1, 1, this);
+ break;
+ case 2:
+ scene->_object1.setVisage(22);
+ scene->_object1._strip = 1;
+ scene->_object1._frame = 1;
+ scene->_object1.changeZoom(100);
+
+ scene->_object2.setVisage(22);
+ scene->_object2._strip = 2;
+ scene->_object2._frame = 1;
+ scene->_object2.changeZoom(100);
+
+ scene->_object3.setVisage(22);
+ scene->_object3._strip = 3;
+ scene->_object3._frame = 1;
+ scene->_object3.changeZoom(100);
+
+ scene->_object4.setVisage(22);
+ scene->_object4._strip = 4;
+ scene->_object4._frame = 1;
+ scene->_object4.changeZoom(100);
+
+ scene->_object5.setVisage(22);
+ scene->_object5._strip = 5;
+ scene->_object5._frame = 1;
+ scene->_object5.changeZoom(100);
+
+ scene->_object6.setVisage(22);
+ scene->_object6._strip = 6;
+ scene->_object6._frame = 1;
+ scene->_object6.changeZoom(100);
+
+ scene->_object7.setVisage(22);
+ scene->_object7._strip = 7;
+ scene->_object7._frame = 1;
+ scene->_object7.changeZoom(100);
+
+ scene->_object8.setVisage(22);
+ scene->_object8._strip = 8;
+ scene->_object8._frame = 1;
+ scene->_object8.changeZoom(100);
+
+ setDelay(1);
+ break;
+ case 3:
+ _globals->_scenePalette.addFader(scene->_scenePalette._palette, 256, 8, this);
+ break;
+ case 4:
+ setDelay(60);
+ break;
+ case 5:
+ scene->_object2.animate(ANIM_MODE_5, NULL);
+ scene->_object3.animate(ANIM_MODE_5, NULL);
+ scene->_object4.animate(ANIM_MODE_5, NULL);
+ scene->_object5.animate(ANIM_MODE_5, NULL);
+ scene->_object6.animate(ANIM_MODE_5, NULL);
+ scene->_object7.animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ setDelay(120);
+ break;
+ case 7:
+ _globals->_scenePalette.addFader(black, 1, 5, this);
+ break;
+ case 8:
+ _globals->_sceneManager.changeScene(100);
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void BF_Scene20::postInit(SceneObjectList *OwnerList) {
+ loadScene(20);
+ Scene::postInit();
+ setZoomPercents(60, 85, 200, 100);
+
+ preloadVisage(21);
+ preloadVisage(22);
+ _scenePalette.loadPalette(1);
+ _scenePalette.loadPalette(22);
+
+ _object1.postInit();
+ _object1.setVisage(21);
+ _object1._strip = 1;
+ _object1._frame = 1;
+ _object1.animate(ANIM_MODE_NONE, NULL);
+ _object1.setPosition(Common::Point(62, 85));
+ _object1.changeZoom(100);
+
+ _object2.postInit();
+ _object2.setVisage(21);
+ _object2._strip = 2;
+ _object2._frame = 1;
+ _object2.animate(ANIM_MODE_NONE, NULL);
+ _object2.setPosition(Common::Point(27, 94));
+ _object2.changeZoom(100);
+
+ _object3.postInit();
+ _object3.setVisage(21);
+ _object3._strip = 2;
+ _object3._frame = 2;
+ _object3.animate(ANIM_MODE_NONE, NULL);
+ _object3.setPosition(Common::Point(68, 94));
+ _object3.changeZoom(100);
+
+ _object4.postInit();
+ _object4.setVisage(21);
+ _object4._strip = 2;
+ _object4._frame = 3;
+ _object4.animate(ANIM_MODE_NONE, NULL);
+ _object4.setPosition(Common::Point(110, 94));
+ _object4.changeZoom(100);
+
+ _object5.postInit();
+ _object5.setVisage(21);
+ _object5._strip = 2;
+ _object5._frame = 4;
+ _object5.animate(ANIM_MODE_NONE, NULL);
+ _object5.setPosition(Common::Point(154, 94));
+ _object5.changeZoom(100);
+
+ _object6.postInit();
+ _object6.setVisage(21);
+ _object6._strip = 2;
+ _object6._frame = 5;
+ _object6.animate(ANIM_MODE_NONE, NULL);
+ _object6.setPosition(Common::Point(199, 94));
+ _object6.changeZoom(100);
+
+ _object7.postInit();
+ _object7.setVisage(21);
+ _object7._strip = 2;
+ _object7._frame = 6;
+ _object7.animate(ANIM_MODE_NONE, NULL);
+ _object7.setPosition(Common::Point(244, 94));
+ _object7.changeZoom(100);
+
+ _object8.postInit();
+ _object8.setVisage(21);
+ _object8._strip = 2;
+ _object8._frame = 7;
+ _object8.animate(ANIM_MODE_NONE, NULL);
+ _object8.setPosition(Common::Point(286, 94));
+ _object8.changeZoom(100);
+
+ setAction(&_action1);
+}
+
+} // End of namespace tSage
diff --git a/engines/tsage/blueforce_scenes0.h b/engines/tsage/blueforce_scenes0.h
new file mode 100644
index 0000000000..06f7912959
--- /dev/null
+++ b/engines/tsage/blueforce_scenes0.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES0_H
+#define TSAGE_BLUEFORCE_SCENES0_H
+
+#include "common/scummsys.h"
+#include "tsage/blueforce_logic.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace tSage {
+
+class BF_Scene20 : public Scene {
+ /* Actions */
+ class Action1 : public Action {
+ private:
+ ASoundExt _sound;
+ public:
+ virtual void signal();
+ };
+public:
+ Action1 _action1;
+ ScenePalette _scenePalette;
+ SceneObject _object1, _object2, _object3, _object4;
+ SceneObject _object5, _object6, _object7, _object8;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+};
+
+} // End of namespace tSage
+
+#endif
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index aaa9030a04..c8aa415914 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -59,7 +59,7 @@ Common::String TSageEngine::getPrimaryFilename() const {
static const PlainGameDescriptor tSageGameTitles[] = {
{ "tsage", "Unknown Tsunami TSAGE-based Game" },
- { "ring", "Ringworld: Revenge of the Patriarch" },
+ { "ringworld", "Ringworld: Revenge of the Patriarch" },
{ "blueforce", "Blue Force" },
{ 0, 0 }
};
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index f9ced562c2..7fbfa55c95 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -27,12 +27,12 @@ static const tSageGameDescription gameDescriptions[] = {
// Ringworld English CD and First Wave versions
{
{
- "ring",
+ "ringworld",
"CD",
AD_ENTRY1s("ring.rlb", "466f0e6492d9d0f34d35c5cd088de90f", 37847618),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
},
GType_Ringworld,
@@ -41,12 +41,12 @@ static const tSageGameDescription gameDescriptions[] = {
// Ringworld Spanish CD
{
{
- "ring",
+ "ringworld",
"CD",
AD_ENTRY1s("ring.rlb", "cb8bba91b30cd172712371d7123bd763", 7427980),
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
},
GType_Ringworld,
@@ -55,12 +55,12 @@ static const tSageGameDescription gameDescriptions[] = {
// Ringworld English Floppy version
{
{
- "ring",
+ "ringworld",
"Floppy",
AD_ENTRY1s("ring.rlb", "7b7f0c5b37b58fa5ec06ebb2ca0d0d9d", 8438770),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
},
GType_Ringworld,
@@ -69,7 +69,7 @@ static const tSageGameDescription gameDescriptions[] = {
// Ringworld English Floppy Demo #1 version
{
{
- "ring",
+ "ringworld",
"Floppy Demo",
AD_ENTRY1s("tsage.rlb", "3b3604a97c06c91f3735d3e9d341f63f", 833453),
Common::EN_ANY,
@@ -84,7 +84,7 @@ static const tSageGameDescription gameDescriptions[] = {
// Ringworld English Floppy Demo #2 version
{
{
- "ring",
+ "ringworld",
"Floppy Demo",
AD_ENTRY1s("demoring.rlb", "64050e1806203b15bb03876140eb4f56", 832206),
Common::EN_ANY,
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index 010117ec78..7aadf62b8d 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -40,6 +40,7 @@ EventsClass::EventsClass() {
_priorFrameTime = 0;
_prevDelayFrame = 0;
_saver->addListener(this);
+ _saver->addLoadNotifier(&EventsClass::loadNotifierProc);
}
bool EventsClass::pollEvent() {
@@ -315,4 +316,13 @@ void EventsClass::listenerSynchronize(Serializer &s) {
}
}
+void EventsClass::loadNotifierProc(bool postFlag) {
+ if (postFlag) {
+ if (_globals->_events._lastCursor == CURSOR_NONE)
+ _globals->_events._lastCursor = _globals->_events._currentCursor;
+ else
+ _globals->_events._lastCursor = CURSOR_NONE;
+ }
+}
+
} // end of namespace tSage
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index e0fbd88745..772de24b5a 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -100,6 +100,7 @@ public:
void delay(int numFrames);
virtual void listenerSynchronize(Serializer &s);
+ static void loadNotifierProc(bool postFlag);
};
} // End of namespace tSage
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index aefc8b0992..586699593d 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/tsage
MODULE_OBJS := \
blueforce_logic.o \
+ blueforce_scenes0.o \
converse.o \
core.o \
debugger.o \
@@ -34,4 +35,3 @@ endif
# Include common rules
include $(srcdir)/rules.mk
-
diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp
index ba4060548e..839fa0f008 100644
--- a/engines/tsage/ringworld_scenes10.cpp
+++ b/engines/tsage/ringworld_scenes10.cpp
@@ -1746,7 +1746,8 @@ void Scene9900::strAction2::signal() {
frameWidth = _txtArray2[_txtArray1Index].getFrame().getBounds().width();
_txtArray2[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200 + frameHeight));
} else {
- _globals->_player.enableControl();
+ // WORKAROUND: Fix inventory becoming available at end of credits
+ _globals->_events.setCursor(CURSOR_WALK);
_actionIndex = 3;
signal();
}
diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp
index 3f9921b0ad..209144766a 100644
--- a/engines/tsage/ringworld_scenes3.cpp
+++ b/engines/tsage/ringworld_scenes3.cpp
@@ -324,7 +324,7 @@ void Scene2000::Action14::signal() {
scene->_stripManager.start(2001, this, scene);
break;
case 6:
- _globals->_soundHandler.fadeOut(0/* was false */);
+ _globals->_soundHandler.fadeOut(NULL);
scene->_object8.setStrip(1);
scene->_object8.setFrame(scene->_object8.getFrameCount());
scene->_object8.animate(ANIM_MODE_6, this);
@@ -786,7 +786,7 @@ void Scene2100::Action9::signal() {
scene->_stripManager.start(6051, this, scene);
break;
case 4:
- scene->_soundHandler.fadeOut(0/* was false */);
+ scene->_soundHandler.fadeOut(NULL);
scene->_object4.setStrip(1);
scene->_object4.setFrame(scene->_object4.getFrameCount());
scene->_object4.animate(ANIM_MODE_6, this);
@@ -1105,7 +1105,7 @@ void Scene2100::Action14::signal() {
scene->_stripManager.start(6009, this, scene);
break;
case 6:
- scene->_soundHandler.fadeOut(0/* was false */);
+ scene->_soundHandler.fadeOut(NULL);
scene->_object4.setStrip(1);
scene->_object4.setFrame(scene->_object4.getFrameCount());
scene->_object4.animate(ANIM_MODE_6, this);
diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp
index 2b329b958a..d0e7491d4a 100644
--- a/engines/tsage/ringworld_scenes8.cpp
+++ b/engines/tsage/ringworld_scenes8.cpp
@@ -2223,7 +2223,7 @@ void Scene7700::signal() {
}
break;
case 7702:
- _soundHandler.fadeOut(0);
+ _globals->_soundHandler.fadeOut(NULL);
_globals->_sceneManager.changeScene(7600);
break;
case 7703:
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index 40444cd630..e07964d443 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -249,12 +249,9 @@ bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &head
while ((ch = (char)in->readByte()) != '\0') header.saveName += ch;
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
// Read in save date/time
header.saveYear = in->readSint16LE();
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index b94e95c696..9a175ea08f 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -28,6 +28,9 @@
namespace tSage {
+// TODO: Doesn't seem to be ever set
+const bool _v52C9F = false;
+
SceneManager::SceneManager() {
_scene = NULL;
_hasPalette = false;
@@ -45,7 +48,7 @@ SceneManager::~SceneManager() {
}
void SceneManager::setNewScene(int sceneNumber) {
- warning("SetNewScene(%d)", sceneNumber);
+ debug(1, "SetNewScene(%d)", sceneNumber);
_nextSceneNumber = sceneNumber;
}
@@ -146,7 +149,7 @@ void SceneManager::fadeInIfNecessary() {
}
void SceneManager::changeScene(int newSceneNumber) {
- warning("changeScene(%d)", newSceneNumber);
+ debug(1, "changeScene(%d)", newSceneNumber);
// Fade out the scene
ScenePalette scenePalette;
uint32 adjustData = 0;
@@ -173,6 +176,11 @@ void SceneManager::changeScene(int newSceneNumber) {
// Blank out the screen
_globals->_screenSurface.fillRect(_globals->_screenSurface.getBounds(), 0);
+ // If there are any fading sounds, wait until fading is complete
+ while (_globals->_soundManager.isFading()) {
+ g_system->delayMillis(10);
+ }
+
// Set the new scene to be loaded
setNewScene(newSceneNumber);
}
@@ -296,7 +304,7 @@ void Scene::dispatch() {
}
void Scene::loadScene(int sceneNum) {
- warning("loadScene(%d)", sceneNum);
+ debug(1, "loadScene(%d)", sceneNum);
_screenNumber = sceneNum;
if (_globals->_scenePalette.loadPalette(sceneNum))
_globals->_sceneManager._hasPalette = true;
@@ -496,6 +504,11 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
_zoomPercents[yEnd++] = minPercent;
}
+byte *Scene::preloadVisage(int resNum) {
+ assert(!_v52C9F);
+ return _resourceManager->getResource(RES_VISAGE, resNum, 9999, false);
+}
+
/*--------------------------------------------------------------------------*/
void Game::execute() {
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index 5845efaec9..665da585f8 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -67,6 +67,7 @@ public:
void loadBackground(int xAmount, int yAmount);
void refreshBackground(int xAmount, int yAmount);
void loadSceneData(int sceneNum);
+ byte *preloadVisage(int resNum);
};
class SceneManager : public GameHandler, public SaveListener {
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 69ac426964..efffa70574 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -85,7 +85,7 @@ void SoundManager::postInit() {
// it handles updates for both music and Fx. However, since Adlib updates also get done in a
// thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to
// call the update method, rather than having it be called separately
-// g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL);
+// g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL, "tsageSoundUpdate");
__sndmgrReady = true;
}
}
@@ -360,9 +360,6 @@ void SoundManager::rethinkVoiceTypes() {
}
void SoundManager::_sfSoundServer() {
- Common::StackLock slock1(sfManager()._serverDisabledMutex);
- Common::StackLock slock2(sfManager()._serverSuspendedMutex);
-
if (sfManager()._needToRethink) {
_sfRethinkVoiceTypes();
sfManager()._needToRethink = false;
@@ -454,6 +451,22 @@ void SoundManager::_sfProcessFading() {
}
}
+bool SoundManager::isFading() {
+ Common::StackLock slock(sfManager()._serverSuspendedMutex);
+
+ // Loop through any active sounds to see if any are being actively faded
+ Common::List<Sound *>::iterator i = sfManager()._playList.begin();
+ while (i != sfManager()._playList.end()) {
+ Sound *s = *i;
+ ++i;
+
+ if (s->_fadeDest != -1)
+ return true;
+ }
+
+ return false;
+}
+
void SoundManager::_sfUpdateVoiceStructs() {
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
VoiceTypeStruct *vs = sfManager()._voiceTypeStructPtrs[voiceIndex];
@@ -1344,7 +1357,7 @@ bool SoundManager::_sfInstallDriver(SoundDriver *driver) {
sfManager()._installedDrivers.push_back(driver);
driver->_groupOffset = driver->getGroupData();
- driver->_groupMask = READ_LE_UINT32(driver->_groupOffset);
+ driver->_groupMask = driver->_groupOffset->groupMask;
_sfExtractGroupMask();
_sfRethinkSoundDrivers();
@@ -2163,13 +2176,14 @@ void Sound::_soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, in
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
+ byte *trackData = _channelData[trackCtr];
vtStruct->_entries[entryIndex]._type1._field6 = 0;
vtStruct->_entries[entryIndex]._type1._field4 = v0;
vtStruct->_entries[entryIndex]._type1._field5 = 0;
int v1, v2;
- driver->playSound(channelData, 14, -1, vtStruct->_entries[entryIndex]._voiceNum, v0, 0x7F);
+ driver->playSound(trackData, 14, -1, vtStruct->_entries[entryIndex]._voiceNum, v0, 0x7F);
driver->proc42(vtStruct->_entries[entryIndex]._voiceNum, voiceType, 0, &v1, &v2);
}
break;
@@ -2441,6 +2455,27 @@ void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFade
_sound.fade(fadeDest, fadeSteps, fadeTicks, stopAfterFadeFlag);
}
+void ASound::fadeSound(int soundNum) {
+ play(soundNum, NULL, 0);
+ fade(127, 5, 1, false, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+
+ASoundExt::ASoundExt(): ASound() {
+ _soundNum = 0;
+}
+
+void ASoundExt::synchronize(Serializer &s) {
+ ASound::synchronize(s);
+ s.syncAsSint16LE(_soundNum);
+}
+
+void ASoundExt::signal() {
+ if (_soundNum != 0) {
+ fadeSound(_soundNum);
+ }
+}
/*--------------------------------------------------------------------------*/
@@ -2760,6 +2795,9 @@ void AdlibSoundDriver::setFrequency(int channel) {
}
int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
+ Common::StackLock slock1(SoundManager::sfManager()._serverDisabledMutex);
+ Common::StackLock slock2(SoundManager::sfManager()._serverSuspendedMutex);
+
int32 samplesLeft = numSamples;
memset(buffer, 0, sizeof(int16) * numSamples);
while (samplesLeft) {
@@ -2775,7 +2813,7 @@ int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
}
}
- int32 render = MIN(samplesLeft, _samplesTillCallback);
+ int32 render = MIN<int>(samplesLeft, _samplesTillCallback);
samplesLeft -= render;
_samplesTillCallback -= render;
@@ -2787,8 +2825,6 @@ int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
/*--------------------------------------------------------------------------*/
-const byte soundBlaster_group_data[] = { 3, 1, 1, 0, 0xff };
-
SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
_minVersion = 0x102;
@@ -2798,7 +2834,8 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
_groupData.groupMask = 1;
_groupData.v1 = 0x3E;
_groupData.v2 = 0;
- _groupData.pData = &soundBlaster_group_data[0];
+ static byte const group_data[] = { 3, 1, 1, 0, 0xff };
+ _groupData.pData = group_data;
_mixer = _vm->_mixer;
_sampleRate = _mixer->getOutputRate();
@@ -2871,6 +2908,7 @@ void SoundBlasterDriver::proc38(int channel, int cmd, int value) {
if (cmd == 7) {
// Set channel volume
_channelVolume = value;
+ _mixer->setChannelVolume(_soundHandle, (byte)MIN(255, value * 2));
}
}
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 702a2776f7..2c9221c27a 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -225,6 +225,7 @@ public:
int getMasterVol() const;
void loadSound(int soundNum, bool showErrors);
void unloadSound(int soundNum);
+ bool isFading();
// _sf methods
static SoundManager &sfManager();
@@ -397,8 +398,20 @@ public:
int getVol() const { return _sound.getVol(); }
void holdAt(int v) { _sound.holdAt(v); }
void release() { _sound.release(); }
+ void fadeSound(int soundNum);
};
+class ASoundExt: public ASound {
+public:
+ int _soundNum;
+
+ ASoundExt();
+ virtual Common::String getClassName() { return "ASoundExt"; }
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+};
+
+
#define ADLIB_CHANNEL_COUNT 9
class AdlibSoundDriver: public SoundDriver, Audio::AudioStream {