[Scummvm-cvs-logs] SF.net SVN: scummvm:[54212] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Fri Nov 12 00:04:05 CET 2010


Revision: 54212
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54212&view=rev
Author:   strangerke
Date:     2010-11-11 23:04:04 +0000 (Thu, 11 Nov 2010)

Log Message:
-----------
HUGO: Cleanup, move several functions and variables to the object class

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/file.cpp
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/hugo.h
    scummvm/trunk/engines/hugo/inventory.cpp
    scummvm/trunk/engines/hugo/object.cpp
    scummvm/trunk/engines/hugo/object.h
    scummvm/trunk/engines/hugo/object_v1d.cpp
    scummvm/trunk/engines/hugo/object_v1w.cpp
    scummvm/trunk/engines/hugo/object_v2d.cpp
    scummvm/trunk/engines/hugo/object_v3d.cpp
    scummvm/trunk/engines/hugo/parser.cpp
    scummvm/trunk/engines/hugo/parser_v1d.cpp
    scummvm/trunk/engines/hugo/parser_v1w.cpp
    scummvm/trunk/engines/hugo/parser_v2d.cpp
    scummvm/trunk/engines/hugo/parser_v3d.cpp
    scummvm/trunk/engines/hugo/route.cpp

Modified: scummvm/trunk/engines/hugo/file.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/file.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -318,12 +318,7 @@
 	// 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 @@
 	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 @@
 	// 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);

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -66,7 +66,7 @@
 	_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 @@
 		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 @@
 		}
 	}
 
-	//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 @@
 	_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 @@
 	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::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;

Modified: scummvm/trunk/engines/hugo/hugo.h
===================================================================
--- scummvm/trunk/engines/hugo/hugo.h	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/hugo.h	2010-11-11 23:04:04 UTC (rev 54212)
@@ -158,7 +158,6 @@
 	uint16    _look;
 	uint16    _take;
 	uint16    _drop;
-	uint16    _numObj;
 
 	GUI::Debugger *getDebugger() { return _console; }
 
@@ -200,7 +199,6 @@
 	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);

Modified: scummvm/trunk/engines/hugo/inventory.cpp
===================================================================
--- scummvm/trunk/engines/hugo/inventory.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/inventory.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -153,7 +153,7 @@
 			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;

Modified: scummvm/trunk/engines/hugo/object.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -47,6 +47,7 @@
 namespace Hugo {
 
 ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0) {
+	_numObj = 0; 
 }
 
 ObjectHandler::~ObjectHandler() {
@@ -116,7 +117,7 @@
 			                       _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 @@
 	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 @@
 		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 @@
 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 @@
 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 @@
 	}
 }
 
+/**
+* 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

Modified: scummvm/trunk/engines/hugo/object.h
===================================================================
--- scummvm/trunk/engines/hugo/object.h	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object.h	2010-11-11 23:04:04 UTC (rev 54212)
@@ -46,6 +46,7 @@
 	virtual ~ObjectHandler();
 
 	object_t  *_objects;
+	uint16    _numObj;
 
 	virtual void moveObjects() = 0;
 	virtual void updateImages() = 0;
@@ -54,13 +55,19 @@
 	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 @@
 protected:
 	HugoEngine *_vm;
 	uint16     _objCount;
+
+	void restoreSeq(object_t *obj);
 };
 
 class ObjectHandler_v1d : public ObjectHandler {

Modified: scummvm/trunk/engines/hugo/object_v1d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object_v1d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object_v1d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -65,7 +65,7 @@
 	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 @@
 	// 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 @@
 	}
 
 	// 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 @@
 	}
 
 	// 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))

Modified: scummvm/trunk/engines/hugo/object_v1w.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object_v1w.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object_v1w.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -65,7 +65,7 @@
 	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 @@
 	// 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 @@
 	}
 
 	// 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 @@
 	}
 
 	// 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))

Modified: scummvm/trunk/engines/hugo/object_v2d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object_v2d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object_v2d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -65,7 +65,7 @@
 	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 @@
 	// 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 @@
 	}
 
 	// 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 @@
 	}
 
 	// 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))

Modified: scummvm/trunk/engines/hugo/object_v3d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object_v3d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/object_v3d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -67,7 +67,7 @@
 	// 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 @@
 	}
 
 	// 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 @@
 	}
 
 	// 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))

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/parser.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -256,7 +256,7 @@
 	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 @@
 	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");

Modified: scummvm/trunk/engines/hugo/parser_v1d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v1d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/parser_v1d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -350,7 +350,7 @@
 		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

Modified: scummvm/trunk/engines/hugo/parser_v1w.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v1w.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/parser_v1w.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -334,7 +334,7 @@
 
 		// 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 @@
 		}
 
 		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 @@
 
 		// 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 @@
 	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 @@
 
 	// 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

Modified: scummvm/trunk/engines/hugo/parser_v2d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v2d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/parser_v2d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -104,7 +104,7 @@
 		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

Modified: scummvm/trunk/engines/hugo/parser_v3d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v3d.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/parser_v3d.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -84,7 +84,7 @@
 
 		// 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 @@
 		}
 
 		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 @@
 
 		// 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 @@
 	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 @@
 
 	// 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

Modified: scummvm/trunk/engines/hugo/route.cpp
===================================================================
--- scummvm/trunk/engines/hugo/route.cpp	2010-11-11 19:38:32 UTC (rev 54211)
+++ scummvm/trunk/engines/hugo/route.cpp	2010-11-11 23:04:04 UTC (rev 54212)
@@ -307,7 +307,7 @@
 	// 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 @@
 	}
 
 	// 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);
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list