diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hugo/file.cpp | 23 | ||||
-rw-r--r-- | engines/hugo/hugo.cpp | 27 | ||||
-rw-r--r-- | engines/hugo/hugo.h | 2 | ||||
-rw-r--r-- | engines/hugo/inventory.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/object.cpp | 90 | ||||
-rw-r--r-- | engines/hugo/object.h | 11 | ||||
-rw-r--r-- | engines/hugo/object_v1d.cpp | 8 | ||||
-rw-r--r-- | engines/hugo/object_v1w.cpp | 8 | ||||
-rw-r--r-- | engines/hugo/object_v2d.cpp | 8 | ||||
-rw-r--r-- | engines/hugo/object_v3d.cpp | 6 | ||||
-rw-r--r-- | engines/hugo/parser.cpp | 4 | ||||
-rw-r--r-- | engines/hugo/parser_v1d.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/parser_v1w.cpp | 10 | ||||
-rw-r--r-- | engines/hugo/parser_v2d.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/parser_v3d.cpp | 10 | ||||
-rw-r--r-- | engines/hugo/route.cpp | 4 |
16 files changed, 135 insertions, 82 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 2979271bc5..b05b3114a3 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -318,12 +318,7 @@ void FileManager::saveGame(int16 slot, const char *descrip) { // Save description of saved game out->write(descrip, DESCRIPLEN); - // Save objects - for (int i = 0; i < _vm->_numObj; i++) { - // Save where curr_seq_p is pointing to - _vm->_object->saveSeq(&_vm->_object->_objects[i]); - out->write(&_vm->_object->_objects[i], sizeof(object_t)); - } + _vm->_object->saveObjects(out); const status_t &gameStatus = _vm->getGameStatus(); @@ -399,17 +394,7 @@ void FileManager::restoreGame(int16 slot) { if (_vm->_heroImage != HERO) _vm->_object->swapImages(HERO, _vm->_heroImage); - // Restore objects, retain current seqList which points to dynamic mem - // Also, retain cmnd_t pointers - for (int i = 0; i < _vm->_numObj; i++) { - object_t *p = &_vm->_object->_objects[i]; - seqList_t seqList[MAX_SEQUENCES]; - memcpy(seqList, p->seqList, sizeof(seqList_t)); - uint16 cmdIndex = p->cmdIndex; - in->read(p, sizeof(object_t)); - p->cmdIndex = cmdIndex; - memcpy(p->seqList, seqList, sizeof(seqList_t)); - } + _vm->_object->restoreObjects(in); in->read(&_vm->_heroImage, sizeof(_vm->_heroImage)); @@ -433,9 +418,7 @@ void FileManager::restoreGame(int16 slot) { // Restore points table in->read(_vm->_points, sizeof(point_t) * _vm->_numBonuses); - // Restore ptrs to currently loaded objects - for (int i = 0; i < _vm->_numObj; i++) - _vm->_object->restoreSeq(&_vm->_object->_objects[i]); + _vm->_object->restoreAllSeq(); // Now restore time of the save and the event queue _vm->_scheduler->restoreEvents(in); diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index f648473bdb..f8b3cd2e43 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -66,7 +66,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy _textUtil(0), _arrayNouns(0), _arrayVerbs(0), _arrayReqs(0), _hotspots(0), _invent(0), _uses(0), _catchallList(0), _backgroundObjects(0), _points(0), _cmdList(0), _screenActs(0), _heroImage(0), _defltTunes(0), _introX(0), _introY(0), _maxInvent(0), _numBonuses(0), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0), _screenStates(0), - _numObj(0), _score(0), _maxscore(0), _backgroundObjectsSize(0), _screenActsSize(0), _usesSize(0) + _score(0), _maxscore(0), _backgroundObjectsSize(0), _screenActsSize(0), _usesSize(0) { DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level"); @@ -311,7 +311,7 @@ void HugoEngine::initMachine() { readScreenFiles(0); else _file->readBackground(_numScreens - 1); // Splash screen - readObjectImages(); // Read all object images + _object->readObjectImages(); // Read all object images if (_platform == Common::kPlatformWindows) _file->readUIFImages(); // Read all uif images (only in Win versions) } @@ -738,13 +738,7 @@ bool HugoEngine::loadHugoDat() { } } - //Read LASTOBJ - for (int varnt = 0; varnt < _numVariant; varnt++) { - numElem = in.readUint16BE(); - if (varnt == _gameVariant) - _numObj = numElem; - } - + _object->loadNumObj(in); _scheduler->loadAlNewscrIndex(in); _screen->loadFontArr(in); @@ -1040,13 +1034,6 @@ void HugoEngine::shutdown() { _object->freeObjects(); } -void HugoEngine::readObjectImages() { - debugC(1, kDebugEngine, "readObjectImages"); - - for (int i = 0; i < _numObj; i++) - _file->readImage(i, &_object->_objects[i]); -} - /** * Read scenery, overlay files for given screen number */ @@ -1213,10 +1200,7 @@ void HugoEngine::setNewScreen(int screenNum) { debugC(1, kDebugEngine, "setNewScreen(%d)", screenNum); *_screen_p = screenNum; // HERO object - for (int i = HERO + 1; i < _numObj; i++) { // Any others - if (_object->isCarried(i)) // being carried - _object->_objects[i].screenIndex = screenNum; - } + _object->setCarriedScreen(screenNum); // Carried objects } /** @@ -1261,8 +1245,7 @@ void HugoEngine::boundaryCollision(object_t *obj) { void HugoEngine::calcMaxScore() { debugC(1, kDebugEngine, "calcMaxScore"); - for (int i = 0; i < _numObj; i++) - _maxscore += _object->_objects[i].objValue; + _maxscore = _object->calcMaxScore(); for (int i = 0; i < _numBonuses; i++) _maxscore += _points[i].score; diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 4f371117ab..985499896e 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -158,7 +158,6 @@ public: uint16 _look; uint16 _take; uint16 _drop; - uint16 _numObj; GUI::Debugger *getDebugger() { return _console; } @@ -200,7 +199,6 @@ public: void clearBoundary(int x1, int x2, int y); void endGame(); void initStatus(); - void readObjectImages(); void readScreenFiles(int screen); void screenActions(int screen); void setNewScreen(int screen); diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp index 74ab32c34f..19aa69c1fa 100644 --- a/engines/hugo/inventory.cpp +++ b/engines/hugo/inventory.cpp @@ -153,7 +153,7 @@ int16 InventoryHandler::processInventory(invact_t action, ...) { if (objId == -1 && i < displayNumb) { // Find objid by counting # carried objects == i+1 int16 j; - for (j = 0, i++; i > 0 && j < _vm->_numObj; j++) { + for (j = 0, i++; i > 0 && j < _vm->_object->_numObj; j++) { if (_vm->_object->isCarried(j)) { if (--i == 0) objId = j; diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index 14585f0cd7..0eede35dac 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -47,6 +47,7 @@ namespace Hugo { ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0) { + _numObj = 0; } ObjectHandler::~ObjectHandler() { @@ -116,7 +117,7 @@ void ObjectHandler::useObject(int16 objId) { _vm->_arrayNouns[obj->nounIndex][0]); // Check valid use of objects and override verb if necessary - for (uses_t *use = _vm->_uses; use->objId != _vm->_numObj; use++) { + for (uses_t *use = _vm->_uses; use->objId != _numObj; use++) { if (_vm->getGameStatus().inventoryObjId == use->objId) { // Look for secondary object, if found use matching verb bool foundFl = false; @@ -157,7 +158,7 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { uint16 y2Max = 0; // Greatest y2 object_t *obj = _objects; // Check objects on screen - for (int i = 0; i < _vm->_numObj; i++, obj++) { + for (int i = 0; i < _numObj; i++, obj++) { // Object must be in current screen and "useful" if (obj->screenIndex == *_vm->_screen_p && (obj->genericCmd || obj->objValue || obj->cmdIndex)) { seq_t *curImage = obj->currImagePtr; @@ -214,7 +215,7 @@ void ObjectHandler::freeObjects() { return; // Free all sequence lists and image data - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; for (int j = 0; j < obj->seqNumb; j++) { // for each sequence seq_t *seq = obj->seqList[j].seqPtr; // Free image @@ -270,7 +271,7 @@ int ObjectHandler::y2comp(const void *a, const void *b) { bool ObjectHandler::isCarrying(uint16 wordIndex) { debugC(1, kDebugObject, "isCarrying(%d)", wordIndex); - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { if ((wordIndex == _objects[i].nounIndex) && _objects[i].carriedFl) return true; } @@ -283,7 +284,7 @@ bool ObjectHandler::isCarrying(uint16 wordIndex) { void ObjectHandler::showTakeables() { debugC(1, kDebugObject, "showTakeables"); - for (int j = 0; j < _vm->_numObj; j++) { + for (int j = 0; j < _numObj; j++) { object_t *obj = &_objects[j]; if ((obj->cycling != INVISIBLE) && (obj->screenIndex == *_vm->_screen_p) && @@ -453,4 +454,83 @@ void ObjectHandler::loadObjectArr(Common::File &in) { } } +/** +* Set the screenindex property of the carried objets to the given screen +* number +*/ +void ObjectHandler::setCarriedScreen(int screenNum) { + for (int i = HERO + 1; i < _numObj; i++) { // Any others + if (isCarried(i)) // being carried + _objects[i].screenIndex = screenNum; + } +} + +/** +* Load _numObj from Hugo.dat +*/ +void ObjectHandler::loadNumObj(Common::File &in) { + int numElem; + + for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { + numElem = in.readUint16BE(); + if (varnt == _vm->_gameVariant) + _numObj = numElem; + } +} + +/** +* Restore all sequences +*/ +void ObjectHandler::restoreAllSeq() { + // Restore ptrs to currently loaded objects + for (int i = 0; i < _numObj; i++) + restoreSeq(&_objects[i]); +} + +/** +* Save objects +*/ +void ObjectHandler::saveObjects(Common::WriteStream *out) { + for (int i = 0; i < _numObj; i++) { + // Save where curr_seq_p is pointing to + saveSeq(&_objects[i]); + out->write(&_objects[i], sizeof(object_t)); + } +} + +/** +* Restore objects +*/ +void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) { + for (int i = 0; i < _numObj; i++) { + object_t *p = &_objects[i]; + seqList_t seqList[MAX_SEQUENCES]; + memcpy(seqList, p->seqList, sizeof(seqList_t)); + uint16 cmdIndex = p->cmdIndex; + in->read(p, sizeof(object_t)); + p->cmdIndex = cmdIndex; + memcpy(p->seqList, seqList, sizeof(seqList_t)); + } +} + +/** +* Compute max object score +*/ +int ObjectHandler::calcMaxScore() { + int score = 0; + for (int i = 0; i < _numObj; i++) + score += _objects[i].objValue; + return(score); +} + +/** +* Read Object images +*/ +void ObjectHandler::readObjectImages() { + debugC(1, kDebugObject, "readObjectImages"); + + for (int i = 0; i < _numObj; i++) + _vm->_file->readImage(i, &_objects[i]); +} + } // End of namespace Hugo diff --git a/engines/hugo/object.h b/engines/hugo/object.h index 72b13caa8f..3c39684b5e 100644 --- a/engines/hugo/object.h +++ b/engines/hugo/object.h @@ -46,6 +46,7 @@ public: virtual ~ObjectHandler(); object_t *_objects; + uint16 _numObj; virtual void moveObjects() = 0; virtual void updateImages() = 0; @@ -54,13 +55,19 @@ public: bool isCarrying(uint16 wordIndex); bool findObjectSpace(object_t *obj, int16 *destx, int16 *desty); + int calcMaxScore(); int16 findObject(uint16 x, uint16 y); void freeObjects(); void loadObjectArr(Common::File &in); void freeObjectArr(); + void loadNumObj(Common::File &in); void lookObject(object_t *obj); - void restoreSeq(object_t *obj); + void readObjectImages(); + void restoreAllSeq(); + void restoreObjects(Common::SeekableReadStream *in); + void saveObjects(Common::WriteStream *out); void saveSeq(object_t *obj); + void setCarriedScreen(int screenNum); void showTakeables(); void useObject(int16 objId); @@ -87,6 +94,8 @@ public: protected: HugoEngine *_vm; uint16 _objCount; + + void restoreSeq(object_t *obj); }; class ObjectHandler_v1d : public ObjectHandler { diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index 6c929f75fd..669c4fb131 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -65,7 +65,7 @@ void ObjectHandler_v1d::updateImages() { int num_objs = 0; byte objindex[MAXOBJECTS]; // Array of indeces to objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= ALMOST_INVISIBLE)) objindex[num_objs++] = i; @@ -188,7 +188,7 @@ void ObjectHandler_v1d::moveObjects() { // Perform any adjustments to velocity based on special path types // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if (obj->screenIndex == *_vm->_screen_p) { @@ -276,7 +276,7 @@ void ObjectHandler_v1d::moveObjects() { } // Move objects, allowing for boundaries - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { // Only process if it's moving @@ -330,7 +330,7 @@ void ObjectHandler_v1d::moveObjects() { } // Clear all object baselines from the boundary file. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > ALMOST_INVISIBLE) && (obj->priority == FLOATING)) diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index 48d921f2be..b47bd0e488 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -65,7 +65,7 @@ void ObjectHandler_v1w::updateImages() { int num_objs = 0; byte objindex[MAXOBJECTS]; // Array of indeces to objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= ALMOST_INVISIBLE)) objindex[num_objs++] = i; @@ -183,7 +183,7 @@ void ObjectHandler_v1w::moveObjects() { // Perform any adjustments to velocity based on special path types // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if (obj->screenIndex == *_vm->_screen_p) { @@ -284,7 +284,7 @@ void ObjectHandler_v1w::moveObjects() { } // Move objects, allowing for boundaries - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { // Only process if it's moving @@ -338,7 +338,7 @@ void ObjectHandler_v1w::moveObjects() { } // Clear all object baselines from the boundary file. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > ALMOST_INVISIBLE) && (obj->priority == FLOATING)) diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index 9d35edd882..d798a54fd1 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -65,7 +65,7 @@ void ObjectHandler_v2d::updateImages() { int num_objs = 0; byte objindex[MAXOBJECTS]; // Array of indeces to objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= ALMOST_INVISIBLE)) objindex[num_objs++] = i; @@ -186,7 +186,7 @@ void ObjectHandler_v2d::moveObjects() { // Perform any adjustments to velocity based on special path types // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if (obj->screenIndex == *_vm->_screen_p) { @@ -287,7 +287,7 @@ void ObjectHandler_v2d::moveObjects() { } // Move objects, allowing for boundaries - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { // Only process if it's moving @@ -341,7 +341,7 @@ void ObjectHandler_v2d::moveObjects() { } // Clear all object baselines from the boundary file. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > ALMOST_INVISIBLE) && (obj->priority == FLOATING)) diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 485522bb12..ce99ef4c48 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -67,7 +67,7 @@ void ObjectHandler_v3d::moveObjects() { // Perform any adjustments to velocity based on special path types // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if (obj->screenIndex == *_vm->_screen_p) { @@ -168,7 +168,7 @@ void ObjectHandler_v3d::moveObjects() { } // Move objects, allowing for boundaries - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { // Only process if it's moving @@ -222,7 +222,7 @@ void ObjectHandler_v3d::moveObjects() { } // Clear all object baselines from the boundary file. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object seq_t *currImage = obj->currImagePtr; // Get ptr to current image if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > ALMOST_INVISIBLE) && (obj->priority == FLOATING)) diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 22f1102b08..ff182a1aee 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -256,7 +256,7 @@ void Parser::showDosInventory() { static const char *blanks = " "; uint16 index = 0, len1 = 0, len2 = 0; - for (int i = 0; i < _vm->_numObj; i++) { // Find widths of 2 columns + for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns if (_vm->_object->isCarried(i)) { uint16 len = strlen(_vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][1]); if (index++ & 1) // Right hand column @@ -274,7 +274,7 @@ void Parser::showDosInventory() { strncat(buffer, blanks, (len1 + len2 - strlen(_vm->_textParser[kTBIntro])) / 2); strcat(strcat(buffer, _vm->_textParser[kTBIntro]), "\n"); index = 0; - for (int i = 0; i < _vm->_numObj; i++) { // Assign strings + for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings if (_vm->_object->isCarried(i)) { if (index++ & 1) strcat(strcat(buffer, _vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][1]), "\n"); diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index 216ab8386c..0a319fd2c1 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -350,7 +350,7 @@ void Parser_v1d::lineHandler() { do { noun = findNextNoun(noun); // Find a noun in the line // Must try at least once for objects allowing verb-context - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { obj = &_vm->_object->_objects[i]; if (isNear(verb, noun, obj, farComment)) { if (isObjectVerb(verb, obj) // Foreground object diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index 96442e4fcd..9155942130 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -334,7 +334,7 @@ void Parser_v1w::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_line, "fetch all")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (_vm->_object->_objects[i].genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } @@ -342,7 +342,7 @@ void Parser_v1w::lineHandler() { } if (strstr(_line, "fetch")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (!strcmp(&_line[strlen("fetch") + 1], _vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][0])) { takeObject(&_vm->_object->_objects[i]); return; @@ -352,7 +352,7 @@ void Parser_v1w::lineHandler() { // Special code to allow me to goto objects if (strstr(_line, "find")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (!strcmp(&_line[strlen("find") + 1], _vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][0])) { _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); return; @@ -396,7 +396,7 @@ void Parser_v1w::lineHandler() { char farComment[XBYTES * 5] = ""; // hold 5 line comment if object not nearby // Test for nearby objects referenced explicitly - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_arrayNouns[obj->nounIndex])) { if (isObjectVerb(obj, farComment) || isGenericVerb(obj, farComment)) @@ -406,7 +406,7 @@ void Parser_v1w::lineHandler() { // Test for nearby objects that only require a verb // Note comment is unused if not near. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (obj->verbOnlyFl) { char contextComment[XBYTES * 5] = ""; // Unused comment for context objects diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index fc82412962..bbec03b8a8 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -104,7 +104,7 @@ void Parser_v2d::lineHandler() { do { noun = findNextNoun(noun); // Find a noun in the line // Must try at least once for objects allowing verb-context - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { obj = &_vm->_object->_objects[i]; if (isNear(verb, noun, obj, farComment)) { if (isObjectVerb(verb, obj) // Foreground object diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index 7c0b9adedf..6a12252600 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -84,7 +84,7 @@ void Parser_v3d::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_line, "fetch all")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (_vm->_object->_objects[i].genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } @@ -92,7 +92,7 @@ void Parser_v3d::lineHandler() { } if (strstr(_line, "fetch")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (!strcmp(&_line[strlen("fetch") + 1], _vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][0])) { takeObject(&_vm->_object->_objects[i]); return; @@ -102,7 +102,7 @@ void Parser_v3d::lineHandler() { // Special code to allow me to goto objects if (strstr(_line, "find")) { - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { if (!strcmp(&_line[strlen("find") + 1], _vm->_arrayNouns[_vm->_object->_objects[i].nounIndex][0])) { _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); return; @@ -153,7 +153,7 @@ void Parser_v3d::lineHandler() { char farComment[XBYTES * 5] = ""; // hold 5 line comment if object not nearby // Test for nearby objects referenced explicitly - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_arrayNouns[obj->nounIndex])) { if (isObjectVerb(obj, farComment) || isGenericVerb(obj, farComment)) @@ -163,7 +163,7 @@ void Parser_v3d::lineHandler() { // Test for nearby objects that only require a verb // Note comment is unused if not near. - for (int i = 0; i < _vm->_numObj; i++) { + for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (obj->verbOnlyFl) { char contextComment[XBYTES * 5] = ""; // Unused comment for context objects diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index a980dc030a..8ae5be10cd 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -307,7 +307,7 @@ bool Route::findRoute(int16 cx, int16 cy) { // Store all object baselines into objbound (except hero's = [0]) object_t *obj; // Ptr to object int i; - for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_numObj; i++, obj++) { + for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_object->_numObj; i++, obj++) { if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != INVISIBLE) && (obj->priority == FLOATING)) _vm->storeBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2); } @@ -321,7 +321,7 @@ bool Route::findRoute(int16 cx, int16 cy) { } // Clear all object baselines from objbound - for (i = 0, obj = _vm->_object->_objects; i < _vm->_numObj; i++, obj++) { + for (i = 0, obj = _vm->_object->_objects; i < _vm->_object->_numObj; i++, obj++) { if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != INVISIBLE) && (obj->priority == FLOATING)) _vm->clearBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2); } |