aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorMarisa-Chan2014-06-13 21:43:04 +0700
committerMarisa-Chan2014-06-13 21:43:04 +0700
commit45589950c0fb1a449351e6a00ef10d42290d8bae (patch)
tree44e4eedcb7e69d5fc386155b000ed038af07251d /engines/wintermute/base
parent48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff)
parent5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff)
downloadscummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.gz
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.bz2
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.zip
Merge remote-tracking branch 'upstream/master' into zvision
Conflicts: engines/zvision/animation/rlf_animation.cpp engines/zvision/animation_control.h engines/zvision/core/console.cpp engines/zvision/core/events.cpp engines/zvision/cursors/cursor.cpp engines/zvision/cursors/cursor_manager.cpp engines/zvision/cursors/cursor_manager.h engines/zvision/fonts/truetype_font.cpp engines/zvision/graphics/render_manager.cpp engines/zvision/graphics/render_manager.h engines/zvision/inventory/inventory_manager.h engines/zvision/inventory_manager.h engines/zvision/meta_animation.h engines/zvision/module.mk engines/zvision/scripting/actions.cpp engines/zvision/scripting/control.h engines/zvision/scripting/controls/animation_control.cpp engines/zvision/scripting/controls/animation_control.h engines/zvision/scripting/controls/input_control.cpp engines/zvision/scripting/controls/lever_control.cpp engines/zvision/scripting/controls/timer_node.cpp engines/zvision/scripting/controls/timer_node.h engines/zvision/scripting/puzzle.h engines/zvision/scripting/scr_file_handling.cpp engines/zvision/scripting/script_manager.cpp engines/zvision/scripting/script_manager.h engines/zvision/sidefx.cpp engines/zvision/sound/zork_raw.cpp engines/zvision/sound/zork_raw.h engines/zvision/video/video.cpp engines/zvision/video/zork_avi_decoder.h engines/zvision/zvision.cpp engines/zvision/zvision.h
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/base.cpp6
-rw-r--r--engines/wintermute/base/base.h6
-rw-r--r--engines/wintermute/base/base_active_rect.cpp8
-rw-r--r--engines/wintermute/base/base_active_rect.h4
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.cpp4
-rw-r--r--engines/wintermute/base/base_dynamic_buffer.h4
-rw-r--r--engines/wintermute/base/base_engine.cpp4
-rw-r--r--engines/wintermute/base/base_engine.h4
-rw-r--r--engines/wintermute/base/base_fader.cpp24
-rw-r--r--engines/wintermute/base/base_fader.h4
-rw-r--r--engines/wintermute/base/base_file_manager.cpp90
-rw-r--r--engines/wintermute/base/base_file_manager.h4
-rw-r--r--engines/wintermute/base/base_frame.cpp22
-rw-r--r--engines/wintermute/base/base_frame.h4
-rw-r--r--engines/wintermute/base/base_game.cpp66
-rw-r--r--engines/wintermute/base/base_game.h7
-rw-r--r--engines/wintermute/base/base_game_music.cpp18
-rw-r--r--engines/wintermute/base/base_game_music.h4
-rw-r--r--engines/wintermute/base/base_game_settings.cpp4
-rw-r--r--engines/wintermute/base/base_game_settings.h4
-rw-r--r--engines/wintermute/base/base_keyboard_state.cpp30
-rw-r--r--engines/wintermute/base/base_keyboard_state.h4
-rw-r--r--engines/wintermute/base/base_named_object.cpp4
-rw-r--r--engines/wintermute/base/base_named_object.h4
-rw-r--r--engines/wintermute/base/base_object.cpp62
-rw-r--r--engines/wintermute/base/base_object.h6
-rw-r--r--engines/wintermute/base/base_parser.cpp8
-rw-r--r--engines/wintermute/base/base_parser.h4
-rw-r--r--engines/wintermute/base/base_persistence_manager.cpp61
-rw-r--r--engines/wintermute/base/base_persistence_manager.h27
-rw-r--r--engines/wintermute/base/base_point.cpp8
-rw-r--r--engines/wintermute/base/base_point.h4
-rw-r--r--engines/wintermute/base/base_quick_msg.cpp4
-rw-r--r--engines/wintermute/base/base_quick_msg.h4
-rw-r--r--engines/wintermute/base/base_region.cpp20
-rw-r--r--engines/wintermute/base/base_region.h4
-rw-r--r--engines/wintermute/base/base_script_holder.cpp12
-rw-r--r--engines/wintermute/base/base_script_holder.h4
-rw-r--r--engines/wintermute/base/base_scriptable.cpp6
-rw-r--r--engines/wintermute/base/base_scriptable.h4
-rw-r--r--engines/wintermute/base/base_sprite.cpp44
-rw-r--r--engines/wintermute/base/base_sprite.h4
-rw-r--r--engines/wintermute/base/base_string_table.cpp4
-rw-r--r--engines/wintermute/base/base_string_table.h4
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp74
-rw-r--r--engines/wintermute/base/base_sub_frame.h4
-rw-r--r--engines/wintermute/base/base_surface_storage.cpp4
-rw-r--r--engines/wintermute/base/base_surface_storage.h4
-rw-r--r--engines/wintermute/base/base_transition_manager.cpp4
-rw-r--r--engines/wintermute/base/base_transition_manager.h4
-rw-r--r--engines/wintermute/base/base_viewport.cpp15
-rw-r--r--engines/wintermute/base/base_viewport.h4
-rw-r--r--engines/wintermute/base/file/base_disk_file.cpp4
-rw-r--r--engines/wintermute/base/file/base_disk_file.h4
-rw-r--r--engines/wintermute/base/file/base_file.cpp4
-rw-r--r--engines/wintermute/base/file/base_file.h4
-rw-r--r--engines/wintermute/base/file/base_file_entry.cpp4
-rw-r--r--engines/wintermute/base/file/base_file_entry.h4
-rw-r--r--engines/wintermute/base/file/base_package.cpp8
-rw-r--r--engines/wintermute/base/file/base_package.h4
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.cpp4
-rw-r--r--engines/wintermute/base/file/base_save_thumb_file.h4
-rw-r--r--engines/wintermute/base/file/dcpackage.h4
-rw-r--r--engines/wintermute/base/font/base_font.cpp4
-rw-r--r--engines/wintermute/base/font/base_font.h4
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp19
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.h4
-rw-r--r--engines/wintermute/base/font/base_font_storage.cpp4
-rw-r--r--engines/wintermute/base/font/base_font_storage.h4
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp82
-rw-r--r--engines/wintermute/base/font/base_font_truetype.h15
-rw-r--r--engines/wintermute/base/gfx/base_image.cpp24
-rw-r--r--engines/wintermute/base/gfx/base_image.h11
-rw-r--r--engines/wintermute/base/gfx/base_renderer.cpp20
-rw-r--r--engines/wintermute/base/gfx/base_renderer.h4
-rw-r--r--engines/wintermute/base/gfx/base_surface.cpp4
-rw-r--r--engines/wintermute/base/gfx/base_surface.h4
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp27
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h4
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp22
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.h4
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.cpp8
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.h22
-rw-r--r--engines/wintermute/base/particles/part_emitter.cpp77
-rw-r--r--engines/wintermute/base/particles/part_emitter.h4
-rw-r--r--engines/wintermute/base/particles/part_force.cpp14
-rw-r--r--engines/wintermute/base/particles/part_force.h4
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp40
-rw-r--r--engines/wintermute/base/particles/part_particle.h4
-rw-r--r--engines/wintermute/base/save_thumb_helper.cpp4
-rw-r--r--engines/wintermute/base/save_thumb_helper.h4
-rw-r--r--engines/wintermute/base/saveload.cpp5
-rw-r--r--engines/wintermute/base/saveload.h4
-rw-r--r--engines/wintermute/base/scriptables/dcscript.h4
-rw-r--r--engines/wintermute/base/scriptables/script.cpp41
-rw-r--r--engines/wintermute/base/scriptables/script.h4
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.cpp18
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp16
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp26
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.h4
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_stack.h4
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp26
-rw-r--r--engines/wintermute/base/scriptables/script_value.h4
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp24
-rw-r--r--engines/wintermute/base/sound/base_sound.h4
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp14
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.h5
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp4
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.h4
-rw-r--r--engines/wintermute/base/timer.cpp10
-rw-r--r--engines/wintermute/base/timer.h4
124 files changed, 771 insertions, 741 deletions
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp
index 91ca30db70..90a3a62d69 100644
--- a/engines/wintermute/base/base.cpp
+++ b/engines/wintermute/base/base.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.
@@ -60,7 +60,7 @@ Common::String BaseClass::getEditorProp(const Common::String &propName, const Co
if (_editorPropsIter != _editorProps.end()) {
return _editorPropsIter->_value.c_str();
} else {
- return initVal;
+ return initVal; // Used to be NULL
}
}
diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h
index f4b0976019..e6ed7c51fe 100644
--- a/engines/wintermute/base/base.h
+++ b/engines/wintermute/base/base.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.
@@ -44,7 +44,7 @@ class BaseClass {
public:
bool _persistable;
bool setEditorProp(const Common::String &propName, const Common::String &propValue);
- Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = nullptr);
+ Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = Common::String());
BaseClass(TDynamicConstructor, TDynamicConstructor) {}
bool parseEditorProperty(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
index abeaa18d54..0c5d16966f 100644
--- a/engines/wintermute/base/base_active_rect.cpp
+++ b/engines/wintermute/base/base_active_rect.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.
@@ -37,7 +37,7 @@ namespace Wintermute {
//////////////////////////////////////////////////////////////////////
BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_owner = nullptr;
_frame = nullptr;
_region = nullptr;
@@ -52,7 +52,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise) : BaseClass(inGame) {
_owner = owner;
_frame = frame;
- BasePlatform::setRect(&_rect, x, y, x + width, y + height);
+ _rect.setRect(x, y, x + width, y + height);
_zoomX = zoomX;
_zoomY = zoomY;
_precise = precise;
diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h
index a3c0746618..29acc595d1 100644
--- a/engines/wintermute/base/base_active_rect.h
+++ b/engines/wintermute/base/base_active_rect.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.
diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp
index 5334ae46c4..7187a78769 100644
--- a/engines/wintermute/base/base_dynamic_buffer.cpp
+++ b/engines/wintermute/base/base_dynamic_buffer.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/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h
index 2804d78895..6662e36dfd 100644
--- a/engines/wintermute/base/base_dynamic_buffer.h
+++ b/engines/wintermute/base/base_dynamic_buffer.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.
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp
index acb12bbe5f..7c2e9c8468 100644
--- a/engines/wintermute/base/base_engine.cpp
+++ b/engines/wintermute/base/base_engine.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/base_engine.h b/engines/wintermute/base/base_engine.h
index a5eafd3597..dd82cf9c29 100644
--- a/engines/wintermute/base/base_engine.h
+++ b/engines/wintermute/base/base_engine.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.
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
index 7978230964..f9c4d1cba5 100644
--- a/engines/wintermute/base/base_fader.cpp
+++ b/engines/wintermute/base/base_fader.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.
@@ -175,16 +175,16 @@ uint32 BaseFader::getCurrentColor() const {
bool BaseFader::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
- persistMgr->transfer(TMEMBER(_blue));
- persistMgr->transfer(TMEMBER(_currentAlpha));
- persistMgr->transfer(TMEMBER(_duration));
- persistMgr->transfer(TMEMBER(_green));
- persistMgr->transfer(TMEMBER(_red));
- persistMgr->transfer(TMEMBER(_sourceAlpha));
- persistMgr->transfer(TMEMBER(_startTime));
- persistMgr->transfer(TMEMBER(_targetAlpha));
- persistMgr->transfer(TMEMBER(_system));
+ persistMgr->transferBool(TMEMBER(_active));
+ persistMgr->transferByte(TMEMBER(_blue));
+ persistMgr->transferByte(TMEMBER(_currentAlpha));
+ persistMgr->transferUint32(TMEMBER(_duration));
+ persistMgr->transferByte(TMEMBER(_green));
+ persistMgr->transferByte(TMEMBER(_red));
+ persistMgr->transferByte(TMEMBER(_sourceAlpha));
+ persistMgr->transferUint32(TMEMBER(_startTime));
+ persistMgr->transferByte(TMEMBER(_targetAlpha));
+ persistMgr->transferBool(TMEMBER(_system));
if (_system && !persistMgr->getIsSaving()) {
_startTime = 0;
diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h
index 087b19bc44..f742954c3d 100644
--- a/engines/wintermute/base/base_fader.h
+++ b/engines/wintermute/base/base_fader.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.
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index bea7e53445..1f78303f52 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.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.
@@ -168,15 +168,20 @@ bool BaseFileManager::initPaths() {
if (languageSubFolder.exists()) {
addPath(PATH_PACKAGE, languageSubFolder);
}
+ // Also add languages/ for Reversion1.
+ languageSubFolder = gameData.getChild("languages");
+ if (languageSubFolder.exists()) {
+ addPath(PATH_PACKAGE, languageSubFolder);
+ }
return STATUS_OK;
}
bool BaseFileManager::registerPackages(const Common::FSList &fslist) {
for (Common::FSList::const_iterator it = fslist.begin(); it != fslist.end(); ++it) {
- debugC(kWintermuteDebugFileAccess, "Adding %s", (*it).getName().c_str());
- if ((*it).getName().contains(".dcp")) {
- if (registerPackage((*it))) {
- addPath(PATH_PACKAGE, (*it));
+ debugC(kWintermuteDebugFileAccess, "Adding %s", it->getName().c_str());
+ if (it->getName().contains(".dcp")) {
+ if (registerPackage(*it)) {
+ addPath(PATH_PACKAGE, *it);
}
}
}
@@ -187,36 +192,77 @@ bool BaseFileManager::registerPackages(const Common::FSList &fslist) {
bool BaseFileManager::registerPackages() {
debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Scanning packages");
+ // We need the target name as a Common::String to perform some game-specific hacks.
+ Common::String targetName = BaseEngine::instance().getGameTargetName();
+
// Register without using SearchMan, as otherwise the FSNode-based lookup in openPackage will fail
// and that has to be like that to support the detection-scheme.
Common::FSList files;
- for (Common::FSList::iterator it = _packagePaths.begin(); it != _packagePaths.end(); ++it) {
- debugC(kWintermuteDebugFileAccess, "Should register folder: %s %s", (*it).getPath().c_str(), (*it).getName().c_str());
- if (!(*it).getChildren(files, Common::FSNode::kListFilesOnly)) {
- warning("getChildren() failed for path: %s", (*it).getDisplayName().c_str());
+ for (Common::FSList::const_iterator it = _packagePaths.begin(); it != _packagePaths.end(); ++it) {
+ debugC(kWintermuteDebugFileAccess, "Should register folder: %s %s", it->getPath().c_str(), it->getName().c_str());
+ if (!it->getChildren(files, Common::FSNode::kListFilesOnly)) {
+ warning("getChildren() failed for path: %s", it->getDisplayName().c_str());
}
- for (Common::FSList::iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
- if (!fileIt->getName().hasSuffix(".dcp")) {
+ for (Common::FSList::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
+ // To prevent any case sensitivity issues we make the filename
+ // all lowercase here. This makes the code slightly prettier
+ // than the equivalent of using equalsIgnoreCase.
+ Common::String fileName = fileIt->getName();
+ fileName.toLowercase();
+
+ if (!fileName.hasSuffix(".dcp")) {
continue;
}
+ // HACK: for Reversion1, avoid loading xlanguage_pt.dcp from the main folder:
+ if (_language != Common::PT_BRA && targetName.hasPrefix("reversion1")) {
+ if (fileName == "xlanguage_pt.dcp") {
+ continue;
+ }
+ }
+
+ // Again, make the parent's name all lowercase to avoid any case
+ // issues.
+ Common::String parentName = fileIt->getParent().getName();
+ parentName.toLowercase();
+
// Avoid registering all the language files
// TODO: Select based on the gameDesc.
- if (_language != Common::UNK_LANG && fileIt->getParent().getName() == "language") {
- Common::String parentName = fileIt->getParent().getName();
- Common::String dcpName = fileIt->getName();
- if (_language == Common::EN_ANY && fileIt->getName() != "english.dcp") {
+ if (_language != Common::UNK_LANG && (parentName == "language" || parentName == "languages")) {
+ // English
+ if (_language == Common::EN_ANY && (fileName != "english.dcp" && fileName != "xlanguage_en.dcp")) {
+ continue;
+ // Chinese
+ } else if (_language == Common::ZH_CNA && (fileName != "chinese.dcp" && fileName != "xlanguage_nz.dcp")) {
+ continue;
+ // Czech
+ } else if (_language == Common::CZ_CZE && (fileName != "czech.dcp" && fileName != "xlanguage_cz.dcp")) {
+ continue;
+ // French
+ } else if (_language == Common::FR_FRA && (fileName != "french.dcp" && fileName != "xlanguage_fr.dcp")) {
+ continue;
+ // German
+ } else if (_language == Common::DE_DEU && (fileName != "german.dcp" && fileName != "xlanguage_de.dcp")) {
+ continue;
+ // Italian
+ } else if (_language == Common::IT_ITA && (fileName != "italian.dcp" && fileName != "xlanguage_it.dcp")) {
continue;
- } else if (_language == Common::CZ_CZE && fileIt->getName() != "czech.dcp") {
+ // Latvian
+ } else if (_language == Common::LV_LAT && (fileName != "latvian.dcp" && fileName != "xlanguage_lv.dcp")) {
+ // TODO: 'latvian.dcp' is just guesswork. Is there any
+ // game using Latvian and using this filename?
continue;
- } else if (_language == Common::IT_ITA && fileIt->getName() != "italian.dcp") {
+ // Polish
+ } else if (_language == Common::PL_POL && (fileName != "polish.dcp" && fileName != "xlanguage_pl.dcp")) {
continue;
- } else if (_language == Common::PL_POL && fileIt->getName() != "polish.dcp") {
+ // Portuguese
+ } else if (_language == Common::PT_BRA && (fileName != "portuguese.dcp" && fileName != "xlanguage_pt.dcp")) {
continue;
- } else if (_language == Common::RU_RUS && fileIt->getName() != "russian.dcp") {
+ // Russian
+ } else if (_language == Common::RU_RUS && (fileName != "russian.dcp" && fileName != "xlanguage_ru.dcp")) {
continue;
}
}
- debugC(kWintermuteDebugFileAccess, "Registering %s %s", (*fileIt).getPath().c_str(), (*fileIt).getName().c_str());
+ debugC(kWintermuteDebugFileAccess, "Registering %s %s", fileIt->getPath().c_str(), fileIt->getName().c_str());
registerPackage((*fileIt));
}
}
@@ -250,8 +296,6 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f
Common::String upcName = filename;
upcName.toUppercase();
Common::SeekableReadStream *file = nullptr;
- char fileName[MAX_PATH_LENGTH];
- Common::strlcpy(fileName, upcName.c_str(), MAX_PATH_LENGTH);
// correct slashes
for (uint32 i = 0; i < upcName.size(); i++) {
diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h
index 8c2876f681..653721c8f5 100644
--- a/engines/wintermute/base/base_file_manager.h
+++ b/engines/wintermute/base/base_file_manager.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.
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
index 1af8be02dd..f2c24b8f6a 100644
--- a/engines/wintermute/base/base_frame.cpp
+++ b/engines/wintermute/base/base_frame.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.
@@ -181,7 +181,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
bool decoration = false;
bool mirrorX = false;
bool mirrorY = false;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
char *surface_file = nullptr;
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
@@ -325,7 +325,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
}
}
- if (BasePlatform::isRectEmpty(&rect)) {
+ if (rect.isRectEmpty()) {
sub->setDefaultRect();
} else {
sub->setRect(rect);
@@ -352,7 +352,7 @@ bool BaseFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float
if (!rect) {
return false;
}
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
Rect32 subRect;
@@ -414,12 +414,12 @@ bool BaseFrame::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
_applyEvent.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_delay));
- persistMgr->transfer(TMEMBER(_editorExpanded));
- persistMgr->transfer(TMEMBER(_keyframe));
- persistMgr->transfer(TMEMBER(_killSound));
- persistMgr->transfer(TMEMBER(_moveX));
- persistMgr->transfer(TMEMBER(_moveY));
+ persistMgr->transferUint32(TMEMBER(_delay));
+ persistMgr->transferBool(TMEMBER(_editorExpanded));
+ persistMgr->transferBool(TMEMBER(_keyframe));
+ persistMgr->transferBool(TMEMBER(_killSound));
+ persistMgr->transferSint32(TMEMBER(_moveX));
+ persistMgr->transferSint32(TMEMBER(_moveY));
persistMgr->transferPtr(TMEMBER_PTR(_sound));
_subframes.persist(persistMgr);
diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h
index c4cfc443fa..49a56592bb 100644
--- a/engines/wintermute/base/base_frame.h
+++ b/engines/wintermute/base/base_frame.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.
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 0d8af0ce8a..d37a22e2a6 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.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.
@@ -185,7 +185,7 @@ BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _target
_lastCursor = nullptr;
- BasePlatform::setRectEmpty(&_mouseLockRect);
+ _mouseLockRect.setEmpty();
_suppressScriptErrors = false;
_lastMiniUpdate = 0;
@@ -1123,7 +1123,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
BaseUtils::swap(&top, &bottom);
}
- BasePlatform::setRect(&_mouseLockRect, left, top, right, bottom);
+ _mouseLockRect.setRect(left, top, right, bottom);
stack->pushNULL();
return STATUS_OK;
@@ -3054,61 +3054,61 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_activeObject));
persistMgr->transferPtr(TMEMBER_PTR(_capturedObject));
persistMgr->transferPtr(TMEMBER_PTR(_cursorNoninteractive));
- persistMgr->transfer(TMEMBER(_editorMode));
+ persistMgr->transferBool(TMEMBER(_editorMode));
persistMgr->transferPtr(TMEMBER_PTR(_fader));
- persistMgr->transfer(TMEMBER(_freezeLevel));
+ persistMgr->transferSint32(TMEMBER(_freezeLevel));
persistMgr->transferPtr(TMEMBER_PTR(_focusedWindow));
persistMgr->transferPtr(TMEMBER_PTR(_fontStorage));
- persistMgr->transfer(TMEMBER(_interactive));
+ persistMgr->transferBool(TMEMBER(_interactive));
persistMgr->transferPtr(TMEMBER_PTR(_keyboardState));
- persistMgr->transfer(TMEMBER(_lastTime));
+ persistMgr->transferUint32(TMEMBER(_lastTime));
persistMgr->transferPtr(TMEMBER_PTR(_mainObject));
_musicSystem->persistChannels(persistMgr);
_musicSystem->persistCrossfadeSettings(persistMgr);
- persistMgr->transfer(TMEMBER(_offsetX));
- persistMgr->transfer(TMEMBER(_offsetY));
+ persistMgr->transferSint32(TMEMBER(_offsetX));
+ persistMgr->transferSint32(TMEMBER(_offsetY));
persistMgr->transferFloat(TMEMBER(_offsetPercentX));
persistMgr->transferFloat(TMEMBER(_offsetPercentY));
- persistMgr->transfer(TMEMBER(_origInteractive));
- persistMgr->transfer(TMEMBER_INT(_origState));
- persistMgr->transfer(TMEMBER(_personalizedSave));
- persistMgr->transfer(TMEMBER(_quitting));
+ persistMgr->transferBool(TMEMBER(_origInteractive));
+ persistMgr->transferSint32(TMEMBER_INT(_origState));
+ persistMgr->transferBool(TMEMBER(_personalizedSave));
+ persistMgr->transferBool(TMEMBER(_quitting));
_regObjects.persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_scEngine));
//persistMgr->transfer(TMEMBER(_soundMgr));
- persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transferSint32(TMEMBER_INT(_state));
//persistMgr->transfer(TMEMBER(_surfaceStorage));
- persistMgr->transfer(TMEMBER(_subtitles));
- persistMgr->transfer(TMEMBER(_subtitlesSpeed));
+ persistMgr->transferBool(TMEMBER(_subtitles));
+ persistMgr->transferSint32(TMEMBER(_subtitlesSpeed));
persistMgr->transferPtr(TMEMBER_PTR(_systemFont));
persistMgr->transferPtr(TMEMBER_PTR(_videoFont));
- persistMgr->transfer(TMEMBER(_videoSubtitles));
+ persistMgr->transferBool(TMEMBER(_videoSubtitles));
_timerNormal.persist(persistMgr);
_timerLive.persist(persistMgr);
_renderer->persistSaveLoadImages(persistMgr);
- persistMgr->transfer(TMEMBER_INT(_textEncoding));
- persistMgr->transfer(TMEMBER(_textRTL));
+ persistMgr->transferSint32(TMEMBER_INT(_textEncoding));
+ persistMgr->transferBool(TMEMBER(_textRTL));
- persistMgr->transfer(TMEMBER(_soundBufferSizeSec));
- persistMgr->transfer(TMEMBER(_suspendedRendering));
+ persistMgr->transferSint32(TMEMBER(_soundBufferSizeSec));
+ persistMgr->transferBool(TMEMBER(_suspendedRendering));
- persistMgr->transfer(TMEMBER(_mouseLockRect));
+ persistMgr->transferRect32(TMEMBER(_mouseLockRect));
_windows.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_suppressScriptErrors));
- persistMgr->transfer(TMEMBER(_autorunDisabled));
+ persistMgr->transferBool(TMEMBER(_suppressScriptErrors));
+ persistMgr->transferBool(TMEMBER(_autorunDisabled));
- persistMgr->transfer(TMEMBER(_autoSaveOnExit));
- persistMgr->transfer(TMEMBER(_autoSaveSlot));
- persistMgr->transfer(TMEMBER(_cursorHidden));
+ persistMgr->transferBool(TMEMBER(_autoSaveOnExit));
+ persistMgr->transferUint32(TMEMBER(_autoSaveSlot));
+ persistMgr->transferBool(TMEMBER(_cursorHidden));
if (!persistMgr->getIsSaving()) {
_quitting = false;
@@ -3361,10 +3361,10 @@ bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) const {
*custom = true;
}
} else {
- BasePlatform::setRect(rect, _renderer->_drawOffsetX,
- _renderer->_drawOffsetY,
- _renderer->getWidth() + _renderer->_drawOffsetX,
- _renderer->getHeight() + _renderer->_drawOffsetY);
+ rect->setRect(_renderer->_drawOffsetX,
+ _renderer->_drawOffsetY,
+ _renderer->getWidth() + _renderer->_drawOffsetX,
+ _renderer->getHeight() + _renderer->_drawOffsetY);
if (custom) {
*custom = false;
}
@@ -3577,7 +3577,6 @@ bool BaseGame::onMouseLeftDown() {
_capturedObject = _activeObject;
}
_mouseLeftDown = true;
- BasePlatform::setCapture(/*_renderer->_window*/);
return STATUS_OK;
}
@@ -3588,7 +3587,6 @@ bool BaseGame::onMouseLeftUp() {
_activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
}
- BasePlatform::releaseCapture();
_capturedObject = nullptr;
_mouseLeftDown = false;
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index 742d6f548d..cdbbff6c93 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.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.
@@ -251,6 +251,8 @@ public:
void addMem(int32 bytes);
bool _touchInterface;
bool _constrainedMemory;
+
+ bool stopVideo();
protected:
BaseFont *_systemFont;
BaseFont *_videoFont;
@@ -319,7 +321,6 @@ private:
BaseGameMusic *_musicSystem;
bool isVideoPlaying();
- bool stopVideo();
BaseArray<BaseQuickMsg *> _quickMessages;
BaseArray<UIWindow *> _windows;
diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp
index c50969df76..fee7c7be2d 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.
@@ -215,18 +215,18 @@ bool BaseGameMusic::updateMusicCrossfade() {
bool BaseGameMusic::persistChannels(BasePersistenceManager *persistMgr) {
for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) {
persistMgr->transferPtr(TMEMBER_PTR(_music[i]));
- persistMgr->transfer(TMEMBER(_musicStartTime[i]));
+ persistMgr->transferUint32(TMEMBER(_musicStartTime[i]));
}
return true;
}
bool BaseGameMusic::persistCrossfadeSettings(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_musicCrossfadeRunning));
- persistMgr->transfer(TMEMBER(_musicCrossfadeStartTime));
- persistMgr->transfer(TMEMBER(_musicCrossfadeLength));
- persistMgr->transfer(TMEMBER(_musicCrossfadeChannel1));
- persistMgr->transfer(TMEMBER(_musicCrossfadeChannel2));
- persistMgr->transfer(TMEMBER(_musicCrossfadeSwap));
+ persistMgr->transferBool(TMEMBER(_musicCrossfadeRunning));
+ persistMgr->transferUint32(TMEMBER(_musicCrossfadeStartTime));
+ persistMgr->transferUint32(TMEMBER(_musicCrossfadeLength));
+ persistMgr->transferSint32(TMEMBER(_musicCrossfadeChannel1));
+ persistMgr->transferSint32(TMEMBER(_musicCrossfadeChannel2));
+ persistMgr->transferBool(TMEMBER(_musicCrossfadeSwap));
return true;
}
diff --git a/engines/wintermute/base/base_game_music.h b/engines/wintermute/base/base_game_music.h
index 72c7a171a6..1e786dbb2b 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.
diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp
index 43809b5d1e..3b54384cc7 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.
diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h
index 38a2fd1042..fe0e9907e6 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.
diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp
index aeb56ad282..61087c5836 100644
--- a/engines/wintermute/base/base_keyboard_state.cpp
+++ b/engines/wintermute/base/base_keyboard_state.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.
@@ -221,12 +221,12 @@ bool BaseKeyboardState::persist(BasePersistenceManager *persistMgr) {
//if (!persistMgr->getIsSaving()) cleanup();
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_currentAlt));
- persistMgr->transfer(TMEMBER(_currentCharCode));
- persistMgr->transfer(TMEMBER(_currentControl));
- persistMgr->transfer(TMEMBER(_currentKeyData));
- persistMgr->transfer(TMEMBER(_currentPrintable));
- persistMgr->transfer(TMEMBER(_currentShift));
+ persistMgr->transferBool(TMEMBER(_currentAlt));
+ persistMgr->transferUint32(TMEMBER(_currentCharCode));
+ persistMgr->transferBool(TMEMBER(_currentControl));
+ persistMgr->transferUint32(TMEMBER(_currentKeyData));
+ persistMgr->transferBool(TMEMBER(_currentPrintable));
+ persistMgr->transferBool(TMEMBER(_currentShift));
if (!persistMgr->getIsSaving()) {
_keyStates = new uint8[323]; // Hardcoded size for the common/keyboard.h enum
@@ -276,17 +276,21 @@ uint32 BaseKeyboardState::keyCodeToVKey(Common::Event *event) {
}
enum VKeyCodes {
- kVkSpace = 32,
- kVkLeft = 37,
- kVkUp = 38,
- kVkRight = 39,
- kVkDown = 40
+ kVkEscape = 27,
+ kVkSpace = 32,
+ kVkLeft = 37,
+ kVkUp = 38,
+ kVkRight = 39,
+ kVkDown = 40
};
//////////////////////////////////////////////////////////////////////////
Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) {
// todo
switch (vkey) {
+ case kVkEscape:
+ return Common::KEYCODE_ESCAPE;
+ break;
case kVkSpace:
return Common::KEYCODE_SPACE;
break;
diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h
index 14a57ee7b8..c74bd5b0f7 100644
--- a/engines/wintermute/base/base_keyboard_state.h
+++ b/engines/wintermute/base/base_keyboard_state.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.
diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp
index 3d1df5ab84..5bfc978299 100644
--- a/engines/wintermute/base/base_named_object.cpp
+++ b/engines/wintermute/base/base_named_object.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/base_named_object.h b/engines/wintermute/base/base_named_object.h
index ee4a3bba6a..a337eae82d 100644
--- a/engines/wintermute/base/base_named_object.h
+++ b/engines/wintermute/base/base_named_object.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.
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
index ea754f8f23..708df8def1 100644
--- a/engines/wintermute/base/base_object.cpp
+++ b/engines/wintermute/base/base_object.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.
@@ -63,7 +63,7 @@ BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) {
_iD = _gameRef->getSequence();
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_rectSet = false;
_cursor = nullptr;
@@ -953,53 +953,53 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
BaseScriptHolder::persist(persistMgr);
for (int i = 0; i < 7; i++) {
- persistMgr->transfer(TMEMBER(_caption[i]));
+ persistMgr->transferCharPtr(TMEMBER(_caption[i]));
}
persistMgr->transferPtr(TMEMBER_PTR(_activeCursor));
- persistMgr->transfer(TMEMBER(_alphaColor));
- persistMgr->transfer(TMEMBER(_autoSoundPanning));
+ persistMgr->transferUint32(TMEMBER(_alphaColor));
+ persistMgr->transferBool(TMEMBER(_autoSoundPanning));
persistMgr->transferPtr(TMEMBER_PTR(_cursor));
- persistMgr->transfer(TMEMBER(_sharedCursors));
- persistMgr->transfer(TMEMBER(_editorAlwaysRegister));
- persistMgr->transfer(TMEMBER(_editorOnly));
- persistMgr->transfer(TMEMBER(_editorSelected));
- persistMgr->transfer(TMEMBER(_iD));
- persistMgr->transfer(TMEMBER(_is3D));
- persistMgr->transfer(TMEMBER(_movable));
- persistMgr->transfer(TMEMBER(_posX));
- persistMgr->transfer(TMEMBER(_posY));
+ persistMgr->transferBool(TMEMBER(_sharedCursors));
+ persistMgr->transferBool(TMEMBER(_editorAlwaysRegister));
+ persistMgr->transferBool(TMEMBER(_editorOnly));
+ persistMgr->transferBool(TMEMBER(_editorSelected));
+ persistMgr->transferSint32(TMEMBER(_iD));
+ persistMgr->transferBool(TMEMBER(_is3D));
+ persistMgr->transferBool(TMEMBER(_movable));
+ persistMgr->transferSint32(TMEMBER(_posX));
+ persistMgr->transferSint32(TMEMBER(_posY));
persistMgr->transferFloat(TMEMBER(_relativeScale));
- persistMgr->transfer(TMEMBER(_rotatable));
+ persistMgr->transferBool(TMEMBER(_rotatable));
persistMgr->transferFloat(TMEMBER(_scale));
persistMgr->transferPtr(TMEMBER_PTR(_sFX));
- persistMgr->transfer(TMEMBER(_sFXStart));
- persistMgr->transfer(TMEMBER(_sFXVolume));
- persistMgr->transfer(TMEMBER(_ready));
- persistMgr->transfer(TMEMBER(_rect));
- persistMgr->transfer(TMEMBER(_rectSet));
- persistMgr->transfer(TMEMBER(_registrable));
- persistMgr->transfer(TMEMBER(_shadowable));
- persistMgr->transfer(TMEMBER(_soundEvent));
- persistMgr->transfer(TMEMBER(_zoomable));
+ persistMgr->transferUint32(TMEMBER(_sFXStart));
+ persistMgr->transferSint32(TMEMBER(_sFXVolume));
+ persistMgr->transferBool(TMEMBER(_ready));
+ persistMgr->transferRect32(TMEMBER(_rect));
+ persistMgr->transferBool(TMEMBER(_rectSet));
+ persistMgr->transferBool(TMEMBER(_registrable));
+ persistMgr->transferBool(TMEMBER(_shadowable));
+ persistMgr->transferCharPtr(TMEMBER(_soundEvent));
+ persistMgr->transferBool(TMEMBER(_zoomable));
persistMgr->transferFloat(TMEMBER(_scaleX));
persistMgr->transferFloat(TMEMBER(_scaleY));
persistMgr->transferFloat(TMEMBER(_rotate));
- persistMgr->transfer(TMEMBER(_rotateValid));
+ persistMgr->transferBool(TMEMBER(_rotateValid));
persistMgr->transferFloat(TMEMBER(_relativeRotate));
- persistMgr->transfer(TMEMBER(_saveState));
- persistMgr->transfer(TMEMBER(_nonIntMouseEvents));
+ persistMgr->transferBool(TMEMBER(_saveState));
+ persistMgr->transferBool(TMEMBER(_nonIntMouseEvents));
- persistMgr->transfer(TMEMBER_INT(_sFXType));
+ persistMgr->transferSint32(TMEMBER_INT(_sFXType));
persistMgr->transferFloat(TMEMBER(_sFXParam1));
persistMgr->transferFloat(TMEMBER(_sFXParam2));
persistMgr->transferFloat(TMEMBER(_sFXParam3));
persistMgr->transferFloat(TMEMBER(_sFXParam4));
- persistMgr->transfer(TMEMBER_INT(_blendMode));
+ persistMgr->transferSint32(TMEMBER_INT(_blendMode));
return STATUS_OK;
}
@@ -1039,7 +1039,7 @@ bool BaseObject::setActiveCursor(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-int BaseObject::getHeight() {
+int32 BaseObject::getHeight() {
return 0;
}
diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h
index 42041c5e3c..f5036f4ec4 100644
--- a/engines/wintermute/base/base_object.h
+++ b/engines/wintermute/base/base_object.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.
@@ -89,7 +89,7 @@ public:
virtual bool handleMouseWheel(int delta);
virtual bool handleMouse(TMouseEvent event, TMouseButton button);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
- virtual int getHeight();
+ virtual int32 getHeight();
bool setCursor(const char *filename);
bool setActiveCursor(const char *filename);
bool cleanup();
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
index 0b677b6cb2..2d80bc5017 100644
--- a/engines/wintermute/base/base_parser.cpp
+++ b/engines/wintermute/base/base_parser.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.
@@ -250,10 +250,10 @@ Common::String BaseParser::getToken(char **buf) {
*t++ = 0;
} else if (*b == 0) {
*buf = b;
- return nullptr;
+ return Common::String();
} else {
// Error.
- return nullptr;
+ return Common::String();
}
*buf = b;
diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h
index 4bf48cc016..4e4a54e28c 100644
--- a/engines/wintermute/base/base_parser.h
+++ b/engines/wintermute/base/base_parser.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.
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
index e5542d96b7..bea55fb857 100644
--- a/engines/wintermute/base/base_persistence_manager.cpp
+++ b/engines/wintermute/base/base_persistence_manager.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.
@@ -38,8 +38,8 @@
#include "engines/wintermute/base/sound/base_sound.h"
#include "engines/wintermute/graphics/transparent_surface.h"
#include "engines/wintermute/wintermute.h"
-#include "graphics/decoders/bmp.h"
#include "graphics/scaler.h"
+#include "image/bmp.h"
#include "common/memstream.h"
#include "common/str.h"
#include "common/system.h"
@@ -170,7 +170,7 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des
if (thumbSize > 0) {
Common::MemoryReadStream thumbStream(thumbData, thumbSize, DisposeAfterUse::NO);
- Graphics::BitmapDecoder bmpDecoder;
+ Image::BitmapDecoder bmpDecoder;
if (bmpDecoder.loadStream(thumbStream)) {
const Graphics::Surface *bmpSurface = bmpDecoder.getSurface();
TransparentSurface *scaleableSurface = new TransparentSurface(*bmpSurface, false);
@@ -587,7 +587,7 @@ double BasePersistenceManager::getDouble() {
//////////////////////////////////////////////////////////////////////////
// bool
-bool BasePersistenceManager::transfer(const char *name, bool *val) {
+bool BasePersistenceManager::transferBool(const char *name, bool *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err()) {
@@ -606,7 +606,7 @@ bool BasePersistenceManager::transfer(const char *name, bool *val) {
//////////////////////////////////////////////////////////////////////////
// int
-bool BasePersistenceManager::transfer(const char *name, int32 *val) {
+bool BasePersistenceManager::transferSint32(const char *name, int32 *val) {
if (_saving) {
_saveStream->writeSint32LE(*val);
if (_saveStream->err()) {
@@ -625,7 +625,7 @@ bool BasePersistenceManager::transfer(const char *name, int32 *val) {
//////////////////////////////////////////////////////////////////////////
// DWORD
-bool BasePersistenceManager::transfer(const char *name, uint32 *val) {
+bool BasePersistenceManager::transferUint32(const char *name, uint32 *val) {
if (_saving) {
_saveStream->writeUint32LE(*val);
if (_saveStream->err()) {
@@ -663,7 +663,7 @@ bool BasePersistenceManager::transferFloat(const char *name, float *val) {
//////////////////////////////////////////////////////////////////////////
// double
-bool BasePersistenceManager::transfer(const char *name, double *val) {
+bool BasePersistenceManager::transferDouble(const char *name, double *val) {
if (_saving) {
putDouble(*val);
if (_saveStream->err()) {
@@ -682,7 +682,7 @@ bool BasePersistenceManager::transfer(const char *name, double *val) {
//////////////////////////////////////////////////////////////////////////
// char*
-bool BasePersistenceManager::transfer(const char *name, char **val) {
+bool BasePersistenceManager::transferCharPtr(const char *name, char **val) {
if (_saving) {
putString(*val);
return STATUS_OK;
@@ -699,7 +699,7 @@ bool BasePersistenceManager::transfer(const char *name, char **val) {
//////////////////////////////////////////////////////////////////////////
// const char*
-bool BasePersistenceManager::transfer(const char *name, const char **val) {
+bool BasePersistenceManager::transferConstChar(const char *name, const char **val) {
if (_saving) {
putString(*val);
return STATUS_OK;
@@ -716,7 +716,7 @@ bool BasePersistenceManager::transfer(const char *name, const char **val) {
//////////////////////////////////////////////////////////////////////////
// Common::String
-bool BasePersistenceManager::transfer(const char *name, Common::String *val) {
+bool BasePersistenceManager::transferString(const char *name, Common::String *val) {
if (_saving) {
putString(val->c_str());
return STATUS_OK;
@@ -737,39 +737,8 @@ bool BasePersistenceManager::transfer(const char *name, Common::String *val) {
}
//////////////////////////////////////////////////////////////////////////
-bool BasePersistenceManager::transfer(const char *name, AnsiStringArray &val) {
- size_t size;
-
- if (_saving) {
- size = val.size();
- _saveStream->writeUint32LE(size);
-
- for (AnsiStringArray::iterator it = val.begin(); it != val.end(); ++it) {
- putString((*it).c_str());
- }
- } else {
- val.clear();
- size = _loadStream->readUint32LE();
-
- for (size_t i = 0; i < size; i++) {
- char *str = getString();
- if (_loadStream->err()) {
- delete[] str;
- return STATUS_FAILED;
- }
- if (str) {
- val.push_back(str);
- }
- delete[] str;
- }
- }
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
// BYTE
-bool BasePersistenceManager::transfer(const char *name, byte *val) {
+bool BasePersistenceManager::transferByte(const char *name, byte *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err()) {
@@ -788,7 +757,7 @@ bool BasePersistenceManager::transfer(const char *name, byte *val) {
//////////////////////////////////////////////////////////////////////////
// RECT
-bool BasePersistenceManager::transfer(const char *name, Rect32 *val) {
+bool BasePersistenceManager::transferRect32(const char *name, Rect32 *val) {
if (_saving) {
_saveStream->writeSint32LE(val->left);
_saveStream->writeSint32LE(val->top);
@@ -813,7 +782,7 @@ bool BasePersistenceManager::transfer(const char *name, Rect32 *val) {
//////////////////////////////////////////////////////////////////////////
// POINT
-bool BasePersistenceManager::transfer(const char *name, Point32 *val) {
+bool BasePersistenceManager::transferPoint32(const char *name, Point32 *val) {
if (_saving) {
_saveStream->writeSint32LE(val->x);
_saveStream->writeSint32LE(val->y);
@@ -834,7 +803,7 @@ bool BasePersistenceManager::transfer(const char *name, Point32 *val) {
//////////////////////////////////////////////////////////////////////////
// Vector2
-bool BasePersistenceManager::transfer(const char *name, Vector2 *val) {
+bool BasePersistenceManager::transferVector2(const char *name, Vector2 *val) {
if (_saving) {
putFloat(val->x);
putFloat(val->y);
diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h
index 3c0587b362..373d1580de 100644
--- a/engines/wintermute/base/base_persistence_manager.h
+++ b/engines/wintermute/base/base_persistence_manager.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.
@@ -74,19 +74,18 @@ public:
byte *_richBuffer;
bool transferPtr(const char *name, void *val);
- bool transfer(const char *name, int32 *val);
- bool transfer(const char *name, uint32 *val);
+ bool transferSint32(const char *name, int32 *val);
+ bool transferUint32(const char *name, uint32 *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);
- bool transfer(const char *name, Rect32 *val);
- bool transfer(const char *name, Point32 *val);
- bool transfer(const char *name, const char **val);
- bool transfer(const char *name, char **val);
- bool transfer(const char *name, Common::String *val);
- bool transfer(const char *name, Vector2 *val);
- bool transfer(const char *name, AnsiStringArray &Val);
+ bool transferDouble(const char *name, double *val);
+ bool transferBool(const char *name, bool *val);
+ bool transferByte(const char *name, byte *val);
+ bool transferRect32(const char *name, Rect32 *val);
+ bool transferPoint32(const char *name, Point32 *val);
+ bool transferConstChar(const char *name, const char **val);
+ bool transferCharPtr(const char *name, char **val);
+ bool transferString(const char *name, Common::String *val);
+ bool transferVector2(const char *name, Vector2 *val);
BasePersistenceManager(const char *savePrefix = nullptr, bool deleteSingleton = false);
virtual ~BasePersistenceManager();
bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp
index fe6ca941f3..f810b286fb 100644
--- a/engines/wintermute/base/base_point.cpp
+++ b/engines/wintermute/base/base_point.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.
@@ -54,8 +54,8 @@ BasePoint::BasePoint(int initX, int initY) {
//////////////////////////////////////////////////////////////////////////
bool BasePoint::persist(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(x));
- persistMgr->transfer(TMEMBER(y));
+ persistMgr->transferSint32(TMEMBER(x));
+ persistMgr->transferSint32(TMEMBER(y));
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h
index cf8a5be336..6f5c1ca28f 100644
--- a/engines/wintermute/base/base_point.h
+++ b/engines/wintermute/base/base_point.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.
diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp
index ac0c107d3b..514f44f788 100644
--- a/engines/wintermute/base/base_quick_msg.cpp
+++ b/engines/wintermute/base/base_quick_msg.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/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h
index b706424c18..39eace390c 100644
--- a/engines/wintermute/base/base_quick_msg.h
+++ b/engines/wintermute/base/base_quick_msg.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.
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
index 581583c922..9a31f5cd66 100644
--- a/engines/wintermute/base/base_region.cpp
+++ b/engines/wintermute/base/base_region.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.
@@ -48,7 +48,7 @@ BaseRegion::BaseRegion(BaseGame *inGame) : BaseObject(inGame) {
_lastMimicScale = -1;
_lastMimicX = _lastMimicY = INT_MIN;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
}
@@ -65,7 +65,7 @@ void BaseRegion::cleanup() {
}
_points.clear();
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_editorSelectedPoint = -1;
}
@@ -430,11 +430,11 @@ bool BaseRegion::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
- persistMgr->transfer(TMEMBER(_editorSelectedPoint));
+ persistMgr->transferBool(TMEMBER(_active));
+ persistMgr->transferSint32(TMEMBER(_editorSelectedPoint));
persistMgr->transferFloat(TMEMBER(_lastMimicScale));
- persistMgr->transfer(TMEMBER(_lastMimicX));
- persistMgr->transfer(TMEMBER(_lastMimicY));
+ persistMgr->transferSint32(TMEMBER(_lastMimicX));
+ persistMgr->transferSint32(TMEMBER(_lastMimicY));
_points.persist(persistMgr);
return STATUS_OK;
@@ -491,7 +491,7 @@ bool BaseRegion::ptInPolygon(int32 x, int32 y) {
//////////////////////////////////////////////////////////////////////////
bool BaseRegion::getBoundingRect(Rect32 *rect) {
if (_points.size() == 0) {
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
} else {
int32 minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN;
@@ -502,7 +502,7 @@ bool BaseRegion::getBoundingRect(Rect32 *rect) {
maxX = MAX(maxX, _points[i]->x);
maxY = MAX(maxY, _points[i]->y);
}
- BasePlatform::setRect(rect, minX, minY, maxX, maxY);
+ rect->setRect(minX, minY, maxX, maxY);
}
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h
index 846dcfc341..fc3389c501 100644
--- a/engines/wintermute/base/base_region.h
+++ b/engines/wintermute/base/base_region.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.
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
index a670ebf1af..8383657239 100644
--- a/engines/wintermute/base/base_script_holder.cpp
+++ b/engines/wintermute/base/base_script_holder.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.
@@ -280,14 +280,14 @@ bool BaseScriptHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) {
bool BaseScriptHolder::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferCharPtr(TMEMBER(_filename));
+ persistMgr->transferBool(TMEMBER(_freezable));
if (persistMgr->getIsSaving()) {
const char *name = getName();
- persistMgr->transfer(TMEMBER(name));
+ persistMgr->transferConstChar(TMEMBER(name));
} else {
char *name;
- persistMgr->transfer(TMEMBER(name));
+ persistMgr->transferCharPtr(TMEMBER(name));
setName(name);
delete[] name;
}
diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h
index b4e22a59ee..9b3bf9ec44 100644
--- a/engines/wintermute/base/base_script_holder.h
+++ b/engines/wintermute/base/base_script_holder.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.
diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp
index be1e18c2c4..c65d30d941 100644
--- a/engines/wintermute/base/base_scriptable.cpp
+++ b/engines/wintermute/base/base_scriptable.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.
@@ -153,7 +153,7 @@ void BaseScriptable::scSetBool(bool val) {
//////////////////////////////////////////////////////////////////////////
bool BaseScriptable::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_refCount));
+ persistMgr->transferSint32(TMEMBER(_refCount));
persistMgr->transferPtr(TMEMBER_PTR(_scProp));
persistMgr->transferPtr(TMEMBER_PTR(_scValue));
diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h
index 08fd32081a..b32668d6c8 100644
--- a/engines/wintermute/base/base_scriptable.h
+++ b/engines/wintermute/base/base_scriptable.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.
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index 383655e0af..2e00998037 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.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.
@@ -462,7 +462,7 @@ bool BaseSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float
return false;
}
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
for (uint32 i = 0; i < _frames.size(); i++) {
Rect32 frame;
Rect32 temp;
@@ -520,29 +520,29 @@ bool BaseSprite::saveAsText(BaseDynamicBuffer *buffer, int indent) {
bool BaseSprite::persist(BasePersistenceManager *persistMgr) {
BaseScriptHolder::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_canBreak));
- persistMgr->transfer(TMEMBER(_changed));
- persistMgr->transfer(TMEMBER(_paused));
- persistMgr->transfer(TMEMBER(_continuous));
- persistMgr->transfer(TMEMBER(_currentFrame));
- persistMgr->transfer(TMEMBER(_editorAllFrames));
- persistMgr->transfer(TMEMBER(_editorBgAlpha));
- persistMgr->transfer(TMEMBER(_editorBgFile));
- persistMgr->transfer(TMEMBER(_editorBgOffsetX));
- persistMgr->transfer(TMEMBER(_editorBgOffsetY));
- persistMgr->transfer(TMEMBER(_editorMuted));
- persistMgr->transfer(TMEMBER(_finished));
+ persistMgr->transferBool(TMEMBER(_canBreak));
+ persistMgr->transferBool(TMEMBER(_changed));
+ persistMgr->transferBool(TMEMBER(_paused));
+ persistMgr->transferBool(TMEMBER(_continuous));
+ persistMgr->transferSint32(TMEMBER(_currentFrame));
+ persistMgr->transferBool(TMEMBER(_editorAllFrames));
+ persistMgr->transferSint32(TMEMBER(_editorBgAlpha));
+ persistMgr->transferCharPtr(TMEMBER(_editorBgFile));
+ persistMgr->transferSint32(TMEMBER(_editorBgOffsetX));
+ persistMgr->transferSint32(TMEMBER(_editorBgOffsetY));
+ persistMgr->transferBool(TMEMBER(_editorMuted));
+ persistMgr->transferBool(TMEMBER(_finished));
_frames.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_lastFrameTime));
- persistMgr->transfer(TMEMBER(_looping));
- persistMgr->transfer(TMEMBER(_moveX));
- persistMgr->transfer(TMEMBER(_moveY));
+ persistMgr->transferUint32(TMEMBER(_lastFrameTime));
+ persistMgr->transferBool(TMEMBER(_looping));
+ persistMgr->transferSint32(TMEMBER(_moveX));
+ persistMgr->transferSint32(TMEMBER(_moveY));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
- persistMgr->transfer(TMEMBER(_precise));
- persistMgr->transfer(TMEMBER(_streamed));
- persistMgr->transfer(TMEMBER(_streamedKeepLoaded));
+ persistMgr->transferBool(TMEMBER(_precise));
+ persistMgr->transferBool(TMEMBER(_streamed));
+ persistMgr->transferBool(TMEMBER(_streamedKeepLoaded));
return STATUS_OK;
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h
index 54d595f655..92287995d9 100644
--- a/engines/wintermute/base/base_sprite.h
+++ b/engines/wintermute/base/base_sprite.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.
diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp
index 3d9cc4f8b3..9adbbdf7be 100644
--- a/engines/wintermute/base/base_string_table.cpp
+++ b/engines/wintermute/base/base_string_table.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/base_string_table.h b/engines/wintermute/base/base_string_table.h
index f8808f5b27..9e915a1ad9 100644
--- a/engines/wintermute/base/base_string_table.h
+++ b/engines/wintermute/base/base_string_table.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.
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index 1055987f6b..3a6e28b1f2 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.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.
@@ -34,7 +34,6 @@
#include "engines/wintermute/base/base_surface_storage.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_engine.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
@@ -54,7 +53,7 @@ BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
_transparent = 0xFFFF00FF;
_wantsDefaultRect = false;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_editorSelected = false;
@@ -121,7 +120,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
int r = 255, g = 255, b = 255;
int ar = 255, ag = 255, ab = 255, alpha = 255;
bool custoTrans = false;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
char *surfaceFile = nullptr;
delete _surface;
@@ -208,7 +207,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
return STATUS_FAILED;
}
*/
- if (BasePlatform::isRectEmpty(&rect)) {
+ if (rect.isRectEmpty()) {
setDefaultRect();
} else {
setRect(rect);
@@ -219,7 +218,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
Rect32 BaseSubFrame::getRect() {
if (_wantsDefaultRect && _surface) {
- BasePlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ _rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight());
_wantsDefaultRect = false;
}
return _rect;
@@ -236,7 +235,7 @@ 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;
@@ -272,7 +271,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl
TransformStruct transform = TransformStruct(zoomX, zoomY, (uint32)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);
+ res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform);
} else {
if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) {
res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY);
@@ -294,11 +293,10 @@ bool BaseSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, flo
float ratioX = scaleX / 100.0f;
float ratioY = scaleY / 100.0f;
- BasePlatform::setRect(rect,
- (int)(x - _hotspotX * ratioX),
- (int)(y - _hotspotY * ratioY),
- (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX),
- (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY));
+ rect->setRect((int)(x - _hotspotX * ratioX),
+ (int)(y - _hotspotY * ratioY),
+ (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX),
+ (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY));
return true;
}
@@ -318,9 +316,9 @@ bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool comple
}
Rect32 rect;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
if (_surface) {
- BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight());
}
if (!(rect == getRect())) {
buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", getRect().left, getRect().top, getRect().right, getRect().bottom);
@@ -376,7 +374,7 @@ void BaseSubFrame::setDefaultRect() {
_wantsDefaultRect = true;
} else {
_wantsDefaultRect = false;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
}
}
@@ -386,27 +384,27 @@ bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_2DOnly));
- persistMgr->transfer(TMEMBER(_3DOnly));
- persistMgr->transfer(TMEMBER(_alpha));
- persistMgr->transfer(TMEMBER(_decoration));
- persistMgr->transfer(TMEMBER(_editorSelected));
- persistMgr->transfer(TMEMBER(_hotspotX));
- persistMgr->transfer(TMEMBER(_hotspotY));
- persistMgr->transfer(TMEMBER(_rect));
- persistMgr->transfer(TMEMBER(_wantsDefaultRect));
-
- persistMgr->transfer(TMEMBER(_surfaceFilename));
- persistMgr->transfer(TMEMBER(_cKDefault));
- persistMgr->transfer(TMEMBER(_cKRed));
- persistMgr->transfer(TMEMBER(_cKGreen));
- persistMgr->transfer(TMEMBER(_cKBlue));
- persistMgr->transfer(TMEMBER(_lifeTime));
-
- persistMgr->transfer(TMEMBER(_keepLoaded));
- persistMgr->transfer(TMEMBER(_mirrorX));
- persistMgr->transfer(TMEMBER(_mirrorY));
- persistMgr->transfer(TMEMBER(_transparent));
+ persistMgr->transferBool(TMEMBER(_2DOnly));
+ persistMgr->transferBool(TMEMBER(_3DOnly));
+ persistMgr->transferUint32(TMEMBER(_alpha));
+ persistMgr->transferBool(TMEMBER(_decoration));
+ persistMgr->transferBool(TMEMBER(_editorSelected));
+ persistMgr->transferSint32(TMEMBER(_hotspotX));
+ persistMgr->transferSint32(TMEMBER(_hotspotY));
+ persistMgr->transferRect32(TMEMBER(_rect));
+ persistMgr->transferBool(TMEMBER(_wantsDefaultRect));
+
+ persistMgr->transferCharPtr(TMEMBER(_surfaceFilename));
+ persistMgr->transferBool(TMEMBER(_cKDefault));
+ persistMgr->transferByte(TMEMBER(_cKRed));
+ persistMgr->transferByte(TMEMBER(_cKGreen));
+ persistMgr->transferByte(TMEMBER(_cKBlue));
+ persistMgr->transferSint32(TMEMBER(_lifeTime));
+
+ persistMgr->transferBool(TMEMBER(_keepLoaded));
+ persistMgr->transferBool(TMEMBER(_mirrorX));
+ persistMgr->transferBool(TMEMBER(_mirrorY));
+ persistMgr->transferUint32(TMEMBER(_transparent));
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h
index 4e164467e2..b2859fa3f3 100644
--- a/engines/wintermute/base/base_sub_frame.h
+++ b/engines/wintermute/base/base_sub_frame.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.
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
index f1d068674b..a2dedf66a3 100644
--- a/engines/wintermute/base/base_surface_storage.cpp
+++ b/engines/wintermute/base/base_surface_storage.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/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h
index c0049d676c..2bec9a0fbb 100644
--- a/engines/wintermute/base/base_surface_storage.h
+++ b/engines/wintermute/base/base_surface_storage.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.
diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp
index eee5f1aae7..198dfe26ba 100644
--- a/engines/wintermute/base/base_transition_manager.cpp
+++ b/engines/wintermute/base/base_transition_manager.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/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h
index 82edb9ff88..3cfc0f2028 100644
--- a/engines/wintermute/base/base_transition_manager.h
+++ b/engines/wintermute/base/base_transition_manager.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.
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
index 09ac80e9de..bf3700a14e 100644
--- a/engines/wintermute/base/base_viewport.cpp
+++ b/engines/wintermute/base/base_viewport.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.
@@ -29,7 +29,6 @@
#include "engines/wintermute/base/base_viewport.h"
#include "engines/wintermute/base/base_engine.h"
#include "engines/wintermute/base/base_persistence_manager.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
namespace Wintermute {
@@ -38,7 +37,7 @@ IMPLEMENT_PERSISTENT(BaseViewport, false)
//////////////////////////////////////////////////////////////////////////
BaseViewport::BaseViewport(BaseGame *inGame) : BaseClass(inGame) {
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_mainObject = nullptr;
_offsetX = _offsetY = 0;
}
@@ -56,9 +55,9 @@ bool BaseViewport::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
persistMgr->transferPtr(TMEMBER_PTR(_mainObject));
- persistMgr->transfer(TMEMBER(_offsetX));
- persistMgr->transfer(TMEMBER(_offsetY));
- persistMgr->transfer(TMEMBER(_rect));
+ persistMgr->transferSint32(TMEMBER(_offsetX));
+ persistMgr->transferSint32(TMEMBER(_offsetY));
+ persistMgr->transferRect32(TMEMBER(_rect));
return STATUS_OK;
}
@@ -73,7 +72,7 @@ bool BaseViewport::setRect(int32 left, int32 top, int32 right, int32 bottom, boo
bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight());
}
- BasePlatform::setRect(&_rect, left, top, right, bottom);
+ _rect.setRect(left, top, right, bottom);
_offsetX = left;
_offsetY = top;
return STATUS_OK;
diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h
index 0225c02c7c..eae756f9c6 100644
--- a/engines/wintermute/base/base_viewport.h
+++ b/engines/wintermute/base/base_viewport.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.
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 808dc9e00d..82a9e24dfb 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.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/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h
index 81cc22b86d..f20629f7ec 100644
--- a/engines/wintermute/base/file/base_disk_file.h
+++ b/engines/wintermute/base/file/base_disk_file.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.
diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp
index 42eea69824..2927c908e2 100644
--- a/engines/wintermute/base/file/base_file.cpp
+++ b/engines/wintermute/base/file/base_file.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/file/base_file.h b/engines/wintermute/base/file/base_file.h
index 9acda7ffce..820b6510fd 100644
--- a/engines/wintermute/base/file/base_file.h
+++ b/engines/wintermute/base/file/base_file.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.
diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp
index 846f56b55c..991d75d03d 100644
--- a/engines/wintermute/base/file/base_file_entry.cpp
+++ b/engines/wintermute/base/file/base_file_entry.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/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h
index 9d738c8c11..6bac3789d7 100644
--- a/engines/wintermute/base/file/base_file_entry.h
+++ b/engines/wintermute/base/file/base_file_entry.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.
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp
index 512279b72c..ae4955390b 100644
--- a/engines/wintermute/base/file/base_package.cpp
+++ b/engines/wintermute/base/file/base_package.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.
@@ -53,8 +53,8 @@ static bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset)
byte buf[32768];
byte signature[8];
- ((uint32 *)signature)[0] = PACKAGE_MAGIC_1;
- ((uint32 *)signature)[1] = PACKAGE_MAGIC_2;
+ WRITE_LE_UINT32(signature + 0, PACKAGE_MAGIC_1);
+ WRITE_LE_UINT32(signature + 4, PACKAGE_MAGIC_2);
uint32 fileSize = (uint32)f->size();
uint32 startPos = 1024 * 1024;
diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h
index 18156c4f65..35976eb47b 100644
--- a/engines/wintermute/base/file/base_package.h
+++ b/engines/wintermute/base/file/base_package.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.
diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp
index bb172ca66a..acd5363e89 100644
--- a/engines/wintermute/base/file/base_save_thumb_file.cpp
+++ b/engines/wintermute/base/file/base_save_thumb_file.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/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h
index faf1af9255..4d9030189d 100644
--- a/engines/wintermute/base/file/base_save_thumb_file.h
+++ b/engines/wintermute/base/file/base_save_thumb_file.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.
diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h
index a2ec5d28d5..5f21ce94ea 100644
--- a/engines/wintermute/base/file/dcpackage.h
+++ b/engines/wintermute/base/file/dcpackage.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.
diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp
index 2a394616d1..0a5f7466df 100644
--- a/engines/wintermute/base/font/base_font.cpp
+++ b/engines/wintermute/base/font/base_font.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/font/base_font.h b/engines/wintermute/base/font/base_font.h
index d75d3f4fb5..5f37d983cb 100644
--- a/engines/wintermute/base/font/base_font.h
+++ b/engines/wintermute/base/font/base_font.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.
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
index 23a633a5a8..bab2bf3df4 100644
--- a/engines/wintermute/base/font/base_font_bitmap.cpp
+++ b/engines/wintermute/base/font/base_font_bitmap.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.
@@ -37,7 +37,6 @@
#include "engines/wintermute/base/base_frame.h"
#include "engines/wintermute/base/base_sprite.h"
#include "engines/wintermute/base/base_file_manager.h"
-#include "engines/wintermute/platform_osystem.h"
namespace Wintermute {
@@ -253,7 +252,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) {
tileWidth = _widths[c];
}
- BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight);
+ rect.setRect(col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1) * _tileHeight);
bool handled = false;
if (_sprite) {
_sprite->getCurrentFrame();
@@ -496,13 +495,13 @@ bool BaseFontBitmap::loadBuffer(char *buffer) {
bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
BaseFont::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_numColumns));
+ persistMgr->transferSint32(TMEMBER(_numColumns));
persistMgr->transferPtr(TMEMBER_PTR(_subframe));
- persistMgr->transfer(TMEMBER(_tileHeight));
- persistMgr->transfer(TMEMBER(_tileWidth));
+ persistMgr->transferSint32(TMEMBER(_tileHeight));
+ persistMgr->transferSint32(TMEMBER(_tileWidth));
persistMgr->transferPtr(TMEMBER_PTR(_sprite));
- persistMgr->transfer(TMEMBER(_widthsFrame));
+ persistMgr->transferSint32(TMEMBER(_widthsFrame));
if (persistMgr->getIsSaving()) {
persistMgr->putBytes(_widths, sizeof(_widths));
@@ -511,8 +510,8 @@ bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
}
- persistMgr->transfer(TMEMBER(_fontextFix));
- persistMgr->transfer(TMEMBER(_wholeCell));
+ persistMgr->transferBool(TMEMBER(_fontextFix));
+ persistMgr->transferBool(TMEMBER(_wholeCell));
return STATUS_OK;
diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h
index 77620d8b88..c26a6ad1cb 100644
--- a/engines/wintermute/base/font/base_font_bitmap.h
+++ b/engines/wintermute/base/font/base_font_bitmap.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.
diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp
index 8abd368b70..f4f7de44fc 100644
--- a/engines/wintermute/base/font/base_font_storage.cpp
+++ b/engines/wintermute/base/font/base_font_storage.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/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h
index f4ac490324..e29675aaef 100644
--- a/engines/wintermute/base/font/base_font_storage.h
+++ b/engines/wintermute/base/font/base_font_storage.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.
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index bbc66902a1..df9a8648db 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.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.
@@ -34,7 +34,6 @@
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/wintermute.h"
#include "graphics/fonts/ttf.h"
#include "graphics/fontman.h"
@@ -122,7 +121,7 @@ int BaseFontTT::getTextWidth(const byte *text, int maxLength) {
}
if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
- textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ textStr = WideString(textStr.c_str(), (uint32)maxLength);
}
//text = text.substr(0, MaxLength); // TODO: Remove
@@ -156,19 +155,19 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign
return;
}
- WideString textStr = (const char *)text;
+ WideString textStr;
// TODO: Why do we still insist on Widestrings everywhere?
- /* if (_gameRef->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
- else text = StringUtil::AnsiToWide((char *)Text);*/
// HACK: J.U.L.I.A. uses CP1252, we need to fix that,
// And we still don't have any UTF8-support.
- if (_gameRef->_textEncoding != TEXT_UTF8) {
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ textStr = StringUtil::utf8ToWide((const char *)text);
+ } else {
textStr = StringUtil::ansiToWide((const char *)text);
}
if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
- textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ textStr = WideString(textStr.c_str(), (uint32)maxLength);
}
//text = text.substr(0, MaxLength); // TODO: Remove
@@ -227,7 +226,7 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign
// and paint it
if (surface) {
Rect32 rc;
- BasePlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight());
+ rc.setRect(0, 0, surface->getWidth(), surface->getHeight());
for (uint32 i = 0; i < _layers.size(); i++) {
uint32 color = _layers[i]->_color;
uint32 origForceAlpha = renderer->_forceAlphaColor;
@@ -249,7 +248,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
//TextLineList lines;
// TODO: Use WideString-conversion here.
//WrapText(text, width, maxHeight, lines);
- Common::Array<Common::String> lines;
+ Common::Array<WideString> lines;
_font->wordWrapText(text, width, lines);
while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) {
@@ -268,16 +267,13 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
alignment = Graphics::kTextAlignRight;
}
- debugC(kWintermuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color));
+ // TODO: This debug call does not work with WideString because text.c_str() returns an uint32 array.
+ //debugC(kWintermuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color));
// void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
Graphics::Surface *surface = new Graphics::Surface();
- if (_deletableFont) { // We actually have a TTF
- surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _gameRef->_renderer->getPixelFormat());
- } else { // We are using a fallback, they can't do 32bpp
- surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
- }
+ surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _gameRef->_renderer->getPixelFormat());
uint32 useColor = 0xffffffff;
- Common::Array<Common::String>::iterator it;
+ Common::Array<WideString>::iterator it;
int heightOffset = 0;
for (it = lines.begin(); it != lines.end(); ++it) {
_font->drawString(surface, *it, 0, heightOffset, width, useColor, alignment);
@@ -285,7 +281,6 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
}
BaseSurface *retSurface = _gameRef->_renderer->createSurface();
- Graphics::Surface *convertedSurface = surface->convertTo(_gameRef->_renderer->getPixelFormat());
if (_deletableFont) {
// Reconstruct the alpha channel of the font.
@@ -295,22 +290,20 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
// to its original alpha value.
Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat();
- uint32 *pixels = (uint32 *)convertedSurface->getPixels();
+ uint32 *pixels = (uint32 *)surface->getPixels();
// This is a Surface we created ourselves, so no empty space between rows.
for (int i = 0; i < surface->w * surface->h; ++i) {
uint8 a, r, g, b;
format.colorToRGB(*pixels, r, g, b);
a = r;
- *pixels++ = format.ARGBToColor(a, r, g, b);
+ *pixels++ = format.ARGBToColor(a, r, g, b);
}
}
- retSurface->putSurface(*convertedSurface, true);
- convertedSurface->free();
+ retSurface->putSurface(*surface, true);
surface->free();
delete surface;
- delete convertedSurface;
return retSurface;
// TODO: _isUnderline, _isBold, _isItalic, _isStriked
}
@@ -521,25 +514,25 @@ bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, char *buffer) {
bool BaseFontTT::persist(BasePersistenceManager *persistMgr) {
BaseFont::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_isBold));
- persistMgr->transfer(TMEMBER(_isItalic));
- persistMgr->transfer(TMEMBER(_isUnderline));
- persistMgr->transfer(TMEMBER(_isStriked));
- persistMgr->transfer(TMEMBER(_fontHeight));
- persistMgr->transfer(TMEMBER(_fontFile));
+ persistMgr->transferBool(TMEMBER(_isBold));
+ persistMgr->transferBool(TMEMBER(_isItalic));
+ persistMgr->transferBool(TMEMBER(_isUnderline));
+ persistMgr->transferBool(TMEMBER(_isStriked));
+ persistMgr->transferSint32(TMEMBER(_fontHeight));
+ persistMgr->transferCharPtr(TMEMBER(_fontFile));
// persist layers
int32 numLayers;
if (persistMgr->getIsSaving()) {
numLayers = _layers.size();
- persistMgr->transfer(TMEMBER(numLayers));
+ persistMgr->transferSint32(TMEMBER(numLayers));
for (int i = 0; i < numLayers; i++) {
_layers[i]->persist(persistMgr);
}
} else {
numLayers = _layers.size();
- persistMgr->transfer(TMEMBER(numLayers));
+ persistMgr->transferSint32(TMEMBER(numLayers));
for (int i = 0; i < numLayers; i++) {
BaseTTFontLayer *layer = new BaseTTFontLayer;
layer->persist(persistMgr);
@@ -569,13 +562,22 @@ bool BaseFontTT::initFont() {
return STATUS_FAILED;
}
#ifdef USE_FREETYPE2
+ Common::String fallbackFilename;
+ // Handle Bold atleast for the fallback-case.
+ // TODO: Handle italic. (Needs a test-case)
+ if (_isBold) {
+ fallbackFilename = "FreeSansBold.ttf";
+ } else {
+ fallbackFilename = "FreeSans.ttf";
+ }
+
Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(_fontFile);
if (!file) {
if (Common::String(_fontFile) != "arial.ttf") {
warning("%s has no replacement font yet, using FreeSans for now (if available)", _fontFile);
}
// Fallback1: Try to find FreeSans.ttf
- file = SearchMan.createReadStreamForMember("FreeSans.ttf");
+ file = SearchMan.createReadStreamForMember(fallbackFilename);
}
if (file) {
@@ -602,10 +604,10 @@ bool BaseFontTT::initFont() {
}
if (themeFile) {
Common::Archive *themeArchive = Common::makeZipArchive(themeFile);
- if (themeArchive->hasFile("FreeSans.ttf")) {
+ if (themeArchive->hasFile(fallbackFilename)) {
file = nullptr;
- file = themeArchive->createReadStreamForMember("FreeSans.ttf");
- _deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72).
+ file = themeArchive->createReadStreamForMember(fallbackFilename);
+ _deletableFont = Graphics::loadTTFFont(*file, _fontHeight, 96); // Use the same dpi as WME (96 vs 72).
_font = _deletableFont;
}
// We're not using BaseFileManager, so clean up after ourselves:
@@ -619,10 +621,12 @@ bool BaseFontTT::initFont() {
// Fallback3: Try to ask FontMan for the FreeSans.ttf ScummModern.zip uses:
if (!_font) {
// Really not desireable, as we will get a font with dpi-72 then
- Common::String fontName = Common::String::format("%s-%s@%d", "FreeSans.ttf", "ASCII", _fontHeight);
+ Common::String fontName = Common::String::format("%s-%s@%d", fallbackFilename.c_str(), "ASCII", _fontHeight);
warning("Looking for %s", fontName.c_str());
_font = FontMan.getFontByName(fontName);
}
+#else
+ warning("BaseFontTT::InitFont - FreeType2-support not compiled in, TTF-fonts will not be loaded");
#endif // USE_FREETYPE2
// Fallback4: Just use the Big GUI-font. (REALLY undesireable)
@@ -639,9 +643,9 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight
//TextLineList lines;
if (maxWidth >= 0) {
- Common::Array<Common::String> lines;
+ Common::Array<WideString> lines;
_font->wordWrapText(text, maxWidth, lines);
- Common::Array<Common::String>::iterator it;
+ Common::Array<WideString>::iterator it;
textWidth = 0;
for (it = lines.begin(); it != lines.end(); ++it) {
textWidth = MAX(textWidth, _font->getStringWidth(*it));
diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h
index 9e0a082593..c0349eccd4 100644
--- a/engines/wintermute/base/font/base_font_truetype.h
+++ b/engines/wintermute/base/font/base_font_truetype.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.
@@ -56,9 +56,8 @@ private:
bool _marked;
uint32 _lastUsed;
- BaseCachedTTFontText() {
+ BaseCachedTTFontText() : _text() {
//_text = L"";
- _text = "";
_width = _maxHeight = _maxLength = -1;
_align = TAL_LEFT;
_surface = nullptr;
@@ -84,9 +83,9 @@ public:
}
bool persist(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_offsetX));
- persistMgr->transfer(TMEMBER(_offsetY));
- persistMgr->transfer(TMEMBER(_color));
+ persistMgr->transferSint32(TMEMBER(_offsetX));
+ persistMgr->transferSint32(TMEMBER(_offsetY));
+ persistMgr->transferUint32(TMEMBER(_color));
return STATUS_OK;
}
@@ -135,7 +134,7 @@ private:
size_t _maxCharWidth;
size_t _maxCharHeight;
-public:
+private:
bool _isBold;
bool _isItalic;
bool _isUnderline;
diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp
index d0dbae352e..e676fafdbf 100644
--- a/engines/wintermute/base/gfx/base_image.cpp
+++ b/engines/wintermute/base/gfx/base_image.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.
@@ -29,11 +29,11 @@
#include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/graphics/transparent_surface.h"
-#include "graphics/decoders/png.h"
-#include "graphics/decoders/jpeg.h"
-#include "graphics/decoders/bmp.h"
-#include "graphics/decoders/tga.h"
#include "graphics/surface.h"
+#include "image/png.h"
+#include "image/jpeg.h"
+#include "image/bmp.h"
+#include "image/tga.h"
#include "common/textconsole.h"
#include "common/stream.h"
#include "common/system.h"
@@ -62,16 +62,14 @@ BaseImage::~BaseImage() {
bool BaseImage::loadFile(const Common::String &filename) {
_filename = filename;
_filename.toLowercase();
- if (filename.hasPrefix("savegame:")) {
- _decoder = new Graphics::BitmapDecoder();
+ if (filename.hasPrefix("savegame:") || _filename.hasSuffix(".bmp")) {
+ _decoder = new Image::BitmapDecoder();
} else if (_filename.hasSuffix(".png")) {
- _decoder = new Graphics::PNGDecoder();
- } else if (_filename.hasSuffix(".bmp")) {
- _decoder = new Graphics::BitmapDecoder();
+ _decoder = new Image::PNGDecoder();
} else if (_filename.hasSuffix(".tga")) {
- _decoder = new Graphics::TGADecoder();
+ _decoder = new Image::TGADecoder();
} else if (_filename.hasSuffix(".jpg")) {
- _decoder = new Graphics::JPEGDecoder();
+ _decoder = new Image::JPEGDecoder();
} else {
error("BaseImage::loadFile : Unsupported fileformat %s", filename.c_str());
}
diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h
index 4b04fd1252..56be9fc453 100644
--- a/engines/wintermute/base/gfx/base_image.h
+++ b/engines/wintermute/base/gfx/base_image.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.
@@ -31,11 +31,14 @@
#include "graphics/surface.h"
#include "graphics/pixelformat.h"
-#include "graphics/decoders/image_decoder.h"
#include "common/endian.h"
#include "common/str.h"
#include "common/stream.h"
+namespace Image {
+class ImageDecoder;
+}
+
namespace Wintermute {
class BaseSurface;
class BaseFileManager;
@@ -60,7 +63,7 @@ public:
void copyFrom(const Graphics::Surface *surface);
private:
Common::String _filename;
- Graphics::ImageDecoder *_decoder;
+ Image::ImageDecoder *_decoder;
const Graphics::Surface *_surface;
Graphics::Surface *_deletableSurface;
const byte *_palette;
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp
index 1f171209d7..0f33fc2c43 100644
--- a/engines/wintermute/base/gfx/base_renderer.cpp
+++ b/engines/wintermute/base/gfx/base_renderer.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,7 +65,7 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) {
_loadImageX = _loadImageY = 0;
_width = _height = _bPP = 0;
- BasePlatform::setRectEmpty(&_monitorRect);
+ _monitorRect.setEmpty();
_realWidth = _realHeight = 0;
_drawOffsetX = _drawOffsetY = 0;
@@ -173,12 +173,12 @@ void BaseRenderer::endSaveLoad() {
}
void BaseRenderer::persistSaveLoadImages(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_loadImageName));
- persistMgr->transfer(TMEMBER(_saveImageName));
- persistMgr->transfer(TMEMBER(_saveImageX));
- persistMgr->transfer(TMEMBER(_saveImageY));
- persistMgr->transfer(TMEMBER(_loadImageX));
- persistMgr->transfer(TMEMBER(_loadImageY));
+ persistMgr->transferString(TMEMBER(_loadImageName));
+ persistMgr->transferString(TMEMBER(_saveImageName));
+ persistMgr->transferSint32(TMEMBER(_saveImageX));
+ persistMgr->transferSint32(TMEMBER(_saveImageY));
+ persistMgr->transferSint32(TMEMBER(_loadImageX));
+ persistMgr->transferSint32(TMEMBER(_loadImageY));
}
//////////////////////////////////////////////////////////////////////
@@ -374,7 +374,7 @@ bool BaseRenderer::displayIndicator() {
}
if (_saveLoadImage && !_hasDrawnSaveLoadImage) {
Rect32 rc;
- BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
+ rc.setRect(0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
if (_loadInProgress) {
_saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc);
} else {
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h
index b6615bc8fc..42ff2cb9e1 100644
--- a/engines/wintermute/base/gfx/base_renderer.h
+++ b/engines/wintermute/base/gfx/base_renderer.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.
diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp
index 19639c0c33..ec42a63c77 100644
--- a/engines/wintermute/base/gfx/base_surface.cpp
+++ b/engines/wintermute/base/gfx/base_surface.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/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
index a53748e9aa..7bd9bcbaea 100644
--- a/engines/wintermute/base/gfx/base_surface.h
+++ b/engines/wintermute/base/gfx/base_surface.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.
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index ff63789d18..601fcc0ffa 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.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.
@@ -268,7 +268,7 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const {
return _renderSurface->format;
}
-void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform) {
+void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform) {
if (_disableDirtyRects) {
RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform);
@@ -376,7 +376,7 @@ void BaseRenderOSystem::addDirtyRect(const Common::Rect &rect) {
void BaseRenderOSystem::drawTickets() {
RenderQueueIterator it = _renderQueue.begin();
// Clean out the old tickets
- // Note: We draw invalid tickets too, otherwise we wouldn't be honouring
+ // Note: We draw invalid tickets too, otherwise we wouldn't be honoring
// the draw request they obviously made BEFORE becoming invalid, either way
// we have a copy of their data, so their invalidness won't affect us.
while (it != _renderQueue.end()) {
@@ -399,10 +399,23 @@ void BaseRenderOSystem::drawTickets() {
return;
}
- // Apply the clear-color to the dirty rect.
- _renderSurface->fillRect(*_dirtyRect, _clearColor);
+ it = _renderQueue.begin();
_lastFrameIter = _renderQueue.end();
- for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) {
+ // A special case: If the screen has one giant OPAQUE rect to be drawn, then we skip filling
+ // the background color. Typical use-case: Fullscreen FMVs.
+ // Caveat: The FPS-counter will invalidate this.
+ if (it != _lastFrameIter && _renderQueue.front() == _renderQueue.back() && (*it)->_transform._alphaDisable == true) {
+ // If our single opaque rect fills the dirty rect, we can skip filling.
+ if (*_dirtyRect != (*it)->_dstRect) {
+ // Apply the clear-color to the dirty rect.
+ _renderSurface->fillRect(*_dirtyRect, _clearColor);
+ }
+ // Otherwise Do NOT fill.
+ } else {
+ // Apply the clear-color to the dirty rect.
+ _renderSurface->fillRect(*_dirtyRect, _clearColor);
+ }
+ for (; it != _renderQueue.end(); ++it) {
RenderTicket *ticket = *it;
if (ticket->_dstRect.intersects(*_dirtyRect)) {
// dstClip is the area we want redrawn.
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index 8996c8b2e8..c9b8a52282 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.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.
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 9ec8573a87..983f9c1296 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.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.
@@ -32,10 +32,6 @@
#include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
#include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/platform_osystem.h"
-#include "graphics/decoders/png.h"
-#include "graphics/decoders/bmp.h"
-#include "graphics/decoders/jpeg.h"
-#include "graphics/decoders/tga.h"
#include "engines/wintermute/graphics/transparent_surface.h"
#include "engines/wintermute/graphics/transform_tools.h"
#include "graphics/pixelformat.h"
@@ -341,7 +337,7 @@ bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode ble
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
_rotation = 0;
- return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY));
+ return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY));
}
//////////////////////////////////////////////////////////////////////////
@@ -441,14 +437,20 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect,
transform._alphaDisable = true;
}
- renderer->drawSurface(this, _surface, &srcRect, &position, transform);
+ renderer->drawSurface(this, _surface, &srcRect, &position, transform);
return STATUS_OK;
}
bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
_loaded = true;
- _surface->free();
- _surface->copyFrom(surface);
+ if (surface.format == _surface->format && surface.pitch == _surface->pitch && surface.h == _surface->h) {
+ const byte *src = (const byte *)surface.getBasePtr(0, 0);
+ byte *dst = (byte *)_surface->getBasePtr(0, 0);
+ memcpy(dst, src, surface.pitch * surface.h);
+ } else {
+ _surface->free();
+ _surface->copyFrom(surface);
+ }
if (hasAlpha) {
_alphaType = TransparentSurface::ALPHA_FULL;
} else {
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 67f45f66db..4a05b2c66c 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.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.
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
index 1cd35e3b04..f8579dfd41 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.
@@ -86,9 +86,9 @@ RenderTicket::~RenderTicket() {
bool RenderTicket::operator==(const RenderTicket &t) const {
if ((t._owner != _owner) ||
- (t._transform != _transform) ||
+ (t._transform != _transform) ||
(t._dstRect != _dstRect) ||
- (t._srcRect != _srcRect)
+ (t._srcRect != _srcRect)
) {
return false;
}
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h
index e824c09fe7..de95273021 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.
@@ -41,17 +41,17 @@ class BaseSurfaceOSystem;
* 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
+ * 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, TransformStruct transform);
+ RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, TransformStruct transform);
RenderTicket() : _isValid(true), _wantsDraw(false), _transform(TransformStruct()) {}
~RenderTicket();
const Graphics::Surface *getSurface() const { return _surface; }
@@ -65,8 +65,8 @@ public:
bool _isValid;
bool _wantsDraw;
- TransformStruct _transform;
-
+ TransformStruct _transform;
+
BaseSurfaceOSystem *_owner;
bool operator==(const RenderTicket &a) const;
const Common::Rect *getSrcRect() const { return &_srcRect; }
diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp
index aaffa0965a..c64a099cee 100644
--- a/engines/wintermute/base/particles/part_emitter.cpp
+++ b/engines/wintermute/base/particles/part_emitter.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.
@@ -38,7 +38,6 @@
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/platform_osystem.h"
#include "common/str.h"
#include "common/math.h"
@@ -50,7 +49,7 @@ IMPLEMENT_PERSISTENT(PartEmitter, false)
PartEmitter::PartEmitter(BaseGame *inGame, BaseScriptHolder *owner) : BaseObject(inGame) {
_width = _height = 0;
- BasePlatform::setRectEmpty(&_border);
+ _border.setEmpty();
_borderThicknessLeft = _borderThicknessRight = _borderThicknessTop = _borderThicknessBottom = 0;
_angle1 = _angle2 = 0;
@@ -198,7 +197,7 @@ bool PartEmitter::initParticle(PartParticle *particle, uint32 currentTime, uint3
float angVelocity = BaseUtils::randomFloat(_angVelocity1, _angVelocity2);
float growthRate = BaseUtils::randomFloat(_growthRate1, _growthRate2);
- if (!BasePlatform::isRectEmpty(&_border)) {
+ if (!_border.isRectEmpty()) {
int thicknessLeft = (int)(_borderThicknessLeft - (float)_borderThicknessLeft * posZ / 100.0f);
int thicknessRight = (int)(_borderThicknessRight - (float)_borderThicknessRight * posZ / 100.0f);
int thicknessTop = (int)(_borderThicknessTop - (float)_borderThicknessTop * posZ / 100.0f);
@@ -386,7 +385,7 @@ bool PartEmitter::compareZ(const PartParticle *p1, const PartParticle *p2) {
//////////////////////////////////////////////////////////////////////////
bool PartEmitter::setBorder(int x, int y, int width, int height) {
- BasePlatform::setRect(&_border, x, y, x + width, y + height);
+ _border.setRect(x, y, x + width, y + height);
return STATUS_OK;
}
@@ -1157,44 +1156,44 @@ const char *PartEmitter::scToString() {
bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_width));
- persistMgr->transfer(TMEMBER(_height));
+ persistMgr->transferSint32(TMEMBER(_width));
+ persistMgr->transferSint32(TMEMBER(_height));
- persistMgr->transfer(TMEMBER(_angle1));
- persistMgr->transfer(TMEMBER(_angle2));
+ persistMgr->transferSint32(TMEMBER(_angle1));
+ persistMgr->transferSint32(TMEMBER(_angle2));
persistMgr->transferFloat(TMEMBER(_velocity1));
persistMgr->transferFloat(TMEMBER(_velocity2));
- persistMgr->transfer(TMEMBER(_velocityZBased));
+ persistMgr->transferBool(TMEMBER(_velocityZBased));
persistMgr->transferFloat(TMEMBER(_scale1));
persistMgr->transferFloat(TMEMBER(_scale2));
- persistMgr->transfer(TMEMBER(_scaleZBased));
+ persistMgr->transferBool(TMEMBER(_scaleZBased));
- persistMgr->transfer(TMEMBER(_maxParticles));
+ persistMgr->transferSint32(TMEMBER(_maxParticles));
- persistMgr->transfer(TMEMBER(_lifeTime1));
- persistMgr->transfer(TMEMBER(_lifeTime2));
- persistMgr->transfer(TMEMBER(_lifeTimeZBased));
+ persistMgr->transferSint32(TMEMBER(_lifeTime1));
+ persistMgr->transferSint32(TMEMBER(_lifeTime2));
+ persistMgr->transferBool(TMEMBER(_lifeTimeZBased));
- persistMgr->transfer(TMEMBER(_genInterval));
- persistMgr->transfer(TMEMBER(_genAmount));
+ persistMgr->transferSint32(TMEMBER(_genInterval));
+ persistMgr->transferSint32(TMEMBER(_genAmount));
- persistMgr->transfer(TMEMBER(_running));
- persistMgr->transfer(TMEMBER(_overheadTime));
+ persistMgr->transferBool(TMEMBER(_running));
+ persistMgr->transferSint32(TMEMBER(_overheadTime));
- persistMgr->transfer(TMEMBER(_border));
- persistMgr->transfer(TMEMBER(_borderThicknessLeft));
- persistMgr->transfer(TMEMBER(_borderThicknessRight));
- persistMgr->transfer(TMEMBER(_borderThicknessTop));
- persistMgr->transfer(TMEMBER(_borderThicknessBottom));
+ persistMgr->transferRect32(TMEMBER(_border));
+ persistMgr->transferSint32(TMEMBER(_borderThicknessLeft));
+ persistMgr->transferSint32(TMEMBER(_borderThicknessRight));
+ persistMgr->transferSint32(TMEMBER(_borderThicknessTop));
+ persistMgr->transferSint32(TMEMBER(_borderThicknessBottom));
- persistMgr->transfer(TMEMBER(_fadeInTime));
- persistMgr->transfer(TMEMBER(_fadeOutTime));
+ persistMgr->transferSint32(TMEMBER(_fadeInTime));
+ persistMgr->transferSint32(TMEMBER(_fadeOutTime));
- persistMgr->transfer(TMEMBER(_alpha1));
- persistMgr->transfer(TMEMBER(_alpha2));
- persistMgr->transfer(TMEMBER(_alphaTimeBased));
+ persistMgr->transferSint32(TMEMBER(_alpha1));
+ persistMgr->transferSint32(TMEMBER(_alpha2));
+ persistMgr->transferBool(TMEMBER(_alphaTimeBased));
persistMgr->transferFloat(TMEMBER(_angVelocity1));
persistMgr->transferFloat(TMEMBER(_angVelocity2));
@@ -1204,14 +1203,14 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferFloat(TMEMBER(_growthRate1));
persistMgr->transferFloat(TMEMBER(_growthRate2));
- persistMgr->transfer(TMEMBER(_exponentialGrowth));
+ persistMgr->transferBool(TMEMBER(_exponentialGrowth));
- persistMgr->transfer(TMEMBER(_useRegion));
+ persistMgr->transferBool(TMEMBER(_useRegion));
- persistMgr->transfer(TMEMBER_INT(_maxBatches));
- persistMgr->transfer(TMEMBER_INT(_batchesGenerated));
+ persistMgr->transferSint32(TMEMBER_INT(_maxBatches));
+ persistMgr->transferSint32(TMEMBER_INT(_batchesGenerated));
- persistMgr->transfer(TMEMBER(_emitEvent));
+ persistMgr->transferCharPtr(TMEMBER(_emitEvent));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
@@ -1220,12 +1219,12 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
uint32 numForces;
if (persistMgr->getIsSaving()) {
numForces = _forces.size();
- persistMgr->transfer(TMEMBER(numForces));
+ persistMgr->transferUint32(TMEMBER(numForces));
for (uint32 i = 0; i < _forces.size(); i++) {
_forces[i]->persist(persistMgr);
}
} else {
- persistMgr->transfer(TMEMBER(numForces));
+ persistMgr->transferUint32(TMEMBER(numForces));
for (uint32 i = 0; i < numForces; i++) {
PartForce *force = new PartForce(_gameRef);
force->persist(persistMgr);
@@ -1236,12 +1235,12 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
uint32 numParticles;
if (persistMgr->getIsSaving()) {
numParticles = _particles.size();
- persistMgr->transfer(TMEMBER(numParticles));
+ persistMgr->transferUint32(TMEMBER(numParticles));
for (uint32 i = 0; i < _particles.size(); i++) {
_particles[i]->persist(persistMgr);
}
} else {
- persistMgr->transfer(TMEMBER(numParticles));
+ persistMgr->transferUint32(TMEMBER(numParticles));
for (uint32 i = 0; i < numParticles; i++) {
PartParticle *particle = new PartParticle(_gameRef);
particle->persist(persistMgr);
diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h
index 94b4dc8126..3fe24b52a0 100644
--- a/engines/wintermute/base/particles/part_emitter.h
+++ b/engines/wintermute/base/particles/part_emitter.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.
diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp
index 122cdf1afe..c2e0832e72 100644
--- a/engines/wintermute/base/particles/part_force.cpp
+++ b/engines/wintermute/base/particles/part_force.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.
@@ -49,15 +49,15 @@ PartForce::~PartForce(void) {
bool PartForce::persist(BasePersistenceManager *persistMgr) {
if (persistMgr->getIsSaving()) {
const char *name = getName();
- persistMgr->transfer(TMEMBER(name));
+ persistMgr->transferConstChar(TMEMBER(name));
} else {
const char *name;
- persistMgr->transfer(TMEMBER(name));
+ persistMgr->transferConstChar(TMEMBER(name));
setName(name);
}
- persistMgr->transfer(TMEMBER(_pos));
- persistMgr->transfer(TMEMBER(_direction));
- persistMgr->transfer(TMEMBER_INT(_type));
+ persistMgr->transferVector2(TMEMBER(_pos));
+ persistMgr->transferVector2(TMEMBER(_direction));
+ persistMgr->transferSint32(TMEMBER_INT(_type));
return STATUS_OK;
}
diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h
index cdb1ce40f9..11862d08ed 100644
--- a/engines/wintermute/base/particles/part_force.h
+++ b/engines/wintermute/base/particles/part_force.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.
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
index 86cacacb5c..97c81e49a5 100644
--- a/engines/wintermute/base/particles/part_particle.cpp
+++ b/engines/wintermute/base/particles/part_particle.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.
@@ -45,7 +45,7 @@ PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) {
_creationTime = 0;
_lifeTime = 0;
_isDead = true;
- BasePlatform::setRectEmpty(&_border);
+ _border.setEmpty();
_state = PARTICLE_NORMAL;
_fadeStart = 0;
@@ -125,7 +125,7 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
}
// particle hit the border
- if (!_isDead && !BasePlatform::isRectEmpty(&_border)) {
+ if (!_isDead && !_border.isRectEmpty()) {
Point32 p;
p.x = (int32)_pos.x;
p.y = (int32)_pos.y;
@@ -230,32 +230,32 @@ bool PartParticle::fadeOut(uint32 currentTime, int fadeTime) {
//////////////////////////////////////////////////////////////////////////
bool PartParticle::persist(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_alpha1));
- persistMgr->transfer(TMEMBER(_alpha2));
- persistMgr->transfer(TMEMBER(_border));
- persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transferSint32(TMEMBER(_alpha1));
+ persistMgr->transferSint32(TMEMBER(_alpha2));
+ persistMgr->transferRect32(TMEMBER(_border));
+ persistMgr->transferVector2(TMEMBER(_pos));
persistMgr->transferFloat(TMEMBER(_posZ));
- persistMgr->transfer(TMEMBER(_velocity));
+ persistMgr->transferVector2(TMEMBER(_velocity));
persistMgr->transferFloat(TMEMBER(_scale));
- persistMgr->transfer(TMEMBER(_creationTime));
- persistMgr->transfer(TMEMBER(_lifeTime));
- persistMgr->transfer(TMEMBER(_isDead));
- persistMgr->transfer(TMEMBER_INT(_state));
- persistMgr->transfer(TMEMBER(_fadeStart));
- persistMgr->transfer(TMEMBER(_fadeTime));
- persistMgr->transfer(TMEMBER(_currentAlpha));
+ persistMgr->transferUint32(TMEMBER(_creationTime));
+ persistMgr->transferSint32(TMEMBER(_lifeTime));
+ persistMgr->transferBool(TMEMBER(_isDead));
+ persistMgr->transferSint32(TMEMBER_INT(_state));
+ persistMgr->transferUint32(TMEMBER(_fadeStart));
+ persistMgr->transferSint32(TMEMBER(_fadeTime));
+ persistMgr->transferSint32(TMEMBER(_currentAlpha));
persistMgr->transferFloat(TMEMBER(_angVelocity));
persistMgr->transferFloat(TMEMBER(_rotation));
persistMgr->transferFloat(TMEMBER(_growthRate));
- persistMgr->transfer(TMEMBER(_exponentialGrowth));
- persistMgr->transfer(TMEMBER(_fadeStartAlpha));
+ persistMgr->transferBool(TMEMBER(_exponentialGrowth));
+ persistMgr->transferSint32(TMEMBER(_fadeStartAlpha));
if (persistMgr->getIsSaving()) {
const char *filename = _sprite->getFilename();
- persistMgr->transfer(TMEMBER(filename));
+ persistMgr->transferConstChar(TMEMBER(filename));
} else {
char *filename;
- persistMgr->transfer(TMEMBER(filename));
+ persistMgr->transferCharPtr(TMEMBER(filename));
SystemClassRegistry::getInstance()->_disabled = true;
setSprite(filename);
SystemClassRegistry::getInstance()->_disabled = false;
diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h
index 281d87cf72..9019845a82 100644
--- a/engines/wintermute/base/particles/part_particle.h
+++ b/engines/wintermute/base/particles/part_particle.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.
diff --git a/engines/wintermute/base/save_thumb_helper.cpp b/engines/wintermute/base/save_thumb_helper.cpp
index 77514849a6..b1d9330263 100644
--- a/engines/wintermute/base/save_thumb_helper.cpp
+++ b/engines/wintermute/base/save_thumb_helper.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/save_thumb_helper.h b/engines/wintermute/base/save_thumb_helper.h
index 44792e3d75..0d32d3ed9f 100644
--- a/engines/wintermute/base/save_thumb_helper.h
+++ b/engines/wintermute/base/save_thumb_helper.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.
diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp
index 8d37909bb4..85553a2a53 100644
--- a/engines/wintermute/base/saveload.cpp
+++ b/engines/wintermute/base/saveload.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.
@@ -48,6 +48,7 @@ bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) {
bool ret;
+ gameRef->stopVideo();
gameRef->_renderer->initSaveLoad(false);
gameRef->_loadInProgress = true;
diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h
index 15d4d86b26..31f5841f41 100644
--- a/engines/wintermute/base/saveload.h
+++ b/engines/wintermute/base/saveload.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.
diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h
index d6bb3cd176..8047baaa68 100644
--- a/engines/wintermute/base/scriptables/dcscript.h
+++ b/engines/wintermute/base/scriptables/dcscript.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.
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 5aeff78c50..44fd117e61 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.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.
@@ -488,7 +488,8 @@ double ScScript::getFloat() {
SWAP(buffer[3], buffer[4]);
#endif
- double ret = *(double *)(buffer);
+ double ret;
+ memcpy(&ret, buffer, sizeof(double));
_iP += 8; // Hardcode the double-size used originally.
return ret;
}
@@ -1249,15 +1250,15 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
// buffer
if (persistMgr->getIsSaving()) {
if (_state != SCRIPT_PERSISTENT && _state != SCRIPT_FINISHED && _state != SCRIPT_THREAD_FINISHED) {
- persistMgr->transfer(TMEMBER(_bufferSize));
+ persistMgr->transferUint32(TMEMBER(_bufferSize));
persistMgr->putBytes(_buffer, _bufferSize);
} else {
// don't save idle/finished scripts
int32 bufferSize = 0;
- persistMgr->transfer(TMEMBER(bufferSize));
+ persistMgr->transferSint32(TMEMBER(bufferSize));
}
} else {
- persistMgr->transfer(TMEMBER(_bufferSize));
+ persistMgr->transferUint32(TMEMBER(_bufferSize));
if (_bufferSize > 0) {
_buffer = new byte[_bufferSize];
persistMgr->getBytes(_buffer, _bufferSize);
@@ -1270,31 +1271,31 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
}
persistMgr->transferPtr(TMEMBER_PTR(_callStack));
- persistMgr->transfer(TMEMBER(_currentLine));
+ persistMgr->transferSint32(TMEMBER(_currentLine));
persistMgr->transferPtr(TMEMBER_PTR(_engine));
- persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferCharPtr(TMEMBER(_filename));
+ persistMgr->transferBool(TMEMBER(_freezable));
persistMgr->transferPtr(TMEMBER_PTR(_globals));
- persistMgr->transfer(TMEMBER(_iP));
+ persistMgr->transferUint32(TMEMBER(_iP));
persistMgr->transferPtr(TMEMBER_PTR(_scopeStack));
persistMgr->transferPtr(TMEMBER_PTR(_stack));
- persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transferSint32(TMEMBER_INT(_state));
persistMgr->transferPtr(TMEMBER_PTR(_operand));
- persistMgr->transfer(TMEMBER_INT(_origState));
+ persistMgr->transferSint32(TMEMBER_INT(_origState));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
persistMgr->transferPtr(TMEMBER_PTR(_reg1));
- persistMgr->transfer(TMEMBER(_thread));
- persistMgr->transfer(TMEMBER(_threadEvent));
+ persistMgr->transferBool(TMEMBER(_thread));
+ persistMgr->transferCharPtr(TMEMBER(_threadEvent));
persistMgr->transferPtr(TMEMBER_PTR(_thisStack));
- persistMgr->transfer(TMEMBER(_timeSlice));
+ persistMgr->transferUint32(TMEMBER(_timeSlice));
persistMgr->transferPtr(TMEMBER_PTR(_waitObject));
persistMgr->transferPtr(TMEMBER_PTR(_waitScript));
- persistMgr->transfer(TMEMBER(_waitTime));
- persistMgr->transfer(TMEMBER(_waitFrozen));
+ persistMgr->transferUint32(TMEMBER(_waitTime));
+ persistMgr->transferBool(TMEMBER(_waitFrozen));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_unbreakable));
+ persistMgr->transferBool(TMEMBER(_methodThread));
+ persistMgr->transferBool(TMEMBER(_methodThread)); // TODO-SAVE: Deduplicate.
+ persistMgr->transferBool(TMEMBER(_unbreakable));
persistMgr->transferPtr(TMEMBER_PTR(_parentScript));
if (!persistMgr->getIsSaving()) {
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
index 488ff63606..1edeae5b55 100644
--- a/engines/wintermute/base/scriptables/script.h
+++ b/engines/wintermute/base/scriptables/script.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.
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index bb819b23e4..cdf55a304c 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.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/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 622b3c4b94..bdb139e1f8 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp
index 7f1c769ec5..7431029cbf 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_array.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.
@@ -214,7 +214,7 @@ bool SXArray::scSetProperty(const char *name, ScValue *value) {
bool SXArray::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_length));
+ persistMgr->transferSint32(TMEMBER(_length));
persistMgr->transferPtr(TMEMBER_PTR(_values));
return STATUS_OK;
diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h
index e6381a011e..2daa58a241 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.h
+++ b/engines/wintermute/base/scriptables/script_ext_array.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp
index d88bfc5851..89cdcde0af 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_date.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.
@@ -243,15 +243,15 @@ bool SXDate::persist(BasePersistenceManager *persistMgr) {
int32 hour = _tm.tm_hour;
int32 min = _tm.tm_min;
int32 sec = _tm.tm_sec;
- persistMgr->transfer(TMEMBER(year));
- persistMgr->transfer(TMEMBER(mon));
- persistMgr->transfer(TMEMBER(mday));
- persistMgr->transfer(TMEMBER(hour));
- persistMgr->transfer(TMEMBER(min));
- persistMgr->transfer(TMEMBER(sec));
+ persistMgr->transferSint32(TMEMBER(year));
+ persistMgr->transferSint32(TMEMBER(mon));
+ persistMgr->transferSint32(TMEMBER(mday));
+ persistMgr->transferSint32(TMEMBER(hour));
+ persistMgr->transferSint32(TMEMBER(min));
+ persistMgr->transferSint32(TMEMBER(sec));
if (persistMgr->checkVersion(1, 2, 1)) {
int32 wday = _tm.tm_wday;
- persistMgr->transfer(TMEMBER(wday));
+ persistMgr->transferSint32(TMEMBER(wday));
_tm.tm_wday = wday;
}
_tm.tm_year = year;
diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h
index 0ccf093a7b..46a23a36fa 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.h
+++ b/engines/wintermute/base/scriptables/script_ext_date.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index 18f7b8213a..15ddd4bcca 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.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.
@@ -443,7 +443,7 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
return STATUS_OK;
}
float val;
- (*(uint32 *)&val) = _readFile->readUint32LE();
+ WRITE_UINT32(&val, _readFile->readUint32LE());
if (!_readFile->err()) {
stack->pushFloat(val);
} else {
@@ -766,16 +766,16 @@ bool SXFile::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_mode));
- persistMgr->transfer(TMEMBER(_textMode));
+ persistMgr->transferCharPtr(TMEMBER(_filename));
+ persistMgr->transferSint32(TMEMBER(_mode));
+ persistMgr->transferBool(TMEMBER(_textMode));
uint32 pos = 0;
if (persistMgr->getIsSaving()) {
pos = getPos();
- persistMgr->transfer(TMEMBER(pos));
+ persistMgr->transferUint32(TMEMBER(pos));
} else {
- persistMgr->transfer(TMEMBER(pos));
+ persistMgr->transferUint32(TMEMBER(pos));
// try to re-open file if needed
_writeFile = nullptr;
diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h
index a1298929f2..4994ef9c97 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.h
+++ b/engines/wintermute/base/scriptables/script_ext_file.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp
index ec53b983e7..4d770d4c51 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_math.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/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h
index 1aa274a96f..5354e52f1e 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.h
+++ b/engines/wintermute/base/scriptables/script_ext_math.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
index 6a47c09136..276d1fb211 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.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.
@@ -498,7 +498,7 @@ bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_size));
+ persistMgr->transferSint32(TMEMBER(_size));
if (persistMgr->getIsSaving()) {
if (_size > 0) {
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
index 4aad8b6484..740ff1d23f 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp
index a72b244f0a..cf1b788ede 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_object.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/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h
index 566111292a..04878be85e 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.h
+++ b/engines/wintermute/base/scriptables/script_ext_object.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.
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
index 2f2422cdf9..bc0c658c57 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_string.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.
@@ -298,21 +298,15 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
uint32 start = 0;
for(uint32 i = 0; i < str.size() + 1; i++) {
- char ch = str.c_str()[i];
- if(ch=='\0' || delims.contains(ch))
- {
- char *part = new char[i - start + 1];
- if(i != start) {
- Common::strlcpy(part, str.c_str() + start, i - start + 1);
- part[i - start] = '\0';
+ // The [] operator doesn't allow access to the zero code terminator
+ // (bug #6531)
+ uint32 ch = (i == str.size()) ? '\0' : str[i];
+ if (ch =='\0' || delims.contains(ch)) {
+ if (i != start) {
+ parts.push_back(WideString(str.c_str() + start, i - start + 1));
} else {
- part[0] = '\0';
+ parts.push_back(WideString());
}
- val = new ScValue(_gameRef, part);
- array->push(val);
- delete[] part;
- delete val;
- val = nullptr;
start = i + 1;
}
}
@@ -406,7 +400,7 @@ bool SXString::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_capacity));
+ persistMgr->transferSint32(TMEMBER(_capacity));
if (persistMgr->getIsSaving()) {
if (_capacity > 0) {
diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h
index 7a95c59b4c..b28f2b24c1 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.h
+++ b/engines/wintermute/base/scriptables/script_ext_string.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.
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
index 801ac6ab52..fe765bfb68 100644
--- a/engines/wintermute/base/scriptables/script_stack.cpp
+++ b/engines/wintermute/base/scriptables/script_stack.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.
@@ -186,7 +186,7 @@ bool ScStack::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_sP));
+ persistMgr->transferSint32(TMEMBER(_sP));
_values.persist(persistMgr);
return STATUS_OK;
diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h
index ee04485a51..fe7afae3f9 100644
--- a/engines/wintermute/base/scriptables/script_stack.h
+++ b/engines/wintermute/base/scriptables/script_stack.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.
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
index 31ec457df1..4b84574257 100644
--- a/engines/wintermute/base/scriptables/script_value.cpp
+++ b/engines/wintermute/base/scriptables/script_value.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.
@@ -791,32 +791,32 @@ void ScValue::setValue(ScValue *val) {
bool ScValue::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_persistent));
- persistMgr->transfer(TMEMBER(_isConstVar));
- persistMgr->transfer(TMEMBER_INT(_type));
- persistMgr->transfer(TMEMBER(_valBool));
- persistMgr->transfer(TMEMBER(_valFloat));
- persistMgr->transfer(TMEMBER(_valInt));
+ persistMgr->transferBool(TMEMBER(_persistent));
+ persistMgr->transferBool(TMEMBER(_isConstVar));
+ persistMgr->transferSint32(TMEMBER_INT(_type));
+ persistMgr->transferBool(TMEMBER(_valBool));
+ persistMgr->transferDouble(TMEMBER(_valFloat));
+ persistMgr->transferSint32(TMEMBER(_valInt));
persistMgr->transferPtr(TMEMBER_PTR(_valNative));
int32 size;
const char *str;
if (persistMgr->getIsSaving()) {
size = _valObject.size();
- persistMgr->transfer("", &size);
+ persistMgr->transferSint32("", &size);
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
str = _valIter->_key.c_str();
- persistMgr->transfer("", &str);
+ persistMgr->transferConstChar("", &str);
persistMgr->transferPtr("", &_valIter->_value);
_valIter++;
}
} else {
ScValue *val = nullptr;
- persistMgr->transfer("", &size);
+ persistMgr->transferSint32("", &size);
for (int i = 0; i < size; i++) {
- persistMgr->transfer("", &str);
+ persistMgr->transferConstChar("", &str);
persistMgr->transferPtr("", &val);
_valObject[str] = val;
@@ -825,7 +825,7 @@ bool ScValue::persist(BasePersistenceManager *persistMgr) {
}
persistMgr->transferPtr(TMEMBER_PTR(_valRef));
- persistMgr->transfer(TMEMBER(_valString));
+ persistMgr->transferCharPtr(TMEMBER(_valString));
if (!persistMgr->getIsSaving() && !persistMgr->checkVersion(1,2,2)) {
// Savegames prior to 1.2.2 stored empty strings as NULL.
diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h
index 90ad9f182a..6130553645 100644
--- a/engines/wintermute/base/scriptables/script_value.h
+++ b/engines/wintermute/base/scriptables/script_value.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.
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index c1923b3ca8..fa452cc0d6 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.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.
@@ -166,16 +166,16 @@ bool BaseSound::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_soundFilename));
- persistMgr->transfer(TMEMBER(_soundLooping));
- persistMgr->transfer(TMEMBER(_soundPaused));
- persistMgr->transfer(TMEMBER(_soundFreezePaused));
- persistMgr->transfer(TMEMBER(_soundPlaying));
- persistMgr->transfer(TMEMBER(_soundPosition));
- persistMgr->transfer(TMEMBER(_soundPrivateVolume));
- persistMgr->transfer(TMEMBER(_soundStreamed));
- persistMgr->transfer(TMEMBER_INT(_soundType));
- persistMgr->transfer(TMEMBER(_soundLoopStart));
+ persistMgr->transferString(TMEMBER(_soundFilename));
+ persistMgr->transferBool(TMEMBER(_soundLooping));
+ persistMgr->transferBool(TMEMBER(_soundPaused));
+ persistMgr->transferBool(TMEMBER(_soundFreezePaused));
+ persistMgr->transferBool(TMEMBER(_soundPlaying));
+ persistMgr->transferUint32(TMEMBER(_soundPosition));
+ persistMgr->transferSint32(TMEMBER(_soundPrivateVolume));
+ persistMgr->transferBool(TMEMBER(_soundStreamed));
+ persistMgr->transferSint32(TMEMBER_INT(_soundType));
+ persistMgr->transferUint32(TMEMBER(_soundLoopStart));
return STATUS_OK;
}
diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h
index 0a984d240a..ceeb81c1bf 100644
--- a/engines/wintermute/base/sound/base_sound.h
+++ b/engines/wintermute/base/sound/base_sound.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.
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
index 7666a441a3..7ec68ea752 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.cpp
+++ b/engines/wintermute/base/sound/base_sound_buffer.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.
@@ -58,6 +58,7 @@ BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame) : BaseClass(inGame) {
_file = nullptr;
_privateVolume = 255;
_volume = 255;
+ _pan = 0;
_looping = false;
_loopStart = 0;
@@ -143,9 +144,9 @@ bool BaseSoundBuffer::play(bool looping, uint32 startSample) {
_handle = new Audio::SoundHandle;
if (_looping) {
Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
- g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, 0, DisposeAfterUse::YES);
+ g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, _pan, DisposeAfterUse::YES);
} else {
- g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, 0, DisposeAfterUse::NO);
+ g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, _pan, DisposeAfterUse::NO);
}
}
@@ -268,8 +269,11 @@ bool BaseSoundBuffer::setLoopStart(uint32 pos) {
//////////////////////////////////////////////////////////////////////////
bool BaseSoundBuffer::setPan(float pan) {
+ pan = MAX(pan, -1.0f);
+ pan = MIN(pan, 1.0f);
+ _pan = (int8)(pan * 127);
if (_handle) {
- g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127));
+ g_system->getMixer()->setChannelBalance(*_handle, _pan);
}
return STATUS_OK;
}
diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h
index 53b86f64c6..94bc8dc6ad 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.h
+++ b/engines/wintermute/base/sound/base_sound_buffer.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.
@@ -93,6 +93,7 @@ private:
bool _streamed;
Common::SeekableReadStream *_file;
int32 _volume;
+ int8 _pan;
};
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 68e62f25b0..539dc0dd1d 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.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/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h
index 5993a05001..30d943c264 100644
--- a/engines/wintermute/base/sound/base_sound_manager.h
+++ b/engines/wintermute/base/sound/base_sound_manager.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.
diff --git a/engines/wintermute/base/timer.cpp b/engines/wintermute/base/timer.cpp
index 96097c10d5..c2ecc1469a 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.
@@ -66,9 +66,9 @@ uint32 Timer::getTimeLast() const {
}
void Timer::persist(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_timer));
- persistMgr->transfer(TMEMBER(_timerDelta));
- persistMgr->transfer(TMEMBER(_timerLast));
+ persistMgr->transferUint32(TMEMBER(_timer));
+ persistMgr->transferUint32(TMEMBER(_timerDelta));
+ persistMgr->transferUint32(TMEMBER(_timerLast));
}
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/timer.h b/engines/wintermute/base/timer.h
index 4099c6c825..768bea4253 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.