[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.103,1.104 cutaway.h,1.31,1.32 defs.h,1.39,1.40 display.cpp,1.46,1.47 display.h,1.34,1.35 graphics.cpp,1.71,1.72 graphics.h,1.54,1.55 journal.cpp,1.18,1.19 logic.cpp,1.161,1.162 logic.h,1.104,1.105 queen.cpp,1.69,1.70 queen.h,1.25,1.26 talk.cpp,1.70,1.71 walk.cpp,1.36,1.37 walk.h,1.19,1.20 xref.txt,1.56,1.57

Gregory Montoir cyx at users.sourceforge.net
Thu Jan 8 02:26:00 CET 2004


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

Modified Files:
	cutaway.cpp cutaway.h defs.h display.cpp display.h 
	graphics.cpp graphics.h journal.cpp logic.cpp logic.h 
	queen.cpp queen.h talk.cpp walk.cpp walk.h xref.txt 
Log Message:
mostly cleanup :
- moved main update() method to QueenEngine
- merged update() & checkPlayer()
- added a method in Logic class to handle the CUTAWAY_SPECIAL stuff
- Journal remembers last seen page
- no need to call loadPanel() to restore panel palette, use palSetPanel() instead


Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- cutaway.cpp	7 Jan 2004 15:46:45 -0000	1.103
+++ cutaway.cpp	8 Jan 2004 10:25:17 -0000	1.104
@@ -696,7 +696,7 @@
 				if (object.animType == 2 || object.animType == 0) {
 					// Unpack animation, but do not unpack moving people
 
-					if (!((objAnim[i].mx > 0 || objAnim[i].my > 0) && InRange(objAnim[i].object, 1, 3))) {
+					if (!((objAnim[i].mx > 0 || objAnim[i].my > 0) && inRange(objAnim[i].object, 1, 3))) {
 						/*debug(6, "Animation - bankUnpack(%i, %i, %i);",
 								objAnim[i].unpackFrame, 
 								objAnim[i].originalFrame,
@@ -730,7 +730,7 @@
 
 				int j;
 				for (j = 0; j < objAnim[i].speed; j++)
-					_vm->logic()->update();
+					_vm->update();
 			}
 
 			if (_vm->input()->cutawayQuit())
@@ -753,7 +753,7 @@
 
 	while (moving) {
 		moving = false;
-		_vm->logic()->update();
+		_vm->update();
 		
 		for (i = 0; i < frameCount; i++) {
 			BobSlot *bob = _vm->graphics()->bob(objAnim[i].object);
@@ -951,7 +951,7 @@
 			break;
 
 		if (_roomFade) {
-			_vm->logic()->update();
+			_vm->update();
 			int end = 223;
 			if (IS_CD_INTRO_ROOM(_vm->logic()->currentRoom())) {
 				end = 255;
@@ -1028,18 +1028,7 @@
 			}
 		}
 
-		// function CUTAWAY_SPECIAL(), lines 885-896 in cutaway.c
-		if (_vm->logic()->currentRoom() == 1 && _vm->logic()->gameState(3) == 0) {
-			// XXX hard-coded room and inventory items
-			_vm->logic()->inventoryDeleteItem(ITEM_CROWBAR, false);
-			_vm->logic()->inventoryDeleteItem(ITEM_DRESS, false);
-			_vm->logic()->inventoryDeleteItem(ITEM_CLOTHES, false);
-			_vm->logic()->inventoryDeleteItem(ITEM_HAY, false);
-			_vm->logic()->inventoryDeleteItem(ITEM_OIL, false);
-			_vm->logic()->inventoryDeleteItem(ITEM_CHICKEN, false);
-			_vm->logic()->gameState(3, 1);
-			_vm->logic()->inventoryRefresh();
-		}
+		_vm->logic()->removeHotelItemsFromInventory();
 	}
 
 	joeBob->animating = 0;
@@ -1147,7 +1136,7 @@
 				if (x || y) {
 					pbs->x = x;
 					pbs->y = y;
-					if (InRange(object->image, -4, -3))
+					if (inRange(object->image, -4, -3))
 						pbs->scale = _vm->logic()->findScale(x, y);
 				}
 
@@ -1373,7 +1362,7 @@
 
 	int i;
 	for (i = 0; i < spaces; i++) {
-		_vm->logic()->update();
+		_vm->update();
 
 		if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
 			// XXX: see if speaking is finished
@@ -1389,7 +1378,7 @@
 	}
 
 	_vm->graphics()->textClear(0,198);
-	_vm->logic()->update();
+	_vm->update();
 }
 		
 int Cutaway::countSpaces(ObjectType type, const char *segment) {
@@ -1404,7 +1393,7 @@
 	if (OBJECT_TYPE_TEXT_DISPLAY == type)
 		tmp *= 3;
 
-	return (tmp * 2) / (_vm->logic()->talkSpeed() / 3);
+	return (tmp * 2) / (_vm->talkSpeed() / 3);
 
 }
 

Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cutaway.h	6 Jan 2004 12:45:29 -0000	1.31
+++ cutaway.h	8 Jan 2004 10:25:17 -0000	1.32
@@ -270,6 +270,7 @@
 		//! Dump CutawayAnum data with debug()
 		static void dumpCutawayAnim(CutawayAnim &anim);
 
+		bool inRange(int16 x, int16 l, int16 h) const { return (x <= h && x >= l); }
 };
 
 } // End of namespace Queen

Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- defs.h	6 Jan 2004 12:45:29 -0000	1.39
+++ defs.h	8 Jan 2004 10:25:17 -0000	1.40
@@ -24,9 +24,6 @@
 
 namespace Queen {
 
-// Maybe should be an inlined function somwhere else, feel free to change
-#define InRange(x,l,h)     ((x)<=(h) && (x)>=(l)) /* X in [l..h] */
-
 #define SAVEGAME_SIZE	24622
 
 enum {

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- display.cpp	6 Jan 2004 12:45:29 -0000	1.46
+++ display.cpp	8 Jan 2004 10:25:17 -0000	1.47
@@ -177,7 +177,7 @@
 
 
 void Display::palSetPanel() {
-	warning("Display::palSetPanel()");
+	memcpy(_pal.room + 144 * 3, _pal.panel, (256 - 144) * 3);
 }
 
 
@@ -636,15 +636,31 @@
 }
 
 
+void Display::setupPanel() {
+	uint8 *pcxBuf = _vm->resource()->loadFile("panel.pcx");
+	uint32 size = _vm->resource()->fileSize("panel.pcx");
+	uint8 *dst = _panelBuf + PANEL_W * 10;
+	readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
+	const uint8 *pal = pcxBuf + size - 768 + 144 * 3;
+	memcpy(_pal.panel, pal, (256 - 144) * 3);
+	delete[] pcxBuf;
+
+	palSetPanel();
+}
+
+
 void Display::setupNewRoom(const char *name, uint16 room) {
 	dynalumInit(name, room);
 
 	char filename[20];
 	sprintf(filename, "%s.PCX", name);
-	uint8 *pcxbuf = _vm->resource()->loadFile(filename);
+	uint8 *pcxBuf = _vm->resource()->loadFile(filename);
 	uint32 size = _vm->resource()->fileSize(filename);
-	readPCXBackdrop(pcxbuf, size, room > 114);
-	delete[] pcxbuf;
+	_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, IS_CD_INTRO_ROOM(room) ? 256 * 3 : 144 * 3);
+	delete[] pcxBuf;
 
 	palCustomColors(room);
 
@@ -735,23 +751,6 @@
 		}
 		dst += dstPitch;
 	}
-}
-
-
-void Display::readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) {
-	_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, useFullPal ? 256 * 3 : 144 * 3);
-}
-
-
-void Display::readPCXPanel(const uint8 *pcxBuf, uint32 size) {
-	uint8 *dst = _panelBuf + PANEL_W * 10;
-	readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
-	const uint8 *pal = pcxBuf + size - 768 + 144 * 3;
-	memcpy(_pal.room + 144 * 3, pal, (256 - 144) * 3);
-	memcpy(_pal.panel, pal, (256 - 144) * 3);
 }
 
 

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- display.h	6 Jan 2004 12:45:29 -0000	1.34
+++ display.h	8 Jan 2004 10:25:17 -0000	1.35
@@ -59,6 +59,7 @@
 	void prepareUpdate();
 	void update(bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
 
+	void setupPanel();
 	void setupNewRoom(const char *name, uint16 room);
 
 	void drawBobSprite(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch, bool xflip);
@@ -69,8 +70,6 @@
 	void fill(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color);
 
 	void readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h);
-	void readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal);
-	void readPCXPanel(const uint8 *pcxBuf, uint32 size);
 
 	void horizontalScrollUpdate(int16 xCamera);
 	void horizontalScroll(int16 scroll) { _fullRefresh = true; _horizontalScroll = scroll; }

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- graphics.cpp	7 Jan 2004 15:45:24 -0000	1.71
+++ graphics.cpp	8 Jan 2004 10:25:17 -0000	1.72
@@ -844,17 +844,6 @@
 }
 
 
-void Graphics::loadPanel() {
-	uint8 *pcxbuf = _vm->resource()->loadFile("panel.pcx");
-	if (pcxbuf == NULL) {
-		error("Unable to open panel file");
-	}
-	uint32 size = _vm->resource()->fileSize("panel.pcx");
-	_vm->display()->readPCXPanel(pcxbuf, size);
-	delete[] pcxbuf;
-}
-
-
 void BamScene::updateCarAnimation() {
 	if (_flag != F_STOP) {
 		const BamDataBlock *bdb = &_carData[_index];

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- graphics.h	7 Jan 2004 15:45:24 -0000	1.54
+++ graphics.h	8 Jan 2004 10:25:17 -0000	1.55
@@ -119,9 +119,9 @@
 	void eraseAllFrames(bool joe);
 
 	enum {
-		MAX_BANK_SIZE       = 110,
-		MAX_FRAMES_NUMBER   = 256,
-		MAX_BANKS_NUMBER    =  18
+		MAX_BANK_SIZE     = 110,
+		MAX_FRAMES_NUMBER = 256,
+		MAX_BANKS_NUMBER  =  18
 	};
 
 
@@ -186,8 +186,6 @@
 	void resetPersonAnim(uint16 bobNum);
 	void erasePersonAnim(uint16 bobNum);
 	void eraseAllAnims();
-
-	void loadPanel();
 
 	void putCameraOnBob(int bobNum) { _cameraBob = bobNum; }
 

Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- journal.cpp	6 Jan 2004 16:53:35 -0000	1.18
+++ journal.cpp	8 Jan 2004 10:25:17 -0000	1.19
@@ -253,7 +253,7 @@
 		enterYesNoMode(zoneNum, TXT_GIVE_UP);
 	}
 	if (zoneNum == ZN_TEXT_SPEED) {
-		_vm->logic()->talkSpeed((x - 136) * 100 / 130);
+		_vm->talkSpeed((x - 136) * 100 / 130);
 		drawConfigPanel();
 	} else if (zoneNum == ZN_SFX_TOGGLE) {
 		_vm->sound()->toggleSfx();
@@ -283,7 +283,7 @@
 		_vm->sound()->toggleSpeech();
 		drawConfigPanel();
 	} else if (zoneNum == ZN_TEXT_TOGGLE) {
-		_vm->logic()->subtitles(!_vm->logic()->subtitles());
+		_vm->subtitles(!_vm->subtitles());
 		drawConfigPanel();
 	}
 }
@@ -453,13 +453,13 @@
 void Journal::drawConfigPanel() {
 	_vm->checkOptionSettings();
 
-	drawSlideBar(_vm->logic()->talkSpeed(), 130, 100, BOB_TALK_SPEED, 136 - 4, 164, FRAME_BLUE_PIN);
+	drawSlideBar(_vm->talkSpeed(), 130, 100, BOB_TALK_SPEED, 136 - 4, 164, FRAME_BLUE_PIN);
 	// XXX music_volume
 	drawSlideBar(100, 130, 100, BOB_MUSIC_VOLUME, 136 - 4, 177, FRAME_GREEN_PIN);
 
 	drawCheckBox(_vm->sound()->sfxOn(), BOB_SFX_TOGGLE, 221, 155, FRAME_CHECK_BOX);
 	drawCheckBox(_vm->sound()->speechOn(), BOB_SPEECH_TOGGLE, 158, 155, FRAME_CHECK_BOX);
-	drawCheckBox(_vm->logic()->subtitles(), BOB_TEXT_TOGGLE, 125, 167, FRAME_CHECK_BOX);
+	drawCheckBox(_vm->subtitles(), BOB_TEXT_TOGGLE, 125, 167, FRAME_CHECK_BOX);
 	drawCheckBox(_vm->sound()->musicOn(), BOB_MUSIC_TOGGLE, 125, 181, FRAME_CHECK_BOX);
 }
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- logic.cpp	7 Jan 2004 15:45:24 -0000	1.161
+++ logic.cpp	8 Jan 2004 10:25:17 -0000	1.162
@@ -43,16 +43,18 @@
 namespace Queen {
 
 Logic::Logic(QueenEngine *vm)
-	:  _queen2jas(NULL), _vm(vm), _credits(NULL) {
+	:  _queen2jas(NULL), _credits(NULL), _vm(vm) {
 	_joe.x = _joe.y = 0;
 	_joe.scale = 100;
 	memset(_gameState, 0, sizeof(_gameState));
 	memset(_talkSelected, 0, sizeof(_talkSelected));
 	_puzzleAttemptCount = 0;
 	initialise();
+	_journal = new Journal(vm);
 }
 
 Logic::~Logic() {
+	delete _journal;
 	delete _credits;
 	delete _queen2jas;
 }
@@ -258,7 +260,7 @@
 	_vm->command()->clear(false);
 	_scene = 0;
 	memset(_gameState, 0, sizeof(_gameState));
-	_vm->graphics()->loadPanel();
+	_vm->display()->setupPanel();
 	_vm->graphics()->bobSetupControl();
 	setupJoe();
 	zoneSetupPanel();
@@ -974,7 +976,7 @@
 		pod = setupJoeInRoom(mode != RDM_FADE_JOE_XY, scale);
 	}
 	if (mode != RDM_NOFADE_JOE) {
-		update();
+		_vm->update();
 		BobSlot *joe = _vm->graphics()->bob(0);
 		if (IS_CD_INTRO_ROOM(_currentRoom)) {
 			_vm->display()->palFadeIn(0, 255, _currentRoom, joe->active, joe->x, joe->y);
@@ -1225,24 +1227,24 @@
 		if (joeFacing() == DIR_FRONT) {
 			if (joePrevFacing() == DIR_BACK) {
 				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
-				update();
+				_vm->update();
 			}
 			frame = 34;
 		} else if (joeFacing() == DIR_BACK) {
 			if (joePrevFacing() == DIR_FRONT) {
 				pbs->frameNum = 33 + FRAMES_JOE_XTRA;
-				update();
+				_vm->update();
 			}
 			frame = 35;
 		} else if ((joeFacing() == DIR_LEFT && joePrevFacing() == DIR_RIGHT) 
 			|| 	(joeFacing() == DIR_RIGHT && joePrevFacing() == DIR_LEFT)) {
 			pbs->frameNum = 34 + FRAMES_JOE_XTRA;
-			update();
+			_vm->update();
 		}
 		pbs->frameNum = frame + FRAMES_JOE_XTRA;
 		pbs->scale = joeScale();
 		pbs->xflip = (joeFacing() == DIR_LEFT);
-		update();
+		_vm->update();
 		joePrevFacing(joeFacing());
 		switch (frame) {
 		case 33:
@@ -1293,12 +1295,12 @@
 		_vm->bankMan()->unpack(5, 29 + FRAMES_JOE_XTRA, 7);
 		bobJoe->xflip = (joeFacing() == DIR_LEFT);
 		bobJoe->scale = joeScale();
-		update();
+		_vm->update();
 		// grab up
 		_vm->bankMan()->unpack(7, 29 + FRAMES_JOE_XTRA, 7);
 		bobJoe->xflip = (joeFacing() == DIR_LEFT);
 		bobJoe->scale = joeScale();
-		update();
+		_vm->update();
 		// turn back
 		frame = 7;
 		break;
@@ -1308,12 +1310,12 @@
 		_vm->bankMan()->unpack(frame, 29 + FRAMES_JOE_XTRA, 7);
 		bobJoe->xflip = (joeFacing() == DIR_LEFT);
 		bobJoe->scale = joeScale();
-		update();
+		_vm->update();
 
 		// extra delay for grab down
 		if (grabState == STATE_GRAB_DOWN) {
-			update();
-			update();
+			_vm->update();
+			_vm->update();
 		}
 	}
 }
@@ -1492,7 +1494,7 @@
 		x += 35;
 	}
 	// XXX OLDVERB=VERB;
-	update();
+	_vm->update();
 }
 
 int16 Logic::previousInventoryItem(int16 start) const {
@@ -1581,6 +1583,20 @@
 }
 
 
+void Logic::removeHotelItemsFromInventory() {
+	if (currentRoom() == 1 && gameState(3) == 0) {
+		inventoryDeleteItem(ITEM_CROWBAR, false);
+		inventoryDeleteItem(ITEM_DRESS, false);
+		inventoryDeleteItem(ITEM_CLOTHES, false);
+		inventoryDeleteItem(ITEM_HAY, false);
+		inventoryDeleteItem(ITEM_OIL, false);
+		inventoryDeleteItem(ITEM_CHICKEN, false);
+		gameState(3, 1);
+		inventoryRefresh();
+	}
+}
+
+
 void Logic::objectCopy(int dummyObjectIndex, int realObjectIndex) {
 	// P3_COPY_FROM function in cutaway.c
 	/* Copy data from Dummy (D) object to object (K)
@@ -1640,17 +1656,9 @@
 }
 
 
-void Logic::checkPlayer() {
-	update();
-	if (!_vm->input()->cutawayRunning()) {
-		_vm->command()->updatePlayer();
-	}
-}
-
-
-void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) {
+void Logic::handleSpecialArea(int facing, uint16 areaNum, uint16 walkDataNum) {
 	// queen.c l.2838-2911
-	debug(9, "customMoveJoe(%d, %d, %d)\n", facing, areaNum, walkDataNum);
+	debug(9, "handleSpecialArea(%d, %d, %d)\n", facing, areaNum, walkDataNum);
 
 	// Stop animating Joe
 	_vm->graphics()->bob(0)->animating = false;
@@ -1785,7 +1793,7 @@
 	// to animate anymore ; so turn animating off
 	joe->animating = piton->animating = false;
 
-	update();
+	_vm->update();
 	_vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y);
 	_vm->graphics()->textCurrentColor(INK_PINNACLE_ROOM);
 
@@ -1793,7 +1801,7 @@
 	uint16 prevObj = 0;
 	while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
 
-		update();
+		_vm->update();
 		int mx = _vm->input()->mousePosX();
 		int my = _vm->input()->mousePosY();
 
@@ -1845,7 +1853,7 @@
 		{ 0x2F,  6 },
 		{ 0x2C,  7 },
 		{ 0x2B,  3 },
-		{ 0x30,  3 },
+		{ 0x30,  3 }
 	};
 	for (int i = 0; i < ARRAYSIZE(songs); ++i) {
 		if (songs[i].obj == prevObj) {
@@ -1864,19 +1872,9 @@
 
 
 void Logic::update() {
-	if (_vm->debugger()->isAttached()) {
-		_vm->debugger()->onFrame();
-	}
-
-	_vm->graphics()->update(_currentRoom);
 	if (_credits)
 		_credits->update();
 
-	_vm->input()->delay();
-
-	if (!_vm->resource()->isInterview()) {
-		_vm->display()->palCustomScroll(_currentRoom);
-	}
 	if (_vm->debugger()->_drawAreas) {
 		for(int i = 1; i < MAX_ZONES_NUMBER; ++i) {
 			const ZoneSlot *pzs = &_zones[ZONE_ROOM][i];
@@ -1886,29 +1884,9 @@
 			}
 		}
 	}
-	BobSlot *joe = _vm->graphics()->bob(0);
-	_vm->display()->update(joe->active, joe->x, joe->y);
-	
-	_vm->input()->checkKeys();
-	if (_vm->input()->debugger()) {
-		_vm->input()->debuggerReset();
-		_vm->debugger()->attach();
-	}
-	if (!_vm->input()->cutawayRunning()) {
-		if (_vm->input()->quickSave()) {
-			_vm->input()->quickSaveReset();
-			gameSave(0, "Quicksave");
-		}
-		if (_vm->input()->quickLoad()) {
-			_vm->input()->quickLoadReset();
-			gameLoad(0);
-		}
-		if (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
-			_vm->display()->blankScreen();
-		}
-	}
 }
 
+
 bool Logic::gameSave(uint16 slot, const char *desc) {
 	if (!desc)	//no description entered
 		return false;
@@ -1925,12 +1903,12 @@
 	memcpy(ptr, buf, 32); ptr += 32;
 	delete[] buf;
 	
-	WRITE_BE_UINT16(ptr, _talkSpeed); ptr += 2;
+	WRITE_BE_UINT16(ptr, _vm->talkSpeed()); ptr += 2;
 	WRITE_BE_UINT16(ptr, 0 /*_settings.musicVolume*/); ptr += 2;
 	WRITE_BE_UINT16(ptr, _vm->sound()->sfxOn() ? 1 : 0); ptr += 2;
 	WRITE_BE_UINT16(ptr, _vm->sound()->speechOn() ? 1 : 0); ptr += 2;
 	WRITE_BE_UINT16(ptr, _vm->sound()->musicOn() ? 1 : 0); ptr += 2;
-	WRITE_BE_UINT16(ptr, _subtitles ? 1 : 0); ptr += 2;
+	WRITE_BE_UINT16(ptr, _vm->subtitles() ? 1 : 0); ptr += 2;
 	
 	for (i = 0; i < 4; i++) {
 		WRITE_BE_UINT16(ptr, _inventoryItem[i]); ptr += 2;
@@ -2000,7 +1978,7 @@
 	_vm->sound()->sfxToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
 	_vm->sound()->speechToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
 	_vm->sound()->musicToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
-	_subtitles = READ_BE_UINT16(ptr) != 0; ptr += 2;
+	_vm->subtitles(READ_BE_UINT16(ptr) != 0); ptr += 2;
 
 	for (i = 0; i < 4; i++) {
 		_inventoryItem[i] = (int16)READ_BE_UINT16(ptr); ptr += 2;
@@ -2086,7 +2064,7 @@
 		_vm->display()->palFadePanel();
 	}
 
-	update();
+	_vm->update();
 }
 
 void Logic::sceneStop() {
@@ -2114,8 +2092,7 @@
 		makePersonSpeak("This is a demo, so I can't load or save games*14", NULL, "");
 	} else if (!_vm->resource()->isInterview()) {
 		_vm->command()->clear(false);
-		Journal j(_vm);
-		j.use();
+		_journal->use();
 		_vm->walk()->stopJoe();
 		// XXX TALKQUIT=CUTQUIT=0; Make sure that we turn off cut stuff in case we use Journal during cutaways
 	}
@@ -2177,7 +2154,7 @@
 void Logic::asmWaitForFrankPosition() {	
 	_vm->bam()->_flag = BamScene::F_REQ_STOP;
 	while (_vm->bam()->_flag != BamScene::F_STOP) {
-		update();
+		_vm->update();
 	}
 }
 
@@ -2192,10 +2169,10 @@
 	int i;
 	for (i = 10; i <= 100; i += 4) {
 		bobFrank->scale = i;
-		update();
+		_vm->update();
 	}
 	for (i = 0; i <= 20; ++i) {
-		update();
+		_vm->update();
 	}
 
 	objectData(521)->name =  ABS(objectData(521)->name); // Dinoray
@@ -2217,10 +2194,10 @@
 	int i;
 	for (i = 10; i <= 100; i += 4) {
 		bobRobot->scale = i;
-		update();
+		_vm->update();
 	}
 	for (i = 0; i <= 20; ++i) {
-		update();
+		_vm->update();
 	}
 	
 	objectData(524)->name = -ABS(objectData(524)->name); // Azura object off
@@ -2233,7 +2210,7 @@
 	BobSlot *robot = _vm->graphics()->bob(6);
 	for (i = 100; i >= 35; i -= 5) {
 		robot->scale = i;
-		update();
+		_vm->update();
 	}
 }
 
@@ -2241,7 +2218,7 @@
 void Logic::asmEndGame() {
 	int i;
 	for (i = 0; i < 40; ++i) {
-		update();
+		_vm->update();
 	}
 	debug(0, "Game completed.");
 	OSystem::instance()->quit();
@@ -2257,7 +2234,7 @@
 			scrollx = 320;
 		}
 		_vm->display()->horizontalScroll(scrollx);
-		update();
+		_vm->update();
 	}
 	_vm->graphics()->putCameraOnBob(1);
 }
@@ -2271,7 +2248,7 @@
 void Logic::asmAltIntroPanRight() {
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
-	update();
+	_vm->update();
 	int16 scrollx = _vm->display()->horizontalScroll();
 	while (scrollx < 285 && !_vm->input()->cutawayQuit()) {
 		++scrollx;
@@ -2279,7 +2256,7 @@
 			scrollx = 285;
 		}
 		_vm->display()->horizontalScroll(scrollx);
-		update();
+		_vm->update();
 	}
 	_vm->input()->fastMode(false);
 }
@@ -2295,7 +2272,7 @@
 			scrollx = 0;
 		}
 		_vm->display()->horizontalScroll(scrollx);
-		update();
+		_vm->update();
 	}
 	_vm->input()->fastMode(false);
 }
@@ -2315,7 +2292,7 @@
 			scrollx = 320;
 		}
 		_vm->display()->horizontalScroll(scrollx);
-		update();
+		_vm->update();
 	}
 }
 
@@ -2352,7 +2329,7 @@
 				scrollx = i;
 			}
 			_vm->display()->horizontalScroll(scrollx);
-			update();
+			_vm->update();
 		}
 	} else {
 		while (scrollx < i) {
@@ -2361,9 +2338,9 @@
 				scrollx = i;
 			}
 			_vm->display()->horizontalScroll(scrollx);
-			update();
+			_vm->update();
 		}
-		update();
+		_vm->update();
 	}
 	_vm->graphics()->putCameraOnBob(0);
 }
@@ -2383,7 +2360,7 @@
 			scrollx = 144;
 		}
 		_vm->display()->horizontalScroll(scrollx);
-		update();
+		_vm->update();
 	}
 }
 
@@ -2403,7 +2380,7 @@
 			bobAzura->x += 8;
 			bobJoe->x += 8;
 		}
-		update();
+		_vm->update();
 	}
 }
 
@@ -2436,7 +2413,7 @@
 		if (scrollX > 320)
 			scrollX = 320;
 		_vm->display()->horizontalScroll(scrollX);
-		update();
+		_vm->update();
 	}
 
 	planeBob->scale = 100;
@@ -2462,7 +2439,7 @@
 	fireBob->y = planeBob->y + 10;
 				
 	_vm->bankMan()->unpack(19, fireBob->frameNum, 15);
-	update();
+	_vm->update();
 
 	k = 20;
 	j = 1;
@@ -2482,7 +2459,7 @@
 				j = 1;
 		}
 					
-		update();
+		_vm->update();
 	}
 
 	_vm->graphics()->putCameraOnBob(0);
@@ -2504,7 +2481,7 @@
 			--x;
 		}
 
-		update();
+		_vm->update();
 	}
 }
 
@@ -2517,10 +2494,10 @@
 	int i;
 	for (i = 5; i <= 100; i += 5) {
 		b->scale = i;
-		update();
+		_vm->update();
 	}
 	for (i = 0; i < 50; ++i) {
-		update();
+		_vm->update();
 	}
 	_vm->display()->palFadeOut(0, 255, currentRoom());
 }
@@ -2529,16 +2506,16 @@
 void Logic::asmWaitForCarPosition() {
 	// Wait for car to reach correct position before pouring oil
 	while (_vm->bam()->_index != 60) {
-		update();
+		_vm->update();
 	}
 }
 
 
 void Logic::asmShakeScreen() {
 	OSystem::instance()->set_shake_pos(3);
-	update();
+	_vm->update();
 	OSystem::instance()->set_shake_pos(0);
-	update();
+	_vm->update();
 }
 
 
@@ -2562,7 +2539,7 @@
 	for (i = 5; i <= 100; i +=5) {
 		bob->scale = i;
 		bob->y -= 4;
-		update();
+		_vm->update();
 	}
 }
 
@@ -2579,7 +2556,7 @@
 
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
-	update();
+	_vm->update();
 				
 	int i = 4, k = 160;
 
@@ -2622,7 +2599,7 @@
 		bob_thugB1->x -= i * 4;
 		bob_thugB2->x -= i * 4;
 
-		update();
+		_vm->update();
 	}
 
 	_vm->input()->fastMode(false);
@@ -2644,7 +2621,7 @@
 	_vm->graphics()->putCameraOnBob(-1);
 	_vm->input()->fastMode(true);
 					
-	update();
+	_vm->update();
 
 	bob_box  ->x += 280 * 2;
 	bob_beam ->x += 30;
@@ -2667,7 +2644,7 @@
 		bob_clock->x -= i * 2;
 		bob_hands->x -= i * 2;
 
-		update();
+		_vm->update();
 	}
 	_vm->input()->fastMode(false);
 }
@@ -2696,7 +2673,7 @@
 
 		bob22->x += i;
 
-		update();
+		_vm->update();
 	}
 
 	_vm->input()->fastMode(false);
@@ -2724,7 +2701,7 @@
 		if (scale < 256) {
 			scale = 256;
 		}
-		update();
+		_vm->update();
 	}
 
 	bas->scale = 90;
@@ -2732,17 +2709,17 @@
 
 	bas->move(560, 25, 4);
 	while (bas->moving && !_vm->input()->cutawayQuit()) {
-		update();
+		_vm->update();
 	}
 
 	bas->move(545, 65, 2);
 	while (bas->moving && !_vm->input()->cutawayQuit()) {
-		update();
+		_vm->update();
 	}
 
 	bas->move(540, 75, 2);
 	while (bas->moving && !_vm->input()->cutawayQuit()) {
-		update();
+		_vm->update();
 	}
 
 	// put camera on Joe
@@ -2814,11 +2791,10 @@
 		// XXX enable talking for talkie version
 
 		if (ConfMan.getBool("alt_intro")) {
-			_vm->graphics()->loadPanel();
 			playCutaway("cintr.cut");
 		} else {
 			playCutaway("cdint.cut");
-			_vm->graphics()->loadPanel();
+			_vm->display()->palSetPanel();
 		}
 
 		playCutaway("cred.cut");

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- logic.h	7 Jan 2004 15:45:24 -0000	1.104
+++ logic.h	8 Jan 2004 10:25:18 -0000	1.105
@@ -53,8 +53,10 @@
 	Box box;
 };
 
-class QueenEngine;
+
 class Credits;
+class Journal;
+class QueenEngine;
 
 class Logic {
 
@@ -208,13 +210,12 @@
 	void inventoryInsertItem(uint16 itemNum, bool refresh = true);
 	void inventoryDeleteItem(uint16 itemNum, bool refresh = true);
 	void inventoryScroll(uint16 count, bool up);
+	void removeHotelItemsFromInventory();
 
 	//! Copy data from dummy object to object
 	void objectCopy(int dummyObjectIndex, int objectIndex);
 
-	void checkPlayer();
-
-	void customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum);
+	void handleSpecialArea(int facing, uint16 areaNum, uint16 walkDataNum);
 
 	void handlePinnacleRoom();
 
@@ -236,11 +237,6 @@
 
 	void useJournal();
 
-	int talkSpeed() const { return _talkSpeed; }
-	void talkSpeed(int speed) { _talkSpeed = speed; }
-	bool subtitles() const { return _subtitles; }
-	void subtitles(bool enable) { _subtitles = enable; }
-
 	void executeSpecialMove(uint16 sm);
 
 	void asmMakeJoeUseDress();
@@ -423,12 +419,10 @@
 	//! scene counter
 	int _scene;
 
-	int _talkSpeed;
-
-	bool _subtitles;
+	Credits *_credits;
+	Journal *_journal;
 
 	QueenEngine *_vm;
-	Credits *_credits;
 };
 
 class LogicDemo : public Logic {

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- queen.cpp	6 Jan 2004 16:53:35 -0000	1.69
+++ queen.cpp	8 Jan 2004 10:25:18 -0000	1.70
@@ -128,10 +128,10 @@
 
 void QueenEngine::checkOptionSettings() {
 	// check talkspeed value
-	if (_logic->talkSpeed() < 4) {
-		_logic->talkSpeed(4);
-	} else if (_logic->talkSpeed() > 95) {
-		_logic->talkSpeed(100);
+	if (_talkSpeed < 4) {
+		_talkSpeed = 4;
+	} else if (_talkSpeed > 95) {
+		_talkSpeed = 100;
 	}
 
 	// XXX check master_volume value
@@ -143,7 +143,7 @@
 
 	// ensure text is always on when voice is off
 	if (!_sound->speechOn()) {
-		_logic->subtitles(true);
+		_subtitles = true;
 	}
 }
 
@@ -152,9 +152,9 @@
 	// XXX master_volume
 	_sound->musicToggle(!ConfMan.getBool("music_mute"));
 	_sound->sfxToggle(!ConfMan.getBool("sfx_mute"));
-	_logic->talkSpeed(ConfMan.getInt("talkspeed"));
+	_talkSpeed = ConfMan.getInt("talkspeed");
 	_sound->speechToggle(!ConfMan.getBool("speech_mute"));
-	_logic->subtitles(ConfMan.getBool("subtitles"));
+	_subtitles = ConfMan.getBool("subtitles");
 	checkOptionSettings();
 }
 
@@ -163,13 +163,52 @@
 	// XXX master_volume
 	ConfMan.set("music_mute", !_sound->musicOn());
 	ConfMan.set("sfx_mute", !_sound->sfxOn());
-	ConfMan.set("talkspeed", _logic->talkSpeed());
+	ConfMan.set("talkspeed", _talkSpeed);
 	ConfMan.set("speech_mute", !_sound->speechOn());
-	ConfMan.set("subtitles", _logic->subtitles());
+	ConfMan.set("subtitles", _subtitles);
 	ConfMan.flushToDisk();
 }
 
 
+void QueenEngine::update(bool checkPlayerInput) {
+	if (_debugger->isAttached()) {
+		_debugger->onFrame();
+	}
+
+	_graphics->update(_logic->currentRoom());
+	_logic->update();
+
+	_input->delay();
+
+	if (!_resource->isInterview()) {
+		_display->palCustomScroll(_logic->currentRoom());
+	}
+	BobSlot *joe = _graphics->bob(0);
+	_display->update(joe->active, joe->x, joe->y);
+	
+	_input->checkKeys();
+	if (_input->debugger()) {
+		_input->debuggerReset();
+		_debugger->attach();
+	}
+	if (!_input->cutawayRunning()) {
+		if (_input->quickSave()) {
+			_input->quickSaveReset();
+			_logic->gameSave(0, "Quicksave");
+		}
+		if (_input->quickLoad()) {
+			_input->quickLoadReset();
+			_logic->gameLoad(0);
+		}
+		if (checkPlayerInput) {
+			_command->updatePlayer();
+		}
+		if (_input->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
+			_display->blankScreen();
+		}
+	}
+}
+
 void QueenEngine::errorString(const char *buf1, char *buf2) {
 	strcpy(buf2, buf1);
 	if (_debugger && !_debugger->isAttached()) {
@@ -209,7 +248,7 @@
 //					_command->clear(true);
 //				}
 				_logic->joeWalk(JWM_NORMAL);
-				_logic->checkPlayer();
+				update(true);
 			}
 		}
 	}

Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- queen.h	6 Jan 2004 16:53:35 -0000	1.25
+++ queen.h	8 Jan 2004 10:25:18 -0000	1.26
@@ -67,6 +67,13 @@
 	void readOptionSettings();
 	void writeOptionSettings();
 
+	int talkSpeed() const { return _talkSpeed; }
+	void talkSpeed(int speed) { _talkSpeed = speed; }
+	bool subtitles() const { return _subtitles; }
+	void subtitles(bool enable) { _subtitles = enable; }
+
+	void update(bool checkPlayerInput = false);
+
 protected:
 
 	void errorString(const char *buf_input, char *buf_output);
@@ -75,9 +82,12 @@
 
 	void initialise();
 
-
 	static void timerHandler(void *ptr);
 	void gotTimerTick();
+
+
+	int _talkSpeed;
+	bool _subtitles;
 
 	BamScene *_bam;
 	BankManager *_bankMan;

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- talk.cpp	7 Jan 2004 15:45:24 -0000	1.70
+++ talk.cpp	8 Jan 2004 10:25:18 -0000	1.71
@@ -711,7 +711,7 @@
 	if (tmp < 10)
 		tmp = 10;
 
-	return (tmp * 2) / (_vm->logic()->talkSpeed() / 3);
+	return (tmp * 2) / (_vm->talkSpeed() / 3);
 }
 
 void Talk::headStringAnimation(const SpeechParameters *parameters, int bobNum, int bankNum) {
@@ -743,7 +743,7 @@
 			bob2->x = x;
 			bob2->y = y;
 
-			_vm->logic()->update();
+			_vm->update();
 		}
 	}
 	else
@@ -795,7 +795,7 @@
 			// XXX bobs[BNUM].scale=SF;
 		}
 
-		_vm->logic()->update();
+		_vm->update();
 	}
 
 	// XXX #ifdef __DOS__
@@ -881,23 +881,23 @@
 				}
 
 				if (!_talkHead)
-					_vm->logic()->update();
+					_vm->update();
 			}
 			else { // (_talkHead && isJoe)
-				_vm->logic()->update();
+				_vm->update();
 			}
 
 			if (_vm->logic()->joeWalk() == JWM_SPEAK) {
 				if (_vm->input()->talkQuit())
 					break;
 
-				_vm->logic()->update();
+				_vm->update();
 			}
 			else {
 				if (_vm->input()->talkQuit())
 					break;
 
-				_vm->logic()->checkPlayer();
+				_vm->update(true);
 				if (_vm->logic()->joeWalk() == JWM_EXECUTE)
 					// Selected a command, so exit
 					break;
@@ -951,7 +951,7 @@
 			for (i = 0; i < 10; i++) {
 				if (_vm->input()->talkQuit())
 					break;
-				_vm->logic()->update();
+				_vm->update();
 			}
 			return;
 
@@ -1074,7 +1074,7 @@
 
 			if (length == 0 && !isJoe && parameters->bf > 0) {
 				_vm->bankMan()->overpack(parameters->bf, startFrame, bankNum);
-				_vm->logic()->update();
+				_vm->update();
 			}
 
 			/* A12 = the frame pointer for the full body frame, well use this  */
@@ -1147,7 +1147,7 @@
 		}
 	}
 
-	_vm->logic()->update();
+	_vm->update();
 }
 
 const Talk::SpeechParameters *Talk::findSpeechParameters(
@@ -1334,7 +1334,7 @@
 				if (_vm->input()->talkQuit())
 					break;
 
-				_vm->logic()->update();
+				_vm->update();
 
 				zone = _vm->logic()->zoneIn(ZONE_PANEL, _vm->input()->mousePosX(), _vm->input()->mousePosY());
 

Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- walk.cpp	7 Jan 2004 15:45:24 -0000	1.36
+++ walk.cpp	8 Jan 2004 10:25:18 -0000	1.37
@@ -114,7 +114,7 @@
 		// area has been turned off, see if we should execute a cutaway
 		if (pwd->area->mapNeighbours < 0) {
 			// queen.c l.2838-2911
-			_vm->logic()->customMoveJoe(pwd->anim.facing, pwd->areaNum, i);
+			_vm->logic()->handleSpecialArea(pwd->anim.facing, pwd->areaNum, i);
 			_joeMoveBlock = true;
 			return;
 		}
@@ -137,7 +137,7 @@
 			if (pbs->speed == 0) {
 				pbs->speed = 1;
 			}
-			_vm->logic()->checkPlayer();
+			_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 
@@ -259,7 +259,7 @@
 		}
 
 		while (pbs->moving) {
-			_vm->logic()->update();
+			_vm->update();
 			uint16 scale = pwd->area->calcScale(pbs->y);
 			pbs->scale = scale;
 			if (pbs->xmajor) {

Index: walk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- walk.h	6 Jan 2004 12:45:29 -0000	1.19
+++ walk.h	8 Jan 2004 10:25:18 -0000	1.20
@@ -44,7 +44,7 @@
 struct WalkData {
 	int16 dx, dy;
 	const Area *area;
-	uint16 areaNum; // extra stuff for customMoveJoe
+	uint16 areaNum;
 	MovePersonAnim anim;
 };
 
@@ -125,7 +125,7 @@
 	//! set if stopJoe() is called
 	bool _joeInterrupted;
 
-	//! set if customMoveJoe() is called
+	//! set if handleSpecialArea() is called
 	bool _joeMoveBlock;
 
 	QueenEngine *_vm;

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- xref.txt	7 Jan 2004 15:45:24 -0000	1.56
+++ xref.txt	8 Jan 2004 10:25:18 -0000	1.57
@@ -127,7 +127,7 @@
 drawbobs()					Graphics::bobDrawAll
 invbob()					Graphics::bobDrawInventoryItem
 loadbackdrop()				*included in Display::setupNewRoom*
-loadpanel()					Graphics::loadPanel
+loadpanel()					Display::setupPanel
 MAKE_SPEAK_BOB()			Graphics::bobSetText
 makeanim()					BobSlot::animNormal
 movebob()					BobSlot::move
@@ -204,8 +204,8 @@
 
 LOGIC
 =====
-CHECK_PLAYER()				Logic::checkPlayer
-CUTAWAY_SPECIAL()
+CHECK_PLAYER()				QueenEngine::update
+CUTAWAY_SPECIAL()			Logic::removeHotelItemsFromInventory
 DISP_OBJECTS()				Logic::roomSetupObjects
 DISP_ROOM()					Logic::roomDisplay
 FIND_BOB()					Logic::findBob
@@ -220,9 +220,9 @@
 SETUP_BOBS()				Graphics::bobSetupControl
 SETUP_FURNITURE()			Logic::roomSetupFurniture
 SETUP_ROOM()				Logic::changeRoom
-SETUP_SCREENS()				*not needed* (only calls Graphics::loadPanel)
+SETUP_SCREENS()				*not needed* (only calls Display::setupPanel)
 SETUP_VARS()				*not needed* (equivalent to Command::clear(), SCENE=0, clear(gamestate))
-update() 					Logic::update
+update() 					QueenEngine::update
 -
 A_ANIMstr 					Logic::_aAnim
 A_ANIM_MAX					Logic::_numAAnim





More information about the Scummvm-git-logs mailing list