[Scummvm-cvs-logs] CVS: scummvm/queen bankman.cpp,1.3,1.4 command.cpp,1.60,1.61 cutaway.cpp,1.113,1.114 display.cpp,1.55,1.56 graphics.cpp,1.83,1.84 logic.cpp,1.174,1.175 logic.h,1.113,1.114 talk.cpp,1.81,1.82 walk.cpp,1.39,1.40 walk.h,1.22,1.23

Gregory Montoir cyx at users.sourceforge.net
Wed Jan 14 06:35:02 CET 2004


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

Modified Files:
	bankman.cpp command.cpp cutaway.cpp display.cpp graphics.cpp 
	logic.cpp logic.h talk.cpp walk.cpp walk.h 
Log Message:
- tweaked a bit walking functions to make persons stop walking when a cutaway is canceled
- removed unpack to bob frame 2 (as it is never used)
- changed some error() calls to assert()
- minor cleanups


Index: bankman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/bankman.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bankman.cpp	11 Jan 2004 14:11:36 -0000	1.3
+++ bankman.cpp	14 Jan 2004 14:34:04 -0000	1.4
@@ -103,14 +103,15 @@
 
 BobFrame *BankManager::fetchFrame(uint32 index) {
 	debug(9, "BankManager::fetchFrame(%d)", index);
-	if (index >= MAX_FRAMES_NUMBER) {
-		error("BankManager::fetchFrame() invalid frame index = %d", index);
-	}
-	return &_frames[index];
+	assert(index < MAX_FRAMES_NUMBER);
+	BobFrame *pbf = &_frames[index];
+	assert(pbf->data != 0);
+	return pbf;
 }
 
 void BankManager::eraseFrame(uint32 index) {
 	debug(9, "BankManager::eraseFrame(%d)", index);
+	assert(index < MAX_FRAMES_NUMBER);
 	BobFrame *pbf = &_frames[index];
 	delete[] pbf->data;
 	memset(pbf, 0, sizeof(BobFrame));

Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- command.cpp	14 Jan 2004 10:40:25 -0000	1.60
+++ command.cpp	14 Jan 2004 14:34:04 -0000	1.61
@@ -455,8 +455,7 @@
 	if (mustWalk) {
 		// determine which way for Joe to face Object
 		uint16 facing = State::findDirection(objData->state);
-
-		BobSlot *bobJoe  = _vm->graphics()->bob(0);
+		BobSlot *bobJoe = _vm->graphics()->bob(0);
 		if (x == bobJoe->x && y == bobJoe->y) {
 			_vm->logic()->joeFacing(facing);
 			_vm->logic()->joeFace();

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- cutaway.cpp	13 Jan 2004 14:43:13 -0000	1.113
+++ cutaway.cpp	14 Jan 2004 14:34:04 -0000	1.114
@@ -77,9 +77,6 @@
 	debug(6, "----- Cutaway::load(\"%s\") -----", filename);
 
 	ptr = _fileData = _vm->resource()->loadFile(filename, 20);
-	if (!_fileData) {
-		error("Failed to load resource data file '%s'", filename);
-	}
 
 	if (0 == scumm_stricmp(filename, "comic.cut"))
 		/* XXX _songBeforeComic = CURRSONG */; 
@@ -956,7 +953,7 @@
 		if (_roomFade) {
 			_vm->update();
 			int end = 223;
-			if (_vm->logic()->isIntroRoom(_vm->logic()->currentRoom())) {
+			if (Logic::isIntroRoom(_vm->logic()->currentRoom())) {
 				end = 255;
 			}
 			BobSlot *j = _vm->graphics()->bob(0);

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- display.cpp	13 Jan 2004 14:43:13 -0000	1.55
+++ display.cpp	14 Jan 2004 14:34:04 -0000	1.56
@@ -79,7 +79,7 @@
 	_dynalum.valid = false;
 	_dynalum.prevColMask = 0xFF;
 
-	if (!(_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum))) {
+	if (!(Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum))) {
 		char filename[20];
 
 		sprintf(filename, "%s.msk", roomName);
@@ -177,7 +177,7 @@
 void Display::palFadeIn(int start, int end, uint16 roomNum, bool dynalum, int16 dynaX, int16 dynaY) {
 	debug(9, "Display::palFadeIn(%d, %d)", start, end);
 	memcpy(_pal.screen, _pal.room, 256 * 3);
-	if (!(_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum))) {
+	if (!(Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum))) {
 		if (dynalum) {
 			dynalumUpdate(dynaX, dynaY);
 		}
@@ -205,7 +205,7 @@
 	debug(9, "Display::palFadeOut(%d, %d)", start, end);
 	_pal.scrollable = false;
 	int n = end - start + 1;
-	if (_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum)) {
+	if (Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum)) {
 		memset(_pal.screen + start * 3, 0, n * 3);
 		palSet(_pal.screen, start, end, true);
 	} else {
@@ -638,7 +638,7 @@
 	_bdWidth  = READ_LE_UINT16(pcxBuf + 12);
 	_bdHeight = READ_LE_UINT16(pcxBuf + 14);
 	readPCX(_backdropBuf, BACKDROP_W, pcxBuf + 128, _bdWidth, _bdHeight);
-	memcpy(_pal.room, pcxBuf + size - 768, _vm->logic()->isIntroRoom(room) ? 256 * 3 : 144 * 3);
+	memcpy(_pal.room, pcxBuf + size - 768, Logic::isIntroRoom(room) ? 256 * 3 : 144 * 3);
 	delete[] pcxBuf;
 
 	palCustomColors(room);

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- graphics.cpp	12 Jan 2004 13:40:01 -0000	1.83
+++ graphics.cpp	14 Jan 2004 14:34:04 -0000	1.84
@@ -407,12 +407,8 @@
 }
 
 BobSlot *Graphics::bob(int index) {
-	if (index < MAX_BOBS_NUMBER)
-		return _bobs + index;
-	else {
-		error("QueenGraphics::bob called with index = %i but MAX_BOBS_NUMBER = %i", 
-				index, MAX_BOBS_NUMBER);
-	}
+	assert(index < MAX_BOBS_NUMBER);
+	return _bobs + index;
 }
 
 void Graphics::setBobText(
@@ -846,7 +842,6 @@
 		curImage += pgd->lastFrame - 1;
 	} else if (lastFrame != 0) {
 		// turn on an animated bob
-		_vm->bankMan()->unpack(pgd->firstFrame, 2, 15);
 		pbs->animating = false;
 		uint16 firstImage = curImage;
 		--curImage;
@@ -861,8 +856,6 @@
 			pbs->animNormal(firstImage, curImage, pgd->speed / 4, rebound, false);
 		}
 	} else {
-		// frame 2 is used as a buffer frame to prevent BOB flickering
-		_vm->bankMan()->unpack(pgd->firstFrame, 2, 15);
 		_vm->bankMan()->unpack(pgd->firstFrame, curImage, 15);
 		pbs->curPos(pgd->x, pgd->y);
 		pbs->frameNum = curImage;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- logic.cpp	12 Jan 2004 13:40:01 -0000	1.174
+++ logic.cpp	14 Jan 2004 14:34:04 -0000	1.175
@@ -41,7 +41,6 @@
 #include "queen/talk.h"
 #include "queen/walk.h"
 
-
 namespace Queen {
 
 Logic::Logic(QueenEngine *vm)
@@ -250,27 +249,18 @@
 	_oldRoom = 0;
 }
 
-
 ObjectData* Logic::objectData(int index) const {
-	if (index >= 0 && index <= _numObjects)
-		return &_objectData[index];
-	else
-		error("[Logic::objectData] Invalid object data index: %i", index);
+	assert(index >= 0 && index <= _numObjects);
+	return &_objectData[index];
 }
 
-
 uint16 Logic::findBob(uint16 obj) {	
-	uint16 bobnum = 0;
-
-	if (obj > _numObjects)
-		error("Object index (%i) > _numObjects (%i)", obj, _numObjects);
+	assert(obj <= _numObjects);
 
 	uint16 room = _objectData[obj].room;
+	assert(room <= _numRooms);
 
-	if (room >= _numRooms) {
-		warning("room (%i) > _numRooms (%i)", room, _numRooms);
-	}
-
+	uint16 bobnum = 0;
 	int16 img = _objectData[obj].image;
 	if(img != 0) {
 		if(img == -3 || img == -4) {
@@ -339,7 +329,6 @@
 	return bobnum;
 }
 
-
 uint16 Logic::findFrame(uint16 obj) {
 	uint16 i;
 	uint16 framenum = 0;
@@ -402,7 +391,6 @@
 	return framenum;
 }
 
-
 uint16 Logic::objectForPerson(uint16 bobNum) const {
 	uint16 bobcur = 0;
 	// first object number in the room
@@ -423,7 +411,6 @@
 	return 0;
 }
 
-
 WalkOffData *Logic::walkOffPointForObject(uint16 obj) const {
 	uint16 i;
 	for (i = 1; i <= _numWalkOffs; ++i) {
@@ -434,30 +421,27 @@
 	return NULL;
 }
 
-
 void Logic::joeWalk(JoeWalkMode walking) {
 	_joe.walk = walking;
 	// Do this so that Input doesn't need to know the walk value
 	_vm->input()->dialogueRunning(JWM_SPEAK == walking);
 }
 
-
 int16 Logic::gameState(int index) const {
-	if (index >= 0 && index < GAME_STATE_COUNT)
-		return _gameState[index];
-	else
-		error("[QueenLogic::gameState] invalid index: %i", index);
+	assert(index >= 0 && index < GAME_STATE_COUNT);
+	return _gameState[index];
 }
 
 void Logic::gameState(int index, int16 newValue) {
-	if (index >= 0 && index < GAME_STATE_COUNT) {
-//		debug(6, "Logic::gameState() - GAMESTATE[%d] = %d", index, newValue);
-		_gameState[index] = newValue;
-	}
-	else
-		error("[QueenLogic::gameState] invalid index: %i", index);
+	assert(index >= 0 && index < GAME_STATE_COUNT);
+	debug(8, "Logic::gameState() [%d] = %d", index, newValue);
+	_gameState[index] = newValue;
 }
 
+const char *Logic::roomName(uint16 roomNum) const { 
+	assert(roomNum >= 1 && roomNum <= _numRooms);
+	return _roomName[roomNum];
+}
 
 void Logic::eraseRoom() {
 	_vm->bankMan()->eraseFrames(false);
@@ -496,7 +480,6 @@
 	}
 }
 
-
 void Logic::setupRoom(const char *room, int comPanel, bool inCutaway) {
 	// load backdrop image, init dynalum, setup colors
 	_vm->display()->setupNewRoom(room, _currentRoom);
@@ -517,10 +500,8 @@
 	_vm->graphics()->setupNewRoom(room, _currentRoom, furn, furnTot);
 
 	_vm->display()->forceFullRefresh();
-
 }
 
-
 void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) {
 	debug(6, "Logic::displayRoom(%d, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway);
 
@@ -545,7 +526,6 @@
 	}
 }
 
-
 ActorData *Logic::findActor(uint16 noun, const char *name) {
 	uint16 obj = currentRoomData() + noun;
 	int16 img = objectData(obj)->image;
@@ -572,7 +552,6 @@
 	return NULL;
 }
 
-
 bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person *pp) {
 	ActorData *pad = findActor(noun, actorName);
 	if (pad != NULL) {
@@ -593,7 +572,6 @@
 	return pad != NULL;
 }
 
-
 uint16 Logic::findPersonNumber(uint16 obj) const {
 	uint16 num = 0;
 	uint16 i;
@@ -606,7 +584,6 @@
 	return num;
 }
 
-
 void Logic::loadJoeBanks(const char *animBank, const char *standBank) {
 	int i;
 	_vm->bankMan()->load(animBank, 13);
@@ -621,14 +598,12 @@
 	_vm->bankMan()->unpack(5, 35 + FRAMES_JOE_XTRA, 7);
 }
 
-
 void Logic::setupJoe() {
 	loadJoeBanks("joe_a.BBK", "joe_b.BBK");
 	joePrevFacing(DIR_FRONT);
 	joeFacing(DIR_FRONT);
 }
 
-
 ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
 	debug(9, "Logic::setupJoeInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y);
 	WalkOffData *pwo = NULL;
@@ -717,7 +692,6 @@
 	return NULL;
 }
 
-
 uint16 Logic::joeFace() {
 	debug(9, "Logic::joeFace() - curFace = %d, prevFace = %d", _joe.facing, _joe.prevFacing);
 	BobSlot *pbs = _vm->graphics()->bob(0);
@@ -765,7 +739,6 @@
 	return frame;
 }
 
-
 void Logic::joeGrab(int16 grabState) {
 	uint16 frame = 0;
 	BobSlot *bobJoe = _vm->graphics()->bob(0);
@@ -822,7 +795,6 @@
 	}
 }
 
-
 void Logic::joeUseDress(bool showCut) {
 	if (showCut) {
 		joeFacing(DIR_FRONT);
@@ -840,7 +812,6 @@
 	gameState(VAR_DRESSING_MODE, 2);
 }
 
-
 void Logic::joeUseClothes(bool showCut) {
 	if (showCut) {
 		joeFacing(DIR_FRONT);
@@ -854,20 +825,17 @@
 	gameState(VAR_DRESSING_MODE, 0);
 }
 
-
 void Logic::joeUseUnderwear() {
 	_vm->display()->palSetJoeNormal();
 	loadJoeBanks("JoeU_A.BBK", "JoeU_B.BBK");
 	gameState(VAR_DRESSING_MODE, 1);
 }
 
-
 void Logic::makePersonSpeak(const char *sentence, Person *person, const char *voiceFilePrefix) {
 	_vm->command()->clear(false);
 	Talk::speak(sentence, person, voiceFilePrefix, _vm);
 }
 
-
 void Logic::startDialogue(const char *dlgFile, int personInRoom, char *cutaway) {
 	char cutawayFile[20];
 	if (cutaway == NULL) {
@@ -880,7 +848,6 @@
 	}
 }
 
-
 void Logic::playCutaway(const char *cutFile, char *next) {
 	char nextFile[20];
 	if (next == NULL) {
@@ -890,7 +857,6 @@
 	Cutaway::run(cutFile, next, _vm);
 }
 
-
 void Logic::makeJoeSpeak(uint16 descNum, bool objectType) {
 	// makeJoeSpeak(k, false) == SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k)) 
 	// makeJoeSpeak(k, true)  == SPEAK(OBJECT_DESCRstr[k],"JOE",find_cd_desc(JOERESPMAX+k))
@@ -903,7 +869,6 @@
 	makePersonSpeak(text, NULL, descFilePrefix);
 }
 
-
 uint16 Logic::findInventoryItem(int invSlot) const {
 	// queen.c l.3894-3898
 	if (invSlot >= 0 && invSlot < 4) {
@@ -912,7 +877,6 @@
 	return 0;
 }
 
-
 void Logic::inventorySetup() {
 	_vm->bankMan()->load("objects.BBK", 14);
 	if (_vm->resource()->isInterview()) {
@@ -1003,7 +967,6 @@
 		inventoryRefresh();
 }
 
-
 void Logic::inventoryDeleteItem(uint16 itemNum, bool refresh) {
 	int16 item = (int16)itemNum;
 	_itemData[itemNum].name = -ABS(_itemData[itemNum].name);	//set invisible
@@ -1017,7 +980,6 @@
 		inventoryRefresh();
 }
 
-
 void Logic::inventoryScroll(uint16 count, bool up) {
 	if (!(numItemsInventory() > 4))
 		return;
@@ -1036,7 +998,6 @@
 	inventoryRefresh();
 }
 
-
 void Logic::removeHotelItemsFromInventory() {
 	if (currentRoom() == 1 && gameState(3) == 0) {
 		inventoryDeleteItem(ITEM_CROWBAR, false);
@@ -1050,7 +1011,6 @@
 	}
 }
 
-
 void Logic::objectCopy(int dummyObjectIndex, int realObjectIndex) {
 	// P3_COPY_FROM function in cutaway.c
 	/* Copy data from Dummy (D) object to object (K)
@@ -1109,7 +1069,6 @@
 	}
 }
 
-
 void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataNum) {
 	// queen.c l.2838-2911
 	debug(9, "handleSpecialArea(%d, %d, %d)\n", facing, areaNum, walkDataNum);
@@ -1224,7 +1183,6 @@
 	}
 }
 
-
 void Logic::handlePinnacleRoom() {
 	// camera does not follow Joe anymore
 	_vm->graphics()->putCameraOnBob(-1);
@@ -1324,7 +1282,6 @@
 	_vm->display()->palFadeOut(0, 223, ROOM_JUNGLE_PINNACLE);
 }
 
-
 void Logic::update() {
 	if (_credits)
 		_credits->update();
@@ -1334,7 +1291,6 @@
 	}
 }
 
-
 void Logic::saveState(byte *&ptr) {
 	uint16 i;
 	for (i = 0; i < 4; i++) {
@@ -1370,7 +1326,6 @@
 		_objectDescription[i].writeToBE(ptr);
 }
 
-
 void Logic::loadState(uint32 ver, byte *&ptr) {
 	uint16 i;
 	for (i = 0; i < 4; i++) {
@@ -1440,7 +1395,6 @@
 	inventoryRefresh();
 }
 
-
 void Logic::sceneStart() {
 	debug(6, "[Logic::sceneStart] _scene = %i", _scene);
 	_scene++;
@@ -1466,66 +1420,55 @@
 	_vm->grid()->setupPanel();
 }
 
-
 void Logic::changeRoom() {
 	if (!preChangeRoom()) 
 		displayRoom(currentRoom(), RDM_FADE_JOE, 100, 1, false);
 	_vm->display()->showMouseCursor(true);
 }
 
-
 void Logic::executeSpecialMove(uint16 sm) {
 	debug(6, "Special move: %d", sm);
 	if (!handleSpecialMove(sm))
 		warning("unhandled / invalid special move : %d", sm);
 }
 
-
 void Logic::asmMakeJoeUseDress() {
 	joeUseDress(false);
 }
 
-
 void Logic::asmMakeJoeUseNormalClothes() {
 	joeUseClothes(false);
 }
 
-
 void Logic::asmMakeJoeUseUnderwear() {
 	joeUseUnderwear();
 }
 
-
 void Logic::asmSwitchToDressPalette() {
 	_vm->display()->palSetJoeDress();
 }
 
-
 void Logic::asmSwitchToNormalPalette() {
 	_vm->display()->palSetJoeNormal();
 }
 
-
 void Logic::asmStartCarAnimation() {
 	_vm->bam()->_flag = BamScene::F_PLAY;
 	_vm->bam()->prepareAnimation();
 }
 
-
 void Logic::asmStopCarAnimation() {
 	_vm->bam()->_flag = BamScene::F_STOP;
 	_vm->graphics()->bob(findBob(594))->active = false; // oil object
 	_vm->graphics()->bob(7)->active = false; // gun shots
 }
 
-
 void Logic::asmStartFightAnimation() {
 	_vm->bam()->_flag = BamScene::F_PLAY;
 	_vm->bam()->prepareAnimation();
 	gameState(148, 1);
 }
 
-
 void Logic::asmWaitForFrankPosition() {	
 	_vm->bam()->_flag = BamScene::F_REQ_STOP;
 	while (_vm->bam()->_flag != BamScene::F_STOP) {
@@ -1533,7 +1476,6 @@
 	}
 }
 
-
 void Logic::asmMakeFrankGrowing() {
 	_vm->bankMan()->unpack(1, 38, 15);
 	BobSlot *bobFrank = _vm->graphics()->bob(5);
@@ -1558,7 +1500,6 @@
 	gameState(157, 1); // No more Ironstein
 }
 
-
 void Logic::asmMakeRobotGrowing() { 	
 	_vm->bankMan()->unpack(1, 38, 15);
 	BobSlot *bobRobot = _vm->graphics()->bob(5);
@@ -1579,7 +1520,6 @@
 	objectData(526)->name = -ABS(objectData(526)->name); // Frank object off
 }
 
-
 void Logic::asmShrinkRobot() {
 	int i;
 	BobSlot *robot = _vm->graphics()->bob(6);
@@ -1589,7 +1529,6 @@
 	}
 }
 
-
 void Logic::asmEndGame() {
 	int i;
 	for (i = 0; i < 40; ++i) {
@@ -1599,7 +1538,6 @@
 	OSystem::instance()->quit();
 }
 
-
 void Logic::asmPutCameraOnDino() {
 	_vm->graphics()->putCameraOnBob(-1);
 	int16 scrollx = _vm->display()->horizontalScroll();
@@ -1614,12 +1552,10 @@
 	_vm->graphics()->putCameraOnBob(1);
 }
 
-
 void Logic::asmPutCameraOnJoe() {
 	_vm->graphics()->putCameraOnBob(0);
 }
 
-
 void Logic::asmAltIntroPanRight() {
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
@@ -1636,7 +1572,6 @@
 	_vm->input()->fastMode(false);
 }
 
-
 void Logic::asmAltIntroPanLeft() {
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
@@ -1652,12 +1587,10 @@
 	_vm->input()->fastMode(false);
 }
 
-
 void Logic::asmSetAzuraInLove() {
 	gameState(VAR_AZURA_IN_LOVE, 1);
 }
 
-
 void Logic::asmPanRightFromJoe() {
 	_vm->graphics()->putCameraOnBob(-1);
 	int16 scrollx = _vm->display()->horizontalScroll();
@@ -1671,23 +1604,19 @@
 	}
 }
 
-
 void Logic::asmSetLightsOff() {
 	_vm->display()->palCustomLightsOff(currentRoom());
 }
 
-
 void Logic::asmSetLightsOn() {
 	_vm->display()->palCustomLightsOn(currentRoom());
 }
 
-
 void Logic::asmSetManequinAreaOn() {
 	Area *a = _vm->grid()->area(ROOM_FLODA_FRONTDESK, 7);
 	a->mapNeighbours = ABS(a->mapNeighbours);
 }
 
-
 void Logic::asmPanToJoe() {
 	int i = _vm->graphics()->bob(0)->x - 160;
 	if (i < 0) {
@@ -1720,12 +1649,10 @@
 	_vm->graphics()->putCameraOnBob(0);
 }
 
-
 void Logic::asmTurnGuardOn() {
 	gameState(85, 1);
 }
 
-
 void Logic::asmPanLeft320To144() {
 	_vm->graphics()->putCameraOnBob(-1);
 	int16 scrollx = _vm->display()->horizontalScroll();
@@ -1739,7 +1666,6 @@
 	}
 }
 
-
 void Logic::asmSmooch() {
 	_vm->graphics()->putCameraOnBob(-1);
 	BobSlot *bobAzura = _vm->graphics()->bob(5);
@@ -1759,7 +1685,6 @@
 	}
 }
 
-
 void Logic::asmMakeLightningHitPlane() {
 	_vm->graphics()->putCameraOnBob(-1);
 	short iy = 0, x, ydir = -1, j, k;
@@ -1840,7 +1765,6 @@
 	_vm->graphics()->putCameraOnBob(0);
 }
 
-
 void Logic::asmScaleBlimp() {
 	int16 z = 256;
 	BobSlot *bob = _vm->graphics()->bob(7);
@@ -1860,7 +1784,6 @@
 	}
 }
 
-
 void Logic::asmScaleEnding() {
 	_vm->graphics()->bob(7)->active = false; // Turn off blimp
 	BobSlot *b = _vm->graphics()->bob(20);
@@ -1877,7 +1800,6 @@
 	_vm->display()->palFadeOut(0, 255, currentRoom());
 }
 
-
 void Logic::asmWaitForCarPosition() {
 	// Wait for car to reach correct position before pouring oil
 	while (_vm->bam()->_index != 60) {
@@ -1885,7 +1807,6 @@
 	}
 }
 
-
 void Logic::asmShakeScreen() {
 	_vm->display()->shake(false);
 	_vm->update();
@@ -1893,7 +1814,6 @@
 	_vm->update();
 }
 
-
 void Logic::asmAttemptPuzzle() {
 	++_puzzleAttemptCount;
 	if (_puzzleAttemptCount & 4) {
@@ -1902,7 +1822,6 @@
 	}
 }
 
-
 void Logic::asmScaleTitle() {
 	BobSlot *bob = _vm->graphics()->bob(5);
 	bob->animating = false;
@@ -1918,7 +1837,6 @@
 	}
 }
 
-
 void Logic::asmPanRightToHugh() {
 	BobSlot *bob_thugA1 = _vm->graphics()->bob(20);
 	BobSlot *bob_thugA2 = _vm->graphics()->bob(21);
@@ -1980,12 +1898,10 @@
 	_vm->input()->fastMode(false);
 }
 
-
 void Logic::asmMakeWhiteFlash() {
 	_vm->display()->palCustomFlash();
 }
 
-
 void Logic::asmPanRightToJoeAndRita() { // cdint.cut
 	BobSlot *bob_box   = _vm->graphics()->bob(20);
 	BobSlot *bob_beam  = _vm->graphics()->bob(21);
@@ -2024,7 +1940,6 @@
 	_vm->input()->fastMode(false);
 }
 
-
 void Logic::asmPanLeftToBomb() {
 	BobSlot *bob21 = _vm->graphics()->bob(21);
 	BobSlot *bob22 = _vm->graphics()->bob(22);
@@ -2054,13 +1969,11 @@
 	_vm->input()->fastMode(false);
 }
 
-
 void Logic::asmEndDemo() {
 	debug(0, "Flight of the Amazon Queen, released January 95.");
 	OSystem::instance()->quit();
 }
 
-
 void Logic::asmInterviewIntro() {
 	// put camera on airship
 	_vm->graphics()->putCameraOnBob(5);
@@ -2101,7 +2014,6 @@
 	_vm->graphics()->putCameraOnBob(0);
 }
 
-
 void Logic::asmEndInterview() {
 	debug(0, "Interactive Interview copyright (c) 1995, IBI.");
 	OSystem::instance()->quit();
@@ -2120,7 +2032,6 @@
 	}
 }
 
-
 void LogicDemo::useJournal() {
 	makePersonSpeak("This is a demo, so I can't load or save games*14", NULL, "");
 }
@@ -2231,7 +2142,7 @@
 }
 
 bool LogicGame::handleSpecialMove(uint16 sm) {
-	typedef void (Logic::*SpecialMoveProc)();
+	typedef void (LogicGame::*SpecialMoveProc)();
 	static const SpecialMoveProc asmTable[] = {
 		/* 00 */
 		0,

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- logic.h	12 Jan 2004 13:40:01 -0000	1.113
+++ logic.h	14 Jan 2004 14:34:05 -0000	1.114
@@ -55,35 +55,24 @@
 
 	uint16 currentRoom() const { return _currentRoom; }
 	void currentRoom(uint16 room) { 
-		if (room >= 1 && room <= _numRooms)
-			_currentRoom = room; 
-		else
-			error("Invalid room number: %i", room);
+		assert(room >= 1 && room <= _numRooms);
+		_currentRoom = room; 
 	}
 
 	uint16 oldRoom() const { return _oldRoom; }
 	void oldRoom(uint16 room) { 
-		if (room <= _numRooms)
-			_oldRoom = room; 
-		else
-			error("Invalid room number: %i", room);
+		assert(room <= _numRooms);
+		_oldRoom = room; 
 	}
 
 	uint16 newRoom() const { return _newRoom; }
 	void newRoom(uint16 room) { 
-		if (room <= _numRooms)
-			_newRoom = room; 
-		else
-			error("Invalid room number: %i", room);
-	}
-
-	bool isAltIntroRoom(uint16 room) const {
-		return room >= 90 && room <= 94;
+		assert(room <= _numRooms);
+		_newRoom = room; 
 	}
 
-	bool isIntroRoom(uint16 room) const {
-		return room >= 115 && room <= 125;
-	}
+	static bool isAltIntroRoom(uint16 room) { return room >= 90 && room <= 94; }
+	static bool isIntroRoom(uint16 room) { return room >= 115 && room <= 125; }
 
 	ObjectData *objectData(int index) const;
 	uint16 roomData(int room) const { return _roomData[room]; }
@@ -128,13 +117,7 @@
 
 	TalkSelected *talkSelected(int index) { return _talkSelected + index; }
 
-	const char *roomName(uint16 roomNum) const { 
-		if (roomNum >= 1 && roomNum <= _numRooms)
-			return _roomName[roomNum];
-		else
-			error("Invalid room number: %i", roomNum);
-	}
-
+	const char *roomName(uint16 roomNum) const;
 	const char *objectName(uint16 objNum) const { return _objName[objNum]; }
 	const char *objectTextualDescription(uint16 objNum) const { return _objDescription[objNum]; }
 

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- talk.cpp	11 Jan 2004 01:36:00 -0000	1.81
+++ talk.cpp	14 Jan 2004 14:34:05 -0000	1.82
@@ -413,9 +413,6 @@
 	int i;
 	
 	byte *ptr = _fileData = loadDialogFile(filename);
-	if (!_fileData) {
-		error("Failed to load resource data file '%s'", filename);
-	}
 
 	bool canQuit;
 

Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- walk.cpp	10 Jan 2004 22:31:41 -0000	1.39
+++ walk.cpp	14 Jan 2004 14:34:05 -0000	1.40
@@ -23,6 +23,7 @@
 #include "queen/walk.h"
 
 #include "queen/bankman.h"
+#include "queen/input.h"
 #include "queen/logic.h"
 #include "queen/graphics.h"
 #include "queen/grid.h"
@@ -30,7 +31,6 @@
 
 namespace Queen {
 
-
 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},
@@ -55,13 +55,10 @@
 	{"*",            0,   0,  0,  0,  0,  0,  0,  0,  0,  0, 0,  0}
 };
 
-
-
 Walk::Walk(QueenEngine *vm)
 	: _vm(vm) {
 }
 
-
 void Walk::animateJoePrepare() {
 	// queen.c l.2748-2788
 	uint16 i;
@@ -99,7 +96,6 @@
 	}
 }
 
-
 void Walk::animateJoe() {
 	// queen.c l.2789-2835
 	uint16 lastDirection = 0;
@@ -139,12 +135,9 @@
 				pbs->speed = 1;
 			}
 			_vm->update(true);
-			// FIXME it would nice to be able to get rid of these 3 lines
-			// as stopJoe() should be do the same...
-			if (_vm->logic()->joeWalk() == JWM_EXECUTE) { // XXX || cutQuit 
-				// we are about to do something else, so stop walking
-				_joeInterrupted = true;
-				pbs->moving = false;
+			if (_vm->input()->cutawayQuit() || _vm->logic()->joeWalk() == JWM_EXECUTE) {
+				stopJoe();
+				break;
 			}
 		}
 		lastDirection = pwd->anim.facing;
@@ -152,7 +145,6 @@
 	_vm->logic()->joeFacing(lastDirection);
 }
 
-
 void Walk::animatePersonPrepare(const MovePersonData *mpd, int direction) {
 	// queen.c l.2469-2572
 	int i;
@@ -218,7 +210,6 @@
 	}
 }
 
-
 void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, uint16 bankNum, int direction) {
 	// queen.c l.2572-2651
 	BobSlot *pbs = _vm->graphics()->bob(bobNum);
@@ -271,12 +262,14 @@
 			if (pbs->speed == 0) {
 				pbs->speed = 1;
 			}
-			// XXX if (cutQuit)
+			if (_vm->input()->cutawayQuit()) {
+				stopPerson(bobNum);
+				break;
+			}
 		}
 	}
 }
 
-
 int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) {
 	_joeInterrupted = false;
 	_joeMoveBlock = false;
@@ -327,7 +320,6 @@
 	return can;
 }
 
-
 int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction) {
 	if (endx == 0 && endy == 0) {
 		warning("Walk::movePerson() - endx == 0 && endy == 0");
@@ -391,12 +383,18 @@
 	return can;
 }
 
-
 void Walk::stopJoe() {
-	_vm->graphics()->bob(0)->moving = false;
+	BobSlot *pbs = _vm->graphics()->bob(0);
+	pbs->moving = false;
 	_joeInterrupted = true;
 }
 
+void Walk::stopPerson(uint16 bobNum) {
+	BobSlot *pbs = _vm->graphics()->bob(bobNum);
+	pbs->x = pbs->endx;
+	pbs->y = pbs->endy;
+	pbs->moving = false;
+}
 
 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
@@ -434,7 +432,6 @@
 	return false;
 }
 
-
 int16 Walk::calcC(int16 c1, int16 c2, int16 c3, int16 c4, int16 lastc) {
 	int16 s1 = MAX(c1, c3);
 	int16 s2 = MIN(c2, c4);
@@ -447,7 +444,6 @@
 	return c;
 }
 
-
 int16 Walk::findAreaPosition(int16 *x, int16 *y, bool recalibrate) {
 	// FIXME - in order to locate the nearest available area, the original 
 	// algorithm computes the X (or Y) closest face distance for each available 
@@ -500,7 +496,6 @@
 	return pos;
 }
 
-
 uint16 Walk::findFreeArea(uint16 area) const {
 	uint16 testArea;
 	uint16 freeArea = 0;
@@ -519,7 +514,6 @@
 	return freeArea;
 }
 
-
 bool Walk::isAreaStruck(uint16 area) const {
 	uint16 i;
 	bool found = false;
@@ -532,7 +526,6 @@
 	return found;
 }
 
-
 bool Walk::calcPath(uint16 oldArea, uint16 newArea) {
 	debug(9, "Walk::calcPath(%d, %d)", oldArea, newArea);
 	_areaList[1] = _areaStrike[1] = oldArea;
@@ -557,7 +550,6 @@
 	return _areaList[1] != 0;
 }
 
-
 void Walk::initWalkData() {
 	uint16 curRoom = _vm->logic()->currentRoom();
 	_roomArea = _vm->grid()->area(curRoom, 0);
@@ -571,7 +563,6 @@
 	memset(_areaList, 0, sizeof(_areaList));
 }
 
-
 void Walk::incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 areaNum) {
 	debug(9, "Walk::incWalkData(%d, %d, %d)", (x - px), (y - py), areaNum);
 	if (px != x || py != y) {
@@ -584,5 +575,4 @@
 	}
 }
 
-
 } // End of namespace Queen

Index: walk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- walk.h	8 Jan 2004 16:41:03 -0000	1.22
+++ walk.h	14 Jan 2004 14:34:05 -0000	1.23
@@ -27,7 +27,6 @@
 
 namespace Queen {
 
-
 struct MovePersonAnim {
 	int16 firstFrame;
 	int16 lastFrame;
@@ -40,7 +39,6 @@
 	}
 };
 
-
 struct WalkData {
 	int16 dx, dy;
 	const Area *area;
@@ -48,7 +46,6 @@
 	MovePersonAnim anim;
 };
 
-
 struct MovePersonData {
 	const char *name;
 	int16 walkLeft1, walkLeft2;
@@ -61,7 +58,6 @@
 	uint16 moveSpeed;
 };
 
-
 class QueenEngine;
 
 class Walk {
@@ -73,13 +69,12 @@
 	int16 movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction);
 
 	void stopJoe();
-
+	void stopPerson(uint16 bobNum);
 
 	enum {
 		MAX_WALK_DATA = 16
 	};
 
-
 private:
 
 	void animateJoePrepare();
@@ -133,11 +128,9 @@
 
 	QueenEngine *_vm;
 
-
 	static const MovePersonData _moveData[];
 };
 
-
 } // End of namespace Queen
 
 #endif





More information about the Scummvm-git-logs mailing list