GROOVIE: Add additional play-speed modes to T7G.

These two speed modes enable faster movement throughout the mansion.
iOS mode matches the behavior of the official iOS release while
tweaked mode additionally uses original framerate for 'teeth'
animations.
This commit is contained in:
Scott Thomas 2011-04-07 23:36:17 +09:30
parent d718755d73
commit 7c39b844b8
7 changed files with 58 additions and 6 deletions

View File

@ -55,6 +55,16 @@ GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
SearchMan.addSubDirectoryMatching(gameDataDir, "media");
SearchMan.addSubDirectoryMatching(gameDataDir, "system");
_modeSpeed = kGroovieSpeedNormal;
if (ConfMan.hasKey("t7g_speed"))
{
Common::String speed = ConfMan.get("t7g_speed");
if (speed.equals("im_an_ios"))
_modeSpeed = kGroovieSpeediOS;
else if (speed.equals("tweaked"))
_modeSpeed = kGroovieSpeedTweaked;
}
// Initialize the custom debug levels
DebugMan.addDebugChannel(kGroovieDebugAll, "All", "Debug everything");
DebugMan.addDebugChannel(kGroovieDebugVideo, "Video", "Debug video and audio playback");

View File

@ -75,6 +75,12 @@ enum DebugLevels {
// the current limitation is 32 debug levels (1 << 31 is the last one)
};
enum GameSpeed {
kGroovieSpeedNormal,
kGroovieSpeediOS,
kGroovieSpeedTweaked
};
struct GroovieGameDescription;
class GroovieEngine : public Engine {
@ -113,6 +119,8 @@ public:
Common::MacResManager *_macResFork;
GameSpeed _modeSpeed;
private:
const GroovieGameDescription *_gameDescription;
Debugger *_debugger;

View File

@ -29,18 +29,19 @@
namespace Groovie {
VideoPlayer::VideoPlayer(GroovieEngine *vm) :
_vm(vm), _syst(vm->_system), _file(NULL), _audioStream(NULL) {
_vm(vm), _syst(vm->_system), _file(NULL), _audioStream(NULL), _fps(0), _overrideSpeed(false) {
}
bool VideoPlayer::load(Common::SeekableReadStream *file, uint16 flags) {
_file = file;
_flags = flags;
_overrideSpeed = false;
_audioStream = NULL;
uint16 fps = loadInternal();
_fps = loadInternal();
if (fps != 0) {
_millisBetweenFrames = 1000 / fps;
if (_fps != 0) {
setOverrideSpeed(_overrideSpeed);
_begunPlaying = false;
return true;
} else {
@ -49,6 +50,18 @@ bool VideoPlayer::load(Common::SeekableReadStream *file, uint16 flags) {
}
}
void VideoPlayer::setOverrideSpeed(bool isOverride)
{
_overrideSpeed = isOverride;
if (_fps != 0)
{
if (isOverride)
_millisBetweenFrames = 1000 / 26;
else
_millisBetweenFrames = 1000 / _fps;
}
}
bool VideoPlayer::playFrame() {
bool end = true;

View File

@ -48,15 +48,21 @@ protected:
virtual uint16 loadInternal() = 0;
virtual bool playFrameInternal() = 0;
void setOverrideSpeed(bool isOverride);
bool getOverrideSpeed() const { return _overrideSpeed; }
GroovieEngine *_vm;
OSystem *_syst;
Common::SeekableReadStream *_file;
uint16 _flags;
Audio::QueuingAudioStream *_audioStream;
private:
// Synchronization stuff
bool _begunPlaying;
bool _overrideSpeed;
uint16 _fps;
uint16 _millisBetweenFrames;
uint32 _lastFrameTime;

View File

@ -65,7 +65,7 @@ static void debugScript(int level, bool nl, const char *s, ...) {
Script::Script(GroovieEngine *vm, EngineVersion version) :
_code(NULL), _savedCode(NULL), _stacktop(0), _debugger(NULL), _vm(vm),
_videoFile(NULL), _videoRef(0), _staufsMove(NULL) {
_videoFile(NULL), _videoRef(0), _staufsMove(NULL), _lastCursor(0xff) {
// Initialize the opcode set depending on the engine version
switch (version) {
case kGroovieT7G:
@ -387,6 +387,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
// If clicked with the mouse, jump to the specified address
if (_mouseClicked) {
_lastCursor = cursor;
_inputAction = address;
}
}
@ -579,11 +580,14 @@ bool Script::playvideofromref(uint32 fileref) {
if (_videoFile) {
_videoRef = fileref;
if (_lastCursor == 7)
_bitflags |= (1 << 15);
_vm->_videoPlayer->load(_videoFile, _bitflags);
} else {
error("Couldn't open file");
return true;
}
_lastCursor = 0xff;
_bitflags = 0;

View File

@ -75,6 +75,7 @@ private:
Common::RandomSource _random;
bool _firstbit;
uint8 _lastCursor;
// Script filename (for debugging purposes)
Common::String _scriptFile;

View File

@ -86,6 +86,11 @@ uint16 VDXPlayer::loadInternal() {
_flagEight = ((_flags & (1 << 8)) != 0);
_flagNine = ((_flags & (1 << 9)) != 0);
// Enable highspeed if we're not obeying fps, and not marked as special
// This will be disabled in chunk audio if we're actually an audio vdx
if ( _vm->_modeSpeed == kGroovieSpeediOS || (_vm->_modeSpeed == kGroovieSpeedTweaked && ((_flags & (1 << 15)) == 0)))
setOverrideSpeed(true);
if (_flagOnePrev && !_flagOne && !_flagEight) {
_flagSeven = true;
}
@ -522,6 +527,11 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colours, uint16 imageWidth
}
void VDXPlayer::chunkSound(Common::ReadStream *in) {
if (getOverrideSpeed())
{
setOverrideSpeed(false);
}
if (!_audioStream) {
_audioStream = Audio::makeQueuingAudioStream(22050, false);
Audio::SoundHandle sound_handle;