aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorStrangerke2013-09-08 14:49:34 +0200
committerStrangerke2013-09-08 14:49:34 +0200
commit599d2eeb06c937a4479cc751f4f9f5e94795c43b (patch)
tree6efd0f887d7a1fd5082209a585d609983031c92d /engines/wintermute/base
parent7df4c94aeb6c1408d26d6ada58d728b6eac17717 (diff)
parent03bf56ea82c0b89f4e61e5e0787a36473f999efa (diff)
downloadscummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.gz
scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.bz2
scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.zip
Merge branch 'master' into avalanche
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/base.cpp2
-rw-r--r--engines/wintermute/base/base.h2
-rw-r--r--engines/wintermute/base/base_active_rect.cpp2
-rw-r--r--engines/wintermute/base/base_active_rect.h2
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.cpp2
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.h2
-rw-r--r--engines/wintermute/base/base_engine.cpp15
-rw-r--r--engines/wintermute/base/base_engine.h12
-rw-r--r--engines/wintermute/base/base_fader.cpp2
-rw-r--r--engines/wintermute/base/base_fader.h2
-rw-r--r--engines/wintermute/base/base_file_manager.cpp4
-rw-r--r--engines/wintermute/base/base_file_manager.h2
-rw-r--r--engines/wintermute/base/base_frame.cpp2
-rw-r--r--engines/wintermute/base/base_frame.h2
-rw-r--r--engines/wintermute/base/base_game.cpp40
-rw-r--r--engines/wintermute/base/base_game.h16
-rw-r--r--engines/wintermute/base/base_game_music.cpp110
-rw-r--r--engines/wintermute/base/base_game_music.h8
-rw-r--r--engines/wintermute/base/base_game_settings.cpp52
-rw-r--r--engines/wintermute/base/base_game_settings.h6
-rw-r--r--engines/wintermute/base/base_keyboard_state.cpp2
-rw-r--r--engines/wintermute/base/base_keyboard_state.h4
-rw-r--r--engines/wintermute/base/base_named_object.cpp2
-rw-r--r--engines/wintermute/base/base_named_object.h2
-rw-r--r--engines/wintermute/base/base_object.cpp22
-rw-r--r--engines/wintermute/base/base_object.h2
-rw-r--r--engines/wintermute/base/base_parser.cpp2
-rw-r--r--engines/wintermute/base/base_parser.h2
-rw-r--r--engines/wintermute/base/base_persistence_manager.cpp8
-rw-r--r--engines/wintermute/base/base_persistence_manager.h4
-rw-r--r--engines/wintermute/base/base_point.cpp2
-rw-r--r--engines/wintermute/base/base_point.h2
-rw-r--r--engines/wintermute/base/base_quick_msg.cpp2
-rw-r--r--engines/wintermute/base/base_quick_msg.h2
-rw-r--r--engines/wintermute/base/base_region.cpp4
-rw-r--r--engines/wintermute/base/base_region.h2
-rw-r--r--engines/wintermute/base/base_script_holder.cpp2
-rw-r--r--engines/wintermute/base/base_script_holder.h2
-rw-r--r--engines/wintermute/base/base_scriptable.cpp2
-rw-r--r--engines/wintermute/base/base_scriptable.h2
-rw-r--r--engines/wintermute/base/base_sprite.cpp2
-rw-r--r--engines/wintermute/base/base_sprite.h11
-rw-r--r--engines/wintermute/base/base_string_table.cpp2
-rw-r--r--engines/wintermute/base/base_string_table.h2
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp34
-rw-r--r--engines/wintermute/base/base_sub_frame.h2
-rw-r--r--engines/wintermute/base/base_surface_storage.cpp2
-rw-r--r--engines/wintermute/base/base_surface_storage.h2
-rw-r--r--engines/wintermute/base/base_transition_manager.cpp2
-rw-r--r--engines/wintermute/base/base_transition_manager.h2
-rw-r--r--engines/wintermute/base/base_viewport.cpp2
-rw-r--r--engines/wintermute/base/base_viewport.h2
-rw-r--r--engines/wintermute/base/file/base_disk_file.cpp8
-rw-r--r--engines/wintermute/base/file/base_disk_file.h2
-rw-r--r--engines/wintermute/base/file/base_file.cpp2
-rw-r--r--engines/wintermute/base/file/base_file.h2
-rw-r--r--engines/wintermute/base/file/base_file_entry.cpp2
-rw-r--r--engines/wintermute/base/file/base_file_entry.h2
-rw-r--r--engines/wintermute/base/file/base_package.cpp2
-rw-r--r--engines/wintermute/base/file/base_package.h2
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.cpp2
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.h2
-rw-r--r--engines/wintermute/base/file/dcpackage.h2
-rw-r--r--engines/wintermute/base/font/base_font.cpp2
-rw-r--r--engines/wintermute/base/font/base_font.h2
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp2
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.h2
-rw-r--r--engines/wintermute/base/font/base_font_storage.cpp2
-rw-r--r--engines/wintermute/base/font/base_font_storage.h2
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp2
-rw-r--r--engines/wintermute/base/font/base_font_truetype.h2
-rw-r--r--engines/wintermute/base/gfx/base_image.cpp2
-rw-r--r--engines/wintermute/base/gfx/base_image.h2
-rw-r--r--engines/wintermute/base/gfx/base_renderer.cpp16
-rw-r--r--engines/wintermute/base/gfx/base_renderer.h2
-rw-r--r--engines/wintermute/base/gfx/base_surface.cpp6
-rw-r--r--engines/wintermute/base/gfx/base_surface.h9
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp72
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h42
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp93
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.h15
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.cpp65
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.h39
-rw-r--r--engines/wintermute/base/particles/part_emitter.cpp22
-rw-r--r--engines/wintermute/base/particles/part_emitter.h2
-rw-r--r--engines/wintermute/base/particles/part_force.cpp2
-rw-r--r--engines/wintermute/base/particles/part_force.h2
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp12
-rw-r--r--engines/wintermute/base/particles/part_particle.h2
-rw-r--r--engines/wintermute/base/save_thumb_helper.cpp14
-rw-r--r--engines/wintermute/base/save_thumb_helper.h2
-rw-r--r--engines/wintermute/base/saveload.cpp2
-rw-r--r--engines/wintermute/base/saveload.h2
-rw-r--r--engines/wintermute/base/scriptables/dcscript.h2
-rw-r--r--engines/wintermute/base/scriptables/script.cpp3
-rw-r--r--engines/wintermute/base/scriptables/script.h2
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.cpp3
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.h2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.h2
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_stack.h2
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_value.h2
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp2
-rw-r--r--engines/wintermute/base/sound/base_sound.h2
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp2
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.h2
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp2
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.h2
-rw-r--r--engines/wintermute/base/timer.cpp4
-rw-r--r--engines/wintermute/base/timer.h6
124 files changed, 531 insertions, 430 deletions
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp
index d01972b82f..a64770c577 100644
--- a/engines/wintermute/base/base.cpp
+++ b/engines/wintermute/base/base.cpp
@@ -183,4 +183,4 @@ bool BaseClass::saveAsText(BaseDynamicBuffer *buffer, int indent) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h
index 7f2796c6e0..48ebe49a97 100644
--- a/engines/wintermute/base/base.h
+++ b/engines/wintermute/base/base.h
@@ -57,6 +57,6 @@ protected:
Common::HashMap<Common::String, Common::String>::iterator _editorPropsIter;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
index 7a91854c57..abeaa18d54 100644
--- a/engines/wintermute/base/base_active_rect.cpp
+++ b/engines/wintermute/base/base_active_rect.cpp
@@ -109,4 +109,4 @@ void BaseActiveRect::clipRect() {
BasePlatform::intersectRect(&_rect, &_rect, &rc);
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h
index 982a0902d0..a3c0746618 100644
--- a/engines/wintermute/base/base_active_rect.h
+++ b/engines/wintermute/base/base_active_rect.h
@@ -55,6 +55,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp
index f684420b1e..5334ae46c4 100644
--- a/engines/wintermute/base/base_dynamic_buffer.cpp
+++ b/engines/wintermute/base/base_dynamic_buffer.cpp
@@ -201,4 +201,4 @@ void BaseDynamicBuffer::putTextForm(const char *format, va_list argptr) {
putBytes((byte *)buff, strlen(buff));
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h
index ad78ebad00..2804d78895 100644
--- a/engines/wintermute/base/base_dynamic_buffer.h
+++ b/engines/wintermute/base/base_dynamic_buffer.h
@@ -60,6 +60,6 @@ private:
void putTextForm(const char *format, va_list argptr);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp
index d4b17a0a64..acb12bbe5f 100644
--- a/engines/wintermute/base/base_engine.cpp
+++ b/engines/wintermute/base/base_engine.cpp
@@ -44,10 +44,11 @@ BaseEngine::BaseEngine() {
_classReg = nullptr;
_rnd = nullptr;
_gameId = "";
+ _language = Common::UNK_LANG;
}
-void BaseEngine::init(Common::Language lang) {
- _fileManager = new BaseFileManager(lang);
+void BaseEngine::init() {
+ _fileManager = new BaseFileManager(_language);
// Don't forget to register your random source
_rnd = new Common::RandomSource("Wintermute");
_classReg = new SystemClassRegistry();
@@ -60,9 +61,11 @@ BaseEngine::~BaseEngine() {
delete _classReg;
}
-void BaseEngine::createInstance(const Common::String &gameid, Common::Language lang) {
- instance()._gameId = gameid;
- instance().init(lang);
+void BaseEngine::createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang) {
+ instance()._targetName = targetName;
+ instance()._gameId = gameId;
+ instance()._language = lang;
+ instance().init();
}
void BaseEngine::LOG(bool res, const char *fmt, ...) {
@@ -122,4 +125,4 @@ const Timer *BaseEngine::getLiveTimer() {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h
index d972e6ebbc..a5eafd3597 100644
--- a/engines/wintermute/base/base_engine.h
+++ b/engines/wintermute/base/base_engine.h
@@ -44,17 +44,19 @@ class BaseRenderer;
class SystemClassRegistry;
class Timer;
class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
- void init(Common::Language lang);
+ void init();
BaseFileManager *_fileManager;
Common::String _gameId;
+ Common::String _targetName;
BaseGame *_gameRef;
// We need random numbers
Common::RandomSource *_rnd;
SystemClassRegistry *_classReg;
+ Common::Language _language;
public:
BaseEngine();
~BaseEngine();
- static void createInstance(const Common::String &gameid, Common::Language lang);
+ static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang);
void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; }
Common::RandomSource *getRandomSource() { return _rnd; }
@@ -68,9 +70,11 @@ public:
static const Timer *getTimer();
static const Timer *getLiveTimer();
static void LOG(bool res, const char *fmt, ...);
- const char *getGameId() { return _gameId.c_str(); }
+ const char *getGameTargetName() const { return _targetName.c_str(); }
+ Common::String getGameId() const { return _gameId; }
+ Common::Language getLanguage() const { return _language; }
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
index 0d17b07a9d..7978230964 100644
--- a/engines/wintermute/base/base_fader.cpp
+++ b/engines/wintermute/base/base_fader.cpp
@@ -193,4 +193,4 @@ bool BaseFader::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h
index 845ce2f244..087b19bc44 100644
--- a/engines/wintermute/base/base_fader.h
+++ b/engines/wintermute/base/base_fader.h
@@ -58,6 +58,6 @@ private:
uint32 _startTime;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 7d59b03684..bea7e53445 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -269,7 +269,7 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f
bool BaseFileManager::hasFile(const Common::String &filename) {
if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
- BasePersistenceManager pm(BaseEngine::instance().getGameId());
+ BasePersistenceManager pm(BaseEngine::instance().getGameTargetName());
if (filename.size() <= 9) {
return false;
}
@@ -360,4 +360,4 @@ BaseFileManager *BaseFileManager::getEngineInstance() {
return nullptr;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h
index 7ed3a6c7cb..8c2876f681 100644
--- a/engines/wintermute/base/base_file_manager.h
+++ b/engines/wintermute/base/base_file_manager.h
@@ -74,6 +74,6 @@ private:
// the detector too, without launching the entire engine:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
index 9fb5770f79..eaad024120 100644
--- a/engines/wintermute/base/base_frame.cpp
+++ b/engines/wintermute/base/base_frame.cpp
@@ -764,4 +764,4 @@ const char *BaseFrame::scToString() {
return "[frame]";
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h
index 954851c77f..bf1e40daa1 100644
--- a/engines/wintermute/base/base_frame.h
+++ b/engines/wintermute/base/base_frame.h
@@ -70,6 +70,6 @@ private:
BaseSound *_sound;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 4d8e79b5c2..b2c05d271d 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -81,7 +81,7 @@ IMPLEMENT_PERSISTENT(BaseGame, true)
//////////////////////////////////////////////////////////////////////
-BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gameId), _timerNormal(), _timerLive() {
+BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _targetName(targetName), _timerNormal(), _timerLive() {
_shuttingDown = false;
_state = GAME_RUNNING;
@@ -212,7 +212,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam
#else*/
_touchInterface = false;
_constrainedMemory = false;
-
+
_settings = new BaseGameSettings(this);
//#endif
@@ -1276,11 +1276,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(2);
const char *key = stack->pop()->getString();
const char *initVal = stack->pop()->getString();
- Common::String privKey = "wme_" + StringUtil::encodeSetting(key);
- Common::String result = initVal;
- if (ConfMan.hasKey(privKey)) {
- result = StringUtil::decodeSetting(ConfMan.get(key));
- }
+ Common::String result = readRegistryString(key, initVal);
stack->pushString(result.c_str());
return STATUS_OK;
}
@@ -3072,8 +3068,8 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_offsetX));
persistMgr->transfer(TMEMBER(_offsetY));
- persistMgr->transfer(TMEMBER(_offsetPercentX));
- persistMgr->transfer(TMEMBER(_offsetPercentY));
+ persistMgr->transferFloat(TMEMBER(_offsetPercentX));
+ persistMgr->transferFloat(TMEMBER(_offsetPercentY));
persistMgr->transfer(TMEMBER(_origInteractive));
persistMgr->transfer(TMEMBER_INT(_origState));
@@ -3734,7 +3730,7 @@ bool BaseGame::onWindowClose() {
bool BaseGame::displayDebugInfo() {
const uint32 strLength = 100;
char str[strLength];
-
+
if (_debugShowFPS) {
sprintf(str, "FPS: %d", _gameRef->_fps);
_systemFont->drawText((byte *)str, 0, 0, 100, TAL_LEFT);
@@ -3902,4 +3898,26 @@ char *BaseGame::getKeyFromStringTable(const char *str) const {
return _settings->getKeyFromStringTable(str);
}
-} // end of namespace Wintermute
+Common::String BaseGame::readRegistryString(const Common::String &key, const Common::String &initValue) const {
+ // Game specific hacks:
+ Common::String result = initValue;
+ // James Peris:
+ if (BaseEngine::instance().getGameId() == "jamesperis" && key == "Language") {
+ Common::Language language = BaseEngine::instance().getLanguage();
+ if (language == Common::EN_ANY) {
+ result = "english";
+ } else if (language == Common::ES_ESP) {
+ result = "spanish";
+ } else {
+ error("Invalid language set for James Peris");
+ }
+ } else { // Just fallback to using ConfMan for now
+ Common::String privKey = "wme_" + StringUtil::encodeSetting(key);
+ if (ConfMan.hasKey(privKey)) {
+ result = StringUtil::decodeSetting(ConfMan.get(key));
+ }
+ }
+ return result;
+}
+
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index d51255d013..d295bb6b1a 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -137,7 +137,7 @@ public:
bool initialize2();
bool initialize3();
BaseTransitionMgr *_transMgr;
-
+
// String Table
void expandStringByStringTable(char **str) const;
char *getKeyFromStringTable(const char *str) const;
@@ -150,7 +150,7 @@ public:
BaseScriptable *_mathClass;
BaseSurfaceStorage *_surfaceStorage;
BaseFontStorage *_fontStorage;
- BaseGame(const Common::String &gameId);
+ BaseGame(const Common::String &targetName);
virtual ~BaseGame();
bool _debugDebugMode;
@@ -173,8 +173,8 @@ public:
// compatibility bits
bool _compatKillMethodThreads;
- const char* getGameId() const { return _gameId.c_str(); }
- void setGameId(const Common::String& gameId) { _gameId = gameId; }
+ const char* getGameTargetName() const { return _targetName.c_str(); }
+ void setGameTargetName(const Common::String& targetName) { _targetName = targetName; }
uint32 _surfaceGCCycleTime;
bool _smartCache; // RO
bool _subtitles; // RO
@@ -275,7 +275,7 @@ private:
bool _mouseRightDown;
bool _mouseMidlleDown;
-
+
BaseGameSettings *_settings;
int32 _soundBufferSizeSec;
@@ -295,7 +295,7 @@ private:
uint32 _lastTime;
uint32 _fpsTime;
uint32 _framesRendered;
- Common::String _gameId;
+ Common::String _targetName;
void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = nullptr, void *data = nullptr);
ENGINE_LOG_CALLBACK _engineLogCallback;
@@ -343,6 +343,8 @@ private:
bool isDoubleClick(int32 buttonIndex);
uint32 _usedMem;
+// TODO: This should be expanded into a proper class eventually:
+ Common::String readRegistryString(const Common::String &key, const Common::String &initValue) const;
protected:
@@ -356,6 +358,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp
index ac23801e4c..c50969df76 100644
--- a/engines/wintermute/base/base_game_music.cpp
+++ b/engines/wintermute/base/base_game_music.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -65,10 +65,10 @@ bool BaseGameMusic::playMusic(int channel, const char *filename, bool looping, u
BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
}
-
+
delete _music[channel];
_music[channel] = nullptr;
-
+
_music[channel] = new BaseSound(_gameRef);
if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) {
if (_musicStartTime[channel]) {
@@ -93,7 +93,7 @@ bool BaseGameMusic::stopMusic(int channel) {
BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
}
-
+
if (_music[channel]) {
_music[channel]->stop();
delete _music[channel];
@@ -111,7 +111,7 @@ bool BaseGameMusic::pauseMusic(int channel) {
BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
}
-
+
if (_music[channel]) {
return _music[channel]->pause();
} else {
@@ -126,7 +126,7 @@ bool BaseGameMusic::resumeMusic(int channel) {
BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
}
-
+
if (_music[channel]) {
return _music[channel]->resume();
} else {
@@ -141,7 +141,7 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) {
BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
}
-
+
_musicStartTime[channel] = time;
if (_music[channel] && _music[channel]->isPlaying()) {
return _music[channel]->setPositionTime(time);
@@ -153,14 +153,14 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) {
//////////////////////////////////////////////////////////////////////////
bool BaseGameMusic::updateMusicCrossfade() {
/* byte globMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */
-
+
if (!_musicCrossfadeRunning) {
return STATUS_OK;
}
if (_gameRef->_state == GAME_FROZEN) {
return STATUS_OK;
}
-
+
if (_musicCrossfadeChannel1 < 0 || _musicCrossfadeChannel1 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel1]) {
_musicCrossfadeRunning = false;
return STATUS_OK;
@@ -169,34 +169,34 @@ bool BaseGameMusic::updateMusicCrossfade() {
_musicCrossfadeRunning = false;
return STATUS_OK;
}
-
+
if (!_music[_musicCrossfadeChannel1]->isPlaying()) {
_music[_musicCrossfadeChannel1]->play();
}
if (!_music[_musicCrossfadeChannel2]->isPlaying()) {
_music[_musicCrossfadeChannel2]->play();
}
-
+
uint32 currentTime = _gameRef->getLiveTimer()->getTime() - _musicCrossfadeStartTime;
-
+
if (currentTime >= _musicCrossfadeLength) {
_musicCrossfadeRunning = false;
//_music[_musicCrossfadeChannel2]->setVolume(GlobMusicVol);
_music[_musicCrossfadeChannel2]->setVolumePercent(100);
-
+
_music[_musicCrossfadeChannel1]->stop();
//_music[_musicCrossfadeChannel1]->setVolume(GlobMusicVol);
_music[_musicCrossfadeChannel1]->setVolumePercent(100);
-
-
+
+
if (_musicCrossfadeSwap) {
// swap channels
BaseSound *dummy = _music[_musicCrossfadeChannel1];
int dummyInt = _musicStartTime[_musicCrossfadeChannel1];
-
+
_music[_musicCrossfadeChannel1] = _music[_musicCrossfadeChannel2];
_musicStartTime[_musicCrossfadeChannel1] = _musicStartTime[_musicCrossfadeChannel2];
-
+
_music[_musicCrossfadeChannel2] = dummy;
_musicStartTime[_musicCrossfadeChannel2] = dummyInt;
}
@@ -205,10 +205,10 @@ bool BaseGameMusic::updateMusicCrossfade() {
//_music[_musicCrossfadeChannel2]->setVolume((float)CurrentTime / (float)_musicCrossfadeLength * GlobMusicVol);
_music[_musicCrossfadeChannel1]->setVolumePercent((int)(100.0f - (float)currentTime / (float)_musicCrossfadeLength * 100.0f));
_music[_musicCrossfadeChannel2]->setVolumePercent((int)((float)currentTime / (float)_musicCrossfadeLength * 100.0f));
-
+
//_gameRef->QuickMessageForm("%d %d", _music[_musicCrossfadeChannel1]->GetVolume(), _music[_musicCrossfadeChannel2]->GetVolume());
}
-
+
return STATUS_OK;
}
@@ -242,15 +242,15 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(4);
channel = stack->pop()->getInt();
}
-
+
const char *filename = stack->pop()->getString();
ScValue *valLooping = stack->pop();
bool looping = valLooping->isNULL() ? true : valLooping->getBool();
-
+
ScValue *valLoopStart = stack->pop();
uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt());
-
-
+
+
if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) {
stack->pushBool(false);
} else {
@@ -258,20 +258,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// StopMusic / StopMusicChannel
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "StopMusic") == 0 || strcmp(name, "StopMusicChannel") == 0) {
int channel = 0;
-
+
if (strcmp(name, "StopMusic") == 0) {
stack->correctParams(0);
} else {
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (DID_FAIL(stopMusic(channel))) {
stack->pushBool(false);
} else {
@@ -279,20 +279,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// PauseMusic / PauseMusicChannel
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PauseMusic") == 0 || strcmp(name, "PauseMusicChannel") == 0) {
int channel = 0;
-
+
if (strcmp(name, "PauseMusic") == 0) {
stack->correctParams(0);
} else {
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (DID_FAIL(pauseMusic(channel))) {
stack->pushBool(false);
} else {
@@ -300,7 +300,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// ResumeMusic / ResumeMusicChannel
//////////////////////////////////////////////////////////////////////////
@@ -312,7 +312,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (DID_FAIL(resumeMusic(channel))) {
stack->pushBool(false);
} else {
@@ -320,7 +320,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// GetMusic / GetMusicChannel
//////////////////////////////////////////////////////////////////////////
@@ -343,7 +343,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// SetMusicPosition / SetMusicChannelPosition
//////////////////////////////////////////////////////////////////////////
@@ -355,18 +355,18 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(2);
channel = stack->pop()->getInt();
}
-
+
uint32 time = stack->pop()->getInt();
-
+
if (DID_FAIL(setMusicStartTime(channel, time))) {
stack->pushBool(false);
} else {
stack->pushBool(true);
}
-
+
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// GetMusicPosition / GetMusicChannelPosition
//////////////////////////////////////////////////////////////////////////
@@ -378,7 +378,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
stack->pushInt(0);
} else {
@@ -386,7 +386,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// IsMusicPlaying / IsMusicChannelPlaying
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
stack->pushBool(false);
} else {
@@ -406,7 +406,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// SetMusicVolume / SetMusicChannelVolume
//////////////////////////////////////////////////////////////////////////
@@ -418,7 +418,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(2);
channel = stack->pop()->getInt();
}
-
+
int volume = stack->pop()->getInt();
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
stack->pushBool(false);
@@ -431,7 +431,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// GetMusicVolume / GetMusicChannelVolume
//////////////////////////////////////////////////////////////////////////
@@ -443,16 +443,16 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
stack->correctParams(1);
channel = stack->pop()->getInt();
}
-
+
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) {
stack->pushInt(0);
} else {
stack->pushInt(_music[channel]->getVolumePercent());
}
-
+
return STATUS_OK;
}
-
+
//////////////////////////////////////////////////////////////////////////
// MusicCrossfade
//////////////////////////////////////////////////////////////////////////
@@ -462,34 +462,34 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
int channel2 = stack->pop()->getInt(0);
uint32 fadeLength = (uint32)stack->pop()->getInt(0);
bool swap = stack->pop()->getBool(true);
-
+
if (_musicCrossfadeRunning) {
script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress.");
stack->pushBool(false);
return STATUS_OK;
}
-
+
_musicCrossfadeStartTime = _gameRef->getLiveTimer()->getTime();
_musicCrossfadeChannel1 = channel1;
_musicCrossfadeChannel2 = channel2;
_musicCrossfadeLength = fadeLength;
_musicCrossfadeSwap = swap;
-
+
_musicCrossfadeRunning = true;
-
+
stack->pushBool(true);
return STATUS_OK;
- }
+ }
//////////////////////////////////////////////////////////////////////////
// GetSoundLength
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSoundLength") == 0) {
stack->correctParams(1);
-
+
int length = 0;
const char *filename = stack->pop()->getString();
-
+
BaseSound *sound = new BaseSound(_gameRef);
if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) {
length = sound->getLength();
@@ -503,4 +503,4 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_game_music.h b/engines/wintermute/base/base_game_music.h
index 0ac904b8c1..72c7a171a6 100644
--- a/engines/wintermute/base/base_game_music.h
+++ b/engines/wintermute/base/base_game_music.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -53,7 +53,7 @@ public:
bool stopMusic(int channel);
bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0);
bool updateMusicCrossfade();
-
+
bool persistChannels(BasePersistenceManager *persistMgr);
bool persistCrossfadeSettings(BasePersistenceManager *persistMgr);
private:
@@ -68,6 +68,6 @@ private:
int32 _musicCrossfadeChannel2;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp
index 55fbe39fd2..1de8b31ca7 100644
--- a/engines/wintermute/base/base_game_settings.cpp
+++ b/engines/wintermute/base/base_game_settings.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -47,7 +47,7 @@ BaseGameSettings::BaseGameSettings(BaseGame *gameRef) {
_allowAccessTab = true;
_allowAboutTab = true;
_allowDesktopRes = false;
-
+
_compressedSavegames = true;
_richSavedGames = false;
_savedGameExt = "dsv";
@@ -101,21 +101,21 @@ bool BaseGameSettings::loadSettings(const char *filename) {
TOKEN_TABLE(SAVED_GAME_EXT)
TOKEN_TABLE(GUID)
TOKEN_TABLE_END
-
-
+
+
byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (origBuffer == nullptr) {
BaseEngine::LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename);
return STATUS_FAILED;
}
-
+
bool ret = STATUS_OK;
-
+
byte *buffer = origBuffer;
byte *params;
int cmd;
BaseParser parser;
-
+
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SETTINGS) {
BaseEngine::LOG(0, "'SETTINGS' keyword expected in game settings file.");
return STATUS_FAILED;
@@ -130,61 +130,61 @@ bool BaseGameSettings::loadSettings(const char *filename) {
strcpy(_gameFile, (char *)params);
}
break;
-
+
case TOKEN_STRING_TABLE:
if (DID_FAIL(_stringTable->loadFile((char *)params))) {
cmd = PARSERR_GENERIC;
}
break;
-
+
case TOKEN_RESOLUTION:
parser.scanStr((char *)params, "%d,%d", &_resWidth, &_resHeight);
break;
-
+
case TOKEN_REQUIRE_3D_ACCELERATION:
parser.scanStr((char *)params, "%b", &_requireAcceleration);
break;
-
+
case TOKEN_REQUIRE_SOUND:
parser.scanStr((char *)params, "%b", &_requireSound);
break;
-
+
case TOKEN_HWTL_MODE:
parser.scanStr((char *)params, "%d", &_TLMode);
break;
-
+
case TOKEN_ALLOW_WINDOWED_MODE:
parser.scanStr((char *)params, "%b", &_allowWindowed);
break;
-
+
case TOKEN_ALLOW_DESKTOP_RES:
parser.scanStr((char *)params, "%b", &_allowDesktopRes);
break;
-
+
case TOKEN_ALLOW_ADVANCED:
parser.scanStr((char *)params, "%b", &_allowAdvanced);
break;
-
+
case TOKEN_ALLOW_ACCESSIBILITY_TAB:
parser.scanStr((char *)params, "%b", &_allowAccessTab);
break;
-
+
case TOKEN_ALLOW_ABOUT_TAB:
parser.scanStr((char *)params, "%b", &_allowAboutTab);
break;
-
+
case TOKEN_REGISTRY_PATH:
//BaseEngine::instance().getRegistry()->setBasePath((char *)params);
break;
-
+
case TOKEN_RICH_SAVED_GAMES:
parser.scanStr((char *)params, "%b", &_richSavedGames);
break;
-
+
case TOKEN_SAVED_GAME_EXT:
_savedGameExt = (char *)params;
break;
-
+
case TOKEN_GUID:
break;
}
@@ -197,12 +197,12 @@ bool BaseGameSettings::loadSettings(const char *filename) {
BaseEngine::LOG(0, "Error loading game settings '%s'", filename);
ret = STATUS_FAILED;
}
-
+
_allowWindowed = true; // TODO: These two settings should probably be cleaned out altogether.
_compressedSavegames = true;
-
+
delete[] origBuffer;
-
+
return ret;
}
@@ -219,4 +219,4 @@ char *BaseGameSettings::getKeyFromStringTable(const char *str) const {
return _stringTable->getKey(str);
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h
index 1dfb0b50cc..38a2fd1042 100644
--- a/engines/wintermute/base/base_game_settings.h
+++ b/engines/wintermute/base/base_game_settings.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -66,6 +66,6 @@ private:
bool _richSavedGames;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp
index 072a1bb71b..aeb56ad282 100644
--- a/engines/wintermute/base/base_keyboard_state.cpp
+++ b/engines/wintermute/base/base_keyboard_state.cpp
@@ -310,4 +310,4 @@ Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) {
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h
index b62ece02b7..14a57ee7b8 100644
--- a/engines/wintermute/base/base_keyboard_state.h
+++ b/engines/wintermute/base/base_keyboard_state.h
@@ -61,7 +61,7 @@ private:
bool _currentPrintable;
uint32 _currentKeyData;
uint32 _currentCharCode;
-
+
bool _currentShift;
bool _currentAlt;
bool _currentControl;
@@ -71,6 +71,6 @@ private:
Common::KeyCode vKeyToKeyCode(uint32 vkey); //TODO, reimplement using ScummVM-backend
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp
index f99ec2f5db..3d1df5ab84 100644
--- a/engines/wintermute/base/base_named_object.cpp
+++ b/engines/wintermute/base/base_named_object.cpp
@@ -68,4 +68,4 @@ void BaseNamedObject::setName(const char *name) {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_named_object.h b/engines/wintermute/base/base_named_object.h
index d25fec4a82..ee4a3bba6a 100644
--- a/engines/wintermute/base/base_named_object.h
+++ b/engines/wintermute/base/base_named_object.h
@@ -46,6 +46,6 @@ public:
void setName(const char *name);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
index ad181b922e..ea754f8f23 100644
--- a/engines/wintermute/base/base_object.cpp
+++ b/engines/wintermute/base/base_object.cpp
@@ -968,9 +968,9 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_movable));
persistMgr->transfer(TMEMBER(_posX));
persistMgr->transfer(TMEMBER(_posY));
- persistMgr->transfer(TMEMBER(_relativeScale));
+ persistMgr->transferFloat(TMEMBER(_relativeScale));
persistMgr->transfer(TMEMBER(_rotatable));
- persistMgr->transfer(TMEMBER(_scale));
+ persistMgr->transferFloat(TMEMBER(_scale));
persistMgr->transferPtr(TMEMBER_PTR(_sFX));
persistMgr->transfer(TMEMBER(_sFXStart));
persistMgr->transfer(TMEMBER(_sFXVolume));
@@ -982,21 +982,21 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_soundEvent));
persistMgr->transfer(TMEMBER(_zoomable));
- persistMgr->transfer(TMEMBER(_scaleX));
- persistMgr->transfer(TMEMBER(_scaleY));
+ persistMgr->transferFloat(TMEMBER(_scaleX));
+ persistMgr->transferFloat(TMEMBER(_scaleY));
- persistMgr->transfer(TMEMBER(_rotate));
+ persistMgr->transferFloat(TMEMBER(_rotate));
persistMgr->transfer(TMEMBER(_rotateValid));
- persistMgr->transfer(TMEMBER(_relativeRotate));
+ persistMgr->transferFloat(TMEMBER(_relativeRotate));
persistMgr->transfer(TMEMBER(_saveState));
persistMgr->transfer(TMEMBER(_nonIntMouseEvents));
persistMgr->transfer(TMEMBER_INT(_sFXType));
- persistMgr->transfer(TMEMBER(_sFXParam1));
- persistMgr->transfer(TMEMBER(_sFXParam2));
- persistMgr->transfer(TMEMBER(_sFXParam3));
- persistMgr->transfer(TMEMBER(_sFXParam4));
+ persistMgr->transferFloat(TMEMBER(_sFXParam1));
+ persistMgr->transferFloat(TMEMBER(_sFXParam2));
+ persistMgr->transferFloat(TMEMBER(_sFXParam3));
+ persistMgr->transferFloat(TMEMBER(_sFXParam4));
persistMgr->transfer(TMEMBER_INT(_blendMode));
@@ -1242,4 +1242,4 @@ bool BaseObject::afterMove() {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h
index 7afe9cf94c..42041c5e3c 100644
--- a/engines/wintermute/base/base_object.h
+++ b/engines/wintermute/base/base_object.h
@@ -142,6 +142,6 @@ public:
virtual const char *scToString() override;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
index a7e3bd5efb..0b677b6cb2 100644
--- a/engines/wintermute/base/base_parser.cpp
+++ b/engines/wintermute/base/base_parser.cpp
@@ -464,4 +464,4 @@ int32 BaseParser::scanStr(const char *in, const char *format, ...) {
return num;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h
index 4953ac3c0b..4bf48cc016 100644
--- a/engines/wintermute/base/base_parser.h
+++ b/engines/wintermute/base/base_parser.h
@@ -83,6 +83,6 @@ private:
char *_whiteSpace;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
index 5dbacb157b..2e2726f361 100644
--- a/engines/wintermute/base/base_persistence_manager.cpp
+++ b/engines/wintermute/base/base_persistence_manager.cpp
@@ -94,7 +94,7 @@ BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool dele
if (savePrefix) {
_savePrefix = savePrefix;
} else if (_gameRef) {
- _savePrefix = _gameRef->getGameId();
+ _savePrefix = _gameRef->getGameTargetName();
} else {
_savePrefix = "wmesav";
}
@@ -282,7 +282,7 @@ bool BasePersistenceManager::initSave(const char *desc) {
} else {
_saveStream->writeUint32LE(0);
}
-
+
thumbnailOK = true;
}
}
@@ -637,7 +637,7 @@ bool BasePersistenceManager::transfer(const char *name, uint32 *val) {
//////////////////////////////////////////////////////////////////////////
// float
-bool BasePersistenceManager::transfer(const char *name, float *val) {
+bool BasePersistenceManager::transferFloat(const char *name, float *val) {
if (_saving) {
putFloat(*val);
if (_saveStream->err()) {
@@ -887,4 +887,4 @@ bool BasePersistenceManager::checkVersion(byte verMajor, byte verMinor, byte ver
return true;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h
index 7b578085ba..c09b3345b7 100644
--- a/engines/wintermute/base/base_persistence_manager.h
+++ b/engines/wintermute/base/base_persistence_manager.h
@@ -76,7 +76,7 @@ public:
bool transferPtr(const char *name, void *val);
bool transfer(const char *name, int32 *val);
bool transfer(const char *name, uint32 *val);
- bool transfer(const char *name, float *val);
+ bool transferFloat(const char *name, float *val);
bool transfer(const char *name, double *val);
bool transfer(const char *name, bool *val);
bool transfer(const char *name, byte *val);
@@ -115,6 +115,6 @@ private:
BaseGame *_gameRef;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp
index fbd8960894..fe6ca941f3 100644
--- a/engines/wintermute/base/base_point.cpp
+++ b/engines/wintermute/base/base_point.cpp
@@ -60,4 +60,4 @@ bool BasePoint::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h
index 26568d5d0b..cf8a5be336 100644
--- a/engines/wintermute/base/base_point.h
+++ b/engines/wintermute/base/base_point.h
@@ -45,6 +45,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp
index 9f19dfd74a..ac0c107d3b 100644
--- a/engines/wintermute/base/base_quick_msg.cpp
+++ b/engines/wintermute/base/base_quick_msg.cpp
@@ -52,4 +52,4 @@ uint32 BaseQuickMsg::getStartTime() const {
return _startTime;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h
index 377f7733fd..b706424c18 100644
--- a/engines/wintermute/base/base_quick_msg.h
+++ b/engines/wintermute/base/base_quick_msg.h
@@ -44,6 +44,6 @@ private:
uint32 _startTime;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
index 2dabe6ae44..36036a1f18 100644
--- a/engines/wintermute/base/base_region.cpp
+++ b/engines/wintermute/base/base_region.cpp
@@ -432,7 +432,7 @@ bool BaseRegion::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_active));
persistMgr->transfer(TMEMBER(_editorSelectedPoint));
- persistMgr->transfer(TMEMBER(_lastMimicScale));
+ persistMgr->transferFloat(TMEMBER(_lastMimicScale));
persistMgr->transfer(TMEMBER(_lastMimicX));
persistMgr->transfer(TMEMBER(_lastMimicY));
_points.persist(persistMgr);
@@ -532,4 +532,4 @@ bool BaseRegion::mimic(BaseRegion *region, float scale, int x, int y) {
return createRegion() ? STATUS_OK : STATUS_FAILED;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h
index 67ca158897..93ad6a6fbe 100644
--- a/engines/wintermute/base/base_region.h
+++ b/engines/wintermute/base/base_region.h
@@ -65,6 +65,6 @@ private:
int32 _lastMimicY;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
index 036bac1dd8..25b8775a98 100644
--- a/engines/wintermute/base/base_script_holder.cpp
+++ b/engines/wintermute/base/base_script_holder.cpp
@@ -500,4 +500,4 @@ bool BaseScriptHolder::sendEvent(const char *eventName) {
return DID_SUCCEED(applyEvent(eventName));
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h
index 38a3f935d3..c34b0378a1 100644
--- a/engines/wintermute/base/base_script_holder.h
+++ b/engines/wintermute/base/base_script_holder.h
@@ -71,6 +71,6 @@ public:
virtual bool sendEvent(const char *eventName);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp
index 5753b0482b..be1e18c2c4 100644
--- a/engines/wintermute/base/base_scriptable.cpp
+++ b/engines/wintermute/base/base_scriptable.cpp
@@ -188,4 +188,4 @@ ScScript *BaseScriptable::invokeMethodThread(const char *methodName) {
return nullptr;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h
index f23d7faa5b..08fd32081a 100644
--- a/engines/wintermute/base/base_scriptable.h
+++ b/engines/wintermute/base/base_scriptable.h
@@ -78,6 +78,6 @@ BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack);
BaseScriptable *makeSXStore(BaseGame *inGame);
BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack);
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index c920da9ee9..ab78c5ac7c 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -817,4 +817,4 @@ bool BaseSprite::killAllSounds() {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h
index 05cb9fc936..1387796895 100644
--- a/engines/wintermute/base/base_sprite.h
+++ b/engines/wintermute/base/base_sprite.h
@@ -32,6 +32,7 @@
#include "engines/wintermute/coll_templ.h"
#include "engines/wintermute/base/base_script_holder.h"
+#include "engines/wintermute/graphics/transform_tools.h"
namespace Wintermute {
class BaseFrame;
@@ -44,17 +45,17 @@ public:
void setDefaults();
DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
- bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
+ bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = kDefaultZoomX, float scaleY = kDefaultZoomY);
int32 _moveY;
int32 _moveX;
- bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
- bool getCurrentFrame(float zoomX = 100, float zoomY = 100);
+ bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod, float rotate = kDefaultAngle, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ bool getCurrentFrame(float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY);
void reset();
bool isChanged();
bool isFinished();
bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
- bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
+ bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod);
bool _looping;
int32 _currentFrame;
bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr);
@@ -88,6 +89,6 @@ private:
bool killAllSounds();
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp
index 8207c32244..3d9cc4f8b3 100644
--- a/engines/wintermute/base/base_string_table.cpp
+++ b/engines/wintermute/base/base_string_table.cpp
@@ -253,4 +253,4 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h
index 128807bd1a..f8808f5b27 100644
--- a/engines/wintermute/base/base_string_table.h
+++ b/engines/wintermute/base/base_string_table.h
@@ -50,6 +50,6 @@ private:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index d93cf667f1..8a8f63240b 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -38,6 +38,8 @@
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
+#include "engines/wintermute/graphics/transform_tools.h"
+#include "engines/wintermute/graphics/transform_struct.h"
namespace Wintermute {
@@ -46,8 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false)
//////////////////////////////////////////////////////////////////////////
BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
_surface = nullptr;
- _hotspotX = _hotspotY = 0;
- _alpha = 0xFFFFFFFF;
+ _hotspotX = kDefaultHotspotX;
+ _hotspotY = kDefaultHotspotY;
+ _alpha = kDefaultRgbaMod;
_transparent = 0xFFFF00FF;
_wantsDefaultRect = false;
@@ -233,12 +236,18 @@ const char* BaseSubFrame::getSurfaceFilename() {
//////////////////////////////////////////////////////////////////////
bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) {
+
+ rotate = fmod(rotate, 360.0f);
+ if (rotate < 0) {
+ rotate += 360.0f;
+ }
+
if (!_surface) {
return STATUS_OK;
}
if (registerOwner != nullptr && !_decoration) {
- if (zoomX == 100 && zoomY == 100) {
+ if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) {
BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise));
} else {
BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise));
@@ -251,17 +260,24 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl
bool res;
//if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha)
- if (_alpha != 0xFFFFFFFF) {
+ if (_alpha != kDefaultRgbaMod) {
alpha = _alpha;
}
- if (rotate != 0.0f) {
- res = _surface->displayTransform((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), _hotspotX, _hotspotY, getRect(), zoomX, zoomY, alpha, rotate, blendMode, _mirrorX, _mirrorY);
+ if (rotate != kDefaultAngle) {
+ Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin;
+ Point32 origin(x, y);
+ Rect32 oldRect = getRect();
+ Point32 newHotspot;
+ TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0);
+ Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot);
+ newOrigin = origin - newHotspot;
+ res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform);
} else {
- if (zoomX == 100 && zoomY == 100) {
+ if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) {
res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY);
} else {
- res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY);
+ res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / kDefaultZoomX)), (int)(y - _hotspotY * (zoomY / kDefaultZoomY)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY);
}
}
@@ -657,4 +673,4 @@ bool BaseSubFrame::setSurfaceSimple() {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h
index 37ba34b748..ba3d5b955a 100644
--- a/engines/wintermute/base/base_sub_frame.h
+++ b/engines/wintermute/base/base_sub_frame.h
@@ -88,6 +88,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
index 8dbd6a6d2a..f1d068674b 100644
--- a/engines/wintermute/base/base_surface_storage.cpp
+++ b/engines/wintermute/base/base_surface_storage.cpp
@@ -203,4 +203,4 @@ bool BaseSurfaceStorage::surfaceSortCB(const BaseSurface *s1, const BaseSurface
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h
index 61738e69a2..c0049d676c 100644
--- a/engines/wintermute/base/base_surface_storage.h
+++ b/engines/wintermute/base/base_surface_storage.h
@@ -52,6 +52,6 @@ public:
Common::Array<BaseSurface *> _surfaces;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp
index 1c869e6a2b..eee5f1aae7 100644
--- a/engines/wintermute/base/base_transition_manager.cpp
+++ b/engines/wintermute/base/base_transition_manager.cpp
@@ -135,4 +135,4 @@ bool BaseTransitionMgr::update() {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h
index edb3045a58..82edb9ff88 100644
--- a/engines/wintermute/base/base_transition_manager.h
+++ b/engines/wintermute/base/base_transition_manager.h
@@ -49,6 +49,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
index f79e5c9f13..09ac80e9de 100644
--- a/engines/wintermute/base/base_viewport.cpp
+++ b/engines/wintermute/base/base_viewport.cpp
@@ -97,4 +97,4 @@ int BaseViewport::getHeight() const {
return _rect.bottom - _rect.top;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h
index 584e5a78f9..0225c02c7c 100644
--- a/engines/wintermute/base/base_viewport.h
+++ b/engines/wintermute/base/base_viewport.h
@@ -52,6 +52,6 @@ private:
Rect32 _rect;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 3c1ecc7a73..7391d819fc 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -66,12 +66,6 @@ static Common::FSNode getNodeForRelativePath(const Common::String &filename) {
const Common::FSNode gameDataDir(ConfMan.get("path"));
Common::FSNode curNode = gameDataDir;
- Common::String fixedPath = "";
- while (!path.empty()) {
- fixedPath += path.nextToken() + "/";
- }
- fixedPath.deleteLastChar();
-
// Parse all path-elements
while (!path.empty()) {
// Get the next path-component by slicing on '\\'
@@ -198,4 +192,4 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
return nullptr;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h
index c9f93b80d9..81cc22b86d 100644
--- a/engines/wintermute/base/file/base_disk_file.h
+++ b/engines/wintermute/base/file/base_disk_file.h
@@ -36,6 +36,6 @@ namespace Wintermute {
Common::SeekableReadStream *openDiskFile(const Common::String &filename);
bool diskFileExists(const Common::String &filename);
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp
index f52a13211e..42eea69824 100644
--- a/engines/wintermute/base/file/base_file.cpp
+++ b/engines/wintermute/base/file/base_file.cpp
@@ -65,4 +65,4 @@ Common::SeekableReadStream *BaseFile::getMemStream() {
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h
index 8eda6d51d9..9acda7ffce 100644
--- a/engines/wintermute/base/file/base_file.h
+++ b/engines/wintermute/base/file/base_file.h
@@ -62,6 +62,6 @@ public:
virtual Common::SeekableReadStream *getMemStream();
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp
index 1968da6f47..846f56b55c 100644
--- a/engines/wintermute/base/file/base_file_entry.cpp
+++ b/engines/wintermute/base/file/base_file_entry.cpp
@@ -70,4 +70,4 @@ BaseFileEntry::~BaseFileEntry() {
_package = nullptr; // ref only
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h
index 6e4823d994..9d738c8c11 100644
--- a/engines/wintermute/base/file/base_file_entry.h
+++ b/engines/wintermute/base/file/base_file_entry.h
@@ -55,6 +55,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp
index 73f767c3ef..512279b72c 100644
--- a/engines/wintermute/base/file/base_package.cpp
+++ b/engines/wintermute/base/file/base_package.cpp
@@ -273,4 +273,4 @@ Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common::
return nullptr;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h
index bcf088aaea..18156c4f65 100644
--- a/engines/wintermute/base/file/base_package.h
+++ b/engines/wintermute/base/file/base_package.h
@@ -85,6 +85,6 @@ private:
Common::HashMap<Common::String, Common::ArchiveMemberPtr>::iterator _filesIter;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp
index 2c4ddf4875..bb172ca66a 100644
--- a/engines/wintermute/base/file/base_save_thumb_file.cpp
+++ b/engines/wintermute/base/file/base_save_thumb_file.cpp
@@ -150,4 +150,4 @@ bool BaseSaveThumbFile::seek(uint32 pos, int whence) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h
index 3b217525fd..faf1af9255 100644
--- a/engines/wintermute/base/file/base_save_thumb_file.h
+++ b/engines/wintermute/base/file/base_save_thumb_file.h
@@ -47,6 +47,6 @@ private:
byte *_data;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h
index 2234139408..a2ec5d28d5 100644
--- a/engines/wintermute/base/file/dcpackage.h
+++ b/engines/wintermute/base/file/dcpackage.h
@@ -75,6 +75,6 @@ v2: uint32 TimeDate1
*/
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp
index 596f9fb5c6..26bc0e7985 100644
--- a/engines/wintermute/base/font/base_font.cpp
+++ b/engines/wintermute/base/font/base_font.cpp
@@ -137,4 +137,4 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) {
return ret;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font.h b/engines/wintermute/base/font/base_font.h
index 50587fa7eb..d75d3f4fb5 100644
--- a/engines/wintermute/base/font/base_font.h
+++ b/engines/wintermute/base/font/base_font.h
@@ -56,6 +56,6 @@ private:
static bool isTrueType(BaseGame *game, const Common::String &filename);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
index 03bd471636..890a9a2f83 100644
--- a/engines/wintermute/base/font/base_font_bitmap.cpp
+++ b/engines/wintermute/base/font/base_font_bitmap.cpp
@@ -587,4 +587,4 @@ int BaseFontBitmap::getLetterHeight() {
return _tileHeight;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h
index 0bdac64026..c810777446 100644
--- a/engines/wintermute/base/font/base_font_bitmap.h
+++ b/engines/wintermute/base/font/base_font_bitmap.h
@@ -66,6 +66,6 @@ private:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp
index 3286742478..8abd368b70 100644
--- a/engines/wintermute/base/font/base_font_storage.cpp
+++ b/engines/wintermute/base/font/base_font_storage.cpp
@@ -138,4 +138,4 @@ bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h
index 60874167e7..f4ac490324 100644
--- a/engines/wintermute/base/font/base_font_storage.h
+++ b/engines/wintermute/base/font/base_font_storage.h
@@ -50,6 +50,6 @@ public:
bool initLoop();
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index 2fcdebc117..3059a69047 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -644,4 +644,4 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight
}*/
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h
index f93505921f..fdbae30684 100644
--- a/engines/wintermute/base/font/base_font_truetype.h
+++ b/engines/wintermute/base/font/base_font_truetype.h
@@ -148,6 +148,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp
index 75de95128f..d0dbae352e 100644
--- a/engines/wintermute/base/gfx/base_image.cpp
+++ b/engines/wintermute/base/gfx/base_image.cpp
@@ -228,4 +228,4 @@ bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) {
return true;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h
index 017305e5d0..4b04fd1252 100644
--- a/engines/wintermute/base/gfx/base_image.h
+++ b/engines/wintermute/base/gfx/base_image.h
@@ -67,6 +67,6 @@ private:
BaseFileManager *_fileManager;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp
index c20881e425..1f171209d7 100644
--- a/engines/wintermute/base/gfx/base_renderer.cpp
+++ b/engines/wintermute/base/gfx/base_renderer.cpp
@@ -113,15 +113,21 @@ void BaseRenderer::setIndicatorVal(int value) {
}
void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) {
- // TODO: Handle NULL
- _loadImageName = filename;
+ if (filename == nullptr) {
+ _saveImageName = "";
+ } else {
+ _loadImageName = filename;
+ }
_loadImageX = x;
_loadImageY = y;
}
void BaseRenderer::setSaveImage(const char *filename, int x, int y) {
- // TODO: Handle NULL
- _saveImageName = filename;
+ if (filename == nullptr) {
+ _saveImageName = "";
+ } else {
+ _saveImageName = filename;
+ }
_saveImageX = x;
_saveImageY = y;
}
@@ -395,4 +401,4 @@ bool BaseRenderer::displayIndicator() {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h
index bfef29a5ed..31dc2a022d 100644
--- a/engines/wintermute/base/gfx/base_renderer.h
+++ b/engines/wintermute/base/gfx/base_renderer.h
@@ -228,6 +228,6 @@ private:
BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp
index 2002463ea4..19639c0c33 100644
--- a/engines/wintermute/base/gfx/base_surface.cpp
+++ b/engines/wintermute/base/gfx/base_surface.cpp
@@ -75,8 +75,8 @@ bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY);
+bool BaseSurface::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) {
+ return displayTransform(x, y, rect, newRect, transform);
}
//////////////////////////////////////////////////////////////////////////
@@ -146,4 +146,4 @@ void BaseSurface::setSize(int width, int height) {
_height = height;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
index b83efa0bb8..8a0603734e 100644
--- a/engines/wintermute/base/gfx/base_surface.h
+++ b/engines/wintermute/base/gfx/base_surface.h
@@ -32,6 +32,7 @@
#include "engines/wintermute/base/base.h"
#include "engines/wintermute/math/rect32.h"
#include "graphics/surface.h"
+#include "engines/wintermute/graphics/transform_struct.h"
namespace Wintermute {
@@ -49,12 +50,12 @@ public:
virtual bool displayHalfTrans(int x, int y, Rect32 rect);
virtual bool isTransparentAt(int x, int y);
- virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0;
virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual bool displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) = 0;
+ virtual bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
virtual bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) = 0;
virtual bool restore();
virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
@@ -95,6 +96,6 @@ protected:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index e1424cea87..668105457f 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -60,8 +60,7 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) {
_borderLeft = _borderRight = _borderTop = _borderBottom = 0;
_ratioX = _ratioY = 1.0f;
- setAlphaMod(255);
- setColorMod(255, 255, 255);
+ _colorMod = kDefaultRgbaMod;
_dirtyRect = nullptr;
_disableDirtyRects = false;
_tempDisableDirtyRects = 0;
@@ -150,18 +149,6 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
return STATUS_OK;
}
-void BaseRenderOSystem::setAlphaMod(byte alpha) {
- byte r = RGBCOLGetR(_colorMod);
- byte g = RGBCOLGetB(_colorMod);
- byte b = RGBCOLGetB(_colorMod);
- _colorMod = BS_ARGB(alpha, r, g, b);
-}
-
-void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) {
- byte alpha = RGBCOLGetA(_colorMod);
- _colorMod = BS_ARGB(alpha, r, g, b);
-}
-
bool BaseRenderOSystem::indicatorFlip() {
g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight);
g_system->updateScreen();
@@ -200,9 +187,9 @@ bool BaseRenderOSystem::flip() {
}
if (_needsFlip || _disableDirtyRects || _tempDisableDirtyRects) {
if (_disableDirtyRects || _tempDisableDirtyRects) {
- g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
+ g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
}
- // g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
+ // g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
delete _dirtyRect;
_dirtyRect = nullptr;
g_system->updateScreen();
@@ -256,7 +243,6 @@ void BaseRenderOSystem::fade(uint16 alpha) {
return fadeToColor(0, 0, 0, dwAlpha);
}
-
//////////////////////////////////////////////////////////////////////////
void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) {
Common::Rect fillRect;
@@ -279,14 +265,14 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect
//TODO: This is only here until I'm sure about the final pixelformat
uint32 col = _renderSurface->format.ARGBToColor(a, r, g, b);
- setAlphaMod(255);
- setColorMod(255, 255, 255);
Graphics::Surface surf;
surf.create((uint16)fillRect.width(), (uint16)fillRect.height(), _renderSurface->format);
Common::Rect sizeRect(fillRect);
sizeRect.translate(-fillRect.top, -fillRect.left);
surf.fillRect(fillRect, col);
- drawSurface(nullptr, &surf, &sizeRect, &fillRect, false, false);
+ TransformStruct temp = TransformStruct();
+ temp._alphaDisable = false;
+ drawSurface(nullptr, &surf, &sizeRect, &fillRect, temp);
surf.free();
//SDL_SetRenderDrawColor(_renderer, r, g, b, a);
@@ -298,16 +284,18 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const {
return _renderSurface->format;
}
-void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) {
+void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform) {
+
if (_tempDisableDirtyRects || _disableDirtyRects) {
- RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
- ticket->_colorMod = _colorMod;
+ RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform);
+ ticket->_transform._rgbaMod = _colorMod;
ticket->_wantsDraw = true;
_renderQueue.push_back(ticket);
_previousTicket = ticket;
drawFromSurface(ticket);
return;
}
+
// Start searching from the beginning for the first and second items (since it's empty the first time around
// then keep incrementing the start-position, to avoid comparing against already used tickets.
if (_drawNum == 0 || _drawNum == 1) {
@@ -320,12 +308,11 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
}
if (owner) { // Fade-tickets are owner-less
- RenderTicket compare(owner, nullptr, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
+ RenderTicket compare(owner, nullptr, srcRect, dstRect, transform);
compare._batchNum = _batchNum;
if (_spriteBatch) {
_batchNum++;
}
- compare._colorMod = _colorMod;
RenderQueueIterator it;
// Avoid calling end() and operator* every time, when potentially going through
// LOTS of tickets.
@@ -334,7 +321,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
for (it = _lastAddedTicket; it != endIterator; ++it) {
compareTicket = *it;
if (*(compareTicket) == compare && compareTicket->_isValid) {
- compareTicket->_colorMod = _colorMod;
+ compareTicket->_transform._rgbaMod = transform._rgbaMod;
if (_disableDirtyRects) {
drawFromSurface(compareTicket);
} else {
@@ -349,8 +336,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
}
}
}
- RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
- ticket->_colorMod = _colorMod;
+ RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform);
if (!_disableDirtyRects) {
drawFromTicket(ticket);
_previousTicket = ticket;
@@ -385,12 +371,14 @@ void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX,
int initLeft = dstRect.left;
int initRight = dstRect.right;
+ TransformStruct temp = TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, BLEND_NORMAL, kDefaultRgbaMod, false, false, kDefaultOffsetX, kDefaultOffsetY);
+
for (int i = 0; i < numTimesY; i++) {
if (i == 0) {
dstRect.translate(offsetX, 0);
}
for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) {
- drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, false, false);
+ drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, temp);
dstRect.translate(offsetX, 0);
}
dstRect.left = initLeft;
@@ -535,7 +523,7 @@ void BaseRenderOSystem::drawTickets() {
// convert from screen-coords to surface-coords.
dstClip.translate(-offsetX, -offsetY);
- _colorMod = ticket->_colorMod;
+ _colorMod = ticket->_transform._rgbaMod;
drawFromSurface(ticket, &pos, &dstClip);
_needsFlip = true;
}
@@ -546,7 +534,7 @@ void BaseRenderOSystem::drawTickets() {
// Revert the colorMod-state.
_colorMod = oldColorMod;
-
+
it = _renderQueue.begin();
// Clean out the old tickets
decrement = 0;
@@ -625,8 +613,8 @@ bool BaseRenderOSystem::setViewport(int left, int top, int right, int bottom) {
// TODO: Hopefully this is the same logic that ScummVM uses.
rect.left = (int16)(left + _borderLeft);
rect.top = (int16)(top + _borderTop);
- rect.right = (int16)((right - left) * _ratioX);
- rect.bottom = (int16)((bottom - top) * _ratioY);
+ rect.setWidth((int16)((right - left) * _ratioX));
+ rect.setHeight((int16)((bottom - top) * _ratioY));
_renderRect = rect;
return STATUS_OK;
@@ -643,15 +631,13 @@ Rect32 BaseRenderOSystem::getViewPort() {
//////////////////////////////////////////////////////////////////////////
void BaseRenderOSystem::modTargetRect(Common::Rect *rect) {
- // FIXME: This is wrong in quite a few ways right now, and ends up
- // breaking the notebook in Dirty Split, so we disable the correction
- // for now, this will need fixing when a game with odd aspect-ratios
- // show up.
return;
- rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft - _renderRect.left);
- rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop - _renderRect.top);
- rect->setWidth((int16)MathUtil::roundUp(rect->width() * _ratioX));
- rect->setHeight((int16)MathUtil::roundUp(rect->height() * _ratioY));
+ int newWidth = (int16)MathUtil::roundUp(rect->width() * _ratioX);
+ int newHeight = (int16)MathUtil::roundUp(rect->height() * _ratioY);
+ rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft);
+ rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop);
+ rect->setWidth(newWidth);
+ rect->setHeight(newHeight);
}
//////////////////////////////////////////////////////////////////////////
@@ -694,7 +680,7 @@ void BaseRenderOSystem::endSaveLoad() {
_drawNum = 1;
_renderSurface->fillRect(Common::Rect(0, 0, _renderSurface->h, _renderSurface->w), _renderSurface->format.ARGBToColor(255, 0, 0, 0));
- g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
+ g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
g_system->updateScreen();
}
@@ -710,4 +696,4 @@ bool BaseRenderOSystem::endSpriteBatch() {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index 3cb0fa82a3..928a52d4fc 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -33,10 +33,30 @@
#include "common/rect.h"
#include "graphics/surface.h"
#include "common/list.h"
+#include "engines/wintermute/graphics/transform_struct.h"
namespace Wintermute {
class BaseSurfaceOSystem;
class RenderTicket;
+/**
+ * A 2D-renderer implementation for WME.
+ * This renderer makes use of a "ticket"-system, where all draw-calls
+ * are stored as tickets until flip() is called, and compared against the tickets
+ * from last frame, to determine which calls were the same as last round
+ * (i.e. in the exact same order, with the exact same arguments), and thus
+ * figure out which parts of the screen need to be redrawn.
+ *
+ * Important concepts to handle here, is the ordered number of any ticket
+ * which is called the "drawNum", every frame this starts from scratch, and
+ * then the incoming tickets created from the draw-calls are checked to see whether
+ * they came before, on, or after the drawNum they had last frame. Everything else
+ * being equal, this information is then used to check whether the draw order changed,
+ * which will then create a need for redrawing, as we draw with an alpha-channel here.
+ *
+ * There is also a draw path that draws without tickets, for debugging purposes,
+ * as well as to accomodate situations with large enough amounts of draw calls,
+ * that there will be too much overhead involved with comparing the generated tickets.
+ */
class BaseRenderOSystem : public BaseRenderer {
public:
BaseRenderOSystem(BaseGame *inGame);
@@ -56,10 +76,13 @@ public:
BaseImage *takeScreenshot() override;
- void setAlphaMod(byte alpha);
- void setColorMod(byte r, byte g, byte b);
void invalidateTicket(RenderTicket *renderTicket);
void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf);
+ /**
+ * Insert a ticket into the queue, adding a dirty rect if it's
+ * new, or out-of-order from last draw from the ticket.
+ * param renderTicket the ticket to be added.
+ */
void drawFromTicket(RenderTicket *renderTicket);
bool setViewport(int left, int top, int right, int bottom) override;
@@ -80,11 +103,18 @@ public:
virtual bool startSpriteBatch() override;
virtual bool endSpriteBatch() override;
void endSaveLoad();
- void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha = false) ;
+ void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform);
void repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY);
BaseSurface *createSurface() override;
private:
- void addDirtyRect(const Common::Rect &rect) ;
+ /**
+ * Mark a specified rect of the screen as dirty.
+ * @param rect the region to be marked as dirty
+ */
+ void addDirtyRect(const Common::Rect &rect);
+ /**
+ * Traverse the tickets that are dirty, and draw them
+ */
void drawTickets();
// Non-dirty-rects:
void drawFromSurface(RenderTicket *ticket);
@@ -97,7 +127,7 @@ private:
RenderTicket *_previousTicket;
bool _needsFlip;
- uint32 _drawNum;
+ uint32 _drawNum; ///< The global number of the current draw-operation.
Common::Rect _renderRect;
Graphics::Surface *_renderSurface;
Graphics::Surface *_blankSurface;
@@ -119,6 +149,6 @@ private:
bool _skipThisFrame;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 0572ef2f6e..d4c5905c4b 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -52,6 +52,7 @@ BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) {
_lockPixels = nullptr;
_lockPitch = 0;
_loaded = false;
+ _rotation = 0;
}
//////////////////////////////////////////////////////////////////////////
@@ -163,7 +164,7 @@ bool BaseSurfaceOSystem::finishLoad() {
needsColorKey = true;
}
}
-
+
if (needsColorKey) {
TransparentSurface trans(*_surface);
trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, replaceAlpha);
@@ -233,7 +234,7 @@ uint32 BaseSurfaceOSystem::getPixelAt(Graphics::Surface *surface, int x, int y)
warning("BaseSurfaceOSystem::GetPixel - Not ported yet");
int bpp = surface->format.bytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
- uint8 *p = (uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+ uint8 *p = (uint8 *)surface->getBasePtr(x, y);
switch (bpp) {
case 1:
@@ -319,39 +320,56 @@ bool BaseSurfaceOSystem::endPixelOp() {
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY);
+ _rotation = 0;
+ return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, mirrorX, mirrorY));
}
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY);
+ _rotation = 0;
+ return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY));
}
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
- return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY);
+ _rotation = 0;
+ return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY));
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
+bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ _rotation = 0;
+ return drawSprite(x, y, &rect, nullptr, TransformStruct(zoomX, zoomY, blendMode, alpha, mirrorX, mirrorY));
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !transparent, blendMode, mirrorX, mirrorY);
+bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ _rotation = 0;
+ TransformStruct transform;
+ if (transparent) {
+ transform = TransformStruct(zoomX, zoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY);
+ } else {
+ transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY);
+ }
+ return drawSprite(x, y, &rect, nullptr, transform);
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
- return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
+bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) {
+ _rotation = (uint32)transform._angle;
+ if (transform._angle < 0.0f) {
+ warning("Negative rotation: %d %d", transform._angle, _rotation);
+ _rotation = (uint32)(360.0f + transform._angle);
+ warning("Negative post rotation: %d %d", transform._angle, _rotation);
+ }
+ return drawSprite(x, y, &rect, &newRect, transform);
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
+bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transform) {
BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
if (!_loaded) {
@@ -359,17 +377,9 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
}
if (renderer->_forceAlphaColor != 0) {
- alpha = renderer->_forceAlphaColor;
+ transform._rgbaMod = renderer->_forceAlphaColor;
}
- byte r = RGBCOLGetR(alpha);
- byte g = RGBCOLGetG(alpha);
- byte b = RGBCOLGetB(alpha);
- byte a = RGBCOLGetA(alpha);
-
- renderer->setAlphaMod(a);
- renderer->setColorMod(r, g, b);
-
#if 0 // These are kept for reference if BlendMode is reimplemented at some point.
if (alphaDisable) {
SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE);
@@ -386,8 +396,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
srcRect.setHeight(rect->bottom - rect->top);
Common::Rect position;
- position.left = x + offsetX;
- position.top = y + offsetY;
+ position.left = x + transform._offset.x;
+ position.top = y + transform._offset.y;
// Crop off-by-ones:
if (position.left == -1) {
@@ -396,31 +406,34 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
if (position.top == -1) {
position.top = 0; // TODO: Something is wrong
}
-
- position.setWidth((int16)((float)srcRect.width() * zoomX / 100.f));
- position.setHeight((int16)((float)srcRect.height() * zoomX / 100.f));
-
+ if (newRect) {
+ position.top = y;
+ position.left = x;
+ position.right = x + newRect->width();
+ position.bottom = y + newRect->height();
+ position.setWidth(newRect->width());
+ position.setHeight(newRect->height());
+ } else {
+ position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / kDefaultZoomX));
+ position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / kDefaultZoomY));
+ }
renderer->modTargetRect(&position);
- /* position.left += offsetX;
- position.top += offsetY;*/
-
// TODO: This actually requires us to have the SAME source-offsets every time,
// But no checking is in place for that yet.
// TODO: Optimize by not doing alpha-blits if we lack or disable alpha
- bool hasAlpha;
- if (_hasAlpha && !alphaDisable) {
+
+ bool hasAlpha = false;
+
+ if (_hasAlpha && !transform._alphaDisable) {
hasAlpha = true;
- } else {
- hasAlpha = false;
- }
- if (alphaDisable) {
+ }
+
+ if (transform._alphaDisable) {
warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored");
}
-
- renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, !hasAlpha);
-
+ renderer->drawSurface(this, _surface, &srcRect, &position, transform);
return STATUS_OK;
}
@@ -441,4 +454,4 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 9091ec65b1..da86833517 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -51,12 +51,12 @@ public:
bool endPixelOp() override;
- bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
- bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
- bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
+ bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
+ bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
+ bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
- bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
- bool displayTransform(int x, int y, int hotX, int hotY, Rect32 Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
+ bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
+ bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override;
bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override;
virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
/* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
@@ -85,16 +85,17 @@ private:
Graphics::Surface *_surface;
bool _loaded;
bool finishLoad();
- bool drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0);
+ bool drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transformStruct);
void genAlphaMask(Graphics::Surface *surface);
uint32 getPixelAt(Graphics::Surface *surface, int x, int y);
+ uint32 _rotation;
bool _hasAlpha;
void *_lockPixels;
int _lockPitch;
byte *_alphaMask;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
index 36c5d7b740..98739e0778 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -26,22 +26,22 @@
* Copyright (c) 2011 Jan Nedoma
*/
-#include "engines/wintermute/graphics/transparent_surface.h"
+
#include "engines/wintermute/base/gfx/osystem/render_ticket.h"
+#include "engines/wintermute/graphics/transform_tools.h"
+#include "common/textconsole.h"
namespace Wintermute {
-RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) : _owner(owner),
-_srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(!disableAlpha) {
- _colorMod = 0;
+RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform) :
+ _owner(owner),
+ _srcRect(*srcRect),
+ _dstRect(*dstRect),
+ _drawNum(0),
+ _isValid(true),
+ _wantsDraw(true),
+ _transform(transform) {
_batchNum = 0;
- _mirror = TransparentSurface::FLIP_NONE;
- if (mirrorX) {
- _mirror |= TransparentSurface::FLIP_V;
- }
- if (mirrorY) {
- _mirror |= TransparentSurface::FLIP_H;
- }
if (surf) {
_surface = new Graphics::Surface();
_surface->create((uint16)srcRect->width(), (uint16)srcRect->height(), surf->format);
@@ -51,7 +51,13 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(
memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel);
}
// Then scale it if necessary
- if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) {
+ if (_transform._angle != kDefaultAngle) {
+ TransparentSurface src(*_surface, false);
+ Graphics::Surface *temp = src.rotoscale(transform);
+ _surface->free();
+ delete _surface;
+ _surface = temp;
+ } else if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) {
TransparentSurface src(*_surface, false);
Graphics::Surface *temp = src.scale(dstRect->width(), dstRect->height());
_surface->free();
@@ -60,6 +66,14 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(
}
} else {
_surface = nullptr;
+
+ if (transform._angle != kDefaultAngle) { // Make sure comparison-tickets get the correct width
+ Rect32 newDstRect;
+ Point32 newHotspot;
+ newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot);
+ _dstRect.setWidth(newDstRect.right - newDstRect.left);
+ _dstRect.setHeight(newDstRect.bottom - newDstRect.top);
+ }
}
}
@@ -70,32 +84,31 @@ RenderTicket::~RenderTicket() {
}
}
-bool RenderTicket::operator==(RenderTicket &t) {
+bool RenderTicket::operator==(const RenderTicket &t) const {
if ((t._owner != _owner) ||
(t._batchNum != _batchNum) ||
- (t._hasAlpha != _hasAlpha) ||
- (t._mirror != _mirror) ||
- (t._colorMod != _colorMod) ||
+ (t._transform != _transform) ||
(t._dstRect != _dstRect) ||
- (t._srcRect != _srcRect)) {
+ (t._srcRect != _srcRect)
+ ) {
return false;
}
return true;
}
// Replacement for SDL2's SDL_RenderCopy
-void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) {
+void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const {
TransparentSurface src(*getSurface(), false);
Common::Rect clipRect;
clipRect.setWidth(getSurface()->w);
clipRect.setHeight(getSurface()->h);
- src._enableAlphaBlit = _hasAlpha;
- src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _mirror, &clipRect, _colorMod, clipRect.width(), clipRect.height());
+ src._enableAlphaBlit = !_transform._alphaDisable;
+ src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _transform._flip, &clipRect, _transform._rgbaMod, clipRect.width(), clipRect.height());
}
-void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) {
+void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const {
TransparentSurface src(*getSurface(), false);
bool doDelete = false;
if (!clipRect) {
@@ -105,11 +118,11 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect
clipRect->setHeight(getSurface()->h);
}
- src._enableAlphaBlit = _hasAlpha;
- src.blit(*_targetSurface, dstRect->left, dstRect->top, _mirror, clipRect, _colorMod, clipRect->width(), clipRect->height());
+ src._enableAlphaBlit = !_transform._alphaDisable;
+ src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height());
if (doDelete) {
delete clipRect;
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h
index 968b42b5e1..875102d01c 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.h
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -29,22 +29,36 @@
#ifndef WINTERMUTE_RENDER_TICKET_H
#define WINTERMUTE_RENDER_TICKET_H
+#include "engines/wintermute/graphics/transparent_surface.h"
#include "graphics/surface.h"
#include "common/rect.h"
namespace Wintermute {
class BaseSurfaceOSystem;
+/**
+ * A single RenderTicket.
+ * A render ticket is a collection of the data and draw specifications made
+ * for a single draw-call in the OSystem-backend for WME. The ticket additionally
+ * holds the order in which this call was made, so that it can be detected if
+ * the same call is done in the following frame. Thus allowing us to potentially
+ * skip drawing the same region again, unless anything has changed. Since a surface
+ * can have a potentially large amount of draw-calls made to it, at varying rotation,
+ * zoom, and crop-levels we also need to hold a copy of the necessary data.
+ * (Video-surfaces may even change their data). The promise that is made when a ticket
+ * is created is that what the state was of the surface at THAT point, is what will end
+ * up on screen at flip() time.
+ */
class RenderTicket {
public:
- RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false, bool disableAlpha = false);
- RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {}
+ RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, TransformStruct transform);
+ RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0), _transform(TransformStruct()) {}
~RenderTicket();
- const Graphics::Surface *getSurface() { return _surface; }
+ const Graphics::Surface *getSurface() const { return _surface; }
// Non-dirty-rects:
- void drawToSurface(Graphics::Surface *_targetSurface);
+ void drawToSurface(Graphics::Surface *_targetSurface) const;
// Dirty-rects:
- void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect);
+ void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const;
Common::Rect _dstRect;
uint32 _batchNum;
@@ -52,18 +66,17 @@ public:
bool _isValid;
bool _wantsDraw;
uint32 _drawNum;
- uint32 _colorMod;
+ TransformStruct _transform;
+
BaseSurfaceOSystem *_owner;
- bool operator==(RenderTicket &a);
- const Common::Rect *getSrcRect() { return &_srcRect; }
+ bool operator==(const RenderTicket &a) const;
+ const Common::Rect *getSrcRect() const { return &_srcRect; }
private:
Graphics::Surface *_surface;
Common::Rect _srcRect;
- bool _hasAlpha;
- uint32 _mirror;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp
index c86e1ce369..aaffa0965a 100644
--- a/engines/wintermute/base/particles/part_emitter.cpp
+++ b/engines/wintermute/base/particles/part_emitter.cpp
@@ -1163,12 +1163,12 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_angle1));
persistMgr->transfer(TMEMBER(_angle2));
- persistMgr->transfer(TMEMBER(_velocity1));
- persistMgr->transfer(TMEMBER(_velocity2));
+ persistMgr->transferFloat(TMEMBER(_velocity1));
+ persistMgr->transferFloat(TMEMBER(_velocity2));
persistMgr->transfer(TMEMBER(_velocityZBased));
- persistMgr->transfer(TMEMBER(_scale1));
- persistMgr->transfer(TMEMBER(_scale2));
+ persistMgr->transferFloat(TMEMBER(_scale1));
+ persistMgr->transferFloat(TMEMBER(_scale2));
persistMgr->transfer(TMEMBER(_scaleZBased));
persistMgr->transfer(TMEMBER(_maxParticles));
@@ -1196,14 +1196,14 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_alpha2));
persistMgr->transfer(TMEMBER(_alphaTimeBased));
- persistMgr->transfer(TMEMBER(_angVelocity1));
- persistMgr->transfer(TMEMBER(_angVelocity2));
+ persistMgr->transferFloat(TMEMBER(_angVelocity1));
+ persistMgr->transferFloat(TMEMBER(_angVelocity2));
- persistMgr->transfer(TMEMBER(_rotation1));
- persistMgr->transfer(TMEMBER(_rotation2));
+ persistMgr->transferFloat(TMEMBER(_rotation1));
+ persistMgr->transferFloat(TMEMBER(_rotation2));
- persistMgr->transfer(TMEMBER(_growthRate1));
- persistMgr->transfer(TMEMBER(_growthRate2));
+ persistMgr->transferFloat(TMEMBER(_growthRate1));
+ persistMgr->transferFloat(TMEMBER(_growthRate2));
persistMgr->transfer(TMEMBER(_exponentialGrowth));
persistMgr->transfer(TMEMBER(_useRegion));
@@ -1252,4 +1252,4 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h
index a0d701f338..94b4dc8126 100644
--- a/engines/wintermute/base/particles/part_emitter.h
+++ b/engines/wintermute/base/particles/part_emitter.h
@@ -135,6 +135,6 @@ private:
BaseArray<char *> _sprites;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp
index df84162504..122cdf1afe 100644
--- a/engines/wintermute/base/particles/part_force.cpp
+++ b/engines/wintermute/base/particles/part_force.cpp
@@ -62,4 +62,4 @@ bool PartForce::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h
index 27f4cb7d90..cdb1ce40f9 100644
--- a/engines/wintermute/base/particles/part_force.h
+++ b/engines/wintermute/base/particles/part_force.h
@@ -52,6 +52,6 @@ public:
bool persist(BasePersistenceManager *PersistMgr);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
index f1aba114de..86cacacb5c 100644
--- a/engines/wintermute/base/particles/part_particle.cpp
+++ b/engines/wintermute/base/particles/part_particle.cpp
@@ -234,9 +234,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_alpha2));
persistMgr->transfer(TMEMBER(_border));
persistMgr->transfer(TMEMBER(_pos));
- persistMgr->transfer(TMEMBER(_posZ));
+ persistMgr->transferFloat(TMEMBER(_posZ));
persistMgr->transfer(TMEMBER(_velocity));
- persistMgr->transfer(TMEMBER(_scale));
+ persistMgr->transferFloat(TMEMBER(_scale));
persistMgr->transfer(TMEMBER(_creationTime));
persistMgr->transfer(TMEMBER(_lifeTime));
persistMgr->transfer(TMEMBER(_isDead));
@@ -244,9 +244,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_fadeStart));
persistMgr->transfer(TMEMBER(_fadeTime));
persistMgr->transfer(TMEMBER(_currentAlpha));
- persistMgr->transfer(TMEMBER(_angVelocity));
- persistMgr->transfer(TMEMBER(_rotation));
- persistMgr->transfer(TMEMBER(_growthRate));
+ persistMgr->transferFloat(TMEMBER(_angVelocity));
+ persistMgr->transferFloat(TMEMBER(_rotation));
+ persistMgr->transferFloat(TMEMBER(_growthRate));
persistMgr->transfer(TMEMBER(_exponentialGrowth));
persistMgr->transfer(TMEMBER(_fadeStartAlpha));
@@ -266,4 +266,4 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h
index 8cca6b4057..281d87cf72 100644
--- a/engines/wintermute/base/particles/part_particle.h
+++ b/engines/wintermute/base/particles/part_particle.h
@@ -85,6 +85,6 @@ private:
int32 _fadeStartAlpha;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/save_thumb_helper.cpp b/engines/wintermute/base/save_thumb_helper.cpp
index bab29c5cf8..77514849a6 100644
--- a/engines/wintermute/base/save_thumb_helper.cpp
+++ b/engines/wintermute/base/save_thumb_helper.cpp
@@ -56,23 +56,23 @@ BaseImage *SaveThumbHelper::storeThumb(bool doFlip, int width, int height) {
// works normally for direct3d
_gameRef->displayContent(false);
_gameRef->_renderer->flip();
-
+
_gameRef->displayContent(false);
_gameRef->_renderer->flip();
}
-
+
BaseImage *screenshot = _gameRef->_renderer->takeScreenshot();
if (!screenshot) {
return nullptr;
}
-
+
// normal thumbnail
if (_gameRef->getSaveThumbWidth() > 0 && _gameRef->getSaveThumbHeight() > 0) {
thumbnail = new BaseImage();
thumbnail->copyFrom(screenshot, width, height);
}
-
-
+
+
delete screenshot;
screenshot = nullptr;
}
@@ -99,7 +99,7 @@ bool SaveThumbHelper::storeThumbnail(bool doFlip) {
bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) {
delete _scummVMThumb;
_scummVMThumb = nullptr;
-
+
_scummVMThumb = storeThumb(doFlip, kThumbnailWidth, kThumbnailHeight2);
if (!_scummVMThumb) {
return STATUS_FAILED;
@@ -107,4 +107,4 @@ bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/save_thumb_helper.h b/engines/wintermute/base/save_thumb_helper.h
index d3bc5f5523..44792e3d75 100644
--- a/engines/wintermute/base/save_thumb_helper.h
+++ b/engines/wintermute/base/save_thumb_helper.h
@@ -47,6 +47,6 @@ private:
BaseGame *_gameRef;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp
index 1b7dfd42ed..8d37909bb4 100644
--- a/engines/wintermute/base/saveload.cpp
+++ b/engines/wintermute/base/saveload.cpp
@@ -201,4 +201,4 @@ bool SaveLoad::emptySaveSlot(int slot) {
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h
index 722f7a89b6..15d4d86b26 100644
--- a/engines/wintermute/base/saveload.h
+++ b/engines/wintermute/base/saveload.h
@@ -52,6 +52,6 @@ private:
static void afterLoadScript(void *script, void *data);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h
index 4aae897dc2..d6bb3cd176 100644
--- a/engines/wintermute/base/scriptables/dcscript.h
+++ b/engines/wintermute/base/scriptables/dcscript.h
@@ -136,6 +136,6 @@ typedef enum {
ELEMENT_STRING = 0
} TElementType;
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 1b945c2e1c..5aeff78c50 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -461,6 +461,7 @@ void ScScript::cleanup() {
_parentScript = nullptr; // ref only
delete _scriptStream;
+ _scriptStream = nullptr;
}
@@ -1464,4 +1465,4 @@ void ScScript::afterLoad() {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
index ee9f45e204..488ff63606 100644
--- a/engines/wintermute/base/scriptables/script.h
+++ b/engines/wintermute/base/scriptables/script.h
@@ -169,6 +169,6 @@ public:
virtual const char *dbgGetFilename();
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index f83fb36843..dd24457d6c 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -605,4 +605,4 @@ void ScEngine::dumpStats() {
}*/
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 639875ffb6..622b3c4b94 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -130,6 +130,6 @@ private:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp
index a466d361ec..7f1c769ec5 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_array.cpp
@@ -249,4 +249,4 @@ bool SXArray::push(ScValue *val) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h
index 68f808641e..e6381a011e 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.h
+++ b/engines/wintermute/base/scriptables/script_ext_array.h
@@ -51,6 +51,6 @@ private:
Common::String _strRep;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp
index afca0c4bbf..d88bfc5851 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_date.cpp
@@ -307,4 +307,4 @@ int SXDate::scCompare(BaseScriptable *Value) {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h
index 062b7c55c7..0ccf093a7b 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.h
+++ b/engines/wintermute/base/scriptables/script_ext_date.h
@@ -49,6 +49,6 @@ private:
Common::String _strRep;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index 29e032a759..18f7b8213a 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -825,4 +825,4 @@ Common::WriteStream *SXFile::openForAppend(const Common::String &filename, bool
error("SXFile::openForAppend - WriteFiles not supported");
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h
index fa2384109f..a1298929f2 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.h
+++ b/engines/wintermute/base/scriptables/script_ext_file.h
@@ -61,6 +61,6 @@ private:
Common::WriteStream *openForAppend(const Common::String &filename, bool binary);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp
index d816fbec65..ec53b983e7 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_math.cpp
@@ -31,7 +31,6 @@
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/persistent.h"
#include "common/math.h"
-#include <math.h>
namespace Wintermute {
@@ -292,4 +291,4 @@ bool SXMath::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h
index 48c43ea7e8..1aa274a96f 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.h
+++ b/engines/wintermute/base/scriptables/script_ext_math.h
@@ -48,6 +48,6 @@ private:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
index 9de9905fea..6a47c09136 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
@@ -526,4 +526,4 @@ int SXMemBuffer::scCompare(BaseScriptable *val) {
}
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
index 6700a03f50..4aad8b6484 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
@@ -55,6 +55,6 @@ private:
bool checkBounds(ScScript *script, int start, int length);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp
index b87aac81f9..a72b244f0a 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_object.cpp
@@ -64,4 +64,4 @@ bool SXObject::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h
index c85d16d44e..566111292a 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.h
+++ b/engines/wintermute/base/scriptables/script_ext_object.h
@@ -41,6 +41,6 @@ public:
virtual ~SXObject();
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
index 7cb3b9360b..2f2422cdf9 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_string.cpp
@@ -430,4 +430,4 @@ int SXString::scCompare(BaseScriptable *val) {
return strcmp(_string, ((SXString *)val)->_string);
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h
index 50b61deba4..7a95c59b4c 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.h
+++ b/engines/wintermute/base/scriptables/script_ext_string.h
@@ -53,6 +53,6 @@ private:
int32 _capacity;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
index b53457c81b..801ac6ab52 100644
--- a/engines/wintermute/base/scriptables/script_stack.cpp
+++ b/engines/wintermute/base/scriptables/script_stack.cpp
@@ -192,4 +192,4 @@ bool ScStack::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h
index 82c3debefa..ee04485a51 100644
--- a/engines/wintermute/base/scriptables/script_stack.h
+++ b/engines/wintermute/base/scriptables/script_stack.h
@@ -61,6 +61,6 @@ public:
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
index 5e2923e029..3532e127d0 100644
--- a/engines/wintermute/base/scriptables/script_value.cpp
+++ b/engines/wintermute/base/scriptables/script_value.cpp
@@ -992,4 +992,4 @@ bool ScValue::setProperty(const char *propName) {
return ret;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h
index a8e815023e..90ad9f182a 100644
--- a/engines/wintermute/base/scriptables/script_value.h
+++ b/engines/wintermute/base/scriptables/script_value.h
@@ -108,6 +108,6 @@ public:
bool setProperty(const char *propName);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index d027c03c8b..c1923b3ca8 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -289,4 +289,4 @@ bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3,
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h
index 3412e6c3a3..0a984d240a 100644
--- a/engines/wintermute/base/sound/base_sound.h
+++ b/engines/wintermute/base/sound/base_sound.h
@@ -82,6 +82,6 @@ private:
BaseSoundBuffer *_sound;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
index 9c919abac6..7666a441a3 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.cpp
+++ b/engines/wintermute/base/sound/base_sound_buffer.cpp
@@ -292,4 +292,4 @@ bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float p
return STATUS_OK;
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h
index e78d062cd4..53b86f64c6 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.h
+++ b/engines/wintermute/base/sound/base_sound_buffer.h
@@ -95,6 +95,6 @@ private:
int32 _volume;
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index f3e7bfb408..68e62f25b0 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -287,4 +287,4 @@ float BaseSoundMgr::posToPan(int x, int y) {
return minPan + relPos * (maxPan - minPan);
}
-} // end of namespace Wintermute
+} // End of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h
index 602571765f..5993a05001 100644
--- a/engines/wintermute/base/sound/base_sound_manager.h
+++ b/engines/wintermute/base/sound/base_sound_manager.h
@@ -64,6 +64,6 @@ private:
bool setMasterVolume(byte percent);
};
-} // end of namespace Wintermute
+} // End of namespace Wintermute
#endif
diff --git a/engines/wintermute/base/timer.cpp b/engines/wintermute/base/timer.cpp
index 5dfc117f48..96097c10d5 100644
--- a/engines/wintermute/base/timer.cpp
+++ b/engines/wintermute/base/timer.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/timer.h b/engines/wintermute/base/timer.h
index ec5477ba2e..4099c6c825 100644
--- a/engines/wintermute/base/timer.h
+++ b/engines/wintermute/base/timer.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -51,7 +51,7 @@ public:
void persist(BasePersistenceManager *persistMgr);
};
-
+
} // End of namespace Wintermute
#endif