aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJulien2012-07-26 17:19:58 -0400
committerJulien2012-07-27 00:15:05 -0400
commit3d6807b35905a951688508d3b696ee48c1453c4d (patch)
tree4bf9dacca0d96c2b0c1a3c4c26f1f655953c637a /engines
parentb4b4a7d127194cf29fdfcf5ee7b41b875d26b37e (diff)
downloadscummvm-rg350-3d6807b35905a951688508d3b696ee48c1453c4d.tar.gz
scummvm-rg350-3d6807b35905a951688508d3b696ee48c1453c4d.tar.bz2
scummvm-rg350-3d6807b35905a951688508d3b696ee48c1453c4d.zip
LASTEXPRESS: Implement Logic::resetState()
Diffstat (limited to 'engines')
-rw-r--r--engines/lastexpress/game/logic.cpp7
-rw-r--r--engines/lastexpress/game/scenes.cpp31
-rw-r--r--engines/lastexpress/game/scenes.h1
3 files changed, 25 insertions, 14 deletions
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index 5f220479d1..c8e4c22ec5 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -408,9 +408,12 @@ void Logic::eventTick(const Common::Event &) {
* Resets the game state.
*/
void Logic::resetState() {
- getState()->scene = kSceneDefault;
+ getScenes()->setCoordinates(Common::Rect(80, 0, 559, 479));
- warning("[Logic::resetState] Not implemented! You need to restart the engine until this is implemented.");
+ SAFE_DELETE(_entities);
+ SAFE_DELETE(_state);
+ _entities = new Entities(_engine);
+ _state = new State(_engine);
}
/**
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 254b0fdb58..447e8714b0 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -739,24 +739,31 @@ void SceneManager::resetQueue() {
_queue.clear();
}
-void SceneManager::setCoordinates(SequenceFrame *frame) {
+void SceneManager::setCoordinates(Common::Rect rect) {
+ _flagCoordinates = true;
- if (!frame || frame->getInfo()->subType == 3)
- return;
+ if (_coords.right > rect.right)
+ _coords.right = rect.right;
- _flagCoordinates = true;
+ if (_coords.bottom > rect.bottom)
+ _coords.bottom = rect.bottom;
- if (_coords.right > (int)frame->getInfo()->xPos1)
- _coords.right = (int16)frame->getInfo()->xPos1;
+ if (_coords.left < rect.left)
+ _coords.left = rect.left;
- if (_coords.bottom > (int)frame->getInfo()->yPos1)
- _coords.bottom = (int16)frame->getInfo()->yPos1;
+ if (_coords.top < rect.top)
+ _coords.top = rect.top;
+}
+
+void SceneManager::setCoordinates(SequenceFrame *frame) {
- if (_coords.left < (int)frame->getInfo()->xPos2)
- _coords.left = (int16)frame->getInfo()->xPos2;
+ if (!frame || frame->getInfo()->subType == 3)
+ return;
- if (_coords.top < (int)frame->getInfo()->yPos2)
- _coords.top = (int16)frame->getInfo()->yPos2;
+ setCoordinates(Common::Rect((int16)frame->getInfo()->xPos1,
+ (int16)frame->getInfo()->yPos1,
+ (int16)frame->getInfo()->xPos2,
+ (int16)frame->getInfo()->yPos2));
}
void SceneManager::resetCoordinates() {
diff --git a/engines/lastexpress/game/scenes.h b/engines/lastexpress/game/scenes.h
index 172dde2683..a866c65111 100644
--- a/engines/lastexpress/game/scenes.h
+++ b/engines/lastexpress/game/scenes.h
@@ -79,6 +79,7 @@ public:
void removeAndRedraw(SequenceFrame **frame, bool doRedraw);
void resetQueue();
void setCoordinates(SequenceFrame *frame);
+ void setCoordinates(Common::Rect rect);
// Helpers
SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1);