diff options
author | Strangerke | 2013-09-08 14:49:34 +0200 |
---|---|---|
committer | Strangerke | 2013-09-08 14:49:34 +0200 |
commit | 599d2eeb06c937a4479cc751f4f9f5e94795c43b (patch) | |
tree | 6efd0f887d7a1fd5082209a585d609983031c92d /engines/wintermute | |
parent | 7df4c94aeb6c1408d26d6ada58d728b6eac17717 (diff) | |
parent | 03bf56ea82c0b89f4e61e5e0787a36473f999efa (diff) | |
download | scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.gz scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.bz2 scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.zip |
Merge branch 'master' into avalanche
Diffstat (limited to 'engines/wintermute')
233 files changed, 1383 insertions, 592 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index e4c18d6287..94df17c543 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -1457,4 +1457,4 @@ bool AdActor::playAnim(const char *filename) { return AdTalkHolder::playAnim(filename); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index 3630c6665b..582b41b8b0 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.h @@ -103,6 +103,6 @@ private: int32 _pFCount; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index c43f74b620..388accf34f 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -1134,4 +1134,4 @@ bool AdEntity::setSprite(const char *filename) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index c23b37366d..bdbd271667 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.h @@ -68,6 +68,6 @@ private: TEntityType _subtype; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index ead68f7729..d5799e851b 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -2282,4 +2282,4 @@ bool AdGame::onScriptShutdown(ScScript *script) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 2032a1723f..cb5147501d 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -158,6 +158,6 @@ private: AdInventoryBox *_inventoryBox; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp index e9b6e56f16..544d8310d0 100644 --- a/engines/wintermute/ad/ad_inventory.cpp +++ b/engines/wintermute/ad/ad_inventory.cpp @@ -133,4 +133,4 @@ bool AdInventory::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h index 999200b465..9de831b2a0 100644 --- a/engines/wintermute/ad/ad_inventory.h +++ b/engines/wintermute/ad/ad_inventory.h @@ -47,6 +47,6 @@ public: int32 _scrollOffset; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 110359917b..d703de1714 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -386,4 +386,4 @@ bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_inventory_box.h b/engines/wintermute/ad/ad_inventory_box.h index 9792b1ea66..f65bd8d8f0 100644 --- a/engines/wintermute/ad/ad_inventory_box.h +++ b/engines/wintermute/ad/ad_inventory_box.h @@ -60,6 +60,6 @@ private: int32 _itemWidth; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index 1a46eb783b..7d05461169 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.cpp @@ -810,4 +810,4 @@ bool AdItem::getExtendedFlag(const char *flagName) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index b8351448a7..dd7039db43 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.h @@ -64,6 +64,6 @@ private: char *_amountString; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index 7bf79e4ae5..c833b59163 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.cpp @@ -561,4 +561,4 @@ bool AdLayer::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h index 8fe4d4f91e..b260b919fd 100644 --- a/engines/wintermute/ad/ad_layer.h +++ b/engines/wintermute/ad/ad_layer.h @@ -53,6 +53,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index d52201a08d..876c5a8bb4 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_state.cpp @@ -192,4 +192,4 @@ bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool s return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_node_state.h b/engines/wintermute/ad/ad_node_state.h index e2050815a7..4b5b46ee60 100644 --- a/engines/wintermute/ad/ad_node_state.h +++ b/engines/wintermute/ad/ad_node_state.h @@ -55,6 +55,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 741d6e6fc6..0d5011f92d 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -1299,4 +1299,4 @@ bool AdObject::updatePartEmitter() { return _partEmitter->update(); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index c6573315da..9e30f69855 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_object.h @@ -123,6 +123,6 @@ private: AdInventory *_inventory; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp index 5b36ed6471..91a24cbf7d 100644 --- a/engines/wintermute/ad/ad_path.cpp +++ b/engines/wintermute/ad/ad_path.cpp @@ -117,4 +117,4 @@ bool AdPath::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_path.h b/engines/wintermute/ad/ad_path.h index 3f38355b94..9de0bcad2c 100644 --- a/engines/wintermute/ad/ad_path.h +++ b/engines/wintermute/ad/ad_path.h @@ -51,6 +51,6 @@ public: bool _ready; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp index be4b487466..d5108ad8c1 100644 --- a/engines/wintermute/ad/ad_path_point.cpp +++ b/engines/wintermute/ad/ad_path_point.cpp @@ -72,4 +72,4 @@ bool AdPathPoint::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_path_point.h b/engines/wintermute/ad/ad_path_point.h index 04648b1733..5e6b8c61ea 100644 --- a/engines/wintermute/ad/ad_path_point.h +++ b/engines/wintermute/ad/ad_path_point.h @@ -45,6 +45,6 @@ public: int32 _distance; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index acd5f13397..bc9ac903c6 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -404,9 +404,9 @@ bool AdRegion::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha)); persistMgr->transfer(TMEMBER(_blocked)); persistMgr->transfer(TMEMBER(_decoration)); - persistMgr->transfer(TMEMBER(_zoom)); + persistMgr->transferFloat(TMEMBER(_zoom)); return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index bc9eab085e..637c742c9c 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_region.h @@ -59,6 +59,6 @@ private: bool _decoration; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index 4483bbc667..fa05224b06 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -166,7 +166,7 @@ BaseFont *AdResponse::getFont() const { int32 AdResponse::getID() const { return _iD; } - + const char *AdResponse::getText() const { return _text; } @@ -175,4 +175,4 @@ const char *AdResponse::getTextOrig() const { return _textOrig; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response.h b/engines/wintermute/ad/ad_response.h index 57cd302e9d..00ebafbdb0 100644 --- a/engines/wintermute/ad/ad_response.h +++ b/engines/wintermute/ad/ad_response.h @@ -68,6 +68,6 @@ private: char *_textOrig; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index a589bf3a30..9d7c17ac74 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -737,4 +737,4 @@ bool AdResponseBox::getObjects(BaseArray<UIObject *> &objects, bool interactiveO return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h index cb57b98924..7598e8b569 100644 --- a/engines/wintermute/ad/ad_response_box.h +++ b/engines/wintermute/ad/ad_response_box.h @@ -94,6 +94,6 @@ private: UIWindow *_window; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp index 663ef49a24..0b58f5ba0c 100644 --- a/engines/wintermute/ad/ad_response_context.cpp +++ b/engines/wintermute/ad/ad_response_context.cpp @@ -68,4 +68,4 @@ void AdResponseContext::setContext(const char *context) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response_context.h b/engines/wintermute/ad/ad_response_context.h index dd0008a728..bc30b4a1c9 100644 --- a/engines/wintermute/ad/ad_response_context.h +++ b/engines/wintermute/ad/ad_response_context.h @@ -47,6 +47,6 @@ private: char *_context; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index 4d7f27aec7..d925b0d57a 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -153,9 +153,9 @@ bool AdRotLevel::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_rotation)); + persistMgr->transferFloat(TMEMBER(_rotation)); return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_rot_level.h b/engines/wintermute/ad/ad_rot_level.h index 3466e46ba5..fe2d1691cd 100644 --- a/engines/wintermute/ad/ad_rot_level.h +++ b/engines/wintermute/ad/ad_rot_level.h @@ -45,6 +45,6 @@ public: bool loadBuffer(byte *buffer, bool complete = true); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index e80f38bd0f..59e6d57787 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -154,9 +154,9 @@ bool AdScaleLevel::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scale_level.h b/engines/wintermute/ad/ad_scale_level.h index 516f507a5a..b2dd7aa91f 100644 --- a/engines/wintermute/ad/ad_scale_level.h +++ b/engines/wintermute/ad/ad_scale_level.h @@ -47,6 +47,6 @@ private: float _scale; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index 4d0068fad1..668b39853b 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -2989,4 +2989,4 @@ bool AdScene::getRegionObjects(AdRegion *region, BaseArray<AdObject *> &objects, return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index cd144b77ef..5beb10e546 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.h @@ -176,6 +176,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp index e9b80b3cc8..8548da91db 100644 --- a/engines/wintermute/ad/ad_scene_node.cpp +++ b/engines/wintermute/ad/ad_scene_node.cpp @@ -79,4 +79,4 @@ bool AdSceneNode::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index 8e022ab115..58cb5f514a 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_state.cpp @@ -95,4 +95,4 @@ AdNodeState *AdSceneState::getNodeState(const char *name, bool saving) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene_state.h b/engines/wintermute/ad/ad_scene_state.h index 600aa4b581..067c737b2e 100644 --- a/engines/wintermute/ad/ad_scene_state.h +++ b/engines/wintermute/ad/ad_scene_state.h @@ -48,6 +48,6 @@ private: BaseArray<AdNodeState *> _nodeStates; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index 70a57a624d..d5baa8291f 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -358,4 +358,4 @@ bool AdSentence::canSkip() { return (_gameRef->getTimer()->getTime() - _startTime) > 300; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_sentence.h b/engines/wintermute/ad/ad_sentence.h index 6f255578f7..c491ad99a2 100644 --- a/engines/wintermute/ad/ad_sentence.h +++ b/engines/wintermute/ad/ad_sentence.h @@ -80,6 +80,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index 6c802c4863..9eb3bd0686 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.cpp @@ -353,4 +353,4 @@ bool AdSpriteSet::containsSprite(BaseSprite *sprite) { return false; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h index 61043aa3d6..ef5ef3a94f 100644 --- a/engines/wintermute/ad/ad_sprite_set.h +++ b/engines/wintermute/ad/ad_sprite_set.h @@ -48,6 +48,6 @@ public: BaseSprite *_sprites[NUM_DIRECTIONS]; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index bf72b2916b..f10a0e2fb9 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.cpp @@ -282,4 +282,4 @@ BaseSprite *AdTalkDef::getDefaultSprite(TDirection dir) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_def.h b/engines/wintermute/ad/ad_talk_def.h index 2375360d89..726eefbe4c 100644 --- a/engines/wintermute/ad/ad_talk_def.h +++ b/engines/wintermute/ad/ad_talk_def.h @@ -53,6 +53,6 @@ public: virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0) override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 33deab7805..6041105b93 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_holder.cpp @@ -399,4 +399,4 @@ bool AdTalkHolder::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h index 501acbc885..ab48c3aaf4 100644 --- a/engines/wintermute/ad/ad_talk_holder.h +++ b/engines/wintermute/ad/ad_talk_holder.h @@ -52,6 +52,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index f03c24ea94..ce86dccd8e 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.cpp @@ -292,4 +292,4 @@ BaseSprite *AdTalkNode::getSprite(TDirection dir) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_node.h b/engines/wintermute/ad/ad_talk_node.h index 012fa2133e..01dfb6b4ff 100644 --- a/engines/wintermute/ad/ad_talk_node.h +++ b/engines/wintermute/ad/ad_talk_node.h @@ -58,6 +58,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_types.h b/engines/wintermute/ad/ad_types.h index ae5882f4ee..dc1a54b91d 100644 --- a/engines/wintermute/ad/ad_types.h +++ b/engines/wintermute/ad/ad_types.h @@ -102,6 +102,6 @@ typedef enum { GEOM_GENERIC } TGeomNodeType; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index 96dece34b8..cc7982cb9d 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -196,7 +196,7 @@ bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); - persistMgr->transfer(TMEMBER(_lastMimicScale)); + persistMgr->transferFloat(TMEMBER(_lastMimicScale)); persistMgr->transfer(TMEMBER(_lastMimicX)); persistMgr->transfer(TMEMBER(_lastMimicY)); _points.persist(persistMgr); @@ -267,4 +267,4 @@ bool AdWaypointGroup::mimic(AdWaypointGroup *wpt, float scale, int argX, int arg return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h index 79b28e0d22..af97a21290 100644 --- a/engines/wintermute/ad/ad_waypoint_group.h +++ b/engines/wintermute/ad/ad_waypoint_group.h @@ -56,6 +56,6 @@ private: int32 _lastMimicY; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp index d01972b82f..a64770c577 100644 --- a/engines/wintermute/base/base.cpp +++ b/engines/wintermute/base/base.cpp @@ -183,4 +183,4 @@ bool BaseClass::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h index 7f2796c6e0..48ebe49a97 100644 --- a/engines/wintermute/base/base.h +++ b/engines/wintermute/base/base.h @@ -57,6 +57,6 @@ protected: Common::HashMap<Common::String, Common::String>::iterator _editorPropsIter; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index 7a91854c57..abeaa18d54 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -109,4 +109,4 @@ void BaseActiveRect::clipRect() { BasePlatform::intersectRect(&_rect, &_rect, &rc); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h index 982a0902d0..a3c0746618 100644 --- a/engines/wintermute/base/base_active_rect.h +++ b/engines/wintermute/base/base_active_rect.h @@ -55,6 +55,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp index f684420b1e..5334ae46c4 100644 --- a/engines/wintermute/base/base_dynamic_buffer.cpp +++ b/engines/wintermute/base/base_dynamic_buffer.cpp @@ -201,4 +201,4 @@ void BaseDynamicBuffer::putTextForm(const char *format, va_list argptr) { putBytes((byte *)buff, strlen(buff)); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h index ad78ebad00..2804d78895 100644 --- a/engines/wintermute/base/base_dynamic_buffer.h +++ b/engines/wintermute/base/base_dynamic_buffer.h @@ -60,6 +60,6 @@ private: void putTextForm(const char *format, va_list argptr); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index d4b17a0a64..acb12bbe5f 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -44,10 +44,11 @@ BaseEngine::BaseEngine() { _classReg = nullptr; _rnd = nullptr; _gameId = ""; + _language = Common::UNK_LANG; } -void BaseEngine::init(Common::Language lang) { - _fileManager = new BaseFileManager(lang); +void BaseEngine::init() { + _fileManager = new BaseFileManager(_language); // Don't forget to register your random source _rnd = new Common::RandomSource("Wintermute"); _classReg = new SystemClassRegistry(); @@ -60,9 +61,11 @@ BaseEngine::~BaseEngine() { delete _classReg; } -void BaseEngine::createInstance(const Common::String &gameid, Common::Language lang) { - instance()._gameId = gameid; - instance().init(lang); +void BaseEngine::createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang) { + instance()._targetName = targetName; + instance()._gameId = gameId; + instance()._language = lang; + instance().init(); } void BaseEngine::LOG(bool res, const char *fmt, ...) { @@ -122,4 +125,4 @@ const Timer *BaseEngine::getLiveTimer() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h index d972e6ebbc..a5eafd3597 100644 --- a/engines/wintermute/base/base_engine.h +++ b/engines/wintermute/base/base_engine.h @@ -44,17 +44,19 @@ class BaseRenderer; class SystemClassRegistry; class Timer; class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> { - void init(Common::Language lang); + void init(); BaseFileManager *_fileManager; Common::String _gameId; + Common::String _targetName; BaseGame *_gameRef; // We need random numbers Common::RandomSource *_rnd; SystemClassRegistry *_classReg; + Common::Language _language; public: BaseEngine(); ~BaseEngine(); - static void createInstance(const Common::String &gameid, Common::Language lang); + static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang); void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; } Common::RandomSource *getRandomSource() { return _rnd; } @@ -68,9 +70,11 @@ public: static const Timer *getTimer(); static const Timer *getLiveTimer(); static void LOG(bool res, const char *fmt, ...); - const char *getGameId() { return _gameId.c_str(); } + const char *getGameTargetName() const { return _targetName.c_str(); } + Common::String getGameId() const { return _gameId; } + Common::Language getLanguage() const { return _language; } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp index 0d17b07a9d..7978230964 100644 --- a/engines/wintermute/base/base_fader.cpp +++ b/engines/wintermute/base/base_fader.cpp @@ -193,4 +193,4 @@ bool BaseFader::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index 845ce2f244..087b19bc44 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -58,6 +58,6 @@ private: uint32 _startTime; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index 7d59b03684..bea7e53445 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -269,7 +269,7 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f bool BaseFileManager::hasFile(const Common::String &filename) { if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) { - BasePersistenceManager pm(BaseEngine::instance().getGameId()); + BasePersistenceManager pm(BaseEngine::instance().getGameTargetName()); if (filename.size() <= 9) { return false; } @@ -360,4 +360,4 @@ BaseFileManager *BaseFileManager::getEngineInstance() { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 7ed3a6c7cb..8c2876f681 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -74,6 +74,6 @@ private: // the detector too, without launching the entire engine: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index 9fb5770f79..eaad024120 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -764,4 +764,4 @@ const char *BaseFrame::scToString() { return "[frame]"; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h index 954851c77f..bf1e40daa1 100644 --- a/engines/wintermute/base/base_frame.h +++ b/engines/wintermute/base/base_frame.h @@ -70,6 +70,6 @@ private: BaseSound *_sound; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 4d8e79b5c2..b2c05d271d 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -81,7 +81,7 @@ IMPLEMENT_PERSISTENT(BaseGame, true) ////////////////////////////////////////////////////////////////////// -BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gameId), _timerNormal(), _timerLive() { +BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _targetName(targetName), _timerNormal(), _timerLive() { _shuttingDown = false; _state = GAME_RUNNING; @@ -212,7 +212,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam #else*/ _touchInterface = false; _constrainedMemory = false; - + _settings = new BaseGameSettings(this); //#endif @@ -1276,11 +1276,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(2); const char *key = stack->pop()->getString(); const char *initVal = stack->pop()->getString(); - Common::String privKey = "wme_" + StringUtil::encodeSetting(key); - Common::String result = initVal; - if (ConfMan.hasKey(privKey)) { - result = StringUtil::decodeSetting(ConfMan.get(key)); - } + Common::String result = readRegistryString(key, initVal); stack->pushString(result.c_str()); return STATUS_OK; } @@ -3072,8 +3068,8 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_offsetX)); persistMgr->transfer(TMEMBER(_offsetY)); - persistMgr->transfer(TMEMBER(_offsetPercentX)); - persistMgr->transfer(TMEMBER(_offsetPercentY)); + persistMgr->transferFloat(TMEMBER(_offsetPercentX)); + persistMgr->transferFloat(TMEMBER(_offsetPercentY)); persistMgr->transfer(TMEMBER(_origInteractive)); persistMgr->transfer(TMEMBER_INT(_origState)); @@ -3734,7 +3730,7 @@ bool BaseGame::onWindowClose() { bool BaseGame::displayDebugInfo() { const uint32 strLength = 100; char str[strLength]; - + if (_debugShowFPS) { sprintf(str, "FPS: %d", _gameRef->_fps); _systemFont->drawText((byte *)str, 0, 0, 100, TAL_LEFT); @@ -3902,4 +3898,26 @@ char *BaseGame::getKeyFromStringTable(const char *str) const { return _settings->getKeyFromStringTable(str); } -} // end of namespace Wintermute +Common::String BaseGame::readRegistryString(const Common::String &key, const Common::String &initValue) const { + // Game specific hacks: + Common::String result = initValue; + // James Peris: + if (BaseEngine::instance().getGameId() == "jamesperis" && key == "Language") { + Common::Language language = BaseEngine::instance().getLanguage(); + if (language == Common::EN_ANY) { + result = "english"; + } else if (language == Common::ES_ESP) { + result = "spanish"; + } else { + error("Invalid language set for James Peris"); + } + } else { // Just fallback to using ConfMan for now + Common::String privKey = "wme_" + StringUtil::encodeSetting(key); + if (ConfMan.hasKey(privKey)) { + result = StringUtil::decodeSetting(ConfMan.get(key)); + } + } + return result; +} + +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index d51255d013..d295bb6b1a 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -137,7 +137,7 @@ public: bool initialize2(); bool initialize3(); BaseTransitionMgr *_transMgr; - + // String Table void expandStringByStringTable(char **str) const; char *getKeyFromStringTable(const char *str) const; @@ -150,7 +150,7 @@ public: BaseScriptable *_mathClass; BaseSurfaceStorage *_surfaceStorage; BaseFontStorage *_fontStorage; - BaseGame(const Common::String &gameId); + BaseGame(const Common::String &targetName); virtual ~BaseGame(); bool _debugDebugMode; @@ -173,8 +173,8 @@ public: // compatibility bits bool _compatKillMethodThreads; - const char* getGameId() const { return _gameId.c_str(); } - void setGameId(const Common::String& gameId) { _gameId = gameId; } + const char* getGameTargetName() const { return _targetName.c_str(); } + void setGameTargetName(const Common::String& targetName) { _targetName = targetName; } uint32 _surfaceGCCycleTime; bool _smartCache; // RO bool _subtitles; // RO @@ -275,7 +275,7 @@ private: bool _mouseRightDown; bool _mouseMidlleDown; - + BaseGameSettings *_settings; int32 _soundBufferSizeSec; @@ -295,7 +295,7 @@ private: uint32 _lastTime; uint32 _fpsTime; uint32 _framesRendered; - Common::String _gameId; + Common::String _targetName; void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = nullptr, void *data = nullptr); ENGINE_LOG_CALLBACK _engineLogCallback; @@ -343,6 +343,8 @@ private: bool isDoubleClick(int32 buttonIndex); uint32 _usedMem; +// TODO: This should be expanded into a proper class eventually: + Common::String readRegistryString(const Common::String &key, const Common::String &initValue) const; protected: @@ -356,6 +358,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp index ac23801e4c..c50969df76 100644 --- a/engines/wintermute/base/base_game_music.cpp +++ b/engines/wintermute/base/base_game_music.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -65,10 +65,10 @@ bool BaseGameMusic::playMusic(int channel, const char *filename, bool looping, u BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + delete _music[channel]; _music[channel] = nullptr; - + _music[channel] = new BaseSound(_gameRef); if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { if (_musicStartTime[channel]) { @@ -93,7 +93,7 @@ bool BaseGameMusic::stopMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { _music[channel]->stop(); delete _music[channel]; @@ -111,7 +111,7 @@ bool BaseGameMusic::pauseMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { return _music[channel]->pause(); } else { @@ -126,7 +126,7 @@ bool BaseGameMusic::resumeMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { return _music[channel]->resume(); } else { @@ -141,7 +141,7 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + _musicStartTime[channel] = time; if (_music[channel] && _music[channel]->isPlaying()) { return _music[channel]->setPositionTime(time); @@ -153,14 +153,14 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) { ////////////////////////////////////////////////////////////////////////// bool BaseGameMusic::updateMusicCrossfade() { /* byte globMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */ - + if (!_musicCrossfadeRunning) { return STATUS_OK; } if (_gameRef->_state == GAME_FROZEN) { return STATUS_OK; } - + if (_musicCrossfadeChannel1 < 0 || _musicCrossfadeChannel1 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel1]) { _musicCrossfadeRunning = false; return STATUS_OK; @@ -169,34 +169,34 @@ bool BaseGameMusic::updateMusicCrossfade() { _musicCrossfadeRunning = false; return STATUS_OK; } - + if (!_music[_musicCrossfadeChannel1]->isPlaying()) { _music[_musicCrossfadeChannel1]->play(); } if (!_music[_musicCrossfadeChannel2]->isPlaying()) { _music[_musicCrossfadeChannel2]->play(); } - + uint32 currentTime = _gameRef->getLiveTimer()->getTime() - _musicCrossfadeStartTime; - + if (currentTime >= _musicCrossfadeLength) { _musicCrossfadeRunning = false; //_music[_musicCrossfadeChannel2]->setVolume(GlobMusicVol); _music[_musicCrossfadeChannel2]->setVolumePercent(100); - + _music[_musicCrossfadeChannel1]->stop(); //_music[_musicCrossfadeChannel1]->setVolume(GlobMusicVol); _music[_musicCrossfadeChannel1]->setVolumePercent(100); - - + + if (_musicCrossfadeSwap) { // swap channels BaseSound *dummy = _music[_musicCrossfadeChannel1]; int dummyInt = _musicStartTime[_musicCrossfadeChannel1]; - + _music[_musicCrossfadeChannel1] = _music[_musicCrossfadeChannel2]; _musicStartTime[_musicCrossfadeChannel1] = _musicStartTime[_musicCrossfadeChannel2]; - + _music[_musicCrossfadeChannel2] = dummy; _musicStartTime[_musicCrossfadeChannel2] = dummyInt; } @@ -205,10 +205,10 @@ bool BaseGameMusic::updateMusicCrossfade() { //_music[_musicCrossfadeChannel2]->setVolume((float)CurrentTime / (float)_musicCrossfadeLength * GlobMusicVol); _music[_musicCrossfadeChannel1]->setVolumePercent((int)(100.0f - (float)currentTime / (float)_musicCrossfadeLength * 100.0f)); _music[_musicCrossfadeChannel2]->setVolumePercent((int)((float)currentTime / (float)_musicCrossfadeLength * 100.0f)); - + //_gameRef->QuickMessageForm("%d %d", _music[_musicCrossfadeChannel1]->GetVolume(), _music[_musicCrossfadeChannel2]->GetVolume()); } - + return STATUS_OK; } @@ -242,15 +242,15 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(4); channel = stack->pop()->getInt(); } - + const char *filename = stack->pop()->getString(); ScValue *valLooping = stack->pop(); bool looping = valLooping->isNULL() ? true : valLooping->getBool(); - + ScValue *valLoopStart = stack->pop(); uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt()); - - + + if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) { stack->pushBool(false); } else { @@ -258,20 +258,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // StopMusic / StopMusicChannel ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "StopMusic") == 0 || strcmp(name, "StopMusicChannel") == 0) { int channel = 0; - + if (strcmp(name, "StopMusic") == 0) { stack->correctParams(0); } else { stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(stopMusic(channel))) { stack->pushBool(false); } else { @@ -279,20 +279,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // PauseMusic / PauseMusicChannel ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "PauseMusic") == 0 || strcmp(name, "PauseMusicChannel") == 0) { int channel = 0; - + if (strcmp(name, "PauseMusic") == 0) { stack->correctParams(0); } else { stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(pauseMusic(channel))) { stack->pushBool(false); } else { @@ -300,7 +300,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // ResumeMusic / ResumeMusicChannel ////////////////////////////////////////////////////////////////////////// @@ -312,7 +312,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(resumeMusic(channel))) { stack->pushBool(false); } else { @@ -320,7 +320,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusic / GetMusicChannel ////////////////////////////////////////////////////////////////////////// @@ -343,7 +343,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // SetMusicPosition / SetMusicChannelPosition ////////////////////////////////////////////////////////////////////////// @@ -355,18 +355,18 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(2); channel = stack->pop()->getInt(); } - + uint32 time = stack->pop()->getInt(); - + if (DID_FAIL(setMusicStartTime(channel, time))) { stack->pushBool(false); } else { stack->pushBool(true); } - + return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusicPosition / GetMusicChannelPosition ////////////////////////////////////////////////////////////////////////// @@ -378,7 +378,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushInt(0); } else { @@ -386,7 +386,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // IsMusicPlaying / IsMusicChannelPlaying ////////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushBool(false); } else { @@ -406,7 +406,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // SetMusicVolume / SetMusicChannelVolume ////////////////////////////////////////////////////////////////////////// @@ -418,7 +418,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(2); channel = stack->pop()->getInt(); } - + int volume = stack->pop()->getInt(); if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushBool(false); @@ -431,7 +431,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusicVolume / GetMusicChannelVolume ////////////////////////////////////////////////////////////////////////// @@ -443,16 +443,16 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushInt(0); } else { stack->pushInt(_music[channel]->getVolumePercent()); } - + return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // MusicCrossfade ////////////////////////////////////////////////////////////////////////// @@ -462,34 +462,34 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this int channel2 = stack->pop()->getInt(0); uint32 fadeLength = (uint32)stack->pop()->getInt(0); bool swap = stack->pop()->getBool(true); - + if (_musicCrossfadeRunning) { script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress."); stack->pushBool(false); return STATUS_OK; } - + _musicCrossfadeStartTime = _gameRef->getLiveTimer()->getTime(); _musicCrossfadeChannel1 = channel1; _musicCrossfadeChannel2 = channel2; _musicCrossfadeLength = fadeLength; _musicCrossfadeSwap = swap; - + _musicCrossfadeRunning = true; - + stack->pushBool(true); return STATUS_OK; - } + } ////////////////////////////////////////////////////////////////////////// // GetSoundLength ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GetSoundLength") == 0) { stack->correctParams(1); - + int length = 0; const char *filename = stack->pop()->getString(); - + BaseSound *sound = new BaseSound(_gameRef); if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { length = sound->getLength(); @@ -503,4 +503,4 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game_music.h b/engines/wintermute/base/base_game_music.h index 0ac904b8c1..72c7a171a6 100644 --- a/engines/wintermute/base/base_game_music.h +++ b/engines/wintermute/base/base_game_music.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -53,7 +53,7 @@ public: bool stopMusic(int channel); bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); bool updateMusicCrossfade(); - + bool persistChannels(BasePersistenceManager *persistMgr); bool persistCrossfadeSettings(BasePersistenceManager *persistMgr); private: @@ -68,6 +68,6 @@ private: int32 _musicCrossfadeChannel2; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp index 55fbe39fd2..1de8b31ca7 100644 --- a/engines/wintermute/base/base_game_settings.cpp +++ b/engines/wintermute/base/base_game_settings.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -47,7 +47,7 @@ BaseGameSettings::BaseGameSettings(BaseGame *gameRef) { _allowAccessTab = true; _allowAboutTab = true; _allowDesktopRes = false; - + _compressedSavegames = true; _richSavedGames = false; _savedGameExt = "dsv"; @@ -101,21 +101,21 @@ bool BaseGameSettings::loadSettings(const char *filename) { TOKEN_TABLE(SAVED_GAME_EXT) TOKEN_TABLE(GUID) TOKEN_TABLE_END - - + + byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); if (origBuffer == nullptr) { BaseEngine::LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename); return STATUS_FAILED; } - + bool ret = STATUS_OK; - + byte *buffer = origBuffer; byte *params; int cmd; BaseParser parser; - + if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SETTINGS) { BaseEngine::LOG(0, "'SETTINGS' keyword expected in game settings file."); return STATUS_FAILED; @@ -130,61 +130,61 @@ bool BaseGameSettings::loadSettings(const char *filename) { strcpy(_gameFile, (char *)params); } break; - + case TOKEN_STRING_TABLE: if (DID_FAIL(_stringTable->loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; - + case TOKEN_RESOLUTION: parser.scanStr((char *)params, "%d,%d", &_resWidth, &_resHeight); break; - + case TOKEN_REQUIRE_3D_ACCELERATION: parser.scanStr((char *)params, "%b", &_requireAcceleration); break; - + case TOKEN_REQUIRE_SOUND: parser.scanStr((char *)params, "%b", &_requireSound); break; - + case TOKEN_HWTL_MODE: parser.scanStr((char *)params, "%d", &_TLMode); break; - + case TOKEN_ALLOW_WINDOWED_MODE: parser.scanStr((char *)params, "%b", &_allowWindowed); break; - + case TOKEN_ALLOW_DESKTOP_RES: parser.scanStr((char *)params, "%b", &_allowDesktopRes); break; - + case TOKEN_ALLOW_ADVANCED: parser.scanStr((char *)params, "%b", &_allowAdvanced); break; - + case TOKEN_ALLOW_ACCESSIBILITY_TAB: parser.scanStr((char *)params, "%b", &_allowAccessTab); break; - + case TOKEN_ALLOW_ABOUT_TAB: parser.scanStr((char *)params, "%b", &_allowAboutTab); break; - + case TOKEN_REGISTRY_PATH: //BaseEngine::instance().getRegistry()->setBasePath((char *)params); break; - + case TOKEN_RICH_SAVED_GAMES: parser.scanStr((char *)params, "%b", &_richSavedGames); break; - + case TOKEN_SAVED_GAME_EXT: _savedGameExt = (char *)params; break; - + case TOKEN_GUID: break; } @@ -197,12 +197,12 @@ bool BaseGameSettings::loadSettings(const char *filename) { BaseEngine::LOG(0, "Error loading game settings '%s'", filename); ret = STATUS_FAILED; } - + _allowWindowed = true; // TODO: These two settings should probably be cleaned out altogether. _compressedSavegames = true; - + delete[] origBuffer; - + return ret; } @@ -219,4 +219,4 @@ char *BaseGameSettings::getKeyFromStringTable(const char *str) const { return _stringTable->getKey(str); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h index 1dfb0b50cc..38a2fd1042 100644 --- a/engines/wintermute/base/base_game_settings.h +++ b/engines/wintermute/base/base_game_settings.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -66,6 +66,6 @@ private: bool _richSavedGames; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp index 072a1bb71b..aeb56ad282 100644 --- a/engines/wintermute/base/base_keyboard_state.cpp +++ b/engines/wintermute/base/base_keyboard_state.cpp @@ -310,4 +310,4 @@ Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h index b62ece02b7..14a57ee7b8 100644 --- a/engines/wintermute/base/base_keyboard_state.h +++ b/engines/wintermute/base/base_keyboard_state.h @@ -61,7 +61,7 @@ private: bool _currentPrintable; uint32 _currentKeyData; uint32 _currentCharCode; - + bool _currentShift; bool _currentAlt; bool _currentControl; @@ -71,6 +71,6 @@ private: Common::KeyCode vKeyToKeyCode(uint32 vkey); //TODO, reimplement using ScummVM-backend }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp index f99ec2f5db..3d1df5ab84 100644 --- a/engines/wintermute/base/base_named_object.cpp +++ b/engines/wintermute/base/base_named_object.cpp @@ -68,4 +68,4 @@ void BaseNamedObject::setName(const char *name) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_named_object.h b/engines/wintermute/base/base_named_object.h index d25fec4a82..ee4a3bba6a 100644 --- a/engines/wintermute/base/base_named_object.h +++ b/engines/wintermute/base/base_named_object.h @@ -46,6 +46,6 @@ public: void setName(const char *name); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index ad181b922e..ea754f8f23 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -968,9 +968,9 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_movable)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); - persistMgr->transfer(TMEMBER(_relativeScale)); + persistMgr->transferFloat(TMEMBER(_relativeScale)); persistMgr->transfer(TMEMBER(_rotatable)); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); persistMgr->transferPtr(TMEMBER_PTR(_sFX)); persistMgr->transfer(TMEMBER(_sFXStart)); persistMgr->transfer(TMEMBER(_sFXVolume)); @@ -982,21 +982,21 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_soundEvent)); persistMgr->transfer(TMEMBER(_zoomable)); - persistMgr->transfer(TMEMBER(_scaleX)); - persistMgr->transfer(TMEMBER(_scaleY)); + persistMgr->transferFloat(TMEMBER(_scaleX)); + persistMgr->transferFloat(TMEMBER(_scaleY)); - persistMgr->transfer(TMEMBER(_rotate)); + persistMgr->transferFloat(TMEMBER(_rotate)); persistMgr->transfer(TMEMBER(_rotateValid)); - persistMgr->transfer(TMEMBER(_relativeRotate)); + persistMgr->transferFloat(TMEMBER(_relativeRotate)); persistMgr->transfer(TMEMBER(_saveState)); persistMgr->transfer(TMEMBER(_nonIntMouseEvents)); persistMgr->transfer(TMEMBER_INT(_sFXType)); - persistMgr->transfer(TMEMBER(_sFXParam1)); - persistMgr->transfer(TMEMBER(_sFXParam2)); - persistMgr->transfer(TMEMBER(_sFXParam3)); - persistMgr->transfer(TMEMBER(_sFXParam4)); + persistMgr->transferFloat(TMEMBER(_sFXParam1)); + persistMgr->transferFloat(TMEMBER(_sFXParam2)); + persistMgr->transferFloat(TMEMBER(_sFXParam3)); + persistMgr->transferFloat(TMEMBER(_sFXParam4)); persistMgr->transfer(TMEMBER_INT(_blendMode)); @@ -1242,4 +1242,4 @@ bool BaseObject::afterMove() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h index 7afe9cf94c..42041c5e3c 100644 --- a/engines/wintermute/base/base_object.h +++ b/engines/wintermute/base/base_object.h @@ -142,6 +142,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp index a7e3bd5efb..0b677b6cb2 100644 --- a/engines/wintermute/base/base_parser.cpp +++ b/engines/wintermute/base/base_parser.cpp @@ -464,4 +464,4 @@ int32 BaseParser::scanStr(const char *in, const char *format, ...) { return num; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h index 4953ac3c0b..4bf48cc016 100644 --- a/engines/wintermute/base/base_parser.h +++ b/engines/wintermute/base/base_parser.h @@ -83,6 +83,6 @@ private: char *_whiteSpace; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 5dbacb157b..2e2726f361 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -94,7 +94,7 @@ BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool dele if (savePrefix) { _savePrefix = savePrefix; } else if (_gameRef) { - _savePrefix = _gameRef->getGameId(); + _savePrefix = _gameRef->getGameTargetName(); } else { _savePrefix = "wmesav"; } @@ -282,7 +282,7 @@ bool BasePersistenceManager::initSave(const char *desc) { } else { _saveStream->writeUint32LE(0); } - + thumbnailOK = true; } } @@ -637,7 +637,7 @@ bool BasePersistenceManager::transfer(const char *name, uint32 *val) { ////////////////////////////////////////////////////////////////////////// // float -bool BasePersistenceManager::transfer(const char *name, float *val) { +bool BasePersistenceManager::transferFloat(const char *name, float *val) { if (_saving) { putFloat(*val); if (_saveStream->err()) { @@ -887,4 +887,4 @@ bool BasePersistenceManager::checkVersion(byte verMajor, byte verMinor, byte ver return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h index 7b578085ba..c09b3345b7 100644 --- a/engines/wintermute/base/base_persistence_manager.h +++ b/engines/wintermute/base/base_persistence_manager.h @@ -76,7 +76,7 @@ public: bool transferPtr(const char *name, void *val); bool transfer(const char *name, int32 *val); bool transfer(const char *name, uint32 *val); - bool transfer(const char *name, float *val); + bool transferFloat(const char *name, float *val); bool transfer(const char *name, double *val); bool transfer(const char *name, bool *val); bool transfer(const char *name, byte *val); @@ -115,6 +115,6 @@ private: BaseGame *_gameRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp index fbd8960894..fe6ca941f3 100644 --- a/engines/wintermute/base/base_point.cpp +++ b/engines/wintermute/base/base_point.cpp @@ -60,4 +60,4 @@ bool BasePoint::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h index 26568d5d0b..cf8a5be336 100644 --- a/engines/wintermute/base/base_point.h +++ b/engines/wintermute/base/base_point.h @@ -45,6 +45,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp index 9f19dfd74a..ac0c107d3b 100644 --- a/engines/wintermute/base/base_quick_msg.cpp +++ b/engines/wintermute/base/base_quick_msg.cpp @@ -52,4 +52,4 @@ uint32 BaseQuickMsg::getStartTime() const { return _startTime; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h index 377f7733fd..b706424c18 100644 --- a/engines/wintermute/base/base_quick_msg.h +++ b/engines/wintermute/base/base_quick_msg.h @@ -44,6 +44,6 @@ private: uint32 _startTime; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 2dabe6ae44..36036a1f18 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -432,7 +432,7 @@ bool BaseRegion::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); - persistMgr->transfer(TMEMBER(_lastMimicScale)); + persistMgr->transferFloat(TMEMBER(_lastMimicScale)); persistMgr->transfer(TMEMBER(_lastMimicX)); persistMgr->transfer(TMEMBER(_lastMimicY)); _points.persist(persistMgr); @@ -532,4 +532,4 @@ bool BaseRegion::mimic(BaseRegion *region, float scale, int x, int y) { return createRegion() ? STATUS_OK : STATUS_FAILED; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h index 67ca158897..93ad6a6fbe 100644 --- a/engines/wintermute/base/base_region.h +++ b/engines/wintermute/base/base_region.h @@ -65,6 +65,6 @@ private: int32 _lastMimicY; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index 036bac1dd8..25b8775a98 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -500,4 +500,4 @@ bool BaseScriptHolder::sendEvent(const char *eventName) { return DID_SUCCEED(applyEvent(eventName)); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h index 38a3f935d3..c34b0378a1 100644 --- a/engines/wintermute/base/base_script_holder.h +++ b/engines/wintermute/base/base_script_holder.h @@ -71,6 +71,6 @@ public: virtual bool sendEvent(const char *eventName); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index 5753b0482b..be1e18c2c4 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -188,4 +188,4 @@ ScScript *BaseScriptable::invokeMethodThread(const char *methodName) { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h index f23d7faa5b..08fd32081a 100644 --- a/engines/wintermute/base/base_scriptable.h +++ b/engines/wintermute/base/base_scriptable.h @@ -78,6 +78,6 @@ BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack); BaseScriptable *makeSXStore(BaseGame *inGame); BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack); -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index c920da9ee9..ab78c5ac7c 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -817,4 +817,4 @@ bool BaseSprite::killAllSounds() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 05cb9fc936..1387796895 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -32,6 +32,7 @@ #include "engines/wintermute/coll_templ.h" #include "engines/wintermute/base/base_script_holder.h" +#include "engines/wintermute/graphics/transform_tools.h" namespace Wintermute { class BaseFrame; @@ -44,17 +45,17 @@ public: void setDefaults(); DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) - bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); + bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = kDefaultZoomX, float scaleY = kDefaultZoomY); int32 _moveY; int32 _moveX; - bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); - bool getCurrentFrame(float zoomX = 100, float zoomY = 100); + bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod, float rotate = kDefaultAngle, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool getCurrentFrame(float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY); void reset(); bool isChanged(); bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); + bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod); bool _looping; int32 _currentFrame; bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr); @@ -88,6 +89,6 @@ private: bool killAllSounds(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index 8207c32244..3d9cc4f8b3 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -253,4 +253,4 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h index 128807bd1a..f8808f5b27 100644 --- a/engines/wintermute/base/base_string_table.h +++ b/engines/wintermute/base/base_string_table.h @@ -50,6 +50,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index d93cf667f1..8a8f63240b 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -38,6 +38,8 @@ #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script_stack.h" +#include "engines/wintermute/graphics/transform_tools.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { @@ -46,8 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _surface = nullptr; - _hotspotX = _hotspotY = 0; - _alpha = 0xFFFFFFFF; + _hotspotX = kDefaultHotspotX; + _hotspotY = kDefaultHotspotY; + _alpha = kDefaultRgbaMod; _transparent = 0xFFFF00FF; _wantsDefaultRect = false; @@ -233,12 +236,18 @@ const char* BaseSubFrame::getSurfaceFilename() { ////////////////////////////////////////////////////////////////////// bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { + + rotate = fmod(rotate, 360.0f); + if (rotate < 0) { + rotate += 360.0f; + } + if (!_surface) { return STATUS_OK; } if (registerOwner != nullptr && !_decoration) { - if (zoomX == 100 && zoomY == 100) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise)); } else { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise)); @@ -251,17 +260,24 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl bool res; //if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha) - if (_alpha != 0xFFFFFFFF) { + if (_alpha != kDefaultRgbaMod) { alpha = _alpha; } - if (rotate != 0.0f) { - res = _surface->displayTransform((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), _hotspotX, _hotspotY, getRect(), zoomX, zoomY, alpha, rotate, blendMode, _mirrorX, _mirrorY); + if (rotate != kDefaultAngle) { + Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin; + Point32 origin(x, y); + Rect32 oldRect = getRect(); + Point32 newHotspot; + TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0); + Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot); + newOrigin = origin - newHotspot; + res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { - if (zoomX == 100 && zoomY == 100) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY); } else { - res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); + res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / kDefaultZoomX)), (int)(y - _hotspotY * (zoomY / kDefaultZoomY)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); } } @@ -657,4 +673,4 @@ bool BaseSubFrame::setSurfaceSimple() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h index 37ba34b748..ba3d5b955a 100644 --- a/engines/wintermute/base/base_sub_frame.h +++ b/engines/wintermute/base/base_sub_frame.h @@ -88,6 +88,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 8dbd6a6d2a..f1d068674b 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -203,4 +203,4 @@ bool BaseSurfaceStorage::surfaceSortCB(const BaseSurface *s1, const BaseSurface } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h index 61738e69a2..c0049d676c 100644 --- a/engines/wintermute/base/base_surface_storage.h +++ b/engines/wintermute/base/base_surface_storage.h @@ -52,6 +52,6 @@ public: Common::Array<BaseSurface *> _surfaces; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp index 1c869e6a2b..eee5f1aae7 100644 --- a/engines/wintermute/base/base_transition_manager.cpp +++ b/engines/wintermute/base/base_transition_manager.cpp @@ -135,4 +135,4 @@ bool BaseTransitionMgr::update() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h index edb3045a58..82edb9ff88 100644 --- a/engines/wintermute/base/base_transition_manager.h +++ b/engines/wintermute/base/base_transition_manager.h @@ -49,6 +49,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index f79e5c9f13..09ac80e9de 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -97,4 +97,4 @@ int BaseViewport::getHeight() const { return _rect.bottom - _rect.top; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 584e5a78f9..0225c02c7c 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -52,6 +52,6 @@ private: Rect32 _rect; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 3c1ecc7a73..7391d819fc 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -66,12 +66,6 @@ static Common::FSNode getNodeForRelativePath(const Common::String &filename) { const Common::FSNode gameDataDir(ConfMan.get("path")); Common::FSNode curNode = gameDataDir; - Common::String fixedPath = ""; - while (!path.empty()) { - fixedPath += path.nextToken() + "/"; - } - fixedPath.deleteLastChar(); - // Parse all path-elements while (!path.empty()) { // Get the next path-component by slicing on '\\' @@ -198,4 +192,4 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h index c9f93b80d9..81cc22b86d 100644 --- a/engines/wintermute/base/file/base_disk_file.h +++ b/engines/wintermute/base/file/base_disk_file.h @@ -36,6 +36,6 @@ namespace Wintermute { Common::SeekableReadStream *openDiskFile(const Common::String &filename); bool diskFileExists(const Common::String &filename); -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp index f52a13211e..42eea69824 100644 --- a/engines/wintermute/base/file/base_file.cpp +++ b/engines/wintermute/base/file/base_file.cpp @@ -65,4 +65,4 @@ Common::SeekableReadStream *BaseFile::getMemStream() { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h index 8eda6d51d9..9acda7ffce 100644 --- a/engines/wintermute/base/file/base_file.h +++ b/engines/wintermute/base/file/base_file.h @@ -62,6 +62,6 @@ public: virtual Common::SeekableReadStream *getMemStream(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp index 1968da6f47..846f56b55c 100644 --- a/engines/wintermute/base/file/base_file_entry.cpp +++ b/engines/wintermute/base/file/base_file_entry.cpp @@ -70,4 +70,4 @@ BaseFileEntry::~BaseFileEntry() { _package = nullptr; // ref only } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h index 6e4823d994..9d738c8c11 100644 --- a/engines/wintermute/base/file/base_file_entry.h +++ b/engines/wintermute/base/file/base_file_entry.h @@ -55,6 +55,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 73f767c3ef..512279b72c 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -273,4 +273,4 @@ Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common:: return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index bcf088aaea..18156c4f65 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -85,6 +85,6 @@ private: Common::HashMap<Common::String, Common::ArchiveMemberPtr>::iterator _filesIter; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index 2c4ddf4875..bb172ca66a 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -150,4 +150,4 @@ bool BaseSaveThumbFile::seek(uint32 pos, int whence) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h index 3b217525fd..faf1af9255 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.h +++ b/engines/wintermute/base/file/base_save_thumb_file.h @@ -47,6 +47,6 @@ private: byte *_data; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h index 2234139408..a2ec5d28d5 100644 --- a/engines/wintermute/base/file/dcpackage.h +++ b/engines/wintermute/base/file/dcpackage.h @@ -75,6 +75,6 @@ v2: uint32 TimeDate1 */ -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp index 596f9fb5c6..26bc0e7985 100644 --- a/engines/wintermute/base/font/base_font.cpp +++ b/engines/wintermute/base/font/base_font.cpp @@ -137,4 +137,4 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) { return ret; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font.h b/engines/wintermute/base/font/base_font.h index 50587fa7eb..d75d3f4fb5 100644 --- a/engines/wintermute/base/font/base_font.h +++ b/engines/wintermute/base/font/base_font.h @@ -56,6 +56,6 @@ private: static bool isTrueType(BaseGame *game, const Common::String &filename); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index 03bd471636..890a9a2f83 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -587,4 +587,4 @@ int BaseFontBitmap::getLetterHeight() { return _tileHeight; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h index 0bdac64026..c810777446 100644 --- a/engines/wintermute/base/font/base_font_bitmap.h +++ b/engines/wintermute/base/font/base_font_bitmap.h @@ -66,6 +66,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp index 3286742478..8abd368b70 100644 --- a/engines/wintermute/base/font/base_font_storage.cpp +++ b/engines/wintermute/base/font/base_font_storage.cpp @@ -138,4 +138,4 @@ bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h index 60874167e7..f4ac490324 100644 --- a/engines/wintermute/base/font/base_font_storage.h +++ b/engines/wintermute/base/font/base_font_storage.h @@ -50,6 +50,6 @@ public: bool initLoop(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 2fcdebc117..3059a69047 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -644,4 +644,4 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight }*/ } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index f93505921f..fdbae30684 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -148,6 +148,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index 75de95128f..d0dbae352e 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -228,4 +228,4 @@ bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) { return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h index 017305e5d0..4b04fd1252 100644 --- a/engines/wintermute/base/gfx/base_image.h +++ b/engines/wintermute/base/gfx/base_image.h @@ -67,6 +67,6 @@ private: BaseFileManager *_fileManager; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index c20881e425..1f171209d7 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -113,15 +113,21 @@ void BaseRenderer::setIndicatorVal(int value) { } void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) { - // TODO: Handle NULL - _loadImageName = filename; + if (filename == nullptr) { + _saveImageName = ""; + } else { + _loadImageName = filename; + } _loadImageX = x; _loadImageY = y; } void BaseRenderer::setSaveImage(const char *filename, int x, int y) { - // TODO: Handle NULL - _saveImageName = filename; + if (filename == nullptr) { + _saveImageName = ""; + } else { + _saveImageName = filename; + } _saveImageX = x; _saveImageY = y; } @@ -395,4 +401,4 @@ bool BaseRenderer::displayIndicator() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index bfef29a5ed..31dc2a022d 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -228,6 +228,6 @@ private: BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp index 2002463ea4..19639c0c33 100644 --- a/engines/wintermute/base/gfx/base_surface.cpp +++ b/engines/wintermute/base/gfx/base_surface.cpp @@ -75,8 +75,8 @@ bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) { } ////////////////////////////////////////////////////////////////////////// -bool BaseSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY); +bool BaseSurface::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) { + return displayTransform(x, y, rect, newRect, transform); } ////////////////////////////////////////////////////////////////////////// @@ -146,4 +146,4 @@ void BaseSurface::setSize(int width, int height) { _height = height; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index b83efa0bb8..8a0603734e 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -32,6 +32,7 @@ #include "engines/wintermute/base/base.h" #include "engines/wintermute/math/rect32.h" #include "graphics/surface.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { @@ -49,12 +50,12 @@ public: virtual bool displayHalfTrans(int x, int y, Rect32 rect); virtual bool isTransparentAt(int x, int y); - virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0; virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; - virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; - virtual bool displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) = 0; + virtual bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) = 0; virtual bool restore(); virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0; @@ -95,6 +96,6 @@ protected: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index e1424cea87..668105457f 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -60,8 +60,7 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _borderLeft = _borderRight = _borderTop = _borderBottom = 0; _ratioX = _ratioY = 1.0f; - setAlphaMod(255); - setColorMod(255, 255, 255); + _colorMod = kDefaultRgbaMod; _dirtyRect = nullptr; _disableDirtyRects = false; _tempDisableDirtyRects = 0; @@ -150,18 +149,6 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { return STATUS_OK; } -void BaseRenderOSystem::setAlphaMod(byte alpha) { - byte r = RGBCOLGetR(_colorMod); - byte g = RGBCOLGetB(_colorMod); - byte b = RGBCOLGetB(_colorMod); - _colorMod = BS_ARGB(alpha, r, g, b); -} - -void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) { - byte alpha = RGBCOLGetA(_colorMod); - _colorMod = BS_ARGB(alpha, r, g, b); -} - bool BaseRenderOSystem::indicatorFlip() { g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight); g_system->updateScreen(); @@ -200,9 +187,9 @@ bool BaseRenderOSystem::flip() { } if (_needsFlip || _disableDirtyRects || _tempDisableDirtyRects) { if (_disableDirtyRects || _tempDisableDirtyRects) { - g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); } - // g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); + // g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); delete _dirtyRect; _dirtyRect = nullptr; g_system->updateScreen(); @@ -256,7 +243,6 @@ void BaseRenderOSystem::fade(uint16 alpha) { return fadeToColor(0, 0, 0, dwAlpha); } - ////////////////////////////////////////////////////////////////////////// void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) { Common::Rect fillRect; @@ -279,14 +265,14 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect //TODO: This is only here until I'm sure about the final pixelformat uint32 col = _renderSurface->format.ARGBToColor(a, r, g, b); - setAlphaMod(255); - setColorMod(255, 255, 255); Graphics::Surface surf; surf.create((uint16)fillRect.width(), (uint16)fillRect.height(), _renderSurface->format); Common::Rect sizeRect(fillRect); sizeRect.translate(-fillRect.top, -fillRect.left); surf.fillRect(fillRect, col); - drawSurface(nullptr, &surf, &sizeRect, &fillRect, false, false); + TransformStruct temp = TransformStruct(); + temp._alphaDisable = false; + drawSurface(nullptr, &surf, &sizeRect, &fillRect, temp); surf.free(); //SDL_SetRenderDrawColor(_renderer, r, g, b, a); @@ -298,16 +284,18 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const { return _renderSurface->format; } -void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) { +void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform) { + if (_tempDisableDirtyRects || _disableDirtyRects) { - RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); - ticket->_colorMod = _colorMod; + RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); + ticket->_transform._rgbaMod = _colorMod; ticket->_wantsDraw = true; _renderQueue.push_back(ticket); _previousTicket = ticket; drawFromSurface(ticket); return; } + // Start searching from the beginning for the first and second items (since it's empty the first time around // then keep incrementing the start-position, to avoid comparing against already used tickets. if (_drawNum == 0 || _drawNum == 1) { @@ -320,12 +308,11 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S } if (owner) { // Fade-tickets are owner-less - RenderTicket compare(owner, nullptr, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); + RenderTicket compare(owner, nullptr, srcRect, dstRect, transform); compare._batchNum = _batchNum; if (_spriteBatch) { _batchNum++; } - compare._colorMod = _colorMod; RenderQueueIterator it; // Avoid calling end() and operator* every time, when potentially going through // LOTS of tickets. @@ -334,7 +321,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S for (it = _lastAddedTicket; it != endIterator; ++it) { compareTicket = *it; if (*(compareTicket) == compare && compareTicket->_isValid) { - compareTicket->_colorMod = _colorMod; + compareTicket->_transform._rgbaMod = transform._rgbaMod; if (_disableDirtyRects) { drawFromSurface(compareTicket); } else { @@ -349,8 +336,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S } } } - RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); - ticket->_colorMod = _colorMod; + RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); if (!_disableDirtyRects) { drawFromTicket(ticket); _previousTicket = ticket; @@ -385,12 +371,14 @@ void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX, int initLeft = dstRect.left; int initRight = dstRect.right; + TransformStruct temp = TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, BLEND_NORMAL, kDefaultRgbaMod, false, false, kDefaultOffsetX, kDefaultOffsetY); + for (int i = 0; i < numTimesY; i++) { if (i == 0) { dstRect.translate(offsetX, 0); } for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) { - drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, false, false); + drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, temp); dstRect.translate(offsetX, 0); } dstRect.left = initLeft; @@ -535,7 +523,7 @@ void BaseRenderOSystem::drawTickets() { // convert from screen-coords to surface-coords. dstClip.translate(-offsetX, -offsetY); - _colorMod = ticket->_colorMod; + _colorMod = ticket->_transform._rgbaMod; drawFromSurface(ticket, &pos, &dstClip); _needsFlip = true; } @@ -546,7 +534,7 @@ void BaseRenderOSystem::drawTickets() { // Revert the colorMod-state. _colorMod = oldColorMod; - + it = _renderQueue.begin(); // Clean out the old tickets decrement = 0; @@ -625,8 +613,8 @@ bool BaseRenderOSystem::setViewport(int left, int top, int right, int bottom) { // TODO: Hopefully this is the same logic that ScummVM uses. rect.left = (int16)(left + _borderLeft); rect.top = (int16)(top + _borderTop); - rect.right = (int16)((right - left) * _ratioX); - rect.bottom = (int16)((bottom - top) * _ratioY); + rect.setWidth((int16)((right - left) * _ratioX)); + rect.setHeight((int16)((bottom - top) * _ratioY)); _renderRect = rect; return STATUS_OK; @@ -643,15 +631,13 @@ Rect32 BaseRenderOSystem::getViewPort() { ////////////////////////////////////////////////////////////////////////// void BaseRenderOSystem::modTargetRect(Common::Rect *rect) { - // FIXME: This is wrong in quite a few ways right now, and ends up - // breaking the notebook in Dirty Split, so we disable the correction - // for now, this will need fixing when a game with odd aspect-ratios - // show up. return; - rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft - _renderRect.left); - rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop - _renderRect.top); - rect->setWidth((int16)MathUtil::roundUp(rect->width() * _ratioX)); - rect->setHeight((int16)MathUtil::roundUp(rect->height() * _ratioY)); + int newWidth = (int16)MathUtil::roundUp(rect->width() * _ratioX); + int newHeight = (int16)MathUtil::roundUp(rect->height() * _ratioY); + rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft); + rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop); + rect->setWidth(newWidth); + rect->setHeight(newHeight); } ////////////////////////////////////////////////////////////////////////// @@ -694,7 +680,7 @@ void BaseRenderOSystem::endSaveLoad() { _drawNum = 1; _renderSurface->fillRect(Common::Rect(0, 0, _renderSurface->h, _renderSurface->w), _renderSurface->format.ARGBToColor(255, 0, 0, 0)); - g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); g_system->updateScreen(); } @@ -710,4 +696,4 @@ bool BaseRenderOSystem::endSpriteBatch() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 3cb0fa82a3..928a52d4fc 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -33,10 +33,30 @@ #include "common/rect.h" #include "graphics/surface.h" #include "common/list.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { class BaseSurfaceOSystem; class RenderTicket; +/** + * A 2D-renderer implementation for WME. + * This renderer makes use of a "ticket"-system, where all draw-calls + * are stored as tickets until flip() is called, and compared against the tickets + * from last frame, to determine which calls were the same as last round + * (i.e. in the exact same order, with the exact same arguments), and thus + * figure out which parts of the screen need to be redrawn. + * + * Important concepts to handle here, is the ordered number of any ticket + * which is called the "drawNum", every frame this starts from scratch, and + * then the incoming tickets created from the draw-calls are checked to see whether + * they came before, on, or after the drawNum they had last frame. Everything else + * being equal, this information is then used to check whether the draw order changed, + * which will then create a need for redrawing, as we draw with an alpha-channel here. + * + * There is also a draw path that draws without tickets, for debugging purposes, + * as well as to accomodate situations with large enough amounts of draw calls, + * that there will be too much overhead involved with comparing the generated tickets. + */ class BaseRenderOSystem : public BaseRenderer { public: BaseRenderOSystem(BaseGame *inGame); @@ -56,10 +76,13 @@ public: BaseImage *takeScreenshot() override; - void setAlphaMod(byte alpha); - void setColorMod(byte r, byte g, byte b); void invalidateTicket(RenderTicket *renderTicket); void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf); + /** + * Insert a ticket into the queue, adding a dirty rect if it's + * new, or out-of-order from last draw from the ticket. + * param renderTicket the ticket to be added. + */ void drawFromTicket(RenderTicket *renderTicket); bool setViewport(int left, int top, int right, int bottom) override; @@ -80,11 +103,18 @@ public: virtual bool startSpriteBatch() override; virtual bool endSpriteBatch() override; void endSaveLoad(); - void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha = false) ; + void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform); void repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY); BaseSurface *createSurface() override; private: - void addDirtyRect(const Common::Rect &rect) ; + /** + * Mark a specified rect of the screen as dirty. + * @param rect the region to be marked as dirty + */ + void addDirtyRect(const Common::Rect &rect); + /** + * Traverse the tickets that are dirty, and draw them + */ void drawTickets(); // Non-dirty-rects: void drawFromSurface(RenderTicket *ticket); @@ -97,7 +127,7 @@ private: RenderTicket *_previousTicket; bool _needsFlip; - uint32 _drawNum; + uint32 _drawNum; ///< The global number of the current draw-operation. Common::Rect _renderRect; Graphics::Surface *_renderSurface; Graphics::Surface *_blankSurface; @@ -119,6 +149,6 @@ private: bool _skipThisFrame; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 0572ef2f6e..d4c5905c4b 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -52,6 +52,7 @@ BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) { _lockPixels = nullptr; _lockPitch = 0; _loaded = false; + _rotation = 0; } ////////////////////////////////////////////////////////////////////////// @@ -163,7 +164,7 @@ bool BaseSurfaceOSystem::finishLoad() { needsColorKey = true; } } - + if (needsColorKey) { TransparentSurface trans(*_surface); trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, replaceAlpha); @@ -233,7 +234,7 @@ uint32 BaseSurfaceOSystem::getPixelAt(Graphics::Surface *surface, int x, int y) warning("BaseSurfaceOSystem::GetPixel - Not ported yet"); int bpp = surface->format.bytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ - uint8 *p = (uint8 *)surface->pixels + y * surface->pitch + x * bpp; + uint8 *p = (uint8 *)surface->getBasePtr(x, y); switch (bpp) { case 1: @@ -319,39 +320,56 @@ bool BaseSurfaceOSystem::endPixelOp() { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { - return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); +bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(zoomX, zoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !transparent, blendMode, mirrorX, mirrorY); +bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { + _rotation = 0; + TransformStruct transform; + if (transparent) { + transform = TransformStruct(zoomX, zoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY); + } else { + transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY); + } + return drawSprite(x, y, &rect, nullptr, transform); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); +bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) { + _rotation = (uint32)transform._angle; + if (transform._angle < 0.0f) { + warning("Negative rotation: %d %d", transform._angle, _rotation); + _rotation = (uint32)(360.0f + transform._angle); + warning("Negative post rotation: %d %d", transform._angle, _rotation); + } + return drawSprite(x, y, &rect, &newRect, transform); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { +bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transform) { BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); if (!_loaded) { @@ -359,17 +377,9 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo } if (renderer->_forceAlphaColor != 0) { - alpha = renderer->_forceAlphaColor; + transform._rgbaMod = renderer->_forceAlphaColor; } - byte r = RGBCOLGetR(alpha); - byte g = RGBCOLGetG(alpha); - byte b = RGBCOLGetB(alpha); - byte a = RGBCOLGetA(alpha); - - renderer->setAlphaMod(a); - renderer->setColorMod(r, g, b); - #if 0 // These are kept for reference if BlendMode is reimplemented at some point. if (alphaDisable) { SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE); @@ -386,8 +396,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo srcRect.setHeight(rect->bottom - rect->top); Common::Rect position; - position.left = x + offsetX; - position.top = y + offsetY; + position.left = x + transform._offset.x; + position.top = y + transform._offset.y; // Crop off-by-ones: if (position.left == -1) { @@ -396,31 +406,34 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo if (position.top == -1) { position.top = 0; // TODO: Something is wrong } - - position.setWidth((int16)((float)srcRect.width() * zoomX / 100.f)); - position.setHeight((int16)((float)srcRect.height() * zoomX / 100.f)); - + if (newRect) { + position.top = y; + position.left = x; + position.right = x + newRect->width(); + position.bottom = y + newRect->height(); + position.setWidth(newRect->width()); + position.setHeight(newRect->height()); + } else { + position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / kDefaultZoomX)); + position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / kDefaultZoomY)); + } renderer->modTargetRect(&position); - /* position.left += offsetX; - position.top += offsetY;*/ - // TODO: This actually requires us to have the SAME source-offsets every time, // But no checking is in place for that yet. // TODO: Optimize by not doing alpha-blits if we lack or disable alpha - bool hasAlpha; - if (_hasAlpha && !alphaDisable) { + + bool hasAlpha = false; + + if (_hasAlpha && !transform._alphaDisable) { hasAlpha = true; - } else { - hasAlpha = false; - } - if (alphaDisable) { + } + + if (transform._alphaDisable) { warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } - - renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, !hasAlpha); - + renderer->drawSurface(this, _surface, &srcRect, &position, transform); return STATUS_OK; } @@ -441,4 +454,4 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 9091ec65b1..da86833517 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -51,12 +51,12 @@ public: bool endPixelOp() override; - bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; + bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransform(int x, int y, int hotX, int hotY, Rect32 Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; /* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); @@ -85,16 +85,17 @@ private: Graphics::Surface *_surface; bool _loaded; bool finishLoad(); - bool drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0); + bool drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transformStruct); void genAlphaMask(Graphics::Surface *surface); uint32 getPixelAt(Graphics::Surface *surface, int x, int y); + uint32 _rotation; bool _hasAlpha; void *_lockPixels; int _lockPitch; byte *_alphaMask; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 36c5d7b740..98739e0778 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -26,22 +26,22 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/graphics/transparent_surface.h" + #include "engines/wintermute/base/gfx/osystem/render_ticket.h" +#include "engines/wintermute/graphics/transform_tools.h" +#include "common/textconsole.h" namespace Wintermute { -RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) : _owner(owner), -_srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(!disableAlpha) { - _colorMod = 0; +RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform) : + _owner(owner), + _srcRect(*srcRect), + _dstRect(*dstRect), + _drawNum(0), + _isValid(true), + _wantsDraw(true), + _transform(transform) { _batchNum = 0; - _mirror = TransparentSurface::FLIP_NONE; - if (mirrorX) { - _mirror |= TransparentSurface::FLIP_V; - } - if (mirrorY) { - _mirror |= TransparentSurface::FLIP_H; - } if (surf) { _surface = new Graphics::Surface(); _surface->create((uint16)srcRect->width(), (uint16)srcRect->height(), surf->format); @@ -51,7 +51,13 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw( memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); } // Then scale it if necessary - if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) { + if (_transform._angle != kDefaultAngle) { + TransparentSurface src(*_surface, false); + Graphics::Surface *temp = src.rotoscale(transform); + _surface->free(); + delete _surface; + _surface = temp; + } else if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) { TransparentSurface src(*_surface, false); Graphics::Surface *temp = src.scale(dstRect->width(), dstRect->height()); _surface->free(); @@ -60,6 +66,14 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw( } } else { _surface = nullptr; + + if (transform._angle != kDefaultAngle) { // Make sure comparison-tickets get the correct width + Rect32 newDstRect; + Point32 newHotspot; + newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); + _dstRect.setWidth(newDstRect.right - newDstRect.left); + _dstRect.setHeight(newDstRect.bottom - newDstRect.top); + } } } @@ -70,32 +84,31 @@ RenderTicket::~RenderTicket() { } } -bool RenderTicket::operator==(RenderTicket &t) { +bool RenderTicket::operator==(const RenderTicket &t) const { if ((t._owner != _owner) || (t._batchNum != _batchNum) || - (t._hasAlpha != _hasAlpha) || - (t._mirror != _mirror) || - (t._colorMod != _colorMod) || + (t._transform != _transform) || (t._dstRect != _dstRect) || - (t._srcRect != _srcRect)) { + (t._srcRect != _srcRect) + ) { return false; } return true; } // Replacement for SDL2's SDL_RenderCopy -void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) { +void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const { TransparentSurface src(*getSurface(), false); Common::Rect clipRect; clipRect.setWidth(getSurface()->w); clipRect.setHeight(getSurface()->h); - src._enableAlphaBlit = _hasAlpha; - src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _mirror, &clipRect, _colorMod, clipRect.width(), clipRect.height()); + src._enableAlphaBlit = !_transform._alphaDisable; + src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _transform._flip, &clipRect, _transform._rgbaMod, clipRect.width(), clipRect.height()); } -void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) { +void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const { TransparentSurface src(*getSurface(), false); bool doDelete = false; if (!clipRect) { @@ -105,11 +118,11 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect clipRect->setHeight(getSurface()->h); } - src._enableAlphaBlit = _hasAlpha; - src.blit(*_targetSurface, dstRect->left, dstRect->top, _mirror, clipRect, _colorMod, clipRect->width(), clipRect->height()); + src._enableAlphaBlit = !_transform._alphaDisable; + src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height()); if (doDelete) { delete clipRect; } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h index 968b42b5e1..875102d01c 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.h +++ b/engines/wintermute/base/gfx/osystem/render_ticket.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -29,22 +29,36 @@ #ifndef WINTERMUTE_RENDER_TICKET_H #define WINTERMUTE_RENDER_TICKET_H +#include "engines/wintermute/graphics/transparent_surface.h" #include "graphics/surface.h" #include "common/rect.h" namespace Wintermute { class BaseSurfaceOSystem; +/** + * A single RenderTicket. + * A render ticket is a collection of the data and draw specifications made + * for a single draw-call in the OSystem-backend for WME. The ticket additionally + * holds the order in which this call was made, so that it can be detected if + * the same call is done in the following frame. Thus allowing us to potentially + * skip drawing the same region again, unless anything has changed. Since a surface + * can have a potentially large amount of draw-calls made to it, at varying rotation, + * zoom, and crop-levels we also need to hold a copy of the necessary data. + * (Video-surfaces may even change their data). The promise that is made when a ticket + * is created is that what the state was of the surface at THAT point, is what will end + * up on screen at flip() time. + */ class RenderTicket { public: - RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false, bool disableAlpha = false); - RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {} + RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, TransformStruct transform); + RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0), _transform(TransformStruct()) {} ~RenderTicket(); - const Graphics::Surface *getSurface() { return _surface; } + const Graphics::Surface *getSurface() const { return _surface; } // Non-dirty-rects: - void drawToSurface(Graphics::Surface *_targetSurface); + void drawToSurface(Graphics::Surface *_targetSurface) const; // Dirty-rects: - void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect); + void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const; Common::Rect _dstRect; uint32 _batchNum; @@ -52,18 +66,17 @@ public: bool _isValid; bool _wantsDraw; uint32 _drawNum; - uint32 _colorMod; + TransformStruct _transform; + BaseSurfaceOSystem *_owner; - bool operator==(RenderTicket &a); - const Common::Rect *getSrcRect() { return &_srcRect; } + bool operator==(const RenderTicket &a) const; + const Common::Rect *getSrcRect() const { return &_srcRect; } private: Graphics::Surface *_surface; Common::Rect _srcRect; - bool _hasAlpha; - uint32 _mirror; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index c86e1ce369..aaffa0965a 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -1163,12 +1163,12 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_angle1)); persistMgr->transfer(TMEMBER(_angle2)); - persistMgr->transfer(TMEMBER(_velocity1)); - persistMgr->transfer(TMEMBER(_velocity2)); + persistMgr->transferFloat(TMEMBER(_velocity1)); + persistMgr->transferFloat(TMEMBER(_velocity2)); persistMgr->transfer(TMEMBER(_velocityZBased)); - persistMgr->transfer(TMEMBER(_scale1)); - persistMgr->transfer(TMEMBER(_scale2)); + persistMgr->transferFloat(TMEMBER(_scale1)); + persistMgr->transferFloat(TMEMBER(_scale2)); persistMgr->transfer(TMEMBER(_scaleZBased)); persistMgr->transfer(TMEMBER(_maxParticles)); @@ -1196,14 +1196,14 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_alphaTimeBased)); - persistMgr->transfer(TMEMBER(_angVelocity1)); - persistMgr->transfer(TMEMBER(_angVelocity2)); + persistMgr->transferFloat(TMEMBER(_angVelocity1)); + persistMgr->transferFloat(TMEMBER(_angVelocity2)); - persistMgr->transfer(TMEMBER(_rotation1)); - persistMgr->transfer(TMEMBER(_rotation2)); + persistMgr->transferFloat(TMEMBER(_rotation1)); + persistMgr->transferFloat(TMEMBER(_rotation2)); - persistMgr->transfer(TMEMBER(_growthRate1)); - persistMgr->transfer(TMEMBER(_growthRate2)); + persistMgr->transferFloat(TMEMBER(_growthRate1)); + persistMgr->transferFloat(TMEMBER(_growthRate2)); persistMgr->transfer(TMEMBER(_exponentialGrowth)); persistMgr->transfer(TMEMBER(_useRegion)); @@ -1252,4 +1252,4 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index a0d701f338..94b4dc8126 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -135,6 +135,6 @@ private: BaseArray<char *> _sprites; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp index df84162504..122cdf1afe 100644 --- a/engines/wintermute/base/particles/part_force.cpp +++ b/engines/wintermute/base/particles/part_force.cpp @@ -62,4 +62,4 @@ bool PartForce::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h index 27f4cb7d90..cdb1ce40f9 100644 --- a/engines/wintermute/base/particles/part_force.h +++ b/engines/wintermute/base/particles/part_force.h @@ -52,6 +52,6 @@ public: bool persist(BasePersistenceManager *PersistMgr); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp index f1aba114de..86cacacb5c 100644 --- a/engines/wintermute/base/particles/part_particle.cpp +++ b/engines/wintermute/base/particles/part_particle.cpp @@ -234,9 +234,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_border)); persistMgr->transfer(TMEMBER(_pos)); - persistMgr->transfer(TMEMBER(_posZ)); + persistMgr->transferFloat(TMEMBER(_posZ)); persistMgr->transfer(TMEMBER(_velocity)); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); persistMgr->transfer(TMEMBER(_creationTime)); persistMgr->transfer(TMEMBER(_lifeTime)); persistMgr->transfer(TMEMBER(_isDead)); @@ -244,9 +244,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_fadeStart)); persistMgr->transfer(TMEMBER(_fadeTime)); persistMgr->transfer(TMEMBER(_currentAlpha)); - persistMgr->transfer(TMEMBER(_angVelocity)); - persistMgr->transfer(TMEMBER(_rotation)); - persistMgr->transfer(TMEMBER(_growthRate)); + persistMgr->transferFloat(TMEMBER(_angVelocity)); + persistMgr->transferFloat(TMEMBER(_rotation)); + persistMgr->transferFloat(TMEMBER(_growthRate)); persistMgr->transfer(TMEMBER(_exponentialGrowth)); persistMgr->transfer(TMEMBER(_fadeStartAlpha)); @@ -266,4 +266,4 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h index 8cca6b4057..281d87cf72 100644 --- a/engines/wintermute/base/particles/part_particle.h +++ b/engines/wintermute/base/particles/part_particle.h @@ -85,6 +85,6 @@ private: int32 _fadeStartAlpha; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/save_thumb_helper.cpp b/engines/wintermute/base/save_thumb_helper.cpp index bab29c5cf8..77514849a6 100644 --- a/engines/wintermute/base/save_thumb_helper.cpp +++ b/engines/wintermute/base/save_thumb_helper.cpp @@ -56,23 +56,23 @@ BaseImage *SaveThumbHelper::storeThumb(bool doFlip, int width, int height) { // works normally for direct3d _gameRef->displayContent(false); _gameRef->_renderer->flip(); - + _gameRef->displayContent(false); _gameRef->_renderer->flip(); } - + BaseImage *screenshot = _gameRef->_renderer->takeScreenshot(); if (!screenshot) { return nullptr; } - + // normal thumbnail if (_gameRef->getSaveThumbWidth() > 0 && _gameRef->getSaveThumbHeight() > 0) { thumbnail = new BaseImage(); thumbnail->copyFrom(screenshot, width, height); } - - + + delete screenshot; screenshot = nullptr; } @@ -99,7 +99,7 @@ bool SaveThumbHelper::storeThumbnail(bool doFlip) { bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) { delete _scummVMThumb; _scummVMThumb = nullptr; - + _scummVMThumb = storeThumb(doFlip, kThumbnailWidth, kThumbnailHeight2); if (!_scummVMThumb) { return STATUS_FAILED; @@ -107,4 +107,4 @@ bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/save_thumb_helper.h b/engines/wintermute/base/save_thumb_helper.h index d3bc5f5523..44792e3d75 100644 --- a/engines/wintermute/base/save_thumb_helper.h +++ b/engines/wintermute/base/save_thumb_helper.h @@ -47,6 +47,6 @@ private: BaseGame *_gameRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp index 1b7dfd42ed..8d37909bb4 100644 --- a/engines/wintermute/base/saveload.cpp +++ b/engines/wintermute/base/saveload.cpp @@ -201,4 +201,4 @@ bool SaveLoad::emptySaveSlot(int slot) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h index 722f7a89b6..15d4d86b26 100644 --- a/engines/wintermute/base/saveload.h +++ b/engines/wintermute/base/saveload.h @@ -52,6 +52,6 @@ private: static void afterLoadScript(void *script, void *data); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h index 4aae897dc2..d6bb3cd176 100644 --- a/engines/wintermute/base/scriptables/dcscript.h +++ b/engines/wintermute/base/scriptables/dcscript.h @@ -136,6 +136,6 @@ typedef enum { ELEMENT_STRING = 0 } TElementType; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index 1b945c2e1c..5aeff78c50 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -461,6 +461,7 @@ void ScScript::cleanup() { _parentScript = nullptr; // ref only delete _scriptStream; + _scriptStream = nullptr; } @@ -1464,4 +1465,4 @@ void ScScript::afterLoad() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h index ee9f45e204..488ff63606 100644 --- a/engines/wintermute/base/scriptables/script.h +++ b/engines/wintermute/base/scriptables/script.h @@ -169,6 +169,6 @@ public: virtual const char *dbgGetFilename(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp index f83fb36843..dd24457d6c 100644 --- a/engines/wintermute/base/scriptables/script_engine.cpp +++ b/engines/wintermute/base/scriptables/script_engine.cpp @@ -605,4 +605,4 @@ void ScEngine::dumpStats() { }*/ } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h index 639875ffb6..622b3c4b94 100644 --- a/engines/wintermute/base/scriptables/script_engine.h +++ b/engines/wintermute/base/scriptables/script_engine.h @@ -130,6 +130,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp index a466d361ec..7f1c769ec5 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.cpp +++ b/engines/wintermute/base/scriptables/script_ext_array.cpp @@ -249,4 +249,4 @@ bool SXArray::push(ScValue *val) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h index 68f808641e..e6381a011e 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.h +++ b/engines/wintermute/base/scriptables/script_ext_array.h @@ -51,6 +51,6 @@ private: Common::String _strRep; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp index afca0c4bbf..d88bfc5851 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.cpp +++ b/engines/wintermute/base/scriptables/script_ext_date.cpp @@ -307,4 +307,4 @@ int SXDate::scCompare(BaseScriptable *Value) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h index 062b7c55c7..0ccf093a7b 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.h +++ b/engines/wintermute/base/scriptables/script_ext_date.h @@ -49,6 +49,6 @@ private: Common::String _strRep; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp index 29e032a759..18f7b8213a 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.cpp +++ b/engines/wintermute/base/scriptables/script_ext_file.cpp @@ -825,4 +825,4 @@ Common::WriteStream *SXFile::openForAppend(const Common::String &filename, bool error("SXFile::openForAppend - WriteFiles not supported"); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h index fa2384109f..a1298929f2 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.h +++ b/engines/wintermute/base/scriptables/script_ext_file.h @@ -61,6 +61,6 @@ private: Common::WriteStream *openForAppend(const Common::String &filename, bool binary); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index d816fbec65..ec53b983e7 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -31,7 +31,6 @@ #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/persistent.h" #include "common/math.h" -#include <math.h> namespace Wintermute { @@ -292,4 +291,4 @@ bool SXMath::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h index 48c43ea7e8..1aa274a96f 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.h +++ b/engines/wintermute/base/scriptables/script_ext_math.h @@ -48,6 +48,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp index 9de9905fea..6a47c09136 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp @@ -526,4 +526,4 @@ int SXMemBuffer::scCompare(BaseScriptable *val) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h index 6700a03f50..4aad8b6484 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h @@ -55,6 +55,6 @@ private: bool checkBounds(ScScript *script, int start, int length); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp index b87aac81f9..a72b244f0a 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.cpp +++ b/engines/wintermute/base/scriptables/script_ext_object.cpp @@ -64,4 +64,4 @@ bool SXObject::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h index c85d16d44e..566111292a 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.h +++ b/engines/wintermute/base/scriptables/script_ext_object.h @@ -41,6 +41,6 @@ public: virtual ~SXObject(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index 7cb3b9360b..2f2422cdf9 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -430,4 +430,4 @@ int SXString::scCompare(BaseScriptable *val) { return strcmp(_string, ((SXString *)val)->_string); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h index 50b61deba4..7a95c59b4c 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.h +++ b/engines/wintermute/base/scriptables/script_ext_string.h @@ -53,6 +53,6 @@ private: int32 _capacity; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp index b53457c81b..801ac6ab52 100644 --- a/engines/wintermute/base/scriptables/script_stack.cpp +++ b/engines/wintermute/base/scriptables/script_stack.cpp @@ -192,4 +192,4 @@ bool ScStack::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h index 82c3debefa..ee04485a51 100644 --- a/engines/wintermute/base/scriptables/script_stack.h +++ b/engines/wintermute/base/scriptables/script_stack.h @@ -61,6 +61,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp index 5e2923e029..3532e127d0 100644 --- a/engines/wintermute/base/scriptables/script_value.cpp +++ b/engines/wintermute/base/scriptables/script_value.cpp @@ -992,4 +992,4 @@ bool ScValue::setProperty(const char *propName) { return ret; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h index a8e815023e..90ad9f182a 100644 --- a/engines/wintermute/base/scriptables/script_value.h +++ b/engines/wintermute/base/scriptables/script_value.h @@ -108,6 +108,6 @@ public: bool setProperty(const char *propName); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp index d027c03c8b..c1923b3ca8 100644 --- a/engines/wintermute/base/sound/base_sound.cpp +++ b/engines/wintermute/base/sound/base_sound.cpp @@ -289,4 +289,4 @@ bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3, return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h index 3412e6c3a3..0a984d240a 100644 --- a/engines/wintermute/base/sound/base_sound.h +++ b/engines/wintermute/base/sound/base_sound.h @@ -82,6 +82,6 @@ private: BaseSoundBuffer *_sound; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index 9c919abac6..7666a441a3 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -292,4 +292,4 @@ bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float p return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h index e78d062cd4..53b86f64c6 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.h +++ b/engines/wintermute/base/sound/base_sound_buffer.h @@ -95,6 +95,6 @@ private: int32 _volume; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp index f3e7bfb408..68e62f25b0 100644 --- a/engines/wintermute/base/sound/base_sound_manager.cpp +++ b/engines/wintermute/base/sound/base_sound_manager.cpp @@ -287,4 +287,4 @@ float BaseSoundMgr::posToPan(int x, int y) { return minPan + relPos * (maxPan - minPan); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h index 602571765f..5993a05001 100644 --- a/engines/wintermute/base/sound/base_sound_manager.h +++ b/engines/wintermute/base/sound/base_sound_manager.h @@ -64,6 +64,6 @@ private: bool setMasterVolume(byte percent); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/timer.cpp b/engines/wintermute/base/timer.cpp index 5dfc117f48..96097c10d5 100644 --- a/engines/wintermute/base/timer.cpp +++ b/engines/wintermute/base/timer.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/base/timer.h b/engines/wintermute/base/timer.h index ec5477ba2e..4099c6c825 100644 --- a/engines/wintermute/base/timer.h +++ b/engines/wintermute/base/timer.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -51,7 +51,7 @@ public: void persist(BasePersistenceManager *persistMgr); }; - + } // End of namespace Wintermute #endif diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h index 4a8e92c121..a3df92d6c8 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -138,6 +138,6 @@ public: } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/dctypes.h b/engines/wintermute/dctypes.h index bd4966eb6b..b40322147f 100644 --- a/engines/wintermute/dctypes.h +++ b/engines/wintermute/dctypes.h @@ -220,6 +220,6 @@ enum TShadowType { SHADOW_STENCIL = 3 }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp index 92b8e6251f..8c8b8255ab 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. @@ -81,4 +81,4 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) { return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h index 588b81af97..6fbbb084f0 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. @@ -32,7 +32,7 @@ class Console : public GUI::Debugger { public: Console(WintermuteEngine *vm); virtual ~Console(); - + bool Cmd_ShowFps(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); private: diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index 1bf2c76a50..ac21d78ef5 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -181,7 +181,7 @@ public: } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE) REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 00ec51a715..702c0b28ba 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -27,6 +27,7 @@ namespace Wintermute { static const PlainGameDescriptor wintermuteGames[] = { {"5ld", "Five Lethal Demons"}, {"5ma", "Five Magical Amulets"}, + {"bthreshold", "Beyond the Threshold"}, {"actualdest", "Actual Destination"}, {"carolreed4", "Carol Reed 4 - East Side Story"}, {"carolreed5", "Carol Reed 5 - The Colour of Murder"}, @@ -36,17 +37,22 @@ static const PlainGameDescriptor wintermuteGames[] = { {"carolreed9", "Carol Reed 9 - Cold Case Summer"}, {"chivalry", "Chivalry is Not Dead"}, {"deadcity", "Dead City"}, + {"dreaming", "Des Reves Elastiques Avec Mille Insectes Nommes Georges"}, {"dirtysplit", "Dirty Split"}, {"dreamscape", "Dreamscape"}, {"ghostsheet", "Ghost in the Sheet"}, {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, + {"jamesperis", "James Peris: No License Nor Control"}, {"julia", "J.U.L.I.A."}, {"mirage", "Mirage"}, {"pigeons", "Pigeons in the Park"}, {"reversion1", "Reversion: The Escape"}, - {"reversion2", "Reversion: The Meeting"}, + {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, + {"shinestar", "The Shine of a Star"}, {"thebox", "The Box"}, + {"tib", "Fairy Tales About Toshechka and Boshechka"}, + {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, {"wintermute", "Wintermute engine game"}, {0, 0} @@ -83,6 +89,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Beyond the Threshold + { + "bthreshold", + "", + AD_ENTRY1s("data.dcp", "d49bf9ccb2e74507447c82d6ad3e2bc4", 12773712), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Carol Reed 4 - East Side Story (Demo) { "carolreed4", @@ -125,6 +141,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Carol Reed 7 - Blue Madonna (Demo) + { + "carolreed7", + "Demo", + AD_ENTRY1s("data.dcp", "0372ad0c775266f6355e9e8ae397a2f1", 103719442), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Carol Reed 7 - Blue Madonna { "carolreed7", @@ -237,6 +264,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Des Reves Elastiques Avec Mille Insectes Nommes Georges + { + "dreaming", + "", + AD_ENTRY1s("data.dcp", "4af26d97ea063fc1277ce30ae431de90", 8804073), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dreamscape { "dreamscape", @@ -268,6 +305,48 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // James Peris: No License Nor Control (English) + { + "jamesperis", + "", + AD_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // James Peris: No License Nor Control (Spanish) + { + "jamesperis", + "", + AD_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // James Peris: No License Nor Control (Demo) (English) + { + "jamesperis", + "Demo", + AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, + // James Peris: No License Nor Control (Demo) (Spanish) + { + "jamesperis", + "Demo", + AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // J.U.L.I.A. (English) { "julia", @@ -289,6 +368,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_DEMO, GUIO0() }, + // J.U.L.I.A. (English) (Greenlight Demo) + { + "julia", + "Greenlight Demo", + AD_ENTRY1s("data.dcp", "4befd448d36b0dae9c3ab1aa7cb8b78d", 7271886), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Mirage { "mirage", @@ -535,6 +625,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // The Shine of a Star + { + "shinestar", + "", + AD_ENTRY1s("data.dcp", "f05abe9e2427a5e4f73648fa09c4ba8e", 94113060), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // The Box { "thebox", @@ -545,6 +645,27 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Fairy Tales About Toshechka and Boshechka + { + "tib", + "", + AD_ENTRY1s("data.dcp", "87d296ef3f46570ed18f000d3885db77", 340264526), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // The Trader of Stories + { + "tradestory", + "Demo", + AD_ENTRY1s("data.dcp", "0a0b51191636cc8ead89b905281c3218", 40401902), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // the white chamber (multi-language) { "twc", diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp new file mode 100644 index 0000000000..8edbf765b5 --- /dev/null +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -0,0 +1,93 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/wintermute/graphics/transform_struct.h" +#include "engines/wintermute/graphics/transparent_surface.h" + +namespace Wintermute { +void TransformStruct::init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, Point32 offset) { + _zoom = zoom; + _angle = angle; + _hotspot = hotspot; + _blendMode = blendMode; + _rgbaMod = rgbaMod; + _alphaDisable = alphaDisable; + _flip = 0; + _flip += TransparentSurface::FLIP_H * mirrorX; + _flip += TransparentSurface::FLIP_V * mirrorY; + _offset = offset; +} + + +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, + 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, + 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, + false, false, + Point32(kDefaultOffsetX, kDefaultOffsetY)); +} + +TransformStruct::TransformStruct() { + init(Point32(kDefaultZoomX, kDefaultZoomY), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), + true, + BLEND_NORMAL, + kDefaultRgbaMod, + false, false, + Point32(kDefaultOffsetX, kDefaultOffsetY)); +} + +bool TransformStruct::getMirrorX() const { + return (bool)(_flip & TransparentSurface::FLIP_H); +} + +bool TransformStruct::getMirrorY() const { + return (bool)(_flip & TransparentSurface::FLIP_V); +} +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h new file mode 100644 index 0000000000..a54c4cc5d0 --- /dev/null +++ b/engines/wintermute/graphics/transform_struct.h @@ -0,0 +1,83 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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 WINTERMUTE_TRANSFORM_STRUCT_H +#define WINTERMUTE_TRANSFORM_STRUCT_H + +#include "engines/wintermute/math/rect32.h" +#include "engines/wintermute/dctypes.h" + +namespace Wintermute { +/** + * Contains all the required information that define a transform. + * Same source sprite + same TransformStruct = Same resulting sprite. + * Has a number of overloaded constructors to accomodate various argument lists. + */ + +const uint32 kDefaultZoomX = 100; +const uint32 kDefaultZoomY = 100; +const uint32 kDefaultRgbaMod = 0xFFFFFFFF; +const int32 kDefaultHotspotX = 0; +const int32 kDefaultHotspotY = 0; +const int32 kDefaultOffsetX = 0; +const int32 kDefaultOffsetY = 0; +const int32 kDefaultAngle = 0; + +struct TransformStruct { +private: + void init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Point32 offset); + +public: + TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0); + TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false); + TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0); + TransformStruct(); + + Point32 _zoom; ///< Zoom; 100 = no zoom + Point32 _hotspot; ///< Position of the hotspot + uint32 _angle; ///< Rotation angle, in degrees + byte _flip; ///< Bitflag: see TransparentSurface::FLIP_XXX + bool _alphaDisable; + TSpriteBlendMode _blendMode; + uint32 _rgbaMod; ///< RGBa + Point32 _offset; + + bool getMirrorX() const; + bool getMirrorY() const; + + bool operator==(const TransformStruct &compare) const { + return (compare._angle == _angle && + compare._flip == _flip && + compare._zoom == _zoom && + compare._offset == _offset && + compare._alphaDisable == _alphaDisable && + compare._rgbaMod == _rgbaMod && + compare._blendMode == _blendMode + ); + } + + bool operator!=(const TransformStruct &compare) const { + return !(compare == *this); + } +}; +} // End of namespace Wintermute +#endif diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp new file mode 100644 index 0000000000..ebf9092aaa --- /dev/null +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include "engines/wintermute/graphics/transform_tools.h" +#include <math.h> + +namespace Wintermute { + +FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { + float rotateRad = rotate * M_PI / 180.0f; + FloatPoint newPoint; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad)) * zoom.x / kDefaultZoomX; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad)) * zoom.y / kDefaultZoomY; + if (mirrorX) { + newPoint.x *= -1; + } + if (mirrorY) { + newPoint.y *= -1; + } + return newPoint; +} + +Rect32 TransformTools::newRect(const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { + Point32 nw(oldRect.left, oldRect.top); + Point32 ne(oldRect.right, oldRect.top); + Point32 sw(oldRect.left, oldRect.bottom); + Point32 se(oldRect.right, oldRect.bottom); + + FloatPoint nw1, ne1, sw1, se1; + + nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); + ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); + sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); + se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); + + float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); + float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); + float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x))); + float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); + + Rect32 res; + newHotspot->y = (uint32)(-floor(top)); + newHotspot->x = (uint32)(-floor(left)); + + res.top = (int32)(floor(top)) + transform._hotspot.y; + res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; + res.left = (int32)(floor(left)) + transform._hotspot.x; + res.right = (int32)(ceil(right)) + transform._hotspot.x; + + return res; +} + +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h new file mode 100644 index 0000000000..c92b81fd11 --- /dev/null +++ b/engines/wintermute/graphics/transform_tools.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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 WINTERMUTE_TRANSFORM_TOOLS_H +#define WINTERMUTE_TRANSFORM_TOOLS_H + +#include "engines/wintermute/math/rect32.h" +#include "engines/wintermute/math/floatpoint.h" +#include "engines/wintermute/graphics/transform_struct.h" + +namespace Wintermute { + +class TransformTools { +public: + /** + * Basic transform (scale + rotate) for a single point + */ + static FloatPoint transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX = false, const bool mirrorY = false); + + /** + * @param &point the point on which the transform is to be applied + * @param rotate the angle in degrees + * @param &zoom zoom x,y in percent + * @param mirrorX flip along the vertical axis? + * @param mirrorY flip along the horizontal axis? + * @return the smallest rect that can contain the transformed sprite + * and, as a side-effect, "newHotspot" will tell you where the hotspot will + * have ended up in the new rect, for centering. + */ + static Rect32 newRect(const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot); +}; + +} // End of namespace Wintermute +#endif diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index dcdcbf247e..e375322ae9 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -23,12 +23,123 @@ #include "common/endian.h" #include "common/util.h" #include "common/rect.h" +#include "common/math.h" #include "common/textconsole.h" #include "graphics/primitives.h" #include "engines/wintermute/graphics/transparent_surface.h" +#include "engines/wintermute/graphics/transform_tools.h" namespace Wintermute { + +#if ENABLE_BILINEAR +void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + float x1 = floor(projX); + float x2 = ceil(projX); + float y1 = floor(projY); + float y2 = ceil(projY); + + uint32 Q11, Q12, Q21, Q22; + + if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { + Q11 = 0; + } else { + Q11 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y1 + srcRect.top))); + } + + if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { + Q12 = 0; + } else { + Q12 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y2 + srcRect.top))); + } + + if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { + Q21 = 0; + } else { + Q21 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y1 + srcRect.top))); + } + + if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { + Q22 = 0; + } else { + Q22 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y2 + srcRect.top))); + } + + byte *Q11s = (byte *)&Q11; + byte *Q12s = (byte *)&Q12; + byte *Q21s = (byte *)&Q21; + byte *Q22s = (byte *)&Q22; + + uint32 color; + byte *dest = (byte *)&color; + + float q11x = (x2 - projX); + float q11y = (y2 - projY); + float q21x = (projX - x1); + float q21y = (y2 - projY); + float q12x = (x2 - projX); + float q12y = (projY - y1); + + if (x1 == x2 && y1 == y2) { + for (int c = 0; c < 4; c++) { + dest[c] = ((float)Q11s[c]); + } + } else { + + if (x1 == x2) { + q11x = 0.5; + q12x = 0.5; + q21x = 0.5; + } else if (y1 == y2) { + q11y = 0.5; + q12y = 0.5; + q21y = 0.5; + } + + for (int c = 0; c < 4; c++) { + dest[c] = (byte)( + ((float)Q11s[c]) * q11x * q11y + + ((float)Q21s[c]) * q21x * q21y + + ((float)Q12s[c]) * q12x * q12y + + ((float)Q22s[c]) * (1.0 - + q11x * q11y - + q21x * q21y - + q12x * q12y) + ); + } + } + WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); +} +#else +void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + uint32 color; + + if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { + color = 0; + } else { + color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); + } + + WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); +} +#endif + byte *TransparentSurface::_lookup = nullptr; void TransparentSurface::destroyLookup() { @@ -46,11 +157,14 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur h = surf.h; pitch = surf.pitch; format = surf.format; - pixels = surf.pixels; + // We need to cast the const qualifier away here because 'pixels' + // always needs to be writable. 'surf' however is a constant Surface, + // thus getPixels will always return const pixel data. + pixels = const_cast<void *>(surf.getPixels()); } } -void doBlitOpaque(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { +void doBlitOpaque(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in, *out; #ifdef SCUMM_LITTLE_ENDIAN @@ -81,7 +195,7 @@ void TransparentSurface::generateLookup() { } } -void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { +void TransparentSurface::doBlitAlpha(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in, *out; if (!_lookup) { @@ -195,16 +309,28 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p } if (pPartRect) { - srcImage.pixels = &((char *)pixels)[pPartRect->top * srcImage.pitch + pPartRect->left * 4]; + + int xOffset = pPartRect->left; + int yOffset = pPartRect->top; + + if (flipping & FLIP_V) { + yOffset = srcImage.h - pPartRect->bottom; + } + + if (flipping & FLIP_H) { + xOffset = srcImage.w - pPartRect->right; + } + + srcImage.pixels = getBasePtr(xOffset, yOffset); srcImage.w = pPartRect->width(); 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) @@ -224,7 +350,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = srcImage.scale(width, height); - savedPixels = (byte *)img->pixels; + savedPixels = (byte *)img->getPixels(); } else { img = &srcImage; } @@ -232,13 +358,13 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p // Handle off-screen clipping if (posY < 0) { img->h = MAX(0, (int)img->h - -posY); - img->pixels = (byte *)img->pixels + img->pitch * -posY; + img->setPixels((byte *)img->getBasePtr(0, -posY)); posY = 0; } if (posX < 0) { img->w = MAX(0, (int)img->w - -posX); - img->pixels = (byte *)img->pixels + (-posX * 4); + img->setPixels((byte *)img->getBasePtr(-posX, 0)); posX = 0; } @@ -250,12 +376,12 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p int inStep = 4; int inoStep = img->pitch; - if (flipping & TransparentSurface::FLIP_V) { + if (flipping & TransparentSurface::FLIP_H) { inStep = -inStep; xp = img->w - 1; } - if (flipping & TransparentSurface::FLIP_H) { + if (flipping & TransparentSurface::FLIP_V) { inoStep = -inoStep; yp = img->h - 1; } @@ -375,7 +501,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p retSize.setHeight(img->h); if (imgScaled) { - imgScaled->pixels = savedPixels; + imgScaled->setPixels(savedPixels); imgScaled->free(); delete imgScaled; } @@ -383,16 +509,54 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } +TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const { + + assert(transform._angle != 0); // This would not be ideal; rotoscale() should never be called in conditional branches where angle = 0 anyway. + + Point32 newHotspot; + Common::Rect srcRect(0, 0, (int16)w, (int16)h); + Rect32 rect = TransformTools::newRect(Rect32(srcRect), transform, &newHotspot); + Common::Rect dstRect(0, 0, (int16)(rect.right - rect.left), (int16)(rect.bottom - rect.top)); + + TransparentSurface *target = new TransparentSurface(); + assert(format.bytesPerPixel == 4); + + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + target->create((uint16)dstW, (uint16)dstH, this->format); + + uint32 invAngle = 360 - (transform._angle % 360); + float invCos = cos(invAngle * M_PI / 180.0); + float invSin = sin(invAngle * M_PI / 180.0); + float targX; + float targY; + + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; + + targX = ((x1 * invCos - y1 * invSin)) * kDefaultZoomX / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * kDefaultZoomY / transform._zoom.y + srcRect.top; + + targX += transform._hotspot.x; + targY += transform._hotspot.y; + +#if ENABLE_BILINEAR + copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); +#else + copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); +#endif + } + } + return target; +} + TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const { Common::Rect srcRect(0, 0, (int16)w, (int16)h); Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight); - return scale(srcRect, dstRect); -} -// Copied from clone2727's https://github.com/clone2727/scummvm/blob/pegasus/engines/pegasus/surface.cpp#L247 -TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const { - // I'm doing simple linear scaling here - // dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH); TransparentSurface *target = new TransparentSurface(); assert(format.bytesPerPixel == 4); @@ -404,11 +568,18 @@ TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const target->create((uint16)dstW, (uint16)dstH, this->format); + + float projX; + float projY; for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { - uint32 color = READ_UINT32((const byte *)getBasePtr(x * srcW / dstW + srcRect.left, - y * srcH / dstH + srcRect.top)); - WRITE_UINT32((byte *)target->getBasePtr(x + dstRect.left, y + dstRect.top), color); + projX = x / (float)dstW * srcW; + projY = y / (float)dstH * srcH; +#if ENABLE_BILINEAR + copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); +#else + copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); +#endif } } return target; @@ -440,4 +611,4 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool } } -} // End of namespace Graphics +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index dc079a1fbc..9d06f3e006 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -23,6 +23,10 @@ #define GRAPHICS_TRANSPARENTSURFACE_H #include "graphics/surface.h" +#include "engines/wintermute/graphics/transform_struct.h" + +#define ENABLE_BILINEAR 0 + /* * This code is based on Broken Sword 2.5 engine @@ -49,21 +53,26 @@ struct TransparentSurface : public Graphics::Surface { void setColorKey(char r, char g, char b); void disableColorKey(); +#if ENABLE_BILINEAR + static void copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); +#else + static void copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); +#endif // Enums /** @brief The possible flipping parameters for the blit methode. */ enum FLIP_FLAGS { - /// The image will not be flipped. - FLIP_NONE = 0, - /// The image will be flipped at the horizontal axis. - FLIP_H = 1, - /// The image will be flipped at the vertical axis. - FLIP_V = 2, - /// The image will be flipped at the horizontal and vertical axis. - FLIP_HV = FLIP_H | FLIP_V, - /// The image will be flipped at the horizontal and vertical axis. - FLIP_VH = FLIP_H | FLIP_V + /// The image will not be flipped. + FLIP_NONE = 0, + /// The image will be flipped at the horizontal axis. + FLIP_H = 1, + /// The image will be flipped at the vertical axis. + FLIP_V = 2, + /// The image will be flipped at the horizontal and vertical axis. + FLIP_HV = FLIP_H | FLIP_V, + /// The image will be flipped at the horizontal and vertical axis. + FLIP_VH = FLIP_H | FLIP_V }; bool _enableAlphaBlit; @@ -102,13 +111,13 @@ struct TransparentSurface : public Graphics::Surface { uint color = BS_ARGB(255, 255, 255, 255), int width = -1, int height = -1); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); - // The following scale-code supports arbitrary scaling (i.e. no repeats of column 0 at the end of lines) + TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const; - TransparentSurface *scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const; + TransparentSurface *rotoscale(const TransformStruct &transform) const; static byte *_lookup; static void destroyLookup(); private: - static void doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); + static void doBlitAlpha(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); static void generateLookup(); }; @@ -125,7 +134,7 @@ private: };*/ -} // End of namespace Graphics +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/floatpoint.h b/engines/wintermute/math/floatpoint.h new file mode 100644 index 0000000000..0c47ef09d7 --- /dev/null +++ b/engines/wintermute/math/floatpoint.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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 WINTERMUTE_FLOATPOINT_H +#define WINTERMUTE_FLOATPOINT_H + +namespace Wintermute { + +struct FloatPoint { + float x; + float y; + FloatPoint() : x(0), y(0) {} + FloatPoint(float x1, float y1) : x(x1), y(y1) {} + bool operator==(const FloatPoint &p) const { return x == p.x && y == p.y; } + bool operator!=(const FloatPoint &p) const { return x != p.x || y != p.y; } + FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); } + FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); } + + FloatPoint& operator+=(const FloatPoint &delta) { + x += delta.x; + y += delta.y; + return *this; + } + FloatPoint& operator-=(const FloatPoint &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } +}; + +} // End of namespace Wintermute + +#endif diff --git a/engines/wintermute/math/math_util.cpp b/engines/wintermute/math/math_util.cpp index 31af77538a..903cea6d39 100644 --- a/engines/wintermute/math/math_util.cpp +++ b/engines/wintermute/math/math_util.cpp @@ -27,7 +27,7 @@ */ #include "engines/wintermute/math/math_util.h" -#include <math.h> +#include "common/scummsys.h" namespace Wintermute { @@ -49,4 +49,4 @@ float MathUtil::roundUp(float val) { return result; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/math_util.h b/engines/wintermute/math/math_util.h index 38b6d9abf9..41a7a43e2e 100644 --- a/engines/wintermute/math/math_util.h +++ b/engines/wintermute/math/math_util.h @@ -37,6 +37,6 @@ public: static float roundUp(float val); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/matrix4.cpp b/engines/wintermute/math/matrix4.cpp index ca1eae8813..011766f510 100644 --- a/engines/wintermute/math/matrix4.cpp +++ b/engines/wintermute/math/matrix4.cpp @@ -28,7 +28,7 @@ #include "engines/wintermute/math/matrix4.h" #include "engines/wintermute/math/vector2.h" -#include <math.h> +#include "common/scummsys.h" namespace Wintermute { @@ -83,4 +83,4 @@ void Matrix4::transformVector2(Vector2 &vec) { vec.y = y; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/matrix4.h b/engines/wintermute/math/matrix4.h index 273633f723..4198b50484 100644 --- a/engines/wintermute/math/matrix4.h +++ b/engines/wintermute/math/matrix4.h @@ -45,6 +45,6 @@ public: float m[4][4]; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 190c1135cf..f522ab3a35 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -24,12 +24,38 @@ #define WINTERMUTE_RECT32_H #include "common/system.h" +#include "engines/wintermute/math/floatpoint.h" +#include "common/rect.h" namespace Wintermute { struct Point32 { int32 x; int32 y; + Point32() : x(0), y(0) {} + Point32(int32 x1, int32 y1) : x(x1), y(y1) {} + bool operator==(const Point32 &p) const { return x == p.x && y == p.y; } + bool operator!=(const Point32 &p) const { return x != p.x || y != p.y; } + Point32 operator+(const Point32 &delta) const { return Point32(x + delta.x, y + delta.y); } + Point32 operator-(const Point32 &delta) const { return Point32(x - delta.x, y - delta.y); } + + Point32 &operator+=(const Point32 &delta) { + x += delta.x; + y += delta.y; + return *this; + } + + Point32 &operator-=(const Point32 &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } + + operator FloatPoint() { + return FloatPoint(x,y); + } + + }; struct Rect32 { @@ -38,6 +64,7 @@ struct Rect32 { Rect32() : top(0), left(0), bottom(0), right(0) {} Rect32(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {} + Rect32(const Common::Rect &rect) : top(rect.top), left(rect.left), bottom(rect.bottom), right(rect.right) {} Rect32(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(isValidRect()); } @@ -89,6 +116,6 @@ struct Rect32 { } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/vector2.cpp b/engines/wintermute/math/vector2.cpp index 74c5586d62..618ee9bda9 100644 --- a/engines/wintermute/math/vector2.cpp +++ b/engines/wintermute/math/vector2.cpp @@ -27,7 +27,7 @@ */ #include "engines/wintermute/math/vector2.h" -#include <math.h> +#include "common/scummsys.h" namespace Wintermute { @@ -52,4 +52,4 @@ float Vector2::length() const { return (float)sqrt(x * x + y * y); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/vector2.h b/engines/wintermute/math/vector2.h index 31f31daaa0..e4ba97c517 100644 --- a/engines/wintermute/math/vector2.h +++ b/engines/wintermute/math/vector2.h @@ -70,6 +70,6 @@ public: float y; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 32931bf05f..95f9ba2ffb 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -89,6 +89,8 @@ MODULE_OBJS := \ base/save_thumb_helper.o \ base/timer.o \ detection.o \ + graphics/transform_struct.o \ + graphics/transform_tools.o \ graphics/transparent_surface.o \ math/math_util.o \ math/matrix4.o \ diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index 1464ae0fd6..ddc0791054 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -37,7 +37,7 @@ class BasePersistenceManager; typedef void *(*PERSISTBUILD)(void); typedef bool(*PERSISTLOAD)(void *, BasePersistenceManager *); typedef void(*SYS_INSTANCE_CALLBACK)(void *instance, void *data); -} // end of namespace Wintermute +} // End of namespace Wintermute #include "engines/wintermute/system/sys_class_registry.h" namespace Wintermute { @@ -85,6 +85,6 @@ namespace Wintermute { #define TMEMBER_PTR(memberName) #memberName, &memberName #define TMEMBER_INT(memberName) #memberName, (int32*)&memberName -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 362c0da624..87a127d001 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -125,9 +125,12 @@ void BasePlatform::handleEvent(Common::Event *event) { // _gameRef->AutoSaveOnExit(); // _gameRef->_quitting = true; // } - if (_gameRef) { - _gameRef->onWindowClose(); - } + +// The engine CAN query for closing, but we disable it for now, as the EVENT_QUIT-event +// can't be stopped. +// if (_gameRef) { +// _gameRef->onWindowClose(); +// } break; default: // TODO: Do we care about any other events? @@ -272,4 +275,4 @@ char *BasePlatform::strlwr(char *string) { return string; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h index 8c39b29ea9..46c86df909 100644 --- a/engines/wintermute/platform_osystem.h +++ b/engines/wintermute/platform_osystem.h @@ -70,6 +70,6 @@ private: static WintermuteEngine *_engineRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp index cda58bbb48..0577f29e2c 100644 --- a/engines/wintermute/system/sys_class.cpp +++ b/engines/wintermute/system/sys_class.cpp @@ -217,4 +217,4 @@ void SystemClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpDat } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_class.h b/engines/wintermute/system/sys_class.h index 3f91723ed8..9fb3f70696 100644 --- a/engines/wintermute/system/sys_class.h +++ b/engines/wintermute/system/sys_class.h @@ -125,6 +125,6 @@ private: InstanceMap _instanceMap; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 8a6aae754f..20e4661efb 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -333,4 +333,4 @@ void SystemClassRegistry::dumpClasses(Common::WriteStream *stream) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_class_registry.h b/engines/wintermute/system/sys_class_registry.h index ef7218c7c1..48a6738ffb 100644 --- a/engines/wintermute/system/sys_class_registry.h +++ b/engines/wintermute/system/sys_class_registry.h @@ -101,6 +101,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_instance.cpp b/engines/wintermute/system/sys_instance.cpp index d106119dba..b8e5c9b50a 100644 --- a/engines/wintermute/system/sys_instance.cpp +++ b/engines/wintermute/system/sys_instance.cpp @@ -46,4 +46,4 @@ SystemInstance::SystemInstance(void *instance, int id, SystemClass *sysClass) { SystemInstance::~SystemInstance() { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_instance.h b/engines/wintermute/system/sys_instance.h index 215a6d1437..115de28094 100644 --- a/engines/wintermute/system/sys_instance.h +++ b/engines/wintermute/system/sys_instance.h @@ -63,6 +63,6 @@ private: SystemClass *_class; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 9db1f4f4b4..b2e6c3953b 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -1206,4 +1206,4 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index 5db9356ef9..b5002f3166 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -75,6 +75,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 91ca7326cb..caed157e0b 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -949,4 +949,4 @@ bool UIEdit::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index ac626f0f06..a057be9ead 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -67,6 +67,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 1872400cdd..6d4cfdb7eb 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -363,4 +363,4 @@ bool UIEntity::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 3bd3ec9888..1b6e8a10d6 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -54,6 +54,6 @@ public: virtual const char *scToString(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 07efc5e4cb..c32ae75c20 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -648,4 +648,4 @@ bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_FAILED; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 935c27613c..5d9508c2cf 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -80,6 +80,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 98d70b770e..5dc25f5852 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -519,4 +519,4 @@ bool UIText::sizeToFit() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index be074755ba..29ed62a5ef 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -55,6 +55,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index abccdd6c39..de4b86a6dd 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -388,4 +388,4 @@ bool UITiledImage::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index a6cd22d53d..39bc6495a9 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -59,6 +59,6 @@ private: Rect32 _downRight; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 2ce9f68605..9066ee9f5b 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -1442,4 +1442,4 @@ bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactive return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 70799cea25..8a726fdff8 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -89,6 +89,6 @@ public: virtual const char *scToString(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/crc.cpp b/engines/wintermute/utils/crc.cpp index e7ec45511b..a9781500fa 100644 --- a/engines/wintermute/utils/crc.cpp +++ b/engines/wintermute/utils/crc.cpp @@ -234,4 +234,4 @@ crc crc_finalize(crc remainder) { return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp index 298f0c268f..ee8b298562 100644 --- a/engines/wintermute/utils/path_util.cpp +++ b/engines/wintermute/utils/path_util.cpp @@ -98,4 +98,4 @@ AnsiString PathUtil::getExtension(const AnsiString &path) { return Common::lastPathComponent(path, '.'); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h index 7358c2aba0..2c7dfa99d1 100644 --- a/engines/wintermute/utils/path_util.h +++ b/engines/wintermute/utils/path_util.h @@ -44,6 +44,6 @@ public: static AnsiString getExtension(const AnsiString &path); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index 9fffad85cd..23abb5d579 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -231,4 +231,4 @@ AnsiString StringUtil::toString(int val) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h index e419e2bca8..3ae5e47493 100644 --- a/engines/wintermute/utils/string_util.h +++ b/engines/wintermute/utils/string_util.h @@ -51,6 +51,6 @@ public: static AnsiString toString(int val); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp index 6e0d69edbe..8fa6313ba6 100644 --- a/engines/wintermute/utils/utils.cpp +++ b/engines/wintermute/utils/utils.cpp @@ -258,4 +258,4 @@ float BaseUtils::Hue2RGB(float v1, float v2, float vH) { return (v1); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h index d6a603ec72..6c804ff01e 100644 --- a/engines/wintermute/utils/utils.h +++ b/engines/wintermute/utils/utils.h @@ -59,6 +59,6 @@ private: static float Hue2RGB(float v1, float v2, float vH); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/video/video_player.cpp b/engines/wintermute/video/video_player.cpp index 42857b5c1b..f18311c3e1 100644 --- a/engines/wintermute/video/video_player.cpp +++ b/engines/wintermute/video/video_player.cpp @@ -106,4 +106,4 @@ bool VideoPlayer::loadSubtitles(const char *filename, const char *subtitleFile) return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/video/video_player.h b/engines/wintermute/video/video_player.h index 033ab50dfa..51c6bf41d3 100644 --- a/engines/wintermute/video/video_player.h +++ b/engines/wintermute/video/video_player.h @@ -85,6 +85,6 @@ public: BaseArray<CVidSubtitle *, CVidSubtitle *> _subtitles;*/ }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 8f9db8392f..f3317684b5 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -163,14 +163,14 @@ bool VideoTheoraPlayer::resetStream() { if (!_file) { return STATUS_FAILED; } - + #if defined (USE_THEORADEC) _theoraDecoder = new Video::TheoraDecoder(); #else return STATUS_FAILED; #endif _theoraDecoder->loadStream(_file); - + if (!_theoraDecoder->isVideoLoaded()) { return STATUS_FAILED; } @@ -369,14 +369,14 @@ void VideoTheoraPlayer::writeAlpha() { if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) { assert(_alphaImage->getSurface()->format.bytesPerPixel == 4); assert(_surface.format.bytesPerPixel == 4); - const byte *alphaData = (const byte *)_alphaImage->getSurface()->getBasePtr(0, 0); + const byte *alphaData = (const byte *)_alphaImage->getSurface()->getPixels(); #ifdef SCUMM_LITTLE_ENDIAN int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8); #else int alphaPlace = 3 - (_alphaImage->getSurface()->format.aShift / 8); #endif alphaData += alphaPlace; - byte *imgData = (byte *)_surface.getBasePtr(0, 0); + byte *imgData = (byte *)_surface.getPixels(); #ifdef SCUMM_LITTLE_ENDIAN imgData += (_surface.format.aShift / 8); #else @@ -417,7 +417,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) { bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) { delete _alphaImage; _alphaImage = new BaseImage(); - if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { + if (filename == "" || !_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { delete _alphaImage; _alphaImage = nullptr; _alphaFilename = ""; @@ -498,7 +498,7 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alphaFilename)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); - persistMgr->transfer(TMEMBER(_playZoom)); + persistMgr->transferFloat(TMEMBER(_playZoom)); persistMgr->transfer(TMEMBER_INT(_playbackType)); persistMgr->transfer(TMEMBER(_looping)); persistMgr->transfer(TMEMBER(_volume)); @@ -529,4 +529,4 @@ BaseSurface *VideoTheoraPlayer::getTexture() const { return _texture; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index 364509a080..ddeba48bbc 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -101,7 +101,7 @@ public: // video properties int32 _posX; int32 _posY; - + bool _dontDropFrames; private: int32 _state; @@ -142,6 +142,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 92381742de..a878944661 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -26,7 +26,6 @@ #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/fs.h" #include "common/tokenizer.h" @@ -134,7 +133,7 @@ Common::Error WintermuteEngine::run() { } int WintermuteEngine::init() { - BaseEngine::createInstance(_targetName, _gameDescription->language); + BaseEngine::createInstance(_targetName, _gameDescription->gameid, _gameDescription->language); _game = new AdGame(_targetName); if (!_game) { return 1; @@ -148,7 +147,7 @@ int WintermuteEngine::init() { _game->initialize1(); // set gameId, for savegame-naming: - _game->setGameId(_targetName); + _game->setGameTargetName(_targetName); if (DID_FAIL(_game->loadSettings("startup.settings"))) { _game->LOG(0, "Error loading game settings."); @@ -251,6 +250,9 @@ int WintermuteEngine::messageLoop() { } prevTime = time; } + if (shouldQuit()) { + break; + } if (_game && _game->_quitting) { break; } @@ -292,6 +294,7 @@ bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String Common::SeekableReadStream *stream = nullptr; // Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG, true); + fileMan->registerPackages(fslist); stream = fileMan->openFile("startup.settings", false, false); // The process is as follows: Check the "GAME=" tag in startup.settings, to decide where the diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h index c7723808ea..1288ac1a65 100644 --- a/engines/wintermute/wintypes.h +++ b/engines/wintermute/wintypes.h @@ -48,6 +48,6 @@ namespace Wintermute { #define MAX_PATH_LENGTH 512 -} // end of namespace Wintermute +} // End of namespace Wintermute #endif |