From e237ff362826e9f1fef982952f476a588dc7134e Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 27 Jan 2011 13:26:34 +0000 Subject: GOB: Some Addy gameflow stubs svn-id: r55562 --- engines/gob/game.cpp | 29 +++++++++++++++++++---------- engines/gob/inter_v2.cpp | 3 ++- engines/gob/inter_v6.cpp | 2 +- engines/gob/map_v2.cpp | 3 +++ 4 files changed, 25 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 4bea9ce6b0..81ff66f100 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -562,14 +562,19 @@ void Game::start() { void Game::totSub(int8 flags, const char *newTotFile) { int8 curBackupPos; - if ((flags == 16) || (flags == 17)) - warning("Urban Stub: Game::totSub(), flags == %d", flags); + if ((flags == 16) || (flags == 17)) { + // Prefetch tot data + delete prefetched data + return; + } if (_numEnvironments >= Environments::kEnvironmentCount) error("Game::totSub(): Environments overflow"); _environments->set(_numEnvironments); + if (flags == 18) + warning("Game::totSub(): Backup media"); + curBackupPos = _curEnvironment; _numEnvironments++; _curEnvironment = _numEnvironments; @@ -578,9 +583,9 @@ void Game::totSub(int8 flags, const char *newTotFile) { _resources = new Resources(_vm); if (flags & 0x80) - warning("Urban Stub: Game::totSub(), flags & 0x80"); + warning("Addy Stub: Game::totSub(), flags & 0x80"); - if (flags & 1) + if (flags & 5) _vm->_inter->_variables = 0; Common::strlcpy(_curTotFile, newTotFile, 10); @@ -591,9 +596,10 @@ void Game::totSub(int8 flags, const char *newTotFile) { return; } - _hotspots->push(0, true); + if (!(flags & 0x20)) + _hotspots->push(0, true); - if (flags & 2) + if ((flags == 18) || (flags & 0x06)) playTot(-1); else playTot(0); @@ -601,18 +607,21 @@ void Game::totSub(int8 flags, const char *newTotFile) { if (_vm->_inter->_terminate != 2) _vm->_inter->_terminate = 0; - _hotspots->clear(); - _hotspots->pop(); + if (!(flags & 0x20)) { + _hotspots->clear(); + _hotspots->pop(); + } - if ((flags & 1) && _vm->_inter->_variables) { + if ((flags & 5) && _vm->_inter->_variables) _vm->_inter->delocateVars(); - } clearUnusedEnvironment(); _numEnvironments--; _curEnvironment = curBackupPos; _environments->get(_numEnvironments); + + _vm->_global->_inter_animDataSize = _script->getAnimDataSize(); } void Game::switchTotSub(int16 index, int16 skipPlay) { diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 3b05b1c335..eb7b8ef62c 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -597,6 +597,7 @@ void Inter_v2::o2_totSub() { strcpy(totFile, "EMAP2011"); flags = _vm->_game->_script->readByte(); + _vm->_game->totSub(flags, totFile); } @@ -693,7 +694,7 @@ void Inter_v2::o2_setGoblinState() { Mult::Mult_AnimData &objAnim = *(obj.pAnimData); objAnim.stateType = type; - if (!obj.goblinStates[state]) + if (!obj.goblinStates || !obj.goblinStates[state]) return; Scenery::AnimLayer *animLayer; diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 999ff4b0a4..0fc0cb6bba 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -80,7 +80,7 @@ void Inter_v6::o6_totSub() { length = _vm->_game->_script->readByte(); if ((length & 0x7F) > 13) - error("Length in o2_totSub is greater than 13 (%d)", length); + error("Length in o6_totSub is greater than 13 (%d)", length); if (length & 0x80) { _vm->_game->_script->evalExpr(0); diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp index f81d3e6002..c301698492 100644 --- a/engines/gob/map_v2.cpp +++ b/engines/gob/map_v2.cpp @@ -257,6 +257,9 @@ void Map_v2::findNearestToDest(Mult::Mult_Object *obj) { } void Map_v2::optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) { + if (!_wayPoints) + return; + if (obj->nearestWayPoint < obj->nearestDest) { for (int i = obj->nearestWayPoint; i <= obj->nearestDest; i++) { -- cgit v1.2.3