LASTEXPRESS: Implement Logic::resetState()

This commit is contained in:
Julien 2012-07-26 17:19:58 -04:00
parent b4b4a7d127
commit 3d6807b359
3 changed files with 26 additions and 15 deletions

View File

@ -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);
}
/**

View File

@ -739,24 +739,31 @@ void SceneManager::resetQueue() {
_queue.clear();
}
void SceneManager::setCoordinates(Common::Rect rect) {
_flagCoordinates = true;
if (_coords.right > rect.right)
_coords.right = rect.right;
if (_coords.bottom > rect.bottom)
_coords.bottom = rect.bottom;
if (_coords.left < rect.left)
_coords.left = rect.left;
if (_coords.top < rect.top)
_coords.top = rect.top;
}
void SceneManager::setCoordinates(SequenceFrame *frame) {
if (!frame || frame->getInfo()->subType == 3)
return;
_flagCoordinates = true;
if (_coords.right > (int)frame->getInfo()->xPos1)
_coords.right = (int16)frame->getInfo()->xPos1;
if (_coords.bottom > (int)frame->getInfo()->yPos1)
_coords.bottom = (int16)frame->getInfo()->yPos1;
if (_coords.left < (int)frame->getInfo()->xPos2)
_coords.left = (int16)frame->getInfo()->xPos2;
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() {

View File

@ -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);