[Scummvm-cvs-logs] CVS: scummvm/queen journal.cpp,1.17,1.18 logic.cpp,1.158,1.159 logic.h,1.101,1.102 queen.cpp,1.68,1.69 queen.h,1.24,1.25

Gregory Montoir cyx at users.sourceforge.net
Tue Jan 6 08:54:02 CET 2004


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

Modified Files:
	journal.cpp logic.cpp logic.h queen.cpp queen.h 
Log Message:
- enabled debugger in QueenEngine::errorString
- initialise Cutaway::_personCount* when the Cutaway starts
- minor tweaks in BankManager


Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- journal.cpp	6 Jan 2004 12:45:29 -0000	1.17
+++ journal.cpp	6 Jan 2004 16:53:35 -0000	1.18
@@ -85,7 +85,7 @@
 		system->delay_msecs(20);
 	}
 
-	_vm->logic()->writeOptionSettings();
+	_vm->writeOptionSettings();
 
 	_vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1);
 	_vm->graphics()->putCameraOnBob(0);
@@ -451,7 +451,7 @@
 
 
 void Journal::drawConfigPanel() {
-	_vm->logic()->checkOptionSettings();
+	_vm->checkOptionSettings();
 
 	drawSlideBar(_vm->logic()->talkSpeed(), 130, 100, BOB_TALK_SPEED, 136 - 4, 164, FRAME_BLUE_PIN);
 	// XXX music_volume

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- logic.cpp	6 Jan 2004 14:21:50 -0000	1.158
+++ logic.cpp	6 Jan 2004 16:53:35 -0000	1.159
@@ -50,16 +50,6 @@
 	memset(_talkSelected, 0, sizeof(_talkSelected));
 	_puzzleAttemptCount = 0;
 	initialise();
-	if (_vm->resource()->isDemo()) {
-		_preChangeRoom = &Logic::preChangeRoom_Demo;
-		_executeSpecialMove = &Logic::executeSpecialMove_Demo;
-	} else if (_vm->resource()->isInterview()) {
-		_preChangeRoom = &Logic::preChangeRoom_Interview;
-		_executeSpecialMove = &Logic::executeSpecialMove_Interview;
-	} else {
-		_preChangeRoom = &Logic::preChangeRoom_Game;
-		_executeSpecialMove = &Logic::executeSpecialMove_Game;
-	}
 }
 
 Logic::~Logic() {
@@ -2169,7 +2159,7 @@
 
 
 void Logic::changeRoom() {
-	if (!(this->*_preChangeRoom)()) 
+	if (!preChangeRoom()) 
 		roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 1, false);
 	_vm->display()->showMouseCursor(true);
 }
@@ -2188,227 +2178,9 @@
 }
 
 
-void Logic::registerDefaultSettings() {
-	ConfMan.registerDefault("master_volume", 255);
-	ConfMan.registerDefault("music_mute", false);
-	ConfMan.registerDefault("sfx_mute", false);
-	ConfMan.registerDefault("talkspeed", DEFAULT_TALK_SPEED);
-	ConfMan.registerDefault("speech_mute", _vm->resource()->isFloppy());
-	ConfMan.registerDefault("subtitles", true);
-}
-
-
-void Logic::checkOptionSettings() {
-	// check talkspeed value
-	if (_talkSpeed < 4) {
-		_talkSpeed = 4;
-	} else if (_talkSpeed > 95) {
-		_talkSpeed = 100;
-	}
-
-	// XXX check master_volume value
-
-	// only CD-ROM version has speech
-	if (_vm->resource()->isFloppy() && _vm->sound()->speechOn()) {
-		_vm->sound()->speechToggle(false);
-	}
-
-	// ensure text is always on when voice is off
-	if (!_vm->sound()->speechOn()) {
-		_subtitles = true;
-	}
-}
-
-
-void Logic::readOptionSettings() {
-	// XXX master_volume
-	_vm->sound()->musicToggle(!ConfMan.getBool("music_mute"));
-	_vm->sound()->sfxToggle(!ConfMan.getBool("sfx_mute"));
-	_talkSpeed = ConfMan.getInt("talkspeed");
-	_vm->sound()->speechToggle(!ConfMan.getBool("speech_mute"));
-	_subtitles = ConfMan.getBool("subtitles");
-
-	checkOptionSettings();
-}
-
-
-void Logic::writeOptionSettings() {
-	// XXX master_volume
-	ConfMan.set("music_mute", !_vm->sound()->musicOn());
-	ConfMan.set("sfx_mute", !_vm->sound()->sfxOn());
-	ConfMan.set("talkspeed", _talkSpeed);
-	ConfMan.set("speech_mute", !_vm->sound()->speechOn());
-	ConfMan.set("subtitles", _subtitles);
-
-	ConfMan.flushToDisk();
-}
-
-
-bool Logic::preChangeRoom_Demo() {
-	if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
-		currentRoom(79);
-		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
-		playCutaway("clogo.cut");
-		sceneReset();
-		currentRoom(ROOM_HOTEL_LOBBY);
-		entryObj(584);
-		roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true);
-		playCutaway("c70d.cut");
-		gameState(VAR_INTRO_PLAYED, 1);
-		inventorySetup();
-		inventoryRefresh();
-		return true;
-	}
-	return false;
-}
-
-
-bool Logic::preChangeRoom_Interview() {
-	if (currentRoom() == 2 && gameState(2) == 0) {
-		currentRoom(6);
-		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
-		playCutaway("start.cut");
-		gameState(2, 1);
-		inventorySetup();
-		inventoryRefresh();
-		return true;
-	}
-	return false;
-}
-
-
-bool Logic::preChangeRoom_Game() {
-	if (currentRoom() == ROOM_JUNGLE_PINNACLE) {
-		handlePinnacleRoom();
-		return true;
-	} else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
-		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
-		playCutaway("copy.cut");
-		playCutaway("clogo.cut");
-
-		// XXX enable talking for talkie version
-
-		if (ConfMan.getBool("alt_intro")) {
-			_vm->graphics()->loadPanel();
-			playCutaway("cintr.cut");
-		} else {
-			playCutaway("cdint.cut");
-			_vm->graphics()->loadPanel();
-		}
-
-		playCutaway("cred.cut");
-		sceneReset();
-		currentRoom(ROOM_HOTEL_LOBBY);
-		entryObj(584);
-		roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true);
-		playCutaway("c70d.cut");
-		gameState(VAR_INTRO_PLAYED, 1);
-		inventorySetup();
-		inventoryRefresh();
-		return true;
-	}
-	return false;
-}
-
-
-bool Logic::executeSpecialMove_Demo(uint16 sm) {
-	switch (sm) {
-	case 4:
-		asmMakeJoeUseUnderwear();
-		break;
-	case 5:
-		asmSwitchToDressPalette();
-		break;
-	case 14:
-		asmEndDemo();
-		break;
-	default:
-		return false;
-	}
-	return true;
-}
-
-
-bool Logic::executeSpecialMove_Interview(uint16 sm) {
-	switch (sm) {
-	case 1:
-		asmInterviewIntro();
-		break;
-	case 2:
-		asmEndInterview();
-		break;
-	default:
-		return false;
-	}
-	return true;
-}
-
-
-bool Logic::executeSpecialMove_Game(uint16 sm) {
-	typedef void (Logic::*SpecialMoveProc)();
-	static const SpecialMoveProc asmTable[] = {
-		/* 00 */
-		NULL,
-		NULL,
-		&Logic::asmMakeJoeUseDress,
-		&Logic::asmMakeJoeUseNormalClothes,
-		/* 04 */
-		&Logic::asmMakeJoeUseUnderwear,
-		&Logic::asmSwitchToDressPalette,
-		&Logic::asmSwitchToNormalPalette,
-		&Logic::asmStartCarAnimation,       // room 74
-		/* 08 */
-		&Logic::asmStopCarAnimation,        // room 74
-		&Logic::asmStartFightAnimation,     // room 69
-		&Logic::asmWaitForFrankPosition,    // c69e.cut
-		&Logic::asmMakeFrankGrowing,        // c69z.cut
-		/* 12 */
-		&Logic::asmMakeRobotGrowing,        // c69z.cut
-		&Logic::asmShrinkRobot,
-		&Logic::asmEndGame,
-		&Logic::asmPutCameraOnDino,
-		/* 16 */
-		&Logic::asmPutCameraOnJoe,
-		&Logic::asmAltIntroPanRight,        // cintr.cut
-		&Logic::asmAltIntroPanLeft,         // cintr.cut
-		&Logic::asmSetAzuraInLove,
-		/* 20 */
-		&Logic::asmPanRightFromJoe,
-		&Logic::asmSetLightsOff,
-		&Logic::asmSetLightsOn,
-		&Logic::asmSetManequinAreaOn,
-		/* 24 */
-		&Logic::asmPanToJoe,
-		&Logic::asmTurnGuardOn,
-		&Logic::asmPanLeft320To144,
-		&Logic::asmSmooch,
-		/* 28 */
-		&Logic::asmMakeLightningHitPlane,
-		&Logic::asmScaleBlimp,
-		&Logic::asmScaleEnding,
-		&Logic::asmWaitForCarPosition,
-		/* 32 */
-		&Logic::asmShakeScreen,
-		&Logic::asmAttemptPuzzle,
-		&Logic::asmScaleTitle,
-		NULL,
-		/* 36 */
-		&Logic::asmPanRightToHugh,
-		&Logic::asmMakeWhiteFlash,
-		&Logic::asmPanRightToJoeAndRita,
-		&Logic::asmPanLeftToBomb            // cdint.cut
-	};
-	if (sm >= ARRAYSIZE(asmTable) || asmTable[sm] == NULL)
-		return false;
-	(this->*asmTable[sm])();
-	return true;
-}
-
-
 void Logic::executeSpecialMove(uint16 sm) {
-	
 	debug(6, "Special move: %d", sm);
-	if (!(this->*_executeSpecialMove)(sm))
+	if (!handleSpecialMove(sm))
 		warning("unhandled / invalid special move : %d", sm);
 }
 
@@ -3052,6 +2824,166 @@
 	}
 }
 
+
+bool LogicDemo::preChangeRoom() {
+	if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
+		currentRoom(79);
+		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
+		playCutaway("clogo.cut");
+		sceneReset();
+		currentRoom(ROOM_HOTEL_LOBBY);
+		entryObj(584);
+		roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true);
+		playCutaway("c70d.cut");
+		gameState(VAR_INTRO_PLAYED, 1);
+		inventorySetup();
+		inventoryRefresh();
+		return true;
+	}
+	return false;
+}
+
+
+bool LogicInterview::preChangeRoom() {
+	if (currentRoom() == 2 && gameState(2) == 0) {
+		currentRoom(6);
+		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
+		playCutaway("start.cut");
+		gameState(2, 1);
+		inventorySetup();
+		inventoryRefresh();
+		return true;
+	}
+	return false;
+}
+
+
+bool LogicGame::preChangeRoom() {
+	if (currentRoom() == ROOM_JUNGLE_PINNACLE) {
+		handlePinnacleRoom();
+		return true;
+	} else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
+		roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
+		playCutaway("copy.cut");
+		playCutaway("clogo.cut");
+
+		// XXX enable talking for talkie version
+
+		if (ConfMan.getBool("alt_intro")) {
+			_vm->graphics()->loadPanel();
+			playCutaway("cintr.cut");
+		} else {
+			playCutaway("cdint.cut");
+			_vm->graphics()->loadPanel();
+		}
+
+		playCutaway("cred.cut");
+		sceneReset();
+		currentRoom(ROOM_HOTEL_LOBBY);
+		entryObj(584);
+		roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true);
+		playCutaway("c70d.cut");
+		gameState(VAR_INTRO_PLAYED, 1);
+		inventorySetup();
+		inventoryRefresh();
+		return true;
+	}
+	return false;
+}
+
+
+bool LogicDemo::handleSpecialMove(uint16 sm) {
+	switch (sm) {
+	case 4:
+		asmMakeJoeUseUnderwear();
+		break;
+	case 5:
+		asmSwitchToDressPalette();
+		break;
+	case 14:
+		asmEndDemo();
+		break;
+	default:
+		return false;
+	}
+	return true;
+}
+
+
+bool LogicInterview::handleSpecialMove(uint16 sm) {
+	switch (sm) {
+	case 1:
+		asmInterviewIntro();
+		break;
+	case 2:
+		asmEndInterview();
+		break;
+	default:
+		return false;
+	}
+	return true;
+}
+
+
+bool LogicGame::handleSpecialMove(uint16 sm) {
+	typedef void (Logic::*SpecialMoveProc)();
+	static const SpecialMoveProc asmTable[] = {
+		/* 00 */
+		0,
+		0,
+		&Logic::asmMakeJoeUseDress,
+		&Logic::asmMakeJoeUseNormalClothes,
+		/* 04 */
+		&Logic::asmMakeJoeUseUnderwear,
+		&Logic::asmSwitchToDressPalette,
+		&Logic::asmSwitchToNormalPalette,
+		&Logic::asmStartCarAnimation,       // room 74
+		/* 08 */
+		&Logic::asmStopCarAnimation,        // room 74
+		&Logic::asmStartFightAnimation,     // room 69
+		&Logic::asmWaitForFrankPosition,    // c69e.cut
+		&Logic::asmMakeFrankGrowing,        // c69z.cut
+		/* 12 */
+		&Logic::asmMakeRobotGrowing,        // c69z.cut
+		&Logic::asmShrinkRobot,
+		&Logic::asmEndGame,
+		&Logic::asmPutCameraOnDino,
+		/* 16 */
+		&Logic::asmPutCameraOnJoe,
+		&Logic::asmAltIntroPanRight,        // cintr.cut
+		&Logic::asmAltIntroPanLeft,         // cintr.cut
+		&Logic::asmSetAzuraInLove,
+		/* 20 */
+		&Logic::asmPanRightFromJoe,
+		&Logic::asmSetLightsOff,
+		&Logic::asmSetLightsOn,
+		&Logic::asmSetManequinAreaOn,
+		/* 24 */
+		&Logic::asmPanToJoe,
+		&Logic::asmTurnGuardOn,
+		&Logic::asmPanLeft320To144,
+		&Logic::asmSmooch,
+		/* 28 */
+		&Logic::asmMakeLightningHitPlane,
+		&Logic::asmScaleBlimp,
+		&Logic::asmScaleEnding,
+		&Logic::asmWaitForCarPosition,
+		/* 32 */
+		&Logic::asmShakeScreen,
+		&Logic::asmAttemptPuzzle,
+		&Logic::asmScaleTitle,
+		0,
+		/* 36 */
+		&Logic::asmPanRightToHugh,
+		&Logic::asmMakeWhiteFlash,
+		&Logic::asmPanRightToJoeAndRita,
+		&Logic::asmPanLeftToBomb            // cdint.cut
+	};
+	if (sm >= ARRAYSIZE(asmTable) || asmTable[sm] == 0)
+		return false;
+	(this->*asmTable[sm])();
+	return true;
+}
 
 
 } // End of namespace Queen

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- logic.h	6 Jan 2004 14:21:50 -0000	1.101
+++ logic.h	6 Jan 2004 16:53:35 -0000	1.102
@@ -60,7 +60,7 @@
 
 public:
 	Logic(QueenEngine *vm);
-	~Logic();
+	virtual ~Logic();
 
 	uint16 currentRoom() const { return _currentRoom; }
 	void currentRoom(uint16 room) { 
@@ -241,18 +241,6 @@
 	bool subtitles() const { return _subtitles; }
 	void subtitles(bool enable) { _subtitles = enable; }
 
-	void registerDefaultSettings();
-	void checkOptionSettings();
-	void readOptionSettings();
-	void writeOptionSettings();
-
-	bool preChangeRoom_Demo();
-	bool preChangeRoom_Interview();
-	bool preChangeRoom_Game();
-
-	bool executeSpecialMove_Demo(uint16 sm);
-	bool executeSpecialMove_Interview(uint16 sm);
-	bool executeSpecialMove_Game(uint16 sm);
 	void executeSpecialMove(uint16 sm);
 
 	void asmMakeJoeUseDress();
@@ -299,9 +287,6 @@
 	void startCredits(const char *filename);
 	void stopCredits();
 
-	typedef bool (Logic::*ExecuteSpecialMoveProc)(uint16);
-	typedef bool (Logic::*PreChangeRoomProc)();
-
 	enum {
 		MAX_ZONES_NUMBER    = 32,
 		MAX_AREAS_NUMBER    = 11,
@@ -315,6 +300,10 @@
 
 	void initialise();
 
+	virtual bool preChangeRoom() = 0;
+	virtual bool handleSpecialMove(uint16 sm) = 0;
+
+
 	LineReader *_queen2jas;
 
 	uint16 _currentRoom;
@@ -438,11 +427,32 @@
 
 	bool _subtitles;
 
-	ExecuteSpecialMoveProc _executeSpecialMove;
-	PreChangeRoomProc _preChangeRoom;
-
 	QueenEngine *_vm;
 	Credits *_credits;
+};
+
+class LogicDemo : public Logic {
+public:
+	LogicDemo(QueenEngine *vm) : Logic(vm) {}
+protected:
+	bool preChangeRoom();
+	bool handleSpecialMove(uint16 sm);
+};
+
+class LogicInterview : public Logic {
+public:
+	LogicInterview(QueenEngine *vm) : Logic(vm) {}
+protected:
+	bool preChangeRoom();
+	bool handleSpecialMove(uint16 sm);
+};
+
+class LogicGame : public Logic {
+public:
+	LogicGame(QueenEngine *vm) : Logic(vm) {}
+protected:
+	bool preChangeRoom();
+	bool handleSpecialMove(uint16 sm);
 };
 
 

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- queen.cpp	6 Jan 2004 12:45:29 -0000	1.68
+++ queen.cpp	6 Jan 2004 16:53:35 -0000	1.69
@@ -98,6 +98,7 @@
 	_system->init_size(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
 }
 
+
 QueenEngine::~QueenEngine() {
 	_timer->removeTimerProc(&timerHandler);
 	delete _bam;
@@ -114,6 +115,61 @@
 	delete _walk;	
 }
 
+
+void QueenEngine::registerDefaultSettings() {
+	ConfMan.registerDefault("master_volume", 255);
+	ConfMan.registerDefault("music_mute", false);
+	ConfMan.registerDefault("sfx_mute", false);
+	ConfMan.registerDefault("talkspeed", Logic::DEFAULT_TALK_SPEED);
+	ConfMan.registerDefault("speech_mute", _resource->isFloppy());
+	ConfMan.registerDefault("subtitles", true);
+}
+
+
+void QueenEngine::checkOptionSettings() {
+	// check talkspeed value
+	if (_logic->talkSpeed() < 4) {
+		_logic->talkSpeed(4);
+	} else if (_logic->talkSpeed() > 95) {
+		_logic->talkSpeed(100);
+	}
+
+	// XXX check master_volume value
+
+	// only CD-ROM version has speech
+	if (_resource->isFloppy() && _sound->speechOn()) {
+		_sound->speechToggle(false);
+	}
+
+	// ensure text is always on when voice is off
+	if (!_sound->speechOn()) {
+		_logic->subtitles(true);
+	}
+}
+
+
+void QueenEngine::readOptionSettings() {
+	// XXX master_volume
+	_sound->musicToggle(!ConfMan.getBool("music_mute"));
+	_sound->sfxToggle(!ConfMan.getBool("sfx_mute"));
+	_logic->talkSpeed(ConfMan.getInt("talkspeed"));
+	_sound->speechToggle(!ConfMan.getBool("speech_mute"));
+	_logic->subtitles(ConfMan.getBool("subtitles"));
+	checkOptionSettings();
+}
+
+
+void QueenEngine::writeOptionSettings() {
+	// XXX master_volume
+	ConfMan.set("music_mute", !_sound->musicOn());
+	ConfMan.set("sfx_mute", !_sound->sfxOn());
+	ConfMan.set("talkspeed", _logic->talkSpeed());
+	ConfMan.set("speech_mute", !_sound->speechOn());
+	ConfMan.set("subtitles", _logic->subtitles());
+	ConfMan.flushToDisk();
+}
+
+
 void QueenEngine::errorString(const char *buf1, char *buf2) {
 	strcpy(buf2, buf1);
 	if (_debugger && !_debugger->isAttached()) {
@@ -126,8 +182,8 @@
 void QueenEngine::go() {
 	initialise();
 
-	_logic->registerDefaultSettings();
-	_logic->readOptionSettings();
+	registerDefaultSettings();
+	readOptionSettings();
 
 	_logic->oldRoom(0);
 	_logic->newRoom(_logic->currentRoom());
@@ -159,6 +215,7 @@
 	}
 }
 
+
 void QueenEngine::initialise(void) {
 	_bam = new BamScene(this);
 	_resource = new Resource(_gameDataPath, _system->get_savefile_manager(), getSavePath());
@@ -168,7 +225,14 @@
 	_display = new Display(this, _system);
 	_graphics = new Graphics(this);
 	_input = new Input(_resource->getLanguage(), _system);
-	_logic = new Logic(this);
+
+	if (_resource->isDemo()) {
+		_logic = new LogicDemo(this);
+	} else if (_resource->isInterview()) {
+		_logic = new LogicInterview(this);
+	} else {
+		_logic = new LogicGame(this);
+	}
 
 	MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE));
 	if (!driver)

Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- queen.h	6 Jan 2004 12:45:29 -0000	1.24
+++ queen.h	6 Jan 2004 16:53:35 -0000	1.25
@@ -62,6 +62,11 @@
 
 	Common::RandomSource randomizer;
 
+	void registerDefaultSettings();
+	void checkOptionSettings();
+	void readOptionSettings();
+	void writeOptionSettings();
+
 protected:
 
 	void errorString(const char *buf_input, char *buf_output);
@@ -69,6 +74,7 @@
 	void go();
 
 	void initialise();
+
 
 	static void timerHandler(void *ptr);
 	void gotTimerTick();





More information about the Scummvm-git-logs mailing list