[Scummvm-cvs-logs] CVS: scummvm/queen walk.h,1.12,1.13 walk.cpp,1.23,1.24 logic.cpp,1.100,1.101 command.cpp,1.18,1.19

Gregory Montoir cyx at users.sourceforge.net
Sun Nov 16 02:49:10 CET 2003


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

Modified Files:
	walk.h walk.cpp logic.cpp command.cpp 
Log Message:
fix some bugs :
- Joe being unable to grab oil during carbam scene (walking bug, when dest_pt == orig_pt)
- wrong Joe facing direction when opening plane door

updated handlePinnacleRoom() comment


Index: walk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- walk.h	8 Nov 2003 23:45:45 -0000	1.12
+++ walk.h	16 Nov 2003 10:47:31 -0000	1.13
@@ -109,7 +109,7 @@
 	void incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 area);
 	
 	//! compute path (and populates _walkData) from current position to the new one
-	void calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y);
+	bool calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y);
 
 
 	WalkData _walkData[MAX_WALK_DATA];	
@@ -128,7 +128,7 @@
 	Graphics *_graphics;
 
 
-	static const MovePersonData MOVE_DATA[];
+	static const MovePersonData _moveData[];
 };
 
 

Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- walk.cpp	15 Nov 2003 15:44:50 -0000	1.23
+++ walk.cpp	16 Nov 2003 10:47:31 -0000	1.24
@@ -28,7 +28,7 @@
 namespace Queen {
 
 
-const MovePersonData Walk::MOVE_DATA[] = {
+const MovePersonData Walk::_moveData[] = {
 	{"COMPY",       -1,  -6,  1,  6,  0,  0,  0,  0, 12, 12, 1, 14},
 	{"DEINO",       -1,  -8,  1,  8,  0,  0,  0,  0, 11, 11, 1, 10},
 	{"FAYE",        -1,  -6,  1,  6, 13, 18,  7, 12, 19, 22, 2,  5},
@@ -311,20 +311,20 @@
 		incWalkData(oldx, oldy, endx, endy, oldPos);
 	}
 	else {
-		calc(oldPos, newPos, oldx, oldy, endx, endy);
-	}
-
-	if (_walkDataCount > 0) {
-		animateJoePrepare();
-		if(animateJoe()) {
+		if (calc(oldPos, newPos, oldx, oldy, endx, endy)) {
+			if (_walkDataCount > 0) {
+				animateJoePrepare();
+				if(animateJoe()) {
+					can = -1;
+				}
+			}
+		}
+		else {
+			// path has been blocked, make Joe say so
+			_logic->joeSpeak(4);
 			can = -1;
 		}
 	}
-	else {
-		// path has been blocked, make Joe say so
-		_logic->joeSpeak(4);
-		can = -1;
-	}
 
 	_graphics->bob(0)->animating = false;
 	// cyx: the NEW_ROOM = 0 is done in Command::grabCurrentSelection()
@@ -375,10 +375,8 @@
 
 	debug(9, "Walk::personMove(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos);
 
-	calc(oldPos, newPos, oldx, oldy, endx, endy);
-
 	// find MovePersonData associated to Person
-	const MovePersonData *mpd = MOVE_DATA;
+	const MovePersonData *mpd = _moveData;
 	while (mpd->name[0] != '*') {
 		if (scumm_stricmp(mpd->name, pp->name) == 0) {
 			break;
@@ -386,9 +384,11 @@
 		++mpd;
 	}
 
-	if (_walkDataCount > 0) {
-		animatePersonPrepare(mpd, direction);
-		animatePerson(mpd, curImage, bobNum, bankNum, direction);
+	if (calc(oldPos, newPos, oldx, oldy, endx, endy)) {
+		if (_walkDataCount > 0) {
+			animatePersonPrepare(mpd, direction);
+			animatePerson(mpd, curImage, bobNum, bankNum, direction);
+		}
 	}
 	else {
 		can = -1;
@@ -427,7 +427,7 @@
 }
 
 
-void Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) {
+bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) {
 	
 	// if newPos is outside of an AREA then traverse Y axis until an AREA is found
 	if (newPos == 0) { 
@@ -442,6 +442,7 @@
 
 	if (oldPos == newPos) {
 		incWalkData(oldx, oldy, x, y, newPos);
+		return true;
 	}
 	else if (calcPath(oldPos, newPos)) {
 		uint16 i;
@@ -459,7 +460,9 @@
 			py = y1;
 		}
 		incWalkData(px, py, x, y, newPos);
+		return true;
 	}
+	return false;
 }
 
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- logic.cpp	15 Nov 2003 21:33:04 -0000	1.100
+++ logic.cpp	16 Nov 2003 10:47:31 -0000	1.101
@@ -1092,6 +1092,8 @@
 		return curImage;
 	}
 
+	debug(0, "Logic::roomRefreshObject(%X, %s)", obj, _objName[ABS(pod->name)]);
+
 	// check the object is in the current room
 	if (pod->room != _currentRoom) {
 		warning("Logic::roomRefreshObject() - Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)",
@@ -1620,7 +1622,7 @@
 		}
 	}
 
-	debug(9, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy);
+	debug(0, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy);
 
 	if (scale > 0 && scale < 100) {
 		_joe.scale = scale;
@@ -1738,10 +1740,10 @@
 
 	case STATE_GRAB_MID:
 		if (_joe.facing == DIR_BACK) {
-			frame = 4;
+			frame = 6;
 		}
 		else if (_joe.facing == DIR_FRONT) {
-			frame = 6;
+			frame = 4;
 		}
 		else {
 			frame = 2;
@@ -2249,7 +2251,7 @@
 
 	// camera does not follow Joe anymore
 	_graphics->cameraBob(-1);
-	roomDisplay("m1", RDM_NOFADE_JOE, 100, 2, true);
+	roomDisplay(roomName(ROOM_JUNGLE_PINNACLE), RDM_NOFADE_JOE, 100, 2, true);
 
 	BobSlot *joe   = _graphics->bob(6);
 	BobSlot *piton = _graphics->bob(7);
@@ -2304,38 +2306,29 @@
 	_input->clearMouseButton();
 
 	_newRoom = _objectData[_entryObj].room;
-	joe->active = piton->active = false;
-	_graphics->textClear(5, 5);
 
-	// There is quite a hack in original source code to handle properly this
-	// special room. The main problem is described in executed.c l.334-339.
-	//
-	// Below is how room switching is handled
-	//
-	//   ACTION2=10;
-	//   SUBJECT[1]=NOUN+ROOM_DATA[ROOM];
-	//   EXECUTE_ACTION(NO);
-	// 
-	// None of the following commands updates gamestate/areas/objects/items :
-	//  
-	// piton -> crash  : 0x216
-	// piton -> floda  : 0x217
-	// piton -> bob    : 0x219
-	// piton -> embark : 0x218
-	// piton -> jungle : 0x20B
+	// Only a few commands can be triggered from this room :
+	// piton -> crash  : 0x216 (obj=0x2a, song=3)
+	// piton -> floda  : 0x217 (obj=0x29, song=16)
+	// piton -> bob    : 0x219 (obj=0x2f, song=6)
+	// piton -> embark : 0x218 (obj=0x2c, song=7)
+	// piton -> jungle : 0x20B (obj=0x2b, song=3)
+	// piton -> amazon : 0x21A (obj=0x30, song=3)
 	// 
-	// But this list is surely not exhaustive...
+	// Because none of these update objects/areas/gamestate, the EXECUTE_ACTION()
+	// call, as the original does, is useless. All we have to do is the playsong 
+	// call (all songs have the PLAY_BEFORE type). This way we could get rid of 
+	// the hack described in execute.c l.334-339.
 	//
-	// So basically, EXECUTE_ACTION only performs the playsong calls...
 	// XXX if (com->song > 0) { playsong(com->song); }
 
+	joe->active = piton->active = false;
+	_graphics->textClear(5, 5);
+
 	// camera follows Joe again
 	_graphics->cameraBob(0);
-	
-	// XXX COMPANEL=1;
-	// _display->panel(true); // cyx: to me, that's completely useless
 
-	_display->palFadeOut(0, 223, 7);
+	_display->palFadeOut(0, 223, ROOM_JUNGLE_PINNACLE);
 }
 
 

Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- command.cpp	15 Nov 2003 21:33:04 -0000	1.18
+++ command.cpp	16 Nov 2003 10:47:31 -0000	1.19
@@ -525,7 +525,6 @@
 
 	// Check to see if object is actually an exit to another
 	// room. If so, then set up new room
-
 	ObjectData *objData = _logic->objectData(objNum);
 	if (objData->x != 0 || objData->y != 0) {
 		x = objData->x;
@@ -550,6 +549,7 @@
 		_logic->newRoom(0);
 	}
 
+	debug(0, "Command::makeJoeWalkTo() - x=%d y=%d newRoom=%d", x, y, _logic->newRoom());
 
 	int16 p = 0;
 	if (mustWalk) {
@@ -1445,7 +1445,7 @@
 	if (_selCmd.noun > 0 && _selCmd.noun <= _logic->currentRoomObjMax()) {
 		uint16 objNum = _logic->currentRoomData() + _selCmd.noun;
 		if (_logic->objectData(objNum)->entryObj == 0) {
-			if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _selCmd.action, true) == -2) { // XXX inCutaway parameter
+			if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _selCmd.action, false) == -2) { // XXX inCutaway parameter
 				// 'I can't get close enough to have a look.'
 				_logic->joeSpeak(13);
 			}





More information about the Scummvm-git-logs mailing list