aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/commandLine.cpp20
-rw-r--r--base/main.cpp20
-rw-r--r--base/plugins.cpp4
-rw-r--r--base/plugins.h6
-rw-r--r--base/version.h8
-rw-r--r--common/archive.cpp2
-rw-r--r--common/config-manager.cpp4
-rw-r--r--common/config-manager.h4
-rw-r--r--common/fs.h2
-rw-r--r--common/hash-str.h8
-rw-r--r--common/hashmap.cpp8
-rw-r--r--common/hashmap.h12
-rw-r--r--common/list.h2
-rw-r--r--common/memorypool.cpp2
-rw-r--r--common/memstream.h4
-rw-r--r--common/recorderfile.cpp6
-rw-r--r--common/rect.h8
-rw-r--r--common/serializer.h10
-rw-r--r--common/str.cpp8
-rw-r--r--common/str.h2
-rw-r--r--common/stream.cpp6
-rw-r--r--common/updates.cpp2
-rw-r--r--common/updates.h2
-rw-r--r--common/ustr.cpp4
-rw-r--r--common/xmlparser.cpp2
-rw-r--r--common/zlib.cpp4
-rw-r--r--engines/lilliput/lilliput.cpp62
-rw-r--r--engines/lilliput/lilliput.h12
-rw-r--r--engines/lilliput/script.cpp30
-rw-r--r--engines/lilliput/script.h6
-rw-r--r--engines/mohawk/myst_scripts.cpp10
-rw-r--r--engines/mohawk/myst_scripts.h1
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp46
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp4
-rw-r--r--engines/sludge/builtin.cpp20
-rw-r--r--engines/sludge/event.cpp15
-rw-r--r--engines/sludge/freeze.cpp9
-rw-r--r--engines/sludge/freeze.h5
-rw-r--r--engines/sludge/loadsave.cpp6
-rw-r--r--engines/sludge/people.cpp15
-rw-r--r--engines/sludge/region.cpp167
-rw-r--r--engines/sludge/region.h50
-rw-r--r--engines/sludge/sludge.cpp4
-rw-r--r--engines/sludge/sludge.h2
-rw-r--r--engines/sludge/sludger.cpp2
-rw-r--r--engines/sludge/speech.cpp2
-rw-r--r--engines/testbed/graphics.cpp41
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp2
-rw-r--r--engines/xeen/combat.cpp10
-rw-r--r--engines/xeen/combat.h2
-rw-r--r--engines/xeen/dialogs/dialogs_input.cpp4
-rw-r--r--engines/xeen/dialogs/dialogs_message.cpp2
-rw-r--r--engines/xeen/dialogs/dialogs_party.cpp2
-rw-r--r--engines/xeen/dialogs/dialogs_spells.cpp2
-rw-r--r--engines/xeen/interface.cpp24
-rw-r--r--engines/xeen/interface_scene.cpp89
-rw-r--r--engines/xeen/interface_scene.h25
-rw-r--r--engines/xeen/locations.cpp15
-rw-r--r--engines/xeen/party.cpp18
-rw-r--r--engines/xeen/party.h5
-rw-r--r--engines/xeen/saves.cpp1
-rw-r--r--engines/xeen/scripts.cpp4
-rw-r--r--engines/xeen/spells.cpp2
-rw-r--r--engines/xeen/xeen.cpp7
-rw-r--r--engines/xeen/xeen.h8
-rw-r--r--graphics/VectorRenderer.h2
-rw-r--r--graphics/VectorRendererSpec.cpp26
-rw-r--r--graphics/fonts/bdf.h4
-rw-r--r--graphics/nine_patch.cpp2
-rw-r--r--graphics/primitives.cpp62
-rw-r--r--graphics/scaler.cpp14
-rw-r--r--graphics/scaler/intern.h12
-rw-r--r--graphics/scaler/scalebit.cpp42
-rw-r--r--graphics/sjis.cpp22
-rw-r--r--image/codecs/indeo/indeo.cpp36
-rw-r--r--image/codecs/indeo3.cpp36
-rw-r--r--po/de_DE.po12
-rw-r--r--po/fi_FI.po9
-rw-r--r--po/sv_SE.po8
79 files changed, 654 insertions, 524 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index e1576a0fad..bd8b9d07ac 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -241,7 +241,7 @@ void registerDefaults() {
ConfMan.registerDefault("boot_param", 0);
ConfMan.registerDefault("dump_scripts", false);
ConfMan.registerDefault("save_slot", -1);
- ConfMan.registerDefault("autosave_period", 5 * 60); // By default, trigger autosave every 5 minutes
+ ConfMan.registerDefault("autosave_period", 5 * 60); // By default, trigger autosave every 5 minutes
#if defined(ENABLE_SCUMM) || defined(ENABLE_SWORD2)
ConfMan.registerDefault("object_labels", true);
@@ -308,7 +308,7 @@ void registerDefaults() {
// Use this for options which have an *optional* value
#define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
- if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
+ if (isLongCmd ? (!strcmp(s + 2, longCmd) || !memcmp(s + 2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
s += 2; \
if (isLongCmd) { \
s += sizeof(longCmd) - 1; \
@@ -337,7 +337,7 @@ void registerDefaults() {
// Use this for boolean options; this distinguishes between "-x" and "-X",
// resp. between "--some-option" and "--no-some-option".
#define DO_OPTION_BOOL(shortCmd, longCmd) \
- if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-" longCmd)) : (tolower(s[1]) == shortCmd)) { \
+ if (isLongCmd ? (!strcmp(s + 2, longCmd) || !strcmp(s + 2, "no-" longCmd)) : (tolower(s[1]) == shortCmd)) { \
bool boolValue = (Common::isLower(s[1]) != 0); \
s += 2; \
if (isLongCmd) { \
@@ -350,7 +350,7 @@ void registerDefaults() {
// Use this for options which never have a value, i.e. for 'commands', like "--help".
#define DO_COMMAND(shortCmd, longCmd) \
- if (isLongCmd ? (!strcmp(s+2, longCmd)) : (tolower(s[1]) == shortCmd)) { \
+ if (isLongCmd ? (!strcmp(s + 2, longCmd)) : (tolower(s[1]) == shortCmd)) { \
s += 2; \
if (isLongCmd) \
s += sizeof(longCmd) - 1; \
@@ -383,7 +383,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
// argv[0] contains the name of the executable.
if (argv[0]) {
s = strrchr(argv[0], '/');
- s_appName = s ? (s+1) : argv[0];
+ s_appName = s ? (s + 1) : argv[0];
}
// We store all command line settings into a string map.
@@ -746,7 +746,7 @@ static Common::Error listSaves(const char *target) {
gameid = domain->getVal("gameid");
if (gameid.empty())
gameid = target;
- gameid.toLowercase(); // Normalize it to lower case
+ gameid.toLowercase(); // Normalize it to lower case
// Find the plugin that will handle the specified gameid
const Plugin *plugin = nullptr;
@@ -754,7 +754,7 @@ static Common::Error listSaves(const char *target) {
if (!plugin) {
return Common::Error(Common::kEnginePluginNotFound,
- Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
+ Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
}
const MetaEngine &metaEngine = plugin->get<MetaEngine>();
@@ -762,7 +762,7 @@ static Common::Error listSaves(const char *target) {
if (!metaEngine.hasFeature(MetaEngine::kSupportsListSaves)) {
// TODO: Include more info about the target (desc, engine name, ...) ???
return Common::Error(Common::kEnginePluginNotSupportSaves,
- Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
+ Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
} else {
// Query the plugin for a list of saved games
SaveStateList saveList = metaEngine.listSaves(target);
@@ -821,7 +821,7 @@ static void listAudioDevices() {
static GameList getGameList(const Common::FSNode &dir) {
Common::FSList files;
- //Collect all files from directory
+ // Collect all files from directory
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
printf("Path %s does not exist or is not a directory.\n", dir.getPath().c_str());
return GameList();
@@ -1043,7 +1043,7 @@ void upgradeTargets() {
if (gameid.empty()) {
gameid = name;
}
- gameid.toLowercase(); // TODO: Is this paranoia? Maybe we should just assume all lowercase, always?
+ gameid.toLowercase(); // TODO: Is this paranoia? Maybe we should just assume all lowercase, always?
Common::FSNode dir(path);
Common::FSList files;
diff --git a/base/main.cpp b/base/main.cpp
index f529f3ec08..8e783c9776 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -213,7 +213,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
caption = EngineMan.findGame(ConfMan.get("gameid")).description();
}
if (caption.empty())
- caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
+ caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
if (!caption.empty()) {
system.setWindowCaption(caption.c_str());
}
@@ -394,7 +394,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
if (settings.contains("debuglevel")) {
gDebugLevel = (int)strtol(settings["debuglevel"].c_str(), 0, 10);
printf("Debuglevel (from command line): %d\n", gDebugLevel);
- settings.erase("debuglevel"); // This option should not be passed to ConfMan.
+ settings.erase("debuglevel"); // This option should not be passed to ConfMan.
} else if (ConfMan.hasKey("debuglevel"))
gDebugLevel = ConfMan.getInt("debuglevel");
@@ -535,12 +535,12 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
g_eventRec.deinit();
#endif
- #if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
+#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
// do our best to prevent fragmentation by unloading as soon as we can
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
// reallocate the config manager to get rid of any fragmentation
ConfMan.defragment();
- #endif
+#endif
// Did an error occur ?
if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled) {
@@ -549,20 +549,20 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
}
// Quit unless an error occurred, or Return to launcher was requested
- #ifndef FORCE_RTL
+#ifndef FORCE_RTL
if (result.getCode() == Common::kNoError && !g_system->getEventManager()->shouldRTL())
break;
- #endif
+#endif
// Reset RTL flag in case we want to load another engine
g_system->getEventManager()->resetRTL();
- #ifdef FORCE_RTL
+#ifdef FORCE_RTL
g_system->getEventManager()->resetQuit();
- #endif
- #ifdef ENABLE_EVENTRECORDER
+#endif
+#ifdef ENABLE_EVENTRECORDER
if (g_eventRec.checkForContinueGame()) {
continue;
}
- #endif
+#endif
// At this point, we usually return to the launcher. However, the
// game may have requested that one or more other games be "chained"
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 18755003b4..b8f63fd443 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -257,7 +257,7 @@ void PluginManagerUncached::init() {
unloadAllPlugins();
_allEnginePlugins.clear();
- unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
+ unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
for (ProviderList::iterator pp = _providers.begin();
pp != _providers.end();
@@ -362,7 +362,7 @@ bool PluginManagerUncached::loadNextPlugin() {
return true;
}
}
- return false; // no more in list
+ return false; // no more in list
}
/**
diff --git a/base/plugins.h b/base/plugins.h
index ce45f7102a..3ad2875906 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -179,9 +179,9 @@ public:
//unloadPlugin();
}
-// virtual bool isLoaded() const = 0; // TODO
- virtual bool loadPlugin() = 0; // TODO: Rename to load() ?
- virtual void unloadPlugin() = 0; // TODO: Rename to unload() ?
+// virtual bool isLoaded() const = 0; // TODO
+ virtual bool loadPlugin() = 0; // TODO: Rename to load() ?
+ virtual void unloadPlugin() = 0; // TODO: Rename to unload() ?
/**
* The following functions query information from the plugin object once
diff --git a/base/version.h b/base/version.h
index 2e362b5c72..74a0e72254 100644
--- a/base/version.h
+++ b/base/version.h
@@ -23,10 +23,10 @@
#ifndef BASE_VERSION_H
#define BASE_VERSION_H
-extern const char *gScummVMVersion; // e.g. "0.4.1"
-extern const char *gScummVMBuildDate; // e.g. "2003-06-24"
+extern const char *gScummVMVersion; // e.g. "0.4.1"
+extern const char *gScummVMBuildDate; // e.g. "2003-06-24"
extern const char *gScummVMVersionDate; // e.g. "0.4.1 (2003-06-24)"
-extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)"
-extern const char *gScummVMFeatures; // e.g. "ALSA MPEG2 zLib"
+extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)"
+extern const char *gScummVMFeatures; // e.g. "ALSA MPEG2 zLib"
#endif
diff --git a/common/archive.cpp b/common/archive.cpp
index 5a339900b6..b4fc7c12c7 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -267,7 +267,7 @@ SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) con
SearchManager::SearchManager() {
- clear(); // Force a reset
+ clear(); // Force a reset
}
void SearchManager::clear() {
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index fdd0c6f033..082f261f51 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -85,7 +85,7 @@ void ConfigManager::loadDefaultConfigFile() {
// Open the default config file
assert(g_system);
SeekableReadStream *stream = g_system->createConfigReadStream();
- _filename.clear(); // clear the filename to indicate that we are using the default config file
+ _filename.clear(); // clear the filename to indicate that we are using the default config file
// ... load it, if available ...
if (stream) {
@@ -321,7 +321,7 @@ void ConfigManager::flushToDisk() {
void ConfigManager::writeDomain(WriteStream &stream, const String &name, const Domain &domain) {
if (domain.empty())
- return; // Don't bother writing empty domains.
+ return; // Don't bother writing empty domains.
// WORKAROUND: Fix for bug #1972625 "ALL: On-the-fly targets are
// written to the config file": Do not save domains that came from
diff --git a/common/config-manager.h b/common/config-manager.h
index 669faaaf88..58f4373dde 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -171,7 +171,7 @@ public:
DomainMap::iterator beginGameDomains() { return _gameDomains.begin(); }
DomainMap::iterator endGameDomains() { return _gameDomains.end(); }
- static void defragment(); // move in memory to reduce fragmentation
+ static void defragment(); // move in memory to reduce fragmentation
void copyFrom(ConfigManager &source);
private:
@@ -185,7 +185,7 @@ private:
Domain _transientDomain;
DomainMap _gameDomains;
- DomainMap _miscDomains; // Any other domains
+ DomainMap _miscDomains; // Any other domains
Domain _appDomain;
Domain _defaultsDomain;
diff --git a/common/fs.h b/common/fs.h
index f516bf7a9c..ed287cc17a 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -269,7 +269,7 @@ public:
class FSDirectory : public Archive {
FSNode _node;
- String _prefix; // string that is prepended to each cache item key
+ String _prefix; // string that is prepended to each cache item key
void setPrefix(const String &prefix);
// Caches are case insensitive, clashes are dealt with when creating
diff --git a/common/hash-str.h b/common/hash-str.h
index 82af6cca93..fcd41ab6a7 100644
--- a/common/hash-str.h
+++ b/common/hash-str.h
@@ -29,11 +29,10 @@
namespace Common {
uint hashit(const char *str);
-uint hashit_lower(const char *str); // Generate a hash based on the lowercase version of the string
+uint hashit_lower(const char *str); // Generate a hash based on the lowercase version of the string
inline uint hashit(const String &str) { return hashit(str.c_str()); }
inline uint hashit_lower(const String &str) { return hashit_lower(str.c_str()); }
-
// FIXME: The following functors obviously are not consistently named
struct CaseSensitiveString_EqualTo {
@@ -53,8 +52,6 @@ struct IgnoreCase_Hash {
uint operator()(const String& x) const { return hashit_lower(x.c_str()); }
};
-
-
// Specalization of the Hash functor for String objects.
// We do case sensitve hashing here, because that is what
// the default EqualTo is compatible with. If one wants to use
@@ -78,9 +75,6 @@ struct Hash<const char *> {
// String map -- by default case insensitive
typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap;
-
-
} // End of namespace Common
-
#endif
diff --git a/common/hashmap.cpp b/common/hashmap.cpp
index 99840993ce..e9eac9fc94 100644
--- a/common/hashmap.cpp
+++ b/common/hashmap.cpp
@@ -95,10 +95,10 @@ void updateHashCollisionStats(int collisions, int dummyHits, int lookups, int ar
g_size / g_totalHashmaps, g_max_size,
g_capacity / g_totalHashmaps, g_max_capacity);
debug(" %d less than %d; %d less than %d; %d less than %d; %d less than %d",
- g_stats[0], 2*8/3,
- g_stats[1],2*16/3,
- g_stats[2],2*32/3,
- g_stats[3],2*64/3);
+ g_stats[0], 2 * 8 / 3,
+ g_stats[1], 2 * 16 / 3,
+ g_stats[2], 2 * 32 / 3,
+ g_stats[3], 2 * 64 / 3);
// TODO:
// * Should record the maximal size of the map during its lifetime, not that at its death
diff --git a/common/hashmap.h b/common/hashmap.h
index d7ba100571..08651a8b01 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -355,7 +355,7 @@ HashMap<Key, Val, HashFunc, EqualFunc>::~HashMap() {
delete[] _storage;
#ifdef DEBUG_HASH_COLLISIONS
extern void updateHashCollisionStats(int, int, int, int, int);
- updateHashCollisionStats(_collisions, _dummyHits, _lookups, _mask+1, _size);
+ updateHashCollisionStats(_collisions, _dummyHits, _lookups, _mask + 1, _size);
#endif
}
@@ -369,9 +369,9 @@ HashMap<Key, Val, HashFunc, EqualFunc>::~HashMap() {
template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t &map) {
_mask = map._mask;
- _storage = new Node *[_mask+1];
+ _storage = new Node *[_mask + 1];
assert(_storage != NULL);
- memset(_storage, 0, (_mask+1) * sizeof(Node *));
+ memset(_storage, 0, (_mask + 1) * sizeof(Node *));
// Simply clone the map given to us, one by one.
_size = 0;
@@ -418,7 +418,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) {
template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(size_type newCapacity) {
- assert(newCapacity > _mask+1);
+ assert(newCapacity > _mask + 1);
#ifndef NDEBUG
const size_type old_size = _size;
@@ -487,7 +487,7 @@ typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, Has
_lookups++;
debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d",
_collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups),
- (const void *)this, _mask+1, _size);
+ (const void *)this, _mask + 1, _size);
#endif
return ctr;
@@ -525,7 +525,7 @@ typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, Has
_lookups++;
debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d",
_collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups),
- (const void *)this, _mask+1, _size);
+ (const void *)this, _mask + 1, _size);
#endif
if (!found && first_free != _mask + 1)
diff --git a/common/list.h b/common/list.h
index 1bb4a2a5df..31cf161d22 100644
--- a/common/list.h
+++ b/common/list.h
@@ -170,7 +170,7 @@ public:
const_iterator i2;
const_iterator e2 = list.end();
- for (i = begin(), i2 = list.begin(); (i != e) && (i2 != e2) ; ++i, ++i2) {
+ for (i = begin(), i2 = list.begin(); (i != e) && (i2 != e2); ++i, ++i2) {
static_cast<Node *>(i._node)->_data = static_cast<const Node *>(i2._node)->_data;
}
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index 1a9bfe2e29..b947b38306 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -64,7 +64,7 @@ void MemoryPool::allocPage() {
// Allocate a new page
page.numChunks = _chunksPerPage;
- assert(page.numChunks * _chunkSize < 16*1024*1024); // Refuse to allocate pages bigger than 16 MB
+ assert(page.numChunks * _chunkSize < 16*1024*1024); // Refuse to allocate pages bigger than 16 MB
page.start = ::malloc(page.numChunks * _chunkSize);
assert(page.start);
diff --git a/common/memstream.h b/common/memstream.h
index f6bf990208..0d7375b6b5 100644
--- a/common/memstream.h
+++ b/common/memstream.h
@@ -289,8 +289,8 @@ public:
return dataSize;
}
- int32 pos() const { return _pos - _length; } //'read' position in the stream
- int32 size() const { return _size; } //that's also 'write' position in the stream, as it's append-only
+ int32 pos() const { return _pos - _length; } // 'read' position in the stream
+ int32 size() const { return _size; } // that's also 'write' position in the stream, as it's append-only
bool seek(int32, int) { return false; }
bool eos() const { return _eos; }
void clearErr() { _eos = false; }
diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp
index 7552cd45b3..3db017ea8b 100644
--- a/common/recorderfile.cpp
+++ b/common/recorderfile.cpp
@@ -335,7 +335,7 @@ RecorderEvent PlaybackFile::getNextEvent() {
case kScreenShotTag:
_readStream->seek(-4, SEEK_CUR);
header.len = _readStream->readUint32BE();
- _readStream->skip(header.len-8);
+ _readStream->skip(header.len - 8);
break;
case kMD5Tag:
checkRecordedMD5();
@@ -575,7 +575,7 @@ int PlaybackFile::getScreensCount() {
int result = 0;
while (skipToNextScreenshot()) {
uint32 size = _readStream->readUint32BE();
- _readStream->skip(size-8);
+ _readStream->skip(size - 8);
++result;
}
return result;
@@ -612,7 +612,7 @@ Graphics::Surface *PlaybackFile::getScreenShot(int number) {
return Graphics::loadThumbnail(*_readStream, thumbnail) ? thumbnail : NULL;
} else {
uint32 size = _readStream->readUint32BE();
- _readStream->skip(size-8);
+ _readStream->skip(size - 8);
screenCount++;
}
}
diff --git a/common/rect.h b/common/rect.h
index 6c4292c7af..135076bf1e 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -40,10 +40,10 @@ struct Point {
Point() : x(0), y(0) {}
Point(int16 x1, int16 y1) : x(x1), y(y1) {}
- bool operator==(const Point &p) const { return x == p.x && y == p.y; }
- bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
- Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); }
- Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); }
+ bool operator==(const Point &p) const { return x == p.x && y == p.y; }
+ bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
+ Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); }
+ Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); }
void operator+=(const Point &delta) {
x += delta.x;
diff --git a/common/serializer.h b/common/serializer.h
index e8db40923a..18fb38563b 100644
--- a/common/serializer.h
+++ b/common/serializer.h
@@ -34,7 +34,7 @@ namespace Common {
template<typename T> \
void syncAs ## SUFFIX(T &val, Version minVersion = 0, Version maxVersion = kLastVersion) { \
if (_version < minVersion || _version > maxVersion) \
- return; \
+ return; \
if (_loadStream) \
val = static_cast<T>(_loadStream->read ## SUFFIX()); \
else { \
@@ -178,7 +178,7 @@ public:
*/
void skip(uint32 size, Version minVersion = 0, Version maxVersion = kLastVersion) {
if (_version < minVersion || _version > maxVersion)
- return; // Ignore anything which is not supposed to be present in this save game version
+ return; // Ignore anything which is not supposed to be present in this save game version
_bytesSynced += size;
if (isLoading())
@@ -194,7 +194,7 @@ public:
*/
void syncBytes(byte *buf, uint32 size, Version minVersion = 0, Version maxVersion = kLastVersion) {
if (_version < minVersion || _version > maxVersion)
- return; // Ignore anything which is not supposed to be present in this save game version
+ return; // Ignore anything which is not supposed to be present in this save game version
if (isLoading())
_loadStream->read(buf, size);
@@ -217,7 +217,7 @@ public:
*/
bool matchBytes(const char *magic, byte size, Version minVersion = 0, Version maxVersion = kLastVersion) {
if (_version < minVersion || _version > maxVersion)
- return true; // Ignore anything which is not supposed to be present in this save game version
+ return true; // Ignore anything which is not supposed to be present in this save game version
bool match;
if (isSaving()) {
@@ -238,7 +238,7 @@ public:
*/
void syncString(String &str, Version minVersion = 0, Version maxVersion = kLastVersion) {
if (_version < minVersion || _version > maxVersion)
- return; // Ignore anything which is not supposed to be present in this save game version
+ return; // Ignore anything which is not supposed to be present in this save game version
if (isLoading()) {
char c;
diff --git a/common/str.cpp b/common/str.cpp
index 2ef67175cd..7d40aebf94 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -63,7 +63,7 @@ void String::initWithCStr(const char *str, uint32 len) {
if (len >= _builtinCapacity) {
// Not enough internal storage, so allocate more
- _extern._capacity = computeCapacity(len+1);
+ _extern._capacity = computeCapacity(len + 1);
_extern._refCount = 0;
_str = new char[_extern._capacity];
assert(_str != 0);
@@ -593,7 +593,7 @@ String String::vformat(const char *fmt, va_list args) {
// vsnprintf didn't have enough space, so grow buffer
output.ensureCapacity(len, false);
scumm_va_copy(va, args);
- int len2 = vsnprintf(output._str, len+1, fmt, va);
+ int len2 = vsnprintf(output._str, len + 1, fmt, va);
va_end(va);
assert(len == len2);
output._size = len2;
@@ -741,7 +741,7 @@ String lastPathComponent(const String &path, const char sep) {
const char *last = str + path.size();
// Skip over trailing slashes
- while (last > str && *(last-1) == sep)
+ while (last > str && *(last - 1) == sep)
--last;
// Path consisted of only slashes -> return empty string
@@ -1010,7 +1010,7 @@ int scumm_strnicmp(const char *s1, const char *s2, uint n) {
byte l1, l2;
do {
if (n-- == 0)
- return 0; // no difference found so far -> signal equality
+ return 0; // no difference found so far -> signal equality
// Don't use ++ inside tolower, in case the macro uses its
// arguments more than once.
diff --git a/common/str.h b/common/str.h
index fd77fa90c8..cf7fc34f6b 100644
--- a/common/str.h
+++ b/common/str.h
@@ -285,7 +285,7 @@ public:
* except that it stores the result in (variably sized) String
* instead of a fixed size buffer.
*/
- static String format(const char *fmt, ...) GCC_PRINTF(1,2);
+ static String format(const char *fmt, ...) GCC_PRINTF(1, 2);
/**
* Print formatted data into a String object. Similar to vsprintf,
diff --git a/common/stream.cpp b/common/stream.cpp
index 8d93888020..0a5fa94ac3 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -99,7 +99,7 @@ bool MemoryReadStream::seek(int32 offs, int whence) {
// Reset end-of-stream flag on a successful seek
_eos = false;
- return true; // FIXME: STREAM REWRITE
+ return true; // FIXME: STREAM REWRITE
}
bool MemoryWriteStreamDynamic::seek(int32 offs, int whence) {
@@ -124,7 +124,7 @@ bool MemoryWriteStreamDynamic::seek(int32 offs, int whence) {
// Post-Condition
assert(_pos <= _size);
- return true; // FIXME: STREAM REWRITE
+ return true; // FIXME: STREAM REWRITE
}
#pragma mark -
@@ -413,7 +413,7 @@ BufferedSeekableReadStream::BufferedSeekableReadStream(SeekableReadStream *paren
bool BufferedSeekableReadStream::seek(int32 offset, int whence) {
// If it is a "local" seek, we may get away with "seeking" around
// in the buffer only.
- _eos = false; // seeking always cancels EOS
+ _eos = false; // seeking always cancels EOS
int relOffset = 0;
switch (whence) {
diff --git a/common/updates.cpp b/common/updates.cpp
index 087002a7d3..4e4ed53b8f 100644
--- a/common/updates.cpp
+++ b/common/updates.cpp
@@ -47,7 +47,7 @@ int UpdateManager::normalizeInterval(int interval) {
val++;
}
- return val[-1]; // Return maximal acceptable value
+ return val[-1]; // Return maximal acceptable value
}
const char *UpdateManager::updateIntervalToString(int interval) {
diff --git a/common/updates.h b/common/updates.h
index 3a3049d4df..812aac718e 100644
--- a/common/updates.h
+++ b/common/updates.h
@@ -50,7 +50,7 @@ public:
kUpdateIntervalNotSupported = 0,
kUpdateIntervalOneDay = 86400,
kUpdateIntervalOneWeek = 604800,
- kUpdateIntervalOneMonth = 2628000 // average seconds per month (60*60*24*365)/12
+ kUpdateIntervalOneMonth = 2628000 // average seconds per month (60*60*24*365)/12
};
UpdateManager() {}
diff --git a/common/ustr.cpp b/common/ustr.cpp
index 35b5502a6d..e5c674f595 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -239,7 +239,7 @@ void U32String::ensureCapacity(uint32 new_size, bool keep_old) {
if (new_size < curCapacity)
newCapacity = curCapacity;
else
- newCapacity = MAX(curCapacity * 2, computeCapacity(new_size+1));
+ newCapacity = MAX(curCapacity * 2, computeCapacity(new_size + 1));
// Allocate new storage
newStorage = new value_type[newCapacity];
@@ -316,7 +316,7 @@ void U32String::initWithCStr(const value_type *str, uint32 len) {
if (len >= _builtinCapacity) {
// Not enough internal storage, so allocate more
- _extern._capacity = computeCapacity(len+1);
+ _extern._capacity = computeCapacity(len + 1);
_extern._refCount = 0;
_str = new value_type[_extern._capacity];
assert(_str != 0);
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index 4470180710..84646ffa95 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -373,7 +373,7 @@ bool XMLParser::parse() {
break;
}
} else {
- ParserNode *node = allocNode(); //new ParserNode;
+ ParserNode *node = allocNode(); // new ParserNode;
node->name = _token;
node->ignore = false;
node->header = activeHeader;
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 39130beb4e..8ea5d6c424 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -281,7 +281,7 @@ public:
_wrapped->seek(0, SEEK_SET);
_zlibErr = inflateReset(&_stream);
if (_zlibErr != Z_OK)
- return false; // FIXME: STREAM REWRITE
+ return false; // FIXME: STREAM REWRITE
_stream.next_in = _buf;
_stream.avail_in = 0;
}
@@ -297,7 +297,7 @@ public:
}
_eos = false;
- return true; // FIXME: STREAM REWRITE
+ return true; // FIXME: STREAM REWRITE
}
};
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index af95ed9696..5aee74f56b 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -674,7 +674,7 @@ void LilliputEngine::prepareGameArea() {
for (int posX = 0; posX < 8; posX++) {
if (map[1] != 0xFF) {
int var1 = map[1];
- if ((_rulesChunk9[var1] & 128) != 0)
+ if ((_cubeFlags[var1] & 128) != 0)
var1 += _animationTick;
displayIsometricBlock(_savedSurfaceGameArea1, var1, posX, posY, 1 << 8);
}
@@ -682,7 +682,7 @@ void LilliputEngine::prepareGameArea() {
if (map[2] != 0xFF) {
int var1 = map[2];
- if ((_rulesChunk9[var1] & 128) != 0)
+ if ((_cubeFlags[var1] & 128) != 0)
var1 += _animationTick;
displayIsometricBlock(_savedSurfaceGameArea1, var1, posX, posY, 2 << 8);
}
@@ -1195,7 +1195,7 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
if (buf[1] != 0xFF) {
int tmpIndex = buf[1];
- if ((_rulesChunk9[tmpIndex] & 16) == 0)
+ if ((_cubeFlags[tmpIndex] & 16) == 0)
++_byte16552;
}
@@ -1422,7 +1422,7 @@ void LilliputEngine::homeInChooseDirection(int index) {
}
int tmpVal = ((_characterMobility[index] & 7) ^ 7);
- retVal = _rulesChunk9[_bufferIsoMap[mapIndex + mapIndexDiff]];
+ retVal = _cubeFlags[_bufferIsoMap[mapIndex + mapIndexDiff]];
tmpVal &= retVal;
if (tmpVal == 0)
continue;
@@ -2118,7 +2118,7 @@ void LilliputEngine::checkCollision(int index, Common::Point pos, int direction)
var1 &= 7;
var1 ^= 7;
- if ((var1 & _rulesChunk9[_bufferIsoMap[mapIndex]]) != 0)
+ if ((var1 & _cubeFlags[_bufferIsoMap[mapIndex]]) != 0)
return;
_characterPos[index] = pos;
@@ -2147,7 +2147,7 @@ void LilliputEngine::signalDispatcher(byte type, byte index, int var4) {
}
void LilliputEngine::sendMessageToCharacter(byte index, int var4) {
- debugC(2, kDebugEngine, "sub17264(%d, %d)", index, var4);
+ debugC(2, kDebugEngine, "sendMessageToCharacter(%d, %d)", index, var4);
if (_characterSignals[index] != -1) {
_signalArr[index] = var4;
@@ -2208,10 +2208,10 @@ void LilliputEngine::checkInterfaceActivationDelay() {
void LilliputEngine::displayHeroismIndicator() {
debugC(2, kDebugEngine, "displayHeroismIndicator()");
- if (_scriptHandler->_savedBuffer215Ptr == NULL)
+ if (_scriptHandler->_barAttrPtr == NULL)
return;
- int var1 = (_scriptHandler->_savedBuffer215Ptr[0] * 25) >> 8;
+ int var1 = (_scriptHandler->_barAttrPtr[0] * 25) >> 8;
if (var1 == _scriptHandler->_heroismLevel)
return;
@@ -2230,7 +2230,6 @@ void LilliputEngine::displayHeroismIndicator() {
var2 = _scriptHandler->_heroismLevel & 0xFF;
if (var2 != 0) {
-// sub16064(var1, _scriptHandler->_byte15FFA);
for (int i = 0; i < (var2 << 2); i++) {
((byte *)_mainSurface->getPixels())[index] = var1;
((byte *)_mainSurface->getPixels())[index + 1] = var1;
@@ -2240,7 +2239,6 @@ void LilliputEngine::displayHeroismIndicator() {
}
if (25 - _scriptHandler->_heroismLevel != 0) {
-// sub16064(23, 25 - _scriptHandler->_byte15FFA);
var2 = (25 - _scriptHandler->_heroismLevel) << 2;
for (int i = 0; i < var2; i++) {
((byte *)_mainSurface->getPixels())[index] = 23;
@@ -2419,13 +2417,13 @@ void LilliputEngine::loadRules() {
_word10800_ERULES = f.readUint16LE();
- // Chunk 1
+ // Chunk 1 : Sequences
int size = f.readUint16LE();
- _rulesChunk1 = (byte *)malloc(sizeof(byte) * size);
+ _sequencesArr = (byte *)malloc(sizeof(byte) * size);
for (int i = 0; i < size; ++i)
- _rulesChunk1[i] = f.readByte();
+ _sequencesArr[i] = f.readByte();
- // Chunk 2
+ // Chunk 2 : Characters
_numCharacters = (f.readUint16LE() & 0xFF);
assert(_numCharacters <= 40);
@@ -2500,25 +2498,25 @@ void LilliputEngine::loadRules() {
for (int i = 0; i < curWord; ++i)
_arrayGameScripts[i] = f.readByte();
- // Chunk 9
+ // Chunk 9 : Cube flags
for (int i = 0; i < 60; i++)
- _rulesChunk9[i] = f.readByte();
+ _cubeFlags[i] = f.readByte();
- // Chunk 10 & 11
- _rulesChunk10_size = f.readByte();
- assert(_rulesChunk10_size <= 20);
+ // Chunk 10 & 11 : Lists
+ _listNumb = f.readByte();
+ assert(_listNumb <= 20);
- if (_rulesChunk10_size != 0) {
- _rulesChunk10 = (int16 *)malloc(sizeof(int16) * _rulesChunk10_size);
+ if (_listNumb != 0) {
+ _listIndex = (int16 *)malloc(sizeof(int16) * _listNumb);
int totalSize = 0;
- for (int i = 0; i < _rulesChunk10_size; ++i) {
- _rulesChunk10[i] = totalSize;
+ for (int i = 0; i < _listNumb; ++i) {
+ _listIndex[i] = totalSize;
totalSize += f.readByte();
}
if (totalSize != 0) {
- _rulesChunk11 = (byte *)malloc(sizeof(byte) * totalSize);
+ _listArr = (byte *)malloc(sizeof(byte) * totalSize);
for (int i = 0; i < totalSize; i++)
- _rulesChunk11[i] = f.readByte();
+ _listArr[i] = f.readByte();
}
}
@@ -2534,7 +2532,7 @@ void LilliputEngine::loadRules() {
int16 tmpValY = (int16)f.readByte();
int16 tmpValX = (int16)f.readByte();
- _rulesBuffer12Pos3[i] = Common::Point(tmpValX, tmpValY);
+ _keyPos[i] = Common::Point(tmpValX, tmpValY);
tmpValY = (int16)f.readByte();
tmpValX = (int16)f.readByte();
@@ -2586,13 +2584,13 @@ void LilliputEngine::fixPaletteEntries(uint8 *palette, int num) {
debugC(1, kDebugEngine, "fixPaletteEntries(palette, %d)", num);
// Color values are coded on 6bits (for old 6bits DAC)
for (int32 i = 0; i < num * 3; i++) {
- int32 a = palette[i];
- assert(a < 64);
+ int32 col = palette[i];
+ assert(col < 64);
- a = (a << 2) | (a >> 4);
- if (a > 255)
- a = 255;
- palette[i] = a;
+ col = (col << 2) | (col >> 4);
+ if (col > 255)
+ col = 255;
+ palette[i] = col;
}
}
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index cd28d3986c..6d67021b55 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -168,7 +168,7 @@ public:
int16 _signalArr[40];
int16 _signalArray[30];
- byte *_rulesChunk1;
+ byte *_sequencesArr;
int16 _currentScriptCharacter;
Common::Point _characterPos[40];
int8 _characterPosAltitude[40];
@@ -195,14 +195,14 @@ public:
int *_arrayGameScriptIndex;
int _gameScriptIndexSize;
byte *_arrayGameScripts;
- byte _rulesChunk9[60];
- byte _rulesChunk10_size;
- int16 *_rulesChunk10;
- byte *_rulesChunk11;
+ byte _cubeFlags[60];
+ byte _listNumb;
+ int16 *_listIndex;
+ byte *_listArr;
int16 _rectNumb;
MinMax _rectXMinMax[40];
MinMax _rectYMinMax[40];
- Common::Point _rulesBuffer12Pos3[40];
+ Common::Point _keyPos[40];
Common::Point _portalPos[40];
int _interfaceHotspotNumb;
byte _interfaceTwoStepAction[20];
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index d1426c3bcb..fb6a4b0d10 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -48,7 +48,7 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_monitoredAttr[1] = 1;
_monitoredAttr[2] = 2;
_monitoredAttr[3] = 3;
- _savedBuffer215Ptr = NULL;
+ _barAttrPtr = NULL;
_word1825E = Common::Point(0, 0);
for (int i = 0; i < 20; i++) {
@@ -368,10 +368,10 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_changeCurrentCharacterSprite();
break;
case 0x29:
- OC_sub17E99();
+ OC_getList();
break;
case 0x2A:
- OC_sub17EC5();
+ OC_setList();
break;
case 0x2B:
OC_setCharacterDirectionTowardsPos();
@@ -652,8 +652,8 @@ static const OpCode opCodes2[] = {
/* 0x26 */ { "OC_setCurrentCharacterPos", 2, kImmediateValue, kgetPosFromScript, kNone, kNone, kNone },
/* 0x27 */ { "OC_setCurrentCharacterBehavior", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x28 */ { "OC_changeCurrentCharacterSprite", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
-/* 0x29 */ { "OC_sub17E99", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
-/* 0x2a */ { "OC_sub17EC5", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
+/* 0x29 */ { "OC_getList", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
+/* 0x2a */ { "OC_setList", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
/* 0x2b */ { "OC_setCharacterDirectionTowardsPos", 1, kgetPosFromScript, kNone, kNone, kNone, kNone },
/* 0x2c */ { "OC_turnCharacterTowardsAnother", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x2d */ { "OC_setSeek", 1, kGetValue1, kNone, kNone, kNone, kNone },
@@ -1057,7 +1057,7 @@ void LilliputScript::setSequence(int charIdx, int8 seqIdx) {
assert(charIdx < 40);
_characterLastSequence[charIdx] = seqIdx;
- byte *buf = _vm->_rulesChunk1;
+ byte *buf = _vm->_sequencesArr;
if (seqIdx != 0) {
int count = 0;
while (count < seqIdx) {
@@ -1328,7 +1328,7 @@ Common::Point LilliputScript::getPosFromScript() {
case 0xF8: {
int8 index = curWord & 0xFF;
assert((index >= 0) && (index < 40));
- return _vm->_rulesBuffer12Pos3[index];
+ return _vm->_keyPos[index];
}
case 0xF7: {
int8 index = _vm->_currentCharacterAttributes[6];
@@ -2571,8 +2571,8 @@ byte *LilliputScript::getCurrentCharacterVarFromScript() {
return &_vm->_currentCharacterAttributes[index];
}
-void LilliputScript::OC_sub17E99() {
- debugC(1, kDebugScript, "OC_sub17E99()");
+void LilliputScript::OC_getList() {
+ debugC(1, kDebugScript, "OC_getList()");
byte *compBuf = getCurrentCharacterVarFromScript();
uint16 oper = _currScript->readUint16LE();
@@ -2580,25 +2580,25 @@ void LilliputScript::OC_sub17E99() {
byte *buf = getCurrentCharacterVarFromScript();
byte var1 = buf[0];
- byte var3 = _vm->_rulesChunk11[var1 + _vm->_rulesChunk10[index]];
+ byte var3 = _vm->_listArr[var1 + _vm->_listIndex[index]];
computeOperation(compBuf, oper, var3);
}
-void LilliputScript::OC_sub17EC5() {
- debugC(1, kDebugScriptTBC, "OC_sub17EC5()");
+void LilliputScript::OC_setList() {
+ debugC(1, kDebugScript, "OC_setList()");
int indexChunk10 = _currScript->readUint16LE();
byte *compBuf = getCurrentCharacterVarFromScript();
- int indexChunk11 = _vm->_rulesChunk10[indexChunk10] + compBuf[0];
+ int indexChunk11 = _vm->_listIndex[indexChunk10] + compBuf[0];
uint16 oper = _currScript->readUint16LE();
byte *tmpBuf = getCurrentCharacterVarFromScript();
int16 var3 = tmpBuf[0];
- computeOperation(&_vm->_rulesChunk11[indexChunk11], oper, var3);
+ computeOperation(&_vm->_listArr[indexChunk11], oper, var3);
}
Common::Point LilliputScript::getCharacterTilePos(int index) {
@@ -3244,7 +3244,7 @@ void LilliputScript::OC_initSmallAnim() {
void LilliputScript::OC_setCharacterHeroismBar() {
debugC(1, kDebugScript, "OC_setCharacterHeroismBar()");
- _savedBuffer215Ptr = getCharacterAttributesPtr();
+ _barAttrPtr = getCharacterAttributesPtr();
_heroismBarX = _currScript->readUint16LE();
_heroismBarBottomY = _currScript->readUint16LE();
}
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index c711ceb901..d75d24e3cf 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -83,7 +83,7 @@ public:
byte _characterSeek[40];
int16 _interactions[40 * 40];
- byte *_savedBuffer215Ptr;
+ byte *_barAttrPtr;
Common::Point _viewportPos;
int16 _viewportCharacterTarget;
@@ -247,8 +247,8 @@ private:
void OC_setCurrentCharacterPos();
void OC_setCurrentCharacterBehavior();
void OC_changeCurrentCharacterSprite();
- void OC_sub17E99();
- void OC_sub17EC5();
+ void OC_getList();
+ void OC_setList();
void OC_setCharacterDirectionTowardsPos();
void OC_turnCharacterTowardsAnother();
void OC_setSeek();
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 70923e93d5..4b22a94d0c 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -625,6 +625,8 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 var, const ArgumentsArray
}
void MystScriptParser::o_changeBackgroundSound(uint16 var, const ArgumentsArray &args) {
+ soundWaitStop();
+
// Used on Stoneship Card 2080
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List
Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
@@ -787,12 +789,16 @@ void MystScriptParser::o_soundWaitStop(uint16 var, const ArgumentsArray &args) {
// Used on Selenitic Card 1191 (Maze Runner)
// Used on Mechanical Card 6267 (Code Lock)
// Used when Button is pushed...
- while (_vm->_sound->isEffectPlaying())
+ soundWaitStop();
+}
+
+void MystScriptParser::soundWaitStop() const {
+ while (_vm->_sound->isEffectPlaying() && !Engine::shouldQuit())
_vm->doFrame();
}
void MystScriptParser::o_quit(uint16 var, const ArgumentsArray &args) {
- _vm->quitGame();
+ Engine::quitGame();
}
void MystScriptParser::showMap() {
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index 3ef8663324..a7a840b9d3 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -87,6 +87,7 @@ public:
void showMap();
void animatedUpdate(const ArgumentsArray &args, uint16 delay);
+ void soundWaitStop() const;
// Common opcodes
DECLARE_OPCODE(o_toggleVar);
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 82e29eb42f..83d787f2f3 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -633,25 +633,43 @@ uint16 Myst::getVar(uint16 var) {
return 10;
case 79: // Stellar Observatory Date - Year #4 (Right)
return (_state.observatoryYearSetting / 1) % 10;
- case 80: // Stellar Observatory Hour #1 - Left ( Number 1 (0) or Blank (10))
+ case 80: // Stellar Observatory Hour #1 - Left ( Hour digits can be 10 (Blank), or 0-2)
+ uint32 observatoryLeftMinutes;
if (!observatoryIsDDMMYYYY2400()) {
- if (_state.observatoryTimeSetting % (12 * 60) < (10 * 60))
+ // 12 Hour Format
+ observatoryLeftMinutes = _state.observatoryTimeSetting % (12 * 60);
+ if (observatoryLeftMinutes > 59 && observatoryLeftMinutes < (10 * 60))
return 10;
else
return 1;
- } else {
- if (_state.observatoryTimeSetting < (10 * 60))
- return 10;
- else if (_state.observatoryTimeSetting < (20 * 60))
+ }
+ else {
+ // 24 Hour Format
+ observatoryLeftMinutes = _state.observatoryTimeSetting;
+ if (observatoryLeftMinutes < (10 * 60))
+ return 0;
+ else if (observatoryLeftMinutes < (20 * 60))
return 1;
else
return 2;
}
case 81: // Stellar Observatory Hour #2 - Right
- if (!observatoryIsDDMMYYYY2400())
- return ((_state.observatoryTimeSetting % (12 * 60)) / 60) % 10;
- else
- return (_state.observatoryTimeSetting / 60) % 10;
+ uint32 observatoryRightMinutes,observatoryRightHour;
+ if (!observatoryIsDDMMYYYY2400()) {
+ // 12 Hour Format
+ observatoryRightMinutes = _state.observatoryTimeSetting % (12 * 60);
+ observatoryRightHour = observatoryRightMinutes / 60;
+ if ( observatoryRightHour % 12 == 0)
+ return 2;
+ else
+ return observatoryRightHour % 10;
+ }
+ else {
+ // 24 Hour Format
+ observatoryRightMinutes = _state.observatoryTimeSetting;
+ observatoryRightHour = observatoryRightMinutes / 60;
+ return observatoryRightHour % 10;
+ }
case 82: // Stellar Observatory Minutes #1 - Left
return (_state.observatoryTimeSetting % 60) / 10;
case 83: // Stellar Observatory Minutes #2 - Right
@@ -1626,6 +1644,7 @@ void Myst::observatoryIncrementMonth(int16 increment) {
}
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
}
void Myst::observatoryMonthChange_run() {
@@ -1692,6 +1711,7 @@ void Myst::observatoryIncrementDay(int16 increment) {
}
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
}
void Myst::observatoryDayChange_run() {
@@ -1752,6 +1772,7 @@ void Myst::observatoryIncrementYear(int16 increment) {
}
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
}
void Myst::observatoryYearChange_run() {
@@ -1817,6 +1838,7 @@ void Myst::observatoryIncrementTime(int16 increment) {
}
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
}
void Myst::observatoryTimeChange_run() {
@@ -2512,6 +2534,7 @@ void Myst::observatoryUpdateMonth() {
_state.observatoryMonthSetting = month;
_state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y;
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
// Redraw digits
_vm->redrawArea(73);
@@ -2539,6 +2562,7 @@ void Myst::observatoryUpdateDay() {
_state.observatoryDaySetting = day;
_state.observatoryDaySlider = _observatoryDaySlider->_pos.y;
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
// Redraw digits
_vm->redrawArea(75);
@@ -2567,6 +2591,7 @@ void Myst::observatoryUpdateYear() {
_state.observatoryYearSetting = year;
_state.observatoryYearSlider = _observatoryYearSlider->_pos.y;
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
// Redraw digits
_vm->redrawArea(79);
@@ -2597,6 +2622,7 @@ void Myst::observatoryUpdateTime() {
_state.observatoryTimeSetting = time;
_state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y;
_vm->_sound->playEffect(8500);
+ _vm->wait(20);
// Redraw digits
_vm->redrawArea(80);
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 2aa6ae8902..fbe025c0b7 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -258,8 +258,8 @@ void ScalpelEngine::setupGraphics() {
// First try for a 640x400 mode
g_system->beginGFXTransaction();
- initCommonGFX();
- g_system->initSize(640, 400, &pixelFormatRGB565);
+ initCommonGFX();
+ g_system->initSize(640, 400, &pixelFormatRGB565);
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
if (gfxError == OSystem::kTransactionSuccess) {
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index dba5f01694..d6cfbb53fe 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -1312,9 +1312,9 @@ builtIn(skipSpeech) {
builtIn(getOverObject) {
UNUSEDALL
- if (overRegion)
+ if (g_sludge->_regionMan->getOverRegion())
// Return value
- setVariable(fun->reg, SVT_OBJTYPE, overRegion->thisType->objectNum);
+ setVariable(fun->reg, SVT_OBJTYPE, g_sludge->_regionMan->getOverRegion()->thisType->objectNum);
else
// Return value
setVariable(fun->reg, SVT_INT, 0);
@@ -1346,7 +1346,7 @@ builtIn(getObjectX) {
if (pers) {
setVariable(fun->reg, SVT_INT, pers->x);
} else {
- ScreenRegion *la = getRegionForObject(objectNumber);
+ ScreenRegion *la = g_sludge->_regionMan->getRegionForObject(objectNumber);
if (la) {
setVariable(fun->reg, SVT_INT, la->sX);
} else {
@@ -1367,7 +1367,7 @@ builtIn(getObjectY) {
if (pers) {
setVariable(fun->reg, SVT_INT, pers->y);
} else {
- ScreenRegion *la = getRegionForObject(objectNumber);
+ ScreenRegion *la = g_sludge->_regionMan->getRegionForObject(objectNumber);
if (la) {
setVariable(fun->reg, SVT_INT, la->sY);
} else {
@@ -1404,7 +1404,7 @@ builtIn(addScreenRegion) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- if (addScreenRegion(x1, y1, x2, y2, sX, sY, di, objectNumber))
+ if (g_sludge->_regionMan->addScreenRegion(x1, y1, x2, y2, sX, sY, di, objectNumber))
return BR_CONTINUE;
return BR_ERROR;
@@ -1416,19 +1416,19 @@ builtIn(removeScreenRegion) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- removeScreenRegion(objectNumber);
+ g_sludge->_regionMan->removeScreenRegion(objectNumber);
return BR_CONTINUE;
}
builtIn(showBoxes) {
UNUSEDALL
- showBoxes();
+ g_sludge->_regionMan->showBoxes();
return BR_CONTINUE;
}
builtIn(removeAllScreenRegions) {
UNUSEDALL
- killAllRegions();
+ g_sludge->_regionMan->kill();
return BR_CONTINUE;
}
@@ -1708,7 +1708,7 @@ static BuiltReturn moveChr(int numParams, LoadedFunction *fun, bool force, bool
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- reggie = getRegionForObject(toObj);
+ reggie = g_sludge->_regionMan->getRegionForObject(toObj);
if (reggie == NULL)
return BR_CONTINUE;
@@ -1945,7 +1945,7 @@ builtIn(isScreenRegion) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- setVariable(fun->reg, SVT_INT, getRegionForObject(objectNumber) != NULL);
+ setVariable(fun->reg, SVT_INT, g_sludge->_regionMan->getRegionForObject(objectNumber) != NULL);
return BR_CONTINUE;
}
diff --git a/engines/sludge/event.cpp b/engines/sludge/event.cpp
index d5c453bdc1..b553702710 100644
--- a/engines/sludge/event.cpp
+++ b/engines/sludge/event.cpp
@@ -36,8 +36,6 @@ namespace Sludge {
extern Variable *launchResult;
extern VariableStack *noStack;
-extern ScreenRegion *overRegion;
-extern ScreenRegion *lastRegion;
EventManager::EventManager(SludgeEngine *vm) {
_vm = vm;
@@ -152,14 +150,14 @@ void EventManager::checkInput() {
bool EventManager::handleInput() {
static int l = 0;
- if (!g_sludge->launchMe.empty()) {
+ if (!_vm->launchMe.empty()) {
if (l) {
// Still paused because of spawned thingy...
} else {
l = 1;
setVariable(*launchResult, SVT_INT, 0/*launch(launchMe) > 31*/); //TODO:false value
- g_sludge->launchMe.clear();
+ _vm->launchMe.clear();
launchResult = nullptr;
}
return true;
@@ -167,8 +165,8 @@ bool EventManager::handleInput() {
l = 0;
}
- if (!overRegion)
- getOverRegion();
+ if (!_vm->_regionMan->getOverRegion())
+ _vm->_regionMan->updateOverRegion();
if (_input.justMoved) {
if (_currentEvents->func[kMoveMouse]) {
@@ -178,12 +176,13 @@ bool EventManager::handleInput() {
}
_input.justMoved = false;
- if (lastRegion != overRegion && _currentEvents->func[kFocus]) {
+ if (_vm-> _regionMan->isRegionChanged()&& _currentEvents->func[kFocus]) {
VariableStack *tempStack = new VariableStack;
if (!checkNew(tempStack))
return false;
initVarNew(tempStack->thisVar);
+ ScreenRegion *overRegion = _vm->_regionMan->getOverRegion();
if (overRegion) {
setVariable(tempStack->thisVar, SVT_OBJTYPE, overRegion->thisType->objectNum);
} else {
@@ -333,7 +332,7 @@ bool EventManager::handleInput() {
_input.rightRelease = false;
_input.leftRelease = false;
_input.keyPressed = 0;
- lastRegion = overRegion;
+ _vm->_regionMan->updateLastRegion();
return true;
}
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index e90f2700d8..0f032731c7 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -95,10 +95,7 @@ bool GraphicsManager::freeze() {
return false;
newFreezer->frozenStatus = copyStatusBarStuff(newStatusStuff);
- newFreezer->allScreenRegions = allScreenRegions;
- allScreenRegions = NULL;
- overRegion = NULL;
-
+ _vm->_regionMan->freeze(newFreezer);
_vm->_cursorMan->freeze(newFreezer);
_vm->_speechMan->freeze(newFreezer);
_vm->_evtMan->freeze(newFreezer);
@@ -139,8 +136,7 @@ void GraphicsManager::unfreeze(bool killImage) {
killAllPeople();
allPeople = _frozenStuff->allPeople;
- killAllRegions();
- allScreenRegions = _frozenStuff->allScreenRegions;
+ g_sludge->_regionMan->resotre(_frozenStuff);
killLightMap();
@@ -171,7 +167,6 @@ void GraphicsManager::unfreeze(bool killImage) {
_vm->_speechMan->restore(_frozenStuff);
_frozenStuff = _frozenStuff->next;
- overRegion = NULL;
// free current frozen screen struct
if (killMe->backdropSurface.getPixels())
diff --git a/engines/sludge/freeze.h b/engines/sludge/freeze.h
index 830c2d8a72..647ccc9fc8 100644
--- a/engines/sludge/freeze.h
+++ b/engines/sludge/freeze.h
@@ -32,12 +32,15 @@ struct ScreenRegion;
struct SpeechStruct;
struct StatusStuff ;
struct EventHandlers;
+struct ScreenRegion;
+
+typedef Common::List<ScreenRegion *> ScreenRegionList;
class Parallax;
struct FrozenStuffStruct {
OnScreenPerson *allPeople;
- ScreenRegion *allScreenRegions;
+ ScreenRegionList *allScreenRegions;
Graphics::Surface backdropSurface;
Graphics::Surface lightMapSurface;
Graphics::Surface *zBufferSprites;
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index 4cabbc79da..2a69d02280 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -375,7 +375,7 @@ bool saveGame(const Common::String &fname) {
g_sludge->_evtMan->saveHandlers(fp);
// Save regions
- saveRegions(fp);
+ g_sludge->_regionMan->saveRegions(fp);
g_sludge->_cursorMan->saveCursor(fp);
@@ -504,7 +504,7 @@ bool loadGame(const Common::String &fname) {
g_sludge->_txtMan->loadFont(ssgVersion, fp);
killAllPeople();
- killAllRegions();
+ g_sludge->_regionMan->kill();
int camerX = fp->readUint16BE();
int camerY = fp->readUint16BE();
@@ -519,7 +519,7 @@ bool loadGame(const Common::String &fname) {
g_sludge->_gfxMan->loadHSI(fp, 0, 0, true);
g_sludge->_evtMan->loadHandlers(fp);
- loadRegions(fp);
+ g_sludge->_regionMan->loadRegions(fp);
if (!g_sludge->_cursorMan->loadCursor(fp)) {
return false;
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index 4aec5fa8b7..d0694795c3 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -51,13 +51,11 @@ extern VariableStack *noStack;
extern int ssgVersion;
ScreenRegion personRegion;
-extern ScreenRegion *lastRegion;
extern Floor *currentFloor;
OnScreenPerson *allPeople = NULL;
int16 scaleHorizon = 75;
int16 scaleDivide = 150;
-extern ScreenRegion *allScreenRegions;
void setFrames(OnScreenPerson &m, int a) {
m.myAnim = m.myPersona->animation[(a * m.myPersona->numDirections) + m.direction];
@@ -161,8 +159,6 @@ bool initPeople() {
personRegion.sX = 0;
personRegion.sY = 0;
personRegion.di = -1;
- allScreenRegions = NULL;
-
return true;
}
@@ -410,8 +406,6 @@ void setPersonColourise(int ob, byte r, byte g, byte b, byte colourmix) {
moveMe->colourmix = colourmix;
}
-extern ScreenRegion *overRegion;
-
void shufflePeople() {
OnScreenPerson **thisReference = &allPeople;
OnScreenPerson *A, *B;
@@ -445,7 +439,7 @@ void drawPeople() {
OnScreenPerson *thisPerson = allPeople;
PersonaAnimation *myAnim = NULL;
- overRegion = NULL;
+ g_sludge->_regionMan->resetOverRegion();
while (thisPerson) {
if (thisPerson->show) {
@@ -480,9 +474,9 @@ void drawPeople() {
if (r) {
if (!thisPerson->thisType->screenName.empty()) {
if (personRegion.thisType != thisPerson->thisType)
- lastRegion = NULL;
+ g_sludge->_regionMan->resetLastRegion();
personRegion.thisType = thisPerson->thisType;
- overRegion = &personRegion;
+ g_sludge->_regionMan->setOverRegion(&personRegion);
}
}
}
@@ -943,8 +937,9 @@ void removeOneCharacter(int i) {
OnScreenPerson *p = findPerson(i);
if (p) {
+ ScreenRegion *overRegion = g_sludge->_regionMan->getOverRegion();
if (overRegion == &personRegion && overRegion->thisType == p->thisType) {
- overRegion = NULL;
+ overRegion = nullptr;
}
if (p->continueAfterWalking)
diff --git a/engines/sludge/region.cpp b/engines/sludge/region.cpp
index 7593fe4aee..4410951057 100644
--- a/engines/sludge/region.cpp
+++ b/engines/sludge/region.cpp
@@ -33,75 +33,65 @@
namespace Sludge {
-ScreenRegion *allScreenRegions = nullptr;
-ScreenRegion *overRegion = nullptr;
-ScreenRegion *lastRegion = nullptr;
-
-void showBoxes() {
- ScreenRegion*huntRegion = allScreenRegions;
-
- while (huntRegion) {
- g_sludge->_gfxMan->drawVerticalLine(huntRegion->x1, huntRegion->y1, huntRegion->y2);
- g_sludge->_gfxMan->drawVerticalLine(huntRegion->x2, huntRegion->y1, huntRegion->y2);
- g_sludge->_gfxMan->drawHorizontalLine(huntRegion->x1, huntRegion->y1, huntRegion->x2);
- g_sludge->_gfxMan->drawHorizontalLine(huntRegion->x1, huntRegion->y2, huntRegion->x2);
- huntRegion = huntRegion->next;
- }
+RegionManager::RegionManager(SludgeEngine *vm)
+{
+ _vm = vm;
+ _allScreenRegions = new ScreenRegionList;
+ _allScreenRegions->clear();
+ _lastRegion = nullptr;
+ _overRegion = nullptr;
+}
+
+RegionManager::~RegionManager() {
+ kill();
+
+ delete _allScreenRegions;
+ _allScreenRegions = nullptr;
}
-void removeScreenRegion(int objectNum) {
- ScreenRegion **huntRegion = &allScreenRegions;
- ScreenRegion *killMe;
+void RegionManager::showBoxes() {
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ g_sludge->_gfxMan->drawVerticalLine((*it)->x1, (*it)->y1, (*it)->y2);
+ g_sludge->_gfxMan->drawVerticalLine((*it)->x2, (*it)->y1, (*it)->y2);
+ g_sludge->_gfxMan->drawHorizontalLine((*it)->x1, (*it)->y1, (*it)->x2);
+ g_sludge->_gfxMan->drawHorizontalLine((*it)->x1, (*it)->y2, (*it)->x2);
+ }
+}
- while (*huntRegion) {
- if ((*huntRegion)->thisType->objectNum == objectNum) {
- killMe = *huntRegion;
- *huntRegion = killMe->next;
+void RegionManager::removeScreenRegion(int objectNum) {
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ if ((*it)->thisType->objectNum == objectNum) {
+ ScreenRegion *killMe = *it;
g_sludge->_objMan->removeObjectType(killMe->thisType);
- if (killMe == overRegion)
- overRegion = NULL;
+ if (killMe == _overRegion)
+ _overRegion = nullptr;
delete killMe;
- killMe = NULL;
- } else {
- huntRegion = &((*huntRegion)->next);
+ killMe = nullptr;
+ _allScreenRegions->reverse_erase(it);
}
}
}
-void saveRegions(Common::WriteStream *stream) {
- int numRegions = 0;
- ScreenRegion *thisRegion = allScreenRegions;
- while (thisRegion) {
- thisRegion = thisRegion->next;
- numRegions++;
- }
+void RegionManager::saveRegions(Common::WriteStream *stream) {
+ uint numRegions = _allScreenRegions->size();
stream->writeUint16BE(numRegions);
- thisRegion = allScreenRegions;
- while (thisRegion) {
- stream->writeUint16BE(thisRegion->x1);
- stream->writeUint16BE(thisRegion->y1);
- stream->writeUint16BE(thisRegion->x2);
- stream->writeUint16BE(thisRegion->y2);
- stream->writeUint16BE(thisRegion->sX);
- stream->writeUint16BE(thisRegion->sY);
- stream->writeUint16BE(thisRegion->di);
- g_sludge->_objMan->saveObjectRef(thisRegion->thisType, stream);
-
- thisRegion = thisRegion->next;
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ stream->writeUint16BE((*it)->x1);
+ stream->writeUint16BE((*it)->y1);
+ stream->writeUint16BE((*it)->x2);
+ stream->writeUint16BE((*it)->y2);
+ stream->writeUint16BE((*it)->sX);
+ stream->writeUint16BE((*it)->sY);
+ stream->writeUint16BE((*it)->di);
+ g_sludge->_objMan->saveObjectRef((*it)->thisType, stream);
}
}
-void loadRegions(Common::SeekableReadStream *stream) {
+void RegionManager::loadRegions(Common::SeekableReadStream *stream) {
int numRegions = stream->readUint16BE();
-
- ScreenRegion *newRegion;
- ScreenRegion **pointy = &allScreenRegions;
-
while (numRegions--) {
- newRegion = new ScreenRegion;
- *pointy = newRegion;
- pointy = &(newRegion->next);
-
+ ScreenRegion *newRegion = new ScreenRegion;
+ _allScreenRegions->push_back(newRegion);
newRegion->x1 = stream->readUint16BE();
newRegion->y1 = stream->readUint16BE();
newRegion->x2 = stream->readUint16BE();
@@ -111,22 +101,20 @@ void loadRegions(Common::SeekableReadStream *stream) {
newRegion->di = stream->readUint16BE();
newRegion->thisType = g_sludge->_objMan->loadObjectRef(stream);
}
- *pointy = NULL;
}
-void killAllRegions() {
- ScreenRegion *killRegion;
- while (allScreenRegions) {
- killRegion = allScreenRegions;
- allScreenRegions = allScreenRegions->next;
+void RegionManager::kill() {
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ ScreenRegion *killRegion = (*it);
g_sludge->_objMan->removeObjectType(killRegion->thisType);
delete killRegion;
}
- overRegion = nullptr;
- lastRegion = nullptr;
+ _allScreenRegions->clear();
+ _overRegion = nullptr;
+ _lastRegion = nullptr;
}
-bool addScreenRegion(int x1, int y1, int x2, int y2, int sX, int sY, int di,
+bool RegionManager::addScreenRegion(int x1, int y1, int x2, int y2, int sX, int sY, int di,
int objectNum) {
ScreenRegion *newRegion = new ScreenRegion;
if (!checkNew(newRegion))
@@ -139,40 +127,51 @@ bool addScreenRegion(int x1, int y1, int x2, int y2, int sX, int sY, int di,
newRegion->sX = sX;
newRegion->sY = sY;
newRegion->thisType = g_sludge->_objMan->loadObjectType(objectNum);
- newRegion->next = allScreenRegions;
- allScreenRegions = newRegion;
- return (bool) (newRegion->thisType != NULL);
+ _allScreenRegions->push_front(newRegion);
+ return (bool) (newRegion->thisType != nullptr);
}
-void getOverRegion() {
+void RegionManager::updateOverRegion() {
int cameraX = g_sludge->_gfxMan->getCamX();
int cameraY = g_sludge->_gfxMan->getCamY();
- ScreenRegion *thisRegion = allScreenRegions;
- while (thisRegion) {
- if ((g_sludge->_evtMan->mouseX() >= thisRegion->x1 - cameraX)
- && (g_sludge->_evtMan->mouseY() >= thisRegion->y1 - cameraY)
- && (g_sludge->_evtMan->mouseX() <= thisRegion->x2 - cameraX)
- && (g_sludge->_evtMan->mouseY() <= thisRegion->y2 - cameraY)) {
- overRegion = thisRegion;
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ if ((g_sludge->_evtMan->mouseX() >= (*it)->x1 - cameraX)
+ && (g_sludge->_evtMan->mouseY() >= (*it)->y1 - cameraY)
+ && (g_sludge->_evtMan->mouseX() <= (*it)->x2 - cameraX)
+ && (g_sludge->_evtMan->mouseY() <= (*it)->y2 - cameraY)) {
+ _overRegion = (*it);
return;
}
- thisRegion = thisRegion->next;
}
- overRegion = NULL;
+ _overRegion = nullptr;
return;
}
-ScreenRegion *getRegionForObject(int obj) {
- ScreenRegion *thisRegion = allScreenRegions;
-
- while (thisRegion) {
- if (obj == thisRegion->thisType->objectNum) {
- return thisRegion;
+ScreenRegion *RegionManager::getRegionForObject(int obj) {
+ for (ScreenRegionList::iterator it = _allScreenRegions->begin(); it != _allScreenRegions->end(); ++it) {
+ if (obj == (*it)->thisType->objectNum) {
+ return (*it);
}
- thisRegion = thisRegion->next;
}
- return NULL;
+ return nullptr;
+}
+
+void RegionManager::freeze(FrozenStuffStruct *frozenStuff) {
+ frozenStuff->allScreenRegions = _allScreenRegions;
+ _allScreenRegions = new ScreenRegionList;
+ _overRegion = nullptr;
+}
+
+void RegionManager::resotre(FrozenStuffStruct *frozenStuff) {
+ // kill
+ kill();
+ delete _allScreenRegions;
+ _allScreenRegions = nullptr;
+
+ // restore
+ _allScreenRegions = frozenStuff->allScreenRegions;
+ _overRegion = nullptr;
}
} // End of namespace Sludge
diff --git a/engines/sludge/region.h b/engines/sludge/region.h
index 74294814f6..5f307cc9d0 100644
--- a/engines/sludge/region.h
+++ b/engines/sludge/region.h
@@ -23,24 +23,56 @@
#define SLUDGE_REGION_H
#include "sludge/objtypes.h"
+#include "sludge/freeze.h"
namespace Sludge {
struct ScreenRegion {
int x1, y1, x2, y2, sX, sY, di;
ObjectType *thisType;
- ScreenRegion *next;
};
+typedef Common::List<ScreenRegion *> ScreenRegionList;
-bool addScreenRegion(int x1, int y1, int x2, int y2, int, int, int, int objectNum);
-void getOverRegion();
-ScreenRegion *getRegionForObject(int obj);
-void removeScreenRegion(int objectNum);
-void loadRegions(Common::SeekableReadStream *stream);
-void saveRegions(Common::WriteStream *stream);
-void killAllRegions();
+class RegionManager {
+public:
+ RegionManager(SludgeEngine *vm);
+ ~RegionManager();
-void showBoxes();
+ // Kill
+ void kill();
+
+ // Add & remove region
+ bool addScreenRegion(int x1, int y1, int x2, int y2, int, int, int, int objectNum);
+ void removeScreenRegion(int objectNum);
+
+ // Save & load
+ void loadRegions(Common::SeekableReadStream *stream);
+ void saveRegions(Common::WriteStream *stream);
+
+ // Draw
+ void showBoxes();
+
+ // Setter & getter
+ ScreenRegion *getRegionForObject(int obj);
+ ScreenRegion *getOverRegion() const { return _overRegion; }
+ void setOverRegion(ScreenRegion *newRegion) { _overRegion = newRegion; }
+ void updateOverRegion();
+ bool isRegionChanged() const { return _lastRegion != _overRegion; }
+ void updateLastRegion() { _lastRegion = _overRegion; }
+ void resetOverRegion() { _overRegion = nullptr; }
+ void resetLastRegion() { _lastRegion = nullptr; }
+
+ // Freeze
+ void freeze(FrozenStuffStruct *frozenStuff);
+ void resotre(FrozenStuffStruct *frozenStuff);
+
+private:
+ SludgeEngine *_vm;
+
+ ScreenRegionList *_allScreenRegions;
+ ScreenRegion *_overRegion;
+ ScreenRegion *_lastRegion;
+};
} // End of namespace Sludge
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index d14f92202f..483fb53d7d 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -29,6 +29,7 @@
#include "sludge/event.h"
#include "sludge/fonttext.h"
#include "sludge/graphics.h"
+#include "sludge/region.h"
#include "sludge/sludge.h"
#include "sludge/sound.h"
#include "sludge/speech.h"
@@ -82,6 +83,7 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
_txtMan = new TextManager();
_cursorMan = new CursorManager(this);
_speechMan = new SpeechManager(this);
+ _regionMan = new RegionManager(this);
}
SludgeEngine::~SludgeEngine() {
@@ -122,6 +124,8 @@ SludgeEngine::~SludgeEngine() {
_resMan = nullptr;
delete _speechMan;
_speechMan = nullptr;
+ delete _regionMan;
+ _regionMan = nullptr;
}
Common::Error SludgeEngine::run() {
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index 83c6359f52..fa1038231a 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -41,6 +41,7 @@ extern SludgeEngine *g_sludge;
class CursorManager;
class EventManager;
class GraphicsManager;
+class RegionManager;
class SoundManager;
class SpeechManager;
class TextManager;
@@ -88,6 +89,7 @@ public:
TextManager *_txtMan;
CursorManager *_cursorMan;
SpeechManager *_speechMan;
+ RegionManager *_regionMan;
SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc);
virtual ~SludgeEngine();
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 9526ddf4df..0da7f39427 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -183,7 +183,7 @@ void initSludge() {
void killSludge() {
killAllFunctions();
killAllPeople();
- killAllRegions();
+ g_sludge->_regionMan->kill();
setFloorNull();
g_sludge->_speechMan->kill();
g_sludge->_languageMan->kill();
diff --git a/engines/sludge/speech.cpp b/engines/sludge/speech.cpp
index b3fedac70e..6324da88cc 100644
--- a/engines/sludge/speech.cpp
+++ b/engines/sludge/speech.cpp
@@ -193,7 +193,7 @@ int SpeechManager::wrapSpeech(const Common::String &theText, int objT, int sampl
setObjFontColour(thisPerson->thisType);
i = wrapSpeechPerson(theText, *thisPerson, sampleFile, animPerson);
} else {
- ScreenRegion *thisRegion = getRegionForObject(objT);
+ ScreenRegion *thisRegion = g_sludge->_regionMan->getRegionForObject(objT);
if (thisRegion) {
setObjFontColour(thisRegion->thisType);
i = wrapSpeechXY(theText,
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 1b5af76ee7..589c95de3b 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -464,7 +464,7 @@ TestExitStatus GFXtests::fullScreenMode() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
g_system->endGFXTransaction();
// Current state should be now !isFeatureEnabled
@@ -482,7 +482,7 @@ TestExitStatus GFXtests::fullScreenMode() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
g_system->endGFXTransaction();
g_system->delayMillis(1000);
@@ -536,7 +536,7 @@ TestExitStatus GFXtests::filteringMode() {
if (g_system->hasFeature(OSystem::kFeatureFullscreenMode) && !g_system->getFeatureState(OSystem::kFeatureFullscreenMode)) {
fullScreenToggled = true;
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true);
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true);
g_system->endGFXTransaction();
}
@@ -557,7 +557,7 @@ TestExitStatus GFXtests::filteringMode() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
g_system->endGFXTransaction();
// Current state should be now !isFeatureEnabled
@@ -575,7 +575,7 @@ TestExitStatus GFXtests::filteringMode() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
g_system->endGFXTransaction();
g_system->delayMillis(1000);
@@ -591,7 +591,7 @@ TestExitStatus GFXtests::filteringMode() {
// Restore fullscreen state
if (fullScreenToggled) {
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false);
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false);
g_system->endGFXTransaction();
}
@@ -639,7 +639,7 @@ TestExitStatus GFXtests::aspectRatio() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, !isFeatureEnabled);
g_system->endGFXTransaction();
g_system->delayMillis(1000);
@@ -653,7 +653,7 @@ TestExitStatus GFXtests::aspectRatio() {
}
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, isFeatureEnabled);
g_system->endGFXTransaction();
} else {
Testsuite::displayMessage("feature not supported");
@@ -835,13 +835,13 @@ TestExitStatus GFXtests::iconifyWindow() {
// Toggle
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureIconifyWindow, !isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureIconifyWindow, !isFeatureEnabled);
g_system->endGFXTransaction();
g_system->delayMillis(1000);
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureIconifyWindow, isFeatureEnabled);
+ g_system->setFeatureState(OSystem::kFeatureIconifyWindow, isFeatureEnabled);
g_system->endGFXTransaction();
} else {
Testsuite::displayMessage("feature not supported");
@@ -884,7 +884,7 @@ TestExitStatus GFXtests::scaledCursors() {
if (isAspectRatioCorrected) {
g_system->beginGFXTransaction();
- g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, false);
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, false);
g_system->endGFXTransaction();
}
@@ -911,8 +911,8 @@ TestExitStatus GFXtests::scaledCursors() {
g_system->beginGFXTransaction();
- bool isGFXModeSet = g_system->setGraphicsMode(gfxMode->id);
- g_system->initSize(320, 200);
+ bool isGFXModeSet = g_system->setGraphicsMode(gfxMode->id);
+ g_system->initSize(320, 200);
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
@@ -947,12 +947,13 @@ TestExitStatus GFXtests::scaledCursors() {
// Restore Original State
g_system->beginGFXTransaction();
- bool isGFXModeSet = g_system->setGraphicsMode(currGFXMode);
- g_system->initSize(320, 200);
- if (isAspectRatioCorrected) {
- g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, true);
- }
+ bool isGFXModeSet = g_system->setGraphicsMode(currGFXMode);
+ g_system->initSize(320, 200);
+
+ if (isAspectRatioCorrected) {
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, true);
+ }
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
@@ -1226,7 +1227,7 @@ TestExitStatus GFXtests::pixelFormats() {
// Switch to that pixel Format
g_system->beginGFXTransaction();
- g_system->initSize(320, 200, &(*iter));
+ g_system->initSize(320, 200, &(*iter));
g_system->endGFXTransaction();
Testsuite::clearScreen(true);
@@ -1272,7 +1273,7 @@ TestExitStatus GFXtests::pixelFormats() {
// Revert back to 8bpp
g_system->beginGFXTransaction();
- g_system->initSize(320, 200);
+ g_system->initSize(320, 200);
g_system->endGFXTransaction();
GFXTestSuite::setCustomColor(255, 0, 0);
initMousePalette();
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 0f6a184cb3..15cd33d28c 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -125,7 +125,7 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
g_system->beginGFXTransaction();
- g_system->initSize(_width, _height, &format);
+ g_system->initSize(_width, _height, &format);
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
if (gfxError != OSystem::kTransactionSuccess) {
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 21a743b59f..f3baca77a4 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -633,12 +633,12 @@ void Combat::monstersAttack() {
_monstersAttacking = false;
- if (_vm->_mode != MODE_SLEEPING) {
+ if (_vm->_mode == MODE_SLEEPING) {
for (uint charNum = 0; charNum < party._activeParty.size(); ++charNum) {
Condition condition = party._activeParty[charNum].worstCondition();
- if (condition != ASLEEP && (condition < PARALYZED || condition == NO_CONDITION)) {
- _vm->_mode = MODE_1;
+ if (condition == DEPRESSED || condition == CONFUSED || condition == NO_CONDITION) {
+ _vm->_mode = MODE_INTERACTIVE;
break;
}
}
@@ -890,7 +890,7 @@ void Combat::doMonsterTurn(int monsterId) {
if (ableChars.size() == 0) {
party._dead = true;
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
return;
}
@@ -2095,7 +2095,7 @@ void Combat::reset() {
clearShooting();
setupCombatParty();
- _combatMode = COMBATMODE_1;
+ _combatMode = COMBATMODE_INTERACTIVE;
_monster2Attack = -1;
}
diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
index e6ac1e27bb..e1a02c0759 100644
--- a/engines/xeen/combat.h
+++ b/engines/xeen/combat.h
@@ -58,7 +58,7 @@ enum ShootType {
};
enum CombatMode {
- COMBATMODE_STARTUP = 0, COMBATMODE_1 = 1, COMBATMODE_2 = 2
+ COMBATMODE_STARTUP = 0, COMBATMODE_INTERACTIVE = 1, COMBATMODE_2 = 2
};
enum PowType {
diff --git a/engines/xeen/dialogs/dialogs_input.cpp b/engines/xeen/dialogs/dialogs_input.cpp
index 6092fc4f3e..d273e57b10 100644
--- a/engines/xeen/dialogs/dialogs_input.cpp
+++ b/engines/xeen/dialogs/dialogs_input.cpp
@@ -84,7 +84,7 @@ Common::KeyState Input::waitForKey(const Common::String &msg) {
intf._tillMove = 0;
bool flag = !_vm->_startupWindowActive && !windows[25]._enabled
- && _vm->_mode != MODE_FF && _vm->_mode != MODE_17;
+ && _vm->_mode != MODE_FF && _vm->_mode != MODE_INTERACTIVE7;
PendingEvent pe;
while (!_vm->shouldExit()) {
@@ -262,7 +262,7 @@ int Choose123::execute(uint numOptions) {
result = 0;
} else if (_buttonValue >= Common::KEYCODE_1 && _buttonValue < (Common::KEYCODE_1 + (int)numOptions)) {
_buttonValue -= Common::KEYCODE_0;
- result = (_buttonValue == numOptions) ? 0 : _buttonValue;
+ result = (_buttonValue == (int)numOptions) ? 0 : _buttonValue;
}
}
diff --git a/engines/xeen/dialogs/dialogs_message.cpp b/engines/xeen/dialogs/dialogs_message.cpp
index df8afea34c..f571e6e811 100644
--- a/engines/xeen/dialogs/dialogs_message.cpp
+++ b/engines/xeen/dialogs/dialogs_message.cpp
@@ -51,7 +51,7 @@ void MessageDialog::execute(const Common::String &msg, MessageWaitType waitType)
break;
case WT_ANIMATED_WAIT:
- if (windows[11]._enabled || _vm->_mode == MODE_17) {
+ if (windows[11]._enabled || _vm->_mode == MODE_INTERACTIVE7) {
g_vm->_locations->wait();
break;
}
diff --git a/engines/xeen/dialogs/dialogs_party.cpp b/engines/xeen/dialogs/dialogs_party.cpp
index 306d1f9c2b..6bd54db712 100644
--- a/engines/xeen/dialogs/dialogs_party.cpp
+++ b/engines/xeen/dialogs/dialogs_party.cpp
@@ -58,7 +58,7 @@ void PartyDialog::execute() {
setupBackground();
while (!_vm->shouldExit()) {
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
// Build up a list of available characters in the Roster that are on the
// same side of Xeen as the player is currently on
diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp
index e59fbdef9c..122b22985e 100644
--- a/engines/xeen/dialogs/dialogs_spells.cpp
+++ b/engines/xeen/dialogs/dialogs_spells.cpp
@@ -137,7 +137,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
spells._lastCaster = _buttonValue;
intf.highlightChar(_buttonValue);
- if (_vm->_mode == MODE_17) {
+ if (_vm->_mode == MODE_INTERACTIVE7) {
windows[10].writeString(Common::String::format(Res.GUILD_OPTIONS,
XeenEngine::printMil(party._gold).c_str(), Res.GUILD_TEXT, c->_name.c_str()));
} else {
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 82523546dd..e986b9f2c1 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -559,7 +559,7 @@ void Interface::perform() {
if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
|| combat._attackMonsters[2] != -1) {
- if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING)
+ if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING)
&& !combat._monstersAttacking && !_charsShooting) {
doCombat();
}
@@ -999,7 +999,7 @@ void Interface::rest() {
map.cellFlagLookup(party._mazePosition);
if ((map._currentCantRest || (map.mazeData()._mazeFlags & RESTRICTION_REST))
- && _vm->_mode != MODE_12) {
+ && _vm->_mode != MODE_INTERACTIVE2) {
ErrorScroll::show(_vm, Res.TOO_DANGEROUS_TO_REST, WT_NONFREEZED_WAIT);
} else {
// Check whether any character is in danger of dying
@@ -1025,14 +1025,14 @@ void Interface::rest() {
Mode oldMode = _vm->_mode;
_vm->_mode = MODE_SLEEPING;
- if (oldMode == MODE_12) {
+ if (oldMode == MODE_INTERACTIVE2) {
party.changeTime(8 * 60);
} else {
for (int idx = 0; idx < 10; ++idx) {
chargeStep();
draw3d(true);
- if (_vm->_mode == MODE_1) {
+ if (_vm->_mode == MODE_INTERACTIVE) {
_vm->_mode = oldMode;
return;
}
@@ -1190,7 +1190,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
_flipUIFrame = (_flipUIFrame + 1) % 4;
if (_flipUIFrame == 0)
_flipWater = !_flipWater;
- if (_tillMove && (_vm->_mode == MODE_1 || _vm->_mode == MODE_COMBAT) &&
+ if (_tillMove && (_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_COMBAT) &&
!combat._monstersAttacking && combat._moveMonsters) {
if (--_tillMove == 0)
combat.moveMonsters();
@@ -1226,7 +1226,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
|| combat._attackMonsters[2] != -1) {
- if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) &&
+ if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING) &&
!combat._monstersAttacking && !_charsShooting && combat._moveMonsters) {
doCombat();
if (scripts._eventSkipped)
@@ -1589,7 +1589,7 @@ void Interface::doCombat() {
combat.run();
nextChar();
- if (_vm->_mode == MODE_1) {
+ if (_vm->_mode == MODE_INTERACTIVE) {
party._treasure._gems = 0;
party._treasure._gold = 0;
party._treasure._hasItems = false;
@@ -1680,7 +1680,7 @@ void Interface::doCombat() {
break;
}
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
if (combat._partyRan && (combat._attackMonsters[0] != -1 ||
combat._attackMonsters[1] != -1 || combat._attackMonsters[2] != -1)) {
party.checkPartyDead();
@@ -1701,7 +1701,7 @@ exit:
_vm->_mode = MODE_COMBAT;
draw3d(true);
party.giveTreasure();
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
party._stepped = true;
unhighlightChar();
@@ -1730,7 +1730,7 @@ exit:
}
}
- combat._combatMode = COMBATMODE_1;
+ combat._combatMode = COMBATMODE_INTERACTIVE;
}
void Interface::nextChar() {
@@ -1741,7 +1741,7 @@ void Interface::nextChar() {
return;
if ((combat._attackMonsters[0] == -1 && combat._attackMonsters[1] == -1 &&
combat._attackMonsters[2] == -1) || combat._combatParty.size() == 0) {
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
return;
}
@@ -1751,7 +1751,7 @@ void Interface::nextChar() {
// Check if party is dead
party.checkPartyDead();
if (party._dead) {
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
break;
}
diff --git a/engines/xeen/interface_scene.cpp b/engines/xeen/interface_scene.cpp
index db14c0d988..2c63e2c231 100644
--- a/engines/xeen/interface_scene.cpp
+++ b/engines/xeen/interface_scene.cpp
@@ -63,11 +63,11 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_data[25] = DrawStruct(0, 8, 109);
_data[26] = DrawStruct(0, 201, 109);
_data[27] = DrawStruct(0, 8, 109);
- _data[28] = DrawStruct(1, -64, 61, 14, SPRFLAG_SCENE_CLIPPED);
+ _data[28] = DrawStruct(1, -64, 61, 14);
_data[29] = DrawStruct(1, -40, 61, 14, 0);
_data[30] = DrawStruct(1, -16, 61, 14, 0);
_data[31] = DrawStruct(1, 8, 61, 14, 0);
- _data[32] = DrawStruct(1, 128, 61, 14, SPRFLAG_HORIZ_FLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[32] = DrawStruct(1, 128, 61, 14, SPRFLAG_HORIZ_FLIPPED);
_data[33] = DrawStruct(1, 104, 61, 14, SPRFLAG_HORIZ_FLIPPED);
_data[34] = DrawStruct(1, 80, 61, 14, SPRFLAG_HORIZ_FLIPPED);
_data[35] = DrawStruct(1, 56, 61, 14, SPRFLAG_HORIZ_FLIPPED);
@@ -123,10 +123,10 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_data[85] = DrawStruct(2, 146, 40, 0, SPRFLAG_HORIZ_FLIPPED);
_data[86] = DrawStruct(1, 32, 40, 6, 0);
_data[87] = DrawStruct(0, -7, 30, 7, 0);
- _data[88] = DrawStruct(0, -112, 30, 7, SPRFLAG_SCENE_CLIPPED);
- _data[89] = DrawStruct(0, 98, 30, 7, SPRFLAG_SCENE_CLIPPED);
- _data[90] = DrawStruct(0, -112, 30, 8, SPRFLAG_SCENE_CLIPPED);
- _data[91] = DrawStruct(0, 98, 30, 8, SPRFLAG_SCENE_CLIPPED);
+ _data[88] = DrawStruct(0, -112, 30, 7);
+ _data[89] = DrawStruct(0, 98, 30, 7);
+ _data[90] = DrawStruct(0, -112, 30, 8);
+ _data[91] = DrawStruct(0, 98, 30, 8);
_data[92] = DrawStruct(0, -38, 30, 8, 0);
_data[93] = DrawStruct(0, 25, 30, 8, 0);
_data[94] = DrawStruct(0, -7, 30, 8, 0);
@@ -141,22 +141,22 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_data[103] = DrawStruct(0, 8, 24);
_data[104] = DrawStruct(0, 169, 24, 0, SPRFLAG_HORIZ_FLIPPED);
_data[105] = DrawStruct(1, 32, 24);
- _data[106] = DrawStruct(0, -23, 40, 0, SPRFLAG_SCENE_CLIPPED);
- _data[107] = DrawStruct(0, 200, 40, 0, SPRFLAG_HORIZ_FLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[106] = DrawStruct(0, -23, 40, 0);
+ _data[107] = DrawStruct(0, 200, 40, 0, SPRFLAG_HORIZ_FLIPPED);
_data[108] = DrawStruct(0, 8, 47);
_data[109] = DrawStruct(0, 169, 47, 0, SPRFLAG_HORIZ_FLIPPED);
- _data[110] = DrawStruct(1, -56, -4, SCALE_ENLARGE, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
- _data[111] = DrawStruct(0, -5, 2, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
- _data[112] = DrawStruct(0, -67, 2, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[110] = DrawStruct(1, -56, -4, SCALE_ENLARGE, SPRFLAG_BOTTOM_CLIPPED);
+ _data[111] = DrawStruct(0, -5, 2, 0, SPRFLAG_BOTTOM_CLIPPED);
+ _data[112] = DrawStruct(0, -67, 2, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[113] = DrawStruct(0, 44, 73);
_data[114] = DrawStruct(0, 44, 73);
- _data[115] = DrawStruct(0, 58, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[115] = DrawStruct(0, 58, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[116] = DrawStruct(0, 169, 73);
_data[117] = DrawStruct(0, 169, 73);
- _data[118] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[118] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[119] = DrawStruct(0, 110, 73);
_data[120] = DrawStruct(0, 110, 73);
- _data[121] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[121] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[122] = DrawStruct(0, 110, 73);
_data[123] = DrawStruct(0, 110, 73);
_data[124] = DrawStruct(0, 72, 43);
@@ -172,6 +172,15 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_data[idx]._flags |= SPRFLAG_SCENE_CLIPPED;
}
+void OutdoorDrawList::draw() {
+ // Mark all items to be drawn as being clipped to the scene area
+ for (int idx = 0; idx < size(); ++idx)
+ _data[idx]._flags |= SPRFLAG_SCENE_CLIPPED;
+
+ // Draw the list
+ (*g_vm->_windows)[3].drawList(_data, size());
+}
+
/*------------------------------------------------------------------------*/
IndoorDrawList::IndoorDrawList() :
@@ -286,16 +295,16 @@ IndoorDrawList::IndoorDrawList() :
_data[84] = DrawStruct(0, 71, 53, 12, SPRFLAG_HORIZ_FLIPPED);
_data[85] = DrawStruct(0, 80, 57, 12, 0);
_data[86] = DrawStruct(0, 64, 57, 12, SPRFLAG_HORIZ_FLIPPED);
- _data[87] = DrawStruct(7, -24, 52, 0, SPRFLAG_SCENE_CLIPPED);
+ _data[87] = DrawStruct(7, -24, 52, 0);
_data[88] = DrawStruct(7, 32, 52);
_data[89] = DrawStruct(7, 88, 52);
_data[90] = DrawStruct(0, 144, 52);
- _data[91] = DrawStruct(0, 200, 52, 0, SPRFLAG_SCENE_CLIPPED);
- _data[92] = DrawStruct(0, -79, 52, 11, SPRFLAG_SCENE_CLIPPED);
+ _data[91] = DrawStruct(0, 200, 52, 0);
+ _data[92] = DrawStruct(0, -79, 52, 11);
_data[93] = DrawStruct(0, -27, 52, 11, 0);
_data[94] = DrawStruct(0, 32, 52, 11, 0);
_data[95] = DrawStruct(0, 89, 52, 11, 0);
- _data[96] = DrawStruct(0, 145, 52, 11, SPRFLAG_SCENE_CLIPPED);
+ _data[96] = DrawStruct(0, 145, 52, 11);
_data[97] = DrawStruct(0, -8, 50, 12, 0);
_data[98] = DrawStruct(0, -65, 50, 12, 0);
_data[99] = DrawStruct(0, 49, 50, 12, 0);
@@ -318,17 +327,17 @@ IndoorDrawList::IndoorDrawList() :
_data[116] = DrawStruct(0, 63, 47, 8, SPRFLAG_HORIZ_FLIPPED);
_data[117] = DrawStruct(0, 94, 52, 8, 0);
_data[118] = DrawStruct(0, 50, 52, 8, SPRFLAG_HORIZ_FLIPPED);
- _data[119] = DrawStruct(6, -40, 40, 0, SPRFLAG_SCENE_CLIPPED);
+ _data[119] = DrawStruct(6, -40, 40, 0);
_data[120] = DrawStruct(6, 64, 40);
- _data[121] = DrawStruct(0, 168, 40, 0, SPRFLAG_SCENE_CLIPPED);
- _data[122] = DrawStruct(0, -72, 40, 6, SPRFLAG_SCENE_CLIPPED);
+ _data[121] = DrawStruct(0, 168, 40, 0);
+ _data[122] = DrawStruct(0, -72, 40, 6);
_data[123] = DrawStruct(0, 32, 40, 6, 0);
- _data[124] = DrawStruct(0, 137, 40, 6, SPRFLAG_SCENE_CLIPPED);
+ _data[124] = DrawStruct(0, 137, 40, 6);
_data[125] = DrawStruct(0, -7, 25, 7, 0);
- _data[126] = DrawStruct(0, -112, 25, 7, SPRFLAG_SCENE_CLIPPED);
- _data[127] = DrawStruct(0, 98, 25, 7, SPRFLAG_SCENE_CLIPPED);
- _data[128] = DrawStruct(0, -112, 29, 8, SPRFLAG_SCENE_CLIPPED);
- _data[129] = DrawStruct(0, 98, 29, 8, SPRFLAG_SCENE_CLIPPED);
+ _data[126] = DrawStruct(0, -112, 25, 7);
+ _data[127] = DrawStruct(0, 98, 25, 7);
+ _data[128] = DrawStruct(0, -112, 29, 8);
+ _data[129] = DrawStruct(0, 98, 29, 8);
_data[130] = DrawStruct(0, -38, 29, 8, 0);
_data[131] = DrawStruct(0, 25, 29, 8, 0);
_data[132] = DrawStruct(0, -7, 29, 8, 0);
@@ -342,23 +351,23 @@ IndoorDrawList::IndoorDrawList() :
_data[140] = DrawStruct(0, 55, 41, 4, SPRFLAG_HORIZ_FLIPPED);
_data[141] = DrawStruct(0, 106, 47, 4, 0);
_data[142] = DrawStruct(0, 38, 47, 4, SPRFLAG_HORIZ_FLIPPED);
- _data[143] = DrawStruct(0, -136, 24, 0, SPRFLAG_SCENE_CLIPPED);
+ _data[143] = DrawStruct(0, -136, 24, 0);
_data[144] = DrawStruct(0, 8, 12);
_data[145] = DrawStruct(0, 32, 24);
_data[146] = DrawStruct(0, 200, 12, 0, SPRFLAG_HORIZ_FLIPPED);
- _data[147] = DrawStruct(0, 200, 24, 0, SPRFLAG_SCENE_CLIPPED);
+ _data[147] = DrawStruct(0, 200, 24, 0);
_data[148] = DrawStruct(0, 32, 24);
- _data[149] = DrawStruct(0, -5, 2, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
- _data[150] = DrawStruct(0, -67, 10, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[149] = DrawStruct(0, -5, 2, 0, SPRFLAG_BOTTOM_CLIPPED);
+ _data[150] = DrawStruct(0, -67, 10, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[151] = DrawStruct(0, 44, 73);
_data[152] = DrawStruct(0, 44, 73);
- _data[153] = DrawStruct(0, 58, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[153] = DrawStruct(0, 58, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[154] = DrawStruct(0, 169, 73);
_data[155] = DrawStruct(0, 169, 73);
- _data[156] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[156] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[157] = DrawStruct(0, 110, 73);
_data[158] = DrawStruct(0, 110, 73);
- _data[159] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED | SPRFLAG_SCENE_CLIPPED);
+ _data[159] = DrawStruct(0, -5, 14, 0, SPRFLAG_BOTTOM_CLIPPED);
_data[160] = DrawStruct(0, 110, 73);
_data[161] = DrawStruct(0, 110, 73);
_data[162] = DrawStruct(0, 72, 43);
@@ -369,9 +378,15 @@ IndoorDrawList::IndoorDrawList() :
_data[167] = DrawStruct(0, 47, 36, 0, SPRFLAG_HORIZ_FLIPPED);
_data[168] = DrawStruct(0, 118, 42);
_data[169] = DrawStruct(0, 26, 42, 0, SPRFLAG_HORIZ_FLIPPED);
+}
- for (int idx = 0; idx < 170; ++idx)
+void IndoorDrawList::draw() {
+ // Mark all items to be drawn as being clipped to the scene area
+ for (int idx = 0; idx < size(); ++idx)
_data[idx]._flags |= SPRFLAG_SCENE_CLIPPED;
+
+ // Draw the list
+ (*g_vm->_windows)[3].drawList(_data, size());
}
/*------------------------------------------------------------------------*/
@@ -3550,7 +3565,6 @@ void InterfaceScene::setOutdoorsObjects() {
void InterfaceScene::drawIndoors() {
Map &map = *_vm->_map;
- Windows &windows = *_vm->_windows;
int surfaceId;
// Draw any surface tiles on top of the default ground
@@ -4385,7 +4399,7 @@ void InterfaceScene::drawIndoors() {
_indoorList._horizon._frame = 7;
// Finally draw the darn indoor scene
- windows[3].drawList(&_indoorList[0], _indoorList.size());
+ _indoorList.draw();
// Check for any character shooting
_isAttacking = false;
@@ -4400,7 +4414,6 @@ void InterfaceScene::drawIndoors() {
void InterfaceScene::drawOutdoors() {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
- Windows &windows = *_vm->_windows;
int surfaceId;
// Draw any surface tiles on top of the default ground
@@ -4466,7 +4479,7 @@ void InterfaceScene::drawOutdoors() {
_outdoorList._groundSprite._flags = _flipWater ? SPRFLAG_HORIZ_FLIPPED : 0;
// Finally render the outdoor scene
- windows[3].drawList(&_outdoorList[0], _outdoorList.size());
+ _outdoorList.draw();
// Check for any character shooting
_isAttacking = false;
diff --git a/engines/xeen/interface_scene.h b/engines/xeen/interface_scene.h
index 0c181522bb..18f1f58a36 100644
--- a/engines/xeen/interface_scene.h
+++ b/engines/xeen/interface_scene.h
@@ -42,14 +42,28 @@ public:
DrawStruct * const _attackImgs3;
DrawStruct * const _attackImgs4;
public:
+ /**
+ * Constructor
+ */
OutdoorDrawList();
+ /**
+ * Get a draw list entry
+ */
DrawStruct &operator[](int idx) {
assert(idx < size());
return _data[idx];
}
+ /**
+ * Return the size of the list
+ */
int size() const { return 132; }
+
+ /**
+ * Draw the list to the scene
+ */
+ void draw();
};
class IndoorDrawList {
@@ -80,12 +94,23 @@ public:
public:
IndoorDrawList();
+ /**
+ * Get a draw list entry
+ */
DrawStruct &operator[](int idx) {
assert(idx < size());
return _data[idx];
}
+ /**
+ * Return the size of the list
+ */
int size() const { return 170; }
+
+ /**
+ * Draw the list to the scene
+ */
+ void draw();
};
class InterfaceScene {
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index 2ca34685ea..00e7c0e762 100644
--- a/engines/xeen/locations.cpp
+++ b/engines/xeen/locations.cpp
@@ -497,7 +497,7 @@ GuildLocation::GuildLocation() : BaseLocation(GUILD) {
addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_b);
addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_s);
addButton(Common::Rect(234, 84, 308, 92), 0);
- g_vm->_mode = MODE_17;
+ g_vm->_mode = MODE_INTERACTIVE7;
_vocName = _ccNum ? "parrot1.voc" : "guild10.voc";
}
@@ -560,7 +560,7 @@ TavernLocation::TavernLocation() : BaseLocation(TAVERN) {
addButton(Common::Rect(234, 64, 308, 72), Common::KEYCODE_f);
addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_t);
addButton(Common::Rect(234, 84, 308, 92), Common::KEYCODE_r);
- g_vm->_mode = MODE_17;
+ g_vm->_mode = MODE_INTERACTIVE7;
_vocName = _ccNum ? "hello1.voc" : "hello.voc";
}
@@ -713,7 +713,7 @@ Character *TavernLocation::doOptions(Character *c) {
party._activeParty[idx]._xeenSide = map._loadCcNum;
}
- g_vm->_mode = MODE_17;
+ g_vm->_mode = MODE_INTERACTIVE7;
party.addTime(1440);
party._mazeId = 0;
@@ -1447,6 +1447,15 @@ void ReaperCutscene::getNewLocation() {
}
break;
+ case 16:
+ if (party._questItems[41]) {
+ _mazeId = 61;
+ _mazePos = Common::Point(7, 12);
+ _mazeDir = DIR_SOUTH;
+ _keyFound = true;
+ }
+ break;
+
case 23:
if (party._questItems[42]) {
_mazeId = 65;
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index eafc026e34..5e564523d7 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -87,6 +87,12 @@ void Treasure::clear() {
}
}
+void Treasure::reset() {
+ clear();
+ _hasItems = false;
+ _gold = _gems = 0;
+}
+
/*------------------------------------------------------------------------*/
const int BLACKSMITH_DATA1[4][4] = {
@@ -518,7 +524,7 @@ void Party::addTime(int numMinutes) {
_newDay = true;
if (_newDay && _minutes >= 300) {
- if (_vm->_mode != MODE_RECORD_EVENTS && _vm->_mode != MODE_17) {
+ if (_vm->_mode != MODE_SCRIPT_IN_PROGRESS && _vm->_mode != MODE_INTERACTIVE7) {
resetTemps();
if (_rested || _vm->_mode == MODE_SLEEPING) {
_rested = false;
@@ -690,7 +696,7 @@ void Party::giveTreasure() {
return;
bool monstersPresent = combat.areMonstersPresent();
- if (_vm->_mode != MODE_RECORD_EVENTS && monstersPresent)
+ if (_vm->_mode != MODE_SCRIPT_IN_PROGRESS && monstersPresent)
return;
combat.clearShooting();
@@ -775,7 +781,7 @@ void Party::giveTreasure() {
events.clearEvents();
if (_vm->_mode != MODE_COMBAT)
- _vm->_mode = MODE_1;
+ _vm->_mode = MODE_INTERACTIVE;
w.close();
_gold += _treasure._gold;
@@ -883,7 +889,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
ps._tempAge -= takeVal;
break;
case 13:
- ps._skills[THIEVERY] = 0;
+ ps._skills[takeVal] = 0;
break;
case 15:
ps.setAward(takeVal, false);
@@ -1438,7 +1444,9 @@ bool Party::giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint
Scripts &scripts = *g_vm->_scripts;
Sound &sound = *g_vm->_sound;
- if (intf._objNumber != -1 && !scripts._animCounter) {
+ // WORKAROUND: Ali Baba's chest in Dark Side requires the character in the first slot to have Lockpicking.
+ // This is obviously a mistake, since the chest is meant to be opened via a password
+ if (intf._objNumber != -1 && !scripts._animCounter && !(files._ccNum && _mazeId == 63 && intf._objNumber == 15)) {
MazeObject &obj = map._mobData._objects[intf._objNumber];
switch (obj._spriteId) {
case 15:
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 4b0616bfc6..3d6142451c 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -87,6 +87,11 @@ public:
* Clears the treasure list
*/
void clear();
+
+ /**
+ * Completely reset the treasure data
+ */
+ void reset();
};
/**
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 4aee1a6a34..60cac91b75 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -190,6 +190,7 @@ Common::Error SavesManager::loadGameState(int slot) {
// Reset any combat information from the previous game
combat.reset();
+ party._treasure.reset();
// Load the new map
map.clearMaze();
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 0e6d721241..d3ff17cffa 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -186,7 +186,7 @@ int Scripts::checkEvents() {
if (event._position == _currentPos && event._line == _lineNum &&
(party._mazeDirection | _currentPos.x | _currentPos.y)) {
if (event._direction == party._mazeDirection || event._direction == DIR_ALL) {
- _vm->_mode = MODE_RECORD_EVENTS;
+ _vm->_mode = MODE_SCRIPT_IN_PROGRESS;
_scriptExecuted = true;
doOpcode(event);
break;
@@ -1463,7 +1463,7 @@ void Scripts::doCloudsEnding() {
g_vm->_party->_cloudsCompleted = true;
doEnding("ENDGAME");
- g_vm->_mode = MODE_1;
+ g_vm->_mode = MODE_INTERACTIVE;
g_vm->_saves->saveGame();
g_vm->_gameMode = GMODE_MENU;
diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp
index 7aa89bbee1..763da71733 100644
--- a/engines/xeen/spells.cpp
+++ b/engines/xeen/spells.cpp
@@ -1150,7 +1150,7 @@ void Spells::superShelter() {
spellFailed();
} else {
Mode oldMode = _vm->_mode;
- _vm->_mode = MODE_12;
+ _vm->_mode = MODE_INTERACTIVE2;
sound.playFX(30);
intf.rest();
_vm->_mode = oldMode;
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 1e15ec7792..371f437172 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -197,7 +197,8 @@ bool XeenEngine::canLoadGameStateCurrently() {
}
bool XeenEngine::canSaveGameStateCurrently() {
- return _mode != MODE_COMBAT && _mode != MODE_STARTUP && (_map->mazeData()._mazeFlags & RESTRICTION_SAVE) == 0;
+ return _mode != MODE_COMBAT && _mode != MODE_STARTUP && _mode != MODE_SCRIPT_IN_PROGRESS
+ && (_map->mazeData()._mazeFlags & RESTRICTION_SAVE) == 0;
}
void XeenEngine::playGame() {
@@ -243,7 +244,7 @@ void XeenEngine::play() {
_combat->_moveMonsters = true;
if (_mode == MODE_STARTUP) {
- _mode = MODE_1;
+ _mode = MODE_INTERACTIVE;
_screen->fadeIn();
}
@@ -272,6 +273,8 @@ void XeenEngine::gameLoop() {
_map->cellFlagLookup(_party->_mazePosition);
if (_map->_currentIsEvent) {
_gameMode = (GameMode)_scripts->checkEvents();
+ if (isLoadPending())
+ continue;
if (shouldExit())
return;
}
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 85cc01d7e7..a092538d09 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -78,7 +78,7 @@ enum XeenDebugChannels {
enum Mode {
MODE_FF = -1,
MODE_STARTUP = 0,
- MODE_1 = 1,
+ MODE_INTERACTIVE = 1,
MODE_COMBAT = 2,
MODE_3 = 3,
MODE_4 = 4,
@@ -86,11 +86,11 @@ enum Mode {
MODE_6 = 6,
MODE_7 = 7,
MODE_8 = 8,
- MODE_RECORD_EVENTS = 9,
+ MODE_SCRIPT_IN_PROGRESS = 9,
MODE_CHARACTER_INFO = 10,
- MODE_12 = 12,
+ MODE_INTERACTIVE2 = 12,
MODE_DIALOG_123 = 13,
- MODE_17 = 17,
+ MODE_INTERACTIVE7 = 17,
MODE_86 = 86
};
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index 2b84c21894..2abe0e0759 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -437,7 +437,7 @@ public:
void drawCallback_ALPHABITMAP(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) {
uint16 x, y, w, h;
stepGetPositions(step, area, x, y, w, h);
- blitAlphaBitmap(step.blitAlphaSrc, Common::Rect(x, y, x + w, y + h), step.autoscale, step.xAlign, step.yAlign); //TODO
+ blitAlphaBitmap(step.blitAlphaSrc, Common::Rect(x, y, x + w, y + h), step.autoscale, step.xAlign, step.yAlign); // TODO
}
void drawCallback_CROSS(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) {
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index c66bb2e9af..e308dde821 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -419,7 +419,7 @@ inline frac_t fp_sqroot(uint32 x) {
x--; px -= pitch; \
} \
a2 = (T >> 8); \
- a1 = ~a2; \
+ a1 = ~a2; \
} while (0)
@@ -2680,7 +2680,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
int gradient = (dx << 8) / (dy + 0x100);
int interx = (x1 << 8) + gradient;
#else
- double gradient = dx / (dy+1);
+ double gradient = dx / (dy + 1);
double interx = x1 + gradient;
#endif
@@ -2846,7 +2846,7 @@ drawTriangleVertAlgClip(int x1, int y1, int w, int h, bool inverted, PixelType c
break;
case kFillForeground:
case kFillBackground:
- colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right+1, y_right, _clippingArea);
+ colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right + 1, y_right, _clippingArea);
blendPixelPtrClip(ptr_right, color, rfpart(intery), x_right, y_right);
blendPixelPtrClip(ptr_left, color, rfpart(intery), x_left, y_left);
break;
@@ -2905,7 +2905,7 @@ drawTriangleVertAlgClip(int x1, int y1, int w, int h, bool inverted, PixelType c
break;
case kFillForeground:
case kFillBackground:
- colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right+1, y_right, _clippingArea);
+ colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right + 1, y_right, _clippingArea);
blendPixelPtrClip(ptr_right, color, rfpart(interx), x_right, y_right);
blendPixelPtrClip(ptr_left, color, rfpart(interx), x_left, y_left);
break;
@@ -2953,7 +2953,7 @@ drawTriangleVertAlgClip(int x1, int y1, int w, int h, bool inverted, PixelType c
break;
case kFillForeground:
case kFillBackground:
- colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right+1, y_right, _clippingArea);
+ colorFillClip<PixelType>(ptr_right + 1, ptr_left, color, x_right + 1, y_right, _clippingArea);
blendPixelPtrClip(ptr_right, color, rfpart(interx), x_right, y_right);
blendPixelPtrClip(ptr_left, color, rfpart(interx), x_left, y_left);
break;
@@ -3061,10 +3061,10 @@ drawBorderRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color,
BE_RESET();
r--;
- int alphaStep_tr = ((alpha_t - alpha_r)/(y+1));
- int alphaStep_br = ((alpha_r - alpha_b)/(y+1));
- int alphaStep_bl = ((alpha_b - alpha_l)/(y+1));
- int alphaStep_tl = ((alpha_l - alpha_t)/(y+1));
+ int alphaStep_tr = ((alpha_t - alpha_r) / (y + 1));
+ int alphaStep_br = ((alpha_r - alpha_b) / (y + 1));
+ int alphaStep_bl = ((alpha_b - alpha_l) / (y + 1));
+ int alphaStep_tl = ((alpha_l - alpha_t) / (y + 1));
// Avoid blending the last pixels twice, since we have an alpha
while (x++ < (y - 2)) {
@@ -3970,10 +3970,10 @@ drawBorderRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color,
px = pitch * x;
py = 0;
- int alphaStep_tr = ((alpha_t - alpha_r)/(x+1));
- int alphaStep_br = ((alpha_r - alpha_b)/(x+1));
- int alphaStep_bl = ((alpha_b - alpha_l)/(x+1));
- int alphaStep_tl = ((alpha_l - alpha_t)/(x+1));
+ int alphaStep_tr = ((alpha_t - alpha_r) / (x + 1));
+ int alphaStep_br = ((alpha_r - alpha_b) / (x + 1));
+ int alphaStep_bl = ((alpha_b - alpha_l) / (x + 1));
+ int alphaStep_tl = ((alpha_l - alpha_t) / (x + 1));
while (x > y++) {
WU_ALGORITHM();
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index d99b5fd401..c903d52c55 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -85,9 +85,9 @@ private:
};
#define DEFINE_FONT(n) \
- const BdfFont *n = 0; \
+ const BdfFont *n = 0; \
void create_##n() { \
- n = new BdfFont(desc, DisposeAfterUse::NO); \
+ n = new BdfFont(desc, DisposeAfterUse::NO); \
}
#define FORWARD_DECLARE_FONT(n) \
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index 56e1202be3..ce82fff61e 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -156,7 +156,7 @@ NinePatchBitmap::NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bi
bmp->format.colorToARGB(*(uint32 *)bmp->getBasePtr(x, y), a, r, g, b); \
if (a != 0 && r + g + b + a != 4) goto bad_bitmap;
- _check_pixel(0,0);
+ _check_pixel(0, 0);
_check_pixel(bmp->w - 1, 0);
_check_pixel(0, bmp->h - 1);
_check_pixel(bmp->w - 1, bmp->h - 1);
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 8663a61606..76c44b650d 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -262,13 +262,13 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p
do {
if (filled) {
- drawHLine(rect.left+x+r, rect.right-x-r, rect.top-y+r-stop, color, plotProc, data);
- drawHLine(rect.left+x+r, rect.right-x-r, rect.bottom+y-r+stop, color, plotProc, data);
+ drawHLine(rect.left + x + r, rect.right - x - r, rect.top - y + r - stop, color, plotProc, data);
+ drawHLine(rect.left + x + r, rect.right - x - r, rect.bottom + y - r + stop, color, plotProc, data);
} else {
- (*plotProc)(rect.left+x+r, rect.top-y+r-stop, color, data);
- (*plotProc)(rect.right-x-r, rect.top-y+r-stop, color, data);
- (*plotProc)(rect.left+x+r, rect.bottom+y-r+stop, color, data);
- (*plotProc)(rect.right-x-r, rect.bottom+y-r+stop, color, data);
+ (*plotProc)(rect.left + x + r, rect.top - y + r - stop, color, data);
+ (*plotProc)(rect.right - x - r, rect.top - y + r - stop, color, data);
+ (*plotProc)(rect.left + x + r, rect.bottom + y - r + stop, color, data);
+ (*plotProc)(rect.right - x - r, rect.bottom + y - r + stop, color, data);
lastx = x;
lasty = y;
@@ -284,15 +284,15 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p
x = lastx;
y = lasty;
- drawHLine(rect.left+x+r, rect.right-x-r, rect.top-y+r-stop, color, plotProc, data);
- drawHLine(rect.left+x+r, rect.right-x-r, rect.bottom+y-r+stop, color, plotProc, data);
+ drawHLine(rect.left + x + r, rect.right - x - r, rect.top - y + r - stop, color, plotProc, data);
+ drawHLine(rect.left + x + r, rect.right - x - r, rect.bottom + y - r + stop, color, plotProc, data);
}
for (int i = 0; i < dy; i++) {
if (filled) {
drawHLine(rect.left, rect.right, rect.top + r + i, color, plotProc, data);
} else {
- (*plotProc)(rect.left, rect.top + r + i, color, data);
+ (*plotProc)(rect.left, rect.top + r + i, color, data);
(*plotProc)(rect.right, rect.top + r + i, color, data);
}
}
@@ -307,13 +307,13 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p
do {
if (filled) {
- drawVLine(rect.left-x+r-stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data);
- drawVLine(rect.right+x-r+stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data);
+ drawVLine(rect.left - x + r - stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data);
+ drawVLine(rect.right + x - r + stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data);
} else {
- (*plotProc)(rect.left-x+r-stop, rect.top+y+r, color, data);
- (*plotProc)(rect.left-x+r-stop, rect.bottom-y-r, color, data);
- (*plotProc)(rect.right+x-r+stop, rect.top+y+r, color, data);
- (*plotProc)(rect.right+x-r+stop, rect.bottom-y-r, color, data);
+ (*plotProc)(rect.left - x + r - stop, rect.top + y + r, color, data);
+ (*plotProc)(rect.left - x + r - stop, rect.bottom - y - r, color, data);
+ (*plotProc)(rect.right + x - r + stop, rect.top + y + r, color, data);
+ (*plotProc)(rect.right + x - r + stop, rect.bottom - y - r, color, data);
lastx = x;
lasty = y;
@@ -329,15 +329,15 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p
if (!filled) {
x = lastx;
y = lasty;
- drawVLine(rect.left-x+r-stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data);
- drawVLine(rect.right+x-r+stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data);
+ drawVLine(rect.left - x + r - stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data);
+ drawVLine(rect.right + x - r + stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data);
}
for (int i = 0; i < dx; i++) {
if (filled) {
drawVLine(rect.left + r + i, rect.top, rect.bottom, color, plotProc, data);
} else {
- (*plotProc)(rect.left + r + i, rect.top, color, data);
+ (*plotProc)(rect.left + r + i, rect.top, color, data);
(*plotProc)(rect.left + r + i, rect.bottom, color, data);
}
}
@@ -385,14 +385,14 @@ void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, in
// http://members.chello.at/easyfilter/bresenham.html
void drawEllipse(int x0, int y0, int x1, int y1, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data) {
- int a = abs(x1-x0), b = abs(y1-y0), b1 = b&1; /* values of diameter */
- long dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a; /* error increment */
- long err = dx+dy+b1*a*a, e2; /* error of 1.step */
+ int a = abs(x1 - x0), b = abs(y1 - y0), b1 = b & 1; /* values of diameter */
+ long dx = 4 * (1 - a) * b * b, dy = 4 * (b1 + 1) * a * a; /* error increment */
+ long err = dx + dy + b1 * a * a, e2; /* error of 1.step */
if (x0 > x1) { x0 = x1; x1 += a; } /* if called with swapped points */
if (y0 > y1) y0 = y1; /* .. exchange them */
- y0 += (b+1)/2; y1 = y0-b1; /* starting pixel */
- a *= 8*a; b1 = 8*b*b;
+ y0 += (b + 1) / 2; y1 = y0 - b1; /* starting pixel */
+ a *= 8 * a; b1 = 8 * b * b;
do {
if (filled) {
@@ -411,15 +411,15 @@ void drawEllipse(int x0, int y0, int x1, int y1, int color, bool filled, void (*
while (y0-y1 < b) { /* too early stop of flat ellipses a=1 */
if (filled) {
- drawHLine(x0-1, x0-1, y0, color, plotProc, data); /* -> finish tip of ellipse */
- drawHLine(x1+1, x1+1, y0, color, plotProc, data);
- drawHLine(x0-1, x0-1, y1, color, plotProc, data);
- drawHLine(x1+1, x1+1, y1, color, plotProc, data);
+ drawHLine(x0 - 1, x0 - 1, y0, color, plotProc, data); /* -> finish tip of ellipse */
+ drawHLine(x1 + 1, x1 + 1, y0, color, plotProc, data);
+ drawHLine(x0 - 1, x0 - 1, y1, color, plotProc, data);
+ drawHLine(x1 + 1, x1 + 1, y1, color, plotProc, data);
} else {
- (*plotProc)(x0-1, y0, color, data); /* -> finish tip of ellipse */
- (*plotProc)(x1+1, y0, color, data);
- (*plotProc)(x0-1, y1, color, data);
- (*plotProc)(x1+1, y1, color, data);
+ (*plotProc)(x0 - 1, y0, color, data); /* -> finish tip of ellipse */
+ (*plotProc)(x1 + 1, y0, color, data);
+ (*plotProc)(x0 - 1, y1, color, data);
+ (*plotProc)(x1 + 1, y1, color, data);
}
y0++;
y1--;
diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp
index 745988cbd9..a3ac7fc107 100644
--- a/graphics/scaler.cpp
+++ b/graphics/scaler.cpp
@@ -107,12 +107,12 @@ void InitLUT(Graphics::PixelFormat format) {
hqx_low2bits = (3 << format.rShift) | (3 << format.gShift) | (3 << format.bShift),
hqx_low3bits = (7 << format.rShift) | (7 << format.gShift) | (7 << format.bShift),
- hqx_highbits = format.RGBToColor(255,255,255) ^ hqx_lowbits;
+ hqx_highbits = format.RGBToColor(255, 255, 255) ^ hqx_lowbits;
// FIXME: The following code only does the right thing
// if the color order is RGB or BGR, i.e., green is in the middle.
- hqx_greenMask = format.RGBToColor(0,255,0);
- hqx_redBlueMask = format.RGBToColor(255,0,255);
+ hqx_greenMask = format.RGBToColor( 0, 255, 0);
+ hqx_redBlueMask = format.RGBToColor(255, 0, 255);
hqx_green_redBlue_Mask = (hqx_greenMask << 16) | hqx_redBlueMask;
#endif
@@ -145,10 +145,10 @@ void InitScalers(uint32 BitFormat) {
#endif
// Build dotmatrix lookup table for the DotMatrix scaler.
- g_dotmatrix[0] = g_dotmatrix[10] = format.RGBToColor(0, 63, 0);
- g_dotmatrix[1] = g_dotmatrix[11] = format.RGBToColor(0, 0, 63);
- g_dotmatrix[2] = g_dotmatrix[8] = format.RGBToColor(63, 0, 0);
- g_dotmatrix[4] = g_dotmatrix[6] =
+ g_dotmatrix[0] = g_dotmatrix[10] = format.RGBToColor( 0, 63, 0);
+ g_dotmatrix[1] = g_dotmatrix[11] = format.RGBToColor( 0, 0, 63);
+ g_dotmatrix[2] = g_dotmatrix[ 8] = format.RGBToColor(63, 0, 0);
+ g_dotmatrix[4] = g_dotmatrix[ 6] =
g_dotmatrix[12] = g_dotmatrix[14] = format.RGBToColor(63, 63, 63);
}
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index eddc3c7f3d..213b69b049 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -195,18 +195,18 @@ static inline bool diffYUV(int yuv1, int yuv2) {
int mask;
diff = ((yuv1 & Umask) - (yuv2 & Umask));
- mask = diff >> 31; // -1 if value < 0, 0 otherwise
- diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
+ mask = diff >> 31; // -1 if value < 0, 0 otherwise
+ diff = (diff ^ mask) - mask; // -1: ~value + 1; 0: value
if (diff > trU) return true;
diff = ((yuv1 & Vmask) - (yuv2 & Vmask));
- mask = diff >> 31; // -1 if value < 0, 0 otherwise
- diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
+ mask = diff >> 31; // -1 if value < 0, 0 otherwise
+ diff = (diff ^ mask) - mask; // -1: ~value + 1; 0: value
if (diff > trV) return true;
diff = ((yuv1 & Ymask) - (yuv2 & Ymask));
- mask = diff >> 31; // -1 if value < 0, 0 otherwise
- diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
+ mask = diff >> 31; // -1 if value < 0, 0 otherwise
+ diff = (diff ^ mask) - mask; // -1: ~value + 1; 0: value
if (diff > trY) return true;
return false;
diff --git a/graphics/scaler/scalebit.cpp b/graphics/scaler/scalebit.cpp
index c8b54f4b25..bcba5793e2 100644
--- a/graphics/scaler/scalebit.cpp
+++ b/graphics/scaler/scalebit.cpp
@@ -47,17 +47,17 @@
static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) {
switch (pixel) {
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
- case 1 : scale2x_8_mmx(DST(8,0), DST(8,1), SRC(8,0), SRC(8,1), SRC(8,2), pixel_per_row); break;
- case 2 : scale2x_16_mmx(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
- case 4 : scale2x_32_mmx(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
+ case 1: scale2x_8_mmx( DST( 8,0), DST( 8,1), SRC( 8,0), SRC( 8,1), SRC( 8,2), pixel_per_row); break;
+ case 2: scale2x_16_mmx(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
+ case 4: scale2x_32_mmx(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
#elif defined(USE_ARM_SCALER_ASM)
- case 1 : scale2x_8_arm(DST(8,0), DST(8,1), SRC(8,0), SRC(8,1), SRC(8,2), pixel_per_row); break;
- case 2 : scale2x_16_arm(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
- case 4 : scale2x_32_arm(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
+ case 1: scale2x_8_arm( DST( 8,0), DST( 8,1), SRC( 8,0), SRC( 8,1), SRC( 8,2), pixel_per_row); break;
+ case 2: scale2x_16_arm(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
+ case 4: scale2x_32_arm(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
#else
- case 1 : scale2x_8_def(DST(8,0), DST(8,1), SRC(8,0), SRC(8,1), SRC(8,2), pixel_per_row); break;
- case 2 : scale2x_16_def(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
- case 4 : scale2x_32_def(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
+ case 1: scale2x_8_def( DST( 8,0), DST( 8,1), SRC( 8,0), SRC( 8,1), SRC( 8,2), pixel_per_row); break;
+ case 2: scale2x_16_def(DST(16,0), DST(16,1), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
+ case 4: scale2x_32_def(DST(32,0), DST(32,1), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
#endif
}
}
@@ -67,9 +67,9 @@ static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const
*/
static inline void stage_scale3x(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) {
switch (pixel) {
- case 1 : scale3x_8_def(DST(8,0), DST(8,1), DST(8,2), SRC(8,0), SRC(8,1), SRC(8,2), pixel_per_row); break;
- case 2 : scale3x_16_def(DST(16,0), DST(16,1), DST(16,2), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
- case 4 : scale3x_32_def(DST(32,0), DST(32,1), DST(32,2), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
+ case 1: scale3x_8_def( DST( 8,0), DST( 8,1), DST( 8,2), SRC( 8,0), SRC( 8,1), SRC( 8,2), pixel_per_row); break;
+ case 2: scale3x_16_def(DST(16,0), DST(16,1), DST(16,2), SRC(16,0), SRC(16,1), SRC(16,2), pixel_per_row); break;
+ case 4: scale3x_32_def(DST(32,0), DST(32,1), DST(32,2), SRC(32,0), SRC(32,1), SRC(32,2), pixel_per_row); break;
}
}
@@ -281,12 +281,12 @@ int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned
return -1;
switch (scale) {
- case 2 :
- case 3 :
+ case 2:
+ case 3:
if (height < 2)
return -1;
break;
- case 4 :
+ case 4:
if (height < 4)
return -1;
break;
@@ -294,14 +294,14 @@ int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
switch (scale) {
- case 2 :
- case 4 :
+ case 2:
+ case 4:
if (width < (16 / pixel))
return -1;
if (width % (8 / pixel) != 0)
return -1;
break;
- case 3 :
+ case 3:
if (width < 2)
return -1;
break;
@@ -329,13 +329,13 @@ int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
{
switch (scale) {
- case 2 :
+ case 2:
scale2x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
break;
- case 3 :
+ case 3:
scale3x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
break;
- case 4 :
+ case 4:
scale4x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
break;
}
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index 45cf1cee90..877f314c69 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -334,16 +334,16 @@ const uint8 *FontTowns::getCharData(uint16 ch) const {
if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI;
if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) {
- c = 48; //correction
- p = -8; //correction
+ c = 48; // correction
+ p = -8; // correction
}
- if (kanjiType == KANA) {//Kana
+ if (kanjiType == KANA) {
chunk_f = (f - 0x81) * 2;
- } else if (kanjiType == KANJI) {//Standard Kanji
+ } else if (kanjiType == KANJI) { // Standard Kanji
p += f - 0x88;
chunk_f = c + 2 * p;
- } else if (kanjiType == EKANJI) {//Enhanced Kanji
+ } else if (kanjiType == EKANJI) { // Enhanced Kanji
p += f - 0xe0;
chunk_f = c + 2 * p;
}
@@ -360,37 +360,37 @@ const uint8 *FontTowns::getCharData(uint16 ch) const {
switch (base) {
case 0x3f:
- cr = 0; //3f
+ cr = 0; // 3f
if (kanjiType == KANA) chunk = 1;
else if (kanjiType == KANJI) chunk = 31;
else if (kanjiType == EKANJI) chunk = 111;
break;
case 0x5f:
- cr = 0; //5f
+ cr = 0; // 5f
if (kanjiType == KANA) chunk = 17;
else if (kanjiType == KANJI) chunk = 47;
else if (kanjiType == EKANJI) chunk = 127;
break;
case 0x7f:
- cr = -1; //80
+ cr = -1; // 80
if (kanjiType == KANA) chunk = 9;
else if (kanjiType == KANJI) chunk = 63;
else if (kanjiType == EKANJI) chunk = 143;
break;
case 0x9f:
- cr = 1; //9e
+ cr = 1; // 9e
if (kanjiType == KANA) chunk = 2;
else if (kanjiType == KANJI) chunk = 32;
else if (kanjiType == EKANJI) chunk = 112;
break;
case 0xbf:
- cr = 1; //be
+ cr = 1; // be
if (kanjiType == KANA) chunk = 18;
else if (kanjiType == KANJI) chunk = 48;
else if (kanjiType == EKANJI) chunk = 128;
break;
case 0xdf:
- cr = 1; //de
+ cr = 1; // de
if (kanjiType == KANA) chunk = 10;
else if (kanjiType == KANJI) chunk = 64;
else if (kanjiType == EKANJI) chunk = 144;
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index 4826137358..80b424fb90 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -465,22 +465,26 @@ IVI45DecContext::IVI45DecContext() : _gb(nullptr), _frameNum(0), _frameType(0),
/*------------------------------------------------------------------------*/
IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height, uint bitsPerPixel) : Codec() {
- switch (bitsPerPixel) {
- case 15:
- _pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
- break;
- case 16:
- _pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
- break;
- case 24:
- _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
- break;
- case 32:
- _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
- break;
- default:
- error("Invalid color depth");
- break;
+ _pixelFormat = g_system->getScreenFormat();
+
+ if (_pixelFormat.bytesPerPixel == 1) {
+ switch (bitsPerPixel) {
+ case 15:
+ _pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
+ break;
+ case 16:
+ _pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ break;
+ case 24:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
+ break;
+ case 32:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ break;
+ default:
+ error("Invalid color depth");
+ break;
+ }
}
_surface.create(width, height, _pixelFormat);
diff --git a/image/codecs/indeo3.cpp b/image/codecs/indeo3.cpp
index 1aa1ef73b6..2b681c98ce 100644
--- a/image/codecs/indeo3.cpp
+++ b/image/codecs/indeo3.cpp
@@ -44,22 +44,26 @@ Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height, uint bitsPerPixel) : _
_iv_frame[0].the_buf = 0;
_iv_frame[1].the_buf = 0;
- switch (bitsPerPixel) {
- case 15:
- _pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
- break;
- case 16:
- _pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
- break;
- case 24:
- _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
- break;
- case 32:
- _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
- break;
- default:
- error("Invalid color depth");
- break;
+ _pixelFormat = g_system->getScreenFormat();
+
+ if (_pixelFormat.bytesPerPixel == 1) {
+ switch (bitsPerPixel) {
+ case 15:
+ _pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
+ break;
+ case 16:
+ _pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ break;
+ case 24:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
+ break;
+ case 32:
+ _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ break;
+ default:
+ error("Invalid color depth");
+ break;
+ }
}
_surface = new Graphics::Surface;
diff --git a/po/de_DE.po b/po/de_DE.po
index c4a6290bfb..2525693161 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -8,10 +8,10 @@ msgstr ""
"Project-Id-Version: ScummVM 1.10.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.scummvm.org\n"
"POT-Creation-Date: 2018-04-14 04:57+0200\n"
-"PO-Revision-Date: 2018-04-11 19:17+0000\n"
-"Last-Translator: Adrian Frühwirth <bonki@scummvm.org>\n"
-"Language-Team: German <https://translations.scummvm.org/projects/scummvm/"
-"scummvm/de/>\n"
+"PO-Revision-Date: 2018-04-15 06:45+0000\n"
+"Last-Translator: Lothar Serra Mari <serra@scummvm.org>\n"
+"Language-Team: German "
+"<https://translations.scummvm.org/projects/scummvm/scummvm/de/>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
@@ -4696,11 +4696,13 @@ msgstr ""
#: engines/xeen/detection.cpp:95
msgid "More durable armor"
-msgstr ""
+msgstr "Widerstandsfähigere Rüstung"
#: engines/xeen/detection.cpp:96
msgid "Armor won't break until character is at -80HP, rather than merely -10HP"
msgstr ""
+"Rüstung zerbricht erst, wenn der Charakter -80HP besitzt und nicht bereits "
+"bei -10HP"
#: engines/zvision/detection_tables.h:61
msgid "Double FPS"
diff --git a/po/fi_FI.po b/po/fi_FI.po
index f04be7a97c..ee3775a9db 100644
--- a/po/fi_FI.po
+++ b/po/fi_FI.po
@@ -8,10 +8,10 @@ msgstr ""
"Project-Id-Version: ScummVM 1.6.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.scummvm.org\n"
"POT-Creation-Date: 2018-04-14 04:57+0200\n"
-"PO-Revision-Date: 2018-04-13 17:25+0000\n"
+"PO-Revision-Date: 2018-04-14 11:03+0000\n"
"Last-Translator: Timo Mikkolainen <tmikkola@gmail.com>\n"
-"Language-Team: Finnish <https://translations.scummvm.org/projects/scummvm/"
-"scummvm/fi/>\n"
+"Language-Team: Finnish "
+"<https://translations.scummvm.org/projects/scummvm/scummvm/fi/>\n"
"Language: fi_FI\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
@@ -4629,11 +4629,12 @@ msgstr ""
#: engines/xeen/detection.cpp:95
msgid "More durable armor"
-msgstr ""
+msgstr "Kestävämmät suojavarusteet"
#: engines/xeen/detection.cpp:96
msgid "Armor won't break until character is at -80HP, rather than merely -10HP"
msgstr ""
+"Suojavaruste hajoaa vasta hahmon ollessa -80HP:ssä normaalin -10HP sijasta"
#: engines/zvision/detection_tables.h:61
msgid "Double FPS"
diff --git a/po/sv_SE.po b/po/sv_SE.po
index 0ecaf443f4..03a1392182 100644
--- a/po/sv_SE.po
+++ b/po/sv_SE.po
@@ -8,10 +8,10 @@ msgstr ""
"Project-Id-Version: ScummVM 1.5.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.scummvm.org\n"
"POT-Creation-Date: 2018-04-14 04:57+0200\n"
-"PO-Revision-Date: 2018-04-11 19:27+0000\n"
+"PO-Revision-Date: 2018-04-14 20:40+0000\n"
"Last-Translator: Adrian Frühwirth <bonki@scummvm.org>\n"
-"Language-Team: Swedish <https://translations.scummvm.org/projects/scummvm/"
-"scummvm/sv/>\n"
+"Language-Team: Swedish "
+"<https://translations.scummvm.org/projects/scummvm/scummvm/sv/>\n"
"Language: sv_SE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
@@ -4641,7 +4641,7 @@ msgstr ""
#: engines/zvision/detection_tables.h:61
msgid "Double FPS"
-msgstr "Dubbel FPS"
+msgstr "Dubbla FPS"
#: engines/zvision/detection_tables.h:62
msgid "Increase framerate from 30 to 60 FPS"