[Scummvm-cvs-logs] CVS: scummvm/queen walk.h,1.6,1.7 walk.cpp,1.9,1.10 logic.h,1.28,1.29 logic.cpp,1.38,1.39 cutaway.cpp,1.19,1.20 xref.txt,1.2,1.3

Gregory Montoir cyx at users.sourceforge.net
Tue Oct 14 12:07:11 CEST 2003


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

Modified Files:
	walk.h walk.cpp logic.h logic.cpp cutaway.cpp xref.txt 
Log Message:
moved some methods from Queen::Walk to Queen::Logic

Index: walk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- walk.h	13 Oct 2003 14:21:17 -0000	1.6
+++ walk.h	14 Oct 2003 19:06:44 -0000	1.7
@@ -64,15 +64,6 @@
 	uint16 moveSpeed;
 };
 
-/*
-struct Person {
-	const char* name;
-	uint16 bobNum; // P_BOB
-	uint16 bankNum; // P_BANK
-	uint16 image; // MOVE_OTHER, CI arg
-	int direction; // MOVE_OTHER, dir arg
-};
-*/
 
 class Logic;
 class Graphics;
@@ -82,18 +73,9 @@
 
 	Walk(Logic* logic, Graphics* graphics);
 
-	//! SETUP_JOE(), loads the various bobs needed to animate Joe
-	void joeSetup();
-
-	//! SETUP_HERO(), places Joe at the right place when entering a room
-	ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale);
-	
 	//! MOVE_JOE()
 	void joeMove(int direction, uint16 endx, uint16 endy, bool inCutaway);
 	
-	//! FACE_JOE()
-	uint16 joeFace();
-
 	//! MOVE_OTHER
 	void personMove(const Person *pp, uint16 endx, uint16 endy, uint16 curImage, int direction);
 
@@ -133,8 +115,6 @@
     void calc(uint16 oldPos, uint16 newPos, uint16 oldx, uint16 oldy, uint16 x, uint16 y);
 
 	static const MovePersonData _moveData[];
-
-	uint16 _joePrevFacing;
 
 	uint16 _walkDataCount;
 	WalkData _walkData[16];	

Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- walk.cpp	14 Oct 2003 12:36:32 -0000	1.9
+++ walk.cpp	14 Oct 2003 19:06:44 -0000	1.10
@@ -57,59 +57,13 @@
 }
 
 
-uint16 Walk::joeFace() {
-
-	debug(9, "Walk::joeFace() - curFace = %d, prevFace = %d", _logic->joeFacing(), _joePrevFacing);
-	BobSlot *pbs = _graphics->bob(0);
-	uint16 frame;
-	if (_logic->currentRoom() == 108) {
-		frame = 1;
-	}
-	else {
-		frame = 33;
-		if (_logic->joeFacing() == DIR_FRONT) {
-			if (_joePrevFacing == DIR_BACK) {
-				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
-				_graphics->update();
-			}
-			frame = 34;
-		}
-		else if (_logic->joeFacing() == DIR_BACK) {
-			if (_joePrevFacing == DIR_FRONT) {
-				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
-				_graphics->update();
-			}
-			frame = 35;
-		}
-		else if ((_logic->joeFacing() == DIR_LEFT && _joePrevFacing == DIR_RIGHT) 
-			|| 	(_logic->joeFacing() == DIR_RIGHT && _joePrevFacing == DIR_LEFT)) {
-			pbs->frameNum = 34 + FRAMES_JOE_XTRA;
-			_graphics->update();
-		}
-		pbs->frameNum = frame + FRAMES_JOE_XTRA;
-		pbs->scale = _logic->joeScale();
-		pbs->xflip = (_logic->joeFacing() == DIR_LEFT);
-		_graphics->update();
-		_joePrevFacing = _logic->joeFacing();
-		switch (frame) {
-		case 33: frame = 1; break;
-		case 34: frame = 3; break;
-		case 35: frame = 5; break;
-		}
-	}
-	pbs->frameNum = 29 + FRAMES_JOE_XTRA;
-	_graphics->bankUnpack(frame, pbs->frameNum, 7);
-	return frame;
-}
-
-
 void Walk::joeMoveBlock(int facing) {
 	warning("Walk::moveJoeBlock() partially implemented");
 	_graphics->bob(0)->animating = false;
 //    CAN=-2;
     // Make Joe face the right direction
 	_logic->joeFacing(facing);
-	joeFace();
+	_logic->joeFace();
 
 	// TODO: cutaway calls
 }
@@ -164,7 +118,7 @@
 	BobSlot *pbs = _graphics->bob(0);
 	_logic->joeFacing(_walkData[1].anim.facing);
 	_logic->joeScale(_walkData[1].area->calcScale(pbs->y));
-	joeFace();
+	_logic->joeFace();
 	bool interrupted = false;
 	for (i = 1; i <= _walkDataCount && !interrupted; ++i) {
 
@@ -345,107 +299,6 @@
 }
 
 
-void Walk::joeSetup() {
-	int i;
-
-	_graphics->bankLoad("joe_a.BBK", 13);
-	for (i = 11; i <= 28 + FRAMES_JOE_XTRA; ++i) {
-		_graphics->bankUnpack(i - 10, i, 13);
-	}
-	_graphics->bankErase(13);
-
-	_graphics->bankLoad("joe_b.BBK", 7);
-	_graphics->bankUnpack(1, 33 + FRAMES_JOE_XTRA, 7);
-	_graphics->bankUnpack(3, 34 + FRAMES_JOE_XTRA, 7);
-	_graphics->bankUnpack(5, 35 + FRAMES_JOE_XTRA, 7);
-
-	_logic->joeFacing(DIR_FRONT);
-}
-
-
-ObjectData *Walk::joeSetupInRoom(bool autoPosition, uint16 scale) {
-	// queen.c SETUP_HERO()
-
-	uint16 oldx;
-	uint16 oldy;
-	WalkOffData *pwo = NULL;
-	ObjectData *pod = _logic->objectData(_logic->entryObj());
-	if (pod == NULL) {
-		error("Walk::joeSetupInRoom() - No object data for obj %d", _logic->entryObj());
-	}
-
-	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(_logic->entryObj());
-		if (pwo != NULL) {
-			oldx = pwo->x;
-			oldy = pwo->y;
-		}
-		else {
-			// no walk off point, use object position
-			oldx = pod->x;
-			oldy = pod->y;
-		}
-	}
-
-	debug(9, "Walk::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy);
-
-	if (scale > 0 && scale < 100) {
-		_logic->joeScale(scale);
-	}
-	else {
-		uint16 area = _logic->zoneInArea(ZONE_ROOM, oldx, oldy);
-		if (area > 0) {
-			_logic->joeScale(_logic->currentRoomArea(area)->calcScale(oldy));
-		}
-		else {
-			_logic->joeScale(100);
-		}
-	}
-
-	// TODO: cutawayJoeFacing
-
-    // check to see which way Joe entered room
-	switch (_logic->findStateDirection(pod->state)) {
-	case STATE_DIR_FRONT:
-		_logic->joeFacing(DIR_FRONT);
-		break;
-	case STATE_DIR_BACK:
-		_logic->joeFacing(DIR_BACK);
-		break;
-	case STATE_DIR_LEFT:
-		_logic->joeFacing(DIR_LEFT);
-		break;
-	case STATE_DIR_RIGHT:
-		_logic->joeFacing(DIR_RIGHT);
-		break;
-	}
-
-	_joePrevFacing = _logic->joeFacing();
-	BobSlot *pbs = _graphics->bob(0);
-	pbs->scale = _logic->joeScale();
-
-	// TODO: room 108 specific
-
-	joeFace();
-	pbs->active = true;
-	pbs->x = oldx;
-	pbs->y = oldy;
-	pbs->frameNum = 29 + FRAMES_JOE_XTRA;
-	_logic->joeX(0);
-	_logic->joeY(0);
-
-	if (pwo != NULL) {
-		// entryObj has a walk off point, then walk from there to object x,y
-		return pod;
-	}
-	return NULL;
-}
 
 
 void Walk::joeMove(int direction, uint16 endx, uint16 endy, bool inCutaway) {
@@ -483,13 +336,15 @@
 	if (direction > 0) {
 		_logic->joeFacing(direction);
 	}
-	_joePrevFacing = _logic->joeFacing();
-	joeFace();
+	_logic->joePrevFacing(_logic->joeFacing());
+	_logic->joeFace();
 }
 
 
 
 void Walk::personMove(const Person *pp, uint16 endx, uint16 endy, uint16 curImage, int direction) {
+
+	// TODO: room 69 specific
 
 	// CAN = 0;
 	initWalkData();

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- logic.h	14 Oct 2003 12:55:31 -0000	1.28
+++ logic.h	14 Oct 2003 19:06:44 -0000	1.29
@@ -79,12 +79,14 @@
 	uint16 joeY()		{ return _joe.y; }
 	uint16 joeWalk()	{ return _joe.walk; }
 	uint16 joeScale()	{ return _joe.scale; }
+	uint16 joePrevFacing() { return _joe.prevFacing; }
 
 	void joeFacing(uint16 dir);
 	void joeX(uint16 x);
 	void joeY(uint16 y);
 	void joeWalk(uint16 walk);
 	void joeScale(uint16 scale);
+	void joePrevFacing(uint16 dir);
 	
 	int16 gameState(int index);
 	void gameState(int index, int16 newValue);
@@ -124,6 +126,15 @@
 
 	StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR");
 
+	//! SETUP_JOE(), loads the various bobs needed to animate Joe
+	void joeSetup();
+
+	//! SETUP_HERO(), places Joe at the right place when entering a room
+	ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale);
+	
+	//! FACE_JOE()
+	uint16 joeFace();
+
 
 protected:
 	bool _textToggle;
@@ -191,7 +202,7 @@
 
 	struct {
 		uint16	x, y;
-		uint16	facing;
+		uint16	facing, prevFacing;
 		uint16  walk;
 		uint16  scale;
 	} _joe;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- logic.cpp	14 Oct 2003 12:55:31 -0000	1.38
+++ logic.cpp	14 Oct 2003 19:06:44 -0000	1.39
@@ -295,7 +295,7 @@
 
 	_graphics->panelLoad();
 	_graphics->bobSetupControl();
-	_walk->joeSetup();
+	joeSetup();
 	zoneSetupPanel();
 
 	memset(_zones, 0, sizeof(_zones));
@@ -581,6 +581,10 @@
 	_joe.scale = scale;
 }
 
+void Logic::joePrevFacing(uint16 dir) {
+	_joe.prevFacing = dir;
+}
+
 int16 Logic::gameState(int index) {
 	if (index >= 0 && index < GAME_STATE_COUNT)
 		return _gameState[index];
@@ -949,7 +953,7 @@
 	zoneSetup();
 	ObjectData *pod = NULL;
 	if (mode != RDM_FADE_NOJOE) {
-		pod = _walk->joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale);
+		pod = joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale);
 	}
 	if (mode != RDM_NOFADE_JOE) {
 		_graphics->update();
@@ -1216,6 +1220,156 @@
 	}
 	return sd;
 }
+
+
+void Logic::joeSetup() {
+	int i;
+
+	_graphics->bankLoad("joe_a.BBK", 13);
+	for (i = 11; i <= 28 + FRAMES_JOE_XTRA; ++i) {
+		_graphics->bankUnpack(i - 10, i, 13);
+	}
+	_graphics->bankErase(13);
+
+	_graphics->bankLoad("joe_b.BBK", 7);
+	_graphics->bankUnpack(1, 33 + FRAMES_JOE_XTRA, 7);
+	_graphics->bankUnpack(3, 34 + FRAMES_JOE_XTRA, 7);
+	_graphics->bankUnpack(5, 35 + FRAMES_JOE_XTRA, 7);
+
+	_joe.facing = DIR_FRONT;
+}
+
+
+ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) {
+	// queen.c SETUP_HERO()
+
+	uint16 oldx;
+	uint16 oldy;
+	WalkOffData *pwo = NULL;
+	ObjectData *pod = &_objectData[_entryObj];
+	if (pod == NULL) {
+		error("Logic::joeSetupInRoom() - No object data for obj %d", _entryObj);
+	}
+
+	if (!autoPosition || _joe.x != 0 || _joe.y != 0) {
+		oldx = _joe.x;
+		oldy = _joe.y;
+	}
+	else {
+		// find the walk off point for the entry object and make 
+		// Joe walking to that point
+		pwo = walkOffPointForObject(_entryObj);
+		if (pwo != NULL) {
+			oldx = pwo->x;
+			oldy = pwo->y;
+		}
+		else {
+			// no walk off point, use object position
+			oldx = pod->x;
+			oldy = pod->y;
+		}
+	}
+
+	debug(9, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy);
+
+	if (scale > 0 && scale < 100) {
+		_joe.scale = scale;
+	}
+	else {
+		uint16 a = zoneInArea(ZONE_ROOM, oldx, oldy);
+		if (a > 0) {
+			_joe.scale = currentRoomArea(a)->calcScale(oldy);
+		}
+		else {
+			_joe.scale = 100;
+		}
+	}
+
+	// TODO: cutawayJoeFacing
+
+    // check to see which way Joe entered room
+	switch (findStateDirection(pod->state)) {
+	case STATE_DIR_FRONT:
+		_joe.facing = DIR_FRONT;
+		break;
+	case STATE_DIR_BACK:
+		_joe.facing = DIR_BACK;
+		break;
+	case STATE_DIR_LEFT:
+		_joe.facing = DIR_LEFT;
+		break;
+	case STATE_DIR_RIGHT:
+		_joe.facing = DIR_RIGHT;
+		break;
+	}
+
+	_joe.prevFacing = _joe.facing;
+	BobSlot *pbs = _graphics->bob(0);
+	pbs->scale = _joe.scale;
+
+	// TODO: room 108 specific
+
+	joeFace();
+	pbs->active = true;
+	pbs->x = oldx;
+	pbs->y = oldy;
+	pbs->frameNum = 29 + FRAMES_JOE_XTRA;
+	_joe.x = 0;
+	_joe.y = 0;
+
+	if (pwo != NULL) {
+		// entryObj has a walk off point, then walk from there to object x,y
+		return pod;
+	}
+	return NULL;
+}
+
+
+uint16 Logic::joeFace() {
+
+	debug(9, "Logic::joeFace() - curFace = %d, prevFace = %d", _joe.facing, _joe.prevFacing);
+	BobSlot *pbs = _graphics->bob(0);
+	uint16 frame;
+	if (_currentRoom == 108) {
+		frame = 1;
+	}
+	else {
+		frame = 33;
+		if (_joe.facing == DIR_FRONT) {
+			if (_joe.prevFacing == DIR_BACK) {
+				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
+				_graphics->update();
+			}
+			frame = 34;
+		}
+		else if (_joe.facing == DIR_BACK) {
+			if (_joe.prevFacing == DIR_FRONT) {
+				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
+				_graphics->update();
+			}
+			frame = 35;
+		}
+		else if ((_joe.facing == DIR_LEFT && _joe.prevFacing == DIR_RIGHT) 
+			|| 	(_joe.facing == DIR_RIGHT && _joe.prevFacing == DIR_LEFT)) {
+			pbs->frameNum = 34 + FRAMES_JOE_XTRA;
+			_graphics->update();
+		}
+		pbs->frameNum = frame + FRAMES_JOE_XTRA;
+		pbs->scale = _joe.scale;
+		pbs->xflip = (_joe.facing == DIR_LEFT);
+		_graphics->update();
+		_joe.prevFacing = _joe.facing;
+		switch (frame) {
+		case 33: frame = 1; break;
+		case 34: frame = 3; break;
+		case 35: frame = 5; break;
+		}
+	}
+	pbs->frameNum = 29 + FRAMES_JOE_XTRA;
+	_graphics->bankUnpack(frame, pbs->frameNum, 7);
+	return frame;
+}
+
 
 
 } // End of namespace Queen

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cutaway.cpp	14 Oct 2003 12:37:06 -0000	1.19
+++ cutaway.cpp	14 Oct 2003 19:06:44 -0000	1.20
@@ -966,7 +966,7 @@
 		joeBob->x = joeX;
 		joeBob->y = joeY;
 		joeBob->scale = _logic->findScale(joeX, joeY);
-		_walk->joeFace();
+		_logic->joeFace();
 	}
 }
 

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xref.txt	14 Oct 2003 09:12:42 -0000	1.2
+++ xref.txt	14 Oct 2003 19:06:44 -0000	1.3
@@ -126,7 +126,7 @@
 SETUP_BOBS()				Graphics::bobSetupControl
 SETUP_FURNITURE()			Logic::roomSetupFurniture
 SETUP_ITEMS()
-SETUP_JOE()					Walk::joeSetup
+SETUP_JOE()					Logic::joeSetup
 SETUP_ROOM()
 SETUP_SCRVARS()
 update() 					Graphics::update
@@ -269,7 +269,7 @@
 CALC_X()					Walk::calcC
 CALC_Y()					Walk::calcC
 CALCSCALE()					Area::calcScale
-FACE_JOE()					Walk::joeFace
+FACE_JOE()					Logic::joeFace
 FIND_FREE_AREA				Walk::findFreeArea
 FIND_NEWP()					Walk::findAreaPosition
 FIND_OLDP()					Walk::findAreaPosition





More information about the Scummvm-git-logs mailing list