diff options
author | Marisa-Chan | 2014-06-13 21:43:04 +0700 |
---|---|---|
committer | Marisa-Chan | 2014-06-13 21:43:04 +0700 |
commit | 45589950c0fb1a449351e6a00ef10d42290d8bae (patch) | |
tree | 44e4eedcb7e69d5fc386155b000ed038af07251d /engines/wintermute | |
parent | 48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff) | |
parent | 5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff) | |
download | scummvm-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')
237 files changed, 2138 insertions, 1572 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index 967270b9bd..9d5a35464a 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.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. @@ -1319,29 +1319,29 @@ BaseSprite *AdActor::getTalkStanceOld(const char *stance) { bool AdActor::persist(BasePersistenceManager *persistMgr) { AdTalkHolder::persist(persistMgr); - persistMgr->transfer(TMEMBER_INT(_dir)); + persistMgr->transferSint32(TMEMBER_INT(_dir)); persistMgr->transferPtr(TMEMBER_PTR(_path)); - persistMgr->transfer(TMEMBER(_pFCount)); - persistMgr->transfer(TMEMBER(_pFStepX)); - persistMgr->transfer(TMEMBER(_pFStepY)); - persistMgr->transfer(TMEMBER(_pFX)); - persistMgr->transfer(TMEMBER(_pFY)); + persistMgr->transferSint32(TMEMBER(_pFCount)); + persistMgr->transferDouble(TMEMBER(_pFStepX)); + persistMgr->transferDouble(TMEMBER(_pFStepY)); + persistMgr->transferDouble(TMEMBER(_pFX)); + persistMgr->transferDouble(TMEMBER(_pFY)); persistMgr->transferPtr(TMEMBER_PTR(_standSprite)); _talkSprites.persist(persistMgr); _talkSpritesEx.persist(persistMgr); - persistMgr->transfer(TMEMBER_INT(_targetDir)); - persistMgr->transfer(TMEMBER_INT(_afterWalkDir)); + persistMgr->transferSint32(TMEMBER_INT(_targetDir)); + persistMgr->transferSint32(TMEMBER_INT(_afterWalkDir)); persistMgr->transferPtr(TMEMBER_PTR(_targetPoint)); persistMgr->transferPtr(TMEMBER_PTR(_turnLeftSprite)); persistMgr->transferPtr(TMEMBER_PTR(_turnRightSprite)); persistMgr->transferPtr(TMEMBER_PTR(_walkSprite)); persistMgr->transferPtr(TMEMBER_PTR(_animSprite2)); - persistMgr->transfer(TMEMBER(_talkAnimName)); - persistMgr->transfer(TMEMBER(_idleAnimName)); - persistMgr->transfer(TMEMBER(_walkAnimName)); - persistMgr->transfer(TMEMBER(_turnLeftAnimName)); - persistMgr->transfer(TMEMBER(_turnRightAnimName)); + persistMgr->transferString(TMEMBER(_talkAnimName)); + persistMgr->transferString(TMEMBER(_idleAnimName)); + persistMgr->transferString(TMEMBER(_walkAnimName)); + persistMgr->transferString(TMEMBER(_turnLeftAnimName)); + persistMgr->transferString(TMEMBER(_turnRightAnimName)); _anims.persist(persistMgr); @@ -1376,7 +1376,7 @@ TDirection AdActor::angleToDirection(int angle) { ////////////////////////////////////////////////////////////////////////// -int AdActor::getHeight() { +int32 AdActor::getHeight() { // if no current sprite is set, set some if (_currentSprite == nullptr) { if (_standSprite) { diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index e836dd72cf..863a055a4b 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.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. @@ -47,7 +47,7 @@ class AdActor : public AdTalkHolder { public: TDirection angleToDirection(int angle); DECLARE_PERSISTENT(AdActor, AdTalkHolder) - virtual int getHeight(); + virtual int32 getHeight() override; BaseSprite *getTalkStance(const char *stance); virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE); BasePoint *_targetPoint; diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 2c0e13a4dc..1bbadeb7f7 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.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. @@ -1067,7 +1067,7 @@ bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -int AdEntity::getHeight() { +int32 AdEntity::getHeight() { if (_region && !_sprite) { return _region->_rect.bottom - _region->_rect.top; } else { @@ -1092,16 +1092,16 @@ void AdEntity::updatePosition() { bool AdEntity::persist(BasePersistenceManager *persistMgr) { AdTalkHolder::persist(persistMgr); - persistMgr->transfer(TMEMBER(_item)); + persistMgr->transferCharPtr(TMEMBER(_item)); persistMgr->transferPtr(TMEMBER_PTR(_region)); //persistMgr->transfer(TMEMBER(_sprite)); - persistMgr->transfer(TMEMBER_INT(_subtype)); + persistMgr->transferSint32(TMEMBER_INT(_subtype)); _talkSprites.persist(persistMgr); _talkSpritesEx.persist(persistMgr); - persistMgr->transfer(TMEMBER(_walkToX)); - persistMgr->transfer(TMEMBER(_walkToY)); - persistMgr->transfer(TMEMBER_INT(_walkToDir)); + persistMgr->transferSint32(TMEMBER(_walkToX)); + persistMgr->transferSint32(TMEMBER(_walkToY)); + persistMgr->transferSint32(TMEMBER_INT(_walkToDir)); persistMgr->transferPtr(TMEMBER_PTR(_theora)); diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index c4d60e86f3..7e1525b7c1 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.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. @@ -40,7 +40,7 @@ public: void setItem(const char *itemName); DECLARE_PERSISTENT(AdEntity, AdTalkHolder) void updatePosition(); - virtual int getHeight(); + virtual int32 getHeight() override; BaseRegion *_region; virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override; virtual bool update(); diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index 86f470b8c3..3c4383f55e 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_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. @@ -1417,41 +1417,41 @@ bool AdGame::persist(BasePersistenceManager *persistMgr) { _objects.persist(persistMgr); - persistMgr->transfer(TMEMBER(_prevSceneName)); - persistMgr->transfer(TMEMBER(_prevSceneFilename)); + persistMgr->transferCharPtr(TMEMBER(_prevSceneName)); + persistMgr->transferCharPtr(TMEMBER(_prevSceneFilename)); persistMgr->transferPtr(TMEMBER_PTR(_responseBox)); _responsesBranch.persist(persistMgr); _responsesGame.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_scene)); _sceneStates.persist(persistMgr); - persistMgr->transfer(TMEMBER(_scheduledFadeIn)); - persistMgr->transfer(TMEMBER(_scheduledScene)); + persistMgr->transferBool(TMEMBER(_scheduledFadeIn)); + persistMgr->transferCharPtr(TMEMBER(_scheduledScene)); persistMgr->transferPtr(TMEMBER_PTR(_selectedItem)); - persistMgr->transfer(TMEMBER_INT(_talkSkipButton)); + persistMgr->transferSint32(TMEMBER_INT(_talkSkipButton)); _sentences.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_sceneViewport)); - persistMgr->transfer(TMEMBER_INT(_stateEx)); - persistMgr->transfer(TMEMBER(_initialScene)); - persistMgr->transfer(TMEMBER(_debugStartupScene)); + persistMgr->transferSint32(TMEMBER_INT(_stateEx)); + persistMgr->transferBool(TMEMBER(_initialScene)); + persistMgr->transferCharPtr(TMEMBER(_debugStartupScene)); persistMgr->transferPtr(TMEMBER_PTR(_invObject)); persistMgr->transferPtr(TMEMBER_PTR(_inventoryOwner)); - persistMgr->transfer(TMEMBER(_tempDisableSaveState)); + persistMgr->transferBool(TMEMBER(_tempDisableSaveState)); _items.persist(persistMgr); - persistMgr->transfer(TMEMBER(_itemsFile)); + persistMgr->transferCharPtr(TMEMBER(_itemsFile)); _speechDirs.persist(persistMgr); - persistMgr->transfer(TMEMBER(_smartItemCursor)); + persistMgr->transferBool(TMEMBER(_smartItemCursor)); if (!persistMgr->getIsSaving()) { _initialScene = false; } - persistMgr->transfer(TMEMBER(_startupScene)); + persistMgr->transferCharPtr(TMEMBER(_startupScene)); return STATUS_OK; @@ -2160,7 +2160,6 @@ bool AdGame::onMouseLeftDown() { _gameRef->_capturedObject = _gameRef->_activeObject; } _mouseLeftDown = true; - BasePlatform::setCapture(/*_renderer->_window*/); return STATUS_OK; } @@ -2171,7 +2170,6 @@ bool AdGame::onMouseLeftUp() { _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT); } - BasePlatform::releaseCapture(); _capturedObject = nullptr; _mouseLeftDown = false; diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 019f2e6478..ebb37e9a07 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_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. diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp index 544d8310d0..e385d233b6 100644 --- a/engines/wintermute/ad/ad_inventory.cpp +++ b/engines/wintermute/ad/ad_inventory.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. @@ -128,7 +128,7 @@ bool AdInventory::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); _takenItems.persist(persistMgr); - persistMgr->transfer(TMEMBER(_scrollOffset)); + persistMgr->transferSint32(TMEMBER(_scrollOffset)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h index 9de831b2a0..c2092bce56 100644 --- a/engines/wintermute/ad/ad_inventory.h +++ b/engines/wintermute/ad/ad_inventory.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/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 4c904e78eb..a2e54a3318 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.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. @@ -372,16 +372,16 @@ bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_closeButton)); - persistMgr->transfer(TMEMBER(_hideSelected)); - persistMgr->transfer(TMEMBER(_itemHeight)); - persistMgr->transfer(TMEMBER(_itemsArea)); - persistMgr->transfer(TMEMBER(_itemWidth)); - persistMgr->transfer(TMEMBER(_scrollBy)); - persistMgr->transfer(TMEMBER(_scrollOffset)); - persistMgr->transfer(TMEMBER(_spacing)); - persistMgr->transfer(TMEMBER(_visible)); + persistMgr->transferBool(TMEMBER(_hideSelected)); + persistMgr->transferSint32(TMEMBER(_itemHeight)); + persistMgr->transferRect32(TMEMBER(_itemsArea)); + persistMgr->transferSint32(TMEMBER(_itemWidth)); + persistMgr->transferSint32(TMEMBER(_scrollBy)); + persistMgr->transferSint32(TMEMBER(_scrollOffset)); + persistMgr->transferSint32(TMEMBER(_spacing)); + persistMgr->transferBool(TMEMBER(_visible)); persistMgr->transferPtr(TMEMBER_PTR(_window)); - persistMgr->transfer(TMEMBER(_exclusive)); + persistMgr->transferBool(TMEMBER(_exclusive)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_inventory_box.h b/engines/wintermute/ad/ad_inventory_box.h index 4d576625b2..4673f2e3f3 100644 --- a/engines/wintermute/ad/ad_inventory_box.h +++ b/engines/wintermute/ad/ad_inventory_box.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/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index f9741d1ed2..c7eda029cf 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.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. @@ -783,17 +783,17 @@ bool AdItem::persist(BasePersistenceManager *persistMgr) { AdTalkHolder::persist(persistMgr); - persistMgr->transfer(TMEMBER(_cursorCombined)); + persistMgr->transferBool(TMEMBER(_cursorCombined)); persistMgr->transferPtr(TMEMBER_PTR(_cursorHover)); persistMgr->transferPtr(TMEMBER_PTR(_cursorNormal)); persistMgr->transferPtr(TMEMBER_PTR(_spriteHover)); - persistMgr->transfer(TMEMBER(_inInventory)); - persistMgr->transfer(TMEMBER(_displayAmount)); - persistMgr->transfer(TMEMBER(_amount)); - persistMgr->transfer(TMEMBER(_amountOffsetX)); - persistMgr->transfer(TMEMBER(_amountOffsetY)); - persistMgr->transfer(TMEMBER_INT(_amountAlign)); - persistMgr->transfer(TMEMBER(_amountString)); + persistMgr->transferBool(TMEMBER(_inInventory)); + persistMgr->transferBool(TMEMBER(_displayAmount)); + persistMgr->transferSint32(TMEMBER(_amount)); + persistMgr->transferSint32(TMEMBER(_amountOffsetX)); + persistMgr->transferSint32(TMEMBER(_amountOffsetY)); + persistMgr->transferSint32(TMEMBER_INT(_amountAlign)); + persistMgr->transferCharPtr(TMEMBER(_amountString)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index 935ea5d73d..092a645019 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.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/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index 752700d0d4..f6ea339895 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.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. @@ -551,12 +551,12 @@ bool AdLayer::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_active)); - persistMgr->transfer(TMEMBER(_closeUp)); - persistMgr->transfer(TMEMBER(_height)); - persistMgr->transfer(TMEMBER(_main)); + persistMgr->transferBool(TMEMBER(_active)); + persistMgr->transferBool(TMEMBER(_closeUp)); + persistMgr->transferSint32(TMEMBER(_height)); + persistMgr->transferBool(TMEMBER(_main)); _nodes.persist(persistMgr); - persistMgr->transfer(TMEMBER(_width)); + persistMgr->transferSint32(TMEMBER(_width)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h index af7c3a364c..995ef28ee9 100644 --- a/engines/wintermute/ad/ad_layer.h +++ b/engines/wintermute/ad/ad_layer.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/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index 876c5a8bb4..c43604320b 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_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. @@ -95,13 +95,13 @@ void AdNodeState::setCursor(const char *filename) { bool AdNodeState::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); - persistMgr->transfer(TMEMBER(_active)); - persistMgr->transfer(TMEMBER(_name)); - persistMgr->transfer(TMEMBER(_filename)); - persistMgr->transfer(TMEMBER(_cursor)); - persistMgr->transfer(TMEMBER(_alphaColor)); + persistMgr->transferBool(TMEMBER(_active)); + persistMgr->transferCharPtr(TMEMBER(_name)); + persistMgr->transferCharPtr(TMEMBER(_filename)); + persistMgr->transferCharPtr(TMEMBER(_cursor)); + persistMgr->transferUint32(TMEMBER(_alphaColor)); for (int i = 0; i < 7; i++) { - persistMgr->transfer(TMEMBER(_caption[i])); + persistMgr->transferCharPtr(TMEMBER(_caption[i])); } return STATUS_OK; diff --git a/engines/wintermute/ad/ad_node_state.h b/engines/wintermute/ad/ad_node_state.h index 4b5b46ee60..cf897e9af3 100644 --- a/engines/wintermute/ad/ad_node_state.h +++ b/engines/wintermute/ad/ad_node_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/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 0d5011f92d..a93bd42bd0 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_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. @@ -859,7 +859,7 @@ bool AdObject::setFont(const char *filename) { ////////////////////////////////////////////////////////////////////////// -int AdObject::getHeight() { +int32 AdObject::getHeight() { if (!_currentSprite) { return 0; } else { @@ -1030,30 +1030,30 @@ bool AdObject::reset() { bool AdObject::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_active)); + persistMgr->transferBool(TMEMBER(_active)); persistMgr->transferPtr(TMEMBER_PTR(_blockRegion)); persistMgr->transferPtr(TMEMBER_PTR(_currentBlockRegion)); persistMgr->transferPtr(TMEMBER_PTR(_currentWptGroup)); persistMgr->transferPtr(TMEMBER_PTR(_currentSprite)); - persistMgr->transfer(TMEMBER(_drawn)); + persistMgr->transferBool(TMEMBER(_drawn)); persistMgr->transferPtr(TMEMBER_PTR(_font)); - persistMgr->transfer(TMEMBER(_ignoreItems)); - persistMgr->transfer(TMEMBER_INT(_nextState)); + persistMgr->transferBool(TMEMBER(_ignoreItems)); + persistMgr->transferSint32(TMEMBER_INT(_nextState)); persistMgr->transferPtr(TMEMBER_PTR(_sentence)); - persistMgr->transfer(TMEMBER_INT(_state)); + persistMgr->transferSint32(TMEMBER_INT(_state)); persistMgr->transferPtr(TMEMBER_PTR(_animSprite)); - persistMgr->transfer(TMEMBER(_sceneIndependent)); - persistMgr->transfer(TMEMBER(_forcedTalkAnimName)); - persistMgr->transfer(TMEMBER(_forcedTalkAnimUsed)); + persistMgr->transferBool(TMEMBER(_sceneIndependent)); + persistMgr->transferCharPtr(TMEMBER(_forcedTalkAnimName)); + persistMgr->transferBool(TMEMBER(_forcedTalkAnimUsed)); persistMgr->transferPtr(TMEMBER_PTR(_tempSprite2)); - persistMgr->transfer(TMEMBER_INT(_type)); + persistMgr->transferSint32(TMEMBER_INT(_type)); persistMgr->transferPtr(TMEMBER_PTR(_wptGroup)); persistMgr->transferPtr(TMEMBER_PTR(_stickRegion)); - persistMgr->transfer(TMEMBER(_subtitlesModRelative)); - persistMgr->transfer(TMEMBER(_subtitlesModX)); - persistMgr->transfer(TMEMBER(_subtitlesModY)); - persistMgr->transfer(TMEMBER(_subtitlesModXCenter)); - persistMgr->transfer(TMEMBER(_subtitlesWidth)); + persistMgr->transferBool(TMEMBER(_subtitlesModRelative)); + persistMgr->transferSint32(TMEMBER(_subtitlesModX)); + persistMgr->transferSint32(TMEMBER(_subtitlesModY)); + persistMgr->transferBool(TMEMBER(_subtitlesModXCenter)); + persistMgr->transferSint32(TMEMBER(_subtitlesWidth)); persistMgr->transferPtr(TMEMBER_PTR(_inventory)); persistMgr->transferPtr(TMEMBER_PTR(_partEmitter)); @@ -1065,9 +1065,9 @@ bool AdObject::persist(BasePersistenceManager *persistMgr) { _attachmentsPost.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_registerAlias)); - persistMgr->transfer(TMEMBER(_partFollowParent)); - persistMgr->transfer(TMEMBER(_partOffsetX)); - persistMgr->transfer(TMEMBER(_partOffsetY)); + persistMgr->transferBool(TMEMBER(_partFollowParent)); + persistMgr->transferSint32(TMEMBER(_partOffsetX)); + persistMgr->transferSint32(TMEMBER(_partOffsetY)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index 9e30f69855..35a734cd83 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_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. @@ -61,7 +61,7 @@ public: bool reset(); DECLARE_PERSISTENT(AdObject, BaseObject) virtual void talk(const char *text, const char *sound = nullptr, uint32 duration = 0, const char *stances = nullptr, TTextAlign align = TAL_CENTER); - virtual int getHeight() override; + virtual int32 getHeight() override; bool setFont(const char *filename); virtual bool update() override; diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp index 91a24cbf7d..4d5c313e52 100644 --- a/engines/wintermute/ad/ad_path.cpp +++ b/engines/wintermute/ad/ad_path.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. @@ -110,9 +110,9 @@ bool AdPath::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); - persistMgr->transfer(TMEMBER(_currIndex)); + persistMgr->transferSint32(TMEMBER(_currIndex)); _points.persist(persistMgr); - persistMgr->transfer(TMEMBER(_ready)); + persistMgr->transferBool(TMEMBER(_ready)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_path.h b/engines/wintermute/ad/ad_path.h index 9de0bcad2c..8dbec5e4f0 100644 --- a/engines/wintermute/ad/ad_path.h +++ b/engines/wintermute/ad/ad_path.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/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp index d5108ad8c1..6e20554034 100644 --- a/engines/wintermute/ad/ad_path_point.cpp +++ b/engines/wintermute/ad/ad_path_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. @@ -65,8 +65,8 @@ bool AdPathPoint::persist(BasePersistenceManager *persistMgr) { BasePoint::persist(persistMgr); - persistMgr->transfer(TMEMBER(_distance)); - persistMgr->transfer(TMEMBER(_marked)); + persistMgr->transferSint32(TMEMBER(_distance)); + persistMgr->transferBool(TMEMBER(_marked)); persistMgr->transferPtr(TMEMBER_PTR(_origin)); return STATUS_OK; diff --git a/engines/wintermute/ad/ad_path_point.h b/engines/wintermute/ad/ad_path_point.h index 5e6b8c61ea..c375946f32 100644 --- a/engines/wintermute/ad/ad_path_point.h +++ b/engines/wintermute/ad/ad_path_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/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index 1c0cf41e86..89ad09fb8f 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_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. @@ -401,9 +401,9 @@ bool AdRegion::saveAsText(BaseDynamicBuffer *buffer, int indent) { bool AdRegion::persist(BasePersistenceManager *persistMgr) { BaseRegion::persist(persistMgr); - persistMgr->transfer(TMEMBER(_alpha)); - persistMgr->transfer(TMEMBER(_blocked)); - persistMgr->transfer(TMEMBER(_decoration)); + persistMgr->transferUint32(TMEMBER(_alpha)); + persistMgr->transferBool(TMEMBER(_blocked)); + persistMgr->transferBool(TMEMBER(_decoration)); persistMgr->transferFloat(TMEMBER(_zoom)); return STATUS_OK; diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index f3674dcbfb..2b5e468901 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_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/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index fa05224b06..6ebe70bedb 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.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. @@ -134,10 +134,10 @@ bool AdResponse::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_icon)); persistMgr->transferPtr(TMEMBER_PTR(_iconHover)); persistMgr->transferPtr(TMEMBER_PTR(_iconPressed)); - persistMgr->transfer(TMEMBER(_iD)); - persistMgr->transfer(TMEMBER(_text)); - persistMgr->transfer(TMEMBER(_textOrig)); - persistMgr->transfer(TMEMBER_INT(_responseType)); + persistMgr->transferSint32(TMEMBER(_iD)); + persistMgr->transferCharPtr(TMEMBER(_text)); + persistMgr->transferCharPtr(TMEMBER(_textOrig)); + persistMgr->transferSint32(TMEMBER_INT(_responseType)); persistMgr->transferPtr(TMEMBER_PTR(_font)); return STATUS_OK; diff --git a/engines/wintermute/ad/ad_response.h b/engines/wintermute/ad/ad_response.h index 00ebafbdb0..22aac01ff2 100644 --- a/engines/wintermute/ad/ad_response.h +++ b/engines/wintermute/ad/ad_response.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/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index 2a5adb9234..83c2ae74c6 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.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,7 +58,7 @@ AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) { _shieldWindow = new UIWindow(_gameRef); _horizontal = false; - BasePlatform::setRectEmpty(&_responseArea); + _responseArea.setEmpty(); _scrollOffset = 0; _spacing = 0; @@ -583,20 +583,20 @@ bool AdResponseBox::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_font)); persistMgr->transferPtr(TMEMBER_PTR(_fontHover)); - persistMgr->transfer(TMEMBER(_horizontal)); - persistMgr->transfer(TMEMBER(_lastResponseText)); - persistMgr->transfer(TMEMBER(_lastResponseTextOrig)); + persistMgr->transferBool(TMEMBER(_horizontal)); + persistMgr->transferCharPtr(TMEMBER(_lastResponseText)); + persistMgr->transferCharPtr(TMEMBER(_lastResponseTextOrig)); _respButtons.persist(persistMgr); - persistMgr->transfer(TMEMBER(_responseArea)); + persistMgr->transferRect32(TMEMBER(_responseArea)); _responses.persist(persistMgr); - persistMgr->transfer(TMEMBER(_scrollOffset)); + persistMgr->transferSint32(TMEMBER(_scrollOffset)); persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow)); - persistMgr->transfer(TMEMBER(_spacing)); + persistMgr->transferSint32(TMEMBER(_spacing)); persistMgr->transferPtr(TMEMBER_PTR(_waitingScript)); persistMgr->transferPtr(TMEMBER_PTR(_window)); - persistMgr->transfer(TMEMBER_INT(_verticalAlign)); - persistMgr->transfer(TMEMBER_INT(_align)); + persistMgr->transferSint32(TMEMBER_INT(_verticalAlign)); + persistMgr->transferSint32(TMEMBER_INT(_align)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h index 9469bfda43..c808a7b5db 100644 --- a/engines/wintermute/ad/ad_response_box.h +++ b/engines/wintermute/ad/ad_response_box.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/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp index 0b58f5ba0c..6d7d8d50a4 100644 --- a/engines/wintermute/ad/ad_response_context.cpp +++ b/engines/wintermute/ad/ad_response_context.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. @@ -50,8 +50,8 @@ AdResponseContext::~AdResponseContext() { ////////////////////////////////////////////////////////////////////////// bool AdResponseContext::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); - persistMgr->transfer(TMEMBER(_context)); - persistMgr->transfer(TMEMBER(_id)); + persistMgr->transferCharPtr(TMEMBER(_context)); + persistMgr->transferSint32(TMEMBER(_id)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_response_context.h b/engines/wintermute/ad/ad_response_context.h index bc30b4a1c9..385ec2ded5 100644 --- a/engines/wintermute/ad/ad_response_context.h +++ b/engines/wintermute/ad/ad_response_context.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/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index b5bdc8ebe9..410ba22b53 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.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/ad/ad_rot_level.h b/engines/wintermute/ad/ad_rot_level.h index 47c621845a..f60dd0a5a9 100644 --- a/engines/wintermute/ad/ad_rot_level.h +++ b/engines/wintermute/ad/ad_rot_level.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/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index aa7f6f89cf..7e2eaa6f4f 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.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/ad/ad_scale_level.h b/engines/wintermute/ad/ad_scale_level.h index 768e79bbf7..4d6a83561f 100644 --- a/engines/wintermute/ad/ad_scale_level.h +++ b/engines/wintermute/ad/ad_scale_level.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/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index bc8d9e96d2..02a6aeb801 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.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. @@ -2041,6 +2041,10 @@ bool AdScene::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ScrollSpeedX") == 0) { _scrollTimeH = value->getInt(); + if (_scrollTimeH == 0) { + warning("_scrollTimeH can't be 0, resetting to default"); + _scrollTimeH = 10; + } return STATUS_OK; } @@ -2049,6 +2053,10 @@ bool AdScene::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ScrollSpeedY") == 0) { _scrollTimeV = value->getInt(); + if (_scrollTimeV == 0) { + warning("_scrollTimeV can't be 0, resetting to default"); + _scrollTimeV = 10; + } return STATUS_OK; } @@ -2300,58 +2308,58 @@ float AdScene::getScaleAt(int Y) { bool AdScene::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_autoScroll)); - persistMgr->transfer(TMEMBER(_editorColBlocked)); - persistMgr->transfer(TMEMBER(_editorColBlockedSel)); - persistMgr->transfer(TMEMBER(_editorColDecor)); - persistMgr->transfer(TMEMBER(_editorColDecorSel)); - persistMgr->transfer(TMEMBER(_editorColEntity)); - persistMgr->transfer(TMEMBER(_editorColEntitySel)); - persistMgr->transfer(TMEMBER(_editorColFrame)); - persistMgr->transfer(TMEMBER(_editorColRegion)); - persistMgr->transfer(TMEMBER(_editorColRegionSel)); - persistMgr->transfer(TMEMBER(_editorColScale)); - persistMgr->transfer(TMEMBER(_editorColWaypoints)); - persistMgr->transfer(TMEMBER(_editorColWaypointsSel)); - persistMgr->transfer(TMEMBER(_editorMarginH)); - persistMgr->transfer(TMEMBER(_editorMarginV)); - persistMgr->transfer(TMEMBER(_editorShowBlocked)); - persistMgr->transfer(TMEMBER(_editorShowDecor)); - persistMgr->transfer(TMEMBER(_editorShowEntities)); - persistMgr->transfer(TMEMBER(_editorShowRegions)); - persistMgr->transfer(TMEMBER(_editorShowScale)); + persistMgr->transferBool(TMEMBER(_autoScroll)); + persistMgr->transferUint32(TMEMBER(_editorColBlocked)); + persistMgr->transferUint32(TMEMBER(_editorColBlockedSel)); + persistMgr->transferUint32(TMEMBER(_editorColDecor)); + persistMgr->transferUint32(TMEMBER(_editorColDecorSel)); + persistMgr->transferUint32(TMEMBER(_editorColEntity)); + persistMgr->transferUint32(TMEMBER(_editorColEntitySel)); + persistMgr->transferUint32(TMEMBER(_editorColFrame)); + persistMgr->transferUint32(TMEMBER(_editorColRegion)); + persistMgr->transferUint32(TMEMBER(_editorColRegionSel)); + persistMgr->transferUint32(TMEMBER(_editorColScale)); + persistMgr->transferUint32(TMEMBER(_editorColWaypoints)); + persistMgr->transferUint32(TMEMBER(_editorColWaypointsSel)); + persistMgr->transferSint32(TMEMBER(_editorMarginH)); + persistMgr->transferSint32(TMEMBER(_editorMarginV)); + persistMgr->transferBool(TMEMBER(_editorShowBlocked)); + persistMgr->transferBool(TMEMBER(_editorShowDecor)); + persistMgr->transferBool(TMEMBER(_editorShowEntities)); + persistMgr->transferBool(TMEMBER(_editorShowRegions)); + persistMgr->transferBool(TMEMBER(_editorShowScale)); persistMgr->transferPtr(TMEMBER_PTR(_fader)); - persistMgr->transfer(TMEMBER(_height)); - persistMgr->transfer(TMEMBER(_initialized)); - persistMgr->transfer(TMEMBER(_lastTimeH)); - persistMgr->transfer(TMEMBER(_lastTimeV)); + persistMgr->transferSint32(TMEMBER(_height)); + persistMgr->transferBool(TMEMBER(_initialized)); + persistMgr->transferUint32(TMEMBER(_lastTimeH)); + persistMgr->transferUint32(TMEMBER(_lastTimeV)); _layers.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_mainLayer)); _objects.persist(persistMgr); - persistMgr->transfer(TMEMBER(_offsetLeft)); - persistMgr->transfer(TMEMBER(_offsetTop)); - persistMgr->transfer(TMEMBER(_paralaxScrolling)); - persistMgr->transfer(TMEMBER(_persistentState)); - persistMgr->transfer(TMEMBER(_persistentStateSprites)); - persistMgr->transfer(TMEMBER(_pfMaxTime)); + persistMgr->transferSint32(TMEMBER(_offsetLeft)); + persistMgr->transferSint32(TMEMBER(_offsetTop)); + persistMgr->transferBool(TMEMBER(_paralaxScrolling)); + persistMgr->transferBool(TMEMBER(_persistentState)); + persistMgr->transferBool(TMEMBER(_persistentStateSprites)); + persistMgr->transferUint32(TMEMBER(_pfMaxTime)); _pfPath.persist(persistMgr); - persistMgr->transfer(TMEMBER(_pfPointsNum)); - persistMgr->transfer(TMEMBER(_pfReady)); + persistMgr->transferSint32(TMEMBER(_pfPointsNum)); + persistMgr->transferBool(TMEMBER(_pfReady)); persistMgr->transferPtr(TMEMBER_PTR(_pfRequester)); persistMgr->transferPtr(TMEMBER_PTR(_pfTarget)); persistMgr->transferPtr(TMEMBER_PTR(_pfTargetPath)); _rotLevels.persist(persistMgr); _scaleLevels.persist(persistMgr); - persistMgr->transfer(TMEMBER(_scrollPixelsH)); - persistMgr->transfer(TMEMBER(_scrollPixelsV)); - persistMgr->transfer(TMEMBER(_scrollTimeH)); - persistMgr->transfer(TMEMBER(_scrollTimeV)); + persistMgr->transferSint32(TMEMBER(_scrollPixelsH)); + persistMgr->transferSint32(TMEMBER(_scrollPixelsV)); + persistMgr->transferUint32(TMEMBER(_scrollTimeH)); + persistMgr->transferUint32(TMEMBER(_scrollTimeV)); persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow)); - persistMgr->transfer(TMEMBER(_targetOffsetLeft)); - persistMgr->transfer(TMEMBER(_targetOffsetTop)); + persistMgr->transferSint32(TMEMBER(_targetOffsetLeft)); + persistMgr->transferSint32(TMEMBER(_targetOffsetTop)); _waypointGroups.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_viewport)); - persistMgr->transfer(TMEMBER(_width)); + persistMgr->transferSint32(TMEMBER(_width)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index 1f35a776b5..1ca52bdda9 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.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/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp index 8548da91db..e5d23d5f2a 100644 --- a/engines/wintermute/ad/ad_scene_node.cpp +++ b/engines/wintermute/ad/ad_scene_node.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. @@ -74,7 +74,7 @@ bool AdSceneNode::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_entity)); persistMgr->transferPtr(TMEMBER_PTR(_region)); - persistMgr->transfer(TMEMBER_INT(_type)); + persistMgr->transferSint32(TMEMBER_INT(_type)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_scene_node.h b/engines/wintermute/ad/ad_scene_node.h index 5bb1606d0e..34b59cd587 100644 --- a/engines/wintermute/ad/ad_scene_node.h +++ b/engines/wintermute/ad/ad_scene_node.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/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index 58cb5f514a..d7c863792d 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_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. @@ -56,7 +56,7 @@ AdSceneState::~AdSceneState() { ////////////////////////////////////////////////////////////////////////// bool AdSceneState::persist(BasePersistenceManager *persistMgr) { - persistMgr->transfer(TMEMBER(_filename)); + persistMgr->transferCharPtr(TMEMBER(_filename)); _nodeStates.persist(persistMgr); return STATUS_OK; diff --git a/engines/wintermute/ad/ad_scene_state.h b/engines/wintermute/ad/ad_scene_state.h index 067c737b2e..90e39f3d51 100644 --- a/engines/wintermute/ad/ad_scene_state.h +++ b/engines/wintermute/ad/ad_scene_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/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index d5baa8291f..86ae06ad06 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.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. @@ -249,23 +249,23 @@ bool AdSentence::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); - persistMgr->transfer(TMEMBER_INT(_align)); - persistMgr->transfer(TMEMBER(_currentStance)); + persistMgr->transferSint32(TMEMBER_INT(_align)); + persistMgr->transferSint32(TMEMBER(_currentStance)); persistMgr->transferPtr(TMEMBER_PTR(_currentSprite)); - persistMgr->transfer(TMEMBER(_currentSkelAnim)); - persistMgr->transfer(TMEMBER(_duration)); + persistMgr->transferCharPtr(TMEMBER(_currentSkelAnim)); + persistMgr->transferUint32(TMEMBER(_duration)); persistMgr->transferPtr(TMEMBER_PTR(_font)); - persistMgr->transfer(TMEMBER(_pos)); + persistMgr->transferPoint32(TMEMBER(_pos)); persistMgr->transferPtr(TMEMBER_PTR(_sound)); - persistMgr->transfer(TMEMBER(_soundStarted)); - persistMgr->transfer(TMEMBER(_stances)); - persistMgr->transfer(TMEMBER(_startTime)); + persistMgr->transferBool(TMEMBER(_soundStarted)); + persistMgr->transferCharPtr(TMEMBER(_stances)); + persistMgr->transferUint32(TMEMBER(_startTime)); persistMgr->transferPtr(TMEMBER_PTR(_talkDef)); - persistMgr->transfer(TMEMBER(_tempStance)); - persistMgr->transfer(TMEMBER(_text)); - persistMgr->transfer(TMEMBER(_width)); - persistMgr->transfer(TMEMBER(_fixedPos)); - persistMgr->transfer(TMEMBER(_freezable)); + persistMgr->transferCharPtr(TMEMBER(_tempStance)); + persistMgr->transferCharPtr(TMEMBER(_text)); + persistMgr->transferSint32(TMEMBER(_width)); + persistMgr->transferBool(TMEMBER(_fixedPos)); + persistMgr->transferBool(TMEMBER(_freezable)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_sentence.h b/engines/wintermute/ad/ad_sentence.h index c491ad99a2..7d187786d4 100644 --- a/engines/wintermute/ad/ad_sentence.h +++ b/engines/wintermute/ad/ad_sentence.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/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index dd920492de..e598913ae6 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.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/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h index ece71f7adb..8590970126 100644 --- a/engines/wintermute/ad/ad_sprite_set.h +++ b/engines/wintermute/ad/ad_sprite_set.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/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index 1fdeed418f..6194121727 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.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. @@ -209,9 +209,9 @@ bool AdTalkDef::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_defaultSprite)); - persistMgr->transfer(TMEMBER(_defaultSpriteFilename)); + persistMgr->transferCharPtr(TMEMBER(_defaultSpriteFilename)); persistMgr->transferPtr(TMEMBER_PTR(_defaultSpriteSet)); - persistMgr->transfer(TMEMBER(_defaultSpriteSetFilename)); + persistMgr->transferCharPtr(TMEMBER(_defaultSpriteSetFilename)); _nodes.persist(persistMgr); diff --git a/engines/wintermute/ad/ad_talk_def.h b/engines/wintermute/ad/ad_talk_def.h index 5711906b4b..a19c504955 100644 --- a/engines/wintermute/ad/ad_talk_def.h +++ b/engines/wintermute/ad/ad_talk_def.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/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 6041105b93..116d3edd21 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_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. diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h index ab48c3aaf4..b5f8f48318 100644 --- a/engines/wintermute/ad/ad_talk_holder.h +++ b/engines/wintermute/ad/ad_talk_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/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index eca4535288..f4612122da 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.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. @@ -191,14 +191,14 @@ bool AdTalkNode::loadBuffer(char *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// bool AdTalkNode::persist(BasePersistenceManager *persistMgr) { - persistMgr->transfer(TMEMBER(_comment)); - persistMgr->transfer(TMEMBER(_startTime)); - persistMgr->transfer(TMEMBER(_endTime)); - persistMgr->transfer(TMEMBER(_playToEnd)); + persistMgr->transferCharPtr(TMEMBER(_comment)); + persistMgr->transferUint32(TMEMBER(_startTime)); + persistMgr->transferUint32(TMEMBER(_endTime)); + persistMgr->transferBool(TMEMBER(_playToEnd)); persistMgr->transferPtr(TMEMBER_PTR(_sprite)); - persistMgr->transfer(TMEMBER(_spriteFilename)); + persistMgr->transferCharPtr(TMEMBER(_spriteFilename)); persistMgr->transferPtr(TMEMBER_PTR(_spriteSet)); - persistMgr->transfer(TMEMBER(_spriteSetFilename)); + persistMgr->transferCharPtr(TMEMBER(_spriteSetFilename)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_talk_node.h b/engines/wintermute/ad/ad_talk_node.h index 7a014b2d9f..e619edf7c2 100644 --- a/engines/wintermute/ad/ad_talk_node.h +++ b/engines/wintermute/ad/ad_talk_node.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/ad/ad_types.h b/engines/wintermute/ad/ad_types.h index dc1a54b91d..931e38974c 100644 --- a/engines/wintermute/ad/ad_types.h +++ b/engines/wintermute/ad/ad_types.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/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index f7735a4d9b..25d7f83264 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.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. @@ -194,11 +194,11 @@ bool AdWaypointGroup::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; diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h index 47fd611be6..32d5e9b764 100644 --- a/engines/wintermute/ad/ad_waypoint_group.h +++ b/engines/wintermute/ad/ad_waypoint_group.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.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, ¶ms)) > 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. diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h index a3df92d6c8..74e266168f 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.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. @@ -67,7 +67,7 @@ class BaseArray : public BaseArrayBase<TYPE> { int32 j; if (persistMgr->getIsSaving()) { j = Common::Array<TYPE>::size(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); typename Common::Array<TYPE>::const_iterator it = Common::Array<TYPE>::begin(); for (; it != Common::Array<TYPE>::end(); ++it) { TYPE obj = *it; @@ -75,7 +75,7 @@ class BaseArray : public BaseArrayBase<TYPE> { } } else { Common::Array<TYPE>::clear(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); for (int i = 0; i < j; i++) { TYPE obj = nullptr; persistMgr->transferPtr("", &obj); @@ -93,18 +93,18 @@ class BaseArray<char *> : public BaseArrayBase<char *> { int32 j; if (persistMgr->getIsSaving()) { j = Common::Array<char *>::size(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); Common::Array<char *>::const_iterator it = Common::Array<char *>::begin(); for (; it != Common::Array<char *>::end(); ++it) { char * obj = *it; - persistMgr->transfer("", &obj); + persistMgr->transferCharPtr("", &obj); } } else { Common::Array<char *>::clear(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); for (int i = 0; i < j; i++) { char * obj = nullptr; - persistMgr->transfer("", &obj); + persistMgr->transferCharPtr("", &obj); add(obj); } } @@ -119,18 +119,18 @@ public: int32 j; if (persistMgr->getIsSaving()) { j = Common::Array<const char *>::size(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); Common::Array<const char *>::const_iterator it = Common::Array<const char *>::begin(); for (; it != Common::Array<const char *>::end(); ++it) { const char * obj = *it; - persistMgr->transfer("", &obj); + persistMgr->transferConstChar("", &obj); } } else { Common::Array<const char *>::clear(); - persistMgr->transfer("ArraySize", &j); + persistMgr->transferSint32("ArraySize", &j); for (int i = 0; i < j; i++) { const char * obj = nullptr; - persistMgr->transfer("", &obj); + persistMgr->transferConstChar("", &obj); add(obj); } } diff --git a/engines/wintermute/configure.engine b/engines/wintermute/configure.engine new file mode 100644 index 0000000000..bdaf49de3f --- /dev/null +++ b/engines/wintermute/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine wintermute "Wintermute" yes "" "" "jpeg png zlib vorbis 16bit" diff --git a/engines/wintermute/dcgf.h b/engines/wintermute/dcgf.h index 3db443965e..78503b8c3b 100644 --- a/engines/wintermute/dcgf.h +++ b/engines/wintermute/dcgf.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/dctypes.h b/engines/wintermute/dctypes.h index b40322147f..33e1cc4018 100644 --- a/engines/wintermute/dctypes.h +++ b/engines/wintermute/dctypes.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,6 +31,7 @@ #include "common/str.h" +#include "common/ustr.h" #include "common/list.h" #include "common/array.h" @@ -41,7 +42,7 @@ namespace Wintermute { //typedef std::wstring WideString; typedef Common::String AnsiString; typedef Common::String Utf8String; -typedef Common::String WideString; // NB: Not actually true I presume. +typedef Common::U32String WideString; typedef Common::List<WideString> WideStringList; typedef Common::List<AnsiString> AnsiStringList; diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp index 8c8b8255ab..a313314a8b 100644 --- a/engines/wintermute/debugger.cpp +++ b/engines/wintermute/debugger.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,8 +29,8 @@ namespace Wintermute { Console::Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) { - DCmd_Register("show_fps", WRAP_METHOD(Console, Cmd_ShowFps)); - DCmd_Register("dump_file", WRAP_METHOD(Console, Cmd_DumpFile)); + registerCmd("show_fps", WRAP_METHOD(Console, Cmd_ShowFps)); + registerCmd("dump_file", WRAP_METHOD(Console, Cmd_DumpFile)); } Console::~Console(void) { @@ -50,7 +50,7 @@ bool Console::Cmd_ShowFps(int argc, const char **argv) { bool Console::Cmd_DumpFile(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Usage: %s <file path> <output file name>\n", argv[0]); + debugPrintf("Usage: %s <file path> <output file name>\n", argv[0]); return true; } @@ -60,7 +60,7 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) { BaseFileManager *fileManager = BaseEngine::instance().getFileManager(); Common::SeekableReadStream *inFile = fileManager->openFile(filePath); if (!inFile) { - DebugPrintf("File '%s' not found\n", argv[1]); + debugPrintf("File '%s' not found\n", argv[1]); return true; } @@ -77,7 +77,7 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) { delete outFile; delete inFile; - DebugPrintf("Resource file '%s' dumped to file '%s'\n", argv[1], argv[2]); + debugPrintf("Resource file '%s' dumped to file '%s'\n", argv[1], argv[2]); return true; } diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h index 6fbbb084f0..625da0ce41 100644 --- a/engines/wintermute/debugger.h +++ b/engines/wintermute/debugger.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/detection.cpp b/engines/wintermute/detection.cpp index ac21d78ef5..a659c434d0 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.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. @@ -68,6 +68,7 @@ static char s_fallbackGameIdBuf[256]; static const char *directoryGlobs[] = { "language", // To detect the various languages + "languages", // To detect the various languages 0 }; @@ -106,11 +107,11 @@ public: } } // Prefix to avoid collisions with actually known games - name = "wmefan-" + name; + name = "wmeunk-" + name; Common::strlcpy(s_fallbackGameIdBuf, name.c_str(), sizeof(s_fallbackGameIdBuf) - 1); s_fallbackDesc.gameid = s_fallbackGameIdBuf; if (caption != name) { - caption += " (fangame) "; + caption += " (unknown version) "; char *offset = s_fallbackGameIdBuf + name.size() + 1; uint32 remainingLength = (sizeof(s_fallbackGameIdBuf) - 1) - (name.size() + 1); Common::strlcpy(offset, caption.c_str(), remainingLength); @@ -184,7 +185,7 @@ public: } // End of namespace Wintermute #if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE) -REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); + REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); #else -REGISTER_PLUGIN_STATIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); + REGISTER_PLUGIN_STATIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); #endif diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 63f5078c12..6087e60ece 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.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. @@ -27,8 +27,11 @@ namespace Wintermute { static const PlainGameDescriptor wintermuteGames[] = { {"5ld", "Five Lethal Demons"}, {"5ma", "Five Magical Amulets"}, - {"bthreshold", "Beyond the Threshold"}, {"actualdest", "Actual Destination"}, + {"agustin", "Boredom of Agustin Cordes"}, + {"bickadoodle", "Bickadoodle"}, + {"bookofgron", "Book of Gron Part One"}, + {"bthreshold", "Beyond the Threshold"}, {"carolreed4", "Carol Reed 4 - East Side Story"}, {"carolreed5", "Carol Reed 5 - The Colour of Murder"}, {"carolreed6", "Carol Reed 6 - Black Circle"}, @@ -36,29 +39,45 @@ static const PlainGameDescriptor wintermuteGames[] = { {"carolreed8", "Carol Reed 8 - Amber's Blood"}, {"carolreed9", "Carol Reed 9 - Cold Case Summer"}, {"chivalry", "Chivalry is Not Dead"}, + {"corrosion", "Corrosion: Cold Winter Waiting"}, {"deadcity", "Dead City"}, {"dreaming", "Des Reves Elastiques Avec Mille Insectes Nommes Georges"}, {"dirtysplit", "Dirty Split"}, {"dreamscape", "Dreamscape"}, {"escapemansion", "Escape from the Mansion"}, + {"framed", "Framed"}, {"ghostsheet", "Ghost in the Sheet"}, {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, + {"helga", "Helga Deep In Trouble"}, {"jamesperis", "James Peris: No License Nor Control"}, + {"kulivocko", "Kulivocko"}, + {"lonelyrobot", "Project Lonely Robot"}, {"looky", "Looky"}, {"julia", "J.U.L.I.A."}, {"mirage", "Mirage"}, + {"oknytt", "Oknytt"}, + {"paintaria", "Paintaria"}, {"pigeons", "Pigeons in the Park"}, + {"projectdoom", "Project: Doom"}, {"reversion1", "Reversion: The Escape"}, {"reversion2", "Reversion: The Meeting"}, + {"rhiannon", "Rhiannon: Curse of the four Branches"}, + {"ritter", "1 1/2 Ritter: Auf der Suche nach der hinreissenden Herzelinde"}, {"rosemary", "Rosemary"}, + {"securanote", "Securanote"}, {"shaban", "Shaban"}, {"shinestar", "The Shine of a Star"}, + {"spaceinvaders", "Space Invaders"}, {"spacemadness", "Space Madness"}, {"thebox", "The Box"}, + {"thekite", "The Kite"}, {"tib", "Fairy Tales About Toshechka and Boshechka"}, {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, + {"vsevolod", "Vsevolod"}, {"wintermute", "Wintermute engine game"}, + {"wtetris", "Wilma Tetris"}, + {"zilm", "Zilm: A Game of Reflex"}, {0, 0} }; @@ -93,6 +112,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Boredom of Agustin Cordes + { + "agustin", + "", + AD_ENTRY1s("data.dcp", "abb79c16c9b92e9b06525a4c7c3f5861", 2461949), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Beyond the Threshold { "bthreshold", @@ -103,6 +132,46 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Bickadoodle + { + "bickadoodle", + "", + AD_ENTRY1s("data.dcp", "84db4d1594cac95e25614985775d10a8", 35303844), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Bickadoodle (Ver 1.1) + { + "bickadoodle", + "Version 1.1", + AD_ENTRY1s("data.dcp", "8bb52ac9a9ee129c5059e8e808b669d7", 35337760), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Bickadoodle (download from http://aethericgames.com/games/bickadoodle/download-bickadoodle/) + { + "bickadoodle", + "", + AD_ENTRY1s("data.dcp", "1584d83577c32add0fce27fae91141a2", 35337728), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Book of Gron Part One + { + "bookofgron", + "", + AD_ENTRY1s("data.dcp", "e61b2ebee044a82fa0f8ca0fce2c8946", 83129531), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Carol Reed 4 - East Side Story (Demo) { "carolreed4", @@ -206,6 +275,32 @@ static const ADGameDescription gameDescriptions[] = { ADGF_TESTING, GUIO0() }, + // Corrosion: Cold Winter Waiting + { + "corrosion", + "", + AD_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_TESTING, + GUIO0() + }, + // Dead City (Czech) + { + "deadcity", + "", + { + // The Czech data are in data.dcp, so in this case we'll have to + // just detect the english version twice, to give the user a choice. + {"english.dcp", 0, "c591046d6de7e381d76f70e0787b2b1f", 415935}, + {"data.dcp", 0, "7ebfd50d1a22370ed7b079bcaa631d62", 9070205}, + AD_LISTEND + }, + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dead City (English) { "deadcity", @@ -248,6 +343,19 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Czech) + { + "dirtysplit", + "", + { + {"czech.dcp", 0, "08a71446467cf8f9444cfea446b46ad6", 127697934}, + {"data.dcp", 0, "8b4b81b718bf65f30a67fc0b1e329eb5", 88577623}, + }, + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (English) { "dirtysplit", @@ -258,6 +366,20 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (French) + { + "dirtysplit", + "", + { + {"french.dcp", 0, "a0508dedebd0fe478d0158fa4c2a1136", 125534323}, + {"data.dcp", 0, "e6d70c7f5d181b761cfcf974adf9186a", 88577623}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (German) { "dirtysplit", @@ -268,6 +390,32 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Italian) + { + "dirtysplit", + "", + { + {"italian.dcp", 0, "8108807fbd8af70be1ec452d0fd1131b", 125513726}, + {"data.dcp", 0, "35a150e22af274185883fdbb142c6fb1", 88577623}, + }, + Common::IT_ITA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Dirty Split (Spanish) + { + "dirtysplit", + "", + { + {"spanish.dcp", 0, "b3982c0a5e85b42e1e38240fef004aa4", 164428596}, + {"data.dcp", 0, "63766d6c68b9f00b632ea1736fc8a95c", 88577621}, + }, + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Des Reves Elastiques Avec Mille Insectes Nommes Georges { "dreaming", @@ -308,7 +456,41 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, - // Ghosts in the Sheet + // Escape from the Mansion + { + "escapemansion", + "1.3", + AD_ENTRY1s("data.dcp", "1e5d231b56c8a228cd15cb690f50253e", 29261972), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Framed + { + "framed", + "", + AD_ENTRY1s("data.dcp", "e7259fb36f2c6f9f28242291e0c3de98", 34690568), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Ghost in the Sheet + { + "ghostsheet", + "", + { + {"english.dcp", 0, "e6d0aad2c89996bcabe416105a3d6d3a", 12221017}, + {"data.dcp", 0, "b2f8b05328e4881e15e98e845b63f451", 168003}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Ghost in the Sheet (Demo) { "ghostsheet", "Demo", @@ -329,6 +511,35 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Helga Deep In Trouble (English) + { + "helga", + "", + { + {"english.dcp", 0, "bfa136b21bdbc7d8691c0770a6d40bc3", 135931}, + {"data.dcp", 0, "25cb955a60b58326f2eeda1ce288fb37", 183251259}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Helga Deep In Trouble (Demo) (English) + { + "helga", + "Demo", + { + {"english.dcp", 0, "b3a93e678f0ef97200f691cd1724643f", 135864}, + {"data.dcp", 0, "45134ed93bc391edf148b79cdcbf2a09", 154266028}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // James Peris: No License Nor Control (English) { "jamesperis", @@ -381,6 +592,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // J.U.L.I.A. (English, Bundle in a box-version) + { + "julia", + "Version 1.2", + AD_ENTRY1s("data.dcp", "fe90023ccc22f35185b40b910e0d03a2", 10101373), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // J.U.L.I.A. (English) (Demo) { "julia", @@ -403,6 +624,27 @@ static const ADGameDescription gameDescriptions[] = { ADGF_DEMO, GUIO0() }, + // Kulivocko (Czech) + { + "kulivocko", + "", + AD_ENTRY1s("data.dcp", "44306dc470e9b27474043932eccee02f", 155106392), + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Kulivocko (Czech) (Demo) + { + "kulivocko", + "Demo", + AD_ENTRY1s("data.dcp", "63b164bdfadecbb0deb5da691afb8154", 48362234), + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Looky Demo (English) { "looky", @@ -414,7 +656,8 @@ static const ADGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformWindows, - ADGF_UNSTABLE, + ADGF_UNSTABLE | + ADGF_DEMO, GUIO0() }, // Looky Demo (German) @@ -428,7 +671,8 @@ static const ADGameDescription gameDescriptions[] = { }, Common::DE_DEU, Common::kPlatformWindows, - ADGF_UNSTABLE, + ADGF_UNSTABLE | + ADGF_DEMO, GUIO0() }, // Looky (German) @@ -455,6 +699,26 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Oknytt + { + "oknytt", + "Version 1.0", + AD_ENTRY1s("data.dcp", "6456cf8f429905c83f07509f9da536dd", 109502959), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Paintaria + { + "paintaria", + "", + AD_ENTRY1s("data.dcp", "354c08440c98150ff0d4008dd2865880", 48326040), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Pigeons in the Park { "pigeons", @@ -465,6 +729,27 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Project: Doom + { + "projectdoom", + "", + AD_ENTRY1s("data.dcp", "d5894b65a40706845434b99870bcab92", 99223761), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Project Lonely Robot + { + "lonelyrobot", + "beta", + AD_ENTRY1s("data.dcp", "a0cf7ad5bab957416dcda454e9f28ef0", 3420120), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Reversion: The Escape Version 1.0 { "reversion1", @@ -643,6 +928,118 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Reversion: The Escape Version 1.3.2369 (Chinese) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_nz.dcp", 0, "7146dfa43ffdf0886e034fffe2c8a0c0", 13722261}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::ZH_CNA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (English) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_en.dcp", 0, "64b6fa7eedc09c231f6ce046e77fee05", 11339619}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (French) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_fr.dcp", 0, "d561d562224afea809153a1fd9fdb0c0", 11963210}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (German) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_de.dcp", 0, "4e3f614c36bd6bae74b8cc83e663a8f0", 14040310}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (Italian) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_it.dcp", 0, "10d09b7fe61946f09dd91d5e8d090f94", 11913752}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::IT_ITA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (Latvian) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_lv.dcp", 0, "704359ab5040b0dab6545064d7aa6eb9", 11414925}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::LV_LAT, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (Polish) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_pl.dcp", 0, "c4ad33f57e1e998169552d521c1d6638", 11532215}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::PL_POL, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Escape Version 1.3.2369 (Portuguese) + { + "reversion1", + "Version 1.3.2369", + { + {"xlanguage_pt.dcp", 0, "886886b6b14aadac844078de856799a6", 10620797}, + {"data.dcp", 0, "aecb5deeea7b0baa871fbd0cef35a648", 254219204}, + AD_LISTEND + }, + Common::PT_BRA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Reversion: The Meeting (Chinese) { "reversion2", @@ -681,6 +1078,66 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Reversion: The Meeting Version 2.0.2412 (Chinese) + { + "reversion2", + "Version 2.0.2412", + { + {"data.dcp", 0, "f4ffc4df24b7bebad56a24930f33a2bc", 255766600}, + {"xlanguage_nz.dcp", 0, "17c79af4928e24484bee77a7e807cc2a", 10737127}, + {"Linux.dcp", 0, "21858bd77dc86b03f701fd47900e2f51", 984535}, + AD_LISTEND + }, + Common::ZH_CNA, + Common::kPlatformLinux, + ADGF_UNSTABLE, + GUIO0() + }, + // Reversion: The Meeting Version 2.0.2412 (English) + { + "reversion2", + "Version 2.0.2412", + { + {"data.dcp", 0, "f4ffc4df24b7bebad56a24930f33a2bc", 255766600}, + {"xlanguage_en.dcp", 0, "0598bf752ce93b42bcaf1094df537c7b", 8533057}, + {"Linux.dcp", 0, "21858bd77dc86b03f701fd47900e2f51", 984535}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformLinux, + ADGF_UNSTABLE, + GUIO0() + }, + // Rhiannon: Curse of the four Branches + { + "rhiannon", + "", + AD_ENTRY1s("data.dcp", "870f348900b735f1cc79c0608ce32b0e", 1046169851), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Rhiannon: Curse of the four Branches (English PC DVD) + { + "rhiannon", + "DVD", + AD_ENTRY1s("data.dcp", "6736bbc921bb6ce5161b3ad095a97bd4", 1053441028), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // 1 1/2 Ritter: Auf der Suche nach der hinreissenden Herzelinde + { + "ritter", + "", + AD_ENTRY1s("data.dcp", "5ac416cee605d3a30f4d59687b1cdab2", 364260278), + Common::DE_DEU, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Rosemary { "rosemary", @@ -691,6 +1148,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Securanote + { + "securanote", + "", + AD_ENTRY1s("data.dcp", "5213d3e59b9e95b7fbd5c56f7de5341a", 2625554), + Common::EN_ANY, + Common::kPlatformIOS, + ADGF_UNSTABLE, + GUIO0() + }, // Shaban { "shaban", @@ -711,6 +1178,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Space Invaders (Demo) + { + "spaceinvaders", + "Demo", + AD_ENTRY1s("data.dcp", "3f27adefdf72f2c1601cf555c80a509f", 1308361), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Space Madness { "spacemadness", @@ -731,6 +1209,56 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // The Kite (Version 1.1) + { + "thekite", + "Version 1.1", + AD_ENTRY1s("data.dcp", "92d29428f464469bda2d81b03d4d5c3e", 47332296), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // The Kite (Version 1.2.e) + { + "thekite", + "Version 1.2.e", + AD_ENTRY1s("data.dcp", "92451578b1bdd2b32a1db592a4f6d5fc", 47360539), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // The Kite (Version 1.2.i) (Italian) + { + "thekite", + "Version 1.2.i", + AD_ENTRY1s("data.dcp", "d3435b106a1b3b4c1df8ad596d271586", 47509274), + Common::IT_ITA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // The Kite (Version 1.2.r) (Russian) + { + "thekite", + "Version 1.2.r", + AD_ENTRY1s("data.dcp", "d531e097dd884737469da014ed882cde", 47554582 ), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // The Kite (Version 1.3.e) + { + "thekite", + "Version 1.3.e", + AD_ENTRY1s("data.dcp", "9761827b51370263b7623721545d7627", 47382987), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Fairy Tales About Toshechka and Boshechka { "tib", @@ -762,6 +1290,37 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Vsevolod Prologue (Demo) + { + "vsevolod", + "Prologue", + AD_ENTRY1s("data.dcp", "f2dcffd2692dbfcc9371fa1a87970fe7", 388669493), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, + // Wilma Tetris + { + "wtetris", + "", + AD_ENTRY1s("data.dcp", "946e3a0496e6c12fb344c9ed861ff015", 2780093), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Zilm: A Game of Reflex 1.0 + { + "Zilm", + "1.0", + AD_ENTRY1s("data.dcp", "098dffaf03d8adbb4cb5633e4733e63c", 351726), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, AD_TABLE_END_MARKER }; diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp index 822c06f42f..9483975d94 100644 --- a/engines/wintermute/graphics/transform_struct.cpp +++ b/engines/wintermute/graphics/transform_struct.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. @@ -40,47 +40,47 @@ void TransformStruct::init(Point32 zoom, uint32 angle, Point32 hotspot, bool alp } TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, int32 offsetX, int32 offsetY) { - init(Point32(zoomX, zoomY), - angle, - Point32(hotspotX, hotspotY), - false, - blendMode, - rgbaMod, - mirrorX, mirrorY, + init(Point32(zoomX, zoomY), + angle, + Point32(hotspotX, hotspotY), + false, + blendMode, + rgbaMod, + mirrorX, mirrorY, Point32(offsetX, offsetY)); } TransformStruct::TransformStruct(float zoomX, float zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, int32 offsetX, int32 offsetY) { - init(Point32((int32)(zoomX / 100.0 * kDefaultZoomX), - (int32)(zoomY / 100.0 * kDefaultZoomY)), - angle, - Point32(hotspotX, hotspotY), - false, - blendMode, - rgbaMod, - mirrorX, mirrorY, + init(Point32((int32)(zoomX / 100.0 * kDefaultZoomX), + (int32)(zoomY / 100.0 * kDefaultZoomY)), + angle, + Point32(hotspotX, hotspotY), + false, + blendMode, + rgbaMod, + mirrorX, mirrorY, Point32(offsetX, offsetY)); } TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { - init(Point32(zoomX, zoomY), - kDefaultAngle, - Point32(kDefaultHotspotX, kDefaultHotspotY), - false, - blendMode, - rgbaMod, - mirrorX, - mirrorY, + init(Point32(zoomX, zoomY), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), + false, + blendMode, + rgbaMod, + mirrorX, + mirrorY, Point32(kDefaultOffsetX, kDefaultOffsetY)); } TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) { - init(Point32(zoomX, zoomY), - angle, - Point32(hotspotX, hotspotY), - true, - BLEND_NORMAL, - kDefaultRgbaMod, + init(Point32(zoomX, zoomY), + angle, + Point32(hotspotX, hotspotY), + true, + BLEND_NORMAL, + kDefaultRgbaMod, false, false, Point32(kDefaultOffsetX, kDefaultOffsetY)); } @@ -99,13 +99,13 @@ TransformStruct::TransformStruct(int32 numTimesX, int32 numTimesY) { } TransformStruct::TransformStruct() { - init(Point32(kDefaultZoomX, kDefaultZoomY), - kDefaultAngle, - Point32(kDefaultHotspotX, kDefaultHotspotY), - true, - BLEND_NORMAL, - kDefaultRgbaMod, - false, false, + init(Point32(kDefaultZoomX, kDefaultZoomY), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), + true, + BLEND_NORMAL, + kDefaultRgbaMod, + false, false, Point32(kDefaultOffsetX, kDefaultOffsetY)); } diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index d5a03ea331..f80b0967cb 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.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/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index dc92cdbbfd..7a009c26fa 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.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/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index 9a73e3b69f..e259db04e5 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.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/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 43deb62db6..5fe0d13766 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -76,7 +76,6 @@ public: * @param *outa, *outr, *outg, *outb pointer to the output pixel. * @param *outa, *outr, *outg, *outb pointer to the colormod components. */ - void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb, byte *ca, byte *cr, byte *cg, byte *cb) { if (*ca != 255) { ina = (ina) * (*ca) >> 8; @@ -85,20 +84,23 @@ void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *o if (ina == 0) { return; } else { - if (*cb != 255) + if (*cb != 255) { *outb = MIN(*outb + ((inb * (*cb) * ina) >> 16), 255); - else + } else { *outb = MIN(*outb + (inb * ina >> 8), 255); + } - if (*cg != 255) + if (*cg != 255) { *outg = MIN(*outg + ((ing * (*cg) * ina) >> 16), 255); - else + } else { *outg = MIN(*outg + (ing * ina >> 8), 255); + } - if (*cr != 255) + if (*cr != 255) { *outr = MIN(*outr + ((inr * (*cr) * ina) >> 16), 255); - else + } else { *outr = MIN(*outr + (inr * ina >> 8), 255); + } } } @@ -108,7 +110,6 @@ void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *o * @param *outa, *outr, *outg, *outb pointer to the output pixel. * @param *outa, *outr, *outg, *outb pointer to the colormod components. */ - void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb, byte *ca, byte *cr, byte *cg, byte *cb) { //if (*ca != 255) { // ina = ina * (*ca) >> 8; @@ -122,20 +123,23 @@ void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte if (ina == 0) { return; } else { - if (*cb != 255) + if (*cb != 255) { *outb = MAX(*outb - ((inb * (*cb) * (*outb) * ina) >> 24), 0); - else + } else { *outb = MAX(*outb - (inb * (*outb) * ina >> 16), 0); + } - if (*cg != 255) + if (*cg != 255) { *outg = MAX(*outg - ((ing * (*cg) * (*outg) * ina) >> 24), 0); - else + } else { *outg = MAX(*outg - (ing * (*outg) * ina >> 16), 0); + } - if (*cr != 255) - *outr = MAX(*outr - ((inr * (*cr) * (*outr) * ina) >> 24), 0); - else + if (*cr != 255) { + *outr = MAX(*outr - ((inr * (*cr) * (*outr) * ina) >> 24), 0); + } else { *outr = MAX(*outr - (inr * (*outr) * ina >> 16), 0); + } } } @@ -154,20 +158,23 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out if (ina == 0) { return; } else if (ina == 255) { - if (*cb != 255) + if (*cb != 255) { *outb = (inb * (*cb)) >> 8; - else + } else { *outb = inb; + } - if (*cr != 255) + if (*cr != 255) { *outr = (inr * (*cr)) >> 8; - else + } else { *outr = inr; + } - if (*cg != 255) + if (*cg != 255) { *outg = (ing * (*cg)) >> 8; - else + } else { *outg = ing; + } *outa = ina; @@ -180,26 +187,29 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out *outr = (*outr * (255 - ina) >> 8); *outg = (*outg * (255 - ina) >> 8); - if (*cb == 0) + if (*cb == 0) { *outb = *outb; - else if (*cb != 255) + } else if (*cb != 255) { *outb = *outb + (inb * ina * (*cb) >> 16); - else + } else { *outb = *outb + (inb * ina >> 8); + } - if (*cr == 0) + if (*cr == 0) { *outr = *outr; - else if (*cr != 255) + } else if (*cr != 255) { *outr = *outr + (inr * ina * (*cr) >> 16); - else + } else { *outr = *outr + (inr * ina >> 8); + } - if (*cg == 0) + if (*cg == 0) { *outg = *outg; - else if (*cg != 255) + } else if (*cg != 255) { *outg = *outg + (ing * ina * (*cg) >> 16); - else + } else { *outg = *outg + (ing * ina >> 8); + } return; } @@ -234,7 +244,6 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out * @param ina, inr, ing, inb: the input pixel, split into its components. * @param *outa, *outr, *outg, *outb pointer to the output pixel. */ - void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb) { if (ina == 0) { @@ -259,7 +268,6 @@ void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte * @param ina, inr, ing, inb: the input pixel, split into its components. * @param *outa, *outr, *outg, *outb pointer to the output pixel. */ - void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb) { if (ina == 0) { @@ -297,10 +305,11 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur } } -void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { /** * Optimized version of doBlit to be used w/opaque blitting (no alpha). */ +void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { + byte *in; byte *out; @@ -320,7 +329,6 @@ void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 /** * Optimized version of doBlit to be used w/binary blitting (blit or no-blit, no blending). */ - void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in; @@ -350,8 +358,8 @@ void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 * What we have here is a template method that calls blendPixel() from a different * class - the one we call it with - thus performing a different type of blending. * - * @param *ino a pointer to the input surface - * @param *outo a pointer to the output surface + * @param ino a pointer to the input surface + * @param outo a pointer to the output surface * @param width width of the input surface * @param height height of the input surface * @param pitch pitch of the output surface - that is, width in bytes of every row, usually bpp * width of the TARGET surface (the area we are blitting to might be smaller, do the math) @@ -360,7 +368,7 @@ void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 * @color colormod in 0xAARRGGBB format - 0xFFFFFFFF for no colormod */ -template<class Blender> +template<class Blender> void doBlit(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color) { Blender b; byte *in; @@ -379,10 +387,10 @@ void doBlit(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, in byte *outb = &out[TransparentSurface::kBIndex]; b.blendPixel(in[TransparentSurface::kAIndex], - in[TransparentSurface::kRIndex], - in[TransparentSurface::kGIndex], - in[TransparentSurface::kBIndex], - outa, outr, outg, outb); + in[TransparentSurface::kRIndex], + in[TransparentSurface::kGIndex], + in[TransparentSurface::kBIndex], + outa, outr, outg, outb); in += inStep; out += 4; @@ -408,10 +416,10 @@ void doBlit(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, in byte *outb = &out[TransparentSurface::kBIndex]; b.blendPixel(in[TransparentSurface::kAIndex], - in[TransparentSurface::kRIndex], - in[TransparentSurface::kGIndex], - in[TransparentSurface::kBIndex], - outa, outr, outg, outb, &ca, &cr, &cg, &cb); + in[TransparentSurface::kRIndex], + in[TransparentSurface::kGIndex], + in[TransparentSurface::kBIndex], + outa, outr, outg, outb, &ca, &cr, &cg, &cb); in += inStep; out += 4; } @@ -431,8 +439,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p // Check if we need to draw anything at all int ca = (color >> 24) & 0xff; - if (ca == 0) + if (ca == 0) { return retSize; + } // Create an encapsulating surface for the data TransparentSurface srcImage(*this, false); @@ -460,17 +469,19 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p srcImage.h = pPartRect->height(); debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, - pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height); + pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height); } else { debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0, - srcImage.w, srcImage.h, color, width, height); + srcImage.w, srcImage.h, color, width, height); } - if (width == -1) + if (width == -1) { width = srcImage.w; - if (height == -1) + } + if (height == -1) { height = srcImage.h; + } #ifdef SCALING_TESTING // Hardcode scaling to 66% to test scaling @@ -520,12 +531,12 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p yp = img->h - 1; } - byte *ino= (byte *)img->getBasePtr(xp, yp); + byte *ino = (byte *)img->getBasePtr(xp, yp); byte *outo = (byte *)target.getBasePtr(posX, posY); - if (color == 0xFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) { + if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) { doBlitOpaqueFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); - } else if (color == 0xFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_BINARY) { + } else if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_BINARY) { doBlitBinaryFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); } else { if (blendMode == BLEND_ADDITIVE) { @@ -653,8 +664,9 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo target->create((uint16)dstW, (uint16)dstH, this->format); - if (transform._zoom.x == 0 || transform._zoom.y == 0) + if (transform._zoom.x == 0 || transform._zoom.y == 0) { return target; + } uint32 invAngle = 360 - (transform._angle % 360); float invCos = cos(invAngle * M_PI / 180.0); @@ -688,8 +700,12 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo for (int x = 0; x < dstW; x++) { int dx = (sdx >> 16); int dy = (sdy >> 16); - if (flipx) dx = sw - dx; - if (flipy) dy = sh - dy; + if (flipx) { + dx = sw - dx; + } + if (flipy) { + dy = sh - dy; + } #ifdef ENABLE_BILINEAR if ((dx > -1) && (dy > -1) && (dx < sw) && (dy < sh)) { @@ -698,7 +714,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo c00 = *sp; sp += 1; c01 = *sp; - sp += (this->pitch/4); + sp += (this->pitch / 4); c11 = *sp; sp -= 1; c10 = *sp; @@ -768,12 +784,12 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) bool flipx = false, flipy = false; // TODO: See mirroring comment in RenderTicket ctor - int *sax = new int[dstW+1]; - int *say = new int[dstH+1]; + int *sax = new int[dstW + 1]; + int *say = new int[dstH + 1]; assert(sax && say); /* - * Precalculate row increments + * Precalculate row increments */ int spixelw = (srcW - 1); int spixelh = (srcH - 1); @@ -793,8 +809,8 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) csx += sx; /* Guard from overflows */ - if (csx > ssx) { - csx = ssx; + if (csx > ssx) { + csx = ssx; } } @@ -812,14 +828,16 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) } } - const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0,0); - tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0,0); + const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0, 0); + tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0, 0); int spixelgap = srcW; - if (flipx) + if (flipx) { sp += spixelw; - if (flipy) + } + if (flipy) { sp += spixelgap * spixelh; + } csay = say; for (int y = 0; y < dstH; y++) { @@ -839,10 +857,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) c01 = sp; c10 = sp; if (cy < spixelh) { - if (flipy) + if (flipy) { c10 -= spixelgap; - else + } else { c10 += spixelgap; + } } c11 = c10; if (cx < spixelw) { @@ -878,10 +897,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) int *salastx = csax; csax++; int sstepx = (*csax >> 16) - (*salastx >> 16); - if (flipx) + if (flipx) { sp -= sstepx; - else + } else { sp += sstepx; + } /* * Advance destination pointer x @@ -895,10 +915,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) csay++; int sstepy = (*csay >> 16) - (*salasty >> 16); sstepy *= spixelgap; - if (flipy) + if (flipy) { sp = csp - sstepy; - else + } else { sp = csp + sstepy; + } } delete[] sax; @@ -907,14 +928,16 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) #else int *scaleCacheX = new int[dstW]; - for (int x = 0; x < dstW; x++) + for (int x = 0; x < dstW; x++) { scaleCacheX[x] = (x * srcW) / dstW; + } for (int y = 0; y < dstH; y++) { uint32 *destP = (uint32 *)target->getBasePtr(0, y); const uint32 *srcP = (const uint32 *)getBasePtr(0, (y * srcH) / dstH); - for (int x = 0; x < dstW; x++) + for (int x = 0; x < dstW; x++) { *destP++ = srcP[scaleCacheX[x]]; + } } delete[] scaleCacheX; @@ -924,8 +947,4 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) } - - - - } // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index b887c05fa8..4ad9bf07eb 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -17,6 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * */ #ifndef GRAPHICS_TRANSPARENTSURFACE_H @@ -73,17 +74,17 @@ struct TransparentSurface : public Graphics::Surface { ALPHA_FULL = 2 }; - #ifdef SCUMM_LITTLE_ENDIAN +#ifdef SCUMM_LITTLE_ENDIAN static const int kAIndex = 0; static const int kBIndex = 1; static const int kGIndex = 2; static const int kRIndex = 3; - #else +#else static const int kAIndex = 3; static const int kBIndex = 2; static const int kGIndex = 1; static const int kRIndex = 0; - #endif +#endif static const int kBShift = 8;//img->format.bShift; static const int kGShift = 16;//img->format.gShift; @@ -99,32 +100,31 @@ struct TransparentSurface : public Graphics::Surface { /** @brief renders the surface to another surface - @param pDest a pointer to the target image. In most cases this is the framebuffer. - @param PosX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br> + @param target a pointer to the target surface. In most cases this is the framebuffer. + @param posX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br> The default value is 0. - @param PosY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br> + @param posY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br> The default value is 0. - @param Flipping how the the image should be flipped.<br> + @param flipping how the the image should be flipped.<br> The default value is BS_Image::FLIP_NONE (no flipping) - @param pSrcPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br> + @param pPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br> This referes to the unflipped and unscaled image.<br> The default value is NULL. - @param Color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br> + @param color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br> The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br> The color components determines the color for color modulation.<br> The default value is BS_ARGB(255, 255, 255, 255) (full covering, no color modulation). The macros BS_RGB and BS_ARGB can be used for the creation of the color value. - @param Width the output width of the screen section. + @param width the output width of the screen section. The images will be scaled if the output width of the screen section differs from the image section.<br> The value -1 determines that the image should not be scaled.<br> The default value is -1. - @param Width the output height of the screen section. + @param height the output height of the screen section. The images will be scaled if the output width of the screen section differs from the image section.<br> The value -1 determines that the image should not be scaled.<br> The default value is -1. @return returns false if the rendering failed. */ - Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0, int flipping = FLIP_NONE, Common::Rect *pPartRect = nullptr, @@ -132,13 +132,14 @@ struct TransparentSurface : public Graphics::Surface { int width = -1, int height = -1, TSpriteBlendMode blend = BLEND_NORMAL); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); - + /** * @brief Scale function; this returns a transformed version of this surface after rotation and * scaling. Please do not use this if angle != 0, use rotoscale. * - * @param transform a TransformStruct wrapping the required info. @see TransformStruct - * + * @param newWidth the resulting width. + * @param newHeight the resulting height. + * @see TransformStruct */ TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const; @@ -147,7 +148,7 @@ struct TransparentSurface : public Graphics::Surface { * scaling. Please do not use this if angle == 0, use plain old scaling function. * * @param transform a TransformStruct wrapping the required info. @see TransformStruct - * + * */ TransparentSurface *rotoscale(const TransformStruct &transform) const; AlphaType getAlphaMode() const; diff --git a/engines/wintermute/math/floatpoint.h b/engines/wintermute/math/floatpoint.h index 0c47ef09d7..77cd9980b9 100644 --- a/engines/wintermute/math/floatpoint.h +++ b/engines/wintermute/math/floatpoint.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/math/math_util.cpp b/engines/wintermute/math/math_util.cpp index 903cea6d39..ed2b932693 100644 --- a/engines/wintermute/math/math_util.cpp +++ b/engines/wintermute/math/math_util.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/math/math_util.h b/engines/wintermute/math/math_util.h index 41a7a43e2e..30b58baa39 100644 --- a/engines/wintermute/math/math_util.h +++ b/engines/wintermute/math/math_util.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/math/matrix4.cpp b/engines/wintermute/math/matrix4.cpp index 011766f510..dff4301df3 100644 --- a/engines/wintermute/math/matrix4.cpp +++ b/engines/wintermute/math/matrix4.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/math/matrix4.h b/engines/wintermute/math/matrix4.h index 4198b50484..245fb4a4a0 100644 --- a/engines/wintermute/math/matrix4.h +++ b/engines/wintermute/math/matrix4.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/math/rect32.h b/engines/wintermute/math/rect32.h index f522ab3a35..93b5c68a30 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.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. @@ -94,12 +94,24 @@ struct Rect32 { left = right = top = bottom = 0; } + bool isRectEmpty() const { + return (left >= right) || (top >= bottom); + } + void offsetRect(int dx, int dy) { left += dx; top += dy; right += dx; bottom += dy; } + + void setRect(int32 newLeft, int32 newTop, int32 newRight, int32 newBottom) { + this->left = newLeft; + this->top = newTop; + this->right = newRight; + this->bottom = newBottom; + } + /** * Check if the given rect is equal to this one. * diff --git a/engines/wintermute/math/vector2.cpp b/engines/wintermute/math/vector2.cpp index 618ee9bda9..a88edb1e6f 100644 --- a/engines/wintermute/math/vector2.cpp +++ b/engines/wintermute/math/vector2.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/math/vector2.h b/engines/wintermute/math/vector2.h index e4ba97c517..65aa6961f8 100644 --- a/engines/wintermute/math/vector2.h +++ b/engines/wintermute/math/vector2.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/module.mk b/engines/wintermute/module.mk index 95f9ba2ffb..19fb3d6717 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -1,5 +1,5 @@ MODULE := engines/wintermute - + MODULE_OBJS := \ ad/ad_actor.o \ ad/ad_entity.o \ @@ -116,14 +116,14 @@ MODULE_OBJS := \ debugger.o \ wintermute.o \ persistent.o - + MODULE_DIRS += \ engines/wintermute - + # This module can be built as a plugin ifeq ($(ENABLE_WINTERMUTE), DYNAMIC_PLUGIN) PLUGIN := 1 endif - -# Include common rules + +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp index 514fd61d34..558fb82a0f 100644 --- a/engines/wintermute/persistent.cpp +++ b/engines/wintermute/persistent.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/persistent.h b/engines/wintermute/persistent.h index ddc0791054..202a0fcda6 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.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/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 87a127d001..e18051f43f 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_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. @@ -169,52 +169,16 @@ bool BasePlatform::setCursorPos(int x, int y) { } ////////////////////////////////////////////////////////////////////////// -bool BasePlatform::showWindow(int nCmdShow) { - return false; -} - -////////////////////////////////////////////////////////////////////////// -void BasePlatform::setCapture() { - return; -} - -////////////////////////////////////////////////////////////////////////// -bool BasePlatform::releaseCapture() { - return false; -} - -////////////////////////////////////////////////////////////////////////// -bool BasePlatform::setRectEmpty(Rect32 *lprc) { - lprc->left = lprc->right = lprc->top = lprc->bottom = 0; - return true; -} - -////////////////////////////////////////////////////////////////////////// -bool BasePlatform::isRectEmpty(const Rect32 *lprc) { - return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom); -} - -////////////////////////////////////////////////////////////////////////// bool BasePlatform::ptInRect(Rect32 *lprc, Point32 p) { return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom); } ////////////////////////////////////////////////////////////////////////// -bool BasePlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) { - lprc->left = left; - lprc->top = top; - lprc->right = right; - lprc->bottom = bottom; - - return true; -} - -////////////////////////////////////////////////////////////////////////// bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) { - if (isRectEmpty(lprcSrc1) || isRectEmpty(lprcSrc2) || + if (lprcSrc1->isRectEmpty() || lprcSrc2->isRectEmpty() || lprcSrc1->left >= lprcSrc2->right || lprcSrc2->left >= lprcSrc1->right || lprcSrc1->top >= lprcSrc2->bottom || lprcSrc2->top >= lprcSrc1->bottom) { - setRectEmpty(lprcDst); + lprcDst->setEmpty(); return false; } lprcDst->left = MAX(lprcSrc1->left, lprcSrc2->left); @@ -227,15 +191,15 @@ bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const ////////////////////////////////////////////////////////////////////////// bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) { - if (isRectEmpty(lprcSrc1)) { - if (isRectEmpty(lprcSrc2)) { - setRectEmpty(lprcDst); + if (lprcSrc1->isRectEmpty()) { + if (lprcSrc2->isRectEmpty()) { + lprcDst->setEmpty(); return false; } else { *lprcDst = *lprcSrc2; } } else { - if (isRectEmpty(lprcSrc2)) { + if (lprcSrc2->isRectEmpty()) { *lprcDst = *lprcSrc1; } else { lprcDst->left = MIN(lprcSrc1->left, lprcSrc2->left); diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h index 46c86df909..dd18f99038 100644 --- a/engines/wintermute/platform_osystem.h +++ b/engines/wintermute/platform_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. @@ -48,13 +48,7 @@ public: // Win32 API bindings static bool getCursorPos(Point32 *lpPoint); static bool setCursorPos(int x, int y); - static bool showWindow(int nCmdShow); - - static void setCapture(); - static bool releaseCapture(); - static bool setRectEmpty(Rect32 *lprc); - static bool isRectEmpty(const Rect32 *lprc); static bool ptInRect(Rect32 *lprc, Point32 p); static bool setRect(Rect32 *lprc, int left, int top, int right, int bottom); static bool intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2); diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp index 0577f29e2c..4152b6fa7d 100644 --- a/engines/wintermute/system/sys_class.cpp +++ b/engines/wintermute/system/sys_class.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/system/sys_class.h b/engines/wintermute/system/sys_class.h index 9fb3f70696..a86f476f70 100644 --- a/engines/wintermute/system/sys_class.h +++ b/engines/wintermute/system/sys_class.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/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 20e4661efb..825fd8f32a 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.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/system/sys_class_registry.h b/engines/wintermute/system/sys_class_registry.h index 48a6738ffb..a9c7e641db 100644 --- a/engines/wintermute/system/sys_class_registry.h +++ b/engines/wintermute/system/sys_class_registry.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/system/sys_instance.cpp b/engines/wintermute/system/sys_instance.cpp index b8e5c9b50a..490324167f 100644 --- a/engines/wintermute/system/sys_instance.cpp +++ b/engines/wintermute/system/sys_instance.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/system/sys_instance.h b/engines/wintermute/system/sys_instance.h index 115de28094..7f6661eb0e 100644 --- a/engines/wintermute/system/sys_instance.h +++ b/engines/wintermute/system/sys_instance.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/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 42a873a0b4..12ecfe152d 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.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. @@ -655,7 +655,7 @@ bool UIButton::display(int offsetX, int offsetY) { BaseFont *font = 0; //RECT rect; - //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); + //rect.setRect(OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); //_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE); _hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN)); @@ -1178,25 +1178,25 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); - persistMgr->transfer(TMEMBER_INT(_align)); + persistMgr->transferSint32(TMEMBER_INT(_align)); persistMgr->transferPtr(TMEMBER_PTR(_backDisable)); persistMgr->transferPtr(TMEMBER_PTR(_backFocus)); persistMgr->transferPtr(TMEMBER_PTR(_backHover)); persistMgr->transferPtr(TMEMBER_PTR(_backPress)); - persistMgr->transfer(TMEMBER(_centerImage)); + persistMgr->transferBool(TMEMBER(_centerImage)); persistMgr->transferPtr(TMEMBER_PTR(_fontDisable)); persistMgr->transferPtr(TMEMBER_PTR(_fontFocus)); persistMgr->transferPtr(TMEMBER_PTR(_fontHover)); persistMgr->transferPtr(TMEMBER_PTR(_fontPress)); - persistMgr->transfer(TMEMBER(_hover)); + persistMgr->transferBool(TMEMBER(_hover)); persistMgr->transferPtr(TMEMBER_PTR(_image)); persistMgr->transferPtr(TMEMBER_PTR(_imageDisable)); persistMgr->transferPtr(TMEMBER_PTR(_imageFocus)); persistMgr->transferPtr(TMEMBER_PTR(_imageHover)); persistMgr->transferPtr(TMEMBER_PTR(_imagePress)); - persistMgr->transfer(TMEMBER(_pixelPerfect)); - persistMgr->transfer(TMEMBER(_press)); - persistMgr->transfer(TMEMBER(_stayPressed)); + persistMgr->transferBool(TMEMBER(_pixelPerfect)); + persistMgr->transferBool(TMEMBER(_press)); + persistMgr->transferBool(TMEMBER(_stayPressed)); if (!persistMgr->getIsSaving()) { _oneTimePress = false; diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index 6452cfc4f7..2e4fa8486b 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.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/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 4de1965b59..ffe8d66b4d 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.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. @@ -932,14 +932,14 @@ bool UIEdit::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_cursorBlinkRate)); - persistMgr->transfer(TMEMBER(_cursorChar)); + persistMgr->transferUint32(TMEMBER(_cursorBlinkRate)); + persistMgr->transferCharPtr(TMEMBER(_cursorChar)); persistMgr->transferPtr(TMEMBER_PTR(_fontSelected)); - persistMgr->transfer(TMEMBER(_frameWidth)); - persistMgr->transfer(TMEMBER(_maxLength)); - persistMgr->transfer(TMEMBER(_scrollOffset)); - persistMgr->transfer(TMEMBER(_selEnd)); - persistMgr->transfer(TMEMBER(_selStart)); + persistMgr->transferSint32(TMEMBER(_frameWidth)); + persistMgr->transferSint32(TMEMBER(_maxLength)); + persistMgr->transferSint32(TMEMBER(_scrollOffset)); + persistMgr->transferSint32(TMEMBER(_selEnd)); + persistMgr->transferSint32(TMEMBER(_selStart)); if (!persistMgr->getIsSaving()) { _cursorVisible = false; diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index 19ea5ecc5d..ea110a74a8 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.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/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 0dbf8df00b..9e1e2a28e5 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.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/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 63f0026412..b1ea2d579f 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.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/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index a8da89b011..194943add8 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_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. @@ -622,23 +622,23 @@ bool UIObject::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_back)); - persistMgr->transfer(TMEMBER(_canFocus)); - persistMgr->transfer(TMEMBER(_disable)); + persistMgr->transferBool(TMEMBER(_canFocus)); + persistMgr->transferBool(TMEMBER(_disable)); persistMgr->transferPtr(TMEMBER_PTR(_focusedWidget)); persistMgr->transferPtr(TMEMBER_PTR(_font)); - persistMgr->transfer(TMEMBER(_height)); + persistMgr->transferSint32(TMEMBER(_height)); persistMgr->transferPtr(TMEMBER_PTR(_image)); persistMgr->transferPtr(TMEMBER_PTR(_listenerObject)); persistMgr->transferPtr(TMEMBER_PTR(_listenerParamObject)); - persistMgr->transfer(TMEMBER(_listenerParamDWORD)); + persistMgr->transferUint32(TMEMBER(_listenerParamDWORD)); persistMgr->transferPtr(TMEMBER_PTR(_parent)); - persistMgr->transfer(TMEMBER(_parentNotify)); - persistMgr->transfer(TMEMBER(_sharedFonts)); - persistMgr->transfer(TMEMBER(_sharedImages)); - persistMgr->transfer(TMEMBER(_text)); - persistMgr->transfer(TMEMBER_INT(_type)); - persistMgr->transfer(TMEMBER(_visible)); - persistMgr->transfer(TMEMBER(_width)); + persistMgr->transferBool(TMEMBER(_parentNotify)); + persistMgr->transferBool(TMEMBER(_sharedFonts)); + persistMgr->transferBool(TMEMBER(_sharedImages)); + persistMgr->transferCharPtr(TMEMBER(_text)); + persistMgr->transferSint32(TMEMBER_INT(_type)); + persistMgr->transferBool(TMEMBER(_visible)); + persistMgr->transferSint32(TMEMBER(_width)); return STATUS_OK; } @@ -652,7 +652,10 @@ int32 UIObject::getWidth() const { return _width; } -int32 UIObject::getHeight() const { +// Has to be non-const to allow the virtual override to work, +// as other getHeight()-functions currently have the potential +// of having side-effects. +int32 UIObject::getHeight() { return _height; } diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 8d14d8a6a4..e7c0d56eb8 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_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. @@ -69,7 +69,7 @@ public: TUIObjectType _type; int32 getWidth() const; - int32 getHeight() const; + int32 getHeight() override; void setHeight(int32 height); void setWidth(int32 width); bool isDisabled() const; diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 117b1ff6cf..18b134a338 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.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. @@ -503,8 +503,8 @@ const char *UIText::scToString() { bool UIText::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); - persistMgr->transfer(TMEMBER_INT(_textAlign)); - persistMgr->transfer(TMEMBER_INT(_verticalAlign)); + persistMgr->transferSint32(TMEMBER_INT(_textAlign)); + persistMgr->transferSint32(TMEMBER_INT(_verticalAlign)); return STATUS_OK; } diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index c39260b228..d82ae9a1a2 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.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/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index e647e0d894..caa93df21c 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_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. @@ -44,15 +44,15 @@ IMPLEMENT_PERSISTENT(UITiledImage, false) UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) { _image = nullptr; - BasePlatform::setRectEmpty(&_upLeft); - BasePlatform::setRectEmpty(&_upMiddle); - BasePlatform::setRectEmpty(&_upRight); - BasePlatform::setRectEmpty(&_middleLeft); - BasePlatform::setRectEmpty(&_middleMiddle); - BasePlatform::setRectEmpty(&_middleRight); - BasePlatform::setRectEmpty(&_downLeft); - BasePlatform::setRectEmpty(&_downMiddle); - BasePlatform::setRectEmpty(&_downRight); + _upLeft.setEmpty(); + _upMiddle.setEmpty(); + _upRight.setEmpty(); + _middleLeft.setEmpty(); + _middleMiddle.setEmpty(); + _middleRight.setEmpty(); + _downLeft.setEmpty(); + _downMiddle.setEmpty(); + _downRight.setEmpty(); } @@ -267,19 +267,19 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) { if (vTiles && hTiles) { // up row - BasePlatform::setRect(&_upLeft, 0, 0, h1, v1); - BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1); - BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1); + _upLeft.setRect(0, 0, h1, v1); + _upMiddle.setRect(h1, 0, h1 + h2, v1); + _upRight.setRect(h1 + h2, 0, h1 + h2 + h3, v1); // middle row - BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2); - BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2); - BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2); + _middleLeft.setRect(0, v1, h1, v1 + v2); + _middleMiddle.setRect(h1, v1, h1 + h2, v1 + v2); + _middleRight.setRect(h1 + h2, v1, h1 + h2 + h3, v1 + v2); // down row - BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3); - BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3); - BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); + _downLeft.setRect(0, v1 + v2, h1, v1 + v2 + v3); + _downMiddle.setRect(h1, v1 + v2, h1 + h2, v1 + v2 + v3); + _downRight.setRect(h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); } // default @@ -287,34 +287,34 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) { int width = _image->_surface->getWidth() / 3; int height = _image->_surface->getHeight() / 3; - if (BasePlatform::isRectEmpty(&_upLeft)) { - BasePlatform::setRect(&_upLeft, 0, 0, width, height); + if (_upLeft.isRectEmpty()) { + _upLeft.setRect(0, 0, width, height); } - if (BasePlatform::isRectEmpty(&_upMiddle)) { - BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height); + if (_upMiddle.isRectEmpty()) { + _upMiddle.setRect(width, 0, 2 * width, height); } - if (BasePlatform::isRectEmpty(&_upRight)) { - BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height); + if (_upRight.isRectEmpty()) { + _upRight.setRect(2 * width, 0, 3 * width, height); } - if (BasePlatform::isRectEmpty(&_middleLeft)) { - BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height); + if (_middleLeft.isRectEmpty()) { + _middleLeft.setRect(0, height, width, 2 * height); } - if (BasePlatform::isRectEmpty(&_middleMiddle)) { - BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height); + if (_middleMiddle.isRectEmpty()) { + _middleMiddle.setRect(width, height, 2 * width, 2 * height); } - if (BasePlatform::isRectEmpty(&_middleRight)) { - BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height); + if (_middleRight.isRectEmpty()) { + _middleRight.setRect(2 * width, height, 3 * width, 2 * height); } - if (BasePlatform::isRectEmpty(&_downLeft)) { - BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height); + if (_downLeft.isRectEmpty()) { + _downLeft.setRect(0, 2 * height, width, 3 * height); } - if (BasePlatform::isRectEmpty(&_downMiddle)) { - BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height); + if (_downMiddle.isRectEmpty()) { + _downMiddle.setRect(width, 2 * height, 2 * width, 3 * height); } - if (BasePlatform::isRectEmpty(&_downRight)) { - BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height); + if (_downRight.isRectEmpty()) { + _downRight.setRect(2 * width, 2 * height, 3 * width, 3 * height); } } @@ -369,16 +369,16 @@ void UITiledImage::correctSize(int32 *width, int32 *height) { bool UITiledImage::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_downLeft)); - persistMgr->transfer(TMEMBER(_downMiddle)); - persistMgr->transfer(TMEMBER(_downRight)); + persistMgr->transferRect32(TMEMBER(_downLeft)); + persistMgr->transferRect32(TMEMBER(_downMiddle)); + persistMgr->transferRect32(TMEMBER(_downRight)); persistMgr->transferPtr(TMEMBER_PTR(_image)); - persistMgr->transfer(TMEMBER(_middleLeft)); - persistMgr->transfer(TMEMBER(_middleMiddle)); - persistMgr->transfer(TMEMBER(_middleRight)); - persistMgr->transfer(TMEMBER(_upLeft)); - persistMgr->transfer(TMEMBER(_upMiddle)); - persistMgr->transfer(TMEMBER(_upRight)); + persistMgr->transferRect32(TMEMBER(_middleLeft)); + persistMgr->transferRect32(TMEMBER(_middleMiddle)); + persistMgr->transferRect32(TMEMBER(_middleRight)); + persistMgr->transferRect32(TMEMBER(_upLeft)); + persistMgr->transferRect32(TMEMBER(_upMiddle)); + persistMgr->transferRect32(TMEMBER(_upRight)); return STATUS_OK; } diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index fa92c46781..916353af2d 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_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. diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 9051ce8217..9f3cdeaaa3 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.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 @@ IMPLEMENT_PERSISTENT(UIWindow, false) ////////////////////////////////////////////////////////////////////////// UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) { - BasePlatform::setRectEmpty(&_titleRect); - BasePlatform::setRectEmpty(&_dragRect); + _titleRect.setEmpty(); + _dragRect.setEmpty(); _titleAlign = TAL_LEFT; _transparent = false; @@ -213,7 +213,7 @@ bool UIWindow::display(int offsetX, int offsetY) { image->draw(_posX + offsetX, _posY + offsetY, _transparent ? nullptr : this); } - if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) { + if (!_titleRect.isRectEmpty() && font && _text) { font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top); } @@ -676,11 +676,11 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) { error("UIWindow::SaveAsText - Unhandled enum-value NUM_TEXT_ALIGN"); } - if (!BasePlatform::isRectEmpty(&_titleRect)) { + if (!_titleRect.isRectEmpty()) { buffer->putTextIndent(indent + 2, "TITLE_RECT { %d, %d, %d, %d }\n", _titleRect.left, _titleRect.top, _titleRect.right, _titleRect.bottom); } - if (!BasePlatform::isRectEmpty(&_dragRect)) { + if (!_dragRect.isRectEmpty()) { buffer->putTextIndent(indent + 2, "DRAG_RECT { %d, %d, %d, %d }\n", _dragRect.left, _dragRect.top, _dragRect.right, _dragRect.bottom); } @@ -1227,7 +1227,7 @@ bool UIWindow::handleMouse(TMouseEvent event, TMouseButton button) { bool res = UIObject::handleMouse(event, button); // handle window dragging - if (!BasePlatform::isRectEmpty(&_dragRect)) { + if (!_dragRect.isRectEmpty()) { // start drag if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) { Rect32 dragRect = _dragRect; @@ -1258,24 +1258,24 @@ bool UIWindow::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_backInactive)); - persistMgr->transfer(TMEMBER(_clipContents)); - persistMgr->transfer(TMEMBER(_dragFrom)); - persistMgr->transfer(TMEMBER(_dragging)); - persistMgr->transfer(TMEMBER(_dragRect)); - persistMgr->transfer(TMEMBER(_fadeBackground)); - persistMgr->transfer(TMEMBER(_fadeColor)); + persistMgr->transferBool(TMEMBER(_clipContents)); + persistMgr->transferPoint32(TMEMBER(_dragFrom)); + persistMgr->transferBool(TMEMBER(_dragging)); + persistMgr->transferRect32(TMEMBER(_dragRect)); + persistMgr->transferBool(TMEMBER(_fadeBackground)); + persistMgr->transferUint32(TMEMBER(_fadeColor)); persistMgr->transferPtr(TMEMBER_PTR(_fontInactive)); persistMgr->transferPtr(TMEMBER_PTR(_imageInactive)); - persistMgr->transfer(TMEMBER(_inGame)); - persistMgr->transfer(TMEMBER(_isMenu)); - persistMgr->transfer(TMEMBER_INT(_mode)); + persistMgr->transferBool(TMEMBER(_inGame)); + persistMgr->transferBool(TMEMBER(_isMenu)); + persistMgr->transferSint32(TMEMBER_INT(_mode)); persistMgr->transferPtr(TMEMBER_PTR(_shieldButton)); persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow)); - persistMgr->transfer(TMEMBER_INT(_titleAlign)); - persistMgr->transfer(TMEMBER(_titleRect)); - persistMgr->transfer(TMEMBER(_transparent)); + persistMgr->transferSint32(TMEMBER_INT(_titleAlign)); + persistMgr->transferRect32(TMEMBER(_titleRect)); + persistMgr->transferBool(TMEMBER(_transparent)); persistMgr->transferPtr(TMEMBER_PTR(_viewport)); - persistMgr->transfer(TMEMBER(_pauseMusic)); + persistMgr->transferBool(TMEMBER(_pauseMusic)); _widgets.persist(persistMgr); diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 6b4d970581..dad8c89e6c 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.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/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp index ee8b298562..71311713af 100644 --- a/engines/wintermute/utils/path_util.cpp +++ b/engines/wintermute/utils/path_util.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/utils/path_util.h b/engines/wintermute/utils/path_util.h index 2c7dfa99d1..264dc5d241 100644 --- a/engines/wintermute/utils/path_util.h +++ b/engines/wintermute/utils/path_util.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/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index e8e078aba8..82d4fe6902 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.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. @@ -50,142 +50,94 @@ bool StringUtil::compareNoCase(const AnsiString &str1, const AnsiString &str2) { ////////////////////////////////////////////////////////////////////////// WideString StringUtil::utf8ToWide(const Utf8String &Utf8Str) { - error("StringUtil::Utf8ToWide - WideString not supported yet"); - /* size_t WideSize = Utf8Str.size(); - - if (sizeof(wchar_t) == 2) { - wchar_t *WideStringNative = new wchar_t[WideSize + 1]; - - const UTF8 *SourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str()); - const UTF8 *SourceEnd = SourceStart + WideSize; - - UTF16 *TargetStart = reinterpret_cast<UTF16 *>(WideStringNative); - UTF16 *TargetEnd = TargetStart + WideSize + 1; - - ConversionResult res = ConvertUTF8toUTF16(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion); - if (res != conversionOK) { - delete[] WideStringNative; - return L""; - } - *TargetStart = 0; - WideString ResultString(WideStringNative); - delete[] WideStringNative; - - return ResultString; - } else if (sizeof(wchar_t) == 4) { - wchar_t *WideStringNative = new wchar_t[WideSize + 1]; - - const UTF8 *SourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str()); - const UTF8 *SourceEnd = SourceStart + WideSize; - - UTF32 *TargetStart = reinterpret_cast<UTF32 *>(WideStringNative); - UTF32 *TargetEnd = TargetStart + WideSize; - - ConversionResult res = ConvertUTF8toUTF32(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion); - if (res != conversionOK) { - delete[] WideStringNative; - return L""; - } - *TargetStart = 0; - WideString ResultString(WideStringNative); - delete[] WideStringNative; - - return ResultString; - } else { - return L""; - }*/ - return ""; + size_t wideSize = Utf8Str.size(); + + uint32 *wideStringNative = new uint32[wideSize + 1]; + + const UTF8 *sourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str()); + const UTF8 *sourceEnd = sourceStart + wideSize; + + UTF32 *targetStart = reinterpret_cast<UTF32 *>(wideStringNative); + UTF32 *targetEnd = targetStart + wideSize; + + ConversionResult res = ConvertUTF8toUTF32(&sourceStart, sourceEnd, &targetStart, targetEnd, strictConversion); + if (res != conversionOK) { + delete[] wideStringNative; + return WideString(); + } + *targetStart = 0; + WideString resultString(wideStringNative); + delete[] wideStringNative; + return resultString; } ////////////////////////////////////////////////////////////////////////// Utf8String StringUtil::wideToUtf8(const WideString &WideStr) { - error("StringUtil::wideToUtf8 - Widestring not supported yet"); - /* size_t WideSize = WideStr.length(); - - if (sizeof(wchar_t) == 2) { - size_t utf8Size = 3 * WideSize + 1; - char *utf8StringNative = new char[Utf8Size]; - - const UTF16 *SourceStart = reinterpret_cast<const UTF16 *>(WideStr.c_str()); - const UTF16 *SourceEnd = SourceStart + WideSize; - - UTF8 *TargetStart = reinterpret_cast<UTF8 *>(Utf8StringNative); - UTF8 *TargetEnd = TargetStart + Utf8Size; - - ConversionResult res = ConvertUTF16toUTF8(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion); - if (res != conversionOK) { - delete[] Utf8StringNative; - return (Utf8String)""; - } - *TargetStart = 0; - Utf8String ResultString(Utf8StringNative); - delete[] Utf8StringNative; - return ResultString; - } else if (sizeof(wchar_t) == 4) { - size_t utf8Size = 4 * WideSize + 1; - char *utf8StringNative = new char[Utf8Size]; - - const UTF32 *SourceStart = reinterpret_cast<const UTF32 *>(WideStr.c_str()); - const UTF32 *SourceEnd = SourceStart + WideSize; - - UTF8 *TargetStart = reinterpret_cast<UTF8 *>(Utf8StringNative); - UTF8 *TargetEnd = TargetStart + Utf8Size; - - ConversionResult res = ConvertUTF32toUTF8(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion); - if (res != conversionOK) { - delete[] Utf8StringNative; - return (Utf8String)""; - } - *TargetStart = 0; - Utf8String ResultString(Utf8StringNative); - delete[] Utf8StringNative; - return ResultString; - } else { - return (Utf8String)""; - }*/ - return ""; + size_t wideSize = WideStr.size(); + + size_t utf8Size = 4 * wideSize + 1; + char *utf8StringNative = new char[utf8Size]; + + const UTF32 *sourceStart = reinterpret_cast<const UTF32 *>(WideStr.c_str()); + const UTF32 *sourceEnd = sourceStart + wideSize; + + UTF8 *targetStart = reinterpret_cast<UTF8 *>(utf8StringNative); + UTF8 *targetEnd = targetStart + utf8Size; + + ConversionResult res = ConvertUTF32toUTF8(&sourceStart, sourceEnd, &targetStart, targetEnd, strictConversion); + if (res != conversionOK) { + delete[] utf8StringNative; + return Utf8String(); + } + *targetStart = 0; + Utf8String resultString(utf8StringNative); + delete[] utf8StringNative; + return resultString; } ////////////////////////////////////////////////////////////////////////// WideString StringUtil::ansiToWide(const AnsiString &str) { - // TODO: This function gets called a lot, so warnings like these drown out the usefull information - Common::String converted = ""; - uint32 index = 0; - while (index != str.size()) { - byte c = str[index]; - if (c == 146) { - converted += (char)39; // Replace right-quote with apostrophe - } else if (c == 133) { - converted += Common::String("..."); // Replace ...-symbol with ... + WideString result; + for (AnsiString::const_iterator i = str.begin(), end = str.end(); i != end; ++i) { + const byte c = *i; + if (c < 0x80 || c >= 0xA0) { + result += c; } else { - converted += c; + uint32 utf32 = _ansiToUTF32[c - 0x80]; + if (utf32) { + result += utf32; + } else { + // It's an invalid CP1252 character... + } } - index++; } - // using default os locale! - - /* setlocale(LC_CTYPE, ""); - size_t wideSize = mbstowcs(NULL, str.c_str(), 0) + 1; - wchar_t *wstr = new wchar_t[WideSize]; - mbstowcs(wstr, str.c_str(), WideSize); - WideString ResultString(wstr); - delete[] wstr; - return ResultString;*/ - return WideString(converted); + return result; } ////////////////////////////////////////////////////////////////////////// AnsiString StringUtil::wideToAnsi(const WideString &wstr) { - // using default os locale! - // TODO: This function gets called a lot, so warnings like these drown out the usefull information - /* setlocale(LC_CTYPE, ""); - size_t wideSize = wcstombs(NULL, wstr.c_str(), 0) + 1; - char *str = new char[WideSize]; - wcstombs(str, wstr.c_str(), WideSize); - AnsiString ResultString(str); - delete[] str; - return ResultString;*/ - return AnsiString(wstr); + AnsiString result; + for (WideString::const_iterator i = wstr.begin(), end = wstr.end(); i != end; ++i) { + const uint32 c = *i; + if (c < 0x80 || (c >= 0xA0 && c <= 0xFF)) { + result += c; + } else { + uint32 ansi = 0xFFFFFFFF; + for (uint j = 0; j < ARRAYSIZE(_ansiToUTF32); ++j) { + if (_ansiToUTF32[j] == c) { + ansi = j + 0x80; + break; + } + } + + if (ansi != 0xFFFFFFFF) { + result += ansi; + } else { + // There's no valid CP1252 code for this character... + } + } + } + return result; } ////////////////////////////////////////////////////////////////////////// @@ -199,12 +151,7 @@ bool StringUtil::isUtf8BOM(const byte *buffer, uint32 bufferSize) { ////////////////////////////////////////////////////////////////////////// int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) { - const char *index = strstr(str.c_str(), toFind.c_str()); - if (index == nullptr) { - return -1; - } else { - return index - str.c_str(); - } + return str.find(toFind, startFrom); } Common::String StringUtil::encodeSetting(const Common::String &str) { @@ -225,5 +172,10 @@ AnsiString StringUtil::toString(int val) { return Common::String::format("%d", val); } +// Mapping of CP1252 characters 0x80...0x9F into UTF-32 +uint32 StringUtil::_ansiToUTF32[32] = { + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178 +}; } // End of namespace Wintermute diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h index 3ae5e47493..431d401d96 100644 --- a/engines/wintermute/utils/string_util.h +++ b/engines/wintermute/utils/string_util.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. @@ -49,6 +49,9 @@ public: static Common::String decodeSetting(const Common::String &str); static AnsiString toString(int val); + +private: + static uint32 _ansiToUTF32[32]; }; } // End of namespace Wintermute diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp index 8fa6313ba6..d592019418 100644 --- a/engines/wintermute/utils/utils.cpp +++ b/engines/wintermute/utils/utils.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/utils/utils.h b/engines/wintermute/utils/utils.h index 6c804ff01e..4ee875fb06 100644 --- a/engines/wintermute/utils/utils.h +++ b/engines/wintermute/utils/utils.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/video/video_player.cpp b/engines/wintermute/video/video_player.cpp index f18311c3e1..5a71b04377 100644 --- a/engines/wintermute/video/video_player.cpp +++ b/engines/wintermute/video/video_player.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/video/video_player.h b/engines/wintermute/video/video_player.h index 51c6bf41d3..8812e2597b 100644 --- a/engines/wintermute/video/video_player.h +++ b/engines/wintermute/video/video_player.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/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index f3317684b5..e1553580ec 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.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/gfx/base_image.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/sound/base_sound_manager.h" -#include "engines/wintermute/platform_osystem.h" #include "video/theora_decoder.h" #include "engines/wintermute/wintermute.h" #include "common/system.h" @@ -128,6 +127,7 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common: #if defined (USE_THEORADEC) _theoraDecoder = new Video::TheoraDecoder(); #else + warning("VideoTheoraPlayer::initialize - Theora support not compiled in, video will be skipped: %s", filename.c_str()); return STATUS_FAILED; #endif _theoraDecoder->loadStream(_file); @@ -306,8 +306,15 @@ bool VideoTheoraPlayer::update() { if (!_theoraDecoder->endOfVideo() && _theoraDecoder->getTimeToNextFrame() == 0) { const Graphics::Surface *decodedFrame = _theoraDecoder->decodeNextFrame(); if (decodedFrame) { - _surface.free(); - _surface.copyFrom(*decodedFrame); + if (decodedFrame->format == _surface.format && decodedFrame->pitch == _surface.pitch && decodedFrame->h == _surface.h) { + const byte *src = (const byte *)decodedFrame->getBasePtr(0, 0); + byte *dst = (byte *)_surface.getBasePtr(0, 0); + memcpy(dst, src, _surface.pitch * _surface.h); + } else { + _surface.free(); + _surface.copyFrom(*decodedFrame); + } + if (_texture) { writeVideo(); } @@ -396,7 +403,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) { bool res; if (_texture && _videoFrameReady) { - BasePlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight()); + rc.setRect(0, 0, _texture->getWidth(), _texture->getHeight()); if (_playZoom == 100.0f) { res = _texture->displayTrans(_posX, _posY, rc, alpha); } else { @@ -492,16 +499,16 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) { } persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); - persistMgr->transfer(TMEMBER(_savedPos)); - persistMgr->transfer(TMEMBER(_savedState)); - persistMgr->transfer(TMEMBER(_filename)); - persistMgr->transfer(TMEMBER(_alphaFilename)); - persistMgr->transfer(TMEMBER(_posX)); - persistMgr->transfer(TMEMBER(_posY)); + persistMgr->transferUint32(TMEMBER(_savedPos)); + persistMgr->transferSint32(TMEMBER(_savedState)); + persistMgr->transferString(TMEMBER(_filename)); + persistMgr->transferString(TMEMBER(_alphaFilename)); + persistMgr->transferSint32(TMEMBER(_posX)); + persistMgr->transferSint32(TMEMBER(_posY)); persistMgr->transferFloat(TMEMBER(_playZoom)); - persistMgr->transfer(TMEMBER_INT(_playbackType)); - persistMgr->transfer(TMEMBER(_looping)); - persistMgr->transfer(TMEMBER(_volume)); + persistMgr->transferSint32(TMEMBER_INT(_playbackType)); + persistMgr->transferBool(TMEMBER(_looping)); + persistMgr->transferSint32(TMEMBER(_volume)); if (!persistMgr->getIsSaving() && (_savedState != THEORA_STATE_NONE)) { initializeSimple(); diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index a4f1b9edd6..8274a1444f 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.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. @@ -62,7 +62,7 @@ public: //CVidSubtitler *_subtitler; // control methods - bool initialize(const Common::String &filename, const Common::String &subtitleFile = nullptr); + bool initialize(const Common::String &filename, const Common::String &subtitleFile = Common::String()); bool initializeSimple(); bool update(); bool play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1); diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 0a6be4caf8..81b6e53c9f 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.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. @@ -365,6 +365,17 @@ bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String name = value; } else if (key == "CAPTION") { retVal = true; + // Remove any translation tags, if they are included in the game description. + // This can potentially remove parts of a string that has translation tags + // and contains a "/" in its description (e.g. /tag/Name start / name end will + // result in "name end"), but it's a very rare case, and this code is just used + // for fallback anyway. + if (value.hasPrefix("/")) { + value.deleteChar(0); + while (value.contains("/")) { + value.deleteChar(0); + } + } caption = value; } } diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h index fcaa2840a9..017809d56a 100644 --- a/engines/wintermute/wintermute.h +++ b/engines/wintermute/wintermute.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/wintypes.h b/engines/wintermute/wintypes.h index 1288ac1a65..b30c09dff7 100644 --- a/engines/wintermute/wintypes.h +++ b/engines/wintermute/wintypes.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. |