aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRobert Špalek2009-10-29 15:26:48 +0000
committerRobert Špalek2009-10-29 15:26:48 +0000
commit403668898fcf59012aa405c36fad8d18dfbf205b (patch)
tree7fdfdc73b5a21cc1d22b40e37bc4e70c8c9fb1ab /engines
parent8178d548eb2e822cfc7a9c21fa7c569f5b695398 (diff)
downloadscummvm-rg350-403668898fcf59012aa405c36fad8d18dfbf205b.tar.gz
scummvm-rg350-403668898fcf59012aa405c36fad8d18dfbf205b.tar.bz2
scummvm-rg350-403668898fcf59012aa405c36fad8d18dfbf205b.zip
Implement flipping the QuickHero and SpeedText flags in GPL2.
All GPL2 callbacks are now fully implemented. It remains to implement proper walking. svn-id: r45501
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/draci.cpp6
-rw-r--r--engines/draci/game.cpp23
-rw-r--r--engines/draci/game.h15
-rw-r--r--engines/draci/script.cpp54
-rw-r--r--engines/draci/script.h4
-rw-r--r--engines/draci/sound.cpp3
6 files changed, 85 insertions, 20 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 71155e6c25..6f99a38830 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -264,6 +264,9 @@ void DraciEngine::handleEvents() {
// 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 @@ Common::Error DraciEngine::loadGameState(int slot) {
// 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);
}
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index e59e4677b5..eeed48f005 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -166,6 +166,9 @@ void Game::init() {
setExitLoop(false);
_scheduledPalette = 0;
_fadePhases = _fadePhase = 0;
+ setEnableQuickHero(true);
+ setWantQuickHero(false);
+ setEnableSpeedText(true);
setLoopStatus(kStatusGate);
setLoopSubstatus(kSubstatusOrdinary);
@@ -439,14 +442,13 @@ void Game::loop() {
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 @@ void Game::initializeFading(int phases) {
_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
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 0f1765345f..1366ffd9ec 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -79,12 +79,13 @@ enum {
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 @@ public:
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 @@ private:
int _fadePhases;
int _fadePhase;
uint _fadeTick;
+
+ bool _enableQuickHero;
+ bool _wantQuickHero;
+ bool _enableSpeedText;
};
} // End of namespace Draci
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index ae8127d496..5b0443c6c3 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -70,26 +70,27 @@ void Script::setupCommandList() {
{ 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 @@ void Script::talk(Common::Queue<int> &params) {
}
// 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 @@ void Script::roomMap(Common::Queue<int> &params) {
_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 @@ void Script::run(const GPL2Program &program, uint16 offset) {
} 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
diff --git a/engines/draci/script.h b/engines/draci/script.h
index a81b9e3ad5..8c493ff877 100644
--- a/engines/draci/script.h
+++ b/engines/draci/script.h
@@ -131,6 +131,10 @@ private:
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);
diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp
index 6b6e18f364..624b93cf37 100644
--- a/engines/draci/sound.cpp
+++ b/engines/draci/sound.cpp
@@ -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 @@ SoundSample *SoundArchive::getSample(int i, uint freq) {
}
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;