[Scummvm-cvs-logs] CVS: scummvm/queen walk.h,1.4,1.5 walk.cpp,1.5,1.6 logic.h,1.19,1.20 logic.cpp,1.29,1.30

Gregory Montoir cyx at users.sourceforge.net
Sun Oct 12 06:17:14 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv6836

Modified Files:
	walk.h walk.cpp logic.h logic.cpp 
Log Message:
DISP_ROOM additions/corrections

Index: walk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- walk.h	11 Oct 2003 10:09:23 -0000	1.4
+++ walk.h	12 Oct 2003 13:16:35 -0000	1.5
@@ -86,7 +86,7 @@
 	void joeSetup();
 
 	//! SETUP_HERO(), places Joe at the right place when entering a room
-	ObjectData *joeSetupInRoom(int state, uint16 scale, uint16 entryObj);
+	ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale);
 	
 	//! MOVE_JOE()
 	void joeMove(int direction, uint16 endx, uint16 endy, bool inCutaway);

Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- walk.cpp	11 Oct 2003 10:09:23 -0000	1.5
+++ walk.cpp	12 Oct 2003 13:16:35 -0000	1.6
@@ -303,7 +303,6 @@
 
 	uint16 i;
 	for (i = 1; i <= _walkDataCount; ++i) {
-//		MovePersonAnim *mpa = &_moveAnim[i];
 		WalkData *pwd = &_walkData[i];
 		// unpack necessary frames for bob animation
 		uint16 dstFrame = pp->image;
@@ -364,25 +363,25 @@
 }
 
 
-ObjectData *Walk::joeSetupInRoom(int state, uint16 scale, uint16 entryObj) {
+ObjectData *Walk::joeSetupInRoom(bool autoPosition, uint16 scale) {
 	// queen.c SETUP_HERO()
 
 	uint16 oldx;
 	uint16 oldy;
 	WalkOffData *pwo = NULL;
-	ObjectData *pod = _logic->objectData(entryObj);
+	ObjectData *pod = _logic->objectData(_logic->entryObj());
 	if (pod == NULL) {
-		error("Walk::joeSetupInRoom() - No object data for obj %d", entryObj);
+		error("Walk::joeSetupInRoom() - No object data for obj %d", _logic->entryObj());
 	}
 
-	if (state == 3 || _logic->joeX() != 0 || _logic->joeY()) {
+	if (!autoPosition || _logic->joeX() != 0 || _logic->joeY() != 0) {
 		oldx = _logic->joeX();
 		oldy = _logic->joeY();
 	}
 	else {
 		// find the walk off point for the entry object and make 
 		// Joe walking to that point
-		pwo = _logic->walkOffPointForObject(entryObj);
+		pwo = _logic->walkOffPointForObject(_logic->entryObj());
 		if (pwo != NULL) {
 			oldx = pwo->x;
 			oldy = pwo->y;

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- logic.h	11 Oct 2003 10:09:23 -0000	1.19
+++ logic.h	12 Oct 2003 13:16:35 -0000	1.20
@@ -38,7 +38,10 @@
 };
 
 enum RoomDisplayMode {
-
+	RDM_FADE_NOJOE  = 0, // fade in, no Joe
+	RDM_FADE_JOE    = 1, // Joe is to be displayed
+	RDM_NOFADE_JOE  = 2, // screen does not dissolve into view
+	RDM_FADE_JOE_XY = 3  // display Joe at the current X, Y coords
 };
 
 struct ZoneSlot {
@@ -65,8 +68,8 @@
 	uint16 objMax(int room);
 	GraphicData* graphicData(int index);
 
-	uint16 findBob(uint16 obj); // FIXME: move that to QueenDisplay ?
-	uint16 findFrame(uint16 obj); // FIXME: move that to QueenDisplay ?
+	uint16 findBob(uint16 obj);
+	uint16 findFrame(uint16 obj);
 	uint16 objectForPerson(uint16 bobnum);
 	WalkOffData *walkOffPointForObject(uint16 obj);
 
@@ -102,13 +105,16 @@
 	void zoneSetup();
 
 	void roomErase();
-	uint16 roomSetupFurniture(uint16 frames); // SETUP_FURNITURE()
+	void roomSetupFurniture(); // SETUP_FURNITURE()
 	void roomSetupObjects(); // DISP_OBJECTS
 	void roomSetup(const char* room, int comPanel, bool inCutaway);
-	void roomDisplay(const char* room, int state, uint16 joeScale, int comPanel, bool inCutaway); // DISP_ROOM
+	void roomDisplay(const char* room, RoomDisplayMode mode, uint16 joeScale, int comPanel, bool inCutaway); // DISP_ROOM
 
 	uint16 findScale(uint16 x, uint16 y);
 
+	int16 entryObj() const { return _entryObj; }
+	void entryObj(int16 obj) { _entryObj = obj; }
+
 
 protected:
 	uint8 *_jas;
@@ -157,9 +163,11 @@
 	uint16 _numFurnitureAnimated; // FMAXA
 	uint16 _numFurnitureStatic; // FMAX
 	uint16 _numFurnitureAnimatedLen; // FMAXLEN
+	uint16 _numFrames; // FRAMES
 
 	Resource *_resource;
 	Graphics *_graphics;
+public:
 	Walk *_walk;
 
 	void initialise();

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- logic.cpp	11 Oct 2003 10:09:23 -0000	1.29
+++ logic.cpp	12 Oct 2003 13:16:35 -0000	1.30
@@ -220,6 +220,7 @@
 
 	memset(_zones, 0, sizeof(_zones));
 	_oldRoom = 0;
+	_entryObj = 0;
 }
 
 uint16 Logic::currentRoom() {
@@ -360,7 +361,7 @@
 			else {
 				// animated bob
 				if(idxAnimated > 0) {
-					bobnum = 4 + _numFurnitureAnimated + _numFurnitureAnimatedLen;
+					bobnum = 4 + _numFurnitureAnimated + idxAnimated;
 				}
 			}
 		}
@@ -385,7 +386,7 @@
 			}
 		}
 		if(bobnum <= 3) {
-			framenum = 29 + FRAMES_JOE_XTRA;
+			framenum = 29 + FRAMES_JOE_XTRA + bobnum;
 		}
 	}
 	else {
@@ -399,6 +400,7 @@
 					idx += ABS(pgd->lastFrame) - pgd->firstFrame + 1;
 				}
 				else {
+					// static bob, skip one frame
 					++idx;
 				}
 			}
@@ -439,7 +441,7 @@
 
 		// calculate only if there are person frames
 		if(idx > 0) {
-			framenum = 36 + _numFurnitureStatic + _numFurnitureAnimatedLen + idx + FRAMES_JOE_XTRA;
+			framenum = 36 + FRAMES_JOE_XTRA + _numFurnitureStatic + _numFurnitureAnimatedLen + idx;
 		}
 	}
 	return framenum;
@@ -636,7 +638,7 @@
 }
 
 
-uint16 Logic::roomSetupFurniture(uint16 frames) {
+void Logic::roomSetupFurniture() {
 	_numFurnitureStatic = 0;
 	_numFurnitureAnimated = 0;
 	_numFurnitureAnimatedLen = 0;
@@ -652,17 +654,17 @@
 //			_gameState[furnitureTotal] = _furnitureData[i].gameStateValue;
 //		}
 //	}
-//	if (furnitureTotal == 0) {
-//		return;
-//	}
+	if (furnitureTotal == 0) {
+		return;
+	}
 
 	// unpack the furniture from the bank 15
 	// there are 3 kinds :
-	// - static (paste downs), gamestate range = ]0;5000]
+	// - static (bobs), gamestate range = ]0;5000]
 	// - animated (bobs), gamestate range = ]0;5000]
-	// - static (overlaying paste downs), gamestate range = [5000; [
+	// - static (paste downs), gamestate range = [5000; [
 
-	// unpack the paste downs
+	// unpack the static bobs
 	for	(i = 1; i <= furnitureTotal; ++i) {
 		int16 obj = _gameState[i];
 		if (obj > 0 && obj <= 5000) {
@@ -671,13 +673,12 @@
 				++_numFurnitureStatic;
 				++curImage;
 				_graphics->bankUnpack(pgd->firstFrame, curImage, 15);
-				++frames;
+				++_numFrames;
 				BobSlot *pbs = _graphics->bob(19 + _numFurnitureStatic);
 				pbs->active = true;
 				pbs->x = pgd->x;
 				pbs->y = pgd->y;
 				pbs->frameNum = curImage;
-				warning("Logic::roomSetupFurniture() : static furniture instead of animated");
 			}
 		}
 	}
@@ -704,7 +705,7 @@
 				for (k = pgd->firstFrame; k <= pgd->lastFrame; ++k) {
 					++curImage;
 					_graphics->bankUnpack(k, curImage, 15);
-					++frames;
+					++_numFrames;
 				}
 				_graphics->bobAnimNormal(5 + curBob, image, curImage, pgd->speed / 4, rebound, false);
 				BobSlot *pbs = _graphics->bob(5 + curBob);
@@ -715,7 +716,7 @@
 		}
 	}
 
-	// unpack the overlaying paste downs
+	// unpack the paste downs
 	++curImage;
 	for  (i = 1; i <= furnitureTotal; ++i) {
 		int16 obj = _gameState[i];
@@ -724,15 +725,40 @@
 			GraphicData *pgd = &_graphicData[obj];
 			_graphics->bankUnpack(pgd->firstFrame, curImage, 15);
 			_graphics->bobPaste(curImage, pgd->x, pgd->y);
+			// no need to increment curImage here, as bobPaste() destroys the 
+			// unpacked frame after blitting it
 		}
 	}
-
-	return frames;
 }
 
 
 void Logic::roomSetupObjects() {
-	warning("Logic::roomSetupObjects() unimplemented");
+	warning("Logic::roomSetupObjects() not fully implemented");
+
+	uint16 i;
+	uint16 curImage = 36 + FRAMES_JOE_XTRA + _numFurnitureStatic + _numFurnitureAnimatedLen;
+	uint16 firstRoomObj = _roomData[_currentRoom] + 1;
+	uint16 lastRoomObj = _roomData[_currentRoom + 1];
+
+	for (i = 1; i <= 3; ++i) {
+		_graphics->bob(i)->active = false;
+	}
+
+	// TODO: bobs static/animated
+	// TODO: bobs persons
+
+	// paste downs list
+	++curImage;
+	_numFrames = curImage;
+	for (i = firstRoomObj; i <= lastRoomObj; ++i) {
+		int16 obj = _objectData[i].image;
+		if (obj > 5000) {
+			obj -= 5000;
+			GraphicData *pgd = &_graphicData[obj];
+			_graphics->bankUnpack(pgd->firstFrame, curImage, 15);
+			_graphics->bobPaste(curImage, pgd->x, pgd->y);
+		}
+	}
 }
 
 
@@ -756,27 +782,25 @@
 	Common::String bkFile(room);
 	bkFile += ".BBK";
 	_graphics->bankLoad(bkFile.c_str(), 15);
-	roomSetupFurniture(37 + FRAMES_JOE_XTRA);
+	_numFrames = 37 + FRAMES_JOE_XTRA;
+	roomSetupFurniture();
 	roomSetupObjects();
 }
 
 
-void Logic::roomDisplay(const char* room, int state, uint16 scale, int comPanel, bool inCutaway) {
-	// STATE = 0, Fade in, no Joe
-	//       = 1, if Joe is to be displayed
-    //       = 2, Screen does not dissolve into view
-    //       = 3, Display Joe at the current X, Y coords
+void Logic::roomDisplay(const char* room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) {
+
+	debug(9, "Logic::roomDisplay(%s, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway);
 
 	roomErase();
 	// TODO: _sound->loadSFX(SFXNAME[_currentRoom]);
 	roomSetup(room, comPanel, inCutaway);
 	zoneSetup();
 	ObjectData *pod = NULL;
-	if (state != 0) {
-		_entryObj = _roomData[70] + 1; // TEMP
-		pod = _walk->joeSetupInRoom(state, scale, _entryObj);
+	if (mode != RDM_FADE_NOJOE) {
+		pod = _walk->joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale);
 	}
-	if (state != 2) {
+	if (mode != RDM_NOFADE_JOE) {
 		_graphics->update();
 		// TODO: _display->fadeIn();
 	}





More information about the Scummvm-git-logs mailing list