[Scummvm-cvs-logs] SF.net SVN: scummvm:[45501] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Thu Oct 29 16:26:49 CET 2009


Revision: 45501
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45501&view=rev
Author:   spalek
Date:     2009-10-29 15:26:48 +0000 (Thu, 29 Oct 2009)

Log Message:
-----------
Implement flipping the QuickHero and SpeedText flags in GPL2.

All GPL2 callbacks are now fully implemented.  It remains to implement
proper walking.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/draci.cpp
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/game.h
    scummvm/trunk/engines/draci/script.cpp
    scummvm/trunk/engines/draci/script.h
    scummvm/trunk/engines/draci/sound.cpp

Modified: scummvm/trunk/engines/draci/draci.cpp
===================================================================
--- scummvm/trunk/engines/draci/draci.cpp	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/draci.cpp	2009-10-29 15:26:48 UTC (rev 45501)
@@ -264,6 +264,9 @@
 				// Show walking map toggle
 				_showWalkingMap = !_showWalkingMap;
 				break;
+			case Common::KEYCODE_q:
+				_game->setWantQuickHero(!_game->getWantQuickHero());
+				break;
 			case Common::KEYCODE_i:
 				if (_game->getRoomNum() == _game->getMapRoom() ||
 				    _game->getLoopSubstatus() != kSubstatusOrdinary) {
@@ -394,8 +397,7 @@
 	// to our constraint in canLoadGameStateCurrently() and to having
 	// enterNewRoom() called right after we exit from here.
 	//
-	// TODO: Handle saving in the map room.  Verify inventory and fix
-	// dialogs.
+	// TODO: Handle saving in the map room
 	return loadSavegameData(slot, this);
 }
 

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/game.cpp	2009-10-29 15:26:48 UTC (rev 45501)
@@ -166,6 +166,9 @@
 	setExitLoop(false);
 	_scheduledPalette = 0;
 	_fadePhases = _fadePhase = 0;
+	setEnableQuickHero(true);
+	setWantQuickHero(false);
+	setEnableSpeedText(true);
 	setLoopStatus(kStatusGate);
 	setLoopSubstatus(kSubstatusOrdinary);
 
@@ -439,14 +442,13 @@
 		if (_loopSubstatus == kSubstatusTalk) {
 			// If the current speech text has expired or the user clicked a mouse button,
 			// advance to the next line of text
-			if (_vm->_mouse->lButtonPressed() ||
-				_vm->_mouse->rButtonPressed() ||
+			if (getEnableSpeedText() && (_vm->_mouse->lButtonPressed() || _vm->_mouse->rButtonPressed()) ||
 				(_vm->_system->getMillis() - _speechTick) >= _speechDuration) {
 
 				setExitLoop(true);
-				_vm->_mouse->lButtonSet(false);
-				_vm->_mouse->rButtonSet(false);
 			}
+			_vm->_mouse->lButtonSet(false);
+			_vm->_mouse->rButtonSet(false);
 		}
 
 		// This returns true if we got a signal to quit the game
@@ -1573,6 +1575,19 @@
 	_fadeTick = _vm->_system->getMillis();
 }
 
+void Game::setEnableQuickHero(bool value) {
+	_enableQuickHero = value;
+}
+
+void Game::setWantQuickHero(bool value) {
+	_wantQuickHero = value;
+	// TODO: after proper walking is implemented, do super-fast animation when walking
+}
+
+void Game::setEnableSpeedText(bool value) {
+	_enableSpeedText = value;
+}
+
 /**
  * The GPL command Mark sets the animation index (which specifies the order in which
  * animations were loaded in) which is then used by the Release command to delete

Modified: scummvm/trunk/engines/draci/game.h
===================================================================
--- scummvm/trunk/engines/draci/game.h	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/game.h	2009-10-29 15:26:48 UTC (rev 45501)
@@ -79,12 +79,13 @@
 	kBlackPalette = -1
 };
 
-// Constants tuned such that with ScummVM's default talkspeed 60, the speed
+// Constants tuned such that with ScummVM's default talkspeed kStandardSpeed, the speed
 // computed by equation (kBaseSpeechDuration + kSpeechTimeUnit * #characters) /
 // talkspeed is equal to the original game.
 enum SpeechConstants {
 	kBaseSpeechDuration = 12000,
-	kSpeechTimeUnit = 2640
+	kSpeechTimeUnit = 2640,
+	kStandardSpeed = 60
 };
 
 // One fading phase is 50ms.
@@ -366,6 +367,12 @@
 	void schedulePalette(int paletteID);
 	int getScheduledPalette() const;
 	void initializeFading(int phases);
+	void setEnableQuickHero(bool value);
+	bool getEnableQuickHero() const { return _enableQuickHero; }
+	void setWantQuickHero(bool value);
+	bool getWantQuickHero() const { return _wantQuickHero; }
+	void setEnableSpeedText(bool value);
+	bool getEnableSpeedText() const { return _enableSpeedText; }
 
 	void DoSync(Common::Serializer &s);
 
@@ -432,6 +439,10 @@
 	int _fadePhases;
 	int _fadePhase;
 	uint _fadeTick;
+
+	bool _enableQuickHero;
+	bool _wantQuickHero;
+	bool _enableSpeedText;
 };
 
 } // End of namespace Draci

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/script.cpp	2009-10-29 15:26:48 UTC (rev 45501)
@@ -70,26 +70,27 @@
 		{ 15, 1, "ExecInit", 			1, { 3 }, &Script::execInit },
 		{ 15, 2, "ExecLook", 			1, { 3 }, &Script::execLook },
 		{ 15, 3, "ExecUse", 			1, { 3 }, &Script::execUse },
-		{ 16, 1, "RepaintInventory", 	0, { 0 }, NULL },	// not used in the original game files
-		{ 16, 2, "ExitInventory", 		0, { 0 }, NULL },	// not used in the original game files
-		{ 17, 1, "ExitMap", 			0, { 0 }, NULL },	// not used in the original game files
 		{ 18, 1, "LoadMusic", 			1, { 2 }, &Script::loadMusic },
 		{ 18, 2, "StartMusic", 			0, { 0 }, &Script::startMusic },
 		{ 18, 3, "StopMusic", 			0, { 0 }, &Script::stopMusic },
-		{ 18, 4, "FadeOutMusic",		1, { 1 }, NULL },
-		{ 18, 5, "FadeInMusic", 		1, { 1 }, NULL },
 		{ 19, 1, "Mark", 				0, { 0 }, &Script::mark },
 		{ 19, 2, "Release", 			0, { 0 }, &Script::release },
 		{ 20, 1, "Play", 				0, { 0 }, &Script::play },
 		{ 21, 1, "LoadMap", 			1, { 2 }, &Script::loadMap },
 		{ 21, 2, "RoomMap", 			0, { 0 }, &Script::roomMap },
-		{ 22, 1, "DisableQuickHero", 	0, { 0 }, NULL },
-		{ 22, 2, "EnableQuickHero", 	0, { 0 }, NULL },
-		{ 23, 1, "DisableSpeedText", 	0, { 0 }, NULL },
-		{ 23, 2, "EnableSpeedText", 	0, { 0 }, NULL },
+		{ 22, 1, "DisableQuickHero", 	0, { 0 }, &Script::disableQuickHero },
+		{ 22, 2, "EnableQuickHero", 	0, { 0 }, &Script::enableQuickHero },
+		{ 23, 1, "DisableSpeedText", 	0, { 0 }, &Script::disableSpeedText },
+		{ 23, 2, "EnableSpeedText", 	0, { 0 }, &Script::enableSpeedText },
 		{ 24, 1, "QuitGame", 			0, { 0 }, &Script::quitGame },
 		{ 25, 1, "PushNewRoom", 		0, { 0 }, &Script::pushNewRoom },
 		{ 25, 2, "PopNewRoom", 			0, { 0 }, &Script::popNewRoom },
+		// The following commands are not used in the original game files.
+		{ 16, 1, "RepaintInventory", 	0, { 0 }, NULL },
+		{ 16, 2, "ExitInventory", 		0, { 0 }, NULL },
+		{ 17, 1, "ExitMap", 			0, { 0 }, NULL },
+		{ 18, 4, "FadeOutMusic",		1, { 1 }, NULL },
+		{ 18, 5, "FadeInMusic", 		1, { 1 }, NULL },
 		// The following commands are not even defined in the game
 		// sources, but their numbers are allocated for internal
 		// purposes of the old player.
@@ -746,8 +747,19 @@
 	}
 
 	// Record time
-	uint subtitleDuration = (kBaseSpeechDuration + speechFrame->getLength() * kSpeechTimeUnit)
-		/ _vm->_sound->talkSpeed();
+	int talkSpeed = _vm->_sound->talkSpeed();
+	if (!_vm->_game->getEnableSpeedText() && talkSpeed > kStandardSpeed) {
+		talkSpeed = kStandardSpeed;
+	}
+	if (talkSpeed <= 0) {
+		talkSpeed = 1;
+	}
+	uint subtitleDuration;
+	if (talkSpeed >= 255) {
+		subtitleDuration = 0;
+	} else {
+		subtitleDuration = (kBaseSpeechDuration + speechFrame->getLength() * kSpeechTimeUnit) / talkSpeed;
+	}
 	const uint duration = MAX(subtitleDuration, dubbingDuration);
 	_vm->_game->setSpeechTiming(_vm->_system->getMillis(), duration);
 
@@ -829,6 +841,22 @@
 	_vm->_game->loadWalkingMap();
 }
 
+void Script::disableQuickHero(Common::Queue<int> &params) {
+	_vm->_game->setEnableQuickHero(false);
+}
+
+void Script::enableQuickHero(Common::Queue<int> &params) {
+	_vm->_game->setEnableQuickHero(true);
+}
+
+void Script::disableSpeedText(Common::Queue<int> &params) {
+	_vm->_game->setEnableSpeedText(false);
+}
+
+void Script::enableSpeedText(Common::Queue<int> &params) {
+	_vm->_game->setEnableSpeedText(true);
+}
+
 void Script::loadPalette(Common::Queue<int> &params) {
 	int palette = params.pop() - 1;
 
@@ -1166,6 +1194,10 @@
 	} while (cmd->_number != 0 && !shouldEndProgram());    // 0 = gplend and exit
 
 	_jump = oldJump;
+
+	// Reset the flags which may have temporarily been altered inside the script.
+	_vm->_game->setEnableQuickHero(true);
+	_vm->_game->setEnableSpeedText(true);
 }
 
 } // End of namespace Draci

Modified: scummvm/trunk/engines/draci/script.h
===================================================================
--- scummvm/trunk/engines/draci/script.h	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/script.h	2009-10-29 15:26:48 UTC (rev 45501)
@@ -131,6 +131,10 @@
 	void talk(Common::Queue<int> &params);
 	void loadMap(Common::Queue<int> &params);
 	void roomMap(Common::Queue<int> &params);
+	void disableQuickHero(Common::Queue<int> &params);
+	void enableQuickHero(Common::Queue<int> &params);
+	void disableSpeedText(Common::Queue<int> &params);
+	void enableSpeedText(Common::Queue<int> &params);
 	void dialogue(Common::Queue<int> &params);
 	void exitDialogue(Common::Queue<int> &params);
 	void resetDialogue(Common::Queue<int> &params);

Modified: scummvm/trunk/engines/draci/sound.cpp
===================================================================
--- scummvm/trunk/engines/draci/sound.cpp	2009-10-29 14:16:20 UTC (rev 45500)
+++ scummvm/trunk/engines/draci/sound.cpp	2009-10-29 15:26:48 UTC (rev 45501)
@@ -31,6 +31,7 @@
 
 #include "draci/sound.h"
 #include "draci/draci.h"
+#include "draci/game.h"
 
 #include "sound/audiostream.h"
 #include "sound/mixer.h"
@@ -162,7 +163,7 @@
 }
 
 Sound::Sound(Audio::Mixer *mixer) : _mixer(mixer), _muteSound(false), _muteVoice(false),
-	_showSubtitles(true), _talkSpeed(60) {
+	_showSubtitles(true), _talkSpeed(kStandardSpeed) {
 
 	for (int i = 0; i < SOUND_HANDLES; i++)
 		_handles[i].type = kFreeHandle;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list