diff options
-rw-r--r-- | engines/tsage/globals.cpp | 50 | ||||
-rw-r--r-- | engines/tsage/globals.h | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.cpp | 56 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.h | 5 |
4 files changed, 67 insertions, 52 deletions
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index eaf978bd22..6984b03ba5 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -427,29 +427,29 @@ void Ringworld2Globals::reset() { _spillLocation[12] = 27; _spillLocation[13] = 31; + // Initialise the vampire data within the Flub maze for (int i = 0; i < 18; i++) { - _v56613[(i * 4) ] = 1; - _v56613[(i * 4) + 2] = 0; - _v56613[(i * 4) + 3] = 0; + _vampireData[i]._isAlive = true; + _vampireData[i]._position = Common::Point(); } - _v56613[( 0 * 4) + 1] = 1; - _v56613[( 1 * 4) + 1] = 2; - _v56613[( 2 * 4) + 1] = 2; - _v56613[( 3 * 4) + 1] = 3; - _v56613[( 4 * 4) + 1] = 2; - _v56613[( 5 * 4) + 1] = 2; - _v56613[( 6 * 4) + 1] = 3; - _v56613[( 7 * 4) + 1] = 1; - _v56613[( 8 * 4) + 1] = 1; - _v56613[( 9 * 4) + 1] = 3; - _v56613[(10 * 4) + 1] = 3; - _v56613[(11 * 4) + 1] = 1; - _v56613[(12 * 4) + 1] = 2; - _v56613[(13 * 4) + 1] = 3; - _v56613[(14 * 4) + 1] = 2; - _v56613[(15 * 4) + 1] = 3; - _v56613[(16 * 4) + 1] = 1; - _v56613[(17 * 4) + 1] = 1; + _vampireData[0].var2 = 1; + _vampireData[1].var2 = 2; + _vampireData[2].var2 = 2; + _vampireData[3].var2 = 3; + _vampireData[4].var2 = 2; + _vampireData[5].var2 = 2; + _vampireData[6].var2 = 3; + _vampireData[7].var2 = 1; + _vampireData[8].var2 = 1; + _vampireData[9].var2 = 3; + _vampireData[10].var2 = 3; + _vampireData[11].var2 = 1; + _vampireData[12].var2 = 2; + _vampireData[13].var2 = 3; + _vampireData[14].var2 = 2; + _vampireData[15].var2 = 3; + _vampireData[16].var2 = 1; + _vampireData[17].var2 = 1; _v566A6 = 3800; _landerSuitNumber = 2; @@ -580,6 +580,14 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_balloonPosition.x); s.syncAsSint16LE(_balloonPosition.y); + + // Synchronise Flub maze vampire data + for (i = 0; i < 18; ++i) { + s.syncAsSint16LE(_vampireData[i]._isAlive); + s.syncAsSint16LE(_vampireData[i].var2); + s.syncAsSint16LE(_vampireData[i]._position.x); + s.syncAsSint16LE(_vampireData[i]._position.y); + } } } // end of namespace Ringworld2 diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 46beea9513..99634ed175 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -244,6 +244,12 @@ namespace Ringworld2 { class ScannerDialog; +struct VampireData { + bool _isAlive; + int var2; + Common::Point _position; +}; + class Ringworld2Globals: public TsAGE2Globals { public: ASoundExt _sound1, _sound2, _sound3, _sound4; @@ -270,7 +276,7 @@ public: int _v5657C; byte _v565AE; byte _spillLocation[14]; - int _v56613[76]; + VampireData _vampireData[18]; byte _flubMazeArea; byte _flubMazeEntryDirection; int _v566A6; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index fbc8834ceb..8533360063 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -13784,11 +13784,9 @@ bool Scene1950::Actor5::startAction(CursorType action, Event &event) { } Scene1950::Vampire::Vampire() { - _fieldA4 = 0; - _fieldA6 = 0; _fieldA8 = 0; _fieldAA = 0; - _fieldAC = 0; + _vampireMode = 0; _fieldAE = 0; _fieldAF = 0; } @@ -13796,11 +13794,11 @@ Scene1950::Vampire::Vampire() { void Scene1950::Vampire::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_fieldA4); - s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_deadPosition.x); + s.syncAsSint16LE(_deadPosition.y); s.syncAsSint16LE(_fieldA8); s.syncAsSint16LE(_fieldAA); - s.syncAsSint16LE(_fieldAC); + s.syncAsSint16LE(_vampireMode); s.syncAsByte(_fieldAE); s.syncAsByte(_fieldAF); } @@ -13808,9 +13806,9 @@ void Scene1950::Vampire::synchronize(Serializer &s) { void Scene1950::Vampire::signal() { Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; - switch (_fieldAC) { + switch (_vampireMode) { case 19: { - _fieldAC = 0; + _vampireMode = 0; setVisage(1960); if (R2_GLOBALS._flubMazeEntryDirection == 3) setStrip(2); @@ -13822,21 +13820,21 @@ void Scene1950::Vampire::signal() { } break; case 20: { - _fieldAC = 19; + _vampireMode = 19; R2_GLOBALS._player.setVisage(22); if (R2_GLOBALS._flubMazeEntryDirection == 3) R2_GLOBALS._player.setStrip(1); else R2_GLOBALS._player.setStrip(2); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) + 1]--; + R2_GLOBALS._vampireData[scene->_vampireIndex - 1].var2--; if (R2_GLOBALS._flubMazeEntryDirection == 3) - _fieldA4 = _position.x + 10; + _deadPosition.x = _position.x + 10; else - _fieldA4 = _position.x - 10; + _deadPosition.x = _position.x - 10; + _deadPosition.y = _position.y - 4; - _fieldA6 = _position.y -4; setVisage(1961); if (R2_GLOBALS._flubMazeEntryDirection == 3) @@ -13845,7 +13843,7 @@ void Scene1950::Vampire::signal() { setStrip(1); animate(ANIM_MODE_2, NULL); - Common::Point pt(_fieldA4, _fieldA6); + Common::Point pt = _deadPosition; PlayerMover *mover = new PlayerMover(); addMover(mover, &pt, this); @@ -13871,26 +13869,26 @@ void Scene1950::Vampire::signal() { R2_GLOBALS._sound2.play(226); animate(ANIM_MODE_5, NULL); fixPriority(10); - R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) ]--; - R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) + 1]--; - R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) + 2] = _position.x; - R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) + 3] = _position.y; + + R2_GLOBALS._vampireData[scene->_vampireIndex - 1]._isAlive = false; + R2_GLOBALS._vampireData[scene->_vampireIndex - 1].var2--; + R2_GLOBALS._vampireData[scene->_vampireIndex - 1]._position = _position; _fieldA8 = (_position.x - R2_GLOBALS._player._position.x) / 2; _fieldAA = (_position.y - R2_GLOBALS._player._position.y) / 2; _fieldAE = 0; for (_fieldAF = 0; _fieldAF < 18; ++_fieldAF) - if (R2_GLOBALS._v56613[4 * _fieldAF] == 0) + if (!R2_GLOBALS._vampireData[_fieldAF]._isAlive) ++_fieldAE; if (_fieldAE == 18) { R2_GLOBALS.setFlag(36); - _fieldAC = 23; + _vampireMode = 23; Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } else if (_fieldAE == 1) { - _fieldAC = 22; + _vampireMode = 22; Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -13922,16 +13920,16 @@ void Scene1950::Vampire::signal() { bool Scene1950::Vampire::startAction(CursorType action, Event &event) { Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; - if ((R2_GLOBALS._v56613[(scene->_vampireIndex - 1) * 4] == 0) || + if (!R2_GLOBALS._vampireData[scene->_vampireIndex - 1]._isAlive || (action != R2_PHOTON_STUNNER)) return SceneActor::startAction(action, event); R2_GLOBALS._player.disableControl(); - if (R2_GLOBALS._v56613[((scene->_vampireIndex - 1) * 4) + 1] <= 1) - _fieldAC = 21; + if (R2_GLOBALS._vampireData[scene->_vampireIndex - 1].var2 <= 1) + _vampireMode = 21; else - _fieldAC = 20; + _vampireMode = 20; R2_GLOBALS._player.setVisage(25); if (R2_GLOBALS._flubMazeEntryDirection == 3) @@ -14788,6 +14786,7 @@ void Scene1950::enterArea() { _field416 = 0; _vampireIndex = 0; + // Certain areas have a vampire in them switch (R2_GLOBALS._flubMazeArea) { case 10: _vampireIndex = 1; @@ -14853,8 +14852,10 @@ void Scene1950::enterArea() { _vampire._moveRate = 6; _vampire._moveDiff = Common::Point(3, 2); _vampire._effect = 1; - if (R2_GLOBALS._v56613[(_vampireIndex - 1) * 4] == 0) { - _vampire.setPosition(Common::Point(R2_GLOBALS._v56613[((_vampireIndex - 1) * 4) + 2], R2_GLOBALS._v56613[((_vampireIndex - 1) * 4) + 3])); + + if (!R2_GLOBALS._vampireData[_vampireIndex - 1]._isAlive) { + // Show vampire ashes + _vampire.setPosition(Common::Point(R2_GLOBALS._vampireData[_vampireIndex - 1]._position)); _vampire.animate(ANIM_MODE_NONE, NULL); _vampire.addMover(NULL); _vampire.setVisage(1961); @@ -14863,6 +14864,7 @@ void Scene1950::enterArea() { _vampire.fixPriority(10); _vampire.setDetails(1950, 15, -1, 17, 2, (SceneItem *) NULL); } else { + // Start the vampire _vampire.setVisage(1960); _vampire.setPosition(Common::Point(160, 130)); _vampire.animate(ANIM_MODE_2, NULL); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 754994c76f..58b1730941 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -1164,11 +1164,10 @@ class Scene1950 : public SceneExt { }; class Vampire : public SceneActor { public: - int _fieldA4; - int _fieldA6; + Common::Point _deadPosition; int _fieldA8; int _fieldAA; - int _fieldAC; + int _vampireMode; byte _fieldAE; byte _fieldAF; |