diff options
author | uruk | 2014-07-02 22:57:49 +0200 |
---|---|---|
committer | uruk | 2014-07-04 12:58:45 +0200 |
commit | 1305bc8aa8b46459dfea08ad52309a57dbda64d8 (patch) | |
tree | 336e3082ba63df69d4fd179b101da0f87c8bcf37 | |
parent | b48c94a5415ece41319d5aa814e4ad16cf1ff4a8 (diff) | |
download | scummvm-rg350-1305bc8aa8b46459dfea08ad52309a57dbda64d8.tar.gz scummvm-rg350-1305bc8aa8b46459dfea08ad52309a57dbda64d8.tar.bz2 scummvm-rg350-1305bc8aa8b46459dfea08ad52309a57dbda64d8.zip |
CGE2: Add, implement and use saveHeroPos().
-rw-r--r-- | engines/cge2/cge2.h | 1 | ||||
-rw-r--r-- | engines/cge2/cge2_main.cpp | 22 |
2 files changed, 15 insertions, 8 deletions
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index e3606b821b..af16311ab2 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -155,6 +155,7 @@ public: void sceneDown(); void closePocket(); void switchScene(int scene); + void saveHeroPos(); void showBak(int ref); void loadTab(); int newRandom(int range); diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 2e70125fa6..dead21d5a4 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -505,14 +505,9 @@ void CGE2Engine::switchScene(int scene) { */ _req = scene; - for (int i = 0; i < 2; i++) { - Hero *h = _heroTab[i]->_ptr; - if (h->_scene == _now) { - delete _heroTab[i]->_posTab[_now]; - V2D *temp = new V2D(this, h->_pos3D._x.trunc(), h->_pos3D._z.trunc()); - _heroTab[i]->_posTab[_now] = temp; - } - } + + saveHeroPos(); + *(_eyeTab[_now]) = *_eye; if (scene < 0) _commandHandler->addCallback(kCmdExec, -1, 0, kQGame); // quit game @@ -530,6 +525,17 @@ void CGE2Engine::switchScene(int scene) { } } +void CGE2Engine::saveHeroPos() { + for (int i = 0; i < 2; i++) { + Hero *h = _heroTab[i]->_ptr; + if (h->_scene == _now) { + delete _heroTab[i]->_posTab[_now]; + V2D *temp = new V2D(this, h->_pos3D._x.trunc(), h->_pos3D._z.trunc()); + _heroTab[i]->_posTab[_now] = temp; + } + } +} + void CGE2Engine::showBak(int ref) { Sprite *spr = _spare->take(ref); if (spr != nullptr) { |