aboutsummaryrefslogtreecommitdiff
path: root/engines/made
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-18 23:34:29 +0200
committerWillem Jan Palenstijn2013-05-08 20:39:44 +0200
commit01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6 (patch)
tree544b07f3aa41abe7907bcd2040cdad11ebc324bb /engines/made
parent9cf2c83e5e5a35816ab153bf8443dac691829ea8 (diff)
parenta41d72a44a660c72fdadbc3a8ef580e5e03cb890 (diff)
downloadscummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.tar.gz
scummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.tar.bz2
scummvm-rg350-01f3f3a8dd0ad2891939d03b0ce47cbf36ea9bc6.zip
Merge branch 'master'
Diffstat (limited to 'engines/made')
-rw-r--r--engines/made/database.cpp14
-rw-r--r--engines/made/database.h14
-rw-r--r--engines/made/detection.cpp93
-rw-r--r--engines/made/graphics.cpp7
-rw-r--r--engines/made/graphics.h9
-rw-r--r--engines/made/made.cpp34
-rw-r--r--engines/made/made.h27
-rw-r--r--engines/made/music.cpp7
-rw-r--r--engines/made/music.h6
-rw-r--r--engines/made/pmvplayer.cpp10
-rw-r--r--engines/made/pmvplayer.h22
-rw-r--r--engines/made/redreader.cpp3
-rw-r--r--engines/made/redreader.h9
-rw-r--r--engines/made/resource.cpp16
-rw-r--r--engines/made/resource.h22
-rw-r--r--engines/made/screen.cpp8
-rw-r--r--engines/made/screen.h11
-rw-r--r--engines/made/screenfx.cpp129
-rw-r--r--engines/made/screenfx.h25
-rw-r--r--engines/made/script.cpp8
-rw-r--r--engines/made/script.h3
-rw-r--r--engines/made/scriptfuncs.cpp22
-rw-r--r--engines/made/scriptfuncs.h10
-rw-r--r--engines/made/sound.cpp6
-rw-r--r--engines/made/sound.h3
25 files changed, 276 insertions, 242 deletions
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 004f1462a6..454fe09a38 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -20,13 +20,15 @@
*
*/
-#include "common/system.h"
+#include "made/database.h"
+#include "made/redreader.h"
+
#include "common/endian.h"
-#include "common/util.h"
+#include "common/stream.h"
+#include "common/debug.h"
+#include "common/file.h"
#include "common/savefile.h"
-#include "common/textconsole.h"
-
-#include "made/database.h"
+#include "common/system.h"
namespace Made {
@@ -494,6 +496,7 @@ int16 GameDatabaseV2::savegame(const char *filename, const char *description, in
out->write(_gameState + 2, _gameStateSize - 2);
for (uint i = 0; i < _objects.size(); i++)
_objects[i]->save(*out);
+ out->finalize();
delete out;
return result;
}
@@ -697,6 +700,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in
out->writeUint16LE(version);
out->write(desc, 64);
out->write(_gameState, _gameStateSize);
+ out->finalize();
delete out;
return result;
}
diff --git a/engines/made/database.h b/engines/made/database.h
index 3bf69ca116..63f0557196 100644
--- a/engines/made/database.h
+++ b/engines/made/database.h
@@ -23,18 +23,18 @@
#ifndef MADE_DATABASE_H
#define MADE_DATABASE_H
-#include "common/array.h"
#include "common/hashmap.h"
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "common/str.h"
-#include "made/made.h"
-#include "made/redreader.h"
+namespace Common {
+class SeekableReadStream;
+class WriteStream;
+class String;
+}
namespace Made {
+class MadeEngine;
+
class Object {
public:
diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp
index e8c948af4e..2a9beed5c4 100644
--- a/engines/made/detection.cpp
+++ b/engines/made/detection.cpp
@@ -20,13 +20,9 @@
*
*/
-#include "base/plugins.h"
-
-#include "engines/advancedDetector.h"
-#include "common/file.h"
-
#include "made/made.h"
+#include "engines/advancedDetector.h"
namespace Made {
@@ -69,9 +65,6 @@ static const PlainGameDescriptor madeGames[] = {
namespace Made {
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-
static const MadeGameDescription gameDescriptions[] = {
{
// NOTE: Return to Zork entries with *.dat are used to detect the game via rtzcd.dat,
@@ -87,7 +80,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -104,8 +97,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("rtzcd.red", "cd8b62ece4677c438688c1de3f5379b9"),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -121,8 +114,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.dat", "a1db8c97a78dae10f91d356f16ad07b8", 536064),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -138,8 +131,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.red", "c4e2430e6b6c6ff1562a80fb4a9df24c", 276177),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -156,8 +149,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("rtzcd.dat", "9d740378da2d16e83d0d0efff01bf83a"),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -173,8 +166,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 276584),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -191,8 +184,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.dat", "9d740378da2d16e83d0d0efff01bf83a", 525824),
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -209,8 +202,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 355442),
Common::DE_DEU,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -227,8 +220,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.dat", "5b86035aed0277f96e3d173542b5364a", 523776),
Common::IT_ITA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -245,8 +238,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354971),
Common::IT_ITA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -263,8 +256,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.dat", "bde8251a8e34e87c54e3f93147d56c9e", 523776),
Common::FR_FRA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -281,8 +274,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354614),
Common::FR_FRA,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -299,7 +292,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_RTZ,
0,
@@ -316,7 +309,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -333,8 +326,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("rtzcd.dat", "c4fccf67ad247f09b94c3c808b138576"),
Common::JA_JPN,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -351,8 +344,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("rtzcd.dat", "e949a6a42d82daabfa7d4dc0a87a9843"),
Common::JA_JPN,
Common::kPlatformFMTowns,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -369,8 +362,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("rtzcd.dat", "0c0117e98530c736a141c2aad6834dc5"),
Common::JA_JPN,
Common::kPlatformPC98,
- ADGF_NO_FLAGS,
- GUIO_NONE
+ ADGF_CD,
+ GUIO1(GUIO_NONE)
},
GID_RTZ,
0,
@@ -386,8 +379,8 @@ static const MadeGameDescription gameDescriptions[] = {
AD_ENTRY1("manhole.dat", "cb21e31ed35c963208343bc995225b73"),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ ADGF_CD,
+ GUIO1(GUIO_NOSPEECH)
},
GID_MANHOLE,
0,
@@ -404,7 +397,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_MANHOLE,
0,
@@ -421,7 +414,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -439,7 +432,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -457,7 +450,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -475,7 +468,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -492,7 +485,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_RODNEY,
0,
@@ -515,7 +508,7 @@ static MadeGameDescription g_fallbackDesc = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NONE)
},
0,
0,
@@ -542,7 +535,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
- const ADGameDescription *fallbackDetect(const Common::FSList &fslist, const FileMap &allFiles) const;
+ const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const;
};
@@ -564,7 +557,7 @@ bool MadeMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame
return gd != 0;
}
-const ADGameDescription *MadeMetaEngine::fallbackDetect(const Common::FSList &fslist, const FileMap &allFiles) const {
+const ADGameDescription *MadeMetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
// Set the default values for the fallback descriptor's ADGameDescription part.
Made::g_fallbackDesc.desc.language = Common::UNK_LANG;
Made::g_fallbackDesc.desc.platform = Common::kPlatformPC;
diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp
index 3ac73617c1..30496d8595 100644
--- a/engines/made/graphics.cpp
+++ b/engines/made/graphics.cpp
@@ -20,11 +20,14 @@
*
*/
-#include "common/debug.h"
+#include "made/graphics.h"
+
#include "common/endian.h"
#include "common/textconsole.h"
+#include "common/debug.h"
+#include "common/util.h"
-#include "made/graphics.h"
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/graphics.h b/engines/made/graphics.h
index 691f1127c2..15704c7792 100644
--- a/engines/made/graphics.h
+++ b/engines/made/graphics.h
@@ -23,10 +23,11 @@
#ifndef MADE_GRAPHICS_H
#define MADE_GRAPHICS_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "graphics/surface.h"
+#include "common/scummsys.h"
+
+namespace Graphics {
+struct Surface;
+}
namespace Made {
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 75d39fa205..3843040961 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -20,31 +20,23 @@
*
*/
-#include "common/events.h"
-#include "common/keyboard.h"
-#include "common/config-manager.h"
-#include "common/stream.h"
-
-#include "graphics/cursorman.h"
-
-#include "engines/util.h"
-
-#include "backends/audiocd/audiocd.h"
-
-#include "base/plugins.h"
-#include "base/version.h"
-
-#include "audio/mixer.h"
-
#include "made/made.h"
-#include "made/database.h"
+#include "made/console.h"
#include "made/pmvplayer.h"
#include "made/resource.h"
#include "made/screen.h"
+#include "made/database.h"
#include "made/script.h"
-#include "made/sound.h"
#include "made/music.h"
-#include "made/redreader.h"
+
+#include "common/config-manager.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "common/error.h"
+
+#include "engines/util.h"
+
+#include "backends/audiocd/audiocd.h"
namespace Made {
@@ -143,6 +135,10 @@ int16 MadeEngine::getTicks() {
return g_system->getMillis() * 30 / 1000;
}
+GUI::Debugger *MadeEngine::getDebugger() {
+ return _console;
+}
+
int16 MadeEngine::getTimer(int16 timerNum) {
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers) && _timers[timerNum - 1] != -1)
return (getTicks() - _timers[timerNum - 1]);
diff --git a/engines/made/made.h b/engines/made/made.h
index e9673eed3c..c0b86bb0a8 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -20,30 +20,14 @@
*
*/
-#ifndef MADE_H
-#define MADE_H
-
-#include "common/scummsys.h"
-#include "common/endian.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/hash-str.h"
-#include "common/keyboard.h"
-#include "common/random.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "common/util.h"
-
-#include "graphics/surface.h"
+#ifndef MADE_MADE_H
+#define MADE_MADE_H
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/voc.h"
+#include "made/sound.h"
#include "engines/engine.h"
-#include "made/sound.h"
-#include "made/console.h"
+#include "common/random.h"
/**
* This is the namespace of the Made engine.
@@ -82,6 +66,7 @@ class Screen;
class ScriptInterpreter;
class GameDatabase;
class MusicPlayer;
+class MadeConsole;
class MadeEngine : public ::Engine {
int _gameId;
@@ -98,7 +83,7 @@ public:
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
- GUI::Debugger *getDebugger() { return _console; }
+ virtual GUI::Debugger *getDebugger();
int getGameId() {
return _gameId;
diff --git a/engines/made/music.cpp b/engines/made/music.cpp
index 146d8d6371..04ac13eeda 100644
--- a/engines/made/music.cpp
+++ b/engines/made/music.cpp
@@ -24,11 +24,10 @@
// MIDI and digital music class
-#include "audio/audiostream.h"
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
-
#include "made/music.h"
+#include "made/resource.h"
+
+#include "audio/midiparser.h"
namespace Made {
diff --git a/engines/made/music.h b/engines/made/music.h
index 1a5bae3040..3cfbd50ce7 100644
--- a/engines/made/music.h
+++ b/engines/made/music.h
@@ -26,13 +26,11 @@
#define MADE_MUSIC_H
#include "audio/midiplayer.h"
-#include "audio/midiparser.h"
-#include "common/mutex.h"
-
-#include "made/resource.h"
namespace Made {
+class GenericResource;
+
enum MusicFlags {
MUSIC_NORMAL = 0,
MUSIC_LOOP = 1
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 386d618273..6c4749f44d 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -21,9 +21,19 @@
*/
#include "made/pmvplayer.h"
+#include "made/made.h"
#include "made/screen.h"
+#include "made/graphics.h"
+
+#include "common/file.h"
+#include "common/debug.h"
+#include "common/system.h"
+#include "common/events.h"
#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
+
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/pmvplayer.h b/engines/made/pmvplayer.h
index 58b6eafd2b..3821ca8de1 100644
--- a/engines/made/pmvplayer.h
+++ b/engines/made/pmvplayer.h
@@ -23,20 +23,24 @@
#ifndef MADE_PMVPLAYER_H
#define MADE_PMVPLAYER_H
-#include "common/system.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/endian.h"
-#include "graphics/surface.h"
#include "audio/mixer.h"
-#include "audio/audiostream.h"
-#include "made/graphics.h"
-#include "made/sound.h"
-#include "made/made.h"
+namespace Common {
+class File;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
+namespace Audio {
+class QueuingAudioStream;
+}
namespace Made {
+class MadeEngine;
+
class PmvPlayer {
public:
PmvPlayer(MadeEngine *vm, Audio::Mixer *mixer);
diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp
index a18c719110..7e92cfe71b 100644
--- a/engines/made/redreader.cpp
+++ b/engines/made/redreader.cpp
@@ -21,8 +21,9 @@
*/
#include "made/redreader.h"
+
+#include "common/file.h"
#include "common/memstream.h"
-#include "common/textconsole.h"
namespace Made {
diff --git a/engines/made/redreader.h b/engines/made/redreader.h
index 84181fb722..3025d31ce1 100644
--- a/engines/made/redreader.h
+++ b/engines/made/redreader.h
@@ -23,9 +23,12 @@
#ifndef MADE_REDREADER_H
#define MADE_REDREADER_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
+#include "common/scummsys.h"
+
+namespace Common {
+class SeekableReadStream;
+class File;
+}
namespace Made {
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index 246241561c..28fee8ce57 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -20,15 +20,17 @@
*
*/
-#include "common/debug.h"
-#include "common/endian.h"
-#include "common/memstream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
#include "made/resource.h"
#include "made/graphics.h"
-#include "made/sound.h"
+
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/debug.h"
+
+#include "graphics/surface.h"
+
+#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
namespace Made {
diff --git a/engines/made/resource.h b/engines/made/resource.h
index 8ffebfef50..9e0a729c58 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -23,15 +23,23 @@
#ifndef MADE_RESOURCE_H
#define MADE_RESOURCE_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
+#include "made/sound.h"
+
+#include "common/endian.h"
+#include "common/array.h"
#include "common/hashmap.h"
-#include "common/textconsole.h"
-#include "graphics/surface.h"
-#include "audio/audiostream.h"
-#include "made/sound.h"
+namespace Common {
+class File;
+}
+
+namespace Audio {
+class AudioStream;
+}
+
+namespace Graphics {
+struct Surface;
+}
namespace Made {
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 7a8b4603dc..dbe2f1c7ba 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -20,12 +20,16 @@
*
*/
-#include "made/made.h"
#include "made/screen.h"
-#include "made/resource.h"
+#include "made/made.h"
+#include "made/screenfx.h"
#include "made/database.h"
+#include "common/system.h"
+
+#include "graphics/surface.h"
#include "graphics/palette.h"
+#include "graphics/cursorman.h"
namespace Made {
diff --git a/engines/made/screen.h b/engines/made/screen.h
index 8485c1c4d7..a61ecabdce 100644
--- a/engines/made/screen.h
+++ b/engines/made/screen.h
@@ -23,15 +23,9 @@
#ifndef MADE_SCREEN_H
#define MADE_SCREEN_H
-#include "common/endian.h"
-#include "common/util.h"
-#include "common/rect.h"
-
-#include "graphics/surface.h"
-#include "graphics/cursorman.h"
-
#include "made/resource.h"
-#include "made/screenfx.h"
+
+#include "common/rect.h"
namespace Made {
@@ -56,6 +50,7 @@ struct SpriteListItem {
};
class MadeEngine;
+class ScreenEffects;
static const byte defaultMouseCursor[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index bdc36c87d7..ff0d393885 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -20,9 +20,10 @@
*
*/
-#include "made/made.h"
-#include "made/screen.h"
#include "made/screenfx.h"
+#include "made/screen.h"
+
+#include "graphics/surface.h"
namespace Made {
@@ -58,11 +59,6 @@ ScreenEffects::~ScreenEffects() {
}
void ScreenEffects::run(int16 effectNum, Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
- // Workaround: we set up the final palette beforehand, to reduce CPU usage during the screen effect.
- // The visual difference is not noticeable, but CPU load is much much less (as palette updates are very expensive).
- // The palette changes in the effects have been removed, where applicable, to reduce CPU load
- setPalette(palette);
-
// TODO: Put effect functions into an array
switch (effectNum) {
@@ -188,6 +184,28 @@ void ScreenEffects::setBlendedPalette(byte *palette, byte *newPalette, int color
}
}
+void ScreenEffects::startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue) {
+ _blendedPaletteStatus._palette = palette;
+ _blendedPaletteStatus._newPalette = newPalette;
+ _blendedPaletteStatus._colorCount = colorCount;
+ _blendedPaletteStatus._maxValue = maxValue;
+ _blendedPaletteStatus._incr = maxValue / 10; // ~10 palette updates
+ _blendedPaletteStatus._value = 0;
+ // Don't do anything if the two palettes are identical
+ _blendedPaletteStatus._active = memcmp(palette, newPalette, colorCount * 3) != 0;
+}
+
+void ScreenEffects::stepBlendedPalette() {
+ if (_blendedPaletteStatus._active && _blendedPaletteStatus._value < _blendedPaletteStatus._maxValue) {
+ setBlendedPalette(_blendedPaletteStatus._palette, _blendedPaletteStatus._newPalette,
+ _blendedPaletteStatus._colorCount, _blendedPaletteStatus._value, _blendedPaletteStatus._maxValue);
+ if (_blendedPaletteStatus._value == _blendedPaletteStatus._maxValue)
+ _blendedPaletteStatus._value++;
+ else
+ _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue);
+ }
+}
+
void ScreenEffects::copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2) {
// TODO: Clean up
@@ -273,71 +291,78 @@ void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPa
}
void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 0; x < 320; x += 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x, 312); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 312; x >= 0; x -= 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, 312 - x, 312); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 0; y < 200; y += 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, y, 190); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 190; y >= 0; y -= 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, 190 - y, 190); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 90);
for (int y = 0; y < 100; y += 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, y, 90); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Curtain open" effect
void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 0; x < 160; x += 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x, 152); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Curtain close" effect
void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 152; x >= 0; x -= 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, 152 - x, 152); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" right to left
@@ -346,7 +371,7 @@ void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Checkerboard" effect
@@ -365,77 +390,84 @@ void ScreenEffects::vfx09(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen wipe in", left to right
void ScreenEffects::vfx10(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 368);
for (int x = -56; x < 312; x += 8) {
copyFxRect(surface, x, 0, x + 64, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", right to left
void ScreenEffects::vfx11(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 368);
for (int x = 312; x > -56; x -= 8) {
copyFxRect(surface, x, 0, x + 64, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", top to bottom
void ScreenEffects::vfx12(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 260);
for (int y = -70; y < 312; y += 10) {
copyFxRect(surface, 0, y, 320, y + 80);
- //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", bottom to top
void ScreenEffects::vfx13(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 260);
for (int y = 312; y > -70; y -= 10) {
copyFxRect(surface, 0, y, 320, y + 80);
- //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen open" effect
void ScreenEffects::vfx14(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 x = 8, y = 5;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 160 - x, 100 - y, 160 + x, 100 + y);
x += 8;
y += 5;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx15(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 x = 8;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 160 - x, 0, 160 + x, 200);
x += 8;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx16(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 y = 8;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 0, 100 - y, 320, 100 + y);
y += 5;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// Palette fadeout/fadein
@@ -448,16 +480,12 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
memcpy(tempPalette, palette, 768);
- // We reduce the number of palette updates by the following factor (e.g. a factor of 5 would mean 5
- // times less updates). This is done to reduce CPU load while performing the very expensive full
- // screen palette changes. The original behavior is to set factor to 1.
- int factor = 5;
-
// Fade out to black
memset(palette, 0, 768);
- for (int i = 0; i < 50 / factor; i++) {
- setBlendedPalette(palette, newPalette, colorCount, i * factor, 50);
- _screen->updateScreenAndWait(25 * factor);
+ startBlendedPalette(palette, newPalette, colorCount, 50);
+ for (int i = 0; i < 50; i++) {
+ stepBlendedPalette();
+ _screen->updateScreenAndWait(25);
}
_screen->setRGBPalette(palette, 0, colorCount);
@@ -467,9 +495,10 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
// Fade from black to palette
memset(newPalette, 0, 768);
- for (int i = 0; i < 50 / factor; i++) {
- setBlendedPalette(palette, newPalette, colorCount, i * factor, 50);
- _screen->updateScreenAndWait(25 * factor);
+ startBlendedPalette(palette, newPalette, colorCount, 50);
+ for (int i = 0; i < 50; i++) {
+ stepBlendedPalette();
+ _screen->updateScreenAndWait(25);
}
_screen->setRGBPalette(palette, 0, colorCount);
@@ -484,7 +513,7 @@ void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" top to bottom
@@ -494,7 +523,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" bottom to top
@@ -504,7 +533,7 @@ void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
} // End of namespace Made
diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h
index 793fcba2d6..1fcdd5f0d4 100644
--- a/engines/made/screenfx.h
+++ b/engines/made/screenfx.h
@@ -23,17 +23,24 @@
#ifndef MADE_SCREENFX_H
#define MADE_SCREENFX_H
-#include "common/endian.h"
-#include "common/util.h"
-#include "common/rect.h"
+#include "common/scummsys.h"
-#include "graphics/surface.h"
-
-#include "made/made.h"
-#include "made/screen.h"
+namespace Graphics {
+struct Surface;
+}
namespace Made {
+class Screen;
+
+struct BlendedPaletteStatus {
+ bool _active;
+ byte *_palette, *_newPalette;
+ int _colorCount;
+ int16 _value, _maxValue, _incr;
+ int cnt;
+};
+
class ScreenEffects {
public:
ScreenEffects(Screen *screen);
@@ -47,8 +54,12 @@ private:
static const byte vfxOffsIndexTable[8];
const byte *vfxOffsTablePtr;
int16 vfxX1, vfxY1, vfxWidth, vfxHeight;
+ BlendedPaletteStatus _blendedPaletteStatus;
+
void setPalette(byte *palette);
void setBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 value, int16 maxValue);
+ void startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue);
+ void stepBlendedPalette();
void copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2);
void vfx00(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount);
diff --git a/engines/made/script.cpp b/engines/made/script.cpp
index 2776008828..7658d20eb5 100644
--- a/engines/made/script.cpp
+++ b/engines/made/script.cpp
@@ -20,15 +20,13 @@
*
*/
-#include "common/endian.h"
-#include "common/util.h"
-
-#include "made/made.h"
#include "made/script.h"
-#include "made/database.h"
#include "made/scriptfuncs.h"
+#include "made/made.h"
+#include "made/database.h"
#include "made/screen.h"
+#include "common/util.h"
namespace Made {
diff --git a/engines/made/script.h b/engines/made/script.h
index 0a7cf8e974..f3db43485f 100644
--- a/engines/made/script.h
+++ b/engines/made/script.h
@@ -23,9 +23,6 @@
#ifndef MADE_SCRIPT_H
#define MADE_SCRIPT_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
#include "common/textconsole.h"
namespace Made {
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index aa172bbe74..de7b5b70f9 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -20,21 +20,19 @@
*
*/
-#include "common/util.h"
-
-#include "backends/audiocd/audiocd.h"
-#include "graphics/cursorman.h"
-#include "audio/softsynth/pcspk.h"
-
+#include "made/scriptfuncs.h"
#include "made/made.h"
-#include "made/resource.h"
-#include "made/database.h"
#include "made/screen.h"
-#include "made/script.h"
-#include "made/sound.h"
-#include "made/pmvplayer.h"
-#include "made/scriptfuncs.h"
#include "made/music.h"
+#include "made/database.h"
+#include "made/pmvplayer.h"
+
+#include "audio/softsynth/pcspk.h"
+
+#include "backends/audiocd/audiocd.h"
+
+#include "graphics/cursorman.h"
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 481c131248..6b3301755d 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -23,13 +23,13 @@
#ifndef MADE_SCRIPTFUNCS_H
#define MADE_SCRIPTFUNCS_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/func.h"
-#include "common/stream.h"
-
#include "made/resource.h"
+#include "audio/mixer.h"
+
+#include "common/debug.h"
+#include "common/system.h"
+
namespace Audio {
class PCSpeaker;
}
diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp
index 54333eb3d4..f73c580560 100644
--- a/engines/made/sound.cpp
+++ b/engines/made/sound.cpp
@@ -20,12 +20,10 @@
*
*/
-#include "common/endian.h"
-#include "common/list.h"
-#include "common/util.h"
-
#include "made/sound.h"
+#include "common/endian.h"
+
namespace Made {
void ManholeEgaSoundDecompressor::decompress(byte *source, byte *dest, uint32 size) {
diff --git a/engines/made/sound.h b/engines/made/sound.h
index 8358d279cf..b8399fd90a 100644
--- a/engines/made/sound.h
+++ b/engines/made/sound.h
@@ -24,9 +24,6 @@
#define MADE_SOUND_H
#include "common/array.h"
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
namespace Made {