diff --git a/AUTHORS b/AUTHORS index e13de73a45da..e2c28b4ba6b9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -89,7 +89,9 @@ ScummVM Team DreamWeb: Torbjorn Andersson Bertrand Augereau + Filippos Karapetis Vladimir Menshakov - (retired) + Willem Jan Palenstijn Gob: Torbjorn Andersson @@ -421,10 +423,10 @@ Other contributions Matteo Angelino Norwegian (Bokmaal): - Einar Johan T. Somaae + Einar Johan Somaaen Norwegian (Nynorsk): - Einar Johan T. Somaae + Einar Johan Somaaen Polish: GrajPoPolsku.pl Team @@ -600,6 +602,13 @@ Special thanks to Broken Sword 2.5 team for providing sources of their engine and their great support. + Neil Dodwell and David Dew from Creative Reality for providing the source + of Dreamweb and for their tremendous support. + + Janusz Wisniewski and Miroslaw Liminowicz from Laboratorium Komputerowe + Avalon for providing full source code for Soltys and letting us to + redistribute the game. + Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for providing the source code of The Journeyman Project: Pegasus Prime. diff --git a/NEWS b/NEWS index 9fde25e3f38c..fc5ad8a67e59 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,15 @@ For a more comprehensive changelog of the latest experimental code, see: https://github.com/scummvm/scummvm/commits/ -1.5.0 (????-??-??) +1.6.0 (????-??-??) + General: + - Added a new save/load chooser based on a grid of thumbnails. This is only + supported for resolutions bigger than 640x400. The old chooser is still + available and used for games without thumbnail support. It is possible to + select the old one as default too. + - Rewrote VideoDecoder subsystem. + +1.5.0 (2012-07-27) New Games: - Added support for Backyard Baseball 2003. - Added support for Blue Force. @@ -9,10 +17,7 @@ For a more comprehensive changelog of the latest experimental code, see: - Added support for Dreamweb. - Added support for Geisha. - Added support for Gregory and the Hot Air Balloon. - - Added support for Magic Tales: Baba Yaga and the Magic Geese. - - Added support for Magic Tales: Imo and the King. - Added support for Magic Tales: Liam Finds a Story. - - Added support for Magic Tales: The Little Samurai. - Added support for Once Upon A Time: Little Red Riding Hood - Added support for Sleeping Cub's Test of Courage. - Added support for Soltys. @@ -33,12 +38,10 @@ For a more comprehensive changelog of the latest experimental code, see: - Improved predictive dialog look. - Various GUI improvements. - SDL ports: - - Added support for OpenGL (GSoC Task). - Broken Sword 1: - Fixed incorrect sound effects in the DOS/Windows demo. - Added support for PlayStation videos. + - Fixed missing subtitles in the demo. Broken Sword 2: - Added support for PlayStation videos. @@ -46,6 +49,10 @@ For a more comprehensive changelog of the latest experimental code, see: Cine: - Implemented Roland MT-32 output driver. + Drascula: + - Added Spanish subtitles in the Von Braun cutscene (#3069981: no subtitles + in scene with "von Braun"). + Gob: - Fixed a crash in Lost in Time - Rewrote the AdLib player. Enabled the now working MDY player in @@ -63,6 +70,10 @@ For a more comprehensive changelog of the latest experimental code, see: - Added aspect ratio correction feature. - Implemented 16 bits per pixel support for games. + Maemo port: + - Added support for Nokia 770 running OS2008 HE. + - Added configurable keymap. + Windows port: - Changed default savegames location for Windows NT4/2000/XP/Vista/7. (The migration batch file can be used to copy savegames from the old diff --git a/README b/README index 722f3298d3da..bbca0ec0cd7b 100644 --- a/README +++ b/README @@ -2084,7 +2084,7 @@ Sierra games using the SCI engine add the following non-standard keywords: originalsaveload bool If true, the original save/load screens are used instead of the enhanced ScummVM ones native_fb01 bool If true, the music driver for an IBM Music - Feature card or a Yahama FB-01 FM synth module + Feature card or a Yamaha FB-01 FM synth module is used for MIDI output Broken Sword II adds the following non-standard keywords: @@ -2125,7 +2125,7 @@ Lands of Lore: The Throne of Chaos adds the following non-standard keywords: Space Quest IV CD adds the following non-standard keyword: silver_cursors bool If true, an alternate set of silver mouse cursors - is used instead of the original golden ones + is used instead of the original golden ones Simon the Sorcerer 1 and 2 add the following non-standard keywords: diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp index 1c5c43535977..6e185702f072 100644 --- a/audio/audiostream.cpp +++ b/audio/audiostream.cpp @@ -386,4 +386,42 @@ Timestamp convertTimeToStreamPos(const Timestamp &where, int rate, bool isStereo return Timestamp(result.secs(), result.numberOfFrames(), result.framerate()); } +/** + * An AudioStream wrapper that cuts off the amount of samples read after a + * given time length is reached. + */ +class LimitingAudioStream : public AudioStream { +public: + LimitingAudioStream(AudioStream *parentStream, const Audio::Timestamp &length, DisposeAfterUse::Flag disposeAfterUse) : + _parentStream(parentStream), _samplesRead(0), _disposeAfterUse(disposeAfterUse), + _totalSamples(length.convertToFramerate(getRate()).totalNumberOfFrames() * getChannels()) {} + + ~LimitingAudioStream() { + if (_disposeAfterUse == DisposeAfterUse::YES) + delete _parentStream; + } + + int readBuffer(int16 *buffer, const int numSamples) { + // Cap us off so we don't read past _totalSamples + int samplesRead = _parentStream->readBuffer(buffer, MIN(numSamples, _totalSamples - _samplesRead)); + _samplesRead += samplesRead; + return samplesRead; + } + + bool endOfData() const { return _parentStream->endOfData() || _samplesRead >= _totalSamples; } + bool isStereo() const { return _parentStream->isStereo(); } + int getRate() const { return _parentStream->getRate(); } + +private: + int getChannels() const { return isStereo() ? 2 : 1; } + + AudioStream *_parentStream; + DisposeAfterUse::Flag _disposeAfterUse; + uint32 _totalSamples, _samplesRead; +}; + +AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse) { + return new LimitingAudioStream(parentStream, length, disposeAfterUse); +} + } // End of namespace Audio diff --git a/audio/audiostream.h b/audio/audiostream.h index 801f13d9d937..d6d4a1628074 100644 --- a/audio/audiostream.h +++ b/audio/audiostream.h @@ -356,6 +356,16 @@ QueuingAudioStream *makeQueuingAudioStream(int rate, bool stereo); */ Timestamp convertTimeToStreamPos(const Timestamp &where, int rate, bool isStereo); +/** + * Factory function for an AudioStream wrapper that cuts off the amount of samples read after a + * given time length is reached. + * + * @param parentStream The stream to limit + * @param length The time length to limit the stream to + * @param disposeAfterUse Whether the parent stream object should be destroyed on destruction of the returned stream + */ +AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + } // End of namespace Audio #endif diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp index 535652a0b3c3..2fe509e1f30a 100644 --- a/audio/decoders/adpcm.cpp +++ b/audio/decoders/adpcm.cpp @@ -71,13 +71,19 @@ int Oki_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) { int samples; byte data; - assert(numSamples % 2 == 0); + for (samples = 0; samples < numSamples && !endOfData(); samples++) { + if (_decodedSampleCount == 0) { + data = _stream->readByte(); + _decodedSamples[0] = decodeOKI((data >> 4) & 0x0f); + _decodedSamples[1] = decodeOKI((data >> 0) & 0x0f); + _decodedSampleCount = 2; + } - for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) { - data = _stream->readByte(); - buffer[samples] = decodeOKI((data >> 4) & 0x0f); - buffer[samples + 1] = decodeOKI(data & 0x0f); + // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2 + buffer[samples] = _decodedSamples[1 - (_decodedSampleCount - 1)]; + _decodedSampleCount--; } + return samples; } @@ -117,13 +123,19 @@ int DVI_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) { int samples; byte data; - assert(numSamples % 2 == 0); + for (samples = 0; samples < numSamples && !endOfData(); samples++) { + if (_decodedSampleCount == 0) { + data = _stream->readByte(); + _decodedSamples[0] = decodeIMA((data >> 4) & 0x0f, 0); + _decodedSamples[1] = decodeIMA((data >> 0) & 0x0f, _channels == 2 ? 1 : 0); + _decodedSampleCount = 2; + } - for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) { - data = _stream->readByte(); - buffer[samples] = decodeIMA((data >> 4) & 0x0f); - buffer[samples + 1] = decodeIMA(data & 0x0f, _channels == 2 ? 1 : 0); + // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2 + buffer[samples] = _decodedSamples[1 - (_decodedSampleCount - 1)]; + _decodedSampleCount--; } + return samples; } diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h index 31747aabaf5b..3b8d8c74d035 100644 --- a/audio/decoders/adpcm_intern.h +++ b/audio/decoders/adpcm_intern.h @@ -37,7 +37,6 @@ #include "common/stream.h" #include "common/textconsole.h" - namespace Audio { class ADPCMStream : public RewindableAudioStream { @@ -64,12 +63,11 @@ class ADPCMStream : public RewindableAudioStream { ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign); virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos); } - virtual bool isStereo() const { return _channels == 2; } - virtual int getRate() const { return _rate; } + virtual bool isStereo() const { return _channels == 2; } + virtual int getRate() const { return _rate; } virtual bool rewind(); - /** * This table is used by some ADPCM variants (IMA and OKI) to adjust the * step for use on the next sample. @@ -83,12 +81,18 @@ class ADPCMStream : public RewindableAudioStream { class Oki_ADPCMStream : public ADPCMStream { public: Oki_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign) - : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {} + : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; } + + virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); } virtual int readBuffer(int16 *buffer, const int numSamples); protected: int16 decodeOKI(byte); + +private: + uint8 _decodedSampleCount; + int16 _decodedSamples[2]; }; class Ima_ADPCMStream : public ADPCMStream { @@ -108,9 +112,15 @@ class Ima_ADPCMStream : public ADPCMStream { class DVI_ADPCMStream : public Ima_ADPCMStream { public: DVI_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign) - : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {} + : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { _decodedSampleCount = 0; } + + virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); } virtual int readBuffer(int16 *buffer, const int numSamples); + +private: + uint8 _decodedSampleCount; + int16 _decodedSamples[2]; }; class Apple_ADPCMStream : public Ima_ADPCMStream { diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp index 31405d3ab146..732de311aa74 100644 --- a/audio/decoders/qdm2.cpp +++ b/audio/decoders/qdm2.cpp @@ -689,7 +689,7 @@ static int getVlc2(Common::BitStream *s, int16 (*table)[2], int bits, int maxDep code = table[index][0]; n = table[index][1]; - if(maxDepth > 2 && n < 0) { + if (maxDepth > 2 && n < 0) { s->skip(nbBits); index = s->getBits(-n) + code; code = table[index][0]; @@ -861,9 +861,9 @@ void initVlcSparse(VLC *vlc, int nb_bits, int nb_codes, const void *symbols, int symbols_wrap, int symbols_size) { vlc->bits = nb_bits; - if(vlc->table_size && vlc->table_size == vlc->table_allocated) { + if (vlc->table_size && vlc->table_size == vlc->table_allocated) { return; - } else if(vlc->table_size) { + } else if (vlc->table_size) { error("called on a partially initialized table"); } @@ -1353,7 +1353,7 @@ void QDM2Stream::fix_coding_method_array(int sb, int channels, sb_int8_array cod for (ch = 0; ch < channels; ch++) { for (j = 0; j < 64; ) { - if((coding_method[ch][sb][j] - 8) > 22) { + if ((coding_method[ch][sb][j] - 8) > 22) { run = 1; case_val = 8; } else { diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp index 8874a61c2e9a..5276cfc530e8 100644 --- a/audio/decoders/quicktime.cpp +++ b/audio/decoders/quicktime.cpp @@ -61,41 +61,6 @@ class SilentAudioStream : public AudioStream { bool _isStereo; }; -/** - * An AudioStream wrapper that cuts off the amount of samples read after a - * given time length is reached. - */ -class LimitingAudioStream : public AudioStream { -public: - LimitingAudioStream(AudioStream *parentStream, const Audio::Timestamp &length, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) : - _parentStream(parentStream), _samplesRead(0), _disposeAfterUse(disposeAfterUse), - _totalSamples(length.convertToFramerate(getRate()).totalNumberOfFrames() * getChannels()) {} - - ~LimitingAudioStream() { - if (_disposeAfterUse == DisposeAfterUse::YES) - delete _parentStream; - } - - int readBuffer(int16 *buffer, const int numSamples) { - // Cap us off so we don't read past _totalSamples - int samplesRead = _parentStream->readBuffer(buffer, MIN(numSamples, _totalSamples - _samplesRead)); - _samplesRead += samplesRead; - return samplesRead; - } - - bool endOfData() const { return _parentStream->endOfData() || _samplesRead >= _totalSamples; } - bool isStereo() const { return _parentStream->isStereo(); } - int getRate() const { return _parentStream->getRate(); } - -private: - int getChannels() const { return isStereo() ? 2 : 1; } - - AudioStream *_parentStream; - DisposeAfterUse::Flag _disposeAfterUse; - uint32 _totalSamples, _samplesRead; -}; - /** * An AudioStream wrapper that forces audio to be played in mono. * It currently just ignores the right channel if stereo. @@ -263,7 +228,7 @@ void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueAudio(const Timestamp &len _skipSamples = Timestamp(); } - queueStream(new LimitingAudioStream(new SilentAudioStream(getRate(), isStereo()), editLength), editLength); + queueStream(makeLimitingAudioStream(new SilentAudioStream(getRate(), isStereo()), editLength), editLength); _curEdit++; enterNewEdit(nextEditTime); } else { @@ -289,7 +254,7 @@ void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueAudio(const Timestamp &len // we move on to the next edit if (trackPosition >= nextEditTime || _curChunk >= _parentTrack->chunkCount) { chunkLength = nextEditTime.convertToFramerate(getRate()) - getCurrentTrackTime(); - stream = new LimitingAudioStream(stream, chunkLength); + stream = makeLimitingAudioStream(stream, chunkLength); _curEdit++; enterNewEdit(nextEditTime); diff --git a/audio/mixer.h b/audio/mixer.h index e38e052bef58..a0060f2e1a4a 100644 --- a/audio/mixer.h +++ b/audio/mixer.h @@ -97,7 +97,7 @@ class Mixer : Common::NonCopyable { * @param stream the actual AudioStream to be played * @param id a unique id assigned to this stream * @param volume the volume with which to play the sound, ranging from 0 to 255 - * @param balance the balance with which to play the sound, ranging from -128 to 127 + * @param balance the balance with which to play the sound, ranging from -127 to 127 (full left to full right), 0 is balanced, -128 is invalid * @param autofreeStream a flag indicating whether the stream should be * freed after playback finished * @param permanent a flag indicating whether a plain stopAll call should diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp index b4e106b790e3..91118d36c145 100644 --- a/backends/events/gph/gph-events.cpp +++ b/backends/events/gph/gph-events.cpp @@ -161,49 +161,6 @@ GPHEventSource::GPHEventSource() : _buttonStateL(false) { } -void GPHEventSource::moveStick() { - bool stickBtn[32]; - - memcpy(stickBtn, _stickBtn, sizeof(stickBtn)); - - if ((stickBtn[0]) || (stickBtn[2]) || (stickBtn[4]) || (stickBtn[6])) - stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0; - - if ((stickBtn[1]) || (stickBtn[2]) || (stickBtn[3])) { - if (_km.x_down_count != 2) { - _km.x_vel = -1; - _km.x_down_count = 1; - } else - _km.x_vel = -4; - } else if ((stickBtn[5]) || (stickBtn[6]) || (stickBtn[7])) { - if (_km.x_down_count != 2) { - _km.x_vel = 1; - _km.x_down_count = 1; - } else - _km.x_vel = 4; - } else { - _km.x_vel = 0; - _km.x_down_count = 0; - } - - if ((stickBtn[0]) || (stickBtn[1]) || (stickBtn[7])) { - if (_km.y_down_count != 2) { - _km.y_vel = -1; - _km.y_down_count = 1; - } else - _km.y_vel = -4; - } else if ((stickBtn[3]) || (stickBtn[4]) || (stickBtn[5])) { - if (_km.y_down_count != 2) { - _km.y_vel = 1; - _km.y_down_count = 1; - } else - _km.y_vel = 4; - } else { - _km.y_vel = 0; - _km.y_down_count = 0; - } -} - /* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */ bool GPHEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { @@ -268,19 +225,110 @@ bool GPHEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) { - _stickBtn[ev.jbutton.button] = 1; event.kbd.flags = 0; switch (ev.jbutton.button) { case BUTTON_UP: - case BUTTON_UPLEFT: - case BUTTON_LEFT: - case BUTTON_DOWNLEFT: + if (_km.y_down_count != 2) { + _km.y_vel = -1; + _km.y_down_count = 1; + } else { + _km.y_vel = -4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; case BUTTON_DOWN: - case BUTTON_DOWNRIGHT: + if (_km.y_down_count != 2) { + _km.y_vel = 1; + _km.y_down_count = 1; + } else { + _km.y_vel = 4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; + case BUTTON_LEFT: + if (_km.x_down_count != 2) { + _km.x_vel = -1; + _km.x_down_count = 1; + } else { + _km.x_vel = -4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; case BUTTON_RIGHT: + if (_km.x_down_count != 3) { + _km.x_vel = 1; + _km.x_down_count = 1; + } else { + _km.x_vel = 4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; + case BUTTON_UPLEFT: + if (_km.x_down_count != 2) { + _km.x_vel = -1; + _km.x_down_count = 1; + } else { + _km.x_vel = -4; + } + if (_km.y_down_count != 2) { + _km.y_vel = -1; + _km.y_down_count = 1; + } else { + _km.y_vel = -4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; case BUTTON_UPRIGHT: - moveStick(); + if (_km.x_down_count != 2) { + _km.x_vel = 1; + _km.x_down_count = 1; + } else { + _km.x_vel = 4; + } + if (_km.y_down_count != 2) { + _km.y_vel = -1; + _km.y_down_count = 1; + } else { + _km.y_vel = -4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; + case BUTTON_DOWNLEFT: + if (_km.x_down_count != 2) { + _km.x_vel = -1; + _km.x_down_count = 1; + } else { + _km.x_vel = -4; + } + if (_km.y_down_count != 2) { + _km.y_vel = 1; + _km.y_down_count = 1; + } else { + _km.y_vel = 4; + } + event.type = Common::EVENT_MOUSEMOVE; + processMouseEvent(event, _km.x, _km.y); + break; + case BUTTON_DOWNRIGHT: + if (_km.x_down_count != 2) { + _km.x_vel = 1; + _km.x_down_count = 1; + } else { + _km.x_vel = 4; + } + if (_km.y_down_count != 2) { + _km.y_vel = 1; + _km.y_down_count = 1; + } else { + _km.y_vel = 4; + } event.type = Common::EVENT_MOUSEMOVE; processMouseEvent(event, _km.x, _km.y); break; @@ -391,7 +439,6 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) { bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) { - _stickBtn[ev.jbutton.button] = 0; event.kbd.flags = 0; switch (ev.jbutton.button) { @@ -403,7 +450,10 @@ bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) { case BUTTON_DOWNRIGHT: case BUTTON_RIGHT: case BUTTON_UPRIGHT: - moveStick(); + _km.y_vel = 0; + _km.y_down_count = 0; + _km.x_vel = 0; + _km.x_down_count = 0; event.type = Common::EVENT_MOUSEMOVE; processMouseEvent(event, _km.x, _km.y); break; diff --git a/backends/events/gph/gph-events.h b/backends/events/gph/gph-events.h index 7672bffed280..3b1e6f090ae9 100644 --- a/backends/events/gph/gph-events.h +++ b/backends/events/gph/gph-events.h @@ -34,18 +34,11 @@ class GPHEventSource : public SdlEventSource { GPHEventSource(); protected: - bool _stickBtn[32]; - /** * Button state for L button modifier */ bool _buttonStateL; - /** - * Handles the stick movement - */ - void moveStick(); - bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event); bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event); bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index 205dcfdbec78..f515343d3c41 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -432,7 +432,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() { // Forcefully disable aspect ratio correction for games // which starts with a native 240px height resolution. // This fixes games with weird resolutions, like MM Nes (256x240) - if(_videoMode.screenHeight == 240) { + if (_videoMode.screenHeight == 240) { _videoMode.aspectRatioCorrection = false; } diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 8521e88eafeb..92553564bfc8 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -486,7 +486,13 @@ bool GPHGraphicsManager::loadGFXMode() { if (_videoMode.aspectRatioCorrection) _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); } - return SurfaceSdlGraphicsManager::loadGFXMode(); + SurfaceSdlGraphicsManager::loadGFXMode(); + + // The old GP2X hacked SDL needs this after any call to SDL_SetVideoMode + // and it does not hurt other devices. + SDL_ShowCursor(SDL_DISABLE); + + return true; } bool GPHGraphicsManager::hasFeature(OSystem::Feature f) { diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index dce902d89429..48e2663d4490 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -902,7 +902,7 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat, bpp = 4; intFormat = GL_RGBA; glFormat = GL_RGBA; - gltype = GL_UNSIGNED_BYTE; + gltype = GL_UNSIGNED_INT_8_8_8_8; } else if (pixelFormat == Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) { // RGB888 bpp = 3; intFormat = GL_RGB; @@ -918,11 +918,6 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat, intFormat = GL_RGBA; glFormat = GL_RGBA; gltype = GL_UNSIGNED_SHORT_5_5_5_1; - } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555 - bpp = 2; - intFormat = GL_RGB; - glFormat = GL_BGRA; - gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV; } else if (pixelFormat == Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) { // RGBA4444 bpp = 2; intFormat = GL_RGBA; @@ -936,6 +931,13 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat, glFormat = GL_RGB; gltype = GL_UNSIGNED_BYTE; #ifndef USE_GLES + } else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555 + // GL_BGRA does not exist in every GLES implementation so should not be configured if + // USE_GLES is set. + bpp = 2; + intFormat = GL_RGB; + glFormat = GL_BGRA; + gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV; } else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)) { // ARGB8888 bpp = 4; intFormat = GL_RGBA; diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp index 5f0301a0c8e5..f371081fdeff 100644 --- a/backends/graphics/openpandora/op-graphics.cpp +++ b/backends/graphics/openpandora/op-graphics.cpp @@ -26,28 +26,59 @@ #include "backends/graphics/openpandora/op-graphics.h" #include "backends/events/openpandora/op-events.h" -//#include "backends/platform/openpandora/op-sdl.h" #include "graphics/scaler/aspect.h" #include "common/mutex.h" #include "common/textconsole.h" +static SDL_Cursor *hiddenCursor; + OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource) : SurfaceSdlGraphicsManager(sdlEventSource) { } bool OPGraphicsManager::loadGFXMode() { - /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL - deal with the boarders (it saves cleaning up the overlay when the game screen is - smaller than the overlay ;) + + uint8_t hiddenCursorData = 0; + hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); + + /* On the OpenPandora we need to work around an SDL assumption that + returns relative mouse coordinates when you get to the screen + edges using the touchscreen. The workaround is to set a blank + SDL cursor and not disable it (Hackish I know). + + The root issues likes in the Windows Manager GRAB code in SDL. + That is why the issue is not seen on framebuffer devices like the + GP2X (there is no X window manager ;)). */ - _videoMode.overlayWidth = 640; - _videoMode.overlayHeight = 480; + SDL_ShowCursor(SDL_ENABLE); + SDL_SetCursor(hiddenCursor); + _videoMode.fullscreen = true; + _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) _videoMode.aspectRatioCorrection = false; + if (_videoMode.aspectRatioCorrection) + _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); + + _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.hardwareHeight = effectiveScreenHeight(); + return SurfaceSdlGraphicsManager::loadGFXMode(); } +void OPGraphicsManager::unloadGFXMode() { + + uint8_t hiddenCursorData = 0; + hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); + + // Free the hidden SDL cursor created in loadGFXMode + SDL_FreeCursor(hiddenCursor); + + SurfaceSdlGraphicsManager::unloadGFXMode(); +} + #endif diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h index 0b3eeae8ec31..2e3d63e3ad0f 100644 --- a/backends/graphics/openpandora/op-graphics.h +++ b/backends/graphics/openpandora/op-graphics.h @@ -24,7 +24,6 @@ #define BACKENDS_GRAPHICS_OP_H #include "backends/graphics/surfacesdl/surfacesdl-graphics.h" -#include "graphics/scaler/aspect.h" // for aspect2Real #include "graphics/scaler/downscaler.h" enum { @@ -35,28 +34,8 @@ class OPGraphicsManager : public SurfaceSdlGraphicsManager { public: OPGraphicsManager(SdlEventSource *sdlEventSource); -// bool hasFeature(OSystem::Feature f); -// void setFeatureState(OSystem::Feature f, bool enable); -// bool getFeatureState(OSystem::Feature f); -// int getDefaultGraphicsMode() const; - -// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL); -// const OSystem::GraphicsMode *getSupportedGraphicsModes() const; -// bool setGraphicsMode(const char *name); -// bool setGraphicsMode(int mode); -// void setGraphicsModeIntern(); -// void internUpdateScreen(); -// void showOverlay(); -// void hideOverlay(); bool loadGFXMode(); -// void drawMouse(); -// void undrawMouse(); -// virtual void warpMouse(int x, int y); - -// SurfaceSdlGraphicsManager::MousePos *getMouseCurState(); -// SurfaceSdlGraphicsManager::VideoState *getVideoMode(); - -// virtual void adjustMouseEvent(const Common::Event &event); + void unloadGFXMode(); }; #endif /* BACKENDS_GRAPHICS_OP_H */ diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk index 2e8fd6215267..9292a16595d6 100644 --- a/backends/platform/android/android.mk +++ b/backends/platform/android/android.mk @@ -130,7 +130,18 @@ $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png: $(PATH_RESOURCES)/drawable/scum $(FILE_RESOURCES_MAIN): $(FILE_MANIFEST) $(RESOURCES) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(INSTALL) -d $(PATH_BUILD_ASSETS) $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/ - $(AAPT) package -f -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@ + work_dir=`pwd`; \ + for i in $(PATH_BUILD_ASSETS)/*.zip; do \ + echo "recompress $$i"; \ + cd $$work_dir; \ + $(RM) -rf $(PATH_BUILD_ASSETS)/tmp; \ + $(MKDIR) $(PATH_BUILD_ASSETS)/tmp; \ + unzip -q $$i -d $(PATH_BUILD_ASSETS)/tmp; \ + cd $(PATH_BUILD_ASSETS)/tmp; \ + zip -r ../`basename $$i` *; \ + done + @$(RM) -rf $(PATH_BUILD_ASSETS)/tmp + $(AAPT) package -f -0 zip -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@ $(PATH_BUILD)/%/$(FILE_RESOURCES): $(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png plugins/lib%.so $(ANDROID_JAR8) $(AAPT) package -f -M $< -S $(PATH_STAGE_PREFIX).$*/res -I $(ANDROID_JAR8) -F $@ diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 95c96e0d25d7..b174e93191c4 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -52,9 +52,6 @@ // Supported GL extensions static bool npot_supported = false; -#ifdef GL_OES_draw_texture -static bool draw_tex_supported = false; -#endif static inline GLfixed xdiv(int numerator, int denominator) { assert(numerator < (1 << 16)); @@ -85,11 +82,6 @@ void GLESBaseTexture::initGLExtensions() { if (token == "GL_ARB_texture_non_power_of_two") npot_supported = true; - -#ifdef GL_OES_draw_texture - if (token == "GL_OES_draw_texture") - draw_tex_supported = true; -#endif } } @@ -180,45 +172,28 @@ void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) { void GLESBaseTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name)); -#ifdef GL_OES_draw_texture - // Great extension, but only works under specific conditions. - // Still a work-in-progress - disabled for now. - if (false && draw_tex_supported && !hasPalette()) { - //GLCALL(glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)); - const GLint crop[4] = { 0, _surface.h, _surface.w, -_surface.h }; + const GLfixed tex_width = xdiv(_surface.w, _texture_width); + const GLfixed tex_height = xdiv(_surface.h, _texture_height); + const GLfixed texcoords[] = { + 0, 0, + tex_width, 0, + 0, tex_height, + tex_width, tex_height, + }; - GLCALL(glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop)); + GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords)); - // Android GLES bug? - GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff)); + const GLshort vertices[] = { + x, y, + x + w, y, + x, y + h, + x + w, y + h, + }; - GLCALL(glDrawTexiOES(x, y, 0, w, h)); - } else -#endif - { - const GLfixed tex_width = xdiv(_surface.w, _texture_width); - const GLfixed tex_height = xdiv(_surface.h, _texture_height); - const GLfixed texcoords[] = { - 0, 0, - tex_width, 0, - 0, tex_height, - tex_width, tex_height, - }; - - GLCALL(glTexCoordPointer(2, GL_FIXED, 0, texcoords)); - - const GLshort vertices[] = { - x, y, - x + w, y, - x, y + h, - x + w, y + h, - }; - - GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices)); - - assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords)); - GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2)); - } + GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices)); + + assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords)); + GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2)); clearDirty(); } diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index 816a6755fc58..3f862c2571b6 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -21,6 +21,7 @@ */ #include +#include #include "common/config-manager.h" #include "common/file.h" @@ -42,7 +43,9 @@ using namespace Osp::Base; using namespace Osp::Base::Runtime; +using namespace Osp::Locales; using namespace Osp::Ui::Controls; +using namespace Osp::System; #define DEFAULT_CONFIG_FILE "/Home/scummvm.ini" #define RESOURCE_PATH "/Res" @@ -305,7 +308,7 @@ void BadaSystem::initBackend() { ConfMan.registerDefault("aspect_ratio", false); ConfMan.setBool("confirm_exit", false); - Osp::System::SystemTime::GetTicks(_epoch); + SystemTime::GetTicks(_epoch); if (E_SUCCESS != initModules()) { AppLog("initModules failed"); @@ -372,7 +375,7 @@ bool BadaSystem::pollEvent(Common::Event &event) { uint32 BadaSystem::getMillis() { long long result, ticks = 0; - Osp::System::SystemTime::GetTicks(ticks); + SystemTime::GetTicks(ticks); result = ticks - _epoch; return result; } @@ -392,18 +395,18 @@ void BadaSystem::updateScreen() { void BadaSystem::getTimeAndDate(TimeDate &td) const { DateTime currentTime; - if (E_SUCCESS == Osp::System::SystemTime::GetCurrentTime(currentTime)) { + if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) { td.tm_sec = currentTime.GetSecond(); td.tm_min = currentTime.GetMinute(); td.tm_hour = currentTime.GetHour(); td.tm_mday = currentTime.GetDay(); td.tm_mon = currentTime.GetMonth(); td.tm_year = currentTime.GetYear(); -#ifdef RELEASE_BUILD - #error getTimeAndDate() is not setting the day of the week -#else - td.tm_wday = 0; // FIXME -#endif + + Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + calendar->SetTime(currentTime); + td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1; + delete calendar; } } diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index e06dd7fa434c..ba3b787942be 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -316,8 +316,9 @@ class OutVMSave : public Common::OutSaveFile { class VMSaveManager : public Common::SaveFileManager { public: - virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { - return Common::wrapCompressedWriteStream(new OutVMSave(filename.c_str())); + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { + OutVMSave *s = new OutVMSave(filename.c_str()); + return compress ? Common::wrapCompressedWriteStream(s) : s; } virtual Common::InSaveFile *openForLoading(const Common::String &filename) { diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index 03729c5e6e51..3192e2d27702 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -45,7 +45,7 @@ static Common::String getSavePath() { // GBAMP Save File Manager ////////////////////////// -Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename) { +Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename, bool compress) { Common::String fileSpec = getSavePath(); if (fileSpec.lastChar() != '/') fileSpec += '/'; diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index 492054dc5290..0d9d9aca8c71 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -27,7 +27,7 @@ class GBAMPSaveFileManager : public Common::SaveFileManager { public: - virtual Common::OutSaveFile *openForSaving(const Common::String &filename); + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true); virtual Common::InSaveFile *openForLoading(const Common::String &filename); virtual bool removeSavefile(const Common::String &filename); diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index 49a1edf4112a..485780b47230 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -20,6 +20,8 @@ * */ +#if defined(GPH_DEVICE) + // Disable symbol overrides so that we can use system headers. #define FORBIDDEN_SYMBOL_ALLOW_ALL @@ -32,8 +34,6 @@ #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" -#include "base/main.h" - #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" @@ -64,23 +64,6 @@ void OSystem_GPH::initBackend() { assert(!_inited); - // Create the events manager - if (_eventSource == 0) - _eventSource = new GPHEventSource(); - - // Create the graphics manager - if (_graphicsManager == 0) { - _graphicsManager = new GPHGraphicsManager(_eventSource); - } - - // Create the mixer manager - if (_mixer == 0) { - _mixerManager = new DoubleBufferSDLMixerManager(); - - // Setup and start mixer - _mixerManager->init(); - } - /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; @@ -165,16 +148,42 @@ void OSystem_GPH::initBackend() { /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' at the bottom is ;-). */ ConfMan.registerDefault("aspect_ratio", true); + ConfMan.registerDefault("fullscreen", true); /* Make sure SDL knows that we have a joystick we want to use. */ ConfMan.setInt("joystick_num", 0); + // Create the events manager + if (_eventSource == 0) + _eventSource = new GPHEventSource(); + + // Create the graphics manager + if (_graphicsManager == 0) { + _graphicsManager = new GPHGraphicsManager(_eventSource); + } + /* Pass to POSIX method to do the heavy lifting */ OSystem_POSIX::initBackend(); _inited = true; } +void OSystem_GPH::initSDL() { + // Check if SDL has not been initialized + if (!_initedSDL) { + + uint32 sdlFlags = SDL_INIT_EVENTTHREAD; + if (ConfMan.hasKey("disable_sdl_parachute")) + sdlFlags |= SDL_INIT_NOPARACHUTE; + + // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers) + if (SDL_Init(sdlFlags) == -1) + error("Could not initialize SDL: %s", SDL_GetError()); + + _initedSDL = true; + } +} + void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { /* Setup default extra data paths for engine data files and plugins */ @@ -222,3 +231,5 @@ void OSystem_GPH::quit() { OSystem_POSIX::quit(); } + +#endif diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp index 2c43af151ffe..876de0f35842 100644 --- a/backends/platform/gph/gph-main.cpp +++ b/backends/platform/gph/gph-main.cpp @@ -21,7 +21,7 @@ */ #include "backends/platform/gph/gph.h" -#include "backends/plugins/posix/posix-provider.h" +#include "backends/plugins/sdl/sdl-provider.h" #include "base/main.h" #if defined(GPH_DEVICE) @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { ((OSystem_GPH *)g_system)->init(); #ifdef DYNAMIC_MODULES - PluginManager::instance().addPluginProvider(new POSIXPluginProvider()); + PluginManager::instance().addPluginProvider(new SDLPluginProvider()); #endif // Invoke the actual ScummVM main entry point: diff --git a/backends/platform/gph/gph.h b/backends/platform/gph/gph.h index 80f43f0bab74..90a798154f39 100644 --- a/backends/platform/gph/gph.h +++ b/backends/platform/gph/gph.h @@ -26,13 +26,11 @@ #if defined(GPH_DEVICE) #include "backends/base-backend.h" -#include "backends/platform/sdl/sdl.h" +#include "backends/platform/sdl/sdl-sys.h" #include "backends/platform/sdl/posix/posix.h" #include "backends/events/gph/gph-events.h" #include "backends/graphics/gph/gph-graphics.h" -#define __GP2XWIZ__ - #ifndef PATH_MAX #define PATH_MAX 255 #endif @@ -45,6 +43,11 @@ class OSystem_GPH : public OSystem_POSIX { void addSysArchivesToSearchSet(Common::SearchSet &s, int priority); void initBackend(); void quit(); + +protected: + bool _inited; + bool _initedSDL; + virtual void initSDL(); }; #endif diff --git a/backends/platform/maemo/debian/changelog b/backends/platform/maemo/debian/changelog index 8a9d8ee3c3f4..ea44574e96b3 100644 --- a/backends/platform/maemo/debian/changelog +++ b/backends/platform/maemo/debian/changelog @@ -1,8 +1,20 @@ -scummvm (1.5.0~git) unstable; urgency=low +scummvm (1.6.0~git) unstable; urgency=low * Development snapshot - -- Tarek Soliman Tue, 15 Nov 2011 14:56:57 -0600 + -- Tarek Soliman Tue, 10 Jul 2012 23:02:00 -0500 + +scummvm (1.5.0) unstable; urgency=low + + * 1.5.0 release + + -- Tarek Soliman Fri, 20 Jul 2012 14:48:44 -0500 + +scummvm (1.4.1) unstable; urgency=low + + * 1.4.1 release + + -- Tarek Soliman Wed, 11 Jan 2012 17:17:26 -0600 scummvm (1.4.0) unstable; urgency=low diff --git a/backends/platform/maemo/debian/control b/backends/platform/maemo/debian/control index 6e1dfe2fd417..bdaccd23595d 100644 --- a/backends/platform/maemo/debian/control +++ b/backends/platform/maemo/debian/control @@ -2,7 +2,7 @@ Source: scummvm Section: user/games Priority: optional Maintainer: Tarek Soliman -Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libz-dev, quilt +Build-Depends: debhelper (>> 4.0.0), libsdl1.2-dev, libmad0-dev, libasound2-dev, libvorbisidec-dev, libmpeg2-4-dev, libflac-dev (>= 1.1.2), libfreetype6-dev, libz-dev, quilt Standards-Version: 3.6.1.1 Package: scummvm diff --git a/backends/platform/maemo/debian/rules b/backends/platform/maemo/debian/rules index 64add08de895..43a34399a337 100755 --- a/backends/platform/maemo/debian/rules +++ b/backends/platform/maemo/debian/rules @@ -50,7 +50,7 @@ install: build install -m0644 dists/engine-data/drascula.dat dists/engine-data/hugo.dat dists/engine-data/kyra.dat dists/engine-data/lure.dat dists/engine-data/queen.tbl dists/engine-data/sky.cpt dists/engine-data/teenagent.dat dists/engine-data/toon.dat debian/scummvm/opt/scummvm/share install -m0644 -d debian/scummvm/usr/share/doc/scummvm - install -m0644 NEWS README COPYRIGHT debian/scummvm/usr/share/doc/scummvm + install -m0644 AUTHORS COPYING COPYING.BSD COPYING.FREEFONT COPYING.LGPL COPYRIGHT NEWS README debian/scummvm/usr/share/doc/scummvm binary: binary-arch binary-arch: build install diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp index e296d4787c46..6bd229177bb7 100644 --- a/backends/platform/maemo/maemo.cpp +++ b/backends/platform/maemo/maemo.cpp @@ -43,6 +43,7 @@ namespace Maemo { OSystem_SDL_Maemo::OSystem_SDL_Maemo() : + _eventObserver(0), OSystem_POSIX() { } @@ -84,6 +85,9 @@ static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymap #endif void OSystem_SDL_Maemo::initBackend() { + ConfMan.registerDefault("fullscreen", true); + ConfMan.registerDefault("aspect_ratio", true); + // Create the events manager if (_eventSource == 0) _eventSource = new MaemoSdlEventSource(); @@ -180,6 +184,7 @@ void OSystem_SDL_Maemo::setupIcon() { // http://bugzilla.libsdl.org/show_bug.cgi?id=586 } +#ifdef ENABLE_KEYMAPPER static const Common::KeyTableEntry maemoKeys[] = { // Function keys {"MENU", Common::KEYCODE_F11, 0, "Menu", false}, @@ -191,7 +196,6 @@ static const Common::KeyTableEntry maemoKeys[] = { {0, Common::KEYCODE_INVALID, 0, 0, false} }; -#ifdef ENABLE_KEYMAPPER Common::HardwareInputSet *OSystem_SDL_Maemo::getHardwareInputSet() { return new Common::HardwareInputSet(true, maemoKeys); } diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h index da553e423aaf..0a88c8666b5e 100644 --- a/backends/platform/n64/framfs_save_manager.h +++ b/backends/platform/n64/framfs_save_manager.h @@ -100,10 +100,10 @@ class OutFRAMSave : public Common::OutSaveFile { class FRAMSaveManager : public Common::SaveFileManager { public: - virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { OutFRAMSave *s = new OutFRAMSave(filename.c_str()); if (!s->err()) { - return Common::wrapCompressedWriteStream(s); + return compress ? Common::wrapCompressedWriteStream(s) : s; } else { delete s; return 0; diff --git a/backends/platform/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h index e0fcbc1e2d50..6e67fb0f5fba 100644 --- a/backends/platform/n64/pakfs_save_manager.h +++ b/backends/platform/n64/pakfs_save_manager.h @@ -101,10 +101,10 @@ class OutPAKSave : public Common::OutSaveFile { class PAKSaveManager : public Common::SaveFileManager { public: - virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { OutPAKSave *s = new OutPAKSave(filename.c_str()); if (!s->err()) { - return Common::wrapCompressedWriteStream(s); + return compress ? Common::wrapCompressedWriteStream(s) : s; } else { delete s; return NULL; diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp index dcec387f9799..354aa24b243c 100644 --- a/backends/platform/openpandora/op-backend.cpp +++ b/backends/platform/openpandora/op-backend.cpp @@ -54,53 +54,15 @@ /* Dump console info to files. */ #define DUMP_STDOUT -static SDL_Cursor *hiddenCursor; - OSystem_OP::OSystem_OP() : OSystem_POSIX() { } -//static Uint32 timer_handler(Uint32 interval, void *param) { -// ((DefaultTimerManager *)param)->handler(); -// return interval; -//} - void OSystem_OP::initBackend() { assert(!_inited); - // Create the events manager - if (_eventSource == 0) - _eventSource = new OPEventSource(); - - // Create the graphics manager - if (_graphicsManager == 0) { - _graphicsManager = new OPGraphicsManager(_eventSource); - } - -// int joystick_num = ConfMan.getInt("joystick_num"); -// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; -// -// if (ConfMan.hasKey("disable_sdl_parachute")) -// sdlFlags |= SDL_INIT_NOPARACHUTE; -// -// if (joystick_num > -1) -// sdlFlags |= SDL_INIT_JOYSTICK; -// -// if (SDL_Init(sdlFlags) == -1) { -// error("Could not initialize SDL: %s", SDL_GetError()); -// } -// - - // Create the mixer manager -// if (_mixer == 0) { -// _mixerManager = new DoubleBufferSDLMixerManager(); - - // Setup and start mixer -// _mixerManager->init(); -// } - /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; @@ -179,7 +141,14 @@ void OSystem_OP::initBackend() { /* Make sure SDL knows that we have a joystick we want to use. */ ConfMan.setInt("joystick_num", 0); -// _graphicsMutex = createMutex(); + // Create the events manager + if (_eventSource == 0) + _eventSource = new OPEventSource(); + + // Create the graphics manager + if (_graphicsManager == 0) { + _graphicsManager = new OPGraphicsManager(_eventSource); + } /* Pass to POSIX method to do the heavy lifting */ OSystem_POSIX::initBackend(); @@ -187,24 +156,6 @@ void OSystem_OP::initBackend() { _inited = true; } -// enable joystick -// if (joystick_num > -1 && SDL_NumJoysticks() > 0) { -// printf("Using joystick: %s\n", SDL_JoystickName(0)); -// _joystick = SDL_JoystickOpen(joystick_num); -// } -// -// setupMixer(); - -// Note: We could implement a custom SDLTimerManager by using -// SDL_AddTimer. That might yield better timer resolution, but it would -// also change the semantics of a timer: Right now, ScummVM timers -// *never* run in parallel, due to the way they are implemented. If we -// switched to SDL_AddTimer, each timer might run in a separate thread. -// However, not all our code is prepared for that, so we can't just -// switch. Still, it's a potential future change to keep in mind. -// _timer = new DefaultTimerManager(); -// _timerID = SDL_AddTimer(10, &timer_handler, _timer); - void OSystem_OP::initSDL() { // Check if SDL has not been initialized if (!_initedSDL) { @@ -217,38 +168,7 @@ void OSystem_OP::initSDL() { if (SDL_Init(sdlFlags) == -1) error("Could not initialize SDL: %s", SDL_GetError()); - uint8_t hiddenCursorData = 0; - - hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); - - /* On the OpenPandora we need to work around an SDL assumption that - returns relative mouse coordinates when you get to the screen - edges using the touchscreen. The workaround is to set a blank - SDL cursor and not disable it (Hackish I know). - - The root issues likes in the Windows Manager GRAB code in SDL. - That is why the issue is not seen on framebuffer devices like the - GP2X (there is no X window manager ;)). - */ - SDL_ShowCursor(SDL_ENABLE); - SDL_SetCursor(hiddenCursor); - SDL_EnableUNICODE(1); - -// memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); -// memset(&_videoMode, 0, sizeof(_videoMode)); -// memset(&_transactionDetails, 0, sizeof(_transactionDetails)); - -// _videoMode.mode = GFX_DOUBLESIZE; -// _videoMode.scaleFactor = 2; -// _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); -// _scalerProc = Normal2x; -// _scalerType = 0; - -// _videoMode.fullscreen = true; - _initedSDL = true; - -// OSystem_POSIX::initSDL(); } } @@ -275,8 +195,6 @@ void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { void OSystem_OP::quit() { - SDL_FreeCursor(hiddenCursor); - #ifdef DUMP_STDOUT printf("%s\n", "Debug: STDOUT and STDERR text files closed."); fclose(stdout); diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h index 8cccbb5f868e..1eddad5c4a67 100644 --- a/backends/platform/openpandora/op-sdl.h +++ b/backends/platform/openpandora/op-sdl.h @@ -31,8 +31,6 @@ #include "backends/events/openpandora/op-events.h" #include "backends/graphics/openpandora/op-graphics.h" -//#define MIXER_DOUBLE_BUFFERING 1 - #ifndef PATH_MAX #define PATH_MAX 255 #endif diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 421edc3e2e7e..46af42e19334 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -145,7 +145,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil return Common::wrapCompressedReadStream(sf); } -Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename) { +Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename, bool compress) { Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast? Common::WriteStream *sf; @@ -193,7 +193,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil } _screen->wantAnim(false); - return Common::wrapCompressedWriteStream(sf); + return compress ? Common::wrapCompressedWriteStream(sf) : sf; } bool Ps2SaveFileManager::removeSavefile(const Common::String &filename) { diff --git a/backends/platform/ps2/savefilemgr.h b/backends/platform/ps2/savefilemgr.h index a25fb063ae49..163706eace75 100644 --- a/backends/platform/ps2/savefilemgr.h +++ b/backends/platform/ps2/savefilemgr.h @@ -35,7 +35,7 @@ class Ps2SaveFileManager : public Common::SaveFileManager { virtual ~Ps2SaveFileManager(); virtual Common::InSaveFile *openForLoading(const Common::String &filename); - virtual Common::OutSaveFile *openForSaving(const Common::String &filename); + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true); virtual Common::StringArray listSavefiles(const Common::String &pattern); virtual bool removeSavefile(const Common::String &filename); diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP index bc0bd35a6e87..969459dc5bd7 100644 --- a/backends/platform/psp/README.PSP +++ b/backends/platform/psp/README.PSP @@ -1,4 +1,4 @@ -ScummVM-PSP 1.5.0git README +ScummVM-PSP 1.6.0git README ============================================================================== Installation diff --git a/backends/platform/webos/webos.cpp b/backends/platform/webos/webos.cpp index 4ec153a7e902..fc186282351a 100644 --- a/backends/platform/webos/webos.cpp +++ b/backends/platform/webos/webos.cpp @@ -45,24 +45,4 @@ void OSystem_SDL_WebOS::initBackend() { OSystem_SDL::initBackend(); } -/** - * Gets the original SDL hardware key set, adds WebOS specific keys and - * returns the new key set. - * - * @return The hardware key set with added webOS specific keys. - */ -#ifdef ENABLE_KEYMAPPER -HardwareInputSet *OSystem_SDL_WebOS::getHardwareInputSet() { - // Get the original SDL hardware key set - HardwareInputSet *inputSet = OSystem_SDL::getHardwareInputSet(); - - // Add WebOS specific keys - inputSet->addHardwareInput(new HardwareInput("FORWARD", - KeyState((KeyCode) 229, 229, 0), "Forward")); - - // Return the modified hardware key set - return inputSet; -} -#endif - #endif diff --git a/backends/platform/webos/webos.h b/backends/platform/webos/webos.h index 8dfa43239ce4..dda56a70da52 100644 --- a/backends/platform/webos/webos.h +++ b/backends/platform/webos/webos.h @@ -31,9 +31,6 @@ class OSystem_SDL_WebOS : public OSystem_POSIX { OSystem_SDL_WebOS(); virtual void initBackend(); -#ifdef ENABLE_KEYMAPPER - virtual Common::HardwareInputSet *getHardwareInputSet(); -#endif }; #endif diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 681675529aca..22a6495f8f4f 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -39,7 +39,7 @@ OSystem_Wii::OSystem_Wii() : _startup_time(0), - _cursorScale(1), + _cursorDontScale(true), _cursorPaletteDisabled(true), _cursorPalette(NULL), _cursorPaletteDirty(false), diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index abafa7f642d6..5d6998d0b61f 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -56,7 +56,7 @@ class OSystem_Wii : public EventsBaseBackend, public PaletteManager { private: s64 _startup_time; - int _cursorScale; + bool _cursorDontScale; bool _cursorPaletteDisabled; u16 *_cursorPalette; bool _cursorPaletteDirty; diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 90e4d98c6baf..fc0802dd4cbe 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -451,7 +451,7 @@ bool OSystem_Wii::needsScreenUpdate() { void OSystem_Wii::updateScreen() { static f32 ar; static gfx_screen_coords_t cc; - static int cs; + static f32 csx, csy; u32 now = getMillis(); if (now - _lastScreenUpdate < 1000 / MAX_FPS) @@ -466,7 +466,6 @@ void OSystem_Wii::updateScreen() { wii_memstats(); #endif - cs = _cursorScale; _lastScreenUpdate = now; if (_overlayVisible || _consoleVisible) @@ -488,12 +487,6 @@ void OSystem_Wii::updateScreen() { if (_gameRunning) ar = gfx_set_ar(4.0 / 3.0); - // ugly, but the modern theme sets a factor of 3, only god knows why - if (cs > 2) - cs = 1; - else - cs *= 2; - if (_overlayDirty) { gfx_tex_convert(&_texOverlay, _overlayPixels); _overlayDirty = false; @@ -503,10 +496,18 @@ void OSystem_Wii::updateScreen() { } if (_mouseVisible) { - cc.x = f32(_mouseX - cs * _mouseHotspotX) * _currentXScale; - cc.y = f32(_mouseY - cs * _mouseHotspotY) * _currentYScale; - cc.w = f32(_texMouse.width) * _currentXScale * cs; - cc.h = f32(_texMouse.height) * _currentYScale * cs; + if (_cursorDontScale) { + csx = 1.0f / _currentXScale; + csy = 1.0f / _currentYScale; + } else { + csx = 1.0f; + csy = 1.0f; + } + + cc.x = f32(_mouseX - csx * _mouseHotspotX) * _currentXScale; + cc.y = f32(_mouseY - csy * _mouseHotspotY) * _currentYScale; + cc.w = f32(_texMouse.width) * _currentXScale * csx; + cc.h = f32(_texMouse.height) * _currentYScale * csy; if (_texMouse.palette && _cursorPaletteDirty) { _texMouse.palette[_mouseKeyColor] = 0; @@ -745,8 +746,7 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, _mouseHotspotX = hotspotX; _mouseHotspotY = hotspotY; - // TODO: Adapt to new dontScale logic! - _cursorScale = 1; + _cursorDontScale = dontScale; if ((_texMouse.palette) && (oldKeycolor != _mouseKeyColor)) _cursorPaletteDirty = true; diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 237c50a1ba7a..64e7e778b604 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -97,7 +97,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String return Common::wrapCompressedReadStream(sf); } -Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) { +Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) { // Ensure that the savepath is valid. If not, generate an appropriate error. Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); @@ -112,7 +112,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String // Open the file for saving Common::WriteStream *sf = file.createWriteStream(); - return Common::wrapCompressedWriteStream(sf); + return compress ? Common::wrapCompressedWriteStream(sf) : sf; } bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) { diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index 1ea87efc6750..c7fca279bc5f 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -38,7 +38,7 @@ class DefaultSaveFileManager : public Common::SaveFileManager { virtual Common::StringArray listSavefiles(const Common::String &pattern); virtual Common::InSaveFile *openForLoading(const Common::String &filename); - virtual Common::OutSaveFile *openForSaving(const Common::String &filename); + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true); virtual bool removeSavefile(const Common::String &filename); protected: diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp index 87348c34168b..d52063239497 100644 --- a/backends/saves/windows/windows-saves.cpp +++ b/backends/saves/windows/windows-saves.cpp @@ -26,8 +26,12 @@ #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) +#if defined(ARRAYSIZE) +#undef ARRAYSIZE +#endif #define WIN32_LEAN_AND_MEAN #include +#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one... #include "common/config-manager.h" #include "common/savefile.h" diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp index 8681102cd0b3..9cd803f14813 100644 --- a/backends/timer/default/default-timer.cpp +++ b/backends/timer/default/default-timer.cpp @@ -59,7 +59,6 @@ void insertPrioQueue(TimerSlot *head, TimerSlot *newSlot) { DefaultTimerManager::DefaultTimerManager() : - _timerHandler(0), _head(0) { _head = new TimerSlot(); diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h index e5a9dada792d..5884979da058 100644 --- a/backends/timer/default/default-timer.h +++ b/backends/timer/default/default-timer.h @@ -34,7 +34,6 @@ class DefaultTimerManager : public Common::TimerManager { typedef Common::HashMap TimerSlotMap; Common::Mutex _mutex; - void *_timerHandler; TimerSlot *_head; TimerSlotMap _callbacks; diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 6fd020cb1564..5ad23313dc55 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -237,6 +237,8 @@ void registerDefaults() { ConfMan.registerDefault("record_temp_file_name", "record.tmp"); ConfMan.registerDefault("record_time_file_name", "record.time"); + ConfMan.registerDefault("gui_saveload_chooser", "grid"); + } // diff --git a/base/internal_version.h b/base/internal_version.h index 539201216944..40ed67ceec2e 100644 --- a/base/internal_version.h +++ b/base/internal_version.h @@ -16,4 +16,4 @@ #define SCUMMVM_REVISION #endif -#define SCUMMVM_VERSION "1.5.0git" SCUMMVM_REVISION +#define SCUMMVM_VERSION "1.6.0git" SCUMMVM_REVISION diff --git a/base/plugins.h b/base/plugins.h index fffb5fb9101c..4409c9eaea7b 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -205,6 +205,10 @@ typedef Common::Array PluginList; template class PluginSubclass : public Plugin { public: + PO_t &operator*() const { + return *(PO_t *)_pluginObject; + } + PO_t *operator->() const { return (PO_t *)_pluginObject; } diff --git a/common/endian.h b/common/endian.h index 394437ec67fa..759513efefe5 100644 --- a/common/endian.h +++ b/common/endian.h @@ -146,6 +146,12 @@ */ #define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) +/** + * A wrapper macro used around two character constants, like 'wb', to + * ensure portability. Typical usage: MKTAG16('w','b'). + */ +#define MKTAG16(a0,a1) ((uint16)((a1) | ((a0) << 8))) + // Functions for reading/writing native integers. // They also transparently handle the need for alignment. diff --git a/common/keyboard.h b/common/keyboard.h index 64c6cc4d0143..3262a15c3fb7 100644 --- a/common/keyboard.h +++ b/common/keyboard.h @@ -249,7 +249,10 @@ struct KeyState { * ASCII-value of the pressed key (if any). * This depends on modifiers, i.e. pressing the 'A' key results in * different values here depending on the status of shift, alt and - * caps lock. + * caps lock. This should be used rather than keycode for text input + * to avoid keyboard layout issues. For example you cannot assume that + * KEYCODE_0 without a modifier will be '0' (on AZERTY keyboards it is + * not). */ uint16 ascii; diff --git a/common/quicktime.h b/common/quicktime.h index 974502d0759d..08ca35ad518a 100644 --- a/common/quicktime.h +++ b/common/quicktime.h @@ -35,6 +35,7 @@ #include "common/scummsys.h" #include "common/stream.h" #include "common/rational.h" +#include "common/types.h" namespace Common { class MacResManager; diff --git a/common/savefile.h b/common/savefile.h index 03a7b52add42..da787289ee1b 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -104,11 +104,23 @@ class SaveFileManager : NonCopyable { virtual String popErrorDesc(); /** - * Open the savefile with the specified name in the given directory for saving. - * @param name the name of the savefile + * Open the savefile with the specified name in the given directory for + * saving. + * + * Saved games are compressed by default, and engines are expected to + * always write compressed saves. + * + * A notable exception is if uncompressed files are needed for + * compatibility with games not supported by ScummVM, such as character + * exports from the Quest for Glory series. QfG5 is a 3D game and won't be + * supported by ScummVM. + * + * @param name the name of the savefile + * @param compress toggles whether to compress the resulting save file + * (default) or not. * @return pointer to an OutSaveFile, or NULL if an error occurred. */ - virtual OutSaveFile *openForSaving(const String &name) = 0; + virtual OutSaveFile *openForSaving(const String &name, bool compress = true) = 0; /** * Open the file with the specified name in the given directory for loading. diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp index 6c0f9c9962e9..b3c45ffe7370 100644 --- a/common/winexe_pe.cpp +++ b/common/winexe_pe.cpp @@ -64,7 +64,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream) { if (!stream) return false; - if (stream->readUint16BE() != 'MZ') + if (stream->readUint16BE() != MKTAG16('M', 'Z')) return false; stream->skip(58); diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index ea3d44cf873d..f0b7f1cc8139 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -20,15 +20,11 @@ * */ -// FIXME: Avoid using fprintf -#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf -#define FORBIDDEN_SYMBOL_EXCEPTION_stderr - - #include "common/xmlparser.h" #include "common/archive.h" #include "common/fs.h" #include "common/memstream.h" +#include "common/system.h" namespace Common { @@ -123,17 +119,19 @@ bool XMLParser::parserError(const String &errStr) { keyClosing = currentPosition; } - fprintf(stderr, "\n File <%s>, line %d:\n", _fileName.c_str(), lineCount); + Common::String errorMessage = Common::String::format("\n File <%s>, line %d:\n", _fileName.c_str(), lineCount); currentPosition = (keyClosing - keyOpening); _stream->seek(keyOpening, SEEK_SET); while (currentPosition--) - fprintf(stderr, "%c", _stream->readByte()); + errorMessage += (char)_stream->readByte(); + + errorMessage += "\n\nParser error: "; + errorMessage += errStr; + errorMessage += "\n\n"; - fprintf(stderr, "\n\nParser error: "); - fprintf(stderr, "%s", errStr.c_str()); - fprintf(stderr, "\n\n"); + g_system->logMessage(LogMessageType::kError, errorMessage.c_str()); return false; } diff --git a/common/zlib.cpp b/common/zlib.cpp index 7d765fc539e1..76e34485da0b 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -107,7 +107,7 @@ class GZipReadStream : public SeekableReadStream { public: - GZipReadStream(SeekableReadStream *w) : _wrapped(w), _stream() { + GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { assert(w != 0); // Verify file header is correct @@ -122,7 +122,8 @@ class GZipReadStream : public SeekableReadStream { _origSize = w->readUint32LE(); } else { // Original size not available in zlib format - _origSize = 0; + // use an otherwise known size if supplied. + _origSize = knownSize; } _pos = 0; w->seek(0, SEEK_SET); @@ -336,7 +337,7 @@ class GZipWriteStream : public WriteStream { #endif // USE_ZLIB -SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped) { +SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize) { #if defined(USE_ZLIB) if (toBeWrapped) { uint16 header = toBeWrapped->readUint16BE(); @@ -345,7 +346,7 @@ SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped) { header % 31 == 0)); toBeWrapped->seek(-2, SEEK_CUR); if (isCompressed) - return new GZipReadStream(toBeWrapped); + return new GZipReadStream(toBeWrapped, knownSize); } #endif return toBeWrapped; diff --git a/common/zlib.h b/common/zlib.h index 61322c286a5b..837249992204 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -86,10 +86,18 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, * format. In the former case, the original stream is returned unmodified * (and in particular, not wrapped). * + * Certain GZip-formats don't supply an easily readable length, if you + * still need the length carried along with the stream, and you know + * the decompressed length at wrap-time, then it can be supplied as knownSize + * here. knownSize will be ignored if the GZip-stream DOES include a length. + * * It is safe to call this with a NULL parameter (in this case, NULL is * returned). + * + * @param toBeWrapped the stream to be wrapped (if it is in gzip-format) + * @param knownSize a supplied length of the compressed data (if not available directly) */ -SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped); +SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize = 0); /** * Take an arbitrary WriteStream and wrap it in a custom stream which provides diff --git a/configure b/configure index ffcd0c1d6c8f..5c6deace4153 100755 --- a/configure +++ b/configure @@ -97,7 +97,7 @@ _sndio=auto _timidity=auto _zlib=auto _sparkle=auto -_png=no +_png=auto _theoradec=auto _faad=auto _fluidsynth=auto @@ -712,7 +712,7 @@ Usage: $0 [OPTIONS]... Configuration: -h, --help display this help and exit - --backend=BACKEND backend to build (android, bada, dc, dingux, ds, gp2x, gph, + --backend=BACKEND backend to build (android, bada, dc, dingux, ds, gph, iphone, linuxmoto, maemo, n64, null, openpandora, ps2, psp, samsungtv, sdl, webos, wii, wince) [sdl] @@ -2079,8 +2079,9 @@ case $_host_os in DEFINES="$DEFINES -D__PLAYSTATION2__" ;; ps3) - # Force use of SDL from the ps3 toolchain + # Force use of SDL and freetype from the ps3 toolchain _sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" + _freetypepath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" DEFINES="$DEFINES -DPLAYSTATION3" CXXFLAGS="$CXXFLAGS -mcpu=cell -mminimal-toc -I$PSL1GHT/ppu/include -I$PS3DEV/portlibs/ppu/include" @@ -2202,13 +2203,8 @@ if test -n "$_host"; then bfin*) ;; caanoo) - # This uses the GPH backend. - DEFINES="$DEFINES -DGPH_DEVICE" DEFINES="$DEFINES -DCAANOO" - DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE" - if test "$_debug_build" = yes; then - DEFINES="$DEFINES -DGPH_DEBUG" - else + if test "$_debug_build" = no; then # Use -O3 on the Caanoo for non-debug builds. _optimization_level=-O3 fi @@ -2299,13 +2295,7 @@ if test -n "$_host"; then add_line_to_config_h "#define USE_WII_DI" ;; gp2x) - # This uses the GPH backend. - DEFINES="$DEFINES -DGPH_DEVICE" DEFINES="$DEFINES -DGP2X" - DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE" - if test "$_debug_build" = yes; then - DEFINES="$DEFINES -DGPH_DEBUG" - fi CXXFLAGS="$CXXFLAGS -march=armv4t" ASFLAGS="$ASFLAGS -mfloat-abi=soft" LDFLAGS="$LDFLAGS -static" @@ -2319,13 +2309,7 @@ if test -n "$_host"; then _port_mk="backends/platform/gph/gp2x-bundle.mk" ;; gp2xwiz) - # This uses the GPH backend. - DEFINES="$DEFINES -DGPH_DEVICE" DEFINES="$DEFINES -DGP2XWIZ" - DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE" - if test "$_debug_build" = yes; then - DEFINES="$DEFINES -DGPH_DEBUG" - fi CXXFLAGS="$CXXFLAGS -mcpu=arm926ej-s" CXXFLAGS="$CXXFLAGS -mtune=arm926ej-s" ASFLAGS="$ASFLAGS -mfloat-abi=soft" @@ -2611,9 +2595,14 @@ case $_backend in INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/ds/commoninclude' INCLUDES="$INCLUDES "'-Ibackends/platform/ds/arm9/data' ;; - gp2x) - ;; gph) + # On the GPH devices we want fancy themes but do not want the load/save thumbnail grid. + DEFINES="$DEFINES -DDISABLE_SAVELOADCHOOSER_GRID" + DEFINES="$DEFINES -DGPH_DEVICE" + DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE" + if test "$_debug_build" = yes; then + DEFINES="$DEFINES -DGPH_DEBUG" + fi ;; iphone) LIBS="$LIBS -lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES" @@ -2709,7 +2698,7 @@ MODULES="$MODULES backends/platform/$_backend" # Setup SDL specifics for SDL based backends # case $_backend in - dingux | gp2x | gph | linuxmoto | maemo | openpandora | samsungtv | sdl) + dingux | gph | linuxmoto | maemo | openpandora | samsungtv | sdl) find_sdlconfig INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`" LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`" @@ -3213,6 +3202,11 @@ fi define_in_config_if_yes "$_png" 'USE_PNG' echo "$_png" +if test `get_engine_build sword25` = yes && test ! "$_png" = yes ; then + echo "...disabling Broken Sword 2.5 engine. PNG is required" + engine_disable sword25 +fi + # # Check for Theora Decoder # @@ -3375,7 +3369,7 @@ if test "$_fluidsynth" = yes ; then esac INCLUDES="$INCLUDES $FLUIDSYNTH_CFLAGS" fi -define_in_config_h_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH' +define_in_config_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH' echo "$_fluidsynth" # @@ -3501,6 +3495,21 @@ define_in_config_if_yes "$_freetype2" "USE_FREETYPE2" # Check for OpenGL (ES) # echocheck "OpenGL" + +case $_backend in + openpandora) + # Only enable OpenGL ES on the OpanPandora if --enable-opengl is passed in explicitly. + if test "$_opengl" = yes ; then + _opengl=yes + _opengles=yes + OPENGL_LIBS="-lGLES_CM -lEGL -lX11" + OPENGL_CFLAGS="$OPENGL_LIBS" + LIBS="$LIBS $OPENGL_LIBS" + INCLUDES="$INCLUDES $OPENGL_CFLAGS" + fi + ;; +esac + if test "$_opengl" = auto ; then _opengl=no if test "$_backend" = "sdl" ; then diff --git a/devtools/README b/devtools/README index 7db5259e7ca2..c7f08d6dfaf7 100644 --- a/devtools/README +++ b/devtools/README @@ -65,7 +65,7 @@ create_lure (dreammaster) create_project (LordHoto, Littleboy) -------------- - Creates project files for Visual Studio 2005, 2008, 2010, Xcode and + Creates project files for Visual Studio 2005, 2008, 2010, 2012, Xcode and Code::Blocks out of the configure / Makefile based build system. It also offers a way to enable or disable certain engines and the use of external libraries similar to configure. Run the tool without diff --git a/devtools/create_drascula/staticdata.h b/devtools/create_drascula/staticdata.h index 21b9a8262298..e0e4f9da109b 100644 --- a/devtools/create_drascula/staticdata.h +++ b/devtools/create_drascula/staticdata.h @@ -6031,10 +6031,10 @@ const char *_texthis[NUM_LANGS][NUM_TEXTHIS] = { }, { "", - "", - "", - "", - "" + "Hace mucho tiempo, parece ser que Drascula mato a la mujer de Von Braun, asi que, con la intencion de enfrentarse al conde, Von Braun empezo a investigar todo lo que pudo sobre vampiros.", + "Cuando creyo estar preparado, subio al castillo y tuvo un enfrentamiento muy violento con Drascula.", + "Nadie sabe que paso exactamente. Aunque Von Braun perdio, Drascula no pudo matarlo.", + "Von Braun se sintio humillado por su derrota, huyo del castillo y no ha tenido valor para enfrentarse de nuevo a Drascula." }, { "", diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp index a87bde3e263b..3b90ad0d857e 100644 --- a/devtools/create_kyradat/create_kyradat.cpp +++ b/devtools/create_kyradat/create_kyradat.cpp @@ -47,7 +47,7 @@ #include enum { - kKyraDatVersion = 82 + kKyraDatVersion = 83 }; const ExtractFilename extractFilenames[] = { diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp index a2759b1e539b..89229eb4f21d 100644 --- a/devtools/create_kyradat/games.cpp +++ b/devtools/create_kyradat/games.cpp @@ -119,6 +119,7 @@ const Game lolGames[] = { { kLoL, { EN_ANY, -1, -1 }, kPlatformPC, kNoSpecial, { "0cc764a204f7ba8cefe1a5f14c479619", 0 } }, { kLoL, { RU_RUS, -1, -1 }, kPlatformPC, kNoSpecial, { "80a9f9bf243bc6ed36d98584fc6988c4", 0 } }, { kLoL, { DE_DEU, -1, -1 }, kPlatformPC, kNoSpecial, { "6b843869772c1b779e1386be868c15dd", 0 } }, + { kLoL, { FR_FRA, -1, -1 }, kPlatformPC, kNoSpecial, { "6b843869772c1b779e1386be868c15dd", 0 } }, // PC98 (no language specifc strings) { kLoL, { JA_JPN, -1, -1 }, kPlatformPC98, kNoSpecial, { "6d5bd4a2f5ce433365734ca6b7a8d984", "1b0a457c48ae6908da301b656fe0aab4" } }, diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp index 1b9f90f18f8f..19b69d941000 100644 --- a/devtools/create_kyradat/tables.cpp +++ b/devtools/create_kyradat/tables.cpp @@ -3349,6 +3349,7 @@ const ExtractEntrySearchData kLoLCharacterDefsProvider[] = { { RU_RUS, kPlatformPC, { 0x00000492, 0x000052BA, { { 0x52, 0x29, 0x0D, 0x49, 0xFD, 0x17, 0xD7, 0x70, 0x6D, 0xCA, 0xEB, 0xB6, 0x7E, 0xFA, 0xBE, 0x08 } } } }, // floppy { EN_ANY, kPlatformPC, { 0x00000492, 0x000046B0, { { 0x7A, 0x94, 0x8B, 0xC6, 0xF7, 0xF1, 0x2F, 0xF3, 0xBC, 0x1B, 0x0B, 0x4E, 0x00, 0xC9, 0x44, 0x58 } } } }, // floppy { DE_DEU, kPlatformPC, { 0x00000492, 0x000047FD, { { 0x8C, 0x0B, 0x8B, 0xCE, 0xE0, 0xB0, 0x8F, 0xA9, 0x06, 0xC3, 0x98, 0xE6, 0x2E, 0x09, 0xB6, 0x93 } } } }, // floppy + { FR_FRA, kPlatformPC, { 0x00000492, 0x000047FD, { { 0x8C, 0x0B, 0x8B, 0xCE, 0xE0, 0xB0, 0x8F, 0xA9, 0x06, 0xC3, 0x98, 0xE6, 0x2E, 0x09, 0xB6, 0x93 } } } }, // floppy { EN_ANY, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD { DE_DEU, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD { FR_FRA, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index df220f0934a7..8499fec400ac 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -75,14 +75,6 @@ namespace { */ std::string unifyPath(const std::string &path); -/** - * Returns the last path component. - * - * @param path Path string. - * @return Last path component. - */ -std::string getLastPathComponent(const std::string &path); - /** * Display the help text for the program. * @@ -221,7 +213,7 @@ int main(int argc, char *argv[]) { msvcVersion = atoi(argv[++i]); - if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10) { + if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11) { std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n"; return -1; } @@ -606,14 +598,6 @@ std::string unifyPath(const std::string &path) { return result; } -std::string getLastPathComponent(const std::string &path) { - std::string::size_type pos = path.find_last_of('/'); - if (pos == std::string::npos) - return path; - else - return path.substr(pos + 1); -} - void displayHelp(const char *exe) { using std::cout; @@ -643,6 +627,7 @@ void displayHelp(const char *exe) { " 8 stands for \"Visual Studio 2005\"\n" " 9 stands for \"Visual Studio 2008\"\n" " 10 stands for \"Visual Studio 2010\"\n" + " 11 stands for \"Visual Studio 2012\"\n" " The default is \"9\", thus \"Visual Studio 2008\"\n" " --build-events Run custom build events as part of the build\n" " (default: false)\n" @@ -1000,7 +985,7 @@ bool isInList(const std::string &dir, const std::string &fileName, const StringL continue; } - const std::string lastPathComponent = getLastPathComponent(*i); + const std::string lastPathComponent = ProjectProvider::getLastPathComponent(*i); if (extensionName == "o") { return false; } else if (!producesObjectFile(fileName) && extensionName != "h") { @@ -1303,6 +1288,14 @@ std::string ProjectProvider::createUUID() const { #endif } +std::string ProjectProvider::getLastPathComponent(const std::string &path) { + std::string::size_type pos = path.find_last_of('/'); + if (pos == std::string::npos) + return path; + else + return path.substr(pos + 1); +} + void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &projectFile, const StringList &includeList, const StringList &excludeList, const std::string &filePrefix) { diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 8719143f4ab1..b4eda8f8d2b5 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -317,6 +317,14 @@ class ProjectProvider { */ void createProject(const BuildSetup &setup); + /** + * Returns the last path component. + * + * @param path Path string. + * @return Last path component. + */ + static std::string getLastPathComponent(const std::string &path); + protected: const int _version; ///< Target project version StringList &_globalWarnings; ///< Global warnings diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index dfd3f1d1c7df..c797770955d6 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -46,7 +46,13 @@ const char *MSBuildProvider::getPropertiesExtension() { } int MSBuildProvider::getVisualStudioVersion() { - return 2010; + if (_version == 10) + return 2010; + + if (_version == 11) + return 2012; + + error("Unsupported version passed to getVisualStudioVersion"); } namespace { @@ -58,9 +64,10 @@ inline void outputConfiguration(std::ostream &project, const std::string &config "\t\t\n"; } -inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config) { +inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, int version) { project << "\t\n" "\t\t" << ((name == setup.projectName || setup.devTools) ? "Application" : "StaticLibrary") << "\n" + "\t\tv" << version << "0\n" "\t\n"; } @@ -98,17 +105,18 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri "\t\t{" << uuid << "}\n" "\t\t" << name << "\n" "\t\tWin32Proj\n" + "\t\t$(VCTargetsPath11)\n" "\t\n"; // Shared configuration project << "\t\n"; - outputConfigurationType(setup, project, name, "Release|Win32"); - outputConfigurationType(setup, project, name, "Analysis|Win32"); - outputConfigurationType(setup, project, name, "Debug|Win32"); - outputConfigurationType(setup, project, name, "Release|x64"); - outputConfigurationType(setup, project, name, "Analysis|x64"); - outputConfigurationType(setup, project, name, "Debug|x64"); + outputConfigurationType(setup, project, name, "Release|Win32", _version); + outputConfigurationType(setup, project, name, "Analysis|Win32", _version); + outputConfigurationType(setup, project, name, "Debug|Win32", _version); + outputConfigurationType(setup, project, name, "Release|x64", _version); + outputConfigurationType(setup, project, name, "Analysis|x64", _version); + outputConfigurationType(setup, project, name, "Debug|x64", _version); project << "\t\n" "\t\n" @@ -249,11 +257,11 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s // Compile configuration if (setup.devTools || name == setup.projectName || name == "sword25" || name == "grim") { project << "\t\t\tfalse\n"; - } else { - if (name == "scummvm" && !isRelease) - project << "\t\t\tProgramDatabase\n"; - if (warningsIterator != _projectWarnings.end()) + if (name == setup.projectName && !isRelease) + project << "\t\t\tProgramDatabase\n"; + } else { + if (warningsIterator != _projectWarnings.end()) project << "\t\t\t" << warnings << ";%(DisableSpecificWarnings)\n"; } @@ -395,6 +403,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\n" "\t\t\n" "\t\t\ttrue\n" + "\t\t\tfalse\n" "\t\t\tlibcmt.lib;%(IgnoreSpecificDefaultLibraries)\n"; } diff --git a/devtools/create_project/msvc11/create_project.sln b/devtools/create_project/msvc11/create_project.sln new file mode 100644 index 000000000000..1552c9f502fe --- /dev/null +++ b/devtools/create_project/msvc11/create_project.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_project", "create_project.vcxproj", "{CF177559-077D-4A08-AABE-BE0FD35F6C63}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.ActiveCfg = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.Build.0 = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/devtools/create_project/msvc11/create_project.vcxproj b/devtools/create_project/msvc11/create_project.vcxproj new file mode 100644 index 000000000000..c87461c0492f --- /dev/null +++ b/devtools/create_project/msvc11/create_project.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {CF177559-077D-4A08-AABE-BE0FD35F6C63} + create_project + $(VCTargetsPath11) + + + + Application + MultiByte + true + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + true + EnableFastChecks + MultiThreadedDebugDLL + Level4 + EditAndContinue + false + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + MachineX86 + false + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + true + true + MachineX86 + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/create_project/msvc11/create_project.vcxproj.filters b/devtools/create_project/msvc11/create_project.vcxproj.filters new file mode 100644 index 000000000000..b4f0b1877459 --- /dev/null +++ b/devtools/create_project/msvc11/create_project.vcxproj.filters @@ -0,0 +1,71 @@ + + + + + {2e3580c8-ec3a-4c81-8351-b668c668db2a} + + + {31aaf58c-d3cb-4ed6-8eca-163b4a9b31a6} + + + {f980f6fb-41b6-4161-b035-58b200c85cad} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + scripts + + + scripts + + + scripts + + + scripts + + + diff --git a/devtools/create_project/scripts/postbuild.cmd b/devtools/create_project/scripts/postbuild.cmd index dd52c0217c57..d78119d058c1 100644 --- a/devtools/create_project/scripts/postbuild.cmd +++ b/devtools/create_project/scripts/postbuild.cmd @@ -24,6 +24,7 @@ echo Copying data files echo. xcopy /F /Y "%~4/lib/%~3/SDL.dll" "%~2" 1>NUL 2>&1 +xcopy /F /Y "%~4/lib/%~3/freetype6.dll" "%~2" 1>NUL 2>&1 xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" "%~2" 1>NUL 2>&1 if "%~5"=="0" goto done diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 62b30ddcd0a5..c301e78ad115 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -110,7 +110,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: std::string toolConfig; toolConfig = (!warnings.empty() ? "DisableSpecificWarnings=\"" + warnings + "\"" : ""); - toolConfig += (name == "scummvm" ? "DebugInformationFormat=\"3\" " : ""); + toolConfig += (name == setup.projectName ? "DebugInformationFormat=\"3\" " : ""); toolConfig += (name == "sword25" ? "DisableLanguageExtensions=\"false\" " : ""); toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : ""); diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 39470f4e19db..62dd417d8c9d 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -202,18 +202,38 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p // Init root group _groups.comment = "PBXGroup"; - Object *group = new Object(this, "PBXGroup", "PBXGroup", "PBXGroup", "", ""); - //Property children; - //children.flags = SettingsAsList; - //group->properties["children"] = children; - group->addProperty("children", "", "", SettingsNoValue|SettingsAsList); + // Create group + std::string name = getLastPathComponent(dir.name); + Object *group = new Object(this, "PBXGroup_" + name , "PBXGroup", "PBXGroup", "", name); + + // List of children + Property children; + children.hasOrder = true; + children.flags = SettingsAsList; + group->addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable); group->addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); - _groups.add(group); + int order = 0; + for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) { + const FileNode *node = *i; + + std::string id = "FileReference_" + node->name; + FileProperty property = FileProperty(node->name, node->name, node->name, ""); + + ADD_SETTING_ORDER_NOVALUE(children, getHash(id), node->name, order++); + ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); + ADD_FILE_REFERENCE(node->name, property); + + // Process child nodes + if (!node->children.empty()) + writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/'); + } - // TODO Add files + group->properties["children"] = children; + + _groups.add(group); } ////////////////////////////////////////////////////////////////////////// @@ -717,6 +737,7 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING_QUOTE(scummvmSimulator_Debug, "FRAMEWORK_SEARCH_PATHS", "$(inherited)"); ADD_SETTING_LIST(scummvmSimulator_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, SettingsNoQuote|SettingsAsList, 5); ADD_SETTING(scummvmSimulator_Debug, "SDKROOT", "iphonesimulator3.2"); + ADD_SETTING_QUOTE(scummvmSimulator_Debug, "VALID_ARCHS", "i386 x86_64"); REMOVE_SETTING(scummvmSimulator_Debug, "TARGETED_DEVICE_FAMILY"); scummvmSimulator_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue); @@ -726,6 +747,7 @@ void XCodeProvider::setupBuildConfiguration() { Object *scummvmSimulator_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Release", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); Property scummvmSimulator_Release(scummvmSimulator_Debug); ADD_SETTING(scummvmSimulator_Release, "COPY_PHASE_STRIP", "YES"); + ADD_SETTING(scummvmSimulator_Release, "GCC_OPTIMIZATION_LEVEL", "3"); REMOVE_SETTING(scummvmSimulator_Release, "GCC_DYNAMIC_NO_PIC"); ADD_SETTING(scummvmSimulator_Release, "WRAPPER_EXTENSION", "app"); @@ -871,7 +893,9 @@ std::string XCodeProvider::writeProperty(const std::string &variable, Property & std::string XCodeProvider::writeSetting(const std::string &variable, std::string value, std::string comment, int flags, int indent) const { return writeSetting(variable, Setting(value, comment, flags, indent)); } -// Heavily modified (not in a good way) function, imported from QMake XCode project generator (licensed under the QT license) + +// Heavily modified (not in a good way) function, imported from the QMake +// XCode project generator pbuilder_pbx.cpp, writeSettings() (under LGPL 2.1) std::string XCodeProvider::writeSetting(const std::string &variable, const Setting &setting) const { std::string output; const std::string quote = (setting.flags & SettingsNoQuote) ? "" : "\""; @@ -893,7 +917,7 @@ std::string XCodeProvider::writeSetting(const std::string &variable, const Setti for (unsigned int i = 0, count = 0; i < setting.entries.size(); ++i) { std::string value = setting.entries.at(i).value; - if(!value.empty()) { + if (!value.empty()) { if (count++ > 0) output += "," + newline; diff --git a/devtools/create_teenagent/create_teenagent.cpp b/devtools/create_teenagent/create_teenagent.cpp index 9551acbaea4b..fc2ba4da0eab 100644 --- a/devtools/create_teenagent/create_teenagent.cpp +++ b/devtools/create_teenagent/create_teenagent.cpp @@ -106,7 +106,5 @@ int main(int argc, char *argv[]) { fclose(fin); fclose(fout); - fprintf(stderr, "please run \"gzip -n %s\"\n", dat_name); - return 0; } diff --git a/devtools/credits.pl b/devtools/credits.pl index db6975641ad3..5cfa4985ac3c 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -69,6 +69,7 @@ sub html_entities_to_ascii { # å -> aa # & -> & # ł -> l + # ś -> s # Š -> S $text =~ s/á/a/g; $text =~ s/é/e/g; @@ -76,6 +77,7 @@ sub html_entities_to_ascii { $text =~ s/ó/o/g; $text =~ s/ø/o/g; $text =~ s/ł/l/g; + $text =~ s/ś/s/g; $text =~ s/Š/S/g; $text =~ s/å/aa/g; @@ -101,6 +103,7 @@ sub html_entities_to_cpp { $text =~ s/ó/\\363/g; $text =~ s/ø/\\370/g; $text =~ s/ł/l/g; + $text =~ s/ś/s/g; $text =~ s/Š/S/g; $text =~ s/å/\\345/g; @@ -550,7 +553,9 @@ sub add_paragraph { begin_section("DreamWeb"); add_person("Torbjörn Andersson", "eriktorbjorn", ""); add_person("Bertrand Augereau", "Tramb", ""); + add_person("Filippos Karapetis", "[md5]", ""); add_person("Vladimir Menshakov", "whoozle", "(retired)"); + add_person("Willem Jan Palenstijn", "wjp", ""); end_section(); begin_section("Gob"); @@ -946,10 +951,10 @@ sub add_paragraph { add_person("Matteo Angelino", "Maff", ""); end_section(); begin_section("Norwegian (Bokmål)"); - add_person("Einar Johan T. Sømåen", "", ""); + add_person("Einar Johan Sømåen", "somaen", ""); end_section(); begin_section("Norwegian (Nynorsk)"); - add_person("Einar Johan T. Sømåen", "", ""); + add_person("Einar Johan Sømåen", "somaen", ""); end_section(); begin_section("Polish"); add_person("GrajPoPolsku.pl Team", "", ""); @@ -1131,6 +1136,14 @@ sub add_paragraph { "Broken Sword 2.5 team for providing sources of their engine and their great ". "support."); + add_paragraph( + "Neil Dodwell and David Dew from Creative Reality for providing the source ". + "of Dreamweb and for their tremendous support."); + + add_paragraph( + "Janusz Wiśniewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon ". + "for providing full source code for Sołtys and letting us to redistribute the game."); + add_paragraph( "Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for ". "providing the source code of The Journeyman Project: Pegasus Prime."); diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 176f04aaf84b..42dcb27d1a74 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -575,6 +575,7 @@ maze Freddi Fish and Luther's Maze Madness 4f04b321a95d4315ce6d65f8e1dd0368 -1 us All HE 80 - - Kirben cd424f143a141bc59226ad83a6e40f51 -1 nl All HE 98.5 - - daniel9, sugarcube 4dbff3787aedcd96b0b325f2d92d7ad9 -1 us All HE 100 Updated - Kirben + 4522564b3c31aaf218b6a96826a549fd -1 us Windows HE 99 - - legoking831 water Freddi Fish and Luther's Water Worries 4ba37f835be11a59d969f90f272f575b -1 us All HE 80 - - Kirben diff --git a/dists/android/AndroidManifest.xml b/dists/android/AndroidManifest.xml index e7778fdf6179..a3c02474ebcd 100644 --- a/dists/android/AndroidManifest.xml +++ b/dists/android/AndroidManifest.xml @@ -4,7 +4,7 @@ diff --git a/dists/android/plugin-manifest.xml b/dists/android/plugin-manifest.xml index 51b39be3b169..7855c330c62e 100644 --- a/dists/android/plugin-manifest.xml +++ b/dists/android/plugin-manifest.xml @@ -3,7 +3,7 @@ diff --git a/dists/engine-data/drascula.dat b/dists/engine-data/drascula.dat index 0938ef4a9a06..e2b046a52796 100644 Binary files a/dists/engine-data/drascula.dat and b/dists/engine-data/drascula.dat differ diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat index c89b21cbca56..339b85664af7 100644 Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ diff --git a/dists/engine-data/teenagent.dat b/dists/engine-data/teenagent.dat index 0dd31dad1442..149232692017 100644 Binary files a/dists/engine-data/teenagent.dat and b/dists/engine-data/teenagent.dat differ diff --git a/dists/gph/README-GPH b/dists/gph/README-GPH index 29f017530646..974c2cf2665e 100644 --- a/dists/gph/README-GPH +++ b/dists/gph/README-GPH @@ -1,4 +1,4 @@ -ScummVM 1.5.0git - GPH DEVICE SPECIFIC README +ScummVM 1.6.0git - GPH DEVICE SPECIFIC README ------------------------------------------------------------------------ diff --git a/dists/gph/scummvm.ini b/dists/gph/scummvm.ini index 952cd0de2447..7d9d85fcc236 100644 --- a/dists/gph/scummvm.ini +++ b/dists/gph/scummvm.ini @@ -1,5 +1,5 @@ [info] -name="ScummVM 1.5.0git" +name="ScummVM 1.6.0git" path="/scummvm/scummvm.gpe" icon="/scummvm/scummvm.png" title="/scummvm/scummvmb.png" diff --git a/dists/iphone/Info.plist b/dists/iphone/Info.plist index e25cee51ea5e..2f6ba85b005c 100644 --- a/dists/iphone/Info.plist +++ b/dists/iphone/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.0git + 1.6.0git CFBundleSignature ???? CFBundleVersion - 1.5.0git + 1.6.0git CFBundleIconFile icon.png CFBundleIconFiles diff --git a/dists/irix/scummvm.spec b/dists/irix/scummvm.spec index 2e099d94a810..bbdf31cc2c06 100644 --- a/dists/irix/scummvm.spec +++ b/dists/irix/scummvm.spec @@ -1,5 +1,5 @@ product scummvm - id "ScummVM 1.5.0git" + id "ScummVM 1.6.0git" image sw id "software" version 18 diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist index 94adc00a9bc3..d8c28f6a08ab 100644 --- a/dists/macosx/Info.plist +++ b/dists/macosx/Info.plist @@ -28,7 +28,7 @@ CFBundleExecutable scummvm CFBundleGetInfoString - 1.5.0git, Copyright 2001-2012 The ScummVM team + 1.6.0git, Copyright 2001-2012 The ScummVM team CFBundleIconFile scummvm.icns CFBundleIdentifier @@ -40,9 +40,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.0git + 1.6.0git CFBundleVersion - 1.5.0git + 1.6.0git NSPrincipalClass NSApplication NSHumanReadableCopyright diff --git a/dists/msvc11/create_msvc11.bat b/dists/msvc11/create_msvc11.bat new file mode 100644 index 000000000000..b6a5413e3b2b --- /dev/null +++ b/dists/msvc11/create_msvc11.bat @@ -0,0 +1,95 @@ +@echo off + +echo. +echo Automatic creation of the MSVC11 project files +echo. + +if "%~1"=="/stable" goto stable +if "%~1"=="/STABLE" goto stable +if "%~1"=="/all" goto all +if "%~1"=="/ALL" goto all +if "%~1"=="/tools" goto tools +if "%~1"=="/TOOLS" goto tools +if "%~1"=="/clean" goto clean_check +if "%~1"=="/CLEAN" goto clean_check +if "%~1"=="/help" goto command_help +if "%~1"=="/HELP" goto command_help +if "%~1"=="/?" goto command_help + +if "%~1"=="" goto check_tool + +echo Invalid command parameter: %~1 +echo. + +:command_help +echo Valid command parameters are: +echo stable Generated stable engines project files +echo all Generate all engines project files +echo tools Generate project files for the devtools +echo clean Clean generated project files +echo help Show help message +goto done + +:check_tool +if not exist create_project.exe goto no_tool + +:question +echo. +set batchanswer=S +set /p batchanswer="Enable stable engines only, or all engines? (S/a)" +if "%batchanswer%"=="s" goto stable +if "%batchanswer%"=="S" goto stable +if "%batchanswer%"=="a" goto all +if "%batchanswer%"=="A" goto all +goto question + +:no_tool +echo create_project.exe not found in the current folder. +echo You need to build it first and copy it in this +echo folder +goto done + +:all +echo. +echo Creating project files with all engines enabled (stable and unstable) +echo. +create_project ..\.. --enable-all-engines --msvc --msvc-version 11 --build-events +goto done + +:stable +echo. +echo Creating normal project files, with only the stable engines enabled +echo. +create_project ..\.. --msvc --msvc-version 11 +goto done + +:tools +echo. +echo Creating tools project files +echo. +create_project ..\.. --tools --msvc --msvc-version 11 +goto done + +:clean_check +echo. +set cleananswer=N +set /p cleananswer="This will remove all project files. Are you sure you want to continue? (N/y)" +if "%cleananswer%"=="n" goto done +if "%cleananswer%"=="N" goto done +if "%cleananswer%"=="y" goto clean +if "%cleananswer%"=="Y" goto clean +goto clean_check + +:clean +echo. +echo Removing all project files +del /Q *.vcxproj* > NUL 2>&1 +del /Q *.props > NUL 2>&1 +del /Q *.sln* > NUL 2>&1 +del /Q scummvm* > NUL 2>&1 +del /Q devtools* > NUL 2>&1 +goto done + +:done +echo. +pause diff --git a/dists/msvc11/readme.txt b/dists/msvc11/readme.txt new file mode 100644 index 000000000000..fa91a8cc12b4 --- /dev/null +++ b/dists/msvc11/readme.txt @@ -0,0 +1,6 @@ +The Visual Studio project files can now be created automatically from the GCC +files using the create_project tool inside the /devtools/create_project folder. + +To create the default project files, build create_project.exe, copy it inside +this folder and run the create_msvc11.bat file for a default build. You can run +create_project.exe with no parameters to check the possible command-line options diff --git a/dists/openpandora/PXML.xml b/dists/openpandora/PXML.xml index 896210bf014b..b759c311ba42 100644 --- a/dists/openpandora/PXML.xml +++ b/dists/openpandora/PXML.xml @@ -4,11 +4,11 @@ - + - ScummVM 1.5.0git + ScummVM 1.6.0git - ScummVM 1.5.0git + ScummVM 1.6.0git @@ -25,7 +25,7 @@ - + ScummVM diff --git a/dists/openpandora/README-OPENPANDORA b/dists/openpandora/README-OPENPANDORA index b3947975c02e..e3c7c9d63108 100644 --- a/dists/openpandora/README-OPENPANDORA +++ b/dists/openpandora/README-OPENPANDORA @@ -1,4 +1,4 @@ -ScummVM 1.5.0git - OPENPANDORA SPECIFIC README +ScummVM 1.6.0git - OPENPANDORA SPECIFIC README ------------------------------------------------------------------------ Please refer to the: diff --git a/dists/openpandora/README-PND.txt b/dists/openpandora/README-PND.txt index 240936f75516..594ad293ed65 100644 --- a/dists/openpandora/README-PND.txt +++ b/dists/openpandora/README-PND.txt @@ -1,4 +1,4 @@ -ScummVM 1.5.0git - OPENPANDORA README - HOW TO INSTALL +ScummVM 1.6.0git - OPENPANDORA README - HOW TO INSTALL ------------------------------------------------------------------------ Please refer to the: diff --git a/dists/openpandora/index.html b/dists/openpandora/index.html index d7238c188924..5da951546c4e 100644 --- a/dists/openpandora/index.html +++ b/dists/openpandora/index.html @@ -5,7 +5,7 @@

-

ScummVM 1.5.0git: OpenPandora Specific Documentation

+

ScummVM 1.6.0git: OpenPandora Specific Documentation

ScummVM OpenPandora README
@@ -13,7 +13,7 @@

ScummVM OpenPandora WiKi

-

ScummVM 1.5.0git: General Documentation

+

ScummVM 1.6.0git: General Documentation

ScummVM website
diff --git a/dists/redhat/scummvm-tools.spec b/dists/redhat/scummvm-tools.spec index 99add8ba8577..2f65931a7065 100644 --- a/dists/redhat/scummvm-tools.spec +++ b/dists/redhat/scummvm-tools.spec @@ -7,7 +7,7 @@ # Prologue information #------------------------------------------------------------------------------ Name : scummvm-tools -Version : 1.5.0git +Version : 1.6.0git Release : 1 Summary : ScummVM-related tools Group : Interpreters diff --git a/dists/redhat/scummvm.spec b/dists/redhat/scummvm.spec index 2ccccae79d9e..bd17017fbf02 100644 --- a/dists/redhat/scummvm.spec +++ b/dists/redhat/scummvm.spec @@ -7,7 +7,7 @@ # Prologue information #------------------------------------------------------------------------------ Name : scummvm -Version : 1.5.0git +Version : 1.6.0git Release : 1 Summary : Graphic adventure game interpreter Group : Interpreters @@ -27,6 +27,7 @@ BuildRequires: flac-devel BuildRequires: zlib-devel BuildRequires: nasm BuildRequires: SDL-devel >= 1.2.2 +BuildRequires: freetype-devel #------------------------------------------------------------------------------ # Description @@ -94,7 +95,7 @@ fi #------------------------------------------------------------------------------ %files %defattr(0644,root,root,0755) -%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.BSD COPYRIGHT +%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.FREEFONT COPYING.BSD COPYRIGHT %attr(0755,root,root)%{_bindir}/scummvm %{_datadir}/applications/* %{_datadir}/pixmaps/scummvm.xpm diff --git a/dists/redhat/scummvm.spec.in b/dists/redhat/scummvm.spec.in index 3beef2f96048..9dbd8add5ba0 100644 --- a/dists/redhat/scummvm.spec.in +++ b/dists/redhat/scummvm.spec.in @@ -27,6 +27,7 @@ BuildRequires: flac-devel BuildRequires: zlib-devel BuildRequires: nasm BuildRequires: SDL-devel >= 1.2.2 +BuildRequires: freetype-devel #------------------------------------------------------------------------------ # Description @@ -94,7 +95,7 @@ fi #------------------------------------------------------------------------------ %files %defattr(0644,root,root,0755) -%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.BSD COPYRIGHT +%doc AUTHORS README NEWS COPYING COPYING.LGPL COPYING.FREEFONT COPYING.BSD COPYRIGHT %attr(0755,root,root)%{_bindir}/scummvm %{_datadir}/applications/* %{_datadir}/pixmaps/scummvm.xpm diff --git a/dists/scummvm.rc b/dists/scummvm.rc index e5d28d089a64..4a67100f9fba 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -14,6 +14,7 @@ IDI_COUNT ICON DISCARDABLE "icons/count.ico" ID_GDF_XML DATA "dists/win32/scummvm.gdf.xml" +scummclassic.zip FILE "gui/themes/scummclassic.zip" scummmodern.zip FILE "gui/themes/scummmodern.zip" #ifdef USE_TRANSLATION translations.dat FILE "gui/themes/translations.dat" @@ -48,8 +49,8 @@ pred.dic FILE "dists/pred.dic" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,0 - PRODUCTVERSION 1,5,0,0 + FILEVERSION 1,6,0,0 + PRODUCTVERSION 1,6,0,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -66,13 +67,13 @@ BEGIN BEGIN VALUE "Comments", "Look! A three headed monkey (TM)! .. Nice use of the TM!\0" VALUE "FileDescription", "http://www.scummvm.org/\0" - VALUE "FileVersion", "1.5.0git\0" + VALUE "FileVersion", "1.6.0git\0" VALUE "InternalName", "scummvm\0" VALUE "LegalCopyright", "Copyright © 2001-2012 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" - VALUE "ProductVersion", "1.5.0git\0" + VALUE "ProductVersion", "1.6.0git\0" END END diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index 6969e0b2a7b9..a874b98514c1 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -14,6 +14,7 @@ IDI_COUNT ICON DISCARDABLE "icons/count.ico" ID_GDF_XML DATA "dists/win32/scummvm.gdf.xml" +scummclassic.zip FILE "gui/themes/scummclassic.zip" scummmodern.zip FILE "gui/themes/scummmodern.zip" #ifdef USE_TRANSLATION translations.dat FILE "gui/themes/translations.dat" diff --git a/dists/slackware/scummvm.SlackBuild b/dists/slackware/scummvm.SlackBuild index 4ccc2a8995a0..076a1d20ea64 100755 --- a/dists/slackware/scummvm.SlackBuild +++ b/dists/slackware/scummvm.SlackBuild @@ -9,7 +9,7 @@ if [ "$TMP" = "" ]; then fi PKG=$TMP/package-scummvm -VERSION=1.5.0git +VERSION=1.6.0git ARCH=i486 BUILD=1 diff --git a/dists/wii/meta.xml b/dists/wii/meta.xml index e843d36e79f3..5a4c46e1446b 100644 --- a/dists/wii/meta.xml +++ b/dists/wii/meta.xml @@ -2,7 +2,7 @@ ScummVM The ScummVM Team - 1.5.0git@REVISION@ + 1.6.0git@REVISION@ @TIMESTAMP@ Point & Click Adventures ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed! diff --git a/dists/win32/scummvm.nsi b/dists/win32/scummvm.nsi index 7ff174befbbd..795eb660b617 100644 --- a/dists/win32/scummvm.nsi +++ b/dists/win32/scummvm.nsi @@ -72,7 +72,7 @@ Name ScummVM # General Symbol Definitions ######################################################################################### !define REGKEY "Software\$(^Name)\$(^Name)" -!define VERSION "1.5.0git" +!define VERSION "1.6.0git" !define COMPANY "ScummVM Team" !define URL "http://scummvm.org/" !define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!" @@ -92,7 +92,7 @@ XPStyle on #TargetMinimalOS 5.0 ; Minimal version of windows for installer: Windows 2000 or more recent ; (will build unicode installer with NSIS 2.50+) -VIProductVersion 1.5.0.0 +VIProductVersion 1.6.0.0 VIAddVersionKey ProductName $(^Name) VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/doc/cz/PrectiMe b/doc/cz/PrectiMe index 4cb362ab3cd5..153ef09dcd61 100644 --- a/doc/cz/PrectiMe +++ b/doc/cz/PrectiMe @@ -53,7 +53,9 @@ Obsah: * 7.7 Podpora MIDI serveru TiMidity++ * 7.8 Použití komprimovaných zvukových souborů (MP3, Ogg Vorbis, Flac) * 7.9 Výstupní vzorkovací kmitoÄet -8.0) Soubor s nastavením +8.0) Soubor s nastavením + * 8.1 Rozpoznávaná klíÄová slova nastavení + * 8.2 Vlastní herní volby, které mohou být pÅ™epínány pomoci grafického rozhraní 9.0) Sestavení @@ -179,13 +181,18 @@ Hry AGOS od Adventuresoft/Horrorsoft: The Feeble Files [feeble] Hry GOB od Coktel Vision: + Bambou le sauveur de la jungle [bambou] Bargon Attack [bargon] + Fascination [fascination] + Geisha [geisha] Gobliiins [gob1] Gobliins 2 [gob2] Goblins 3 [gob3] Lost in Time [lostintime] + Once Upon A Time: Little Red Riding Hood [littlered] The Bizarre Adventures of Woodruff and the Schnibble [woodruff] + Urban Runner [urban] Ween: The Prophecy [ween] Hry MADE od Activision: @@ -216,6 +223,7 @@ Další hry: Hry SCUMM od Humongous Entertainment: Backyard Baseball [baseball] Backyard Baseball 2001 [baseball2001] + Backyard Baseball 2003 [baseball2003] Backyard Football [football] Big Thinkers First Grade [thinker1] Big Thinkers Kindergarten [thinkerk] @@ -284,7 +292,6 @@ Hry Living Books: Následující hry by mÄ›ly jít spustit, ale zatím nejsou úplnÄ› hratelné. Hrajte je pouze na vlastní riziko a prosíme, abyste pro tyto hry nenahlaÅ¡ovali chyby. Pokud chcete mít nejnovÄ›jší zprávy o kompatibilitách her, navÅ¡tivte naší stránku a prohlédnÄ›te si tabulku kompatibilit. - Backyard Baseball 2003 [baseball2003] Backyard Football 2002 [football2002] Backyard Soccer [soccer] Backyard Soccer MLS [soccermls] @@ -1478,6 +1485,8 @@ Vzorový soubor s nastavením vypadá takto: path=C:\amiga_mi2\ music_driver=windows +8.1) Rozpoznávaná klíÄová slova nastavení +---- ------------------------------------ Jsou rozpoznávána následující klíÄová slova: path Å™etÄ›zec Cesta, kde jsou umístÄ›ny datové soubory hry @@ -1494,7 +1503,6 @@ Jsou rozpoznávána následující klíÄová slova: talkspeed Äíslo ZpoždÄ›ní textu v hrách SCUMM, nebo rychlost textu v jiných hrách. fullscreen boolean Režim celé obrazovky aspect_ratio boolean Povolit korekci pomÄ›ru stran - disable_dithering boolean Odstranit artefakty chvÄ›ní v nÄ›kterých hrách EGA gfx_mode Å™etÄ›zec Grafický režim (normální, 2x, 3x, 2xsai, super2xsai, supereagle, advmame2x, advmame3x,hq2x, hq3x, tv2x, dotmatrix) confirm_exit boolean Zeptat se uživatele na potvrzení pÅ™ed ukonÄením (pouze jádro SDL). console boolean Povolit okno konzole (výchozí: zapnuto) (pouze Windows). @@ -1518,6 +1526,16 @@ Jsou rozpoznávána následující klíÄová slova: alt_intro boolean Použít alternativní úvod pro CD verze Beneath a Steel Sky a Flight of the Amazon Queen boot_param Äíslo PÅ™edá toto Äíslo zavádÄ›címu skriptu +Hry Sierra používající jádro AGI pÅ™idávají následující nestandardní klíÄové slovo: + +originalsaveload boolean Pokud true, jsou použity původní obrazovky nahrávání/uložení místo vylepÅ¡ených ze ScummVM + +Hry Sierra používající jádro SCI pÅ™idávají následující nestandardní klíÄová slova: + + disable_dithering boolean Odstranit artefakty chvÄ›ní v nÄ›kterých hrách EGA + prefer_digitalsfx boolean Pokud true, jsou upÅ™ednostňovány digitální zvukové efekty pÅ™ed syntetizovanými + originalsaveload boolean Pokud true, jsou použity původní obrazovky nahrávání/uložení místo vylepÅ¡ených ze ScummVM + native_fb01 bool Pokud true, je ovladaÄ hudby pro kartu IBM Music Feature nebo modul syntetizátoru Yahama FB-01 FM použit jako výstup MIDI Broken Sword II pÅ™idává následující nestandardní klíÄová slova: gfx_details Äíslo Nastavení grafických detailů (0-3) @@ -1526,16 +1544,25 @@ Broken Sword II pÅ™idává následující nestandardní klíÄová slova: reverse_stereo boolean Pokud true, kanály stereo jsou obráceny sfx_mute boolean Pokud true, zvukové efekty jsou ztlumeny -Flight of the Amazon Queen pÅ™idává následující nestandardní klíÄová slova +Flight of the Amazon Queen pÅ™idává následující nestandardní klíÄová slova: music_mute boolean Pokud true, hudba je ztlumena sfx_mute boolean Pokud true, zvukové efekty jsou ztlumeny -King's Quest VI Windows pÅ™idává následující nestandardní klíÄová slova: +Jones in the Fast Lane pÅ™idává následující nestandardní klíÄové slovo: + + music_mute boolean Pokud true, je použito CD audio místo zvuků ve hÅ™e + +King's Quest VI Windows pÅ™idává následující nestandardní klíÄové slovo: windows_cursors boolean Pokud true, jsou použity původní Äernobílé kurzory místo kurzorů z DOS. Pokud false, jsou ve verzi Windows použity kurzory DOS, zvÄ›tÅ¡ené, aby se shodovaly se zbytkem zvÄ›tÅ¡ené grafiky -Space Qust IV CD pÅ™idává následující nestandardní klíÄové slovo: +Lands of Lore: The Throne of Chaos pÅ™idává následující nestandardní klíÄová slova: + + smooth_scrolling boolean Pokud true, je posunování pÅ™i zmÄ›nÄ› z jedné obrazovky na druhou plynulejší + floating_cursors boolean Pokud true, je kurzor zmÄ›nÄ›n na smÄ›rovou Å¡ipku pÅ™i najetí na okraj obrazovky. HrÃ¡Ä pak může kliknout pro pohyb v tomto smÄ›ru. + +Space Quest IV CD pÅ™idává následující nestandardní klíÄové slovo: silver_cursors boolean Pokud true, je místo původních zlatých kurzorů použita alternativní sada stříbrných @@ -1548,10 +1575,23 @@ The Legend of Kyrandia pÅ™idává následující nestandardní klíÄové slovo: walkspeed celé Äíslo Rychlost chůze (0-4) +The Legend of Kyrandia: Malcolm's Revenge pÅ™idává následující nestandardní klíÄová slova: + + studio_audience boolean Pokud true, je slyÅ¡et potlesk a smích kdykoliv Malcolm provede nÄ›co vtipného + skip_support boolean Pokud true, hrÃ¡Ä může pÅ™eskakovat text a scény hry + helium_mode boolean Pokud true, lidé znÄ›jí tak, jakoby se nadýchali hélia + The 7th Guest pÅ™idává následující nestandardní klíÄové slovo: t7g_speed Å™etÄ›zec Rychlost pÅ™ehrávání videa (normal - normální, tweaked - upravená, im_an_ios - jsem na ios) +8.2) Vlastní herní volby, které mohou být pÅ™epínány pomoci grafického +---- ---------------------------------------------------------------- +rozhraní +-------- +Mnoho vlastních herních voleb v pÅ™edchozí Äásti může být pÅ™epnuto pÅ™es grafické rozhraní. Pokud je takováto volba pro urÄitou hru dostupná, objeví se karta "Jádro" pÅ™i pÅ™idávání nebo úpravÄ› nastavení této hry. +Pokud vlastní možnosti nejsou zobrazeny, musí být konkrétní hry spuÅ¡tÄ›ny jednou nebo znovu pÅ™idány do seznamu her spouÅ¡tÄ›Äe ScummVM. Toto aktualizuje nastavení každé položky, Äímž umožní zobrazení vlastních voleb. + 9.0) Sestavení: ---- ---------- Pro aktuální pÅ™ehled o tom, jak ScummVM sestavit pro různé platformy, prohlédnÄ›te si, prosím, naší Wiki, zvláštÄ› tuto stránku: @@ -1624,3 +1664,4 @@ http://www.scummvm.org/ ------------------------------------------------------------------------ + diff --git a/doc/da/HurtigStart b/doc/da/HurtigStart new file mode 100644 index 000000000000..b54590bba3db --- /dev/null +++ b/doc/da/HurtigStart @@ -0,0 +1,151 @@ +Dette dokument er en delvis oversættelse af den engelske README filen. +Det originale dokument har meget mere information, sÃ¥ hvis du ikke kan +finde det du har brug for her og kan forstÃ¥ en smule engelsk, sÃ¥ prøv +at se i den Engelske README-fil. + +For mere information, kompatibilitet lister, detaljer om donering, den +seneste udgivelse, statusrapporter og mere, kan du besøge ScummVMs hjemme- +side pÃ¥: http://www.scummvm.org/ + +Indholdsfortegnelse: +-------------------- +1.0) Indledning + * 1.1 Om ScummVM + * 1.2 Hurtig start +2.0) Kontakt + * 2.1 Rapportering af fejl + +1.0) Indledning: +---- ----------- + +1.1) Om ScummVM: +---- ----------- +ScummVM er et program, som tillader dig at køre visse klassiske grafiske +peg-og-klik eventyr spil, hvis du allerede har deres data filer. Den +smarte del omkring dette: ScummVM erstatter bare de eksekverbare filer +der fulgte med i spillet, sÃ¥ du kan afspille dem pÃ¥ systemer, hvor de +aldrig var designet til! + +Oprindeligt var det designet til at køre LucasArts' SCUMM spil, sÃ¥som +Maniac Mansion, Monkey Island, Day of the Tentacle eller Sam and Max. +SCUMM stÃ¥r for 'Script Creation Utility for Maniac Mansion', som var det +første spil som LucasArts designede dette system til. Og langt senere gav +navn til ScummVM ('VM', betyder Virtuel Maskine). + +EfterhÃ¥nden er understøttelse for en masse ikke-SCUMM spil blevet tilføjet, +og ScummVM understøtter nu ogsÃ¥ mange af Sierras AGI og SCI-spil (sÃ¥som +Kings Quest 1-6, Space Quest 1-5, ...), Discworld 1 og 2, Simon the Sorcerer +1 og 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword I og II, +Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia serien, +mange af Humongous Entertainments børne SCUMM spil (herunder Freddi Fish +and Putt Putt spil) og mange flere. Du kan finde en komplet liste med +oplysninger om, hvilke eventyr der understøttes og hvor godt, pÃ¥ +kompatibilitetssiden. ScummVM forbedres løbende, sÃ¥ vend ofte tilbage. + +Blandt de systemer, som du kan spille disse spil pÃ¥ er regulære desktop +computere (Windows, Linux, Mac OS X, ...), spillekonsoller (Dreamcast, +Nintendo DS og Wii, PS2, PSP, ...), smartphones (Android, iPhone, PocketPC, +Symbian ...) og flere. + +PÃ¥ dette tidspunkt er ScummVM stadig under kraftig udvikling. Vær opmærksom +pÃ¥, at selvom vi forsøger at sørge for, at mange spil kan gennemføres med fÃ¥ +store fejl, kan nedbrud ske, og vi tilbyder ingen garanti. NÃ¥r det er sagt, +er nogle af spillene blevet understøttet i lang tid og bør fungerer fint +med alle nyere stabile udgaver. Du kan fÃ¥ en fornemmelse af, hvor godt +hvert spil virker i ScummVM, ved at kigge pÃ¥ kompatibilitetssiden. Faktisk, +hvis du søger lidt rundt, vil du mÃ¥ske opdage, at ScummVM endog anvendes +kommercielt til genudgivelse af nogle af understøttede spil pÃ¥ moderne +platforme. Dette viser, at flere virksomheder er tilfredse med kvaliteten +af ​​programmet, og hvor godt det kan køre nogle af spillene. + +Hvis du har fornøjelse af ScummVM, er du velkommen til at donere ved hjælp +af PayPal-knappen pÃ¥ ScummVM's hjemmeside. Dette vil hjælpe os med at købe +værktøjer nødvendige for at udvikle ScummVM nemmere og hurtigere. Hvis du +ikke kan donere, hjælp og bidrage med en programrettelse! + +1.2) Hurtig start: +---- ------------ +VIGTIGT: Denne korte vejledning antager, at du bruger ScummVM pÃ¥ dansk. +Som standard vil ScummVM bruge dit operativsystem sprog. Hvis du +foretrækker at bruge ScummVM pÃ¥ engelsk, kan du ogsÃ¥ foretrække at +følge vejledning fra den engelske README fil. + +For de utÃ¥lmodige blandt jer, er her hvordan du fÃ¥r ScummVM op at køre +i fem enkle trin. + +1. Hent ScummVM fra og +installere det. + +2. Opret en mappe pÃ¥ din harddisk og kopiere spillets datafiler fra de +oprindelige medier til denne mappe. Gentag dette for hvert spil du +ønsker at spille (det er bedre at bruge en separat mappe til hvert spil). + +3. Start ScummVM. + +Hvis ScummVM pÃ¥ dette tidspunkt vises pÃ¥ engelsk i stedet for dansk, gør +som følger for at ændre sprog: + - Klik pÃ¥ 'Options'. + - Klik pÃ¥ højre pil i fanebjælken og vælg 'Misc' fanen. + - Vælg "Dansk" i "GUI Language'og klik pÃ¥ 'OK'. + - Bekræft meddelelsen boksen, der popper op, klik pÃ¥ 'Quit' for at + afslutte ScummVM og derefter genstarte programmet. + +Vælg nu 'Tilføj spil', vælge mappen med spillets datafiler (forsøg ikke +at vælge datafilerne selv!) Og tryk pÃ¥ 'Vælg' + +4. En dialog skulle komme op, hvor du kan konfigurere forskellige +indstillinger, hvis du ønsker det (det burde dog være fint at lade alt +forblive pÃ¥ sin standard). Bekræft dialogen. + +5. Vælg det spil, du ønsker at spille pÃ¥ listen, og tryk pÃ¥ 'Start'. + +ScummVM husker de spil, du tilføjer. SÃ¥ hvis du lukker ScummVM, vil +listen over spil næste gang du starter den, indeholde alle de spil du +tidligere har tilføjet. Du kan derfor gÃ¥ direkte til trin 5, medmindre +du ønsker at tilføje flere spil. + +Tip: Hvis du ønsker at tilføje flere spil pÃ¥ én gang, sÃ¥ prøv at trykke +og holde shift-tasten nede før du klikker pÃ¥ 'Tilføj spil' - teksten vil +skifte til 'Tilføj flere', og hvis du trykker pÃ¥ den, bliver du igen bedt +om at vælge en mappe, men denne gang vil ScummVM søge gennem alle +undermapper for understøttede spil. + +2.0) Kontakt: +---- -------- +Den nemmeste mÃ¥de at kontakte ScummVM holdet pÃ¥ er ved at sende fejlrapporter +(se afsnit 2.1) eller ved at bruge vores fora pÃ¥ http://forums.scummvm.org. +Du kan ogsÃ¥ deltage og e-maile til scummvm-devel postlisten, eller chatte +med os pÃ¥ IRC (#scummvm pÃ¥ irc.freenode.net). Bed os venligst ikke om at +understøtte et ikke-understøttet spil -- læs FAQ pÃ¥ vores hjemmeside først. +Bemærk, at det officielle sprog i dette forum, mailing liste og chat er +engelsk og ingen andre sprog bør anvendes. + +2.1) Rapportering af fejl: +---- --------------------- +For at rapportere en fejl, skal du oprette en SourceForge konto, og følge +"Bug Tracker" linket fra vores hjemmeside. Sørg for at fejlen er reproducerbare, +og stadig forekommer i den seneste git/Daglig byggede version. +Kontroller ogsÃ¥ listen med kendte problemer (nedenfor) og kompatibilitetslisten +pÃ¥ vores hjemmeside for spillet, for at sikre, at problemet ikke allerede er kendt: + + http://www.scummvm.org/compatibility_stable.php + +Vær venlig ikke at rapportere fejl pÃ¥ spil, der ikke er anført som værende +mulige at gennemføre i 'understøttede spil' sektionen, eller kompatibilitetslisten. +Vi -ved- disse spil har fejl. + +Inkluder venligst følgende oplysninger: + - ScummVM version (VENLIGST test pÃ¥ den nyeste git/Daglig byggede) + - Detaljer om fejlen, herunder oplysninger om genskabelsen af fejlen + - Sprog i spillet (engelsk, tysk, ...) + - Version af spillet (talkie, diskette, ...) + - Platform og Kompiler (Win32, Linux, FreeBSD, ...) + - Medsend et gemt spil hvis det er muligt + - Hvis fejlen kun skete for nylig, notér venligst den sidste version + uden fejl, og den første version med fejlen. PÃ¥ denne mÃ¥de kan vi + ordne det hurtigere ved at kigge pÃ¥ de foretagne ændringer. + +Endelig, bedes du rapportere hvert problem separat; indsend ikke flere +problemer pÃ¥ samme billet. (Ellers bliver det svært at spore status for +hver enkelt fejl). Husk ogsÃ¥ pÃ¥, at alle fejlrapporter skal skrives pÃ¥ +engelsk. \ No newline at end of file diff --git a/doc/de/Liesmich b/doc/de/Liesmich index 5d24ec050b88..88b6ce6de86f 100644 --- a/doc/de/Liesmich +++ b/doc/de/Liesmich @@ -56,6 +56,8 @@ Inhaltsverzeichnis: * 7.8 Komprimierte Audio-Dateien verwenden (MP3, Ogg Vorbis, FLAC) * 7.9 Ausgabefrequenzen 8.0) Konfigurationsdatei + * 8.1 Verwendbare Konfigurationsschlüsselwörter + * 8.2 Spielspezifische Optionen bei der grafischen Benutzeroberfläche 9.0) Kompilierung @@ -273,11 +275,16 @@ AGOS-Spiele von Adventuresoft/Horrorsoft: Floyd - Es gibt noch Helden [feeble] GOB-Spiele von Coktel Vision: + Bambou le sauveur de la jungle [bambou] Bargon Attack [bargon] + Fascination [fascination] + Geisha [geisha] Gobliiins [gob1] Gobliins 2 [gob2] Goblins 3 [gob3] Lost in Time [lostintime] + Once Upon A Time: Little Red Riding Hood [littlered] + Urban Runner [urban] Woodruff and the Schnibble of Azimuth [woodruff] Ween: The Prophecy [ween] @@ -310,6 +317,7 @@ Andere Spiele: SCUMM-Spiele von Humongous Entertainment: Backyard Baseball [baseball] Backyard Baseball 2001 [baseball2001] + Backyard Baseball 2003 [baseball2003] Backyard Football [football] Big Thinkers First Grade [thinker1] Big Thinkers Kindergarten [thinkerk] @@ -378,7 +386,6 @@ Wenn Sie über den neusten Stand bezüglich der Kompatibilität des Spiels erfah möchten, besuchen Sie unsere Website und schauen Sie in der Kompatibilitätsliste nach. - Backyard Baseball 2003 [baseball2003] Backyard Football 2002 [football2002] Backyard Soccer [soccer] Backyard Soccer MLS [soccermls] @@ -558,6 +565,15 @@ Zwischensequenzen, aber diese sind von niedrigerer Qualität.) Sie können sie auch in einem Unterverzeichnis namens „video“ ablegen, wenn Ihnen das lieber ist. +Bei PlayStation-Versionen können Sie die Original-Videos von CD ausgeben lassen. +Alle Dateien mit der Endung „STR“ sollten als Raw-Sektoren von der CD ausgelesen +werden (alle 2352 Bytes pro Sektor). Sie können stattdessen auch die weiter +unten erwähnten umgewandelten Zwischensequenzen verwenden, aber dies +funktioniert nicht bei allen Videos in Baphomets Fluch II. Weitere Informationen +finden Sie hier: + + http://wiki.scummvm.org/index.php/HOWTO-PlayStation_Videos + Einige Neuausgaben der Spiele, wie beispielsweise die PlayStation-Version, haben keine Smacker-Videos. Revolution Software hat uns freundlicherweise erlaubt, die Zwischensequenzen umgewandelt auf unserer Website als Download zur Verfügung zu @@ -577,9 +593,11 @@ Ogg-Vorbis-Audio angeboten. Um diese Zwischensequenzen mit Ogg-Vorbis-Audio abspielen zu können, ist eine Version von ScummVM erforderlich, die sowohl mit Unterstützung von libVorbis als auch zlib kompiliert wurde. -Für Baphomets Fluch bieten wir auch ein Untertitel-Paket an. Entpacken Sie es -einfach und folgen Sie den Anweisungen in der liesmich.txt. (Baphomets Fluch II -hat bereits Untertitel; für diese ist keine zusätzliche Arbeit notwendig.) +Für Baphomets Fluch bieten wir außerdem ein Untertitelpaket an. Entpacken Sie es +einfach und folgen Sie den Anweisungen in der liesmich.txt. Das Untertitelpaket +funktioniert momentan nicht bei der Verwendung von PlayStation-Videos. +(Baphomets Fluch II hat bereits Untertitel; für diese ist keine zusätzliche +Arbeit notwendig.) 3.7.2) Zwischensequenzen von Baphomets Fluch I und II im Rückblick: @@ -800,11 +818,11 @@ originale EXE-Datei des Spiels (mickey.exe) sowie die Spieldateien. Für das Spiel gibt es unter ScummVM umfangreiche Mausunterstützung, obwohl es im Originalspiel überhaupt keine Mausunterstützung gab. Menüpunkte können mit der -Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orten zu -wechseln. Wenn die Maus über die Kanten des Bildschirms bewegt wird, ändert sich +Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orte zu +wechseln. Wenn die Maus über den Rand des Bildschirms bewegt wird, ändert sich die Farbe des Zeigers in Rot, wenn es möglich ist, in diese Richtung zu gehen. -Der Spieler kann dann einfach auf die Kanten des Spielbildschirms klicken, um -den Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel +Der Spieler kann dann einfach auf den Rand des Spielbildschirms klicken, um den +Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel unkomplizierter ist, als sich mit dem Menü umherzubewegen. @@ -815,11 +833,11 @@ importieren. Für das Spiel gibt es unter ScummVM umfangreiche Mausunterstützung, obwohl es im Originalspiel überhaupt keine Mausunterstützung gab. Menüpunkte können mit der -Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orten zu -wechseln. Wenn die Maus über die Kanten des Bildschirms bewegt wird, ändert sich +Maus ausgewählt werden und es ist auch möglich, mittels Maus an andere Orte zu +wechseln. Wenn die Maus über den Rand des Bildschirms bewegt wird, ändert sich die Farbe des Zeigers in Rot, wenn es möglich ist, in diese Richtung zu gehen. -Der Spieler kann dann einfach auf die Kanten des Spielbildschirms klicken, um -den Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel +Der Spieler kann dann einfach auf den Rand des Spielbildschirms klicken, um den +Ort zu wechseln, ähnlich wie in vielen Adventures, was einfacher und viel unkomplizierter ist, als sich mit dem Menü umherzubewegen. @@ -903,7 +921,7 @@ Kompatibilitätsseite der Website aufgeführt ist, sehen Sie bitte im Abschnitt - Sprache und Untertitel zusammen führen manchmal dazu, dass die Sprachausgabe vorzeitig abgeschnitten wird. Dies ist eine Beschränkung des Originalspiels. - - Nur die Standardsprache (Englisch) der Spieldaten wird bei den Amiga- und + - Nur die Standard-Sprache (Englisch) der Spieldaten wird bei den Amiga- und Macintosh-Versionen unterstützt. Simon the Sorcerer's Game Pack: @@ -1044,7 +1062,7 @@ gestartet werden -- siehe nächster Abschnitt. --debugflags=FLAGGEN Aktiviert für Engine spezifische Debug-Flaggen (getrennt durch Kommas). -u, --dump-scripts Aktiviert die Skriptausgabe, wenn ein Verzeichnis - namens 'dumps' im aktuellen Verzeichnis existiert. + namens „dumps“ im aktuellen Verzeichnis existiert. --cdrom=ZAHL CD-Laufwerk, von dem CD-Titel wiedergegeben werden sollen (Standard: 0 = erstes Laufwerk) @@ -1436,7 +1454,7 @@ Spielstände werden bei einigen Plattformen standardmäßig im aktuellen Verzeichnis gespeichert und bei anderen in voreingestellten Verzeichnissen. Sehen Sie sich das Beispiel weiter unten in dieser Liesmich-Datei an. -Die folgenden Plattformen haben ein anderes Standardverzeichnis: +Die folgenden Plattformen haben ein anderes Standard-Verzeichnis: Mac OS X: $HOME/Documents/ScummVM Savegames/ @@ -1454,6 +1472,11 @@ Die folgenden Plattformen haben ein anderes Standardverzeichnis: \Profiles\Benutzername\ Application Data\ScummVM\Saved games\ +Hinweis für Anwender von Windows NT4/2000/XP/Vista/7: Das Standard-Verzeichnis +für Spielstände wurde bei ScummVM 1.5.0 geändert. Die Stapelverarbeitungsdatei +migration.bat kann verwendet werden, um die Spielstände vom alten +Standard-Verzeichnis in das neue zu kopieren. + 6.1) Automatische Spielstände: ---- ------------------------- @@ -1797,7 +1820,7 @@ SoundFonts): fluidsynth -m alsa_seq /Pfad/zu/8mbgmsfx.sf2 Wenn einmal TiMidity oder FluidSynth laufen, verwenden Sie den Befehl -„aconnect -o -l“, der bereits in diesem Abschnitt beschrieben wurde. +„aconnect -o -lâ€, der bereits in diesem Abschnitt beschrieben wurde. 7.6.2) Sound-Wiedergabe mittels IRIX-dmedia-Sequenzer: [NUR IN UNIX] @@ -1839,7 +1862,7 @@ Dienstprogramm): Nun können Sie ScummVM starten und TiMidity für Musikausgabe auswählen. Standardmäßig wird das Programm mit dem localhost:7777 verbunden, aber Sie -können Host und Port über die Umgebungsvariable „TIMIDITY_HOST“ ändern. Sie +können Host und Port über die Umgebungsvariable „TIMIDITY_HOST†ändern. Sie können auch eine „Gerätenummer“ über die Umgebungsvariable „SCUMMVM_MIDIPORT“ festlegen. @@ -2117,10 +2140,13 @@ Eine beispielhafte Konfigurationsdatei sieht wie folgt aus: path=C:\amiga_mi2\ music_driver=windows -Erklärung zu nachfolgender Liste: In der nachfolgenden Liste mit -Schlüsselwörtern werden rechts das Schlüsselwort, in der Mitte der Typ der -erwarteten Zuweisung und rechts die Erklärung angezeigt. Der Typ „Bool“ bedeutet -Wahrheitswert. Er kann entweder „true“ (wahr) oder „false“ (falsch) sein. + +8.1) Verwendbare Konfigurationsschlüsselwörter +---- ----------------------------------------- +In der nachfolgenden Liste mit Schlüsselwörtern für die Konfigurationsdatei +werden rechts das Schlüsselwort, in der Mitte der Typ der erwarteten Zuweisung +und rechts die Erklärung angezeigt. Der Typ „Bool“ bedeutet Wahrheitswert. Er +kann entweder „true“ (wahr) oder „false“ (falsch) sein. Die folgenden Schlüsselwörter werden erkannt: @@ -2149,8 +2175,6 @@ Die folgenden Schlüsselwörter werden erkannt: fullscreen Bool Vollbildmodus aspect_ratio Bool Seitenverhältniskorrektur - disable_dithering Bool Entfernung von Fehlerdiffusionsartefakten in - EGA-Spielen gfx_mode Text Grafikmodus (normal, 2x, 3x, 2xsai, super2xsai, supereagle, advmame2x, advmame3x, hq2x, hq3x, tv2x, dotmatrix) @@ -2198,6 +2222,28 @@ Die folgenden Schlüsselwörter werden erkannt: boot_param Zahl Ruft Boot-Skript mit dieser Nummer auf. +Sierra-Spiele, welche die AGI-Engine verwenden, verfügen zusätzlich über +folgendes nicht standardmäßiges Schlüsselwort: + + originalsaveload Bool Falls „true“, werden die originalen Menüs zum + Speichern und Laden statt der + erweiterten von ScummVM verwendet. + +Sierra-Spiele, welche die SCI-Engine verwenden, verfügen zusätzlich über +folgende nicht standardmäßige Schlüsselwörter: + + disable_dithering Bool Entfernung von Fehlerdiffusionsartefakten in + EGA-Spielen + prefer_digitalsfx Bool Falls „true“, werden digitale Sound-Effekte + statt synthetisierter bevorzugt. + originalsaveload Bool Falls „true“, werden die originalen Menüs zum + Speichern und Laden statt der + erweiterten von ScummVM verwendet. + native_fb01 Bool Falls „true“, wird für die MIDI-Ausgabe + der Musiktreiber für eine Music-Feature-Karte + von IBM oder für ein Yamaha-FB-01-FM- + Synthetisierungsmodul verwendet. + Baphomets Fluch II verfügt zusätzlich über folgende nicht standardmäßige Schlüsselwörter: @@ -2213,6 +2259,12 @@ Schlüsselwörter: music_mute Bool Falls „true“, wird Musik unterdrückt. sfx_mute Bool Falls „true“, werden Geräusche unterdrückt. +Jones in the Fast Lane verfügt zusätzlich über folgendes nicht standardmäßiges +Schlüsselwort: + + music_mute Bool Falls „true“, wird - sofern verfügbar - CD-Ton + anstatt des Tons im Spiel verwendet. + Die Windows-Version von King's Quest VI verfügt zusätzlich über folgendes nicht standardmäßiges Schlüsselwort: @@ -2223,6 +2275,25 @@ standardmäßiges Schlüsselwort: verwendet - hochskaliert, um zum Rest der hochskalierten Grafiken zu passen. +Lands of Lore: The Throne of Chaos verfügt zusätzlich über folgende nicht +standardmäßige Schlüsselwörter: + + smooth_scrolling Bool Falls „true“, ist das Scrollen gleichmäßiger, + wenn man von einem Bildschirm zum anderen + wechselt. + floating_cursors Bool Falls „true“, verwandelt sich der Mauszeiger in + einen Richtungspfeil, wenn er über den + Bildschirmrand bewegt wird. Durch einen + Mausklick kann der Spieler dann in diese + Richtung gehen. + +Die CD-Version von Space Quest IV verfügt zusätzlich über folgendes nicht +standardmäßiges Schlüsselwort: + + silver_cursors Bool Falls „true“, wird ein alternativer Satz + silberner Mauszeiger verwendet anstatt der + originalen goldenen. + Simon the Sorcerer 1 und 2 verfügen zusätzlich über folgende nicht standardmäßige Schlüsselwörter: @@ -2234,6 +2305,16 @@ Schlüsselwort: walkspeed Zahl Bewegungsgeschwindigkeit (0-4) +The Legend of Kyrandia: Malcolm's Revenge verfügt zusätzlich über folgende nicht +standardmäßige Schlüsselwörter: + + studio_audience Bool Falls „true“, hört man stets Applaus- und + Jubelgeräusche, wenn Malcolm einen Scherz macht. + skip_support Bool Falls „true“, kann der Spieler Textteile und + Zwischensequenzen überspringen. + helium_mode Bool Falls „true“, klingen alle Spielfiguren so, + als hätten sie Helium eingeatmet. + The 7th Guest verfügt zusätzlich über folgendes nicht standardmäßiges Schlüsselwort: @@ -2242,6 +2323,18 @@ Schlüsselwort: im_an_ios [ich bin ein iOS]) +8.2) Spielspezifische Optionen bei der grafischen Benutzeroberfläche +---- --------------------------------------------------------------- +Viele spielspezifische Optionen, die im vorigen Abschnitt aufgeführt wurden, +können über die grafische Benutzeroberfläche angesprochen werden. Falls eine +spielspezifische Option für ein bestimmtes Spiel verfügbar ist, erscheint ein +neuer Reiter mit der Bezeichnung „Engine“, wenn man dieses Spiel hinzufügt oder +dessen Spieloptionen bearbeitet. Falls die spielspezifischen Optionen nicht +angezeigt werden, muss das betreffende Spiel einmal gestartet oder neu zur +Spieleliste hinzugefügt werden. Dadurch wird die Konfiguration von jedem Eintrag +aktualisiert, was die spielspezifischen Optionen zum Vorschein bringt. + + 9.0) Kompilierung: ---- ------------- Für eine aktuelle Ãœbersicht dazu, wie man ScummVM für unterschiedliche @@ -2341,7 +2434,3 @@ Viel Glück und viel Spaß beim Spielen wünscht das ScummVM-Team. http://www.scummvm.org/ ------------------------------------------------------------------------ - - -(Deutscher Text basiert auf README mit SHA1-ID: -d1de75a6ca828ab2fcdbce6352a12337f93fc21c) diff --git a/doc/de/Neues b/doc/de/Neues index 23fe6751c1d7..74203148e7f1 100644 --- a/doc/de/Neues +++ b/doc/de/Neues @@ -1,34 +1,92 @@ -Umfangreichere Änderungsaufzeichnungen des neusten experimentellen Codes finden +Umfangreichere Änderungsaufzeichnungen des neusten experimentellen Codes finden Sie auf Englisch unter: https://github.com/scummvm/scummvm/commits/ -1.5.0 (??.??.????) +1.5.0 (27.07.2012) Neue Spiele: + - Unterstützung für Backyard Baseball 2003 hinzugefügt. + - Unterstützung für Blue Force hinzugefügt. + - Unterstützung für Darby der Drache hinzugefügt. + - Unterstützung für Dreamweb hinzugefügt. + - Unterstützung für Geisha hinzugefügt. + - Unterstützung für Gregor und der Heißluftballon hinzugefügt. + - Unterstützung für Magic Tales: Liam Finds a Story hinzugefügt. + - Unterstützung für Once Upon A Time: Little Red Riding Hood hinzugefügt. + - Unterstützung für Sleeping Cub's Test of Courage hinzugefügt. - Unterstützung für Soltys hinzugefügt. + - Unterstützung für The Princess and the Crab hinzugefügt. + +Allgemein: + - MT-32-Emulationscode auf den neusten Stand des Munt-Projekt-Schnappschusses + gebracht. Die Emulation hat sich drastisch verbessert. + - Unterstützung für TrueType-Schriftarten über FreeType2 in unserer + grafischen Benutzeroberfläche hinzugefügt. Damit einhergehend wurde auch + GNU FreeFont zu unserem modernen Thema hinzugefügt. Beachten Sie, dass + nicht alle Ports hiervon profitieren. + - Baskische Ãœbersetzung hinzugefügt. + - Spiel- und engine-spezifische Optionen in den Engines AGI, DREAMWEB, KYRA, + QUEEN, SKY und SCI hinzugefügt. Es ist nun möglich, diese über den + Engine-Reiter anzusprechen, wenn man ein Spiel hinzufügt oder dessen + Spieloptionen bearbeitet. In den meisten Fällen müssen Sie jedes Spiel + einmal starten oder diese alle in ScummVMs Spieleliste neu hinzufügen, um + den Reiter für spielspezifische Optionen zu erhalten. + - Aussehen von vorhersagendem Eingabedialog verbessert. + - Verschiedene Verbesserungen der grafischen Benutzeroberfläche. - SDL-Portierungen: - - Unterstützung für OpenGL hinzugefügt. (GSoC-Aufgabe) + Baphomets Fluch 1: + - Falsche Soundeffekte in der DOS-/Windows-Demo korrigiert. + - Unterstützung für PlayStation-Videos hinzugefügt. + - Fehlende Untertitel zur Demo hinzugefügt. + + Baphomets Fluch 2: + - Unterstützung für PlayStation-Videos hinzugefügt. Cine: - Roland-MT-32-Ausgabetreiber integriert. + Drascula: + - Spanische Untertitel zur Zwischensequenz mit Von Braun + hinzugefügt (3069981: Keine Untertitel in Szene mit „Von Braun“). + + Gob: + - Absturz in Lost in Time beseitigt. + - AdLib-Abspieler umgeschrieben. Den nun funktionierenden MDY-Abspieler in + Fascination und Geisha aktiviert. + SCUMM: - Unterstützung für die Macintosh-Version von SPY Fox in Hold the Mustard hinzugefügt. - Dialog zur Auswahl des Schwierigkeitsgrads für Loom FM-TOWNS hinzugefügt. + - Grafische Störungen in HE98-Version von Pajama Sam's Lost & Found + beseitigt. - Sword1: - - Falsche Soundeffekte in der DOS-/Windows-Demo korrigiert. + iPhone-Portierung: + - Verhalten von Geste für F5 (Menü) geändert, um stattdessen das Hauptmenü zu + öffnen. + - Unterstützung für spezifische Mauszeigerpaletten hinzugefügt. Hierdurch + wird beispielsweise der rote Zeiger im modernen Thema verwendet. + - Unterstützung für Seitenverhältniskorrektur hinzugefügt. + - Unterstützung für 16 Bits pro Pixel bei Spielen integriert. + + Maemo-Portierung: + - Unterstützung für Nokia 770 mit dem Betriebssystem OS2008 HE hinzugefügt. + - Konfigurierbare Tastenzuweisung hinzugefügt. Windows-Portierung: - - Standardmäßiger Speicherort für Spielstände bei + - Standard-Verzeichnis für Spielstände bei Windows NT4/2000/XP/Vista/7 geändert. + (Die Stapelverarbeitungsdatei migration.bat kann verwendet werden, um die + Spielstände vom alten Standard-Verzeichnis in das neue zu kopieren.) 1.4.1 (27.01.2012) AGOS: - Das Laden von Videos direkt aus InstallShield-Archiven in der Windows-Version von Floyd - Es gibt noch Helden korrigiert. + Baphomets Fluch 2: + - Leichte Grafikverbesserung für PSX-Version. + + BASS: - Unterstützung für verbesserte Musik von James Woodcock hinzugefügt (http://www.jameswoodcock.co.uk/?p=7695). @@ -52,9 +110,6 @@ Sie auf Englisch unter: nicht alle Kanäle zurückgesetzt wurden und somit einige Noten falsch klangen. - Sword2: - - Leichte Grafikverbesserung für PSX-Version. - 1.4.0 (11.11.2011) Neue Spiele: - Unterstützung für Lands of Lore: The Throne of Chaos hinzugefügt. @@ -82,6 +137,12 @@ Sie auf Englisch unter: - Laden und Speichern in der PC-Version von Waxworks repariert. - Musik in den PC-Versionen von Elvira 1 und 2 sowie Waxworks korrigiert. + Baphomets Fluch 1: + - Aufhängen in Windows-Demo beseitigt. + - Absturz beseitigt, wenn Untertitelpaket für Zwischensequenzen in + Macintosh-Version verwendet wird. + + Groovie: - Unterstützung für die iOS-Version von The 7th Guest hinzugefügt. @@ -105,11 +166,6 @@ Sie auf Englisch unter: - Palettenhandhabung in der Amiga-Version von Indiana Jones and the Fate of Atlantis verbessert. - Sword1: - - Aufhängen in Windows-Demo beseitigt. - - Absturz beseitigt, wenn Untertitelpaket für Zwischensequenzen in - Macintosh-Version verwendet wird. - Tinsel: - Löschen von Spielständen aus der Liste der Speicherstände korrigiert (im Startmenü und im ScummVM-Menü innerhalb des Spiels). @@ -189,7 +245,7 @@ Sie auf Englisch unter: Drascula: - Deutsche und französische Untertitel zur Zwischensequenz mit Von Braun - hinzugefügt (3069981: Keine Untertitel in Szene mit “Von Braun“). + hinzugefügt (3069981: Keine Untertitel in Szene mit „Von Braun“). - Französische Ãœbersetzung des Spiels verbessert. - Unterstützung für Rückkehr zur Spieleliste hinzugefügt. @@ -1313,7 +1369,7 @@ Sie auf Englisch unter: - Grafische Benutzeroberfläche für SoundFont-Einstellungen hinzugefügt (werden momentan nur von CoreAudio und FluidSynth-MIDI-Treibern verwendet). - - Der MPEG-Spieler konnte aussetzen, wenn der Ton vorzeitig endet. + - Der MPEG-Abspieler konnte aussetzen, wenn der Ton vorzeitig endet. - Automatische Skalierung der Benutzeroberfläche verbessert, um den vollen Vorteil des Bildschirms auszunutzen. - Fehlerbeseitigungen für GCC 4 @@ -1667,7 +1723,3 @@ Sie auf Englisch unter: 0.0.1 (08.10.2001) - Erste Version - - -(Deutscher Text basiert auf NEWS mit SHA1-ID: -ab2b020ff10b2e5d25cc93757029838c7eac6b41) diff --git a/doc/se/LasMig b/doc/se/LasMig index 656210883fe9..9ac79b4c3527 100644 --- a/doc/se/LasMig +++ b/doc/se/LasMig @@ -1,5 +1,4 @@ ScummVM LÄS MIG -Senast uppdaterad: $Date$ ------------------------------------------------------------------------ För ytterligare information, kompatibilitetslistor, donationsdetaljer, den senaste programversionen, utvecklingsrapporter med mera, var god besök ScummVM:s hemsida pÃ¥ http://www.scummvm.org/ @@ -55,6 +54,8 @@ InnehÃ¥ll: * 7.8 Att använda komprimerade ljudfiler (MP3, Ogg Vorbis, Flac) * 7.9 Uppspelningsfrekvens 8.0) Konfigurationsfilen + * 8.1 Igenkända nyckelord + * 8.2 Spelinställningar som kan aktiveras via användargränssnittet 9.0) Kompilering @@ -184,13 +185,18 @@ AGOS-spel frÃ¥n Adventuresoft/Horrorsoft: The Feeble Files [feeble] GOB-spel frÃ¥n Coktel Vision: + Bambou le sauveur de la jungle [bambou] Bargon Attack [bargon] + Fascination [fascination] + Geisha [geisha] Gobliiins [gob1] Gobliins 2 [gob2] Goblins 3 [gob3] Lost in Time [lostintime] + Once Upon A Time: Little Red Riding Hood [littlered] The Bizarre Adventures of Woodruff and the Schnibble [woodruff] + Urban Runner [urban] Ween: The Prophecy [ween] MADE-spel frÃ¥n Activision: @@ -221,6 +227,7 @@ MADE-spel frÃ¥n Activision: SCUMM-spel frÃ¥n Humongous Entertainment: Backyard Baseball [baseball] Backyard Baseball 2001 [baseball2001] + Backyard Baseball 2003 [baseball2003] Backyard Football [football] Big Thinkers First Grade [thinker1] Big Thinkers Kindergarten [thinkerk] @@ -288,7 +295,6 @@ Living Books-spel: De följande spelen borde starta, men är ännu ej helt spelbara. Spela dem pÃ¥ egen risk och var god skicka inga buggrapporter angÃ¥ende dem. För senaste nytt angÃ¥ende spelkompatibilitet kan du besöka vÃ¥r hemsida och läsa kompatibilitetslistan. - Backyard Baseball 2003 [baseball2003] Backyard Football 2002 [football2002] Backyard Soccer [soccer] Backyard Soccer MLS [soccermls] @@ -387,6 +393,11 @@ Instruktionerna för Broken Sword-spelen är för Sold-Out Software-versionerna ------ --------------------------------- Filmscenerna i Broken Sword-spelen har varit med om en hel del (se nästa avdelning om du är intresserad) men i regel behöver du bara kopiera .SMK-filerna frÃ¥n â€SMACKS†eller â€SMACKSHIâ€-katalogerna pÃ¥ CD-skivorna till samma katalog där de andra datafilerna ligger. (Broken Sword har även en â€SMACKSLO†katalog med samma filmscener, men dessa har lägre kvalitet.) Du kan även lägga dem i en underkatalog med namnet â€videoâ€, om du vill. +För PlayStation-versionerna kan du dumpa originalfilmerna frÃ¥n CD:n. Dumpa varje fil med ändelsen â€STR†som rÃ¥a sektorer frÃ¥n CD:n (samtliga 2352 bitar per sektor). DU kan även använde de omkodade filmscenerna nedan istället, men detta fungerar inte för alla filmer i Broken Sword II. För ytterligare information, se: + + http://wiki.scummvm.org/index.php/HOWTO-PlayStation_Videos + + Vissa nyutgÃ¥vor av spelen, tillika PlayStation-versionen, har inga Smacker videos. Revolution Software har varit goda nog att skapa nykodade filmscener som kan laddas hem frÃ¥n vÃ¥ran hemsida: http://www.scummvm.org/downloads.php @@ -395,7 +406,7 @@ Dessa filmscener är tillgängliga i DXA-format med FLAC-ljud. Kvaliteten är de För de system som är för lÃ¥ngsamma för att hantera FLAC-ljud finns ljudet för dessa filmscener att ladda hem separat som OGG Vorbis-ljud. För att se dessa filmscener med OGG Vorbis-ljud krävs en version av ScummVM som kompilerats med stöd för bÃ¥de libVorbis och zlib. -Vi erbjuder även ett tillägg för undertexter i Broken Sword. Packa upp tillägget och följ instruktionerna i readme.txt-filen. (Broken Sword II har redan undertexter; inga modifikationer krävs för dem). +Vi erbjuder även ett tillägg för undertexter i Broken Sword. Packa upp tillägget och följ instruktionerna i readme.txt-filen. Undertextpaketet fungerar för tillfället inte med PlayStation-filmer (Broken Sword II har redan undertexter; inga modifikationer krävs för dem). 3.7.2) Broken Sword-spelens filmscener – en Ã¥terblick: @@ -475,7 +486,7 @@ Döp om voices.wav pÃ¥ CD4 till voices4.wav 3.14) Notiser om The Legend of Kyrandia: ----- ---------------------------------- -För att spela The Legend of Kyrandia i ScummVM behöver du “kyra.datâ€-filen som är tillgänglig frÃ¥n â€Downloadsâ€-avdelningen pÃ¥ ScummVM:s hemsida. +För att spela The Legend of Kyrandia i ScummVM behöver du “kyra.datâ€-filen. Filen borde alltid inkluderas med officiella ScummVM-paket. Om ScummVM klagar över att filen saknas kan du finna den pÃ¥ “Downloadsâ€-avdelningen av ScummVM:s hemsida. Märk att den nuvarande Windows-versionen av ScummVM borde ha filen inbyggd i programfilen, och sÃ¥lunda behöver du bara ladda hem den om ScummVM klagar över att filen saknas. 3.15) Notiser om Sierra AGI-spel med textinmatningshjälp: @@ -537,10 +548,6 @@ Den här versionen har följande kända problem. Du behöver inte rapportera dem FM-TOWNS-versioner av spel: - Kanji-versioner kräver en FM-TOWNS Font ROM - - ScummVM krashar slumpmässigt när FM-TOWNS Font Rom används för - kanji-versionerna av de följande spelen: - The Secret of Monkey Island, Monkey Island 2: LeChuck's Revenge - och Indiana Jones and the Fate of Atlantis Loom: - Att stänga av undertexterna via konfigurationsfilen är inte pÃ¥litligt dÃ¥ @@ -590,7 +597,6 @@ Den här versionen har följande kända problem. Du behöver inte rapportera dem The Legend of Kyrandia: - Varken musik eller ljudeffekter i Macintosh diskett-versioner. - Macintosh-CD använder DOS-musik och ljudeffekter. - - PC-9821-versionen saknar stöd för ljudeffekter. Humongous Entertainment-spel: - Endast originalgränssnittet för att ladda och spara kan användas. @@ -668,6 +674,7 @@ Ordning: scummvm [INSTÄLLNINGAR]... [SPEL] --themepath=PATH Sökväg dit GUI-teman lagras --list-themes Visa full lista med alla användbara GUI-teman -e, --music-driver=MODE Välj musik-driver (se även avdelning 7.0) + --list-audio-devices Visar tillgängliga ljudenheter -q, --language=LANG Välj spelets sprÃ¥k (se även avdelning 5.2) -m, --music-volume=NUM Ställ in musikvolym, 0-255 (standard: 192) -s, --sfx-volume=NUM Ställ in ljudeffektsvolym, 0-255 (standard: 192) @@ -822,19 +829,28 @@ Motorer som för närvarande stöder Ã¥tervändo till launchern: AGI AGOS CINE + COMPOSER + CRUISE DRACI + DRASCULA GOB GROOVIE + HUGO KYRA LURE + MADE + MOHAWK PARALLACTION QUEEN SAGA + SCI SCUMM SKY SWORD1 SWORD2 + TEENAGENT TOUCHE + TSAGE TUCKER @@ -1006,8 +1022,24 @@ Notis för WinCE-användare: PÃ¥ grund av de begränsade tangentborden pÃ¥ de fl Spardata lagras som standard i den aktiva katalogen pÃ¥ vissa plattformar och i förbestämda kataloger pÃ¥ andra plattformar. Du kan ställa in katalogen i konfigurationsfilen genom att ändra savepath-parametern. Se exempel för konfigurationsfilen senare i detta dokument. Plattformar som för närvarande har annorlunda standardkataloger: - Mac OS X: $HOME/Documents/ScummVM Savegames/ - Övriga unix-system: $HOME/.scummvm/ + Mac OS X: + $HOME/Documents/ScummVM Savegames/ + + Övriga unix-system: + $HOME/.scummvm/ + + Windows Vista/7: + \Users\username\AppData\Roaming\ScummVM\Saved games\ + + Windows 2000/XP: + \Documents and Settings\username\Application Data\ScummVM\Saved games\ + + Windows NT4: + \Profiles\username\Application Data\ScummVM\Saved games\ + +Spardata lagras i en gömd map I Windows NT4/2000/XP/Vista/7, som kan kommas Ã¥t genom att köra "%APPDATA%%\ScummVM\Saved Games\" eller genom att visa dolda filer i Windows Explorer. + +Notis för användare av NT4/2000/XP/Vista/7: Den förutbestämda platsen för spardata har ändrats i ScummVM 1.5.0. Migrationsfilen kan användas för att kopiera spardata frÃ¥n den förra platsen till den nya. 6.1) Autosparning: @@ -1059,20 +1091,28 @@ Där “xxx†stÃ¥r för positionsnumret (t.ex. 001) i ScummVM. AGI AGOS + CGE CINE + CRUISE DRACI GROOVIE + HUGO KYRA LURE + MOHAWK PARALLACTION QUEEN SAGA + SCI SCUMM SKY SWORD1 SWORD2 + TEENAGENT TINSEL + TOON TOUCHE + TSAGE TUCKER --save-slot/-x: @@ -1086,20 +1126,28 @@ Där “xxx†stÃ¥r för positionsnumret (t.ex. 001) i ScummVM. Motorer som för tillfället stöder --save-slot/-x: AGI + CGE CINE + CRUISE DRACI GROOVIE + HUGO KYRA LURE - PARALLACTION + MOHAWK QUEEN SAGA + SCI SCUMM SKY SWORD1 SWORD2 + TEENAGENT TINSEL + TOON TOUCHE + TSAGE + TUCKER 7.0) Musik och ljud: @@ -1396,7 +1444,7 @@ Att använda frekvenser mellan de ovansagda rekommenderas ej. Till att börja me ---- -------------------- Som standard sparas och laddas konfigrationsfilen i: - Windows Vista: + Windows Vista/7: \Users\username\AppData\Roaming\ScummVM\scummvm.ini, Windows 2000/XP: @@ -1458,6 +1506,9 @@ Ett exempel pÃ¥ en konfigurationsfil ser ut sÃ¥ här: path=C:\amiga_mi2\ music_driver=windows + +8.1) Igenkända nyckelord +---- ------------------- Följande nyckelord kan användas: path string Sökvägen dit spelets datafiler ligger @@ -1483,7 +1534,6 @@ Följande nyckelord kan användas: fullscreen bool Fullskärmsläge aspect_ratio bool Aktivera korrektion av bildförhÃ¥llande - disable_dithering bool Anti-gitter för EGA-spel gfx_mode string Grafikläge (normalt, 2x, 3x, 2xsai, super2xsai, supereagle, advmame2x, advmame3x, hq2x, hq3x, tv2x, dotmatrix) @@ -1529,6 +1579,29 @@ Följande nyckelord kan användas: boot_param number Skicka det här numret till boot script +Sierra-spel som använder AGI-motorn använder även följande nyckelord: + + originalsaveload bool Ställ in till “true†för att använda + originalskärmarna för ladda/spara + istället för ScummVM:s förbättrade + skärmar + +Sierra-spel som använder SCI-motorn använder även följande nyckelord: + + disable_dithering bool Tar bort gitter artefakter frÃ¥n EGA-spel + prefer_digitalsfx bool Ställ in till “true†för att föredra + digitala ljudeffekter istället för + syntetiserade ljudeffekter + originalsaveload bool Ställ in till “true†för att använda + originalskärmarna för ladda/spara + istället för ScummVM:s förbättrade + skärmar + native_fb01 bool Ställ in till “true†för att använda + ett IBM Music Feature-kort eller en + Yamaha FB-01 FM synthmodul för + MIDI-uppspelning + + Broken Sword II lägger till följande nyckelord: gfx_details number Grafisk detalj (0-3) @@ -1546,6 +1619,13 @@ Flight of the Amazon Queen lägger till följande nyckelord: sfx_mute bool Ställ in till “true†för att deaktivera ljudeffekter + +Jones in the Fast Lane använder även följande nyckelord: + music_mute bool Ställ in till “true†för att använda + CD-ljud, om tillgängligt, istället + spelets vanliga ljud. + + King's Quest VI Windows lägger till följande nyckelord: windows_cursors bool Ställ in till “true†för att använda de svartvita @@ -1553,6 +1633,25 @@ King's Quest VI Windows lägger till följande nyckelord: Ställ in till â€false†för att använda de uppskalade muspekarna som matchar resten av grafiken. + +Lands of Lore: The Throne of Chaos använder även följande nyckelord: + + smooth_scrolling bool Ställ in till “true†för mjukare + skärmrullning när du gÃ¥r frÃ¥n en + skärm till en annan. + floating_cursors bool Ställ in till “true†för att ändra + pekaren till en riktningspil när den + närmar sig kanten av skärmen. Spelaren + kan sedan klicka för att gÃ¥ mot + den riktningen. + + +Space Quest IV CD använder även följande nyckelord: + + silver_cursors bool Ställ in till “true†för att använda + silverpekare istället för gulpekarna + + Simon the Sorcerer 1 och 2 lägger till följande nyckelord: music_mute bool Ställ in till “true†för att deaktivera musik @@ -1565,6 +1664,28 @@ The Legend of Kyrandia lägger till följande nyckelord: walkspeed int GÃ¥nghastighet (0-4) +The Legend of Kyrandia: Malcolm's Revenge använder även följande nyckelord: + + studio_audience bool Ställ in till “true†för att höra + skratt och applÃ¥der när Malcolm + berättar ett skämt + skip_support bool Ställ in till “true†för att kunna + skippa text och filmscener + helium_mode bool Ställ in till “true†sÃ¥ lÃ¥ter folk + som att dom inandats helium + +The 7th Guest använder även följande nyckelord: + + t7g_speed string Hastighet pÃ¥ videouppspelning + (normal, tweaked, im_an_ios) + + +8.2) Spelinställningar som kan aktiveras via användargränssnittet +---- ------------------------------------------------------------ +MÃ¥nga av inställningarna i den föregÃ¥ende avdelningen kan aktiveras via användargränssnittet. Om en inställning finns tillgänglig för ett specifikt spel visas en ny tabb med namnet â€Motor†när du lägger till eller ändrar inställningarna för spelet. +Om specialinställningarna inte visas mÃ¥ste spelet köras en gÃ¥ng eller läggas till igen i spellistan i ScummVM:s launcher. Detta uppdaterar inställningarna för varje spel, vilket lÃ¥ter specialinställningarna visas. + + 9.0) Kompilering: ---- ------------ För en uppdaterad överblick för hur man kompilerar ScummVM pÃ¥ diverse plattformar var god se vÃ¥r Wiki, speciellt den här här sidan: @@ -1599,15 +1720,6 @@ PÃ¥ Win9x/NT/XP kan du definiera USE_WINDBG och lägga till WinDbg för att visa * Var god se: http://wiki.scummvm.org/index.php/Compiling_ScummVM/Windows_CE - Debian GNU/Linux: - * Installera paketen 'build-essential', 'fakeroot', 'debhelper', - och 'libsdl1.2-dev' pÃ¥ ditt system. - * Installera de här paketen (valfria): 'libvorbis-dev' (för Ogg - Vorbis stöd), 'libasound2-dev' (för ALSA sequencer stöd), - 'libmad0-dev' (för MAD MP3 stöd), 'zlib1g-dev' (för stöd av kompresserad spardata). - * Kör 'make deb'. - * Kör sedan 'dpkg -i ../scummvm-cvs*deb', sÃ¥ är du klar. - Mac OS X: * Se till att du har utvecklingsverktygen istallerade. * SDL-utvecklingspaketet för OS X som finns tillgängligt pÃ¥ SLD:s hemsida @@ -1649,4 +1761,4 @@ PÃ¥ Win9x/NT/XP kan du definiera USE_WINDBG och lägga till WinDbg för att visa Lycka till och glada äventyr! ScummVM-teamet. http://www.scummvm.org/ ------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------ diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index ac06e74e0aa7..9beba6ce4a81 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -22,7 +22,6 @@ #include "common/debug.h" #include "common/util.h" -#include "common/hash-str.h" #include "common/file.h" #include "common/macresman.h" #include "common/md5.h" @@ -308,14 +307,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) return Common::kNoError; } -struct SizeMD5 { - int size; - Common::String md5; -}; - -typedef Common::HashMap SizeMD5Map; - -static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSizeMD5) { +void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps) const { // TODO: This message should be cleaned up / made more specific. // For example, we should specify at least which engine triggered this. // @@ -327,7 +319,7 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz report += _("of the game you tried to add and its version/language/etc.:"); report += "\n"; - for (SizeMD5Map::const_iterator file = filesSizeMD5.begin(); file != filesSizeMD5.end(); ++file) + for (ADFilePropertiesMap::const_iterator file = filesProps.begin(); file != filesProps.end(); ++file) report += Common::String::format(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size); report += "\n"; @@ -375,8 +367,36 @@ void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSL } } +bool AdvancedMetaEngine::getFileProperties(const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, ADFileProperties &fileProps) const { + // FIXME/TODO: We don't handle the case that a file is listed as a regular + // file and as one with resource fork. + + if (game.flags & ADGF_MACRESFORK) { + Common::MacResManager macResMan; + + if (!macResMan.open(parent, fname)) + return false; + + fileProps.md5 = macResMan.computeResForkMD5AsString(_md5Bytes); + fileProps.size = macResMan.getResForkDataSize(); + return true; + } + + if (!allFiles.contains(fname)) + return false; + + Common::File testFile; + + if (!testFile.open(allFiles[fname])) + return false; + + fileProps.size = (int32)testFile.size(); + fileProps.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes); + return true; +} + ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const { - SizeMD5Map filesSizeMD5; + ADFilePropertiesMap filesProps; const ADGameFileDescription *fileDesc; const ADGameDescription *g; @@ -391,39 +411,14 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) { Common::String fname = fileDesc->fileName; - SizeMD5 tmp; + ADFileProperties tmp; - if (filesSizeMD5.contains(fname)) + if (filesProps.contains(fname)) continue; - // FIXME/TODO: We don't handle the case that a file is listed as a regular - // file and as one with resource fork. - - if (g->flags & ADGF_MACRESFORK) { - Common::MacResManager macResMan; - - if (macResMan.open(parent, fname)) { - tmp.md5 = macResMan.computeResForkMD5AsString(_md5Bytes); - tmp.size = macResMan.getResForkDataSize(); - debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str()); - filesSizeMD5[fname] = tmp; - } - } else { - if (allFiles.contains(fname)) { - debug(3, "+ %s", fname.c_str()); - - Common::File testFile; - - if (testFile.open(allFiles[fname])) { - tmp.size = (int32)testFile.size(); - tmp.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes); - } else { - tmp.size = -1; - } - - debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str()); - filesSizeMD5[fname] = tmp; - } + if (getFileProperties(parent, allFiles, *g, fname, tmp)) { + debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str()); + filesProps[fname] = tmp; } } } @@ -456,19 +451,19 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) { Common::String tstr = fileDesc->fileName; - if (!filesSizeMD5.contains(tstr)) { + if (!filesProps.contains(tstr)) { fileMissing = true; allFilesPresent = false; break; } - if (fileDesc->md5 != NULL && fileDesc->md5 != filesSizeMD5[tstr].md5) { - debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesSizeMD5[tstr].md5.c_str()); + if (fileDesc->md5 != NULL && fileDesc->md5 != filesProps[tstr].md5) { + debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesProps[tstr].md5.c_str()); fileMissing = true; break; } - if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesSizeMD5[tstr].size) { + if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesProps[tstr].size) { debug(3, "Size Mismatch. Skipping"); fileMissing = true; break; @@ -514,8 +509,8 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons // We didn't find a match if (matched.empty()) { - if (!filesSizeMD5.empty() && gotAnyMatchesWithAllFiles) { - reportUnknown(parent, filesSizeMD5); + if (!filesProps.empty() && gotAnyMatchesWithAllFiles) { + reportUnknown(parent, filesProps); } // Filename based fallback @@ -524,7 +519,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons return matched; } -const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const { +const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback, ADFilePropertiesMap *filesProps) const { const ADFileBasedFallback *ptr; const char* const* filenames; @@ -554,6 +549,16 @@ const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap & maxNumMatchedFiles = numMatchedFiles; debug(4, "and overridden"); + + if (filesProps) { + for (filenames = ptr->filenames; *filenames; ++filenames) { + ADFileProperties tmp; + + if (getFileProperties(fslist.begin()->getParent(), allFiles, *agdesc, *filenames, tmp)) + (*filesProps)[*filenames] = tmp; + } + } + } } } diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 45a9f183e828..8c19d036913f 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -26,6 +26,8 @@ #include "engines/metaengine.h" #include "engines/engine.h" +#include "common/hash-str.h" + #include "common/gui_options.h" // FIXME: Temporary hack? namespace Common { @@ -45,6 +47,20 @@ struct ADGameFileDescription { int32 fileSize; ///< Size of the described file. Set to -1 to ignore. }; +/** + * A record describing the properties of a file. Used on the existing + * files while detecting a game. + */ +struct ADFileProperties { + int32 size; + Common::String md5; +}; + +/** + * A map of all relevant existing files in a game directory while detecting. + */ +typedef Common::HashMap ADFilePropertiesMap; + /** * A shortcut to produce an empty ADGameFileDescription record. Used to mark * the end of a list of these. @@ -286,9 +302,17 @@ class AdvancedMetaEngine : public MetaEngine { * In case of a tie, the entry coming first in the list is chosen. * * @param allFiles a map describing all present files + * @param fslist a list of nodes for all present files * @param fileBasedFallback a list of ADFileBasedFallback records, zero-terminated + * @param filesProps if not 0, return a map of properties for all detected files here + */ + const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback, ADFilePropertiesMap *filesProps = 0) const; + + /** + * Log and print a report that we found an unknown game variant, together with the file + * names, sizes and MD5 sums. */ - const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const; + void reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps) const; // TODO void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const; @@ -298,6 +322,9 @@ class AdvancedMetaEngine : public MetaEngine { * Includes nifty stuff like removing trailing dots and ignoring case. */ void composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth) const; + + /** Get the properties (size and MD5) of this file. */ + bool getFileProperties(const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, ADFileProperties &fileProps) const; }; #endif diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 805fe7d366a9..5f7780bfe3e3 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -20,9 +20,6 @@ * */ -// FIXME: Avoid using printf -#define FORBIDDEN_SYMBOL_EXCEPTION_printf - #include "base/plugins.h" #include "engines/advancedDetector.h" @@ -491,10 +488,14 @@ const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXX g_fallbackDesc.desc.gameid = _gameid.c_str(); g_fallbackDesc.desc.extra = _extra.c_str(); - printf("Your game version has been detected using fallback matching as a\n"); - printf("variant of %s (%s).\n", g_fallbackDesc.desc.gameid, g_fallbackDesc.desc.extra); - printf("If this is an original and unmodified version or new made Fanmade game,\n"); - printf("please report any, information previously printed by ScummVM to the team.\n"); + Common::String fallbackWarning; + + fallbackWarning = "Your game version has been detected using fallback matching as a\n"; + fallbackWarning += Common::String::format("variant of %s (%s).\n", g_fallbackDesc.desc.gameid, g_fallbackDesc.desc.extra); + fallbackWarning += "If this is an original and unmodified version or new made Fanmade game,\n"; + fallbackWarning += "please report any, information previously printed by ScummVM to the team.\n"; + + g_system->logMessage(LogMessageType::kWarning, fallbackWarning.c_str()); return (const ADGameDescription *)&g_fallbackDesc; } diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 10c01741aeeb..9176412e0ee4 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -260,9 +260,6 @@ bool MoviePlayerDXA::load() { debug(0, "Playing video %s", videoName.c_str()); CursorMan.showMouse(false); - - _firstFrameOffset = _fileStream->pos(); - return true; } @@ -271,6 +268,10 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { uint w = getWidth(); const Graphics::Surface *surface = decodeNextFrame(); + + if (!surface) + return; + byte *src = (byte *)surface->pixels; dst += y * pitch + x; @@ -281,7 +282,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { } while (--h); if (hasDirtyPalette()) - setSystemPalette(); + g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); } void MoviePlayerDXA::playVideo() { @@ -302,34 +303,7 @@ void MoviePlayerDXA::stopVideo() { } void MoviePlayerDXA::startSound() { - uint32 offset, size; - - if (getSoundTag() == MKTAG('W','A','V','E')) { - size = _fileStream->readUint32BE(); - - if (_sequenceNum) { - Common::File in; - - _fileStream->seek(size, SEEK_CUR); - - in.open("audio.wav"); - if (!in.isOpen()) { - error("Can't read offset file 'audio.wav'"); - } - - in.seek(_sequenceNum * 8, SEEK_SET); - offset = in.readUint32LE(); - size = in.readUint32LE(); - - in.seek(offset, SEEK_SET); - _bgSoundStream = Audio::makeWAVStream(in.readStream(size), DisposeAfterUse::YES); - in.close(); - } else { - _bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), DisposeAfterUse::YES); - } - } else { - _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName); - } + start(); if (_bgSoundStream != NULL) { _vm->_mixer->stopHandle(_bgSound); @@ -344,8 +318,7 @@ void MoviePlayerDXA::nextFrame() { } if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) { - _fileStream->seek(_firstFrameOffset); - _curFrame = -1; + rewind(); startSound(); } @@ -374,13 +347,15 @@ bool MoviePlayerDXA::processFrame() { copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); _vm->_system->unlockScreen(); - Common::Rational soundTime(_mixer->getSoundElapsedTime(_bgSound), 1000); - if ((_bgSoundStream == NULL) || ((soundTime * getFrameRate()).toInt() / 1000 < getCurFrame() + 1)) { + uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound); + uint32 nextFrameStartTime = ((Video::VideoDecoder::VideoTrack *)getTrack(0))->getNextFrameStartTime(); + + if ((_bgSoundStream == NULL) || soundTime < nextFrameStartTime) { if (_bgSoundStream && _mixer->isSoundHandleActive(_bgSound)) { - while (_mixer->isSoundHandleActive(_bgSound) && (soundTime * getFrameRate()).toInt() < getCurFrame()) { + while (_mixer->isSoundHandleActive(_bgSound) && soundTime < nextFrameStartTime) { _vm->_system->delayMillis(10); - soundTime = Common::Rational(_mixer->getSoundElapsedTime(_bgSound), 1000); + soundTime = _mixer->getSoundElapsedTime(_bgSound); } // In case the background sound ends prematurely, update // _ticks so that we can still fall back on the no-sound @@ -399,14 +374,35 @@ bool MoviePlayerDXA::processFrame() { return false; } -void MoviePlayerDXA::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_bgSound)) - g_system->getMixer()->setChannelVolume(_bgSound, getVolume()); -} +void MoviePlayerDXA::readSoundData(Common::SeekableReadStream *stream) { + uint32 tag = stream->readUint32BE(); + + if (tag == MKTAG('W','A','V','E')) { + uint32 size = stream->readUint32BE(); + + if (_sequenceNum) { + Common::File in; + + stream->skip(size); + + in.open("audio.wav"); + if (!in.isOpen()) { + error("Can't read offset file 'audio.wav'"); + } + + in.seek(_sequenceNum * 8, SEEK_SET); + uint32 offset = in.readUint32LE(); + size = in.readUint32LE(); -void MoviePlayerDXA::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_bgSound)) - g_system->getMixer()->setChannelBalance(_bgSound, getBalance()); + in.seek(offset, SEEK_SET); + _bgSoundStream = Audio::makeWAVStream(in.readStream(size), DisposeAfterUse::YES); + in.close(); + } else { + _bgSoundStream = Audio::makeWAVStream(stream->readStream(size), DisposeAfterUse::YES); + } + } else { + _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName); + } } /////////////////////////////////////////////////////////////////////////////// @@ -415,7 +411,7 @@ void MoviePlayerDXA::updateBalance() { MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name) - : MoviePlayer(vm), SmackerDecoder(vm->_mixer) { + : MoviePlayer(vm), SmackerDecoder() { debug(0, "Creating SMK cutscene player"); memset(baseName, 0, sizeof(baseName)); @@ -435,8 +431,6 @@ bool MoviePlayerSMK::load() { CursorMan.showMouse(false); - _firstFrameOffset = _fileStream->pos(); - return true; } @@ -445,6 +439,10 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { uint w = getWidth(); const Graphics::Surface *surface = decodeNextFrame(); + + if (!surface) + return; + byte *src = (byte *)surface->pixels; dst += y * pitch + x; @@ -455,7 +453,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { } while (--h); if (hasDirtyPalette()) - setSystemPalette(); + g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); } void MoviePlayerSMK::playVideo() { @@ -468,6 +466,7 @@ void MoviePlayerSMK::stopVideo() { } void MoviePlayerSMK::startSound() { + start(); } void MoviePlayerSMK::handleNextFrame() { @@ -477,10 +476,8 @@ void MoviePlayerSMK::handleNextFrame() { } void MoviePlayerSMK::nextFrame() { - if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) { - _fileStream->seek(_firstFrameOffset); - _curFrame = -1; - } + if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) + rewind(); if (!endOfVideo()) { decodeNextFrame(); @@ -503,7 +500,7 @@ bool MoviePlayerSMK::processFrame() { uint32 waitTime = getTimeToNextFrame(); - if (!waitTime) { + if (!waitTime && !endOfVideoTracks()) { warning("dropped frame %i", getCurFrame()); return false; } diff --git a/engines/agos/animation.h b/engines/agos/animation.h index d1ff074b0354..9e31fced6ded 100644 --- a/engines/agos/animation.h +++ b/engines/agos/animation.h @@ -67,9 +67,6 @@ class MoviePlayer { virtual void handleNextFrame(); virtual bool processFrame() = 0; virtual void startSound() {} - -protected: - uint32 _firstFrameOffset; }; class MoviePlayerDXA : public MoviePlayer, Video::DXADecoder { @@ -84,9 +81,7 @@ class MoviePlayerDXA : public MoviePlayer, Video::DXADecoder { virtual void stopVideo(); protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); + void readSoundData(Common::SeekableReadStream *stream); private: void handleNextFrame(); diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index ed26b9638194..cc1c40c207eb 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -467,11 +467,7 @@ void AGOSEngine::delay(uint amount) { memset(_saveLoadName, 0, sizeof(_saveLoadName)); sprintf(_saveLoadName, "Quick %d", _saveLoadSlot); _saveLoadType = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2; - - // We should only allow a load or save when it was possible in original - // This stops load/save during copy protection, conversations and cut scenes - if (!_mouseHideCount && !_showPreposition) - quickLoadOrSave(); + quickLoadOrSave(); } else if (event.kbd.hasFlags(Common::KBD_CTRL)) { if (event.kbd.keycode == Common::KEYCODE_a) { GUI::Dialog *_aboutDialog; diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index b3ec916b4777..c6bca1a6e6f2 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -142,23 +142,41 @@ void AGOSEngine_Feeble::quickLoadOrSave() { } #endif +// The function uses segments of code from the original game scripts +// to allow quick loading and saving, but isn't perfect. +// +// Unfortuntely this allows loading and saving in locations, +// which aren't supported, and will not restore correctly: +// Various locations in Elvira 1/2 and Waxworks where saving +// was disabled void AGOSEngine::quickLoadOrSave() { - // The function uses segments of code from the original game scripts - // to allow quick loading and saving, but isn't perfect. - // - // Unfortuntely this allows loading and saving in locations, - // which aren't supported, and will not restore correctly: - // Any overhead maps in Simon the Sorcerer 2 - // Various locations in Elvira 1/2 and Waxworks where saving - // was disabled - - // The floppy disk demo of Simon the Sorcerer 1 doesn't work. - if (getFeatures() & GF_DEMO) - return; - bool success; Common::String buf; + // Disable loading and saving when it was not possible in the original: + // In overhead maps areas in Simon the Sorcerer 2 + // In the floppy disk demo of Simon the Sorcerer 1 + // In copy protection, conversations and cut scenes + if ((getGameType() == GType_SIMON2 && _boxStarHeight == 200) || + (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) || + _mouseHideCount || _showPreposition) { + buf = Common::String::format("Quick load or save game isn't supported in this location"); + GUI::MessageDialog dialog(buf, "OK"); + dialog.runModal(); + return; + } + + // Check if Simon is walking, and stop when required + if (getGameType() == GType_SIMON1 && getBitFlag(11)) { + vcStopAnimation(11, 1122); + animate(4, 11, 1122, 0, 0, 2); + waitForSync(1122); + } else if (getGameType() == GType_SIMON2 && getBitFlag(11)) { + vcStopAnimation(11, 232); + animate(4, 11, 232, 0, 0, 2); + waitForSync(1122); + } + char *filename = genSaveName(_saveLoadSlot); if (_saveLoadType == 2) { Subroutine *sub; diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 309b89bddab4..4f85957b3dc1 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -123,12 +123,15 @@ Bitmap::~Bitmap() { Bitmap &Bitmap::operator=(const Bitmap &bmp) { debugC(1, kCGEDebugBitmap, "&Bitmap::operator ="); + if (this == &bmp) + return *this; uint8 *v0 = bmp._v; _w = bmp._w; _h = bmp._h; _m = NULL; _map = 0; + _vm = bmp._vm; delete[] _v; if (v0 == NULL) { diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 875ac34cd0e6..6cc0c4596359 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -30,6 +30,8 @@ #include "common/fs.h" #include "engines/advancedDetector.h" #include "engines/util.h" +#include "gui/message.h" + #include "cge/cge.h" #include "cge/vga13h.h" #include "cge/cge_main.h" @@ -50,7 +52,6 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel"); _startupMode = 1; - _demoText = kDemo; _oldLev = 0; _pocPtr = 0; _bitmapPalette = NULL; @@ -122,7 +123,7 @@ void CGEEngine::init() { _maxScene = 0; _dark = false; _game = false; - _finis = false; + _endGame = false; _now = 1; _lev = -1; _recentStep = -2; @@ -134,7 +135,6 @@ void CGEEngine::init() { _soundOk = 1; _sprTv = NULL; _gameCase2Cpt = 0; - _offUseCount = 0; _startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; } @@ -196,6 +196,16 @@ Common::Error CGEEngine::run() { // Run the game cge_main(); + // If game is finished, display ending message + if (_flag[3]) { + Common::String msg = Common::String(_text->getText(kSayTheEnd)); + if (msg.size() != 0) { + g_system->delayMillis(10); + GUI::MessageDialog dialog(msg, "OK"); + dialog.runModal(); + } + } + // Remove game objects deinit(); diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 4ebc836ee0a8..0e8c5a05bb90 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -78,6 +78,8 @@ class Talk; #define kMapZCnt 20 #define kMapTop 80 +#define kSayTheEnd 41 + // our engine debug channels enum { kCGEDebugBitmap = 1 << 0, @@ -147,7 +149,6 @@ class CGEEngine : public Engine { const ADGameDescription *_gameDescription; int _startupMode; - int _demoText; int _oldLev; int _pocPtr; bool _music; @@ -157,7 +158,7 @@ class CGEEngine : public Engine { bool _flag[4]; bool _dark; bool _game; - bool _finis; + bool _endGame; int _now; int _lev; int _mode; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 2620147c4db9..3ba5f7fed97a 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -150,11 +150,11 @@ void CGEEngine::sndSetVolume() { void CGEEngine::syncHeader(Common::Serializer &s) { debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)"); - int i; + int i = kDemo; s.syncAsUint16LE(_now); s.syncAsUint16LE(_oldLev); - s.syncAsUint16LE(_demoText); + s.syncAsUint16LE(i); // unused Demo string id for (i = 0; i < 5; i++) s.syncAsUint16LE(_game); s.syncAsSint16LE(i); // unused VGA::Mono variable @@ -305,12 +305,21 @@ Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) { _hero->park(); _oldLev = _lev; + int x = _hero->_x; + int y = _hero->_y; + int z = _hero->_z; + // Write out the user's progress saveGame(slot, desc); + _commandHandler->addCommand(kCmdLevel, -1, _oldLev, &_sceneLight); // Reload the scene sceneUp(); + _hero->_x = x; + _hero->_y = y; + _hero->_z = z; + return Common::kNoError; } @@ -518,8 +527,8 @@ Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) { setShapeList(MB); } -void Square::touch(uint16 mask, int x, int y) { - Sprite::touch(mask, x, y); +void Square::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) { + Sprite::touch(mask, x, y, keyCode); if (mask & kMouseLeftUp) { _vm->XZ(_x + x, _y + y).cell() = 0; _vm->_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, this); @@ -706,7 +715,7 @@ void CGEEngine::qGame() { saveGame(0, Common::String("Automatic Savegame")); _vga->sunset(); - _finis = true; + _endGame = true; } void CGEEngine::switchScene(int newScene) { @@ -758,11 +767,11 @@ void System::funTouch() { _funDel = n; } -void System::touch(uint16 mask, int x, int y) { +void System::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) { funTouch(); if (mask & kEventKeyb) { - if (x == Common::KEYCODE_ESCAPE) { + if (keyCode == Common::KEYCODE_ESCAPE) { // The original was calling keyClick() // The sound is uselessly annoying and noisy, so it has been removed _vm->killText(); @@ -926,7 +935,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { } #pragma argsused -void Sprite::touch(uint16 mask, int x, int y) { +void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) { _vm->_sys->funTouch(); if ((mask & kEventAttn) != 0) @@ -1312,7 +1321,7 @@ void CGEEngine::runGame() { _sceneLight->_flags._tran = true; _vga->_showQ->append(_sceneLight); - _sceneLight->_flags._hide = true; + _sceneLight->_flags._hide = false; const Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, @@ -1403,14 +1412,14 @@ void CGEEngine::runGame() { _keyboard->setClient(_sys); // main loop - while (!_finis && !_quitFlag) { - if (_flag[3]) + while (!_endGame && !_quitFlag) { + if (_flag[3]) // Flag FINIS _commandHandler->addCallback(kCmdExec, -1, 0, kQGame); mainLoop(); } // If finishing game due to closing ScummVM window, explicitly save the game - if (!_finis && canSaveGameStateCurrently()) + if (!_endGame && canSaveGameStateCurrently()) qGame(); _keyboard->setClient(NULL); diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index 87199ee5245a..bde8306f36ce 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -78,7 +78,7 @@ namespace CGE { #define kScrHeight 200 #define kWorldHeight (kScrHeight - kPanHeight) #define kStackSize 2048 -#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + _demoText) +#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + kDemo) #define kSavegame0Name ("{{INIT}}" kSvgExt) #define kSavegameStrSize 11 #define kGameFrameDelay (1000 / 50) @@ -92,7 +92,7 @@ class System : public Sprite { void setPal(); void funTouch(); - virtual void touch(uint16 mask, int x, int y); + virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode); void tick(); private: CGEEngine *_vm; @@ -101,7 +101,7 @@ class System : public Sprite { class Square : public Sprite { public: Square(CGEEngine *vm); - virtual void touch(uint16 mask, int x, int y); + virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode); private: CGEEngine *_vm; }; diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index f723ec8fbd87..2e04b8202684 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -108,7 +108,7 @@ class CGEMetaEngine : public AdvancedMetaEngine { } virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { - return detectGameFilebased(allFiles, CGE::fileBasedFallback); + return detectGameFilebased(allFiles, fslist, CGE::fileBasedFallback); } virtual const char *getName() const { @@ -217,8 +217,6 @@ SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int sl } else { // Create the return descriptor SaveStateDescriptor desc(slot, header.saveName); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); desc.setThumbnail(header.thumbnail); desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay); desc.setSaveTime(header.saveHour, header.saveMinutes); diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 095aac24120f..1530c870ef6a 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -55,7 +55,7 @@ Sprite *Keyboard::setClient(Sprite *spr) { bool Keyboard::getKey(Common::Event &event) { Common::KeyCode keycode = event.kbd.keycode; - if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) + if (((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) && event.type == Common::EVENT_KEYDOWN) _keyAlt = true; else _keyAlt = false; @@ -109,9 +109,19 @@ bool Keyboard::getKey(Common::Event &event) { case Common::KEYCODE_3: case Common::KEYCODE_4: if (event.kbd.flags & Common::KBD_ALT) { - _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - '0', NULL); + _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - Common::KEYCODE_0, NULL); return false; } + // Fallthrough intended + case Common::KEYCODE_5: + case Common::KEYCODE_6: + case Common::KEYCODE_7: + case Common::KEYCODE_8: + if (event.type == Common::EVENT_KEYDOWN && !(event.kbd.flags & Common::KBD_ALT) && keycode != Common::KEYCODE_0) { + _vm->selectPocket(keycode - Common::KEYCODE_1); + return false; + } + break; default: break; } @@ -125,9 +135,11 @@ void Keyboard::newKeyboard(Common::Event &event) { if ((event.type == Common::EVENT_KEYDOWN) && (_client)) { CGEEvent &evt = _vm->_eventManager->getNextEvent(); - evt._x = event.kbd.keycode; // Keycode - evt._mask = kEventKeyb; // Event mask - evt._spritePtr = _client; // Sprite pointer + evt._x = 0; + evt._y = 0; + evt._keyCode = event.kbd.keycode; // Keycode + evt._mask = kEventKeyb; // Event mask + evt._spritePtr = _client; // Sprite pointer } } @@ -194,6 +206,7 @@ void Mouse::newMouse(Common::Event &event) { CGEEvent &evt = _vm->_eventManager->getNextEvent(); evt._x = event.mouse.x; evt._y = event.mouse.y; + evt._keyCode = Common::KEYCODE_INVALID; evt._spritePtr = _vm->spriteAt(evt._x, evt._y); switch (event.type) { @@ -259,7 +272,7 @@ void EventManager::handleEvents() { CGEEvent e = _eventQueue[_eventQueueTail]; if (e._mask) { if (_vm->_mouse->_hold && e._spritePtr != _vm->_mouse->_hold) - _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y); + _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y, e._keyCode); // update mouse cursor position if (e._mask & kMouseRoll) @@ -268,11 +281,11 @@ void EventManager::handleEvents() { // activate current touched SPRITE if (e._spritePtr) { if (e._mask & kEventKeyb) - e._spritePtr->touch(e._mask, e._x, e._y); + e._spritePtr->touch(e._mask, e._x, e._y, e._keyCode); else - e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y); + e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y, e._keyCode); } else if (_vm->_sys) - _vm->_sys->touch(e._mask, e._x, e._y); + _vm->_sys->touch(e._mask, e._x, e._y, e._keyCode); if (e._mask & kMouseLeftDown) { _vm->_mouse->_hold = e._spritePtr; diff --git a/engines/cge/events.h b/engines/cge/events.h index 6bbd52e4a569..522aa67905eb 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -70,6 +70,7 @@ struct CGEEvent { uint16 _mask; uint16 _x; uint16 _y; + Common::KeyCode _keyCode; Sprite *_spritePtr; }; diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index c50db4e9295b..f23105d8235f 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -201,9 +201,28 @@ EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) { _error = true; _vm->_resman->seek(kp->_pos); - byte *dataBuffer = (byte *)malloc(kp->_size); - _vm->_resman->read(dataBuffer, kp->_size); - _readStream = new Common::MemoryReadStream(dataBuffer, kp->_size, DisposeAfterUse::YES); + byte *dataBuffer; + int bufSize; + + if ((strlen(name) > 4) && (scumm_stricmp(name + strlen(name) - 4, ".SPR") == 0)) { + // SPR files have some inconsistencies. Some have extra 0x1A at the end, some others + // do not have a carriage return at the end of the last line + // Therefore, we remove this ending 0x1A and add extra new lines. + // This fixes bug #3537527 + dataBuffer = (byte *)malloc(kp->_size + 2); + _vm->_resman->read(dataBuffer, kp->_size); + if (dataBuffer[kp->_size - 1] == 0x1A) + dataBuffer[kp->_size - 1] = '\n'; + dataBuffer[kp->_size] = '\n'; + dataBuffer[kp->_size + 1] = '\n'; + bufSize = kp->_size + 2; + } else { + dataBuffer = (byte *)malloc(kp->_size); + _vm->_resman->read(dataBuffer, kp->_size); + bufSize = kp->_size; + } + + _readStream = new Common::MemoryReadStream(dataBuffer, bufSize, DisposeAfterUse::YES); } uint32 EncryptedStream::read(void *dataPtr, uint32 dataSize) { diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 7f747944748a..b37889895579 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -91,6 +91,12 @@ void Sound::sndDigiStart(SmpInfo *PSmpInfo) { // Start the new sound _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, Audio::makeLoopingAudioStream(_audioStream, (uint)PSmpInfo->_counter)); + + // CGE pan: + // 8 = Center + // Less = Left + // More = Right + _vm->_mixer->setChannelBalance(_soundHandle, (int8)CLIP(((PSmpInfo->_span - 8) * 16), -127, 127)); } void Sound::stop() { diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 3800b6643ac9..e178795b7c7e 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -637,15 +637,6 @@ Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _ _page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); } -#if 0 - // This part was used to display credits at the beginning of the game - for (int i = 10; i < 20; i++) { - char *text = _text->getText(i); - if (text) { - debugN(1, "%s\n", text); - } - } -#endif _oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount); _newColors = (Dac *)malloc(sizeof(Dac) * kPalCount); getColors(_oldColors); diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index beca19f66725..a816f7756f89 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -29,6 +29,7 @@ #define CGE_VGA13H_H #include "common/serializer.h" +#include "common/events.h" #include "graphics/surface.h" #include "cge/general.h" #include "cge/bitmap.h" @@ -146,7 +147,7 @@ class Sprite { void step(int nr = -1); Seq *setSeq(Seq *seq); CommandHandler::Command *snList(SnList type); - virtual void touch(uint16 mask, int x, int y); + virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode); virtual void tick(); void sync(Common::Serializer &s); private: diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index a317a765d4ee..910e54d267ff 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -63,7 +63,7 @@ Vmenu *Vmenu::_addr = NULL; int Vmenu::_recent = -1; Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y) - : Talk(vm, VMGather(list), kTBRect), _menu(list), _bar(NULL), _vm(vm) { + : Talk(vm, VMGather(list), kTBRect), _menu(list), _bar(NULL), _vmgt(NULL), _vm(vm) { Choice *cp; _addr = this; @@ -89,11 +89,11 @@ Vmenu::~Vmenu() { #define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember)) -void Vmenu::touch(uint16 mask, int x, int y) { +void Vmenu::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) { if (!_items) return; - Sprite::touch(mask, x, y); + Sprite::touch(mask, x, y, keyCode); y -= kTextVMargin - 1; int n = 0; diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 89ef7a94843d..928b48f11c30 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -58,7 +58,7 @@ class Vmenu : public Talk { MenuBar *_bar; Vmenu(CGEEngine *vm, Choice *list, int x, int y); ~Vmenu(); - virtual void touch(uint16 mask, int x, int y); + virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode); private: char *_vmgt; CGEEngine *_vm; diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index 410fcca1f318..60168831a152 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -682,9 +682,10 @@ void convert8BBP2(byte *dest, byte *source, int16 width, int16 height) { * Load image set * @param resourceName Image set filename * @param idx Target index in animDataTable (-1 if any empty space will do) + * @param frameIndex frame of animation to load (-1 for all frames) * @return The number of the animDataTable entry after the loaded image set (-1 if error) */ -int loadSet(const char *resourceName, int16 idx) { +int loadSet(const char *resourceName, int16 idx, int16 frameIndex =-1 ) { AnimHeader2Struct header2; uint16 numSpriteInAnim; int16 foundFileIdx = findFileInBundle(resourceName); @@ -708,7 +709,17 @@ int loadSet(const char *resourceName, int16 idx) { entry = idx < 0 ? emptyAnimSpace() : idx; assert(entry >= 0); - for (int16 i = 0; i < numSpriteInAnim; i++, entry++) { + int16 startFrame = 0; + int16 endFrame = numSpriteInAnim; + + if(frameIndex>=0) + { + startFrame = frameIndex; + endFrame = frameIndex+1; + ptr += 0x10 * frameIndex; + } + + for (int16 i = startFrame; i < endFrame; i++, entry++) { Common::MemoryReadStream readS(ptr, 0x10); header2.field_0 = readS.readUint32BE(); @@ -767,7 +778,7 @@ int loadSeq(const char *resourceName, int16 idx) { * @return The number of the animDataTable entry after the loaded resource (-1 if error) * @todo Implement loading of all resource types */ -int loadResource(const char *resourceName, int16 idx) { +int loadResource(const char *resourceName, int16 idx, int16 frameIndex) { int result = -1; // Return an error by default if (strstr(resourceName, ".SPL")) { result = loadSpl(resourceName, idx); @@ -778,7 +789,7 @@ int loadResource(const char *resourceName, int16 idx) { } else if (strstr(resourceName, ".ANM")) { result = loadAni(resourceName, idx); } else if (strstr(resourceName, ".SET")) { - result = loadSet(resourceName, idx); + result = loadSet(resourceName, idx, frameIndex); } else if (strstr(resourceName, ".SEQ")) { result = loadSeq(resourceName, idx); } else if (strstr(resourceName, ".H32")) { diff --git a/engines/cine/anim.h b/engines/cine/anim.h index 9c06c260ced5..c5130aab82b4 100644 --- a/engines/cine/anim.h +++ b/engines/cine/anim.h @@ -98,7 +98,7 @@ class AnimData { void freeAnimDataTable(); void freeAnimDataRange(byte startIdx, byte numIdx); -int loadResource(const char *resourceName, int16 idx = -1); +int loadResource(const char *resourceName, int16 idx = -1, int16 frameIndex = -1); void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat); void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency); diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp index 693fea3294c6..36ecf53dea0b 100644 --- a/engines/cine/bg_list.cpp +++ b/engines/cine/bg_list.cpp @@ -39,9 +39,9 @@ uint32 var8; * @param objIdx Sprite description */ void addToBGList(int16 objIdx) { - renderer->incrustSprite(g_cine->_objectTable[objIdx]); - createBgIncrustListElement(objIdx, 0); + + renderer->incrustSprite(g_cine->_bgIncrustList.back()); } /** @@ -49,9 +49,9 @@ void addToBGList(int16 objIdx) { * @param objIdx Sprite description */ void addSpriteFilledToBGList(int16 objIdx) { - renderer->incrustMask(g_cine->_objectTable[objIdx]); - createBgIncrustListElement(objIdx, 1); + + renderer->incrustMask(g_cine->_bgIncrustList.back()); } /** @@ -103,9 +103,9 @@ void loadBgIncrustFromSave(Common::SeekableReadStream &fHandle) { g_cine->_bgIncrustList.push_back(tmp); if (tmp.param == 0) { - renderer->incrustSprite(g_cine->_objectTable[tmp.objIdx]); + renderer->incrustSprite(tmp); } else { - renderer->incrustMask(g_cine->_objectTable[tmp.objIdx]); + renderer->incrustMask(tmp); } } } diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 6b94c33c318f..bbe2cd4896c2 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -189,6 +189,8 @@ void CineEngine::initialize() { g_cine->_messageTable.clear(); resetObjectTable(); + disableSystemMenu = 1; + var8 = 0; var2 = var3 = var4 = var5 = 0; diff --git a/engines/cine/detection_tables.h b/engines/cine/detection_tables.h index 0ec2768baea3..bf02f0519cb9 100644 --- a/engines/cine/detection_tables.h +++ b/engines/cine/detection_tables.h @@ -251,7 +251,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs00", "d6752e7d25924cb866b61eb7cb0c8b56"), Common::EN_GRB, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -267,7 +267,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs1", "9629129b86979fa592c1787385bf3695"), Common::EN_GRB, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -281,7 +281,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs1", "d8c3a9d05a63e4cfa801826a7063a126"), Common::EN_USA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -295,7 +295,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs00", "862a75d76fb7fffec30e52be9ad1c474"), Common::EN_USA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -309,7 +309,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs1", "39b91ae35d1297ce0a76a1a803ca1593"), Common::DE_DEU, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -323,7 +323,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs1", "74c2dabd9d212525fca8875a5f6d8994"), Common::ES_ESP, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -341,7 +341,7 @@ static const CINEGameDescription gameDescriptions[] = { }, Common::ES_ESP, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -355,7 +355,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs00", "f143567f08cfd1a9b1c9a41c89eadfef"), Common::FR_FRA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -369,7 +369,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs1", "da066e6b8dd93f2502c2a3755f08dc12"), Common::IT_ITA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO0() }, GType_OS, @@ -383,7 +383,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "a9da5531ead0ebf9ad387fa588c0cbb0"), Common::EN_GRB, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -397,7 +397,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "8a429ced2f4acff8a15ae125174042e8"), Common::EN_GRB, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -411,7 +411,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "d5f27e33fc29c879f36f15b86ccfa58c"), Common::EN_USA, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -425,7 +425,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "8b7dce249821d3a62b314399c4334347"), Common::DE_DEU, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -439,7 +439,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "35fc295ddd0af9da932d256ba799a4b0"), Common::ES_ESP, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -453,7 +453,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "d4ea4a97e01fa67ea066f9e785050ed2"), Common::FR_FRA, Common::kPlatformAmiga, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -467,7 +467,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("demo", "8d3a750d1c840b1b1071e42f9e6f6aa2"), Common::EN_GRB, Common::kPlatformAmiga, - ADGF_DEMO, + ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -481,7 +481,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "1501d5ae364b2814a33ed19347c3fcae"), Common::EN_GRB, Common::kPlatformAtariST, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, @@ -495,7 +495,7 @@ static const CINEGameDescription gameDescriptions[] = { AD_ENTRY1("procs0", "2148d25de3219dd4a36580ca735d0afa"), Common::FR_FRA, Common::kPlatformAtariST, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, GUIO1(GUIO_NOMIDI) }, GType_OS, diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index 918d52260684..7a988227f67f 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -174,7 +174,8 @@ void FWRenderer::fillSprite(const ObjectStruct &obj, uint8 color) { * @param obj Object info * @param fillColor Sprite color */ -void FWRenderer::incrustMask(const ObjectStruct &obj, uint8 color) { +void FWRenderer::incrustMask(const BGIncrust &incrust, uint8 color) { + const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx]; const byte *data = g_cine->_animDataTable[obj.frame].data(); int x, y, width, height; @@ -218,7 +219,9 @@ void FWRenderer::drawSprite(const ObjectStruct &obj) { * Draw color sprite on background * @param obj Object info */ -void FWRenderer::incrustSprite(const ObjectStruct &obj) { +void FWRenderer::incrustSprite(const BGIncrust &incrust) { + const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx]; + const byte *data = g_cine->_animDataTable[obj.frame].data(); const byte *mask = g_cine->_animDataTable[obj.frame].mask(); int x, y, width, height; @@ -246,14 +249,16 @@ void FWRenderer::drawCommand() { unsigned int i; int x = 10, y = _cmdY; - drawPlainBox(x, y, 301, 11, 0); - drawBorder(x - 1, y - 1, 302, 12, 2); + if(disableSystemMenu == 0) { + drawPlainBox(x, y, 301, 11, 0); + drawBorder(x - 1, y - 1, 302, 12, 2); - x += 2; - y += 2; + x += 2; + y += 2; - for (i = 0; i < _cmd.size(); i++) { - x = drawChar(_cmd[i], x, y); + for (i = 0; i < _cmd.size(); i++) { + x = drawChar(_cmd[i], x, y); + } } } @@ -298,7 +303,8 @@ void FWRenderer::drawMessage(const char *str, int x, int y, int width, int color for (i = 0; str[i]; i++, line--) { // Fit line of text into textbox if (!line) { - while (str[i] == ' ') i++; + while (str[i] == ' ') + i++; line = fitLine(str + i, tw, words, cw); if ( str[i + line] != '\0' && str[i + line] != 0x7C && words) { @@ -839,7 +845,7 @@ void OSRenderer::restorePalette(Common::SeekableReadStream &fHandle, int version fHandle.read(buf, kHighPalNumBytes); - if (colorCount == kHighPalNumBytes) { + if (colorCount == kHighPalNumColors) { // Load the active 256 color palette from file _activePal.load(buf, sizeof(buf), kHighPalFormat, kHighPalNumColors, CINE_LITTLE_ENDIAN); } else { @@ -1119,7 +1125,8 @@ void OSRenderer::clear() { * @param obj Object info * @param fillColor Sprite color */ -void OSRenderer::incrustMask(const ObjectStruct &obj, uint8 color) { +void OSRenderer::incrustMask(const BGIncrust &incrust, uint8 color) { + const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx]; const byte *data = g_cine->_animDataTable[obj.frame].data(); int x, y, width, height; @@ -1154,15 +1161,16 @@ void OSRenderer::drawSprite(const ObjectStruct &obj) { * Draw color sprite * @param obj Object info */ -void OSRenderer::incrustSprite(const ObjectStruct &obj) { - const byte *data = g_cine->_animDataTable[obj.frame].data(); +void OSRenderer::incrustSprite(const BGIncrust &incrust) { + const ObjectStruct &obj = g_cine->_objectTable[incrust.objIdx]; + const byte *data = g_cine->_animDataTable[incrust.frame].data(); int x, y, width, height, transColor; - x = obj.x; - y = obj.y; + x = incrust.x; + y = incrust.y; transColor = obj.part; - width = g_cine->_animDataTable[obj.frame]._realWidth; - height = g_cine->_animDataTable[obj.frame]._height; + width = g_cine->_animDataTable[incrust.frame]._realWidth; + height = g_cine->_animDataTable[incrust.frame]._height; if (_bgTable[_currentBg].bg) { drawSpriteRaw2(data, transColor, width, height, _bgTable[_currentBg].bg, x, y); @@ -1225,7 +1233,6 @@ void OSRenderer::renderOverlay(const Common::List::iterator &it) { int len, idx, width, height; ObjectStruct *obj; AnimData *sprite; - byte *mask; byte color; switch (it->type) { @@ -1235,14 +1242,8 @@ void OSRenderer::renderOverlay(const Common::List::iterator &it) { break; } sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame]; - len = sprite->_realWidth * sprite->_height; - mask = new byte[len]; - generateMask(sprite->data(), mask, len, g_cine->_objectTable[it->objIdx].part); - remaskSprite(mask, it); - drawMaskedSprite(g_cine->_objectTable[it->objIdx], mask); - delete[] mask; + drawSprite(&(*it), sprite->data(), sprite->_realWidth, sprite->_height, _backBuffer, g_cine->_objectTable[it->objIdx].x, g_cine->_objectTable[it->objIdx].y, g_cine->_objectTable[it->objIdx].part, sprite->_bpp); break; - // game message case 2: if (it->objIdx >= g_cine->_messageTable.size()) { @@ -1290,14 +1291,6 @@ void OSRenderer::renderOverlay(const Common::List::iterator &it) { maskBgOverlay(_bgTable[it->x].bg, sprite->data(), sprite->_realWidth, sprite->_height, _backBuffer, obj->x, obj->y); break; - // FIXME: Implement correct drawing of type 21 overlays. - // Type 21 overlays aren't just filled rectangles, I found their drawing routine - // from Operation Stealth's drawSprite routine. So they're likely some kind of sprites - // and it's just a coincidence that the oxygen meter during the first arcade sequence - // works even somehow currently. I tried the original under DOSBox and the oxygen gauge - // is a long red bar that gets shorter as the air runs out. - case 21: - // A filled rectangle: case 22: // TODO: Check it this implementation really works correctly (Some things might be wrong, needs testing). assert(it->objIdx < NUM_MAX_OBJECT); @@ -1752,6 +1745,82 @@ void drawSpriteRaw(const byte *spritePtr, const byte *maskPtr, int16 width, int1 } } +void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 width, int16 height, byte *page, int16 x, int16 y, byte transparentColor, byte bpp) { + byte *pMask = NULL; + + // draw the mask based on next objects in the list + Common::List::iterator it; + for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ++it) { + if(&(*it) == overlayPtr) { + break; + } + } + + while(it != g_cine->_overlayList.end()) { + overlay *pCurrentOverlay = &(*it); + if ((pCurrentOverlay->type == 5) || ((pCurrentOverlay->type == 21) && (pCurrentOverlay->x == overlayPtr->objIdx))) { + AnimData *sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame]; + + if (pMask == NULL) { + pMask = new byte[width*height]; + + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + byte spriteColor= spritePtr[width * i + j]; + pMask[width * i + j] = spriteColor; + } + } + } + + for (int i = 0; i < sprite->_realWidth; i++) { + for (int j = 0; j < sprite->_height; j++) { + int inMaskX = (g_cine->_objectTable[it->objIdx].x + i) - x; + int inMaskY = (g_cine->_objectTable[it->objIdx].y + j) - y; + + if (inMaskX >=0 && inMaskX < width) { + if (inMaskY >= 0 && inMaskY < height) { + if (sprite->_bpp == 1) { + if (!sprite->getColor(i, j)) { + pMask[inMaskY * width + inMaskX] = page[x + y * 320 + inMaskX + inMaskY * 320]; + } + } + } + } + } + } + } + it++; + } + + // now, draw with the mask we created + if(pMask) { + spritePtr = pMask; + } + + // ignore transparent color in 1bpp + if (bpp == 1) { + transparentColor = 1; + } + + { + for (int i = 0; i < height; i++) { + byte *destPtr = page + x + y * 320; + destPtr += i * 320; + + for (int j = 0; j < width; j++) { + byte color= *(spritePtr++); + if ((transparentColor != color) && x + j >= 0 && x + j < 320 && i + y >= 0 && i + y < 200) { + *(destPtr++) = color; + } else { + destPtr++; + } + } + } + } + + delete[] pMask; +} + void drawSpriteRaw2(const byte *spritePtr, byte transColor, int16 width, int16 height, byte *page, int16 x, int16 y) { int16 i, j; diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h index 737c49cc3678..3434cf9fc21f 100644 --- a/engines/cine/gfx.h +++ b/engines/cine/gfx.h @@ -27,6 +27,7 @@ #include "common/rect.h" #include "common/stack.h" #include "cine/object.h" +#include "cine/bg_list.h" namespace Cine { @@ -177,8 +178,8 @@ class FWRenderer : public Common::NonCopyable { void drawFrame(); void setCommand(Common::String cmd); - virtual void incrustMask(const ObjectStruct &obj, uint8 color = 0); - virtual void incrustSprite(const ObjectStruct &obj); + virtual void incrustMask(const BGIncrust &incrust, uint8 color = 0); + virtual void incrustSprite(const BGIncrust &incrust); virtual void loadBg16(const byte *bg, const char *name, unsigned int idx = 0); virtual void loadCt16(const byte *ct, const char *name); @@ -223,6 +224,7 @@ class OSRenderer : public FWRenderer { protected: void drawSprite(const ObjectStruct &obj); + void drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 width, int16 height, byte *page, int16 x, int16 y, byte transparentColor, byte bpp); int drawChar(char character, int x, int y); void drawBackground(); void renderOverlay(const Common::List::iterator &it); @@ -238,8 +240,8 @@ class OSRenderer : public FWRenderer { void clear(); - void incrustMask(const ObjectStruct &obj, uint8 color = 0); - void incrustSprite(const ObjectStruct &obj); + void incrustMask(const BGIncrust &incrust, uint8 color = 0); + void incrustSprite(const BGIncrust &incrust); void loadBg16(const byte *bg, const char *name, unsigned int idx = 0); void loadCt16(const byte *ct, const char *name); diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 971830ce8fb1..f13f38a45e47 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -56,6 +56,12 @@ static void processEvent(Common::Event &event) { case Common::EVENT_RBUTTONDOWN: mouseRight = 1; break; + case Common::EVENT_LBUTTONUP: + mouseLeft = 0; + break; + case Common::EVENT_RBUTTONUP: + mouseRight = 0; + break; case Common::EVENT_MOUSEMOVE: break; case Common::EVENT_KEYDOWN: @@ -115,7 +121,7 @@ static void processEvent(Common::Event &event) { } break; case Common::KEYCODE_F10: - if (!disableSystemMenu && !inMenu) { + if (!inMenu) { g_cine->makeSystemMenu(); } break; @@ -214,8 +220,6 @@ void manageEvents() { g_sound->update(); mouseData.left = mouseLeft; mouseData.right = mouseRight; - mouseLeft = 0; - mouseRight = 0; } void getMouseData(uint16 param, uint16 *pButton, uint16 *pX, uint16 *pY) { @@ -311,6 +315,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { // HACK: Force amount of oxygen left to maximum during Operation Stealth's first arcade sequence. // This makes it possible to pass the arcade sequence for now. // FIXME: Remove the hack and make the first arcade sequence normally playable. + /* if (g_cine->getGameType() == Cine::GType_OS) { Common::String bgName(renderer->getBgName()); // Check if the background is one of the three backgrounds @@ -320,7 +325,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { // Force the amount of oxygen left to the maximum. g_cine->_objectTable[oxygenObjNum].x = maxOxygen; } - } + }*/ // HACK: In Operation Stealth after the first arcade sequence jump player's position to avoid getting stuck. // After the first arcade sequence the player comes up stairs from @@ -379,8 +384,8 @@ void CineEngine::mainLoop(int bootScriptIdx) { playerAction = false; _messageLen <<= 3; - if (_messageLen < 0x800) - _messageLen = 0x800; + if (_messageLen < 800) + _messageLen = 800; do { manageEvents(); diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index 223099a5875e..20952eea526b 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -991,7 +991,7 @@ void CineEngine::makeSave(char *saveFileName) { * at a time. */ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat) { - int16 currentAnim, foundFileIdx; + int16 foundFileIdx; char *animName, part[256], name[10]; strcpy(part, currentPartName); @@ -1001,10 +1001,10 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam const int entrySize = ((saveGameFormat == ANIMSIZE_23) ? 23 : 30); const int fileStartPos = fHandle.pos(); - currentAnim = 0; - while (currentAnim < NUM_MAX_ANIMDATA) { + + for(int resourceIndex=0; resourceIndex_partBuffer[foundFileIdx].partName; loadRelatedPalette(animName); // Is this for Future Wars only? - const int16 prevAnim = currentAnim; - currentAnim = loadResource(animName, currentAnim); - assert(currentAnim > prevAnim); // Make sure we advance forward + loadResource(animName, resourceIndex, frameIndex); } loadPart(part); diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 66150cc5b2c8..9cbe3c3faba9 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -533,7 +533,6 @@ void RawScript::setData(const FWScriptInfo &info, const byte *data) { * @return Precalculated script labels */ const ScriptVars &RawScript::labels() const { - assert(_data); return _labels; } @@ -687,7 +686,7 @@ const char *FWScript::getNextString() { * @param pos Restored script position */ void FWScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos) { - assert(pos < _script._size); + assert(pos <= _script._size); _labels = labels; _localVars = local; _compare = compare; @@ -705,13 +704,15 @@ void FWScript::load(const ScriptVars &labels, const ScriptVars &local, uint16 co int FWScript::execute() { int ret = 0; - while (!ret) { - _line = _pos; - byte opcode = getNextByte(); - OpFunc handler = _info->opcodeHandler(opcode); + if(_script._size) { + while (!ret) { + _line = _pos; + byte opcode = getNextByte(); + OpFunc handler = _info->opcodeHandler(opcode); - if (handler) { - ret = (this->*handler)(); + if (handler) { + ret = (this->*handler)(); + } } } @@ -1861,7 +1862,7 @@ int FWScript::o1_disableSystemMenu() { byte param = getNextByte(); debugC(5, kCineDebugScript, "Line: %d: disableSystemMenu(%d)", _line, param); - disableSystemMenu = (param != 0); + disableSystemMenu = param; return 0; } diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index b2e992e8f67a..52e1cdac7e58 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -785,7 +785,6 @@ PCSoundFxPlayer::~PCSoundFxPlayer() { bool PCSoundFxPlayer::load(const char *song) { debug(9, "PCSoundFxPlayer::load('%s')", song); - Common::StackLock lock(_mutex); /* stop (w/ fade out) the previous song */ while (_fadeOutCounter != 0 && _fadeOutCounter < 100) { @@ -793,6 +792,8 @@ bool PCSoundFxPlayer::load(const char *song) { } _fadeOutCounter = 0; + Common::StackLock lock(_mutex); + stop(); _sfxData = readBundleSoundFile(song); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 9b73ae1101c8..eccd71cf05d5 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -36,7 +36,7 @@ namespace Cine { -bool disableSystemMenu = false; +int16 disableSystemMenu = 0; bool inMenu; int16 commandVar3[4]; @@ -341,7 +341,7 @@ void CineEngine::makeSystemMenu() { int16 mouseX, mouseY, mouseButton; int16 selectedSave; - if (!disableSystemMenu) { + if (disableSystemMenu != 1) { inMenu = true; do { @@ -544,14 +544,16 @@ int16 buildObjectListCommand(int16 param) { int16 selectSubObject(int16 x, int16 y, int16 param) { int16 listSize = buildObjectListCommand(param); - int16 selectedObject; + int16 selectedObject = -1; bool osExtras = g_cine->getGameType() == Cine::GType_OS; if (!listSize) { return -2; } - selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras); + if (disableSystemMenu == 0) { + selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras); + } if (selectedObject == -1) return -1; @@ -691,9 +693,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X, int16 var_4; SelectionMenu *menu; - if (disableSystemMenu) - return -1; - paramY = (height * 9) + 10; if (X + width > 319) { @@ -810,14 +809,18 @@ void makeActionMenu() { getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); if (g_cine->getGameType() == Cine::GType_OS) { - playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true); + if(disableSystemMenu == 0) { + playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true); + } if (playerCommand >= 8000) { playerCommand -= 8000; canUseOnObject = canUseOnItemTable[playerCommand]; } } else { - playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70); + if(disableSystemMenu == 0) { + playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70); + } } inMenu = false; diff --git a/engines/cine/various.h b/engines/cine/various.h index 0c1883c323c3..813619816d53 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -41,7 +41,7 @@ void makeActionMenu(); void waitPlayerInput(); void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4); -extern bool disableSystemMenu; +extern int16 disableSystemMenu; extern bool inMenu; extern CommandeType currentSaveName[10]; diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 556dad7e94b2..23a9d2ff858f 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -381,11 +381,17 @@ void ComposerEngine::loadLibrary(uint id) { filename = getStringFromConfig(_bookGroup, Common::String::format("%d", id)); filename = mangleFilename(filename); + // bookGroup is the basename of the path. + // TODO: tidy this up. _bookGroup.clear(); for (uint i = 0; i < filename.size(); i++) { - if (filename[i] == '\\' || filename[i] == ':') + if (filename[i] == '~' || filename[i] == '/' || filename[i] == ':') continue; for (uint j = 0; j < filename.size(); j++) { + if (filename[j] == '/') { + _bookGroup.clear(); + continue; + } if (filename[j] == '.') break; _bookGroup += filename[j]; diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp index b2e267ca497f..cbe17ea4d301 100644 --- a/engines/cruise/detection.cpp +++ b/engines/cruise/detection.cpp @@ -303,8 +303,6 @@ SaveStateDescriptor CruiseMetaEngine::querySaveMetaInfos(const char *target, int // Create the return descriptor SaveStateDescriptor desc(slot, header.saveName); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); desc.setThumbnail(header.thumbnail); return desc; diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp index de76eb83e063..61705a1e59d8 100644 --- a/engines/draci/detection.cpp +++ b/engines/draci/detection.cpp @@ -161,8 +161,6 @@ SaveStateDescriptor DraciMetaEngine::querySaveMetaInfos(const char *target, int // Create the return descriptor SaveStateDescriptor desc(slot, header.saveName); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); desc.setThumbnail(header.thumbnail); int day = (header.date >> 24) & 0xFF; diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index 6468281ac2eb..f2e2f42216b1 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -172,8 +172,6 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i saveName += (char)in->readByte(); SaveStateDescriptor desc(slot, saveName); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); // Check if there is a ScummVM data block if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { diff --git a/engines/dreamweb/detection_tables.h b/engines/dreamweb/detection_tables.h index 063aabbd8910..8a2f94f99b6a 100644 --- a/engines/dreamweb/detection_tables.h +++ b/engines/dreamweb/detection_tables.h @@ -46,7 +46,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformPC, - ADGF_TESTING, + 0, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -63,7 +63,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -84,7 +84,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::EN_GRB, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -101,7 +101,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::EN_USA, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -118,7 +118,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::FR_FRA, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -136,7 +136,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::FR_FRA, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -153,7 +153,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::DE_DEU, Common::kPlatformPC, - ADGF_TESTING, + 0, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -170,7 +170,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::DE_DEU, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -187,7 +187,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::ES_ESP, Common::kPlatformPC, - ADGF_TESTING, + 0, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -204,7 +204,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::ES_ESP, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -222,7 +222,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::ES_ESP, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, @@ -239,7 +239,7 @@ static const DreamWebGameDescription gameDescriptions[] = { }, Common::IT_ITA, Common::kPlatformPC, - ADGF_TESTING, + 0, GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_BRIGHTPALETTE) }, }, diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 48d44c03805c..1f6deb856607 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -152,8 +152,8 @@ class DreamWebEngine : public Engine { uint8 modifyChar(uint8 c) const; Common::String modifyFileName(const char *); - const Common::String& getDatafilePrefix() { return _datafilePrefix; }; - const Common::String& getSpeechDirName() { return _speechDirName; }; + const Common::String& getDatafilePrefix() { return _datafilePrefix; } + const Common::String& getSpeechDirName() { return _speechDirName; } private: void keyPressed(uint16 ascii); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4515939ebc56..f235f7c2fdc4 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2920,9 +2920,7 @@ void DreamWebEngine::setupInitialVars() { _vars._progressPoints = 0; _vars._watchOn = 0; _vars._shadesOn = 0; - _vars._secondCount = 0; - _vars._minuteCount = 30; - _vars._hourCount = 19; + getTime(); _vars._zoomOn = 1; _vars._location = 0; _vars._exPos = 0; diff --git a/engines/gob/anifile.cpp b/engines/gob/anifile.cpp index 2671fe0405d1..085ac800cd1e 100644 --- a/engines/gob/anifile.cpp +++ b/engines/gob/anifile.cpp @@ -37,30 +37,38 @@ ANIFile::ANIFile(GobEngine *vm, const Common::String &fileName, uint16 width, uint8 bpp) : _vm(vm), _width(width), _bpp(bpp), _hasPadding(false) { - Common::SeekableReadStream *ani = _vm->_dataIO->getFile(fileName); - if (ani) { - Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), false, DisposeAfterUse::YES); + bool bigEndian = false; + Common::String endianFileName = fileName; - load(sub, fileName); - return; - } + if ((_vm->getEndiannessMethod() == kEndiannessMethodAltFile) && + !_vm->_dataIO->hasFile(fileName)) { + // If the game has alternate big-endian files, look if one exist - // File doesn't exist, try to open the big-endian'd alternate file - Common::String alternateFileName = fileName; - alternateFileName.setChar('_', 0); + Common::String alternateFileName = fileName; + alternateFileName.setChar('_', 0); - ani = _vm->_dataIO->getFile(alternateFileName); + if (_vm->_dataIO->hasFile(alternateFileName)) { + bigEndian = true; + endianFileName = alternateFileName; + } + } else if ((_vm->getEndiannessMethod() == kEndiannessMethodBE) || + ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) && + (_vm->getEndianness() == kEndiannessBE))) + // Game always little endian or it follows the system and it is big endian + bigEndian = true; + + Common::SeekableReadStream *ani = _vm->_dataIO->getFile(endianFileName); if (ani) { - Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), true, DisposeAfterUse::YES); + Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), bigEndian, DisposeAfterUse::YES); // The big endian version pads a few fields to even size - _hasPadding = true; + _hasPadding = bigEndian; load(sub, fileName); return; } - warning("ANIFile::ANIFile(): No such file \"%s\"", fileName.c_str()); + warning("ANIFile::ANIFile(): No such file \"%s\" (\"%s\")", endianFileName.c_str(), fileName.c_str()); } ANIFile::~ANIFile() { @@ -281,4 +289,9 @@ void ANIFile::drawLayer(Surface &dest, uint16 layer, uint16 part, _layers[layer]->draw(dest, part, x, y, transp); } +void ANIFile::recolor(uint8 from, uint8 to) { + for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l) + (*l)->recolor(from, to); +} + } // End of namespace Gob diff --git a/engines/gob/anifile.h b/engines/gob/anifile.h index b6d9c735b5d8..c930aafc6bdd 100644 --- a/engines/gob/anifile.h +++ b/engines/gob/anifile.h @@ -92,6 +92,9 @@ class ANIFile { /** Draw an animation frame. */ void draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const; + /** Recolor the animation sprites. */ + void recolor(uint8 from, uint8 to); + private: typedef Common::Array LayerArray; typedef Common::Array AnimationArray; diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp index 8d739fb3a4f3..7e3668a0cea3 100644 --- a/engines/gob/aniobject.cpp +++ b/engines/gob/aniobject.cpp @@ -28,23 +28,20 @@ namespace Gob { ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani), _cmp(0), - _visible(false), _paused(false), _mode(kModeContinuous), - _x(0), _y(0), _background(0), _drawn(false) { + _visible(false), _paused(false), _mode(kModeContinuous), _x(0), _y(0) { setAnimation(0); setPosition(); } ANIObject::ANIObject(const CMPFile &cmp) : _ani(0), _cmp(&cmp), - _visible(false), _paused(false), _mode(kModeContinuous), - _x(0), _y(0), _background(0), _drawn(false) { + _visible(false), _paused(false), _mode(kModeContinuous), _x(0), _y(0) { setAnimation(0); setPosition(); } ANIObject::~ANIObject() { - delete _background; } void ANIObject::setVisible(bool visible) { @@ -104,7 +101,7 @@ void ANIObject::getPosition(int16 &x, int16 &y) const { y = _y; } -void ANIObject::getFramePosition(int16 &x, int16 &y) const { +void ANIObject::getFramePosition(int16 &x, int16 &y, uint16 n) const { // CMP "animations" have no specific frame positions if (_cmp) { getPosition(x, y); @@ -118,11 +115,24 @@ void ANIObject::getFramePosition(int16 &x, int16 &y) const { if (_frame >= animation.frameCount) return; - x = _x + animation.frameAreas[_frame].left; - y = _y + animation.frameAreas[_frame].top; + // If we're paused, we don't advance any frames + if (_paused) + n = 0; + + // Number of cycles run through after n frames + uint16 cycles = (_frame + n) / animation.frameCount; + // Frame position after n frames + uint16 frame = (_frame + n) % animation.frameCount; + + // Only doing one cycle? + if (_mode == kModeOnce) + cycles = MAX(cycles, 1); + + x = _x + animation.frameAreas[frame].left + cycles * animation.deltaX; + y = _y + animation.frameAreas[frame].top + cycles * animation.deltaY; } -void ANIObject::getFrameSize(int16 &width, int16 &height) const { +void ANIObject::getFrameSize(int16 &width, int16 &height, uint16 n) const { if (_cmp) { width = _cmp->getWidth (_animation); height = _cmp->getHeight(_animation); @@ -137,8 +147,15 @@ void ANIObject::getFrameSize(int16 &width, int16 &height) const { if (_frame >= animation.frameCount) return; - width = animation.frameAreas[_frame].right - animation.frameAreas[_frame].left + 1; - height = animation.frameAreas[_frame].bottom - animation.frameAreas[_frame].top + 1; + // If we're paused, we don't advance any frames + if (_paused) + n = 0; + + // Frame position after n frames + uint16 frame = (_frame + n) % animation.frameCount; + + width = animation.frameAreas[frame].right - animation.frameAreas[frame].left + 1; + height = animation.frameAreas[frame].bottom - animation.frameAreas[frame].top + 1; } bool ANIObject::isIn(int16 x, int16 y) const { @@ -188,46 +205,36 @@ bool ANIObject::draw(Surface &dest, int16 &left, int16 &top, bool ANIObject::drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { - if (!_background) { + if (!hasBuffer()) { uint16 width, height; _cmp->getMaxSize(width, height); - _background = new Surface(width, height, dest.getBPP()); + resizeBuffer(width, height); } - const uint16 cR = _cmp->getWidth (_animation) - 1; - const uint16 cB = _cmp->getHeight(_animation) - 1; - - _backgroundLeft = CLIP( + _x, 0, dest.getWidth () - 1); - _backgroundTop = CLIP( + _y, 0, dest.getHeight() - 1); - _backgroundRight = CLIP(cR + _x, 0, dest.getWidth () - 1); - _backgroundBottom = CLIP(cB + _y, 0, dest.getHeight() - 1); + left = _x; + top = _y; + right = _x + _cmp->getWidth (_animation) - 1; + bottom = _y + _cmp->getHeight(_animation) - 1; - _background->blit(dest, _backgroundLeft , _backgroundTop, - _backgroundRight, _backgroundBottom, 0, 0); + if (!saveScreen(dest, left, top, right, bottom)) + return false; _cmp->draw(dest, _animation, _x, _y, 0); - _drawn = true; - - left = _backgroundLeft; - top = _backgroundTop; - right = _backgroundRight; - bottom = _backgroundBottom; - return true; } bool ANIObject::drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { - if (!_background) { + if (!hasBuffer()) { uint16 width, height; _ani->getMaxSize(width, height); - _background = new Surface(width, height, dest.getBPP()); + resizeBuffer(width, height); } const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation); @@ -236,45 +243,23 @@ bool ANIObject::drawANI(Surface &dest, int16 &left, int16 &top, const ANIFile::FrameArea &area = animation.frameAreas[_frame]; - _backgroundLeft = CLIP(area.left + _x, 0, dest.getWidth () - 1); - _backgroundTop = CLIP(area.top + _y, 0, dest.getHeight() - 1); - _backgroundRight = CLIP(area.right + _x, 0, dest.getWidth () - 1); - _backgroundBottom = CLIP(area.bottom + _y, 0, dest.getHeight() - 1); + left = _x + area.left; + top = _y + area.top; + right = _x + area.right; + bottom = _y + area.bottom; - _background->blit(dest, _backgroundLeft , _backgroundTop, - _backgroundRight, _backgroundBottom, 0, 0); + if (!saveScreen(dest, left, top, right, bottom)) + return false; _ani->draw(dest, _animation, _frame, _x, _y); - _drawn = true; - - left = _backgroundLeft; - top = _backgroundTop; - right = _backgroundRight; - bottom = _backgroundBottom; - return true; } bool ANIObject::clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { - if (!_drawn) - return false; - - const int16 bgRight = _backgroundRight - _backgroundLeft; - const int16 bgBottom = _backgroundBottom - _backgroundTop; - - dest.blit(*_background, 0, 0, bgRight, bgBottom, _backgroundLeft, _backgroundTop); - - _drawn = false; - - left = _backgroundLeft; - top = _backgroundTop; - right = _backgroundRight; - bottom = _backgroundBottom; - - return true; + return restoreScreen(dest, left, top, right, bottom); } void ANIObject::advance() { diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h index 00f42b43cef8..d8c8edc2b801 100644 --- a/engines/gob/aniobject.h +++ b/engines/gob/aniobject.h @@ -25,6 +25,8 @@ #include "common/system.h" +#include "gob/backbuffer.h" + namespace Gob { class ANIFile; @@ -32,7 +34,7 @@ class CMPFile; class Surface; /** An ANI object, controlling an animation within an ANI file. */ -class ANIObject { +class ANIObject : public BackBuffer { public: enum Mode { kModeContinuous, ///< Play the animation continuously. @@ -68,10 +70,10 @@ class ANIObject { /** Return the current position. */ void getPosition(int16 &x, int16 &y) const; - /** Return the current frame position. */ - void getFramePosition(int16 &x, int16 &y) const; - /** Return the current frame size. */ - void getFrameSize(int16 &width, int16 &height) const; + /** Return the frame position after another n frames. */ + void getFramePosition(int16 &x, int16 &y, uint16 n = 0) const; + /** Return the current frame size after another n frames. */ + void getFrameSize(int16 &width, int16 &height, uint16 n = 0) const; /** Are there coordinates within the animation sprite? */ bool isIn(int16 x, int16 y) const; @@ -118,13 +120,6 @@ class ANIObject { int16 _x; ///< The current X position. int16 _y; ///< The current Y position. - Surface *_background; ///< The saved background. - bool _drawn; ///< Was the animation drawn? - - int16 _backgroundLeft; ///< The left position of the saved background. - int16 _backgroundTop; ///< The top of the saved background. - int16 _backgroundRight; ///< The right position of the saved background. - int16 _backgroundBottom; ///< The bottom position of the saved background. bool drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); bool drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); diff --git a/engines/gob/backbuffer.cpp b/engines/gob/backbuffer.cpp new file mode 100644 index 000000000000..752042d46ee0 --- /dev/null +++ b/engines/gob/backbuffer.cpp @@ -0,0 +1,100 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/util.h" + +#include "gob/backbuffer.h" +#include "gob/surface.h" + +namespace Gob { + +BackBuffer::BackBuffer() : _background(0), _saved(false) { +} + +BackBuffer::~BackBuffer() { + delete _background; +} + +bool BackBuffer::hasBuffer() const { + return _background != 0; +} + +bool BackBuffer::hasSavedBackground() const { + return _saved; +} + +void BackBuffer::trashBuffer() { + _saved = false; +} + +void BackBuffer::resizeBuffer(uint16 width, uint16 height) { + trashBuffer(); + + if (_background && (_background->getWidth() == width) && (_background->getHeight() == height)) + return; + + delete _background; + + _background = new Surface(width, height, 1); +} + +bool BackBuffer::saveScreen(const Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { + if (!_background) + return false; + + const int16 width = MIN(right - left + 1, _background->getWidth ()); + const int16 height = MIN(bottom - top + 1, _background->getHeight()); + if ((width <= 0) || (height <= 0)) + return false; + + right = left + width - 1; + bottom = top + height - 1; + + _saveLeft = left; + _saveTop = top; + _saveRight = right; + _saveBottom = bottom; + + _background->blit(dest, _saveLeft, _saveTop, _saveRight, _saveBottom, 0, 0); + + _saved = true; + + return true; +} + +bool BackBuffer::restoreScreen(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { + if (!_saved) + return false; + + left = _saveLeft; + top = _saveTop; + right = _saveRight; + bottom = _saveBottom; + + dest.blit(*_background, 0, 0, right - left, bottom - top, left, top); + + _saved = false; + + return true; +} + +} // End of namespace Gob diff --git a/engines/gob/backbuffer.h b/engines/gob/backbuffer.h new file mode 100644 index 000000000000..c978689e9f88 --- /dev/null +++ b/engines/gob/backbuffer.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_BACKBUFFER_H +#define GOB_BACKBUFFER_H + +#include "common/system.h" + +namespace Gob { + +class Surface; + +class BackBuffer { +public: + BackBuffer(); + ~BackBuffer(); + +protected: + void trashBuffer(); + void resizeBuffer(uint16 width, uint16 height); + + bool saveScreen (const Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); + bool restoreScreen( Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); + + bool hasBuffer() const; + bool hasSavedBackground() const; + +private: + Surface *_background; ///< The saved background. + bool _saved; ///< Was the background saved? + + int16 _saveLeft; ///< The left position of the saved background. + int16 _saveTop; ///< The top of the saved background. + int16 _saveRight; ///< The right position of the saved background. + int16 _saveBottom; ///< The bottom position of the saved background. +}; + +} // End of namespace Gob + +#endif // GOB_BACKBUFFER_H diff --git a/engines/gob/cmpfile.cpp b/engines/gob/cmpfile.cpp index 7b21c4c83508..d304958f7601 100644 --- a/engines/gob/cmpfile.cpp +++ b/engines/gob/cmpfile.cpp @@ -21,6 +21,7 @@ */ #include "common/stream.h" +#include "common/substream.h" #include "common/str.h" #include "gob/gob.h" @@ -143,7 +144,13 @@ void CMPFile::loadCMP(Common::SeekableReadStream &cmp) { } void CMPFile::loadRXY(Common::SeekableReadStream &rxy) { - _coordinates = new RXYFile(rxy); + bool bigEndian = (_vm->getEndiannessMethod() == kEndiannessMethodBE) || + ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) && + (_vm->getEndianness() == kEndiannessBE)); + + Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), bigEndian, DisposeAfterUse::NO); + + _coordinates = new RXYFile(sub); for (uint i = 0; i < _coordinates->size(); i++) { const RXYFile::Coordinates &c = (*_coordinates)[i]; @@ -243,4 +250,9 @@ uint16 CMPFile::addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom) return _coordinates->add(left, top, right, bottom); } +void CMPFile::recolor(uint8 from, uint8 to) { + if (_surface) + _surface->recolor(from, to); +} + } // End of namespace Gob diff --git a/engines/gob/cmpfile.h b/engines/gob/cmpfile.h index 2b669e4d3848..9c858238af1a 100644 --- a/engines/gob/cmpfile.h +++ b/engines/gob/cmpfile.h @@ -70,6 +70,8 @@ class CMPFile { uint16 addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom); + void recolor(uint8 from, uint8 to); + private: GobEngine *_vm; diff --git a/engines/gob/decfile.cpp b/engines/gob/decfile.cpp index fb67c526278b..85b4c09ca326 100644 --- a/engines/gob/decfile.cpp +++ b/engines/gob/decfile.cpp @@ -38,30 +38,38 @@ DECFile::DECFile(GobEngine *vm, const Common::String &fileName, uint16 width, uint16 height, uint8 bpp) : _vm(vm), _width(width), _height(height), _bpp(bpp), _hasPadding(false), _backdrop(0) { - Common::SeekableReadStream *dec = _vm->_dataIO->getFile(fileName); - if (dec) { - Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), false, DisposeAfterUse::YES); - - load(sub, fileName); - return; - } - - // File doesn't exist, try to open the big-endian'd alternate file - Common::String alternateFileName = fileName; - alternateFileName.setChar('_', 0); - - dec = _vm->_dataIO->getFile(alternateFileName); - if (dec) { - Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), true, DisposeAfterUse::YES); + bool bigEndian = false; + Common::String endianFileName = fileName; + + if ((_vm->getEndiannessMethod() == kEndiannessMethodAltFile) && + !_vm->_dataIO->hasFile(fileName)) { + // If the game has alternate big-endian files, look if one exist + + Common::String alternateFileName = fileName; + alternateFileName.setChar('_', 0); + + if (_vm->_dataIO->hasFile(alternateFileName)) { + bigEndian = true; + endianFileName = alternateFileName; + } + } else if ((_vm->getEndiannessMethod() == kEndiannessMethodBE) || + ((_vm->getEndiannessMethod() == kEndiannessMethodSystem) && + (_vm->getEndianness() == kEndiannessBE))) + // Game always little endian or it follows the system and it is big endian + bigEndian = true; + + Common::SeekableReadStream *ani = _vm->_dataIO->getFile(endianFileName); + if (ani) { + Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), bigEndian, DisposeAfterUse::YES); // The big endian version pads a few fields to even size - _hasPadding = true; + _hasPadding = bigEndian; load(sub, fileName); return; } - warning("DECFile::DECFile(): No such file \"%s\"", fileName.c_str()); + warning("DECFile::DECFile(): No such file \"%s\" (\"%s\")", endianFileName.c_str(), fileName.c_str()); } DECFile::~DECFile() { diff --git a/engines/gob/detection/detection.cpp b/engines/gob/detection/detection.cpp index bcfd5dacfa41..8fb0052a5b66 100644 --- a/engines/gob/detection/detection.cpp +++ b/engines/gob/detection/detection.cpp @@ -25,40 +25,146 @@ #include "engines/obsolete.h" #include "gob/gob.h" +#include "gob/dataio.h" #include "gob/detection/tables.h" class GobMetaEngine : public AdvancedMetaEngine { public: - GobMetaEngine() : AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) { - _singleid = "gob"; - _guioptions = GUIO1(GUIO_NOLAUNCHLOAD); - } + GobMetaEngine(); - virtual GameDescriptor findGame(const char *gameid) const { - return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable); - } + virtual GameDescriptor findGame(const char *gameid) const; + + virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const; + + virtual const char *getName() const; + virtual const char *getOriginalCopyright() const; + + virtual bool hasFeature(MetaEngineFeature f) const; + + virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + +private: + /** + * Inspect the game archives to detect which Once Upon A Time game this is. + */ + static const Gob::GOBGameDescription *detectOnceUponATime(const Common::FSList &fslist); +}; + +GobMetaEngine::GobMetaEngine() : + AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) { + + _singleid = "gob"; + _guioptions = GUIO1(GUIO_NOLAUNCHLOAD); +} + +GameDescriptor GobMetaEngine::findGame(const char *gameid) const { + return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable); +} + +const ADGameDescription *GobMetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { + ADFilePropertiesMap filesProps; + + const Gob::GOBGameDescription *game; + game = (const Gob::GOBGameDescription *)detectGameFilebased(allFiles, fslist, Gob::fileBased, &filesProps); + if (!game) + return 0; - virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { - return detectGameFilebased(allFiles, Gob::fileBased); + if (game->gameType == Gob::kGameTypeOnceUponATime) { + game = detectOnceUponATime(fslist); + if (!game) + return 0; } - virtual const char *getName() const { - return "Gob"; + reportUnknown(fslist.begin()->getParent(), filesProps); + return (const ADGameDescription *)game; +} + +const Gob::GOBGameDescription *GobMetaEngine::detectOnceUponATime(const Common::FSList &fslist) { + // Add the game path to the search manager + SearchMan.clear(); + SearchMan.addDirectory(fslist.begin()->getParent().getPath(), fslist.begin()->getParent()); + + // Open the archives + Gob::DataIO dataIO; + if (!dataIO.openArchive("stk1.stk", true) || + !dataIO.openArchive("stk2.stk", true) || + !dataIO.openArchive("stk3.stk", true)) { + + SearchMan.clear(); + return 0; } - virtual const char *getOriginalCopyright() const { - return "Goblins Games (C) Coktel Vision"; + Gob::OnceUponATime gameType = Gob::kOnceUponATimeInvalid; + Gob::OnceUponATimePlatform platform = Gob::kOnceUponATimePlatformInvalid; + + // If these animal files are present, it's Abracadabra + if (dataIO.hasFile("arai.anm") && + dataIO.hasFile("crab.anm") && + dataIO.hasFile("crap.anm") && + dataIO.hasFile("drag.anm") && + dataIO.hasFile("guep.anm") && + dataIO.hasFile("loup.anm") && + dataIO.hasFile("mous.anm") && + dataIO.hasFile("rhin.anm") && + dataIO.hasFile("saut.anm") && + dataIO.hasFile("scor.anm")) + gameType = Gob::kOnceUponATimeAbracadabra; + + // If these animal files are present, it's Baba Yaga + if (dataIO.hasFile("abei.anm") && + dataIO.hasFile("arai.anm") && + dataIO.hasFile("drag.anm") && + dataIO.hasFile("fauc.anm") && + dataIO.hasFile("gren.anm") && + dataIO.hasFile("rena.anm") && + dataIO.hasFile("sang.anm") && + dataIO.hasFile("serp.anm") && + dataIO.hasFile("tort.anm") && + dataIO.hasFile("vaut.anm")) + gameType = Gob::kOnceUponATimeBabaYaga; + + // Detect the platform by endianness and existence of a MOD file + Common::SeekableReadStream *villeDEC = dataIO.getFile("ville.dec"); + if (villeDEC && (villeDEC->size() > 6)) { + byte data[6]; + + if (villeDEC->read(data, 6) == 6) { + if (!memcmp(data, "\000\000\000\001\000\007", 6)) { + // Big endian -> Amiga or Atari ST + + if (dataIO.hasFile("mod.babayaga")) + platform = Gob::kOnceUponATimePlatformAmiga; + else + platform = Gob::kOnceUponATimePlatformAtariST; + + } else if (!memcmp(data, "\000\000\001\000\007\000", 6)) + // Little endian -> DOS + platform = Gob::kOnceUponATimePlatformDOS; + } + + delete villeDEC; } - virtual bool hasFeature(MetaEngineFeature f) const; + SearchMan.clear(); - virtual Common::Error createInstance(OSystem *syst, Engine **engine) const { - Engines::upgradeTargetIfNecessary(obsoleteGameIDsTable); - return AdvancedMetaEngine::createInstance(syst, engine); + if ((gameType == Gob::kOnceUponATimeInvalid) || (platform == Gob::kOnceUponATimePlatformInvalid)) { + warning("GobMetaEngine::detectOnceUponATime(): Detection failed (%d, %d)", + (int) gameType, (int) platform); + return 0; } - virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; -}; + + return &Gob::fallbackOnceUpon[gameType][platform]; +} + +const char *GobMetaEngine::getName() const { + return "Gob"; +} + +const char *GobMetaEngine::getOriginalCopyright() const { + return "Goblins Games (C) Coktel Vision"; +} bool GobMetaEngine::hasFeature(MetaEngineFeature f) const { return false; @@ -68,6 +174,12 @@ bool Gob::GobEngine::hasFeature(EngineFeature f) const { return (f == kSupportsRTL); } + +Common::Error GobMetaEngine::createInstance(OSystem *syst, Engine **engine) const { + Engines::upgradeTargetIfNecessary(obsoleteGameIDsTable); + return AdvancedMetaEngine::createInstance(syst, engine); +} + bool GobMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)desc; if (gd) { @@ -77,6 +189,7 @@ bool GobMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD return gd != 0; } + #if PLUGIN_ENABLED_DYNAMIC(GOB) REGISTER_PLUGIN_DYNAMIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine); #else diff --git a/engines/gob/detection/tables.h b/engines/gob/detection/tables.h index 5d211ac7d8dc..271f75af7997 100644 --- a/engines/gob/detection/tables.h +++ b/engines/gob/detection/tables.h @@ -48,7 +48,10 @@ static const PlainGameDescriptor gobGames[] = { {"gob2cd", "Gobliins 2 CD"}, {"ween", "Ween: The Prophecy"}, {"bargon", "Bargon Attack"}, + {"babayaga", "Once Upon A Time: Baba Yaga"}, + {"abracadabra", "Once Upon A Time: Abracadabra"}, {"littlered", "Once Upon A Time: Little Red Riding Hood"}, + {"onceupon", "Once Upon A Time"}, {"ajworld", "A.J.'s World of Discovery"}, {"gob3", "Goblins Quest 3"}, {"gob3cd", "Goblins Quest 3 CD"}, @@ -94,6 +97,7 @@ static const GOBGameDescription gameDescriptions[] = { #include "gob/detection/tables_ween.h" // Ween: The Prophecy #include "gob/detection/tables_bargon.h" // Bargon Attack #include "gob/detection/tables_littlered.h" // Once Upon A Time: Little Red Riding Hood + #include "gob/detection/tables_onceupon.h" // Once Upon A Time: Baba Yaga and Abracadabra #include "gob/detection/tables_lit.h" // Lost in Time #include "gob/detection/tables_fascin.h" // Fascination #include "gob/detection/tables_geisha.h" // Geisha diff --git a/engines/gob/detection/tables_ajworld.h b/engines/gob/detection/tables_ajworld.h index c78d11a6addd..d86bdb16beb7 100644 --- a/engines/gob/detection/tables_ajworld.h +++ b/engines/gob/detection/tables_ajworld.h @@ -1,4 +1,3 @@ - /* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names diff --git a/engines/gob/detection/tables_fallback.h b/engines/gob/detection/tables_fallback.h index 2853ee7b4fa1..05f579c08c2e 100644 --- a/engines/gob/detection/tables_fallback.h +++ b/engines/gob/detection/tables_fallback.h @@ -23,6 +23,8 @@ #ifndef GOB_DETECTION_TABLES_FALLBACK_H #define GOB_DETECTION_TABLES_FALLBACK_H +// -- Tables for the filename-based fallback -- + static const GOBGameDescription fallbackDescs[] = { { //0 { @@ -361,6 +363,20 @@ static const GOBGameDescription fallbackDescs[] = { 0, 0, 0 }, { //24 + { + "onceupon", + "unknown", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformUnknown, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeOnceUponATime, + kFeaturesEGA, + 0, 0, 0 + }, + { //25 { "adi2", "", @@ -374,7 +390,7 @@ static const GOBGameDescription fallbackDescs[] = { kFeatures640x480, "adi2.stk", 0, 0 }, - { //25 + { //26 { "adi4", "", @@ -388,7 +404,7 @@ static const GOBGameDescription fallbackDescs[] = { kFeatures640x480, "adif41.stk", 0, 0 }, - { //26 + { //27 { "coktelplayer", "unknown", @@ -430,10 +446,119 @@ static const ADFileBasedFallback fileBased[] = { { &fallbackDescs[21].desc, { "disk1.stk", "disk2.stk", "disk3.stk", 0 } }, { &fallbackDescs[22].desc, { "intro.stk", "stk2.stk", "stk3.stk", 0 } }, { &fallbackDescs[23].desc, { "intro.stk", "stk2.stk", "stk3.stk", "mod.babayaga", 0 } }, - { &fallbackDescs[24].desc, { "adi2.stk", 0 } }, - { &fallbackDescs[25].desc, { "adif41.stk", "adim41.stk", 0 } }, - { &fallbackDescs[26].desc, { "coktelplayer.scn", 0 } }, + { &fallbackDescs[24].desc, { "stk1.stk", "stk2.stk", "stk3.stk", 0 } }, + { &fallbackDescs[25].desc, { "adi2.stk", 0 } }, + { &fallbackDescs[26].desc, { "adif41.stk", "adim41.stk", 0 } }, + { &fallbackDescs[27].desc, { "coktelplayer.scn", 0 } }, { 0, { 0 } } }; +// -- Tables for detecting the specific Once Upon A Time game -- + +enum OnceUponATime { + kOnceUponATimeInvalid = -1, + kOnceUponATimeAbracadabra = 0, + kOnceUponATimeBabaYaga = 1, + kOnceUponATimeMAX +}; + +enum OnceUponATimePlatform { + kOnceUponATimePlatformInvalid = -1, + kOnceUponATimePlatformDOS = 0, + kOnceUponATimePlatformAmiga = 1, + kOnceUponATimePlatformAtariST = 2, + kOnceUponATimePlatformMAX +}; + +static const GOBGameDescription fallbackOnceUpon[kOnceUponATimeMAX][kOnceUponATimePlatformMAX] = { + { // kOnceUponATimeAbracadabra + { // kOnceUponATimePlatformDOS + { + "abracadabra", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 + }, + { // kOnceUponATimePlatformAmiga + { + "abracadabra", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 + }, + { // kOnceUponATimePlatformAtariST + { + "abracadabra", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 + } + }, + { // kOnceUponATimeBabaYaga + { // kOnceUponATimePlatformDOS + { + "babayaga", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 + }, + { // kOnceUponATimePlatformAmiga + { + "babayaga", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 + }, + { // kOnceUponATimePlatformAtariST + { + "babayaga", + "", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 + } + } +}; + #endif // GOB_DETECTION_TABLES_FALLBACK_H diff --git a/engines/gob/detection/tables_geisha.h b/engines/gob/detection/tables_geisha.h index 331e17e31d65..a32d1ebf8170 100644 --- a/engines/gob/detection/tables_geisha.h +++ b/engines/gob/detection/tables_geisha.h @@ -32,7 +32,63 @@ "geisha", "", AD_ENTRY1s("disk1.stk", "6eebbb98ad90cd3c44549fc2ab30f632", 212153), - UNK_LANG, + EN_ANY, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeGeisha, + kFeaturesEGA | kFeaturesAdLib, + "disk1.stk", "intro.tot", 0 +}, +{ + { + "geisha", + "", + AD_ENTRY1s("disk1.stk", "6eebbb98ad90cd3c44549fc2ab30f632", 212153), + DE_DEU, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeGeisha, + kFeaturesEGA | kFeaturesAdLib, + "disk1.stk", "intro.tot", 0 +}, +{ // Supplied by misterhands in bug report #3539797 + { + "geisha", + "", + AD_ENTRY1s("disk1.stk", "0c4c16090921664f50baefdfd24d7f5d", 211889), + FR_FRA, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeGeisha, + kFeaturesEGA | kFeaturesAdLib, + "disk1.stk", "intro.tot", 0 +}, +{ // Supplied by einstein95 in bug report #3544449 + { + "geisha", + "", + AD_ENTRY1s("disk1.stk", "49107ac897e7c00af6c4ecd78a74a710", 212169), + ES_ESP, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeGeisha, + kFeaturesEGA | kFeaturesAdLib, + "disk1.stk", "intro.tot", 0 +}, +{ // Supplied by einstein95 in bug report #3544449 + { + "geisha", + "", + AD_ENTRY1s("disk1.stk", "49107ac897e7c00af6c4ecd78a74a710", 212169), + IT_ITA, kPlatformPC, ADGF_NO_FLAGS, GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) @@ -63,7 +119,7 @@ "geisha", "", AD_ENTRY1s("disk1.stk", "e5892f00917c62423e93f5fd9920cf47", 208120), - UNK_LANG, + EN_ANY, kPlatformAmiga, ADGF_NO_FLAGS, GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) diff --git a/engines/gob/detection/tables_onceupon.h b/engines/gob/detection/tables_onceupon.h new file mode 100644 index 000000000000..366024d43c5a --- /dev/null +++ b/engines/gob/detection/tables_onceupon.h @@ -0,0 +1,518 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* Detection tables for Once Upon A Time: Baba Yaga and Abracadabra. */ + +#ifndef GOB_DETECTION_TABLES_ONCEUPON_H +#define GOB_DETECTION_TABLES_ONCEUPON_H + +// -- Once Upon A Time: Abracadabra, Amiga -- + +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106}, + {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106}, + {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482}, + {0, 0, 0, 0} + }, + DE_DEU, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106}, + {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106}, + {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482}, + {0, 0, 0, 0} + }, + IT_ITA, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "e4b21818af03930dc9cab2ad4c93cb5b", 362106}, + {"stk3.stk", 0, "76874ad92782f9b2de57beafc05ec877", 353482}, + {0, 0, 0, 0} + }, + ES_ESP, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, + +// -- Once Upon A Time: Abracadabra, Atari ST -- + +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123}, + {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123}, + {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257}, + {0, 0, 0, 0} + }, + DE_DEU, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123}, + {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123}, + {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257}, + {0, 0, 0, 0} + }, + IT_ITA, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "abracadabra", + "", + { + {"stk1.stk", 0, "a8e963eea170155548e5bc1d0f07d50d", 209806}, + {"stk2.stk", 0, "c6440aaf068ec3149ae89bc5c41ebf02", 362123}, + {"stk3.stk", 0, "5af3c1202ba6fcf8dad2b2125e1c1383", 353257}, + {0, 0, 0, 0} + }, + ES_ESP, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeAbracadabra, + kFeaturesEGA, + 0, 0, 0 +}, + +// -- Once Upon A Time: Baba Yaga, DOS EGA Floppy -- + +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813}, + {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582}, + {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813}, + {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582}, + {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925}, + {0, 0, 0, 0} + }, + DE_DEU, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813}, + {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582}, + {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813}, + {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582}, + {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925}, + {0, 0, 0, 0} + }, + IT_ITA, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "3c777f43e6fb49fde9222543447e135a", 204813}, + {"stk2.stk", 0, "6cf0b009dd185a8f589e91a1f9c33df5", 361582}, + {"stk3.stk", 0, "6473183ca4db1b5b5cea047f9af59a26", 328925}, + {0, 0, 0, 0} + }, + ES_ESP, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesAdLib | kFeaturesEGA, + 0, 0, 0 +}, + +// -- Once Upon A Time: Baba Yaga, Amiga -- + +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090}, + {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090}, + {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + DE_DEU, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090}, + {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090}, + {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + IT_ITA, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "bcc823d2888057031e54716ed1b3c80e", 205090}, + {"stk2.stk", 0, "f76bf7c2ff60d816d69962d1a593207c", 362122}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + ES_ESP, + kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, + +// -- Once Upon A Time: Baba Yaga, Atari ST -- + +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095}, + {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095}, + {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + DE_DEU, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095}, + {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095}, + {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + IT_ITA, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, +{ + { + "babayaga", + "", + { + {"stk1.stk", 0, "17a4e3e7a18cc97231c92d280c7878a1", 205095}, + {"stk2.stk", 0, "bfbc380e5461f63af28e9e6b10f334b5", 362128}, + {"stk3.stk", 0, "6227d1aefdf39d88dcf83e38bea2a9af", 328922}, + {0, 0, 0, 0} + }, + ES_ESP, + kPlatformAtariST, + ADGF_NO_FLAGS, + GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH) + }, + kGameTypeBabaYaga, + kFeaturesEGA, + 0, 0, 0 +}, + +#endif // GOB_DETECTION_TABLES_ONCEUPON_H diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index fe59b11f7602..8c6919416d8c 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -256,7 +256,7 @@ void Draw::blitInvalidated() { if (_cursorIndex == 4) blitCursor(); - if (_vm->_inter->_terminate) + if (_vm->_inter && _vm->_inter->_terminate) return; if (_noInvalidated && !_applyPal) @@ -271,7 +271,9 @@ void Draw::blitInvalidated() { return; } - _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1); + if (_cursorSprites) + _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1); + if (_applyPal) { clearPalette(); forceBlit(); @@ -425,28 +427,13 @@ int Draw::stringLength(const char *str, uint16 fontIndex) { return len; } -void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, Surface &dest, const Font &font) { - - while (*str != '\0') { - const int16 charRight = x + font.getCharWidth(*str); - const int16 charBottom = y + font.getCharHeight(); - - if ((charRight <= dest.getWidth()) && (charBottom <= dest.getHeight())) - font.drawLetter(dest, *str, x, y, color1, color2, transp); - - x += font.getCharWidth(*str); - str++; - } -} - void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, int16 bottom, const char *str, int16 fontIndex, int16 color) { adjustCoords(1, &left, &top); adjustCoords(1, &right, &bottom); - uint16 centerOffset = _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter); + uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0; if (centerOffset != 0) { _vm->_game->_script->call(centerOffset); @@ -505,7 +492,7 @@ void Draw::oPlaytoons_sub_F_1B(uint16 id, int16 left, int16 top, int16 right, in adjustCoords(1, &left, &top); adjustCoords(1, &right, &bottom); - uint16 centerOffset = _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter); + uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0; if (centerOffset != 0) { _vm->_game->_script->call(centerOffset); diff --git a/engines/gob/draw.h b/engines/gob/draw.h index e7af1f9af327..b51c6466e077 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -194,8 +194,6 @@ class Draw { adjustCoords(adjust, (int16 *)coord1, (int16 *)coord2); } int stringLength(const char *str, uint16 fontIndex); - void drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, Surface &dest, const Font &font); void printTextCentered(int16 id, int16 left, int16 top, int16 right, int16 bottom, const char *str, int16 fontIndex, int16 color); void oPlaytoons_sub_F_1B( uint16 id, int16 left, int16 top, int16 right, int16 bottom, char *paramStr, int16 var3, int16 var4, int16 shortId); diff --git a/engines/gob/draw_fascin.cpp b/engines/gob/draw_fascin.cpp index 54cd52b66051..12009d7ee5f6 100644 --- a/engines/gob/draw_fascin.cpp +++ b/engines/gob/draw_fascin.cpp @@ -222,8 +222,8 @@ void Draw_Fascination::spriteOperation(int16 operation) { _destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency); } } else { - drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, - _backColor, _transparency, *_spritesArray[_destSurface], *font); + font->drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, + _backColor, _transparency, *_spritesArray[_destSurface]); _destSpriteX += len * font->getCharWidth(); } } else { diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp index a443f81ccfe4..76e2ae591cd1 100644 --- a/engines/gob/draw_playtoons.cpp +++ b/engines/gob/draw_playtoons.cpp @@ -283,8 +283,8 @@ void Draw_Playtoons::spriteOperation(int16 operation) { _destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency); } } else { - drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, - _backColor, _transparency, *_spritesArray[_destSurface], *font); + font->drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, + _backColor, _transparency, *_spritesArray[_destSurface]); _destSpriteX += len * font->getCharWidth(); } } else { diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index b637ecbd2b76..f5475278c4c5 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -74,13 +74,16 @@ void Draw_v2::closeScreen() { } void Draw_v2::blitCursor() { - if (_cursorIndex == -1) + if (!_cursorSprites || (_cursorIndex == -1)) return; _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1); } void Draw_v2::animateCursor(int16 cursor) { + if (!_cursorSprites) + return; + int16 cursorIndex = cursor; int16 newX = 0, newY = 0; uint16 hotspotX, hotspotY; @@ -831,8 +834,8 @@ void Draw_v2::spriteOperation(int16 operation) { getColor(_backColor), _transparency); } } else { - drawString(_textToPrint, _destSpriteX, _destSpriteY, getColor(_frontColor), - getColor(_backColor), _transparency, *_spritesArray[_destSurface], *font); + font->drawString(_textToPrint, _destSpriteX, _destSpriteY, getColor(_frontColor), + getColor(_backColor), _transparency, *_spritesArray[_destSurface]); _destSpriteX += len * font->getCharWidth(); } } else { diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 0d1953322f5a..de0c3f2d5c1f 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -64,7 +64,7 @@ void Environments::clear() { // Deleting unique variables, script and resources for (uint i = 0; i < kEnvironmentCount; i++) { - if (_environments[i].variables == _vm->_inter->_variables) + if (_vm->_inter && (_environments[i].variables == _vm->_inter->_variables)) continue; if (!has(_environments[i].variables, i + 1)) diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 3d8a18ed38b9..fcf98f035569 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -48,6 +48,10 @@ #include "gob/videoplayer.h" #include "gob/save/saveload.h" +#include "gob/pregob/pregob.h" +#include "gob/pregob/onceupon/abracadabra.h" +#include "gob/pregob/onceupon/babayaga.h" + namespace Gob { #define MAX_TIME_DELTA 100 @@ -115,7 +119,7 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst), _rnd("gob") { _vidPlayer = 0; _init = 0; _inter = 0; _map = 0; _palAnim = 0; _scenery = 0; _draw = 0; _util = 0; _video = 0; - _saveLoad = 0; + _saveLoad = 0; _preGob = 0; _pauseStart = 0; @@ -180,6 +184,10 @@ void GobEngine::validateVideoMode(int16 videoMode) { error("Video mode 0x%X is not supported", videoMode); } +EndiannessMethod GobEngine::getEndiannessMethod() const { + return _endiannessMethod; +} + Endianness GobEngine::getEndianness() const { if ((getPlatform() == Common::kPlatformAmiga) || (getPlatform() == Common::kPlatformMacintosh) || @@ -274,15 +282,15 @@ void GobEngine::setTrueColor(bool trueColor) { } Common::Error GobEngine::run() { - if (!initGameParts()) { - GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); - return Common::kUnknownError; - } + Common::Error err; - if (!initGraphics()) { - GUIErrorMessage("GobEngine::init(): Failed to set up graphics"); - return Common::kUnknownError; - } + err = initGameParts(); + if (err.getCode() != Common::kNoError) + return err; + + err = initGraphics(); + if (err.getCode() != Common::kNoError) + return err; // On some systems it's not safe to run CD audio games from the CD. if (isCD()) @@ -368,11 +376,12 @@ void GobEngine::pauseEngineIntern(bool pause) { _game->_startTimeKey += duration; _draw->_cursorTimeKey += duration; - if (_inter->_soundEndTimeKey != 0) + if (_inter && (_inter->_soundEndTimeKey != 0)) _inter->_soundEndTimeKey += duration; } - _vidPlayer->pauseAll(pause); + if (_vidPlayer) + _vidPlayer->pauseAll(pause); _mixer->pauseAll(pause); } @@ -392,12 +401,13 @@ void GobEngine::pauseGame() { pauseEngineIntern(false); } -bool GobEngine::initGameParts() { +Common::Error GobEngine::initGameParts() { _resourceSizeWorkaround = false; // just detect some devices some of which will be always there if the music is not disabled _noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false; - _saveLoad = 0; + + _endiannessMethod = kEndiannessMethodSystem; _global = new Global(this); _util = new Util(this); @@ -429,6 +439,8 @@ bool GobEngine::initGameParts() { _goblin = new Goblin_v1(this); _scenery = new Scenery_v1(this); _saveLoad = new SaveLoad_Geisha(this, _targetName.c_str()); + + _endiannessMethod = kEndiannessMethodAltFile; break; case kGameTypeFascination: @@ -605,20 +617,45 @@ bool GobEngine::initGameParts() { _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; + + case kGameTypeAbracadabra: + _init = new Init_v2(this); + _video = new Video_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); + _preGob = new OnceUpon::Abracadabra(this); + break; + + case kGameTypeBabaYaga: + _init = new Init_v2(this); + _video = new Video_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); + _preGob = new OnceUpon::BabaYaga(this); + break; + default: deinitGameParts(); - return false; + return Common::kUnsupportedGameidError; } // Setup mixer syncSoundSettings(); - _inter->setupOpcodes(); + if (_inter) + _inter->setupOpcodes(); - return true; + return Common::kNoError; } void GobEngine::deinitGameParts() { + delete _preGob; _preGob = 0; delete _saveLoad; _saveLoad = 0; delete _mult; _mult = 0; delete _vidPlayer; _vidPlayer = 0; @@ -637,10 +674,10 @@ void GobEngine::deinitGameParts() { delete _dataIO; _dataIO = 0; } -bool GobEngine::initGraphics() { +Common::Error GobEngine::initGraphics() { if (is800x600()) { warning("GobEngine::initGraphics(): 800x600 games currently unsupported"); - return false; + return Common::kUnsupportedGameidError; } else if (is640x480()) { _width = 640; _height = 480; @@ -664,7 +701,7 @@ bool GobEngine::initGraphics() { _global->_primarySurfDesc = SurfacePtr(new Surface(_width, _height, _pixelFormat.bytesPerPixel)); - return true; + return Common::kNoError; } } // End of namespace Gob diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 52f3ba8f2d5d..df734045963a 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -75,6 +75,7 @@ class Scenery; class Util; class SaveLoad; class GobConsole; +class PreGob; #define WRITE_VAR_UINT32(var, val) _vm->_inter->_variables->writeVar32(var, val) #define WRITE_VAR_UINT16(var, val) _vm->_inter->_variables->writeVar16(var, val) @@ -129,7 +130,10 @@ enum GameType { kGameTypeAdi4, kGameTypeAdibou2, kGameTypeAdibou1, + kGameTypeAbracadabra, + kGameTypeBabaYaga, kGameTypeLittleRed, + kGameTypeOnceUponATime, // Need more inspection to see if Baba Yaga or Abracadabra kGameTypeAJWorld }; @@ -145,6 +149,13 @@ enum Features { kFeaturesTrueColor = 1 << 7 }; +enum EndiannessMethod { + kEndiannessMethodLE, ///< Always little endian. + kEndiannessMethodBE, ///< Always big endian. + kEndiannessMethodSystem, ///< Follows system endianness. + kEndiannessMethodAltFile ///< Different endianness in alternate file. +}; + enum { kDebugFuncOp = 1 << 0, kDebugDrawOp = 1 << 1, @@ -168,6 +179,8 @@ class GobEngine : public Engine { int32 _features; Common::Platform _platform; + EndiannessMethod _endiannessMethod; + uint32 _pauseStart; // Engine APIs @@ -176,10 +189,10 @@ class GobEngine : public Engine { virtual void pauseEngineIntern(bool pause); virtual void syncSoundSettings(); - bool initGameParts(); - void deinitGameParts(); + Common::Error initGameParts(); + Common::Error initGraphics(); - bool initGraphics(); + void deinitGameParts(); public: static const Common::Language _gobToScummVMLang[]; @@ -220,6 +233,7 @@ class GobEngine : public Engine { Inter *_inter; SaveLoad *_saveLoad; VideoPlayer *_vidPlayer; + PreGob *_preGob; const char *getLangDesc(int16 language) const; void validateLanguage(); @@ -227,6 +241,7 @@ class GobEngine : public Engine { void pauseGame(); + EndiannessMethod getEndiannessMethod() const; Endianness getEndianness() const; Common::Platform getPlatform() const; GameType getGameType() const; diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index a61261f35524..814d4d1821ab 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -34,9 +34,13 @@ #include "gob/inter.h" #include "gob/video.h" #include "gob/videoplayer.h" + +#include "gob/sound/sound.h" + #include "gob/demos/scnplayer.h" #include "gob/demos/batplayer.h" -#include "gob/sound/sound.h" + +#include "gob/pregob/pregob.h" namespace Gob { @@ -118,6 +122,14 @@ void Init::initGame() { return; } + if (_vm->_preGob) { + _vm->_preGob->run(); + delete _palDesc; + _vm->_video->initPrimary(-1); + cleanup(); + return; + } + Common::SeekableReadStream *infFile = _vm->_dataIO->getFile("intro.inf"); if (!infFile) { diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index 134203fa9d36..029f7c697be3 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -119,7 +119,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { MouseButtons buttons; SurfacePtr surface; SoundDesc samples[4]; - int16 comp[5] = { 0, 1, 2, 3, -1 }; + static const int16 comp[5] = { 0, 1, 2, 3, -1 }; static const char *const sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"}; surface = _vm->_video->initSurfDesc(320, 200); @@ -167,8 +167,8 @@ void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { MouseButtons buttons; Video::Color *palBak; SoundDesc samples[2]; - int16 comp[3] = { 0, 1, -1 }; byte *palettes[4]; + static const int16 comp[3] = { 0, 1, -1 }; static const char *const sndFiles[] = {"1INTROIV.snd", "2INTROIV.snd"}; static const char *const palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"}; diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp index 8a4d4246b6f9..8d05cefa6618 100644 --- a/engines/gob/inter_geisha.cpp +++ b/engines/gob/inter_geisha.cpp @@ -200,8 +200,12 @@ void Inter_Geisha::oGeisha_checkData(OpFuncParams ¶ms) { if (mode == SaveLoad::kSaveModeNone) { exists = _vm->_dataIO->hasFile(file); - if (!exists) - warning("File \"%s\" not found", file.c_str()); + if (!exists) { + // NOTE: Geisha looks if fin.tot exists to check if it needs to open disk3.stk. + // This is completely normal, so don't print a warning. + if (file != "fin.tot") + warning("File \"%s\" not found", file.c_str()); + } } else if (mode == SaveLoad::kSaveModeSave) exists = _vm->_saveLoad->getSize(file.c_str()) >= 0; diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp index c0e8978afd8c..24905b08d195 100644 --- a/engines/gob/inter_v5.cpp +++ b/engines/gob/inter_v5.cpp @@ -281,7 +281,7 @@ void Inter_v5::o5_getSystemCDSpeed(OpGobParams ¶ms) { Font *font; if ((font = _vm->_draw->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface, *font); + font->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface); _vm->_draw->forceBlit(); delete font; @@ -293,7 +293,7 @@ void Inter_v5::o5_getSystemRAM(OpGobParams ¶ms) { Font *font; if ((font = _vm->_draw->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface, *font); + font->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface); _vm->_draw->forceBlit(); delete font; @@ -305,7 +305,7 @@ void Inter_v5::o5_getSystemCPUSpeed(OpGobParams ¶ms) { Font *font; if ((font = _vm->_draw->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface, *font); + font->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface); _vm->_draw->forceBlit(); delete font; @@ -317,7 +317,7 @@ void Inter_v5::o5_getSystemDrawSpeed(OpGobParams ¶ms) { Font *font; if ((font = _vm->_draw->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface, *font); + font->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface); _vm->_draw->forceBlit(); delete font; @@ -329,7 +329,7 @@ void Inter_v5::o5_totalSystemSpecs(OpGobParams ¶ms) { Font *font; if ((font = _vm->_draw->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface, *font); + font->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface); _vm->_draw->forceBlit(); delete font; diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp index 3be9f1f6517a..c8c4f2bba708 100644 --- a/engines/gob/minigames/geisha/penetration.cpp +++ b/engines/gob/minigames/geisha/penetration.cpp @@ -505,7 +505,7 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) { // Draw, fade in if necessary and wait for the end of the frame _vm->_draw->blitInvalidated(); fadeIn(); - _vm->_util->waitEndFrame(); + _vm->_util->waitEndFrame(false); // Handle the input checkInput(); @@ -778,29 +778,24 @@ void Penetration::drawFloorText() { else if (_floor == 2) floorString = strings[kString1stBasement]; + Surface &surface = *_vm->_draw->_backSurface; + if (floorString) - _vm->_draw->drawString(floorString, 10, 15, kColorFloorText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); + font->drawString(floorString, 10, 15, kColorFloorText, kColorBlack, 1, surface); if (_exits.size() > 0) { int exitCount = kString2Exits; if (_exits.size() == 1) exitCount = kString1Exit; - _vm->_draw->drawString(strings[kStringYouHave] , 10, 38, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[exitCount] , 10, 53, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringToReach] , 10, 68, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringUpperLevel1], 10, 84, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringUpperLevel2], 10, 98, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); + font->drawString(strings[kStringYouHave] , 10, 38, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[exitCount] , 10, 53, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[kStringToReach] , 10, 68, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[kStringUpperLevel1], 10, 84, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[kStringUpperLevel2], 10, 98, kColorExitText, kColorBlack, 1, surface); } else - _vm->_draw->drawString(strings[kStringNoExit], 10, 53, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); + font->drawString(strings[kStringNoExit], 10, 53, kColorExitText, kColorBlack, 1, surface); } void Penetration::drawEndText() { @@ -814,21 +809,17 @@ void Penetration::drawEndText() { if (!font) return; + Surface &surface = *_vm->_draw->_backSurface; + const char **strings = kStrings[getLanguage()]; - _vm->_draw->drawString(strings[kStringLevel0] , 11, 21, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringPenetration], 11, 42, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringSuccessful] , 11, 58, kColorExitText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - - _vm->_draw->drawString(strings[kStringDanger] , 11, 82, kColorFloorText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringGynoides] , 11, 98, kColorFloorText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); - _vm->_draw->drawString(strings[kStringActivated], 11, 113, kColorFloorText, kColorBlack, 1, - *_vm->_draw->_backSurface, *font); + font->drawString(strings[kStringLevel0] , 11, 21, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[kStringPenetration], 11, 42, kColorExitText, kColorBlack, 1, surface); + font->drawString(strings[kStringSuccessful] , 11, 58, kColorExitText, kColorBlack, 1, surface); + + font->drawString(strings[kStringDanger] , 11, 82, kColorFloorText, kColorBlack, 1, surface); + font->drawString(strings[kStringGynoides] , 11, 98, kColorFloorText, kColorBlack, 1, surface); + font->drawString(strings[kStringActivated], 11, 113, kColorFloorText, kColorBlack, 1, surface); _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, kTextAreaLeft, kTextAreaTop, kTextAreaRight, kTextAreaBigBottom); _vm->_draw->blitInvalidated(); diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 3395046b6c78..d5ee6478bee3 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -3,6 +3,7 @@ MODULE := engines/gob MODULE_OBJS := \ anifile.o \ aniobject.o \ + backbuffer.o \ cheater.o \ cheater_geisha.o \ cmpfile.o \ @@ -77,6 +78,17 @@ MODULE_OBJS := \ demos/scnplayer.o \ demos/batplayer.o \ detection/detection.o \ + pregob/pregob.o \ + pregob/txtfile.o \ + pregob/gctfile.o \ + pregob/seqfile.o \ + pregob/onceupon/onceupon.o \ + pregob/onceupon/abracadabra.o \ + pregob/onceupon/babayaga.o \ + pregob/onceupon/title.o \ + pregob/onceupon/parents.o \ + pregob/onceupon/stork.o \ + pregob/onceupon/chargenchild.o \ minigames/geisha/evilfish.o \ minigames/geisha/oko.o \ minigames/geisha/meter.o \ diff --git a/engines/gob/pregob/gctfile.cpp b/engines/gob/pregob/gctfile.cpp new file mode 100644 index 000000000000..08c32cda769d --- /dev/null +++ b/engines/gob/pregob/gctfile.cpp @@ -0,0 +1,306 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/random.h" +#include "common/stream.h" + +#include "gob/surface.h" +#include "gob/video.h" + +#include "gob/pregob/gctfile.h" + +namespace Gob { + +GCTFile::Chunk::Chunk() : type(kChunkTypeNone) { +} + + +GCTFile::GCTFile(Common::SeekableReadStream &gct, Common::RandomSource &rnd) : _rnd(&rnd), + _areaLeft(0), _areaTop(0), _areaRight(0), _areaBottom(0), _currentItem(0xFFFF) { + + load(gct); +} + +GCTFile::~GCTFile() { +} + +void GCTFile::load(Common::SeekableReadStream &gct) { + gct.skip(4); // Required buffer size + gct.skip(2); // Unknown + + // Read the selector and line counts for each item + const uint16 itemCount = gct.readUint16LE(); + _items.resize(itemCount); + + for (Items::iterator i = _items.begin(); i != _items.end(); ++i) { + const uint16 selector = gct.readUint16LE(); + const uint16 lineCount = gct.readUint16LE(); + + i->selector = selector; + i->lines.resize(lineCount); + } + + // Read all item lines + for (Items::iterator i = _items.begin(); i != _items.end(); ++i) { + for (Lines::iterator l = i->lines.begin(); l != i->lines.end(); ++l) { + const uint16 lineSize = gct.readUint16LE(); + + readLine(gct, *l, lineSize); + } + } + + if (gct.err()) + error("GCTFile::load(): Failed reading GCT"); +} + +void GCTFile::readLine(Common::SeekableReadStream &gct, Line &line, uint16 lineSize) const { + line.chunks.push_back(Chunk()); + + while (lineSize > 0) { + byte c = gct.readByte(); + lineSize--; + + if (c == 0) { + // Command byte + + if (lineSize == 0) + break; + + byte cmd = gct.readByte(); + lineSize--; + + // Line end command + if (cmd == 0) + break; + + // Item reference command + if (cmd == 1) { + if (lineSize < 2) { + warning("GCTFile::readLine(): Item reference command is missing parameters"); + break; + } + + const uint32 itemRef = gct.readUint16LE(); + lineSize -= 2; + + line.chunks.push_back(Chunk()); + line.chunks.back().type = kChunkTypeItem; + line.chunks.back().item = itemRef; + + line.chunks.push_back(Chunk()); + continue; + } + + warning("GCTFile::readLine(): Invalid command 0x%02X", cmd); + break; + } + + // Text + line.chunks.back().type = kChunkTypeString; + line.chunks.back().text += (char)c; + } + + // Skip bytes we didn't read (because of errors) + gct.skip(lineSize); + + // Remove empty chunks from the end of the list + while (!line.chunks.empty() && (line.chunks.back().type == kChunkTypeNone)) + line.chunks.pop_back(); +} + +uint16 GCTFile::getLineCount(uint item) const { + if (item >= _items.size()) + return 0; + + return _items[item].lines.size(); +} + +void GCTFile::selectLine(uint item, uint16 line) { + if ((item >= _items.size()) && (item != kSelectorAll) && (item != kSelectorRandom)) + return; + + _items[item].selector = line; +} + +void GCTFile::setText(uint item, uint16 line, const Common::String &text) { + if ((item >= _items.size()) || (line >= _items[item].lines.size())) + return; + + _items[item].lines[line].chunks.clear(); + _items[item].lines[line].chunks.push_back(Chunk()); + + _items[item].lines[line].chunks.back().type = kChunkTypeString; + _items[item].lines[line].chunks.back().text = text; +} + +void GCTFile::setText(uint item, const Common::String &text) { + if (item >= _items.size()) + return; + + _items[item].selector = 0; + + _items[item].lines.resize(1); + + setText(item, 0, text); +} + +void GCTFile::reset() { + _currentItem = 0xFFFF; + _currentText.clear(); +} + +Common::String GCTFile::getLineText(const Line &line) const { + Common::String text; + + // Go over all chunks in this line + for (Chunks::const_iterator c = line.chunks.begin(); c != line.chunks.end(); ++c) { + // A chunk is either a direct string, or a reference to another item + + if (c->type == kChunkTypeItem) { + Common::List lines; + + getItemText(c->item, lines); + if (lines.empty()) + continue; + + if (lines.size() > 1) + warning("GCTFile::getLineText(): Referenced item has multiple lines"); + + text += lines.front(); + } else if (c->type == kChunkTypeString) + text += c->text; + } + + return text; +} + +void GCTFile::getItemText(uint item, Common::List &text) const { + text.clear(); + + if ((item >= _items.size()) || _items[item].lines.empty()) + return; + + uint16 line = _items[item].selector; + + // Draw all lines + if (line == kSelectorAll) { + for (Lines::const_iterator l = _items[item].lines.begin(); l != _items[item].lines.end(); ++l) + text.push_back(getLineText(*l)); + + return; + } + + // Draw random line + if (line == kSelectorRandom) + line = _rnd->getRandomNumber(_items[item].lines.size() - 1); + + if (line >= _items[item].lines.size()) + return; + + text.push_back(getLineText(_items[item].lines[line])); +} + +void GCTFile::setArea(int16 left, int16 top, int16 right, int16 bottom) { + trashBuffer(); + + _hasArea = false; + + const int16 width = right - left + 1; + const int16 height = bottom - top + 1; + if ((width <= 0) || (height <= 0)) + return; + + _areaLeft = left; + _areaTop = top; + _areaRight = right; + _areaBottom = bottom; + + _hasArea = true; + + resizeBuffer(width, height); +} + +bool GCTFile::clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { + return restoreScreen(dest, left, top, right, bottom); +} + +bool GCTFile::fill(Surface &dest, uint8 color, int16 &left, int16 &top, int16 &right, int16 &bottom) { + left = _areaLeft; + top = _areaTop; + right = _areaRight; + bottom = _areaBottom; + + if (!hasSavedBackground()) + saveScreen(dest, left, top, right, bottom); + + dest.fillRect(left, top, right, bottom, color); + + return true; +} + +bool GCTFile::finished() const { + return (_currentItem != 0xFFFF) && _currentText.empty(); +} + +bool GCTFile::draw(Surface &dest, uint16 item, const Font &font, uint8 color, + int16 &left, int16 &top, int16 &right, int16 &bottom) { + + if ((item >= _items.size()) || !_hasArea) + return false; + + left = _areaLeft; + top = _areaTop; + right = _areaRight; + bottom = _areaBottom; + + const int16 width = right - left + 1; + const int16 height = bottom - top + 1; + + const uint lineCount = height / font.getCharHeight(); + if (lineCount == 0) + return false; + + if (!hasSavedBackground()) + saveScreen(dest, left, top, right, bottom); + + if (item != _currentItem) { + _currentItem = item; + + getItemText(_currentItem, _currentText); + } + + if (_currentText.empty()) + return false; + + int16 y = top; + for (uint i = 0; (i < lineCount) && !_currentText.empty(); i++, y += font.getCharHeight()) { + const Common::String &line = _currentText.front(); + const int16 x = left + ((width - (line.size() * font.getCharWidth())) / 2); + + font.drawString(line, x, y, color, 0, true, dest); + _currentText.pop_front(); + } + + return true; +} + +} // End of namespace Gob diff --git a/engines/gob/pregob/gctfile.h b/engines/gob/pregob/gctfile.h new file mode 100644 index 000000000000..ed6351b7a818 --- /dev/null +++ b/engines/gob/pregob/gctfile.h @@ -0,0 +1,149 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_GCTFILE_H +#define GOB_PREGOB_GCTFILE_H + +#include "common/str.h" +#include "common/array.h" +#include "common/list.h" + +#include "gob/backbuffer.h" + +namespace Common { + class RandomSource; + class SeekableReadStream; +} + +namespace Gob { + +class Surface; +class Font; + +class GCTFile : public BackBuffer { +public: + static const uint16 kSelectorAll = 0xFFFE; ///< Print all lines. + static const uint16 kSelectorRandom = 0xFFFF; ///< Print a random line. + + + GCTFile(Common::SeekableReadStream &gct, Common::RandomSource &rnd); + ~GCTFile(); + + /** Return the number of lines in an item. */ + uint16 getLineCount(uint item) const; + + /** Set the area the text will be printed in. */ + void setArea(int16 left, int16 top, int16 right, int16 bottom); + + /** Set which line of this item should be printed. */ + void selectLine(uint item, uint16 line); + + /** Change the text of an items' line. */ + void setText(uint item, uint16 line, const Common::String &text); + /** Change the item into one one line and set that line's text. */ + void setText(uint item, const Common::String &text); + + /** Reset the item drawing state. */ + void reset(); + + /** Clear the drawn text, restoring the original content. */ + bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); + + /** Fill the text area with a color. */ + bool fill(Surface &dest, uint8 color, int16 &left, int16 &top, int16 &right, int16 &bottom); + + /** Draw an item onto the surface, until all text has been drawn or the area is filled. */ + bool draw(Surface &dest, uint16 item, const Font &font, uint8 color, + int16 &left, int16 &top, int16 &right, int16 &bottom); + + /** Did we draw all text? */ + bool finished() const; + +private: + /** The type of a chunk. */ + enum ChunkType { + kChunkTypeNone = 0, ///< Do nothing. + kChunkTypeString , ///< A direct string. + kChunkTypeItem ///< A reference to an item to print instead. + }; + + /** A chunk in an item text line. */ + struct Chunk { + ChunkType type; ///< The type of the chunk. + + Common::String text; ///< Text to print. + + int item; ///< Item to print instead. + + Chunk(); + }; + + typedef Common::List Chunks; + + /** A line in an item. */ + struct Line { + Chunks chunks; ///< The chunks that make up the line. + }; + + typedef Common::Array Lines; + + /** A GCT item. */ + struct Item { + Lines lines; ///< The text lines in the item + uint16 selector; ///< Which line to print. + }; + + typedef Common::Array Items; + + + Common::RandomSource *_rnd; + + Items _items; ///< All GCT items. + + // The area on which to print + bool _hasArea; + int16 _areaLeft; + int16 _areaTop; + int16 _areaRight; + int16 _areaBottom; + + /** Index of the current item we're drawing. */ + uint16 _currentItem; + /** Text left to draw. */ + Common::List _currentText; + + + // -- Loading helpers -- + + void load(Common::SeekableReadStream &gct); + void readLine(Common::SeekableReadStream &gct, Line &line, uint16 lineSize) const; + + + // -- Draw helpers -- + + Common::String getLineText(const Line &line) const; + void getItemText(uint item, Common::List &text) const; +}; + +} // End of namespace Gob + +#endif // GOB_PREGOB_GCTFILE_H diff --git a/engines/gob/pregob/onceupon/abracadabra.cpp b/engines/gob/pregob/onceupon/abracadabra.cpp new file mode 100644 index 000000000000..2cf6855ef848 --- /dev/null +++ b/engines/gob/pregob/onceupon/abracadabra.cpp @@ -0,0 +1,137 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/textconsole.h" + +#include "gob/gob.h" + +#include "gob/pregob/onceupon/abracadabra.h" + +static const uint8 kCopyProtectionColors[7] = { + 14, 11, 13, 1, 7, 12, 2 +}; + +static const uint8 kCopyProtectionShapes[7 * 20] = { + 3, 4, 3, 0, 1, 2, 0, 2, 2, 0, 2, 4, 0, 3, 4, 1, 1, 4, 1, 3, + 0, 2, 0, 4, 2, 4, 4, 2, 3, 0, 1, 1, 1, 1, 3, 0, 4, 2, 3, 4, + 0, 0, 1, 2, 1, 1, 2, 4, 3, 1, 4, 2, 4, 4, 2, 4, 1, 2, 3, 3, + 1, 0, 2, 3, 4, 2, 3, 2, 2, 0, 0, 0, 4, 2, 3, 4, 4, 0, 4, 1, + 4, 2, 1, 1, 1, 1, 4, 3, 4, 2, 3, 0, 0, 3, 0, 2, 3, 0, 2, 4, + 4, 2, 4, 3, 0, 4, 0, 2, 3, 1, 4, 1, 3, 1, 0, 0, 2, 1, 3, 2, + 3, 1, 0, 3, 1, 3, 4, 2, 4, 4, 3, 2, 0, 2, 0, 1, 2, 0, 1, 4 +}; + +static const uint8 kCopyProtectionObfuscate[4] = { + 1, 0, 2, 3 +}; + +namespace Gob { + +namespace OnceUpon { + +const OnceUpon::MenuButton Abracadabra::kAnimalsButtons = { + true, 131, 127, 183, 164, 193, 0, 243, 35, 132, 128, 0 +}; + +const OnceUpon::MenuButton Abracadabra::kAnimalButtons[] = { + {false, 37, 89, 95, 127, 37, 89, 95, 127, 131, 25, 0}, + {false, 114, 65, 172, 111, 114, 65, 172, 111, 131, 25, 1}, + {false, 186, 72, 227, 96, 186, 72, 227, 96, 139, 25, 2}, + {false, 249, 87, 282, 112, 249, 87, 282, 112, 143, 25, 3}, + {false, 180, 102, 234, 138, 180, 102, 234, 138, 133, 25, 4}, + {false, 197, 145, 242, 173, 197, 145, 242, 173, 137, 25, 5}, + {false, 113, 151, 171, 176, 113, 151, 171, 176, 131, 25, 6}, + {false, 114, 122, 151, 150, 114, 122, 151, 150, 141, 25, 7}, + {false, 36, 136, 94, 176, 36, 136, 94, 176, 131, 25, 8}, + {false, 243, 123, 295, 155, 243, 123, 295, 155, 136, 25, 9} +}; + +const char *Abracadabra::kAnimalNames[] = { + "loup", + "drag", + "arai", + "crap", + "crab", + "mous", + "saut", + "guep", + "rhin", + "scor" +}; + +// The houses where the stork can drop a bundle +const OnceUpon::MenuButton Abracadabra::kStorkHouses[] = { + {false, 16, 80, 87, 125, 0, 0, 0, 0, 0, 0, 0}, // Castle , Lord & Lady + {false, 61, 123, 96, 149, 0, 0, 0, 0, 0, 0, 1}, // Cottage, Farmers + {false, 199, 118, 226, 137, 0, 0, 0, 0, 0, 0, 2}, // Hut , Woodcutters + {false, 229, 91, 304, 188, 0, 0, 0, 0, 0, 0, 3} // Palace , King & Queen +}; + +// The stork bundle drop parameters +const Stork::BundleDrop Abracadabra::kStorkBundleDrops[] = { + { 14, 65, 127, true }, + { 14, 76, 152, true }, + { 14, 204, 137, true }, + { 11, 275, 179, false } +}; + +// Parameters for the stork section. +const OnceUpon::StorkParam Abracadabra::kStorkParam = { + "present.cmp", ARRAYSIZE(kStorkHouses), kStorkHouses, kStorkBundleDrops +}; + + +Abracadabra::Abracadabra(GobEngine *vm) : OnceUpon(vm) { +} + +Abracadabra::~Abracadabra() { +} + +void Abracadabra::run() { + init(); + + // Copy protection + bool correctCP = doCopyProtection(kCopyProtectionColors, kCopyProtectionShapes, kCopyProtectionObfuscate); + if (_vm->shouldQuit() || !correctCP) + return; + + // Show the intro + showIntro(); + if (_vm->shouldQuit()) + return; + + // Handle the start menu + doStartMenu(&kAnimalsButtons, ARRAYSIZE(kAnimalButtons), kAnimalButtons, kAnimalNames); + if (_vm->shouldQuit()) + return; + + // Play the actual game + playGame(); +} + +const OnceUpon::StorkParam &Abracadabra::getStorkParameters() const { + return kStorkParam; +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/abracadabra.h b/engines/gob/pregob/onceupon/abracadabra.h new file mode 100644 index 000000000000..8048213f5f56 --- /dev/null +++ b/engines/gob/pregob/onceupon/abracadabra.h @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_ABRACADABRA_H +#define GOB_PREGOB_ONCEUPON_ABRACADABRA_H + +#include "gob/pregob/onceupon/onceupon.h" + +namespace Gob { + +namespace OnceUpon { + +class Abracadabra : public OnceUpon { +public: + Abracadabra(GobEngine *vm); + ~Abracadabra(); + + void run(); + +protected: + const StorkParam &getStorkParameters() const; + +private: + /** Definition of the menu button that leads to the animal names screen. */ + static const MenuButton kAnimalsButtons; + + /** Definition of the buttons that make up the animals in the animal names screen. */ + static const MenuButton kAnimalButtons[]; + /** File prefixes for the name of each animal. */ + static const char *kAnimalNames[]; + + // Parameters for the stork section. + static const MenuButton kStorkHouses[]; + static const Stork::BundleDrop kStorkBundleDrops[]; + static const struct StorkParam kStorkParam; +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_ABRACADABRA_H diff --git a/engines/gob/pregob/onceupon/babayaga.cpp b/engines/gob/pregob/onceupon/babayaga.cpp new file mode 100644 index 000000000000..ef56b9dd0bbb --- /dev/null +++ b/engines/gob/pregob/onceupon/babayaga.cpp @@ -0,0 +1,137 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/textconsole.h" + +#include "gob/gob.h" + +#include "gob/pregob/onceupon/babayaga.h" + +static const uint8 kCopyProtectionColors[7] = { + 14, 11, 13, 1, 7, 12, 2 +}; + +static const uint8 kCopyProtectionShapes[7 * 20] = { + 0, 0, 1, 2, 1, 1, 2, 4, 3, 1, 4, 2, 4, 4, 2, 4, 1, 2, 3, 3, + 3, 1, 0, 3, 1, 3, 4, 2, 4, 4, 3, 2, 0, 2, 0, 1, 2, 0, 1, 4, + 1, 0, 2, 3, 4, 2, 3, 2, 2, 0, 0, 0, 4, 2, 3, 4, 4, 0, 4, 1, + 0, 2, 0, 4, 2, 4, 4, 2, 3, 0, 1, 1, 1, 1, 3, 0, 4, 2, 3, 4, + 3, 4, 3, 0, 1, 2, 0, 2, 2, 0, 2, 4, 0, 3, 4, 1, 1, 4, 1, 3, + 4, 2, 1, 1, 1, 1, 4, 3, 4, 2, 3, 0, 0, 3, 0, 2, 3, 0, 2, 4, + 4, 2, 4, 3, 0, 4, 0, 2, 3, 1, 4, 1, 3, 1, 0, 0, 2, 1, 3, 2 +}; + +static const uint8 kCopyProtectionObfuscate[4] = { + 0, 1, 2, 3 +}; + +namespace Gob { + +namespace OnceUpon { + +const OnceUpon::MenuButton BabaYaga::kAnimalsButtons = { + true, 131, 127, 183, 164, 193, 0, 245, 37, 131, 127, 0 +}; + +const OnceUpon::MenuButton BabaYaga::kAnimalButtons[] = { + {false, 34, 84, 92, 127, 34, 84, 92, 127, 131, 25, 0}, + {false, 114, 65, 172, 111, 114, 65, 172, 111, 131, 25, 1}, + {false, 186, 72, 227, 96, 186, 72, 227, 96, 139, 25, 2}, + {false, 249, 87, 282, 112, 249, 87, 282, 112, 143, 25, 3}, + {false, 180, 97, 234, 138, 180, 97, 234, 138, 133, 25, 4}, + {false, 197, 145, 242, 173, 197, 145, 242, 173, 137, 25, 5}, + {false, 113, 156, 171, 176, 113, 156, 171, 176, 131, 25, 6}, + {false, 114, 127, 151, 150, 114, 127, 151, 150, 141, 25, 7}, + {false, 36, 136, 94, 176, 36, 136, 94, 176, 131, 25, 8}, + {false, 245, 123, 293, 155, 245, 123, 293, 155, 136, 25, 9} +}; + +const char *BabaYaga::kAnimalNames[] = { + "vaut", + "drag", + "arai", + "gren", + "fauc", + "abei", + "serp", + "tort", + "sang", + "rena" +}; + +// The houses where the stork can drop a bundle +const OnceUpon::MenuButton BabaYaga::kStorkHouses[] = { + {false, 16, 80, 87, 125, 0, 0, 0, 0, 0, 0, 0}, // Castle , Lord & Lady + {false, 61, 123, 96, 149, 0, 0, 0, 0, 0, 0, 1}, // Cottage, Farmers + {false, 199, 118, 226, 137, 0, 0, 0, 0, 0, 0, 2}, // Hut , Woodcutters + {false, 229, 91, 304, 188, 0, 0, 0, 0, 0, 0, 3} // Palace , King & Queen +}; + +// The stork bundle drop parameters +const Stork::BundleDrop BabaYaga::kStorkBundleDrops[] = { + { 14, 35, 129, true }, + { 14, 70, 148, true }, + { 14, 206, 136, true }, + { 11, 260, 225, false } +}; + +// Parameters for the stork section. +const OnceUpon::StorkParam BabaYaga::kStorkParam = { + "present2.cmp", ARRAYSIZE(kStorkHouses), kStorkHouses, kStorkBundleDrops +}; + + +BabaYaga::BabaYaga(GobEngine *vm) : OnceUpon(vm) { +} + +BabaYaga::~BabaYaga() { +} + +void BabaYaga::run() { + init(); + + // Copy protection + bool correctCP = doCopyProtection(kCopyProtectionColors, kCopyProtectionShapes, kCopyProtectionObfuscate); + if (_vm->shouldQuit() || !correctCP) + return; + + // Show the intro + showIntro(); + if (_vm->shouldQuit()) + return; + + // Handle the start menu + doStartMenu(&kAnimalsButtons, ARRAYSIZE(kAnimalButtons), kAnimalButtons, kAnimalNames); + if (_vm->shouldQuit()) + return; + + // Play the actual game + playGame(); +} + +const OnceUpon::StorkParam &BabaYaga::getStorkParameters() const { + return kStorkParam; +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/babayaga.h b/engines/gob/pregob/onceupon/babayaga.h new file mode 100644 index 000000000000..0241f78f4e39 --- /dev/null +++ b/engines/gob/pregob/onceupon/babayaga.h @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_BABAYAGA_H +#define GOB_PREGOB_ONCEUPON_BABAYAGA_H + +#include "gob/pregob/onceupon/onceupon.h" + +namespace Gob { + +namespace OnceUpon { + +class BabaYaga : public OnceUpon { +public: + BabaYaga(GobEngine *vm); + ~BabaYaga(); + + void run(); + +protected: + const StorkParam &getStorkParameters() const; + +private: + /** Definition of the menu button that leads to the animal names screen. */ + static const MenuButton kAnimalsButtons; + + /** Definition of the buttons that make up the animals in the animal names screen. */ + static const MenuButton kAnimalButtons[]; + /** File prefixes for the name of each animal. */ + static const char *kAnimalNames[]; + + // Parameters for the stork section. + static const MenuButton kStorkHouses[]; + static const Stork::BundleDrop kStorkBundleDrops[]; + static const struct StorkParam kStorkParam; +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_BABAYAGA_H diff --git a/engines/gob/pregob/onceupon/brokenstrings.h b/engines/gob/pregob/onceupon/brokenstrings.h new file mode 100644 index 000000000000..89acb1c6bde6 --- /dev/null +++ b/engines/gob/pregob/onceupon/brokenstrings.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H +#define GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H + +struct BrokenString { + const char *wrong; + const char *correct; +}; + +struct BrokenStringLanguage { + const BrokenString *strings; + uint count; +}; + +static const BrokenString kBrokenStringsGerman[] = { + { "Zeichungen von Kaki," , "Zeichnungen von Kaki," }, + { "die es in seine Wachtr\204ume", "die es in seine Tagtr\204ume" }, + { " Spielerfahrung" , " Spielerfahren" }, + { " Fortgeschrittene" , " Fortgeschritten" }, + { "die Vespe" , "die Wespe" }, + { "das Rhinoceros" , "das Rhinozeros" }, + { "die Heusschrecke" , "die Heuschrecke" }, + { "Das, von Drachen gebrachte" , "Das vom Drachen gebrachte" }, + { "Am Waldesrand es sieht" , "Am Waldesrand sieht es" }, + { " das Kind den Palast." , "das Kind den Palast." }, + { "Am Waldessaum sieht" , "Am Waldesrand sieht" }, + { "tipp auf ESC!" , "dr\201cke ESC!" }, + { "Wohin fliegt der Drachen?" , "Wohin fliegt der Drache?" } +}; + +static const BrokenStringLanguage kBrokenStrings[kLanguageCount] = { + { 0, 0 }, // French + { kBrokenStringsGerman, ARRAYSIZE(kBrokenStringsGerman) }, // German + { 0, 0 }, // English + { 0, 0 }, // Spanish + { 0, 0 }, // Italian +}; + +#endif // GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H diff --git a/engines/gob/pregob/onceupon/chargenchild.cpp b/engines/gob/pregob/onceupon/chargenchild.cpp new file mode 100644 index 000000000000..ba099e4937ae --- /dev/null +++ b/engines/gob/pregob/onceupon/chargenchild.cpp @@ -0,0 +1,117 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gob/surface.h" +#include "gob/anifile.h" + +#include "gob/pregob/onceupon/chargenchild.h" + +enum Animation { + kAnimWalkLeft = 0, + kAnimWalkRight = 1, + kAnimJumpLeft = 2, + kAnimJumpRight = 3, + kAnimTapFoot = 14 +}; + +namespace Gob { + +namespace OnceUpon { + +CharGenChild::CharGenChild(const ANIFile &ani) : ANIObject(ani) { + setPosition(265, 110); + setAnimation(kAnimWalkLeft); + setVisible(true); + setPause(false); +} + +CharGenChild::~CharGenChild() { +} + +void CharGenChild::advance() { + bool wasLastFrame = lastFrame(); + + ANIObject::advance(); + + int16 x, y, left, top, width, height; + getPosition(x, y); + getFramePosition(left, top); + getFrameSize(width, height); + + const int16 right = left + width - 1; + + switch (getAnimation()) { + case kAnimWalkLeft: + if (left <= 147) + setAnimation(kAnimWalkRight); + break; + + case kAnimWalkRight: + if (right >= 290) { + setAnimation(kAnimJumpLeft); + + setPosition(x, y - 14); + } + break; + + case kAnimJumpLeft: + if (wasLastFrame) { + setAnimation(kAnimTapFoot); + + setPosition(x, y - 10); + } + break; + + case kAnimTapFoot: + if (wasLastFrame) { + setAnimation(kAnimJumpRight); + + setPosition(x, y + 10); + } + break; + + case kAnimJumpRight: + if (wasLastFrame) { + setAnimation(kAnimWalkLeft); + + setPosition(x, y + 14); + } + break; + } +} + +CharGenChild::Sound CharGenChild::shouldPlaySound() const { + const uint16 anim = getAnimation(); + const uint16 frame = getFrame(); + + if (((anim == kAnimWalkLeft) || (anim == kAnimWalkRight)) && ((frame == 1) || (frame == 6))) + return kSoundWalk; + + if (((anim == kAnimJumpLeft) || (anim == kAnimJumpRight)) && (frame == 0)) + return kSoundJump; + + return kSoundNone; +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/chargenchild.h b/engines/gob/pregob/onceupon/chargenchild.h new file mode 100644 index 000000000000..3b09ef112a40 --- /dev/null +++ b/engines/gob/pregob/onceupon/chargenchild.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_CHARGENCHILD_H +#define GOB_PREGOB_ONCEUPON_CHARGENCHILD_H + +#include "common/system.h" + +#include "gob/aniobject.h" + +namespace Gob { + +class Surface; +class ANIFile; + +namespace OnceUpon { + +/** The child running around on the character generator screen. */ +class CharGenChild : public ANIObject { +public: + enum Sound { + kSoundNone = 0, + kSoundWalk , + kSoundJump + }; + + CharGenChild(const ANIFile &ani); + ~CharGenChild(); + + /** Advance the animation to the next frame. */ + void advance(); + + /** Should we play a sound right now? */ + Sound shouldPlaySound() const; +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_CHARGENCHILD_H diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp new file mode 100644 index 000000000000..e4c2df34c0d0 --- /dev/null +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -0,0 +1,1904 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gob/gob.h" +#include "gob/global.h" +#include "gob/util.h" +#include "gob/dataio.h" +#include "gob/surface.h" +#include "gob/draw.h" +#include "gob/video.h" +#include "gob/anifile.h" +#include "gob/aniobject.h" + +#include "gob/sound/sound.h" + +#include "gob/pregob/txtfile.h" +#include "gob/pregob/gctfile.h" + +#include "gob/pregob/onceupon/onceupon.h" +#include "gob/pregob/onceupon/palettes.h" +#include "gob/pregob/onceupon/title.h" +#include "gob/pregob/onceupon/parents.h" +#include "gob/pregob/onceupon/chargenchild.h" + +static const uint kLanguageCount = 5; + +static const uint kCopyProtectionHelpStringCount = 3; + +static const char *kCopyProtectionHelpStrings[Gob::OnceUpon::OnceUpon::kLanguageCount][kCopyProtectionHelpStringCount] = { + { // French + "Consulte le livret des animaux, rep\212re la", + "page correspondant \205 la couleur de l\'\202cran", + "et clique le symbole associ\202 \205 l\'animal affich\202.", + }, + { // German + "Suche im Tieralbum die Seite, die der Farbe auf", + "dem Bildschirm entspricht und klicke auf das", + "Tiersymbol.", + }, + { // English + "Consult the book of animals, find the page", + "corresponding to the colour of screen and click", + "the symbol associated with the animal displayed.", + }, + { // Spanish + "Consulta el libro de los animales, localiza la ", + "p\240gina que corresponde al color de la pantalla.", + "Cliquea el s\241mbolo asociado al animal que aparece.", + }, + { // Italian + "Guarda il libretto degli animali, trova la", + "pagina che corrisponde al colore dello schermo,", + "clicca il simbolo associato all\'animale presentato", + } +}; + +static const char *kCopyProtectionWrongStrings[Gob::OnceUpon::OnceUpon::kLanguageCount] = { + "Tu t\'es tromp\202, dommage...", // French + "Schade, du hast dich geirrt." , // German + "You are wrong, what a pity!" , // English + "Te equivocas, l\240stima..." , // Spanish + "Sei Sbagliato, peccato..." // Italian +}; + +static const uint kCopyProtectionShapeCount = 5; + +static const int16 kCopyProtectionShapeCoords[kCopyProtectionShapeCount][6] = { + { 0, 51, 26, 75, 60, 154}, + { 28, 51, 58, 81, 96, 151}, + { 60, 51, 94, 79, 136, 152}, + { 96, 51, 136, 71, 180, 155}, + {140, 51, 170, 77, 228, 153} +}; + +enum ClownAnimation { + kClownAnimationClownCheer = 0, + kClownAnimationClownStand = 1, + kClownAnimationClownCry = 6 +}; + +// 12 seconds delay for one area full of GCT text +static const uint32 kGCTDelay = 12000; + +namespace Gob { + +namespace OnceUpon { + +const OnceUpon::MenuButton OnceUpon::kMainMenuDifficultyButton[] = { + {false, 29, 18, 77, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyBeginner}, + {false, 133, 18, 181, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyIntermediate}, + {false, 241, 18, 289, 57, 0, 0, 0, 0, 0, 0, (int)kDifficultyAdvanced}, +}; + +const OnceUpon::MenuButton OnceUpon::kSectionButtons[] = { + {false, 27, 121, 91, 179, 0, 0, 0, 0, 0, 0, 0}, + { true, 95, 121, 159, 179, 4, 1, 56, 49, 100, 126, 2}, + { true, 163, 121, 227, 179, 64, 1, 120, 49, 168, 126, 6}, + { true, 231, 121, 295, 179, 128, 1, 184, 49, 236, 126, 10} +}; + +const OnceUpon::MenuButton OnceUpon::kIngameButtons[] = { + {true, 108, 83, 139, 116, 0, 0, 31, 34, 108, 83, 0}, + {true, 144, 83, 175, 116, 36, 0, 67, 34, 144, 83, 1}, + {true, 180, 83, 211, 116, 72, 0, 103, 34, 180, 83, 2} +}; + +const OnceUpon::MenuButton OnceUpon::kAnimalNamesBack = { + true, 19, 13, 50, 46, 36, 0, 67, 34, 19, 13, 1 +}; + +const OnceUpon::MenuButton OnceUpon::kLanguageButtons[] = { + {true, 43, 80, 93, 115, 0, 55, 50, 90, 43, 80, 0}, + {true, 132, 80, 182, 115, 53, 55, 103, 90, 132, 80, 1}, + {true, 234, 80, 284, 115, 106, 55, 156, 90, 234, 80, 2}, + {true, 43, 138, 93, 173, 159, 55, 209, 90, 43, 138, 3}, + {true, 132, 138, 182, 173, 212, 55, 262, 90, 132, 138, 4}, + {true, 234, 138, 284, 173, 265, 55, 315, 90, 234, 138, 2} +}; + +const char *OnceUpon::kSound[kSoundCount] = { + "diamant.snd", // kSoundClick + "cigogne.snd", // kSoundStork + "saute.snd" // kSoundJump +}; + +const OnceUpon::SectionFunc OnceUpon::kSectionFuncs[kSectionCount] = { + &OnceUpon::sectionStork, + &OnceUpon::sectionChapter1, + &OnceUpon::sectionParents, + &OnceUpon::sectionChapter2, + &OnceUpon::sectionForest0, + &OnceUpon::sectionChapter3, + &OnceUpon::sectionEvilCastle, + &OnceUpon::sectionChapter4, + &OnceUpon::sectionForest1, + &OnceUpon::sectionChapter5, + &OnceUpon::sectionBossFight, + &OnceUpon::sectionChapter6, + &OnceUpon::sectionForest2, + &OnceUpon::sectionChapter7, + &OnceUpon::sectionEnd +}; + + +OnceUpon::ScreenBackup::ScreenBackup() : palette(-1), changedCursor(false), cursorVisible(false) { + screen = new Surface(320, 200, 1); +} + +OnceUpon::ScreenBackup::~ScreenBackup() { + delete screen; +} + + +OnceUpon::OnceUpon(GobEngine *vm) : PreGob(vm), _openedArchives(false), + _jeudak(0), _lettre(0), _plettre(0), _glettre(0) { + +} + +OnceUpon::~OnceUpon() { + deinit(); +} + +void OnceUpon::init() { + deinit(); + + // Open data files + + bool hasSTK1 = _vm->_dataIO->openArchive("stk1.stk", true); + bool hasSTK2 = _vm->_dataIO->openArchive("stk2.stk", true); + bool hasSTK3 = _vm->_dataIO->openArchive("stk3.stk", true); + + if (!hasSTK1 || !hasSTK2 || !hasSTK3) + error("OnceUpon::OnceUpon(): Failed to open archives"); + + _openedArchives = true; + + // Open fonts + + _jeudak = _vm->_draw->loadFont("jeudak.let"); + _lettre = _vm->_draw->loadFont("lettre.let"); + _plettre = _vm->_draw->loadFont("plettre.let"); + _glettre = _vm->_draw->loadFont("glettre.let"); + + if (!_jeudak || !_lettre || !_plettre || !_glettre) + error("OnceUpon::OnceUpon(): Failed to fonts (%d, %d, %d, %d)", + _jeudak != 0, _lettre != 0, _plettre != 0, _glettre != 0); + + // Verify the language + + if (_vm->_global->_language == kLanguageAmerican) + _vm->_global->_language = kLanguageBritish; + + if ((_vm->_global->_language >= kLanguageCount)) + error("We do not support the language \"%s\".\n" + "If you are certain that your game copy includes this language,\n" + "please contact the ScummVM team with details about this version.\n" + "Thanks", _vm->getLangDesc(_vm->_global->_language)); + + // Load all our sounds and init the screen + + loadSounds(kSound, kSoundCount); + initScreen(); + + // We start with an invalid palette + _palette = -1; + + // No quit requested at start + _quit = false; + + // We start with no selected difficulty and at section 0 + _difficulty = kDifficultyCount; + _section = 0; + + // Default name + _name = "Nemo"; + + // Default character properties + _house = 0; + _head = 0; + _colorHair = 0; + _colorJacket = 0; + _colorTrousers = 0; +} + +void OnceUpon::deinit() { + // Free sounds + freeSounds(); + + // Free fonts + + delete _jeudak; + delete _lettre; + delete _plettre; + delete _glettre; + + _jeudak = 0; + _lettre = 0; + _plettre = 0; + _glettre = 0; + + // Close archives + + if (_openedArchives) { + _vm->_dataIO->closeArchive(true); + _vm->_dataIO->closeArchive(true); + _vm->_dataIO->closeArchive(true); + } + + _openedArchives = false; +} + +void OnceUpon::setGamePalette(uint palette) { + if (palette >= kPaletteCount) + return; + + _palette = palette; + + setPalette(kGamePalettes[palette], kPaletteSize); +} + +void OnceUpon::setGameCursor() { + Surface cursor(320, 16, 1); + + // Set the default game cursor + _vm->_video->drawPackedSprite("icon.cmp", cursor); + setCursor(cursor, 105, 0, 120, 15, 0, 0); +} + +void OnceUpon::drawLineByLine(const Surface &src, int16 left, int16 top, int16 right, int16 bottom, + int16 x, int16 y) const { + + // A special way of drawing something: + // Draw every other line "downwards", wait a bit after each line + // Then, draw the remaining lines "upwards" and again wait a bit after each line. + + if (_vm->shouldQuit()) + return; + + const int16 width = right - left + 1; + const int16 height = bottom - top + 1; + + if ((width <= 0) || (height <= 0)) + return; + + // Draw the even lines downwards + for (int16 i = 0; i < height; i += 2) { + if (_vm->shouldQuit()) + return; + + _vm->_draw->_backSurface->blit(src, left, top + i, right, top + i, x, y + i); + + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, y + i, x + width - 1, y + 1); + _vm->_draw->blitInvalidated(); + + _vm->_util->longDelay(1); + } + + // Draw the odd lines upwards + for (int16 i = (height & 1) ? height : (height - 1); i >= 0; i -= 2) { + if (_vm->shouldQuit()) + return; + + _vm->_draw->_backSurface->blit(src, left, top + i, right, top + i, x, y + i); + + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, y + i, x + width - 1, y + 1); + _vm->_draw->blitInvalidated(); + + _vm->_util->longDelay(1); + } +} + +void OnceUpon::backupScreen(ScreenBackup &backup, bool setDefaultCursor) { + // Backup the screen and palette + backup.screen->blit(*_vm->_draw->_backSurface); + backup.palette = _palette; + + // Backup the cursor + + backup.cursorVisible = isCursorVisible(); + + backup.changedCursor = false; + if (setDefaultCursor) { + backup.changedCursor = true; + + addCursor(); + setGameCursor(); + } +} + +void OnceUpon::restoreScreen(ScreenBackup &backup) { + if (_vm->shouldQuit()) + return; + + // Restore the screen + _vm->_draw->_backSurface->blit(*backup.screen); + _vm->_draw->forceBlit(); + + // Restore the palette + if (backup.palette >= 0) + setGamePalette(backup.palette); + + // Restore the cursor + + if (!backup.cursorVisible) + hideCursor(); + + if (backup.changedCursor) + removeCursor(); + + backup.changedCursor = false; +} + +void OnceUpon::fixTXTStrings(TXTFile &txt) const { + TXTFile::LineArray &lines = txt.getLines(); + for (uint i = 0; i < lines.size(); i++) + lines[i].text = fixString(lines[i].text); +} + +#include "gob/pregob/onceupon/brokenstrings.h" +Common::String OnceUpon::fixString(const Common::String &str) const { + const BrokenStringLanguage &broken = kBrokenStrings[_vm->_global->_language]; + + for (uint i = 0; i < broken.count; i++) { + if (str == broken.strings[i].wrong) + return broken.strings[i].correct; + } + + return str; +} + +enum ClownAnimation { + kClownAnimationStand = 0, + kClownAnimationCheer = 1, + kClownAnimationCry = 2 +}; + +const PreGob::AnimProperties OnceUpon::kClownAnimations[] = { + { 1, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 0, 0, ANIObject::kModeOnce , true, false, false, 0, 0}, + { 6, 0, ANIObject::kModeOnce , true, false, false, 0, 0} +}; + +enum CopyProtectionState { + kCPStateSetup, // Set up the screen + kCPStateWaitUser, // Waiting for the user to pick a shape + kCPStateWaitClown, // Waiting for the clown animation to finish + kCPStateFinish // Finishing +}; + +bool OnceUpon::doCopyProtection(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4]) { + fadeOut(); + setPalette(kCopyProtectionPalette, kPaletteSize); + + // Load the copy protection sprites + Surface sprites[2] = {Surface(320, 200, 1), Surface(320, 200, 1)}; + + _vm->_video->drawPackedSprite("grille1.cmp", sprites[0]); + _vm->_video->drawPackedSprite("grille2.cmp", sprites[1]); + + // Load the clown animation + ANIFile ani (_vm, "grille.ani", 320); + ANIList anims; + + loadAnims(anims, ani, 1, &kClownAnimations[kClownAnimationStand]); + + // Set the copy protection cursor + setCursor(sprites[1], 5, 110, 20, 134, 3, 0); + + // We start with 2 tries left, not having a correct answer and the copy protection not set up yet + CopyProtectionState state = kCPStateSetup; + + uint8 triesLeft = 2; + int8 animalShape = -1; + bool hasCorrect = false; + + while (!_vm->shouldQuit() && (state != kCPStateFinish)) { + clearAnim(anims); + + // Set up the screen + if (state == kCPStateSetup) { + animalShape = cpSetup(colors, shapes, obfuscate, sprites); + + setAnim(*anims[0], kClownAnimations[kClownAnimationStand]); + state = kCPStateWaitUser; + } + + drawAnim(anims); + + // If we're waiting for the clown and he finished, evaluate if we're finished + if (!anims[0]->isVisible() && (state == kCPStateWaitClown)) + state = (hasCorrect || (--triesLeft == 0)) ? kCPStateFinish : kCPStateSetup; + + showCursor(); + fadeIn(); + + endFrame(true); + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + checkInput(mouseX, mouseY, mouseButtons); + + if (state == kCPStateWaitUser) { + // Look if we clicked a shaped and got it right + + int8 guessedShape = -1; + if (mouseButtons == kMouseButtonsLeft) + guessedShape = cpFindShape(mouseX, mouseY); + + if (guessedShape >= 0) { + hasCorrect = guessedShape == animalShape; + animalShape = -1; + + setAnim(*anims[0], kClownAnimations[hasCorrect ? kClownAnimationCheer : kClownAnimationCry]); + state = kCPStateWaitClown; + } + } + } + + freeAnims(anims); + + fadeOut(); + hideCursor(); + clearScreen(); + + // Display the "You are wrong" screen + if (!hasCorrect) + cpWrong(); + + return hasCorrect; +} + +int8 OnceUpon::cpSetup(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4], + const Surface sprites[2]) { + + fadeOut(); + hideCursor(); + + // Get a random animal and animal color + int8 animalColor = _vm->_util->getRandom(7); + while ((colors[animalColor] == 1) || (colors[animalColor] == 7) || (colors[animalColor] == 11)) + animalColor = _vm->_util->getRandom(7); + + int8 animal = _vm->_util->getRandom(20); + + int8 animalShape = shapes[animalColor * 20 + animal]; + if (animal < 4) + animal = obfuscate[animal]; + + // Get the position of the animal sprite + int16 animalLeft = (animal % 4) * 80; + int16 animalTop = (animal / 4) * 50; + + uint8 sprite = 0; + if (animalTop >= 200) { + animalTop -= 200; + sprite = 1; + } + + int16 animalRight = animalLeft + 80 - 1; + int16 animalBottom = animalTop + 50 - 1; + + // Fill with the animal color + _vm->_draw->_backSurface->fill(colors[animalColor]); + + // Print the help line strings + for (uint i = 0; i < kCopyProtectionHelpStringCount; i++) { + const char * const helpString = kCopyProtectionHelpStrings[_vm->_global->_language][i]; + + const int x = 160 - (strlen(helpString) * _plettre->getCharWidth()) / 2; + const int y = i * 10 + 5; + + _plettre->drawString(helpString, x, y, 8, 0, true, *_vm->_draw->_backSurface); + } + + // White rectangle with black border + _vm->_draw->_backSurface->fillRect( 93, 43, 226, 134, 15); + _vm->_draw->_backSurface->drawRect( 92, 42, 227, 135, 0); + + // Draw the animal in the animal color + _vm->_draw->_backSurface->fillRect(120, 63, 199, 112, colors[animalColor]); + _vm->_draw->_backSurface->blit(sprites[sprite], animalLeft, animalTop, animalRight, animalBottom, 120, 63, 0); + + // Draw the shapes + for (uint i = 0; i < kCopyProtectionShapeCount; i++) { + const int16 * const coords = kCopyProtectionShapeCoords[i]; + + _vm->_draw->_backSurface->blit(sprites[1], coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], 0); + } + + _vm->_draw->forceBlit(); + + return animalShape; +} + +int8 OnceUpon::cpFindShape(int16 x, int16 y) const { + // Look through all shapes and check if the coordinates are inside one of them + for (uint i = 0; i < kCopyProtectionShapeCount; i++) { + const int16 * const coords = kCopyProtectionShapeCoords[i]; + + const int16 left = coords[4]; + const int16 top = coords[5]; + const int16 right = coords[4] + (coords[2] - coords[0] + 1) - 1; + const int16 bottom = coords[5] + (coords[3] - coords[1] + 1) - 1; + + if ((x >= left) && (x <= right) && (y >= top) && (y <= bottom)) + return i; + } + + return -1; +} + +void OnceUpon::cpWrong() { + // Display the "You are wrong" string, centered + + const char * const wrongString = kCopyProtectionWrongStrings[_vm->_global->_language]; + const int wrongX = 160 - (strlen(wrongString) * _plettre->getCharWidth()) / 2; + + _vm->_draw->_backSurface->clear(); + _plettre->drawString(wrongString, wrongX, 100, 15, 0, true, *_vm->_draw->_backSurface); + + _vm->_draw->forceBlit(); + + fadeIn(); + + waitInput(); + + fadeOut(); + clearScreen(); +} + +void OnceUpon::showIntro() { + // Show all intro parts + + // "Loading" + showWait(10); + if (_vm->shouldQuit()) + return; + + // Quote about fairy tales + showQuote(); + if (_vm->shouldQuit()) + return; + + // Once Upon A Time title + showTitle(); + if (_vm->shouldQuit()) + return; + + // Game title screen + showChapter(0); + if (_vm->shouldQuit()) + return; + + // "Loading" + showWait(17); +} + +void OnceUpon::showWait(uint palette) { + // Show the loading floppy + + fadeOut(); + clearScreen(); + setGamePalette(palette); + + Surface wait(320, 43, 1); + + _vm->_video->drawPackedSprite("wait.cmp", wait); + _vm->_draw->_backSurface->blit(wait, 0, 0, 72, 33, 122, 84); + + _vm->_draw->forceBlit(); + + fadeIn(); +} + +void OnceUpon::showQuote() { + // Show the quote about fairytales + + fadeOut(); + clearScreen(); + setGamePalette(11); + + static const Font *fonts[3] = { _plettre, _glettre, _plettre }; + + TXTFile *quote = loadTXT(getLocFile("gene.tx"), TXTFile::kFormatStringPositionColorFont); + quote->draw(*_vm->_draw->_backSurface, fonts, ARRAYSIZE(fonts)); + delete quote; + + _vm->_draw->forceBlit(); + + fadeIn(); + + waitInput(); + + fadeOut(); +} + +const PreGob::AnimProperties OnceUpon::kTitleAnimation = { + 8, 0, ANIObject::kModeContinuous, true, false, false, 0, 0 +}; + +void OnceUpon::showTitle() { + fadeOut(); + setGamePalette(10); + + Title title(_vm); + title.play(); +} + +void OnceUpon::showChapter(int chapter) { + // Display the intro text to a chapter + + fadeOut(); + clearScreen(); + setGamePalette(11); + + // Parchment background + _vm->_video->drawPackedSprite("parch.cmp", *_vm->_draw->_backSurface); + + static const Font *fonts[3] = { _plettre, _glettre, _plettre }; + + const Common::String chapterFile = getLocFile(Common::String::format("gene%d.tx", chapter)); + + TXTFile *gameTitle = loadTXT(chapterFile, TXTFile::kFormatStringPositionColorFont); + gameTitle->draw(*_vm->_draw->_backSurface, fonts, ARRAYSIZE(fonts)); + delete gameTitle; + + _vm->_draw->forceBlit(); + + fadeIn(); + + waitInput(); + + fadeOut(); +} + +void OnceUpon::showByeBye() { + fadeOut(); + hideCursor(); + clearScreen(); + setGamePalette(1); + + _plettre->drawString("Bye Bye....", 140, 80, 2, 0, true, *_vm->_draw->_backSurface); + _vm->_draw->forceBlit(); + + fadeIn(); + + _vm->_util->longDelay(1000); + + fadeOut(); +} + +void OnceUpon::doStartMenu(const MenuButton *animalsButton, uint animalCount, + const MenuButton *animalButtons, const char * const *animalNames) { + clearScreen(); + + // Wait until we clicked on of the difficulty buttons and are ready to start playing + while (!_vm->shouldQuit()) { + MenuAction action = handleStartMenu(animalsButton); + if (action == kMenuActionPlay) + break; + + // If we pressed the "listen to animal names" button, handle that screen + if (action == kMenuActionAnimals) + handleAnimalNames(animalCount, animalButtons, animalNames); + } +} + +OnceUpon::MenuAction OnceUpon::handleStartMenu(const MenuButton *animalsButton) { + ScreenBackup screenBackup; + backupScreen(screenBackup, true); + + fadeOut(); + setGamePalette(17); + drawStartMenu(animalsButton); + showCursor(); + fadeIn(); + + MenuAction action = kMenuActionNone; + while (!_vm->shouldQuit() && (action == kMenuActionNone)) { + endFrame(true); + + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + if (key == kKeyEscape) + // ESC -> Quit + return kMenuActionQuit; + + if (mouseButtons != kMouseButtonsLeft) + continue; + + playSound(kSoundClick); + + // If we clicked on a difficulty button, show the selected difficulty and start the game + int diff = checkButton(kMainMenuDifficultyButton, ARRAYSIZE(kMainMenuDifficultyButton), mouseX, mouseY); + if (diff >= 0) { + _difficulty = (Difficulty)diff; + action = kMenuActionPlay; + + drawStartMenu(animalsButton); + _vm->_util->longDelay(1000); + } + + if (animalsButton && (checkButton(animalsButton, 1, mouseX, mouseY) != -1)) + action = kMenuActionAnimals; + + } + + fadeOut(); + restoreScreen(screenBackup); + + return action; +} + +OnceUpon::MenuAction OnceUpon::handleMainMenu() { + ScreenBackup screenBackup; + backupScreen(screenBackup, true); + + fadeOut(); + setGamePalette(17); + drawMainMenu(); + showCursor(); + fadeIn(); + + MenuAction action = kMenuActionNone; + while (!_vm->shouldQuit() && (action == kMenuActionNone)) { + endFrame(true); + + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + if (key == kKeyEscape) + // ESC -> Quit + return kMenuActionQuit; + + if (mouseButtons != kMouseButtonsLeft) + continue; + + playSound(kSoundClick); + + // If we clicked on a difficulty button, change the current difficulty level + int diff = checkButton(kMainMenuDifficultyButton, ARRAYSIZE(kMainMenuDifficultyButton), mouseX, mouseY); + if ((diff >= 0) && (diff != (int)_difficulty)) { + _difficulty = (Difficulty)diff; + + drawMainMenu(); + } + + // If we clicked on a section button, restart the game from this section + int section = checkButton(kSectionButtons, ARRAYSIZE(kSectionButtons), mouseX, mouseY); + if ((section >= 0) && (section <= _section)) { + _section = section; + action = kMenuActionRestart; + } + + } + + fadeOut(); + restoreScreen(screenBackup); + + return action; +} + +OnceUpon::MenuAction OnceUpon::handleIngameMenu() { + ScreenBackup screenBackup; + backupScreen(screenBackup, true); + + drawIngameMenu(); + showCursor(); + + MenuAction action = kMenuActionNone; + while (!_vm->shouldQuit() && (action == kMenuActionNone)) { + endFrame(true); + + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + if ((key == kKeyEscape) || (mouseButtons == kMouseButtonsRight)) + // ESC or right mouse button -> Dismiss the menu + action = kMenuActionPlay; + + if (mouseButtons != kMouseButtonsLeft) + continue; + + int button = checkButton(kIngameButtons, ARRAYSIZE(kIngameButtons), mouseX, mouseY); + if (button == 0) + action = kMenuActionQuit; + else if (button == 1) + action = kMenuActionMainMenu; + else if (button == 2) + action = kMenuActionPlay; + + } + + clearIngameMenu(*screenBackup.screen); + restoreScreen(screenBackup); + + return action; +} + +void OnceUpon::drawStartMenu(const MenuButton *animalsButton) { + // Draw the background + _vm->_video->drawPackedSprite("menu2.cmp", *_vm->_draw->_backSurface); + + // Draw the "Listen to animal names" button + if (animalsButton) { + Surface elements(320, 38, 1); + _vm->_video->drawPackedSprite("elemenu.cmp", elements); + _vm->_draw->_backSurface->fillRect(animalsButton->left , animalsButton->top, + animalsButton->right, animalsButton->bottom, 0); + drawButton(*_vm->_draw->_backSurface, elements, *animalsButton); + } + + // Highlight the current difficulty + drawMenuDifficulty(); + + _vm->_draw->forceBlit(); +} + +void OnceUpon::drawMainMenu() { + // Draw the background + _vm->_video->drawPackedSprite("menu.cmp", *_vm->_draw->_backSurface); + + // Highlight the current difficulty + drawMenuDifficulty(); + + // Draw the section buttons + Surface elements(320, 200, 1); + _vm->_video->drawPackedSprite("elemenu.cmp", elements); + + for (uint i = 0; i < ARRAYSIZE(kSectionButtons); i++) { + const MenuButton &button = kSectionButtons[i]; + + if (!button.needDraw) + continue; + + if (_section >= (int)button.id) + drawButton(*_vm->_draw->_backSurface, elements, button); + } + + _vm->_draw->forceBlit(); +} + +void OnceUpon::drawIngameMenu() { + Surface menu(320, 34, 1); + _vm->_video->drawPackedSprite("icon.cmp", menu); + + // Draw the menu in a special way, button by button + for (uint i = 0; i < ARRAYSIZE(kIngameButtons); i++) { + const MenuButton &button = kIngameButtons[i]; + + drawLineByLine(menu, button.srcLeft, button.srcTop, button.srcRight, button.srcBottom, + button.dstX, button.dstY); + } + + _vm->_draw->forceBlit(); + _vm->_video->retrace(); +} + +void OnceUpon::drawMenuDifficulty() { + if (_difficulty == kDifficultyCount) + return; + + TXTFile *difficulties = loadTXT(getLocFile("diffic.tx"), TXTFile::kFormatStringPositionColor); + + // Draw the difficulty name + difficulties->draw((uint) _difficulty, *_vm->_draw->_backSurface, &_plettre, 1); + + // Draw a border around the current difficulty + drawButtonBorder(kMainMenuDifficultyButton[_difficulty], difficulties->getLines()[_difficulty].color); + + delete difficulties; +} + +void OnceUpon::clearIngameMenu(const Surface &background) { + if (_vm->shouldQuit()) + return; + + // Find the area encompassing the whole ingame menu + + int16 left = 0x7FFF; + int16 top = 0x7FFF; + int16 right = 0x0000; + int16 bottom = 0x0000; + + for (uint i = 0; i < ARRAYSIZE(kIngameButtons); i++) { + const MenuButton &button = kIngameButtons[i]; + + if (!button.needDraw) + continue; + + left = MIN(left , button.dstX); + top = MIN(top , button.dstY); + right = MAX(right , button.dstX + (button.srcRight - button.srcLeft + 1) - 1); + bottom = MAX(bottom, button.dstY + (button.srcBottom - button.srcTop + 1) - 1); + } + + if ((left > right) || (top > bottom)) + return; + + // Clear it line by line + drawLineByLine(background, left, top, right, bottom, left, top); +} + +OnceUpon::MenuAction OnceUpon::doIngameMenu() { + // Show the ingame menu + MenuAction action = handleIngameMenu(); + + if ((action == kMenuActionQuit) || _vm->shouldQuit()) { + + // User pressed the quit button, or quit ScummVM + _quit = true; + action = kMenuActionQuit; + + } else if (action == kMenuActionPlay) { + + // User pressed the return to game button + action = kMenuActionPlay; + + } else if (kMenuActionMainMenu) { + + // User pressed the return to main menu button + action = handleMainMenu(); + } + + return action; +} + +OnceUpon::MenuAction OnceUpon::doIngameMenu(int16 &key, MouseButtons &mouseButtons) { + if ((key != kKeyEscape) && (mouseButtons != kMouseButtonsRight)) + return kMenuActionNone; + + key = 0; + mouseButtons = kMouseButtonsNone; + + MenuAction action = doIngameMenu(); + if (action == kMenuActionPlay) + action = kMenuActionNone; + + return action; +} + +int OnceUpon::checkButton(const MenuButton *buttons, uint count, int16 x, int16 y, int failValue) const { + // Look through all buttons, and return the ID of the button we're in + + for (uint i = 0; i < count; i++) { + const MenuButton &button = buttons[i]; + + if ((x >= button.left) && (x <= button.right) && (y >= button.top) && (y <= button.bottom)) + return (int)button.id; + } + + // We're in none of these buttons, return the fail value + return failValue; +} + +void OnceUpon::drawButton(Surface &dest, const Surface &src, const MenuButton &button, int transp) const { + dest.blit(src, button.srcLeft, button.srcTop, button.srcRight, button.srcBottom, button.dstX, button.dstY, transp); +} + +void OnceUpon::drawButtons(Surface &dest, const Surface &src, const MenuButton *buttons, uint count, int transp) const { + for (uint i = 0; i < count; i++) { + const MenuButton &button = buttons[i]; + + if (!button.needDraw) + continue; + + drawButton(dest, src, button, transp); + } +} + +void OnceUpon::drawButtonBorder(const MenuButton &button, uint8 color) { + _vm->_draw->_backSurface->drawRect(button.left, button.top, button.right, button.bottom, color); + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, button.left, button.top, button.right, button.bottom); +} + +enum AnimalNamesState { + kANStateChoose, // We're in the animal chooser + kANStateNames, // We're in the language chooser + kANStateFinish // We're finished +}; + +void OnceUpon::handleAnimalNames(uint count, const MenuButton *buttons, const char * const *names) { + fadeOut(); + clearScreen(); + setGamePalette(19); + + bool cursorVisible = isCursorVisible(); + + // Set the cursor + addCursor(); + setGameCursor(); + + anSetupChooser(); + + int8 _animal = -1; + + AnimalNamesState state = kANStateChoose; + while (!_vm->shouldQuit() && (state != kANStateFinish)) { + showCursor(); + fadeIn(); + + endFrame(true); + + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + checkInput(mouseX, mouseY, mouseButtons); + + // If we moused over an animal button, draw a border around it + int animal = checkButton(buttons, count, mouseX, mouseY); + if ((state == kANStateChoose) && (animal != _animal)) { + // Erase the old border + if (_animal >= 0) + drawButtonBorder(buttons[_animal], 15); + + _animal = animal; + + // Draw the new border + if (_animal >= 0) + drawButtonBorder(buttons[_animal], 10); + } + + if (mouseButtons != kMouseButtonsLeft) + continue; + + playSound(kSoundClick); + + // We clicked on a language button, play the animal name + int language = checkButton(kLanguageButtons, ARRAYSIZE(kLanguageButtons), mouseX, mouseY); + if ((state == kANStateNames) && (language >= 0)) + anPlayAnimalName(names[_animal], language); + + // We clicked on an animal + if ((state == kANStateChoose) && (_animal >= 0)) { + anSetupNames(buttons[_animal]); + + state = kANStateNames; + } + + // If we clicked on the back button, go back + if (checkButton(&kAnimalNamesBack, 1, mouseX, mouseY) != -1) { + if (state == kANStateNames) { + anSetupChooser(); + + state = kANStateChoose; + } else if (state == kANStateChoose) + state = kANStateFinish; + } + } + + fadeOut(); + + // Restore the cursor + if (!cursorVisible) + hideCursor(); + removeCursor(); +} + +void OnceUpon::anSetupChooser() { + fadeOut(); + + _vm->_video->drawPackedSprite("dico.cmp", *_vm->_draw->_backSurface); + + // Draw the back button + Surface menu(320, 34, 1); + _vm->_video->drawPackedSprite("icon.cmp", menu); + drawButton(*_vm->_draw->_backSurface, menu, kAnimalNamesBack); + + // "Choose an animal" + TXTFile *choose = loadTXT(getLocFile("choisi.tx"), TXTFile::kFormatStringPosition); + choose->draw(*_vm->_draw->_backSurface, &_plettre, 1, 14); + delete choose; + + _vm->_draw->forceBlit(); +} + +void OnceUpon::anSetupNames(const MenuButton &animal) { + fadeOut(); + + Surface background(320, 200, 1); + + _vm->_video->drawPackedSprite("dico.cmp", background); + + // Draw the background and clear what we don't need + _vm->_draw->_backSurface->blit(background); + _vm->_draw->_backSurface->fillRect(19, 19, 302, 186, 15); + + // Draw the back button + Surface menu(320, 34, 1); + _vm->_video->drawPackedSprite("icon.cmp", menu); + drawButton(*_vm->_draw->_backSurface, menu, kAnimalNamesBack); + + // Draw the animal + drawButton(*_vm->_draw->_backSurface, background, animal); + + // Draw the language buttons + Surface elements(320, 200, 1); + _vm->_video->drawPackedSprite("elemenu.cmp", elements); + drawButtons(*_vm->_draw->_backSurface, elements, kLanguageButtons, ARRAYSIZE(kLanguageButtons)); + + // Draw the language names + _plettre->drawString("Fran\207ais", 43, 70, 10, 15, true, *_vm->_draw->_backSurface); + _plettre->drawString("Deutsch" , 136, 70, 10, 15, true, *_vm->_draw->_backSurface); + _plettre->drawString("English" , 238, 70, 10, 15, true, *_vm->_draw->_backSurface); + _plettre->drawString("Italiano" , 43, 128, 10, 15, true, *_vm->_draw->_backSurface); + _plettre->drawString("Espa\244ol" , 136, 128, 10, 15, true, *_vm->_draw->_backSurface); + _plettre->drawString("English" , 238, 128, 10, 15, true, *_vm->_draw->_backSurface); + + _vm->_draw->forceBlit(); +} + +void OnceUpon::anPlayAnimalName(const Common::String &animal, uint language) { + // Sound file to play + Common::String soundFile = animal + "_" + kLanguageSuffixLong[language] + ".snd"; + + // Get the name of the animal + TXTFile *names = loadTXT(animal + ".anm", TXTFile::kFormatString); + Common::String name = names->getLines()[language].text; + delete names; + + // It should be centered on the screen + const int nameX = 160 - (name.size() * _plettre->getCharWidth()) / 2; + + // Backup the screen surface + Surface backup(162, 23, 1); + backup.blit(*_vm->_draw->_backSurface, 78, 123, 239, 145, 0, 0); + + // Draw the name border + Surface nameBorder(162, 23, 1); + _vm->_video->drawPackedSprite("mot.cmp", nameBorder); + _vm->_draw->_backSurface->blit(nameBorder, 0, 0, 161, 22, 78, 123); + + // Print the animal name + _plettre->drawString(name, nameX, 129, 10, 0, true, *_vm->_draw->_backSurface); + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 78, 123, 239, 145); + + playSoundFile(soundFile); + + // Restore the screen + _vm->_draw->_backSurface->blit(backup, 0, 0, 161, 22, 78, 123); + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 78, 123, 239, 145); +} + +void OnceUpon::playGame() { + while (!_vm->shouldQuit() && !_quit) { + // Play a section and advance to the next section if we finished it + if (playSection()) + _section = MIN(_section + 1, kSectionCount - 1); + } + + // If we quit through the game and not through ScummVM, show the "Bye Bye" screen + if (!_vm->shouldQuit()) + showByeBye(); +} + +bool OnceUpon::playSection() { + if ((_section < 0) || (_section >= ARRAYSIZE(kSectionFuncs))) { + _quit = true; + return false; + } + + return (this->*kSectionFuncs[_section])(); +} + +const PreGob::AnimProperties OnceUpon::kSectionStorkAnimations[] = { + { 0, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 1, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 2, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 3, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 4, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 5, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 6, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 7, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 8, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + {17, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + {16, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + {15, 0, ANIObject::kModeContinuous, true, false, false, 0, 0} +}; + +enum StorkState { + kStorkStateWaitUser, + kStorkStateWaitBundle, + kStorkStateFinish +}; + +bool OnceUpon::sectionStork() { + fadeOut(); + hideCursor(); + setGamePalette(0); + setGameCursor(); + + const StorkParam ¶m = getStorkParameters(); + + Surface backdrop(320, 200, 1); + + // Draw the frame + _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface); + + // Draw the backdrop + _vm->_video->drawPackedSprite(param.backdrop, backdrop); + _vm->_draw->_backSurface->blit(backdrop, 0, 0, 288, 175, 16, 12); + + // "Where does the stork go?" + TXTFile *whereStork = loadTXT(getLocFile("ouva.tx"), TXTFile::kFormatStringPositionColor); + whereStork->draw(*_vm->_draw->_backSurface, &_plettre, 1); + + // Where the stork actually goes + GCTFile *thereStork = loadGCT(getLocFile("choix.gc")); + thereStork->setArea(17, 18, 303, 41); + + ANIFile ani(_vm, "present.ani", 320); + ANIList anims; + + Stork *stork = new Stork(_vm, ani); + + loadAnims(anims, ani, ARRAYSIZE(kSectionStorkAnimations), kSectionStorkAnimations); + anims.push_back(stork); + + drawAnim(anims); + + _vm->_draw->forceBlit(); + + int8 storkSoundWait = 0; + + StorkState state = kStorkStateWaitUser; + MenuAction action = kMenuActionNone; + while (!_vm->shouldQuit() && (state != kStorkStateFinish)) { + // Play the stork sound + if (--storkSoundWait == 0) + playSound(kSoundStork); + if (storkSoundWait <= 0) + storkSoundWait = 50 - _vm->_util->getRandom(30); + + // Check if the bundle landed + if ((state == kStorkStateWaitBundle) && stork->hasBundleLanded()) + state = kStorkStateFinish; + + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + + action = doIngameMenu(key, mouseButtons); + if (action != kMenuActionNone) { + state = kStorkStateFinish; + break; + } + + clearAnim(anims); + + if (mouseButtons == kMouseButtonsLeft) { + stopSound(); + playSound(kSoundClick); + + int house = checkButton(param.houses, param.houseCount, mouseX, mouseY); + if ((state == kStorkStateWaitUser) && (house >= 0)) { + + _house = house; + + stork->dropBundle(param.drops[house]); + state = kStorkStateWaitBundle; + + // Remove the "Where does the stork go?" text + int16 left, top, right, bottom; + if (whereStork->clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + + // Print the text where the stork actually goes + thereStork->selectLine(3, house); // The house + thereStork->selectLine(4, house); // The house's inhabitants + if (thereStork->draw(*_vm->_draw->_backSurface, 2, *_plettre, 10, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + } + } + + drawAnim(anims); + showCursor(); + fadeIn(); + + endFrame(true); + } + + freeAnims(anims); + delete thereStork; + delete whereStork; + + fadeOut(); + hideCursor(); + + // Didn't complete the section + if (action != kMenuActionNone) + return false; + + // Move on to the character generator + + CharGenAction charGenAction = kCharGenRestart; + while (charGenAction == kCharGenRestart) + charGenAction = characterGenerator(); + + // Did we successfully create a character? + return charGenAction == kCharGenDone; +} + +const OnceUpon::MenuButton OnceUpon::kCharGenHeadButtons[] = { + {true, 106, 146, 152, 180, 0, 0, 47, 34, 106, 146, 0}, + {true, 155, 146, 201, 180, 49, 0, 96, 34, 155, 146, 1}, + {true, 204, 146, 250, 180, 98, 0, 145, 34, 204, 146, 2}, + {true, 253, 146, 299, 180, 147, 0, 194, 34, 253, 146, 3} +}; + +const OnceUpon::MenuButton OnceUpon::kCharGenHeads[] = { + {true, 0, 0, 0, 0, 29, 4, 68, 31, 40, 51, 0}, + {true, 0, 0, 0, 0, 83, 4, 113, 31, 45, 51, 1}, + {true, 0, 0, 0, 0, 132, 4, 162, 31, 45, 51, 2}, + {true, 0, 0, 0, 0, 182, 4, 211, 31, 45, 51, 3} +}; + +const OnceUpon::MenuButton OnceUpon::kCharGenHairButtons[] = { + {true, 105, 55, 124, 70, 271, 1, 289, 15, 105, 55, 0x04}, + {true, 105, 74, 124, 89, 271, 20, 289, 34, 105, 74, 0x07} +}; + +const OnceUpon::MenuButton OnceUpon::kCharGenJacketButtons[] = { + {true, 105, 90, 124, 105, 271, 39, 289, 53, 105, 90, 0x06}, + {true, 105, 109, 124, 124, 271, 58, 289, 72, 105, 109, 0x02} +}; + +const OnceUpon::MenuButton OnceUpon::kCharGenTrousersButtons[] = { + {true, 105, 140, 124, 155, 271, 77, 289, 91, 105, 140, 0x01}, + {true, 105, 159, 124, 174, 271, 96, 289, 110, 105, 159, 0x03} +}; + +const OnceUpon::MenuButton OnceUpon::kCharGenNameEntry[] = { + {true, 0, 0, 0, 0, 0, 38, 54, 48, 140, 145, 0}, + {true, 0, 0, 0, 0, 106, 38, 159, 48, 195, 145, 0}, + {true, 0, 0, 0, 0, 0, 105, 54, 121, 140, 156, 0}, + {true, 0, 0, 0, 0, 106, 105, 159, 121, 195, 156, 0} +}; + +enum CharGenState { + kCharGenStateHead = 0, // Choose a head + kCharGenStateHair , // Choose hair color + kCharGenStateJacket , // Choose jacket color + kCharGenStateTrousers , // Choose trousers color + kCharGenStateName , // Choose name + kCharGenStateSure , // "Are you sure?" + kCharGenStateStoryName , // "We're going to tell the story of $NAME" + kCharGenStateFinish // Finished +}; + +void OnceUpon::charGenSetup(uint stage) { + Surface choix(320, 200, 1), elchoix(320, 200, 1), paperDoll(65, 137, 1); + + _vm->_video->drawPackedSprite("choix.cmp" , choix); + _vm->_video->drawPackedSprite("elchoix.cmp", elchoix); + + paperDoll.blit(choix, 200, 0, 264, 136, 0, 0); + + GCTFile *text = loadGCT(getLocFile("choix.gc")); + text->setArea(17, 18, 303, 41); + text->setText(9, _name); + + // Background + _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface); + _vm->_draw->_backSurface->fillRect(16, 50, 303, 187, 5); + + // Character sprite frame + _vm->_draw->_backSurface->blit(choix, 0, 38, 159, 121, 140, 54); + + // Recolor the paper doll parts + if (_colorHair != 0xFF) + elchoix.recolor(0x0C, _colorHair); + + if (_colorJacket != 0xFF) + paperDoll.recolor(0x0A, _colorJacket); + + if (_colorTrousers != 0xFF) + paperDoll.recolor(0x09, _colorTrousers); + + _vm->_draw->_backSurface->blit(paperDoll, 32, 51); + + // Paper doll head + if (_head != 0xFF) + drawButton(*_vm->_draw->_backSurface, elchoix, kCharGenHeads[_head], 0); + + if (stage == kCharGenStateHead) { + // Head buttons + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenHeadButtons, ARRAYSIZE(kCharGenHeadButtons)); + + // "Choose a head" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 5, *_plettre, 10, left, top, right, bottom); + + } else if (stage == kCharGenStateHair) { + // Hair color buttons + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenHairButtons, ARRAYSIZE(kCharGenHairButtons)); + + // "What color is the hair?" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 6, *_plettre, 10, left, top, right, bottom); + + } else if (stage == kCharGenStateJacket) { + // Jacket color buttons + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenJacketButtons, ARRAYSIZE(kCharGenJacketButtons)); + + // "What color is the jacket?" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 7, *_plettre, 10, left, top, right, bottom); + + } else if (stage == kCharGenStateTrousers) { + // Trousers color buttons + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenTrousersButtons, ARRAYSIZE(kCharGenTrousersButtons)); + + // "What color are the trousers?" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 8, *_plettre, 10, left, top, right, bottom); + + } else if (stage == kCharGenStateName) { + // Name entry field + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenNameEntry, ARRAYSIZE(kCharGenNameEntry)); + + // "Enter name" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 10, *_plettre, 10, left, top, right, bottom); + + charGenDrawName(); + } else if (stage == kCharGenStateSure) { + // Name entry field + drawButtons(*_vm->_draw->_backSurface, choix, kCharGenNameEntry, ARRAYSIZE(kCharGenNameEntry)); + + // "Are you sure?" + TXTFile *sure = loadTXT(getLocFile("estu.tx"), TXTFile::kFormatStringPositionColor); + sure->draw(*_vm->_draw->_backSurface, &_plettre, 1); + delete sure; + + charGenDrawName(); + } else if (stage == kCharGenStateStoryName) { + + // "We're going to tell the story of $NAME" + int16 left, top, right, bottom; + text->draw(*_vm->_draw->_backSurface, 11, *_plettre, 10, left, top, right, bottom); + } + + delete text; +} + +bool OnceUpon::enterString(Common::String &name, int16 key, uint maxLength, const Font &font) { + if (key == 0) + return true; + + if (key == kKeyBackspace) { + name.deleteLastChar(); + return true; + } + + if (key == kKeySpace) + key = ' '; + + if ((key >= ' ') && (key <= 0xFF)) { + if (name.size() >= maxLength) + return false; + + if (!font.hasChar(key)) + return false; + + name += (char) key; + return true; + } + + return false; +} + +void OnceUpon::charGenDrawName() { + _vm->_draw->_backSurface->fillRect(147, 151, 243, 166, 1); + + const int16 nameY = 151 + ((166 - 151 + 1 - _plettre->getCharHeight()) / 2); + const int16 nameX = 147 + ((243 - 147 + 1 - (15 * _plettre->getCharWidth ())) / 2); + + _plettre->drawString(_name, nameX, nameY, 10, 0, true, *_vm->_draw->_backSurface); + + const int16 cursorLeft = nameX + _name.size() * _plettre->getCharWidth(); + const int16 cursorTop = nameY; + const int16 cursorRight = cursorLeft + _plettre->getCharWidth() - 1; + const int16 cursorBottom = cursorTop + _plettre->getCharHeight() - 1; + + _vm->_draw->_backSurface->fillRect(cursorLeft, cursorTop, cursorRight, cursorBottom, 10); + + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 151, 243, 166); +} + +OnceUpon::CharGenAction OnceUpon::characterGenerator() { + fadeOut(); + hideCursor(); + setGameCursor(); + + showWait(1); + + _name.clear(); + + _head = 0xFF; + _colorHair = 0xFF; + _colorJacket = 0xFF; + _colorTrousers = 0xFF; + + CharGenState state = kCharGenStateHead; + charGenSetup(state); + + ANIFile ani(_vm, "ba.ani", 320); + + ani.recolor(0x0F, 0x0C); + ani.recolor(0x0E, 0x0A); + ani.recolor(0x08, 0x09); + + CharGenChild *child = new CharGenChild(ani); + + ANIList anims; + anims.push_back(child); + + fadeOut(); + _vm->_draw->forceBlit(); + + CharGenAction action = kCharGenRestart; + while (!_vm->shouldQuit() && (state != kCharGenStateFinish)) { + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + + MenuAction menuAction = doIngameMenu(key, mouseButtons); + if (menuAction != kMenuActionNone) { + state = kCharGenStateFinish; + action = kCharGenAbort; + break; + } + + clearAnim(anims); + + if (state == kCharGenStateStoryName) { + if ((mouseButtons != kMouseButtonsNone) || (key != 0)) { + state = kCharGenStateFinish; + action = kCharGenDone; + break; + } + } + + if (state == kCharGenStateSure) { + // Not sure => restart + if ((key == 'N') || (key == 'n')) { // No / Nein / Non + state = kCharGenStateFinish; + action = kCharGenRestart; + break; + } + + if ((key == 'Y') || (key == 'y') || // Yes + (key == 'J') || (key == 'j') || // Ja + (key == 'S') || (key == 's') || // Si + (key == 'O') || (key == 'o')) { // Oui + + state = kCharGenStateStoryName; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + } + + if (state == kCharGenStateName) { + if (enterString(_name, key, 14, *_plettre)) { + _vm->_draw->_backSurface->fillRect(147, 151, 243, 166, 1); + + const int16 nameY = 151 + ((166 - 151 + 1 - _plettre->getCharHeight()) / 2); + const int16 nameX = 147 + ((243 - 147 + 1 - (15 * _plettre->getCharWidth ())) / 2); + + _plettre->drawString(_name, nameX, nameY, 10, 0, true, *_vm->_draw->_backSurface); + + const int16 cursorLeft = nameX + _name.size() * _plettre->getCharWidth(); + const int16 cursorTop = nameY; + const int16 cursorRight = cursorLeft + _plettre->getCharWidth() - 1; + const int16 cursorBottom = cursorTop + _plettre->getCharHeight() - 1; + + _vm->_draw->_backSurface->fillRect(cursorLeft, cursorTop, cursorRight, cursorBottom, 10); + + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 151, 243, 166); + } + + if ((key == kKeyReturn) && !_name.empty()) { + _name.trim(); + _name.setChar(Util::toCP850Upper(_name[0]), 0); + + state = kCharGenStateSure; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + } + + if (mouseButtons == kMouseButtonsLeft) { + stopSound(); + playSound(kSoundClick); + + int trousers = checkButton(kCharGenTrousersButtons, ARRAYSIZE(kCharGenTrousersButtons), mouseX, mouseY); + if ((state == kCharGenStateTrousers) && (trousers >= 0)) { + _colorTrousers = trousers; + + ani.recolor(0x09, _colorTrousers); + + state = kCharGenStateName; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + + int jacket = checkButton(kCharGenJacketButtons, ARRAYSIZE(kCharGenJacketButtons), mouseX, mouseY); + if ((state == kCharGenStateJacket) && (jacket >= 0)) { + _colorJacket = jacket; + + ani.recolor(0x0A, _colorJacket); + + state = kCharGenStateTrousers; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + + int hair = checkButton(kCharGenHairButtons, ARRAYSIZE(kCharGenHairButtons), mouseX, mouseY); + if ((state == kCharGenStateHair) && (hair >= 0)) { + _colorHair = hair; + + ani.recolor(0x0C, _colorHair); + + state = kCharGenStateJacket; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + + int head = checkButton(kCharGenHeadButtons, ARRAYSIZE(kCharGenHeadButtons), mouseX, mouseY); + if ((state == kCharGenStateHead) && (head >= 0)) { + _head = head; + + state = kCharGenStateHair; + charGenSetup(state); + _vm->_draw->forceBlit(); + } + } + + drawAnim(anims); + + // Play the child sounds + CharGenChild::Sound childSound = child->shouldPlaySound(); + if (childSound == CharGenChild::kSoundWalk) { + beep(50, 10); + } else if (childSound == CharGenChild::kSoundJump) { + stopSound(); + playSound(kSoundJump); + } + + showCursor(); + fadeIn(); + + endFrame(true); + } + + fadeOut(); + hideCursor(); + + freeAnims(anims); + + if (_vm->shouldQuit()) + return kCharGenAbort; + + return action; +} + +bool OnceUpon::sectionChapter1() { + showChapter(1); + return true; +} + +bool OnceUpon::sectionParents() { + fadeOut(); + setGamePalette(14); + clearScreen(); + + const Common::String seq = ((_house == 1) || (_house == 2)) ? "parents.seq" : "parents2.seq"; + const Common::String gct = getLocFile("mefait.gc"); + + Parents parents(_vm, seq, gct, _name, _house, *_plettre, kGamePalettes[14], kGamePalettes[13], kPaletteSize); + parents.play(); + + warning("OnceUpon::sectionParents(): TODO: Item search"); + return true; +} + +bool OnceUpon::sectionChapter2() { + showChapter(2); + return true; +} + +bool OnceUpon::sectionForest0() { + warning("OnceUpon::sectionForest0(): TODO"); + return true; +} + +bool OnceUpon::sectionChapter3() { + showChapter(3); + return true; +} + +bool OnceUpon::sectionEvilCastle() { + warning("OnceUpon::sectionEvilCastle(): TODO"); + return true; +} + +bool OnceUpon::sectionChapter4() { + showChapter(4); + return true; +} + +bool OnceUpon::sectionForest1() { + warning("OnceUpon::sectionForest1(): TODO"); + return true; +} + +bool OnceUpon::sectionChapter5() { + showChapter(5); + return true; +} + +bool OnceUpon::sectionBossFight() { + warning("OnceUpon::sectionBossFight(): TODO"); + return true; +} + +bool OnceUpon::sectionChapter6() { + showChapter(6); + return true; +} + +bool OnceUpon::sectionForest2() { + warning("OnceUpon::sectionForest2(): TODO"); + return true; +} + +bool OnceUpon::sectionChapter7() { + showChapter(7); + return true; +} + +const PreGob::AnimProperties OnceUpon::kSectionEndAnimations[] = { + { 0, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 6, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + { 9, 0, ANIObject::kModeContinuous, true, false, false, 0, 0}, + {11, 0, ANIObject::kModeContinuous, true, false, false, 0, 0} +}; + +bool OnceUpon::sectionEnd() { + fadeOut(); + setGamePalette(9); + + _vm->_video->drawPackedSprite("cadre.cmp", *_vm->_draw->_backSurface); + + Surface endBackground(320, 200, 1); + _vm->_video->drawPackedSprite("fin.cmp", endBackground); + + _vm->_draw->_backSurface->blit(endBackground, 0, 0, 288, 137, 16, 50); + + GCTFile *endText = loadGCT(getLocFile("final.gc")); + endText->setArea(17, 18, 303, 41); + endText->setText(1, _name); + + ANIFile ani(_vm, "fin.ani", 320); + ANIList anims; + + loadAnims(anims, ani, ARRAYSIZE(kSectionEndAnimations), kSectionEndAnimations); + drawAnim(anims); + + _vm->_draw->forceBlit(); + + uint32 textStartTime = 0; + + MenuAction action = kMenuActionNone; + while (!_vm->shouldQuit() && (action == kMenuActionNone)) { + // Check user input + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + int16 key = checkInput(mouseX, mouseY, mouseButtons); + + action = doIngameMenu(key, mouseButtons); + if (action != kMenuActionNone) + break; + + clearAnim(anims); + + // Pressed a key or mouse button => Skip to next area-full of text + if ((mouseButtons == kMouseButtonsLeft) || (key != 0)) + textStartTime = 0; + + // Draw the next area-full of text + uint32 now = _vm->_util->getTimeKey(); + if (!endText->finished() && ((textStartTime == 0) || (now >= (textStartTime + kGCTDelay)))) { + textStartTime = now; + + int16 left, top, right, bottom; + if (endText->clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + + if (endText->draw(*_vm->_draw->_backSurface, 0, *_plettre, 10, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + } + + drawAnim(anims); + fadeIn(); + + endFrame(true); + } + + freeAnims(anims); + delete endText; + + // Restart requested + if (action == kMenuActionRestart) + return false; + + // Last scene. Even if we didn't explicitly request a quit, the game ends here + _quit = true; + return false; +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h new file mode 100644 index 000000000000..66ef877618a7 --- /dev/null +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -0,0 +1,344 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_ONCEUPON_H +#define GOB_PREGOB_ONCEUPON_ONCEUPON_H + +#include "common/system.h" +#include "common/str.h" + +#include "gob/pregob/pregob.h" + +#include "gob/pregob/onceupon/stork.h" + +namespace Gob { + +class Surface; +class Font; + +class ANIObject; + +namespace OnceUpon { + +class OnceUpon : public PreGob { +public: + /** Number of languages we support. */ + static const uint kLanguageCount = 5; + + + OnceUpon(GobEngine *vm); + ~OnceUpon(); + + +protected: + /** A description of a menu button. */ + struct MenuButton { + bool needDraw; ///< Does the button need drawing? + + int16 left; ///< Left coordinate of the button. + int16 top; ///< Top coordinate of the button. + int16 right; ///< Right coordinate of the button. + int16 bottom; ///< Bottom coordinate of the button. + + int16 srcLeft; ///< Left coordinate of the button's sprite. + int16 srcTop; ///< Top coordinate of the button's sprite. + int16 srcRight; ///< Right coordinate of the button's sprite. + int16 srcBottom; ///< Right coordinate of the button's sprite. + + int16 dstX; ///< Destination X coordinate of the button's sprite. + int16 dstY; ///< Destination Y coordinate of the button's sprite. + + uint id; ///< The button's ID. + }; + + /** Parameters for the stork section. */ + struct StorkParam { + const char *backdrop; ///< Backdrop image file. + + uint houseCount; ///< Number of houses. + const MenuButton *houses; ///< House button definitions. + + const Stork::BundleDrop *drops; ///< The bundle drop parameters. + }; + + void init(); + void deinit(); + + /** Handle the copy protection. + * + * @param colors Colors the copy protection animals can be. + * @param shapes The shape that's the correct answer for each animal in each color. + * @param obfuscate Extra obfuscate table. correctShape = shapes[colors][obfuscate[animal]]. + * @return true if the user guessed the correct shape, false otherwise. + */ + bool doCopyProtection(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4]); + + /** Show the intro. */ + void showIntro(); + + /** Handle the start menu. + * + * @param animalsButton Definition of the menu button that leads to the animal names screen. Can be 0. + * @param animalCount Number of animals in the animal names screen. + * @param animalButtons Definition of the buttons that make up the animals in the animal names screen. + * @param animalNames File prefixes for the name of each animal. + */ + void doStartMenu(const MenuButton *animalsButton, uint animalCount, + const MenuButton *animalButtons, const char * const *animalNames); + + /** Play the game proper. */ + void playGame(); + + + /** Return the parameters for the stork section. */ + virtual const StorkParam &getStorkParameters() const = 0; + + +private: + /** All actions a user can request in a menu. */ + enum MenuAction { + kMenuActionNone = 0, ///< No action. + kMenuActionAnimals , ///< Do the animal names. + kMenuActionPlay , ///< Play the game. + kMenuActionRestart , ///< Restart the section. + kMenuActionMainMenu, ///< Go to the main menu. + kMenuActionQuit ///< Quit the game. + }; + + /** Difficulty levels. */ + enum Difficulty { + kDifficultyBeginner = 0, + kDifficultyIntermediate = 1, + kDifficultyAdvanced = 2, + kDifficultyCount + }; + + /** The different sounds common in the game. */ + enum Sound { + kSoundClick = 0, + kSoundStork , + kSoundJump , + kSoundCount + }; + + /** Action the character generation wants us to take. */ + enum CharGenAction { + kCharGenDone = 0, ///< Created a character, move on. + kCharGenAbort , ///< Aborted the character generation. + kCharGenRestart ///< Restart the character generation. + }; + + /** A complete screen backup. */ + struct ScreenBackup { + Surface *screen; ///< Screen contents. + int palette; ///< Screen palette. + + bool changedCursor; ///< Did we change the cursor? + bool cursorVisible; ///< Was the cursor visible? + + ScreenBackup(); + ~ScreenBackup(); + }; + + + /** The number of game sections. */ + static const int kSectionCount = 15; + + static const MenuButton kMainMenuDifficultyButton[]; ///< Difficulty buttons. + static const MenuButton kSectionButtons[]; ///< Section buttons. + + static const MenuButton kIngameButtons[]; ///< Ingame menu buttons. + + static const MenuButton kAnimalNamesBack; ///< "Back" button in the animal names screens. + static const MenuButton kLanguageButtons[]; ///< Language buttons in the animal names screen. + + static const MenuButton kSectionStorkHouses[]; + + static const MenuButton kCharGenHeadButtons[]; + static const MenuButton kCharGenHeads[]; + static const MenuButton kCharGenHairButtons[]; + static const MenuButton kCharGenJacketButtons[]; + static const MenuButton kCharGenTrousersButtons[]; + static const MenuButton kCharGenNameEntry[]; + + /** All general game sounds we know about. */ + static const char *kSound[kSoundCount]; + + + static const AnimProperties kClownAnimations[]; + static const AnimProperties kTitleAnimation; + static const AnimProperties kSectionStorkAnimations[]; + static const AnimProperties kSectionEndAnimations[]; + + + /** Function pointer type for a section handler. */ + typedef bool (OnceUpon::*SectionFunc)(); + /** Section handler function. */ + static const SectionFunc kSectionFuncs[kSectionCount]; + + + /** Did we open the game archives? */ + bool _openedArchives; + + // Fonts + Font *_jeudak; + Font *_lettre; + Font *_plettre; + Font *_glettre; + + /** The current palette. */ + int _palette; + + bool _quit; ///< Did the user request a normal game quit? + + Difficulty _difficulty; ///< The current difficulty. + int _section; ///< The current game section. + + Common::String _name; ///< The name of the child. + + uint8 _house; + + uint8 _head; + uint8 _colorHair; + uint8 _colorJacket; + uint8 _colorTrousers; + + + // -- General helpers -- + + void setGamePalette(uint palette); ///< Set a game palette. + void setGameCursor(); ///< Set the default game cursor. + + /** Draw this sprite in a fancy, animated line-by-line way. */ + void drawLineByLine(const Surface &src, int16 left, int16 top, int16 right, int16 bottom, + int16 x, int16 y) const; + + /** Backup the screen contents. */ + void backupScreen(ScreenBackup &backup, bool setDefaultCursor = false); + /** Restore the screen contents with a previously made backup. */ + void restoreScreen(ScreenBackup &backup); + + Common::String fixString(const Common::String &str) const; ///< Fix a string if necessary. + void fixTXTStrings(TXTFile &txt) const; ///< Fix all strings in a TXT. + + + // -- Copy protection helpers -- + + /** Set up the copy protection. */ + int8 cpSetup(const uint8 colors[7], const uint8 shapes[7 * 20], + const uint8 obfuscate[4], const Surface sprites[2]); + /** Find the shape under these coordinates. */ + int8 cpFindShape(int16 x, int16 y) const; + /** Display the "You are wrong" screen. */ + void cpWrong(); + + + // -- Show different game screens -- + + void showWait(uint palette = 0xFFFF); ///< Show the wait / loading screen. + void showQuote(); ///< Show the quote about fairytales. + void showTitle(); ///< Show the Once Upon A Time title. + void showChapter(int chapter); ///< Show a chapter intro text. + void showByeBye(); ///< Show the "bye bye" screen. + + /** Handle the "listen to animal names" part. */ + void handleAnimalNames(uint count, const MenuButton *buttons, const char * const *names); + + + // -- Menu helpers -- + + MenuAction handleStartMenu(const MenuButton *animalsButton); ///< Handle the start menu. + MenuAction handleMainMenu(); ///< Handle the main menu. + MenuAction handleIngameMenu(); ///< Handle the ingame menu. + + void drawStartMenu(const MenuButton *animalsButton); ///< Draw the start menu. + void drawMainMenu(); ///< Draw the main menu. + void drawIngameMenu(); ///< Draw the ingame menu. + + /** Draw the difficulty label. */ + void drawMenuDifficulty(); + + /** Clear the ingame menu in an animated way. */ + void clearIngameMenu(const Surface &background); + + /** Handle the whole ingame menu. */ + MenuAction doIngameMenu(); + /** Handle the whole ingame menu if ESC or right mouse button was pressed. */ + MenuAction doIngameMenu(int16 &key, MouseButtons &mouseButtons); + + + // -- Menu button helpers -- + + /** Find the button under these coordinates. */ + int checkButton(const MenuButton *buttons, uint count, int16 x, int16 y, int failValue = -1) const; + + /** Draw a menu button. */ + void drawButton (Surface &dest, const Surface &src, const MenuButton &button, int transp = -1) const; + /** Draw multiple menu buttons. */ + void drawButtons(Surface &dest, const Surface &src, const MenuButton *buttons, uint count, int transp = -1) const; + + /** Draw a border around a button. */ + void drawButtonBorder(const MenuButton &button, uint8 color); + + + // -- Animal names helpers -- + + /** Set up the animal chooser. */ + void anSetupChooser(); + /** Set up the language chooser for one animal. */ + void anSetupNames(const MenuButton &animal); + /** Play / Display the name of an animal in one language. */ + void anPlayAnimalName(const Common::String &animal, uint language); + + + // -- Game sections -- + + bool playSection(); + + bool sectionStork(); + bool sectionChapter1(); + bool sectionParents(); + bool sectionChapter2(); + bool sectionForest0(); + bool sectionChapter3(); + bool sectionEvilCastle(); + bool sectionChapter4(); + bool sectionForest1(); + bool sectionChapter5(); + bool sectionBossFight(); + bool sectionChapter6(); + bool sectionForest2(); + bool sectionChapter7(); + bool sectionEnd(); + + CharGenAction characterGenerator(); + void charGenSetup(uint stage); + void charGenDrawName(); + + static bool enterString(Common::String &name, int16 key, uint maxLength, const Font &font); +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_ONCEUPON_H diff --git a/engines/gob/pregob/onceupon/palettes.h b/engines/gob/pregob/onceupon/palettes.h new file mode 100644 index 000000000000..952581041c98 --- /dev/null +++ b/engines/gob/pregob/onceupon/palettes.h @@ -0,0 +1,411 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_PALETTES_H +#define GOB_PREGOB_ONCEUPON_PALETTES_H + +static const int kPaletteSize = 16; +static const uint kPaletteCount = 20; + +static const byte kCopyProtectionPalette[3 * kPaletteSize] = { + 0x00, 0x00, 0x00, + 0x19, 0x00, 0x19, + 0x00, 0x3F, 0x00, + 0x00, 0x2A, 0x2A, + 0x2A, 0x00, 0x00, + 0x2A, 0x00, 0x2A, + 0x2A, 0x15, 0x00, + 0x00, 0x19, 0x12, + 0x00, 0x00, 0x00, + 0x15, 0x15, 0x3F, + 0x15, 0x3F, 0x15, + 0x00, 0x20, 0x3F, + 0x3F, 0x00, 0x00, + 0x3F, 0x00, 0x20, + 0x3F, 0x3F, 0x00, + 0x3F, 0x3F, 0x3F +}; + +static const byte kGamePalettes[kPaletteCount][3 * kPaletteSize] = { + { + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, + 0x00, 0x00, 0x18, + 0x00, 0x00, 0x3C, + 0x1C, 0x28, 0x00, + 0x10, 0x18, 0x00, + 0x1C, 0x1C, 0x20, + 0x14, 0x14, 0x14, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x14, 0x20, 0x04, + 0x3C, 0x2C, 0x00, + 0x02, 0x00, 0x18, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x38, 0x20, 0x3C, + 0x2C, 0x10, 0x30, + 0x20, 0x08, 0x28, + 0x14, 0x00, 0x1C, + 0x20, 0x20, 0x38, + 0x18, 0x18, 0x2C, + 0x10, 0x10, 0x24, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x3C, 0x20, 0x20, + 0x24, 0x14, 0x14, + 0x1C, 0x10, 0x10, + 0x14, 0x0C, 0x0C, + 0x1C, 0x1C, 0x1C, + 0x18, 0x18, 0x18, + 0x10, 0x10, 0x10, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x10, 0x28, 0x1C, + 0x10, 0x1C, 0x10, + 0x10, 0x14, 0x0C, + 0x1C, 0x1C, 0x3C, + 0x24, 0x24, 0x3C, + 0x18, 0x18, 0x24, + 0x10, 0x10, 0x18, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x3F, 0x26, 0x3F, + 0x36, 0x1C, 0x36, + 0x2C, 0x12, 0x2A, + 0x27, 0x0C, 0x24, + 0x22, 0x07, 0x1E, + 0x1D, 0x03, 0x18, + 0x16, 0x00, 0x10, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3A, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x3F, 0x39, 0x26, + 0x38, 0x34, 0x1C, + 0x30, 0x2F, 0x13, + 0x27, 0x29, 0x0C, + 0x1D, 0x22, 0x07, + 0x14, 0x1B, 0x03, + 0x0C, 0x14, 0x00, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3A, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x24, 0x3C, 0x3C, + 0x1C, 0x34, 0x38, + 0x14, 0x2C, 0x30, + 0x0C, 0x20, 0x2C, + 0x08, 0x18, 0x28, + 0x04, 0x10, 0x20, + 0x00, 0x08, 0x1C, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x38, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x24, + 0x38, 0x24, 0x1C, + 0x30, 0x1C, 0x14, + 0x28, 0x18, 0x0C, + 0x20, 0x10, 0x04, + 0x1C, 0x0C, 0x00, + 0x14, 0x08, 0x00, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x38, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x3C, 0x34, 0x24, + 0x38, 0x2C, 0x1C, + 0x30, 0x24, 0x14, + 0x2C, 0x1C, 0x10, + 0x30, 0x30, 0x3C, + 0x1C, 0x1C, 0x38, + 0x0C, 0x0C, 0x38, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0C, + 0x02, 0x03, 0x14, + 0x07, 0x07, 0x1D, + 0x0E, 0x0E, 0x25, + 0x17, 0x17, 0x2E, + 0x21, 0x22, 0x36, + 0x2F, 0x2F, 0x3F, + 0x3F, 0x3F, 0x3F, + 0x3F, 0x3B, 0x0D, + 0x3A, 0x31, 0x0A, + 0x35, 0x28, 0x07, + 0x30, 0x21, 0x04, + 0x2B, 0x19, 0x02, + 0x26, 0x12, 0x01, + 0x16, 0x0B, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, + 0x21, 0x01, 0x00, + 0x2A, 0x02, 0x00, + 0x33, 0x03, 0x00, + 0x3D, 0x06, 0x00, + 0x2A, 0x19, 0x05, + 0x15, 0x14, 0x14, + 0x22, 0x1F, 0x1E, + 0x2F, 0x2C, 0x28, + 0x3F, 0x3C, 0x29, + 0x3F, 0x38, 0x0B, + 0x3B, 0x30, 0x0A, + 0x37, 0x29, 0x08, + 0x33, 0x23, 0x07, + 0x2F, 0x1D, 0x06 + }, + { + 0x00, 0x00, 0x00, + 0x00, 0x1C, 0x38, + 0x34, 0x30, 0x28, + 0x2C, 0x24, 0x1C, + 0x24, 0x18, 0x10, + 0x1C, 0x10, 0x08, + 0x14, 0x04, 0x04, + 0x10, 0x00, 0x00, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x38, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x00, 0x1C, 0x38, + 0x34, 0x30, 0x28, + 0x2C, 0x24, 0x1C, + 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x38, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x1A, 0x30, 0x37, + 0x14, 0x28, 0x31, + 0x10, 0x20, 0x2C, + 0x0C, 0x19, 0x27, + 0x08, 0x12, 0x21, + 0x05, 0x0C, 0x1C, + 0x03, 0x07, 0x16, + 0x01, 0x03, 0x11, + 0x00, 0x00, 0x0C, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x34, 0x30, 0x34, + 0x30, 0x24, 0x30, + 0x28, 0x1C, 0x28, + 0x24, 0x14, 0x24, + 0x1C, 0x0C, 0x1C, + 0x18, 0x08, 0x18, + 0x14, 0x04, 0x14, + 0x0C, 0x04, 0x0C, + 0x08, 0x00, 0x08, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x2C, 0x24, 0x0C, + 0x34, 0x34, 0x28, + 0x2C, 0x2C, 0x1C, + 0x24, 0x24, 0x10, + 0x1C, 0x18, 0x08, + 0x14, 0x14, 0x08, + 0x10, 0x10, 0x04, + 0x0C, 0x0C, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x38, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x14, 0x28, 0x31, + 0x10, 0x20, 0x2C, + 0x0C, 0x19, 0x27, + 0x08, 0x12, 0x21, + 0x05, 0x0C, 0x1C, + 0x03, 0x07, 0x16, + 0x01, 0x03, 0x11, + 0x00, 0x3C, 0x00, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x10, 0x28, 0x1C, + 0x10, 0x1C, 0x10, + 0x10, 0x14, 0x0C, + 0x1C, 0x1C, 0x3C, + 0x24, 0x24, 0x3C, + 0x18, 0x18, 0x24, + 0x10, 0x10, 0x18, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + }, + { + 0x00, 0x00, 0x00, + 0x10, 0x28, 0x1C, + 0x10, 0x1C, 0x10, + 0x10, 0x14, 0x0C, + 0x1C, 0x1C, 0x3C, + 0x24, 0x24, 0x3C, + 0x18, 0x18, 0x24, + 0x10, 0x10, 0x18, + 0x14, 0x20, 0x04, + 0x00, 0x00, 0x24, + 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, + 0x3C, 0x2C, 0x00, + 0x3C, 0x18, 0x00, + 0x3C, 0x04, 0x00, + 0x1C, 0x00, 0x00 + } +}; + +#endif // GOB_PREGOB_ONCEUPON_PALETTES_H diff --git a/engines/gob/pregob/onceupon/parents.cpp b/engines/gob/pregob/onceupon/parents.cpp new file mode 100644 index 000000000000..cdaee6a38d8e --- /dev/null +++ b/engines/gob/pregob/onceupon/parents.cpp @@ -0,0 +1,217 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gob/gob.h" +#include "gob/global.h" +#include "gob/dataio.h" +#include "gob/palanim.h" +#include "gob/draw.h" +#include "gob/video.h" + +#include "gob/sound/sound.h" + +#include "gob/pregob/gctfile.h" + +#include "gob/pregob/onceupon/palettes.h" +#include "gob/pregob/onceupon/parents.h" + +namespace Gob { + +namespace OnceUpon { + +const char *Parents::kSound[kSoundCount] = { + "rire.snd", // kSoundCackle + "tonn.snd" // kSoundThunder +}; + +// So that every GCT line is displayed for 12 seconds +const uint16 Parents::kLoop[kLoopCount][3] = { + { 72, 77, 33}, + {105, 109, 38}, + {141, 145, 38}, + {446, 454, 23}, + {456, 464, 23}, + {466, 474, 23}, + {476, 484, 23} +}; + + +Parents::Parents(GobEngine *vm, const Common::String &seq, const Common::String &gct, + const Common::String &childName, uint8 house, const Font &font, + const byte *normalPalette, const byte *brightPalette, uint paletteSize) : + SEQFile(vm, seq), + _gct(0), _house(house), _font(&font), + _paletteSize(paletteSize), _normalPalette(normalPalette), _brightPalette(brightPalette) { + + // Load sounds + for (int i = 0; i < kSoundCount; i++) + _vm->_sound->sampleLoad(&_sounds[i], SOUND_SND, kSound[i]); + + // Load GCT + Common::SeekableReadStream *gctStream = _vm->_dataIO->getFile(gct); + if (gctStream) { + _gct = new GCTFile(*gctStream, _vm->_rnd); + + delete gctStream; + } else + error("Parents::Parents(): Failed to open \"%s\"", gct.c_str()); + + _gct->setArea(17, 18, 303, 41); + _gct->setText(1, childName); + + _gct->selectLine(2, _house); + _gct->selectLine(4, _house); + + for (uint i = 0; i < kLoopCount; i++) + _loopID[i] = addLoop(kLoop[i][0], kLoop[i][1], kLoop[i][2]); +} + +Parents::~Parents() { + delete _gct; +} + +void Parents::play() { + _currentLoop = 0; + + SEQFile::play(true, 496, 15); + + // After playback, fade out + if (!_vm->shouldQuit()) + _vm->_palAnim->fade(0, 0, 0); +} + +void Parents::handleFrameEvent() { + switch (getFrame()) { + case 0: + // On fame 0, fade in + _vm->_draw->forceBlit(); + _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0); + break; + + case 4: + drawGCT(0); + break; + + case 55: + drawGCT(3, 0); + break; + + case 79: + drawGCT(_house + 5, 1); + break; + + case 110: + drawGCT(_house + 9, 2); + break; + + case 146: + drawGCT(17); + break; + + case 198: + drawGCT(13); + break; + + case 445: + drawGCT(14, 3); + break; + + case 455: + drawGCT(18, 4); + break; + + case 465: + drawGCT(19, 5); + break; + + case 475: + drawGCT(20, 6); + break; + + case 188: + case 228: + case 237: + case 257: + case 275: + case 426: + lightningEffect(); + break; + + case 203: + case 243: + case 252: + case 272: + case 290: + case 441: + playSound(kSoundThunder); + break; + + case 340: + playSound(kSoundCackle); + break; + } +} + +void Parents::handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons) { + if ((key == kKeyEscape) || (mouseButtons == kMouseButtonsRight)) + abortPlay(); + + if (((key == kKeySpace) || (mouseButtons == kMouseButtonsLeft)) && (_currentLoop < kLoopCount)) + skipLoop(_loopID[_currentLoop]); +} + +void Parents::playSound(Sound sound) { + _vm->_sound->blasterStop(0); + _vm->_sound->blasterPlay(&_sounds[sound], 0, 0); +} + +void Parents::lightningEffect() { + for (int i = 0; (i < 5) && !_vm->shouldQuit(); i++) { + + setPalette(_brightPalette, _paletteSize); + _vm->_util->delay(5); + + setPalette(_normalPalette, _paletteSize); + _vm->_util->delay(5); + } +} + +void Parents::setPalette(const byte *palette, uint size) { + memcpy(_vm->_draw->_vgaPalette, palette, 3 * size); + + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); + _vm->_video->retrace(); +} + +void Parents::drawGCT(uint item, uint loop) { + int16 left, top, right, bottom; + if (_gct->clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + if (_gct->draw(*_vm->_draw->_backSurface, item, *_font, 10, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + + _currentLoop = loop; +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/parents.h b/engines/gob/pregob/onceupon/parents.h new file mode 100644 index 000000000000..f5c8307b735e --- /dev/null +++ b/engines/gob/pregob/onceupon/parents.h @@ -0,0 +1,94 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_PARENTS_H +#define GOB_PREGOB_ONCEUPON_PARENTS_H + +#include "gob/sound/sounddesc.h" + +#include "gob/pregob/seqfile.h" + +namespace Gob { + +class Font; + +class GCTFile; + +namespace OnceUpon { + +/** The home / parents animation sequence. */ +class Parents : public SEQFile { +public: + Parents(GobEngine *vm, const Common::String &seq, const Common::String &gct, + const Common::String &childName, uint8 house, const Font &font, + const byte *normalPalette, const byte *brightPalette, uint paletteSize); + ~Parents(); + + void play(); + +protected: + void handleFrameEvent(); + void handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons); + +private: + static const uint kLoopCount = 7; + + static const uint16 kLoop[kLoopCount][3]; + + enum Sound { + kSoundCackle = 0, + kSoundThunder , + kSoundCount + }; + + static const char *kSound[kSoundCount]; + + + uint8 _house; + + const Font *_font; + + uint _paletteSize; + const byte *_normalPalette; + const byte *_brightPalette; + + SoundDesc _sounds[kSoundCount]; + + GCTFile *_gct; + + uint _loopID[kLoopCount]; + uint _currentLoop; + + + void lightningEffect(); + + void playSound(Sound sound); + void setPalette(const byte *palette, uint size); + + void drawGCT(uint item, uint loop = 0xFFFF); +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_PARENTS_H diff --git a/engines/gob/pregob/onceupon/stork.cpp b/engines/gob/pregob/onceupon/stork.cpp new file mode 100644 index 000000000000..3c38037d087d --- /dev/null +++ b/engines/gob/pregob/onceupon/stork.cpp @@ -0,0 +1,234 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/str.h" + +#include "gob/gob.h" +#include "gob/surface.h" +#include "gob/anifile.h" +#include "gob/video.h" + +#include "gob/pregob/onceupon/stork.h" + +enum Animation { + kAnimFlyNearWithBundle = 9, + kAnimFlyFarWithBundle = 12, + kAnimFlyNearWithoutBundle = 10, + kAnimFlyFarWithoutBundle = 13, + kAnimBundleNear = 11, + kAnimBundleFar = 14 +}; + +namespace Gob { + +namespace OnceUpon { + +Stork::Stork(GobEngine *vm, const ANIFile &ani) : ANIObject(ani), _shouldDrop(false) { + _frame = new Surface(320, 200, 1); + vm->_video->drawPackedSprite("cadre.cmp", *_frame); + + _bundle = new ANIObject(ani); + + _bundle->setVisible(false); + _bundle->setPause(true); + + setState(kStateFlyNearWithBundle, kAnimFlyNearWithBundle, -80); +} + +Stork::~Stork() { + delete _frame; + + delete _bundle; +} + +bool Stork::hasBundleLanded() const { + if (!_shouldDrop || !_bundle->isVisible() || _bundle->isPaused()) + return false; + + int16 x, y, width, height; + _bundle->getFramePosition(x, y); + _bundle->getFrameSize(width, height); + + return (y + height) >= _bundleDrop.landY; +} + +void Stork::dropBundle(const BundleDrop &drop) { + if (_shouldDrop) + return; + + _shouldDrop = true; + _bundleDrop = drop; +} + +bool Stork::draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { + left = 0x7FFF; + top = 0x7FFF; + right = 0x0000; + bottom = 0x0000; + + bool drawn = ANIObject::draw(dest, left, top, right, bottom); + if (drawn) { + // Left frame edge + if (left <= 15) + dest.blit(*_frame, left, top, MIN(15, right), bottom, left, top); + + // Right frame edge + if (right >= 304) + dest.blit(*_frame, MAX(304, left), top, right, bottom, MAX(304, left), top); + } + + int16 bLeft, bTop, bRight, bBottom; + if (_bundle->draw(dest, bLeft, bTop, bRight, bBottom)) { + // Bottom frame edge + if (bBottom >= 188) + dest.blit(*_frame, bLeft, MAX(188, bTop), bRight, bBottom, bLeft, MAX(188, bTop)); + + left = MIN(left , bLeft ); + top = MIN(top , bTop ); + right = MAX(right , bRight ); + bottom = MAX(bottom, bBottom); + + drawn = true; + } + + return drawn; +} + +bool Stork::clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) { + left = 0x7FFF; + top = 0x7FFF; + right = 0x0000; + bottom = 0x0000; + + bool cleared = _bundle->clear(dest, left, top, right, bottom); + + int16 sLeft, sTop, sRight, sBottom; + if (ANIObject::clear(dest, sLeft, sTop, sRight, sBottom)) { + left = MIN(left , sLeft ); + top = MIN(top , sTop ); + right = MAX(right , sRight ); + bottom = MAX(bottom, sBottom); + + cleared = true; + } + + return cleared; +} + +void Stork::advance() { + _bundle->advance(); + + ANIObject::advance(); + + int16 curX, curY, curWidth, curHeight; + getFramePosition(curX, curY, 0); + getFrameSize(curWidth, curHeight, 0); + + const int16 curRight = curX + curWidth - 1; + + int16 nextX, nextY, nextWidth, nextHeight; + getFramePosition(nextX, nextY, 1); + getFrameSize(nextWidth, nextHeight, 1); + + const int16 nextRight = nextX + nextWidth - 1; + + switch (_state) { + case kStateFlyNearWithBundle: + if (curX >= 330) + setState(kStateFlyFarWithBundle, kAnimFlyFarWithBundle, 330); + + if ((curRight <= _bundleDrop.dropX) && + (nextRight >= _bundleDrop.dropX) && _shouldDrop && !_bundleDrop.dropWhileFar) + dropBundle(kStateFlyNearWithoutBundle, kAnimFlyNearWithoutBundle); + + break; + + case kStateFlyFarWithBundle: + if (curX <= -80) + setState(kStateFlyNearWithBundle, kAnimFlyNearWithBundle, -80); + + if ((curX >= _bundleDrop.dropX) && + (nextX <= _bundleDrop.dropX) && _shouldDrop && _bundleDrop.dropWhileFar) + dropBundle(kStateFlyFarWithoutBundle, kAnimFlyFarWithoutBundle); + + break; + + case kStateFlyNearWithoutBundle: + if (curX >= 330) + setState(kStateFlyFarWithoutBundle, kAnimFlyFarWithoutBundle, 330); + break; + + case kStateFlyFarWithoutBundle: + if (curX <= -80) + setState(kStateFlyNearWithoutBundle, kAnimFlyNearWithoutBundle, -80); + break; + + default: + break; + } +} + +void Stork::dropBundle(State state, uint16 anim) { + setState(state, anim); + + int16 x, y, width, height; + getFramePosition(x, y); + getFrameSize(width, height); + + _bundle->setAnimation(_bundleDrop.anim); + _bundle->setPause(false); + _bundle->setVisible(true); + + int16 bWidth, bHeight; + _bundle->getFrameSize(bWidth, bHeight); + + // Drop position + x = _bundleDrop.dropX; + y = y + height - bHeight; + + // If the stork is flying near (from left to right), drop the bundle at the right edge + if (!_bundleDrop.dropWhileFar) + x = x - bWidth; + + _bundle->setPosition(x, y); +} + +void Stork::setState(State state, uint16 anim) { + setAnimation(anim); + setVisible(true); + setPause(false); + + _state = state; +} + +void Stork::setState(State state, uint16 anim, int16 x) { + setState(state, anim); + setPosition(); + + int16 pX, pY; + getPosition(pX, pY); + setPosition( x, pY); +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/stork.h b/engines/gob/pregob/onceupon/stork.h new file mode 100644 index 000000000000..756f5258c773 --- /dev/null +++ b/engines/gob/pregob/onceupon/stork.h @@ -0,0 +1,103 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_STORK_H +#define GOB_PREGOB_ONCEUPON_STORK_H + +#include "common/system.h" + +#include "gob/aniobject.h" + +namespace Common { + class String; +} + +namespace Gob { + +class GobEngine; + +class Surface; +class ANIFile; + +namespace OnceUpon { + +/** The stork in Baba Yaga / dragon in Abracadabra. */ +class Stork : public ANIObject { +public: + /** Information on how to drop the bundle. */ + struct BundleDrop { + int16 anim; ///< Animation of the bundle floating down + + int16 dropX; ///< X position the stork drops the bundle + int16 landY; ///< Y position the bundle lands + + bool dropWhileFar; ///< Does the stork drop the bundle while far instead of near? + }; + + Stork(GobEngine *vm, const ANIFile &ani); + ~Stork(); + + /** Has the bundle landed? */ + bool hasBundleLanded() const; + + /** Drop the bundle. */ + void dropBundle(const BundleDrop &drop); + + /** Draw the current frame onto the surface and return the affected rectangle. */ + bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); + /** Draw the current frame from the surface and return the affected rectangle. */ + bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); + + /** Advance the animation to the next frame. */ + void advance(); + +private: + enum State { + kStateFlyNearWithBundle = 0, + kStateFlyFarWithBundle , + kStateFlyNearWithoutBundle , + kStateFlyFarWithoutBundle + }; + + + GobEngine *_vm; + + Surface *_frame; + ANIObject *_bundle; + + State _state; + + bool _shouldDrop; + BundleDrop _bundleDrop; + + + void setState(State state, uint16 anim); + void setState(State state, uint16 anim, int16 x); + + void dropBundle(State state, uint16 anim); +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_STORK_H diff --git a/engines/gob/pregob/onceupon/title.cpp b/engines/gob/pregob/onceupon/title.cpp new file mode 100644 index 000000000000..5163ff6822b8 --- /dev/null +++ b/engines/gob/pregob/onceupon/title.cpp @@ -0,0 +1,117 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gob/gob.h" +#include "gob/global.h" +#include "gob/palanim.h" +#include "gob/draw.h" + +#include "gob/sound/sound.h" + +#include "gob/pregob/onceupon/title.h" + +namespace Gob { + +namespace OnceUpon { + +Title::Title(GobEngine *vm) : SEQFile(vm, "ville.seq") { +} + +Title::~Title() { +} + +void Title::play() { + SEQFile::play(true, 0xFFFF, 15); + + // After playback, fade out and stop the music + if (!_vm->shouldQuit()) + _vm->_palAnim->fade(0, 0, 0); + + stopMusic(); +} + +void Title::handleFrameEvent() { + // On fame 0, start the music and fade in + if (getFrame() == 0) { + playMusic(); + + _vm->_draw->forceBlit(); + _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0); + } +} + +void Title::playMusic() { + // Look at what platform this is and play the appropriate music type + + if (_vm->getPlatform() == Common::kPlatformPC) + playMusicDOS(); + else if (_vm->getPlatform() == Common::kPlatformAmiga) + playMusicAmiga(); + else if (_vm->getPlatform() == Common::kPlatformAtariST) + playMusicAtariST(); +} + +void Title::playMusicDOS() { + // Play an AdLib track + + _vm->_sound->adlibLoadTBR("babayaga.tbr"); + _vm->_sound->adlibLoadMDY("babayaga.mdy"); + _vm->_sound->adlibSetRepeating(-1); + _vm->_sound->adlibPlay(); +} + +void Title::playMusicAmiga() { + // Play a Protracker track + + _vm->_sound->protrackerPlay("mod.babayaga"); +} + +void Title::playMusicAtariST() { + // Play a Soundblaster composition + + static const int16 titleMusic[21] = { 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, -1}; + static const char * const titleFiles[ 3] = {"baba1.snd", "baba2.snd", "baba3.snd"}; + + for (uint i = 0; i < ARRAYSIZE(titleFiles); i++) + _vm->_sound->sampleLoad(_vm->_sound->sampleGetBySlot(i), SOUND_SND, titleFiles[i]); + + _vm->_sound->blasterPlayComposition(titleMusic, 0); + _vm->_sound->blasterRepeatComposition(-1); +} + +void Title::stopMusic() { + // Just stop everything + + _vm->_sound->adlibSetRepeating(0); + _vm->_sound->blasterRepeatComposition(0); + + _vm->_sound->adlibStop(); + _vm->_sound->blasterStopComposition(); + _vm->_sound->protrackerStop(); + + for (int i = 0; i < ::Gob::Sound::kSoundsCount; i++) + _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(i)); +} + +} // End of namespace OnceUpon + +} // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/title.h b/engines/gob/pregob/onceupon/title.h new file mode 100644 index 000000000000..5e7ef76d4058 --- /dev/null +++ b/engines/gob/pregob/onceupon/title.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_TITLE_H +#define GOB_PREGOB_ONCEUPON_TITLE_H + +#include "gob/pregob/seqfile.h" + +namespace Gob { + +namespace OnceUpon { + +/** The Once Upon A Time title animation sequence. */ +class Title : public SEQFile { +public: + Title(GobEngine *vm); + ~Title(); + + void play(); + +protected: + void handleFrameEvent(); + +private: + void playMusic(); ///< Play the title music. + void playMusicDOS(); ///< Play the title music of the DOS version. + void playMusicAmiga(); ///< Play the title music of the Amiga version. + void playMusicAtariST(); ///< Play the title music of the Atari ST version. + void stopMusic(); ///< Stop the title music. +}; + +} // End of namespace OnceUpon + +} // End of namespace Gob + +#endif // GOB_PREGOB_ONCEUPON_TITLE_H diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp new file mode 100644 index 000000000000..54eb3c6795df --- /dev/null +++ b/engines/gob/pregob/pregob.cpp @@ -0,0 +1,351 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "graphics/cursorman.h" + +#include "gob/gob.h" +#include "gob/global.h" +#include "gob/util.h" +#include "gob/surface.h" +#include "gob/dataio.h" +#include "gob/palanim.h" +#include "gob/draw.h" +#include "gob/video.h" +#include "gob/aniobject.h" + +#include "gob/sound/sound.h" + +#include "gob/pregob/pregob.h" +#include "gob/pregob/gctfile.h" + + +namespace Gob { + +const char PreGob::kLanguageSuffixShort[5] = { 't', 'g', 'a', 'e', 'i'}; +const char *PreGob::kLanguageSuffixLong [5] = {"fr", "al", "an", "it", "es"}; + + +PreGob::PreGob(GobEngine *vm) : _vm(vm), _fadedOut(false) { +} + +PreGob::~PreGob() { +} + +void PreGob::fadeOut() { + if (_fadedOut || _vm->shouldQuit()) + return; + + // Fade to black + _vm->_palAnim->fade(0, 0, 0); + + _fadedOut = true; +} + +void PreGob::fadeIn() { + if (!_fadedOut || _vm->shouldQuit()) + return; + + // Fade to palette + _vm->_draw->blitInvalidated(); + _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0); + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199); + + _fadedOut = false; +} + +void PreGob::clearScreen() { + _vm->_draw->_backSurface->clear(); + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199); + _vm->_draw->blitInvalidated(); + _vm->_video->retrace(); +} + +void PreGob::initScreen() { + _vm->_util->setFrameRate(15); + + _fadedOut = true; + + _vm->_draw->initScreen(); + + _vm->_draw->_backSurface->clear(); + _vm->_util->clearPalette(); + + _vm->_draw->forceBlit(); + _vm->_video->retrace(); + + _vm->_util->processInput(); +} + +void PreGob::setPalette(const byte *palette, uint16 size) { + memcpy(_vm->_draw->_vgaPalette, palette, 3 * size); + + // If we didn't fade out prior, immediately set the palette + if (!_fadedOut) + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); +} + +void PreGob::addCursor() { + CursorMan.pushCursor(0, 0, 0, 0, 0, 0); +} + +void PreGob::removeCursor() { + CursorMan.popCursor(); +} + +void PreGob::setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY) { + CursorMan.replaceCursor(sprite.getData(), sprite.getWidth(), sprite.getHeight(), hotspotX, hotspotY, 0); +} + +void PreGob::setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom, + int16 hotspotX, int16 hotspotY) { + + const int width = right - left + 1; + const int height = bottom - top + 1; + + if ((width <= 0) || (height <= 0)) + return; + + Surface cursor(width, height, 1); + + cursor.blit(sprite, left, top, right, bottom, 0, 0); + + setCursor(cursor, hotspotX, hotspotX); +} + +void PreGob::showCursor() { + CursorMan.showMouse(true); + + _vm->_draw->_showCursor = 4; +} + +void PreGob::hideCursor() { + CursorMan.showMouse(false); + + _vm->_draw->_showCursor = 0; +} + +bool PreGob::isCursorVisible() const { + return CursorMan.isVisible(); +} + +void PreGob::loadSounds(const char * const *sounds, uint soundCount) { + freeSounds(); + + _sounds.resize(soundCount); + + for (uint i = 0; i < soundCount; i++) + loadSound(_sounds[i], sounds[i]); +} + +void PreGob::freeSounds() { + _sounds.clear(); +} + +bool PreGob::loadSound(SoundDesc &sound, const Common::String &file) const { + return _vm->_sound->sampleLoad(&sound, SOUND_SND, file.c_str()); +} + +void PreGob::playSound(uint sound, int16 frequency, int16 repCount) { + if (sound >= _sounds.size()) + return; + + _vm->_sound->blasterPlay(&_sounds[sound], repCount, frequency); +} + +void PreGob::stopSound() { + _vm->_sound->blasterStop(0); +} + +void PreGob::playSoundFile(const Common::String &file, int16 frequency, int16 repCount, bool interruptible) { + stopSound(); + + SoundDesc sound; + if (!loadSound(sound, file)) + return; + + _vm->_sound->blasterPlay(&sound, repCount, frequency); + + _vm->_util->forceMouseUp(); + + bool finished = false; + while (!_vm->shouldQuit() && !finished && _vm->_sound->blasterPlayingSound()) { + endFrame(true); + + finished = hasInput(); + } + + _vm->_util->forceMouseUp(); + + stopSound(); +} + +void PreGob::beep(int16 frequency, int32 length) { + _vm->_sound->speakerOn(frequency, length); +} + +void PreGob::endFrame(bool doInput) { + _vm->_draw->blitInvalidated(); + _vm->_util->waitEndFrame(); + + if (doInput) + _vm->_util->processInput(); +} + +int16 PreGob::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) { + _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons); + _vm->_util->forceMouseUp(); + + return _vm->_util->checkKey(); +} + +int16 PreGob::waitInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) { + bool finished = false; + + int16 key = 0; + while (!_vm->shouldQuit() && !finished) { + endFrame(true); + + key = checkInput(mouseX, mouseY, mouseButtons); + + finished = (mouseButtons != kMouseButtonsNone) || (key != 0); + } + + return key; +} + +int16 PreGob::waitInput() { + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + return waitInput(mouseX, mouseY, mouseButtons); +} + +bool PreGob::hasInput() { + int16 mouseX, mouseY; + MouseButtons mouseButtons; + + return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone); +} + +void PreGob::clearAnim(ANIObject &anim) { + int16 left, top, right, bottom; + + if (anim.clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); +} + +void PreGob::drawAnim(ANIObject &anim) { + int16 left, top, right, bottom; + + if (anim.draw(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + anim.advance(); +} + +void PreGob::redrawAnim(ANIObject &anim) { + clearAnim(anim); + drawAnim(anim); +} + +void PreGob::clearAnim(const ANIList &anims) { + for (int i = (anims.size() - 1); i >= 0; i--) + clearAnim(*anims[i]); +} + +void PreGob::drawAnim(const ANIList &anims) { + for (ANIList::const_iterator a = anims.begin(); a != anims.end(); ++a) + drawAnim(**a); +} + +void PreGob::redrawAnim(const ANIList &anims) { + clearAnim(anims); + drawAnim(anims); +} + +void PreGob::loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const { + freeAnims(anims); + + anims.resize(count); + for (uint i = 0; i < count; i++) { + anims[i] = new ANIObject(ani); + + setAnim(*anims[i], props[i]); + } +} + +void PreGob::freeAnims(ANIList &anims) const { + for (ANIList::iterator a = anims.begin(); a != anims.end(); ++a) + delete *a; + + anims.clear(); +} + +void PreGob::setAnim(ANIObject &anim, const AnimProperties &props) const { + anim.setAnimation(props.animation); + anim.setFrame(props.frame); + anim.setMode(props.mode); + anim.setPause(props.paused); + anim.setVisible(props.visible); + + if (props.hasPosition) + anim.setPosition(props.x, props.y); + else + anim.setPosition(); +} + +Common::String PreGob::getLocFile(const Common::String &file) const { + if (_vm->_global->_language >= ARRAYSIZE(kLanguageSuffixShort)) + return file; + + return file + kLanguageSuffixShort[_vm->_global->_language]; +} + +TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) const { + Common::SeekableReadStream *txtStream = _vm->_dataIO->getFile(txtFile); + if (!txtStream) + error("PreGob::loadTXT(): Failed to open \"%s\"", txtFile.c_str()); + + TXTFile *txt = new TXTFile(*txtStream, format); + + delete txtStream; + + fixTXTStrings(*txt); + + return txt; +} + +void PreGob::fixTXTStrings(TXTFile &txt) const { +} + +GCTFile *PreGob::loadGCT(const Common::String &gctFile) const { + Common::SeekableReadStream *gctStream = _vm->_dataIO->getFile(gctFile); + if (!gctStream) + error("PreGob::loadGCT(): Failed to open \"%s\"", gctFile.c_str()); + + GCTFile *gct = new GCTFile(*gctStream, _vm->_rnd); + + delete gctStream; + + return gct; +} + +} // End of namespace Gob diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h new file mode 100644 index 000000000000..632f85b88e3a --- /dev/null +++ b/engines/gob/pregob/pregob.h @@ -0,0 +1,194 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_PREGOB_H +#define GOB_PREGOB_PREGOB_H + +#include "common/str.h" +#include "common/array.h" + +#include "gob/util.h" +#include "gob/aniobject.h" + +#include "gob/sound/sounddesc.h" + +#include "gob/pregob/txtfile.h" + +namespace Gob { + +class GobEngine; +class Surface; + +class GCTFile; + +class PreGob { +public: + PreGob(GobEngine *vm); + virtual ~PreGob(); + + virtual void run() = 0; + + struct AnimProperties { + uint16 animation; + uint16 frame; + + ANIObject::Mode mode; + + bool visible; + bool paused; + + bool hasPosition; + int16 x; + int16 y; + }; + +protected: + typedef Common::Array ANIList; + + static const char kLanguageSuffixShort[5]; + static const char *kLanguageSuffixLong [5]; + + + GobEngine *_vm; + + + // -- Graphics -- + + /** Initialize the game screen. */ + void initScreen(); + + void fadeOut(); ///< Fade to black. + void fadeIn(); ///< Fade to the current palette. + + void clearScreen(); + + /** Change the palette. + * + * @param palette The palette to change to. + * @param size Size of the palette in colors. + */ + void setPalette(const byte *palette, uint16 size); ///< Change the palette + + /** Add a new cursor that can be manipulated to the stack. */ + void addCursor(); + /** Remove the top-most cursor from the stack. */ + void removeCursor(); + + /** Set the current cursor. */ + void setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY); + /** Set the current cursor. */ + void setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom, + int16 hotspotX, int16 hotspotY); + + /** Show the cursor. */ + void showCursor(); + /** Hide the cursor. */ + void hideCursor(); + + /** Is the cursor currently visible? */ + bool isCursorVisible() const; + + /** Remove an animation from the screen. */ + void clearAnim(ANIObject &anim); + /** Draw an animation to the screen, advancing it. */ + void drawAnim(ANIObject &anim); + /** Clear and draw an animation to the screen, advancing it. */ + void redrawAnim(ANIObject &anim); + + /** Remove animations from the screen. */ + void clearAnim(const ANIList &anims); + /** Draw animations to the screen, advancing them. */ + void drawAnim(const ANIList &anims); + /** Clear and draw animations to the screen, advancing them. */ + void redrawAnim(const ANIList &anims); + + void loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const; + void freeAnims(ANIList &anims) const; + + void setAnim(ANIObject &anim, const AnimProperties &props) const; + + /** Wait for the frame to end, handling screen updates and optionally update input. */ + void endFrame(bool doInput); + + + // -- Sound -- + + /** Load all sounds that can be played interactively in the game. */ + void loadSounds(const char * const *sounds, uint soundCount); + /** Free all loaded sound. */ + void freeSounds(); + + /** Play a loaded sound. */ + void playSound(uint sound, int16 frequency = 0, int16 repCount = 0); + /** Stop all sound playback. */ + void stopSound(); + + /** Play a sound until it ends or is interrupted by a keypress. */ + void playSoundFile(const Common::String &file, int16 frequency = 0, int16 repCount = 0, bool interruptible = true); + + /** Beep the PC speaker. */ + void beep(int16 frequency, int32 length); + + + // -- Input -- + + /** Check mouse and keyboard input. */ + int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons); + /** Wait for mouse or keyboard input. */ + int16 waitInput (int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons); + /** Wait for mouse or keyboard input, but don't care about what was done with the mouse. */ + int16 waitInput(); + /** Did we have mouse or keyboard input? */ + bool hasInput(); + + + // -- TXT helpers -- + + /** Get the name of a localized file. */ + Common::String getLocFile(const Common::String &file) const; + /** Open a TXT file. */ + TXTFile *loadTXT(const Common::String &txtFile, TXTFile::Format format) const; + + /** Called by loadTXT() to fix strings within the TXT file. */ + virtual void fixTXTStrings(TXTFile &txt) const; + + + // -- GCT helpers -- + + GCTFile *loadGCT(const Common::String &gctFile) const; + + +private: + /** Did we fade out? */ + bool _fadedOut; + + /** All loaded sounds. */ + Common::Array _sounds; + + + /** Load a sound file. */ + bool loadSound(SoundDesc &sound, const Common::String &file) const; +}; + +} // End of namespace Gob + +#endif // GOB_PREGOB_PREGOB_H diff --git a/engines/gob/pregob/seqfile.cpp b/engines/gob/pregob/seqfile.cpp new file mode 100644 index 000000000000..91973bbb8535 --- /dev/null +++ b/engines/gob/pregob/seqfile.cpp @@ -0,0 +1,384 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/str.h" +#include "common/stream.h" + +#include "gob/gob.h" +#include "gob/dataio.h" +#include "gob/draw.h" +#include "gob/decfile.h" +#include "gob/anifile.h" +#include "gob/aniobject.h" + +#include "gob/pregob/seqfile.h" + +namespace Gob { + +SEQFile::SEQFile(GobEngine *vm, const Common::String &fileName) : _vm(vm) { + for (uint i = 0; i < kObjectCount; i++) + _objects[i].object = 0; + + Common::SeekableReadStream *seq = _vm->_dataIO->getFile(Util::setExtension(fileName, ".SEQ")); + if (!seq) { + warning("SEQFile::SEQFile(): No such file \"%s\"", fileName.c_str()); + return; + } + + load(*seq); + + delete seq; +} + +SEQFile::~SEQFile() { + for (uint i = 0; i < kObjectCount; i++) + delete _objects[i].object; + + for (Backgrounds::iterator b = _backgrounds.begin(); b != _backgrounds.end(); ++b) + delete *b; + + for (Animations::iterator a = _animations.begin(); a != _animations.end(); ++a) + delete *a; +} + +void SEQFile::load(Common::SeekableReadStream &seq) { + const uint16 decCount = (uint16)seq.readByte() + 1; + const uint16 aniCount = (uint16)seq.readByte() + 1; + + // Load backgrounds + _backgrounds.reserve(decCount); + for (uint i = 0; i < decCount; i++) { + const Common::String dec = Util::readString(seq, 13); + + if (!_vm->_dataIO->hasFile(dec)) { + warning("SEQFile::load(): No such background \"%s\"", dec.c_str()); + return; + } + + _backgrounds.push_back(new DECFile(_vm, dec, 320, 200)); + } + + // Load animations + _animations.reserve(aniCount); + for (uint i = 0; i < aniCount; i++) { + const Common::String ani = Util::readString(seq, 13); + + if (!_vm->_dataIO->hasFile(ani)) { + warning("SEQFile::load(): No such animation \"%s\"", ani.c_str()); + return; + } + + _animations.push_back(new ANIFile(_vm, ani)); + } + + _frameRate = seq.readUint16LE(); + + // Load background change keys + + const uint16 bgKeyCount = seq.readUint16LE(); + _bgKeys.resize(bgKeyCount); + + for (uint16 i = 0; i < bgKeyCount; i++) { + const uint16 frame = seq.readUint16LE(); + const uint16 index = seq.readUint16LE(); + + _bgKeys[i].frame = frame; + _bgKeys[i].background = index < _backgrounds.size() ? _backgrounds[index] : 0; + } + + // Load animation keys for all 4 objects + + for (uint i = 0; i < kObjectCount; i++) { + const uint16 animKeyCount = seq.readUint16LE(); + _animKeys.reserve(_animKeys.size() + animKeyCount); + + for (uint16 j = 0; j < animKeyCount; j++) { + _animKeys.push_back(AnimationKey()); + + const uint16 frame = seq.readUint16LE(); + const uint16 index = seq.readUint16LE(); + + uint16 animation; + const ANIFile *ani = findANI(index, animation); + + _animKeys.back().object = i; + _animKeys.back().frame = frame; + _animKeys.back().ani = ani; + _animKeys.back().animation = animation; + _animKeys.back().x = seq.readSint16LE(); + _animKeys.back().y = seq.readSint16LE(); + _animKeys.back().order = seq.readSint16LE(); + } + } + +} + +const ANIFile *SEQFile::findANI(uint16 index, uint16 &animation) { + animation = 0xFFFF; + + // 0xFFFF = remove animation + if (index == 0xFFFF) + return 0; + + for (Animations::const_iterator a = _animations.begin(); a != _animations.end(); ++a) { + if (index < (*a)->getAnimationCount()) { + animation = index; + return *a; + } + + index -= (*a)->getAnimationCount(); + } + + return 0; +} + +void SEQFile::play(bool abortable, uint16 endFrame, uint16 frameRate) { + if (_bgKeys.empty() && _animKeys.empty()) + // Nothing to do + return; + + // Init + + _frame = 0; + _abortPlay = false; + + for (uint i = 0; i < kObjectCount; i++) { + delete _objects[i].object; + + _objects[i].object = 0; + _objects[i].order = 0; + } + + for (Loops::iterator l = _loops.begin(); l != _loops.end(); ++l) + l->currentLoop = 0; + + // Set the frame rate + + int16 frameRateBack = _vm->_util->getFrameRate(); + + if (frameRate == 0) + frameRate = _frameRate; + + _vm->_util->setFrameRate(frameRate); + + _abortable = abortable; + + while (!_vm->shouldQuit() && !_abortPlay) { + // Handle the frame contents + playFrame(); + + // Handle extra frame events + handleFrameEvent(); + + // Wait for the frame to end + _vm->_draw->blitInvalidated(); + _vm->_util->waitEndFrame(); + + // Handle input + + _vm->_util->processInput(); + + int16 key = _vm->_util->checkKey(); + + int16 mouseX, mouseY; + MouseButtons mouseButtons; + _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons); + _vm->_util->forceMouseUp(); + + handleInput(key, mouseX, mouseY, mouseButtons); + + // Loop + + bool looped = false; + for (Loops::iterator l = _loops.begin(); l != _loops.end(); ++l) { + if ((l->endFrame == _frame) && (l->currentLoop < l->loopCount)) { + _frame = l->startFrame; + + l->currentLoop++; + looped = true; + } + } + + // If we didn't loop, advance the frame and look if we should end here + + if (!looped) { + _frame++; + if (_frame >= endFrame) + break; + } + } + + // Restore the frame rate + _vm->_util->setFrameRate(frameRateBack); +} + +void SEQFile::playFrame() { + // Remove the current animation frames + clearAnims(); + + // Handle background keys, directly updating the background + for (BackgroundKeys::const_iterator b = _bgKeys.begin(); b != _bgKeys.end(); ++b) { + if (!b->background || (b->frame != _frame)) + continue; + + b->background->draw(*_vm->_draw->_backSurface); + + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199); + } + + // Handle the animation keys, updating the objects + for (AnimationKeys::const_iterator a = _animKeys.begin(); a != _animKeys.end(); ++a) { + if (a->frame != _frame) + continue; + + Object &object = _objects[a->object]; + + delete object.object; + object.object = 0; + + // No valid animation => remove + if ((a->animation == 0xFFFF) || !a->ani) + continue; + + // Change the animation + + object.object = new ANIObject(*a->ani); + + object.object->setAnimation(a->animation); + object.object->setPosition(a->x, a->y); + object.object->setVisible(true); + object.object->setPause(false); + + object.order = a->order; + } + + // Draw the animations + drawAnims(); +} + +// NOTE: This is really not at all efficient. However, since there's only a +// small number of objects, it should matter. We really do need a stable +// sort, though, so Common::sort() is out. +SEQFile::Objects SEQFile::getOrderedObjects() { + int16 minOrder = (int16)0x7FFF; + int16 maxOrder = (int16)0x8000; + + Objects objects; + + // Find the span of order values + for (uint i = 0; i < kObjectCount; i++) { + if (!_objects[i].object) + continue; + + minOrder = MIN(minOrder, _objects[i].order); + maxOrder = MAX(maxOrder, _objects[i].order); + } + + // Stably sort the objects by order value + for (int16 o = minOrder; o <= maxOrder; o++) + for (uint i = 0; i < kObjectCount; i++) + if (_objects[i].object && (_objects[i].order == o)) + objects.push_back(_objects[i]); + + return objects; +} + +void SEQFile::clearAnims() { + Objects objects = getOrderedObjects(); + + // Remove the animation frames, in reverse drawing order + for (Objects::iterator o = objects.reverse_begin(); o != objects.end(); --o) { + int16 left, top, right, bottom; + + if (o->object->clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + } +} + +void SEQFile::drawAnims() { + Objects objects = getOrderedObjects(); + + // Draw the animation frames and advance the animation + for (Objects::iterator o = objects.begin(); o != objects.end(); ++o) { + int16 left, top, right, bottom; + + if (o->object->draw(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + + o->object->advance(); + } +} + +uint16 SEQFile::getFrame() const { + return _frame; +} + +void SEQFile::seekFrame(uint16 frame) { + _frame = frame; +} + +uint SEQFile::addLoop(uint16 startFrame, uint16 endFrame, uint16 loopCount) { + _loops.resize(_loops.size() + 1); + + _loops.back().startFrame = startFrame; + _loops.back().endFrame = endFrame; + _loops.back().loopCount = loopCount; + _loops.back().currentLoop = 0; + _loops.back().empty = false; + + return _loops.size() - 1; +} + +void SEQFile::skipLoop(uint loopID) { + if (loopID >= _loops.size()) + return; + + _loops[loopID].currentLoop = 0xFFFF; +} + +void SEQFile::delLoop(uint loopID) { + if (loopID >= _loops.size()) + return; + + _loops[loopID].empty = true; + + cleanLoops(); +} + +void SEQFile::cleanLoops() { + while (!_loops.empty() && _loops.back().empty) + _loops.pop_back(); +} + +void SEQFile::abortPlay() { + _abortPlay = true; +} + +void SEQFile::handleFrameEvent() { +} + +void SEQFile::handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons) { + if (_abortable && ((key != 0) || (mouseButtons != kMouseButtonsNone))) + abortPlay(); +} + +} // End of namespace Gob diff --git a/engines/gob/pregob/seqfile.h b/engines/gob/pregob/seqfile.h new file mode 100644 index 000000000000..5e12962ef96a --- /dev/null +++ b/engines/gob/pregob/seqfile.h @@ -0,0 +1,193 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_SEQFILE_H +#define GOB_PREGOB_SEQFILE_H + +#include "common/system.h" +#include "common/array.h" +#include "common/list.h" + +#include "gob/util.h" + +namespace Common { + class String; + class SeekableReadStream; +} + +namespace Gob { + +class GobEngine; + +class DECFile; +class ANIFile; +class ANIObject; + +/** A SEQ file, describing a complex animation sequence. + * + * Used in early hardcoded gob games. + * The principle is similar to the Mult class (see mult.h), but instead + * of depending on all the externally loaded animations, backgrounds and + * objects, a SEQ file references animation and background directly by + * filename. + */ +class SEQFile { +public: + SEQFile(GobEngine *vm, const Common::String &fileName); + virtual ~SEQFile(); + + /** Play the SEQ. + * + * @param abortable If true, end playback on any user input. + * @param endFrame The frame on where to end, or 0xFFFF for infinite playback. + * @param frameRate The frame rate at which to play the SEQ, or 0 for playing at + * the speed the SEQ itself wants to. + */ + void play(bool abortable = true, uint16 endFrame = 0xFFFF, uint16 frameRate = 0); + + +protected: + GobEngine *_vm; + + + /** Returns the current frame number. */ + uint16 getFrame() const; + + /** Seek to a specific frame. */ + void seekFrame(uint16 frame); + + /** Add a frame loop. */ + uint addLoop(uint16 startFrame, uint16 endFrame, uint16 loopCount); + + /** Skip a frame loop. */ + void skipLoop(uint loopID); + + /** Delete a frame loop. */ + void delLoop(uint loopID); + + /** Ends SEQ playback. */ + void abortPlay(); + + /** Callback for special frame events. */ + virtual void handleFrameEvent(); + /** Callback for special user input handling. */ + virtual void handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons); + + +private: + /** Number of animation objects that are visible at the same time. */ + static const uint kObjectCount = 4; + + /** A key for changing the background. */ + struct BackgroundKey { + uint16 frame; ///< Frame the change is to happen. + + const DECFile *background; ///< The background to use. + }; + + /** A key for playing an object animation. */ + struct AnimationKey { + uint object; ///< The object this key belongs to. + + uint16 frame; ///< Frame the change is to happen. + + const ANIFile *ani; ///< The ANI to use. + + uint16 animation; ///< The animation to use. + + int16 x; ///< X position of the animation. + int16 y; ///< Y position of the animation. + + int16 order; ///< Used to determine in which order to draw the objects. + }; + + /** A managed animation object. */ + struct Object { + ANIObject *object; ///< The actual animation object. + + int16 order; ///< The current drawing order. + }; + + /** A frame loop. */ + struct Loop { + uint16 startFrame; + uint16 endFrame; + + uint16 loopCount; + uint16 currentLoop; + + bool empty; + }; + + typedef Common::Array Backgrounds; + typedef Common::Array Animations; + + typedef Common::Array BackgroundKeys; + typedef Common::Array AnimationKeys; + + typedef Common::List Objects; + + typedef Common::Array Loops; + + + uint16 _frame; ///< The current frame. + bool _abortPlay; ///< Was the end of the playback requested? + + uint16 _frameRate; + + Backgrounds _backgrounds; ///< All backgrounds in this SEQ. + Animations _animations; ///< All animations in this SEQ. + + BackgroundKeys _bgKeys; ///< The background change keyframes. + AnimationKeys _animKeys; ///< The animation change keyframes. + + Object _objects[kObjectCount]; ///< The managed animation objects. + + Loops _loops; + + /** Whether the playback should be abortable by user input. */ + bool _abortable; + + + // -- Loading helpers -- + + void load(Common::SeekableReadStream &seq); + + const ANIFile *findANI(uint16 index, uint16 &animation); + + // -- Playback helpers -- + + void playFrame(); + + /** Get a list of objects ordered by drawing order. */ + Objects getOrderedObjects(); + + void clearAnims(); ///< Remove all animation frames. + void drawAnims(); ///< Draw the animation frames. + + /** Look if we can compact the loop array. */ + void cleanLoops(); +}; + +} // End of namespace Gob + +#endif // GOB_PREGOB_SEQFILE_H diff --git a/engines/gob/pregob/txtfile.cpp b/engines/gob/pregob/txtfile.cpp new file mode 100644 index 000000000000..3ff0d4b039e0 --- /dev/null +++ b/engines/gob/pregob/txtfile.cpp @@ -0,0 +1,232 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/stream.h" + +#include "gob/draw.h" + +#include "gob/pregob/txtfile.h" + +namespace Gob { + +TXTFile::TXTFile(Common::SeekableReadStream &txt, Format format) { + load(txt, format); +} + +TXTFile::~TXTFile() { +} + +TXTFile::LineArray &TXTFile::getLines() { + return _lines; +} + +void TXTFile::load(Common::SeekableReadStream &txt, Format format) { + if (format == kFormatStringPositionColorFont) { + int numLines = getInt(txt); + + _lines.reserve(numLines); + } + + while (!txt.eos()) { + Line line; + + line.text = getStr(txt); + line.x = (format >= kFormatStringPosition) ? getInt(txt) : 0; + line.y = (format >= kFormatStringPosition) ? getInt(txt) : 0; + line.color = (format >= kFormatStringPositionColor) ? getInt(txt) : 0; + line.font = (format >= kFormatStringPositionColorFont) ? getInt(txt) : 0; + + _lines.push_back(line); + } + + while (!_lines.empty() && _lines.back().text.empty()) + _lines.pop_back(); +} + +bool TXTFile::draw(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount, int color) { + + trashBuffer(); + + if (!getArea(left, top, right, bottom, fonts, fontCount)) + return false; + + resizeBuffer(right - left + 1, bottom - top + 1); + saveScreen(surface, left, top, right, bottom); + + for (LineArray::const_iterator l = _lines.begin(); l != _lines.end(); ++l) { + if (l->font >= fontCount) + continue; + + fonts[l->font]->drawString(l->text, l->x, l->y, (color < 0) ? l->color : color, 0, true, surface); + } + + return true; +} + +bool TXTFile::draw(uint line, Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount, int color) { + + trashBuffer(); + + if (!getArea(line, left, top, right, bottom, fonts, fontCount)) + return false; + + resizeBuffer(right - left + 1, bottom - top + 1); + saveScreen(surface, left, top, right, bottom); + + const Line &l = _lines[line]; + + fonts[l.font]->drawString(l.text, l.x, l.y, (color < 0) ? l.color : color, 0, true, surface); + + return true; +} + +bool TXTFile::draw(Surface &surface, const Font * const *fonts, uint fontCount, int color) { + int16 left, top, right, bottom; + + return draw(surface, left, top, right, bottom, fonts, fontCount, color); +} + +bool TXTFile::draw(uint line, Surface &surface, const Font * const *fonts, uint fontCount, int color) { + int16 left, top, right, bottom; + + return draw(line, surface, left, top, right, bottom, fonts, fontCount, color); +} + +bool TXTFile::clear(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom) { + return restoreScreen(surface, left, top, right, bottom); +} + +bool TXTFile::getArea(int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount) const { + + bool hasLine = false; + + left = 0x7FFF; + top = 0x7FFF; + right = 0x0000; + bottom = 0x0000; + + for (uint i = 0; i < _lines.size(); i++) { + int16 lLeft, lTop, lRight, lBottom; + + if (getArea(i, lLeft, lTop, lRight, lBottom, fonts, fontCount)) { + left = MIN(left , lLeft ); + top = MIN(top , lTop ); + right = MAX(right , lRight ); + bottom = MAX(bottom, lBottom); + + hasLine = true; + } + } + + return hasLine; +} + +bool TXTFile::getArea(uint line, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount) const { + + + if ((line >= _lines.size()) || (_lines[line].font >= fontCount)) + return false; + + const Line &l = _lines[line]; + + left = l.x; + top = l.y; + right = l.x + l.text.size() * fonts[l.font]->getCharWidth() - 1; + bottom = l.y + fonts[l.font]->getCharHeight() - 1; + + return true; +} + +Common::String TXTFile::getStr(Common::SeekableReadStream &txt) { + // Skip all ' ', '\n' and '\r' + while (!txt.eos()) { + char c = txt.readByte(); + if (txt.eos()) + break; + + if ((c != ' ') && (c != '\n') && (c != '\r')) { + txt.seek(-1, SEEK_CUR); + break; + } + } + + if (txt.eos()) + return ""; + + // Read string until ' ', '\n' or '\r' + Common::String string; + while (!txt.eos()) { + char c = txt.readByte(); + if ((c == ' ') || (c == '\n') || (c == '\r')) + break; + + string += c; + } + + // Replace all '#' with ' ' and throw out non-printables + Common::String cleanString; + + for (uint i = 0; i < string.size(); i++) { + if (string[i] == '#') + cleanString += ' '; + else if ((unsigned char)string[i] >= ' ') + cleanString += string[i]; + } + + return cleanString; +} + +int TXTFile::getInt(Common::SeekableReadStream &txt) { + // Skip all [^-0-9] + while (!txt.eos()) { + char c = txt.readByte(); + if (txt.eos()) + break; + + if ((c == '-') || ((c >= '0') && (c <= '9'))) { + txt.seek(-1, SEEK_CUR); + break; + } + } + + if (txt.eos()) + return 0; + + // Read until [^-0-9] + Common::String string; + while (!txt.eos()) { + char c = txt.readByte(); + if ((c != '-') && ((c < '0') || (c > '9'))) + break; + + string += c; + } + + // Convert to integer + return atoi(string.c_str()); +} + +} // End of namespace Gob diff --git a/engines/gob/pregob/txtfile.h b/engines/gob/pregob/txtfile.h new file mode 100644 index 000000000000..c623b5885945 --- /dev/null +++ b/engines/gob/pregob/txtfile.h @@ -0,0 +1,91 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GOB_PREGOB_TXTFILE_H +#define GOB_PREGOB_TXTFILE_H + +#include "common/system.h" +#include "common/str.h" +#include "common/array.h" + +#include "gob/backbuffer.h" + +namespace Common { + class SeekableReadStream; +} + +namespace Gob { + +class Surface; +class Font; + +class TXTFile : public BackBuffer { +public: + enum Format { + kFormatString, + kFormatStringPosition, + kFormatStringPositionColor, + kFormatStringPositionColorFont + }; + + struct Line { + Common::String text; + int x, y; + int color; + uint font; + }; + + typedef Common::Array LineArray; + + TXTFile(Common::SeekableReadStream &txt, Format format); + ~TXTFile(); + + LineArray &getLines(); + + bool draw( Surface &surface, const Font * const *fonts, uint fontCount, int color = -1); + bool draw(uint line, Surface &surface, const Font * const *fonts, uint fontCount, int color = -1); + + bool draw( Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount, int color = -1); + bool draw(uint line, Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount, int color = -1); + + bool clear(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom); + +private: + LineArray _lines; + + void load(Common::SeekableReadStream &txt, Format format); + + Common::String getStr(Common::SeekableReadStream &txt); + int getInt(Common::SeekableReadStream &txt); + + + bool getArea( int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount) const; + bool getArea(uint line, int16 &left, int16 &top, int16 &right, int16 &bottom, + const Font * const *fonts, uint fontCount) const; +}; + +} // End of namespace Gob + +#endif // GOB_PREGOB_TXTFILE_H diff --git a/engines/gob/rxyfile.cpp b/engines/gob/rxyfile.cpp index 9702dc8c7fff..2ff8c121cd8b 100644 --- a/engines/gob/rxyfile.cpp +++ b/engines/gob/rxyfile.cpp @@ -21,12 +21,19 @@ */ #include "common/stream.h" +#include "common/substream.h" #include "gob/rxyfile.h" namespace Gob { RXYFile::RXYFile(Common::SeekableReadStream &rxy) : _width(0), _height(0) { + Common::SeekableSubReadStreamEndian sub(&rxy, 0, rxy.size(), false, DisposeAfterUse::NO); + + load(sub); +} + +RXYFile::RXYFile(Common::SeekableSubReadStreamEndian &rxy) : _width(0), _height(0) { load(rxy); } @@ -64,22 +71,22 @@ const RXYFile::Coordinates &RXYFile::operator[](uint i) const { return _coords[i]; } -void RXYFile::load(Common::SeekableReadStream &rxy) { +void RXYFile::load(Common::SeekableSubReadStreamEndian &rxy) { if (rxy.size() < 2) return; rxy.seek(0); - _realCount = rxy.readUint16LE(); + _realCount = rxy.readUint16(); uint16 count = (rxy.size() - 2) / 8; _coords.resize(count); for (CoordArray::iterator c = _coords.begin(); c != _coords.end(); ++c) { - c->left = rxy.readUint16LE(); - c->right = rxy.readUint16LE(); - c->top = rxy.readUint16LE(); - c->bottom = rxy.readUint16LE(); + c->left = rxy.readUint16(); + c->right = rxy.readUint16(); + c->top = rxy.readUint16(); + c->bottom = rxy.readUint16(); if (c->left != 0xFFFF) { _width = MAX(_width , c->right + 1); diff --git a/engines/gob/rxyfile.h b/engines/gob/rxyfile.h index bc9600b5b012..4fd46c5e40a9 100644 --- a/engines/gob/rxyfile.h +++ b/engines/gob/rxyfile.h @@ -28,6 +28,7 @@ namespace Common { class SeekableReadStream; + class SeekableSubReadStreamEndian; } namespace Gob { @@ -46,6 +47,7 @@ class RXYFile { }; RXYFile(Common::SeekableReadStream &rxy); + RXYFile(Common::SeekableSubReadStreamEndian &rxy); RXYFile(uint16 width, uint16 height); ~RXYFile(); @@ -71,7 +73,7 @@ class RXYFile { uint16 _height; - void load(Common::SeekableReadStream &rxy); + void load(Common::SeekableSubReadStreamEndian &rxy); }; } // End of namespace Gob diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp index 403bd632a140..63af6aeef486 100644 --- a/engines/gob/sound/sound.cpp +++ b/engines/gob/sound/sound.cpp @@ -109,7 +109,7 @@ int Sound::sampleGetNextFreeSlot() const { return -1; } -bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist) { +bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName) { if (!sndDesc) return false; @@ -117,12 +117,15 @@ bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, int32 size; byte *data = _vm->_dataIO->getFile(fileName, size); - if (!data) { - warning("Can't open sample file \"%s\"", fileName); + + if (!data || !sndDesc->load(type, data, size)) { + delete data; + + warning("Sound::sampleLoad(): Failed to load sound \"%s\"", fileName); return false; } - return sndDesc->load(type, data, size); + return true; } void Sound::sampleFree(SoundDesc *sndDesc, bool noteAdLib, int index) { @@ -458,7 +461,7 @@ void Sound::blasterStop(int16 fadeLength, SoundDesc *sndDesc) { _blaster->stopSound(fadeLength, sndDesc); } -void Sound::blasterPlayComposition(int16 *composition, int16 freqVal, +void Sound::blasterPlayComposition(const int16 *composition, int16 freqVal, SoundDesc *sndDescs, int8 sndCount) { if (!_blaster) return; diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h index 6ad0ec54839a..bbc182d17215 100644 --- a/engines/gob/sound/sound.h +++ b/engines/gob/sound/sound.h @@ -51,7 +51,7 @@ class Sound { const SoundDesc *sampleGetBySlot(int slot) const; int sampleGetNextFreeSlot() const; - bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist = true); + bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName); void sampleFree(SoundDesc *sndDesc, bool noteAdLib = false, int index = -1); @@ -60,7 +60,7 @@ class Sound { int16 frequency, int16 fadeLength = 0); void blasterStop(int16 fadeLength, SoundDesc *sndDesc = 0); - void blasterPlayComposition(int16 *composition, int16 freqVal, + void blasterPlayComposition(const int16 *composition, int16 freqVal, SoundDesc *sndDescs = 0, int8 sndCount = kSoundsCount); void blasterStopComposition(); void blasterRepeatComposition(int32 repCount); diff --git a/engines/gob/sound/soundblaster.cpp b/engines/gob/sound/soundblaster.cpp index 19c234644827..f267eee32db9 100644 --- a/engines/gob/sound/soundblaster.cpp +++ b/engines/gob/sound/soundblaster.cpp @@ -88,7 +88,7 @@ void SoundBlaster::nextCompositionPos() { _compositionPos = -1; } -void SoundBlaster::playComposition(int16 *composition, int16 freqVal, +void SoundBlaster::playComposition(const int16 *composition, int16 freqVal, SoundDesc *sndDescs, int8 sndCount) { _compositionSamples = sndDescs; diff --git a/engines/gob/sound/soundblaster.h b/engines/gob/sound/soundblaster.h index c740ba2269b3..3c4968d6112a 100644 --- a/engines/gob/sound/soundblaster.h +++ b/engines/gob/sound/soundblaster.h @@ -41,7 +41,7 @@ class SoundBlaster : public SoundMixer { int16 frequency, int16 fadeLength = 0); void stopSound(int16 fadeLength, SoundDesc *sndDesc = 0); - void playComposition(int16 *composition, int16 freqVal, + void playComposition(const int16 *composition, int16 freqVal, SoundDesc *sndDescs = 0, int8 sndCount = 60); void stopComposition(); void endComposition(); diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 3eaf741be26b..afbb7c3bae28 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -684,6 +684,12 @@ void Surface::shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom, } +void Surface::recolor(uint8 from, uint8 to) { + for (Pixel p = get(); p.isValid(); ++p) + if (p.get() == from) + p.set(to); +} + void Surface::putPixel(uint16 x, uint16 y, uint32 color) { if ((x >= _width) || (y >= _height)) return; diff --git a/engines/gob/surface.h b/engines/gob/surface.h index 09be8d1a498d..8f895a791046 100644 --- a/engines/gob/surface.h +++ b/engines/gob/surface.h @@ -156,6 +156,8 @@ class Surface { void shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color, uint8 strength); + void recolor(uint8 from, uint8 to); + void putPixel(uint16 x, uint16 y, uint32 color); void drawLine(uint16 x0, uint16 y0, uint16 x1, uint16 y1, uint32 color); void drawRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color); diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 64dfcf9b12f3..5ac4ef024ea6 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -189,12 +189,27 @@ bool Util::getKeyFromBuffer(Common::KeyState &key) { return true; } +static const uint16 kLatin1ToCP850[] = { + 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, + 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, + 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8, + 0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1, + 0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, + 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 +}; + +int16 Util::toCP850(uint16 latin1) { + if ((latin1 < 0xA0) || ((latin1 - 0xA0) >= ARRAYSIZE(kLatin1ToCP850))) + return 0; + + return kLatin1ToCP850[latin1 - 0xA0]; +} + int16 Util::translateKey(const Common::KeyState &key) { static struct keyS { int16 from; int16 to; } keys[] = { - {Common::KEYCODE_INVALID, kKeyNone }, {Common::KEYCODE_BACKSPACE, kKeyBackspace}, {Common::KEYCODE_SPACE, kKeySpace }, {Common::KEYCODE_RETURN, kKeyReturn }, @@ -216,20 +231,88 @@ int16 Util::translateKey(const Common::KeyState &key) { {Common::KEYCODE_F10, kKeyF10 } }; + // Translate special keys for (int i = 0; i < ARRAYSIZE(keys); i++) if (key.keycode == keys[i].from) return keys[i].to; - if ((key.keycode >= Common::KEYCODE_SPACE) && - (key.keycode <= Common::KEYCODE_DELETE)) { - - // Used as a user input in Gobliins 2 notepad, in the save dialog, ... + // Return the ascii value, for text input + if ((key.ascii >= 32) && (key.ascii <= 127)) return key.ascii; - } + + // Translate international characters into CP850 characters + if ((key.ascii >= 160) && (key.ascii <= 255)) + return toCP850(key.ascii); return 0; } +static const uint8 kLowerToUpper[][2] = { + {0x81, 0x9A}, + {0x82, 0x90}, + {0x83, 0xB6}, + {0x84, 0x8E}, + {0x85, 0xB7}, + {0x86, 0x8F}, + {0x87, 0x80}, + {0x88, 0xD2}, + {0x89, 0xD3}, + {0x8A, 0xD4}, + {0x8B, 0xD8}, + {0x8C, 0xD7}, + {0x8D, 0xDE}, + {0x91, 0x92}, + {0x93, 0xE2}, + {0x94, 0x99}, + {0x95, 0xE3}, + {0x96, 0xEA}, + {0x97, 0xEB}, + {0x95, 0xE3}, + {0x96, 0xEA}, + {0x97, 0xEB}, + {0x9B, 0x9D}, + {0xA0, 0xB5}, + {0xA1, 0xD6}, + {0xA2, 0xE0}, + {0xA3, 0xE9}, + {0xA4, 0xA5}, + {0xC6, 0xC7}, + {0xD0, 0xD1}, + {0xE4, 0xE5}, + {0xE7, 0xE8}, + {0xEC, 0xED} +}; + +char Util::toCP850Lower(char cp850) { + const uint8 cp = (unsigned char)cp850; + if (cp <= 32) + return cp850; + + if (cp <= 127) + return tolower(cp850); + + for (uint i = 0; i < ARRAYSIZE(kLowerToUpper); i++) + if (cp == kLowerToUpper[i][1]) + return (char)kLowerToUpper[i][0]; + + return cp850; +} + +char Util::toCP850Upper(char cp850) { + const uint8 cp = (unsigned char)cp850; + if (cp <= 32) + return cp850; + + if (cp <= 127) + return toupper(cp850); + + for (uint i = 0; i < ARRAYSIZE(kLowerToUpper); i++) + if (cp == kLowerToUpper[i][0]) + return (char)kLowerToUpper[i][1]; + + return cp850; +} + int16 Util::getKey() { Common::KeyState key; @@ -367,21 +450,29 @@ void Util::notifyNewAnim() { _startFrameTime = getTimeKey(); } -void Util::waitEndFrame() { +void Util::waitEndFrame(bool handleInput) { int32 time; - _vm->_video->waitRetrace(); - time = getTimeKey() - _startFrameTime; if ((time > 1000) || (time < 0)) { + _vm->_video->retrace(); _startFrameTime = getTimeKey(); return; } - int32 toWait = _frameWaitTime - time; + int32 toWait = 0; + do { + if (toWait > 0) + delay(MIN(toWait, 10)); + + if (handleInput) + processInput(); + + _vm->_video->retrace(); - if (toWait > 0) - delay(toWait); + time = getTimeKey() - _startFrameTime; + toWait = _frameWaitTime - time; + } while (toWait > 0); _startFrameTime = getTimeKey(); } diff --git a/engines/gob/util.h b/engines/gob/util.h index b26a78ab2cca..a4984c620798 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -124,7 +124,7 @@ class Util { int16 getFrameRate(); void setFrameRate(int16 rate); void notifyNewAnim(); - void waitEndFrame(); + void waitEndFrame(bool handleInput = true); void setScrollOffset(int16 x = -1, int16 y = -1); static void insertStr(const char *str1, char *str2, int16 pos); @@ -143,6 +143,11 @@ class Util { /** Read a constant-length string out of a stream. */ static Common::String readString(Common::SeekableReadStream &stream, int n); + /** Convert a character in CP850 encoding to the equivalent lower case character. */ + static char toCP850Lower(char cp850); + /** Convert a character in CP850 encoding to the equivalent upper case character. */ + static char toCP850Upper(char cp850); + Util(GobEngine *vm); protected: @@ -166,6 +171,7 @@ class Util { void addKeyToBuffer(const Common::KeyState &key); bool getKeyFromBuffer(Common::KeyState &key); int16 translateKey(const Common::KeyState &key); + int16 toCP850(uint16 latin1); void checkJoystick(); void keyDown(const Common::Event &event); diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 3b1c6423bb42..64af34cf6275 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -84,6 +84,10 @@ uint16 Font::getCharCount() const { return _endItem - _startItem + 1; } +bool Font::hasChar(uint8 c) const { + return (c >= _startItem) && (c <= _endItem); +} + bool Font::isMonospaced() const { return _charWidths == 0; } @@ -134,6 +138,23 @@ void Font::drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y, } } +void Font::drawString(const Common::String &str, int16 x, int16 y, int16 color1, int16 color2, + bool transp, Surface &dest) const { + + const char *s = str.c_str(); + + while (*s != '\0') { + const int16 charRight = x + getCharWidth(*s); + const int16 charBottom = y + getCharHeight(); + + if ((x >= 0) && (y >= 0) && (charRight <= dest.getWidth()) && (charBottom <= dest.getHeight())) + drawLetter(dest, *s, x, y, color1, color2, transp); + + x += getCharWidth(*s); + s++; + } +} + const byte *Font::getCharData(uint8 c) const { if (_endItem == 0) { warning("Font::getCharData(): _endItem == 0"); @@ -225,7 +246,7 @@ void Video::setSize(bool defaultTo1XScaler) { void Video::retrace(bool mouse) { if (mouse) - CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0); + CursorMan.showMouse((_vm->_draw->_showCursor & 6) != 0); if (_vm->_global->_primarySurfDesc) { int screenX = _screenDeltaX; @@ -332,6 +353,10 @@ void Video::drawPackedSprite(byte *sprBuf, int16 width, int16 height, void Video::drawPackedSprite(const char *path, Surface &dest, int width) { int32 size; byte *data = _vm->_dataIO->getFile(path, size); + if (!data) { + warning("Video::drawPackedSprite(): Failed to open sprite \"%s\"", path); + return; + } drawPackedSprite(data, width, dest.getHeight(), 0, 0, 0, dest); delete[] data; diff --git a/engines/gob/video.h b/engines/gob/video.h index ecbb579c5fbb..122c1e47d511 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -41,11 +41,16 @@ class Font { uint8 getCharWidth () const; uint8 getCharHeight() const; + bool hasChar(uint8 c) const; + bool isMonospaced() const; void drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y, uint32 color1, uint32 color2, bool transp) const; + void drawString(const Common::String &str, int16 x, int16 y, int16 color1, int16 color2, + bool transp, Surface &dest) const; + private: const byte *_dataPtr; const byte *_data; diff --git a/engines/groovie/saveload.cpp b/engines/groovie/saveload.cpp index 14e7a09cb269..1a92c02e0ef8 100644 --- a/engines/groovie/saveload.cpp +++ b/engines/groovie/saveload.cpp @@ -103,8 +103,6 @@ Common::InSaveFile *SaveLoad::openForLoading(const Common::String &target, int s if (descriptor) { // Initialize the SaveStateDescriptor descriptor->setSaveSlot(slot); - descriptor->setDeletableFlag(true); - descriptor->setWriteProtectedFlag(false); // TODO: Add extra information //setSaveDate(int year, int month, int day) diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index 90708163f505..bb5944acc858 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -244,9 +244,6 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); desc.setThumbnail(thumbnail); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - uint32 saveDate = file->readUint32BE(); uint16 saveTime = file->readUint16BE(); diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h index 79ef11e7a9db..e2162f20e284 100644 --- a/engines/kyra/detection_tables.h +++ b/engines/kyra/detection_tables.h @@ -1329,6 +1329,22 @@ const KYRAGameDescription adGameDescs[] = { LOL_FLOPPY_CMP_FLAGS }, + { // French floppy version 1.20, bug #3552534 "KYRA: LOL Floppy FR version unknown" + { + "lol", + 0, + { + { "WESTWOOD.1", 0, "43857e24d1fc6731f3b13d9ed6db8c3a", -1 }, + { 0, 0, 0, 0 } + }, + Common::FR_FRA, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS) + }, + LOL_FLOPPY_CMP_FLAGS + }, + { { "lol", @@ -1397,6 +1413,23 @@ const KYRAGameDescription adGameDescs[] = { LOL_FLOPPY_FLAGS }, + { // French floppy version 1.23, bug #3552534 "KYRA: LOL Floppy FR version unknown" + { + "lol", + "Extracted", + { + { "GENERAL.PAK", 0, "f4fd14f244bd7c7fa08d026fafe44cc5", -1 }, + { "CHAPTER7.PAK", 0, "733e33c8444c93843dac3b683c283eaa", -1 }, + { 0, 0, 0, 0 } + }, + Common::FR_FRA, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO8(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS) + }, + LOL_FLOPPY_FLAGS + }, + // Russian fan translation { { diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index a63f123258e5..fadb1066e0d2 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -770,7 +770,7 @@ void EoBCoreEngine::releaseItemsAndDecorationsShapes() { if (_spellShapes) { for (int i = 0; i < 4; i++) { if (_spellShapes[i]) - delete [] _spellShapes[i]; + delete[] _spellShapes[i]; } delete[] _spellShapes; } @@ -820,7 +820,7 @@ void EoBCoreEngine::releaseItemsAndDecorationsShapes() { if (_firebeamShapes[i]) delete[] _firebeamShapes[i]; } - delete []_firebeamShapes; + delete[] _firebeamShapes; } delete[] _redSplatShape; diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 050fe2b7948d..f60e755dd766 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -263,7 +263,7 @@ friend class TransferPartyWiz; // Main Menu, Intro, Finale virtual int mainMenu() = 0; - virtual void seq_xdeath() {}; + virtual void seq_xdeath() {} virtual void seq_playFinale() = 0; bool _playFinale; @@ -921,8 +921,8 @@ friend class TransferPartyWiz; void usePotion(int charIndex, int weaponSlot); void useWand(int charIndex, int weaponSlot); - virtual void turnUndeadAuto() {}; - virtual void turnUndeadAutoHit() {}; + virtual void turnUndeadAuto() {} + virtual void turnUndeadAutoHit() {} void castSpell(int spell, int weaponSlot); void removeCharacterEffect(int spell, int charIndex, int showWarning); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 4fd5985a09a2..04d805737f73 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -141,7 +141,7 @@ bool Screen::init() { if (!font) error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'"); - _fonts[FID_SJIS_FNT] = new SJISFont(this, font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode); + _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode); } } @@ -3595,8 +3595,8 @@ void AMIGAFont::unload() { memset(_chars, 0, sizeof(_chars)); } -SJISFont::SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize) - : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _screen(s) { +SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize) + : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) { assert(_font); _font->setDrawingMode(outlineSize ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index b064c72bb03d..60bfeb324110 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -213,7 +213,7 @@ class AMIGAFont : public Font { */ class SJISFont : public Font { public: - SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize); + SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize); ~SJISFont() { unload(); } bool usesOverlay() const { return true; } @@ -233,7 +233,6 @@ class SJISFont : public Font { const uint8 _invisColor; const bool _is16Color; - const Screen *_screen; int _sjisWidth, _asciiWidth; int _fontHeight; }; diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp index e06ca42c40e8..ae75c111b45d 100644 --- a/engines/kyra/screen_eob.cpp +++ b/engines/kyra/screen_eob.cpp @@ -607,7 +607,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco srcLineStart += SCREEN_W; src = srcLineStart; } - delete [] colorMap; + delete[] colorMap; } return shp; diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 08b232f400af..3726b1f4b94c 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -31,7 +31,7 @@ namespace Kyra { -Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system, vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount), _vm(vm) { +Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system, vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount) { _paletteOverlay1 = new uint8[0x100]; _paletteOverlay2 = new uint8[0x100]; _grayOverlay = new uint8[0x100]; diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 3bba9f8b7002..09496705bbdf 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -89,8 +89,6 @@ class Screen_LoL : public Screen_v2 { static void convertPC98Gfx(uint8 *data, int w, int h, int pitch); private: - LoLEngine *_vm; - static const ScreenDim _screenDimTable256C[]; static const ScreenDim _screenDimTable16C[]; static const int _screenDimTableCount; diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index 427bef66e29d..827a48768511 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -130,7 +130,6 @@ class SoundTowns : public Sound { void fadeOutSoundEffects(); int _lastTrack; - Audio::AudioStream *_currentSFX; Audio::SoundHandle _sfxHandle; uint8 *_musicTrackData; diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 0004395f6f94..70cc30419286 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -475,8 +475,8 @@ SoundMidiPC::SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *dri ::GUI::MessageDialog dialog(_("You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" - "General MIDI ones. After all it might happen\n" - "that a few tracks will not be correctly played.")); + "General MIDI ones. It is still possible that\n" + "some tracks sound incorrect.")); dialog.runModal(); } } diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 2f996de1ac6f..4b25db33f2bd 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -34,7 +34,7 @@ namespace Kyra { SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer) - : Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), _musicTrackData(0), _sfxFileData(0), _cdaPlaying(0), + : Sound(vm, mixer), _lastTrack(-1), _musicTrackData(0), _sfxFileData(0), _cdaPlaying(0), _sfxFileIndex((uint)-1), _musicFadeTable(0), _sfxWDTable(0), _sfxBTTable(0), _sfxChannel(0x46) { _driver = new TownsEuphonyDriver(_mixer); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 423b827092d8..00dc4f9e13c6 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -38,7 +38,7 @@ namespace Kyra { -#define RESFILE_VERSION 82 +#define RESFILE_VERSION 83 namespace { bool checkKyraDat(Common::SeekableReadStream *file) { diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index 9d0ed532f20d..7618259e69d9 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -32,10 +32,8 @@ #include "common/events.h" #include "common/rational.h" -#include "common/rect.h" #include "common/stream.h" #include "common/system.h" -#include "common/textconsole.h" #include "engines/engine.h" @@ -232,7 +230,7 @@ AnimFrame *Animation::processChunkFrame(Common::SeekableReadStream *in, const Ch i.read(str, false); // Decode the frame - AnimFrame *f = new AnimFrame(str, i); + AnimFrame *f = new AnimFrame(str, i, true); // Delete the temporary chunk buffer delete str; @@ -250,7 +248,7 @@ void Animation::processChunkAudio(Common::SeekableReadStream *in, const Chunk &c // Read Snd header uint32 header1 = in->readUint32LE(); uint16 header2 = in->readUint16LE(); - warning("Start ADPCM: %d, %d", header1, header2); + debugC(4, kLastExpressDebugSound, "Start ADPCM: %d, %d", header1, header2); size -= 6; } diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp index 205c46f66774..d176d963d15c 100644 --- a/engines/lastexpress/data/cursor.cpp +++ b/engines/lastexpress/data/cursor.cpp @@ -128,7 +128,7 @@ Common::Rect Icon::draw(Graphics::Surface *surface) { for (int i = 0; i < 32; i++) { // Adjust brightness - if (_brightnessIndex == -1) + if (_brightnessIndex == -1 || _brightnessIndex >= ARRAYSIZE(brigthnessData)) *s = *image; else *s = (*image & brigthnessData[_brightnessIndex]) >> _brightnessIndex; diff --git a/engines/lastexpress/data/font.cpp b/engines/lastexpress/data/font.cpp index 79cf64e617b1..8ac1afce9aab 100644 --- a/engines/lastexpress/data/font.cpp +++ b/engines/lastexpress/data/font.cpp @@ -149,7 +149,7 @@ uint8 Font::getCharWidth(uint16 c) const{ uint16 Font::getStringWidth(Common::String str) const { uint16 width = 0; for (uint i = 0; i < str.size(); i++) - width += getCharWidth((unsigned) (int)str[i]); + width += getCharWidth((unsigned char)str[i]); return width; } @@ -185,8 +185,8 @@ void Font::drawChar(Graphics::Surface *surface, int16 x, int16 y, uint16 c) { Common::Rect Font::drawString(Graphics::Surface *surface, int16 x, int16 y, Common::String str) { int16 currentX = x; for (uint i = 0; i < str.size(); i++) { - drawChar(surface, currentX, y, (unsigned) (int)str[i]); - currentX += getCharWidth((unsigned) (int)str[i]); + drawChar(surface, currentX, y, (unsigned char)str[i]); + currentX += getCharWidth((unsigned char)str[i]); } return Common::Rect(x, y, x + currentX, y + (int16)_charHeight); diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp index 8f279ffbb332..fdb1ac6d46e2 100644 --- a/engines/lastexpress/data/scene.cpp +++ b/engines/lastexpress/data/scene.cpp @@ -28,7 +28,6 @@ #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" -#include "common/textconsole.h" #include "common/stream.h" namespace LastExpress { @@ -122,7 +121,7 @@ bool SceneHotspot::isInside(const Common::Point &point) { // Scene Scene::~Scene() { // Free the hotspots - for (int i = 0; i < (int)_hotspots.size(); i++) + for (uint i = 0; i < _hotspots.size(); i++) delete _hotspots[i]; } @@ -172,7 +171,7 @@ bool Scene::checkHotSpot(const Common::Point &coord, SceneHotspot **hotspot) { bool found = false; int _location = 0; - for (int i = 0; i < (int)_hotspots.size(); i++) { + for (uint i = 0; i < _hotspots.size(); i++) { if (_hotspots[i]->isInside(coord)) { if (_location <= _hotspots[i]->location) { _location = _hotspots[i]->location; @@ -224,7 +223,7 @@ Common::String Scene::toString() { // Hotspots if (_hotspots.size() != 0) { output += "\nHotspots:\n"; - for (int i = 0; i < (int)_hotspots.size(); i++) + for (uint i = 0; i < _hotspots.size(); i++) output += _hotspots[i]->toString() + "\n"; } @@ -241,7 +240,7 @@ SceneLoader::~SceneLoader() { void SceneLoader::clear() { // Remove all scenes - for (int i = 0; i < (int)_scenes.size(); i++) + for (uint i = 0; i < _scenes.size(); i++) delete _scenes[i]; _scenes.clear(); @@ -292,9 +291,9 @@ Scene *SceneLoader::get(SceneIndex index) { return NULL; // Load the hotspots if needed - _scenes[(int)index]->loadHotspots(_stream); + _scenes[(uint)index]->loadHotspots(_stream); - return _scenes[(int)index]; + return _scenes[(uint)index]; } } // End of namespace LastExpress diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp index a62348f6c0d1..a5bcba84cd1b 100644 --- a/engines/lastexpress/data/sequence.cpp +++ b/engines/lastexpress/data/sequence.cpp @@ -27,7 +27,6 @@ #include "lastexpress/debug.h" #include "common/stream.h" -#include "common/textconsole.h" namespace LastExpress { @@ -77,7 +76,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) { // AnimFrame -AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f) : _palette(NULL) { +AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype) : _palette(NULL), _ignoreSubtype(ignoreSubtype) { _palSize = 1; // TODO: use just the needed rectangle _image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h index 9987eae48e61..610a55cebff3 100644 --- a/engines/lastexpress/data/sequence.h +++ b/engines/lastexpress/data/sequence.h @@ -49,8 +49,9 @@ byte {1} - Compression type byte {1} - Subtype (determines which set of decompression functions will be called) => 0, 1, 2, 3 byte {1} - Unknown + byte {1} - Keep previous frame while drawing + byte {1} - Unknown byte {1} - Unknown - uint16 {2} - Unknown byte {1} - Sound action byte {1} - Unknown uint32 {4} - positionId @@ -129,7 +130,7 @@ struct FrameInfo { class AnimFrame : public Drawable { public: - AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f); + AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype = false); ~AnimFrame(); Common::Rect draw(Graphics::Surface *s); @@ -146,6 +147,7 @@ class AnimFrame : public Drawable { uint16 _palSize; uint16 *_palette; Common::Rect _rect; + bool _ignoreSubtype; }; class Sequence { diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp index a9bee6155daf..a77e4a06c694 100644 --- a/engines/lastexpress/data/snd.cpp +++ b/engines/lastexpress/data/snd.cpp @@ -28,11 +28,9 @@ #include "lastexpress/debug.h" #include "audio/decoders/adpcm_intern.h" -#include "audio/audiostream.h" #include "common/debug.h" #include "common/memstream.h" #include "common/system.h" -#include "common/textconsole.h" namespace LastExpress { @@ -358,6 +356,8 @@ class LastExpress_ADPCMStream : public Audio::ADPCMStream { Audio::ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) { _currentFilterId = -1; _nextFilterId = filterId; + _stepAdjust1 = 0; + _stepAdjust2 = 0; } int readBuffer(int16 *buffer, const int numSamples) { @@ -378,7 +378,7 @@ class LastExpress_ADPCMStream : public Audio::ADPCMStream { // Get current filter _currentFilterId = _nextFilterId; - _nextFilterId = -1; + //_nextFilterId = -1; // FIXME: the filter id should be recomputed based on the sound entry status for each block // No filter: skip decoding if (_currentFilterId == -1) @@ -455,7 +455,9 @@ void SimpleSound::play(Audio::AudioStream *as) { ////////////////////////////////////////////////////////////////////////// StreamedSound::StreamedSound() : _as(NULL), _loaded(false) {} -StreamedSound::~StreamedSound() {} +StreamedSound::~StreamedSound() { + _as = NULL; +} bool StreamedSound::load(Common::SeekableReadStream *stream, int32 filterId) { if (!stream) @@ -484,6 +486,9 @@ bool StreamedSound::isFinished() { } void StreamedSound::setFilterId(int32 filterId) { + if (!_as) + return; + ((LastExpress_ADPCMStream *)_as)->setFilterId(filterId); } @@ -521,6 +526,7 @@ void AppendableSound::queueBuffer(Common::SeekableReadStream *bufferIn) { // Setup the ADPCM decoder uint32 sizeIn = (uint32)bufferIn->size(); Audio::AudioStream *adpcm = makeDecoder(bufferIn, sizeIn); + ((LastExpress_ADPCMStream *)adpcm)->setFilterId(16); // Queue the stream _as->queueAudioStream(adpcm); diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp index 0be832cbdd80..a9a8284588dd 100644 --- a/engines/lastexpress/data/subtitle.cpp +++ b/engines/lastexpress/data/subtitle.cpp @@ -32,7 +32,6 @@ #include "common/debug.h" #include "common/rect.h" #include "common/stream.h" -#include "common/textconsole.h" namespace LastExpress { @@ -151,7 +150,7 @@ SubtitleManager::~SubtitleManager() { } void SubtitleManager::reset() { - for (int i = 0; i < (int)_subtitles.size(); i++) + for (uint i = 0; i < _subtitles.size(); i++) delete _subtitles[i]; _subtitles.clear(); diff --git a/engines/lastexpress/debug.cpp b/engines/lastexpress/debug.cpp index dc2807db63e5..f89ad8b80d67 100644 --- a/engines/lastexpress/debug.cpp +++ b/engines/lastexpress/debug.cpp @@ -28,13 +28,13 @@ #include "lastexpress/data/cursor.h" #include "lastexpress/data/scene.h" #include "lastexpress/data/sequence.h" -#include "lastexpress/data/snd.h" #include "lastexpress/data/subtitle.h" #include "lastexpress/fight/fight.h" #include "lastexpress/game/action.h" #include "lastexpress/game/beetle.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" @@ -44,15 +44,12 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" #include "common/debug-channels.h" -#include "common/events.h" #include "common/md5.h" namespace LastExpress { @@ -612,7 +609,7 @@ bool Debugger::cmdPlayNis(int argc, const char **argv) { loadArchive((ArchiveIndex)getNumber(argv[2])); // If we got a nis filename, check that the file exists - if (name.contains('.') && _engine->getResourceManager()->hasFile(name)) { + if (name.contains('.') && !_engine->getResourceManager()->hasFile(name)) { DebugPrintf("Cannot find file: %s\n", name.c_str()); return true; } diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp index 82a6520522e4..2fdeef910a45 100644 --- a/engines/lastexpress/detection.cpp +++ b/engines/lastexpress/detection.cpp @@ -173,7 +173,7 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) }, - + // The Last Express (Russian) // expressw.exe 1999-04-05 15:33:56 // express.exe ??? @@ -211,6 +211,7 @@ class LastExpressMetaEngine : public AdvancedMetaEngine { return "LastExpress Engine (C) 1997 Smoking Car Productions"; } +protected: bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; }; diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp index 301c52e142b4..e0fe42952015 100644 --- a/engines/lastexpress/entities/abbot.cpp +++ b/engines/lastexpress/entities/abbot.cpp @@ -34,9 +34,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -417,7 +415,7 @@ IMPLEMENT_FUNCTION(22, Abbot, function22) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752); + Entity::timeCheckSavepoint(kTime1971000, params->param1, kEntityAbbot, kEntityServers0, kAction218586752); if (getState()->time > kTime1989000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->inventoryItem = kItemNone; @@ -516,7 +514,8 @@ IMPLEMENT_FUNCTION(24, Abbot, function24) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 900); + if (!Entity::updateParameter(params->param1, getState()->time, 900)) + break; setup_function25(); break; @@ -617,7 +616,8 @@ IMPLEMENT_FUNCTION(26, Abbot, function26) break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, 4500); + if (!Entity::updateParameter(params->param2, getState()->time, 4500)) + break; if (getEntities()->isSomebodyInsideRestaurantOrSalon()) setup_function27(); @@ -691,7 +691,7 @@ IMPLEMENT_FUNCTION(28, Abbot, function28) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2052000, params->param1, 1, setup_function29); + Entity::timeCheckCallback(kTime2052000, params->param1, 1, WRAP_SETUP_FUNCTION(Abbot, setup_function29)); break; case kActionDefault: @@ -770,7 +770,7 @@ IMPLEMENT_FUNCTION(29, Abbot, function29) getSavePoints()->push(kEntityAbbot, kEntityBoutarel, kAction122358304); getEntities()->drawSequenceLeft(kEntityAbbot, "508B"); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -864,7 +864,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31) if (!params->param1) break; - UPDATE_PARAM(params->param5, getState()->time, 450); + if (!Entity::updateParameter(params->param5, getState()->time, 450)) + break; setCallback(6); setup_callbackActionRestaurantOrSalon(); @@ -920,7 +921,8 @@ IMPLEMENT_FUNCTION(31, Abbot, function31) getSavePoints()->push(kEntityAbbot, kEntityAlexei, kAction122288808); params->param1 = 1; - UPDATE_PARAM(params->param5, getState()->time, 450); + if (!Entity::updateParameter(params->param5, getState()->time, 450)) + break; setCallback(6); setup_callbackActionRestaurantOrSalon(); @@ -1163,7 +1165,8 @@ IMPLEMENT_FUNCTION(36, Abbot, function36) break; case 2: - UPDATE_PARAM(params->param4, getState()->time, 900); + if (!Entity::updateParameter(params->param4, getState()->time, 900)) + break; getSound()->playSound(kEntityAbbot, "Abb3042"); break; @@ -1287,7 +1290,7 @@ IMPLEMENT_FUNCTION_II(40, Abbot, function40, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(kEntityAbbot, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); } else if (!getEvent(kEventAbbotInvitationDrink) && getEntities()->isDistanceBetweenEntities(kEntityAbbot, kEntityPlayer, 1000) && !getEntities()->isInsideCompartments(kEntityPlayer) @@ -1302,7 +1305,7 @@ IMPLEMENT_FUNCTION_II(40, Abbot, function40, CarIndex, EntityPosition) case kActionDefault: if (getEntities()->updateEntity(kEntityAbbot, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -1321,7 +1324,7 @@ IMPLEMENT_FUNCTION(41, Abbot, chapter4Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129); + Entity::timeCheckSavepoint(kTime2358000, params->param1, kEntityAbbot, kEntityServers0, kAction218128129); if (getState()->time > kTime2389500 && getEntities()->isSomebodyInsideRestaurantOrSalon()) setup_function42(); @@ -1425,10 +1428,12 @@ IMPLEMENT_FUNCTION(43, Abbot, function43) } label_callback_1: - TIME_CHECK(kTime2466000, params->param5, setup_function44); + if (Entity::timeCheck(kTime2466000, params->param5, WRAP_SETUP_FUNCTION(Abbot, setup_function44))) + break; if (params->param3) { - UPDATE_PARAM(params->param6, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75)) + break; params->param2 = 1; params->param3 = 0; @@ -1646,14 +1651,14 @@ IMPLEMENT_FUNCTION(48, Abbot, function48) if (ENTITY_PARAM(0, 1)) getData()->inventoryItem = kItemInvalid; - UPDATE_PARAM_PROC(params->param1, getState()->time, 1800) + if (Entity::updateParameter(params->param1, getState()->time, 1800)) { getData()->inventoryItem = kItemNone; setCallback(4); setup_updatePosition("126C", kCarRedSleeping, 52); - UPDATE_PARAM_PROC_END + } - TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon)); break; case kAction1: @@ -1705,7 +1710,7 @@ IMPLEMENT_FUNCTION(48, Abbot, function48) getEntities()->drawSequenceLeft(kEntityAbbot, "126B"); params->param1 = 0; - TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallbackInventory(kTime2533500, params->param2, 5, WRAP_SETUP_FUNCTION(Abbot, setup_callbackActionRestaurantOrSalon)); break; case 5: @@ -1750,7 +1755,8 @@ IMPLEMENT_FUNCTION(49, Abbot, pickBomb) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->timeTicks, 150); + if (!Entity::updateParameter(params->param1, getState()->timeTicks, 150)) + break; getSavePoints()->push(kEntityAbbot, kEntityAbbot, kAction157489665); break; diff --git a/engines/lastexpress/entities/abbot.h b/engines/lastexpress/entities/abbot.h index 462f5a491ef8..ce52bb68cee4 100644 --- a/engines/lastexpress/entities/abbot.h +++ b/engines/lastexpress/entities/abbot.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_ABBOT_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp index 54c2d87b892f..115c890f6f86 100644 --- a/engines/lastexpress/entities/alexei.cpp +++ b/engines/lastexpress/entities/alexei.cpp @@ -31,9 +31,6 @@ #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -207,7 +204,7 @@ IMPLEMENT_FUNCTION(13, Alexei, function13) getData()->entityPosition = kPosition_7500; getEntities()->clearSequences(kEntityAlexei); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -242,7 +239,7 @@ IMPLEMENT_FUNCTION(14, Alexei, function14) getObjects()->update(kObjectCompartment2, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); getEntities()->exitCompartment(kEntityAlexei, kObjectCompartment2, true); - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -254,7 +251,7 @@ IMPLEMENT_FUNCTION(15, Alexei, function15) break; case kActionNone: - UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1) + if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) { if (getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->location = kLocationOutsideCompartment; @@ -292,7 +289,7 @@ IMPLEMENT_FUNCTION(15, Alexei, function15) getData()->location = kLocationInsideCompartment; getEntities()->drawSequenceLeft(kEntityAlexei, "103B"); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -312,12 +309,13 @@ IMPLEMENT_FUNCTION_IS(16, Alexei, function16, TimeValue) getObjects()->update(kObjectCompartment2, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); getObjects()->update(kObjectHandleInsideBathroom, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param5) { - UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75); + if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75)) + break; params->param5 = 0; params->param6 = 1; @@ -448,7 +446,7 @@ IMPLEMENT_FUNCTION(17, Alexei, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler) + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_chapter1Handler)); break; case kActionDefault: @@ -485,7 +483,9 @@ IMPLEMENT_FUNCTION(18, Alexei, chapter1Handler) } if (params->param1) { - UPDATE_PARAM(params->param3, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90)) + break; + getScenes()->loadSceneFromPosition(kCarRestaurant, 61); } else { params->param3 = 0; @@ -689,7 +689,7 @@ IMPLEMENT_FUNCTION(21, Alexei, function21) break; case kActionNone: - UPDATE_PARAM_CHECK(params->param2, getState()->time, params->param1) + if (Entity::updateParameterCheck(params->param2, getState()->time, params->param1)) { getData()->location = kLocationOutsideCompartment; getData()->inventoryItem = kItemNone; @@ -751,7 +751,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22) break; case kActionNone: - UPDATE_PARAM_PROC(params->param2, getState()->time, params->param2) + if (Entity::updateParameter(params->param2, getState()->time, params->param2)) { if (getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->location = kLocationOutsideCompartment; getData()->inventoryItem = kItemNone; @@ -760,7 +760,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22) setup_updatePosition("103D", kCarRestaurant, 52); break; } - UPDATE_PARAM_PROC_END + } if (params->param3 == kTimeInvalid || getState()->time <= kTime1111500) break; @@ -978,7 +978,7 @@ IMPLEMENT_FUNCTION(26, Alexei, function26) break; case kActionNone: - TIME_CHECK(kTime1512000, params->param1, setup_function27) + Entity::timeCheck(kTime1512000, params->param1, WRAP_SETUP_FUNCTION(Alexei, setup_function27)); break; case kActionDefault: @@ -1333,25 +1333,26 @@ IMPLEMENT_FUNCTION(35, Alexei, function35) case kActionNone: if (getEntities()->isInSalon(kEntityPlayer)) { - UPDATE_PARAM_PROC(params->param2, getState()->time, 2700) + if (Entity::updateParameter(params->param2, getState()->time, 2700)) { setCallback(1); setup_callbackActionRestaurantOrSalon(); break; - UPDATE_PARAM_PROC_END + } } else { params->param2 = 0; } - UPDATE_PARAM_PROC(params->param3, getState()->time, params->param1) + if (Entity::updateParameter(params->param3, getState()->time, params->param1)) { if (getEntities()->isSomebodyInsideRestaurantOrSalon()) { setCallback(3); setup_function15(); break; } - UPDATE_PARAM_PROC_END + } label_callback_3: - UPDATE_PARAM(params->param4, getState()->time, 9000); + if (!Entity::updateParameter(params->param4, getState()->time, 9000)) + break; setCallback(4); setup_callbackActionRestaurantOrSalon(); @@ -1378,7 +1379,7 @@ IMPLEMENT_FUNCTION(35, Alexei, function35) case 2: case 5: - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -1400,7 +1401,8 @@ IMPLEMENT_FUNCTION(36, Alexei, function36) if (params->param3 || params->param2) break; - UPDATE_PARAM(params->param4, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, params->param1)) + break; getEntities()->drawSequenceRight(kEntityAlexei, "124B"); @@ -1448,7 +1450,7 @@ IMPLEMENT_FUNCTION(36, Alexei, function36) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/alexei.h b/engines/lastexpress/entities/alexei.h index 262826ae42bf..979238586372 100644 --- a/engines/lastexpress/entities/alexei.h +++ b/engines/lastexpress/entities/alexei.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_ALEXEI_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp index cd7987055900..e834e1f7cb3d 100644 --- a/engines/lastexpress/entities/alouan.cpp +++ b/engines/lastexpress/entities/alouan.cpp @@ -28,9 +28,6 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -89,22 +86,22 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(6, Alouan, compartment6) - COMPARTMENT_TO(Alouan, kObjectCompartment6, kPosition_4070, "621Cf", "621Df"); + Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Cf", "621Df"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(7, Alouan, compartment8) - COMPARTMENT_TO(Alouan, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh"); + Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Ch", "621Dh"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(8, Alouan, compartment6to8) - COMPARTMENT_FROM_TO(Alouan, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah"); + Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "621Bf", kObjectCompartment8, kPosition_2740, "621Ah"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(9, Alouan, compartment8to6) - COMPARTMENT_FROM_TO(Alouan, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af"); + Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "621Bh", kObjectCompartment6, kPosition_4070, "621Af"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -114,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Alouan, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Alouan, setup_chapter1Handler)); break; case kActionDefault: @@ -134,7 +131,8 @@ IMPLEMENT_FUNCTION(11, Alouan, chapter1Handler) case kActionNone: - TIME_CHECK_CALLBACK(kTime1096200, params->param1, 1, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime1096200, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback1: if (getState()->time > kTime1162800 && !params->param2) { @@ -284,21 +282,28 @@ IMPLEMENT_FUNCTION(16, Alouan, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTimeCitySalzbourg, params->param1, 1, setup_compartment8to6); + if (Entity::timeCheckCallback(kTimeCitySalzbourg, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback1: - if (params->param2 != kTimeInvalid && getState()->time > kTime1989000) - TIME_CHECK_CAR(kTime2119500, params->param5, 5, setup_compartment8); + if (params->param2 != kTimeInvalid && getState()->time > kTime1989000) { + if (Entity::timeCheckCar(kTime2119500, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } label_callback2: - TIME_CHECK_CALLBACK_1(kTime2052000, params->param3, 3, setup_playSound, "Har1005"); + if (Entity::timeCheckCallback(kTime2052000, params->param3, 3, "Har1005", WRAP_SETUP_FUNCTION_S(Alouan, setup_playSound))) + break; label_callback3: - TIME_CHECK_CALLBACK(kTime2133000, params->param4, 4, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2133000, params->param4, 4, WRAP_SETUP_FUNCTION(Alouan, setup_compartment6to8))) + break; label_callback4: - if (params->param5 != kTimeInvalid && getState()->time > kTime2151000) - TIME_CHECK_CAR(kTime2241000, params->param5, 5, setup_compartment8); + if (params->param5 != kTimeInvalid && getState()->time > kTime2151000) { + if (Entity::timeCheckCar(kTime2241000, params->param5, 5, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } break; case kActionDefault: @@ -355,11 +360,14 @@ IMPLEMENT_FUNCTION(18, Alouan, chapter4Handler) break; case kActionNone: - if (params->param1 != kTimeInvalid) - TIME_CHECK_CAR(kTime2443500, params->param1, 1, setup_compartment8); + if (params->param1 != kTimeInvalid) { + if (Entity::timeCheckCar(kTime2443500, params->param1, 1, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8))) + break; + } label_callback1: - TIME_CHECK_CALLBACK(kTime2455200, params->param2, 2, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2455200, params->param2, 2, WRAP_SETUP_FUNCTION(Alouan, setup_compartment8to6))) + break; label_callback2: if (getState()->time > kTime2475000 && !params->param3) { @@ -441,7 +449,9 @@ IMPLEMENT_FUNCTION(22, Alouan, function22) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 2700); + if (!Entity::updateParameter(params->param1, getState()->time, 2700)) + break; + setup_function23(); break; diff --git a/engines/lastexpress/entities/alouan.h b/engines/lastexpress/entities/alouan.h index c6a6beddd94e..91254a449ad9 100644 --- a/engines/lastexpress/entities/alouan.h +++ b/engines/lastexpress/entities/alouan.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_ALOUAN_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp index b13aa21f6d59..f8768032b543 100644 --- a/engines/lastexpress/entities/anna.cpp +++ b/engines/lastexpress/entities/anna.cpp @@ -34,9 +34,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -200,16 +198,17 @@ IMPLEMENT_FUNCTION(12, Anna, function12) params->param2 = 1; if (params->param6) { - UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param7, getState()->timeTicks, 75)) { getSavePoints()->push(kEntityAnna, kEntityAnna, kActionEndSound); params->param6 = 0; params->param7 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param4) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75)) + break; params->param4 = 0; params->param5 = 1; @@ -227,7 +226,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12) case kActionEndSound: if (params->param2) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -289,7 +288,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12) getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorHandKnock, kCursorHand); getObjects()->update(kObject53, kEntityAnna, kObjectLocation1, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -424,12 +423,13 @@ IMPLEMENT_FUNCTION_IS(15, Anna, function15, TimeValue) getObjects()->update(kObjectCompartmentF, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); getObjects()->update(kObject53, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param5) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75)) + break; params->param5 = 0; params->param6 = 1; @@ -547,7 +547,7 @@ IMPLEMENT_FUNCTION(16, Anna, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Anna, setup_chapter1Handler)); break; case kActionDefault: @@ -577,7 +577,7 @@ IMPLEMENT_FUNCTION_II(17, Anna, function17, uint32, uint32) if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -615,7 +615,7 @@ IMPLEMENT_FUNCTION_II(17, Anna, function17, uint32, uint32) } if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -664,20 +664,21 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue) case kActionNone: if (params->param1 && params->param1 < getState()->time && getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param5 && !params->param4) { - UPDATE_PARAM_PROC(params->param6, getState()->time, 900) + if (Entity::updateParameter(params->param6, getState()->time, 900)) { params->param2 |= kItemScarf; params->param5 = 0; params->param6 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param3) { - UPDATE_PARAM(params->param7, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90)) + break; getScenes()->loadSceneFromPosition(kCarRestaurant, 61); } else { @@ -757,7 +758,7 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue) case kAction259136835: case kAction268773672: getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -1151,15 +1152,16 @@ IMPLEMENT_FUNCTION(29, Anna, function29) case kActionNone: if (params->param2) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 900) + if (Entity::updateParameter(params->param3, getState()->time, 900)) { getData()->inventoryItem = (InventoryItem)(getData()->inventoryItem | kItemScarf); params->param2 = 0; params->param3 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param1) { - UPDATE_PARAM(params->param4, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 90)) + break; getScenes()->loadSceneFromPosition(kCarRestaurant, 55); } else { @@ -1281,7 +1283,9 @@ IMPLEMENT_FUNCTION(30, Anna, function30) } if (params->param1) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 90)) + break; + getScenes()->loadSceneFromPosition(kCarRestaurant, 55); } else { params->param5 = 0; @@ -1411,15 +1415,15 @@ IMPLEMENT_FUNCTION(34, Anna, function34) case kActionNone: if (!params->param1 && getEntities()->isPlayerPosition(kCarRedSleeping, 60)) { - UPDATE_PARAM_PROC(params->param2, getState()->time, 150) + if (Entity::updateParameter(params->param2, getState()->time, 150)) { setCallback(1); setup_draw("419B"); break; - UPDATE_PARAM_PROC_END + } } label_callback_1: - TIME_CHECK(kTime1489500, params->param3, setup_function35); + Entity::timeCheck(kTime1489500, params->param3, WRAP_SETUP_FUNCTION(Anna, setup_function35)); break; case kActionKnock: @@ -1485,7 +1489,8 @@ IMPLEMENT_FUNCTION(35, Anna, function35) if (!params->param1) break; - UPDATE_PARAM(params->param3, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75)) + break; switch (params->param2) { default: @@ -1666,7 +1671,7 @@ IMPLEMENT_FUNCTION_II(39, Anna, function39, CarIndex, EntityPosition) if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -1687,7 +1692,7 @@ IMPLEMENT_FUNCTION_II(39, Anna, function39, CarIndex, EntityPosition) if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -1799,7 +1804,8 @@ IMPLEMENT_FUNCTION(41, Anna, function41) break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, 2700); + if (!Entity::updateParameter(params->param2, getState()->time, 2700)) + break; params->param5++; switch (params->param5) { @@ -1985,7 +1991,7 @@ IMPLEMENT_FUNCTION_I(45, Anna, function45, bool) case 2: getEntities()->exitCompartment(kEntityAnna, kObjectCompartmentF, true); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2092,11 +2098,11 @@ IMPLEMENT_FUNCTION(48, Anna, function48) break; if (params->param3 != kTimeInvalid && getState()->time > kTime1969200) { - UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150) + if (Entity::updateParameterTime(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)) { setCallback(3); setup_playSound("Aug3007A"); break; - UPDATE_PARAM_PROC_END + } } label_callback_4: @@ -2195,7 +2201,7 @@ IMPLEMENT_FUNCTION(49, Anna, leaveTableWithAugust) getSavePoints()->push(kEntityAnna, kEntityTables3, kActionDrawTablesWithChairs, "010M"); getEntities()->clearSequences(kEntityAugust); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -2386,22 +2392,23 @@ IMPLEMENT_FUNCTION(53, Anna, function53) case kActionNone: if (getProgress().field_48 && params->param5 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150) + if (Entity::updateParameterTime(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)) { setup_function54(); break; - UPDATE_PARAM_PROC_END + } } if (params->param3) { - UPDATE_PARAM_PROC(params->param6, getState()->time, 9000) + if (Entity::updateParameter(params->param6, getState()->time, 9000)) { params->param4 = !params->param4; getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A"); params->param6 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param1) { - UPDATE_PARAM(params->param7, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75)) + break; CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal; @@ -2537,17 +2544,19 @@ IMPLEMENT_FUNCTION(54, Anna, function54) case kActionNone: if (params->param3) { - TIME_CHECK(kTime2079000, params->param5, setup_function55); + if (Entity::timeCheck(kTime2079000, params->param5, WRAP_SETUP_FUNCTION(Anna, setup_function55))) + break; - UPDATE_PARAM_PROC(params->param6, getState()->time, 9000) + if (Entity::updateParameter(params->param6, getState()->time, 9000)) { params->param4 = !params->param4; getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A"); params->param6 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param1) { - UPDATE_PARAM(params->param7, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param7, getState()->timeTicks, 75)) + break; CursorStyle cursor = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal; @@ -2894,7 +2903,8 @@ IMPLEMENT_FUNCTION(59, Anna, function59) } if (params->param1) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; CursorStyle style = getEntities()->isInsideCompartment(kEntityMax, kCarRedSleeping, kPosition_4070) ? kCursorHand : kCursorNormal; getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorNormal, style); @@ -3040,7 +3050,7 @@ IMPLEMENT_FUNCTION(60, Anna, function60) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityAnna); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3268,7 +3278,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler) case kActionNone: if (getEntities()->isPlayerPosition(kCarRedSleeping, 46)) { - UPDATE_PARAM_GOTO(params->param4, getState()->timeTicks, 30, label_next); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 30)) + goto label_next; getScenes()->loadSceneFromPosition(kCarRedSleeping, 8); } @@ -3277,7 +3288,8 @@ IMPLEMENT_FUNCTION(67, Anna, chapter4Handler) label_next: if (params->param1) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; @@ -3407,7 +3419,8 @@ IMPLEMENT_FUNCTION(69, Anna, function69) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param2, getState()->time, 4500); + if (!Entity::updateParameter(params->param2, getState()->time, 4500)) + break; getData()->car = kCarRedSleeping; getData()->entityPosition = kPosition_9270; @@ -3417,7 +3430,7 @@ IMPLEMENT_FUNCTION(69, Anna, function69) break; } - TIME_CHECK_CALLBACK(kTime2535300, params->param3, 4, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallback(kTime2535300, params->param3, 4, WRAP_SETUP_FUNCTION(Anna, setup_callbackActionRestaurantOrSalon)); break; case kActionDefault: @@ -3533,7 +3546,7 @@ IMPLEMENT_FUNCTION(71, Anna, function71) getEntities()->exitCompartment(kEntityAnna, kObjectCompartmentF); getData()->entityPosition = kPosition_4070; - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -3589,7 +3602,7 @@ IMPLEMENT_FUNCTION_II(72, Anna, function72, CarIndex, EntityPosition) if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -3602,7 +3615,7 @@ IMPLEMENT_FUNCTION_II(72, Anna, function72, CarIndex, EntityPosition) case kActionDefault: if (getEntities()->updateEntity(kEntityAnna, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); } else if (!getEvent(kEventAnnaTired)) getData()->inventoryItem = kItemInvalid; break; @@ -3911,7 +3924,8 @@ IMPLEMENT_FUNCTION(80, Anna, function80) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->timeTicks, 450); + if (!Entity::updateParameter(params->param1, getState()->timeTicks, 450)) + break; getSound()->playSound(kEntityPlayer, "Kro5001", kFlagDefault); break; @@ -3980,7 +3994,8 @@ IMPLEMENT_FUNCTION(81, Anna, finalSequence) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->timeTicks, 180); + if (!Entity::updateParameter(params->param1, getState()->timeTicks, 180)) + break; getSound()->playSound(kEntityTrain, "LIB069"); getLogic()->gameOver(kSavegameTypeIndex, 2, kSceneNone, true); diff --git a/engines/lastexpress/entities/anna.h b/engines/lastexpress/entities/anna.h index 72c6db4bd9a0..205ff9d42c56 100644 --- a/engines/lastexpress/entities/anna.h +++ b/engines/lastexpress/entities/anna.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_ANNA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp index cfde8a2d6fb2..67d810fde25f 100644 --- a/engines/lastexpress/entities/august.cpp +++ b/engines/lastexpress/entities/august.cpp @@ -36,9 +36,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -150,7 +148,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION_SI(7, August, enterExitCompartment3, ObjectIndex) if (savepoint.action == kAction4) { getEntities()->exitCompartment(kEntityAugust, (ObjectIndex)params->param4); - CALLBACK_ACTION(); + callbackAction(); return; } @@ -177,7 +175,7 @@ IMPLEMENT_FUNCTION_IIS(10, August, callSavepointNoDrawing, EntityIndex, ActionIn if (!params->param6) getSavePoints()->call(kEntityAugust, (EntityIndex)params->param1, (ActionIndex)params->param2, (char *)¶ms->seq); - CALLBACK_ACTION(); + callbackAction(); break; case kAction10: @@ -233,7 +231,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue) case kActionNone: if (params->param1 < getState()->time && !params->param2) { params->param2 = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -262,7 +260,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue) case 1: if (ENTITY_PARAM(0, 1)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -272,7 +270,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue) case 2: case 3: if (ENTITY_PARAM(0, 1)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -289,7 +287,7 @@ IMPLEMENT_FUNCTION_I(17, August, function17, TimeValue) case 5: if (ENTITY_PARAM(0, 1)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -308,7 +306,7 @@ IMPLEMENT_FUNCTION_II(18, August, updateEntity2, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); } else if (getEntities()->isDistanceBetweenEntities(kEntityAugust, kEntityPlayer, 1000) && !getEntities()->isInGreenCarEntrance(kEntityPlayer) && !getEntities()->isInsideCompartments(kEntityPlayer) @@ -316,14 +314,14 @@ IMPLEMENT_FUNCTION_II(18, August, updateEntity2, CarIndex, EntityPosition) if (getData()->car == kCarGreenSleeping || getData()->car == kCarRedSleeping) { ENTITY_PARAM(0, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); } } break; case kActionDefault: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -407,7 +405,7 @@ IMPLEMENT_FUNCTION_II(19, August, function19, bool, bool) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityAugust); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -503,7 +501,7 @@ IMPLEMENT_FUNCTION_I(20, August, function20, bool) getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); getEntities()->exitCompartment(kEntityAugust, kObjectCompartment3, true); - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -520,12 +518,13 @@ IMPLEMENT_FUNCTION_I(21, August, function21, TimeValue) getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param2) { - UPDATE_PARAM_GOTO(params->param8, getState()->timeTicks, 75, label_continue); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75)) + goto label_continue; params->param2 = 0; params->param3 = 1; @@ -540,10 +539,10 @@ IMPLEMENT_FUNCTION_I(21, August, function21, TimeValue) break; if (params->param6) { - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 6300) + if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 6300)) { params->param6 = 0; CURRENT_PARAM(1, 1) = 0; - UPDATE_PARAM_PROC_END + } } if (!params->param4 @@ -753,7 +752,7 @@ IMPLEMENT_FUNCTION(22, August, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(August, setup_chapter1Handler)); break; case kActionDefault: @@ -786,7 +785,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) } else { getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true); getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -806,7 +805,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) } label_callback_8: - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->timeTicks, 75) + if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)) { getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true); if (getProgress().eventCorpseMovedFromFloor) { @@ -822,7 +821,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) setup_savegame(kSavegameTypeEvent, kEventAugustFindCorpse); } break; - UPDATE_PARAM_PROC_END + } label_callback_9: if (params->param3 && params->param1 < getState()->time && !CURRENT_PARAM(1, 5)) { @@ -842,7 +841,8 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) break; if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) { - UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75); + if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75)) + break; getObjects()->update(kObjectCompartment1, kEntityAugust, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal); @@ -867,7 +867,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) if (params->param8 >= 3) { getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -959,7 +959,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) case 2: getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -986,7 +986,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; case 5: @@ -1028,7 +1028,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) case 12: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 13: @@ -1056,7 +1056,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue) getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; case 15: @@ -1096,7 +1096,7 @@ IMPLEMENT_FUNCTION(24, August, dinner) getScenes()->loadSceneFromPosition(kCarRestaurant, 61); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -1485,7 +1485,8 @@ IMPLEMENT_FUNCTION(30, August, restaurant) break; case kActionNone: - UPDATE_PARAM(params->param3, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75)) + break; getData()->inventoryItem = kItemInvalid; break; @@ -1634,9 +1635,9 @@ IMPLEMENT_FUNCTION(32, August, function32) break; case kActionNone: - UPDATE_PARAM_PROC_TIME(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0); + if (Entity::updateParameterTime(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0)) { getSavePoints()->push(kEntityAugust, kEntityAnna, kAction123712592); - UPDATE_PARAM_PROC_END + } if (params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { if (!params->param4) { @@ -1645,18 +1646,19 @@ IMPLEMENT_FUNCTION(32, August, function32) } if (params->param7 != kTimeInvalid && params->param4 < getState()->time) { - UPDATE_PARAM_PROC_TIME(params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0); + if (Entity::updateParameterTime((TimeValue)params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0)) { getData()->location = kLocationOutsideCompartment; setCallback(5); setup_updatePosition("109D", kCarRestaurant, 56); break; - UPDATE_PARAM_PROC_END + } } } if (params->param3) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90)) + break; getScenes()->loadSceneFromPosition(kCarRestaurant, 55); } else { @@ -1813,7 +1815,7 @@ IMPLEMENT_FUNCTION(36, August, chapter2Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704); + Entity::timeCheckSavepoint(kTime1755000, params->param2, kEntityAugust, kEntityServers0, kAction252568704); if (getState()->time > kTime1773000 && params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->inventoryItem = kItemNone; @@ -1904,7 +1906,7 @@ IMPLEMENT_FUNCTION(37, August, function37) break; case kActionNone: - TIME_CHECK_CALLBACK_1(kTime1791000, params->param2, 5, setup_function20, true); + Entity::timeCheckCallback(kTime1791000, params->param2, 5, true, WRAP_SETUP_FUNCTION_B(August, setup_function20)); break; case kActionDefault: @@ -1962,9 +1964,9 @@ IMPLEMENT_FUNCTION(38, August, function38) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128); + Entity::timeCheckSavepoint(kTime1801800, params->param1, kEntityAugust, kEntityRebecca, kAction155980128); - TIME_CHECK_CALLBACK(kTime1820700, params->param2, 3, setup_callbackActionRestaurantOrSalon); + Entity::timeCheckCallback(kTime1820700, params->param2, 3, WRAP_SETUP_FUNCTION(August, setup_callbackActionRestaurantOrSalon)); break; case kActionDefault: @@ -2110,7 +2112,7 @@ IMPLEMENT_FUNCTION_II(41, August, function41, CarIndex, EntityPosition) getData()->inventoryItem = kItemNone; if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -2147,7 +2149,7 @@ IMPLEMENT_FUNCTION_II(41, August, function41, CarIndex, EntityPosition) case kActionDefault: if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -2172,7 +2174,7 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool) if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -2191,7 +2193,7 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool) case kActionDefault: if (getEntities()->updateEntity(kEntityAugust, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -2212,7 +2214,7 @@ IMPLEMENT_FUNCTION(43, August, chapter3Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081); + Entity::timeCheckSavepoint(kTime1953000, params->param2, kEntityAugust, kEntityAnna, kAction291662081); // Set as same position as Anna if (params->param1) { @@ -2402,7 +2404,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION(46, August, function46) switch (savepoint.action) { default: - TIME_CHECK_CALLBACK(kTime2088000, params->param1, 1, setup_function47); + Entity::timeCheckCallback(kTime2088000, params->param1, 1, WRAP_SETUP_FUNCTION(August, setup_function47)); break; case kActionNone: @@ -2473,7 +2475,7 @@ IMPLEMENT_FUNCTION(47, August, function47) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2487,7 +2489,7 @@ IMPLEMENT_FUNCTION(48, August, function48) break; case kActionNone: - TIME_CHECK(kTimeCityLinz, params->param1, setup_function49); + Entity::timeCheck(kTimeCityLinz, params->param1, WRAP_SETUP_FUNCTION(August, setup_function49)); break; case kActionKnock: @@ -2770,7 +2772,8 @@ IMPLEMENT_FUNCTION(54, August, function54) getData()->inventoryItem = kItemInvalid; if (!params->param2 && params->param1) { - UPDATE_PARAM(params->param5, getState()->time, params->param1); + if (!Entity::updateParameter(params->param5, getState()->time, params->param1)) + break; getData()->inventoryItem = kItemNone; setup_function55(); @@ -3046,7 +3049,8 @@ IMPLEMENT_FUNCTION(60, August, function60) if (!params->param1) break; - UPDATE_PARAM(params->param3, getState()->time, 9000); + if (!Entity::updateParameter(params->param3, getState()->time, 9000)) + break; setCallback(1); setup_callbackActionRestaurantOrSalon(); @@ -3142,7 +3146,8 @@ IMPLEMENT_FUNCTION(62, August, function62) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 900); + if (!Entity::updateParameter(params->param1, getState()->time, 900)) + break; getSound()->playSound(kEntityAugust, "Aug4003A"); @@ -3220,9 +3225,9 @@ IMPLEMENT_FUNCTION(63, August, function63) break; case kActionNone: - UPDATE_PARAM_PROC(params->param3, getState()->time, 1800) + if (Entity::updateParameter(params->param3, getState()->time, 1800)) { getData()->inventoryItem = kItemInvalid; - UPDATE_PARAM_PROC_END + } if (getState()->time > kTime2488500 && !params->param4) { params->param4 = 1; @@ -3231,7 +3236,8 @@ IMPLEMENT_FUNCTION(63, August, function63) break; } - UPDATE_PARAM(params->param5, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, params->param1)) + break; params->param2 = (params->param6 < 1 ? 1 : 0); @@ -3388,7 +3394,8 @@ IMPLEMENT_FUNCTION(68, August, function68) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param4, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; diff --git a/engines/lastexpress/entities/august.h b/engines/lastexpress/entities/august.h index 2cbb31b968c5..606321955be4 100644 --- a/engines/lastexpress/entities/august.h +++ b/engines/lastexpress/entities/august.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_AUGUST_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp index 315b12a69e55..219ddf901b90 100644 --- a/engines/lastexpress/entities/boutarel.cpp +++ b/engines/lastexpress/entities/boutarel.cpp @@ -32,9 +32,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -231,7 +229,7 @@ IMPLEMENT_FUNCTION_I(11, Boutarel, function11, bool) case 7: getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -249,7 +247,7 @@ IMPLEMENT_FUNCTION(12, Boutarel, enterTableWithMmeBoutarel) getSavePoints()->push(kEntityBoutarel, kEntityTables2, kAction136455232); getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -276,7 +274,7 @@ IMPLEMENT_FUNCTION(13, Boutarel, leaveTableWithMmeBoutarel) getSavePoints()->push(kEntityBoutarel, kEntityTables2, kActionDrawTablesWithChairs, "008F"); getEntities()->clearSequences(kEntityMmeBoutarel); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -358,7 +356,7 @@ IMPLEMENT_FUNCTION_I(14, Boutarel, function14, bool) getEntities()->clearSequences(kEntityBoutarel); getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -416,7 +414,7 @@ IMPLEMENT_FUNCTION_IS(15, Boutarel, function15, bool) case 5: getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -464,7 +462,7 @@ IMPLEMENT_FUNCTION_IS(16, Boutarel, function16, bool) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityBoutarel); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -478,10 +476,13 @@ IMPLEMENT_FUNCTION_IS(17, Boutarel, function17, TimeValue) break; case kActionNone: - TIME_CHECK_CALLBACK_ACTION(params->param1, params->param6); + if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param6)) + break; if (params->param5) { - UPDATE_PARAM(params->param7, getState()->timeTicks, 90) + if (!Entity::updateParameter(params->param7, getState()->timeTicks, 90)) + break; + getScenes()->loadSceneFromPosition(kCarRestaurant, 51); } else { params->param7 = 0; @@ -511,12 +512,13 @@ IMPLEMENT_FUNCTION_I(18, Boutarel, function18, TimeValue) getObjects()->update(kObjectCompartmentC, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); getObjects()->update(kObject50, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param2) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param2 = 0; params->param3 = 1; @@ -615,7 +617,7 @@ IMPLEMENT_FUNCTION(19, Boutarel, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_chapter1Handler)); break; case kActionDefault: @@ -644,14 +646,14 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20) break; if (!params->param2) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 4500) + if (Entity::updateParameter(params->param3, getState()->time, 4500)) { setCallback(3); setup_playSound("MRB1078A"); break; - UPDATE_PARAM_PROC_END + } } - TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false); + Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case kActionDefault: @@ -676,13 +678,13 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20) break; case 3: - TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false); + Entity::timeCheckCallback(kTime1138500, params->param4, 4, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case 4: getSavePoints()->push(kEntityBoutarel, kEntityCooks, kAction224849280); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -834,7 +836,7 @@ IMPLEMENT_FUNCTION(24, Boutarel, chapter2Handler) break; case kActionNone: - TIME_CHECK_CALLBACK_1(kTime1759500, params->param2, 1, setup_function14, false); + Entity::timeCheckCallback(kTime1759500, params->param2, 1, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case kActionDefault: @@ -934,9 +936,9 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29) break; case kActionNone: - UPDATE_PARAM_PROC(params->param2, getState()->time, 450) + if (Entity::updateParameter(params->param2, getState()->time, 450)) { getSavePoints()->push(kEntityBoutarel, kEntityServers1, kAction256200848); - UPDATE_PARAM_PROC_END + } if (!params->param1) break; @@ -959,7 +961,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29) } } - TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true); + Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case kActionDefault: @@ -972,7 +974,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29) break; case 1: - TIME_CHECK_CALLBACK_1(kTime2002500, params->param4, 1, setup_function14, true); + Entity::timeCheckCallback(kTime2002500, params->param4, 1, true, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case 2: @@ -1045,7 +1047,7 @@ IMPLEMENT_FUNCTION(32, Boutarel, chapter4Handler) break; case kActionNone: - TIME_CHECK(kTime2367000, params->param1, setup_function33); + Entity::timeCheck(kTime2367000, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function33)); break; case kActionDefault: @@ -1063,7 +1065,7 @@ IMPLEMENT_FUNCTION(33, Boutarel, function33) case kActionNone: if (params->param1) - TIME_CHECK_CALLBACK_1(kTime2389500, params->param2, 3, setup_function14, false); + Entity::timeCheckCallback(kTime2389500, params->param2, 3, false, WRAP_SETUP_FUNCTION_B(Boutarel, setup_function14)); break; case kActionDefault: @@ -1111,7 +1113,8 @@ IMPLEMENT_FUNCTION(34, Boutarel, function34) break; case kActionNone: - TIME_CHECK(kTime2470500, params->param1, setup_function35); + if (Entity::timeCheck(kTime2470500, params->param1, WRAP_SETUP_FUNCTION(Boutarel, setup_function35))) + break; if (getState()->time > kTime2457000 && getEvent(kEventAugustDrink)) { getSavePoints()->push(kEntityBoutarel, kEntityAbbot, kAction159003408); diff --git a/engines/lastexpress/entities/boutarel.h b/engines/lastexpress/entities/boutarel.h index 5eb264631cec..04838f65273a 100644 --- a/engines/lastexpress/entities/boutarel.h +++ b/engines/lastexpress/entities/boutarel.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_BOUTAREL_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp index 4ef2dc50e8cc..a2f3a3d871eb 100644 --- a/engines/lastexpress/entities/chapters.cpp +++ b/engines/lastexpress/entities/chapters.cpp @@ -63,11 +63,9 @@ #include "lastexpress/game/state.h" #include "lastexpress/menu/menu.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -152,7 +150,7 @@ IMPLEMENT_FUNCTION(5, Chapters, resetMainEntities) RESET_ENTITY_STATE(kEntityVesna, Vesna, setup_reset); RESET_ENTITY_STATE(kEntityYasmin, Yasmin, setup_reset); - CALLBACK_ACTION(); + callbackAction(); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -191,7 +189,7 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End) getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); } else { getSound()->playSound(kEntityPlayer, "LIB014"); getSound()->playSound(kEntityPlayer, "LIB015", kFlagDefault, 15); @@ -386,12 +384,6 @@ IMPLEMENT_FUNCTION(7, Chapters, chapter1Init) IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// -#define PLAY_STEAM() { \ - getSoundQueue()->resetState(); \ - getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); \ - ENTITY_PARAM(0, 2) = 0; \ - } - IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler) switch (savepoint.action) { default: @@ -401,21 +393,28 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler) if (!getProgress().isTrainRunning || getState()->time >= kTime1458000) goto label_processStations; - UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param2) + if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param2)) { // Play sound FX getSound()->playLocomotiveSound(); params->param2 = 225 * (4 * rnd(5) + 20); params->param6 = 0; - UPDATE_PARAM_PROC_END + } label_processStations: // Process stations - TIME_CHECK_CALLBACK_2(kTime1039500, params->param7, 1, setup_savegame, kSavegameTypeTime, kTimeNone); + if (getState()->time > kTime1039500 && !params->param7) { + params->param7 = 1; + setCallback(1); + setup_savegame(kSavegameTypeTime, kTimeNone); + + break; + } label_enter_epernay: // Entering Epernay station - TIME_CHECK_CALLBACK_2(kTimeEnterEpernay, params->param8, 1, setup_enterStation, "Epernay", kCityEpernay); + if (timeCheckEnterStation(kTimeEnterEpernay, params->param8, 1, "Epernay", kCityEpernay)) + break; label_exit_epernay: // Exiting Epernay station @@ -445,19 +444,23 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler) goto label_exit_strasbourg; // Entering Chalons station - TIME_CHECK_CALLBACK_2(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, setup_enterStation, "Chalons", kCityChalons); + if (timeCheckEnterStation(kTimeEnterChalons, CURRENT_PARAM(1, 3), 5, "Chalons", kCityChalons)) + break; label_exit_chalons: // Exiting Chalons station - TIME_CHECK_CALLBACK_1(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, setup_exitStation, "Chalons"); + if (timeCheckExitStation(kTimeExitChalons, CURRENT_PARAM(1, 4), 6, "Chalons")) + break; label_enter_barleduc: // Entering Bar-Le-Duc station - TIME_CHECK_CALLBACK_2(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, setup_enterStation, "BarLeDuc", kCityBarleduc); + if (timeCheckEnterStation(kTimeCityBarLeDuc, CURRENT_PARAM(1, 5), 7, "BarLeDuc", kCityBarleduc)) + break; label_exit_barleduc: // Exiting Bar-Le-Duc station - TIME_CHECK_CALLBACK_1(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, setup_exitStation, "BarLeDuc"); + if (timeCheckExitStation(kTimeExitBarLeDuc, CURRENT_PARAM(1, 6), 8, "BarLeDuc")) + break; label_enter_nancy: if (getState()->time > kTime1260000 && !CURRENT_PARAM(1, 7)) { @@ -466,50 +469,67 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler) } // Entering Nancy station - TIME_CHECK_CALLBACK_2(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, setup_enterStation, "Nancy", kCityNancy); + if (timeCheckEnterStation(kTimeCityNancy, CURRENT_PARAM(1, 8), 9, "Nancy", kCityNancy)) + break; label_exit_nancy: // Exiting Nancy station - TIME_CHECK_CALLBACK_1(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, setup_exitStation, "Nancy"); + if (timeCheckExitStation(kTimeExitNancy, CURRENT_PARAM(2, 1), 10, "Nancy")) + break; label_enter_luneville: // Entering Luneville station - TIME_CHECK_CALLBACK_2(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, setup_enterStation, "Luneville", kCityLuneville); + if (timeCheckEnterStation(kTimeCityLuneville, CURRENT_PARAM(2, 2), 11, "Luneville", kCityLuneville)) + break; label_exit_luneville: // Exiting Luneville station - TIME_CHECK_CALLBACK_1(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, setup_exitStation, "Luneville"); + if (timeCheckExitStation(kTimeExitLuneville, CURRENT_PARAM(2, 3), 12, "Luneville")) + break; label_enter_avricourt: // Entering Avricourt station - TIME_CHECK_CALLBACK_2(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, setup_enterStation, "Avricourt", kCityAvricourt); + if (timeCheckEnterStation(kTimeCityAvricourt, CURRENT_PARAM(2, 4), 13, "Avricourt", kCityAvricourt)) + break; label_exit_avricourt: // Exiting Avricourt station - TIME_CHECK_CALLBACK_1(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, setup_exitStation, "Avricourt"); + if (timeCheckExitStation(kTimeExitAvricourt, CURRENT_PARAM(2, 5), 14, "Avricourt")) + break; label_enter_deutschavricourt: // Entering Deutsch-Avricourt station - TIME_CHECK_CALLBACK_2(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, setup_enterStation, "DeutschA", kCityDeutschAvricourt); + if (timeCheckEnterStation(kTimeCityDeutschAvricourt, CURRENT_PARAM(2, 6), 15, "DeutschA", kCityDeutschAvricourt)) + break; label_exit_deutschavricourt: // Exiting Avricourt station - TIME_CHECK_CALLBACK_1(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, setup_exitStation, "DeutschA"); + if (timeCheckExitStation(kTimeExitDeutschAvricourt, CURRENT_PARAM(2, 7), 16, "DeutschA")) + break; label_enter_strasbourg: - TIME_CHECK_CALLBACK_2(kTimeCityStrasbourg, CURRENT_PARAM(2, 8), 17, setup_savegame, kSavegameTypeTime, kTimeNone); + if (getState()->time > kTimeCityStrasbourg && !CURRENT_PARAM(2, 8)) { + CURRENT_PARAM(2, 8) = 1; + setCallback(17); + setup_savegame(kSavegameTypeTime, kTimeNone); + + break; + } label_exit_strasbourg: // Exiting Strasbourg station - TIME_CHECK_CALLBACK_1(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, setup_exitStation, "Strasbou"); + if (timeCheckExitStation(kTimeExitStrasbourg, CURRENT_PARAM(3, 1), 19, "Strasbou")) + break; label_enter_badenoos: // Entering Baden Oos station - TIME_CHECK_CALLBACK_2(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, setup_enterStation, "BadenOos", kCityBadenOos); + if (timeCheckEnterStation(kTimeCityBadenOos, CURRENT_PARAM(3, 2), 20, "BadenOos", kCityBadenOos)) + break; label_exit_badenoos: // Exiting Baden Oos station - TIME_CHECK_CALLBACK_1(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, setup_exitStation, "BadenOos"); + if (timeCheckExitStation(kTimeExitBadenOos, CURRENT_PARAM(3, 3), 21, "BadenOos")) + break; label_chapter1_next: if (getState()->time > kTimeChapter1End3 && ! CURRENT_PARAM(3, 4)) { @@ -524,43 +544,43 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler) getSavePoints()->push(kEntityChapters, kEntityTrain, kActionTrainStopRunning); if (getEntityData(kEntityPlayer)->location != kLocationOutsideTrain) { - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isOutsideAlexeiWindow()) { getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49); - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isOutsideAnnaWindow()) { getScenes()->loadSceneFromPosition(kCarRedSleeping, 49); - PLAY_STEAM(); + playSteam(); break; } CarIndex car = getEntityData(kEntityPlayer)->car; if (car < kCarRedSleeping || car > kCarCoalTender) { if (car < kCarBaggageRear || car > kCarGreenSleeping) { - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isPlayerPosition(kCarGreenSleeping, 98)) { getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadSceneFromPosition(kCarGreenSleeping, 71); - PLAY_STEAM(); + playSteam(); break; } getScenes()->loadSceneFromPosition(kCarGreenSleeping, 82); - PLAY_STEAM(); + playSteam(); break; } getScenes()->loadSceneFromPosition(kCarRestaurant, 82); - PLAY_STEAM(); + playSteam(); break; } @@ -817,7 +837,8 @@ IMPLEMENT_FUNCTION(12, Chapters, chapter2Handler) if (!getProgress().isTrainRunning) break; - UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1)) + break; getSound()->playLocomotiveSound(); @@ -903,15 +924,15 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler) case kActionNone: if (getProgress().isTrainRunning) { - UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, params->param1) + if (Entity::updateParameter(params->param4, getState()->timeTicks, params->param1)) { getSound()->playLocomotiveSound(); params->param1 = 225 * (4 * rnd(5) + 20); params->param4 = 0; - UPDATE_PARAM_PROC_END + } } - UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, params->param2) + if (Entity::updateParameter(params->param5, getState()->timeTicks, params->param2)) { switch (rnd(2)) { default: break; @@ -927,30 +948,38 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler) params->param2 = 225 * (4 * rnd(6) + 8); params->param5 = 0; - UPDATE_PARAM_PROC_END + } - TIME_CHECK_CALLBACK_2(kTimeEnterSalzbourg, params->param6, 1, setup_enterStation, "Salzburg", kCitySalzbourg); + if (timeCheckEnterStation(kTimeEnterSalzbourg, params->param6, 1, "Salzburg", kCitySalzbourg)) + break; label_callback_1: - TIME_CHECK_CALLBACK_1(kTimeExitSalzbourg, params->param7, 2, setup_exitStation, "Salzburg"); + if (timeCheckExitStation(kTimeExitSalzbourg, params->param7, 2, "Salzburg")) + break; label_callback_2: - TIME_CHECK_CALLBACK_2(kTimeEnterAttnangPuchheim, params->param8, 3, setup_enterStation, "Attnang", kCityAttnangPuchheim); + if (timeCheckEnterStation(kTimeEnterAttnangPuchheim, params->param8, 3, "Attnang", kCityAttnangPuchheim)) + break; label_callback_3: - TIME_CHECK_CALLBACK_1(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, setup_exitStation, "Attnang"); + if (timeCheckExitStation(kTimeExitAttnangPuchheim, CURRENT_PARAM(1, 1), 4, "Attnang")) + break; label_callback_4: - TIME_CHECK_CALLBACK_2(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, setup_enterStation, "Wels", kCityWels); + if (timeCheckEnterStation(kTimeEnterWels, CURRENT_PARAM(1, 2), 5, "Wels", kCityWels)) + break; label_callback_5: - TIME_CHECK_CALLBACK_1(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, setup_exitStation, "Wels"); + if (timeCheckExitStation(kTimeEnterWels, CURRENT_PARAM(1, 3), 6, "Wels")) + break; label_callback_6: - TIME_CHECK_CALLBACK_2(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, setup_enterStation, "Linz", kCityLinz); + if (timeCheckEnterStation(kTimeEnterLinz, CURRENT_PARAM(1, 4), 7, "Linz", kCityLinz)) + break; label_callback_7: - TIME_CHECK_CALLBACK_1(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, setup_exitStation, "Linz"); + if (timeCheckExitStation(kTimeCityLinz, CURRENT_PARAM(1, 5), 8, "Linz")) + break; label_callback_8: if (getState()->time > kTime2187000 && !CURRENT_PARAM(1, 6)) { @@ -958,7 +987,7 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler) getState()->timeDelta = 5; } - TIME_CHECK_CALLBACK_2(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, setup_enterStation, "Vienna", kCityVienna); + timeCheckEnterStation(kTimeCityVienna, CURRENT_PARAM(1, 7), 9, "Vienna", kCityVienna); break; case kActionEndSound: @@ -1202,15 +1231,15 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler) case kActionNone: if (getProgress().isTrainRunning) { - UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param4); + if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param4)) { getSound()->playLocomotiveSound(); params->param4 = 225 * (4 * rnd(5) + 20); params->param6 = 0; - UPDATE_PARAM_PROC_END + } } - UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, params->param5) + if (Entity::updateParameter(params->param7, getState()->timeTicks, params->param5)) { switch (rnd(2)) { default: break; @@ -1226,12 +1255,14 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler) params->param5 = 225 * (4 * rnd(6) + 8); params->param7 = 0; - UPDATE_PARAM_PROC_END + } - TIME_CHECK_CALLBACK_2(kTimeEnterPoszony, params->param8, 1, setup_enterStation, "Pozsony", kCityPoszony); + if (timeCheckEnterStation(kTimeEnterPoszony, params->param8, 1, "Pozsony", kCityPoszony)) + break; label_exitPozsony: - TIME_CHECK_CALLBACK_1(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, setup_exitStation, "Pozsony"); + if (timeCheckExitStation(kTimeExitPoszony, CURRENT_PARAM(1, 1), 2, "Pozsony")) + break; label_enterGalanta: if (getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1) { @@ -1244,10 +1275,12 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler) if (params->param1) goto label_callback_4; - TIME_CHECK_CALLBACK_2(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, setup_enterStation, "Galanta", kCityGalanta); + if (timeCheckEnterStation(kTimeEnterGalanta, CURRENT_PARAM(1, 3), 3, "Galanta", kCityGalanta)) + break; label_exitGalanta: - TIME_CHECK_CALLBACK_1(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, setup_exitStation, "Galanta"); + if (timeCheckExitStation(kTimeExitGalanta, CURRENT_PARAM(1, 4), 4, "Galanta")) + break; label_callback_4: if (getState()->time > kTime2470500 && !CURRENT_PARAM(1, 5)) { @@ -1280,43 +1313,43 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler) getSavePoints()->push(kEntityChapters, kEntityTrain, kActionTrainStopRunning); if (getEntityData(kEntityPlayer)->location != kLocationOutsideTrain) { - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isOutsideAlexeiWindow()) { getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49); - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isOutsideAnnaWindow()) { getScenes()->loadSceneFromPosition(kCarRedSleeping, 49); - PLAY_STEAM(); + playSteam(); break; } CarIndex car = getEntityData(kEntityPlayer)->car; if (car < kCarRedSleeping || car > kCarCoalTender) { if (car < kCarBaggageRear || car > kCarGreenSleeping) { - PLAY_STEAM(); + playSteam(); break; } if (getEntities()->isPlayerPosition(kCarGreenSleeping, 98)) { getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadSceneFromPosition(kCarGreenSleeping, 71); - PLAY_STEAM(); + playSteam(); break; } getScenes()->loadSceneFromPosition(kCarGreenSleeping, 82); - PLAY_STEAM(); + playSteam(); break; } getScenes()->loadSceneFromPosition(kCarRestaurant, 82); - PLAY_STEAM(); + playSteam(); break; } @@ -1815,7 +1848,37 @@ void Chapters::enterExitHelper(bool isEnteringStation) { ENTITY_PARAM(0, 3) = 1; } - CALLBACK_ACTION(); + callbackAction(); +} + +void Chapters::playSteam() { + getSoundQueue()->resetState(); + getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); + ENTITY_PARAM(0, 2) = 0; +} + +bool Chapters::timeCheckEnterStation(TimeValue timeValue, uint ¶meter, byte callback, const char *sequence, CityIndex cityIndex) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + setup_enterStation(sequence, cityIndex); + + return true; + } + + return false; +} + +bool Chapters::timeCheckExitStation(TimeValue timeValue, uint ¶meter, byte callback, const char *sequence) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + setup_exitStation(sequence); + + return true; + } + + return false; } } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h index 353d3a6b5b44..ddb3de3bea6a 100644 --- a/engines/lastexpress/entities/chapters.h +++ b/engines/lastexpress/entities/chapters.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_CHAPTERS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { @@ -154,8 +153,11 @@ class Chapters : public Entity { DECLARE_FUNCTION(chapter5Handler) private: + bool timeCheckEnterStation(TimeValue timeValue, uint ¶meter, byte callback, const char *sequence, CityIndex cityIndex); + bool timeCheckExitStation(TimeValue timeValue, uint ¶meter, byte callback, const char *sequence); void enterExitStation(const SavePoint &savepoint, bool isEnteringStation); void enterExitHelper(bool isEnteringStation); + void playSteam(); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp index 42e888cc7c71..5e8a2df8cb70 100644 --- a/engines/lastexpress/entities/cooks.cpp +++ b/engines/lastexpress/entities/cooks.cpp @@ -29,9 +29,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -96,7 +94,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3) case kActionDrawScene: if (!getEntities()->isInKitchen(kEntityPlayer)) { getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -108,7 +106,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3) if (!getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -122,7 +120,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3) if (params->param1 && !getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); } break; @@ -182,7 +180,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4) case kActionDrawScene: if (!getEntities()->isInKitchen(kEntityPlayer)) { getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -194,7 +192,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4) if (!getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -208,7 +206,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4) if (params->param1 && !getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); getEntities()->clearSequences(kEntityCooks); - CALLBACK_ACTION(); + callbackAction(); } break; @@ -241,7 +239,7 @@ IMPLEMENT_FUNCTION(5, Cooks, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Cooks, setup_chapter1Handler)); break; case kActionDefault: @@ -262,7 +260,8 @@ IMPLEMENT_FUNCTION(6, Cooks, chapter1Handler) break; case kActionNone: - UPDATE_PARAM(params->param4, getState()->time, params->param2); + if (!Entity::updateParameter(params->param4, getState()->time, params->param2)) + break; // Broken plate sound getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks)); @@ -375,7 +374,8 @@ IMPLEMENT_FUNCTION(9, Cooks, chapter2Handler) break; case kActionNone: - UPDATE_PARAM(params->param3, getState()->time, params->param1); + if (!Entity::updateParameter(params->param3, getState()->time, params->param1)) + break; // Broken plate sound getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks)); @@ -434,12 +434,12 @@ IMPLEMENT_FUNCTION(11, Cooks, chapter3Handler) break; case kActionNone: - UPDATE_PARAM_PROC(params->param4, getState()->time, params->param2) + if (Entity::updateParameter(params->param4, getState()->time, params->param2)) { // Broken plate sound getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks)); params->param2 = 225 * (4 * rnd(30) + 120); params->param4 = 0; - UPDATE_PARAM_PROC_END + } if (getState()->time > kTime2079000 && !params->param5) { params->param1 = 0; @@ -526,7 +526,8 @@ IMPLEMENT_FUNCTION(13, Cooks, chapter4Handler) break; case kActionNone: - UPDATE_PARAM(params->param3, getState()->time, params->param1) + if (!Entity::updateParameter(params->param3, getState()->time, params->param1)) + break; // Broken plate sound getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks)); diff --git a/engines/lastexpress/entities/cooks.h b/engines/lastexpress/entities/cooks.h index 3ab7d3516190..f01d0b2ca079 100644 --- a/engines/lastexpress/entities/cooks.h +++ b/engines/lastexpress/entities/cooks.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_COOKS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp index c3e7e37b881c..b60427790355 100644 --- a/engines/lastexpress/entities/coudert.cpp +++ b/engines/lastexpress/entities/coudert.cpp @@ -32,22 +32,11 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { -#define SAVEGAME_BLOOD_JACKET() \ - if (getProgress().jacket == kJacketBlood \ - && getEntities()->isDistanceBetweenEntities(kEntityCoudert, kEntityPlayer, 1000) \ - && !getEntities()->isInsideCompartments(kEntityPlayer) \ - && !getEntities()->checkFields10(kEntityPlayer)) { \ - setCallback(1); \ - setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); \ - } - Coudert::Coudert(LastExpressEngine *engine) : Entity(engine, kEntityCoudert) { ADD_CALLBACK_FUNCTION(Coudert, reset); ADD_CALLBACK_FUNCTION(Coudert, bloodJacket); @@ -126,11 +115,11 @@ IMPLEMENT_FUNCTION_S(2, Coudert, bloodJacket) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -153,7 +142,7 @@ IMPLEMENT_FUNCTION_SI(3, Coudert, enterExitCompartment, ObjectIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); return; case kActionCallback: @@ -175,15 +164,15 @@ IMPLEMENT_FUNCTION(4, Coudert, callbackActionOnDirection) case kActionNone: if (getData()->direction != kDirectionRight) { - CALLBACK_ACTION(); + callbackAction(); break; } - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -202,7 +191,7 @@ IMPLEMENT_FUNCTION_SIII(5, Coudert, enterExitCompartment2, ObjectIndex, EntityPo break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); return; case kActionCallback: @@ -223,11 +212,11 @@ IMPLEMENT_FUNCTION_S(6, Coudert, playSound) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -252,11 +241,11 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -296,7 +285,7 @@ IMPLEMENT_FUNCTION_II(9, Coudert, updateEntity, CarIndex, EntityPosition) if (getEntities()->updateEntity(kEntityCoudert, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -332,7 +321,7 @@ IMPLEMENT_FUNCTION_II(9, Coudert, updateEntity, CarIndex, EntityPosition) params->param3 = kItemInvalid; if (getEntities()->updateEntity(kEntityCoudert, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -365,11 +354,12 @@ IMPLEMENT_FUNCTION_I(10, Coudert, updateFromTime, uint32) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); - UPDATE_PARAM(params->param2, getState()->time, params->param1); + if (!Entity::updateParameter(params->param2, getState()->time, params->param1)) + break; - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -388,11 +378,12 @@ IMPLEMENT_FUNCTION_I(11, Coudert, updateFromTicks, uint32) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); - UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, params->param1)) + break; - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -412,7 +403,7 @@ IMPLEMENT_FUNCTION_I(12, Coudert, excuseMe, EntityIndex) return; if (getSoundQueue()->isBuffered(kEntityCoudert)) { - CALLBACK_ACTION(); + callbackAction(); return; } @@ -452,7 +443,7 @@ IMPLEMENT_FUNCTION_I(12, Coudert, excuseMe, EntityIndex) getSound()->playSound(kEntityCoudert, "JAC1112E"); } - CALLBACK_ACTION(); + callbackAction(); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -462,7 +453,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); if (!params->param2 && !params->param3) { @@ -487,7 +478,8 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex) } } - UPDATE_PARAM(params->param5, getState()->timeTicks, 225); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 225)) + break; getData()->inventoryItem = kItemNone; setCallback(5); @@ -561,7 +553,7 @@ IMPLEMENT_FUNCTION_II(13, Coudert, function13, bool, EntityIndex) case 5: case 6: case 7: - CALLBACK_ACTION(); + callbackAction(); break; case 9: @@ -584,7 +576,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionDefault: @@ -629,7 +621,7 @@ IMPLEMENT_FUNCTION_I(14, Coudert, function14, EntityIndex) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -706,7 +698,7 @@ IMPLEMENT_FUNCTION_I(15, Coudert, function15, bool) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -724,7 +716,7 @@ IMPLEMENT_FUNCTION(16, Coudert, function16) ENTITY_PARAM(2, 1) = 0; getInventory()->setLocationAndProcess(kItem5, kObjectLocation1); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -743,7 +735,7 @@ IMPLEMENT_FUNCTION(16, Coudert, function16) if (!getEntities()->isPlayerPosition(kCarRedSleeping, 2)) getData()->entityPosition = kPosition_2088; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -761,7 +753,7 @@ IMPLEMENT_FUNCTION_I(17, Coudert, function17, bool) if (ENTITY_PARAM(2, 1)) { ENTITY_PARAM(2, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -789,7 +781,7 @@ IMPLEMENT_FUNCTION_I(17, Coudert, function17, bool) case 1: case 2: case 3: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -817,7 +809,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18) getEntities()->drawSequenceLeft(kEntityCoudert, "627K"); getScenes()->loadSceneFromItemPosition(kItem5); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -849,7 +841,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18) break; case 2: - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -857,7 +849,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18) ENTITY_PARAM(0, 1) = 0; getSavePoints()->push(kEntityCoudert, kEntityCoudert, kActionDrawScene); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -876,14 +868,14 @@ IMPLEMENT_FUNCTION_I(19, Coudert, function19, bool) || ENTITY_PARAM(2, 4) || ENTITY_PARAM(2, 6)) { getInventory()->setLocationAndProcess(kItem5, kObjectLocation1); ENTITY_PARAM(2, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } if (ENTITY_PARAM(0, 3) || ENTITY_PARAM(0, 5) || ENTITY_PARAM(0, 4)) { getScenes()->loadSceneFromItemPosition(kItem5); ENTITY_PARAM(2, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -903,7 +895,7 @@ IMPLEMENT_FUNCTION_I(19, Coudert, function19, bool) getEntities()->drawSequenceLeft(kEntityCoudert, ENTITY_PARAM(0, 2) ? "627B" : "627E"); ENTITY_PARAM(0, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -916,11 +908,12 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex) break; case kActionNone: - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 3), getState()->time, 300) + if (Entity::updateParameter(CURRENT_PARAM(1, 3), getState()->time, 300)) { getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityCoudert)); - UPDATE_PARAM_PROC_END + } - UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->time, 900); + if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 900)) + break; getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1); @@ -930,7 +923,7 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex) if (params->param2) getObjects()->update((ObjectIndex)params->param2, (EntityIndex)params->param7, (ObjectLocation)params->param8, (CursorStyle)CURRENT_PARAM(1, 1), (CursorStyle)CURRENT_PARAM(1, 2)); - CALLBACK_ACTION(); + callbackAction(); break; case kActionKnock: @@ -999,7 +992,8 @@ IMPLEMENT_FUNCTION(21, Coudert, function21) case kActionNone: if (!params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment("627Zh", kObjectCompartmentH); @@ -1044,7 +1038,7 @@ IMPLEMENT_FUNCTION(21, Coudert, function21) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1073,7 +1067,7 @@ IMPLEMENT_FUNCTION(21, Coudert, function21) getData()->location = kLocationOutsideCompartment; getSavePoints()->push(kEntityCoudert, kEntityIvo, kAction123852928); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1100,7 +1094,8 @@ IMPLEMENT_FUNCTION(22, Coudert, function22) case kActionNone: if (!params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment("627Rg", kObjectCompartmentG); @@ -1145,7 +1140,7 @@ IMPLEMENT_FUNCTION(22, Coudert, function22) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1174,7 +1169,7 @@ IMPLEMENT_FUNCTION(22, Coudert, function22) getData()->location = kLocationOutsideCompartment; getSavePoints()->push(kEntityCoudert, kEntityMilos, kAction123852928); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1225,7 +1220,7 @@ IMPLEMENT_FUNCTION(23, Coudert, function23) case 3: getEntities()->exitCompartment(kEntityCoudert, kObjectCompartmentF, true); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1296,7 +1291,7 @@ IMPLEMENT_FUNCTION(25, Coudert, function25) getData()->location = kLocationOutsideCompartment; getSavePoints()->push(kEntityCoudert, kEntityRebecca, kAction123852928); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1311,7 +1306,8 @@ IMPLEMENT_FUNCTION(26, Coudert, function26) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment2("627Zd", kObjectCompartmentD, kPosition_5790, kPosition_6130); @@ -1357,7 +1353,7 @@ IMPLEMENT_FUNCTION(26, Coudert, function26) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1375,7 +1371,7 @@ IMPLEMENT_FUNCTION(26, Coudert, function26) getData()->location = kLocationOutsideCompartment; getSavePoints()->push(kEntityCoudert, kEntityMmeBoutarel, kAction123852928); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1402,7 +1398,8 @@ IMPLEMENT_FUNCTION(27, Coudert, function27) case kActionNone: if (!params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment2("627Rc", kObjectCompartmentC, kPosition_6470, kPosition_6130); @@ -1446,7 +1443,7 @@ IMPLEMENT_FUNCTION(27, Coudert, function27) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1473,7 +1470,7 @@ IMPLEMENT_FUNCTION(27, Coudert, function27) getData()->location = kLocationOutsideCompartment; getSavePoints()->push(kEntityCoudert, kEntityBoutarel, kAction123852928); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1515,7 +1512,7 @@ IMPLEMENT_FUNCTION_I(30, Coudert, function30, ObjectIndex) case kActionDefault: switch (parameters->param1) { default: - CALLBACK_ACTION(); + callbackAction(); // Stop processing here return; @@ -1615,7 +1612,7 @@ IMPLEMENT_FUNCTION_I(30, Coudert, function30, ObjectIndex) break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1654,7 +1651,7 @@ IMPLEMENT_FUNCTION_I(31, Coudert, function31, uint32) case 2: case 3: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1699,7 +1696,7 @@ IMPLEMENT_FUNCTION(32, Coudert, function32) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1726,7 +1723,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33) setup_updateEntity(kCarRedSleeping, kPosition_540); } } else { - CALLBACK_ACTION(); + callbackAction(); } break; @@ -1763,7 +1760,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33) case 4: ENTITY_PARAM(2, 6) = 0; - CALLBACK_ACTION(); + callbackAction(); break; case 5: @@ -1808,7 +1805,7 @@ IMPLEMENT_FUNCTION(33, Coudert, function33) case 10: ENTITY_PARAM(2, 6) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1882,7 +1879,7 @@ IMPLEMENT_FUNCTION_I(34, Coudert, function34, bool) break; case 7: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1902,7 +1899,8 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool) getScenes()->loadSceneFromPosition(kCarRestaurant, 65); } - UPDATE_PARAM(params->param2, getState()->time, 2700); + if (!Entity::updateParameter(params->param2, getState()->time, 2700)) + break; getSavePoints()->push(kEntityCoudert, kEntityMax, kActionMaxFreeFromCage); @@ -1951,7 +1949,7 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1965,7 +1963,7 @@ IMPLEMENT_FUNCTION(36, Coudert, chapter1) break; case kActionNone: - TIME_CHECK_CALLBACK(kTimeChapter1, params->param1, 1, setup_chapter1Handler) + Entity::timeCheckCallback(kTimeChapter1, params->param1, 1, WRAP_SETUP_FUNCTION(Coudert, setup_chapter1Handler)); break; case kActionDefault: @@ -2174,7 +2172,7 @@ IMPLEMENT_FUNCTION(39, Coudert, function39) getSavePoints()->push(kEntityCoudert, kEntityVerges, kAction167854368); ENTITY_PARAM(2, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2283,22 +2281,22 @@ IMPLEMENT_FUNCTION(40, Coudert, chapter1Handler) label_callback_10: if (getState()->time > kTime1189800 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 2700); + if (Entity::updateParameter(params->param3, getState()->time, 2700)) { ENTITY_PARAM(0, 2) = 1; ENTITY_PARAM(0, 1) = 1; getEntities()->drawSequenceLeft(kEntityCoudert, "697F"); params->param3 = 0; - UPDATE_PARAM_PROC_END + } } if (!ENTITY_PARAM(0, 2)) break; - TIME_CHECK_OBJECT(kTime1107000, params->param4, kObject111, kObjectLocation2); - TIME_CHECK_OBJECT(kTime1161000, params->param5, kObject111, kObjectLocation3); - TIME_CHECK_OBJECT(kTime1206000, params->param6, kObject111, kObjectLocation4); + timeCheckObject(kTime1107000, params->param4, kObject111, kObjectLocation2); + timeCheckObject(kTime1161000, params->param5, kObject111, kObjectLocation3); + timeCheckObject(kTime1206000, params->param6, kObject111, kObjectLocation4); break; case kAction1: @@ -2536,7 +2534,7 @@ IMPLEMENT_FUNCTION(41, Coudert, function41) case 18: getSavePoints()->push(kEntityCoudert, kEntityMilos, kAction208228224); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2827,28 +2825,34 @@ IMPLEMENT_FUNCTION(45, Coudert, function45) } label_callback_13: - TIME_CHECK_CALLBACK(kTime2088900, params->param1, 14, setup_function32); + if (Entity::timeCheckCallback(kTime2088900, params->param1, 14, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_14: - TIME_CHECK_CALLBACK(kTime2119500, params->param2, 15, setup_function32); + if (Entity::timeCheckCallback(kTime2119500, params->param2, 15, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_15: - TIME_CHECK_CALLBACK(kTime2138400, params->param3, 16, setup_function32); + if (Entity::timeCheckCallback(kTime2138400, params->param3, 16, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_16: - TIME_CHECK_CALLBACK(kTime2147400, params->param4, 17, setup_function32); + if (Entity::timeCheckCallback(kTime2147400, params->param4, 17, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_17: - TIME_CHECK_CALLBACK(kTime2160000, params->param5, 18, setup_function32); + if (Entity::timeCheckCallback(kTime2160000, params->param5, 18, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_18: - TIME_CHECK_CALLBACK(kTime2205000, params->param6, 19, setup_function32); + if (Entity::timeCheckCallback(kTime2205000, params->param6, 19, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_19: if (ENTITY_PARAM(0, 2)) { - TIME_CHECK_OBJECT(kTime2025000, params->param7, kObject111, kObjectLocation7); - TIME_CHECK_OBJECT(kTime2133000, params->param8, kObject111, kObjectLocation8); - TIME_CHECK_OBJECT(kTime2173500, CURRENT_PARAM(1, 1), kObject111, kObjectLocation9); + timeCheckObject(kTime2025000, params->param7, kObject111, kObjectLocation7); + timeCheckObject(kTime2133000, params->param8, kObject111, kObjectLocation8); + timeCheckObject(kTime2173500, CURRENT_PARAM(1, 1), kObject111, kObjectLocation9); } break; @@ -3051,7 +3055,7 @@ IMPLEMENT_FUNCTION(46, Coudert, function46) break; case 11: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3116,7 +3120,7 @@ IMPLEMENT_FUNCTION_I(47, Coudert, function47, bool) break; case 7: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3164,7 +3168,7 @@ IMPLEMENT_FUNCTION(48, Coudert, function48) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3261,7 +3265,7 @@ IMPLEMENT_FUNCTION(49, Coudert, function49) break; case 11: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3347,7 +3351,7 @@ IMPLEMENT_FUNCTION(50, Coudert, function50) break; case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3541,11 +3545,11 @@ IMPLEMENT_FUNCTION(53, Coudert, function53) params->param2 = (uint)(getState()->time + 4500); if (params->param3 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0) + if (Entity::updateParameterTime((TimeValue)params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)) { setCallback(2); setup_function55(); break; - UPDATE_PARAM_PROC_END + } } } @@ -3558,18 +3562,22 @@ IMPLEMENT_FUNCTION(53, Coudert, function53) label_callback_3: if (!params->param1) { - TIME_CHECK_CALLBACK(kTime2394000, params->param4, 4, setup_function56); + if (Entity::timeCheckCallback(kTime2394000, params->param4, 4, WRAP_SETUP_FUNCTION(Coudert, setup_function56))) + break; label_callback_4: - TIME_CHECK_CALLBACK(kTime2434500, params->param5, 5, setup_function32); + if (Entity::timeCheckCallback(kTime2434500, params->param5, 5, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2448000, params->param6, 6, setup_function32); + if (Entity::timeCheckCallback(kTime2448000, params->param6, 6, WRAP_SETUP_FUNCTION(Coudert, setup_function32))) + break; } label_callback_6: if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) { - UPDATE_PARAM(params->param7, getState()->time, 2700); + if (!Entity::updateParameter(params->param7, getState()->time, 2700)) + break; ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 1) = 1; @@ -3696,7 +3704,7 @@ IMPLEMENT_FUNCTION(54, Coudert, function54) break; case 3: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3764,7 +3772,7 @@ IMPLEMENT_FUNCTION(55, Coudert, function55) break; case 7: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3868,7 +3876,7 @@ IMPLEMENT_FUNCTION(56, Coudert, function56) break; case 16: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -4034,7 +4042,8 @@ IMPLEMENT_FUNCTION(62, Coudert, function62) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param4, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; @@ -4168,7 +4177,7 @@ void Coudert::visitCompartment(const SavePoint &savepoint, EntityPosition positi case 6: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/coudert.h b/engines/lastexpress/entities/coudert.h index 45d13ce9bb8a..8303c80a32c8 100644 --- a/engines/lastexpress/entities/coudert.h +++ b/engines/lastexpress/entities/coudert.h @@ -24,8 +24,6 @@ #define LASTEXPRESS_COUDERT_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" - namespace LastExpress { class LastExpressEngine; diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index e136ca4776bf..2deca291f62f 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -22,23 +22,13 @@ #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" - #include "lastexpress/data/sequence.h" #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/logic.h" -#include "lastexpress/game/scenes.h" -#include "lastexpress/game/state.h" +#include "lastexpress/game/object.h" #include "lastexpress/game/savegame.h" -#include "lastexpress/game/savepoint.h" -#include "lastexpress/game/state.h" - -#include "lastexpress/sound/sound.h" - -#include "lastexpress/helpers.h" -#include "lastexpress/lastexpress.h" +#include "lastexpress/game/scenes.h" namespace LastExpress { @@ -55,6 +45,17 @@ EntityData::EntityCallData::~EntityCallData() { SAFE_DELETE(sequence3); } +void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, int length) { + char seqName[13]; + memset(&seqName, 0, length); + + if (s.isSaving()) strcpy((char *)&seqName, string.c_str()); + s.syncBytes((byte *)&seqName, length); + + if (s.isLoading()) + string = seqName; +} + void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) { for (uint i = 0; i < ARRAYSIZE(callbacks); i++) s.syncAsByte(callbacks[i]); @@ -81,23 +82,19 @@ void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsByte(directionSwitch); // Sync strings -#define SYNC_STRING(varName, count) { \ - char seqName[13]; \ - memset(&seqName, 0, count); \ - if (s.isSaving()) strcpy((char *)&seqName, varName.c_str()); \ - s.syncBytes((byte *)&seqName, count); \ - if (s.isLoading()) varName = seqName; \ -} - - SYNC_STRING(sequenceName, 13); - SYNC_STRING(sequenceName2, 13); - SYNC_STRING(sequenceNamePrefix, 7); - SYNC_STRING(sequenceNameCopy, 13); - -#undef SYNC_STRING + syncString(s, sequenceName, 13); + syncString(s, sequenceName2, 13); + syncString(s, sequenceNamePrefix, 7); + syncString(s, sequenceNameCopy, 13); // Skip pointers to frame & sequences - s.skip(5 * 4); + // (we are using a compressed stream, so we cannot seek on load) + if (s.isLoading()) { + byte empty[5 * 4]; + s.syncBytes(empty, 5 * 4); + } else { + s.skip(5 * 4); + } } ////////////////////////////////////////////////////////////////////////// @@ -246,16 +243,38 @@ void Entity::savegame(const SavePoint &savepoint) { break; case kActionNone: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: getSaveLoad()->saveGame((SavegameType)params->param1, _entityIndex, (EventIndex)params->param2); - CALLBACK_ACTION(); + callbackAction(); break; } } +void Entity::savegameBloodJacket() { + if (getProgress().jacket == kJacketBlood + && getEntities()->isDistanceBetweenEntities(_entityIndex, kEntityPlayer, 1000) + && !getEntities()->isInsideCompartments(kEntityPlayer) + && !getEntities()->checkFields10(kEntityPlayer)) { + setCallback(1); + + switch (_entityIndex) { + default: + break; + + case kEntityCoudert: + setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket); + break; + + case kEntityMertens: + setup_savegame(kSavegameTypeEvent, kEventCoudertBloodJacket); + break; + } + } +} + void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag flag) { EXPOSE_PARAMS(EntityData::EntityParametersSIIS) @@ -264,7 +283,7 @@ void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag fla break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -284,7 +303,7 @@ void Entity::draw(const SavePoint &savepoint, bool handleExcuseMe) { break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -308,7 +327,7 @@ void Entity::draw2(const SavePoint &savepoint) { break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -326,8 +345,10 @@ void Entity::updateFromTicks(const SavePoint &savepoint) { break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->timeTicks, params->param1) - CALLBACK_ACTION(); + if (Entity::updateParameter(params->param2, getState()->timeTicks, params->param1)) + break; + + callbackAction(); break; } } @@ -340,8 +361,10 @@ void Entity::updateFromTime(const SavePoint &savepoint) { break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, params->param1) - CALLBACK_ACTION(); + if (Entity::updateParameter(params->param2, getState()->time, params->param1)) + break; + + callbackAction(); break; } } @@ -352,12 +375,12 @@ void Entity::callbackActionOnDirection(const SavePoint &savepoint) { break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: if (getData()->direction != kDirectionRight) - CALLBACK_ACTION(); + callbackAction(); break; } } @@ -370,7 +393,7 @@ void Entity::callbackActionRestaurantOrSalon(const SavePoint &savepoint) { case kActionNone: case kActionDefault: if (getEntities()->isSomebodyInsideRestaurantOrSalon()) - CALLBACK_ACTION(); + callbackAction(); break; } } @@ -395,7 +418,7 @@ void Entity::updateEntity(const SavePoint &savepoint, bool handleExcuseMe) { case kActionNone: case kActionDefault: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; } } @@ -410,7 +433,7 @@ void Entity::callSavepoint(const SavePoint &savepoint, bool handleExcuseMe) { case kActionExitCompartment: if (!CURRENT_PARAM(1, 1)) getSavePoints()->call(_entityIndex, (EntityIndex)params->param4, (ActionIndex)params->param5, (char *)¶ms->seq2); - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -448,7 +471,7 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos if (updateLocation) getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -468,6 +491,74 @@ void Entity::enterExitCompartment(const SavePoint &savepoint, EntityPosition pos } } +void Entity::goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo) { + switch (savepoint.action) { + default: + break; + + case kActionDefault: + getData()->entityPosition = positionFrom; + setCallback(1); + setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom); + break; + + case kActionCallback: + switch (getCallback()) { + default: + break; + + case 1: + setCallback(2); + setup_enterExitCompartment(sequenceTo.c_str(), compartmentFrom); + break; + + case 2: + getData()->entityPosition = positionFrom; + getEntities()->clearSequences(_entityIndex); + callbackAction(); + break; + } + break; + } +} + +void Entity::goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo) { + switch (savepoint.action) { + default: + break; + + case kActionDefault: + getData()->entityPosition = positionFrom; + getData()->location = kLocationOutsideCompartment; + setCallback(1); + setup_enterExitCompartment(sequenceFrom.c_str(), compartmentFrom); + break; + + case kActionCallback: + switch (getCallback()) { + default: + break; + + case 1: + setCallback(2); + setup_updateEntity(kCarGreenSleeping, positionTo); + break; + + case 2: + setCallback(3); + setup_enterExitCompartment(sequenceTo.c_str(), compartmentTo); + break; + + case 3: + getData()->location = kLocationInsideCompartment; + getEntities()->clearSequences(_entityIndex); + callbackAction(); + break; + } + break; + } +} + void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) { EXPOSE_PARAMS(EntityData::EntityParametersSIII) @@ -477,7 +568,7 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) { case kActionExitCompartment: getEntities()->updatePositionExit(_entityIndex, (CarIndex)params->param4, (Position)params->param5); - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -494,4 +585,385 @@ void Entity::updatePosition(const SavePoint &savepoint, bool handleExcuseMe) { } } +void Entity::callbackAction() { + if (getData()->currentCall == 0) + error("[Entity::callbackAction] currentCall is already 0, cannot proceed"); + + getData()->currentCall--; + + getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]); + + getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback); +} + +////////////////////////////////////////////////////////////////////////// +// Setup functions +////////////////////////////////////////////////////////////////////////// +void Entity::setup(const char *name, uint index) { + debugC(6, kLastExpressDebugLogic, "Entity: %s()", name); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupI(const char *name, uint index, uint param1) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u)", name, param1); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = (unsigned int)param1; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupII(const char *name, uint index, uint param1, uint param2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u)", name, param1, param2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIII(const char *name, uint index, uint param1, uint param2, uint param3) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %u)", name, param1, param2, param3); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + params->param3 = param3; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupS(const char *name, uint index, const char *seq1) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s)", name, seq1); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSS(const char *name, uint index, const char *seq1, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s)", name, seq1, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSI(const char *name, uint index, const char *seq1, uint param4) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u)", name, seq1, param4); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u)", name, seq1, param4, param5); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + params->param5 = param5; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %u)", name, seq, param4, param5, param6); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII *)_data->getCurrentParameters(); + strncpy(params->seq, seq, 12); + params->param4 = param4; + params->param5 = param5; + params->param6 = param6; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %s)", name, seq1, param4, param5, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + params->param5 = param5; + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s, %u)", name, seq1, seq2, param7); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + params->param7 = param7; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIS(const char *name, uint index, uint param1, const char *seq) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s)", name, param1, seq); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII *)_data->getCurrentParameters(); + params->param1 = (unsigned int)param1; + strncpy(params->seq, seq, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s, %s)", name, param1, seq1, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI *)_data->getCurrentParameters(); + params->param1 = param1; + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s)", name, param1, param2, seq); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + strncpy(params->seq, seq, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s, %s)", name, param1, param2, seq1, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +////////////////////////////////////////////////////////////////////////// +// Helper functions +////////////////////////////////////////////////////////////////////////// + +bool Entity::updateParameter(uint ¶meter, uint timeType, uint delta) { + if (!parameter) + parameter = (uint)(timeType + delta); + + if (parameter >= timeType) + return false; + + parameter = kTimeInvalid; + + return true; +} + +bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta) { + if (getState()->time <= timeValue) { + if (check || !parameter) + parameter = (uint)(getState()->time + delta); + } + + if (parameter >= getState()->time && getState()->time <= timeValue) + return false; + + parameter = kTimeInvalid; + + return true; +} + +bool Entity::updateParameterCheck(uint ¶meter, uint timeType, uint delta) { + if (parameter && parameter >= timeType) + return false; + + if (!parameter) + parameter = (uint)(timeType + delta); + + return true; +} + +bool Entity::timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, const char *str, Common::Functor1 *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + (*function)(str); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, bool check, Common::Functor1 *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + (*function)(check); + + return true; + } + + return false; +} + +bool Entity::timeCheckCallbackInventory(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getData()->inventoryItem = kItemNone; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + +bool Entity::timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function) { + if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) + parameter = (uint)getState()->time + 75; + + if (getState()->time > timeValue || parameter < getState()->time) { + parameter = kTimeInvalid; + setCallback(callback); + (*function)(); + + return true; + } + + return false; +} + +void Entity::timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getSavePoints()->push(entity1, entity2, action); + } +} + +void Entity::timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex object, ObjectLocation location) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getObjects()->updateLocation2(object, location); + } +} + +bool Entity::timeCheckCallbackAction(TimeValue timeValue, uint ¶meter) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + callbackAction(); + return true; + } + + return false; +} + +bool Entity::timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint ¶meter, byte callback, const char* sound, EntityPosition position) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + getData()->entityPosition = position; + setCallback(callback); + setup_playSound(sound); + return true; + } + + return false; +} + + } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 039f461c7b50..3601f34f6f3d 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -25,8 +25,13 @@ #include "lastexpress/shared.h" +#include "lastexpress/game/logic.h" +#include "lastexpress/game/savepoint.h" +#include "lastexpress/game/state.h" + #include "lastexpress/sound/sound.h" +#include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" #include "common/array.h" @@ -41,10 +46,229 @@ class Sequence; class SequenceFrame; struct SavePoint; +////////////////////////////////////////////////////////////////////////// +// Declaration +////////////////////////////////////////////////////////////////////////// +#define DECLARE_FUNCTION(name) \ + void setup_##name(); \ + void name(const SavePoint &savepoint); + +#define DECLARE_FUNCTION_1(name, param1) \ + void setup_##name(param1); \ + void name(const SavePoint &savepoint); + +#define DECLARE_FUNCTION_2(name, param1, param2) \ + void setup_##name(param1, param2); \ + void name(const SavePoint &savepoint); + +#define DECLARE_FUNCTION_3(name, param1, param2, param3) \ + void setup_##name(param1, param2, param3); \ + void name(const SavePoint &savepoint); + +#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \ + void setup_##name(param1, param2, param3, param4); \ + void name(const SavePoint &savepoint); + +#define DECLARE_FUNCTION_NOSETUP(name) \ + void name(const SavePoint &savepoint); + +#define DECLARE_NULL_FUNCTION() \ + void setup_nullfunction(); + +////////////////////////////////////////////////////////////////////////// +// Callbacks +////////////////////////////////////////////////////////////////////////// +#define ENTITY_CALLBACK(class, name, pointer) \ + Common::Functor1Mem(pointer, &class::name) + +#define ADD_CALLBACK_FUNCTION(class, name) \ + _callbacks.push_back(new ENTITY_CALLBACK(class, name, this)); + +#define ADD_NULL_FUNCTION() \ + _callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this)); + +#define WRAP_SETUP_FUNCTION(className, method) \ + new Common::Functor0Mem(this, &className::method) + +#define WRAP_SETUP_FUNCTION_S(className, method) \ + new Common::Functor1Mem(this, &className::method) + +#define WRAP_SETUP_FUNCTION_B(className, method) \ + new Common::Functor1Mem(this, &className::method) + +////////////////////////////////////////////////////////////////////////// +// Parameters macros +////////////////////////////////////////////////////////////////////////// +#define CURRENT_PARAM(index, id) \ + ((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id + +#define ENTITY_PARAM(index, id) \ + ((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id + +////////////////////////////////////////////////////////////////////////// +// Misc +////////////////////////////////////////////////////////////////////////// +#define RESET_ENTITY_STATE(entity, class, function) \ + getEntities()->resetState(entity); \ + ((class *)getEntities()->get(entity))->function(); + +////////////////////////////////////////////////////////////////////////// +// Implementation +////////////////////////////////////////////////////////////////////////// + +// Expose parameters and check validity +#define EXPOSE_PARAMS(type) \ + type *params = (type *)_data->getCurrentParameters(); \ + if (!params) \ + error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \ + +// function signature without setup (we keep the index for consistency but never use it) +#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \ + void class::name(const SavePoint &savepoint) { \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")"); + +// simple setup with no parameters +#define IMPLEMENT_FUNCTION(index, class, name) \ + void class::setup_##name() { \ + Entity::setup(#class "::setup_" #name, index); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_END } + +// nullfunction call +#define IMPLEMENT_NULL_FUNCTION(index, class) \ + void class::setup_nullfunction() { \ + Entity::setup(#class "::setup_nullfunction", index); \ + } + +// setup with one uint parameter +#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \ + void class::setup_##name(paramType param1) { \ + Entity::setupI(#class "::setup_" #name, index, param1); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action)); + +// setup with two uint parameters +#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \ + void class::setup_##name(paramType1 param1, paramType2 param2) { \ + Entity::setupII(#class "::setup_" #name, index, param1, param2); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action)); + +// setup with three uint parameters +#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \ + void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \ + Entity::setupIII(#class "::setup_" #name, index, param1, param2, param3); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action)); + +// setup with one char *parameter +#define IMPLEMENT_FUNCTION_S(index, class, name) \ + void class::setup_##name(const char *seq1) { \ + Entity::setupS(#class "::setup_" #name, index, seq1); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)¶ms->seq1, ACTION_NAME(savepoint.action)); + +// setup with one char *parameter and one uint +#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \ + void class::setup_##name(const char *seq1, paramType2 param4) { \ + Entity::setupSI(#class "::setup_" #name, index, seq1, param4); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)¶ms->seq1, params->param4, ACTION_NAME(savepoint.action)); + +// setup with one char *parameter and two uints +#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \ + void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \ + Entity::setupSII(#class "::setup_" #name, index, seq1, param4, param5); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)¶ms->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action)); + +// setup with one char *parameter and three uints +#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \ + void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \ + Entity::setupSIII(#class "::setup_" #name, index, seq, param4, param5, param6); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSIII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)¶ms->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \ + void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \ + Entity::setupSIIS(#class "::setup_" #name, index, seq1, param4, param5, seq2); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)¶ms->seq1, params->param4, params->param5, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_SS(index, class, name) \ + void class::setup_##name(const char *seq1, const char *seq2) { \ + Entity::setupSS(#class "::setup_" #name, index, seq1, seq2); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSSII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \ + void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \ + Entity::setupSSI(#class "::setup_" #name, index, seq1, seq2, param7); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersSSII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)¶ms->seq1, (char *)¶ms->seq2, params->param7, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \ + void class::setup_##name(paramType param1, const char *seq) { \ + Entity::setupIS(#class "::setup_" #name, index, param1, seq); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersISII) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)¶ms->seq, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \ + void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \ + Entity::setupISS(#class "::setup_" #name, index, param1, seq1, seq2); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersISSI) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \ + void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \ + Entity::setupIIS(#class "::setup_" #name, index, param1, param2, seq); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIISI) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)¶ms->seq, ACTION_NAME(savepoint.action)); + +#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \ + void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \ + Entity::setupIISS(#class "::setup_" #name, index, param1, param2, seq1, seq2); \ + } \ + void class::name(const SavePoint &savepoint) { \ + EXPOSE_PARAMS(EntityData::EntityParametersIISS) \ + debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); + + +////////////////////////////////////////////////////////////////////////// class EntityData : Common::Serializable { public: - struct EntityParameters : Common::Serializable{ + struct EntityParameters : Common::Serializable { virtual ~EntityParameters() {} virtual Common::String toString() = 0; @@ -596,6 +820,15 @@ class EntityData : Common::Serializable { return str; } + /** + * Synchronizes a string. + * + * @param s The Common::Serializer to use. + * @param string The string. + * @param length Length of the string. + */ + void syncString(Common::Serializer &s, Common::String &string, int length); + // Serializable void saveLoadWithSerializer(Common::Serializer &s); }; @@ -611,32 +844,30 @@ class EntityData : Common::Serializable { params->parameters[i] = new T(); } - EntityCallData *getCallData() { return &_data; } + EntityCallData *getCallData() { return &_data; } - EntityParameters *getParameters(uint callback, byte index) const; - EntityParameters *getCurrentParameters(byte index = 0) { return getParameters(_data.currentCall, index); } + EntityParameters *getParameters(uint callback, byte index) const; + EntityParameters *getCurrentParameters(byte index = 0) { return getParameters(_data.currentCall, index); } + EntityCallParameters *getCurrentCallParameters() { return &_parameters[_data.currentCall]; } - int getCallback(uint callback) const; - int getCurrentCallback() { return getCallback(_data.currentCall); } - void setCallback(uint callback, byte index); - void setCurrentCallback(uint index) { setCallback(_data.currentCall, index); } + int getCallback(uint callback) const; + int getCurrentCallback() { return getCallback(_data.currentCall); } + void setCallback(uint callback, byte index); + void setCurrentCallback(uint index) { setCallback(_data.currentCall, index); } - void updateParameters(uint32 index) const; + void updateParameters(uint32 index) const; // Serializable - void saveLoadWithSerializer(Common::Serializer &ser); + void saveLoadWithSerializer(Common::Serializer &ser); private: - EntityCallData _data; + EntityCallData _data; EntityCallParameters _parameters[9]; }; class Entity : Common::Serializable { public: - - typedef Common::Functor1 Callback; - Entity(LastExpressEngine *engine, EntityIndex index); virtual ~Entity(); @@ -657,6 +888,12 @@ class Entity : Common::Serializable { virtual void setup_chapter4() = 0; virtual void setup_chapter5() = 0; + // Shared functions + virtual void setup_savegame(SavegameType, uint32) { error("[Entity::setup_savegame] Trying to call the parent setup function. Use the specific entity function directly"); } + virtual void setup_enterExitCompartment(const char *, ObjectIndex) { error("[Entity::setup_enterExitCompartment] Trying to call the parent setup function. Use the specific entity function directly"); } + virtual void setup_updateEntity(CarIndex, EntityPosition) { error("[Entity::setup_updateEntity] Trying to call the parent setup function. Use the specific entity function directly"); } + virtual void setup_playSound(const char*) { error("[Entity::setup_playSound] Trying to call the parent setup function. Use the specific entity function directly"); } + // Serializable void saveLoadWithSerializer(Common::Serializer &ser) { _data->saveLoadWithSerializer(ser); } @@ -664,10 +901,11 @@ class Entity : Common::Serializable { protected: LastExpressEngine *_engine; + typedef Common::Functor1 Callback; - EntityIndex _entityIndex; - EntityData *_data; - Common::Array _callbacks; + EntityIndex _entityIndex; + EntityData *_data; + Common::Array _callbacks; /** * Saves the game @@ -678,6 +916,13 @@ class Entity : Common::Serializable { */ void savegame(const SavePoint &savepoint); + /** + * Saves the game before being found out with a blood covered jacket. + * + * @param saveFunction The setup function to call to save the game + */ + void savegameBloodJacket(); + /** * Play sound * @@ -781,16 +1026,84 @@ class Entity : Common::Serializable { */ void enterExitCompartment(const SavePoint &savepoint, EntityPosition position1 = kPositionNone, EntityPosition position2 = kPositionNone, CarIndex car = kCarNone, ObjectIndex compartment = kObjectNone, bool alternate = false, bool updateLocation = false); + /** + * Go to compartment. + * + * @param savepoint The savepoint. + * @param compartmentFrom The compartment from. + * @param positionFrom The position from. + * @param sequenceFrom The sequence from. + * @param sequenceTo The sequence to. + */ + void goToCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, Common::String sequenceTo); + + /** + * Go to compartment from compartment. + * + * @param savepoint The savepoint. + * @param compartmentFrom The compartment from. + * @param positionFrom The position from. + * @param sequenceFrom The sequence from. + * @param compartmentTo The compartment to. + * @param positionTo The position to. + * @param sequenceTo The sequence to. + */ + void goToCompartmentFromCompartment(const SavePoint &savepoint, ObjectIndex compartmentFrom, EntityPosition positionFrom, Common::String sequenceFrom, ObjectIndex compartmentTo, EntityPosition positionTo, Common::String sequenceTo); + /** * Updates the position * - * @param savepoint The savepoint + * @param savepoint The savepoint * - Sequence name * - CarIndex * - Position * @param handleExcuseMe true to handle excuseMe actions */ void updatePosition(const SavePoint &savepoint, bool handleExcuseMe = false); + + /** + * Store the current callback information and perform the callback action + */ + void callbackAction(); + + ////////////////////////////////////////////////////////////////////////// + // Setup functions + ////////////////////////////////////////////////////////////////////////// + void setup(const char *name, uint index); + void setupI(const char *name, uint index, uint param1); + void setupII(const char *name, uint index, uint param1, uint param2); + void setupIII(const char *name, uint index, uint param1, uint param2, uint param3); + void setupS(const char *name, uint index, const char *seq1); + void setupSS(const char *name, uint index, const char *seq1, const char *seq2); + void setupSI(const char *name, uint index, const char *seq1, uint param4); + void setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5); + void setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6); + void setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2); + void setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7); + void setupIS(const char *name, uint index, uint param1, const char *seq); + void setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2); + void setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq); + void setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2); + + ////////////////////////////////////////////////////////////////////////// + // Helper functions + ////////////////////////////////////////////////////////////////////////// + + bool updateParameter(uint ¶meter, uint timeType, uint delta); + bool updateParameterCheck(uint ¶meter, uint timeType, uint delta); + bool updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta); + + bool timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function); + bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); + bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, const char *str, Common::Functor1 *function); + bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, bool check, Common::Functor1 *function); + bool timeCheckCallbackInventory(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); + bool timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); + void timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action); + void timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex index, ObjectLocation location); + bool timeCheckCallbackAction(TimeValue timeValue, uint ¶meter); + bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint ¶meter, byte callback, const char* sound, EntityPosition position); + }; diff --git a/engines/lastexpress/entities/entity39.cpp b/engines/lastexpress/entities/entity39.cpp index e786d153a033..1786cd22011d 100644 --- a/engines/lastexpress/entities/entity39.cpp +++ b/engines/lastexpress/entities/entity39.cpp @@ -28,7 +28,6 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/entity39.h b/engines/lastexpress/entities/entity39.h index 4335a9566e87..54b65408c7f9 100644 --- a/engines/lastexpress/entities/entity39.h +++ b/engines/lastexpress/entities/entity39.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_ENTITY39_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { @@ -72,4 +71,4 @@ class Entity39 : public Entity { } // End of namespace LastExpress -#endif // LASTEXPRESS_##define##_H +#endif // LASTEXPRESS_ENTITY39_H diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h index 2da0da15b375..fd803676a95b 100644 --- a/engines/lastexpress/entities/entity_intern.h +++ b/engines/lastexpress/entities/entity_intern.h @@ -25,502 +25,6 @@ namespace LastExpress { -#define LOW_BYTE(w) ((unsigned char)(((unsigned long)(w)) & 0xff)) - -////////////////////////////////////////////////////////////////////////// -// Callbacks -#define ENTITY_CALLBACK(class, name, pointer) \ - Common::Functor1Mem(pointer, &class::name) - -#define ADD_CALLBACK_FUNCTION(class, name) \ - _callbacks.push_back(new ENTITY_CALLBACK(class, name, this)); - -#define ADD_NULL_FUNCTION() \ - _callbacks.push_back(new ENTITY_CALLBACK(Entity, nullfunction, this)); - -////////////////////////////////////////////////////////////////////////// -// Declaration -////////////////////////////////////////////////////////////////////////// - -#define DECLARE_FUNCTION(name) \ - void setup_##name(); \ - void name(const SavePoint &savepoint); - -#define DECLARE_FUNCTION_1(name, param1) \ - void setup_##name(param1); \ - void name(const SavePoint &savepoint); - -#define DECLARE_FUNCTION_2(name, param1, param2) \ - void setup_##name(param1, param2); \ - void name(const SavePoint &savepoint); - -#define DECLARE_FUNCTION_3(name, param1, param2, param3) \ - void setup_##name(param1, param2, param3); \ - void name(const SavePoint &savepoint); - -#define DECLARE_FUNCTION_4(name, param1, param2, param3, param4) \ - void setup_##name(param1, param2, param3, param4); \ - void name(const SavePoint &savepoint); - -#define DECLARE_FUNCTION_NOSETUP(name) \ - void name(const SavePoint &savepoint); - -#define DECLARE_NULL_FUNCTION() \ - void setup_nullfunction(); - -////////////////////////////////////////////////////////////////////////// -// Setup -////////////////////////////////////////////////////////////////////////// - -#define IMPLEMENT_SETUP(class, callback_class, name, index) \ -void class::setup_##name() { \ - BEGIN_SETUP(callback_class, name, index, EntityData::EntityParametersIIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::setup_" #name "()"); \ - END_SETUP() \ -} - -#define BEGIN_SETUP(class, name, index, type) \ - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \ - _data->setCurrentCallback(index); \ - _data->resetCurrentParameters(); - -#define END_SETUP() \ - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - - -////////////////////////////////////////////////////////////////////////// -// Implementation -////////////////////////////////////////////////////////////////////////// - -// Expose parameters and check validity -#define EXPOSE_PARAMS(type) \ - type *params = (type *)_data->getCurrentParameters(); \ - if (!params) \ - error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \ - - -// function signature without setup (we keep the index for consistency but never use it) -#define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \ - void class::name(const SavePoint &savepoint) { \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(index=" #index ")"); - -// simple setup with no parameters -#define IMPLEMENT_FUNCTION(index, class, name) \ - IMPLEMENT_SETUP(class, class, name, index) \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "() - action: %s", ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_END } - -// nullfunction call -#define IMPLEMENT_NULL_FUNCTION(index, class) \ - IMPLEMENT_SETUP(class, Entity, nullfunction, index) - -// setup with one uint parameter -#define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \ - void class::setup_##name(paramType param1) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \ - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \ - params->param1 = (unsigned int)param1; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d) - action: %s", params->param1, ACTION_NAME(savepoint.action)); - -// setup with two uint parameters -#define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \ - void class::setup_##name(paramType1 param1, paramType2 param2) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \ - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \ - params->param1 = param1; \ - params->param2 = param2; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d) - action: %s", params->param1, params->param2, ACTION_NAME(savepoint.action)); - -// setup with three uint parameters -#define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \ - void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersIIII) \ - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII*)_data->getCurrentParameters(); \ - params->param1 = param1; \ - params->param2 = param2; \ - params->param3 = param3; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %d) - action: %s", params->param1, params->param2, params->param3, ACTION_NAME(savepoint.action)); - -// setup with one char *parameter -#define IMPLEMENT_FUNCTION_S(index, class, name) \ - void class::setup_##name(const char *seq1) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \ - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s) - action: %s", (char *)¶ms->seq1, ACTION_NAME(savepoint.action)); - -// setup with one char *parameter and one uint -#define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \ - void class::setup_##name(const char *seq1, paramType2 param4) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \ - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - params->param4 = param4; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d) - action: %s", (char *)¶ms->seq1, params->param4, ACTION_NAME(savepoint.action)); - -// setup with one char *parameter and two uints -#define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \ - void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \ - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - params->param4 = param4; \ - params->param5 = param5; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d) - action: %s", (char *)¶ms->seq1, params->param4, params->param5, ACTION_NAME(savepoint.action)); - -// setup with one char *parameter and three uints -#define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \ - void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIII) \ - EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq, seq, 12); \ - params->param4 = param4; \ - params->param5 = param5; \ - params->param6 = param6; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSIII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %d) - action: %s", (char *)¶ms->seq, params->param4, params->param5, params->param6, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \ - void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSIIS) \ - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - params->param4 = param4; \ - params->param5 = param5; \ - strncpy((char *)¶ms->seq2, seq2, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %d, %d, %s) - action: %s", (char *)¶ms->seq1, params->param4, params->param5, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_SS(index, class, name) \ - void class::setup_##name(const char *seq1, const char *seq2) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \ - EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - strncpy((char *)¶ms->seq2, seq2, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSSII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s) - action: %s", (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \ - void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersSSII) \ - EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - strncpy((char *)¶ms->seq2, seq2, 12); \ - params->param7 = param7; \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersSSII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%s, %s, %d) - action: %s", (char *)¶ms->seq1, (char *)¶ms->seq2, params->param7, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \ - void class::setup_##name(paramType param1, const char *seq) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersISII) \ - EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII*)_data->getCurrentParameters(); \ - params->param1 = (unsigned int)param1; \ - strncpy((char *)¶ms->seq, seq, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersISII) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s) - action: %s", params->param1, (char *)¶ms->seq, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \ - void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersISSI) \ - EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI*)_data->getCurrentParameters(); \ - params->param1 = param1; \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - strncpy((char *)¶ms->seq2, seq2, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersISSI) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %s, %s) - action: %s", params->param1, (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \ - void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISI) \ - EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI*)_data->getCurrentParameters(); \ - params->param1 = param1; \ - params->param2 = param2; \ - strncpy((char *)¶ms->seq, seq, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIISI) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s) - action: %s", params->param1, params->param2, (char *)¶ms->seq, ACTION_NAME(savepoint.action)); - -#define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \ - void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \ - BEGIN_SETUP(class, name, index, EntityData::EntityParametersIISS) \ - EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS*)_data->getCurrentParameters(); \ - params->param1 = param1; \ - params->param2 = param2; \ - strncpy((char *)¶ms->seq1, seq1, 12); \ - strncpy((char *)¶ms->seq2, seq2, 12); \ - END_SETUP() \ - } \ - void class::name(const SavePoint &savepoint) { \ - EXPOSE_PARAMS(EntityData::EntityParametersIISS) \ - debugC(6, kLastExpressDebugLogic, "Entity: " #class "::" #name "(%d, %d, %s, %s) - action: %s", params->param1, params->param2, (char *)¶ms->seq1, (char *)¶ms->seq2, ACTION_NAME(savepoint.action)); - - -////////////////////////////////////////////////////////////////////////// -// Misc -////////////////////////////////////////////////////////////////////////// -#define RESET_ENTITY_STATE(entity, class, function) \ - getEntities()->resetState(entity); \ - ((class *)getEntities()->get(entity))->function(); - -////////////////////////////////////////////////////////////////////////// -// Parameters macros (for default IIII parameters) -////////////////////////////////////////////////////////////////////////// -#define CURRENT_PARAM(index, id) \ - ((EntityData::EntityParametersIIII*)_data->getCurrentParameters(index))->param##id - -#define ENTITY_PARAM(index, id) \ - ((EntityData::EntityParametersIIII*)_data->getParameters(8, index))->param##id - -////////////////////////////////////////////////////////////////////////// -// Time check macros -////////////////////////////////////////////////////////////////////////// -#define TIME_CHECK(timeValue, parameter, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - function(); \ - break; \ - } - -#define TIME_CHECK_SAVEPOINT(timeValue, parameter, entity1, entity2, action) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getSavePoints()->push(entity1, entity2, action); \ - } - -#define TIME_CHECK_CALLBACK(timeValue, parameter, callback, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - setCallback(callback); \ - function(); \ - break; \ - } - -#define TIME_CHECK_CALLBACK_1(timeValue, parameter, callback, function, param1) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - setCallback(callback); \ - function(param1); \ - break; \ - } - -#define TIME_CHECK_CALLBACK_2(timeValue, parameter, callback, function, param1, param2) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - setCallback(callback); \ - function(param1, param2); \ - break; \ - } - -#define TIME_CHECK_CALLBACK_3(timeValue, parameter, callback, function, param1, param2, param3) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - setCallback(callback); \ - function(param1, param2, param3); \ - break; \ - } - -#define TIME_CHECK_CALLBACK_INVENTORY(timeValue, parameter, callback, function) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getData()->inventoryItem = kItemNone; \ - setCallback(callback); \ - function(); \ - break; \ - } - -#define TIME_CHECK_CALLBACK_ACTION(timeValue, parameter) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - CALLBACK_ACTION(); \ - break; \ - } - -#define TIME_CHECK_PLAYSOUND_UPDATEPOSITION(timeValue, parameter, callback, sound, position) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getData()->entityPosition = position; \ - setCallback(callback); \ - setup_playSound(sound); \ - break; \ - } - -#define TIME_CHECK_OBJECT(timeValue, parameter, object, location) \ - if (getState()->time > timeValue && !parameter) { \ - parameter = 1; \ - getObjects()->updateLocation2(object, location); \ - } - -#define TIME_CHECK_CAR(timeValue, parameter, callback, function) {\ - if ((getState()->time <= timeValue && !getEntities()->isPlayerInCar(kCarGreenSleeping)) || !parameter) \ - parameter = (uint)getState()->time + 75; \ - if (getState()->time > timeValue || parameter < getState()->time) { \ - parameter = kTimeInvalid; \ - setCallback(callback); \ - function(); \ - break; \ - } \ -} - -////////////////////////////////////////////////////////////////////////// -// Callback action -////////////////////////////////////////////////////////////////////////// -#define CALLBACK_ACTION() { \ - if (getData()->currentCall == 0) \ - error("[CALLBACK_ACTION] currentCall is already 0, cannot proceed"); \ - getData()->currentCall--; \ - getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]); \ - getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback); \ - } - -////////////////////////////////////////////////////////////////////////// -// Param update -////////////////////////////////////////////////////////////////////////// -#define UPDATE_PARAM(parameter, type, value) { \ - if (!parameter) \ - parameter = (uint)(type + value); \ - if (parameter >= type) \ - break; \ - parameter = kTimeInvalid; \ -} - -// Todo: replace with UPDATE_PARAM_PROC as appropriate -#define UPDATE_PARAM_GOTO(parameter, type, value, label) { \ - if (!parameter) \ - parameter = (uint)(type + value); \ - if (parameter >= type) \ - goto label; \ - parameter = kTimeInvalid; \ -} - -// Updating parameter with code inside the check -#define UPDATE_PARAM_PROC(parameter, type, value) \ - if (!parameter) \ - parameter = (uint)(type + value); \ - if (parameter < type) { \ - parameter = kTimeInvalid; - -#define UPDATE_PARAM_PROC_TIME(timeValue, test, parameter, value) \ - if (getState()->time <= timeValue) { \ - if (test || !parameter) \ - parameter = (uint)(getState()->time + value); \ - } \ - if (parameter < getState()->time || getState()->time > timeValue) { \ - parameter = kTimeInvalid; - -#define UPDATE_PARAM_PROC_END } - -// Updating parameter with an added check (and code inside the check) -#define UPDATE_PARAM_CHECK(parameter, type, value) \ - if (!parameter || parameter < type) { \ - if (!parameter) \ - parameter = (uint)(type + value); - -////////////////////////////////////////////////////////////////////////// -// Compartments -////////////////////////////////////////////////////////////////////////// -// Go from one compartment to another (or the same one if no optional args are passed -#define COMPARTMENT_TO(class, compartmentFrom, positionFrom, sequenceFrom, sequenceTo) \ - switch (savepoint.action) { \ - default: \ - break; \ - case kActionDefault: \ - getData()->entityPosition = positionFrom; \ - setCallback(1); \ - setup_enterExitCompartment(sequenceFrom, compartmentFrom); \ - break; \ - case kActionCallback: \ - switch (getCallback()) { \ - default: \ - break; \ - case 1: \ - setCallback(2); \ - setup_enterExitCompartment(sequenceTo, compartmentFrom); \ - break; \ - case 2: \ - getData()->entityPosition = positionFrom; \ - getEntities()->clearSequences(_entityIndex); \ - CALLBACK_ACTION(); \ - } \ - break; \ - } - -#define COMPARTMENT_FROM_TO(class, compartmentFrom, positionFrom, sequenceFrom, compartmentTo, positionTo, sequenceTo) \ - switch (savepoint.action) { \ - default: \ - break; \ - case kActionDefault: \ - getData()->entityPosition = positionFrom; \ - getData()->location = kLocationOutsideCompartment; \ - setCallback(1); \ - setup_enterExitCompartment(sequenceFrom, compartmentFrom); \ - break; \ - case kActionCallback: \ - switch (getCallback()) { \ - default: \ - break; \ - case 1: \ - setCallback(2); \ - setup_updateEntity(kCarGreenSleeping, positionTo); \ - break; \ - case 2: \ - setCallback(3); \ - setup_enterExitCompartment(sequenceTo, compartmentTo); \ - break; \ - case 3: \ - getData()->location = kLocationInsideCompartment; \ - getEntities()->clearSequences(_entityIndex); \ - CALLBACK_ACTION(); \ - break; \ - } \ - break; \ - } } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp index 46cd790ffba8..d2bbc9854c4a 100644 --- a/engines/lastexpress/entities/francois.cpp +++ b/engines/lastexpress/entities/francois.cpp @@ -32,7 +32,6 @@ #include "lastexpress/sound/queue.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { @@ -114,7 +113,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, updateEntity, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); } else { if (!getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000) || !getInventory()->hasItem(kItemFirebird) @@ -169,7 +168,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, updateEntity, CarIndex, EntityPosition) case kActionDefault: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -225,7 +224,7 @@ IMPLEMENT_FUNCTION(9, Francois, function9) case 2: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -263,7 +262,7 @@ IMPLEMENT_FUNCTION(10, Francois, function10) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityFrancois); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -279,7 +278,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue) case kActionNone: if (!getSoundQueue()->isBuffered(kEntityFrancois)) { - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6) + if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)) { switch (rnd(7)) { default: break; @@ -312,7 +311,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue) params->param6 = 15 * rnd(7); CURRENT_PARAM(1, 1) = 0; - UPDATE_PARAM_PROC_END + } } if (!getEntities()->hasValidFrame(kEntityFrancois) || !getEntities()->isWalkingOppositeToPlayer(kEntityFrancois)) @@ -442,7 +441,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -465,7 +464,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue) getData()->field_4A3 = 30; getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); break; case kAction205346192: @@ -524,7 +523,7 @@ IMPLEMENT_FUNCTION(12, Francois, function12) break; case 7: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -609,7 +608,7 @@ IMPLEMENT_FUNCTION(13, Francois, function13) break; case 11: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -708,7 +707,7 @@ IMPLEMENT_FUNCTION_IIS(14, Francois, function14, ObjectIndex, EntityPosition) break; case 13: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -764,7 +763,7 @@ IMPLEMENT_FUNCTION(15, Francois, function15) case 7: if (!getEntities()->isInsideCompartment(kEntityMmeBoutarel, kCarRedSleeping, kPosition_5790)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -773,7 +772,7 @@ IMPLEMENT_FUNCTION(15, Francois, function15) break; case 8: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -830,7 +829,7 @@ IMPLEMENT_FUNCTION(16, Francois, function16) getData()->entityPosition = kPosition_5790; getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -849,7 +848,7 @@ IMPLEMENT_FUNCTION(17, Francois, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Francois, setup_chapter1Handler)); break; case kActionDefault: @@ -867,7 +866,7 @@ IMPLEMENT_FUNCTION(18, Francois, chapter1Handler) break; case kActionNone: - TIME_CHECK_CALLBACK_1(kTimeParisEpernay, params->param1, 1, setup_function11, kTime1093500); + timeCheckCallback(kTimeParisEpernay, params->param1, 1, kTime1093500); break; case kActionCallback: @@ -884,7 +883,7 @@ IMPLEMENT_FUNCTION(19, Francois, function19) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1161000, params->param1, 2, setup_function12); + Entity::timeCheckCallback(kTime1161000, params->param1, 2, WRAP_SETUP_FUNCTION(Francois, setup_function12)); break; case kAction101107728: @@ -979,17 +978,21 @@ IMPLEMENT_FUNCTION(23, Francois, function23) } label_callback_1: - TIME_CHECK_CALLBACK_1(kTime1764000, params->param1, 2, setup_playSound, "Fra2011"); + if (Entity::timeCheckCallback(kTime1764000, params->param1, 2, "Fra2011", WRAP_SETUP_FUNCTION_S(Francois, setup_playSound))) + break; label_callback_2: - TIME_CHECK_CALLBACK(kTime1800000, params->param2, 3, setup_function13); + if (Entity::timeCheckCallback(kTime1800000, params->param2, 3, WRAP_SETUP_FUNCTION(Francois, setup_function13))) + break; label_callback_3: if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) { - TIME_CHECK_CALLBACK_1(kTime1768500, params->param3, 4, setup_function11, kTime1773000); + if (timeCheckCallback(kTime1768500, params->param3, 4, kTime1773000)) + break; label_callback_4: - TIME_CHECK_CALLBACK_1(kTime1827000, params->param4, 5, setup_function11, kTime1831500); + if (timeCheckCallback(kTime1827000, params->param4, 5, kTime1831500)) + break; } label_callback_5: @@ -999,18 +1002,19 @@ IMPLEMENT_FUNCTION(23, Francois, function23) } if (params->param5 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75); + if (Entity::updateParameterTime(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75)) { setCallback(6); setup_playSound("Fra2010"); break; - UPDATE_PARAM_PROC_END + } } label_callback_6: - TIME_CHECK_CALLBACK_3(kTime1782000, params->param6, 7, setup_function14, kObjectCompartmentC, kPosition_6470, "c"); + if (timeCheckCallbackCompartment(kTime1782000, params->param6, 7, kObjectCompartmentC, kPosition_6470, "c")) + break; label_callback_7: - TIME_CHECK_CALLBACK_3(kTime1813500, params->param7, 8, setup_function14, kObjectCompartmentF, kPosition_4070, "f"); + timeCheckCallbackCompartment(kTime1813500, params->param7, 8, kObjectCompartmentF, kPosition_4070, "f"); break; case kActionCallback: @@ -1086,32 +1090,41 @@ IMPLEMENT_FUNCTION(25, Francois, chapter3Handler) } label_callback_2: - TIME_CHECK_CALLBACK(kTime2025000, params->param3, 3, setup_function12); + if (Entity::timeCheckCallback(kTime2025000, params->param3, 3, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_3: - TIME_CHECK_CALLBACK(kTime2052000, params->param4, 4, setup_function12); + if (Entity::timeCheckCallback(kTime2052000, params->param4, 4, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_4: - TIME_CHECK_CALLBACK(kTime2079000, params->param5, 5, setup_function12); + if (Entity::timeCheckCallback(kTime2079000, params->param5, 5, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2092500, params->param6, 6, setup_function12); + if (Entity::timeCheckCallback(kTime2092500, params->param6, 6, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_6: - TIME_CHECK_CALLBACK(kTime2173500, params->param7, 7, setup_function12); + if (Entity::timeCheckCallback(kTime2173500, params->param7, 7, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_7: - TIME_CHECK_CALLBACK(kTime2182500, params->param8, 8, setup_function12); + if (Entity::timeCheckCallback(kTime2182500, params->param8, 8, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_8: - TIME_CHECK_CALLBACK(kTime2241000, CURRENT_PARAM(1, 1), 9, setup_function12); + if (Entity::timeCheckCallback(kTime2241000, CURRENT_PARAM(1, 1), 9, WRAP_SETUP_FUNCTION(Francois, setup_function12))) + break; label_callback_9: if (!getInventory()->hasItem(kItemWhistle) && getInventory()->get(kItemWhistle)->location != kObjectLocation3) { - TIME_CHECK_CALLBACK_1(kTime2011500, CURRENT_PARAM(1, 2), 10, setup_function11, kTime2016000); + if (timeCheckCallback(kTime2011500, CURRENT_PARAM(1, 2), 10, kTime2016000)) + break; label_callback_10: - TIME_CHECK_CALLBACK_1(kTime2115000, CURRENT_PARAM(1, 3), 11, setup_function11, kTime2119500); + if (timeCheckCallback(kTime2115000, CURRENT_PARAM(1, 3), 11, kTime2119500)) + break; } label_callback_11: @@ -1129,13 +1142,15 @@ IMPLEMENT_FUNCTION(25, Francois, chapter3Handler) } label_callback_12: - TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 5), 13, setup_function14, kObjectCompartmentE, kPosition_4840, "e"); + if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 5), 13, kObjectCompartmentE, kPosition_4840, "e")) + break; label_callback_13: - TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 6), 14, setup_function14, kObjectCompartmentF, kPosition_4070, "f"); + if (timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 6), 14, kObjectCompartmentF, kPosition_4070, "f")) + break; label_callback_14: - TIME_CHECK_CALLBACK_3(kTime2040300, CURRENT_PARAM(1, 7), 15, setup_function14, kObjectCompartmentB, kPosition_7500, "b"); + timeCheckCallbackCompartment(kTime2040300, CURRENT_PARAM(1, 7), 15, kObjectCompartmentB, kPosition_7500, "b"); } } break; @@ -1291,4 +1306,33 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_NULL_FUNCTION(31, Francois) + +////////////////////////////////////////////////////////////////////////// +// Helper functions +////////////////////////////////////////////////////////////////////////// +bool Francois::timeCheckCallbackCompartment(TimeValue timeValue, uint ¶meter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + setup_function14(compartment, position, sequenceSuffix); + + return true; + } + + return false; +} + +bool Francois::timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, TimeValue timeValue2) { + if (getState()->time > timeValue && !parameter) { + parameter = 1; + setCallback(callback); + setup_function11(timeValue2); + + return true; + } + + return false; +} + + } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/francois.h b/engines/lastexpress/entities/francois.h index 19eca6fb5095..51270fa4b69f 100644 --- a/engines/lastexpress/entities/francois.h +++ b/engines/lastexpress/entities/francois.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_FRANCOIS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { @@ -160,6 +159,10 @@ class Francois : public Entity { DECLARE_FUNCTION(function30) DECLARE_NULL_FUNCTION() + +private: + bool timeCheckCallbackCompartment(TimeValue timeValue, uint ¶meter, byte callback, ObjectIndex compartment, EntityPosition position, const char* sequenceSuffix); + bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, TimeValue timeValue2); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp index daa50956d30a..a912fa4ecb75 100644 --- a/engines/lastexpress/entities/gendarmes.cpp +++ b/engines/lastexpress/entities/gendarmes.cpp @@ -31,7 +31,6 @@ #include "lastexpress/game/state.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -67,7 +66,7 @@ IMPLEMENT_FUNCTION(2, Gendarmes, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Gendarmes, setup_chapter1Handler)); break; case kActionDefault: @@ -195,7 +194,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition) break; case 1: - CALLBACK_ACTION(); + callbackAction(); break; case 2: @@ -233,7 +232,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition) case 6: getData()->location = kLocationOutsideCompartment; getEntities()->exitCompartment(kEntityGendarmes, (ObjectIndex)parameters2->param5); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -267,11 +266,12 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje getSound()->playSound(kEntityGendarmes, "POL1046A", kFlagDefault); } - UPDATE_PARAM(params->param7, getState()->timeTicks, 300); + if (!Entity::updateParameter(params->param7, getState()->timeTicks, 300)) + break; if (!params->param4 && getEntities()->isOutsideAlexeiWindow()) { getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); } else { if (getEntities()->isOutsideAlexeiWindow()) getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49); @@ -322,7 +322,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverBloodJacket, true); getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 4: @@ -330,7 +330,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true); getObjects()->update((ObjectIndex)params->param3, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 5: @@ -552,13 +552,14 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl case kActionNone: if (checkCallback) { EXPOSE_PARAMS(EntityData::EntityParametersIIII); - TIME_CHECK_CALLBACK_ACTION(params->param1, params->param2); + if (Entity::timeCheckCallbackAction((TimeValue)params->param1, params->param2)) + break; } if (shouldUpdateEntity) { EXPOSE_PARAMS(EntityData::EntityParametersIIII); if (getEntities()->updateEntity(kEntityGendarmes, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } } @@ -582,7 +583,7 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -599,7 +600,7 @@ void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFl if (shouldUpdateEntity) { EXPOSE_PARAMS(EntityData::EntityParametersIIII); if (getEntities()->updateEntity(kEntityGendarmes, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } } diff --git a/engines/lastexpress/entities/gendarmes.h b/engines/lastexpress/entities/gendarmes.h index d999cfc1fd4f..a7616435317d 100644 --- a/engines/lastexpress/entities/gendarmes.h +++ b/engines/lastexpress/entities/gendarmes.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_GENDARMES_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" #include "lastexpress/sound/sound.h" diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp index 8ec972b93930..e9abcd888a37 100644 --- a/engines/lastexpress/entities/hadija.cpp +++ b/engines/lastexpress/entities/hadija.cpp @@ -28,10 +28,7 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -89,22 +86,22 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(6, Hadija, compartment6) - COMPARTMENT_TO(Hadija, kObjectCompartment6, kPosition_4070, "619Cf", "619Df"); + Entity::goToCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Cf", "619Df"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(7, Hadija, compartment8) - COMPARTMENT_TO(Hadija, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh"); + Entity::goToCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Ch", "619Dh"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(8, Hadija, compartment6to8) - COMPARTMENT_FROM_TO(Hadija, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah"); + Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment6, kPosition_4070, "619Bf", kObjectCompartment8, kPosition_2740, "619Ah"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(9, Hadija, compartment8to6) - COMPARTMENT_FROM_TO(Hadija, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af"); + Entity::goToCompartmentFromCompartment(savepoint, kObjectCompartment8, kPosition_2740, "619Bh", kObjectCompartment6, kPosition_4070, "619Af"); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -114,7 +111,7 @@ IMPLEMENT_FUNCTION(10, Hadija, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Hadija, setup_chapter1Handler)); break; case kActionDefault: @@ -133,10 +130,12 @@ IMPLEMENT_FUNCTION(11, Hadija, chapter1Handler) break; case kActionNone: - TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840); + if (Entity::timeCheckPlaySoundUpdatePosition(kTimeParisEpernay, params->param1, 1, "Har1100", kPosition_4840)) + break; label_callback1: - TIME_CHECK_CALLBACK(kTime1084500, params->param2, 2, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime1084500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback2: if (params->param3 != kTimeInvalid && getState()->time > kTime1093500) { @@ -164,7 +163,8 @@ IMPLEMENT_FUNCTION(11, Hadija, chapter1Handler) } label_callback3: - TIME_CHECK_CALLBACK(kTime1156500, params->param4, 4, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime1156500, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback4: if (params->param5 != kTimeInvalid && getState()->time > kTime1165500) { @@ -254,7 +254,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) } if (params->param2 == kTimeInvalid || getState()->time <= kTime1786500) { - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; } @@ -264,7 +264,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) params->param2 = (uint)getState()->time + 75; if (params->param2 >= getState()->time) { - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; } } @@ -281,7 +281,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler) break; case 1: - TIME_CHECK_CALLBACK(kTime1822500, params->param3, 2, setup_compartment8to6); + Entity::timeCheckCallback(kTime1822500, params->param3, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6)); break; case 2: @@ -321,20 +321,26 @@ IMPLEMENT_FUNCTION(16, Hadija, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1998000, params->param1, 1, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime1998000, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback1: - TIME_CHECK_CALLBACK(kTime2020500, params->param2, 2, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2020500, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback2: - TIME_CHECK_CALLBACK(kTime2079000, params->param3, 3, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2079000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback3: - TIME_CHECK_CALLBACK(kTime2187000, params->param4, 4, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2187000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback4: - if (params->param5 != kTimeInvalid && getState()->time > kTime2196000) - TIME_CHECK_CAR(kTime2254500, params->param5, 5, setup_compartment6); + if (params->param5 != kTimeInvalid && getState()->time > kTime2196000) { + if (Entity::timeCheckCar(kTime2254500, params->param5, 5, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } break; case kActionDefault: @@ -387,18 +393,24 @@ IMPLEMENT_FUNCTION(18, Hadija, chapter4Handler) break; case kActionNone: - if (params->param1 != kTimeInvalid) - TIME_CHECK_CAR(kTime1714500, params->param1, 1, setup_compartment6); + if (params->param1 != kTimeInvalid) { + if (Entity::timeCheckCar(kTime1714500, params->param1, 1, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } label_callback1: - TIME_CHECK_CALLBACK(kTime2367000, params->param2, 2, setup_compartment6to8); + if (Entity::timeCheckCallback(kTime2367000, params->param2, 2, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6to8))) + break; label_callback2: - TIME_CHECK_CALLBACK(kTime2421000, params->param3, 3, setup_compartment8to6); + if (Entity::timeCheckCallback(kTime2421000, params->param3, 3, WRAP_SETUP_FUNCTION(Hadija, setup_compartment8to6))) + break; label_callback3: - if (params->param4 != kTimeInvalid && getState()->time > kTime2425500) - TIME_CHECK_CAR(kTime2484000, params->param4, 4, setup_compartment6); + if (params->param4 != kTimeInvalid && getState()->time > kTime2425500) { + if (Entity::timeCheckCar(kTime2484000, params->param4, 4, WRAP_SETUP_FUNCTION(Hadija, setup_compartment6))) + break; + } break; case kActionCallback: @@ -468,7 +480,9 @@ IMPLEMENT_FUNCTION(22, Hadija, function22) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 2700); + if (!Entity::updateParameter(params->param1, getState()->time, 2700)) + break; + setup_function23(); break; diff --git a/engines/lastexpress/entities/hadija.h b/engines/lastexpress/entities/hadija.h index d2495955e065..545f21ee0300 100644 --- a/engines/lastexpress/entities/hadija.h +++ b/engines/lastexpress/entities/hadija.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_HADIJA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/ivo.cpp b/engines/lastexpress/entities/ivo.cpp index f2261b438cce..c53f4689fb6a 100644 --- a/engines/lastexpress/entities/ivo.cpp +++ b/engines/lastexpress/entities/ivo.cpp @@ -32,10 +32,7 @@ #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -184,7 +181,7 @@ IMPLEMENT_FUNCTION(11, Ivo, function11) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityIvo); - CALLBACK_ACTION(); + callbackAction(); break; case 4: @@ -193,7 +190,7 @@ IMPLEMENT_FUNCTION(11, Ivo, function11) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityIvo); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -210,7 +207,7 @@ IMPLEMENT_FUNCTION(12, Ivo, sitAtTableWithSalko) getEntities()->clearSequences(kEntitySalko); getSavePoints()->push(kEntityIvo, kEntityTables2, kAction136455232); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -231,7 +228,7 @@ IMPLEMENT_FUNCTION(13, Ivo, leaveTableWithSalko) getSavePoints()->push(kEntityIvo, kEntityTables2, kActionDrawTablesWithChairs, "009E"); getEntities()->clearSequences(kEntitySalko); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -249,7 +246,7 @@ IMPLEMENT_FUNCTION(14, Ivo, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_chapter1Handler)); break; case kActionDefault: @@ -374,7 +371,7 @@ IMPLEMENT_FUNCTION(18, Ivo, chapter2) break; case kActionNone: - TIME_CHECK(kTime1777500, params->param1, setup_function19); + Entity::timeCheck(kTime1777500, params->param1, WRAP_SETUP_FUNCTION(Ivo, setup_function19)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/ivo.h b/engines/lastexpress/entities/ivo.h index cd5cb7b6be1a..75814336e062 100644 --- a/engines/lastexpress/entities/ivo.h +++ b/engines/lastexpress/entities/ivo.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_IVO_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp index 2918b1e8bde3..7860836a26ac 100644 --- a/engines/lastexpress/entities/kahina.cpp +++ b/engines/lastexpress/entities/kahina.cpp @@ -32,10 +32,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -90,7 +88,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION_I(4, Kahina, updateFromTime, uint32) if (savepoint.action == kAction137503360) { ENTITY_PARAM(0, 2) = 1; - CALLBACK_ACTION(); + callbackAction(); } Entity::updateFromTime(savepoint); @@ -111,7 +109,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) if (params->param1 < getState()->time && !params->param2) { params->param2 = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -141,7 +139,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) case 1: if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -151,7 +149,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) case 2: case 3: if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -163,7 +161,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) case 4: if (ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -173,7 +171,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) case 5: if (ENTITY_PARAM(0, 1) || ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -185,7 +183,7 @@ IMPLEMENT_FUNCTION_I(6, Kahina, function6, TimeValue) case kAction137503360: ENTITY_PARAM(0, 2) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -198,12 +196,12 @@ IMPLEMENT_FUNCTION_II(7, Kahina, updateEntity2, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: if (getEntities()->updateEntity(_entityIndex, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); } else if (getEntities()->isDistanceBetweenEntities(kEntityKahina, kEntityPlayer, 1000) && !getEntities()->isInGreenCarEntrance(kEntityPlayer) && !getEntities()->isInsideCompartments(kEntityPlayer) @@ -211,14 +209,14 @@ IMPLEMENT_FUNCTION_II(7, Kahina, updateEntity2, CarIndex, EntityPosition) if (getData()->car == kCarGreenSleeping || getData()->car == kCarRedSleeping) { ENTITY_PARAM(0, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); } } break; case kAction137503360: ENTITY_PARAM(0, 2) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -249,7 +247,7 @@ IMPLEMENT_FUNCTION(10, Kahina, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kahina, setup_chapter1Handler)); break; case kActionDefault: @@ -269,7 +267,7 @@ IMPLEMENT_FUNCTION(11, Kahina, chapter1Handler) return; if (getProgress().jacket != kJacketOriginal) - TIME_CHECK_SAVEPOINT(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837); + Entity::timeCheckSavepoint(kTime1107000, params->param1, kEntityKahina, kEntityMertens, kAction238732837); if (getProgress().eventMertensKronosInvitation) setup_function12(); @@ -282,7 +280,7 @@ IMPLEMENT_FUNCTION(12, Kahina, function12) break; case kActionNone: - TIME_CHECK(kTime1485000, params->param2, setup_function13); + Entity::timeCheck(kTime1485000, params->param2, WRAP_SETUP_FUNCTION(Kahina, setup_function13)); break; case kActionKnock: @@ -372,12 +370,12 @@ IMPLEMENT_FUNCTION(14, Kahina, function14) case kActionExitCompartment: getEntities()->exitCompartment(kEntityKahina, kObjectCompartmentF); - CALLBACK_ACTION(); + callbackAction(); break; case kAction4: getEntities()->exitCompartment(kEntityKahina, kObjectCompartmentF); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -396,10 +394,10 @@ IMPLEMENT_FUNCTION(15, Kahina, function15) case kActionNone: if (params->param2 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0) + if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)) { setCallback(9); setup_updateEntity(kCarRedSleeping, kPosition_4070); - UPDATE_PARAM_PROC_END + } } break; @@ -542,7 +540,7 @@ IMPLEMENT_FUNCTION(15, Kahina, function15) case 17: getEntities()->clearSequences(kEntityKahina); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -582,18 +580,18 @@ IMPLEMENT_FUNCTION(17, Kahina, chapter2Handler) case kActionNone: if (params->param1) { - UPDATE_PARAM_PROC(params->param2, getState()->time, 9000) + if (Entity::updateParameter(params->param2, getState()->time, 9000)) { params->param1 = 1; params->param2 = 0; - UPDATE_PARAM_PROC_END + } } if (getEvent(kEventKahinaAskSpeakFirebird) && getEvent(kEventKronosConversationFirebird) && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 900) + if (Entity::updateParameter(params->param3, getState()->time, 900)) { setCallback(1); setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird); break; - UPDATE_PARAM_PROC_END + } } label_callback_3: @@ -729,7 +727,7 @@ IMPLEMENT_FUNCTION_II(19, Kahina, function19, CarIndex, EntityPosition) RESET_ENTITY_STATE(kEntityKahina, Kahina, setup_function22); if (getEntities()->updateEntity(kEntityKahina, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -745,7 +743,7 @@ IMPLEMENT_FUNCTION_II(19, Kahina, function19, CarIndex, EntityPosition) case kActionDefault: if (getEntities()->updateEntity(kEntityKahina, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -787,16 +785,17 @@ IMPLEMENT_FUNCTION(20, Kahina, chapter3Handler) } if (!params->param1) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 9000) + if (Entity::updateParameter(params->param3, getState()->time, 9000)) { params->param1 = 1; params->param3 = 0; - UPDATE_PARAM_PROC_END + } } if (getEvent(kEventKahinaAskSpeakFirebird) && !getEvent(kEventKronosConversationFirebird) && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) { - UPDATE_PARAM(params->param4, getState()->time, 900); + if (!Entity::updateParameter(params->param4, getState()->time, 900)) + break; setCallback(3); setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird); @@ -928,11 +927,11 @@ IMPLEMENT_FUNCTION(21, Kahina, function21) params->param3 = (uint)getState()->time + 4500; if (params->param6 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0) + if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)) { setCallback(2); setup_function23(); break; - UPDATE_PARAM_PROC_END + } } } @@ -943,14 +942,14 @@ IMPLEMENT_FUNCTION(21, Kahina, function21) params->param4 = (uint)getState()->time + 4500; if (params->param6 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0) + if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)) { getSound()->playSound(kEntityPlayer, "LIB014", getSound()->getSoundFlag(kEntityKahina)); getSound()->playSound(kEntityPlayer, "LIB015", getSound()->getSoundFlag(kEntityKahina)); getEntities()->drawSequenceLeft(kEntityKahina, "202a"); params->param2 = 0; - UPDATE_PARAM_PROC_END + } } } @@ -1125,7 +1124,7 @@ IMPLEMENT_FUNCTION(23, Kahina, function23) case 7: getEntities()->clearSequences(kEntityKahina); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1262,7 +1261,7 @@ IMPLEMENT_FUNCTION(25, Kahina, function25) getProgress().field_78 = 1; ENTITY_PARAM(0, 3) = 0; - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -1303,7 +1302,7 @@ IMPLEMENT_FUNCTION(25, Kahina, function25) case 13: getEntities()->clearSequences(kEntityKahina); - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1387,7 +1386,7 @@ IMPLEMENT_FUNCTION(26, Kahina, function26) getInventory()->setLocationAndProcess(kItemBriefcase, kObjectLocation2); getProgress().field_78 = 1; - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -1429,7 +1428,7 @@ IMPLEMENT_FUNCTION(26, Kahina, function26) case 9: getEntities()->clearSequences(kEntityKahina); - CALLBACK_ACTION(); + callbackAction(); break; case 6: diff --git a/engines/lastexpress/entities/kahina.h b/engines/lastexpress/entities/kahina.h index b25053e339c9..7479cf76f9ab 100644 --- a/engines/lastexpress/entities/kahina.h +++ b/engines/lastexpress/entities/kahina.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_KAHINA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp index 134dce9c8180..26ce3ca42437 100644 --- a/engines/lastexpress/entities/kronos.cpp +++ b/engines/lastexpress/entities/kronos.cpp @@ -39,10 +39,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -128,7 +126,7 @@ IMPLEMENT_FUNCTION(7, Kronos, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_chapter1Handler)); break; case kActionDefault: @@ -149,7 +147,7 @@ IMPLEMENT_FUNCTION(8, Kronos, chapter1Handler) break; case kActionNone: - TIME_CHECK(kTime1489500, params->param2, setup_function11); + Entity::timeCheck(kTime1489500, params->param2, WRAP_SETUP_FUNCTION(Kronos, setup_function11)); break; case kAction171849314: @@ -191,7 +189,7 @@ IMPLEMENT_FUNCTION(10, Kronos, function10) break; case kActionNone: - TIME_CHECK(kTime1489500, params->param1, setup_function11); + Entity::timeCheck(kTime1489500, params->param1, WRAP_SETUP_FUNCTION(Kronos, setup_function11)); break; case kActionDefault: @@ -295,10 +293,10 @@ IMPLEMENT_FUNCTION(15, Kronos, function15) case kActionNone: if (params->param1 && !getEntities()->isInSalon(kEntityBoutarel)) { - UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param2, getState()->timeTicks, 75)) { setup_function16(); break; - UPDATE_PARAM_PROC_END + } } if (params->param3 != kTimeInvalid && getState()->time > kTime2002500) { @@ -407,8 +405,7 @@ IMPLEMENT_FUNCTION(18, Kronos, function18) params->param2 = 1; } - TIME_CHECK(kTime2106000, params->param3, setup_function19) - else { + if (!Entity::timeCheck(kTime2106000, params->param3, WRAP_SETUP_FUNCTION(Kronos, setup_function19))) { if (params->param1 && getEntities()->isInKronosSanctum(kEntityPlayer)) { setCallback(1); setup_savegame(kSavegameTypeEvent, kEventKahinaPunchSuite4); @@ -528,9 +525,9 @@ IMPLEMENT_FUNCTION(20, Kronos, function20) } if (CURRENT_PARAM(1, 2) != kTimeInvalid && params->param7 < getState()->time) { - UPDATE_PARAM_PROC_TIME(params->param8, !params->param1, CURRENT_PARAM(1, 2), 450) + if (Entity::updateParameterTime((TimeValue)params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)) { getSavePoints()->push(kEntityKronos, kEntityKahina, kAction237555748); - UPDATE_PARAM_PROC_END + } } if (!params->param1) diff --git a/engines/lastexpress/entities/kronos.h b/engines/lastexpress/entities/kronos.h index 4c61b986205f..a7693fcd468a 100644 --- a/engines/lastexpress/entities/kronos.h +++ b/engines/lastexpress/entities/kronos.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_KRONOS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp index 0e67b45cd250..af86ef8cddd8 100644 --- a/engines/lastexpress/entities/mahmud.cpp +++ b/engines/lastexpress/entities/mahmud.cpp @@ -34,10 +34,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -86,7 +84,8 @@ IMPLEMENT_FUNCTION_SIII(4, Mahmud, enterExitCompartment2, ObjectIndex, uint32, O break; case kActionNone: - UPDATE_PARAM(params->param7, getState()->timeTicks, params->param5); + if (!Entity::updateParameter(params->param7, getState()->timeTicks, params->param5)) + break; if (!getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingUp)) getScenes()->loadSceneFromObject((ObjectIndex)params->param6, true); @@ -95,7 +94,7 @@ IMPLEMENT_FUNCTION_SIII(4, Mahmud, enterExitCompartment2, ObjectIndex, uint32, O case kActionExitCompartment: getEntities()->exitCompartment(kEntityMahmud, (ObjectIndex)params->param4); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -146,7 +145,8 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) break; case kActionNone: - UPDATE_PARAM(params->param6, getState()->time, 13500); + if (!Entity::updateParameter(params->param6, getState()->time, 13500)) + break; getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand); getObjects()->update(kObjectCompartment6, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand); @@ -267,7 +267,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMahmud); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -392,7 +392,7 @@ IMPLEMENT_FUNCTION(11, Mahmud, function11) getEntities()->clearSequences(kEntityMahmud); getObjects()->update(kObjectCompartment4, kEntityMahmud, kObjectLocation3, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -471,7 +471,7 @@ IMPLEMENT_FUNCTION(12, Mahmud, function12) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMahmud); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -537,7 +537,7 @@ IMPLEMENT_FUNCTION(13, Mahmud, function13) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMahmud); - CALLBACK_ACTION(); + callbackAction(); break; } @@ -560,7 +560,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler) if (!params->param2 && getProgress().chapter == kChapter1) { - TIME_CHECK_CALLBACK(kTime1098000, params->param6, 1, setup_function13); + if (Entity::timeCheckCallback(kTime1098000, params->param6, 1, WRAP_SETUP_FUNCTION(Mahmud, setup_function13))) + break; if (!getSoundQueue()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { params->param7 = 1; @@ -572,7 +573,8 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler) } if (params->param5) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75)) + break; params->param4 = 1; params->param5 = 0; @@ -732,7 +734,7 @@ IMPLEMENT_FUNCTION(15, Mahmud, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mahmud, setup_chaptersHandler)); break; case kActionDefault: diff --git a/engines/lastexpress/entities/mahmud.h b/engines/lastexpress/entities/mahmud.h index 5feb95cba58d..685100f078a9 100644 --- a/engines/lastexpress/entities/mahmud.h +++ b/engines/lastexpress/entities/mahmud.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_MAHMUD_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp index eacc38bf606c..abd2aae9e424 100644 --- a/engines/lastexpress/entities/max.cpp +++ b/engines/lastexpress/entities/max.cpp @@ -31,10 +31,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -91,7 +89,8 @@ IMPLEMENT_FUNCTION(6, Max, chapter12_handler) break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, params->param1); + if (!Entity::updateParameter(params->param2, getState()->time, params->param1)) + break; if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); @@ -125,7 +124,8 @@ IMPLEMENT_FUNCTION(7, Max, function7) break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, params->param1) + if (!Entity::updateParameter(params->param2, getState()->time, params->param1)) + break; if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); @@ -186,7 +186,7 @@ IMPLEMENT_FUNCTION(7, Max, function7) case kAction101687594: getEntities()->clearSequences(kEntityMax); - CALLBACK_ACTION(); + callbackAction(); break; case kAction122358304: @@ -195,7 +195,7 @@ IMPLEMENT_FUNCTION(7, Max, function7) getObjects()->update(kObjectCompartmentF, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); getObjects()->update(kObject53, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case kAction158007856: @@ -214,7 +214,8 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler) break; case kActionNone: - UPDATE_PARAM(params->param3, getState()->time, params->param2); + if (!Entity::updateParameter(params->param3, getState()->time, params->param2)) + break; if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max3101"); @@ -323,7 +324,7 @@ IMPLEMENT_FUNCTION(10, Max, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter12_handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Max, setup_chapter12_handler)); break; case kActionDefault: @@ -392,7 +393,8 @@ IMPLEMENT_FUNCTION(13, Max, chapter3Handler) break; } - UPDATE_PARAM(params->param3, getState()->time, params->param1); + if (!Entity::updateParameter(params->param3, getState()->time, params->param1)) + break; if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); @@ -514,7 +516,8 @@ IMPLEMENT_FUNCTION(15, Max, function15) } if (!params->param1) { - UPDATE_PARAM(params->param3, getState()->time, 900); + if (!Entity::updateParameter(params->param3, getState()->time, 900)) + break; getSavePoints()->push(kEntityMax, kEntityCoudert, kAction157026693); } diff --git a/engines/lastexpress/entities/max.h b/engines/lastexpress/entities/max.h index 17b58475aa11..acd8235e897e 100644 --- a/engines/lastexpress/entities/max.h +++ b/engines/lastexpress/entities/max.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_MAX_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp index d88962fce25a..97dd29379323 100644 --- a/engines/lastexpress/entities/mertens.cpp +++ b/engines/lastexpress/entities/mertens.cpp @@ -32,21 +32,11 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { -#define SAVEGAME_BLOOD_JACKET() \ - if (getProgress().jacket == kJacketBlood \ - && getEntities()->isDistanceBetweenEntities(kEntityMertens, kEntityPlayer, 1000) \ - && !getEntities()->isInsideCompartments(kEntityPlayer) \ - && !getEntities()->checkFields10(kEntityPlayer)) { \ - setCallback(1); \ - setup_savegame(kSavegameTypeEvent, kEventMertensBloodJacket); \ - } Mertens::Mertens(LastExpressEngine *engine) : Entity(engine, kEntityMertens) { ADD_CALLBACK_FUNCTION(Mertens, reset); @@ -117,11 +107,11 @@ IMPLEMENT_FUNCTION_S(2, Mertens, bloodJacket) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -144,7 +134,7 @@ IMPLEMENT_FUNCTION_SI(3, Mertens, enterExitCompartment, ObjectIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); return; case kActionCallback: @@ -165,12 +155,12 @@ IMPLEMENT_FUNCTION_SI(4, Mertens, enterExitCompartment2, ObjectIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); return; case kAction4: getEntities()->exitCompartment(kEntityMertens, (ObjectIndex)params->param4); - CALLBACK_ACTION(); + callbackAction(); return; case kActionCallback: @@ -191,13 +181,13 @@ IMPLEMENT_FUNCTION_SIII(5, Mertens, enterExitCompartment3, ObjectIndex, EntityPo break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionExitCompartment: getEntities()->exitCompartment(_entityIndex, (ObjectIndex)params->param4); getData()->entityPosition = (EntityPosition)params->param5; - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -229,15 +219,15 @@ IMPLEMENT_FUNCTION(6, Mertens, callbackActionOnDirection) case kActionNone: if (getData()->direction != kDirectionRight) { - CALLBACK_ACTION(); + callbackAction(); break; } - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -256,11 +246,11 @@ IMPLEMENT_FUNCTION_S(7, Mertens, playSound) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -283,11 +273,11 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -310,14 +300,6 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) - -#define LOADSCENE_FROM_POSITION() \ - if (getData()->direction != kDirectionUp) { \ - getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); \ - } else { \ - getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition - 750), true); \ - } - switch (savepoint.action) { default: break; @@ -333,7 +315,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) || getEntities()->checkFields10(kEntityPlayer)) { if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -364,7 +346,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) { getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -395,7 +377,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) params->param3 = 1; if (getEntities()->updateEntity(kEntityMertens, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -416,7 +398,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) ENTITY_PARAM(0, 7) = 0; if (params->param1 != 3 || (params->param2 != kPosition_8200 && params->param2 != kPosition_9510)) { - LOADSCENE_FROM_POSITION(); + loadSceneFromPosition(); break; } @@ -428,7 +410,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) getEntities()->updateEntity(kEntityMertens, kCarGreenSleeping, kPosition_2000); getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -444,35 +426,33 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition) getEntities()->updateEntity(kEntityMertens, kCarGreenSleeping, kPosition_2000); getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); - CALLBACK_ACTION(); + callbackAction(); break; } - LOADSCENE_FROM_POSITION(); + loadSceneFromPosition(); break; case 4: getAction()->playAnimation(kEventMertensKronosConcertInvitation); ENTITY_PARAM(2, 4) = 0; - LOADSCENE_FROM_POSITION(); + loadSceneFromPosition(); break; case 5: getAction()->playAnimation(getData()->entityPosition < getEntityData(kEntityPlayer)->entityPosition ? kEventMertensAskTylerCompartmentD : kEventMertensAskTylerCompartment); - LOADSCENE_FROM_POSITION(); + loadSceneFromPosition(); break; case 6: getAction()->playAnimation(kEventMertensDontMakeBed); - LOADSCENE_FROM_POSITION(); + loadSceneFromPosition(); ENTITY_PARAM(0, 4) = 0; break; } break; } - -#undef LOADSCENE_FROM_POSITION IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -482,11 +462,12 @@ IMPLEMENT_FUNCTION_I(11, Mertens, function11, uint32) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); - UPDATE_PARAM(params->param2, getState()->time, params->param1) + if (!Entity::updateParameter(params->param2, getState()->time, params->param1)) + break; - CALLBACK_ACTION(); + callbackAction(); break; case kActionCallback: @@ -506,7 +487,7 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex) return; if (getSoundQueue()->isBuffered(kEntityMertens)) { - CALLBACK_ACTION(); + callbackAction(); return; } @@ -540,7 +521,7 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex) getSound()->playSound(kEntityMertens, "CON1112G"); } - CALLBACK_ACTION(); + callbackAction(); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -550,23 +531,23 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); if (!params->param2 && !params->param3) { - UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param4, getState()->timeTicks, 75)) { getData()->inventoryItem = kItemNone; setCallback(5); setup_function18(); break; - UPDATE_PARAM_PROC_END + } } - UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 225) + if (Entity::updateParameter(params->param5, getState()->timeTicks, 225)) { getData()->inventoryItem = kItemNone; setCallback(6); setup_function18(); break; - UPDATE_PARAM_PROC_END + } getData()->inventoryItem = (getProgress().chapter == kChapter1 && !ENTITY_PARAM(2, 1) @@ -640,7 +621,7 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool) case 6: case 9: case 10: - CALLBACK_ACTION(); + callbackAction(); break; case 7: @@ -672,7 +653,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex) break; case kActionNone: - SAVEGAME_BLOOD_JACKET(); + Entity::savegameBloodJacket(); break; case kActionDefault: @@ -719,7 +700,7 @@ IMPLEMENT_FUNCTION_I(14, Mertens, function14, EntityIndex) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -783,7 +764,7 @@ IMPLEMENT_FUNCTION_I(15, Mertens, function15, bool) break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -860,7 +841,7 @@ IMPLEMENT_FUNCTION_I(16, Mertens, function16, bool) break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -888,7 +869,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17) getScenes()->loadSceneFromItemPosition(kItem7); ENTITY_PARAM(2, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -926,7 +907,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17) break; case 2: - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -944,7 +925,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17) getSavePoints()->push(kEntityMertens, kEntityMertens, kActionDrawScene); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -970,7 +951,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18) getInventory()->setLocationAndProcess(kItem7, kObjectLocation1); ENTITY_PARAM(2, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -978,7 +959,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18) getScenes()->loadSceneFromItemPosition(kItem7); ENTITY_PARAM(2, 1) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1009,7 +990,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18) ENTITY_PARAM(0, 1) = 0; getData()->inventoryItem = kItemNone; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -1025,7 +1006,7 @@ IMPLEMENT_FUNCTION(19, Mertens, function19) if (ENTITY_PARAM(2, 1)) { getInventory()->setLocationAndProcess(kItem7, kObjectLocation1); ENTITY_PARAM(2, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); } else { setCallback(1); setup_bloodJacket("601C"); @@ -1039,7 +1020,7 @@ IMPLEMENT_FUNCTION(19, Mertens, function19) if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2)) getData()->entityPosition = kPosition_2088; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -1057,7 +1038,7 @@ IMPLEMENT_FUNCTION(20, Mertens, function20) if (ENTITY_PARAM(2, 1)) { ENTITY_PARAM(2, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); } else { setCallback(1); setup_bloodJacket("601C"); @@ -1066,7 +1047,7 @@ IMPLEMENT_FUNCTION(20, Mertens, function20) case kActionCallback: if (getCallback() == 1) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -1078,11 +1059,12 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex) break; case kActionNone: - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->time, 300) + if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 300)) { getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityMertens)); - UPDATE_PARAM_PROC_END + } - UPDATE_PARAM(CURRENT_PARAM(1, 5), getState()->time, 900); + if (!Entity::updateParameter(CURRENT_PARAM(1, 5), getState()->time, 900)) + break; // Update objects getObjects()->updateLocation2((ObjectIndex)params->param1, kObjectLocation1); @@ -1092,7 +1074,7 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex) if (params->param2) getObjects()->update((ObjectIndex)params->param2, (EntityIndex)params->param8, (ObjectLocation)CURRENT_PARAM(1, 1), (CursorStyle)CURRENT_PARAM(1, 2), (CursorStyle)CURRENT_PARAM(1, 3)); - CALLBACK_ACTION(); + callbackAction(); break; case kActionKnock: @@ -1222,7 +1204,7 @@ IMPLEMENT_FUNCTION(22, Mertens, function22) break; case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1291,7 +1273,7 @@ IMPLEMENT_FUNCTION(23, Mertens, function23) case 6: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1306,7 +1288,8 @@ IMPLEMENT_FUNCTION(24, Mertens, function24) case kActionNone: if (!params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment3("601Rc", kObjectCompartment3, kPosition_6470, kPosition_6130); @@ -1351,7 +1334,7 @@ IMPLEMENT_FUNCTION(24, Mertens, function24) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1380,7 +1363,7 @@ IMPLEMENT_FUNCTION(24, Mertens, function24) break; case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1409,7 +1392,8 @@ IMPLEMENT_FUNCTION(25, Mertens, function25) case kActionNone: if (!params->param1) { - UPDATE_PARAM(params->param2, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 75)) + break; setCallback(3); setup_enterExitCompartment3("601Zb", kObjectCompartment2, kPosition_7500, kPositionNone); @@ -1458,7 +1442,7 @@ IMPLEMENT_FUNCTION(25, Mertens, function25) case 5: getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -1492,7 +1476,7 @@ IMPLEMENT_FUNCTION(25, Mertens, function25) break; case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1547,7 +1531,7 @@ IMPLEMENT_FUNCTION_I(26, Mertens, function26, bool) case 2: getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -1613,7 +1597,7 @@ IMPLEMENT_FUNCTION_I(26, Mertens, function26, bool) getData()->location = kLocationOutsideCompartment; getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1628,17 +1612,17 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) case kActionNone: if (getProgress().field_14 == 29) { - CALLBACK_ACTION(); + callbackAction(); break; } - UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 150) + if (Entity::updateParameter(params->param2, getState()->timeTicks, 150)) { getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal); setCallback(10); setup_playSound16("CON1018A"); break; - UPDATE_PARAM_PROC_END + } label_callback10: if (!params->param3) @@ -1646,7 +1630,8 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) if (params->param3 >= getState()->timeTicks) { label_callback11: - UPDATE_PARAM(params->param4, getState()->timeTicks, 375); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 375)) + break; getSound()->playSound(kEntityPlayer, "LIB033"); @@ -1680,7 +1665,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; } } else { @@ -1738,7 +1723,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; } } else { @@ -1763,7 +1748,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) default: getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 1: @@ -1821,7 +1806,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; } } else { @@ -1930,7 +1915,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getData()->location = kLocationOutsideCompartment; getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 8: @@ -1957,7 +1942,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) case 19: case 22: case 28: - CALLBACK_ACTION(); + callbackAction(); break; case 15: @@ -1969,7 +1954,7 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; case 16: @@ -1981,27 +1966,27 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType) getSound()->playSound(kEntityPlayer, "LIB015"); getScenes()->loadScene(kScene41); - CALLBACK_ACTION(); + callbackAction(); break; case 23: getProgress().eventMertensAugustWaiting = true; getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 24: getProgress().eventMertensKronosInvitation = true; getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 25: getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2053,7 +2038,7 @@ IMPLEMENT_FUNCTION_S(28, Mertens, function28) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2115,7 +2100,7 @@ IMPLEMENT_FUNCTION_SS(29, Mertens, function29) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2140,14 +2125,14 @@ IMPLEMENT_FUNCTION_I(30, Mertens, function30, MertensActionType) case kActionDefault: switch (params->param1) { default: - CALLBACK_ACTION(); + callbackAction(); return; case 1: params->param2 = kPosition_8200; if (getProgress().field_14) { - CALLBACK_ACTION(); + callbackAction(); return; } @@ -2273,7 +2258,7 @@ IMPLEMENT_FUNCTION_I(30, Mertens, function30, MertensActionType) break; case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2312,7 +2297,7 @@ IMPLEMENT_FUNCTION_I(31, Mertens, function31, MertensActionType) case 2: case 3: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2360,7 +2345,7 @@ IMPLEMENT_FUNCTION(32, Mertens, function32) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2382,7 +2367,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33) setCallback(ENTITY_PARAM(0, 8) ? 1 : 3); setup_updateEntity(kCarGreenSleeping, ENTITY_PARAM(0, 8) ? kPosition_1500 : kPosition_540); } else { - CALLBACK_ACTION(); + callbackAction(); } break; @@ -2401,7 +2386,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33) case 2: ENTITY_PARAM(1, 8) = 0; - CALLBACK_ACTION(); + callbackAction(); break; case 3: @@ -2480,7 +2465,7 @@ IMPLEMENT_FUNCTION(33, Mertens, function33) break; } - CALLBACK_ACTION(); + callbackAction(); break; case 12: @@ -2493,13 +2478,13 @@ IMPLEMENT_FUNCTION(33, Mertens, function33) break; } - CALLBACK_ACTION(); + callbackAction(); break; case 13: ENTITY_PARAM(2, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2513,7 +2498,7 @@ IMPLEMENT_FUNCTION(34, Mertens, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Mertens, setup_chapter1Handler)); break; case kActionDefault: @@ -2548,7 +2533,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35) case kActionDefault: if (getProgress().field_14 == 29) { - CALLBACK_ACTION(); + callbackAction(); break; } else { getProgress().field_14 = 3; @@ -2589,7 +2574,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; case 5: @@ -2611,7 +2596,7 @@ IMPLEMENT_FUNCTION(35, Mertens, function35) break; case 7: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2626,7 +2611,7 @@ IMPLEMENT_FUNCTION(36, Mertens, function36) case kActionDefault: if (getProgress().field_14 == 29) { - CALLBACK_ACTION(); + callbackAction(); } else { getProgress().field_14 = 3; @@ -2712,7 +2697,7 @@ IMPLEMENT_FUNCTION(36, Mertens, function36) case 6: case 9: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2767,7 +2752,7 @@ IMPLEMENT_FUNCTION(37, Mertens, function37) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2791,12 +2776,12 @@ IMPLEMENT_FUNCTION(38, Mertens, function38) case kActionDefault: if (!ENTITY_PARAM(0, 4)) { - CALLBACK_ACTION(); + callbackAction(); break; } if (getProgress().field_14 == 29) { - CALLBACK_ACTION(); + callbackAction(); } else { setCallback(1); setup_updateEntity(kCarGreenSleeping, kPosition_8200); @@ -2810,7 +2795,7 @@ IMPLEMENT_FUNCTION(38, Mertens, function38) case 1: if (!ENTITY_PARAM(0, 4)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -2820,7 +2805,7 @@ IMPLEMENT_FUNCTION(38, Mertens, function38) case 2: ENTITY_PARAM(0, 4) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2894,7 +2879,7 @@ IMPLEMENT_FUNCTION(39, Mertens, function39) break; case 10: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -2940,7 +2925,7 @@ IMPLEMENT_FUNCTION(40, Mertens, function40) case 5: ENTITY_PARAM(0, 6) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -3013,7 +2998,7 @@ IMPLEMENT_FUNCTION(42, Mertens, function42) getData()->inventoryItem = kItemInvalid; if (!params->param2) { - TIME_CHECK_SAVEPOINT(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072); + Entity::timeCheckSavepoint(kTime1125000, params->param3, kEntityMertens, kEntityMahmud, kAction170483072); if (params->param4 != kTimeInvalid && getState()->time > kTimeCityChalons) { @@ -3040,11 +3025,11 @@ IMPLEMENT_FUNCTION(42, Mertens, function42) label_callback_8: if (getState()->time > kTime1215000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) { - UPDATE_PARAM_PROC(params->param5, getState()->time, 2700) + if (Entity::updateParameter(params->param5, getState()->time, 2700)) { getEntities()->drawSequenceLeft(kEntityMertens, "601E"); ENTITY_PARAM(0, 1) = 1; params->param5 = 0; - UPDATE_PARAM_PROC_END + } } if (ENTITY_PARAM(0, 8)) { @@ -3547,19 +3532,23 @@ IMPLEMENT_FUNCTION(46, Mertens, function46) } label_callback_6: - TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 7, setup_function28, "CON3012"); + if (Entity::timeCheckCallback(kTime1971000, params->param1, 7, "CON3012", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28))) + break; label_callback_7: - TIME_CHECK_CALLBACK(kTime2117700, params->param2, 8, setup_function32); + if (Entity::timeCheckCallback(kTime2117700, params->param2, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_8: - TIME_CHECK_CALLBACK_1(kTime2124000, params->param3, 9, setup_function28, "CON2010"); + if (Entity::timeCheckCallback(kTime2124000, params->param3, 9, "CON2010", WRAP_SETUP_FUNCTION_S(Mertens, setup_function28))) + break; label_callback_9: - TIME_CHECK_CALLBACK(kTime2146500, params->param4, 10, setup_function32); + if (Entity::timeCheckCallback(kTime2146500, params->param4, 10, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_10: - TIME_CHECK_CALLBACK(kTime2169000, params->param5, 11, setup_function32); + Entity::timeCheckCallback(kTime2169000, params->param5, 11, WRAP_SETUP_FUNCTION(Mertens, setup_function32)); break; case kAction11: @@ -3742,21 +3731,26 @@ IMPLEMENT_FUNCTION(48, Mertens, function48) label_callback_4: if (!params->param1) { - TIME_CHECK_CALLBACK(kTime2403000, params->param2, 5, setup_function49); + if (Entity::timeCheckCallback(kTime2403000, params->param2, 5, WRAP_SETUP_FUNCTION(Mertens, setup_function49))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2430000, params->param3, 6, setup_function32); + if (Entity::timeCheckCallback(kTime2430000, params->param3, 6, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_6: - TIME_CHECK_CALLBACK(kTime2439000, params->param4, 7, setup_function32); + if (Entity::timeCheckCallback(kTime2439000, params->param4, 7, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; label_callback_7: - TIME_CHECK_CALLBACK(kTime2448000, params->param5, 8, setup_function32); + if (Entity::timeCheckCallback(kTime2448000, params->param5, 8, WRAP_SETUP_FUNCTION(Mertens, setup_function32))) + break; } label_callback_8: if (getState()->time > kTime2538000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) { - UPDATE_PARAM(params->param6, getState()->time, 2700); + if (!Entity::updateParameter(params->param6, getState()->time, 2700)) + break; getEntities()->drawSequenceLeft(kEntityMertens, "601E"); @@ -3913,7 +3907,7 @@ IMPLEMENT_FUNCTION(49, Mertens, function49) break; case 11: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -4010,7 +4004,8 @@ IMPLEMENT_FUNCTION(53, Mertens, function53) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param4, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 0; @@ -4108,4 +4103,15 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_NULL_FUNCTION(54, Mertens) +////////////////////////////////////////////////////////////////////////// +// Helper functions +////////////////////////////////////////////////////////////////////////// + +void Mertens::loadSceneFromPosition() { + if (getData()->direction != kDirectionUp) + getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); + else + getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition - 750), true); +} + } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/mertens.h b/engines/lastexpress/entities/mertens.h index 31b7a97dcd6f..4cc58fd4ba42 100644 --- a/engines/lastexpress/entities/mertens.h +++ b/engines/lastexpress/entities/mertens.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_MERTENS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { @@ -210,6 +209,9 @@ class Mertens : public Entity { DECLARE_FUNCTION(function53) DECLARE_NULL_FUNCTION() + +private: + void loadSceneFromPosition(); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp index ff3d2b6744f2..519a6134975c 100644 --- a/engines/lastexpress/entities/milos.cpp +++ b/engines/lastexpress/entities/milos.cpp @@ -36,10 +36,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -135,7 +133,7 @@ IMPLEMENT_FUNCTION_II(10, Milos, enterCompartmentDialog, CarIndex, EntityPositio case kActionNone: case kActionDefault: if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -173,16 +171,16 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue) if (!params->param5 && params->param1 < getState()->time && !params->param7) { params->param7 = 1; - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param2) { - UPDATE_PARAM_PROC(params->param8, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param8, getState()->timeTicks, 75)) { params->param2 = 0; params->param3 = 1; getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorNormal, kCursorNormal); - UPDATE_PARAM_PROC_END + } } params->param8 = 0; @@ -191,10 +189,10 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue) break; if (params->param6) { - UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 4500) + if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 4500)) { params->param6 = 0; CURRENT_PARAM(1, 1) = 0; - UPDATE_PARAM_PROC_END + } } if (!getProgress().field_CC) { @@ -364,7 +362,7 @@ IMPLEMENT_FUNCTION(12, Milos, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Milos, setup_chapter1Handler)); break; case kActionDefault: @@ -394,7 +392,7 @@ IMPLEMENT_FUNCTION(13, Milos, function13) getEntities()->clearSequences(kEntityIvo); getEntities()->clearSequences(kEntitySalko); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -422,7 +420,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14) getEntities()->exitCompartment(kEntityMilos, kObjectCompartment1, true); getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -436,7 +434,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14) if (CURRENT_PARAM(1, 1) < getState()->timeTicks) { if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1) { - UPDATE_PARAM(CURRENT_PARAM(1, 2), getState()->timeTicks, 75); + if (!Entity::updateParameter(CURRENT_PARAM(1, 2), getState()->timeTicks, 75)) + break; getObjects()->update(kObjectCompartment1, kEntityMilos, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal); @@ -474,7 +473,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14) getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } } else { @@ -507,7 +506,8 @@ IMPLEMENT_FUNCTION(14, Milos, function14) } label_callback_12: - UPDATE_PARAM(CURRENT_PARAM(1, 4), getState()->timeTicks, 75); + if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)) + break; getEntities()->exitCompartment(kEntityMilos, kObjectCompartment1, true); @@ -593,7 +593,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14) getData()->location = kLocationOutsideCompartment; getObjects()->update(kObjectCompartment1, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; case 2: @@ -633,7 +633,7 @@ IMPLEMENT_FUNCTION(14, Milos, function14) getScenes()->loadScene(kScene41); getData()->location = kLocationOutsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -722,7 +722,7 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560); + Entity::timeCheckSavepoint(kTime1071000, params->param3, kEntityMilos, kEntityServers1, kAction223002560); if (getState()->time > kTime1089000 && getEntities()->isSomebodyInsideRestaurantOrSalon()) { setup_function16(); @@ -730,15 +730,16 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler) } if (getEntities()->isPlayerPosition(kCarRestaurant, 61) && !params->param1) { - UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 45) + if (Entity::updateParameter(params->param4, getState()->timeTicks, 45)) { setCallback(1); setup_draw("009C"); break; - UPDATE_PARAM_PROC_END + } } if (getEntities()->isPlayerPosition(kCarRestaurant, 70) && !params->param2) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 45); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 45)) + break; setCallback(2); setup_draw("009C"); @@ -953,7 +954,8 @@ IMPLEMENT_FUNCTION(21, Milos, function21) break; case kActionNone: - UPDATE_PARAM(params->param2, getState()->time, 4500); + if (!Entity::updateParameter(params->param2, getState()->time, 4500)) + break; params->param1 = 1; break; @@ -1118,7 +1120,8 @@ IMPLEMENT_FUNCTION(24, Milos, function24) } if (params->param1) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; @@ -1284,14 +1287,15 @@ IMPLEMENT_FUNCTION(25, Milos, function25) case kActionNone: if (!getEvent(kEventMilosCompartmentVisitTyler) && !getProgress().field_54 && !ENTITY_PARAM(0, 4)) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 13500) + if (Entity::updateParameter(params->param3, getState()->time, 13500)) { getSavePoints()->push(kEntityMilos, kEntityVesna, kAction155913424); params->param3 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param1) { - UPDATE_PARAM(params->param4, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; @@ -1386,7 +1390,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue) case kActionNone: if (params->param1 < getState()->time && !params->param2) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1415,7 +1419,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue) case 1: if (ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1425,7 +1429,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue) case 2: case 3: if (ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1442,7 +1446,7 @@ IMPLEMENT_FUNCTION_I(26, Milos, function26, TimeValue) case 5: if (ENTITY_PARAM(0, 2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1461,7 +1465,7 @@ IMPLEMENT_FUNCTION_II(27, Milos, function27, CarIndex, EntityPosition) case kActionNone: if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } @@ -1472,14 +1476,14 @@ IMPLEMENT_FUNCTION_II(27, Milos, function27, CarIndex, EntityPosition) if (getData()->car == kCarRedSleeping || getData()->car == kCarGreenSleeping) { ENTITY_PARAM(0, 2) = 1; - CALLBACK_ACTION(); + callbackAction(); } } break; case kActionDefault: if (getEntities()->updateEntity(kEntityMilos, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -1536,7 +1540,7 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler) TIME_CHECK_PLAYSOUND_MILOS(kTime2370600, params->param5, "Mil4015"); - TIME_CHECK_SAVEPOINT(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766); + Entity::timeCheckSavepoint(kTime2407500, params->param6, kEntityMilos, kEntityVesna, kAction55996766); break; case kActionCallback: diff --git a/engines/lastexpress/entities/milos.h b/engines/lastexpress/entities/milos.h index d58d717f8a8f..e8f95dc5ff27 100644 --- a/engines/lastexpress/entities/milos.h +++ b/engines/lastexpress/entities/milos.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_MILOS_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp index 9ca10ca37458..950644cb8f70 100644 --- a/engines/lastexpress/entities/mmeboutarel.cpp +++ b/engines/lastexpress/entities/mmeboutarel.cpp @@ -31,10 +31,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -124,7 +122,7 @@ IMPLEMENT_FUNCTION_S(8, MmeBoutarel, function8) if (!getEntities()->isPlayerPosition(kCarRedSleeping, 2)) getData()->entityPosition = kPosition_2088; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -211,7 +209,7 @@ IMPLEMENT_FUNCTION(9, MmeBoutarel, function9) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMmeBoutarel); - CALLBACK_ACTION(); + callbackAction(); break; case 5: @@ -220,7 +218,7 @@ IMPLEMENT_FUNCTION(9, MmeBoutarel, function9) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMmeBoutarel); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -246,7 +244,7 @@ IMPLEMENT_FUNCTION(10, MmeBoutarel, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_chapter1Handler)); break; case kActionDefault: @@ -312,7 +310,7 @@ IMPLEMENT_FUNCTION(11, MmeBoutarel, function11) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -402,7 +400,7 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13) case kActionNone: if (!getSoundQueue()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0) + if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)) { getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject51, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal); @@ -414,22 +412,24 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13) setCallback(1); setup_playSound("MME1037"); break; - UPDATE_PARAM_PROC_END + } } label_callback_1: if (getProgress().field_24 && params->param7 != kTimeInvalid) { - UPDATE_PARAM_PROC_TIME(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0) + if (Entity::updateParameterTime(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)) { setCallback(2); setup_function11(); break; - UPDATE_PARAM_PROC_END + } } - TIME_CHECK(kTime1094400, params->param8, setup_function14); + if (Entity::timeCheck(kTime1094400, params->param8, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function14))) + break; if (params->param4) { - UPDATE_PARAM(CURRENT_PARAM(1, 1), getState()->timeTicks, 75); + if (!Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, 75)) + break; params->param3 = 1; params->param4 = 0; @@ -589,7 +589,8 @@ IMPLEMENT_FUNCTION(15, MmeBoutarel, function15) label_callback_5: if (params->param2) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param1 = 1; params->param2 = 0; @@ -1018,7 +1019,8 @@ IMPLEMENT_FUNCTION(23, MmeBoutarel, chapter4Handler) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param2, getState()->time, 900); + if (!Entity::updateParameter(params->param2, getState()->time, 900)) + break; getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorKeepValue, kCursorKeepValue); @@ -1064,10 +1066,12 @@ IMPLEMENT_FUNCTION(24, MmeBoutarel, function24) break; case kActionNone: - TIME_CHECK(kTime2470500, params->param4, setup_function25); + if (Entity::timeCheck(kTime2470500, params->param4, WRAP_SETUP_FUNCTION(MmeBoutarel, setup_function25))) + break; if (params->param2) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param1 = 1; params->param2 = 0; @@ -1210,7 +1214,8 @@ IMPLEMENT_FUNCTION(28, MmeBoutarel, function28) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param3, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; diff --git a/engines/lastexpress/entities/mmeboutarel.h b/engines/lastexpress/entities/mmeboutarel.h index 772451ba15f5..0f6e6349fea9 100644 --- a/engines/lastexpress/entities/mmeboutarel.h +++ b/engines/lastexpress/entities/mmeboutarel.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_MMEBOUTAREL_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp index a191273702ed..6e9f992390b6 100644 --- a/engines/lastexpress/entities/pascale.cpp +++ b/engines/lastexpress/entities/pascale.cpp @@ -30,10 +30,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -171,7 +169,7 @@ IMPLEMENT_FUNCTION(8, Pascale, welcomeSophieAndRebecca) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 4) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -185,8 +183,8 @@ IMPLEMENT_FUNCTION(9, Pascale, sitSophieAndRebecca) break; case kActionExitCompartment: - CALLBACK_ACTION(); - break; + callbackAction(); + break; case kActionDefault: getEntities()->drawSequenceLeft(kEntityPascale, "012C1"); @@ -217,7 +215,7 @@ IMPLEMENT_FUNCTION(10, Pascale, welcomeCath) getScenes()->loadSceneFromPosition(kCarRestaurant, 69); } - CALLBACK_ACTION(); + callbackAction(); break; case kAction4: @@ -239,7 +237,7 @@ IMPLEMENT_FUNCTION(10, Pascale, welcomeCath) getScenes()->loadSceneFromPosition(kCarRestaurant, 69); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -283,7 +281,7 @@ IMPLEMENT_FUNCTION(11, Pascale, function11) getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -298,7 +296,7 @@ IMPLEMENT_FUNCTION(12, Pascale, chapter1) case kActionNone: setup_chapter1Handler(); - break; + break; case kActionDefault: getSavePoints()->addData(kEntityPascale, kAction239072064, 0); @@ -366,7 +364,7 @@ IMPLEMENT_FUNCTION(13, Pascale, getMessageFromAugustToTyler) getSavePoints()->push(kEntityPascale, kEntityVerges, kActionDeliverMessageToTyler); ENTITY_PARAM(0, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -382,7 +380,7 @@ IMPLEMENT_FUNCTION(14, Pascale, sitAnna) case kActionExitCompartment: getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 62); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -433,7 +431,7 @@ IMPLEMENT_FUNCTION(15, Pascale, welcomeAnna) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -486,7 +484,7 @@ IMPLEMENT_FUNCTION(16, Pascale, serveTatianaVassili) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 3) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -648,7 +646,7 @@ IMPLEMENT_FUNCTION(21, Pascale, chapter3) case kActionNone: setup_chapter3Handler(); - break; + break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); @@ -685,7 +683,7 @@ IMPLEMENT_FUNCTION(22, Pascale, chapter3Handler) setCallback(2); setup_welcomeSophieAndRebecca(); } - break; + break; case kActionCallback: if (getCallback() == 1) @@ -727,7 +725,7 @@ IMPLEMENT_FUNCTION(23, Pascale, function23) ENTITY_PARAM(0, 7) = 0; getEntities()->clearSequences(kEntityPascale); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -748,7 +746,7 @@ IMPLEMENT_FUNCTION(24, Pascale, welcomeAbbot) break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kAction10: @@ -771,7 +769,7 @@ IMPLEMENT_FUNCTION(25, Pascale, chapter4) case kActionNone: setup_chapter4Handler(); - break; + break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); @@ -953,7 +951,7 @@ IMPLEMENT_FUNCTION(27, Pascale, function27) ENTITY_PARAM(1, 1) = 0; ENTITY_PARAM(1, 2) = 1; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -999,7 +997,7 @@ IMPLEMENT_FUNCTION(28, Pascale, messageFromAnna) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(1, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1037,7 +1035,7 @@ IMPLEMENT_FUNCTION(29, Pascale, function29) case 2: getData()->entityPosition = kPosition_850; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1075,7 +1073,7 @@ IMPLEMENT_FUNCTION(30, Pascale, function30) case 2: getData()->entityPosition = kPosition_5900; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1090,7 +1088,7 @@ IMPLEMENT_FUNCTION(31, Pascale, chapter5) case kActionNone: setup_chapter5Handler(); - break; + break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); @@ -1117,18 +1115,19 @@ IMPLEMENT_FUNCTION(33, Pascale, function33) case kActionNone: if (params->param4) { - UPDATE_PARAM_PROC(params->param5, getState()->time, 4500) + if (Entity::updateParameter(params->param5, getState()->time, 4500)) { getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal); setCallback(1); setup_playSound("Wat5010"); break; - UPDATE_PARAM_PROC_END + } } label_callback1: if (params->param1) { - UPDATE_PARAM(params->param6, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 2; diff --git a/engines/lastexpress/entities/pascale.h b/engines/lastexpress/entities/pascale.h index 333ebcae3e3c..eaf0f3ba0c60 100644 --- a/engines/lastexpress/entities/pascale.h +++ b/engines/lastexpress/entities/pascale.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_PASCALE_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp index b1a176b47e4d..5bcb6aef855f 100644 --- a/engines/lastexpress/entities/rebecca.cpp +++ b/engines/lastexpress/entities/rebecca.cpp @@ -30,10 +30,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -179,7 +177,7 @@ IMPLEMENT_FUNCTION(15, Rebecca, function15) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityRebecca); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -261,7 +259,7 @@ IMPLEMENT_FUNCTION_I(16, Rebecca, function16, bool) getSavePoints()->push(kEntityRebecca, kEntityTables3, kAction136455232); getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -334,7 +332,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool) case 5: getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -343,7 +341,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool) getData()->location = kLocationInsideCompartment; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -397,7 +395,7 @@ IMPLEMENT_FUNCTION(18, Rebecca, function18) case 2: case 3: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -473,7 +471,7 @@ IMPLEMENT_FUNCTION(19, Rebecca, function19) case 5: case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -493,21 +491,21 @@ IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue) getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (!params->param2) { params->param6 = 0; } else { - UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) { params->param2 = 0; params->param3 = 1; getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal); params->param6 = 0; - UPDATE_PARAM_PROC_END + } } if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) { @@ -657,7 +655,7 @@ IMPLEMENT_FUNCTION(21, Rebecca, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Rebecca, setup_chapter1Handler)); break; case kActionDefault: @@ -685,7 +683,8 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler) break; case kActionNone: - TIME_CHECK_CALLBACK_1(kTime1084500, params->param3, 1, setup_playSound, "REB1015"); + if (Entity::timeCheckCallback(kTime1084500, params->param3, 1, "REB1015", WRAP_SETUP_FUNCTION_S(Rebecca, setup_playSound))) + break; if (params->param4 == kTimeInvalid) goto label_callback_4; @@ -699,7 +698,7 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler) if (params->param4 >= getState()->time) { label_callback_4: if (params->param1) { - UPDATE_PARAM_CHECK(params->param5, getState()->time, 900) + if (Entity::updateParameterCheck(params->param5, getState()->time, 900)) { if (getEntities()->isInSalon(kEntityPlayer)) { setCallback(5); setup_playSound("REB1013"); @@ -710,7 +709,9 @@ IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler) label_callback_5: if (params->param2) { - UPDATE_PARAM(params->param6, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param6, getState()->timeTicks, 90)) + break; + getScenes()->loadSceneFromPosition(kCarRestaurant, 55); } else { params->param6 = 0; @@ -774,7 +775,13 @@ IMPLEMENT_FUNCTION(23, Rebecca, function23) break; case kActionNone: - TIME_CHECK_CALLBACK_2(kTime1111500, params->param2, 3, setup_enterExitCompartment, "623De", kObjectCompartmentE); + if (getState()->time > kTime1111500 && !params->param2) { + params->param2 = 1; + setCallback(3); + setup_enterExitCompartment("623De", kObjectCompartmentE); + + break; + } break; case kActionDefault: @@ -843,12 +850,13 @@ IMPLEMENT_FUNCTION(24, Rebecca, function24) break; case kActionNone: - TIME_CHECK_SAVEPOINT(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416); + Entity::timeCheckSavepoint(kTime1134000, params->param2, kEntityRebecca, kEntityServers0, kAction223712416); if (!params->param1) break; - TIME_CHECK_CALLBACK(kTime1165500, params->param3, 6, setup_function19); + if (Entity::timeCheckCallback(kTime1165500, params->param3, 6, WRAP_SETUP_FUNCTION(Rebecca, setup_function19))) + break; if (params->param4 != kTimeInvalid) { if (getState()->time <= kTime1161000) { @@ -965,10 +973,16 @@ IMPLEMENT_FUNCTION(26, Rebecca, function26) break; case kActionNone: - TIME_CHECK_CALLBACK_3(kTime1224000, params->param2, 1, setup_updatePosition, "118H", kCarRestaurant, 52); + if (getState()->time > kTime1224000 && !params->param2) { + params->param2 = 1; + setCallback(1); + setup_updatePosition("118H", kCarRestaurant, 52); + break; + } if (params->param1) { - UPDATE_PARAM(params->param3, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90)) + break; getScenes()->loadSceneFromPosition(kCarRestaurant, 51); } @@ -1223,7 +1237,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34) params->param2 = (uint)getState()->time; if (params->param2 >= getState()->time) { - TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19); + Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; } } @@ -1233,7 +1247,7 @@ IMPLEMENT_FUNCTION(34, Rebecca, function34) getSavePoints()->push(kEntityRebecca, kEntityServers0, kAction223712416); } - TIME_CHECK_CALLBACK(kTime2052000, params->param3, 1, setup_function19); + Entity::timeCheckCallback(kTime2052000, params->param3, 1, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; case kActionEndSound: @@ -1632,7 +1646,7 @@ IMPLEMENT_FUNCTION(44, Rebecca, function44) label_callback_2: if (params->param2) - TIME_CHECK_CALLBACK(kTime2443500, params->param5, 3, setup_function19); + Entity::timeCheckCallback(kTime2443500, params->param5, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)); break; case kActionEndSound: @@ -1755,7 +1769,8 @@ IMPLEMENT_FUNCTION(48, Rebecca, function48) case kActionNone: if (params->param1) { - UPDATE_PARAM(params->param3, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75)) + break; params->param1 = 0; params->param2 = 1; diff --git a/engines/lastexpress/entities/rebecca.h b/engines/lastexpress/entities/rebecca.h index e91ee30d4d47..885632f88406 100644 --- a/engines/lastexpress/entities/rebecca.h +++ b/engines/lastexpress/entities/rebecca.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_REBECCA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp index 63d995dc4253..e8b4b4247b43 100644 --- a/engines/lastexpress/entities/salko.cpp +++ b/engines/lastexpress/entities/salko.cpp @@ -33,10 +33,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -137,7 +135,7 @@ IMPLEMENT_FUNCTION_II(7, Salko, function7, CarIndex, EntityPosition) break; case kAction123668192: - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -158,7 +156,7 @@ IMPLEMENT_FUNCTION(9, Salko, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Salko, setup_chapter1Handler)); break; case kActionDefault: @@ -301,7 +299,8 @@ IMPLEMENT_FUNCTION(15, Salko, chapter3Handler) case kActionNone: if (getState()->time < kTime2200500) { - UPDATE_PARAM(params->param1, getState()->time, 81000); + if (!Entity::updateParameter(params->param1, getState()->time, 81000)) + break; setCallback(1); setup_function16(); @@ -331,7 +330,8 @@ IMPLEMENT_FUNCTION(16, Salko, function16) } label_callback3: - UPDATE_PARAM(params->param1, getState()->time, 4500); + if (!Entity::updateParameter(params->param1, getState()->time, 4500)) + break; getSavePoints()->push(kEntitySalko, kEntitySalko, kAction101169464); break; @@ -390,7 +390,7 @@ IMPLEMENT_FUNCTION(16, Salko, function16) getData()->entityPosition = kPosition_2740; getEntities()->clearSequences(kEntitySalko); - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/salko.h b/engines/lastexpress/entities/salko.h index 63082110530e..6ca73e39f6e9 100644 --- a/engines/lastexpress/entities/salko.h +++ b/engines/lastexpress/entities/salko.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_SALKO_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/servers0.cpp b/engines/lastexpress/entities/servers0.cpp index 989bddd662dc..73e0d347226d 100644 --- a/engines/lastexpress/entities/servers0.cpp +++ b/engines/lastexpress/entities/servers0.cpp @@ -28,10 +28,7 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -113,11 +110,11 @@ IMPLEMENT_FUNCTION_NOSETUP(5, Servers0, callbackActionOnDirection) case kActionNone: if (getData()->direction != kDirectionRight) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -163,7 +160,7 @@ IMPLEMENT_FUNCTION(7, Servers0, function7) case 2: getEntities()->clearSequences(kEntityServers0); getData()->entityPosition = kPosition_5900; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -220,7 +217,7 @@ IMPLEMENT_FUNCTION(9, Servers0, function9) ENTITY_PARAM(2, 2) = 0; ENTITY_PARAM(1, 6) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -315,17 +312,17 @@ IMPLEMENT_FUNCTION(20, Servers0, chapter1Handler) case kActionNone: if (params->param2) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 2700); + if (Entity::updateParameter(params->param3, getState()->time, 2700)) { ENTITY_PARAM(0, 4) = 1; params->param2 = 0; - UPDATE_PARAM_PROC_END + } } if (params->param1) { - UPDATE_PARAM_PROC(params->param4, getState()->time, 4500) + if (Entity::updateParameter(params->param4, getState()->time, 4500)) { ENTITY_PARAM(0, 5) = 1; params->param1 = 0; - UPDATE_PARAM_PROC_END + } } if (!getEntities()->isInKitchen(kEntityServers0) && !getEntities()->isSomebodyInsideRestaurantOrSalon()) @@ -486,7 +483,7 @@ IMPLEMENT_FUNCTION(25, Servers0, function25) getEntities()->clearSequences(kEntityServers0); ENTITY_PARAM(1, 3) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -647,7 +644,7 @@ IMPLEMENT_FUNCTION(29, Servers0, augustAnnaDateOrder) getEntities()->clearSequences(kEntityServers0); ENTITY_PARAM(1, 5) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -693,7 +690,7 @@ IMPLEMENT_FUNCTION(30, Servers0, function30) getEntities()->clearSequences(kEntityServers0); ENTITY_PARAM(2, 4) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -736,10 +733,10 @@ IMPLEMENT_FUNCTION(32, Servers0, chapter4Handler) break; case kActionNone: - UPDATE_PARAM_PROC(params->param2, getState()->time, 3600) + if (Entity::updateParameter(params->param2, getState()->time, 3600)) { ENTITY_PARAM(1, 8) = 1; params->param1 = 0; - UPDATE_PARAM_PROC_END + } if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon()) break; @@ -859,7 +856,7 @@ IMPLEMENT_FUNCTION(33, Servers0, augustOrderSteak) getEntities()->clearSequences(kEntityServers0); ENTITY_PARAM(1, 7) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -902,7 +899,7 @@ IMPLEMENT_FUNCTION(34, Servers0, augustServeDuck) getEntities()->clearSequences(kEntityServers0); ENTITY_PARAM(1, 8) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -972,7 +969,7 @@ void Servers0::handleServer(const SavePoint &savepoint, const char *name, Entity getSavePoints()->push(kEntityServers0, entity, action); *parameter = 0; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -1027,7 +1024,7 @@ void Servers0::serveTable(const SavePoint &savepoint, const char *seq1, EntityIn getEntities()->clearSequences(kEntityServers0); *parameter = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/servers0.h b/engines/lastexpress/entities/servers0.h index 2e9165a410e5..4c35637d6505 100644 --- a/engines/lastexpress/entities/servers0.h +++ b/engines/lastexpress/entities/servers0.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_SERVERS0_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/servers1.cpp b/engines/lastexpress/entities/servers1.cpp index 995fbbc01be7..a8f4c0233c83 100644 --- a/engines/lastexpress/entities/servers1.cpp +++ b/engines/lastexpress/entities/servers1.cpp @@ -28,10 +28,7 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -143,7 +140,7 @@ IMPLEMENT_FUNCTION(7, Servers1, function7) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(1, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -219,7 +216,7 @@ IMPLEMENT_FUNCTION(9, Servers1, function9) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 1) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -265,7 +262,7 @@ IMPLEMENT_FUNCTION(10, Servers1, function10) getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 2) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -469,7 +466,7 @@ IMPLEMENT_FUNCTION(20, Servers1, function20) getEntities()->drawSequenceLeft(kEntityServers1, "BLANK"); ENTITY_PARAM(0, 7) = 0; - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -566,10 +563,10 @@ IMPLEMENT_FUNCTION(26, Servers1, chapter4Handler) case kActionNone: if (params->param2) { - UPDATE_PARAM_PROC(params->param2, getState()->time, 900) + if (Entity::updateParameter(params->param2, getState()->time, 900)) { ENTITY_PARAM(1, 5) = 1; params->param1 = 0; - UPDATE_PARAM_PROC_END + } } if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon()) @@ -705,7 +702,7 @@ void Servers1::serveTable(const SavePoint &savepoint, const char *seq1, EntityIn if (parameter2 != NULL) *parameter2 = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -775,7 +772,7 @@ void Servers1::serveSalon(const SavePoint &savepoint, const char *seq1, const ch getData()->entityPosition = kPosition_5900; *parameter = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/servers1.h b/engines/lastexpress/entities/servers1.h index 13b30696f091..c8f667ec5c4d 100644 --- a/engines/lastexpress/entities/servers1.h +++ b/engines/lastexpress/entities/servers1.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_SERVERS1_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/sophie.cpp b/engines/lastexpress/entities/sophie.cpp index 57bd491949ea..170090005f14 100644 --- a/engines/lastexpress/entities/sophie.cpp +++ b/engines/lastexpress/entities/sophie.cpp @@ -27,38 +27,10 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { -#define CHAPTER_IMPLEMENTATION() \ - switch (savepoint.action) { \ - default: \ - break; \ - case kActionNone: \ - setup_chaptersHandler(); \ - break; \ - case kActionDefault: \ - getEntities()->clearSequences(kEntitySophie); \ - getData()->entityPosition = kPosition_4840; \ - getData()->location = kLocationInsideCompartment; \ - getData()->car = kCarRedSleeping; \ - getData()->clothes = kClothesDefault; \ - getData()->inventoryItem = kItemNone; \ - break; \ - } - -#define DEFAULT_ACTION_IMPLEMENTATION() \ - if (savepoint.action == kActionDefault) { \ - getData()->entityPosition = kPosition_4840; \ - getData()->location = kLocationInsideCompartment; \ - getData()->car = kCarRedSleeping; \ - getEntities()->clearSequences(kEntitySophie); \ - } - Sophie::Sophie(LastExpressEngine *engine) : Entity(engine, kEntitySophie) { ADD_CALLBACK_FUNCTION(Sophie, reset); ADD_CALLBACK_FUNCTION(Sophie, updateEntity); @@ -123,7 +95,7 @@ IMPLEMENT_FUNCTION_II(2, Sophie, updateEntity, CarIndex, EntityPosition) break; case kAction123668192: - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -207,7 +179,7 @@ IMPLEMENT_FUNCTION(4, Sophie, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chaptersHandler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Sophie, setup_chaptersHandler)); break; case kActionDefault: @@ -220,27 +192,27 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(5, Sophie, function5) - DEFAULT_ACTION_IMPLEMENTATION() + handleAction(savepoint); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(6, Sophie, chapter2) - CHAPTER_IMPLEMENTATION() + handleChapter(savepoint); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(7, Sophie, chapter3) - CHAPTER_IMPLEMENTATION() + handleChapter(savepoint); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(8, Sophie, chapter4) - CHAPTER_IMPLEMENTATION() + handleChapter(savepoint); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(9, Sophie, function9) - DEFAULT_ACTION_IMPLEMENTATION() + handleAction(savepoint); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -274,4 +246,37 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_NULL_FUNCTION(12, Sophie) +////////////////////////////////////////////////////////////////////////// +// Helpers functions +////////////////////////////////////////////////////////////////////////// + +void Sophie::handleAction(const SavePoint &savepoint) { + if (savepoint.action == kActionDefault) { + getData()->entityPosition = kPosition_4840; + getData()->location = kLocationInsideCompartment; + getData()->car = kCarRedSleeping; + getEntities()->clearSequences(kEntitySophie); + } +} + +void Sophie::handleChapter(const SavePoint &savepoint) { + switch (savepoint.action) { + default: + break; + + case kActionNone: + setup_chaptersHandler(); + break; + + case kActionDefault: + getEntities()->clearSequences(kEntitySophie); + getData()->entityPosition = kPosition_4840; + getData()->location = kLocationInsideCompartment; + getData()->car = kCarRedSleeping; + getData()->clothes = kClothesDefault; + getData()->inventoryItem = kItemNone; + break; + } +} + } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/sophie.h b/engines/lastexpress/entities/sophie.h index c2ca348027fc..188788bb9be5 100644 --- a/engines/lastexpress/entities/sophie.h +++ b/engines/lastexpress/entities/sophie.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_SOPHIE_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { @@ -88,6 +87,10 @@ class Sophie : public Entity { DECLARE_FUNCTION(chapter5Handler) DECLARE_NULL_FUNCTION() + +private: + void handleAction(const SavePoint &savepoint); + void handleChapter(const SavePoint &savepoint); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/tables.cpp b/engines/lastexpress/entities/tables.cpp index 06ea4c597c22..4f8d2b954dbb 100644 --- a/engines/lastexpress/entities/tables.cpp +++ b/engines/lastexpress/entities/tables.cpp @@ -29,10 +29,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/tables.h b/engines/lastexpress/entities/tables.h index 7fcfc0499e6d..c213aac978b5 100644 --- a/engines/lastexpress/entities/tables.h +++ b/engines/lastexpress/entities/tables.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_TABLES_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp index c8901b3e3053..432def6253c8 100644 --- a/engines/lastexpress/entities/tatiana.cpp +++ b/engines/lastexpress/entities/tatiana.cpp @@ -35,10 +35,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -192,7 +190,7 @@ IMPLEMENT_FUNCTION(14, Tatiana, function14) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityTatiana); - CALLBACK_ACTION(); + callbackAction(); } break; @@ -228,7 +226,7 @@ IMPLEMENT_FUNCTION(15, Tatiana, function15) getEntities()->exitCompartment(kEntityTatiana, kObjectCompartmentB, true); getObjects()->update(kObjectCompartmentB, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -246,12 +244,13 @@ IMPLEMENT_FUNCTION_I(16, Tatiana, function16, uint32) getObjects()->update(kObjectCompartmentB, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); getObjects()->update(kObject49, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param2) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; params->param2 = 0; params->param3 = 1; @@ -342,7 +341,7 @@ IMPLEMENT_FUNCTION(17, Tatiana, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Tatiana, setup_chapter1Handler)); break; case kActionDefault: @@ -375,10 +374,10 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18) } if (!params->param1) { - UPDATE_PARAM_PROC(params->param3, getState()->time, 4500) + if (Entity::updateParameter(params->param3, getState()->time, 4500)) { getEntities()->drawSequenceRight(kEntityTatiana, "806DS"); params->param1 = 1; - UPDATE_PARAM_PROC_END + } } } @@ -386,14 +385,14 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18) getSavePoints()->push(kEntityTatiana, kEntityAlexei, kAction157159392); getEntities()->clearSequences(kEntityTatiana); - CALLBACK_ACTION(); + callbackAction(); } break; case kActionExitCompartment: getSavePoints()->push(kEntityTatiana, kEntityAlexei, kAction188784532); - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -425,27 +424,29 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler) if (getSoundQueue()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSoundQueue()->isBuffered("TAT1066")) goto label_tatiana_chapter1_2; - UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 450) + if (Entity::updateParameter(params->param5, getState()->timeTicks, 450)) { getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A"); getProgress().field_64 = 1; params->param3++; params->param5 = 0; - UPDATE_PARAM_PROC_END + } if (getEntities()->isPlayerPosition(kCarRestaurant, 71)) { - UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75) + if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) { getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A"); getProgress().field_64 = 1; params->param3++; params->param6 = 0; - UPDATE_PARAM_PROC_END + } } label_tatiana_chapter1_2: - TIME_CHECK_SAVEPOINT(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762); + Entity::timeCheckSavepoint(kTime1084500, params->param7, kEntityTatiana, kEntityPascale, kAction257489762); if (params->param1) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 90); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 90)) + break; + getScenes()->loadSceneFromPosition(kCarRestaurant, 65); } else { params->param8 = 0; @@ -614,7 +615,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, function22) if (params->param1 == kTimeInvalid || getState()->time <= kTime1179000) goto label_update; - UPDATE_PARAM_PROC_TIME(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0) + if (Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) { label_update: if (!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch) @@ -623,7 +624,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, function22) getObjects()->update(kObject25, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward); getObjects()->update(kObjectTrainTimeTable, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward); } - UPDATE_PARAM_PROC_END + } params->param1 = kTimeInvalid; @@ -1022,7 +1023,7 @@ IMPLEMENT_FUNCTION(32, Tatiana, chapter3Handler) } if (parameters->param4 && parameters->param5) { - UPDATE_PARAM_CHECK(parameters->param4, getState()->time, 6300) + if (Entity::updateParameterCheck(parameters->param4, getState()->time, 6300)) { if (getEntities()->isSomebodyInsideRestaurantOrSalon()) { getData()->location = kLocationOutsideCompartment; @@ -1283,18 +1284,19 @@ IMPLEMENT_FUNCTION(37, Tatiana, function37) params->param3 = (uint)getState()->time + 900; if (params->param4 != kTimeInvalid && params->param3 < getState()->time) { - UPDATE_PARAM_PROC_TIME(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450) + if (Entity::updateParameterTime(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)) { getProgress().field_5C = 1; if (getEntities()->isInsideCompartment(kEntityAnna, kCarRedSleeping, kPosition_4070)) { setup_function38(); break; } - UPDATE_PARAM_PROC_END + } } } if (params->param1) { - UPDATE_PARAM(params->param5, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param5, getState()->timeTicks, 75)) + break; getObjects()->update(kObjectCompartmentB, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject49, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorNormal); @@ -1403,7 +1405,8 @@ IMPLEMENT_FUNCTION(38, Tatiana, function38) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 450); + if (!Entity::updateParameter(params->param1, getState()->time, 450)) + break; getEntities()->exitCompartment(kEntityTatiana, kObjectCompartmentF, true); @@ -1535,7 +1538,7 @@ IMPLEMENT_FUNCTION(40, Tatiana, function40) if (getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos) || getData()->car != getEntityData(kEntityPlayer)->car || getEntities()->updateEntity(kEntityTatiana, kCarKronos, kPosition_9270)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMe: @@ -1547,7 +1550,7 @@ IMPLEMENT_FUNCTION(40, Tatiana, function40) case kActionDefault: if (getEntities()->updateEntity(kEntityTatiana, kCarKronos, kPosition_9270)) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -1595,7 +1598,7 @@ IMPLEMENT_FUNCTION(41, Tatiana, function41) } getEntities()->clearSequences(kEntityTatiana); - CALLBACK_ACTION(); + callbackAction(); } break; @@ -1629,7 +1632,7 @@ IMPLEMENT_FUNCTION(41, Tatiana, function41) case 6: getEntities()->clearSequences(kEntityTatiana); - CALLBACK_ACTION(); + callbackAction(); break; case 4: @@ -1952,7 +1955,8 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48) if (!params->param1 || getSoundQueue()->isBuffered(kEntityTatiana)) goto label_end; - UPDATE_PARAM_GOTO(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30), label_end); + if (!Entity::updateParameter(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30))) + goto label_end; getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault); params->param2 = 0; @@ -2199,7 +2203,8 @@ IMPLEMENT_FUNCTION(54, Tatiana, function54) } if (params->param1 > 3) { - UPDATE_PARAM(params->param3, getState()->timeTicks, 225); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, 225)) + break; params->param1 = 0; params->param3 = 0; diff --git a/engines/lastexpress/entities/tatiana.h b/engines/lastexpress/entities/tatiana.h index c457d49b1e58..8ec69db5e900 100644 --- a/engines/lastexpress/entities/tatiana.h +++ b/engines/lastexpress/entities/tatiana.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_TATIANA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp index bced1da62b86..e3f530ef2585 100644 --- a/engines/lastexpress/entities/train.cpp +++ b/engines/lastexpress/entities/train.cpp @@ -32,10 +32,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -269,18 +267,20 @@ IMPLEMENT_FUNCTION(8, Train, process) if ((getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping)) && params->param4 && !params->param5) { - params->param4 -= 1; + params->param4 -= 1; - if (!params->param4 && getProgress().jacket == kJacketGreen) { + if (!params->param4 && getProgress().jacket == kJacketGreen) { - getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay); - params->param5 = 1; - getScenes()->processScene(); - } + getAction()->playAnimation(isNight() ? kEventCathSmokeNight : kEventCathSmokeDay); + params->param5 = 1; + getScenes()->processScene(); + } } if (params->param6) { - UPDATE_PARAM_GOTO(params1->param7, getState()->time, 900, label_process); + if (!Entity::updateParameter(params1->param7, getState()->time, 900)) + goto label_process; + getScenes()->loadSceneFromPosition(kCarRestaurant, 58); } @@ -552,7 +552,7 @@ void Train::handleCompartmentAction() { ENTITY_PARAM(0, 8) = params->param1; - CALLBACK_ACTION(); + callbackAction(); } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/lastexpress/entities/train.h b/engines/lastexpress/entities/train.h index ea9e1d7a073f..4b8bc10c1ada 100644 --- a/engines/lastexpress/entities/train.h +++ b/engines/lastexpress/entities/train.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_TRAIN_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp index 22f41afa92bd..4695f8831fdf 100644 --- a/engines/lastexpress/entities/vassili.cpp +++ b/engines/lastexpress/entities/vassili.cpp @@ -35,10 +35,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -85,7 +83,7 @@ IMPLEMENT_FUNCTION(4, Vassili, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vassili, setup_chapter1Handler)); break; case kActionDefault: @@ -146,7 +144,8 @@ IMPLEMENT_FUNCTION(6, Vassili, function6) case kActionNone: if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) { - UPDATE_PARAM_GOTO(params->param3, getState()->timeTicks, params->param1, label_function7); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1)) + goto label_function7; setCallback(1); setup_draw("303B"); @@ -402,7 +401,8 @@ IMPLEMENT_FUNCTION(13, Vassili, sleeping) case kActionNone: if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) { - UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1)) + break; setCallback(1); setup_draw("303B"); @@ -461,7 +461,8 @@ IMPLEMENT_FUNCTION(15, Vassili, stealEgg) case kActionNone: if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) { - UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1)) + break; setCallback(1); setup_draw("303B"); @@ -545,7 +546,8 @@ IMPLEMENT_FUNCTION(17, Vassili, chapter4Handler) case kActionNone: if (getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_8200)) { - UPDATE_PARAM(params->param3, getState()->timeTicks, params->param1); + if (!Entity::updateParameter(params->param3, getState()->timeTicks, params->param1)) + break; setCallback(1); setup_draw("303B"); diff --git a/engines/lastexpress/entities/vassili.h b/engines/lastexpress/entities/vassili.h index 843a0651741f..d006770f7b63 100644 --- a/engines/lastexpress/entities/vassili.h +++ b/engines/lastexpress/entities/vassili.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_VASSILI_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp index 8246f851458b..867f122d8fe9 100644 --- a/engines/lastexpress/entities/verges.cpp +++ b/engines/lastexpress/entities/verges.cpp @@ -32,10 +32,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -102,11 +100,11 @@ IMPLEMENT_FUNCTION(3, Verges, callbackActionOnDirection) case kActionNone: if (getData()->direction != kDirectionRight) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExitCompartment: - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: @@ -219,7 +217,7 @@ switch (savepoint.action) { break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -241,12 +239,13 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition) } if (getEntities()->updateEntity(kEntityVerges, (CarIndex)params->param1, (EntityPosition)params->param2)) { - CALLBACK_ACTION(); + callbackAction(); break; } if (params->param6) { - UPDATE_PARAM(params->param8, getState()->timeTicks, 75); + if (!Entity::updateParameter(params->param8, getState()->timeTicks, 75)) + break; getSound()->playSound(kEntityVerges, (char *)¶ms->seq); @@ -266,7 +265,7 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition) } if (getEntities()->updateEntity(kEntityVerges, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -337,7 +336,7 @@ IMPLEMENT_FUNCTION(11, Verges, function11) getObjects()->update(kObject104, kEntityVerges, kObjectLocationNone, kCursorNormal, kCursorHand); getObjects()->update(kObject105, kEntityVerges, kObjectLocationNone, kCursorNormal, kCursorHand); - CALLBACK_ACTION(); + callbackAction(); break; } } @@ -397,7 +396,7 @@ IMPLEMENT_FUNCTION(12, Verges, function12) getData()->entityPosition = kPosition_850; getEntities()->clearSequences(kEntityVerges); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -438,7 +437,7 @@ IMPLEMENT_FUNCTION_I(13, Verges, function13, bool) getEntities()->clearSequences(kEntityVerges); getScenes()->loadSceneFromPosition(kCarBaggage, 91); - CALLBACK_ACTION(); + callbackAction(); } break; } @@ -462,7 +461,7 @@ IMPLEMENT_FUNCTION_IS(15, Verges, function15, EntityIndex) if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2) && !getEntities()->isPlayerPosition(kCarRedSleeping, 2)) getData()->entityPosition = kPosition_2088; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -499,7 +498,7 @@ IMPLEMENT_FUNCTION_ISS(16, Verges, function16, EntityIndex) if (!getEntities()->isPlayerPosition(kCarGreenSleeping, 2) && !getEntities()->isPlayerPosition(kCarRedSleeping, 2)) getData()->entityPosition = kPosition_2088; - CALLBACK_ACTION(); + callbackAction(); } break; @@ -559,7 +558,7 @@ IMPLEMENT_FUNCTION(17, Verges, function17) case 4: ENTITY_PARAM(0, 3) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -573,7 +572,7 @@ IMPLEMENT_FUNCTION(18, Verges, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Verges, setup_chapter1Handler)); break; case kActionDefault: @@ -651,7 +650,7 @@ IMPLEMENT_FUNCTION(22, Verges, function22) break; case 5: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -697,7 +696,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain) break; case kActionEndSound: - CALLBACK_ACTION(); + callbackAction(); break; case kActionDefault: @@ -818,7 +817,7 @@ IMPLEMENT_FUNCTION(25, Verges, function25) case 11: ENTITY_PARAM(0, 7) = 0; - CALLBACK_ACTION(); + callbackAction(); break; case 6: @@ -908,10 +907,12 @@ IMPLEMENT_FUNCTION(26, Verges, chapter1Handler) if (params->param6) goto label_callback12; - TIME_CHECK_CALLBACK_1(kTimeChapter1, params->param7, 4, setup_function9, "TRA1001"); + if (Entity::timeCheckCallback(kTimeChapter1, params->param7, 4, "TRA1001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback4: - TIME_CHECK_CALLBACK(kTime1089000, params->param8, 5, setup_function12); + if (Entity::timeCheckCallback(kTime1089000, params->param8, 5, WRAP_SETUP_FUNCTION(Verges, setup_function12))) + break; params->param8 = 1; @@ -922,16 +923,20 @@ IMPLEMENT_FUNCTION(26, Verges, chapter1Handler) } label_callback8: - TIME_CHECK_CALLBACK_1(kTime1107000, CURRENT_PARAM(1, 1), 9, setup_function9, "TRA1001A"); + if (Entity::timeCheckCallback(kTime1107000, CURRENT_PARAM(1, 1), 9, "TRA1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback9: - TIME_CHECK_CALLBACK_1(kTime1134000, CURRENT_PARAM(1, 2), 10, setup_function9, "TRA1002"); + if (Entity::timeCheckCallback(kTime1134000, CURRENT_PARAM(1, 2), 10, "TRA1002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback10: - TIME_CHECK_CALLBACK_1(kTime1165500, CURRENT_PARAM(1, 3), 11, setup_function9, "TRA1003"); + if (Entity::timeCheckCallback(kTime1165500, CURRENT_PARAM(1, 3), 11, "TRA1003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback11: - TIME_CHECK_CALLBACK_1(kTime1225800, CURRENT_PARAM(1, 4), 12, setup_function9, "TRA1004"); + if (Entity::timeCheckCallback(kTime1225800, CURRENT_PARAM(1, 4), 12, "TRA1004", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback12: if (ENTITY_PARAM(0, 5) && !params->param2) { @@ -1083,7 +1088,8 @@ IMPLEMENT_FUNCTION(28, Verges, chapter2Handler) } label_callback_1: - TIME_CHECK_CALLBACK_1(kTime1818900, params->param1, 2, setup_function9, "Tra2177"); + if (Entity::timeCheckCallback(kTime1818900, params->param1, 2, "Tra2177", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_2: if (params->param2 == kTimeInvalid || !getState()->time) @@ -1224,7 +1230,7 @@ IMPLEMENT_FUNCTION_S(30, Verges, function30) break; case 4: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1266,7 +1272,7 @@ IMPLEMENT_FUNCTION(31, Verges, function31) getProgress().field_48 = 1; ENTITY_PARAM(0, 4) = 0; - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1280,7 +1286,12 @@ IMPLEMENT_FUNCTION(32, Verges, function32) break; case kActionNone: - TIME_CHECK_CALLBACK_3(kTime2263500, params->param1, 5, setup_function10, kCarRedSleeping, kPosition_9460, "TRA3006"); + if (getState()->time > kTime2263500 && !params->param1) { + params->param1 = 1; + setCallback(5); + setup_function10(kCarRedSleeping, kPosition_9460, "TRA3006"); + break; + } break; case kActionDefault: @@ -1343,7 +1354,7 @@ IMPLEMENT_FUNCTION(32, Verges, function32) break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1440,25 +1451,31 @@ IMPLEMENT_FUNCTION(34, Verges, function34) } label_callback_3: - TIME_CHECK_CALLBACK_1(kTime1971000, params->param1, 4, setup_function9, "Tra3001"); + if (Entity::timeCheckCallback(kTime1971000, params->param1, 4, "Tra3001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_4: - TIME_CHECK_CALLBACK_1(kTime1998000, params->param2, 5, setup_function9, "Tra3010a"); + if (Entity::timeCheckCallback(kTime1998000, params->param2, 5, "Tra3010a", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_5: - TIME_CHECK_CALLBACK(kTime2016000, params->param3, 6, setup_function35); + if (Entity::timeCheckCallback(kTime2016000, params->param3, 6, WRAP_SETUP_FUNCTION(Verges, setup_function35))) + break; label_callback_6: - TIME_CHECK_CALLBACK_1(kTime2070000, params->param4, 7, setup_function9, "Tra3002"); + if (Entity::timeCheckCallback(kTime2070000, params->param4, 7, "Tra3002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_7: - TIME_CHECK_CALLBACK_1(kTime2142000, params->param5, 8, setup_function9, "Tra3003"); + if (Entity::timeCheckCallback(kTime2142000, params->param5, 8, "Tra3003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_8: - TIME_CHECK_CALLBACK_1(kTime2173500, params->param6, 9, setup_function30, "Tra3012"); + if (Entity::timeCheckCallback(kTime2173500, params->param6, 9, "Tra3012", WRAP_SETUP_FUNCTION_S(Verges, setup_function30))) + break; label_callback_9: - TIME_CHECK_CALLBACK(kTime2218500, params->param7, 10, setup_function32); + Entity::timeCheckCallback(kTime2218500, params->param7, 10, WRAP_SETUP_FUNCTION(Verges, setup_function32)); break; case kActionOpenDoor: @@ -1548,7 +1565,7 @@ IMPLEMENT_FUNCTION(35, Verges, function35) break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1605,27 +1622,32 @@ IMPLEMENT_FUNCTION(37, Verges, chapter4Handler) } label_callback_2: - TIME_CHECK_CALLBACK_1(kTime2349000, params->param1, 3, setup_function9, "Tra1001"); + if (Entity::timeCheckCallback(kTime2349000, params->param1, 3, "Tra1001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_3: - TIME_CHECK_CALLBACK_1(kTime2378700, params->param2, 4, setup_function9, "Tra4001"); + if (Entity::timeCheckCallback(kTime2378700, params->param2, 4, "Tra4001", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_4: - TIME_CHECK_CALLBACK_1(kTime2403000, params->param3, 5, setup_function9, "Tra1001A"); + if (Entity::timeCheckCallback(kTime2403000, params->param3, 5, "Tra1001A", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_5: - TIME_CHECK_CALLBACK_1(kTime2414700, params->param4, 6, setup_function9, "Tra4002"); + if (Entity::timeCheckCallback(kTime2414700, params->param4, 6, "Tra4002", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_6: - TIME_CHECK_CALLBACK_1(kTime2484000, params->param5, 7, setup_function9, "Tra4003"); + if (Entity::timeCheckCallback(kTime2484000, params->param5, 7, "Tra4003", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; label_callback_7: - TIME_CHECK_CALLBACK_1(kTime2511000, params->param6, 8, setup_function9, "Tra4004"); + if (Entity::timeCheckCallback(kTime2511000, params->param6, 8, "Tra4004", WRAP_SETUP_FUNCTION_S(Verges, setup_function9))) + break; } label_callback_8: - TIME_CHECK_CALLBACK_1(kTime2538000, params->param7, 9, setup_function9, "Tra4005"); - + Entity::timeCheckCallback(kTime2538000, params->param7, 9, "Tra4005", WRAP_SETUP_FUNCTION_S(Verges, setup_function9)); break; case kActionOpenDoor: @@ -1887,7 +1909,7 @@ void Verges::talk(const SavePoint &savepoint, const char *sound1, const char *so break; case 6: - CALLBACK_ACTION(); + callbackAction(); break; } break; diff --git a/engines/lastexpress/entities/verges.h b/engines/lastexpress/entities/verges.h index 17a3c8ac4014..82381043d39a 100644 --- a/engines/lastexpress/entities/verges.h +++ b/engines/lastexpress/entities/verges.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_VERGES_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp index 7a1f1d3195c2..f29bce8b2b7d 100644 --- a/engines/lastexpress/entities/vesna.cpp +++ b/engines/lastexpress/entities/vesna.cpp @@ -32,10 +32,7 @@ #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" - #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -134,7 +131,7 @@ IMPLEMENT_FUNCTION_II(7, Vesna, updateEntity2, CarIndex, EntityPosition) break; case kAction123668192: - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -165,7 +162,8 @@ IMPLEMENT_FUNCTION(11, Vesna, function11) case kActionNone: if (parameters->param3) { - UPDATE_PARAM(parameters->param7, getState()->timeTicks, 75); + if (!Entity::updateParameter(parameters->param7, getState()->timeTicks, 75)) + break; parameters->param2 = 1; parameters->param3 = 0; @@ -245,7 +243,7 @@ IMPLEMENT_FUNCTION(11, Vesna, function11) case kAction55996766: case kAction101687594: - CALLBACK_ACTION(); + callbackAction(); break; } IMPLEMENT_FUNCTION_END @@ -257,7 +255,7 @@ IMPLEMENT_FUNCTION(12, Vesna, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Vesna, setup_chapter1Handler)); break; case kActionDefault: @@ -458,7 +456,7 @@ IMPLEMENT_FUNCTION(18, Vesna, function18) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityVesna); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -514,7 +512,8 @@ IMPLEMENT_FUNCTION(20, Vesna, chapter3Handler) } if (parameters->param2) { - UPDATE_PARAM(parameters->param8, getState()->timeTicks, 75); + if (!Entity::updateParameter(parameters->param8, getState()->timeTicks, 75)) + break; parameters->param1 = 1; parameters->param2 = 0; @@ -711,7 +710,7 @@ IMPLEMENT_FUNCTION(21, Vesna, function21) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityVesna); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -1083,13 +1082,14 @@ IMPLEMENT_FUNCTION(30, Vesna, function30) case kActionNone: if (!params->param1) { - UPDATE_PARAM_PROC(params->param3, getState()->timeTicks, 120) + if (Entity::updateParameter(params->param3, getState()->timeTicks, 120)) { getSound()->playSound(kEntityVesna, "Ves50001", kFlagDefault); params->param1 = 1; - UPDATE_PARAM_PROC_END + } } - UPDATE_PARAM(params->param4, getState()->timeTicks, 180); + if (!Entity::updateParameter(params->param4, getState()->timeTicks, 180)) + break; setCallback(1); setup_savegame(kSavegameTypeEvent, kEventCathVesnaTrainTopKilled); diff --git a/engines/lastexpress/entities/vesna.h b/engines/lastexpress/entities/vesna.h index a09664096d9c..025d45882e5c 100644 --- a/engines/lastexpress/entities/vesna.h +++ b/engines/lastexpress/entities/vesna.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_VESNA_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp index 45e5e115687c..1d280f51e064 100644 --- a/engines/lastexpress/entities/yasmin.cpp +++ b/engines/lastexpress/entities/yasmin.cpp @@ -28,10 +28,8 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" namespace LastExpress { @@ -132,7 +130,7 @@ IMPLEMENT_FUNCTION(6, Yasmin, function6) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityYasmin); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -172,7 +170,7 @@ IMPLEMENT_FUNCTION(7, Yasmin, function7) getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityYasmin); - CALLBACK_ACTION(); + callbackAction(); break; } break; @@ -186,7 +184,7 @@ IMPLEMENT_FUNCTION(8, Yasmin, chapter1) break; case kActionNone: - TIME_CHECK(kTimeChapter1, params->param1, setup_chapter1Handler); + Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Yasmin, setup_chapter1Handler)); break; case kActionDefault: @@ -204,12 +202,22 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1093500, params->param1, 1, setup_function6); - TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7); - TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070); - TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104"); - TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106"); - TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6); + if (Entity::timeCheckCallback(kTime1093500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6))) + break; + + if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + + if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070)) + break; + + if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound))) + break; + + if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound))) + break; + + Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -224,23 +232,27 @@ IMPLEMENT_FUNCTION(9, Yasmin, chapter1Handler) break; case 2: - TIME_CHECK_CALLBACK(kTime1161000, params->param2, 3, setup_function7); + if (Entity::timeCheckCallback(kTime1161000, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; // Fallback to case 3 case 3: - TIME_CHECK_PLAYSOUND_UPDATEPOSITION(kTime1162800, params->param3, 4, "Har1102", kPosition_4070); + if (Entity::timeCheckPlaySoundUpdatePosition(kTime1162800, params->param3, 4, "Har1102", kPosition_4070)) + break; // Fallback to case 4 case 4: - TIME_CHECK_CALLBACK_1(kTime1165500, params->param4, 5, setup_playSound, "Har1104"); + if (Entity::timeCheckCallback(kTime1165500, params->param4, 5, "Har1104", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound))) + break; // Fallback to case 5 case 5: - TIME_CHECK_CALLBACK_1(kTime1174500, params->param5, 6, setup_playSound, "Har1106"); + if (Entity::timeCheckCallback(kTime1174500, params->param5, 6, "Har1106", WRAP_SETUP_FUNCTION_S(Yasmin, setup_playSound))) + break; // Fallback to case 6 case 6: - TIME_CHECK_CALLBACK(kTime1183500, params->param6, 7, setup_function6); + Entity::timeCheckCallback(kTime1183500, params->param6, 7, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; @@ -281,7 +293,8 @@ IMPLEMENT_FUNCTION(12, Yasmin, chapter2Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime1759500, params->param1, 1, setup_function7); + if (Entity::timeCheckCallback(kTime1759500, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; if (getState()->time > kTime1800000 && !params->param2) { params->param2 = 1; @@ -334,9 +347,13 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2062800, params->param1, 1, setup_function6); - TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7); - TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6); + if (Entity::timeCheckCallback(kTime2062800, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function6))) + break; + + if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + + Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -345,11 +362,12 @@ IMPLEMENT_FUNCTION(14, Yasmin, chapter3Handler) break; case 1: - TIME_CHECK_CALLBACK(kTime2106000, params->param2, 2, setup_function7); + if (Entity::timeCheckCallback(kTime2106000, params->param2, 2, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; // Fallback to case 2 case 2: - TIME_CHECK_CALLBACK(kTime2160000, params->param3, 3, setup_function6); + Entity::timeCheckCallback(kTime2160000, params->param3, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; @@ -381,8 +399,10 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler) break; case kActionNone: - TIME_CHECK_CALLBACK(kTime2457000, params->param1, 1, setup_function7); - TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6); + if (Entity::timeCheckCallback(kTime2457000, params->param1, 1, WRAP_SETUP_FUNCTION(Yasmin, setup_function7))) + break; + + Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; case kActionCallback: @@ -397,7 +417,7 @@ IMPLEMENT_FUNCTION(16, Yasmin, chapter4Handler) break; case 2: - TIME_CHECK_CALLBACK(kTime2479500, params->param2, 3, setup_function6); + Entity::timeCheckCallback(kTime2479500, params->param2, 3, WRAP_SETUP_FUNCTION(Yasmin, setup_function6)); break; } break; @@ -445,7 +465,9 @@ IMPLEMENT_FUNCTION(20, Yasmin, function20) break; case kActionNone: - UPDATE_PARAM(params->param1, getState()->time, 2700); + if (!Entity::updateParameter(params->param1, getState()->time, 2700)) + break; + setup_function21(); break; @@ -472,7 +494,7 @@ IMPLEMENT_FUNCTION(21, Yasmin, function21) case kActionNone: case kActionDefault: if (getEntities()->updateEntity(kEntityYasmin, (CarIndex)params->param1, (EntityPosition)params->param2)) - CALLBACK_ACTION(); + callbackAction(); break; case kActionExcuseMeCath: diff --git a/engines/lastexpress/entities/yasmin.h b/engines/lastexpress/entities/yasmin.h index e943a8b15834..b1413f5c2fc0 100644 --- a/engines/lastexpress/entities/yasmin.h +++ b/engines/lastexpress/entities/yasmin.h @@ -24,7 +24,6 @@ #define LASTEXPRESS_YASMIN_H #include "lastexpress/entities/entity.h" -#include "lastexpress/entities/entity_intern.h" namespace LastExpress { diff --git a/engines/lastexpress/fight/fight.cpp b/engines/lastexpress/fight/fight.cpp index b832d46a60ba..b00c1732e7c5 100644 --- a/engines/lastexpress/fight/fight.cpp +++ b/engines/lastexpress/fight/fight.cpp @@ -31,6 +31,7 @@ #include "lastexpress/data/cursor.h" #include "lastexpress/data/sequence.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" @@ -38,6 +39,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" #include "lastexpress/helpers.h" @@ -53,6 +55,8 @@ Fight::FightData::FightData() { index = 0; isFightRunning = false; + + memset(&sequences, 0, sizeof(sequences)); } Fight::FightData::~FightData() { @@ -399,6 +403,9 @@ void Fight::loadData(FightType type) { } void Fight::setOpponents() { + if (!_data) + error("[Fight::setOpponents] Data not initialized"); + _data->player->setOpponent(_data->opponent); _data->opponent->setOpponent(_data->player); diff --git a/engines/lastexpress/fight/fighter.cpp b/engines/lastexpress/fight/fighter.cpp index bae7728a2b4d..4b1cddabd459 100644 --- a/engines/lastexpress/fight/fighter.cpp +++ b/engines/lastexpress/fight/fighter.cpp @@ -53,20 +53,20 @@ Fighter::Fighter(LastExpressEngine *engine) : _engine(engine) { } Fighter::~Fighter() { - clearSequences(); -} - -////////////////////////////////////////////////////////////////////////// -// Cleanup -////////////////////////////////////////////////////////////////////////// -void Fighter::clearSequences() { // The original game resets the function pointers to default values, just before deleting the struct getScenes()->removeAndRedraw(&_frame, false); // Free sequences - for (int i = 0; i < (int)_sequences.size(); i++) + for (uint i = 0; i < _sequences.size(); i++) SAFE_DELETE(_sequences[i]); + + // Zero-out passed pointers + _sequence = NULL; + _opponent = NULL; + _fight = NULL; + + _engine = NULL; } ////////////////////////////////////////////////////////////////////////// @@ -113,6 +113,9 @@ void Fighter::draw() { // Processing ////////////////////////////////////////////////////////////////////////// void Fighter::process() { + if (!_fight) + error("[Fighter::handleAction] Fighter not initialized properly"); + if (!_sequence) { if (_frame) { getScenes()->removeFromQueue(_frame); @@ -188,6 +191,9 @@ void Fighter::process() { // Default actions ////////////////////////////////////////////////////////////////////////// void Fighter::handleAction(FightAction action) { + if (!_opponent || !_fight) + error("[Fighter::handleAction] Fighter not initialized properly"); + switch (action) { default: return; @@ -243,7 +249,10 @@ void Opponent::update() { // Helpers ////////////////////////////////////////////////////////////////////////// bool Fighter::checkFrame(uint32 val) { - return (_frame->getInfo()->field_33 & val); + if (!_frame) + error("[Fighter::checkFrame] Invalid current frame"); + + return (bool)(_frame->getInfo()->field_33 & val); } } // End of namespace LastExpress diff --git a/engines/lastexpress/fight/fighter.h b/engines/lastexpress/fight/fighter.h index e37fe49d86bf..dad95af18643 100644 --- a/engines/lastexpress/fight/fighter.h +++ b/engines/lastexpress/fight/fighter.h @@ -99,9 +99,6 @@ class Fighter { void draw(); void process(); - // Cleanup - void clearSequences(); - // Helpers bool checkFrame(uint32 val); }; diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp index 98d74dd1a7bc..60a309518af6 100644 --- a/engines/lastexpress/game/action.cpp +++ b/engines/lastexpress/game/action.cpp @@ -29,7 +29,6 @@ #include "lastexpress/entities/abbot.h" #include "lastexpress/entities/anna.h" -#include "lastexpress/entities/entity.h" #include "lastexpress/game/beetle.h" #include "lastexpress/game/entities.h" @@ -42,9 +41,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -332,6 +329,22 @@ static const struct { {"8042A", 600} }; +template +class Functor1MemConst : public Common::Functor1 { +public: + typedef Res (T::*FuncType)(Arg) const; + + Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {} + + bool isValid() const { return _func != 0 && _t != 0; } + Res operator()(Arg v1) const { + return (_t->*_func)(v1); + } +private: + mutable T *_t; + const FuncType _func; +}; + Action::Action(LastExpressEngine *engine) : _engine(engine) { ADD_ACTION(dummy); ADD_ACTION(inventory); @@ -407,7 +420,7 @@ SceneIndex Action::processHotspot(const SceneHotspot &hotspot) { ////////////////////////////////////////////////////////////////////////// // Action 0 IMPLEMENT_ACTION(dummy) - warning("[Action::action_dummy] Dummy action function called (hotspot action: %d)", hotspot.action); + error("[Action::action_dummy] Dummy action function called (hotspot action: %d)", hotspot.action); return kSceneInvalid; } @@ -1742,14 +1755,14 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const { return kCursorBackward; case SceneHotspot::kActionKnockOnDoor: - warning("================================= DOOR %03d =================================", object); + debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object); if (object >= kObjectMax) return kCursorNormal; else return (CursorStyle)getObjects()->get(object).cursor; case SceneHotspot::kAction12: - warning("================================= OBJECT %03d =================================", object); + debugC(2, kLastExpressDebugScenes, "================================= OBJECT %03d =================================", object); if (object >= kObjectMax) return kCursorNormal; @@ -1759,7 +1772,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const { return kCursorNormal; case SceneHotspot::kActionPickItem: - warning("================================= ITEM %03d =================================", object); + debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object); if (object >= kObjectCompartmentA) return kCursorNormal; @@ -1770,7 +1783,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const { return kCursorNormal; case SceneHotspot::kActionDropItem: - warning("================================= ITEM %03d =================================", object); + debugC(2, kLastExpressDebugScenes, "================================= ITEM %03d =================================", object); if (object >= kObjectCompartmentA) return kCursorNormal; @@ -1887,7 +1900,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const { // Handle compartment action case SceneHotspot::kActionCompartment: case SceneHotspot::kActionExitCompartment: - warning("================================= DOOR %03d =================================", object); + debugC(2, kLastExpressDebugScenes, "================================= DOOR %03d =================================", object); if (object >= kObjectMax) return kCursorNormal; diff --git a/engines/lastexpress/game/beetle.cpp b/engines/lastexpress/game/beetle.cpp index ab707ddae9de..2a7245969700 100644 --- a/engines/lastexpress/game/beetle.cpp +++ b/engines/lastexpress/game/beetle.cpp @@ -27,7 +27,6 @@ #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -337,26 +336,13 @@ void Beetle::drawUpdate() { } } -#define INVERT_Y() \ - switch (_data->indexes[_data->offset]) { \ - default: \ - break; \ - case 24: \ - case 25: \ - case 26: \ - case 27: \ - case 28: \ - _data->coordY = -_data->coordY; \ - break; \ - } - // Invert direction - INVERT_Y(); + invertDirection(); SequenceFrame *frame = new SequenceFrame(_data->currentSequence, (uint16)_data->currentFrame); updateFrame(frame); - INVERT_Y(); + invertDirection(); getScenes()->addToQueue(frame); @@ -364,6 +350,21 @@ void Beetle::drawUpdate() { _data->frame = frame; } +void Beetle::invertDirection() { + switch (_data->indexes[_data->offset]) { + default: + break; + + case 24: + case 25: + case 26: + case 27: + case 28: + _data->coordY = -_data->coordY; + break; + } +} + void Beetle::move() { if (!_data) error("[Beetle::move] Sequences have not been loaded"); diff --git a/engines/lastexpress/game/beetle.h b/engines/lastexpress/game/beetle.h index d3c47f39e565..034ebbd5574f 100644 --- a/engines/lastexpress/game/beetle.h +++ b/engines/lastexpress/game/beetle.h @@ -111,6 +111,7 @@ class Beetle { void updateFrame(SequenceFrame *frame) const; void updateData(uint32 index); void drawUpdate(); + void invertDirection(); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp index f27087a609a9..51db635bed57 100644 --- a/engines/lastexpress/game/entities.cpp +++ b/engines/lastexpress/game/entities.cpp @@ -27,8 +27,6 @@ #include "lastexpress/data/sequence.h" // Entities -#include "lastexpress/entities/entity.h" - #include "lastexpress/entities/abbot.h" #include "lastexpress/entities/alexei.h" #include "lastexpress/entities/alouan.h" @@ -71,10 +69,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -673,11 +669,12 @@ void Entities::executeCallbacks() { ////////////////////////////////////////////////////////////////////////// // Processing ////////////////////////////////////////////////////////////////////////// -#define INCREMENT_DIRECTION_COUNTER() { \ - data->doProcessEntity = false; \ - if (data->direction == kDirectionRight || (data->direction == kDirectionSwitch && data->directionSwitch == kDirectionRight)) \ - ++data->field_4A1; \ - } +void Entities::incrementDirectionCounter(EntityData::EntityCallData *data) { + data->doProcessEntity = false; + + if (data->direction == kDirectionRight || (data->direction == kDirectionSwitch && data->directionSwitch == kDirectionRight)) + ++data->field_4A1; +} void Entities::processEntity(EntityIndex entityIndex) { EntityData::EntityCallData *data = getData(entityIndex); @@ -696,7 +693,7 @@ void Entities::processEntity(EntityIndex entityIndex) { getScenes()->removeAndRedraw(&data->frame, false); getScenes()->removeAndRedraw(&data->frame1, false); - INCREMENT_DIRECTION_COUNTER(); + incrementDirectionCounter(data); return; } @@ -726,7 +723,7 @@ void Entities::processEntity(EntityIndex entityIndex) { processFrame(entityIndex, false, true); if (!getFlags()->flag_entities_0 && !data->doProcessEntity) { - INCREMENT_DIRECTION_COUNTER(); + incrementDirectionCounter(data); return; } } else { @@ -744,7 +741,7 @@ void Entities::processEntity(EntityIndex entityIndex) { data->position = 0; } - INCREMENT_DIRECTION_COUNTER(); + incrementDirectionCounter(data); } return; } @@ -754,46 +751,44 @@ void Entities::processEntity(EntityIndex entityIndex) { if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) { ++data->field_49B; - } else { - if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) { - ++data->field_49B; - } else { - if (data->frame->getInfo()->keepPreviousFrame == 1) - keepPreviousFrame = true; - - // Increment current frame - ++data->currentFrame; + } else if (data->frame->getInfo()->field_30 <= data->field_49B || data->frame->getInfo()->keepPreviousFrame) { + if (data->frame->getInfo()->keepPreviousFrame == 1) + keepPreviousFrame = true; - if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) { + // Increment current frame + ++data->currentFrame; - if (data->direction == kDirectionLeft) { - data->currentFrame = 0; - } else { - keepPreviousFrame = true; - drawNextSequence(entityIndex); + if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) { - if (getFlags()->flag_entities_0 || data->doProcessEntity) - return; + if (data->direction == kDirectionLeft) { + data->currentFrame = 0; + } else { + keepPreviousFrame = true; + drawNextSequence(entityIndex); - if (!data->sequence2) { - updateEntityPosition(entityIndex); - data->doProcessEntity = false; - return; - } + if (getFlags()->flag_entities_0 || data->doProcessEntity) + return; - copySequenceData(entityIndex); + if (!data->sequence2) { + updateEntityPosition(entityIndex); + data->doProcessEntity = false; + return; } + copySequenceData(entityIndex); } - processFrame(entityIndex, keepPreviousFrame, false); - - if (getFlags()->flag_entities_0 || data->doProcessEntity) - return; } + + processFrame(entityIndex, keepPreviousFrame, false); + + if (getFlags()->flag_entities_0 || data->doProcessEntity) + return; + } else { + ++data->field_49B; } - INCREMENT_DIRECTION_COUNTER(); + incrementDirectionCounter(data); } void Entities::computeCurrentFrame(EntityIndex entityIndex) const { @@ -2283,7 +2278,7 @@ bool Entities::updateEntity(EntityIndex entity, CarIndex car, EntityPosition pos if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingUp)) { getSavePoints()->push(kEntityPlayer, entity, kActionExcuseMeCath); - } else if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingDown) || getScenes()->checkCurrentPosition(false)){ + } else if (getScenes()->checkPosition(kSceneNone, SceneManager::kCheckPositionLookingDown) || getScenes()->checkCurrentPosition(false)) { getSavePoints()->push(kEntityPlayer, entity, kActionExcuseMe); if (getScenes()->checkCurrentPosition(false)) diff --git a/engines/lastexpress/game/entities.h b/engines/lastexpress/game/entities.h index eb5eae461f39..a9de7931f045 100644 --- a/engines/lastexpress/game/entities.h +++ b/engines/lastexpress/game/entities.h @@ -344,6 +344,7 @@ class Entities : Common::Serializable { uint _positions[_positionsCount]; void executeCallbacks(); + void incrementDirectionCounter(EntityData::EntityCallData *data); void processEntity(EntityIndex entity); void drawSequence(EntityIndex entity, const char *sequence, EntityDirection direction) const; diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp index e417b1ec0d34..52c00ece3174 100644 --- a/engines/lastexpress/game/inventory.cpp +++ b/engines/lastexpress/game/inventory.cpp @@ -26,7 +26,9 @@ #include "lastexpress/data/scene.h" #include "lastexpress/data/snd.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/logic.h" +#include "lastexpress/game/savegame.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" @@ -44,7 +46,7 @@ namespace LastExpress { Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0), - _showingHourGlass(false), _blinkingEgg(false), _blinkingTime(0), _blinkingInterval(_defaultBlinkingInterval), _blinkingBrightness(1), + _showingHourGlass(false), _blinkingDirection(1), _blinkingBrightness(0), _useMagnifier(false), _portraitHighlighted(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) { //_inventoryRect = Common::Rect(0, 0, 32, 32); @@ -162,13 +164,11 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { getMenu()->show(true, kSavegameTypeIndex, 0); - } else if (ev.type == Common::EVENT_RBUTTONDOWN) { - if (getGlobalTimer()) { - if (getSoundQueue()->isBuffered("TIMER")) - getSoundQueue()->removeFromQueue("TIMER"); + } else if (ev.type == Common::EVENT_RBUTTONDOWN && getGlobalTimer()) { + if (getSoundQueue()->isBuffered("TIMER")) + getSoundQueue()->removeFromQueue("TIMER"); - setGlobalTimer(900); - } + setGlobalTimer(900); } } @@ -180,7 +180,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { if (_highlightedItemIndex) drawHighlight(_highlightedItemIndex, true); } else { - // The user released the mouse button, we need to update the inventory state (clear hightlight and items) + // The user released the mouse button, we need to update the inventory state (clear highlight and items) drawItem((CursorStyle)getProgress().portrait, 0, 0, 1); _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(0, 44, 32, (int16)(40 * _itemsShown + 40))); _isOpened = false; @@ -226,12 +226,11 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { if (getFlags()->mouseLeftPressed) { if (getState()->sceneUseBackup) { - if (getState()->sceneBackup2 - && getFirstExaminableItem() == _selectedItem) { - SceneIndex sceneIndex = getState()->sceneBackup2; - getState()->sceneBackup2 = kSceneNone; + if (getState()->sceneBackup2 && getFirstExaminableItem() == _selectedItem) { + SceneIndex sceneIndex = getState()->sceneBackup2; + getState()->sceneBackup2 = kSceneNone; - getScenes()->loadScene(sceneIndex); + getScenes()->loadScene(sceneIndex); } } else { getState()->sceneBackup = getState()->scene; @@ -261,7 +260,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { // Change item highlight on list if (getFlags()->mouseLeftPressed) { - uint32 index = ev.mouse.y / 40; + uint32 index = (uint16)ev.mouse.y / 40; if (_highlightedItemIndex && _highlightedItemIndex != index) drawHighlight(_highlightedItemIndex, true); @@ -418,12 +417,12 @@ void Inventory::show() { drawEgg(); } -void Inventory::setPortrait(InventoryItem item) { +void Inventory::setPortrait(InventoryItem item) const { getProgress().portrait = item; drawItem((CursorStyle)getProgress().portrait, 0, 0); } -void Inventory::showHourGlass(){ +void Inventory::showHourGlass() const { if (!getMenu()->isShown()) drawItem(kCursorHourGlass, 608, 448); @@ -613,7 +612,7 @@ void Inventory::examine(InventoryItem item) { } } -void Inventory::drawEgg() { +void Inventory::drawEgg() const { if (!getMenu()->isShown()) drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, _eggHightlighted ? 0 : 1); @@ -621,40 +620,51 @@ void Inventory::drawEgg() { } // Blinking egg: we need to blink the egg for delta time, with the blinking getting faster until it's always lit. -void Inventory::drawBlinkingEgg() { +void Inventory::drawBlinkingEgg(uint ticks) { + uint globalTimer = getGlobalTimer(); + uint timerValue = (getProgress().jacket == kJacketGreen) ? 450 : 225; - warning("[Inventory::drawBlinkingEgg] Blinking not implemented"); + if (globalTimer == timerValue || globalTimer == 900) { + _blinkingBrightness = 0; + _blinkingDirection = 1; + } - //// TODO show egg (with or without mouseover) + globalTimer = globalTimer <= ticks ? 0 : globalTimer - ticks; + setGlobalTimer(globalTimer); - //// Play timer sound - //if (getGlobalTimer() < 90) { - // if (getGlobalTimer() + ticks >= 90) - // getSound()->playSoundWithSubtitles("TIMER.SND", 50331664, kEntityPlayer); + if (getFlags()->flag_0 + || (globalTimer % 5) == 0 + || (globalTimer <= 500 && (globalTimer % ((globalTimer + 100) / 100)) == 0)) + blinkEgg(); - // if (getSoundQueue()->isBuffered("TIMER")) - // setGlobalTimer(0); - //} + if (globalTimer < 90) { + if ((globalTimer + ticks) >= 90) + getSound()->playSoundWithSubtitles("TIMER", (SoundFlag)(kFlagType13|kFlagDefault), kEntityPlayer); - //// Restore egg to standard brightness - //if (!getGlobalTimer()) { - // - //} + if (!getSoundQueue()->isBuffered("TIMER")) + setGlobalTimer(0); + } + if (globalTimer == 0) { + drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, _menuEggRect.contains(getCoords()) ? 1 : -1); - //drawItem(608, 448, getMenu()->getGameId() + 39, _blinkingBrightness) + askForRedraw(); - //// TODO if delta time > _blinkingInterval, update egg & ask for redraw then adjust blinking time and remaining time - // + getSaveLoad()->saveGame(kSavegameTypeAuto, kEntityChapters, 0); + } +} - //// Reset values and stop blinking - //if (_blinkingTime == 0) - // blinkEgg(false); +void Inventory::blinkEgg() { + drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, (_blinkingBrightness == 0) ? -1 : _blinkingBrightness); askForRedraw(); + + _blinkingBrightness += _blinkingDirection; + if (_blinkingBrightness == 0 || _blinkingBrightness == 3) + _blinkingDirection = -_blinkingDirection; } -void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessIndex) { +void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessIndex) const { Icon icon(id); icon.setPosition(x, y); @@ -678,7 +688,7 @@ void Inventory::drawSelectedItem() { } } -void Inventory::clearSelectedItem() { +void Inventory::clearSelectedItem() const { _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(44, 0, 44 + 32, 32)); } @@ -733,7 +743,7 @@ void Inventory::drawHighlight(uint32 currentIndex, bool reset) { } } -uint32 Inventory::getItemIndex(uint32 currentIndex) { +uint32 Inventory::getItemIndex(uint32 currentIndex) const { uint32 count = 0; for (uint32 i = 1; i < ARRAYSIZE(_entries); i++) { diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h index b1995adce35c..b1019a43c6af 100644 --- a/engines/lastexpress/game/inventory.h +++ b/engines/lastexpress/game/inventory.h @@ -106,11 +106,10 @@ class Inventory : Common::Serializable, public EventHandler { // UI Control void show(); - void blinkEgg(bool enabled); - void showHourGlass(); - void setPortrait(InventoryItem item); - void drawEgg(); - void drawBlinkingEgg(); + void showHourGlass() const; + void setPortrait(InventoryItem item) const; + void drawEgg() const; + void drawBlinkingEgg(uint ticks = 1); // Handle inventory UI events. void handleMouseEvent(const Common::Event &ev); @@ -133,8 +132,6 @@ class Inventory : Common::Serializable, public EventHandler { Common::String toString(); private: - static const uint32 _defaultBlinkingInterval = 250; ///< Default blinking interval in ms - LastExpressEngine *_engine; InventoryEntry _entries[32]; @@ -144,9 +141,7 @@ class Inventory : Common::Serializable, public EventHandler { uint32 _itemsShown; bool _showingHourGlass; - bool _blinkingEgg; - uint32 _blinkingTime; - uint32 _blinkingInterval; + int16 _blinkingDirection; uint16 _blinkingBrightness; // Flags @@ -157,8 +152,6 @@ class Inventory : Common::Serializable, public EventHandler { Scene *_itemScene; - // Important rects - //Common::Rect _inventoryRect; Common::Rect _menuEggRect; Common::Rect _selectedItemRect; @@ -168,14 +161,15 @@ class Inventory : Common::Serializable, public EventHandler { void close(); void examine(InventoryItem item); void drawHighlight(uint32 currentIndex, bool reset); - uint32 getItemIndex(uint32 currentIndex); + uint32 getItemIndex(uint32 currentIndex) const; bool isItemSceneParameter(InventoryItem item) const; - void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1); + void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1) const; + void blinkEgg(); void drawSelectedItem(); - void clearSelectedItem(); + void clearSelectedItem() const; }; } // End of namespace LastExpress diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp index aeac8cff989c..1696f100ff6f 100644 --- a/engines/lastexpress/game/logic.cpp +++ b/engines/lastexpress/game/logic.cpp @@ -47,10 +47,8 @@ #include "lastexpress/menu/menu.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -88,16 +86,6 @@ Logic::~Logic() { ////////////////////////////////////////////////////////////////////////// // Event Handling ////////////////////////////////////////////////////////////////////////// -#define REDRAW_CURSOR() { \ - if (getInventory()->isMagnifierInUse()) \ - _engine->getCursor()->setStyle(kCursorMagnifier); \ - if (getInventory()->isPortraitHighlighted() \ - || getInventory()->isOpened() \ - || getInventory()->isEggHighlighted()) \ - _engine->getCursor()->setStyle(kCursorNormal); \ - return; \ -} - void Logic::eventMouse(const Common::Event &ev) { bool hotspotHandled = false; @@ -168,7 +156,9 @@ void Logic::eventMouse(const Common::Event &ev) { getInventory()->unselectItem(); } - REDRAW_CURSOR() + redrawCursor(); + + return; } // Handle match case @@ -194,7 +184,9 @@ void Logic::eventMouse(const Common::Event &ev) { getScenes()->processScene(); } - REDRAW_CURSOR() + redrawCursor(); + + return; } // Handle entity item case @@ -315,7 +307,7 @@ void Logic::eventTick(const Common::Event &) { ////////////////////////////////////////////////////////////////////////// // Draw the blinking egg if needed if (getGlobalTimer() && !getFlags()->shouldDrawEggOrHourGlass) - getInventory()->drawBlinkingEgg(); + getInventory()->drawBlinkingEgg(ticks); ////////////////////////////////////////////////////////////////////////// // Adjust time and save game if needed @@ -411,9 +403,12 @@ void Logic::eventTick(const Common::Event &) { * Resets the game state. */ void Logic::resetState() { - getState()->scene = kSceneDefault; + getScenes()->setCoordinates(Common::Rect(80, 0, 559, 479)); + + SAFE_DELETE(_entities); + _entities = new Entities(_engine); - warning("[Logic::resetState] Not implemented! You need to restart the engine until this is implemented."); + _state->reset(); } /** @@ -595,4 +590,14 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe _engine->getCursor()->setStyle(style); } +void Logic::redrawCursor() const { + if (getInventory()->isMagnifierInUse()) + _engine->getCursor()->setStyle(kCursorMagnifier); + + if (getInventory()->isPortraitHighlighted() + || getInventory()->isOpened() + || getInventory()->isEggHighlighted()) + _engine->getCursor()->setStyle(kCursorNormal); +} + } // End of namespace LastExpress diff --git a/engines/lastexpress/game/logic.h b/engines/lastexpress/game/logic.h index 8b7dcef942b8..efb8f1e1a3df 100644 --- a/engines/lastexpress/game/logic.h +++ b/engines/lastexpress/game/logic.h @@ -25,8 +25,6 @@ #include "lastexpress/shared.h" -#include "lastexpress/game/entities.h" - #include "lastexpress/eventhandler.h" #include "common/events.h" @@ -75,6 +73,7 @@ class Logic : public EventHandler { void switchChapter() const; void showCredits() const; + void redrawCursor() const; // Flags & Members bool _flagActionPerformed; diff --git a/engines/lastexpress/game/object.cpp b/engines/lastexpress/game/object.cpp index d9e9e4279ae7..48df91ea6d37 100644 --- a/engines/lastexpress/game/object.cpp +++ b/engines/lastexpress/game/object.cpp @@ -22,11 +22,11 @@ #include "lastexpress/game/object.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" namespace LastExpress { diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp index 9c464feb6e39..360e99146adb 100644 --- a/engines/lastexpress/game/savegame.cpp +++ b/engines/lastexpress/game/savegame.cpp @@ -22,6 +22,7 @@ #include "lastexpress/game/savegame.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" @@ -34,13 +35,13 @@ #include "lastexpress/debug.h" #include "lastexpress/lastexpress.h" -#include "lastexpress/helpers.h" #include "common/file.h" -#include "common/system.h" namespace LastExpress { +#define DISABLE_COMPRESSION 1 + // Names of savegames static const struct { const char *saveFile; @@ -53,6 +54,296 @@ static const struct { {"lastexpress-gold.egg"} }; +////////////////////////////////////////////////////////////////////////// +// SavegameStream +////////////////////////////////////////////////////////////////////////// + +uint32 SavegameStream::write(const void *dataPtr, uint32 dataSize) { +#if !DISABLE_COMPRESSION + if (_enableCompression) + return writeCompressed(dataPtr, dataSize); +#endif + + return Common::MemoryWriteStreamDynamic::write(dataPtr, dataSize); +} + +uint32 SavegameStream::read(void *dataPtr, uint32 dataSize) { +#if !DISABLE_COMPRESSION + if (_enableCompression) + return readCompressed(dataPtr, dataSize); +#endif + + return readUncompressed(dataPtr, dataSize); +} + +uint32 SavegameStream::readUncompressed(void *dataPtr, uint32 dataSize) { + if ((int32)dataSize > size() - pos()) { + dataSize = size() - pos(); + _eos = true; + } + memcpy(dataPtr, getData() + pos(), dataSize); + + seek(dataSize, SEEK_CUR); + + return dataSize; +} + +void SavegameStream::writeBuffer(uint8 value, bool onlyValue) { + if (_bufferOffset == -1) + _bufferOffset = 0; + + if (_bufferOffset == 256) { + _bufferOffset = 0; + Common::MemoryWriteStreamDynamic::write(_buffer, 256); + } + + if (onlyValue || value < 0xFB) + _buffer[_bufferOffset] = value; + else + _buffer[_bufferOffset] = 0xFE; + + _offset++; + _bufferOffset++; + + if (!onlyValue && value >= 0xFB) + { + if (_bufferOffset == 256) { + _bufferOffset = 0; + Common::MemoryWriteStreamDynamic::write(_buffer, 256); + } + + _buffer[_bufferOffset] = value; + + _bufferOffset++; + _offset++; + } +} + +uint8 SavegameStream::readBuffer() { + if (_bufferOffset == -1 || _bufferOffset >= 256) { + readUncompressed(_buffer, 256); + _bufferOffset = 0; + } + + byte val = _buffer[_bufferOffset]; + _bufferOffset++; + + return val; +} + +uint32 SavegameStream::process() { + _enableCompression = !_enableCompression; + +#if DISABLE_COMPRESSION + return 0; +#else + switch (_status) { + default: + break; + + case kStatusReading: + _status = kStatusReady; + if (_bufferOffset != -1 && _bufferOffset != 256) { + seek(_bufferOffset - 256, SEEK_CUR); + _bufferOffset = -1; + } + break; + + case kStatusWriting: + switch (_valueCount) { + default: + break; + + case 1: + writeBuffer(_previousValue, false); + break; + + case 2: + if (_previousValue) { + writeBuffer(0xFF); + writeBuffer(_repeatCount); + writeBuffer(_previousValue); + break; + } + + if (_repeatCount == 3) { + writeBuffer(0xFB); + break; + } + + if (_repeatCount == 255) { + writeBuffer(0xFC); + break; + } + + writeBuffer(0xFD); + writeBuffer(_repeatCount); + break; + } + + if (_bufferOffset != -1 && _bufferOffset != 0) { + Common::MemoryWriteStreamDynamic::write(_buffer, _bufferOffset); + _bufferOffset = -1; + } + break; + } + + _status = kStatusReady; + _valueCount = 0; + uint32 offset = _offset; + _offset = 0; + + return offset; +#endif +} + +uint32 SavegameStream::writeCompressed(const void *dataPtr, uint32 dataSize) { + if (_status == kStatusReading) + error("[SavegameStream::writeCompressed] Error: Compression buffer is in read mode."); + + _status = kStatusWriting; + const byte *data = (const byte *)dataPtr; + + while (dataSize) { + switch (_valueCount) { + default: + error("[SavegameStream::writeCompressed] Invalid value count (%d)", _valueCount); + + case 0: + _previousValue = *data++; + _valueCount = 1; + break; + + case 1: + if (*data != _previousValue) { + writeBuffer(_previousValue, false); + _previousValue = *data; + } else { + _valueCount = 2; + _repeatCount = 2; + } + + ++data; + break; + + case 2: + if (*data != _previousValue || _repeatCount >= 255) { + if (_previousValue) { + writeBuffer(0xFF, true); + writeBuffer(_repeatCount, true); + writeBuffer(_previousValue, true); + + _previousValue = *data++; + _valueCount = 1; + break; + } + + if (_repeatCount == 3) { + writeBuffer(0xFB, true); + + _previousValue = *data++; + _valueCount = 1; + break; + } + + if (_repeatCount == -1) { + writeBuffer(0xFC, true); + + _previousValue = *data++; + _valueCount = 1; + break; + } + + writeBuffer(0xFD, true); + writeBuffer(_repeatCount, true); + + _previousValue = *data++; + _valueCount = 1; + } + + ++data; + ++_repeatCount; + break; + } + + --dataSize; + } + + return _offset; +} + +uint32 SavegameStream::readCompressed(void *dataPtr, uint32 dataSize) { + if (_status == kStatusWriting) + error("[SavegameStream::writeCompressed] Error: Compression buffer is in write mode."); + + _status = kStatusReady; + byte *data = (byte *)dataPtr; + + while (dataSize) { + switch (_valueCount) { + default: + error("[SavegameStream::readCompressed] Invalid value count (%d)", _valueCount); + + case 0: + case 1: { + // Read control code + byte control = readBuffer(); + + switch (control) { + default: + // Data value + *data++ = control; + break; + + case 0xFB: + _repeatCount = 2; + _previousValue = 0; + *data++ = 0; + _valueCount = 2; + break; + + case 0xFC: + _repeatCount = 254; + _previousValue = 0; + *data++ = 0; + _valueCount = 2; + break; + + case 0xFD: + _repeatCount = readBuffer() - 1; + _previousValue = 0; + *data++ = 0; + _valueCount = 2; + break; + + case 0xFE: + *data++ = readBuffer(); + break; + + case 0xFF: + _repeatCount = readBuffer() - 1; + _previousValue = readBuffer(); + *data++ = _previousValue; + _valueCount = 2; + break; + } + } + break; + + case 2: + *data++ = _previousValue; + _repeatCount--; + if (!_repeatCount) + _valueCount = 1; + break; + } + + --dataSize; + } + + return _offset; +} + ////////////////////////////////////////////////////////////////////////// // Constructors ////////////////////////////////////////////////////////////////////////// @@ -81,6 +372,7 @@ void SaveLoad::flushStream(GameId id) { error("[SaveLoad::flushStream] Savegame stream is invalid"); save->write(_savegame->getData(), (uint32)_savegame->size()); + save->finalize(); delete save; } @@ -258,7 +550,7 @@ void SaveLoad::saveGame(SavegameType type, EntityIndex entity, uint32 value) { entry.saveLoadWithSerializer(ser); if (!entry.isValid()) { - warning("[SaveLoad::saveGame] Invalid entry. This savegame might be corrupted"); + error("[SaveLoad::saveGame] Invalid entry. This savegame might be corrupted"); _savegame->seek(header.offset); } else if (getState()->time < entry.time || (type == kSavegameTypeTickInterval && getState()->time == entry.time)) { // Not ready to save a game, skipping! @@ -341,16 +633,46 @@ bool SaveLoad::loadMainHeader(Common::InSaveFile *stream, SavegameMainHeader *he ////////////////////////////////////////////////////////////////////////// // Entries ////////////////////////////////////////////////////////////////////////// -void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) { -#define WRITE_ENTRY(name, func, val) { \ - uint32 _prevPosition = (uint32)_savegame->pos(); \ - func; \ - uint32 _count = (uint32)_savegame->pos() - _prevPosition; \ - debugC(kLastExpressDebugSavegame, "Savegame: Writing " #name ": %d bytes", _count); \ - if (_count != val)\ - error("[SaveLoad::writeEntry] Number of bytes written (%d) differ from expected count (%d)", _count, val); \ +uint32 SaveLoad::writeValue(Common::Serializer &ser, const char *name, Common::Functor1 *function, uint size) { + debugC(kLastExpressDebugSavegame, "Savegame: Writing %s: %u bytes", name, size); + + uint32 prevPosition = (uint32)_savegame->pos(); + + // Serialize data into our buffer + (*function)(ser); + + uint32 count = (uint32)_savegame->pos() - prevPosition; + +#if DISABLE_COMPRESSION + if (count != size) + error("[SaveLoad::writeValue] %s - Number of bytes written (%d) differ from expected count (%d)", name, count, size); +#endif + + return count; } +uint32 SaveLoad::readValue(Common::Serializer &ser, const char *name, Common::Functor1 *function, uint size) { + debugC(kLastExpressDebugSavegame, "Savegame: Reading %s: %u bytes", name, size); + + uint32 prevPosition = (uint32)_savegame->pos(); + + (*function)(ser); + + uint32 count = (uint32)_savegame->pos() - prevPosition; + +#if DISABLE_COMPRESSION + if (size != 0 && count != size) + error("[SaveLoad::readValue] %s - Number of bytes read (%d) differ from expected count (%d)", name, count, size); +#endif + + return count; +} + +void SaveLoad::syncEntity(Common::Serializer &ser) { + ser.syncAsUint32LE(_entity); +} + +void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) { if (!_savegame) error("[SaveLoad::writeEntry] Savegame stream is invalid"); @@ -369,18 +691,22 @@ void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) { header.saveLoadWithSerializer(ser); // Write game data - WRITE_ENTRY("entity index", ser.syncAsUint32LE(entity), 4); - WRITE_ENTRY("state", getState()->saveLoadWithSerializer(ser), 4 + 4 + 4 + 4 + 1 + 4 + 4); - WRITE_ENTRY("selected item", getInventory()->saveSelectedItem(ser), 4); - WRITE_ENTRY("positions", getEntities()->savePositions(ser), 4 * 1000); - WRITE_ENTRY("compartments", getEntities()->saveCompartments(ser), 4 * 16 * 2); - WRITE_ENTRY("progress", getProgress().saveLoadWithSerializer(ser), 4 * 128); - WRITE_ENTRY("events", getState()->syncEvents(ser), 512); - WRITE_ENTRY("inventory", getInventory()->saveLoadWithSerializer(ser), 7 * 32); - WRITE_ENTRY("objects", getObjects()->saveLoadWithSerializer(ser), 5 * 128); - WRITE_ENTRY("entities", getEntities()->saveLoadWithSerializer(ser), 1262 * 40); - WRITE_ENTRY("sound", getSoundQueue()->saveLoadWithSerializer(ser), 3 * 4 + getSoundQueue()->count() * 64); - WRITE_ENTRY("savepoints", getSavePoints()->saveLoadWithSerializer(ser), 128 * 16 + 4 + getSavePoints()->count() * 16); + _entity = entity; + + _savegame->process(); + writeValue(ser, "entity index", WRAP_SYNC_FUNCTION(this, SaveLoad, syncEntity), 4); + writeValue(ser, "state", WRAP_SYNC_FUNCTION(getState(), State::GameState, saveLoadWithSerializer), 4 + 4 + 4 + 4 + 1 + 4 + 4); + writeValue(ser, "selected item", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveSelectedItem), 4); + writeValue(ser, "positions", WRAP_SYNC_FUNCTION(getEntities(), Entities, savePositions), 4 * 1000); + writeValue(ser, "compartments", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveCompartments), 4 * 16 * 2); + writeValue(ser, "progress", WRAP_SYNC_FUNCTION(&getProgress(), State::GameProgress, saveLoadWithSerializer), 4 * 128); + writeValue(ser, "events", WRAP_SYNC_FUNCTION(getState(), State::GameState, syncEvents), 512); + writeValue(ser, "inventory", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveLoadWithSerializer), 7 * 32); + writeValue(ser, "objects", WRAP_SYNC_FUNCTION(getObjects(), Objects, saveLoadWithSerializer), 5 * 128); + writeValue(ser, "entities", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveLoadWithSerializer), 1262 * 40); + writeValue(ser, "sound", WRAP_SYNC_FUNCTION(getSoundQueue(), SoundQueue, saveLoadWithSerializer), 3 * 4 + getSoundQueue()->count() * 64); + writeValue(ser, "savepoints", WRAP_SYNC_FUNCTION(getSavePoints(), SavePoints, saveLoadWithSerializer), 128 * 16 + 4 + getSavePoints()->count() * 16); + _savegame->process(); header.offset = (uint32)_savegame->pos() - (originalPosition + 32); @@ -406,22 +732,6 @@ void SaveLoad::writeEntry(SavegameType type, EntityIndex entity, uint32 value) { } void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, bool keepIndex) { -#define LOAD_ENTRY(name, func, val) { \ - uint32 _prevPosition = (uint32)_savegame->pos(); \ - func; \ - uint32 _count = (uint32)_savegame->pos() - _prevPosition; \ - debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \ - if (_count != val) \ - error("[SaveLoad::readEntry] Number of bytes read (%d) differ from expected count (%d)", _count, val); \ -} - -#define LOAD_ENTRY_ONLY(name, func) { \ - uint32 _prevPosition = (uint32)_savegame->pos(); \ - func; \ - uint32 _count = (uint32)_savegame->pos() - _prevPosition; \ - debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \ -} - if (!type || !entity || !val) error("[SaveLoad::readEntry] Invalid parameters passed"); @@ -444,20 +754,23 @@ void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, b uint32 originalPosition = (uint32)_savegame->pos(); // Load game data - LOAD_ENTRY("entity index", ser.syncAsUint32LE(*entity), 4); - LOAD_ENTRY("state", getState()->saveLoadWithSerializer(ser), 4 + 4 + 4 + 4 + 1 + 4 + 4); - LOAD_ENTRY("selected item", getInventory()->saveSelectedItem(ser), 4); - LOAD_ENTRY("positions", getEntities()->savePositions(ser), 4 * 1000); - LOAD_ENTRY("compartments", getEntities()->saveCompartments(ser), 4 * 16 * 2); - LOAD_ENTRY("progress", getProgress().saveLoadWithSerializer(ser), 4 * 128); - LOAD_ENTRY("events", getState()->syncEvents(ser), 512); - LOAD_ENTRY("inventory", getInventory()->saveLoadWithSerializer(ser), 7 * 32); - LOAD_ENTRY("objects", getObjects()->saveLoadWithSerializer(ser), 5 * 128); - LOAD_ENTRY("entities", getEntities()->saveLoadWithSerializer(ser), 1262 * 40); - LOAD_ENTRY_ONLY("sound", getSoundQueue()->saveLoadWithSerializer(ser)); - LOAD_ENTRY_ONLY("savepoints", getSavePoints()->saveLoadWithSerializer(ser)); + _savegame->process(); + readValue(ser, "entity index", WRAP_SYNC_FUNCTION(this, SaveLoad, syncEntity), 4); + readValue(ser, "state", WRAP_SYNC_FUNCTION(getState(), State::GameState, saveLoadWithSerializer), 4 + 4 + 4 + 4 + 1 + 4 + 4); + readValue(ser, "selected item", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveSelectedItem), 4); + readValue(ser, "positions", WRAP_SYNC_FUNCTION(getEntities(), Entities, savePositions), 4 * 1000); + readValue(ser, "compartments", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveCompartments), 4 * 16 * 2); + readValue(ser, "progress", WRAP_SYNC_FUNCTION(&getProgress(), State::GameProgress, saveLoadWithSerializer), 4 * 128); + readValue(ser, "events", WRAP_SYNC_FUNCTION(getState(), State::GameState, syncEvents), 512); + readValue(ser, "inventory", WRAP_SYNC_FUNCTION(getInventory(), Inventory, saveLoadWithSerializer), 7 * 32); + readValue(ser, "objects", WRAP_SYNC_FUNCTION(getObjects(), Objects, saveLoadWithSerializer), 5 * 128); + readValue(ser, "entities", WRAP_SYNC_FUNCTION(getEntities(), Entities, saveLoadWithSerializer), 1262 * 40); + readValue(ser, "sound", WRAP_SYNC_FUNCTION(getSoundQueue(), SoundQueue, saveLoadWithSerializer)); + readValue(ser, "savepoints", WRAP_SYNC_FUNCTION(getSavePoints(), SavePoints, saveLoadWithSerializer)); + _savegame->process(); // Update chapter + *entity = _entity; getProgress().chapter = entry.chapter; // Skip padding @@ -567,7 +880,7 @@ Common::InSaveFile *SaveLoad::openForLoading(GameId id) { } Common::OutSaveFile *SaveLoad::openForSaving(GameId id) { - Common::OutSaveFile *save = g_system->getSavefileManager()->openForSaving(getFilename(id)); + Common::OutSaveFile *save = g_system->getSavefileManager()->openForSaving(getFilename(id), false); // TODO Enable compression again if (!save) debugC(2, kLastExpressDebugSavegame, "Cannot open savegame for writing: %s", getFilename(id).c_str()); diff --git a/engines/lastexpress/game/savegame.h b/engines/lastexpress/game/savegame.h index 6f0408487fc6..8656b2ee8604 100644 --- a/engines/lastexpress/game/savegame.h +++ b/engines/lastexpress/game/savegame.h @@ -80,11 +80,68 @@ namespace LastExpress { // Savegame signatures -#define SAVEGAME_SIGNATURE 0x12001200 -#define SAVEGAME_ENTRY_SIGNATURE 0xE660E660 +#define SAVEGAME_SIGNATURE 0x12001200 // 301994496 +#define SAVEGAME_ENTRY_SIGNATURE 0xE660E660 // 3865110112 + +#define WRAP_SYNC_FUNCTION(instance, className, method) \ + new Common::Functor1Mem(instance, &className::method) class LastExpressEngine; +class SavegameStream : public Common::MemoryWriteStreamDynamic, public Common::SeekableReadStream { +public: + SavegameStream() : MemoryWriteStreamDynamic(DisposeAfterUse::YES), _eos(false) { + _enableCompression = false; + _bufferOffset = -1; + _valueCount = 0; + _previousValue = 0; + _repeatCount = 0; + _offset = 0; + _status = kStatusReady; + + memset(_buffer, 0, 256); + } + + int32 pos() const { return MemoryWriteStreamDynamic::pos(); } + int32 size() const { return MemoryWriteStreamDynamic::size(); } + bool seek(int32 offset, int whence = SEEK_SET) { return MemoryWriteStreamDynamic::seek(offset, whence); } + bool eos() const { return _eos; } + uint32 read(void *dataPtr, uint32 dataSize); + uint32 write(const void *dataPtr, uint32 dataSize); + + uint32 process(); + +private: + enum CompressedStreamStatus { + kStatusReady, + kStatusReading, + kStatusWriting + }; + + uint32 readUncompressed(void *dataPtr, uint32 dataSize); + + // Compressed data + uint32 writeCompressed(const void *dataPtr, uint32 dataSize); + uint32 readCompressed(void *dataPtr, uint32 dataSize); + + void writeBuffer(uint8 value, bool onlyValue = true); + uint8 readBuffer(); + +private: + bool _eos; + + // Compression handling + bool _enableCompression; + int16 _bufferOffset; + byte _valueCount; + byte _previousValue; + int16 _repeatCount; + uint32 _offset; + CompressedStreamStatus _status; + + byte _buffer[256]; +}; + class SaveLoad { public: SaveLoad(LastExpressEngine *engine); @@ -116,30 +173,6 @@ class SaveLoad { uint32 getLastSavegameTicks() const { return _gameTicksLastSavegame; } private: - class SavegameStream : public Common::MemoryWriteStreamDynamic, public Common::SeekableReadStream { - public: - SavegameStream() : MemoryWriteStreamDynamic(DisposeAfterUse::YES), - _eos(false) {} - - int32 pos() const { return MemoryWriteStreamDynamic::pos(); } - int32 size() const { return MemoryWriteStreamDynamic::size(); } - bool seek(int32 offset, int whence = SEEK_SET) { return MemoryWriteStreamDynamic::seek(offset, whence); } - bool eos() const { return _eos; } - uint32 read(void *dataPtr, uint32 dataSize) { - if ((int32)dataSize > size() - pos()) { - dataSize = size() - pos(); - _eos = true; - } - memcpy(dataPtr, getData() + pos(), dataSize); - - seek(dataSize, SEEK_CUR); - - return dataSize; - } - private: - bool _eos; - }; - LastExpressEngine *_engine; struct SavegameMainHeader : Common::Serializable { @@ -268,6 +301,9 @@ class SaveLoad { void writeEntry(SavegameType type, EntityIndex entity, uint32 val); void readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, bool keepIndex); + uint32 writeValue(Common::Serializer &ser, const char *name, Common::Functor1 *function, uint size); + uint32 readValue(Common::Serializer &ser, const char *name, Common::Functor1 *function, uint size = 0); + SavegameEntryHeader *getEntry(uint32 index); // Opening save files @@ -279,6 +315,10 @@ class SaveLoad { void initStream(); void loadStream(GameId id); void flushStream(GameId id); + + // Misc + EntityIndex _entity; + void syncEntity(Common::Serializer &ser); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/game/savepoint.cpp b/engines/lastexpress/game/savepoint.cpp index 64ae26c2be4e..6b2dfc593067 100644 --- a/engines/lastexpress/game/savepoint.cpp +++ b/engines/lastexpress/game/savepoint.cpp @@ -26,7 +26,6 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/state.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -95,7 +94,7 @@ void SavePoints::process() { if (!updateEntityFromData(savepoint)) { // Call requested callback - Entity::Callback *callback = getCallback(savepoint.entity1); + Callback *callback = getCallback(savepoint.entity1); if (callback && callback->isValid()) { debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s", ENTITY_NAME(savepoint.entity1), ACTION_NAME(savepoint.action), ENTITY_NAME(savepoint.entity2)); (*callback)(savepoint); @@ -126,7 +125,7 @@ void SavePoints::addData(EntityIndex entity, ActionIndex action, uint32 param) { ////////////////////////////////////////////////////////////////////////// // Callbacks ////////////////////////////////////////////////////////////////////////// -void SavePoints::setCallback(EntityIndex index, Entity::Callback *callback) { +void SavePoints::setCallback(EntityIndex index, Callback *callback) { if (index >= 40) error("[SavePoints::setCallback] Attempting to use an invalid entity index. Valid values 0-39, was %d", index); @@ -136,7 +135,7 @@ void SavePoints::setCallback(EntityIndex index, Entity::Callback *callback) { _callbacks[index] = callback; } -Entity::Callback *SavePoints::getCallback(EntityIndex index) const { +Callback *SavePoints::getCallback(EntityIndex index) const { if (index >= 40) error("[SavePoints::getCallback] Attempting to use an invalid entity index. Valid values 0-39, was %d", index); @@ -150,7 +149,7 @@ void SavePoints::call(EntityIndex entity2, EntityIndex entity1, ActionIndex acti point.entity2 = entity2; point.param.intValue = param; - Entity::Callback *callback = getCallback(entity1); + Callback *callback = getCallback(entity1); if (callback != NULL && callback->isValid()) { debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s, param=%d", ENTITY_NAME(entity1), ACTION_NAME(action), ENTITY_NAME(entity2), param); (*callback)(point); @@ -164,7 +163,7 @@ void SavePoints::call(EntityIndex entity2, EntityIndex entity1, ActionIndex acti point.entity2 = entity2; strcpy((char *)&point.param.charValue, param); - Entity::Callback *callback = getCallback(entity1); + Callback *callback = getCallback(entity1); if (callback != NULL && callback->isValid()) { debugC(8, kLastExpressDebugLogic, "Savepoint: entity1=%s, action=%s, entity2=%s, param=%s", ENTITY_NAME(entity1), ACTION_NAME(action), ENTITY_NAME(entity2), param); (*callback)(point); @@ -181,7 +180,7 @@ void SavePoints::callAndProcess() { bool isRunning = getFlags()->isGameRunning; while (isRunning) { - Entity::Callback *callback = getCallback(index); + Callback *callback = getCallback(index); if (callback != NULL && callback->isValid()) { (*callback)(savepoint); isRunning = getFlags()->isGameRunning; @@ -243,7 +242,15 @@ void SavePoints::saveLoadWithSerializer(Common::Serializer &s) { } // Skip uninitialized data if any - s.skip((_savePointsMaxSize - dataSize) * 16); + // (we are using a compressed stream, so we cannot seek on load) + uint32 unusedDataSize = (_savePointsMaxSize - dataSize) * 16; + if (s.isLoading()) { + byte *empty = (byte *)malloc(unusedDataSize); + s.syncBytes(empty, unusedDataSize); + free(empty); + } else { + s.skip(unusedDataSize); + } // Number of savepoints uint32 numSavepoints = _savepoints.size(); diff --git a/engines/lastexpress/game/savepoint.h b/engines/lastexpress/game/savepoint.h index a3303b4b8a7e..005133891a36 100644 --- a/engines/lastexpress/game/savepoint.h +++ b/engines/lastexpress/game/savepoint.h @@ -23,9 +23,8 @@ #ifndef LASTEXPRESS_SAVEPOINT_H #define LASTEXPRESS_SAVEPOINT_H -#include "lastexpress/entities/entity.h" - #include "lastexpress/helpers.h" +#include "lastexpress/shared.h" #include "common/array.h" #include "common/list.h" @@ -74,10 +73,9 @@ struct SavePoint { } }; -class SavePoints : Common::Serializable { -private: - typedef Common::Functor1 Callback; +typedef Common::Functor1 Callback; +class SavePoints : Common::Serializable { public: struct SavePointData { @@ -112,7 +110,7 @@ class SavePoints : Common::Serializable { void addData(EntityIndex entity, ActionIndex action, uint32 param); // Callbacks - void setCallback(EntityIndex index, Entity::Callback *callback); + void setCallback(EntityIndex index, Callback *callback); Callback *getCallback(EntityIndex entity) const; void call(EntityIndex entity2, EntityIndex entity1, ActionIndex action, uint32 param = 0) const; void call(EntityIndex entity2, EntityIndex entity1, ActionIndex action, const char *param) const; diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp index b886951e0b7b..3cda90075749 100644 --- a/engines/lastexpress/game/scenes.cpp +++ b/engines/lastexpress/game/scenes.cpp @@ -22,8 +22,6 @@ #include "lastexpress/game/scenes.h" -#include "lastexpress/data/scene.h" - #include "lastexpress/game/action.h" #include "lastexpress/game/beetle.h" #include "lastexpress/game/entities.h" @@ -34,10 +32,8 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -493,7 +489,7 @@ bool SceneManager::checkCurrentPosition(bool doCheckOtherCars) const { if (position == 99) return true; - switch (car){ + switch (car) { default: break; @@ -743,24 +739,31 @@ void SceneManager::resetQueue() { _queue.clear(); } -void SceneManager::setCoordinates(SequenceFrame *frame) { +void SceneManager::setCoordinates(Common::Rect rect) { + _flagCoordinates = true; - if (!frame || frame->getInfo()->subType == 3) - return; + if (_coords.right > rect.right) + _coords.right = rect.right; - _flagCoordinates = true; + if (_coords.bottom > rect.bottom) + _coords.bottom = rect.bottom; + + if (_coords.left < rect.left) + _coords.left = rect.left; - if (_coords.right > (int)frame->getInfo()->xPos1) - _coords.right = (int16)frame->getInfo()->xPos1; + if (_coords.top < rect.top) + _coords.top = rect.top; +} - if (_coords.bottom > (int)frame->getInfo()->yPos1) - _coords.bottom = (int16)frame->getInfo()->yPos1; +void SceneManager::setCoordinates(SequenceFrame *frame) { - if (_coords.left < (int)frame->getInfo()->xPos2) - _coords.left = (int16)frame->getInfo()->xPos2; + if (!frame || frame->getInfo()->subType == 3) + return; - if (_coords.top < (int)frame->getInfo()->yPos2) - _coords.top = (int16)frame->getInfo()->yPos2; + setCoordinates(Common::Rect((int16)frame->getInfo()->xPos1, + (int16)frame->getInfo()->yPos1, + (int16)frame->getInfo()->xPos2, + (int16)frame->getInfo()->yPos2)); } void SceneManager::resetCoordinates() { diff --git a/engines/lastexpress/game/scenes.h b/engines/lastexpress/game/scenes.h index 172dde268357..a866c65111e5 100644 --- a/engines/lastexpress/game/scenes.h +++ b/engines/lastexpress/game/scenes.h @@ -79,6 +79,7 @@ class SceneManager { void removeAndRedraw(SequenceFrame **frame, bool doRedraw); void resetQueue(); void setCoordinates(SequenceFrame *frame); + void setCoordinates(Common::Rect rect); // Helpers SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1); diff --git a/engines/lastexpress/game/state.cpp b/engines/lastexpress/game/state.cpp index f3fd9720b150..02ede2559540 100644 --- a/engines/lastexpress/game/state.cpp +++ b/engines/lastexpress/game/state.cpp @@ -49,6 +49,18 @@ State::~State() { _engine = NULL; } +void State::reset() { + SAFE_DELETE(_inventory); + SAFE_DELETE(_objects); + SAFE_DELETE(_savepoints); + SAFE_DELETE(_state); + + _inventory = new Inventory(_engine); + _objects = new Objects(_engine); + _savepoints = new SavePoints(_engine); + _state = new GameState(); +} + bool State::isNightTime() const { return (_state->progress.chapter == kChapter1 || _state->progress.chapter == kChapter4 diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h index c937fdce9fce..2c484f6976b2 100644 --- a/engines/lastexpress/game/state.h +++ b/engines/lastexpress/game/state.h @@ -621,6 +621,8 @@ class State { State(LastExpressEngine *engine); ~State(); + void reset(); + // Accessors Inventory *getGameInventory() { return _inventory; } Objects *getGameObjects() { return _objects; } diff --git a/engines/lastexpress/helpers.h b/engines/lastexpress/helpers.h index 7f3f1e246c68..02454be13df5 100644 --- a/engines/lastexpress/helpers.h +++ b/engines/lastexpress/helpers.h @@ -27,6 +27,8 @@ // Misc helpers ////////////////////////////////////////////////////////////////////////// +#define LOW_BYTE(w) ((unsigned char)(((unsigned long)(w)) & 0xff)) + // Misc #define getArchive(name) _engine->getResourceManager()->getFileStream(name) #define rnd(value) _engine->getRandom().getRandomNumber(value - 1) diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp index 250fa0f2d0c0..01d2634dec3a 100644 --- a/engines/lastexpress/lastexpress.cpp +++ b/engines/lastexpress/lastexpress.cpp @@ -54,18 +54,17 @@ const char *g_entityNames[] = { "Player", "Anna", "August", "Mertens", "Coudert" namespace LastExpress { LastExpressEngine::LastExpressEngine(OSystem *syst, const ADGameDescription *gd) : - Engine(syst), _gameDescription(gd), - _debugger(NULL), _cursor(NULL), - _font(NULL), _logic(NULL), _menu(NULL), - _frameCounter(0), _lastFrameCount(0), + Engine(syst), _gameDescription(gd), + _debugger(NULL), _random("lastexpress"), _cursor(NULL), + _font(NULL), _logic(NULL), _menu(NULL), + _frameCounter(0), _lastFrameCount(0), _graphicsMan(NULL), _resMan(NULL), _sceneMan(NULL), _soundMan(NULL), _eventMouse(NULL), _eventTick(NULL), - _eventMouseBackup(NULL), _eventTickBackup(NULL), - _random("lastexpress") + _eventMouseBackup(NULL), _eventTickBackup(NULL) { // Setup mixer - syncSoundSettings(); + Engine::syncSoundSettings(); // Adding the default directories const Common::FSNode gameDataDir(ConfMan.get("path")); diff --git a/engines/lastexpress/menu/menu.cpp b/engines/lastexpress/menu/menu.cpp index f1a8bebe9451..6a453aee997f 100644 --- a/engines/lastexpress/menu/menu.cpp +++ b/engines/lastexpress/menu/menu.cpp @@ -30,6 +30,7 @@ #include "lastexpress/fight/fight.h" +#include "lastexpress/game/entities.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/savegame.h" @@ -41,10 +42,8 @@ #include "lastexpress/menu/trainline.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -865,7 +864,7 @@ void Menu::init(bool doSavegame, SavegameType type, uint32 value) { doSavegame = false; } else { - // TODO rename saves? + warning("[Menu::initGame] Renaming saves not implemented"); } // Create a new savegame if needed @@ -876,7 +875,7 @@ void Menu::init(bool doSavegame, SavegameType type, uint32 value) { getSaveLoad()->saveGame(kSavegameTypeEvent2, kEntityPlayer, kEventNone); if (!getGlobalTimer()) { - // TODO: remove existing savegame temp file + warning("[Menu::initGame] Removing temporary saves not implemented"); } // Init savegame & menu values diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp index ee4885e34efd..1d010355ac88 100644 --- a/engines/lastexpress/resource.cpp +++ b/engines/lastexpress/resource.cpp @@ -31,7 +31,6 @@ #include "common/debug.h" #include "common/file.h" -#include "common/textconsole.h" namespace LastExpress { @@ -129,13 +128,10 @@ bool ResourceManager::loadArchive(const Common::String &name) { // Get a stream to file in the archive // - same as createReadStreamForMember except it checks if the file exists and will assert / output a debug message if not -Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String &name) { +Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String &name) const { // Check if the file exits in the archive if (!hasFile(name)) { -//#ifdef _DEBUG -// error("[ResourceManager::getFileStream] Cannot open file: %s", name.c_str()); -//#endif debugC(2, kLastExpressDebugResource, "Error opening file: %s", name.c_str()); return NULL; } diff --git a/engines/lastexpress/resource.h b/engines/lastexpress/resource.h index f2f5d63bce51..90ac9b87adc4 100644 --- a/engines/lastexpress/resource.h +++ b/engines/lastexpress/resource.h @@ -42,7 +42,7 @@ class ResourceManager : public Common::Archive { // Loading bool loadArchive(ArchiveIndex type); static bool isArchivePresent(ArchiveIndex type); - Common::SeekableReadStream *getFileStream(const Common::String &name); + Common::SeekableReadStream *getFileStream(const Common::String &name) const; // Archive functions bool hasFile(const Common::String &name) const; diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h index d60a49844779..56cf730e2419 100644 --- a/engines/lastexpress/shared.h +++ b/engines/lastexpress/shared.h @@ -80,7 +80,8 @@ enum SoundFlag { kFlagMusic = 0x5000010, kFlagType3 = 0x6000000, kFlagLoop = 0x6001008, - kFlagType9 = 0x7000000 + kFlagType9 = 0x7000000, + kFlagNIS = 0x7002010 }; enum SoundState { @@ -1732,62 +1733,6 @@ enum ActionIndex { kActionEnd }; -////////////////////////////////////////////////////////////////////////// -// Functors classes used by the engine -////////////////////////////////////////////////////////////////////////// - -// FIXME is this achievable with the existing Functor1Mem function -template -class Functor1MemConst : public Common::Functor1 { -public: - typedef Res (T::*FuncType)(Arg) const; - - Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {} - - bool isValid() const { return _func != 0 && _t != 0; } - Res operator()(Arg v1) const { - return (_t->*_func)(v1); - } -private: - mutable T *_t; - const FuncType _func; -}; - -// FIXME move this to existing func.h file -template -struct QuaternaryFunction { - typedef Arg1 FirstArgumentType; - typedef Arg2 SecondArgumentType; - typedef Arg3 ThirdArgumentType; - typedef Arg4 FourthArgumentType; - typedef Result ResultType; -}; - -template -struct Functor4 : public QuaternaryFunction { - virtual ~Functor4() {} - - virtual bool isValid() const = 0; - virtual Res operator()(Arg1, Arg2, Arg3, Arg4) const = 0; -}; - -template -class Functor4Mem : public Functor4 { -public: - typedef Res (T::*FuncType)(Arg1, Arg2, Arg3, Arg4); - - Functor4Mem(T *t, const FuncType &func) : _t(t), _func(func) {} - - bool isValid() const { return _func != 0 && _t != 0; } - Res operator()(Arg1 v1, Arg2 v2, Arg3 v3, Arg4 v4) const { - return (_t->*_func)(v1, v2, v3, v4); - } -private: - mutable T *_t; - const FuncType _func; -}; - - } // End of namespace LastExpress #endif // LASTEXPRESS_SHARED_H diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp index 44cc68a57bfa..f2a063e45ff7 100644 --- a/engines/lastexpress/sound/entry.cpp +++ b/engines/lastexpress/sound/entry.cpp @@ -30,11 +30,9 @@ #include "lastexpress/sound/sound.h" #include "lastexpress/graphics.h" -#include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" -#include "common/stream.h" namespace LastExpress { @@ -47,6 +45,8 @@ namespace LastExpress { SoundEntry::SoundEntry(LastExpressEngine *engine) : _engine(engine) { _type = kSoundTypeNone; + _currentDataPtr = NULL; + _blockCount = 0; _time = 0; @@ -71,7 +71,13 @@ SoundEntry::~SoundEntry() { // Entries that have been queued will have their streamed disposed automatically if (!_soundStream) SAFE_DELETE(_stream); - delete _soundStream; + + SAFE_DELETE(_soundStream); + + free(_currentDataPtr); + + _subtitle = NULL; + _stream = NULL; // Zero passed pointers _engine = NULL; @@ -111,7 +117,7 @@ void SoundEntry::close() { void SoundEntry::play() { if (!_stream) { - warning("[SoundEntry::play] stream has been disposed"); + error("[SoundEntry::play] stream has been disposed"); return; } @@ -277,7 +283,7 @@ bool SoundEntry::updateSound() { int l = strlen(sub) + 1; if (l - 1 > 4) - sub[l - 1 - 4] = 0; + sub[l - (1 + 4)] = 0; showSubtitle(sub); } } else { @@ -393,6 +399,10 @@ SubtitleEntry::SubtitleEntry(LastExpressEngine *engine) : _engine(engine) { SubtitleEntry::~SubtitleEntry() { SAFE_DELETE(_data); + + // Zero-out passed pointers + _sound = NULL; + _engine = NULL; } void SubtitleEntry::load(Common::String filename, SoundEntry *soundEntry) { @@ -423,6 +433,9 @@ void SubtitleEntry::loadData() { } void SubtitleEntry::setupAndDraw() { + if (!_sound) + error("[SubtitleEntry::setupAndDraw] Sound entry not initialized"); + if (!_data) { _data = new SubtitleManager(_engine->getFont()); _data->load(getArchive(_filename)); diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp index 33b4c067936e..d72acfd8a01a 100644 --- a/engines/lastexpress/sound/queue.cpp +++ b/engines/lastexpress/sound/queue.cpp @@ -26,6 +26,7 @@ #include "lastexpress/game/state.h" #include "lastexpress/sound/entry.h" +#include "lastexpress/sound/sound.h" #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -39,6 +40,7 @@ SoundQueue::SoundQueue(LastExpressEngine *engine) : _engine(engine) { _subtitlesFlag = 0; _currentSubtitle = NULL; + //_soundCacheData = NULL; } SoundQueue::~SoundQueue() { @@ -51,6 +53,7 @@ SoundQueue::~SoundQueue() { _subtitles.clear(); _currentSubtitle = NULL; + //SAFE_DELETE(_soundCacheData); // Zero passed pointers _engine = NULL; @@ -134,7 +137,7 @@ void SoundQueue::updateQueue() { // Original update the current entry, loading another set of samples to be decoded - getFlags()->flag_3 = 0; + getFlags()->flag_3 = false; --_flag; } @@ -340,13 +343,14 @@ void SoundQueue::updateSubtitles() { return; } + if (!subtitle) + return; + if (_subtitlesFlag & 1) subtitle->drawOnScreen(); - if (subtitle) { - subtitle->loadData(); - subtitle->setupAndDraw(); - } + subtitle->loadData(); + subtitle->setupAndDraw(); } ////////////////////////////////////////////////////////////////////////// @@ -368,7 +372,15 @@ void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) { (*i)->saveLoadWithSerializer(s); } else { warning("[Sound::saveLoadWithSerializer] Loading not implemented"); - s.skip(numEntries * 64); + + uint32 unusedDataSize = numEntries * 64; + if (s.isLoading()) { + byte *empty = (byte *)malloc(unusedDataSize); + s.syncBytes(empty, unusedDataSize); + free(empty); + } else { + s.skip(unusedDataSize); + } } } diff --git a/engines/lastexpress/sound/queue.h b/engines/lastexpress/sound/queue.h index 75fe06883ab5..e1f9be1cf718 100644 --- a/engines/lastexpress/sound/queue.h +++ b/engines/lastexpress/sound/queue.h @@ -106,7 +106,7 @@ class SoundQueue : Common::Serializable { // Entries Common::List _soundList; ///< List of all sound entries - void *_soundCacheData; + //void *_soundCacheData; // Subtitles int _subtitlesFlag; diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp index 2f7bb4a60150..319f7cd4f469 100644 --- a/engines/lastexpress/sound/sound.cpp +++ b/engines/lastexpress/sound/sound.cpp @@ -33,7 +33,6 @@ #include "lastexpress/sound/entry.h" #include "lastexpress/sound/queue.h" -#include "lastexpress/helpers.h" #include "lastexpress/graphics.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -675,7 +674,7 @@ const char *SoundManager::getDialogName(EntityIndex entity) const { ////////////////////////////////////////////////////////////////////////// // Letters & Messages ////////////////////////////////////////////////////////////////////////// -void SoundManager::readText(int id){ +void SoundManager::readText(int id) { if (!_queue->isBuffered(kEntityTables4)) return; @@ -1330,23 +1329,23 @@ void SoundManager::playLoopingSound(int param) { } } else { switch (getEntityData(kEntityPlayer)->car) { - case 1: - case 6: + case kCarBaggageRear: + case kCarBaggage: partNumber = 4; break; - case 2: - case 3: - case 4: - case 5: + case kCarKronos: + case kCarGreenSleeping: + case kCarRedSleeping: + case kCarRestaurant: partNumber = 1; break; - case 7: + case kCarCoalTender: partNumber = 5; break; - case 8: + case kCarLocomotive: partNumber = 99; break; - case 9: + case kCar9: partNumber = 3; break; default: @@ -1357,13 +1356,13 @@ void SoundManager::playLoopingSound(int param) { } if (partNumber != 99) - sprintf(tmp, "LOOP%d%c.SND", partNumber, _engine->getRandom().getRandomNumber(numLoops[partNumber] - 1) + 'A'); + sprintf(tmp, "LOOP%d%c.SND", partNumber, (char)(_engine->getRandom().getRandomNumber(numLoops[partNumber] - 1) + 'A')); } if (getFlags()->flag_3) fnameLen = 5; - if (!entry || scumm_strnicmp(entry->getName2().c_str(), tmp, fnameLen)) { + if (!entry || scumm_strnicmp(entry->getName2().c_str(), tmp, (uint)fnameLen)) { _loopingSoundDuration = _engine->getRandom().getRandomNumber(319) + 260; if (partNumber != 99) { diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 4d63647af536..0f13d87fbc28 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -1360,8 +1360,8 @@ bool CopyProtectionDialog::show() { (*tmpHotspot)->copyTo(&screen.screen()); screen.update(); - } else if ((events.event().kbd.keycode >= Common::KEYCODE_0) && - (events.event().kbd.keycode <= Common::KEYCODE_9)) { + } else if ((events.event().kbd.ascii >= '0') && + (events.event().kbd.ascii <= '9')) { HotspotsList::iterator tmpHotspot = _hotspots.begin(); for (int i = 0; i < _charIndex + 3; i++) ++tmpHotspot; diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index f0c657897dcc..56649299487e 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -167,7 +167,7 @@ class MohawkMetaEngine : public AdvancedMetaEngine { } virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { - return detectGameFilebased(allFiles, Mohawk::fileBased); + return detectGameFilebased(allFiles, fslist, Mohawk::fileBased); } virtual const char *getName() const { diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 5acc1bb179ca..55814af1c30a 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -203,24 +203,6 @@ static const MohawkGameDescription gameDescriptions[] = { 0, }, - // Myst Masterpiece Edition - // English Windows - // From clone2727 - { - { - "myst", - "Masterpiece Edition", - AD_ENTRY1("MYST.DAT", "c4cae9f143b5947262e6cb2397e1617e"), - Common::EN_ANY, - Common::kPlatformMacintosh, - ADGF_UNSTABLE, - GUIO1(GUIO_NOASPECT) - }, - GType_MYST, - GF_ME, - 0, - }, - // Myst Masterpiece Edition // German Windows // From DrMcCoy (Included in "Myst: Die Trilogie") diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 708478a6d815..a0671d18d572 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -3378,11 +3378,10 @@ void LBLiveTextItem::readData(uint16 type, uint16 size, Common::MemoryReadStream LiveTextWord word; word.bounds = _vm->readRect(stream); word.soundId = stream->readUint16(); - // TODO: unknowns - uint16 unknown1 = stream->readUint16(); - uint16 unknown2 = stream->readUint16(); - debug(4, "Word: (%d, %d) to (%d, %d), sound %d, unknowns %04x, %04x", - word.bounds.left, word.bounds.top, word.bounds.right, word.bounds.bottom, word.soundId, unknown1, unknown2); + word.itemType = stream->readUint16(); + word.itemId = stream->readUint16(); + debug(4, "Word: (%d, %d) to (%d, %d), sound %d, item %d (type %d)", + word.bounds.left, word.bounds.top, word.bounds.right, word.bounds.bottom, word.soundId, word.itemId, word.itemType); _words.push_back(word); } @@ -3461,6 +3460,12 @@ void LBLiveTextItem::update() { uint16 soundId = _words[_currentWord].soundId; if (soundId && !_vm->_sound->isPlaying(soundId)) { paletteUpdate(_currentWord, false); + + // TODO: check this in RE + LBItem *item = _vm->getItemById(_words[_currentWord].itemId); + if (item) + item->togglePlaying(false, true); + _currentWord = 0xFFFF; } } diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 91d6a8cd30c3..76da7d82199e 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -537,6 +537,9 @@ class LBPaletteItem : public LBItem { struct LiveTextWord { Common::Rect bounds; uint16 soundId; + + uint16 itemType; + uint16 itemId; }; struct LiveTextPhrase { diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 0efd412bd0bd..9c0e64220314 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -98,11 +98,6 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription _view.soundListVolume = NULL; _view.scriptResCount = 0; _view.scriptResources = NULL; - - if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh) { - const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "CD Data"); - } } MohawkEngine_Myst::~MohawkEngine_Myst() { @@ -205,11 +200,6 @@ static const char *mystFiles[] = { // qtw/myst/libelev.mov: libup.mov is basically the same with sound Common::String MohawkEngine_Myst::wrapMovieFilename(const Common::String &movieName, uint16 stack) { - // The Macintosh release of Myst ME stores its videos in a different folder - // WORKAROUND: The gear rotation videos are not in the CD Data folder. See above comments. - if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh && !movieName.matchString("cl1wg?")) - return Common::String("CD Data/m/") + movieName + ".mov"; - Common::String prefix; switch (stack) { @@ -498,52 +488,32 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS if (!_mhk[0]->openFile(mystFiles[_curStack])) error("Could not open %s", mystFiles[_curStack]); - if (getPlatform() == Common::kPlatformMacintosh) - _gfx->loadExternalPictureFile(_curStack); - _runExitScript = false; // Clear the resource cache and the image cache _cache.clear(); _gfx->clearCache(); - // Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked - // up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed. + // Play Flyby Entry Movie on Masterpiece Edition. const char *flyby = 0; if (getFeatures() & GF_ME) { switch (_curStack) { case kSeleniticStack: - if (getPlatform() == Common::kPlatformMacintosh) - flyby = "FLY_SEc"; - else - flyby = "selenitic flyby"; + flyby = "selenitic flyby"; break; case kStoneshipStack: - if (getPlatform() == Common::kPlatformMacintosh) - flyby = "FLY_STc"; - else - flyby = "stoneship flyby"; + flyby = "stoneship flyby"; break; // Myst Flyby Movie not used in Original Masterpiece Edition Engine case kMystStack: - if (_tweaksEnabled) { - if (getPlatform() == Common::kPlatformMacintosh) - flyby = "FLY_MYc"; - else - flyby = "myst flyby"; - } + if (_tweaksEnabled) + flyby = "myst flyby"; break; case kMechanicalStack: - if (getPlatform() == Common::kPlatformMacintosh) - flyby = "FLY_MEc"; - else - flyby = "mech age flyby"; + flyby = "mech age flyby"; break; case kChannelwoodStack: - if (getPlatform() == Common::kPlatformMacintosh) - flyby = "FLY_CHc"; - else - flyby = "channelwood flyby"; + flyby = "channelwood flyby"; break; default: break; diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp index ae80dd5538c4..2df0f7e6bac6 100644 --- a/engines/mohawk/myst_graphics.cpp +++ b/engines/mohawk/myst_graphics.cpp @@ -49,8 +49,6 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { if (_pixelFormat.bytesPerPixel == 1) error("Myst requires greater than 256 colors to run"); - _pictureFile.entries = NULL; - // Initialize our buffer _backBuffer = new Graphics::Surface(); _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat); @@ -61,122 +59,50 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { MystGraphics::~MystGraphics() { delete _bmpDecoder; - delete[] _pictureFile.entries; _backBuffer->free(); delete _backBuffer; } -static const char *s_picFileNames[] = { - "CHpics", - "", - "", - "DUpics", - "INpics", - "", - "MEpics", - "MYpics", - "SEpics", - "", - "", - "STpics" -}; - -void MystGraphics::loadExternalPictureFile(uint16 stack) { - if (_vm->getPlatform() != Common::kPlatformMacintosh) - return; - - if (_pictureFile.picFile.isOpen()) - _pictureFile.picFile.close(); - delete[] _pictureFile.entries; - - if (!scumm_stricmp(s_picFileNames[stack], "")) - return; - - if (!_pictureFile.picFile.open(s_picFileNames[stack])) - error ("Could not open external picture file \'%s\'", s_picFileNames[stack]); - - _pictureFile.pictureCount = _pictureFile.picFile.readUint32BE(); - _pictureFile.entries = new PictureFile::PictureEntry[_pictureFile.pictureCount]; - - for (uint32 i = 0; i < _pictureFile.pictureCount; i++) { - _pictureFile.entries[i].offset = _pictureFile.picFile.readUint32BE(); - _pictureFile.entries[i].size = _pictureFile.picFile.readUint32BE(); - _pictureFile.entries[i].id = _pictureFile.picFile.readUint16BE(); - _pictureFile.entries[i].type = _pictureFile.picFile.readUint16BE(); - _pictureFile.entries[i].width = _pictureFile.picFile.readUint16BE(); - _pictureFile.entries[i].height = _pictureFile.picFile.readUint16BE(); +MohawkSurface *MystGraphics::decodeImage(uint16 id) { + // We need to grab the image from the current stack archive, however, we don't know + // if it's a PICT or WDIB resource. If it's Myst ME it's most likely a PICT, and if it's + // original it's definitely a WDIB. However, Myst ME throws us another curve ball in + // that PICT resources can contain WDIB's instead of PICT's. + Common::SeekableReadStream *dataStream = NULL; + + if (_vm->getFeatures() & GF_ME && _vm->hasResource(ID_PICT, id)) { + // The PICT resource exists. However, it could still contain a MystBitmap + // instead of a PICT image... + dataStream = _vm->getResource(ID_PICT, id); + } else { + // No PICT, so the WDIB must exist. Let's go grab it. + dataStream = _vm->getResource(ID_WDIB, id); } -} -MohawkSurface *MystGraphics::decodeImage(uint16 id) { - MohawkSurface *mhkSurface = 0; + bool isPict = false; - // Myst ME uses JPEG/PICT images instead of compressed Windows Bitmaps for room images, - // though there are a few weird ones that use that format. For further nonsense with images, - // the Macintosh version stores images in external "picture files." We check them before - // going to check for a PICT resource. - if (_vm->getFeatures() & GF_ME && _vm->getPlatform() == Common::kPlatformMacintosh && _pictureFile.picFile.isOpen()) { - for (uint32 i = 0; i < _pictureFile.pictureCount; i++) - if (_pictureFile.entries[i].id == id) { - if (_pictureFile.entries[i].type == 0) { - Graphics::JPEGDecoder jpeg; - Common::SeekableSubReadStream subStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size); - - if (!jpeg.loadStream(subStream)) - error("Could not decode Myst ME Mac JPEG"); - - mhkSurface = new MohawkSurface(jpeg.getSurface()->convertTo(_pixelFormat)); - } else if (_pictureFile.entries[i].type == 1) { - Graphics::PICTDecoder pict; - Common::SeekableSubReadStream subStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size); - - if (!pict.loadStream(subStream)) - error("Could not decode Myst ME Mac PICT"); - - mhkSurface = new MohawkSurface(pict.getSurface()->convertTo(_pixelFormat)); - } else - error ("Unknown Picture File type %d", _pictureFile.entries[i].type); - break; - } + if (_vm->getFeatures() & GF_ME) { + // Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap + // would be compressed, there's no way to detect for the BM without a hack. + // So, we search for the PICT version opcode for detection. + dataStream->seek(512 + 10); // 512 byte pict header + isPict = (dataStream->readUint32BE() == 0x001102FF); + dataStream->seek(0); } - // We're not using the external Mac files, so it's time to delve into the main Mohawk - // archives. However, we still don't know if it's a PICT or WDIB resource. If it's Myst - // ME it's most likely a PICT, and if it's original it's definitely a WDIB. However, - // Myst ME throws us another curve ball in that PICT resources can contain WDIB's instead - // of PICT's. - if (!mhkSurface) { - bool isPict = false; - Common::SeekableReadStream *dataStream = NULL; - - if (_vm->getFeatures() & GF_ME && _vm->hasResource(ID_PICT, id)) { - // The PICT resource exists. However, it could still contain a MystBitmap - // instead of a PICT image... - dataStream = _vm->getResource(ID_PICT, id); - } else // No PICT, so the WDIB must exist. Let's go grab it. - dataStream = _vm->getResource(ID_WDIB, id); - - if (_vm->getFeatures() & GF_ME) { - // Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap - // would be compressed, there's no way to detect for the BM without a hack. - // So, we search for the PICT version opcode for detection. - dataStream->seek(512 + 10); // 512 byte pict header - isPict = (dataStream->readUint32BE() == 0x001102FF); - dataStream->seek(0); - } + MohawkSurface *mhkSurface = 0; - if (isPict) { - Graphics::PICTDecoder pict; + if (isPict) { + Graphics::PICTDecoder pict; - if (!pict.loadStream(*dataStream)) - error("Could not decode Myst ME PICT"); + if (!pict.loadStream(*dataStream)) + error("Could not decode Myst ME PICT"); - mhkSurface = new MohawkSurface(pict.getSurface()->convertTo(_pixelFormat)); - } else { - mhkSurface = _bmpDecoder->decodeImage(dataStream); - mhkSurface->convertToTrueColor(); - } + mhkSurface = new MohawkSurface(pict.getSurface()->convertTo(_pixelFormat)); + } else { + mhkSurface = _bmpDecoder->decodeImage(dataStream); + mhkSurface->convertToTrueColor(); } assert(mhkSurface); diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h index 20fd46c5b962..de8fe521e6ee 100644 --- a/engines/mohawk/myst_graphics.h +++ b/engines/mohawk/myst_graphics.h @@ -43,7 +43,6 @@ class MystGraphics : public GraphicsManager { MystGraphics(MohawkEngine_Myst*); ~MystGraphics(); - void loadExternalPictureFile(uint16 stack); void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest); void copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest); void copyImageToScreen(uint16 image, Common::Rect dest); @@ -66,20 +65,6 @@ class MystGraphics : public GraphicsManager { MohawkEngine_Myst *_vm; MystBitmap *_bmpDecoder; - struct PictureFile { - uint32 pictureCount; - struct PictureEntry { - uint32 offset; - uint32 size; - uint16 id; - uint16 type; - uint16 width; - uint16 height; - } *entries; - - Common::File picFile; - } _pictureFile; - Graphics::Surface *_backBuffer; Graphics::PixelFormat _pixelFormat; Common::Rect _viewport; diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp index cae165ccf0bf..d103105c2d4c 100644 --- a/engines/mohawk/myst_stacks/dni.cpp +++ b/engines/mohawk/myst_stacks/dni.cpp @@ -109,7 +109,7 @@ void Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _vm->setMainCursor(kDefaultMystCursor); // Play movie end (atrus leaving) - _vm->_video->setVideoBounds(atrus, Audio::Timestamp(0, 14813, 600), Audio::Timestamp(0xFFFFFFFF)); + _vm->_video->setVideoBounds(atrus, Audio::Timestamp(0, 14813, 600), _vm->_video->getDuration(atrus)); _vm->_video->setVideoLooping(atrus, false); _atrusLeft = true; diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp index a5f608dbbf97..545b97d956e0 100644 --- a/engines/mohawk/myst_stacks/intro.cpp +++ b/engines/mohawk/myst_stacks/intro.cpp @@ -100,12 +100,8 @@ void Intro::introMovies_run() { switch (_introStep) { case 0: - // Play the Mattel (or UbiSoft) logo in the Myst ME Mac version - if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) { - _vm->_video->playMovie(_vm->wrapMovieFilename("mattel", kIntroStack)); - _introStep = 1; - } else - _introStep = 2; + _introStep = 1; + _vm->_video->playMovie(_vm->wrapMovieFilename("broder", kIntroStack)); break; case 1: if (!_vm->_video->isVideoPlaying()) @@ -113,10 +109,7 @@ void Intro::introMovies_run() { break; case 2: _introStep = 3; - if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) - _vm->_video->playMovie(_vm->wrapMovieFilename("presto", kIntroStack)); - else - _vm->_video->playMovie(_vm->wrapMovieFilename("broder", kIntroStack)); + _vm->_video->playMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack)); break; case 3: if (!_vm->_video->isVideoPlaying()) @@ -124,21 +117,13 @@ void Intro::introMovies_run() { break; case 4: _introStep = 5; - _vm->_video->playMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack)); - break; - case 5: - if (!_vm->_video->isVideoPlaying()) - _introStep = 6; - break; - case 6: - _introStep = 7; if (!(_vm->getFeatures() & GF_DEMO)) // The demo doesn't have the intro video _vm->_video->playMovie(_vm->wrapMovieFilename("intro", kIntroStack)); break; - case 7: + case 5: if (!_vm->_video->isVideoPlaying()) - _introStep = 8; + _introStep = 6; break; default: if (_vm->getFeatures() & GF_DEMO) diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index e54d6fefa2a6..32613c6185b2 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -646,7 +646,7 @@ Common::String MohawkEngine_Riven::getName(uint16 nameResource, uint16 nameID) { } delete nameStream; - delete [] stringOffsets; + delete[] stringOffsets; return name; } diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index 18d609c51315..0ed4f38b5349 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -29,6 +29,7 @@ #include "common/textconsole.h" #include "common/system.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "video/qt_decoder.h" @@ -43,13 +44,12 @@ void VideoEntry::clear() { loop = false; enabled = false; start = Audio::Timestamp(0, 1); - end = Audio::Timestamp(0xFFFFFFFF, 1); // Largest possible, there is an endOfVideo() check anyway filename.clear(); id = -1; } bool VideoEntry::endOfVideo() { - return !video || video->endOfVideo() || video->getTime() >= (uint)end.msecs(); + return !video || video->endOfVideo(); } VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) { @@ -207,7 +207,7 @@ bool VideoManager::updateMovies() { // Remove any videos that are over if (_videoStreams[i].endOfVideo()) { if (_videoStreams[i].loop) { - _videoStreams[i]->seekToTime(_videoStreams[i].start); + _videoStreams[i]->seek(_videoStreams[i].start); } else { // Check the video time one last time before deleting it _vm->doVideoTimer(i, true); @@ -239,7 +239,7 @@ bool VideoManager::updateMovies() { frame = convertedFrame; } else if (pixelFormat.bytesPerPixel == 1 && _videoStreams[i]->hasDirtyPalette()) { // Set the palette when running in 8bpp mode only - _videoStreams[i]->setSystemPalette(); + _vm->_system->getPaletteManager()->setPalette(_videoStreams[i]->getPalette(), 0, 256); } // Clip the width/height to make sure we stay on the screen (Myst does this a few times) @@ -394,6 +394,8 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool entry.loop = loop; entry.enabled = true; + entry->start(); + // Search for any deleted videos so we can take a formerly used slot for (uint32 i = 0; i < _videoStreams.size(); i++) if (!_videoStreams[i].video) { @@ -430,6 +432,7 @@ VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint entry->loadStream(file); entry->setVolume(volume); + entry->start(); // Search for any deleted videos so we can take a formerly used slot for (uint32 i = 0; i < _videoStreams.size(); i++) @@ -492,7 +495,7 @@ uint32 VideoManager::getTime(VideoHandle handle) { uint32 VideoManager::getDuration(VideoHandle handle) { assert(handle != NULL_VID_HANDLE); - return _videoStreams[handle]->getDuration(); + return _videoStreams[handle]->getDuration().msecs(); } bool VideoManager::endOfVideo(VideoHandle handle) { @@ -511,14 +514,13 @@ bool VideoManager::isVideoPlaying() { void VideoManager::setVideoBounds(VideoHandle handle, Audio::Timestamp start, Audio::Timestamp end) { assert(handle != NULL_VID_HANDLE); _videoStreams[handle].start = start; - _videoStreams[handle].end = end; - _videoStreams[handle]->seekToTime(start); + _videoStreams[handle]->setEndTime(end); + _videoStreams[handle]->seek(start); } void VideoManager::drawVideoFrame(VideoHandle handle, Audio::Timestamp time) { assert(handle != NULL_VID_HANDLE); - _videoStreams[handle].end = Audio::Timestamp(0xffffffff, 1); - _videoStreams[handle]->seekToTime(time); + _videoStreams[handle]->seek(time); updateMovies(); delete _videoStreams[handle].video; _videoStreams[handle].clear(); @@ -526,7 +528,7 @@ void VideoManager::drawVideoFrame(VideoHandle handle, Audio::Timestamp time) { void VideoManager::seekToTime(VideoHandle handle, Audio::Timestamp time) { assert(handle != NULL_VID_HANDLE); - _videoStreams[handle]->seekToTime(time); + _videoStreams[handle]->seek(time); } void VideoManager::setVideoLooping(VideoHandle handle, bool loop) { diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h index 98bcadfb5354..9dddcde09b64 100644 --- a/engines/mohawk/video.h +++ b/engines/mohawk/video.h @@ -45,19 +45,19 @@ struct MLSTRecord { struct VideoEntry { // Playback variables - Video::SeekableVideoDecoder *video; + Video::VideoDecoder *video; uint16 x; uint16 y; bool loop; bool enabled; - Audio::Timestamp start, end; + Audio::Timestamp start; // Identification Common::String filename; // External video files int id; // Internal Mohawk files // Helper functions - Video::SeekableVideoDecoder *operator->() const { assert(video); return video; } // TODO: Remove this eventually + Video::VideoDecoder *operator->() const { assert(video); return video; } // TODO: Remove this eventually void clear(); bool endOfVideo(); }; diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 5e39c893db53..ee981a2c7d54 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -617,7 +617,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { } } - delete []shadow; + delete[] shadow; delete stream; } diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 839b2c6834d2..8d4afd6847f4 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -832,7 +832,7 @@ void AmigaDisk_ns::decodeCnv(byte *data, uint16 numFrames, uint16 width, uint16 assert(buf); stream->read(buf, rawsize); unpackBitmap(data, buf, numFrames, bytesPerPlane, height); - delete []buf; + delete[] buf; } #undef NUM_PLANES diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 6868505c52db..9855830478f1 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -766,7 +766,7 @@ Gfx::~Gfx() { freeLabels(); - delete []_unpackedBitmap; + delete[] _unpackedBitmap; return; } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index b43dd193b5e4..f8cb4b3647f7 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -144,7 +144,7 @@ struct Cnv : public Frames { ~Cnv() { if (_freeData) - delete []_data; + delete[] _data; } byte* getFramePtr(uint16 index) { diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp index 3cc25b36b0b7..dcc71e4f2f36 100644 --- a/engines/parallaction/sound_ns.cpp +++ b/engines/parallaction/sound_ns.cpp @@ -237,7 +237,7 @@ AmigaSoundMan_ns::~AmigaSoundMan_ns() { stopSfx(2); stopSfx(3); - delete []beepSoundBuffer; + delete[] beepSoundBuffer; } Audio::AudioStream *AmigaSoundMan_ns::loadChannelData(const char *filename, Channel *ch, bool looping) { diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp index 5d393de49284..fc722e5043ea 100644 --- a/engines/pegasus/movie.cpp +++ b/engines/pegasus/movie.cpp @@ -73,8 +73,6 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent) error("Could not load video '%s'", fileName.c_str()); } - _video->pauseVideo(true); - Common::Rect bounds(0, 0, _video->getWidth(), _video->getHeight()); sizeElement(_video->getWidth(), _video->getHeight()); _movieBox = bounds; @@ -83,7 +81,7 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent) allocateSurface(bounds); setStart(0, getScale()); - setStop(_video->getDuration() * getScale() / 1000, getScale()); + setStop(_video->getDuration().convertToFramerate(getScale()).totalNumberOfFrames(), getScale()); } void Movie::redrawMovieWorld() { @@ -149,7 +147,7 @@ void Movie::setTime(const TimeValue time, const TimeScale scale) { else if (timeFrac >= Common::Rational(_stopTime, _stopScale)) return; - _video->seekToTime(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator())); + _video->seek(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator())); _time = timeFrac; _lastMillis = 0; } @@ -166,15 +164,15 @@ void Movie::setRate(const Common::Rational rate) { } void Movie::start() { - if (_video && _video->isPaused()) - _video->pauseVideo(false); + if (_video) + _video->start(); TimeBase::start(); } void Movie::stop() { - if (_video && !_video->isPaused()) - _video->pauseVideo(true); + if (_video) + _video->stop(); TimeBase::stop(); } @@ -199,7 +197,7 @@ TimeValue Movie::getDuration(const TimeScale scale) const { // but the problem is that too much code requires this function to behave this way... if (_video) - return _video->getDuration() * ((scale == 0) ? getScale() : scale) / 1000; + return _video->getDuration().convertToFramerate(((scale == 0) ? getScale() : scale)).totalNumberOfFrames(); return 0; } diff --git a/engines/pegasus/movie.h b/engines/pegasus/movie.h index 593442fa447d..efe4a7c24420 100644 --- a/engines/pegasus/movie.h +++ b/engines/pegasus/movie.h @@ -32,7 +32,7 @@ #include "pegasus/surface.h" namespace Video { - class SeekableVideoDecoder; +class VideoDecoder; } namespace Pegasus { @@ -65,13 +65,13 @@ class Movie : public Animation, public PixelImage { virtual TimeValue getDuration(const TimeScale = 0) const; // *** HACK ALERT - Video::SeekableVideoDecoder *getMovie() { return _video; } + Video::VideoDecoder *getMovie() { return _video; } void setVolume(uint16); protected: void updateTime(); - Video::SeekableVideoDecoder *_video; + Video::VideoDecoder *_video; Common::Rect _movieBox; }; diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index ce62b17265fd..a6806d5c4668 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -205,13 +205,11 @@ void Caldoria::start() { error("Could not load pullback movie"); // Draw the first frame so we can fade to it - pullbackMovie->pauseVideo(true); const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); assert(frame); assert(frame->format == g_system->getScreenFormat()); g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h); _vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond); - pullbackMovie->pauseVideo(false); bool saveAllowed = _vm->swapSaveAllowed(false); bool openAllowed = _vm->swapLoadAllowed(false); @@ -219,6 +217,8 @@ void Caldoria::start() { bool skipped = false; Input input; + pullbackMovie->start(); + while (!_vm->shouldQuit() && !pullbackMovie->endOfVideo()) { if (pullbackMovie->needsUpdate()) { frame = pullbackMovie->decodeNextFrame(); diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp index c950a8589777..816a13f01df4 100644 --- a/engines/pegasus/neighborhood/mars/mars.cpp +++ b/engines/pegasus/neighborhood/mars/mars.cpp @@ -2405,6 +2405,8 @@ void Mars::doCanyonChase() { if (!video->loadFile("Images/Mars/M44ESA.movie")) error("Could not load interface->shuttle transition video"); + video->start(); + while (!_vm->shouldQuit() && !video->endOfVideo()) { if (video->needsUpdate()) { const Graphics::Surface *frame = video->decodeNextFrame(); @@ -3024,6 +3026,8 @@ void Mars::transportToRobotShip() { if (!video->loadFile("Images/Mars/M98EAE.movie")) error("Could not load shuttle->interface transition video"); + video->start(); + while (!_vm->shouldQuit() && !video->endOfVideo()) { if (video->needsUpdate()) { const Graphics::Surface *frame = video->decodeNextFrame(); diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 0e426a294314..bbe2e0e21220 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -289,8 +289,10 @@ void PegasusEngine::runIntro() { bool skipped = false; - Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder(); + Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) { + video->start(); + while (!shouldQuit() && !video->endOfVideo() && !skipped) { if (video->needsUpdate()) { const Graphics::Surface *frame = video->decodeNextFrame(); @@ -320,7 +322,8 @@ void PegasusEngine::runIntro() { if (!video->loadFile(_introDirectory + "/Big Movie.movie")) error("Could not load intro movie"); - video->seekToTime(Audio::Timestamp(0, 10 * 600, 600)); + video->seek(Audio::Timestamp(0, 10 * 600, 600)); + video->start(); playMovieScaled(video, 0, 0); @@ -671,13 +674,14 @@ void PegasusEngine::introTimerExpired() { bool skipped = false; - Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder(); + Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (!video->loadFile(_introDirectory + "/LilMovie.movie")) error("Failed to load little movie"); bool saveAllowed = swapSaveAllowed(false); bool openAllowed = swapLoadAllowed(false); + video->start(); skipped = playMovieScaled(video, 0, 0); delete video; @@ -815,13 +819,14 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) { _gfx->clearScreen(); _gfx->updateDisplay(); - Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder(); + Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (!video->loadFile(_introDirectory + "/Closing.movie")) error("Could not load closing movie"); uint16 x = (640 - video->getWidth() * 2) / 2; uint16 y = (480 - video->getHeight() * 2) / 2; + video->start(); playMovieScaled(video, x, y); delete video; @@ -1261,7 +1266,7 @@ void PegasusEngine::checkFlashlight() { _neighborhood->checkFlashlight(); } -bool PegasusEngine::playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y) { +bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y) { bool skipped = false; while (!shouldQuit() && !video->endOfVideo() && !skipped) { @@ -2084,10 +2089,12 @@ void PegasusEngine::playEndMessage() { void PegasusEngine::doSubChase() { static const uint32 endTime = 133200 * 1000 / 600; - Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder(); + Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (!video->loadFile("Images/Norad Alpha/Sub Chase Movie")) error("Failed to load sub chase"); + video->start(); + while (!shouldQuit() && !video->endOfVideo() && video->getTime() < endTime) { if (video->needsUpdate()) { const Graphics::Surface *frame = video->decodeNextFrame(); diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h index a1b4cff9abc4..1ee0136c30f0 100644 --- a/engines/pegasus/pegasus.h +++ b/engines/pegasus/pegasus.h @@ -50,7 +50,7 @@ namespace Common { } namespace Video { - class SeekableVideoDecoder; + class VideoDecoder; } namespace Pegasus { @@ -253,7 +253,7 @@ friend class InputHandler; Hotspot _returnHotspot; InputHandler *_savedHandler; void showTempScreen(const Common::String &fileName); - bool playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y); + bool playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y); void throwAwayEverything(); void shellGameInput(const Input &input, const Hotspot *cursorSpot); Common::RandomSource *_rnd; diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp index 897305f2a3d3..343bc415f31a 100644 --- a/engines/pegasus/surface.cpp +++ b/engines/pegasus/surface.cpp @@ -108,8 +108,8 @@ void Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) { _bounds = Common::Rect(0, 0, _surface->w, _surface->h); } -void Surface::getImageFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time) { - video->seekToTime(Audio::Timestamp(0, time, 600)); +void Surface::getImageFromMovieFrame(Video::VideoDecoder *video, TimeValue time) { + video->seek(Audio::Timestamp(0, time, 600)); const Graphics::Surface *frame = video->decodeNextFrame(); if (frame) { @@ -344,7 +344,7 @@ void Frame::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool _transparent = transparent; } -void Frame::initFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time, bool transparent) { +void Frame::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) { getImageFromMovieFrame(video, time); _transparent = transparent; } @@ -381,7 +381,7 @@ void Picture::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bo sizeElement(surfaceBounds.width(), surfaceBounds.height()); } -void Picture::initFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time, bool transparent) { +void Picture::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) { Frame::initFromMovieFrame(video, time, transparent); Common::Rect surfaceBounds; diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 34a88dbd53af..311fb5041910 100644 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -41,7 +41,7 @@ namespace Graphics { } namespace Video { - class SeekableVideoDecoder; + class VideoDecoder; } namespace Pegasus { @@ -76,7 +76,7 @@ class Surface { virtual void getImageFromPICTFile(const Common::String &fileName); virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id); - virtual void getImageFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue); + virtual void getImageFromMovieFrame(Video::VideoDecoder *, TimeValue); protected: bool _ownsSurface; @@ -110,7 +110,7 @@ class Frame : public PixelImage { virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); - virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false); + virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false); }; class SpriteFrame : public Frame { @@ -130,7 +130,7 @@ class Picture : public DisplayElement, public Frame { virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); - virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false); + virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false); virtual void draw(const Common::Rect &); }; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 3acc87b85604..f3b183c84f88 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -56,8 +56,8 @@ static const PlainGameDescriptor queenGameDescriptor = { }; static const ExtraGuiOption queenExtraGuiOption = { - _s("Floppy intro"), - _s("Use the floppy version's intro (CD version only)"), + _s("Alternative intro"), + _s("Use an alternative game intro (CD version only)"), "alt_intro", false }; diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index d39ec34cc829..9c178559f2b8 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -252,9 +252,6 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s debug(0, "Save is for: %s", title); } - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - if (version >= 6) { Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in); desc.setThumbnail(thumbnail); diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp index b6470370af45..260eca98e641 100644 --- a/engines/saga/introproc_saga2.cpp +++ b/engines/saga/introproc_saga2.cpp @@ -32,6 +32,7 @@ #include "common/keyboard.h" #include "common/system.h" #include "common/textconsole.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "video/smk_decoder.h" @@ -92,7 +93,7 @@ int Scene::FTA2EndProc(FTA2Endings whichEnding) { } void Scene::playMovie(const char *filename) { - Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(_vm->_mixer); + Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(); if (!smkDecoder->loadFile(filename)) return; @@ -101,6 +102,8 @@ void Scene::playMovie(const char *filename) { uint16 y = (g_system->getHeight() - smkDecoder->getHeight()) / 2; bool skipVideo = false; + smkDecoder->start(); + while (!_vm->shouldQuit() && !smkDecoder->endOfVideo() && !skipVideo) { if (smkDecoder->needsUpdate()) { const Graphics::Surface *frame = smkDecoder->decodeNextFrame(); @@ -108,7 +111,7 @@ void Scene::playMovie(const char *filename) { _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); if (smkDecoder->hasDirtyPalette()) - smkDecoder->setSystemPalette(); + _vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256); _vm->_system->updateScreen(); } diff --git a/engines/saga/shorten.cpp b/engines/saga/shorten.cpp index 5efc8d1f6731..69c27b6a6bad 100644 --- a/engines/saga/shorten.cpp +++ b/engines/saga/shorten.cpp @@ -519,9 +519,6 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by if (maxLPC > 0) free(lpc); - if (size > 0) - free(unpackedBuffer); - delete gReader; return unpackedBuffer; } diff --git a/engines/savestate.h b/engines/savestate.h index 6cbdb22edf15..c23355465749 100644 --- a/engines/savestate.h +++ b/engines/savestate.h @@ -40,6 +40,8 @@ struct Surface; * * Further possibilites are a thumbnail, play time, creation date, * creation time, delete protected, write protection. + * + * Saves are writable and deletable by default. */ class SaveStateDescriptor { public: diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 40a6fd14152e..1889d53480b2 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -250,20 +250,18 @@ void Console::postEnter() { #endif if (_videoFile.hasSuffix(".seq")) { - SeqDecoder *seqDecoder = new SeqDecoder(); - seqDecoder->setFrameDelay(_videoFrameDelay); - videoDecoder = seqDecoder; + videoDecoder = new SEQDecoder(_videoFrameDelay); #ifdef ENABLE_SCI32 } else if (_videoFile.hasSuffix(".vmd")) { - videoDecoder = new Video::VMDDecoder(g_system->getMixer()); + videoDecoder = new Video::AdvancedVMDDecoder(); } else if (_videoFile.hasSuffix(".rbt")) { - videoDecoder = new RobotDecoder(g_system->getMixer(), _engine->getPlatform() == Common::kPlatformMacintosh); + videoDecoder = new RobotDecoder(_engine->getPlatform() == Common::kPlatformMacintosh); } else if (_videoFile.hasSuffix(".duk")) { duckMode = true; - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); #endif } else if (_videoFile.hasSuffix(".avi")) { - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); } else { warning("Unrecognized video type"); } @@ -2987,8 +2985,9 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { // Ignore specific leftover scripts, which require other non-existing scripts if ((_engine->getGameId() == GID_HOYLE3 && itr->getNumber() == 995) || (_engine->getGameId() == GID_KQ5 && itr->getNumber() == 980) || - (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947) || - (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980)) { + (_engine->getGameId() == GID_KQ7 && itr->getNumber() == 111) || + (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980) || + (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947)) { continue; } diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 78df3065b2ea..58ac5f1fa66f 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -397,8 +397,8 @@ static const ADExtraGuiOptionsMap optionsList[] = { { GAMEOPTION_FB01_MIDI, { - _s("Use IMF/Yahama FB-01 for MIDI output"), - _s("Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI output"), + _s("Use IMF/Yamaha FB-01 for MIDI output"), + _s("Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI output"), "native_fb01", false } @@ -762,9 +762,6 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in); desc.setThumbnail(thumbnail); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - int day = (meta.saveDate >> 24) & 0xFF; int month = (meta.saveDate >> 16) & 0xFF; int year = meta.saveDate & 0xFFFF; diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index 9872973e09b9..b978f40aba97 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -1238,6 +1238,24 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 5 - English DOS Floppy + // VERSION file reports "0.000.051" + // Supplied by misterhands in bug report #3536863. + // This is the original English version, which has been externally patched to + // Polish in the Polish release below. + {"kq5", "", { + {"resource.map", 0, "70010c20138541f89013bb5e1b30f16a", 7998}, + {"resource.000", 0, "a591bd4b879fc832b8095c0b3befe9e2", 276398}, + {"resource.001", 0, "c0f48d4a7ebeaa6aa074fc98d77423e9", 1018560}, + {"resource.002", 0, "7f188a95acdb60bbe32a8379ba299393", 1307048}, + {"resource.003", 0, "0860785af59518b94d54718dddcd6907", 1348500}, + {"resource.004", 0, "c4745dd1e261c22daa6477961d08bf6c", 1239887}, + {"resource.005", 0, "6556ff8e7c4d1acf6a78aea154daa76c", 1287869}, + {"resource.006", 0, "da82e4beb744731d0a151f1d4922fafa", 1170456}, + {"resource.007", 0, "431def14ca29cdb5e6a5e84d3f38f679", 1240176}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 5 - English DOS Floppy (supplied by omer_mor in bug report #3036996) // VERSION file reports "0.000.051" {"kq5", "", { @@ -1308,6 +1326,21 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 5 DOS Spanish Floppy 0.000.062 VGA (5 x 3.5" disks) + // Supplied by dianiu in bug report #3555646 + {"kq5", "", { + {"resource.map", 0, "c09896a2a30c9b002c5cbbc62f5a5c3a", 8169}, + {"resource.000", 0, "1f1d03aead44da46362ff40c0074a3ec", 335871}, + {"resource.001", 0, "d1803ad904127ae091edb274ee8c047f", 1180637}, + {"resource.002", 0, "d9cd5972016f650cc31fb7c2a2b0953a", 1102207}, + {"resource.003", 0, "829c8caeff793f3cfcea2cb01aaa4150", 965586}, + {"resource.004", 0, "0bd9e570ee04b025e43d3075998fae5b", 1117965}, + {"resource.005", 0, "4aaa2e9a69089b9afbaaccbbf2c4e647", 1202936}, + {"resource.006", 0, "65b520e60c4217e6a6572d9edf77193b", 1141985}, + {"resource.007", 0, "f42b0100f0a1c30806814f8648b6bc28", 1145583}, + AD_LISTEND}, + Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 5 - German DOS Floppy (supplied by markcoolio in bug report #2727101, also includes english language) // SCI interpreter version 1.000.060 {"kq5", "", { @@ -1354,8 +1387,10 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, - // King's Quest 5 - Polish DOS Floppy (supplied by jacek909 in bug report #2725722, includes english language?!) + // King's Quest 5 - Polish DOS Floppy (supplied by jacek909 in bug report #2725722) // SCI interpreter version 1.000.060 + // VERSION file reports "0.000.051". + // This is actually an English version with external text resource patches (bug #3536863). {"kq5", "", { {"resource.map", 0, "70010c20138541f89013bb5e1b30f16a", 7998}, {"resource.000", 0, "a591bd4b879fc832b8095c0b3befe9e2", 276398}, @@ -1366,6 +1401,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.005", 0, "6556ff8e7c4d1acf6a78aea154daa76c", 1287869}, {"resource.006", 0, "da82e4beb744731d0a151f1d4922fafa", 1170456}, {"resource.007", 0, "431def14ca29cdb5e6a5e84d3f38f679", 1240176}, + {"text.000", 0, "601aa35a3ddeb558e1280e0963e955a2", 1517}, AD_LISTEND}, Common::PL_POL, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, @@ -1447,6 +1483,16 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 6 - Spanish DOS Floppy (from jvprat) + // Executable scanning reports "1.cfs.158", VERSION file reports "1.000.000, July 5, 1994" + // SCI interpreter version 1.001.055 + {"kq6", "", { + {"resource.map", 0, "a73a5ab04b8f60c4b75b946a4dccea5a", 8953}, + {"resource.000", 0, "4da3ad5868a775549a7cc4f72770a58e", 8537260}, + {"resource.msg", 0, "41eed2d3893e1ca6c3695deba4e9d2e8", 267102}, + AD_LISTEND}, + Common::ES_ESP, Common::kPlatformPC, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // King's Quest 6 - English DOS CD (from the King's Quest Collection) // Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G" // SCI interpreter version 1.001.054 @@ -1465,16 +1511,6 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO5(GUIO_NOASPECT, GAMEOPTION_KQ6_WINDOWS_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, - // King's Quest 6 - Spanish DOS CD (from jvprat) - // Executable scanning reports "1.cfs.158", VERSION file reports "1.000.000, July 5, 1994" - // SCI interpreter version 1.001.055 - {"kq6", "CD", { - {"resource.map", 0, "a73a5ab04b8f60c4b75b946a4dccea5a", 8953}, - {"resource.000", 0, "4da3ad5868a775549a7cc4f72770a58e", 8537260}, - {"resource.msg", 0, "41eed2d3893e1ca6c3695deba4e9d2e8", 267102}, - AD_LISTEND}, - Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO3(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, - // King's Quest 6 - English Macintosh Floppy // VERSION file reports "1.0" {"kq6", "", { @@ -2660,6 +2696,13 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Police Quest 3 - Spanish DOS v1.000 - Supplied by dianiu in bug report #3555647 + {"pq3", "", { + {"resource.map", 0, "ffa0b4631c4e36d69631256d19ba29e7", 5421}, + {"resource.000", 0, "5ee460af3d70c06a745cc482b6c783ba", 5410263}, + AD_LISTEND}, + Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Police Quest 3 EGA // Reported by musiclyinspired in bug report #3046573 {"pq3", "", { @@ -2777,6 +2820,31 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy v1.102 Int#0.000.629 (suppled by digitoxin1 in bug report #3554611) + {"qfg1", "", { + {"resource.map", 0, "b162dbd4632250d4d83bed46d0783c10", 6396}, + {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800}, + {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 459835}, + {"resource.002", 0, "e64004e020fdf1813be52b639b08be89", 635561}, + {"resource.003", 0, "f0af87c60ec869946da442833aa5afa8", 640502}, + {"resource.004", 0, "f0af87c60ec869946da442833aa5afa8", 644575}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + + // Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy v1.102 Int#0.000.629 (suppled by digitoxin1 in bug report #3554611) + {"qfg1", "", { + {"resource.map", 0, "5772a2c1bfae46f26582582c9901121e", 6858}, + {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800}, + {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 75090}, + {"resource.002", 0, "d22695c53835dfdece056d86f26c251e", 271354}, + {"resource.003", 0, "3cd085e27078f269b3ece5838812ff41", 258084}, + {"resource.004", 0, "8927c7a04a78f1e76f342db3ccc9d879", 267835}, + {"resource.005", 0, "13d16cc9b90b51e2c8643cdf52a62957", 268807}, + {"resource.006", 0, "48b2b3c964dcbeccb68e984e6d4e97db", 278473}, + {"resource.007", 0, "f0af87c60ec869946da442833aa5afa8", 269237}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by markcoolio in bug report #2723843) // Executable scanning reports "0.000.566" {"qfg1", "", { @@ -2864,17 +2932,6 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, - // Quest for Glory 1 (from abevi, bug report #2612718) - {"qfg1", "", { - {"resource.map", 0, "b162dbd4632250d4d83bed46d0783c10", 6396}, - {"resource.000", 0, "40332d3ebfc70a4b6a6a0443c2763287", 78800}, - {"resource.001", 0, "a270012fa74445d74c044d1b65a9ff8c", 459835}, - {"resource.002", 0, "e64004e020fdf1813be52b639b08be89", 635561}, - {"resource.003", 0, "f0af87c60ec869946da442833aa5afa8", 640502}, - {"resource.004", 0, "f0af87c60ec869946da442833aa5afa8", 644575}, - AD_LISTEND}, - Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, - // Quest for Glory 1 - English DOS // SCI interpreter version 0.000.629 {"qfg1", "", { @@ -2981,6 +3038,21 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Quest for Glory 2 - English DOS (supplied by digitoxin1 in bug report #3554614) + // v1.102 9x3.5" (label: Int#11.20.90) + {"qfg2", "", { + {"resource.map", 0, "367023314ea33e3156297402f6c1da49", 8166}, + {"resource.000", 0, "a17e374c4d33b81208c862bc0ffc1a38", 212119}, + {"resource.001", 0, "e08d7887e30b12008c40f9570447711a", 331995}, + {"resource.002", 0, "df137dc7869cab07e1149ba2333c815c", 467461}, + {"resource.003", 0, "df137dc7869cab07e1149ba2333c815c", 502560}, + {"resource.004", 0, "df137dc7869cab07e1149ba2333c815c", 488532}, + {"resource.005", 0, "df137dc7869cab07e1149ba2333c815c", 478574}, + {"resource.006", 0, "b1944bd664ddbd2859cdaa0c4a0d6281", 507489}, + {"resource.007", 0, "cd2de58e27665d5853530de93fae7cd6", 490794}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformPC, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + // Quest for Glory 2 - English DOS Non-Interactive Demo // Executable scanning reports "1.000.046" {"qfg2", "Demo", { @@ -3536,7 +3608,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054}, {"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO1(GAMEOPTION_SQ4_SILVER_CURSORS) }, + Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO5(GUIO_MIDIGM, GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Space Quest 4 - English Windows CD (from the Space Quest Collection) // Executable scanning reports "1.001.064", VERSION file reports "1.0" diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp index 0d575f97dd29..a0f7ebf4a28e 100644 --- a/engines/sci/engine/file.cpp +++ b/engines/sci/engine/file.cpp @@ -57,11 +57,24 @@ namespace Sci { reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) { Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH); + englishName.toLowercase(); + Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName; Common::SeekableReadStream *inFile = 0; Common::WriteStream *outFile = 0; Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager(); + bool isCompressed = true; + const SciGameId gameId = g_sci->getGameId(); + if ((gameId == GID_QFG1 || gameId == GID_QFG1VGA || gameId == GID_QFG2 || gameId == GID_QFG3) + && englishName.hasSuffix(".sav")) { + // QFG Characters are saved via the CharSave object. + // We leave them uncompressed so that they can be imported in later QFG + // games. + // Rooms/Scripts: QFG1: 601, QFG2: 840, QFG3/4: 52 + isCompressed = false; + } + if (mode == _K_FILE_MODE_OPEN_OR_FAIL) { // Try to open file, abort if not possible inFile = saveFileMan->openForLoading(wrappedName); @@ -74,12 +87,12 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str()); } else if (mode == _K_FILE_MODE_CREATE) { // Create the file, destroying any content it might have had - outFile = saveFileMan->openForSaving(wrappedName); + outFile = saveFileMan->openForSaving(wrappedName, isCompressed); if (!outFile) debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str()); } else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) { // Try to open file, create it if it doesn't exist - outFile = saveFileMan->openForSaving(wrappedName); + outFile = saveFileMan->openForSaving(wrappedName, isCompressed); if (!outFile) debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_CREATE): failed to create file '%s'", englishName.c_str()); diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index c8fe47d9fce3..46051ef1456c 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -757,13 +757,26 @@ bool Kernel::debugSetFunction(const char *kernelName, int logging, int breakpoin return true; } -void Kernel::setDefaultKernelNames(GameFeatures *features) { - _kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames)); +#ifdef ENABLE_SCI32 +enum { + kKernelEntriesSci2 = 0x8b, + kKernelEntriesGk2Demo = 0xa0, + kKernelEntriesSci21 = 0x9d, + kKernelEntriesSci3 = 0xa1 +}; +#endif + +void Kernel::loadKernelNames(GameFeatures *features) { + _kernelNames.clear(); - // Some (later) SCI versions replaced CanBeHere by CantBeHere - // If vocab.999 exists, the kernel function is still named CanBeHere - if (_selectorCache.cantBeHere != -1) - _kernelNames[0x4d] = "CantBeHere"; + if (getSciVersion() <= SCI_VERSION_1_1) { + _kernelNames = Common::StringArray(s_defaultKernelNames, ARRAYSIZE(s_defaultKernelNames)); + + // Some (later) SCI versions replaced CanBeHere by CantBeHere + // If vocab.999 exists, the kernel function is still named CanBeHere + if (_selectorCache.cantBeHere != -1) + _kernelNames[0x4d] = "CantBeHere"; + } switch (getSciVersion()) { case SCI_VERSION_0_EARLY: @@ -817,66 +830,60 @@ void Kernel::setDefaultKernelNames(GameFeatures *features) { _kernelNames[0x7c] = "Message"; break; - default: - // Use default table for the other versions - break; - } -} - #ifdef ENABLE_SCI32 + case SCI_VERSION_2: + _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2); + break; -enum { - kKernelEntriesSci2 = 0x8b, - kKernelEntriesGk2Demo = 0xa0, - kKernelEntriesSci21 = 0x9d, - kKernelEntriesSci3 = 0xa1 -}; - -void Kernel::setKernelNamesSci2() { - _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2); -} + case SCI_VERSION_2_1: + if (features->detectSci21KernelType() == SCI_VERSION_2) { + // Some early SCI2.1 games use a modified SCI2 kernel table instead of + // the SCI2.1 kernel table. We detect which version to use based on + // how kDoSound is called from Sound::play(). + // Known games that use this: + // GK2 demo + // KQ7 1.4 + // PQ4 SWAT demo + // LSL6 + // PQ4CD + // QFG4CD + + // This is interesting because they all have the same interpreter + // version (2.100.002), yet they would not be compatible with other + // games of the same interpreter. + + _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo); + // OnMe is IsOnMe here, but they should be compatible + _kernelNames[0x23] = "Robot"; // Graph in SCI2 + _kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2 + } else { + // Normal SCI2.1 kernel table + _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21); + } + break; -void Kernel::setKernelNamesSci21(GameFeatures *features) { - // Some SCI games use a modified SCI2 kernel table instead of the - // SCI2.1 kernel table. We detect which version to use based on - // how kDoSound is called from Sound::play(). - // Known games that use this: - // GK2 demo - // KQ7 1.4 - // PQ4 SWAT demo - // LSL6 - // PQ4CD - // QFG4CD - - // This is interesting because they all have the same interpreter - // version (2.100.002), yet they would not be compatible with other - // games of the same interpreter. - - if (getSciVersion() != SCI_VERSION_3 && features->detectSci21KernelType() == SCI_VERSION_2) { - _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo); - // OnMe is IsOnMe here, but they should be compatible - _kernelNames[0x23] = "Robot"; // Graph in SCI2 - _kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2 - } else if (getSciVersion() != SCI_VERSION_3) { - _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21); - } else if (getSciVersion() == SCI_VERSION_3) { + case SCI_VERSION_3: _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci3); - } -} -#endif - -void Kernel::loadKernelNames(GameFeatures *features) { - _kernelNames.clear(); + // In SCI3, some kernel functions have been removed, and others have been added + _kernelNames[0x18] = "Dummy"; // AddMagnify in SCI2.1 + _kernelNames[0x19] = "Dummy"; // DeleteMagnify in SCI2.1 + _kernelNames[0x30] = "Dummy"; // SetScroll in SCI2.1 + _kernelNames[0x39] = "Dummy"; // ShowMovie in SCI2.1 + _kernelNames[0x4c] = "Dummy"; // ScrollWindow in SCI2.1 + _kernelNames[0x56] = "Dummy"; // VibrateMouse in SCI2.1 (only used in QFG4 floppy) + _kernelNames[0x64] = "Dummy"; // AvoidPath in SCI2.1 + _kernelNames[0x66] = "Dummy"; // MergePoly in SCI2.1 + _kernelNames[0x8d] = "MessageBox"; // Dummy in SCI2.1 + _kernelNames[0x9b] = "Minimize"; // Dummy in SCI2.1 -#ifdef ENABLE_SCI32 - if (getSciVersion() >= SCI_VERSION_2_1) - setKernelNamesSci21(features); - else if (getSciVersion() == SCI_VERSION_2) - setKernelNamesSci2(); - else + break; #endif - setDefaultKernelNames(features); + + default: + // Use default table for the other versions + break; + } mapFunctions(); } diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 677b790f93ae..f985a69ebcc5 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -223,23 +223,6 @@ class Kernel { bool debugSetFunction(const char *kernelName, int logging, int breakpoint); private: - /** - * Sets the default kernel function names, based on the SCI version used. - */ - void setDefaultKernelNames(GameFeatures *features); - -#ifdef ENABLE_SCI32 - /** - * Sets the default kernel function names to the SCI2 kernel functions. - */ - void setKernelNamesSci2(); - - /** - * Sets the default kernel function names to the SCI2.1 kernel functions. - */ - void setKernelNamesSci21(GameFeatures *features); -#endif - /** * Loads the kernel selector names. */ @@ -429,6 +412,7 @@ reg_t kListAt(EngineState *s, int argc, reg_t *argv); reg_t kString(EngineState *s, int argc, reg_t *argv); reg_t kMulDiv(EngineState *s, int argc, reg_t *argv); reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv); +reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv); // "Screen items" in SCI32 are views reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv); reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv); @@ -453,6 +437,8 @@ reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv); reg_t kEditText(EngineState *s, int argc, reg_t *argv); reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv); reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv); +reg_t kSetScroll(EngineState *s, int argc, reg_t *argv); +reg_t kPalCycle(EngineState *s, int argc, reg_t *argv); // SCI2.1 Kernel Functions reg_t kText(EngineState *s, int argc, reg_t *argv); @@ -556,6 +542,7 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv); reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv); reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv); reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv); +reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv); #endif //@} diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 6965a5da45d5..f5f46285be2f 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -240,7 +240,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = { { SIG_SCI32, 16, MAP_CALL(FileIOWriteWord), "ii", NULL }, { SIG_SCI32, 17, MAP_CALL(FileIOCreateSaveSlot), "ir", NULL }, { SIG_SCI32, 18, MAP_EMPTY(FileIOChangeDirectory), "r", NULL }, // for SQ6, when changing the savegame directory in the save/load dialog - { SIG_SCI32, 19, MAP_CALL(Stub), "r", NULL }, // for Torin / Torin demo + { SIG_SCI32, 19, MAP_CALL(FileIOIsValidDirectory), "r", NULL }, // for Torin / Torin demo #endif SCI_SUBOPENTRY_TERMINATOR }; @@ -248,7 +248,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = { #ifdef ENABLE_SCI32 static const SciKernelMapSubEntry kSave_subops[] = { - { SIG_SCI32, 0, MAP_CALL(SaveGame), "[r0]i[r0](r)", NULL }, + { SIG_SCI32, 0, MAP_CALL(SaveGame), "[r0]i[r0](r0)", NULL }, { SIG_SCI32, 1, MAP_CALL(RestoreGame), "[r0]i[r0]", NULL }, { SIG_SCI32, 2, MAP_CALL(GetSaveDir), "(r*)", NULL }, { SIG_SCI32, 3, MAP_CALL(CheckSaveGame), ".*", NULL }, @@ -419,7 +419,10 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(PriCoord), SIG_EVERYWHERE, "i", NULL, NULL }, { MAP_CALL(Random), SIG_EVERYWHERE, "i(i)(i)", NULL, NULL }, { MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, NULL }, - { MAP_CALL(RemapColors), SIG_EVERYWHERE, "i(i)(i)(i)(i)(i)", NULL, NULL }, + { MAP_CALL(RemapColors), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, NULL }, +#ifdef ENABLE_SCI32 + { "RemapColors", kRemapColors32, SIG_SCI32, SIGFOR_ALL, "i(i)(i)(i)(i)(i)", NULL, NULL }, +#endif { MAP_CALL(ResCheck), SIG_EVERYWHERE, "ii(iiii)", NULL, NULL }, { MAP_CALL(RespondsTo), SIG_EVERYWHERE, ".i", NULL, NULL }, { MAP_CALL(RestartGame), SIG_EVERYWHERE, "", NULL, NULL }, @@ -517,11 +520,8 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(EditText), SIG_EVERYWHERE, "o", NULL, NULL }, { MAP_CALL(MakeSaveCatName), SIG_EVERYWHERE, "rr", NULL, NULL }, { MAP_CALL(MakeSaveFileName), SIG_EVERYWHERE, "rri", NULL, NULL }, - - // SCI2 unmapped functions - TODO! - - // SetScroll - called by script 64909, Styler::doit() - // PalCycle - called by Game::newRoom. Related to RemapColors. + { MAP_CALL(SetScroll), SIG_EVERYWHERE, "oiiiii(i)", NULL, NULL }, + { MAP_CALL(PalCycle), SIG_EVERYWHERE, "i(.*)", NULL, NULL }, // SCI2 Empty functions @@ -561,6 +561,11 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_DUMMY(InputText), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_DUMMY(TextWidth), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + // SetScroll is called by script 64909, Styler::doit(), but it doesn't seem to + // be used at all (plus, it was then changed to a dummy function in SCI3). + // Since this is most likely unused, and we got no test case, error out when + // it is called in order to find an actual call to it. + { MAP_DUMMY(SetScroll), SIG_EVERYWHERE, "(.*)", NULL, NULL }, // SCI2.1 Kernel Functions { MAP_CALL(CD), SIG_EVERYWHERE, "(.*)", NULL, NULL }, @@ -583,8 +588,8 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(Font), SIG_EVERYWHERE, "i(.*)", NULL, NULL }, { MAP_CALL(Bitmap), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_CALL(AddLine), SIG_EVERYWHERE, "oiiiiiiiii", NULL, NULL }, - { MAP_CALL(UpdateLine), SIG_EVERYWHERE, "roiiiiiiiii", NULL, NULL }, - { MAP_CALL(DeleteLine), SIG_EVERYWHERE, "ro", NULL, NULL }, + { MAP_CALL(UpdateLine), SIG_EVERYWHERE, "[r0]oiiiiiiiii", NULL, NULL }, + { MAP_CALL(DeleteLine), SIG_EVERYWHERE, "[r0]o", NULL, NULL }, // SCI2.1 Empty Functions @@ -629,11 +634,14 @@ static SciKernelMapEntry s_kernelMap[] = { // SCI2.1 unmapped functions - TODO! + // SetHotRectangles - used by Phantasmagoria 1, script 64981 (used in the chase scene) + // The idea, if I understand correctly, is that the engine generates events + // of a special HotRect type continuously when the mouse is on that rectangle + // MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons // SetPalStyleRange - 2 integer parameters, start and end. All styles from start-end // (inclusive) are set to 0 // MorphOn - used by SQ6, script 900, the datacorder reprogramming puzzle (from room 270) - // SetHotRectangles - used by Phantasmagoria 1 // SCI3 Kernel Functions { MAP_CALL(PlayDuck), SIG_EVERYWHERE, "(.*)", NULL, NULL }, @@ -828,7 +836,7 @@ static const char *const sci2_default_knames[] = { /*0x20*/ "AddMagnify", /*0x21*/ "DeleteMagnify", /*0x22*/ "IsHiRes", - /*0x23*/ "Graph", + /*0x23*/ "Graph", // Robot in early SCI2.1 games with a SCI2 kernel table /*0x24*/ "InvertRect", // only in SCI2, not used in any SCI2 game /*0x25*/ "TextSize", /*0x26*/ "Message", @@ -839,7 +847,7 @@ static const char *const sci2_default_knames[] = { /*0x2b*/ "EditText", /*0x2c*/ "InputText", // unused function /*0x2d*/ "CreateTextBitmap", - /*0x2e*/ "DisposeTextBitmap", + /*0x2e*/ "DisposeTextBitmap", // Priority in early SCI2.1 games with a SCI2 kernel table /*0x2f*/ "GetEvent", /*0x30*/ "GlobalToLocal", /*0x31*/ "LocalToGlobal", @@ -1099,7 +1107,7 @@ static const char *const sci21_default_knames[] = { /*0x8a*/ "LoadChunk", /*0x8b*/ "SetPalStyleRange", /*0x8c*/ "AddPicAt", - /*0x8d*/ "MessageBox", // SCI3, was Dummy in SCI2.1 + /*0x8d*/ "Dummy", // MessageBox in SCI3 /*0x8e*/ "NewRoom", // debug function /*0x8f*/ "Dummy", /*0x90*/ "Priority", @@ -1113,7 +1121,7 @@ static const char *const sci21_default_knames[] = { /*0x98*/ "GetWindowsOption", // Windows only /*0x99*/ "WinDLL", // Windows only /*0x9a*/ "Dummy", - /*0x9b*/ "Minimize", // SCI3, was Dummy in SCI2.1 + /*0x9b*/ "Dummy", // Minimize in SCI3 /*0x9c*/ "DeletePic", // == SCI3 only =============== /*0x9d*/ "Dummy", @@ -1127,57 +1135,73 @@ static const char *const sci21_default_knames[] = { // Base set of opcode formats. They're copied and adjusted slightly in // script_adjust_opcode_format depending on SCI version. static const opcode_format g_base_opcode_formats[128][4] = { - /*00*/ + // 00 - 03 / bnot, add, sub, mul {Script_None}, {Script_None}, {Script_None}, {Script_None}, - /*04*/ + // 04 - 07 / div, mod, shr, shl {Script_None}, {Script_None}, {Script_None}, {Script_None}, - /*08*/ + // 08 - 0B / xor, and, or, neg {Script_None}, {Script_None}, {Script_None}, {Script_None}, - /*0C*/ + // 0C - 0F / not, eq, ne, gt {Script_None}, {Script_None}, {Script_None}, {Script_None}, - /*10*/ + // 10 - 13 / ge, lt, le, ugt {Script_None}, {Script_None}, {Script_None}, {Script_None}, - /*14*/ + // 14 - 17 / uge, ult, ule, bt {Script_None}, {Script_None}, {Script_None}, {Script_SRelative}, - /*18*/ + // 18 - 1B / bnt, jmp, ldi, push {Script_SRelative}, {Script_SRelative}, {Script_SVariable}, {Script_None}, - /*1C*/ + // 1C - 1F / pushi, toss, dup, link {Script_SVariable}, {Script_None}, {Script_None}, {Script_Variable}, - /*20*/ + // 20 - 23 / call, callk, callb, calle {Script_SRelative, Script_Byte}, {Script_Variable, Script_Byte}, {Script_Variable, Script_Byte}, {Script_Variable, Script_SVariable, Script_Byte}, - /*24 (24=ret)*/ + // 24 - 27 / ret, send, dummy, dummy {Script_End}, {Script_Byte}, {Script_Invalid}, {Script_Invalid}, - /*28*/ + // 28 - 2B / class, dummy, self, super {Script_Variable}, {Script_Invalid}, {Script_Byte}, {Script_Variable, Script_Byte}, - /*2C*/ + // 2C - 2F / rest, lea, selfID, dummy {Script_SVariable}, {Script_SVariable, Script_Variable}, {Script_None}, {Script_Invalid}, - /*30*/ + // 30 - 33 / pprev, pToa, aTop, pTos {Script_None}, {Script_Property}, {Script_Property}, {Script_Property}, - /*34*/ + // 34 - 37 / sTop, ipToa, dpToa, ipTos {Script_Property}, {Script_Property}, {Script_Property}, {Script_Property}, - /*38*/ + // 38 - 3B / dpTos, lofsa, lofss, push0 {Script_Property}, {Script_SRelative}, {Script_SRelative}, {Script_None}, - /*3C*/ + // 3C - 3F / push1, push2, pushSelf, line {Script_None}, {Script_None}, {Script_None}, {Script_Word}, - /*40-4F*/ + // ------------------------------------------------------------------------ + // 40 - 43 / lag, lal, lat, lap {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 44 - 47 / lsg, lsl, lst, lsp {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 48 - 4B / lagi, lali, lati, lapi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 4C - 4F / lsgi, lsli, lsti, lspi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, - /*50-5F*/ + // ------------------------------------------------------------------------ + // 50 - 53 / sag, sal, sat, sap {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 54 - 57 / ssg, ssl, sst, ssp {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 58 - 5B / sagi, sali, sati, sapi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 5C - 5F / ssgi, ssli, ssti, sspi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, - /*60-6F*/ + // ------------------------------------------------------------------------ + // 60 - 63 / plusag, plusal, plusat, plusap {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 64 - 67 / plussg, plussl, plusst, plussp {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 68 - 6B / plusagi, plusali, plusati, plusapi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 6C - 6F / plussgi, plussli, plussti, plusspi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, - /*70-7F*/ + // ------------------------------------------------------------------------ + // 70 - 73 / minusag, minusal, minusat, minusap {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 74 - 77 / minussg, minussl, minusst, minussp {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 78 - 7B / minusagi, minusali, minusati, minusapi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param}, + // 7C - 7F / minussgi, minussli, minussti, minusspi {Script_Global}, {Script_Local}, {Script_Temp}, {Script_Param} }; #undef END diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index a21e19802d15..f7cc4f44b5dc 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -197,8 +197,15 @@ reg_t kCD(EngineState *s, int argc, reg_t *argv) { // TODO: Stub switch (argv[0].toUint16()) { case 0: - // Return whether the contents of disc argv[1] is available. - return TRUE_REG; + if (argc == 1) { + // Check if a disc is in the drive + return TRUE_REG; + } else { + // Check if the specified disc is in the drive + // and return the current disc number. We just + // return the requested disc number. + return argv[1]; + } case 1: // Return the current CD number return make_reg(0, 1); @@ -688,6 +695,13 @@ reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv) { return TRUE_REG; // slot creation was successful } +reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv) { + // Used in Torin's Passage and LSL7 to determine if the directory passed as + // a parameter (usually the save directory) is valid. We always return true + // here. + return TRUE_REG; +} + #endif // ---- Save operations ------------------------------------------------------- @@ -1002,7 +1016,7 @@ reg_t kAutoSave(EngineState *s, int argc, reg_t *argv) { // the elapsed time from the timer object) // This function has to return something other than 0 to proceed - return s->r_acc; + return TRUE_REG; } #endif diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 0ef268f1087f..da377319c060 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -645,6 +645,20 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) { if (paletteChanged) g_sci->_gfxPalette->kernelAnimateSet(); + // WORKAROUND: The game scripts in SQ4 floppy count the number of elapsed + // cycles in the intro from the number of successive kAnimate calls during + // the palette cycling effect, while showing the SQ4 logo. This worked in + // older computers because each animate call took awhile to complete. + // Normally, such scripts are handled automatically by our speed throttler, + // however in this case there are no calls to kGameIsRestarting (where the + // speed throttler gets called) between the different palette animation calls. + // Thus, we add a small delay between each animate call to make the whole + // palette animation effect slower and visible, and not have the logo screen + // get skipped because the scripts don't wait between animation steps. Fixes + // bug #3537232. + if (g_sci->getGameId() == GID_SQ4 && !g_sci->isCD() && s->currentRoomNumber() == 1) + g_sci->sleep(10); + return s->r_acc; } @@ -936,8 +950,9 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { } } if (objName == "savedHeros") { - // Import of QfG character files dialog is shown - // display additional popup information before letting user use it + // Import of QfG character files dialog is shown. + // Display additional popup information before letting user use it. + // For the SCI32 version of this, check kernelAddPlane(). reg_t changeDirButton = s->_segMan->findObjectByName("changeDirItem"); if (!changeDirButton.isNull()) { // check if checkDirButton is still enabled, in that case we are called the first time during that room @@ -950,6 +965,8 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { "for Quest for Glory 2. Example: 'qfg2-thief.sav'."); } } + + // For the SCI32 version of this, check kListAt(). s->_chosenQfGImportItem = readSelectorValue(s->_segMan, controlObject, SELECTOR(mark)); } @@ -1204,73 +1221,27 @@ reg_t kShow(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } +// Early variant of the SCI32 kRemapColors kernel function, used in the demo of QFG4 reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) { uint16 operation = argv[0].toUint16(); switch (operation) { - case 0: { // Set remapping to base. 0 turns remapping off. - int16 base = (argc >= 2) ? argv[1].toSint16() : 0; - if (base != 0) // 0 is the default behavior when changing rooms in GK1, thus silencing the warning - warning("kRemapColors: Set remapping to base %d", base); + case 0: { // remap by percent + uint16 percent = argv[1].toUint16(); + g_sci->_gfxPalette->resetRemapping(); + g_sci->_gfxPalette->setRemappingPercent(254, percent); } break; - case 1: { // unknown - // The demo of QFG4 calls this with 1+3 parameters, thus there are differences here - //int16 unk1 = argv[1].toSint16(); - //int16 unk2 = argv[2].toSint16(); - //int16 unk3 = argv[3].toSint16(); - //uint16 unk4 = argv[4].toUint16(); - //uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0; - kStub(s, argc, argv); + case 1: { // remap by range + uint16 from = argv[1].toUint16(); + uint16 to = argv[2].toUint16(); + uint16 base = argv[3].toUint16(); + g_sci->_gfxPalette->resetRemapping(); + g_sci->_gfxPalette->setRemappingRange(254, from, to, base); } break; - case 2: { // remap by percent - // This adjusts the alpha value of a specific color, and it operates on - // an RGBA palette. Since we're operating on an RGB palette, we just - // modify the color intensity instead - // TODO: From what I understand, palette remapping should be placed - // separately, so that it can be reset by case 0 above. Thus, we - // should adjust the functionality of the Palette class accordingly. - int16 color = argv[1].toSint16(); - if (color >= 10) - color -= 10; - uint16 percent = argv[2].toUint16(); // 0 - 100 - if (argc >= 4) - warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16()); - warning("kRemapColors: RemapByPercent color %d by %d percent", color, percent); - // TODO: It's not correct to set intensity here - //g_sci->_gfxPalette->kernelSetIntensity(color, 255, percent, false); - } - break; - case 3: { // remap to gray - // NOTE: This adjusts the alpha value of a specific color, and it operates on - // an RGBA palette - int16 color = argv[1].toSint16(); // this is subtracted from a maximum color value, and can be offset by 10 - int16 percent = argv[2].toSint16(); // 0 - 100 - uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0; - warning("kRemapColors: RemapToGray color %d by %d percent (unk3 = %d)", color, percent, unk3); - } - break; - case 4: { // unknown - //int16 unk1 = argv[1].toSint16(); - //uint16 unk2 = argv[2].toUint16(); - //uint16 unk3 = argv[3].toUint16(); - //uint16 unk4 = (argc >= 5) ? argv[4].toUint16() : 0; - kStub(s, argc, argv); - } - break; - case 5: { // set color intensity - // TODO: This isn't right, it should be setting a mapping table instead. - // For PQ4, we can emulate this with kernelSetIntensity(). In QFG4, this - // won't do. - //int16 mapping = argv[1].toSint16(); - uint16 intensity = argv[2].toUint16(); - // HACK for PQ4 - if (g_sci->getGameId() == GID_PQ4) - g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true); - - kStub(s, argc, argv); - } + case 2: // turn remapping off (unused) + error("Unused subop kRemapColors(2) has been called"); break; default: break; diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 413ad1ecb1c3..8b3afeef995a 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -39,6 +39,7 @@ #include "sci/graphics/cache.h" #include "sci/graphics/compare.h" #include "sci/graphics/controls16.h" +#include "sci/graphics/coordadjuster.h" #include "sci/graphics/cursor.h" #include "sci/graphics/palette.h" #include "sci/graphics/paint16.h" @@ -171,8 +172,13 @@ reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) { debugC(kDebugLevelStrings, "kCreateTextBitmap case 0 (%04x:%04x, %04x:%04x, %04x:%04x)", PRINT_REG(argv[1]), PRINT_REG(argv[2]), PRINT_REG(argv[3])); debugC(kDebugLevelStrings, "%s", text.c_str()); - uint16 maxWidth = argv[1].toUint16(); // nsRight - nsLeft + 1 - uint16 maxHeight = argv[2].toUint16(); // nsBottom - nsTop + 1 + int16 maxWidth = argv[1].toUint16(); + int16 maxHeight = argv[2].toUint16(); + g_sci->_gfxCoordAdjuster->fromScriptToDisplay(maxHeight, maxWidth); + // These values can be larger than the screen in the SQ6 demo, room 100 + // TODO: Find out why. For now, don't show any text in that room. + if (g_sci->getGameId() == GID_SQ6 && g_sci->isDemo() && s->currentRoomNumber() == 100) + return NULL_REG; return g_sci->_gfxText32->createTextBitmap(object, maxWidth, maxHeight); } case 1: { @@ -197,18 +203,6 @@ reg_t kDisposeTextBitmap(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) { - uint16 windowsOption = argv[0].toUint16(); - switch (windowsOption) { - case 0: - // Title bar on/off in Phantasmagoria, we return 0 (off) - return NULL_REG; - default: - warning("GetWindowsOption: Unknown option %d", windowsOption); - return NULL_REG; - } -} - reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case 1: @@ -236,12 +230,12 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) { // tables inside graphics/transitions.cpp uint16 showStyle = argv[0].toUint16(); // 0 - 15 reg_t planeObj = argv[1]; // the affected plane - //uint16 seconds = argv[2].toUint16(); // seconds that the transition lasts - //uint16 backColor = argv[3].toUint16(); // target back color(?). When fading out, it's 0x0000. When fading in, it's 0xffff - //int16 priority = argv[4].toSint16(); // always 0xc8 (200) when fading in/out - //uint16 animate = argv[5].toUint16(); // boolean, animate or not while the transition lasts - //uint16 refFrame = argv[6].toUint16(); // refFrame, always 0 when fading in/out -#if 0 + Common::String planeObjName = s->_segMan->getObjectName(planeObj); + uint16 seconds = argv[2].toUint16(); // seconds that the transition lasts + uint16 backColor = argv[3].toUint16(); // target back color(?). When fading out, it's 0x0000. When fading in, it's 0xffff + int16 priority = argv[4].toSint16(); // always 0xc8 (200) when fading in/out + uint16 animate = argv[5].toUint16(); // boolean, animate or not while the transition lasts + uint16 refFrame = argv[6].toUint16(); // refFrame, always 0 when fading in/out int16 divisions; // If the game has the pFadeArray selector, another parameter is used here, @@ -253,7 +247,7 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) { } else { divisions = (argc >= 8) ? argv[7].toSint16() : -1; // divisions (transition steps?) } -#endif + if (showStyle > 15) { warning("kSetShowStyle: Illegal style %d for plane %04x:%04x", showStyle, PRINT_REG(planeObj)); return s->r_acc; @@ -269,18 +263,29 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) { // TODO: Check if the plane is in the list of planes to draw + Common::String effectName = "unknown"; + switch (showStyle) { - //case 0: // no transition, perhaps? (like in the previous SCI versions) + case 0: // no transition / show + effectName = "show"; + break; case 13: // fade out + effectName = "fade out"; // TODO + break; case 14: // fade in + effectName = "fade in"; // TODO + break; default: - // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now - kStub(s, argc, argv); + // TODO break; } + warning("kSetShowStyle: effect %d (%s) - plane: %04x:%04x (%s), sec: %d, " + "back: %d, prio: %d, animate: %d, ref frame: %d, divisions: %d", + showStyle, effectName.c_str(), PRINT_REG(planeObj), planeObjName.c_str(), + seconds, backColor, priority, animate, refFrame, divisions); return s->r_acc; } @@ -364,7 +369,8 @@ reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv) { case 10: // Where, called by ScrollableWindow::where // TODO // argv[2] is an unknown integer - kStub(s, argc, argv); + // Silenced the warnings because of the high amount of console spam + //kStub(s, argc, argv); break; case 11: // Go, called by ScrollableWindow::scrollTo // 2 extra parameters here @@ -638,6 +644,169 @@ reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } +reg_t kSetScroll(EngineState *s, int argc, reg_t *argv) { + // Called in the intro of LSL6 hires (room 110) + // The end effect of this is the same as the old screen scroll transition + + // 7 parameters + reg_t planeObject = argv[0]; + //int16 x = argv[1].toSint16(); + //int16 y = argv[2].toSint16(); + uint16 pictureId = argv[3].toUint16(); + // param 4: int (0 in LSL6, probably scroll direction? The picture in LSL6 scrolls down) + // param 5: int (first call is 1, then the subsequent one is 0 in LSL6) + // param 6: optional int (0 in LSL6) + + // Set the new picture directly for now + //writeSelectorValue(s->_segMan, planeObject, SELECTOR(left), x); + //writeSelectorValue(s->_segMan, planeObject, SELECTOR(top), y); + writeSelectorValue(s->_segMan, planeObject, SELECTOR(picture), pictureId); + // and update our draw list + g_sci->_gfxFrameout->kernelUpdatePlane(planeObject); + + // TODO + return kStub(s, argc, argv); +} + +reg_t kPalCycle(EngineState *s, int argc, reg_t *argv) { + // Examples: GK1 room 480 (Bayou ritual), LSL6 room 100 (title screen) + + switch (argv[0].toUint16()) { + case 0: { // Palette animation initialization + // 3 or 4 extra params + // Case 1 sends fromColor and speed again, so we don't need them here. + // Only toColor is stored + //uint16 fromColor = argv[1].toUint16(); + s->_palCycleToColor = argv[2].toUint16(); + //uint16 speed = argv[3].toUint16(); + + // Invalidate the picture, so that the palette steps calls (case 1 + // below) can update its palette without it being overwritten by the + // view/picture palettes. + g_sci->_gfxScreen->_picNotValid = 1; + + // TODO: The fourth optional parameter is an unknown integer, and is 0 by default + if (argc == 5) { + // When this variant is used, picNotValid doesn't seem to be set + // (e.g. GK1 room 480). In this case, the animation step calls are + // not made, so perhaps this signifies the palette cycling steps + // to make. + // GK1 sets this to 6 (6 palette steps?) + g_sci->_gfxScreen->_picNotValid = 0; + } + kStub(s, argc, argv); + } + break; + case 1: { // Palette animation step + // This is the same as the old kPaletteAnimate call, with 1 set of colors. + // The end color is set up during initialization in case 0 above. + + // 1 or 2 extra params + uint16 fromColor = argv[1].toUint16(); + uint16 speed = (argc == 2) ? 1 : argv[2].toUint16(); + // TODO: For some reason, this doesn't set the color correctly + // (e.g. LSL6 intro, room 100, Sierra logo) + if (g_sci->_gfxPalette->kernelAnimate(fromColor, s->_palCycleToColor, speed)) + g_sci->_gfxPalette->kernelAnimateSet(); + } + // No kStub() call here, as this gets called loads of times, like kPaletteAnimate + break; + // case 2 hasn't been encountered + // case 3 hasn't been encountered + case 4: // reset any palette cycling and make the picture valid again + // Gets called when changing rooms and after palette cycling animations finish + // 0 or 1 extra params + if (argc == 1) { + g_sci->_gfxScreen->_picNotValid = 0; + // TODO: This also seems to perform more steps + } else { + // The variant with the 1 extra param resets remapping to base + // TODO + } + kStub(s, argc, argv); + break; + default: + // TODO + kStub(s, argc, argv); + break; + } + + return s->r_acc; +} + +reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { + uint16 operation = argv[0].toUint16(); + + switch (operation) { + case 0: { // turn remapping off + // WORKAROUND: Game scripts in QFG4 erroneously turn remapping off in room + // 140 (the character point allocation screen) and never turn it back on, + // even if it's clearly used in that screen. + if (g_sci->getGameId() == GID_QFG4 && s->currentRoomNumber() == 140) + return s->r_acc; + + int16 base = (argc >= 2) ? argv[1].toSint16() : 0; + if (base > 0) + warning("kRemapColors(0) called with base %d", base); + g_sci->_gfxPalette->resetRemapping(); + } + break; + case 1: { // remap by range + uint16 color = argv[1].toUint16(); + uint16 from = argv[2].toUint16(); + uint16 to = argv[3].toUint16(); + uint16 base = argv[4].toUint16(); + uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0; + if (unk5 > 0) + warning("kRemapColors(1) called with 6 parameters, unknown parameter is %d", unk5); + g_sci->_gfxPalette->setRemappingRange(color, from, to, base); + } + break; + case 2: { // remap by percent + uint16 color = argv[1].toUint16(); + uint16 percent = argv[2].toUint16(); // 0 - 100 + if (argc >= 4) + warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16()); + g_sci->_gfxPalette->setRemappingPercent(color, percent); + } + break; + case 3: { // remap to gray + // Example call: QFG4 room 490 (Baba Yaga's hut) - params are color 253, 75% and 0. + // In this room, it's used for the cloud before Baba Yaga appears. + int16 color = argv[1].toSint16(); + int16 percent = argv[2].toSint16(); // 0 - 100 + if (argc >= 4) + warning("RemapToGray called with 4 parameters, unknown parameter is %d", argv[3].toUint16()); + g_sci->_gfxPalette->setRemappingPercentGray(color, percent); + } + break; + case 4: { // remap to percent gray + // Example call: QFG4 rooms 530/535 (swamp) - params are 253, 100%, 200 + int16 color = argv[1].toSint16(); + int16 percent = argv[2].toSint16(); // 0 - 100 + // argv[3] is unknown (a number, e.g. 200) - start color, perhaps? + if (argc >= 5) + warning("RemapToGrayPercent called with 5 parameters, unknown parameter is %d", argv[4].toUint16()); + g_sci->_gfxPalette->setRemappingPercentGray(color, percent); + } + break; + case 5: { // don't map to range + //int16 mapping = argv[1].toSint16(); + uint16 intensity = argv[2].toUint16(); + // HACK for PQ4 + if (g_sci->getGameId() == GID_PQ4) + g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true); + + kStub(s, argc, argv); + } + break; + default: + break; + } + + return s->r_acc; +} + #endif } // End of namespace Sci diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 15d18eb4bb05..342fa95eda11 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -506,6 +506,11 @@ reg_t kListAt(EngineState *s, int argc, reg_t *argv) { curIndex++; } + // Update the virtual file selected in the character import screen of QFG4. + // For the SCI0-SCI1.1 version of this, check kDrawControl(). + if (g_sci->inQfGImportRoom() && !strcmp(s->_segMan->getObjectName(curObject), "SelectorDText")) + s->_chosenQfGImportItem = listIndex; + return curObject; } diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index 7570856dff2b..4b8fadbb8433 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -77,7 +77,18 @@ reg_t kSqrt(EngineState *s, int argc, reg_t *argv) { return make_reg(0, (int16) sqrt((float) ABS(argv[0].toSint16()))); } +/** + * Returns the angle (in degrees) between the two points determined by (x1, y1) + * and (x2, y2). The angle ranges from 0 to 359 degrees. + * What this function does is pretty simple but apparently the original is not + * accurate. + */ uint16 kGetAngleWorker(int16 x1, int16 y1, int16 x2, int16 y2) { + // SCI1 games (QFG2 and newer) use a simple atan implementation. SCI0 games + // use a somewhat less accurate calculation (below). + if (getSciVersion() >= SCI_VERSION_1_EGA_ONLY) + return (int16)(360 - atan2((double)(x1 - x2), (double)(y1 - y2)) * 57.2958) % 360; + int16 xRel = x2 - x1; int16 yRel = y1 - y2; // y-axis is mirrored. int16 angle; diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 12c830f62224..8b7fc4ffecbb 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -419,6 +419,18 @@ reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv) { return argv[2]; } +reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) { + uint16 windowsOption = argv[0].toUint16(); + switch (windowsOption) { + case 0: + // Title bar on/off in Phantasmagoria, we return 0 (off) + return NULL_REG; + default: + warning("GetWindowsOption: Unknown option %d", windowsOption); + return NULL_REG; + } +} + #endif // kIconBar is really a subop of kMacPlatform for SCI1.1 Mac diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index b378b4d58be3..0633267db41d 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -140,12 +140,14 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { ((argv[3].toUint16() & 0xff) << 16) | ((argv[4].toUint16() & 0xff) << 8) | (argv[5].toUint16() & 0xff); - if (argc == 8) { + // Removed warning because of the high amount of console spam + /*if (argc == 8) { + // TODO: Handle the extra 2 SCI21 params // argv[6] is always 1 // argv[7] is the contents of global 229 (0xE5) warning("kDoAudio: Play called with SCI2.1 extra parameters: %04x:%04x and %04x:%04x", PRINT_REG(argv[6]), PRINT_REG(argv[7])); - } + }*/ } else { warning("kDoAudio: Play called with an unknown number of parameters (%d)", argc); return NULL_REG; @@ -244,6 +246,11 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { // Used in Pharkas whenever a speech sample starts (takes no params) //warning("kDoAudio: Unhandled case 13, %d extra arguments passed", argc - 1); break; + case 17: + // Seems to be some sort of audio sync, used in SQ6. Silenced the + // warning due to the high level of spam it produces. (takes no params) + //warning("kDoAudio: Unhandled case 17, %d extra arguments passed", argc - 1); + break; default: warning("kDoAudio: Unhandled case %d, %d extra arguments passed", argv[0].toUint16(), argc - 1); } diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 2456ba1100da..6bf9aff2fe62 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -50,6 +50,8 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { if (!videoDecoder) return; + videoDecoder->start(); + byte *scaleBuffer = 0; byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; uint16 width = videoDecoder->getWidth(); @@ -90,7 +92,7 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { EngineState *s = g_sci->getEngineState(); if (videoDecoder->hasDirtyPalette()) { - byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3; + const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3; g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart); } @@ -108,7 +110,7 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { } if (videoDecoder->hasDirtyPalette()) { - byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3; + const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3; g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart); } @@ -162,9 +164,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { } else { // DOS SEQ // SEQ's are called with no subops, just the string and delay - SeqDecoder *seqDecoder = new SeqDecoder(); - seqDecoder->setFrameDelay(argv[1].toUint16()); // Time between frames in ticks - videoDecoder = seqDecoder; + // Time is specified as ticks + videoDecoder = new SEQDecoder(argv[1].toUint16()); if (!videoDecoder->loadFile(filename)) { warning("Failed to open movie file %s", filename.c_str()); @@ -190,7 +191,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case 0: { Common::String filename = s->_segMan->getString(argv[1]); - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); if (filename.equalsIgnoreCase("gk2a.avi")) { // HACK: Switch to 16bpp graphics for Indeo3. @@ -209,6 +210,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { warning("Failed to open movie file %s", filename.c_str()); delete videoDecoder; videoDecoder = 0; + } else { + s->_videoState.fileName = filename; } break; } @@ -250,6 +253,7 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) { int16 y = argv[5].toUint16(); warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y); g_sci->_robotDecoder->load(id); + g_sci->_robotDecoder->start(); g_sci->_robotDecoder->setPos(x, y); } break; @@ -265,13 +269,13 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) { warning("kRobot(%d)", subop); break; case 8: // sync - //if (false) { // debug: automatically skip all robot videos - if ((uint32)g_sci->_robotDecoder->getCurFrame() != g_sci->_robotDecoder->getFrameCount() - 1) { - writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG); - } else { + //if (true) { // debug: automatically skip all robot videos + if (g_sci->_robotDecoder->endOfVideo()) { g_sci->_robotDecoder->close(); // Signal the engine scripts that the video is done writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG); + } else { + writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG); } break; default: @@ -346,7 +350,7 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { break; } case 6: // Play - videoDecoder = new Video::VMDDecoder(g_system->getMixer()); + videoDecoder = new Video::AdvancedVMDDecoder(); if (s->_videoState.fileName.empty()) { // Happens in Lighthouse @@ -404,7 +408,7 @@ reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv) { s->_videoState.reset(); s->_videoState.fileName = Common::String::format("%d.duk", argv[1].toUint16()); - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); if (!videoDecoder->loadFile(s->_videoState.fileName)) { warning("Could not open Duck %s", s->_videoState.fileName.c_str()); diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index cddd01e10cfc..a92d572d35c8 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -400,11 +400,21 @@ Common::String MessageState::processString(const char *s) { void MessageState::outputString(reg_t buf, const Common::String &str) { #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) { - SciString *sciString = _segMan->lookupString(buf); - sciString->setSize(str.size() + 1); - for (uint32 i = 0; i < str.size(); i++) - sciString->setValue(i, str.c_str()[i]); - sciString->setValue(str.size(), 0); + if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_STRING) { + SciString *sciString = _segMan->lookupString(buf); + sciString->setSize(str.size() + 1); + for (uint32 i = 0; i < str.size(); i++) + sciString->setValue(i, str.c_str()[i]); + sciString->setValue(str.size(), 0); + } else if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_ARRAY) { + // Happens in the intro of LSL6, we are asked to write the string + // into an array + SciArray *sciString = _segMan->lookupArray(buf); + sciString->setSize(str.size() + 1); + for (uint32 i = 0; i < str.size(); i++) + sciString->setValue(i, make_reg(0, str.c_str()[i])); + sciString->setValue(str.size(), NULL_REG); + } } else { #endif SegmentRef buffer_r = _segMan->dereference(buf); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 57334b89aaed..037f4ab70043 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -385,7 +385,7 @@ void Script::setLockers(int lockers) { _lockers = lockers; } -uint32 Script::validateExportFunc(int pubfunct, bool relocateSci3) { +uint32 Script::validateExportFunc(int pubfunct, bool relocSci3) { bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE); if (_numExports <= pubfunct) { @@ -401,7 +401,7 @@ uint32 Script::validateExportFunc(int pubfunct, bool relocateSci3) { if (getSciVersion() != SCI_VERSION_3) { offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct); } else { - if (!relocateSci3) + if (!relocSci3) offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct) + getCodeBlockOffsetSci3(); else offset = relocateOffsetSci3(pubfunct * 2 + 22); @@ -422,16 +422,9 @@ uint32 Script::validateExportFunc(int pubfunct, bool relocateSci3) { } } - if (!offset) { -#ifdef ENABLE_SCI32 - // WORKAROUNDS for invalid (empty) exports - if (g_sci->getGameId() == GID_TORIN && _nr == 64036) { - } else if (g_sci->getGameId() == GID_RAMA && _nr == 64908) { - } else -#endif - error("Request for invalid exported function 0x%x of script %d", pubfunct, _nr); - return NULL; - } + // Note that it's perfectly normal to return a zero offset, especially in + // SCI1.1 and newer games. Examples include script 64036 in Torin's Passage, + // script 64908 in the demo of RAMA and script 1013 in KQ6 floppy. if (offset >= _bufSize) error("Invalid export function pointer"); diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index 1fc8caf313ae..0b499203c2f1 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -197,11 +197,11 @@ class Script : public SegmentObj { * Validate whether the specified public function is exported by * the script in the specified segment. * @param pubfunct Index of the function to validate - * @param relocateSci3 Decide whether to relocate this SCI3 public function or not + * @param relocSci3 Decide whether to relocate this SCI3 public function or not * @return NULL if the public function is invalid, its * offset into the script's segment otherwise */ - uint32 validateExportFunc(int pubfunct, bool relocateSci3); + uint32 validateExportFunc(int pubfunct, bool relocSci3); /** * Marks the script as deleted. diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 69eb37768405..659c13b13e94 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -978,7 +978,27 @@ const uint16 sq4CdPatchTextOptionsButton[] = { PATCH_END }; -// Patch 2: Add the ability to toggle among the three available options, +// Patch 2: Adjust a check in babbleIcon::init, which handles the babble icon +// (e.g. the two guys from Andromeda) shown when dying/quitting. +// Fixes bug #3538418. +const byte sq4CdSignatureBabbleIcon[] = { + 7, + 0x89, 0x5a, // lsg 5a + 0x35, 0x02, // ldi 02 + 0x1a, // eq? + 0x31, 0x26, // bnt 26 [02a7] + 0 +}; + +const uint16 sq4CdPatchBabbleIcon[] = { + 0x89, 0x5a, // lsg 5a + 0x35, 0x01, // ldi 01 + 0x1a, // eq? + 0x2f, 0x26, // bt 26 [02a7] + PATCH_END +}; + +// Patch 3: Add the ability to toggle among the three available options, // when the text options button is clicked: "Speech", "Text" and "Both". // Refer to the patch above for additional details. // iconTextSwitch::doit (called when the text options button is clicked) @@ -1030,6 +1050,7 @@ const SciScriptSignature sq4Signatures[] = { { 298, "Floppy: endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x44), -3, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight }, { 298, "Floppy (German): endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x4c), -3, sq4FloppySignatureEndlessFlightGerman, sq4FloppyPatchEndlessFlight }, { 818, "CD: Speech and subtitles option", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x3c, 0x35), 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions }, + { 0, "CD: Babble icon speech and subtitles fix", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x35, 0x02), 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon }, { 818, "CD: Speech and subtitles option button", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa1, 0x53), 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton }, SCI_SIGNATUREENTRY_TERMINATOR }; diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index a6c145979f69..951fc7c36360 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -143,16 +143,27 @@ Script *SegManager::allocateScript(int script_nr, SegmentId *segid) { } void SegManager::deallocate(SegmentId seg) { - if (!check(seg)) - error("SegManager::deallocate(): invalid segment ID"); + if (seg < 1 || (uint)seg >= _heap.size()) + error("Attempt to deallocate an invalid segment ID"); SegmentObj *mobj = _heap[seg]; + if (!mobj) + error("Attempt to deallocate an already freed segment"); if (mobj->getType() == SEG_TYPE_SCRIPT) { Script *scr = (Script *)mobj; _scriptSegMap.erase(scr->getScriptNumber()); - if (scr->getLocalsSegment()) - deallocate(scr->getLocalsSegment()); + if (scr->getLocalsSegment()) { + // Check if the locals segment has already been deallocated. + // If the locals block has been stored in a segment with an ID + // smaller than the segment ID of the script itself, it will be + // already freed at this point. This can happen when scripts are + // uninstantiated and instantiated again: they retain their own + // segment ID, but are allocated a new locals segment, which can + // have an ID smaller than the segment of the script itself. + if (_heap[scr->getLocalsSegment()]) + deallocate(scr->getLocalsSegment()); + } } delete mobj; @@ -307,21 +318,6 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) { return result[index]; } -// validate the seg -// return: -// false - invalid seg -// true - valid seg -bool SegManager::check(SegmentId seg) { - if (seg < 1 || (uint)seg >= _heap.size()) { - return false; - } - if (!_heap[seg]) { - warning("SegManager: seg %x is removed from memory, but not removed from hash_map", seg); - return false; - } - return true; -} - // return the seg if script_id is valid and in the map, else 0 SegmentId SegManager::getScriptSegment(int script_id) const { return _scriptSegMap.getVal(script_id, 0); diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 356a1b04a7d6..074d3f6b0a66 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -471,14 +471,6 @@ class SegManager : public Common::Serializable { void createClassTable(); SegmentId findFreeSegment() const; - - /** - * Check segment validity - * @param[in] seg The segment to validate - * @return false if 'seg' is an invalid segment, true if - * 'seg' is a valid segment - */ - bool check(SegmentId seg); }; } // End of namespace Sci diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 94a3fe3ae5e4..0f0c8dcd66b6 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -122,8 +122,11 @@ void EngineState::reset(bool isRestoring) { _videoState.reset(); _syncedAudioOptions = false; + _vmdPalStart = 0; _vmdPalEnd = 256; + + _palCycleToColor = 255; } void EngineState::speedThrottler(uint32 neededSleep) { diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 9ae6299d8365..81090876c7a7 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -199,6 +199,8 @@ struct EngineState : public Common::Serializable { uint16 _vmdPalStart, _vmdPalEnd; bool _syncedAudioOptions; + uint16 _palCycleToColor; + /** * Resets the engine state. */ diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 5a2a39def2fe..3f439669767c 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1173,6 +1173,7 @@ void run_vm(EngineState *s) { case op_line: // 0x3f (63) // Debug opcode (line number) + //debug("Script %d, line %d", scr->getScriptNumber(), opparams[0]); break; case op_lag: // 0x40 (64) diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index a0fd6689df1d..8b38faa0134b 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -202,6 +202,7 @@ enum SciOpcodes { op_push2 = 0x3d, // 061 op_pushSelf = 0x3e, // 062 op_line = 0x3f, // 063 + // op_lag = 0x40, // 064 op_lal = 0x41, // 065 op_lat = 0x42, // 066 @@ -218,6 +219,7 @@ enum SciOpcodes { op_lsli = 0x4d, // 077 op_lsti = 0x4e, // 078 op_lspi = 0x4f, // 079 + // op_sag = 0x50, // 080 op_sal = 0x51, // 081 op_sat = 0x52, // 082 @@ -234,6 +236,7 @@ enum SciOpcodes { op_ssli = 0x5d, // 093 op_ssti = 0x5e, // 094 op_sspi = 0x5f, // 095 + // op_plusag = 0x60, // 096 op_plusal = 0x61, // 097 op_plusat = 0x62, // 098 @@ -250,6 +253,7 @@ enum SciOpcodes { op_plussli = 0x6d, // 109 op_plussti = 0x6e, // 110 op_plusspi = 0x6f, // 111 + // op_minusag = 0x70, // 112 op_minusal = 0x71, // 113 op_minusat = 0x72, // 114 diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index ecb1e4c2d5b5..9fa0368784a2 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -36,13 +36,15 @@ const SciWorkaroundEntry arithmeticWorkarounds[] = { { GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xcc6, 0, { WORKAROUND_FAKE, 0 } }, // op_or: when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464 { GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xce0, 0, { WORKAROUND_FAKE, 0 } }, // Same as above, for the Spanish version - bug #3313962 { GID_FANMADE, 516, 983, 0, "Wander", "setTarget", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_mul: The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913 + { GID_GK1, 800,64992, 0, "Fwd", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7 { GID_ICEMAN, 199, 977, 0, "Grooper", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_add: While dancing with the girl { GID_MOTHERGOOSE256, -1, 999, 0, "Event", "new", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_and: constantly during the game (SCI1 version) { GID_MOTHERGOOSE256, -1, 4, 0, "rm004", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_or: when going north and reaching the castle (rooms 4 and 37) - bug #3038228 { GID_MOTHERGOOSEHIRES,90, 90, 0, "newGameButton", "select", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_ge: MUMG Deluxe, when selecting "New Game" in the main menu. It tries to compare an integer with a list. Needs to return false for the game to continue. + { GID_PHANTASMAGORIA, 902, 0, 0, "", "export 7", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_shr: when starting a chapter in Phantasmagoria { GID_QFG1VGA, 301, 928, 0, "Blink", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_div: when entering the inn, gets called with 1 parameter, but 2nd parameter is used for div which happens to be an object { GID_QFG2, 200, 200, 0, "astro", "messages", -1, 0, { WORKAROUND_FAKE, 0 } }, // op_lsi: when getting asked for your name by the astrologer bug #3039879 - { GID_GK1, 800,64992, 0, "Fwd", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7 + { GID_QFG4, 710,64941, 0, "RandCycle", "doit", -1, 0, { WORKAROUND_FAKE, 1 } }, // op_gt: when the tentacle appears in the third room of the caves SCI_WORKAROUNDENTRY_TERMINATOR }; @@ -162,10 +164,10 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { WORKAROUND_FAKE, 0 } }, // sub that's called from several objects while on sarien battle cruiser { GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { WORKAROUND_FAKE, 0 } }, // export 1, but called locally (when shooting at aliens) { GID_SQ4, -1, 398, 0, "showBox", "changeState", -1, 0, { WORKAROUND_FAKE, 0 } }, // CD: called when rummaging in Software Excess bargain bin - { GID_SQ4, -1, 928, 0, "Narrator", "startText", -1, 1000, { WORKAROUND_FAKE, 1 } }, // CD: method returns this to the caller + { GID_SQ4, -1, 928, -1, "Narrator", "startText", -1, 1000, { WORKAROUND_FAKE, 1 } }, // CD: happens in the options dialog and in-game when speech and subtitles are used simultaneously { GID_SQ5, 201, 201, 0, "buttonPanel", "doVerb", -1, 0, { WORKAROUND_FAKE, 1 } }, // when looking at the orange or red button - bug #3038563 { GID_SQ6, -1, 0, 0, "SQ6", "init", -1, 2, { WORKAROUND_FAKE, 0 } }, // Demo and full version: called when the game starts (demo: room 0, full: room 100) - { GID_SQ6, 100, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu + { GID_SQ6, -1, 64950, -1, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu, when entering the Orion's Belt bar (room 300), and perhaps other places { GID_SQ6, -1, 64964, 0, "DPath", "init", -1, 1, { WORKAROUND_FAKE, 0 } }, // during the game { GID_TORIN, -1, 64017, 0, "oFlags", "clear", -1, 0, { WORKAROUND_FAKE, 0 } }, // entering Torin's home in the French version SCI_WORKAROUNDENTRY_TERMINATOR @@ -397,6 +399,7 @@ const SciWorkaroundEntry kUnLoad_workarounds[] = { { GID_LSL6, 740, 740, 0, "showCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during ending, 4 additional parameters are passed by accident { GID_LSL6HIRES, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident { GID_SQ1, 43, 303, 0, "slotGuy", "dispose", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when leaving ulence flats bar, parameter 1 is not passed - script error + { GID_QFG4, -1, 110, 0, "dreamer", "dispose", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during the dream sequence, a 3rd parameter is passed by accident SCI_WORKAROUNDENTRY_TERMINATOR }; diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp index fcdd0575094d..30184cc09180 100644 --- a/engines/sci/graphics/font.cpp +++ b/engines/sci/graphics/font.cpp @@ -54,7 +54,7 @@ GfxFontFromResource::GfxFontFromResource(ResourceManager *resMan, GfxScreen *scr } GfxFontFromResource::~GfxFontFromResource() { - delete []_chars; + delete[] _chars; _resMan->unlockResource(_resource); } diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 265a175e6669..968014c032b4 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -28,6 +28,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "engines/engine.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "sci/sci.h" @@ -117,27 +118,43 @@ void GfxFrameout::showCurrentScrollText() { } } +extern void showScummVMDialog(const Common::String &message); + void GfxFrameout::kernelAddPlane(reg_t object) { PlaneEntry newPlane; if (_planes.empty()) { // There has to be another way for sierra sci to do this or maybe script resolution is compiled into // interpreter (TODO) - uint16 tmpRunningWidth = readSelectorValue(_segMan, object, SELECTOR(resX)); - uint16 tmpRunningHeight = readSelectorValue(_segMan, object, SELECTOR(resY)); + uint16 scriptWidth = readSelectorValue(_segMan, object, SELECTOR(resX)); + uint16 scriptHeight = readSelectorValue(_segMan, object, SELECTOR(resY)); - // The above can be 0 in SCI3 (e.g. Phantasmagoria 2) - if (tmpRunningWidth == 0 && tmpRunningHeight == 0) { - tmpRunningWidth = 320; - tmpRunningHeight = 200; + // Phantasmagoria 2 doesn't specify a script width/height + if (g_sci->getGameId() == GID_PHANTASMAGORIA2) { + scriptWidth = 640; + scriptHeight = 480; } - _coordAdjuster->setScriptsResolution(tmpRunningWidth, tmpRunningHeight); + assert(scriptWidth > 0 && scriptHeight > 0); + _coordAdjuster->setScriptsResolution(scriptWidth, scriptHeight); + } + + // Import of QfG character files dialog is shown in QFG4. + // Display additional popup information before letting user use it. + // For the SCI0-SCI1.1 version of this, check kDrawControl(). + if (g_sci->inQfGImportRoom() && !strcmp(_segMan->getObjectName(object), "DSPlane")) { + showScummVMDialog("Characters saved inside ScummVM are shown " + "automatically. Character files saved in the original " + "interpreter need to be put inside ScummVM's saved games " + "directory and a prefix needs to be added depending on which " + "game it was saved in: 'qfg1-' for Quest for Glory 1, 'qfg2-' " + "for Quest for Glory 2, 'qfg3-' for Quest for Glory 3. " + "Example: 'qfg2-thief.sav'."); } newPlane.object = object; newPlane.priority = readSelectorValue(_segMan, object, SELECTOR(priority)); - newPlane.lastPriority = 0xFFFF; // hidden + newPlane.lastPriority = -1; // hidden newPlane.planeOffsetX = 0; newPlane.planeOffsetY = 0; newPlane.pictureId = kPlanePlainColored; @@ -294,6 +311,10 @@ reg_t GfxFrameout::addPlaneLine(reg_t object, Common::Point startPoint, Common:: } void GfxFrameout::updatePlaneLine(reg_t object, reg_t hunkId, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) { + // Check if we're asked to update a line that was never added + if (hunkId.isNull()) + return; + for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) { @@ -311,6 +332,10 @@ void GfxFrameout::updatePlaneLine(reg_t object, reg_t hunkId, Common::Point star } void GfxFrameout::deletePlaneLine(reg_t object, reg_t hunkId) { + // Check if we're asked to delete a line that was never added (happens during the intro of LSL6) + if (hunkId.isNull()) + return; + for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) { @@ -326,8 +351,10 @@ void GfxFrameout::deletePlaneLine(reg_t object, reg_t hunkId) { void GfxFrameout::kernelAddScreenItem(reg_t object) { // Ignore invalid items - if (!_segMan->isObject(object)) + if (!_segMan->isObject(object)) { + warning("kernelAddScreenItem: Attempt to add an invalid object (%04x:%04x)", PRINT_REG(object)); return; + } FrameoutEntry *itemEntry = new FrameoutEntry(); memset(itemEntry, 0, sizeof(FrameoutEntry)); @@ -341,8 +368,10 @@ void GfxFrameout::kernelAddScreenItem(reg_t object) { void GfxFrameout::kernelUpdateScreenItem(reg_t object) { // Ignore invalid items - if (!_segMan->isObject(object)) + if (!_segMan->isObject(object)) { + warning("kernelUpdateScreenItem: Attempt to update an invalid object (%04x:%04x)", PRINT_REG(object)); return; + } FrameoutEntry *itemEntry = findScreenItem(object); if (!itemEntry) { @@ -372,10 +401,9 @@ void GfxFrameout::kernelUpdateScreenItem(reg_t object) { void GfxFrameout::kernelDeleteScreenItem(reg_t object) { FrameoutEntry *itemEntry = findScreenItem(object); - if (!itemEntry) { - warning("kernelDeleteScreenItem: invalid object %04x:%04x", PRINT_REG(object)); + // If the item could not be found, it may already have been deleted + if (!itemEntry) return; - } _screenItems.remove(itemEntry); delete itemEntry; @@ -432,15 +460,10 @@ bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) { } bool planeSortHelper(const PlaneEntry &entry1, const PlaneEntry &entry2) { -// SegManager *segMan = g_sci->getEngineState()->_segMan; - -// uint16 plane1Priority = readSelectorValue(segMan, entry1, SELECTOR(priority)); -// uint16 plane2Priority = readSelectorValue(segMan, entry2, SELECTOR(priority)); - - if (entry1.priority == 0xffff) + if (entry1.priority < 0) return true; - if (entry2.priority == 0xffff) + if (entry2.priority < 0) return false; return entry1.priority < entry2.priority; @@ -466,7 +489,7 @@ void GfxFrameout::showVideo() { uint16 y = videoDecoder->getPos().y; if (videoDecoder->hasDirtyPalette()) - videoDecoder->setSystemPalette(); + g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256); while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { @@ -475,7 +498,7 @@ void GfxFrameout::showVideo() { g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); if (videoDecoder->hasDirtyPalette()) - videoDecoder->setSystemPalette(); + g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256); g_system->updateScreen(); } @@ -606,13 +629,13 @@ void GfxFrameout::kernelFrameout() { _screen->drawLine(startPoint, endPoint, it2->color, it2->priority, it2->control); } - uint16 planeLastPriority = it->lastPriority; + int16 planeLastPriority = it->lastPriority; // Update priority here, sq6 sets it w/o UpdatePlane - uint16 planePriority = it->priority = readSelectorValue(_segMan, planeObject, SELECTOR(priority)); + int16 planePriority = it->priority = readSelectorValue(_segMan, planeObject, SELECTOR(priority)); it->lastPriority = planePriority; - if (planePriority == 0xffff) { // Plane currently not meant to be shown + if (planePriority < 0) { // Plane currently not meant to be shown // If plane was shown before, delete plane rect if (planePriority != planeLastPriority) _paint32->fillRect(it->planeRect, 0); @@ -653,7 +676,7 @@ void GfxFrameout::kernelFrameout() { if (view && view->isSci2Hires()) { view->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x); view->adjustToUpscaledCoordinates(itemEntry->z, dummyX); - } else if (getSciVersion() == SCI_VERSION_2_1) { + } else if (getSciVersion() >= SCI_VERSION_2_1) { _coordAdjuster->fromScriptToDisplay(itemEntry->y, itemEntry->x); _coordAdjuster->fromScriptToDisplay(itemEntry->z, dummyX); } @@ -676,13 +699,13 @@ void GfxFrameout::kernelFrameout() { // TODO: maybe we should clip the cels rect with this, i'm not sure // the only currently known usage is game menu of gk1 } else if (view) { - if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128)) - view->getCelRect(itemEntry->loopNo, itemEntry->celNo, - itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect); - else - view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo, - itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX, - itemEntry->scaleY, itemEntry->celRect); + if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128)) + view->getCelRect(itemEntry->loopNo, itemEntry->celNo, + itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect); + else + view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo, + itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX, + itemEntry->scaleY, itemEntry->celRect); Common::Rect nsRect = itemEntry->celRect; // Translate back to actual coordinate within scrollable plane @@ -691,7 +714,7 @@ void GfxFrameout::kernelFrameout() { if (view && view->isSci2Hires()) { view->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left); view->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right); - } else if (getSciVersion() == SCI_VERSION_2_1) { + } else if (getSciVersion() >= SCI_VERSION_2_1) { _coordAdjuster->fromDisplayToScript(nsRect.top, nsRect.left); _coordAdjuster->fromDisplayToScript(nsRect.bottom, nsRect.right); } @@ -706,7 +729,9 @@ void GfxFrameout::kernelFrameout() { g_sci->_gfxCompare->setNSRect(itemEntry->object, nsRect); } - // FIXME: When does this happen, and why? + // Don't attempt to draw sprites that are outside the visible + // screen area. An example is the random people walking in + // Jackson Square in GK1. if (itemEntry->celRect.bottom < 0 || itemEntry->celRect.top >= _screen->getDisplayHeight() || itemEntry->celRect.right < 0 || itemEntry->celRect.left >= _screen->getDisplayWidth()) continue; @@ -719,6 +744,9 @@ void GfxFrameout::kernelFrameout() { translatedClipRect = clipRect; translatedClipRect.translate(it->upscaledPlaneRect.left, it->upscaledPlaneRect.top); } else { + // QFG4 passes invalid rectangles when a battle is starting + if (!clipRect.isValidRect()) + continue; clipRect.clip(it->planeClipRect); translatedClipRect = clipRect; translatedClipRect.translate(it->planeRect.left, it->planeRect.top); diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index ecaf450d8968..5fd282422421 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -40,8 +40,8 @@ typedef Common::List PlaneLineList; struct PlaneEntry { reg_t object; - uint16 priority; - uint16 lastPriority; + int16 priority; + int16 lastPriority; int16 planeOffsetX; int16 planeOffsetY; GuiResourceId pictureId; diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index ea154c503751..53d69cdccaa8 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -100,6 +100,9 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen) default: error("GfxPalette: Unknown view type"); } + + _remapOn = false; + resetRemapping(); } GfxPalette::~GfxPalette() { @@ -140,8 +143,9 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut) memset(paletteOut, 0, sizeof(Palette)); // Setup 1:1 mapping - for (colorNo = 0; colorNo < 256; colorNo++) + for (colorNo = 0; colorNo < 256; colorNo++) { paletteOut->mapping[colorNo] = colorNo; + } if (bytesLeft < 37) { // This happens when loading palette of picture 0 in sq5 - the resource is broken and doesn't contain a full @@ -329,6 +333,79 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) { } } +byte GfxPalette::remapColor(byte remappedColor, byte screenColor) { + assert(_remapOn); + if (_remappingType[remappedColor] == kRemappingByRange) + return _remappingByRange[screenColor]; + else if (_remappingType[remappedColor] == kRemappingByPercent) + return _remappingByPercent[screenColor]; + else + error("remapColor(): Color %d isn't remapped", remappedColor); + + return 0; // should never reach here +} + +void GfxPalette::resetRemapping() { + _remapOn = false; + _remappingPercentToSet = 0; + + for (int i = 0; i < 256; i++) { + _remappingType[i] = kRemappingNone; + _remappingByPercent[i] = i; + _remappingByRange[i] = i; + } +} + +void GfxPalette::setRemappingPercent(byte color, byte percent) { + _remapOn = true; + + // We need to defer the setup of the remapping table every time the screen + // palette is changed, so that kernelFindColor() can find the correct + // colors. Set it once here, in case the palette stays the same and update + // it on each palette change by copySysPaletteToScreen(). + _remappingPercentToSet = percent; + + for (int i = 0; i < 256; i++) { + byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100; + byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100; + byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100; + _remappingByPercent[i] = kernelFindColor(r, g, b); + } + + _remappingType[color] = kRemappingByPercent; +} + +void GfxPalette::setRemappingPercentGray(byte color, byte percent) { + _remapOn = true; + + // We need to defer the setup of the remapping table every time the screen + // palette is changed, so that kernelFindColor() can find the correct + // colors. Set it once here, in case the palette stays the same and update + // it on each palette change by copySysPaletteToScreen(). + _remappingPercentToSet = percent; + + // Note: This is not what the original does, but the results are the same visually + for (int i = 0; i < 256; i++) { + byte rComponent = _sysPalette.colors[i].r * _remappingPercentToSet * 0.30 / 100; + byte gComponent = _sysPalette.colors[i].g * _remappingPercentToSet * 0.59 / 100; + byte bComponent = _sysPalette.colors[i].b * _remappingPercentToSet * 0.11 / 100; + byte luminosity = rComponent + gComponent + bComponent; + _remappingByPercent[i] = kernelFindColor(luminosity, luminosity, luminosity); + } + + _remappingType[color] = kRemappingByPercent; +} + +void GfxPalette::setRemappingRange(byte color, byte from, byte to, byte base) { + _remapOn = true; + + for (int i = from; i <= to; i++) { + _remappingByRange[i] = i + base; + } + + _remappingType[color] = kRemappingByRange; +} + bool GfxPalette::insert(Palette *newPalette, Palette *destPalette) { bool paletteChanged = false; @@ -491,6 +568,16 @@ void GfxPalette::copySysPaletteToScreen() { } } + // Check if we need to reset remapping by percent with the new colors. + if (_remappingPercentToSet) { + for (int i = 0; i < 256; i++) { + byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100; + byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100; + byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100; + _remappingByPercent[i] = kernelFindColor(r, g, b); + } + } + g_system->getPaletteManager()->setPalette(bpal, 0, 256); } @@ -999,8 +1086,9 @@ bool GfxPalette::loadClut(uint16 clutId) { memset(&pal, 0, sizeof(Palette)); // Setup 1:1 mapping - for (int i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { pal.mapping[i] = i; + } // Now load in the palette for (int i = 1; i <= 236; i++) { diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index a9ea1c32deac..e974781d4973 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -31,6 +31,12 @@ namespace Sci { class ResourceManager; class GfxScreen; +enum ColorRemappingType { + kRemappingNone = 0, + kRemappingByRange = 1, + kRemappingByPercent = 2 +}; + /** * Palette class, handles palette operations like changing intensity, setting up the palette, merging different palettes */ @@ -53,6 +59,15 @@ class GfxPalette : public Common::Serializable { void getSys(Palette *pal); uint16 getTotalColorCount() const { return _totalScreenColors; } + void resetRemapping(); + void setRemappingPercent(byte color, byte percent); + void setRemappingPercentGray(byte color, byte percent); + void setRemappingRange(byte color, byte from, byte to, byte base); + bool isRemapped(byte color) const { + return _remapOn && (_remappingType[color] != kRemappingNone); + } + byte remapColor(byte remappedColor, byte screenColor); + void setOnScreen(); void copySysPaletteToScreen(); @@ -123,6 +138,12 @@ class GfxPalette : public Common::Serializable { int _palVarySignal; uint16 _totalScreenColors; + bool _remapOn; + ColorRemappingType _remappingType[256]; + byte _remappingByPercent[256]; + byte _remappingByRange[256]; + uint16 _remappingPercentToSet; + void loadMacIconBarPalette(); byte *_macClut; diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 4020518b72dd..246b6bfff9f4 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -53,23 +53,35 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) { #ifdef ENABLE_SCI32 // GK1 Mac uses a 640x480 resolution too - if (g_sci->getGameId() == GID_GK1 && g_sci->getPlatform() == Common::kPlatformMacintosh) - _upscaledHires = GFX_SCREEN_UPSCALED_640x480; + if (g_sci->getPlatform() == Common::kPlatformMacintosh) { + if (g_sci->getGameId() == GID_GK1) + _upscaledHires = GFX_SCREEN_UPSCALED_640x480; + } #endif if (_resMan->detectHires()) { _width = 640; + _pitch = 640; _height = 480; } else { _width = 320; + _pitch = 320; _height = getLowResScreenHeight(); } +#ifdef ENABLE_SCI32 + // Phantasmagoria 1 sets a window area of 630x450 + if (g_sci->getGameId() == GID_PHANTASMAGORIA) { + _width = 630; + _height = 450; + } +#endif + // Japanese versions of games use hi-res font on upscaled version of the game. if ((g_sci->getLanguage() == Common::JA_JPN) && (getSciVersion() <= SCI_VERSION_1_1)) _upscaledHires = GFX_SCREEN_UPSCALED_640x400; - _pixels = _width * _height; + _pixels = _pitch * _height; switch (_upscaledHires) { case GFX_SCREEN_UPSCALED_640x400: @@ -91,7 +103,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) { _upscaledMapping[i] = (i * 12) / 5; break; default: - _displayWidth = _width; + _displayWidth = _pitch; _displayHeight = _height; memset(&_upscaledMapping, 0, sizeof(_upscaledMapping) ); break; @@ -207,7 +219,7 @@ byte GfxScreen::getDrawingMask(byte color, byte prio, byte control) { } void GfxScreen::putPixel(int x, int y, byte drawMask, byte color, byte priority, byte control) { - int offset = y * _width + x; + int offset = y * _pitch + x; if (drawMask & GFX_SCREEN_MASK_VISUAL) { _visualScreen[offset] = color; @@ -240,7 +252,7 @@ void GfxScreen::putFontPixel(int startingY, int x, int y, byte color) { // Do not scale ourselves, but put it on the display directly putPixelOnDisplay(x, y + startingY, color); } else { - int offset = (startingY + y) * _width + x; + int offset = (startingY + y) * _pitch + x; _visualScreen[offset] = color; if (!_upscaledHires) { @@ -342,19 +354,19 @@ void GfxScreen::putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, u } byte GfxScreen::getVisual(int x, int y) { - return _visualScreen[y * _width + x]; + return _visualScreen[y * _pitch + x]; } byte GfxScreen::getPriority(int x, int y) { - return _priorityScreen[y * _width + x]; + return _priorityScreen[y * _pitch + x]; } byte GfxScreen::getControl(int x, int y) { - return _controlScreen[y * _width + x]; + return _controlScreen[y * _pitch + x]; } byte GfxScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color, byte t_pri, byte t_con, bool isEGA) { - int offset = y * _width + x; + int offset = y * _pitch + x; byte match = 0; if (screenMask & GFX_SCREEN_MASK_VISUAL) { @@ -415,14 +427,14 @@ void GfxScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & GFX_SCREEN_MASK_VISUAL) { - bitsSaveScreen(rect, _visualScreen, _width, memoryPtr); + bitsSaveScreen(rect, _visualScreen, _pitch, memoryPtr); bitsSaveDisplayScreen(rect, memoryPtr); } if (mask & GFX_SCREEN_MASK_PRIORITY) { - bitsSaveScreen(rect, _priorityScreen, _width, memoryPtr); + bitsSaveScreen(rect, _priorityScreen, _pitch, memoryPtr); } if (mask & GFX_SCREEN_MASK_CONTROL) { - bitsSaveScreen(rect, _controlScreen, _width, memoryPtr); + bitsSaveScreen(rect, _controlScreen, _pitch, memoryPtr); } if (mask & GFX_SCREEN_MASK_DISPLAY) { if (!_upscaledHires) @@ -475,14 +487,14 @@ void GfxScreen::bitsRestore(byte *memoryPtr) { memcpy((void *)&mask, memoryPtr, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & GFX_SCREEN_MASK_VISUAL) { - bitsRestoreScreen(rect, memoryPtr, _visualScreen, _width); + bitsRestoreScreen(rect, memoryPtr, _visualScreen, _pitch); bitsRestoreDisplayScreen(rect, memoryPtr); } if (mask & GFX_SCREEN_MASK_PRIORITY) { - bitsRestoreScreen(rect, memoryPtr, _priorityScreen, _width); + bitsRestoreScreen(rect, memoryPtr, _priorityScreen, _pitch); } if (mask & GFX_SCREEN_MASK_CONTROL) { - bitsRestoreScreen(rect, memoryPtr, _controlScreen, _width); + bitsRestoreScreen(rect, memoryPtr, _controlScreen, _pitch); } if (mask & GFX_SCREEN_MASK_DISPLAY) { if (!_upscaledHires) @@ -560,7 +572,7 @@ void GfxScreen::dither(bool addToFlag) { if (!_unditheringEnabled) { // Do dithering on visual and display-screen for (y = 0; y < _height; y++) { - for (x = 0; x < _width; x++) { + for (x = 0; x < _pitch; x++) { color = *visualPtr; if (color & 0xF0) { color ^= color << 4; @@ -585,7 +597,7 @@ void GfxScreen::dither(bool addToFlag) { memset(&_ditheredPicColors, 0, sizeof(_ditheredPicColors)); // Do dithering on visual screen and put decoded but undithered byte onto display-screen for (y = 0; y < _height; y++) { - for (x = 0; x < _width; x++) { + for (x = 0; x < _pitch; x++) { color = *visualPtr; if (color & 0xF0) { color ^= color << 4; diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 73ea596ba118..01fb899edb73 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -132,6 +132,7 @@ class GfxScreen { private: uint16 _width; + uint16 _pitch; uint16 _height; uint _pixels; uint16 _displayWidth; diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 4e5c4da8b25c..36aaae92327b 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -741,8 +741,14 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const const int x2 = clipRectTranslated.left + x; const int y2 = clipRectTranslated.top + y; if (!upscaledHires) { - if (priority >= _screen->getPriority(x2, y2)) - _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0); + if (priority >= _screen->getPriority(x2, y2)) { + if (!_palette->isRemapped(palette->mapping[color])) { + _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0); + } else { + byte remappedColor = _palette->remapColor(palette->mapping[color], _screen->getVisual(x2, y2)); + _screen->putPixel(x2, y2, drawMask, remappedColor, priority, 0); + } + } } else { // UpscaledHires means view is hires and is supposed to // get drawn onto lowres screen. @@ -851,7 +857,12 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const int x2 = clipRectTranslated.left + x; const int y2 = clipRectTranslated.top + y; if (color != clearKey && priority >= _screen->getPriority(x2, y2)) { - _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0); + if (!_palette->isRemapped(palette->mapping[color])) { + _screen->putPixel(x2, y2, drawMask, palette->mapping[color], priority, 0); + } else { + byte remappedColor = _palette->remapColor(palette->mapping[color], _screen->getVisual(x2, y2)); + _screen->putPixel(x2, y2, drawMask, remappedColor, priority, 0); + } } } } diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index d43a9d06fc9a..42ae00b525db 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -632,7 +632,7 @@ void SciEngine::initGraphics() { _gfxPaint = _gfxPaint32; _gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache, _gfxScreen); _gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxScreen, _gfxText32); - _robotDecoder = new RobotDecoder(g_system->getMixer(), getPlatform() == Common::kPlatformMacintosh); + _robotDecoder = new RobotDecoder(getPlatform() == Common::kPlatformMacintosh); _gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette, _gfxPaint32); } else { #endif diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 123dd2189440..528bb5139308 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -67,7 +67,8 @@ int AudioPlayer::startAudio(uint16 module, uint32 number) { if (audioStream) { _wPlayFlag = false; - _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream); + Audio::Mixer::SoundType soundType = (module == 65535) ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType; + _mixer->playStream(soundType, &_audioHandle, audioStream); return sampleLen; } else { // Don't throw a warning in this case. getAudioStream() already has. Some games diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 989df7c8a1ee..5d32f40f18dd 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -96,7 +96,7 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) { if (_useDigitalSFX || !newSound->soundRes) { int sampleLen; newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen); - newSound->soundType = Audio::Mixer::kSpeechSoundType; + newSound->soundType = Audio::Mixer::kSFXSoundType; } } @@ -367,24 +367,36 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) { case 4: // SCI01+ case 5: // SCI1+ (SCI1 late sound scheme), with fade and continue - musicSlot->fadeTo = CLIP(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX); - // sometimes we get objects in that position, fix it up (ffs. workarounds) - if (!argv[1].getSegment()) - musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16(); - else - musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5; - musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo(); - musicSlot->fadeTicker = 0; - if (argc == 5) { // TODO: We currently treat this argument as a boolean, but may // have to handle different non-zero values differently. (e.g., - // some KQ6 scripts pass 3 here) - musicSlot->stopAfterFading = (argv[4].toUint16() != 0); + // some KQ6 scripts pass 3 here). + // There is a script bug in KQ6, room 460 (the room with the flying + // books). An object is passed here, which should not be treated as + // a true flag. Fixes bugs #3555404 and #3291115. + musicSlot->stopAfterFading = (argv[4].isNumber() && argv[4].toUint16() != 0); } else { musicSlot->stopAfterFading = false; } + musicSlot->fadeTo = CLIP(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX); + // Check if the song is already at the requested volume. If it is, don't + // perform any fading. Happens for example during the intro of Longbow. + if (musicSlot->fadeTo != musicSlot->volume) { + // sometimes we get objects in that position, fix it up (ffs. workarounds) + if (!argv[1].getSegment()) + musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16(); + else + musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5; + musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo(); + } else { + // Stop the music, if requested. Fixes bug #3555404. + if (musicSlot->stopAfterFading) + processStopSound(obj, false); + } + + musicSlot->fadeTicker = 0; + // WORKAROUND/HACK: In the labyrinth in KQ6, when falling in the pit and // lighting the lantern, the game scripts perform a fade in of the game // music, but set it to stop after fading. Remove that flag here. This is @@ -497,12 +509,7 @@ void SoundCommandParser::processUpdateCues(reg_t obj) { // fireworks). // It is also needed in other games, e.g. LSL6 when talking to the // receptionist (bug #3192166). - if (g_sci->getGameId() == GID_LONGBOW && g_sci->getEngineState()->currentRoomNumber() == 95) { - // HACK: Don't set a signal here in the intro of Longbow, as that makes some dialog - // boxes disappear too soon (bug #3044844). - } else { - writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET); - } + writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET); if (_soundVersion <= SCI_VERSION_0_LATE) { processStopSound(obj, false); } else { diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp index ebcfac6054a9..608c77136fc4 100644 --- a/engines/sci/video/robot_decoder.cpp +++ b/engines/sci/video/robot_decoder.cpp @@ -22,11 +22,13 @@ #include "common/archive.h" #include "common/stream.h" +#include "common/substream.h" #include "common/system.h" #include "common/textconsole.h" #include "common/util.h" #include "graphics/surface.h" +#include "audio/audiostream.h" #include "audio/decoders/raw.h" #include "sci/resource.h" @@ -63,57 +65,26 @@ namespace Sci { // our graphics engine, it looks just like a part of the room. A RBT can move // around the screen and go behind other objects. (...) -#ifdef ENABLE_SCI32 - -enum robotPalTypes { +enum RobotPalTypes { kRobotPalVariable = 0, kRobotPalConstant = 1 }; -RobotDecoder::RobotDecoder(Audio::Mixer *mixer, bool isBigEndian) { - _surface = 0; - _width = 0; - _height = 0; +RobotDecoder::RobotDecoder(bool isBigEndian) { _fileStream = 0; - _audioStream = 0; - _dirtyPalette = false; _pos = Common::Point(0, 0); - _mixer = mixer; _isBigEndian = isBigEndian; + _frameTotalSize = 0; } RobotDecoder::~RobotDecoder() { close(); } -bool RobotDecoder::load(GuiResourceId id) { - // TODO: RAMA's robot 1003 cannot be played (shown at the menu screen) - - // its drawn at odd coordinates. SV can't play it either (along with some - // others), so it must be some new functionality added in RAMA's robot - // videos. Skip it for now. - if (g_sci->getGameId() == GID_RAMA && id == 1003) - return false; - - // TODO: The robot video in the Lighthouse demo gets stuck - if (g_sci->getGameId() == GID_LIGHTHOUSE && id == 16) - return false; - - Common::String fileName = Common::String::format("%d.rbt", id); - Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(fileName); - - if (!stream) { - warning("Unable to open robot file %s", fileName.c_str()); - return false; - } - - return loadStream(stream); -} - bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) { close(); _fileStream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), _isBigEndian, DisposeAfterUse::YES); - _surface = new Graphics::Surface(); readHeaderChunk(); @@ -125,131 +96,60 @@ bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) { if (_header.version < 4 || _header.version > 6) error("Unknown robot version: %d", _header.version); - if (_header.hasSound) { - _audioStream = Audio::makeQueuingAudioStream(11025, false); - _mixer->playStream(Audio::Mixer::kMusicSoundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance()); - } + RobotVideoTrack *videoTrack = new RobotVideoTrack(_header.frameCount); + addTrack(videoTrack); - readPaletteChunk(_header.paletteDataSize); - readFrameSizesChunk(); - calculateVideoDimensions(); - _surface->create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); + if (_header.hasSound) + addTrack(new RobotAudioTrack()); + videoTrack->readPaletteChunk(_fileStream, _header.paletteDataSize); + readFrameSizesChunk(); + videoTrack->calculateVideoDimensions(_fileStream, _frameTotalSize); return true; } -void RobotDecoder::readHeaderChunk() { - // Header (60 bytes) - _fileStream->skip(6); - _header.version = _fileStream->readUint16(); - _header.audioChunkSize = _fileStream->readUint16(); - _header.audioSilenceSize = _fileStream->readUint16(); - _fileStream->skip(2); - _header.frameCount = _fileStream->readUint16(); - _header.paletteDataSize = _fileStream->readUint16(); - _header.unkChunkDataSize = _fileStream->readUint16(); - _fileStream->skip(5); - _header.hasSound = _fileStream->readByte(); - _fileStream->skip(34); - - // Some videos (e.g. robot 1305 in Phantasmagoria and - // robot 184 in Lighthouse) have an unknown chunk before - // the palette chunk (probably used for sound preloading). - // Skip it here. - if (_header.unkChunkDataSize) - _fileStream->skip(_header.unkChunkDataSize); -} - -void RobotDecoder::readPaletteChunk(uint16 chunkSize) { - byte *paletteData = new byte[chunkSize]; - _fileStream->read(paletteData, chunkSize); - - // SCI1.1 palette - byte palFormat = paletteData[32]; - uint16 palColorStart = paletteData[25]; - uint16 palColorCount = READ_SCI11ENDIAN_UINT16(paletteData + 29); +bool RobotDecoder::load(GuiResourceId id) { + // TODO: RAMA's robot 1003 cannot be played (shown at the menu screen) - + // its drawn at odd coordinates. SV can't play it either (along with some + // others), so it must be some new functionality added in RAMA's robot + // videos. Skip it for now. + if (g_sci->getGameId() == GID_RAMA && id == 1003) + return false; + + // TODO: The robot video in the Lighthouse demo gets stuck + if (g_sci->getGameId() == GID_LIGHTHOUSE && id == 16) + return false; - int palOffset = 37; - memset(_palette, 0, 256 * 3); + Common::String fileName = Common::String::format("%d.rbt", id); + Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(fileName); - for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) { - if (palFormat == kRobotPalVariable) - palOffset++; - _palette[colorNo * 3 + 0] = paletteData[palOffset++]; - _palette[colorNo * 3 + 1] = paletteData[palOffset++]; - _palette[colorNo * 3 + 2] = paletteData[palOffset++]; + if (!stream) { + warning("Unable to open robot file %s", fileName.c_str()); + return false; } - _dirtyPalette = true; - delete[] paletteData; + return loadStream(stream); } +void RobotDecoder::close() { + VideoDecoder::close(); -void RobotDecoder::readFrameSizesChunk() { - // The robot video file contains 2 tables, with one entry for each frame: - // - A table containing the size of the image in each video frame - // - A table containing the total size of each video frame. - // In v5 robots, the tables contain 16-bit integers, whereas in v6 robots, - // they contain 32-bit integers. - - _frameTotalSize = new uint32[_header.frameCount]; - - // TODO: The table reading code can probably be removed once the - // audio chunk size is figured out (check the TODO inside processNextFrame()) -#if 0 - // We don't need any of the two tables to play the video, so we ignore - // both of them. - uint16 wordSize = _header.version == 6 ? 4 : 2; - _fileStream->skip(_header.frameCount * wordSize * 2); -#else - switch (_header.version) { - case 4: - case 5: // sizes are 16-bit integers - // Skip table with frame image sizes, as we don't need it - _fileStream->skip(_header.frameCount * 2); - for (int i = 0; i < _header.frameCount; ++i) - _frameTotalSize[i] = _fileStream->readUint16(); - break; - case 6: // sizes are 32-bit integers - // Skip table with frame image sizes, as we don't need it - _fileStream->skip(_header.frameCount * 4); - for (int i = 0; i < _header.frameCount; ++i) - _frameTotalSize[i] = _fileStream->readUint32(); - break; - default: - error("Can't yet handle index table for robot version %d", _header.version); - } -#endif - - // 2 more unknown tables - _fileStream->skip(1024 + 512); + delete _fileStream; + _fileStream = 0; - // Pad to nearest 2 kilobytes - uint32 curPos = _fileStream->pos(); - if (curPos & 0x7ff) - _fileStream->seek((curPos & ~0x7ff) + 2048); + delete[] _frameTotalSize; + _frameTotalSize = 0; } -void RobotDecoder::calculateVideoDimensions() { - // This is an O(n) operation, as each frame has a different size. - // We need to know the actual frame size to have a constant video size. - uint32 pos = _fileStream->pos(); - - for (uint32 curFrame = 0; curFrame < _header.frameCount; curFrame++) { - _fileStream->skip(4); - uint16 frameWidth = _fileStream->readUint16(); - uint16 frameHeight = _fileStream->readUint16(); - if (frameWidth > _width) - _width = frameWidth; - if (frameHeight > _height) - _height = frameHeight; - _fileStream->skip(_frameTotalSize[curFrame] - 8); - } +void RobotDecoder::readNextPacket() { + // Get our track + RobotVideoTrack *videoTrack = (RobotVideoTrack *)getTrack(0); + videoTrack->increaseCurFrame(); + Graphics::Surface *surface = videoTrack->getSurface(); - _fileStream->seek(pos); -} + if (videoTrack->endOfTrack()) + return; -const Graphics::Surface *RobotDecoder::decodeNextFrame() { // Read frame image header (24 bytes) _fileStream->skip(3); byte frameScale = _fileStream->readByte(); @@ -258,23 +158,28 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() { _fileStream->skip(4); // unknown, almost always 0 uint16 frameX = _fileStream->readUint16(); uint16 frameY = _fileStream->readUint16(); + // TODO: In v4 robot files, frameX and frameY have a different meaning. // Set them both to 0 for v4 for now, so that robots in PQ:SWAT show up // correctly. if (_header.version == 4) frameX = frameY = 0; + uint16 compressedSize = _fileStream->readUint16(); uint16 frameFragments = _fileStream->readUint16(); _fileStream->skip(4); // unknown uint32 decompressedSize = frameWidth * frameHeight * frameScale / 100; + // FIXME: A frame's height + position can go off limits... why? With the // following, we cut the contents to fit the frame - uint16 scaledHeight = CLIP(decompressedSize / frameWidth, 0, _height - frameY); + uint16 scaledHeight = CLIP(decompressedSize / frameWidth, 0, surface->h - frameY); + // FIXME: Same goes for the frame's width + position. In this case, we // modify the position to fit the contents on screen. - if (frameWidth + frameX > _width) - frameX = _width - frameWidth; - assert (frameWidth + frameX <= _width && scaledHeight + frameY <= _height); + if (frameWidth + frameX > surface->w) + frameX = surface->w - frameWidth; + + assert(frameWidth + frameX <= surface->w && scaledHeight + frameY <= surface->h); DecompressorLZS lzs; byte *decompressedFrame = new byte[decompressedSize]; @@ -305,24 +210,23 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() { // Copy over the decompressed frame byte *inFrame = decompressedFrame; - byte *outFrame = (byte *)_surface->pixels; + byte *outFrame = (byte *)surface->pixels; // Black out the surface - memset(outFrame, 0, _width * _height); + memset(outFrame, 0, surface->w * surface->h); // Move to the correct y coordinate - outFrame += _width * frameY; + outFrame += surface->w * frameY; for (uint16 y = 0; y < scaledHeight; y++) { memcpy(outFrame + frameX, inFrame, frameWidth); inFrame += frameWidth; - outFrame += _width; + outFrame += surface->w; } delete[] decompressedFrame; - // +1 because we start with frame number -1 - uint32 audioChunkSize = _frameTotalSize[_curFrame + 1] - (24 + compressedSize); + uint32 audioChunkSize = _frameTotalSize[videoTrack->getCurFrame()] - (24 + compressedSize); // TODO: The audio chunk size below is usually correct, but there are some // exceptions (e.g. robot 4902 in Phantasmagoria, towards its end) @@ -337,51 +241,166 @@ const Graphics::Surface *RobotDecoder::decodeNextFrame() { // Queue the next audio frame // FIXME: For some reason, there are audio hiccups/gaps if (_header.hasSound) { - _fileStream->skip(8); // header - _audioStream->queueBuffer(g_sci->_audio->getDecodedRobotAudioFrame(_fileStream, audioChunkSize - 8), - (audioChunkSize - 8) * 2, DisposeAfterUse::NO, - Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN); + RobotAudioTrack *audioTrack = (RobotAudioTrack *)getTrack(1); + _fileStream->skip(8); // header + audioChunkSize -= 8; + audioTrack->queueBuffer(g_sci->_audio->getDecodedRobotAudioFrame(_fileStream, audioChunkSize), audioChunkSize * 2); } else { _fileStream->skip(audioChunkSize); - } - - if (_curFrame == -1) - _startTime = g_system->getMillis(); + } +} - _curFrame++; +void RobotDecoder::readHeaderChunk() { + // Header (60 bytes) + _fileStream->skip(6); + _header.version = _fileStream->readUint16(); + _header.audioChunkSize = _fileStream->readUint16(); + _header.audioSilenceSize = _fileStream->readUint16(); + _fileStream->skip(2); + _header.frameCount = _fileStream->readUint16(); + _header.paletteDataSize = _fileStream->readUint16(); + _header.unkChunkDataSize = _fileStream->readUint16(); + _fileStream->skip(5); + _header.hasSound = _fileStream->readByte(); + _fileStream->skip(34); - return _surface; + // Some videos (e.g. robot 1305 in Phantasmagoria and + // robot 184 in Lighthouse) have an unknown chunk before + // the palette chunk (probably used for sound preloading). + // Skip it here. + if (_header.unkChunkDataSize) + _fileStream->skip(_header.unkChunkDataSize); } -void RobotDecoder::close() { - if (!_fileStream) - return; +void RobotDecoder::readFrameSizesChunk() { + // The robot video file contains 2 tables, with one entry for each frame: + // - A table containing the size of the image in each video frame + // - A table containing the total size of each video frame. + // In v5 robots, the tables contain 16-bit integers, whereas in v6 robots, + // they contain 32-bit integers. - delete _fileStream; - _fileStream = 0; + _frameTotalSize = new uint32[_header.frameCount]; + // TODO: The table reading code can probably be removed once the + // audio chunk size is figured out (check the TODO inside processNextFrame()) +#if 0 + // We don't need any of the two tables to play the video, so we ignore + // both of them. + uint16 wordSize = _header.version == 6 ? 4 : 2; + _fileStream->skip(_header.frameCount * wordSize * 2); +#else + switch (_header.version) { + case 4: + case 5: // sizes are 16-bit integers + // Skip table with frame image sizes, as we don't need it + _fileStream->skip(_header.frameCount * 2); + for (int i = 0; i < _header.frameCount; ++i) + _frameTotalSize[i] = _fileStream->readUint16(); + break; + case 6: // sizes are 32-bit integers + // Skip table with frame image sizes, as we don't need it + _fileStream->skip(_header.frameCount * 4); + for (int i = 0; i < _header.frameCount; ++i) + _frameTotalSize[i] = _fileStream->readUint32(); + break; + default: + error("Can't yet handle index table for robot version %d", _header.version); + } +#endif + + // 2 more unknown tables + _fileStream->skip(1024 + 512); + + // Pad to nearest 2 kilobytes + uint32 curPos = _fileStream->pos(); + if (curPos & 0x7ff) + _fileStream->seek((curPos & ~0x7ff) + 2048); +} + +RobotDecoder::RobotVideoTrack::RobotVideoTrack(int frameCount) : _frameCount(frameCount) { + _surface = new Graphics::Surface(); + _curFrame = -1; + _dirtyPalette = false; +} + +RobotDecoder::RobotVideoTrack::~RobotVideoTrack() { _surface->free(); delete _surface; - _surface = 0; +} - if (_header.hasSound) { - _mixer->stopHandle(_audioHandle); - //delete _audioStream; _audioStream = 0; +uint16 RobotDecoder::RobotVideoTrack::getWidth() const { + return _surface->w; +} + +uint16 RobotDecoder::RobotVideoTrack::getHeight() const { + return _surface->h; +} + +Graphics::PixelFormat RobotDecoder::RobotVideoTrack::getPixelFormat() const { + return _surface->format; +} + +void RobotDecoder::RobotVideoTrack::readPaletteChunk(Common::SeekableSubReadStreamEndian *stream, uint16 chunkSize) { + byte *paletteData = new byte[chunkSize]; + stream->read(paletteData, chunkSize); + + // SCI1.1 palette + byte palFormat = paletteData[32]; + uint16 palColorStart = paletteData[25]; + uint16 palColorCount = READ_SCI11ENDIAN_UINT16(paletteData + 29); + + int palOffset = 37; + memset(_palette, 0, 256 * 3); + + for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) { + if (palFormat == kRobotPalVariable) + palOffset++; + _palette[colorNo * 3 + 0] = paletteData[palOffset++]; + _palette[colorNo * 3 + 1] = paletteData[palOffset++]; + _palette[colorNo * 3 + 2] = paletteData[palOffset++]; } - reset(); + _dirtyPalette = true; + delete[] paletteData; } -void RobotDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); +void RobotDecoder::RobotVideoTrack::calculateVideoDimensions(Common::SeekableSubReadStreamEndian *stream, uint32 *frameSizes) { + // This is an O(n) operation, as each frame has a different size. + // We need to know the actual frame size to have a constant video size. + uint32 pos = stream->pos(); + + uint16 width = 0, height = 0; + + for (int curFrame = 0; curFrame < _frameCount; curFrame++) { + stream->skip(4); + uint16 frameWidth = stream->readUint16(); + uint16 frameHeight = stream->readUint16(); + if (frameWidth > width) + width = frameWidth; + if (frameHeight > height) + height = frameHeight; + stream->skip(frameSizes[curFrame] - 8); + } + + stream->seek(pos); + + _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); } -void RobotDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); +RobotDecoder::RobotAudioTrack::RobotAudioTrack() { + _audioStream = Audio::makeQueuingAudioStream(11025, false); } -#endif +RobotDecoder::RobotAudioTrack::~RobotAudioTrack() { + delete _audioStream; +} + +void RobotDecoder::RobotAudioTrack::queueBuffer(byte *buffer, int size) { + _audioStream->queueBuffer(buffer, size, DisposeAfterUse::YES, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN); +} + +Audio::AudioStream *RobotDecoder::RobotAudioTrack::getAudioStream() const { + return _audioStream; +} } // End of namespace Sci diff --git a/engines/sci/video/robot_decoder.h b/engines/sci/video/robot_decoder.h index e9cefe7d9139..ebc3262939a0 100644 --- a/engines/sci/video/robot_decoder.h +++ b/engines/sci/video/robot_decoder.h @@ -25,84 +25,103 @@ #include "common/rational.h" #include "common/rect.h" -#include "common/stream.h" -#include "common/substream.h" -#include "audio/audiostream.h" -#include "audio/mixer.h" -#include "graphics/pixelformat.h" #include "video/video_decoder.h" -namespace Sci { +namespace Audio { +class QueuingAudioStream; +} -#ifdef ENABLE_SCI32 - -struct RobotHeader { - // 6 bytes, identifier bytes - uint16 version; - uint16 audioChunkSize; - uint16 audioSilenceSize; - // 2 bytes, unknown - uint16 frameCount; - uint16 paletteDataSize; - uint16 unkChunkDataSize; - // 5 bytes, unknown - byte hasSound; - // 34 bytes, unknown -}; +namespace Common { +class SeekableSubReadStreamEndian; +} + +namespace Sci { -class RobotDecoder : public Video::FixedRateVideoDecoder { +class RobotDecoder : public Video::VideoDecoder { public: - RobotDecoder(Audio::Mixer *mixer, bool isBigEndian); + RobotDecoder(bool isBigEndian); virtual ~RobotDecoder(); bool loadStream(Common::SeekableReadStream *stream); bool load(GuiResourceId id); void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _width; } - uint16 getHeight() const { return _height; } - uint32 getFrameCount() const { return _header.frameCount; } - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } + void setPos(uint16 x, uint16 y) { _pos = Common::Point(x, y); } Common::Point getPos() const { return _pos; } protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); - - // FixedRateVideoDecoder API - Common::Rational getFrameRate() const { return Common::Rational(60, 10); } - + void readNextPacket(); + private: + class RobotVideoTrack : public FixedRateVideoTrack { + public: + RobotVideoTrack(int frameCount); + ~RobotVideoTrack(); + + uint16 getWidth() const; + uint16 getHeight() const; + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame() { return _surface; } + const byte *getPalette() const { _dirtyPalette = false; return _palette; } + bool hasDirtyPalette() const { return _dirtyPalette; } + + void readPaletteChunk(Common::SeekableSubReadStreamEndian *stream, uint16 chunkSize); + void calculateVideoDimensions(Common::SeekableSubReadStreamEndian *stream, uint32 *frameSizes); + Graphics::Surface *getSurface() { return _surface; } + void increaseCurFrame() { _curFrame++; } + + protected: + Common::Rational getFrameRate() const { return Common::Rational(60, 10); } + + private: + int _frameCount; + int _curFrame; + byte _palette[256 * 3]; + mutable bool _dirtyPalette; + Graphics::Surface *_surface; + }; + + class RobotAudioTrack : public AudioTrack { + public: + RobotAudioTrack(); + ~RobotAudioTrack(); + + Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kMusicSoundType; } + + void queueBuffer(byte *buffer, int size); + + protected: + Audio::AudioStream *getAudioStream() const; + + private: + Audio::QueuingAudioStream *_audioStream; + }; + + struct RobotHeader { + // 6 bytes, identifier bytes + uint16 version; + uint16 audioChunkSize; + uint16 audioSilenceSize; + // 2 bytes, unknown + uint16 frameCount; + uint16 paletteDataSize; + uint16 unkChunkDataSize; + // 5 bytes, unknown + byte hasSound; + // 34 bytes, unknown + } _header; + void readHeaderChunk(); - void readPaletteChunk(uint16 chunkSize); void readFrameSizesChunk(); - void calculateVideoDimensions(); - - void freeData(); - RobotHeader _header; Common::Point _pos; bool _isBigEndian; + uint32 *_frameTotalSize; Common::SeekableSubReadStreamEndian *_fileStream; - - uint16 _width; - uint16 _height; - uint32 *_frameTotalSize; - byte _palette[256 * 3]; - bool _dirtyPalette; - Graphics::Surface *_surface; - Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _audioHandle; - Audio::Mixer *_mixer; }; -#endif } // End of namespace Sci diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp index abd64911a795..a7b6346ecafc 100644 --- a/engines/sci/video/seq_decoder.cpp +++ b/engines/sci/video/seq_decoder.cpp @@ -41,33 +41,44 @@ enum seqFrameTypes { kSeqFrameDiff = 1 }; -SeqDecoder::SeqDecoder() { - _fileStream = 0; - _surface = 0; - _dirtyPalette = false; +SEQDecoder::SEQDecoder(uint frameDelay) : _frameDelay(frameDelay) { } -SeqDecoder::~SeqDecoder() { +SEQDecoder::~SEQDecoder() { close(); } -bool SeqDecoder::loadStream(Common::SeekableReadStream *stream) { +bool SEQDecoder::loadStream(Common::SeekableReadStream *stream) { close(); + addTrack(new SEQVideoTrack(stream, _frameDelay)); + + return true; +} + +SEQDecoder::SEQVideoTrack::SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay) { + assert(stream); + assert(frameDelay != 0); _fileStream = stream; + _frameDelay = frameDelay; + _curFrame = -1; + _surface = new Graphics::Surface(); _surface->create(SEQ_SCREEN_WIDTH, SEQ_SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _frameCount = _fileStream->readUint16LE(); - // Set palette - int paletteChunkSize = _fileStream->readUint32LE(); - readPaletteChunk(paletteChunkSize); + // Set initial palette + readPaletteChunk(_fileStream->readUint32LE()); +} - return true; +SEQDecoder::SEQVideoTrack::~SEQVideoTrack() { + delete _fileStream; + _surface->free(); + delete _surface; } -void SeqDecoder::readPaletteChunk(uint16 chunkSize) { +void SEQDecoder::SEQVideoTrack::readPaletteChunk(uint16 chunkSize) { byte *paletteData = new byte[chunkSize]; _fileStream->read(paletteData, chunkSize); @@ -91,23 +102,7 @@ void SeqDecoder::readPaletteChunk(uint16 chunkSize) { delete[] paletteData; } -void SeqDecoder::close() { - if (!_fileStream) - return; - - _frameDelay = 0; - - delete _fileStream; - _fileStream = 0; - - _surface->free(); - delete _surface; - _surface = 0; - - reset(); -} - -const Graphics::Surface *SeqDecoder::decodeNextFrame() { +const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() { int16 frameWidth = _fileStream->readUint16LE(); int16 frameHeight = _fileStream->readUint16LE(); int16 frameLeft = _fileStream->readUint16LE(); @@ -142,9 +137,6 @@ const Graphics::Surface *SeqDecoder::decodeNextFrame() { delete[] buf; } - if (_curFrame == -1) - _startTime = g_system->getMillis(); - _curFrame++; return _surface; } @@ -159,7 +151,7 @@ const Graphics::Surface *SeqDecoder::decodeNextFrame() { } \ memcpy(dest + writeRow * SEQ_SCREEN_WIDTH + writeCol, litData + litPos, n); -bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) { +bool SEQDecoder::SEQVideoTrack::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) { int writeRow = 0; int writeCol = left; int litPos = 0; @@ -237,4 +229,9 @@ bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litS return true; } +const byte *SEQDecoder::SEQVideoTrack::getPalette() const { + _dirtyPalette = false; + return _palette; +} + } // End of namespace Sci diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h index 800a3c9024de..890f349feb9f 100644 --- a/engines/sci/video/seq_decoder.h +++ b/engines/sci/video/seq_decoder.h @@ -40,44 +40,49 @@ namespace Sci { /** * Implementation of the Sierra SEQ decoder, used in KQ6 DOS floppy/CD and GK1 DOS */ -class SeqDecoder : public Video::FixedRateVideoDecoder { +class SEQDecoder : public Video::VideoDecoder { public: - SeqDecoder(); - virtual ~SeqDecoder(); + SEQDecoder(uint frameDelay); + virtual ~SEQDecoder(); bool loadStream(Common::SeekableReadStream *stream); - void close(); - - void setFrameDelay(int frameDelay) { _frameDelay = frameDelay; } - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return SEQ_SCREEN_WIDTH; } - uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; } - uint32 getFrameCount() const { return _frameCount; } - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - -protected: - Common::Rational getFrameRate() const { assert(_frameDelay); return Common::Rational(60, _frameDelay); } private: - enum { - SEQ_SCREEN_WIDTH = 320, - SEQ_SCREEN_HEIGHT = 200 + class SEQVideoTrack : public FixedRateVideoTrack { + public: + SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay); + ~SEQVideoTrack(); + + uint16 getWidth() const { return SEQ_SCREEN_WIDTH; } + uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; } + Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame(); + const byte *getPalette() const; + bool hasDirtyPalette() const { return _dirtyPalette; } + + protected: + Common::Rational getFrameRate() const { return Common::Rational(60, _frameDelay); } + + private: + enum { + SEQ_SCREEN_WIDTH = 320, + SEQ_SCREEN_HEIGHT = 200 + }; + + void readPaletteChunk(uint16 chunkSize); + bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey); + + Common::SeekableReadStream *_fileStream; + int _curFrame, _frameCount; + byte _palette[256 * 3]; + mutable bool _dirtyPalette; + Graphics::Surface *_surface; + uint _frameDelay; }; - void readPaletteChunk(uint16 chunkSize); - bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey); - - uint16 _width, _height; - uint16 _frameDelay; - Common::SeekableReadStream *_fileStream; - byte _palette[256 * 3]; - bool _dirtyPalette; - uint32 _frameCount; - Graphics::Surface *_surface; + uint _frameDelay; }; } // End of namespace Sci diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index ebf1a2675cec..5404c7f8b1e0 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -20,9 +20,6 @@ * */ -// FIXME: Avoid using printf -#define FORBIDDEN_SYMBOL_EXCEPTION_printf - #include "base/plugins.h" #include "common/archive.h" @@ -1066,15 +1063,19 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co // unknown MD5, or with a medium debug level in case of a known MD5 (for // debugging purposes). if (!findInMD5Table(res.md5.c_str())) { - printf("Your game version appears to be unknown. If this is *NOT* a fan-modified\n"); - printf("version (in particular, not a fan-made translation), please, report the\n"); - printf("following data to the ScummVM team along with name of the game you tried\n"); - printf("to add and its version/language/etc.:\n"); + Common::String md5Warning; + + md5Warning = "Your game version appears to be unknown. If this is *NOT* a fan-modified\n"; + md5Warning += "version (in particular, not a fan-made translation), please, report the\n"; + md5Warning += "following data to the ScummVM team along with name of the game you tried\n"; + md5Warning += "to add and its version/language/etc.:\n"; - printf(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n", + md5Warning += Common::String::format(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n", res.game.gameid, generateFilenameForDetection(res.fp.pattern, res.fp.genMethod).c_str(), res.md5.c_str()); + + g_system->logMessage(LogMessageType::kWarning, md5Warning.c_str()); } else { debug(1, "Using MD5 '%s'", res.md5.c_str()); } @@ -1266,7 +1267,6 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot); SaveStateDescriptor desc(slot, saveDesc); - desc.setDeletableFlag(true); desc.setThumbnail(thumbnail); SaveStateMetaInfos infos; diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 40e99c26a80d..be17a3b3058b 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -40,7 +40,7 @@ MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) : _vm(vm) { _video = new Video::BinkDecoder(); else #endif - _video = new Video::SmackerDecoder(mixer); + _video = new Video::SmackerDecoder(); _flags = 0; _wizResNum = 0; @@ -61,11 +61,16 @@ int MoviePlayer::load(const char *filename, int flags, int image) { if (_video->isVideoLoaded()) _video->close(); + // Ensure that Bink will use our PixelFormat + _video->setDefaultHighColorFormat(g_system->getScreenFormat()); + if (!_video->loadFile(filename)) { warning("Failed to load video file %s", filename); return -1; } + _video->start(); + debug(1, "Playing video %s", filename); if (flags & 2) diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 0814e3bfe116..d4eefe8c2801 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Fri Jun 15 09:16:45 2012 + This file was generated by the md5table tool on Sat Jul 07 23:39:27 2012 DO NOT EDIT MANUALLY! */ @@ -191,6 +191,7 @@ static const MD5Table md5table[] = { { "45082a5c9f42ba14dacfe1fdeeba819d", "freddicove", "HE 100", "Demo", 18422, Common::EN_ANY, Common::kPlatformUnknown }, { "45152f7cf2ba8f43cf8a8ea2e740ae09", "monkey", "VGA", "VGA", 8357, Common::ES_ESP, Common::kPlatformPC }, { "4521138d15d1fd7649c31fb981746231", "pajama2", "HE 98.5", "Demo", -1, Common::DE_DEU, Common::kPlatformUnknown }, + { "4522564b3c31aaf218b6a96826a549fd", "maze", "HE 99", "", -1, Common::EN_USA, Common::kPlatformWindows }, { "46b53fd430adcfbed791b48a0d4b079f", "funpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC }, { "470c45b636139bb40716daa1c7edaad0", "loom", "EGA", "EGA", -1, Common::DE_DEU, Common::kPlatformPC }, { "477dbafbd66a53c98416dc01aef019ad", "monkey", "EGA", "EGA", -1, Common::IT_ITA, Common::kPlatformPC }, diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index ddafd964ebc9..f7add4eed285 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -37,6 +37,7 @@ #include "gui/message.h" +#include "video/dxa_decoder.h" #include "video/psx_decoder.h" #include "video/smk_decoder.h" @@ -96,9 +97,8 @@ static const char *const sequenceListPSX[20] = { // Basic movie player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType) - : _vm(vm), _textMan(textMan), _resMan(resMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) { - _bgSoundStream = NULL; +MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType) + : _vm(vm), _textMan(textMan), _resMan(resMan), _system(system) { _decoderType = decoderType; _decoder = decoder; @@ -107,7 +107,6 @@ MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio:: } MoviePlayer::~MoviePlayer() { - delete _bgSoundHandle; delete _decoder; } @@ -116,16 +115,12 @@ MoviePlayer::~MoviePlayer() { * @param id the id of the file */ bool MoviePlayer::load(uint32 id) { - Common::File f; Common::String filename; - if (_decoderType == kVideoDecoderDXA) - _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(sequenceList[id]); - else - _bgSoundStream = NULL; - if (SwordEngine::_systemVars.showText) { + Common::File f; filename = Common::String::format("%s.txt", sequenceList[id]); + if (f.open(filename)) { Common::String line; int lineNo = 0; @@ -169,7 +164,6 @@ bool MoviePlayer::load(uint32 id) { _movieTexts.push_back(MovieText(startFrame, endFrame, ptr, color)); lastEnd = endFrame; } - f.close(); } } @@ -189,6 +183,7 @@ bool MoviePlayer::load(uint32 id) { // Need to load here in case it fails in which case we'd need // to go back to paletted mode if (_decoder->loadFile(filename)) { + _decoder->start(); return true; } else { initGraphics(g_system->getWidth(), g_system->getHeight(), true); @@ -197,30 +192,27 @@ bool MoviePlayer::load(uint32 id) { break; } - return _decoder->loadFile(filename.c_str()); -} + if (!_decoder->loadFile(filename)) + return false; -void MoviePlayer::play() { - if (_bgSoundStream) - _snd->playStream(Audio::Mixer::kSFXSoundType, _bgSoundHandle, _bgSoundStream); + // For DXA, also add the external sound file + if (_decoderType == kVideoDecoderDXA) + _decoder->addStreamFileTrack(sequenceList[id]); - bool terminated = false; + _decoder->start(); + return true; +} +void MoviePlayer::play() { _textX = 0; _textY = 0; - terminated = !playVideo(); - - if (terminated) - _snd->stopHandle(*_bgSoundHandle); + playVideo(); _textMan->releaseText(2, false); _movieTexts.clear(); - while (_snd->isSoundHandleActive(*_bgSoundHandle)) - _system->delayMillis(100); - // It's tempting to call _screen->fullRefresh() here to restore the old // palette. However, that causes glitches with DXA movies, where the // previous location would be momentarily drawn, before switching to @@ -320,7 +312,7 @@ bool MoviePlayer::playVideo() { } if (_decoder->hasDirtyPalette()) { - _decoder->setSystemPalette(); + _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256); if (!_movieTexts.empty()) { // Look for the best color indexes to use to display the subtitles @@ -506,24 +498,12 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { scaledFrame.free(); } -DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle) - : _mixer(mixer), _bgSoundHandle(bgSoundHandle) { -} - -uint32 DXADecoderWithSound::getTime() const { - if (_mixer->isSoundHandleActive(*_bgSoundHandle)) - return _mixer->getSoundElapsedTime(*_bgSoundHandle); - - return DXADecoder::getTime(); -} - /////////////////////////////////////////////////////////////////////////////// // Factory function for creating the appropriate cutscene player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system) { +MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system) { Common::String filename; - Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle; // For the PSX version, we'll try the PlayStation stream files if (vm->isPsx()) { @@ -534,7 +514,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * #ifdef USE_RGB_COLOR // All BS1 PSX videos run the videos at 2x speed Video::VideoDecoder *psxDecoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x); - return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, psxDecoder, kVideoDecoderPSX); + return new MoviePlayer(vm, textMan, resMan, system, psxDecoder, kVideoDecoderPSX); #else GUI::MessageDialog dialog(Common::String::format(_("PSX stream cutscene '%s' cannot be played in paletted mode"), filename.c_str()), _("OK")); dialog.runModal(); @@ -546,20 +526,20 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * filename = Common::String::format("%s.smk", sequenceList[id]); if (Common::File::exists(filename)) { - Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd); - return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK); + Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(); + return new MoviePlayer(vm, textMan, resMan, system, smkDecoder, kVideoDecoderSMK); } filename = Common::String::format("%s.dxa", sequenceList[id]); if (Common::File::exists(filename)) { #ifdef USE_ZLIB - DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle); - return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA); + Video::VideoDecoder *dxaDecoder = new Video::DXADecoder(); + return new MoviePlayer(vm, textMan, resMan, system, dxaDecoder, kVideoDecoderDXA); #else GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK")); dialog.runModal(); - return NULL; + return 0; #endif } @@ -569,7 +549,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * if (Common::File::exists(filename)) { GUI::MessageDialog dialog(_("MPEG2 cutscenes are no longer supported"), _("OK")); dialog.runModal(); - return NULL; + return 0; } if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) { @@ -578,7 +558,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * dialog.runModal(); } - return NULL; + return 0; } } // End of namespace Sword1 diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index c2ed86a1a33d..d0c61f5eb35f 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -23,16 +23,19 @@ #ifndef SWORD1_ANIMATION_H #define SWORD1_ANIMATION_H -#include "video/dxa_decoder.h" -#include "video/video_decoder.h" - #include "common/list.h" -#include "audio/audiostream.h" - #include "sword1/screen.h" #include "sword1/sound.h" +namespace Graphics { +struct Surface; +} + +namespace Video { +class VideoDecoder; +} + namespace Sword1 { enum DecoderType { @@ -55,21 +58,9 @@ class MovieText { } }; -class DXADecoderWithSound : public Video::DXADecoder { -public: - DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle); - ~DXADecoderWithSound() {} - - uint32 getTime() const; - -private: - Audio::Mixer *_mixer; - Audio::SoundHandle *_bgSoundHandle; -}; - class MoviePlayer { public: - MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType); + MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType); virtual ~MoviePlayer(); bool load(uint32 id); void play(); @@ -78,7 +69,6 @@ class MoviePlayer { SwordEngine *_vm; Text *_textMan; ResMan *_resMan; - Audio::Mixer *_snd; OSystem *_system; Common::List _movieTexts; int _textX, _textY, _textWidth, _textHeight; @@ -88,8 +78,6 @@ class MoviePlayer { DecoderType _decoderType; Video::VideoDecoder *_decoder; - Audio::SoundHandle *_bgSoundHandle; - Audio::AudioStream *_bgSoundStream; bool playVideo(); void performPostProcessing(byte *screen); @@ -100,7 +88,7 @@ class MoviePlayer { void convertColor(byte r, byte g, byte b, float &h, float &s, float &v); }; -MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system); +MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system); } // End of namespace Sword1 diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 087dcd09d83e..5662e4672b3e 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -268,9 +268,6 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int SaveStateDescriptor desc(slot, name); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - if (versionSave < 2) // These older version of the savegames used a flag to signal presence of thumbnail in->skip(1); diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index 8e04861edf0d..757d7687805c 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -959,7 +959,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3 // meantime, we don't want any looping sound effects still playing. _sound->quitScreen(); - MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _mixer, _system); + MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _system); if (player) { _screen->clearScreen(); if (player->load(sequenceId)) diff --git a/engines/sword1/objectman.cpp b/engines/sword1/objectman.cpp index d0803590a783..5d1864d58d48 100644 --- a/engines/sword1/objectman.cpp +++ b/engines/sword1/objectman.cpp @@ -99,13 +99,64 @@ uint8 ObjectMan::fnCheckForTextLine(uint32 textId) { char *ObjectMan::lockText(uint32 textId) { uint8 lang = SwordEngine::_systemVars.language; + char *text = lockText(textId, lang); + if (text == 0) { + if (lang != BS1_ENGLISH) { + text = lockText(textId, BS1_ENGLISH); + if (text != 0) + warning("Missing translation for textId %u (\"%s\")", textId, text); + unlockText(textId, BS1_ENGLISH); + } + + return _missingSubTitleStr; + } + return text; +} + +char *ObjectMan::lockText(uint32 textId, uint8 lang) { char *addr = (char *)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]); if (addr == 0) - return _missingSubTitleStr; + return NULL; addr += sizeof(Header); if ((textId & ITM_ID) >= _resMan->readUint32(addr)) { + // Workaround for missing sentences in some langages in the demo. + switch(textId) { + case 8455194: + return const_cast(_translationId8455194[lang]); + case 8455195: + return const_cast(_translationId8455195[lang]); + case 8455196: + return const_cast(_translationId8455196[lang]); + case 8455197: + return const_cast(_translationId8455197[lang]); + case 8455198: + return const_cast(_translationId8455198[lang]); + case 8455199: + return const_cast(_translationId8455199[lang]); + case 8455200: + return const_cast(_translationId8455200[lang]); + case 8455201: + return const_cast(_translationId8455201[lang]); + case 8455202: + return const_cast(_translationId8455202[lang]); + case 8455203: + return const_cast(_translationId8455203[lang]); + case 8455204: + return const_cast(_translationId8455204[lang]); + case 8455205: + return const_cast(_translationId8455205[lang]); + case 6488080: + return const_cast(_translationId6488080[lang]); + case 6488081: + return const_cast(_translationId6488081[lang]); + case 6488082: + return const_cast(_translationId6488082[lang]); + case 6488083: + return const_cast(_translationId6488083[lang]); + } + warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, _resMan->readUint32(addr)); - return _missingSubTitleStr; + return NULL; } uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1) * 4); if (offset == 0) { @@ -113,15 +164,19 @@ char *ObjectMan::lockText(uint32 textId) { // We use the hardcoded text in this case. if (textId == 2950145) return const_cast(_translationId2950145[lang]); - + warning("ObjectMan::lockText(%d): text number has no text lines", textId); - return _missingSubTitleStr; + return NULL; } return addr + offset; } void ObjectMan::unlockText(uint32 textId) { - _resMan->resClose(_textList[textId / ITM_PER_SEC][SwordEngine::_systemVars.language]); + unlockText(textId, SwordEngine::_systemVars.language); +} + +void ObjectMan::unlockText(uint32 textId, uint8 lang) { + _resMan->resClose(_textList[textId / ITM_PER_SEC][lang]); } uint32 ObjectMan::lastTextNumber(int section) { @@ -186,7 +241,193 @@ const char *const ObjectMan::_translationId2950145[7] = { "Eh?", // Italian "\277Eh?", // Spanish "Ano?", // Czech - " " // Portuguese + NULL // Portuguese +}; + +// The translations for the next texts are missing in the demo but are present +// in the full game. The translations were therefore extracted from the full game. + +// Missing translation for textId 8455194 (in the demo). +const char *const ObjectMan::_translationId8455194[7] = { + NULL, // "Who was the guy you were supposed to meet?", // English (not needed) + "Qui \351tait l'homme que vous deviez rencontrer?", // French + "Wer war der Typ, den Du treffen wolltest?", // German + "Chi dovevi incontrare?", // Italian + "\277Qui\351n era el hombre con el que ten\355as que encontrarte?", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455195 (in the demo). +const char *const ObjectMan::_translationId8455195[7] = { + NULL, // "His name was Plantard. I didn't know him, but he called me last night.", // English (not needed) + "Son nom \351tait Plantard. Je ne le connaissais pas, mais il m'avait t\351l\351phon\351 la veille.", // French + "Sein Name war Plantard. Ich kannte ihn nicht, aber er hat mich letzte Nacht angerufen.", // German + "Si chiamava Plantard. Mi ha chiamato ieri sera, ma non lo conoscevo.", // Italian + "Su nombre era Plantard. Yo no lo conoc\355a pero \351l me llam\363 ayer por la noche.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455196 (in the demo). +const char *const ObjectMan::_translationId8455196[7] = { + NULL, // "He said he had a story which would interest me.", // English (not needed) + "Il a dit qu'il avait une histoire qui devrait m'int\351resser.", // French + "Er sagte, er h\344tte eine Story, die mich interessieren w\374rde.", // German + "Mi disse che aveva una storia che mi poteva interessare.", // Italian + "Dijo que ten\355a una historia que me interesar\355a.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455197 (in the demo). +const char *const ObjectMan::_translationId8455197[7] = { + NULL, // "He asked me to meet him at the caf\351.", // English (not needed) + "Il m'a demand\351 de le rencontrer au caf\351.", // French + "Er fragte mich, ob wir uns im Caf\351 treffen k\366nnten.", // German + "Mi chiese di incontrarci al bar.", // Italian + "Me pidi\363 que nos encontr\341ramos en el caf\351.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455198 (in the demo). +const char *const ObjectMan::_translationId8455198[7] = { + NULL, // "I guess I'll never know what he wanted to tell me...", // English (not needed) + "Je suppose que je ne saurai jamais ce qu'il voulait me dire...", // French + "Ich werde wohl nie erfahren, was er mir sagen wollte...", // German + "Penso che non sapr\362 mai che cosa voleva dirmi...", // Italian + "Supongo que nunca sabr\351 qu\351 me quer\355a contar...", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455199 (in the demo). +const char *const ObjectMan::_translationId8455199[7] = { + NULL, // "Not unless you have Rosso's gift for psychic interrogation.", // English (not needed) + "Non, \340 moins d'avoir les dons de Rosso pour les interrogatoires psychiques.", // French + "Es sei denn, Du h\344ttest Rosso's Gabe der parapsychologischen Befragung.", // German + "A meno che tu non riesca a fare interrogatori telepatici come Rosso.", // Italian + "A no ser que tengas el don de Rosso para la interrogaci\363n ps\355quica.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455200 (in the demo). +const char *const ObjectMan::_translationId8455200[7] = { + NULL, // "How did Plantard get your name?", // English (not needed) + "Comment Plantard a-t-il obtenu votre nom?", // French + "Woher hat Plantard Deinen Namen?", // German + "Come ha fatto Plantard a sapere il tuo nome?", // Italian + "\277C\363mo consigui\363 Plantard tu nombre?", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455201 (in the demo). +const char *const ObjectMan::_translationId8455201[7] = { + NULL, // "Through the newspaper - La Libert\351.", // English (not needed) + "Par mon journal... La Libert\351.", // French + "\334ber die Zeitung - La Libert\351.", // German + "Tramite il giornale La Libert\351.", // Italian + "Por el peri\363dico - La Libert\351.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455202 (in the demo). +const char *const ObjectMan::_translationId8455202[7] = { + NULL, // "I'd written an article linking two unsolved murders, one in Italy, the other in Japan.", // English (not needed) + "J'ai \351crit un article o\371 je faisais le lien entre deux meurtres inexpliqu\351s, en Italie et au japon.", // French + "Ich habe einen Artikel geschrieben, in dem ich zwei ungel\366ste Morde miteinander in Verbindung bringe, einen in Italien, einen anderen in Japan.", // German + "Ho scritto un articolo che metteva in collegamento due omicidi insoluti in Italia e Giappone.", // Italian + "Yo hab\355a escrito un art\355culo conectando dos asesinatos sin resolver, uno en Italia, el otro en Jap\363n.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455203 (in the demo). +const char *const ObjectMan::_translationId8455203[7] = { + NULL, // "The cases were remarkably similar...", // English (not needed) + "Les affaires \351taient quasiment identiques...", // French + "Die F\344lle sind sich bemerkenswert \344hnlich...", // German + "I casi erano sorprendentemente uguali...", // Italian + "Los casos eran incre\355blemente parecidos...", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455204 (in the demo). +const char *const ObjectMan::_translationId8455204[7] = { + NULL, // "...a wealthy victim, no apparent motive, and a costumed killer.", // English (not needed) + "...une victime riche, pas de motif apparent, et un tueur d\351guis\351.", // French + "...ein wohlhabendes Opfer, kein offensichtliches Motiv, und ein verkleideter Killer.", // German + "...una vittima ricca, nessun motivo apparente e un assassino in costume.", // Italian + "...una v\355ctima rica, sin motivo aparente, y un asesino disfrazado.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 8455205 (in the demo). +const char *const ObjectMan::_translationId8455205[7] = { + NULL, // "Plantard said he could supply me with more information.", // English (not needed) + "Plantard m'a dit qu'il pourrait me fournir des renseignements.", // French + "Plantard sagte, er k\366nne mir weitere Informationen beschaffen.", // German + "Plantard mi disse che mi avrebbe fornito ulteriori informazioni.", // Italian + "Plantard dijo que \351l me pod\355a proporcionar m\341s informaci\363n.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 6488080 (in the demo). +const char *const ObjectMan::_translationId6488080[7] = { + NULL, // "I wasn't going to head off all over Paris until I'd investigated some more.", // English (not needed) + "Je ferais mieux d'enqu\351ter un peu par ici avant d'aller me promener ailleurs.", // French + "Ich durchquere nicht ganz Paris, bevor ich etwas mehr herausgefunden habe.", // German + "Non mi sarei incamminato per tutta Parigi prima di ulteriori indagini.", // Italian + "No iba a ponerme a recorrer Par\355s sin haber investigado un poco m\341s.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// The next three sentences are specific to the demo and only the english text is present. +// The translations were provided by: +// French: Thierry Crozat +// German: Simon Sawatzki +// Italian: Matteo Angelino +// Spanish: Tomás Maidagan + +// Missing translation for textId 6488081 (in the demo). +const char *const ObjectMan::_translationId6488081[7] = { + NULL, // "I wasn't sure what I was going to do when I caught up with that clown...", // English (not needed) + "Je ne savais pas ce que je ferais quand je rattraperais le clown...", // French + "Ich wu\337te nicht, worauf ich mich einlie\337, als ich dem Clown nachjagte...", // German + "Non sapevo cosa avrei fatto una volta raggiunto quel clown...", // Italian + "No sab\355a muy bien qu\351 es lo que har\355a cuando alcanzara al payaso...", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 6488082 (in the demo). +const char *const ObjectMan::_translationId6488082[7] = { + NULL, // "...but before I knew it, I was drawn into a desperate race between two ruthless enemies.", // English (not needed) + "...mais avant de m'en rendre compte je me retrouvais happ\351 dans une course effr\351n\351e entre deux ennemis impitoyables.", // French + "... doch bevor ich mich versah, war ich inmitten eines Wettlaufs von zwei r\374cksichtslosen Feinden.", // German + "... ma prima che me ne rendessi conto, fui trascinato in una corsa disperata con due spietati nemici.", // Italian + "...pero sin darme cuenta, acab\351 en medio de una desesperada carrera entre dos despiadados enemigos.", // Spanish + NULL, // Czech + NULL // Portuguese +}; + +// Missing translation for textId 6488083 (in the demo). +const char *const ObjectMan::_translationId6488083[7] = { + NULL, // "The goal: the mysterious power of the Broken Sword.", // English (not needed) + "Le but: les pouvoirs myst\351rieux de l'\351p\351e bris\351e.", // French + "Das Ziel: die geheimnisvolle Macht des zerbrochenen Schwertes.", // German + "Obiettivo: il misterioso potere della Spada spezzata.", // Italian + "El objetivo: el misterioso poder de la Espada Rota.", // Spanish + NULL, // Czech + NULL // Portuguese }; } // End of namespace Sword1 diff --git a/engines/sword1/objectman.h b/engines/sword1/objectman.h index ca3c7c152681..197b437c15a8 100644 --- a/engines/sword1/objectman.h +++ b/engines/sword1/objectman.h @@ -53,6 +53,9 @@ class ObjectMan { void saveLiveList(uint16 *dest); // for loading/saving void loadLiveList(uint16 *src); private: + char *lockText(uint32 textId, uint8 language); + void unlockText(uint32 textId, uint8 language); + ResMan *_resMan; static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files @@ -60,6 +63,22 @@ class ObjectMan { uint8 *_cptData[TOTAL_SECTIONS]; static char _missingSubTitleStr[]; static const char *const _translationId2950145[7]; //translation for textId 2950145 (missing from cluster file for some langages) + static const char *const _translationId8455194[7]; //translation for textId 8455194 (missing in the demo) + static const char *const _translationId8455195[7]; //translation for textId 8455195 (missing in the demo) + static const char *const _translationId8455196[7]; //translation for textId 8455196 (missing in the demo) + static const char *const _translationId8455197[7]; //translation for textId 8455197 (missing in the demo) + static const char *const _translationId8455198[7]; //translation for textId 8455198 (missing in the demo) + static const char *const _translationId8455199[7]; //translation for textId 8455199 (missing in the demo) + static const char *const _translationId8455200[7]; //translation for textId 8455200 (missing in the demo) + static const char *const _translationId8455201[7]; //translation for textId 8455201 (missing in the demo) + static const char *const _translationId8455202[7]; //translation for textId 8455202 (missing in the demo) + static const char *const _translationId8455203[7]; //translation for textId 8455203 (missing in the demo) + static const char *const _translationId8455204[7]; //translation for textId 8455204 (missing in the demo) + static const char *const _translationId8455205[7]; //translation for textId 8455205 (missing in the demo) + static const char *const _translationId6488080[7]; //translation for textId 6488081 (missing in the demo) + static const char *const _translationId6488081[7]; //translation for textId 6488081 (missing in the demo) + static const char *const _translationId6488082[7]; //translation for textId 6488082 (missing in the demo) + static const char *const _translationId6488083[7]; //translation for textId 6488083 (missing in the demo) }; } // End of namespace Sword1 diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 3574074b0061..61bf5257ab96 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -142,7 +142,7 @@ void Sound::checkSpeechFileEndianness() { be_diff_sum += fabs((double)(be_value - prev_be_value)); prev_be_value = be_value; } - delete [] data; + delete[] data; } // Set the big endian flag _bigEndianSpeech = (be_diff_sum < le_diff_sum); diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 5e3f8929e977..00260f789a91 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -38,8 +38,11 @@ #include "sword2/screen.h" #include "sword2/animation.h" +#include "graphics/palette.h" + #include "gui/message.h" +#include "video/dxa_decoder.h" #include "video/smk_decoder.h" #include "video/psx_decoder.h" @@ -51,9 +54,8 @@ namespace Sword2 { // Basic movie player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer::MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType) - : _vm(vm), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) { - _bgSoundStream = NULL; +MoviePlayer::MoviePlayer(Sword2Engine *vm, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType) + : _vm(vm), _system(system) { _decoderType = decoderType; _decoder = decoder; @@ -62,7 +64,6 @@ MoviePlayer::MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, A } MoviePlayer::~MoviePlayer() { - delete _bgSoundHandle; delete _decoder; } @@ -75,11 +76,6 @@ bool MoviePlayer::load(const char *name) { if (_vm->shouldQuit()) return false; - if (_decoderType == kVideoDecoderDXA) - _bgSoundStream = Audio::SeekableAudioStream::openStreamFile(name); - else - _bgSoundStream = NULL; - _textSurface = NULL; Common::String filename; @@ -99,6 +95,7 @@ bool MoviePlayer::load(const char *name) { // Need to load here in case it fails in which case we'd need // to go back to paletted mode if (_decoder->loadFile(filename)) { + _decoder->start(); return true; } else { initGraphics(640, 480, true); @@ -106,7 +103,15 @@ bool MoviePlayer::load(const char *name) { } } - return _decoder->loadFile(filename.c_str()); + if (!_decoder->loadFile(filename)) + return false; + + // For DXA, also add the external sound file + if (_decoderType == kVideoDecoderDXA) + _decoder->addStreamFileTrack(name); + + _decoder->start(); + return true; } void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut) { @@ -122,24 +127,15 @@ void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadI if (leadIn) _vm->_sound->playMovieSound(leadIn, kLeadInSound); - if (_bgSoundStream) - _snd->playStream(Audio::Mixer::kSFXSoundType, _bgSoundHandle, _bgSoundStream); - - bool terminated = false; - - terminated = !playVideo(); + bool terminated = !playVideo(); closeTextObject(_currentMovieText, NULL, 0); if (terminated) { - _snd->stopHandle(*_bgSoundHandle); _vm->_sound->stopMovieSounds(); _vm->_sound->stopSpeech(); } - while (_snd->isSoundHandleActive(*_bgSoundHandle)) - _system->delayMillis(100); - if (_decoderType == kVideoDecoderPSX) { // Need to jump back to paletted color initGraphics(640, 480, true); @@ -336,7 +332,7 @@ bool MoviePlayer::playVideo() { } if (_decoder->hasDirtyPalette()) { - _decoder->setSystemPalette(); + _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256); uint32 maxWeight = 0; uint32 minWeight = 0xFFFFFFFF; @@ -406,31 +402,19 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { scaledFrame.free(); } -DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle) - : _mixer(mixer), _bgSoundHandle(bgSoundHandle) { -} - -uint32 DXADecoderWithSound::getTime() const { - if (_mixer->isSoundHandleActive(*_bgSoundHandle)) - return _mixer->getSoundElapsedTime(*_bgSoundHandle); - - return DXADecoder::getTime(); -} - /////////////////////////////////////////////////////////////////////////////// // Factory function for creating the appropriate cutscene player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, uint32 frameCount) { +MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system, uint32 frameCount) { Common::String filename; - Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle; filename = Common::String::format("%s.str", name); if (Common::File::exists(filename)) { #ifdef USE_RGB_COLOR Video::VideoDecoder *psxDecoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x, frameCount); - return new MoviePlayer(vm, snd, system, bgSoundHandle, psxDecoder, kVideoDecoderPSX); + return new MoviePlayer(vm, system, psxDecoder, kVideoDecoderPSX); #else GUI::MessageDialog dialog(_("PSX cutscenes found but ScummVM has been built without RGB color support"), _("OK")); dialog.runModal(); @@ -441,16 +425,16 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *s filename = Common::String::format("%s.smk", name); if (Common::File::exists(filename)) { - Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd); - return new MoviePlayer(vm, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK); + Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(); + return new MoviePlayer(vm, system, smkDecoder, kVideoDecoderSMK); } filename = Common::String::format("%s.dxa", name); if (Common::File::exists(filename)) { #ifdef USE_ZLIB - DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle); - return new MoviePlayer(vm, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA); + Video::DXADecoder *dxaDecoder = new Video::DXADecoder(); + return new MoviePlayer(vm, system, dxaDecoder, kVideoDecoderDXA); #else GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK")); dialog.runModal(); diff --git a/engines/sword2/animation.h b/engines/sword2/animation.h index 3d5c42b7f740..b2a243b2ca96 100644 --- a/engines/sword2/animation.h +++ b/engines/sword2/animation.h @@ -25,12 +25,16 @@ #ifndef SWORD2_ANIMATION_H #define SWORD2_ANIMATION_H -#include "video/dxa_decoder.h" -#include "video/video_decoder.h" -#include "audio/mixer.h" - #include "sword2/screen.h" +namespace Graphics { +struct Surface; +} + +namespace Video { +class VideoDecoder; +} + namespace Sword2 { enum DecoderType { @@ -55,20 +59,9 @@ struct MovieText { } }; -class DXADecoderWithSound : public Video::DXADecoder { -public: - DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle); - ~DXADecoderWithSound() {} - - uint32 getTime() const; -private: - Audio::Mixer *_mixer; - Audio::SoundHandle *_bgSoundHandle; -}; - class MoviePlayer { public: - MoviePlayer(Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType); + MoviePlayer(Sword2Engine *vm, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType); virtual ~MoviePlayer(); bool load(const char *name); @@ -76,7 +69,6 @@ class MoviePlayer { protected: Sword2Engine *_vm; - Audio::Mixer *_snd; OSystem *_system; MovieText *_movieTexts; uint32 _numMovieTexts; @@ -87,8 +79,6 @@ class MoviePlayer { DecoderType _decoderType; Video::VideoDecoder *_decoder; - Audio::SoundHandle *_bgSoundHandle; - Audio::AudioStream *_bgSoundStream; uint32 _leadOut; int _leadOutFrame; @@ -105,7 +95,7 @@ class MoviePlayer { uint32 getWhiteColor(); }; -MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *snd, OSystem *system, uint32 frameCount); +MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system, uint32 frameCount); } // End of namespace Sword2 diff --git a/engines/sword2/function.cpp b/engines/sword2/function.cpp index 836b252d6ca2..07fcaa094b0d 100644 --- a/engines/sword2/function.cpp +++ b/engines/sword2/function.cpp @@ -2139,7 +2139,7 @@ int32 Logic::fnPlaySequence(int32 *params) { uint32 frameCount = Sword2Engine::isPsx() ? params[1] : 0; - _moviePlayer = makeMoviePlayer(filename, _vm, _vm->_mixer, _vm->_system, frameCount); + _moviePlayer = makeMoviePlayer(filename, _vm, _vm->_system, frameCount); if (_moviePlayer && _moviePlayer->load(filename)) { _moviePlayer->play(_sequenceTextList, _sequenceTextLines, _smackerLeadIn, _smackerLeadOut); diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 9ee13b4b6d4f..a95532ec65ac 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -61,6 +61,7 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) { // Get the file and load it into the decoder Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(filename); _decoder.loadStream(in); + _decoder.start(); GraphicEngine *pGfx = Kernel::getInstance()->getGfx(); diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index 1d256e56ba85..2f5614b50596 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -39,7 +39,7 @@ #include "sword25/gfx/bitmap.h" #ifdef USE_THEORADEC -#include "sword25/fmv/theora_decoder.h" +#include "video/theora_decoder.h" #endif #define THEORA_INDIRECT_RENDERING @@ -141,7 +141,7 @@ class MoviePlayer : public Service { #ifdef USE_THEORADEC - TheoraDecoder _decoder; + Video::TheoraDecoder _decoder; Graphics::Surface *_backSurface; int _outX, _outY; diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp deleted file mode 100644 index d38f5a26cf31..000000000000 --- a/engines/sword25/fmv/theora_decoder.cpp +++ /dev/null @@ -1,565 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * Source is based on the player example from libvorbis package, - * available at: http://svn.xiph.org/trunk/theora/examples/player_example.c - * - * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. - * - * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 - * by the Xiph.Org Foundation and contributors http://www.xiph.org/ - * - */ - -#include "sword25/fmv/theora_decoder.h" - -#ifdef USE_THEORADEC -#include "common/system.h" -#include "common/textconsole.h" -#include "common/util.h" -#include "graphics/yuv_to_rgb.h" -#include "audio/decoders/raw.h" -#include "sword25/kernel/common.h" - -namespace Sword25 { - -#define AUDIOFD_FRAGSIZE 10240 - -static double rint(double v) { - return floor(v + 0.5); -} - -TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) { - _fileStream = 0; - - _theoraPacket = 0; - _vorbisPacket = 0; - _theoraDecode = 0; - _theoraSetup = 0; - _nextFrameStartTime = 0.0; - - _soundType = soundType; - _audStream = 0; - _audHandle = new Audio::SoundHandle(); - - ogg_sync_init(&_oggSync); - - _curFrame = -1; - _audiobuf = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t)); - - reset(); -} - -TheoraDecoder::~TheoraDecoder() { - close(); - delete _fileStream; - delete _audHandle; - free(_audiobuf); -} - -void TheoraDecoder::queuePage(ogg_page *page) { - if (_theoraPacket) - ogg_stream_pagein(&_theoraOut, page); - - if (_vorbisPacket) - ogg_stream_pagein(&_vorbisOut, page); -} - -int TheoraDecoder::bufferData() { - char *buffer = ogg_sync_buffer(&_oggSync, 4096); - int bytes = _fileStream->read(buffer, 4096); - - ogg_sync_wrote(&_oggSync, bytes); - - return bytes; -} - -bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) { - close(); - - _endOfAudio = false; - _endOfVideo = false; - _fileStream = stream; - - // start up Ogg stream synchronization layer - ogg_sync_init(&_oggSync); - - // init supporting Vorbis structures needed in header parsing - vorbis_info_init(&_vorbisInfo); - vorbis_comment_init(&_vorbisComment); - - // init supporting Theora structures needed in header parsing - th_comment_init(&_theoraComment); - th_info_init(&_theoraInfo); - - // Ogg file open; parse the headers - // Only interested in Vorbis/Theora streams - bool foundHeader = false; - while (!foundHeader) { - int ret = bufferData(); - - if (ret == 0) - break; - - while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) { - ogg_stream_state test; - - // is this a mandated initial header? If not, stop parsing - if (!ogg_page_bos(&_oggPage)) { - // don't leak the page; get it into the appropriate stream - queuePage(&_oggPage); - foundHeader = true; - break; - } - - ogg_stream_init(&test, ogg_page_serialno(&_oggPage)); - ogg_stream_pagein(&test, &_oggPage); - ogg_stream_packetout(&test, &_oggPacket); - - // identify the codec: try theora - if (!_theoraPacket && th_decode_headerin(&_theoraInfo, &_theoraComment, &_theoraSetup, &_oggPacket) >= 0) { - // it is theora - memcpy(&_theoraOut, &test, sizeof(test)); - _theoraPacket = 1; - } else if (!_vorbisPacket && vorbis_synthesis_headerin(&_vorbisInfo, &_vorbisComment, &_oggPacket) >= 0) { - // it is vorbis - memcpy(&_vorbisOut, &test, sizeof(test)); - _vorbisPacket = 1; - } else { - // whatever it is, we don't care about it - ogg_stream_clear(&test); - } - } - // fall through to non-bos page parsing - } - - // we're expecting more header packets. - while ((_theoraPacket && _theoraPacket < 3) || (_vorbisPacket && _vorbisPacket < 3)) { - int ret; - - // look for further theora headers - while (_theoraPacket && (_theoraPacket < 3) && (ret = ogg_stream_packetout(&_theoraOut, &_oggPacket))) { - if (ret < 0) - error("Error parsing Theora stream headers; corrupt stream?"); - - if (!th_decode_headerin(&_theoraInfo, &_theoraComment, &_theoraSetup, &_oggPacket)) - error("Error parsing Theora stream headers; corrupt stream?"); - - _theoraPacket++; - } - - // look for more vorbis header packets - while (_vorbisPacket && (_vorbisPacket < 3) && (ret = ogg_stream_packetout(&_vorbisOut, &_oggPacket))) { - if (ret < 0) - error("Error parsing Vorbis stream headers; corrupt stream?"); - - if (vorbis_synthesis_headerin(&_vorbisInfo, &_vorbisComment, &_oggPacket)) - error("Error parsing Vorbis stream headers; corrupt stream?"); - - _vorbisPacket++; - - if (_vorbisPacket == 3) - break; - } - - // The header pages/packets will arrive before anything else we - // care about, or the stream is not obeying spec - - if (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) { - queuePage(&_oggPage); // demux into the appropriate stream - } else { - ret = bufferData(); // someone needs more data - - if (ret == 0) - error("End of file while searching for codec headers."); - } - } - - // and now we have it all. initialize decoders - if (_theoraPacket) { - _theoraDecode = th_decode_alloc(&_theoraInfo, _theoraSetup); - debugN(1, "Ogg logical stream %lx is Theora %dx%d %.02f fps", - _theoraOut.serialno, _theoraInfo.pic_width, _theoraInfo.pic_height, - (double)_theoraInfo.fps_numerator / _theoraInfo.fps_denominator); - - switch (_theoraInfo.pixel_fmt) { - case TH_PF_420: - debug(1, " 4:2:0 video"); - break; - case TH_PF_422: - debug(1, " 4:2:2 video"); - break; - case TH_PF_444: - debug(1, " 4:4:4 video"); - break; - case TH_PF_RSVD: - default: - debug(1, " video\n (UNKNOWN Chroma sampling!)"); - break; - } - - if (_theoraInfo.pic_width != _theoraInfo.frame_width || _theoraInfo.pic_height != _theoraInfo.frame_height) - debug(1, " Frame content is %dx%d with offset (%d,%d).", - _theoraInfo.frame_width, _theoraInfo.frame_height, _theoraInfo.pic_x, _theoraInfo.pic_y); - - switch (_theoraInfo.colorspace){ - case TH_CS_UNSPECIFIED: - /* nothing to report */ - break; - case TH_CS_ITU_REC_470M: - debug(1, " encoder specified ITU Rec 470M (NTSC) color."); - break; - case TH_CS_ITU_REC_470BG: - debug(1, " encoder specified ITU Rec 470BG (PAL) color."); - break; - default: - debug(1, "warning: encoder specified unknown colorspace (%d).", _theoraInfo.colorspace); - break; - } - - debug(1, "Encoded by %s", _theoraComment.vendor); - if (_theoraComment.comments) { - debug(1, "theora comment header:"); - for (int i = 0; i < _theoraComment.comments; i++) { - if (_theoraComment.user_comments[i]) { - int len = _theoraComment.comment_lengths[i]; - char *value = (char *)malloc(len + 1); - if (value) { - memcpy(value, _theoraComment.user_comments[i], len); - value[len] = '\0'; - debug(1, "\t%s", value); - free(value); - } - } - } - } - - th_decode_ctl(_theoraDecode, TH_DECCTL_GET_PPLEVEL_MAX, &_ppLevelMax, sizeof(_ppLevelMax)); - _ppLevel = _ppLevelMax; - th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &_ppLevel, sizeof(_ppLevel)); - _ppInc = 0; - } else { - // tear down the partial theora setup - th_info_clear(&_theoraInfo); - th_comment_clear(&_theoraComment); - } - - th_setup_free(_theoraSetup); - _theoraSetup = 0; - - if (_vorbisPacket) { - vorbis_synthesis_init(&_vorbisDSP, &_vorbisInfo); - vorbis_block_init(&_vorbisDSP, &_vorbisBlock); - debug(3, "Ogg logical stream %lx is Vorbis %d channel %ld Hz audio.", - _vorbisOut.serialno, _vorbisInfo.channels, _vorbisInfo.rate); - - _audStream = Audio::makeQueuingAudioStream(_vorbisInfo.rate, _vorbisInfo.channels); - - // Get enough audio data to start us off - while (_audStream->numQueuedStreams() == 0) { - // Queue more data - bufferData(); - while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) - queuePage(&_oggPage); - - queueAudio(); - } - - if (_audStream) - g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _audHandle, _audStream, -1, getVolume(), getBalance()); - } else { - // tear down the partial vorbis setup - vorbis_info_clear(&_vorbisInfo); - vorbis_comment_clear(&_vorbisComment); - _endOfAudio = true; - } - - _surface.create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat()); - - // Set up a display surface - _displaySurface.pixels = _surface.getBasePtr(_theoraInfo.pic_x, _theoraInfo.pic_y); - _displaySurface.w = _theoraInfo.pic_width; - _displaySurface.h = _theoraInfo.pic_height; - _displaySurface.format = _surface.format; - _displaySurface.pitch = _surface.pitch; - - // Set the frame rate - _frameRate = Common::Rational(_theoraInfo.fps_numerator, _theoraInfo.fps_denominator); - - return true; -} - -void TheoraDecoder::close() { - if (_vorbisPacket) { - ogg_stream_clear(&_vorbisOut); - vorbis_block_clear(&_vorbisBlock); - vorbis_dsp_clear(&_vorbisDSP); - vorbis_comment_clear(&_vorbisComment); - vorbis_info_clear(&_vorbisInfo); - - g_system->getMixer()->stopHandle(*_audHandle); - - _audStream = 0; - _vorbisPacket = false; - } - if (_theoraPacket) { - ogg_stream_clear(&_theoraOut); - th_decode_free(_theoraDecode); - th_comment_clear(&_theoraComment); - th_info_clear(&_theoraInfo); - _theoraDecode = 0; - _theoraPacket = false; - } - - if (!_fileStream) - return; - - ogg_sync_clear(&_oggSync); - - delete _fileStream; - _fileStream = 0; - - _surface.free(); - _displaySurface.pixels = 0; - _displaySurface.free(); - - reset(); -} - -const Graphics::Surface *TheoraDecoder::decodeNextFrame() { - // First, let's get our frame - while (_theoraPacket) { - // theora is one in, one out... - if (ogg_stream_packetout(&_theoraOut, &_oggPacket) > 0) { - - if (_ppInc) { - _ppLevel += _ppInc; - th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &_ppLevel, sizeof(_ppLevel)); - _ppInc = 0; - } - - if (th_decode_packetin(_theoraDecode, &_oggPacket, NULL) == 0) { - _curFrame++; - - // Convert YUV data to RGB data - th_ycbcr_buffer yuv; - th_decode_ycbcr_out(_theoraDecode, yuv); - translateYUVtoRGBA(yuv); - - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - double time = th_granule_time(_theoraDecode, _oggPacket.granulepos); - - // We need to calculate when the next frame should be shown - // This is all in floating point because that's what the Ogg code gives us - // Ogg is a lossy container format, so it doesn't always list the time to the - // next frame. In such cases, we need to calculate it ourselves. - if (time == -1.0) - _nextFrameStartTime += _frameRate.getInverse().toDouble(); - else - _nextFrameStartTime = time; - - // break out - break; - } - } else { - // If we can't get any more frames, we're done. - if (_theoraOut.e_o_s || _fileStream->eos()) { - _endOfVideo = true; - break; - } - - // Queue more data - bufferData(); - while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) - queuePage(&_oggPage); - } - - // Update audio if we can - queueAudio(); - } - - // Force at least some audio to be buffered - // TODO: 5 is very arbitrary. We probably should do something like QuickTime does. - while (!_endOfAudio && _audStream->numQueuedStreams() < 5) { - bufferData(); - while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) - queuePage(&_oggPage); - - bool queuedAudio = queueAudio(); - if ((_vorbisOut.e_o_s || _fileStream->eos()) && !queuedAudio) { - _endOfAudio = true; - break; - } - } - - return &_displaySurface; -} - -bool TheoraDecoder::queueAudio() { - if (!_audStream) - return false; - - // An audio buffer should have been allocated (either in the constructor or after queuing the current buffer) - if (!_audiobuf) { - warning("[TheoraDecoder::queueAudio] Invalid audio buffer"); - return false; - } - - bool queuedAudio = false; - - for (;;) { - float **pcm; - - // if there's pending, decoded audio, grab it - int ret = vorbis_synthesis_pcmout(&_vorbisDSP, &pcm); - if (ret > 0) { - int count = _audiobufFill / 2; - int maxsamples = ((AUDIOFD_FRAGSIZE - _audiobufFill) / _vorbisInfo.channels) >> 1; - int i; - for (i = 0; i < ret && i < maxsamples; i++) - for (int j = 0; j < _vorbisInfo.channels; j++) { - int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767); - _audiobuf[count++] = val; - } - - vorbis_synthesis_read(&_vorbisDSP, i); - _audiobufFill += (i * _vorbisInfo.channels) << 1; - - if (_audiobufFill == AUDIOFD_FRAGSIZE) { - byte flags = Audio::FLAG_16BITS | Audio::FLAG_STEREO; -#ifdef SCUMM_LITTLE_ENDIAN - flags |= Audio::FLAG_LITTLE_ENDIAN; -#endif - _audStream->queueBuffer((byte *)_audiobuf, AUDIOFD_FRAGSIZE, DisposeAfterUse::NO, flags); - - // The audio mixer is now responsible for the old audio buffer. - // We need to create a new one. - _audiobuf = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t)); - if (!_audiobuf) { - warning("[TheoraDecoder::queueAudio] Cannot allocate memory for audio buffer"); - return false; - } - - _audiobufFill = 0; - queuedAudio = true; - } - } else { - // no pending audio; is there a pending packet to decode? - if (ogg_stream_packetout(&_vorbisOut, &_oggPacket) > 0) { - if (vorbis_synthesis(&_vorbisBlock, &_oggPacket) == 0) // test for success! - vorbis_synthesis_blockin(&_vorbisDSP, &_vorbisBlock); - } else // we've buffered all we have, break out for now - return queuedAudio; - } - } - - // Unreachable - return false; -} - -void TheoraDecoder::reset() { - VideoDecoder::reset(); - - // FIXME: This does a rewind() instead of a reset()! - - if (_fileStream) - _fileStream->seek(0); - - _audiobufFill = 0; - _audiobufReady = false; - - _curFrame = -1; - - _theoraPacket = 0; - _vorbisPacket = 0; -} - -bool TheoraDecoder::endOfVideo() const { - return !isVideoLoaded() || (_endOfVideo && (!_audStream || (_audStream->endOfData() && _endOfAudio))); -} - -uint32 TheoraDecoder::getTimeToNextFrame() const { - if (endOfVideo() || _curFrame < 0) - return 0; - - uint32 elapsedTime = getTime(); - uint32 nextFrameStartTime = (uint32)(_nextFrameStartTime * 1000); - - if (nextFrameStartTime <= elapsedTime) - return 0; - - return nextFrameStartTime - elapsedTime; -} - -uint32 TheoraDecoder::getTime() const { - if (_audStream) - return g_system->getMixer()->getSoundElapsedTime(*_audHandle); - - return VideoDecoder::getTime(); -} - -void TheoraDecoder::pauseVideoIntern(bool pause) { - if (_audStream) - g_system->getMixer()->pauseHandle(*_audHandle, pause); -} - -enum TheoraYUVBuffers { - kBufferY = 0, - kBufferU = 1, - kBufferV = 2 -}; - -void TheoraDecoder::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) { - // Width and height of all buffers have to be divisible by 2. - assert((YUVBuffer[kBufferY].width & 1) == 0); - assert((YUVBuffer[kBufferY].height & 1) == 0); - assert((YUVBuffer[kBufferU].width & 1) == 0); - assert((YUVBuffer[kBufferV].width & 1) == 0); - - // UV images have to have a quarter of the Y image resolution - assert(YUVBuffer[kBufferU].width == YUVBuffer[kBufferY].width >> 1); - assert(YUVBuffer[kBufferV].width == YUVBuffer[kBufferY].width >> 1); - assert(YUVBuffer[kBufferU].height == YUVBuffer[kBufferY].height >> 1); - assert(YUVBuffer[kBufferV].height == YUVBuffer[kBufferY].height >> 1); - - Graphics::convertYUV420ToRGB(&_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride); -} - -void TheoraDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(*_audHandle)) - g_system->getMixer()->setChannelVolume(*_audHandle, getVolume()); -} - -void TheoraDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(*_audHandle)) - g_system->getMixer()->setChannelBalance(*_audHandle, getBalance()); -} - -} // End of namespace Sword25 - -#endif diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h deleted file mode 100644 index 739040024fbd..000000000000 --- a/engines/sword25/fmv/theora_decoder.h +++ /dev/null @@ -1,144 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef SWORD25_THEORADECODER_H -#define SWORD25_THEORADECODER_H - -#include "common/scummsys.h" // for USE_THEORADEC - -#ifdef USE_THEORADEC - -#include "common/rational.h" -#include "video/video_decoder.h" -#include "audio/audiostream.h" -#include "audio/mixer.h" -#include "graphics/pixelformat.h" -#include "graphics/surface.h" - -#include -#include - -namespace Common { -class SeekableReadStream; -} - -namespace Sword25 { - -/** - * - * Decoder for Theora videos. - * Video decoder used in engines: - * - sword25 - */ -class TheoraDecoder : public Video::VideoDecoder { -public: - TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType); - virtual ~TheoraDecoder(); - - /** - * Load a video file - * @param stream the stream to load - */ - bool loadStream(Common::SeekableReadStream *stream); - void close(); - void reset(); - - /** - * Decode the next frame and return the frame's surface - * @note the return surface should *not* be freed - * @note this may return 0, in which case the last frame should be kept on screen - */ - const Graphics::Surface *decodeNextFrame(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _displaySurface.w; } - uint16 getHeight() const { return _displaySurface.h; } - - uint32 getFrameCount() const { - // It is not possible to get frame count easily - // I.e. seeking is required - assert(0); - return 0; - } - - Graphics::PixelFormat getPixelFormat() const { return _displaySurface.format; } - uint32 getTime() const; - uint32 getTimeToNextFrame() const; - - bool endOfVideo() const; - -protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); - void pauseVideoIntern(bool pause); - -private: - void queuePage(ogg_page *page); - bool queueAudio(); - int bufferData(); - void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer); - - Common::SeekableReadStream *_fileStream; - Graphics::Surface _surface; - Graphics::Surface _displaySurface; - Common::Rational _frameRate; - double _nextFrameStartTime; - bool _endOfVideo; - bool _endOfAudio; - - Audio::Mixer::SoundType _soundType; - Audio::SoundHandle *_audHandle; - Audio::QueuingAudioStream *_audStream; - - ogg_sync_state _oggSync; - ogg_page _oggPage; - ogg_packet _oggPacket; - ogg_stream_state _vorbisOut; - ogg_stream_state _theoraOut; - th_info _theoraInfo; - th_comment _theoraComment; - th_dec_ctx *_theoraDecode; - th_setup_info *_theoraSetup; - vorbis_info _vorbisInfo; - vorbis_dsp_state _vorbisDSP; - vorbis_block _vorbisBlock; - vorbis_comment _vorbisComment; - - int _theoraPacket; - int _vorbisPacket; - - int _ppLevelMax; - int _ppLevel; - int _ppInc; - - // single audio fragment audio buffering - int _audiobufFill; - bool _audiobufReady; - ogg_int16_t *_audiobuf; -}; - -} // End of namespace Sword25 - -#endif - -#endif diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk index 302120c5005e..e24a2212448e 100644 --- a/engines/sword25/module.mk +++ b/engines/sword25/module.mk @@ -85,11 +85,6 @@ MODULE_OBJS := \ util/pluto/pluto.o \ util/pluto/plzio.o -ifdef USE_THEORADEC -MODULE_OBJS += \ - fmv/theora_decoder.o -endif - # This module can be built as a plugin ifeq ($(ENABLE_SWORD25), DYNAMIC_PLUGIN) PLUGIN := 1 diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index 78b2db19eb00..69fae3dc4e74 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -239,16 +239,20 @@ void SoundEngine::setSoundVolume(uint handle, float volume) { debugC(1, kDebugSound, "SoundEngine::setSoundVolume(%d, %f)", handle, volume); SndHandle* sndHandle = findHandle(handle); - if (sndHandle != NULL) + if (sndHandle != NULL) { + sndHandle->volume = volume; _mixer->setChannelVolume(sndHandle->handle, (byte)(volume * 255)); + } } void SoundEngine::setSoundPanning(uint handle, float pan) { debugC(1, kDebugSound, "SoundEngine::setSoundPanning(%d, %f)", handle, pan); SndHandle* sndHandle = findHandle(handle); - if (sndHandle != NULL) + if (sndHandle != NULL) { + sndHandle->pan = pan; _mixer->setChannelBalance(sndHandle->handle, (int8)(pan * 127)); + } } void SoundEngine::pauseSound(uint handle) { @@ -324,13 +328,16 @@ bool SoundEngine::canLoadResource(const Common::String &fileName) { return fname.hasSuffix(".ogg"); } - - bool SoundEngine::persist(OutputPersistenceBlock &writer) { +bool SoundEngine::persist(OutputPersistenceBlock &writer) { writer.write(_maxHandleId); for (uint i = 0; i < SOUND_HANDLES; i++) { writer.write(_handles[i].id); + // Don't restart sounds which already finished playing. + if (_handles[i].type != kFreeHandle && !_mixer->isSoundHandleActive(_handles[i].handle)) + _handles[i].type = kFreeHandle; + writer.writeString(_handles[i].fileName); writer.write((int)_handles[i].sndType); writer.write(_handles[i].volume); @@ -374,7 +381,8 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) { reader.read(layer); if (reader.isGood()) { - playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i); + if (sndType != kFreeHandle) + playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i); } else return false; } diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp index d645e5ed2ada..b7f5e3034053 100644 --- a/engines/sword25/util/pluto/pluto.cpp +++ b/engines/sword25/util/pluto/pluto.cpp @@ -895,10 +895,10 @@ static void unpersistnumber(UnpersistInfo *upi) static void unpersiststring(UnpersistInfo *upi) { /* perms reftbl sptbl ref */ - int length; + size_t length; char* string; lua_checkstack(upi->L, 1); - verify(LIF(Z,read)(&upi->zio, &length, sizeof(int)) == 0); + verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0); string = pdep_newvector(upi->L, length, char); verify(LIF(Z,read)(&upi->zio, string, length) == 0); lua_pushlstring(upi->L, string, length); diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 8882531d273e..934727a47887 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -2252,7 +2252,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x78e0: - processCallback(0x50c5); + processCallback(0x505c); return false; case 0x78e7: @@ -2265,7 +2265,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x78f5: if (CHECK_FLAG(0xDB95, 1)) { - displayMessage(0x3575); + displayMessage(0x3E75); return true; } else return false; @@ -3925,7 +3925,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x39ae); break; default: - displayMessage(0x39b7); + displayMessage(0x3ab7); } return true; diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index dad876dd97bb..2de6f49c44d7 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -80,7 +80,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = { }; enum { - MAX_SAVES = 20 + MAX_SAVES = 20 }; class TeenAgentMetaEngine : public AdvancedMetaEngine { @@ -123,16 +123,15 @@ class TeenAgentMetaEngine : public AdvancedMetaEngine { virtual SaveStateList listSaves(const char *target) const { Common::String pattern = target; - pattern += ".*"; + pattern += ".??"; Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern); Common::sort(filenames.begin(), filenames.end()); SaveStateList saveList; for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - int slot; - const char *ext = strrchr(file->c_str(), '.'); - if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) { + int slot = atoi(file->c_str() + file->size() - 2); + if (slot >= 0 && slot < MAX_SAVES) { Common::ScopedPtr in(g_system->getSavefileManager()->openForLoading(*file)); if (!in) continue; @@ -174,7 +173,6 @@ class TeenAgentMetaEngine : public AdvancedMetaEngine { return SaveStateDescriptor(slot, desc); SaveStateDescriptor ssd(slot, desc); - ssd.setDeletableFlag(true); //checking for the thumbnail if (Graphics::Surface *const thumb = Graphics::loadThumbnail(*in)) diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp index 597ca670c0ac..dff58f98e299 100644 --- a/engines/teenagent/resources.cpp +++ b/engines/teenagent/resources.cpp @@ -22,6 +22,7 @@ #include "teenagent/resources.h" #include "teenagent/teenagent.h" #include "common/textconsole.h" +#include "common/translation.h" #include "common/zlib.h" namespace TeenAgent { @@ -64,28 +65,47 @@ bool Resources::loadArchives(const ADGameDescription *gd) { Common::File *dat_file = new Common::File(); if (!dat_file->open("teenagent.dat")) { delete dat_file; - Common::String errorMessage = "You're missing the 'teenagent.dat' file. Get it from the ScummVM website"; - GUIErrorMessage(errorMessage); + Common::String errorMessage = _("You're missing the 'teenagent.dat' file. Get it from the ScummVM website"); warning("%s", errorMessage.c_str()); + GUIErrorMessage(errorMessage); return false; } + + // teenagent.dat used to be compressed with zlib compression. The usage of + // zlib here is no longer needed, and it's maintained only for backwards + // compatibility. Common::SeekableReadStream *dat = Common::wrapCompressedReadStream(dat_file); + +#if !defined(USE_ZLIB) + uint16 header = dat->readUint16BE(); + bool isCompressed = (header == 0x1F8B || + ((header & 0x0F00) == 0x0800 && + header % 31 == 0)); + dat->seek(-2, SEEK_CUR); + + if (isCompressed) { + // teenagent.dat is compressed, but zlib hasn't been compiled in + delete dat; + Common::String errorMessage = _("The teenagent.dat file is compressed and zlib hasn't been included in this executable. Please decompress it"); + warning("%s", errorMessage.c_str()); + GUIErrorMessage(errorMessage); + return false; + } +#endif + cseg.read(dat, 0xb3b0); dseg.read(dat, 0xe790); eseg.read(dat, 0x8be2); - delete dat; - { - FilePack varia; - varia.open("varia.res"); - font7.load(varia, 7); - font7.width_pack = 1; - font7.height = 11; - font8.load(varia, 8); - font8.height = 31; - varia.close(); - } + FilePack varia; + varia.open("varia.res"); + font7.load(varia, 7); + font7.width_pack = 1; + font7.height = 11; + font8.load(varia, 8); + font8.height = 31; + varia.close(); off.open("off.res"); on.open("on.res"); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index f06de6f80315..57c069fe59f7 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -535,9 +535,8 @@ Common::Error TeenAgentEngine::run() { syncSoundSettings(); - _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false); setMusic(1); - music->start(); + _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false); int load_slot = Common::ConfigManager::instance().getInt("save_slot"); if (load_slot >= 0) { diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index 082694b72856..590e6c6d8190 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -1028,7 +1028,7 @@ TestExitStatus GFXtests::paletteRotation() { GFXTestSuite::setCustomColor(255, 0, 0); Testsuite::clearScreen(); - if(Testsuite::handleInteractiveInput("Did you see a rotation in colors of rectangles displayed on screen?", "Yes", "No", kOptionRight)) { + if (Testsuite::handleInteractiveInput("Did you see a rotation in colors of rectangles displayed on screen?", "Yes", "No", kOptionRight)) { return kTestFailed; } @@ -1121,7 +1121,7 @@ TestExitStatus GFXtests::pixelFormats() { g_system->updateScreen(); g_system->delayMillis(500); - if(Testsuite::handleInteractiveInput("Were you able to notice the colored rectangles on the screen for this format?", "Yes", "No", kOptionLeft)) { + if (Testsuite::handleInteractiveInput("Were you able to notice the colored rectangles on the screen for this format?", "Yes", "No", kOptionLeft)) { numPassed++; } else { numFailed++; diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp index 655179aa7473..39eeca31bd8e 100644 --- a/engines/testbed/testsuite.cpp +++ b/engines/testbed/testsuite.cpp @@ -289,7 +289,7 @@ void Testsuite::execute() { continue; } - if((*i)->isInteractive && !ConfParams.isSessionInteractive()) { + if ((*i)->isInteractive && !ConfParams.isSessionInteractive()) { logPrintf("Info! Skipping Test: %s, non-interactive environment is selected\n", ((*i)->featureName).c_str()); _numTestsSkipped++; continue; diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 0f662e22bdc6..2e4be33e5309 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -63,6 +63,14 @@ uint16 TinselEngine::getVersion() const { return _gameDescription->version; } +bool TinselEngine::getIsADGFDemo() const { + return (bool)(_gameDescription->desc.flags & ADGF_DEMO); +} + +bool TinselEngine::isCD() const { + return (bool)(_gameDescription->desc.flags & ADGF_CD); +} + } // End of namespace Tinsel static const PlainGameDescriptor tinselGames[] = { diff --git a/engines/tinsel/detection_tables.h b/engines/tinsel/detection_tables.h index b6b19f6ee7a3..631c2dce141d 100644 --- a/engines/tinsel/detection_tables.h +++ b/engines/tinsel/detection_tables.h @@ -47,7 +47,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_DEMO, + 0, TINSEL_V0, }, @@ -61,12 +61,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformPC, - ADGF_DEMO, + ADGF_DEMO | ADGF_CD, GUIO0() }, GID_DW1, 0, - GF_CD, + 0, TINSEL_V1, }, #if 0 @@ -81,12 +81,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformMacintosh, - ADGF_DEMO, + ADGF_DEMO | ADGF_CD, GUIO0() }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_BIG_ENDIAN, + GF_SCNFILES, TINSEL_V1, }, #endif @@ -110,7 +110,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -133,7 +133,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -156,7 +156,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -179,7 +179,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_FLOPPY | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -195,7 +195,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_FLOPPY | GF_ENHANCED_AUDIO_SUPPORT, + GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -214,7 +214,42 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_ENHANCED_AUDIO_SUPPORT, + GF_ENHANCED_AUDIO_SUPPORT, + TINSEL_V1, + }, + + { // Polish fan translation CD V1 version, with *.gra files (same as the floppy one, with english.smp) + { + "dw", + "CD", + { + {"dw.gra", 0, "ef05bbd2a754bd11a2e87bcd84ab5ccf", 781864}, + {"english.smp", 0, NULL, -1}, + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_CD, + GUIO_NONE + }, + GID_DW1, + 0, + GF_ENHANCED_AUDIO_SUPPORT, + TINSEL_V1, + }, + + { // Polish fan translaction floppy V1 version, with *.gra files + { + "dw", + "Floppy", + AD_ENTRY1s("dw.gra", "ef05bbd2a754bd11a2e87bcd84ab5ccf", 781864), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSPEECH + }, + GID_DW1, + 0, + GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -236,7 +271,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -261,7 +296,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -280,12 +315,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::DE_DEU, Common::kPlatformPC, - ADGF_DROPLANGUAGE | ADGF_CD, + ADGF_DROPLANGUAGE, GUIO0() }, GID_DW1, 0, - GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, { @@ -308,7 +343,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, { @@ -331,7 +366,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -351,7 +386,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -371,7 +406,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -390,7 +425,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -408,12 +443,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformPSX, - ADGF_DEMO, + ADGF_CD | ADGF_DEMO, GUIO0() }, GID_DW1, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V1, }, @@ -434,7 +469,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, #endif @@ -456,7 +491,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_BIG_ENDIAN, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, @@ -475,7 +510,7 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_ALT_MIDI, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT | GF_ALT_MIDI, TINSEL_V1, }, @@ -496,11 +531,32 @@ static const TinselGameDescription gameDescriptions[] = { }, GID_DW1, 0, - GF_CD | GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + TINSEL_V1, + }, + + { // Polish fan translaction Discworld 1 + { + "dw", + "CD", + { + {"dw.scn", 0, "fa169d2c98660215ebd84b49c1899eef", 776396}, + {"english.txt", 0, "c1a53eb7ec812689dab70e2bb22cf2ab", 224151}, + {"english.smp", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::PL_POL, + Common::kPlatformPC, + ADGF_CD, + GUIO_NONE + }, + GID_DW1, + 0, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, - { // English DW2 demo + { // English Discworld 2 demo { "dw2", "Demo", @@ -511,12 +567,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformPC, - ADGF_DEMO, + ADGF_DEMO | ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES | GF_DEMO, + GF_SCNFILES, TINSEL_V2, }, @@ -531,12 +587,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_GRB, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, @@ -551,12 +607,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::EN_USA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, @@ -571,12 +627,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::FR_FRA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, @@ -591,12 +647,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::DE_DEU, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, @@ -612,12 +668,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::IT_ITA, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, { @@ -632,12 +688,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::ES_ESP, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, @@ -653,12 +709,12 @@ static const TinselGameDescription gameDescriptions[] = { }, Common::RU_RUS, Common::kPlatformPC, - ADGF_NO_FLAGS, + ADGF_CD, GUIO1(GUIO_NOASPECT) }, GID_DW2, 0, - GF_CD | GF_SCNFILES, + GF_SCNFILES, TINSEL_V2, }, diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp index fbe9e8d1f69c..56ee2ea752c8 100644 --- a/engines/tinsel/dialogs.cpp +++ b/engines/tinsel/dialogs.cpp @@ -753,6 +753,11 @@ static CONFBOX t1RestartBox[] = { #endif }; +static CONFBOX t1RestartBoxPSX[] = { + { AAGBUT, INITGAME, TM_NONE, NULL, USE_POINTER, 122, 48, 23, 19, NULL, IX1_TICK1 }, + { AAGBUT, CLOSEWIN, TM_NONE, NULL, USE_POINTER, 82, 48, 23, 19, NULL, IX1_CROSS1 } +}; + static CONFBOX t2RestartBox[] = { { AAGBUT, INITGAME, TM_NONE, NULL, 0, 140, 78, BW, BH, NULL, IX2_TICK1 }, { AAGBUT, CLOSEWIN, TM_NONE, NULL, 0, 60, 78, BW, BH, NULL, IX2_CROSS1 } @@ -763,10 +768,10 @@ static CONFINIT t1ciRestart = { 6, 2, 72, 53, false, t1RestartBox, ARRAYSIZE(t1R #else static CONFINIT t1ciRestart = { 4, 2, 98, 53, false, t1RestartBox, ARRAYSIZE(t1RestartBox), SIX_RESTART_HEADING }; #endif +static CONFINIT t1ciRestartPSX = { 8, 2, 46, 53, false, t1RestartBoxPSX, ARRAYSIZE(t1RestartBoxPSX), SIX_RESTART_HEADING }; static CONFINIT t2ciRestart = { 4, 2, 196, 53, false, t2RestartBox, sizeof(t2RestartBox)/sizeof(CONFBOX), SS_RESTART_HEADING }; -#define ciRestart (TinselV2 ? t2ciRestart : t1ciRestart) -#define restartBox (TinselV2 ? t2RestartBox : t1RestartBox) +#define ciRestart (TinselV2 ? t2ciRestart : (TinselV1PSX ? t1ciRestartPSX : t1ciRestart)) /*-------------------------------------------------------------*\ | This is the sound control 'menu'. In Discworld 2, it also | @@ -1038,18 +1043,20 @@ static bool RePosition(); static bool LanguageChange() { LANGUAGE nLang = _vm->_config->_language; - if (_vm->getFeatures() & GF_USE_3FLAGS) { - // VERY quick dodgy bodge - if (cd.selBox == 0) - nLang = TXT_FRENCH; // = 1 - else if (cd.selBox == 1) - nLang = TXT_GERMAN; // = 2 - else - nLang = TXT_SPANISH; // = 4 - } else if (_vm->getFeatures() & GF_USE_4FLAGS) { - nLang = (LANGUAGE)(cd.selBox + 1); - } else if (_vm->getFeatures() & GF_USE_5FLAGS) { - nLang = (LANGUAGE)cd.selBox; + if ((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)) { + // Languages: TXT_ENGLISH, TXT_FRENCH, TXT_GERMAN, TXT_ITALIAN, TXT_SPANISH + // 5 flag versions include English + int selected = (_vm->getFeatures() & GF_USE_5FLAGS) ? cd.selBox : cd.selBox + 1; + // Make sure that a language flag has been selected. If the user has + // changed the language speed slider and hasn't clicked on a flag, it + // won't be selected. + if (selected >= 0 && selected <= 4) { + nLang = (LANGUAGE)selected; + + // 3 flag versions don't include Italian + if (selected >= 3 && (_vm->getFeatures() & GF_USE_3FLAGS)) + nLang = TXT_SPANISH; + } } if (nLang != _vm->_config->_language) { @@ -1255,6 +1262,20 @@ static INV_OBJECT *GetInvObject(int id) { error("GetInvObject(%d): Trying to manipulate undefined inventory icon", id); } +/** + * Returns true if the given id represents a valid inventory object + */ +bool GetIsInvObject(int id) { + INV_OBJECT *pObject = g_invObjects; + + for (int i = 0; i < g_numObjects; i++, pObject++) { + if (pObject->id == id) + return true; + } + + return false; +} + /** * Convert item ID number to index. */ diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h index 8c48eb8b76a8..ab53ba771c8c 100644 --- a/engines/tinsel/dialogs.h +++ b/engines/tinsel/dialogs.h @@ -152,6 +152,8 @@ void InvSetLimit(int invno, int n); void InvSetSize(int invno, int MinWidth, int MinHeight, int StartWidth, int StartHeight, int MaxWidth, int MaxHeight); +bool GetIsInvObject(int id); + int WhichInventoryOpen(); bool IsTopWindow(); diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp index 5c4b939e4ede..3ecef8375345 100644 --- a/engines/tinsel/drives.cpp +++ b/engines/tinsel/drives.cpp @@ -149,7 +149,7 @@ bool GotoCD() { bool TinselFile::_warningShown = false; -TinselFile::TinselFile() : ReadStreamEndian((_vm->getFeatures() & GF_BIG_ENDIAN) != 0) { +TinselFile::TinselFile() : ReadStreamEndian(TinselV1Mac) { _stream = NULL; } diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index c3089db99017..14d588dcece0 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -99,14 +99,16 @@ void SetupHandleTable() { MEMHANDLE *pH; TinselFile f; - if (f.open(TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)) { + const char *indexFileName = TinselV1PSX ? PSX_INDEX_FILENAME : INDEX_FILENAME; + + if (f.open(indexFileName)) { // get size of index file len = f.size(); if (len > 0) { if ((len % RECORD_SIZE) != 0) { // index file is corrupt - error(FILE_IS_CORRUPT, TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME); + error(FILE_IS_CORRUPT, indexFileName); } // calc number of handles @@ -132,16 +134,16 @@ void SetupHandleTable() { if (f.eos() || f.err()) { // index file is corrupt - error(FILE_IS_CORRUPT, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)); + error(FILE_IS_CORRUPT, indexFileName); } // close the file f.close(); } else { // index file is corrupt - error(FILE_IS_CORRUPT, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)); + error(FILE_IS_CORRUPT, indexFileName); } } else { // cannot find the index file - error(CANNOT_FIND_FILE, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)); + error(CANNOT_FIND_FILE, indexFileName); } // allocate memory nodes and load all permanent graphics diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index fa5334a0339e..b3bfbcc5dce2 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -131,16 +131,13 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { g_currentMidi = dwFileOffset; g_currentLoop = bLoop; - if (_vm->_config->_musicVolume != 0) { - bool mute = false; - if (ConfMan.hasKey("mute")) - mute = ConfMan.getBool("mute"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); - SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); - } + SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); // the index and length of the last tune loaded - static uint32 dwLastMidiIndex = 0; // FIXME: Avoid non-const global vars uint32 dwSeqLen = 0; // length of the sequence // Support for external music from the music enhancement project @@ -181,61 +178,53 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { if (dwFileOffset == 0) return true; - if (dwFileOffset != dwLastMidiIndex) { - Common::File midiStream; - - // open MIDI sequence file in binary mode - if (!midiStream.open(MIDI_FILE)) - error(CANNOT_FIND_FILE, MIDI_FILE); - - // update index of last tune loaded - dwLastMidiIndex = dwFileOffset; - - // move to correct position in the file - midiStream.seek(dwFileOffset, SEEK_SET); - - // read the length of the sequence - dwSeqLen = midiStream.readUint32LE(); - - // make sure buffer is large enough for this sequence - assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size); - - // stop any currently playing tune - _vm->_midiMusic->stop(); - - // read the sequence - if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen) - error(FILE_IS_CORRUPT, MIDI_FILE); - - midiStream.close(); - - // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii", - // which actually affects all ports, since it's specific to the GRA version. - // - // The GRA version does not seem to set the channel volume at all for the first - // intro track, thus we need to do that here. We only initialize the channels - // used in that sequence. And we are using 127 as default channel volume. - // - // Only in the GRA version dwFileOffset can be "38888", just to be sure, we - // check for the SCN files feature flag not being set though. - if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) { - _vm->_midiMusic->send(0x7F07B0 | 3); - _vm->_midiMusic->send(0x7F07B0 | 5); - _vm->_midiMusic->send(0x7F07B0 | 8); - _vm->_midiMusic->send(0x7F07B0 | 10); - _vm->_midiMusic->send(0x7F07B0 | 13); - } + Common::File midiStream; - _vm->_midiMusic->playMIDI(dwSeqLen, bLoop); + // open MIDI sequence file in binary mode + if (!midiStream.open(MIDI_FILE)) + error(CANNOT_FIND_FILE, MIDI_FILE); - // Store the length - //dwLastSeqLen = dwSeqLen; - } else { - // dwFileOffset == dwLastMidiIndex - _vm->_midiMusic->stop(); - _vm->_midiMusic->playMIDI(dwSeqLen, bLoop); + // move to correct position in the file + midiStream.seek(dwFileOffset, SEEK_SET); + + // read the length of the sequence + dwSeqLen = midiStream.readUint32LE(); + + // make sure buffer is large enough for this sequence + assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size); + + // stop any currently playing tune + _vm->_midiMusic->stop(); + + // read the sequence. This needs to be read again before playSEQ() is + // called even if the music is restarting, as playSEQ() reads the file + // name off the buffer itself. However, that function adds SMF headers + // to the buffer, thus if it's read again, the SMF headers will be read + // and the filename will always be 'MThd'. + if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen) + error(FILE_IS_CORRUPT, MIDI_FILE); + + midiStream.close(); + + // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii", + // which actually affects all ports, since it's specific to the GRA version. + // + // The GRA version does not seem to set the channel volume at all for the first + // intro track, thus we need to do that here. We only initialize the channels + // used in that sequence. And we are using 127 as default channel volume. + // + // Only in the GRA version dwFileOffset can be "38888", just to be sure, we + // check for the SCN files feature flag not being set though. + if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) { + _vm->_midiMusic->send(0x7F07B0 | 3); + _vm->_midiMusic->send(0x7F07B0 | 5); + _vm->_midiMusic->send(0x7F07B0 | 8); + _vm->_midiMusic->send(0x7F07B0 | 10); + _vm->_midiMusic->send(0x7F07B0 | 13); } + _vm->_midiMusic->playMIDI(dwSeqLen, bLoop); + return true; } @@ -279,27 +268,7 @@ int GetMidiVolume() { */ void SetMidiVolume(int vol) { assert(vol >= 0 && vol <= Audio::Mixer::kMaxChannelVolume); - - static int priorVolMusic = 0; // FIXME: Avoid non-const global vars - - if (vol == 0 && priorVolMusic == 0) { - // Nothing to do - } else if (vol == 0 && priorVolMusic != 0) { - // Stop current midi sequence - StopMidi(); - _vm->_midiMusic->setVolume(vol); - } else if (vol != 0 && priorVolMusic == 0) { - // Perhaps restart last midi sequence - if (g_currentLoop) - PlayMidiSequence(g_currentMidi, true); - - _vm->_midiMusic->setVolume(vol); - } else if (vol != 0 && priorVolMusic != 0) { - // Alter current volume - _vm->_midiMusic->setVolume(vol); - } - - priorVolMusic = vol; + _vm->_midiMusic->setVolume(vol); } /** @@ -309,7 +278,7 @@ void OpenMidiFiles() { Common::File midiStream; // Demo version has no midi file - if ((_vm->getFeatures() & GF_DEMO) || (TinselVersion == TINSEL_V2)) + if (TinselV0 || TinselV2) return; if (g_midiBuffer.pDat) @@ -942,14 +911,12 @@ void RestoreMidiFacts(SCNHANDLE Midi, bool Loop) { g_currentMidi = Midi; g_currentLoop = Loop; - if (_vm->_config->_musicVolume != 0 && Loop) { - bool mute = false; - if (ConfMan.hasKey("mute")) - mute = ConfMan.getBool("mute"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); - PlayMidiSequence(g_currentMidi, true); - SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); - } + PlayMidiSequence(g_currentMidi, true); + SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); } #if 0 diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 60f04b47fd3d..6ea18c826860 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -122,6 +122,8 @@ static uint32 g_hMasterScript; struct WorkaroundEntry { TinselEngineVersion version; ///< Engine version this workaround applies to bool scnFlag; ///< Only applicable for Tinsel 1 (DW 1) + bool isDemo; ///< Flags whether it's for a demo + Common::Platform platform; ///< Platform filter SCNHANDLE hCode; ///< Script to apply fragment to int ip; ///< Script offset to run this fragment before int numBytes; ///< Number of bytes in the script @@ -129,6 +131,7 @@ struct WorkaroundEntry { }; #define FRAGMENT_WORD(x) (byte)(x & 0xFF), (byte)(x >> 8) +#define FRAGMENT_DWORD(x) (byte)(x & 0xFF), (byte)(x >> 8), (byte)(x >> 16), (byte)(x >> 24) static const byte fragment1[] = {OP_ZERO, OP_GSTORE | OPSIZE16, 206, 0}; static const byte fragment2[] = {OP_LIBCALL | OPSIZE8, 110}; @@ -149,6 +152,10 @@ static const byte fragment12[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1491), OP_IMM | OPSIZE16, FRAGMENT_WORD(322), OP_LIBCALL | OPSIZE8, 46, // Give back the whistle OP_JUMP | OPSIZE16, FRAGMENT_WORD(1568)}; static const byte fragment13[] = {OP_ZERO, OP_GSTORE | OPSIZE16, FRAGMENT_WORD(306)}; +static const byte fragment14[] = {OP_LIBCALL | OPSIZE8, 58, + OP_IMM, FRAGMENT_DWORD((42 << 23)), OP_ONE, OP_ZERO, OP_LIBCALL | OPSIZE8, 44, + OP_LIBCALL | OPSIZE8, 97, OP_JUMP | OPSIZE16, FRAGMENT_WORD(2220) +}; #undef FRAGMENT_WORD @@ -157,7 +164,7 @@ const WorkaroundEntry workaroundList[] = { // book back to the present. In the GRA version, it was global 373, // and was reset when he is returned to the past, but was forgotten // in the SCN version, so this ensures the flag is properly reset. - {TINSEL_V1, true, 427942095, 1, sizeof(fragment1), fragment1}, + {TINSEL_V1, true, false, Common::kPlatformUnknown, 427942095, 1, sizeof(fragment1), fragment1}, // DW1-GRA: Rincewind exiting the Inn is blocked by the luggage. // Whilst you can then move into walkable areas, saving and @@ -165,26 +172,26 @@ const WorkaroundEntry workaroundList[] = { // fragment turns off NPC blocking for the Outside Inn rooms so that // the luggage won't block Past Outside Inn. // See bug report #2525010. - {TINSEL_V1, false, 444622076, 0, sizeof(fragment2), fragment2}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 444622076, 0, sizeof(fragment2), fragment2}, // Present Outside Inn - {TINSEL_V1, false, 352600876, 0, sizeof(fragment2), fragment2}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 352600876, 0, sizeof(fragment2), fragment2}, // DW1-GRA: Talking to palace guards in Act 2 gives !!!HIGH // STRING||| - this happens if you initiate dialog with one of the // guards, but not the other. So these fragments provide the correct // talk parameters where needed. // See bug report #2831159. - {TINSEL_V1, false, 310506872, 463, sizeof(fragment4), fragment4}, - {TINSEL_V1, false, 310506872, 485, sizeof(fragment5), fragment5}, - {TINSEL_V1, false, 310506872, 513, sizeof(fragment6), fragment6}, - {TINSEL_V1, false, 310506872, 613, sizeof(fragment7), fragment7}, - {TINSEL_V1, false, 310506872, 641, sizeof(fragment8), fragment8}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 463, sizeof(fragment4), fragment4}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 485, sizeof(fragment5), fragment5}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 513, sizeof(fragment6), fragment6}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 613, sizeof(fragment7), fragment7}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 641, sizeof(fragment8), fragment8}, // DW1-SCN: The script for the lovable street-Starfish does a // 'StopSample' after flicking the coin to ensure it's sound is // stopped, but which also accidentally can stop any active // conversation with the Amazon. - {TINSEL_V1, true, 394640351, 121, sizeof(fragment9), fragment9}, + {TINSEL_V1, true, false, Common::kPlatformUnknown, 394640351, 121, sizeof(fragment9), fragment9}, // DW2: In the garden, global #490 is set when the bees begin their // 'out of hive' animation, and reset when done. But if the game is @@ -197,25 +204,29 @@ const WorkaroundEntry workaroundList[] = { // * Stealing the mallets from the wizards (bug #2820788). // This fix ensures that the global is reset when the Garden scene // is loaded (both entering and restoring a game). - {TINSEL_V2, true, 2888147476U, 0, sizeof(fragment3), fragment3}, + {TINSEL_V2, true, false, Common::kPlatformUnknown, 2888147476U, 0, sizeof(fragment3), fragment3}, // DW1-GRA: Corrects text being drawn partially off-screen during // the blackboard description of the Librarian. - {TINSEL_V1, false, 293831402, 133, sizeof(fragment10), fragment10}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 293831402, 133, sizeof(fragment10), fragment10}, // DW1-GRA/SCN: Corrects the dead-end of being able to give the // whistle back to the pirate before giving him the parrot. // See bug report #2934211. - {TINSEL_V1, true, 352601285, 1569, sizeof(fragment11), fragment11}, - {TINSEL_V1, false, 352602304, 1488, sizeof(fragment12), fragment12}, + {TINSEL_V1, true, false, Common::kPlatformUnknown, 352601285, 1569, sizeof(fragment11), fragment11}, + {TINSEL_V1, false, false, Common::kPlatformUnknown, 352602304, 1488, sizeof(fragment12), fragment12}, // DW2: Corrects a bug with global 306 not being cleared if you leave // the marketplace scene whilst D'Blah is talking (even if it's not // actually audible); returning to the scene and clicking on him multiple // times would cause the game to crash - {TINSEL_V2, true, 1109294728, 0, sizeof(fragment13), fragment13}, + {TINSEL_V2, true, false, Common::kPlatformUnknown, 1109294728, 0, sizeof(fragment13), fragment13}, + + // DW1 PSX DEMO: Alters a script in the PSX DW1 demo to show the Idle animation scene rather than + // quitting the game when no user input happens for a while + {TINSEL_V1, true, true, Common::kPlatformPSX, 0, 2186, sizeof(fragment14), fragment14}, - {TINSEL_V0, false, 0, 0, 0, NULL} + {TINSEL_V0, false, false, Common::kPlatformUnknown, 0, 0, 0, NULL} }; //----------------- LOCAL GLOBAL DATA -------------------- @@ -582,6 +593,8 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { if ((wkEntry->version == TinselVersion) && (wkEntry->hCode == ic->hCode) && (wkEntry->ip == ip) && + (wkEntry->isDemo == _vm->getIsADGFDemo()) && + ((wkEntry->platform == Common::kPlatformUnknown) || (wkEntry->platform == _vm->getPlatform())) && (!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) { // Point to start of workaround fragment ip = 0; diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 0a552c8c2b1e..518e27f02ba1 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -55,8 +55,7 @@ namespace Tinsel { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 1 -// TODO: Not yet used +#define CURRENT_VER 2 /** * An auxillary macro, used to specify savegame versions. We use this instead @@ -97,12 +96,13 @@ struct SaveGameHeader { TimeDate dateTime; bool scnFlag; byte language; + uint16 numInterpreters; // Savegame version 2 or later only }; enum { DW1_SAVEGAME_ID = 0x44575399, // = 'DWSc' = "DiscWorld 1 ScummVM" DW2_SAVEGAME_ID = 0x44573253, // = 'DW2S' = "DiscWorld 2 ScummVM" - SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1 + SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1 + 2 }; #define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID) @@ -186,6 +186,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) { } } + // Handle the number of interpreter contexts that will be saved in the savegame + if (tmp >= 2) { + tmp -= 2; + hdr.numInterpreters = NUM_INTERPRET; + s.syncAsUint16LE(hdr.numInterpreters); + } else { + hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20; + } + // Skip over any extra bytes s.skip(tmp); return true; @@ -262,7 +271,7 @@ static void syncSoundReel(Common::Serializer &s, SOUNDREELS &sr) { s.syncAsSint32LE(sr.actorCol); } -static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd) { +static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp) { s.syncAsUint32LE(sd.SavedSceneHandle); s.syncAsUint32LE(sd.SavedBgroundHandle); for (int i = 0; i < MAX_MOVERS; ++i) @@ -273,7 +282,7 @@ static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd) { s.syncAsSint32LE(sd.NumSavedActors); s.syncAsSint32LE(sd.SavedLoffset); s.syncAsSint32LE(sd.SavedToffset); - for (int i = 0; i < NUM_INTERPRET; ++i) + for (int i = 0; i < numInterp; ++i) sd.SavedICInfo[i].syncWithSerializer(s); for (int i = 0; i < MAX_POLY; ++i) s.syncAsUint32LE(sd.SavedDeadPolys[i]); @@ -422,7 +431,7 @@ char *ListEntry(int i, letype which) { return NULL; } -static void DoSync(Common::Serializer &s) { +static bool DoSync(Common::Serializer &s, int numInterp) { int sg = 0; if (TinselV2) { @@ -434,7 +443,7 @@ static void DoSync(Common::Serializer &s) { if (TinselV2 && s.isLoading()) HoldItem(INV_NOICON); - syncSavedData(s, *g_srsd); + syncSavedData(s, *g_srsd, numInterp); syncGlobInfo(s); // Glitter globals syncInvInfo(s); // Inventory data @@ -443,6 +452,10 @@ static void DoSync(Common::Serializer &s) { sg = WhichItemHeld(); s.syncAsSint32LE(sg); if (s.isLoading()) { + if (sg != -1 && !GetIsInvObject(sg)) + // Not a valid inventory object, so return false + return false; + if (TinselV2) g_thingHeld = sg; else @@ -459,7 +472,7 @@ static void DoSync(Common::Serializer &s) { if (*g_SaveSceneSsCount != 0) { SAVED_DATA *sdPtr = g_SaveSceneSsData; for (int i = 0; i < *g_SaveSceneSsCount; ++i, ++sdPtr) - syncSavedData(s, *sdPtr); + syncSavedData(s, *sdPtr, numInterp); // Flag that there is a saved scene to return to. Note that in this context 'saved scene' // is a stored scene to return to from another scene, such as from the Summoning Book close-up @@ -469,6 +482,8 @@ static void DoSync(Common::Serializer &s) { if (!TinselV2) syncAllActorsAlive(s); + + return true; } /** @@ -487,8 +502,23 @@ static bool DoRestore() { delete f; // Invalid header, or savegame too new -> skip it return false; } + + // Load in the data. For older savegame versions, we potentially need to load the data twice, once + // for pre 1.5 savegames, and if that fails, a second time for 1.5 savegames + int numInterpreters = hdr.numInterpreters; + int32 currentPos = f->pos(); + for (int tryNumber = 0; tryNumber < ((hdr.ver >= 2) ? 1 : 2); ++tryNumber) { + // If it's the second loop iteration, try with the 1.5 savegame number of interpreter contexts + if (tryNumber == 1) { + f->seek(currentPos); + numInterpreters = 80; + } - DoSync(s); + // Load the savegame data + if (DoSync(s, numInterpreters)) + // Data load was successful (or likely), so break out of loop + break; + } uint32 id = f->readSint32LE(); if (id != (uint32)0xFEEDFACE) @@ -575,7 +605,7 @@ static void DoSave() { return; } - DoSync(s); + DoSync(s, hdr.numInterpreters); // Write out the special Id for Discworld savegames f->writeUint32LE(0xFEEDFACE); diff --git a/engines/tinsel/scene.h b/engines/tinsel/scene.h index baaff27a3e30..06e5c096d935 100644 --- a/engines/tinsel/scene.h +++ b/engines/tinsel/scene.h @@ -75,9 +75,9 @@ enum REEL { typedef enum { TRANS_DEF, TRANS_CUT, TRANS_FADE } TRANSITS; // amount to shift scene handles by -#define SCNHANDLE_SHIFT ((TinselV2 && !IsDemo) ? 25 : 23) -#define OFFSETMASK ((TinselV2 && !IsDemo) ? 0x01ffffffL : 0x007fffffL) -#define HANDLEMASK ((TinselV2 && !IsDemo) ? 0xFE000000L : 0xFF800000L) +#define SCNHANDLE_SHIFT ((TinselV2 && !TinselV2Demo) ? 25 : 23) +#define OFFSETMASK ((TinselV2 && !TinselV2Demo) ? 0x01ffffffL : 0x007fffffL) +#define HANDLEMASK ((TinselV2 && !TinselV2Demo) ? 0xFE000000L : 0xFF800000L) void DoHailScene(SCNHANDLE scene); diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index f575b0327064..e052302cfd18 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -75,7 +75,7 @@ SoundManager::~SoundManager() { // playSample for DiscWorld 1 bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::SoundHandle *handle) { // Floppy version has no sample file - if (_vm->getFeatures() & GF_FLOPPY) + if (!_vm->isCD()) return false; // no sample driver? @@ -182,7 +182,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p Audio::Mixer::SoundType type, Audio::SoundHandle *handle) { // Floppy version has no sample file - if (_vm->getFeatures() & GF_FLOPPY) + if (!_vm->isCD()) return false; // no sample driver? @@ -471,7 +471,7 @@ void SoundManager::setSFXVolumes(uint8 volume) { */ void SoundManager::openSampleFiles() { // Floppy and demo versions have no sample files, except for the Discworld 2 demo - if (_vm->getFeatures() & GF_FLOPPY || (IsDemo && !TinselV2)) + if (!_vm->isCD() || TinselV0) return; TinselFile f; diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 5dda8361441e..058f8eb6fd42 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -1625,10 +1625,6 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, bool bComplete, int * Play a midi file. */ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) { - // FIXME: This is a workaround for the FIXME below - if (GetMidiVolume() == 0) - return; - CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -1637,18 +1633,13 @@ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) { PlayMidiSequence(hMidi, loop == MIDI_LOOP); - // FIXME: The following check messes up the script arguments when - // entering the secret door in the bookshelf in the library, - // leading to a crash, when the music volume is set to 0 (MidiPlaying() - // always false then). - // - // Why exactly this happens is unclear. An analysis of the involved - // script(s) might reveal more. - // - // Note: This check&sleep was added in DW v2. It was most likely added - // to ensure that the MIDI song started playing before the next opcode + // This check&sleep was added in DW v2. It was most likely added to + // ensure that the MIDI song started playing before the next opcode // is executed. - if (!MidiPlaying()) + // In DW1, it messes up the script arguments when entering the secret + // door in the bookshelf in the library, leading to a crash, when the + // music volume is set to 0. + if (!MidiPlaying() && TinselV2) CORO_SLEEP(1); if (complete) { @@ -3412,7 +3403,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x // Kick off the sample now (perhaps with a delay) if (g_bNoPause) g_bNoPause = false; - else if (!IsDemo) + else if (!TinselV2Demo) CORO_SLEEP(SysVar(SV_SPEECHDELAY)); //SamplePlay(VOICE, hText, _ctx->sub, false, -1, -1, PRIORITY_TALK); @@ -4244,7 +4235,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi int libCode; if (TinselV0) libCode = DW1DEMO_CODES[operand]; else if (!TinselV2) libCode = DW1_CODES[operand]; - else if (_vm->getFeatures() & GF_DEMO) libCode = DW2DEMO_CODES[operand]; + else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand]; else libCode = DW2_CODES[operand]; debug(7, "CallLibraryRoutine op %d (escOn %d, myEscape %d)", operand, pic->escOn, pic->myEscape); diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index bac7ef6efb49..123249125eb5 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -63,21 +63,16 @@ enum TinselGameID { }; enum TinselGameFeatures { - GF_DEMO = 1 << 0, - GF_CD = 1 << 1, - GF_FLOPPY = 1 << 2, - GF_SCNFILES = 1 << 3, - GF_ENHANCED_AUDIO_SUPPORT = 1 << 4, - GF_ALT_MIDI = 1 << 5, // Alternate sequence in midi.dat file + GF_SCNFILES = 1 << 0, + GF_ENHANCED_AUDIO_SUPPORT = 1 << 1, + GF_ALT_MIDI = 1 << 2, // Alternate sequence in midi.dat file // The GF_USE_?FLAGS values specify how many country flags are displayed // in the subtitles options dialog. // None of these defined -> 1 language, in ENGLISH.TXT - GF_USE_3FLAGS = 1 << 6, // French, German, Spanish - GF_USE_4FLAGS = 1 << 7, // French, German, Spanish, Italian - GF_USE_5FLAGS = 1 << 8, // All 5 flags - - GF_BIG_ENDIAN = 1 << 9 + GF_USE_3FLAGS = 1 << 3, // French, German, Spanish + GF_USE_4FLAGS = 1 << 4, // French, German, Spanish, Italian + GF_USE_5FLAGS = 1 << 5 // All 5 flags }; /** @@ -134,13 +129,12 @@ typedef bool (*KEYFPTR)(const Common::KeyState &); #define TinselV0 (TinselVersion == TINSEL_V0) #define TinselV1 (TinselVersion == TINSEL_V1) #define TinselV2 (TinselVersion == TINSEL_V2) +#define TinselV2Demo (TinselVersion == TINSEL_V2 && _vm->getIsADGFDemo()) #define TinselV1PSX (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformPSX) #define TinselV1Mac (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformMacintosh) -#define IsDemo (_vm->getFeatures() & GF_DEMO) - -#define READ_16(v) ((_vm->getFeatures() & GF_BIG_ENDIAN) ? READ_BE_UINT16(v) : READ_LE_UINT16(v)) -#define READ_32(v) ((_vm->getFeatures() & GF_BIG_ENDIAN) ? READ_BE_UINT32(v) : READ_LE_UINT32(v)) +#define READ_16(v) (TinselV1Mac ? READ_BE_UINT16(v) : READ_LE_UINT16(v)) +#define READ_32(v) (TinselV1Mac ? READ_BE_UINT32(v) : READ_LE_UINT32(v)) // Global reference to the TinselEngine object extern TinselEngine *_vm; @@ -186,6 +180,8 @@ class TinselEngine : public Engine { uint16 getVersion() const; uint32 getFlags() const; Common::Platform getPlatform() const; + bool getIsADGFDemo() const; + bool isCD() const; const char *getSampleIndex(LANGUAGE lang); const char *getSampleFile(LANGUAGE lang); diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index c532bbbf09ce..c1a57638c22a 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -273,8 +273,6 @@ SaveStateDescriptor ToltecsMetaEngine::querySaveMetaInfos(const char *target, in if (error == Toltecs::ToltecsEngine::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); desc.setThumbnail(header.thumbnail); if (header.version > 0) { diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index 84f6fa375c68..1c85a8d79850 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -132,7 +132,7 @@ Common::Rect Animation::getRect() { return Common::Rect(_x1, _y1, _x2, _y2); } -void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy) { +void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy) { debugC(3, kDebugAnim, "drawFrame(surface, %d, %d, %d)", frame, xx, yy); if (frame < 0) frame = 0; @@ -146,10 +146,13 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int if (_frames[frame]._ref != -1) frame = _frames[frame]._ref; - int32 rectX = _frames[frame]._x2 - _frames[frame]._x1; - int32 rectY = _frames[frame]._y2 - _frames[frame]._y1; - int32 offsX = 0; - int32 offsY = 0; + if (!_frames[frame]._data) + return; + + int16 rectX = _frames[frame]._x2 - _frames[frame]._x1; + int16 rectY = _frames[frame]._y2 - _frames[frame]._y1; + int16 offsX = 0; + int16 offsY = 0; _vm->addDirtyRect(xx + _x1 + _frames[frame]._x1, yy + _y1 + _frames[frame]._y1, xx + rectX + _x1 + _frames[frame]._x1 , yy + rectY + _y1 + _frames[frame]._y1); @@ -186,10 +189,10 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int int32 destPitch = surface.pitch; uint8 *srcRow = _frames[frame]._data + offsX + (_frames[frame]._x2 - _frames[frame]._x1) * offsY; uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1 + offsY) * destPitch + (xx + _x1 + _frames[frame]._x1 + offsX); - for (int32 y = 0; y < rectY; y++) { + for (int16 y = 0; y < rectY; y++) { uint8 *cur = curRow; uint8 *c = srcRow + y * (_frames[frame]._x2 - _frames[frame]._x1); - for (int32 x = 0; x < rectX; x++) { + for (int16 x = 0; x < rectX; x++) { if (*c) *cur = *c; c++; @@ -199,27 +202,27 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int32 xx, int } } -void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask) { +void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask) { debugC(1, kDebugAnim, "drawFrameWithMask(surface, %d, %d, %d, %d, mask)", frame, xx, yy, zz); warning("STUB: drawFrameWithMask()"); } -void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask, int32 scale) { +void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale) { debugC(5, kDebugAnim, "drawFrameWithMaskAndScale(surface, %d, %d, %d, %d, mask, %d)", frame, xx, yy, zz, scale); if (_frames[frame]._ref != -1) frame = _frames[frame]._ref; - int32 rectX = _frames[frame]._x2 - _frames[frame]._x1; - int32 rectY = _frames[frame]._y2 - _frames[frame]._y1; + int16 rectX = _frames[frame]._x2 - _frames[frame]._x1; + int16 rectY = _frames[frame]._y2 - _frames[frame]._y1; - int32 finalWidth = rectX * scale / 1024; - int32 finalHeight = rectY * scale / 1024; + int16 finalWidth = rectX * scale / 1024; + int16 finalHeight = rectY * scale / 1024; // compute final x1, y1, x2, y2 - int32 xx1 = xx + _x1 + _frames[frame]._x1 * scale / 1024; - int32 yy1 = yy + _y1 + _frames[frame]._y1 * scale / 1024; - int32 xx2 = xx1 + finalWidth; - int32 yy2 = yy1 + finalHeight; - int32 w = _frames[frame]._x2 - _frames[frame]._x1; + int16 xx1 = xx + _x1 + _frames[frame]._x1 * scale / 1024; + int16 yy1 = yy + _y1 + _frames[frame]._y1 * scale / 1024; + int16 xx2 = xx1 + finalWidth; + int16 yy2 = yy1 + finalHeight; + int16 w = _frames[frame]._x2 - _frames[frame]._x1; _vm->addDirtyRect(xx1, yy1, xx2, yy2); @@ -233,8 +236,8 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram if (strstr(_name, "SHADOW")) shadowFlag = true; - for (int32 y = yy1; y < yy2; y++) { - for (int32 x = xx1; x < xx2; x++) { + for (int16 y = yy1; y < yy2; y++) { + for (int16 x = xx1; x < xx2; x++) { if (x < 0 || x >= 1280 || y < 0 || y >= 400) continue; @@ -242,8 +245,8 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram uint8 *curMask = curRowMask + x + y * destPitchMask; // find the good c - int32 xs = (x - xx1) * 1024 / scale; - int32 ys = (y - yy1) * 1024 / scale; + int16 xs = (x - xx1) * 1024 / scale; + int16 ys = (y - yy1) * 1024 / scale; uint8 *cc = &c[ys * w + xs]; if (*cc && ((*curMask) >= zz)) { if (shadowFlag) @@ -272,7 +275,7 @@ Common::Rect Animation::getFrameRect(int32 frame) { return Common::Rect(_frames[frame]._x1, _frames[frame]._y1, _frames[frame]._x2, _frames[frame]._y2); } -int32 Animation::getFrameWidth(int32 frame) { +int16 Animation::getFrameWidth(int32 frame) { debugC(4, kDebugAnim, "getFrameWidth(%d)", frame); if ((frame < 0) || (frame >= _numFrames)) return 0; @@ -283,7 +286,7 @@ int32 Animation::getFrameWidth(int32 frame) { return _frames[frame]._x2 - _frames[frame]._x1; } -int32 Animation::getFrameHeight(int32 frame) { +int16 Animation::getFrameHeight(int32 frame) { debugC(4, kDebugAnim, "getFrameHeight(%d)", frame); if (frame < 0 || frame >= _numFrames) return 0; @@ -294,15 +297,15 @@ int32 Animation::getFrameHeight(int32 frame) { return _frames[frame]._y2 - _frames[frame]._y1; } -int32 Animation::getWidth() const { +int16 Animation::getWidth() const { return _x2 - _x1; } -int32 Animation::getHeight() const { +int16 Animation::getHeight() const { return _y2 - _y1; } -void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, byte *colorMap) { +void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, byte *colorMap) { debugC(4, kDebugAnim, "drawFontFrame(surface, %d, %d, %d, colorMap)", frame, xx, yy); if (frame < 0) frame = 0; @@ -316,8 +319,8 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx, if (_frames[frame]._ref != -1) frame = _frames[frame]._ref; - int32 rectX = _frames[frame]._x2 - _frames[frame]._x1; - int32 rectY = _frames[frame]._y2 - _frames[frame]._y1; + int16 rectX = _frames[frame]._x2 - _frames[frame]._x1; + int16 rectY = _frames[frame]._y2 - _frames[frame]._y1; if ((xx + _x1 + _frames[frame]._x1 < 0) || (yy + _y1 + _frames[frame]._y1 < 0)) return; @@ -337,9 +340,9 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx, int32 destPitch = surface.pitch; uint8 *c = _frames[frame]._data; uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1); - for (int32 y = 0; y < rectY; y++) { + for (int16 y = 0; y < rectY; y++) { unsigned char *cur = curRow; - for (int32 x = 0; x < rectX; x++) { + for (int16 x = 0; x < rectX; x++) { if (*c && *c < 4) *cur = colorMap[*c]; c++; @@ -349,7 +352,7 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int32 xx, } } -void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) { +void Animation::drawFrameOnPicture(int32 frame, int16 xx, int16 yy) { debugC(1, kDebugAnim, "drawFrameOnPicture(%d, %d, %d)", frame, xx, yy); if (frame < 0) frame = 0; @@ -363,8 +366,8 @@ void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) { if (_frames[frame]._ref != -1) frame = _frames[frame]._ref; - int32 rectX = _frames[frame]._x2 - _frames[frame]._x1; - int32 rectY = _frames[frame]._y2 - _frames[frame]._y1; + int16 rectX = _frames[frame]._x2 - _frames[frame]._x1; + int16 rectY = _frames[frame]._y2 - _frames[frame]._y1; Picture *pic = _vm->getPicture(); @@ -386,9 +389,9 @@ void Animation::drawFrameOnPicture(int32 frame, int32 xx, int32 yy) { int32 destPitch = pic->getWidth(); uint8 *c = _frames[frame]._data; uint8 *curRow = (uint8 *)pic->getDataPtr() + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1); - for (int32 y = 0; y < rectY; y++) { + for (int16 y = 0; y < rectY; y++) { unsigned char *cur = curRow; - for (int32 x = 0; x < rectX; x++) { + for (int16 x = 0; x < rectX; x++) { if (*c) *cur = *c; c++; @@ -455,8 +458,8 @@ void AnimationInstance::render() { if (frame >= _animation->_numFrames) frame = _animation->_numFrames - 1; - int32 x = _x; - int32 y = _y; + int16 x = _x; + int16 y = _y; if (_alignBottom) { int32 offsetX = (_animation->_x2 - _animation->_x1) / 2 * (_scale - 1024); @@ -498,7 +501,7 @@ void AnimationInstance::setAnimation(Animation *animation, bool setRange) { } } -void AnimationInstance::setAnimationRange(int32 rangeStart, int rangeEnd) { +void AnimationInstance::setAnimationRange(int32 rangeStart, int32 rangeEnd) { debugC(5, kDebugAnim, "setAnimationRange(%d, %d)", rangeStart, rangeEnd); _rangeStart = rangeStart; _rangeEnd = rangeEnd; @@ -510,7 +513,7 @@ void AnimationInstance::setAnimationRange(int32 rangeStart, int rangeEnd) { _currentFrame = _rangeEnd; } -void AnimationInstance::setPosition(int32 x, int32 y, int32 z, bool relative) { +void AnimationInstance::setPosition(int16 x, int16 y, int32 z, bool relative) { debugC(5, kDebugAnim, "setPosition(%d, %d, %d, %d)", x, y, z, (relative) ? 1 : 0); if (relative || !_animation) { _x = x; @@ -523,7 +526,7 @@ void AnimationInstance::setPosition(int32 x, int32 y, int32 z, bool relative) { } } -void AnimationInstance::moveRelative(int32 dx, int32 dy, int32 dz) { +void AnimationInstance::moveRelative(int16 dx, int16 dy, int32 dz) { debugC(1, kDebugAnim, "moveRelative(%d, %d, %d)", dx, dy, dz); _x += dx; _y += dy; @@ -568,13 +571,13 @@ void AnimationInstance::setUseMask(bool useMask) { _useMask = useMask; } -void AnimationInstance::getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) const { +void AnimationInstance::getRect(int16 *x1, int16 *y1, int16 *x2, int16 *y2) const { debugC(5, kDebugAnim, "getRect(%d, %d, %d, %d)", *x1, *y1, *x2, *y2); - int32 rectX = _animation->_frames[_currentFrame]._x2 - _animation->_frames[_currentFrame]._x1; - int32 rectY = _animation->_frames[_currentFrame]._y2 - _animation->_frames[_currentFrame]._y1; + int16 rectX = _animation->_frames[_currentFrame]._x2 - _animation->_frames[_currentFrame]._x1; + int16 rectY = _animation->_frames[_currentFrame]._y2 - _animation->_frames[_currentFrame]._y1; - int32 finalWidth = rectX * _scale / 1024; - int32 finalHeight = rectY * _scale / 1024; + int16 finalWidth = rectX * _scale / 1024; + int16 finalHeight = rectY * _scale / 1024; // compute final x1, y1, x2, y2 *x1 = _x + _animation->_x1 + _animation->_frames[_currentFrame]._x1 * _scale / 1024; @@ -583,7 +586,7 @@ void AnimationInstance::getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) cons *y2 = *y1 + finalHeight; } -void AnimationInstance::setX(int32 x, bool relative) { +void AnimationInstance::setX(int16 x, bool relative) { debugC(1, kDebugAnim, "setX(%d, %d)", x, (relative) ? 1 : 0); if (relative || !_animation) _x = x; @@ -591,7 +594,7 @@ void AnimationInstance::setX(int32 x, bool relative) { _x = x - _animation->_x1; } -void AnimationInstance::setY(int32 y, bool relative) { +void AnimationInstance::setY(int16 y, bool relative) { debugC(1, kDebugAnim, "setY(%d, %d)", y, (relative) ? 1 : 0); if (relative || !_animation) _y = y; @@ -614,11 +617,11 @@ int32 AnimationInstance::getLayerZ() const { return _layerZ; } -int32 AnimationInstance::getX2() const { +int16 AnimationInstance::getX2() const { return _x + _animation->_x1; } -int32 AnimationInstance::getY2() const { +int16 AnimationInstance::getY2() const { return _y + _animation->_y1; } @@ -647,6 +650,7 @@ void AnimationInstance::save(Common::WriteStream *stream) { stream->writeSint32LE(_visible); stream->writeSint32LE(_useMask); } + void AnimationInstance::load(Common::ReadStream *stream) { _currentFrame = stream->readSint32LE(); _currentTime = stream->readSint32LE(); @@ -695,14 +699,13 @@ void AnimationManager::updateInstance(AnimationInstance* instance) { } void AnimationManager::addInstance(AnimationInstance *instance) { - // if the instance already exists, we skip the add for (uint32 i = 0; i < _instances.size(); i++) { if (_instances[i] == instance) return; } - int found = -1; + int32 found = -1; // here we now do an ordered insert (closer to the original game) for (uint32 i = 0; i < _instances.size(); i++) { @@ -712,11 +715,10 @@ void AnimationManager::addInstance(AnimationInstance *instance) { } } - if ( found == -1 ) { + if (found == -1) _instances.push_back(instance); - } else { + else _instances.insert_at(found, instance); - } } void AnimationManager::removeInstance(AnimationInstance *instance) { diff --git a/engines/toon/anim.h b/engines/toon/anim.h index eb8dcbd60091..cd550b2621bf 100644 --- a/engines/toon/anim.h +++ b/engines/toon/anim.h @@ -36,10 +36,10 @@ class Picture; class ToonEngine; struct AnimationFrame { - int32 _x1; - int32 _y1; - int32 _x2; - int32 _y2; + int16 _x1; + int16 _y1; + int16 _x2; + int16 _y2; int32 _ref; uint8 *_data; }; @@ -49,10 +49,10 @@ class Animation { Animation(ToonEngine *vm); ~Animation(); - int32 _x1; - int32 _y1; - int32 _x2; - int32 _y2; + int16 _x1; + int16 _y1; + int16 _x2; + int16 _y2; int32 _numFrames; int32 _fps; AnimationFrame *_frames; @@ -61,18 +61,18 @@ class Animation { char _name[32]; bool loadAnimation(const Common::String &file); - void drawFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y); - void drawFontFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y, byte *colorMap); - void drawFrameOnPicture(int32 frame, int32 x, int32 y); - void drawFrameWithMask(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask); - void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask, int32 scale); + void drawFrame(Graphics::Surface &surface, int32 frame, int16 x, int16 y); + void drawFontFrame(Graphics::Surface &surface, int32 frame, int16 x, int16 y, byte *colorMap); + void drawFrameOnPicture(int32 frame, int16 x, int16 y); + void drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask); + void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale); void drawStrip(int32 offset = 0); void applyPalette(int32 offset, int32 srcOffset, int32 numEntries); Common::Rect getFrameRect(int32 frame); - int32 getFrameWidth(int32 frame); - int32 getFrameHeight(int32 frame); - int32 getWidth() const; - int32 getHeight() const; + int16 getFrameWidth(int32 frame); + int16 getFrameHeight(int32 frame); + int16 getWidth() const; + int16 getHeight() const; Common::Rect getRect(); protected: ToonEngine *_vm; @@ -92,25 +92,25 @@ class AnimationInstance { void renderOnPicture(); void setAnimation(Animation *animation, bool setRange = true); void playAnimation(); - void setAnimationRange(int32 rangeStart, int rangeEnd); + void setAnimationRange(int32 rangeStart, int32 rangeEnd); void setFps(int32 fps); void setLooping(bool enable); void stopAnimation(); void setFrame(int32 position); void forceFrame(int32 position); - void setPosition(int32 x, int32 y, int32 z, bool relative = false); + void setPosition(int16 x, int16 y, int32 z, bool relative = false); Animation *getAnimation() const { return _animation; } void setScale(int32 scale, bool align = false); void setVisible(bool visible); bool getVisible() const { return _visible; } void setUseMask(bool useMask); - void moveRelative(int32 dx, int32 dy, int32 dz); - void getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) const; - int32 getX() const { return _x; } - int32 getY() const { return _y; } + void moveRelative(int16 dx, int16 dy, int32 dz); + void getRect(int16 *x1, int16 *y1, int16 *x2, int16 *y2) const; + int16 getX() const { return _x; } + int16 getY() const { return _y; } int32 getZ() const { return _z; } - int32 getX2() const; - int32 getY2() const; + int16 getX2() const; + int16 getY2() const; int32 getZ2() const; int32 getFrame() const { return _currentFrame; } void reset(); @@ -120,8 +120,8 @@ class AnimationInstance { void setId(int32 id) { _id = id; } int32 getId() const { return _id; } - void setX(int32 x, bool relative = false); - void setY(int32 y, bool relative = false); + void setX(int16 x, bool relative = false); + void setY(int16 y, bool relative = false); void setZ(int32 z, bool relative = false); void setLayerZ(int32 layer); int32 getLayerZ() const; @@ -133,8 +133,8 @@ class AnimationInstance { int32 _currentTime; int32 _fps; Animation *_animation; - int32 _x; - int32 _y; + int16 _x; + int16 _y; int32 _z; int32 _layerZ; int32 _rangeStart; diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp index 77822ab07860..bc0e05105759 100644 --- a/engines/toon/audio.cpp +++ b/engines/toon/audio.cpp @@ -326,7 +326,7 @@ bool AudioStreamInstance::readPacket() { } if (numDecompressedBytes > _bufferMaxSize) { - delete [] _buffer; + delete[] _buffer; _bufferMaxSize = numDecompressedBytes; _buffer = new int16[numDecompressedBytes]; } diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 09730626f2e0..479f4965f3ad 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -62,7 +62,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) { _speed = 150; // 150 = nominal drew speed _lastWalkTime = 0; _numPixelToWalk = 0; - _nextIdleTime = _vm->getSystem()->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength(); + _nextIdleTime = _vm->_system->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength(); _lineToSayId = 0; } @@ -101,7 +101,7 @@ void Character::setFacing(int32 facing) { int32 dir = 0; - _lastWalkTime = _vm->getSystem()->getMillis(); + _lastWalkTime = _vm->_system->getMillis(); if ((_facing - facing + 8) % 8 > (facing - _facing + 8) % 8) dir = 1; else @@ -188,7 +188,7 @@ bool Character::walkTo(int16 newPosX, int16 newPosY) { _currentPathNode = 0; stopSpecialAnim(); - _lastWalkTime = _vm->getSystem()->getMillis(); + _lastWalkTime = _vm->_system->getMillis(); _numPixelToWalk = 0; @@ -220,8 +220,8 @@ bool Character::walkTo(int16 newPosX, int16 newPosY) { } // in 1/1000 pixels - _numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024; - _lastWalkTime = _vm->getSystem()->getMillis(); + _numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024; + _lastWalkTime = _vm->_system->getMillis(); while (_numPixelToWalk >= 1000 && _currentPathNode < _currentPath.size()) { _x = _currentPath[_currentPathNode].x; @@ -356,8 +356,8 @@ void Character::update(int32 timeIncrement) { } // in 1/1000 pixels - _numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024; - _lastWalkTime = _vm->getSystem()->getMillis(); + _numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024; + _lastWalkTime = _vm->_system->getMillis(); while (_numPixelToWalk > 1000 && _currentPathNode < _currentPath.size()) { _x = _currentPath[_currentPathNode].x; @@ -534,35 +534,33 @@ int32 Character::getFacingFromDirection(int16 dx, int16 dy) { dx = -dx; int32 facingEntry = 0; - int32 ydiff = dy; + int16 ydiff = dy; if (ydiff < 0) { ++facingEntry; ydiff = -ydiff; } - facingEntry <<= 1; + facingEntry *= 2; - int32 xdiff = dx; + int16 xdiff = dx; if (xdiff < 0) { ++facingEntry; xdiff = -xdiff; } - facingEntry <<= 1; + facingEntry *= 2; if (xdiff >= ydiff) { - int32 temp = ydiff; + // Swap xdiff and ydiff + int16 temp = ydiff; ydiff = xdiff; xdiff = temp; - } else { - facingEntry += 1; - } - - facingEntry <<= 1; + } else + facingEntry++; - int32 temp = (ydiff + 1) >> 1; + facingEntry *= 2; - if (xdiff < temp) - facingEntry += 1; + if (xdiff < ((ydiff + 1) / 2)) + facingEntry++; return facingTable[facingEntry]; } diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp index 8234934972a7..3877fa2a6cac 100644 --- a/engines/toon/detection.cpp +++ b/engines/toon/detection.cpp @@ -133,7 +133,7 @@ class ToonMetaEngine : public AdvancedMetaEngine { } virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { - return detectGameFilebased(allFiles, Toon::fileBasedFallback); + return detectGameFilebased(allFiles, fslist, Toon::fileBasedFallback); } virtual const char *getName() const { @@ -234,9 +234,6 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); desc.setThumbnail(thumbnail); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - uint32 saveDate = file->readUint32BE(); uint16 saveTime = file->readUint16BE(); diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp index d58663a00cb9..1e851ff4ae05 100644 --- a/engines/toon/font.cpp +++ b/engines/toon/font.cpp @@ -65,10 +65,10 @@ byte FontRenderer::textToFont(byte c) { return map_textToFont[c - 0x80]; } -void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText, int32 mode) { +void FontRenderer::renderText(int16 x, int16 y, const Common::String &origText, int32 mode) { debugC(5, kDebugFont, "renderText(%d, %d, %s, %d)", x, y, origText.c_str(), mode); - int32 xx, yy; + int16 xx, yy; computeSize(origText, &xx, &yy); if (mode & 2) { @@ -83,8 +83,8 @@ void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText, _vm->addDirtyRect(x, y, x + xx, y + yy); - int32 curX = x; - int32 curY = y; + int16 curX = x; + int16 curY = y; int32 height = 0; const byte *text = (const byte *)origText.c_str(); @@ -98,20 +98,20 @@ void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText, curChar = textToFont(curChar); _currentFont->drawFontFrame(_vm->getMainSurface(), curChar, curX, curY, _currentFontColor); curX = curX + _currentFont->getFrameWidth(curChar) - 1; - height = MAX(height, _currentFont->getFrameHeight(curChar)); + height = MAX(height, _currentFont->getFrameHeight(curChar)); } text++; } } -void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int32 *retY) { +void FontRenderer::computeSize(const Common::String &origText, int16 *retX, int16 *retY) { debugC(4, kDebugFont, "computeSize(%s, retX, retY)", origText.c_str()); - int32 lineWidth = 0; - int32 lineHeight = 0; - int32 totalHeight = 0; - int32 totalWidth = 0; - int32 lastLineHeight = 0; + int16 lineWidth = 0; + int16 lineHeight = 0; + int16 totalHeight = 0; + int16 totalWidth = 0; + int16 lastLineHeight = 0; const byte *text = (const byte *)origText.c_str(); while (*text) { @@ -127,8 +127,8 @@ void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int3 lastLineHeight = 0; } else { curChar = textToFont(curChar); - int32 charWidth = _currentFont->getFrameWidth(curChar) - 1; - int32 charHeight = _currentFont->getFrameHeight(curChar); + int16 charWidth = _currentFont->getFrameWidth(curChar) - 1; + int16 charHeight = _currentFont->getFrameHeight(curChar); lineWidth += charWidth; lineHeight = MAX(lineHeight, charHeight); @@ -137,7 +137,7 @@ void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int3 // assume we only need to take the lower bound into // consideration. Common::Rect charRect = _currentFont->getFrameRect(curChar); - lastLineHeight = MAX(lastLineHeight, charRect.bottom); + lastLineHeight = MAX(lastLineHeight, charRect.bottom); } text++; } @@ -189,7 +189,7 @@ void FontRenderer::setFontColor(int32 fontColor1, int32 fontColor2, int32 fontCo _currentFontColor[3] = fontColor3; } -void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode) { +void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &origText, int32 mode) { debugC(5, kDebugFont, "renderMultiLineText(%d, %d, %s, %d)", x, y, origText.c_str(), mode); // divide the text in several lines @@ -204,10 +204,10 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o byte *it = text; - int32 maxWidth = 0; - int32 curWidth = 0; + int16 maxWidth = 0; + int16 curWidth = 0; - while (1) { + while (true) { byte *lastLine = it; byte *lastSpace = it; int32 lastSpaceX = 0; @@ -223,7 +223,7 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o curChar = textToFont(curChar); int width = _currentFont->getFrameWidth(curChar); - curWidth += MAX(width - 2, 0); + curWidth += MAX(width - 2, 0); it++; curLetterNr++; } @@ -260,8 +260,8 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o //numLines++; // get font height (assumed to be constant) - int32 height = _currentFont->getHeight(); - int textSize = (height - 2) * numLines; + int16 height = _currentFont->getHeight(); + int32 textSize = (height - 2) * numLines; y = y - textSize; if (y < 30) y = 30; @@ -278,8 +278,8 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &o x = TOON_SCREEN_WIDTH - (maxWidth / 2) - 30; // we have good coordinates now, we can render the multi line - int32 curX = x; - int32 curY = y; + int16 curX = x; + int16 curY = y; for (int32 i = 0; i < numLines; i++) { const byte *line = lines[i]; diff --git a/engines/toon/font.h b/engines/toon/font.h index 349d9d1ee7fa..2a46ad355910 100644 --- a/engines/toon/font.h +++ b/engines/toon/font.h @@ -33,9 +33,9 @@ class FontRenderer { ~FontRenderer(); void setFont(Animation *font); - void computeSize(const Common::String &origText, int32 *retX, int32 *retY); - void renderText(int32 x, int32 y, const Common::String &origText, int32 mode); - void renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode); + void computeSize(const Common::String &origText, int16 *retX, int16 *retY); + void renderText(int16 x, int16 y, const Common::String &origText, int32 mode); + void renderMultiLineText(int16 x, int16 y, const Common::String &origText, int32 mode); void setFontColorByCharacter(int32 characterId); void setFontColor(int32 fontColor1, int32 fontColor2, int32 fontColor3); protected: diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp index ce2cdf1bb94d..8b8f0ab57721 100644 --- a/engines/toon/hotspot.cpp +++ b/engines/toon/hotspot.cpp @@ -57,7 +57,7 @@ void Hotspots::save(Common::WriteStream *Stream) { } } -int32 Hotspots::FindBasedOnCorner(int32 x, int32 y) { +int32 Hotspots::FindBasedOnCorner(int16 x, int16 y) { debugC(1, kDebugHotspot, "FindBasedOnCorner(%d, %d)", x, y); for (int32 i = 0; i < _numItems; i++) { @@ -73,7 +73,7 @@ int32 Hotspots::FindBasedOnCorner(int32 x, int32 y) { return -1; } -int32 Hotspots::Find(int32 x, int32 y) { +int32 Hotspots::Find(int16 x, int16 y) { debugC(6, kDebugHotspot, "Find(%d, %d)", x, y); int32 priority = -1; diff --git a/engines/toon/hotspot.h b/engines/toon/hotspot.h index 70e80046e159..3852e2e42ed8 100644 --- a/engines/toon/hotspot.h +++ b/engines/toon/hotspot.h @@ -51,8 +51,8 @@ class Hotspots { ~Hotspots(); bool LoadRif(const Common::String &rifName, const Common::String &additionalRifName); - int32 Find(int32 x, int32 y); - int32 FindBasedOnCorner(int32 x, int32 y); + int32 Find(int16 x, int16 y); + int32 FindBasedOnCorner(int16 x, int16 y); HotspotData *Get(int32 id); int32 getCount() const { return _numItems; } diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index 8cdf92363ff4..8c85e20f7c2f 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -25,6 +25,7 @@ #include "common/keyboard.h" #include "common/stream.h" #include "common/system.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "toon/audio.h" @@ -33,6 +34,10 @@ namespace Toon { +ToonstruckSmackerDecoder::ToonstruckSmackerDecoder() : Video::SmackerDecoder() { + _lowRes = false; +} + void ToonstruckSmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) { debugC(6, kDebugMovie, "handleAudioTrack(%d, %d, %d)", track, chunkSize, unpackedSize); @@ -40,33 +45,21 @@ void ToonstruckSmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, ui /* uint16 width = */ _fileStream->readUint16LE(); uint16 height = _fileStream->readUint16LE(); _lowRes = (height == getHeight() / 2); - } else + } else { Video::SmackerDecoder::handleAudioTrack(track, chunkSize, unpackedSize); + } } -bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename) { - debugC(1, kDebugMovie, "loadFile(%s)", filename.c_str()); +bool ToonstruckSmackerDecoder::loadStream(Common::SeekableReadStream *stream) { + if (!Video::SmackerDecoder::loadStream(stream)) + return false; _lowRes = false; - - if (Video::SmackerDecoder::loadFile(filename)) { - if (_surface->h == 200) { - if (_surface) { - _surface->free(); - delete _surface; - } - _surface = new Graphics::Surface(); - _surface->create(640, 400, Graphics::PixelFormat::createFormatCLUT8()); - _header.flags = 4; - } - - return true; - } - return false; + return true; } -ToonstruckSmackerDecoder::ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : Video::SmackerDecoder(mixer, soundType) { - _lowRes = false; +Video::SmackerDecoder::SmackerVideoTrack *ToonstruckSmackerDecoder::createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const { + return Video::SmackerDecoder::createVideoTrack(width, height, frameCount, frameRate, (height == 200) ? 4 : flags, signature); } // decoder is deallocated with Movie destruction i.e. new ToonstruckSmackerDecoder is needed @@ -103,46 +96,49 @@ void Movie::play(const Common::String &video, int32 flags) { bool Movie::playVideo(bool isFirstIntroVideo) { debugC(1, kDebugMovie, "playVideo(isFirstIntroVideo: %d)", isFirstIntroVideo); + + _decoder->start(); + while (!_vm->shouldQuit() && !_decoder->endOfVideo()) { if (_decoder->needsUpdate()) { const Graphics::Surface *frame = _decoder->decodeNextFrame(); if (frame) { if (_decoder->isLowRes()) { // handle manually 2x scaling here - Graphics::Surface* surf = _vm->getSystem()->lockScreen(); + Graphics::Surface* surf = _vm->_system->lockScreen(); for (int y = 0; y < frame->h / 2; y++) { memcpy(surf->getBasePtr(0, y * 2 + 0), frame->getBasePtr(0, y), frame->pitch); memcpy(surf->getBasePtr(0, y * 2 + 1), frame->getBasePtr(0, y), frame->pitch); } - _vm->getSystem()->unlockScreen(); + _vm->_system->unlockScreen(); } else { - _vm->getSystem()->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); // WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels. if (isFirstIntroVideo) { int32 currentFrame = _decoder->getCurFrame(); if (currentFrame >= 956 && currentFrame <= 1038) { debugC(1, kDebugMovie, "Triggered workaround for glitch in first intro video..."); - _vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1); - _vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1); - _vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1); - _vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1); + _vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1); + _vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1); } } } } - _decoder->setSystemPalette(); - _vm->getSystem()->updateScreen(); + _vm->_system->getPaletteManager()->setPalette(_decoder->getPalette(), 0, 256); + _vm->_system->updateScreen(); } Common::Event event; - while (_vm->getSystem()->getEventManager()->pollEvent(event)) + while (_vm->_system->getEventManager()->pollEvent(event)) if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) { _vm->dirtyAllScreen(); return false; } - _vm->getSystem()->delayMillis(10); + _vm->_system->delayMillis(10); } _vm->dirtyAllScreen(); return !_vm->shouldQuit(); diff --git a/engines/toon/movie.h b/engines/toon/movie.h index 2cd33302f231..e795182cba76 100644 --- a/engines/toon/movie.h +++ b/engines/toon/movie.h @@ -30,13 +30,17 @@ namespace Toon { class ToonstruckSmackerDecoder : public Video::SmackerDecoder { public: - ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType); - virtual ~ToonstruckSmackerDecoder() {} - void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize); - bool loadFile(const Common::String &filename); + ToonstruckSmackerDecoder(); + + bool loadStream(Common::SeekableReadStream *stream); bool isLowRes() { return _lowRes; } + protected: - bool _lowRes; + void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize); + SmackerVideoTrack *createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const; + +private: + bool _lowRes; }; class Movie { diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp index ff136e5acb2b..204b0fe57678 100644 --- a/engines/toon/picture.cpp +++ b/engines/toon/picture.cpp @@ -150,7 +150,7 @@ void Picture::setupPalette() { _vm->setPaletteEntries(_palette, 1, 128); } -void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy) { +void Picture::drawMask(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy) { debugC(1, kDebugPicture, "drawMask(surface, %d, %d, %d, %d)", x, y, dx, dy); for (int32 i = 0; i < 128; i++) { @@ -161,8 +161,8 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i _vm->setPaletteEntries(color, i, 1); } - int32 rx = MIN(_width, surface.w - x); - int32 ry = MIN(_height, surface.h - y); + int16 rx = MIN(_width, surface.w - x); + int16 ry = MIN(_height, surface.h - y); if (rx < 0 || ry < 0) return; @@ -172,10 +172,10 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i uint8 *c = _data + _width * dy + dx; uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x; - for (int32 yy = 0; yy < ry; yy++) { + for (int16 yy = 0; yy < ry; yy++) { uint8 *curSrc = c; uint8 *cur = curRow; - for (int32 xx = 0; xx < rx; xx++) { + for (int16 xx = 0; xx < rx; xx++) { //*cur = (*curSrc >> 5) * 8; // & 0x1f; *cur = (*curSrc & 0x1f) ? 127 : 0; @@ -187,10 +187,9 @@ void Picture::drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, i } } -void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array& rectArray) { - - int32 rx = MIN(_width, surface.w - x); - int32 ry = MIN(_height, surface.h - y); +void Picture::drawWithRectList(Graphics::Surface& surface, int16 x, int16 y, int16 dx, int16 dy, Common::Array& rectArray) { + int16 rx = MIN(_width, surface.w - x); + int16 ry = MIN(_height, surface.h - y); if (rx < 0 || ry < 0) return; @@ -202,16 +201,16 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int Common::Rect rect = rectArray[i]; - int32 fillRx = MIN(rx, rect.right - rect.left); - int32 fillRy = MIN(ry, rect.bottom - rect.top); + int16 fillRx = MIN(rx, rect.right - rect.left); + int16 fillRy = MIN(ry, rect.bottom - rect.top); uint8 *c = _data + _width * (dy + rect.top) + (dx + rect.left); uint8 *curRow = (uint8 *)surface.pixels + (y + rect.top) * destPitch + (x + rect.left); - for (int32 yy = 0; yy < fillRy; yy++) { + for (int16 yy = 0; yy < fillRy; yy++) { uint8 *curSrc = c; uint8 *cur = curRow; - for (int32 xx = 0; xx < fillRx; xx++) { + for (int16 xx = 0; xx < fillRx; xx++) { *cur = *curSrc; curSrc++; cur++; @@ -222,11 +221,11 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int } } -void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy) { +void Picture::draw(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy) { debugC(6, kDebugPicture, "draw(surface, %d, %d, %d, %d)", x, y, dx, dy); - int32 rx = MIN(_width, surface.w - x); - int32 ry = MIN(_height, surface.h - y); + int16 rx = MIN(_width, surface.w - x); + int16 ry = MIN(_height, surface.h - y); if (rx < 0 || ry < 0) return; @@ -236,10 +235,10 @@ void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 uint8 *c = _data + _width * dy + dx; uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x; - for (int32 yy = 0; yy < ry; yy++) { + for (int16 yy = 0; yy < ry; yy++) { uint8 *curSrc = c; uint8 *cur = curRow; - for (int32 xx = 0; xx < rx; xx++) { + for (int16 xx = 0; xx < rx; xx++) { *cur = *curSrc; curSrc++; cur++; @@ -249,7 +248,7 @@ void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 } } -uint8 Picture::getData(int32 x, int32 y) { +uint8 Picture::getData(int16 x, int16 y) { debugC(6, kDebugPicture, "getData(%d, %d)", x, y); if (!_data) @@ -259,7 +258,7 @@ uint8 Picture::getData(int32 x, int32 y) { } // use original work from johndoe -void Picture::floodFillNotWalkableOnMask(int32 x, int32 y) { +void Picture::floodFillNotWalkableOnMask(int16 x, int16 y) { debugC(1, kDebugPicture, "floodFillNotWalkableOnMask(%d, %d)", x, y); // Stack-based floodFill algorithm based on // http://student.kuleuven.be/~m0216922/CG/files/floodfill.cpp @@ -292,10 +291,10 @@ void Picture::floodFillNotWalkableOnMask(int32 x, int32 y) { } } -void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable) { +void Picture::drawLineOnMask(int16 x, int16 y, int16 x2, int16 y2, bool walkable) { debugC(1, kDebugPicture, "drawLineOnMask(%d, %d, %d, %d, %d)", x, y, x2, y2, (walkable) ? 1 : 0); - static int32 lastX = 0; - static int32 lastY = 0; + static int16 lastX = 0; + static int16 lastY = 0; if (x == -1) { x = lastX; @@ -303,12 +302,12 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable } uint32 bx = x << 16; - int32 dx = x2 - x; + int16 dx = x2 - x; uint32 by = y << 16; - int32 dy = y2 - y; - uint32 adx = abs(dx); - uint32 ady = abs(dy); - int32 t = 0; + int16 dy = y2 - y; + uint16 adx = abs(dx); + uint16 ady = abs(dy); + int16 t = 0; if (adx <= ady) t = ady; else @@ -317,9 +316,7 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable int32 cdx = (dx << 16) / t; int32 cdy = (dy << 16) / t; - int32 i = t; - while (i) { - + for (int16 i = t; i > 0; i--) { int32 rx = bx >> 16; int32 ry = by >> 16; @@ -337,7 +334,6 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable bx += cdx; by += cdy; - i--; } } } // End of namespace Toon diff --git a/engines/toon/picture.h b/engines/toon/picture.h index 460c5b58a20c..5e79612a3968 100644 --- a/engines/toon/picture.h +++ b/engines/toon/picture.h @@ -33,25 +33,27 @@ namespace Toon { class ToonEngine; -class Picture { +class Picture { public: Picture(ToonEngine *vm); ~Picture(); + bool loadPicture(const Common::String &file); void setupPalette(); - void draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy); - void drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array& rectArray); - void drawMask(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy); - void drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable); - void floodFillNotWalkableOnMask(int32 x, int32 y); - uint8 getData(int32 x, int32 y); + void draw(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy); + void drawWithRectList(Graphics::Surface& surface, int16 x, int16 y, int16 dx, int16 dy, Common::Array& rectArray); + void drawMask(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 dy); + void drawLineOnMask(int16 x, int16 y, int16 x2, int16 y2, bool walkable); + void floodFillNotWalkableOnMask(int16 x, int16 y); + uint8 getData(int16 x, int16 y); uint8 *getDataPtr() { return _data; } - int32 getWidth() const { return _width; } - int32 getHeight() const { return _height; } + int16 getWidth() const { return _width; } + int16 getHeight() const { return _height; } + protected: - int32 _width; - int32 _height; + int16 _width; + int16 _height; uint8 *_data; uint8 *_palette; // need to be copied at 3-387 int32 _paletteEntries; diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp index e9b7534198f7..1fa405811486 100644 --- a/engines/toon/script_func.cpp +++ b/engines/toon/script_func.cpp @@ -564,9 +564,9 @@ int32 ScriptFunc::sys_Cmd_Exit_Conversation(EMCState *state) { int32 ScriptFunc::sys_Cmd_Set_Mouse_Pos(EMCState *state) { if (_vm->state()->_inCloseUp) { - _vm->getSystem()->warpMouse(stackPos(0), stackPos(1)); + _vm->_system->warpMouse(stackPos(0), stackPos(1)); } else { - _vm->getSystem()->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1)); + _vm->_system->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1)); } return 0; } diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 416daa1fe87b..9fd8415676b1 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -51,7 +51,7 @@ void ToonEngine::init() { _currentScriptRegion = 0; _resources = new Resources(this); _animationManager = new AnimationManager(this); - _moviePlayer = new Movie(this, new ToonstruckSmackerDecoder(_mixer)); + _moviePlayer = new Movie(this, new ToonstruckSmackerDecoder()); _hotspots = new Hotspots(this); _mainSurface = new Graphics::Surface(); @@ -820,7 +820,6 @@ Common::Error ToonEngine::run() { ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription) : Engine(syst), _gameDescription(gameDescription), _language(gameDescription->language), _rnd("toon") { - _system = syst; _tickLength = 16; _currentPicture = NULL; _inventoryPicture = NULL; @@ -1224,7 +1223,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { _script->init(&_sceneAnimationScripts[i]._state, _sceneAnimationScripts[i]._data); if (!forGameLoad) { _script->start(&_sceneAnimationScripts[i]._state, 9 + i); - _sceneAnimationScripts[i]._lastTimer = getSystem()->getMillis(); + _sceneAnimationScripts[i]._lastTimer = _system->getMillis(); _sceneAnimationScripts[i]._frozen = false; _sceneAnimationScripts[i]._frozenForConversation = false; } @@ -1588,12 +1587,12 @@ void ToonEngine::clickEvent() { } void ToonEngine::selectHotspot() { - int32 x1 = 0; - int32 x2 = 0; - int32 y1 = 0; - int32 y2 = 0; + int16 x1 = 0; + int16 x2 = 0; + int16 y1 = 0; + int16 y2 = 0; - int32 mouseX = _mouseX; + int16 mouseX = _mouseX; if (_gameState->_inCutaway) mouseX += TOON_BACKBUFFER_WIDTH; @@ -1693,7 +1692,6 @@ void ToonEngine::selectHotspot() { } void ToonEngine::exitScene() { - fadeOut(5); // disable all scene animation @@ -2831,7 +2829,6 @@ void ToonEngine::playSoundWrong() { } void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) { - if (characterId < 0) characterId = 0; @@ -2852,8 +2849,8 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) { } } else if (characterId == 1) { // flux - int32 x = _flux->getX(); - int32 y = _flux->getY(); + int16 x = _flux->getX(); + int16 y = _flux->getY(); if (x >= _gameState->_currentScrollValue && x <= _gameState->_currentScrollValue + TOON_SCREEN_WIDTH) { if (!_gameState->_inCutaway) { *retX = x; @@ -2885,7 +2882,7 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) { if (character && !_gameState->_inCutaway) { if (character->getAnimationInstance()) { if (character->getX() >= _gameState->_currentScrollValue && character->getX() <= _gameState->_currentScrollValue + TOON_SCREEN_WIDTH) { - int32 x1, y1, x2, y2; + int16 x1, y1, x2, y2; character->getAnimationInstance()->getRect(&x1, &y1, &x2, &y2); *retX = (x1 + x2) / 2; *retY = y1; @@ -2896,7 +2893,6 @@ void ToonEngine::getTextPosition(int32 characterId, int32 *retX, int32 *retY) { } Character *ToonEngine::getCharacterById(int32 charId) { - for (int32 i = 0; i < 8; i++) { if (_characters[i] && _characters[i]->getId() == charId) return _characters[i]; diff --git a/engines/toon/toon.h b/engines/toon/toon.h index 540f3e403b9d..d40c489011cd 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -289,10 +289,6 @@ class ToonEngine : public Engine { return _oldTimer2; } - OSystem *getSystem() { - return _system; - } - AudioManager *getAudioManager() { return _audioManager; } @@ -340,7 +336,6 @@ class ToonEngine : public Engine { void clearDirtyRects(); protected: - OSystem *_system; int32 _tickLength; Resources *_resources; TextResource *_genericTexts; diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index 35dd54776f36..e4bbe0c4c1d4 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -135,19 +135,13 @@ class ToucheMetaEngine : public AdvancedMetaEngine { } virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { - const ADGameDescription *matchedDesc = detectGameFilebased(allFiles, Touche::fileBasedFallback); - - if (matchedDesc) { // We got a match - Common::String report = Common::String::format(_("Your game version has been detected using " - "filename matching as a variant of %s."), matchedDesc->gameid); - report += "\n"; - report += _("If this is an original and unmodified version, please report any"); - report += "\n"; - report += _("information previously printed by ScummVM to the team."); - report += "\n"; - g_system->logMessage(LogMessageType::kInfo, report.c_str()); - } + ADFilePropertiesMap filesProps; + + const ADGameDescription *matchedDesc = detectGameFilebased(allFiles, fslist, Touche::fileBasedFallback, &filesProps); + if (!matchedDesc) + return 0; + reportUnknown(fslist.begin()->getParent(), filesProps); return matchedDesc; } diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index a76d5839a9c4..23701c9e5b5a 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -88,7 +88,7 @@ RightClickDialog::~RightClickDialog() { void RightClickDialog::draw() { // Save the covered background area - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); // Draw the dialog image g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); @@ -323,7 +323,7 @@ void AmmoBeltDialog::draw() { if (!_savedArea) { // Save the covered background area - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); } else { bounds.moveTo(0, 0); } diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index 2178f31b301e..1cb8191640d5 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -794,12 +794,12 @@ bool Scene910::Lyle::startAction(CursorType action, Event &event) { Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene; if (action == CURSOR_USE) { - if (BF_GLOBALS._v4CEE2 == 0) + if (BF_GLOBALS._nico910State == 0) return NamedObject::startAction(action, event); else return false; } else if (action == CURSOR_TALK) { - if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._v4CEE2 != 0)) { + if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._nico910State != 0)) { scene->_stripManager.start(9100 + _field90, &BF_GLOBALS._stripProxy); if (_field90 < 1) _field90++; @@ -833,7 +833,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) { return true; break; case CURSOR_TALK: - if (BF_GLOBALS._v4CEE2 >= 4) + if (BF_GLOBALS._nico910State >= 4) return NamedObject::startAction(action, event); if (BF_GLOBALS._v4CEE6 < 4) @@ -847,8 +847,8 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) { return true; break; case INV_COLT45: - if (BF_GLOBALS._v4CEE2 > 1) { - if (BF_GLOBALS._v4CEE2 != 4) { + if (BF_GLOBALS._nico910State > 1) { + if (BF_GLOBALS._nico910State != 4) { if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())) { if (scene->_field2DE0 == 0) { BF_GLOBALS._player.disableControl(); @@ -880,7 +880,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) { break; case INV_BADGE: case INV_ID: - if (BF_GLOBALS._v4CEE2 >= 4) + if (BF_GLOBALS._nico910State >= 4) return NamedObject::startAction(action, event); if (BF_GLOBALS._v4CEE6 < 4) @@ -895,11 +895,12 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) { return true; break; case INV_YELLOW_CORD: - if (BF_GLOBALS._v4CEE2 < 4) { + if (BF_GLOBALS._nico910State < 4) { BF_GLOBALS._player.disableControl(); scene->_yellowCord.fixPriority(121); scene->_sceneSubMode = 10; scene->_sceneMode = 9123; + BF_GLOBALS._nico910State = 3; if (BF_GLOBALS._player._visage == 1911) scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL); else @@ -995,7 +996,7 @@ bool Scene910::Stuart::startAction(CursorType action, Event &event) { return true; } else { BF_GLOBALS._player.disableControl(); - if (BF_GLOBALS._v4CEE2 == 4) { + if (BF_GLOBALS._nico910State == 4) { scene->_sceneSubMode = 11; scene->_sceneMode = 9123; if (BF_GLOBALS._player._visage == 1911) @@ -1136,7 +1137,7 @@ bool Scene910::BreakerBox::startAction(CursorType action, Event &event) { SceneItem::display2(910, 62); return true; } else if (scene->_sceneMode != 9120) { - if (BF_GLOBALS._v4CEE2 == 1) { + if (BF_GLOBALS._nico910State == 1) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 9118; scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL); @@ -1291,7 +1292,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) { switch (_state) { case 1: - if (BF_GLOBALS._v4CEE2 < 1) { + if (BF_GLOBALS._nico910State < 1) { if (_frame == 2) { if (!BF_GLOBALS.getFlag(fGotPointsForClosingDoor)) { T2_GLOBALS._uiElements.addScore(30); @@ -1299,7 +1300,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) { } scene->_sceneMode = 0; if (BF_GLOBALS._dayNumber == 5) { - if (BF_GLOBALS._v4CEE2 == 0) { + if (BF_GLOBALS._nico910State == 0) { scene->_breakerBoxInset.remove(); // _objectList.draw(); BF_GLOBALS._player.disableControl(); @@ -1309,7 +1310,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) { scene->_nico.postInit(); scene->_sceneMode = 9129; scene->setAction(&scene->_sequenceManager1, scene, 9129, &BF_GLOBALS._player, &scene->_nico, NULL); - } else if (BF_GLOBALS._v4CEE2 == 2) { + } else if (BF_GLOBALS._nico910State == 2) { scene->_breakerBoxInset.remove(); // _objectList.draw(); BF_GLOBALS._player.disableControl(); @@ -1612,7 +1613,7 @@ bool Scene910::BlackPlug::startAction(CursorType action, Event &event) { SET_EXT_FGCOLOR, 13, LIST_END); return true; } - if (BF_GLOBALS._v4CEE2 == 3) { + if (BF_GLOBALS._nico910State == 3) { SceneItem::display(910, 84, SET_WIDTH, 312, SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4, SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2, @@ -1830,7 +1831,7 @@ bool Scene910::Generator::startAction(CursorType action, Event &event) { SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2, SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9, SET_EXT_FGCOLOR, 13, LIST_END); - else if (BF_GLOBALS._v4CEE2 == 1) { + else if (BF_GLOBALS._nico910State == 1) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 9118; scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL); @@ -1869,7 +1870,7 @@ bool Scene910::Item2::startAction(CursorType action, Event &event) { bool Scene910::Item3::startAction(CursorType action, Event &event) { Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene; - if ((action == CURSOR_TALK) && (BF_GLOBALS._v4CEE2 == 4) && (BF_GLOBALS._v4CEE4 == 0)) { + if ((action == CURSOR_TALK) && (BF_GLOBALS._nico910State == 4) && (BF_GLOBALS._v4CEE4 == 0)) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 15; scene->_stripManager.start(9102, scene); @@ -1907,7 +1908,7 @@ bool Scene910::Item15::startAction(CursorType action, Event &event) { bool Scene910::Item16::startAction(CursorType action, Event &event) { Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene; - if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0)) + if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0)) return false; if (BF_GLOBALS._player._visage == 1911) { @@ -2016,7 +2017,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) { if (BF_GLOBALS._dayNumber < 5) _item17.setDetails(Rect(0, 149, 29, 167), 910, -1, -1, -1, 1, NULL); - if (BF_GLOBALS._v4CEE2 == 0) + if (BF_GLOBALS._nico910State == 0) _item16.setDetails(Rect(265, 18, 319, 102), 910, -1, -1, -1, 1, NULL); _breakerBox.setDetails(910, 6, -1, -1, 1, (SceneItem *)NULL); @@ -2048,7 +2049,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) { || (BF_GLOBALS._sceneManager._previousScene == 190) || (BF_GLOBALS._sceneManager._previousScene == 300)) { BF_GLOBALS._sceneManager._previousScene = 900; - BF_GLOBALS._v4CEE2 = 0; + BF_GLOBALS._nico910State = 0; BF_GLOBALS._v4CEE4 = 0; } @@ -2142,7 +2143,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) { _nico.setPosition(Common::Point(262, 124)); _nico.setStrip(6); BF_GLOBALS._v4CEE6 = 0; - BF_GLOBALS._v4CEE2 = 1; + BF_GLOBALS._nico910State = 1; _nico.setDetails(910, 63, 64, 67, 5, &_item4); BF_GLOBALS._v4CECA = 2; if (BF_GLOBALS._v4CECC == 0) @@ -2157,7 +2158,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._player.disableControl(); } - if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)){ + if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)){ _shadow.postInit(); _shadow.setAction(&_action2); } @@ -2297,7 +2298,7 @@ void Scene910::signal() { case 13: BF_GLOBALS._player.disableControl(); BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 9117, &_nico, NULL); - BF_GLOBALS._v4CEE2 = 2; + BF_GLOBALS._nico910State = 2; // No break on purpose case 15: _stuart.postInit(); @@ -2314,7 +2315,7 @@ void Scene910::signal() { _lyle._field90 = 1; _sceneMode = 10; addFader((const byte *)&black, 2, this); - BF_GLOBALS._v4CEE2 = 1; + BF_GLOBALS._nico910State = 1; BF_GLOBALS._walkRegions.disableRegion(16); BF_GLOBALS._walkRegions.disableRegion(14); BF_GLOBALS._sceneItems.remove(&_item16); @@ -2324,7 +2325,7 @@ void Scene910::signal() { BF_GLOBALS._player._frame = 1; if (_field2DE2 == 0) { _field2DE2 = 1; - if (BF_GLOBALS._v4CEE2 == 4) { + if (BF_GLOBALS._nico910State == 4) { _sceneMode = 9149; setAction(&_sequenceManager1, this, 9149, &BF_GLOBALS._player, NULL); } else { @@ -2452,7 +2453,7 @@ void Scene910::signal() { break; case 9114: _fakeWall.hide(); - if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) { + if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) { BF_GLOBALS._player.disableControl(); _nico.postInit(); _nico.setDetails(910, 63, 64, 65, 5, &_item4); @@ -2496,7 +2497,7 @@ void Scene910::signal() { case 9121: _item3.setDetails(7, 910, 96, 60, 61, 3); BF_GLOBALS._v4CEE4 = 2; - if (BF_GLOBALS._v4CEE2 == 4) { + if (BF_GLOBALS._nico910State == 4) { _sceneMode = 20; _stripManager.start(9115, this); } else { @@ -2527,7 +2528,7 @@ void Scene910::signal() { setAction(&_sequenceManager1, this, 9111, &BF_GLOBALS._player, &_blackCord, NULL); break; case 5: - switch (BF_GLOBALS._v4CEE2 - 1) { + switch (BF_GLOBALS._nico910State - 1) { case 0: _sceneMode = 9118; setAction(&_sequenceManager1, this, 9118, &BF_GLOBALS._player, &_nico, NULL); @@ -2598,7 +2599,7 @@ void Scene910::signal() { break; case 9125: BF_GLOBALS.setFlag(fBackupAt340); - BF_GLOBALS._v4CEE2 = 4; + BF_GLOBALS._nico910State = 4; _stuart.postInit(); _nico.setDetails(910, 72, 73, 74, 3, (SceneItem *)NULL); _stuart.setDetails(910, 66, 67, 68, 5, &_nico); @@ -2645,7 +2646,7 @@ void Scene910::signal() { } _lyle.setAction(&_sequenceManager2, NULL, 9131, &_lyle, NULL); BF_GLOBALS._walkRegions.enableRegion(16); - if (BF_GLOBALS._v4CEE2 == 4) + if (BF_GLOBALS._nico910State == 4) BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 0); else BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910); @@ -2679,7 +2680,7 @@ void Scene910::signal() { } break; case 9143: - if (BF_GLOBALS._v4CEE2 == 0) { + if (BF_GLOBALS._nico910State == 0) { BF_GLOBALS._v51C44 = 1; BF_GLOBALS._sceneManager.changeScene(920); } else { @@ -2730,7 +2731,7 @@ void Scene910::process(Event &event) { if (_item17._bounds.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); BF_GLOBALS._events.setCursor(surface); - } else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0)) { + } else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0)) { CursorType cursorId = BF_GLOBALS._events.getCursor(); BF_GLOBALS._events.setCursor(cursorId); } else if (!_item16._bounds.contains(event.mousePos)) { @@ -2755,7 +2756,7 @@ void Scene910::process(Event &event) { _sceneMode = 9123; setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL); event.handled = true; - } else if (BF_GLOBALS._v4CEE2 <= 1) { + } else if (BF_GLOBALS._nico910State <= 1) { if (BF_GLOBALS.getFlag(fCanDrawGun)) { BF_GLOBALS._player.addMover(NULL); BF_GLOBALS._player.disableControl(); @@ -2776,7 +2777,7 @@ void Scene910::process(Event &event) { event.handled = true; break; case CURSOR_WALK: - if (BF_GLOBALS._v4CEE2 == 1) { + if (BF_GLOBALS._nico910State == 1) { BF_GLOBALS._player.disableControl(); if (BF_GLOBALS._player._visage == 1911) { BF_GLOBALS._player.disableControl(); @@ -2826,7 +2827,7 @@ void Scene910::dispatch() { _sceneSubMode = 3; _sceneMode = 9123; setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL); - } else if (BF_GLOBALS._v4CEE2 == 0) { + } else if (BF_GLOBALS._nico910State == 0) { _sceneMode = 9143; setAction(&_sequenceManager1, this, 9143, &BF_GLOBALS._player, NULL); } else { @@ -2840,7 +2841,7 @@ void Scene910::dispatch() { } } - if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._v4CEE2 == 0)) { + if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._nico910State == 0)) { BF_GLOBALS._player.disableControl(); _shadow.remove(); _nico.remove(); @@ -2853,7 +2854,7 @@ void Scene910::dispatch() { } void Scene910::checkGun() { - if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0) && (BF_GLOBALS._hiddenDoorStatus != 0)) + if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0) && (BF_GLOBALS._hiddenDoorStatus != 0)) SceneItem::display(910, 70, SET_WIDTH, 312, SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4, SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2, @@ -2900,7 +2901,7 @@ void Scene910::closeHiddenDoor() { setAction(&_sequenceManager1, this, 9115, &_fakeWall, &_object5, NULL); } - if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) { + if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) { // _objectList.draw(); if (BF_GLOBALS._sceneObjects->contains(&_breakerBoxInset)) _breakerBoxInset.remove(); diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 06fbffb75145..ba27db91042f 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -505,7 +505,7 @@ void ConversationChoiceDialog::draw() { // Make a backup copy of the area the dialog will occupy Rect tempRect = _bounds; tempRect.collapse(-10, -10); - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), tempRect); // Fill in the contents of the entire dialog _gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index 0c458f5c351c..bcadfdc2014d 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -164,8 +164,6 @@ class TSageMetaEngine : public AdvancedMetaEngine { // Create the return descriptor SaveStateDescriptor desc(slot, header.saveName); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); desc.setThumbnail(header.thumbnail); desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay); desc.setSaveTime(header.saveHour, header.saveMinutes); diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index d538cbacbf10..a84ee5662f62 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -105,7 +105,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "17c3993415e8a2cf93040eef7e88ec93", 1156508), Common::EN_ANY, Common::kPlatformPC, - ADGF_TESTING, + ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, @@ -120,7 +120,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "17eabb456cb1546c66baf1aff387ba6a", 10032614), Common::EN_ANY, Common::kPlatformPC, - ADGF_TESTING, + ADGF_NO_FLAGS, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, @@ -134,7 +134,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "99983f48cb218f1f3760cf2f9a7ef11d", 63863322), Common::EN_ANY, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, @@ -150,7 +150,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "5b2b35c51b62e82d82b0791540bfae2d", 10082565), Common::ES_ESP, Common::kPlatformPC, - ADGF_CD | ADGF_TESTING, + ADGF_CD | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index 972d591c34dd..77ac0a25d789 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -116,7 +116,7 @@ void ModalDialog::draw() { // Make a backup copy of the area the dialog will occupy Rect tempRect = _bounds; tempRect.collapse(-10, -10); - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), tempRect); _gfxManager.activate(); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 59eb59b1941c..de9463268bb5 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -247,7 +247,7 @@ void BlueForceGlobals::synchronize(Serializer &s) { for (int i = 0; i < 18; i++) s.syncAsByte(_breakerBoxStatusArr[i]); s.syncAsSint16LE(_hiddenDoorStatus); - s.syncAsSint16LE(_v4CEE2); + s.syncAsSint16LE(_nico910State); s.syncAsSint16LE(_v4CEE4); s.syncAsSint16LE(_v4CEE6); s.syncAsSint16LE(_v4CEE8); @@ -320,7 +320,7 @@ void BlueForceGlobals::reset() { _breakerBoxStatusArr[16] = 3; _breakerBoxStatusArr[17] = 0; _hiddenDoorStatus = 0; - _v4CEE2 = 0; + _nico910State = 0; _v4CEE4 = 0; _v4CEE6 = 0; _v4CEE8 = 0; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 45226c921bd2..d190b6a2a4c3 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -200,7 +200,7 @@ class BlueForceGlobals: public TsAGE2Globals { int _v4CECC; int8 _breakerBoxStatusArr[18]; int _hiddenDoorStatus; - int _v4CEE2; + int _nico910State; int _v4CEE4; int _v4CEE6; int _v4CEE8; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 0781ae4544d7..fb0b0b0cbb8a 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -38,7 +38,7 @@ namespace TsAGE { * @src Source surface * @bounds Area to backup */ -GfxSurface *Surface_getArea(GfxSurface &src, const Rect &bounds) { +GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds) { assert(bounds.isValidRect()); GfxSurface *dest = new GfxSurface(); dest->create(bounds.width(), bounds.height()); @@ -437,7 +437,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt) // Make a backup copy of the area the text will occupy Rect saveRect = textRect; saveRect.collapse(-20, -8); - GfxSurface *savedArea = Surface_getArea(gfxManager.getSurface(), saveRect); + GfxSurface *savedArea = surfaceGetArea(gfxManager.getSurface(), saveRect); // Display the text gfxManager._font.writeLines(msg.c_str(), textRect, ALIGN_LEFT); @@ -1073,7 +1073,7 @@ void GfxDialog::draw() { Rect tempRect(_bounds); // Make a backup copy of the area the dialog will occupy - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); // Set the palette for use in the dialog setPalette(); diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 9c6f13e40731..9175b1050a87 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -339,7 +339,7 @@ class GfxDialog : public GfxElement { static void setPalette(); }; -GfxSurface *Surface_getArea(GfxSurface &src, const Rect &bounds); +GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds); GfxSurface surfaceFromRes(const byte *imgData); GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum); diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp index 0e451b842969..4728e66cd961 100644 --- a/engines/tsage/ringworld/ringworld_dialogs.cpp +++ b/engines/tsage/ringworld/ringworld_dialogs.cpp @@ -59,7 +59,7 @@ void RightClickButton::highlight() { _savedButton = NULL; } else { // Highlight button by getting the needed highlighted image resource - _savedButton = Surface_getArea(g_globals->gfxManager().getSurface(), _bounds); + _savedButton = surfaceGetArea(g_globals->gfxManager().getSurface(), _bounds); uint size; byte *imgData = g_resourceManager->getSubResource(7, 2, _buttonIndex, &size); @@ -122,7 +122,7 @@ RightClickButton *RightClickDialog::findButton(const Common::Point &pt) { void RightClickDialog::draw() { // Save the covered background area - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); // Draw the dialog image g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index 00c219f2eea1..7d571b40d72e 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -295,7 +295,7 @@ void SceneArea::display() { _bounds.setWidth(_surface.getBounds().width()); _bounds.setHeight(_surface.getBounds().height()); - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); draw2(); } diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp index 3b415bdb6ae4..004ccbbb6d76 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld/ringworld_scenes5.cpp @@ -1893,7 +1893,7 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { _olloFace.setStrip(4); _olloFace.fixPriority(152); - if(g_globals->_sceneManager._previousScene == 4050) { + if (g_globals->_sceneManager._previousScene == 4050) { g_globals->_soundHandler.play(155); g_globals->_player.setPosition(Common::Point(72, 128)); g_globals->_player.enableControl(); diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 30ae6be7b181..478fdcf5a536 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -85,7 +85,7 @@ RightClickDialog::~RightClickDialog() { void RightClickDialog::draw() { // Save the covered background area - _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); + _savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds); // Draw the dialog image g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index e336564c5f14..fa2946d56c3b 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -504,14 +504,14 @@ class SpeakerSoldier : public VisualSpeaker { class SpeakerSoldier300 : public SpeakerSoldier { public: - SpeakerSoldier300() : SpeakerSoldier(60) {}; + SpeakerSoldier300() : SpeakerSoldier(60) {} virtual Common::String getClassName() { return "SpeakerSoldier300"; } virtual void proc15(); }; class SpeakerSoldier1625 : public SpeakerSoldier { public: - SpeakerSoldier1625() : SpeakerSoldier(5) {}; + SpeakerSoldier1625() : SpeakerSoldier(5) {} virtual Common::String getClassName() { return "SpeakerSoldier1625"; } }; @@ -585,7 +585,7 @@ class SpeakerWebbster2500 : public SpeakerWebbster { class SpeakerWebbster3240 : public SpeakerWebbster { public: - SpeakerWebbster3240() : SpeakerWebbster(10) {}; + SpeakerWebbster3240() : SpeakerWebbster(10) {} virtual Common::String getClassName() { return "SpeakerWebbster3240"; } virtual void proc15(); @@ -593,7 +593,7 @@ class SpeakerWebbster3240 : public SpeakerWebbster { class SpeakerWebbster3375 : public SpeakerWebbster { public: - SpeakerWebbster3375() : SpeakerWebbster(60) {}; + SpeakerWebbster3375() : SpeakerWebbster(60) {} virtual Common::String getClassName() { return "SpeakerWebbster3375"; } virtual void proc15(); @@ -601,7 +601,7 @@ class SpeakerWebbster3375 : public SpeakerWebbster { class SpeakerWebbster3385 : public SpeakerWebbster { public: - SpeakerWebbster3385() : SpeakerWebbster(60) {}; + SpeakerWebbster3385() : SpeakerWebbster(60) {} virtual Common::String getClassName() { return "SpeakerWebbster3385"; } virtual void proc15(); @@ -609,7 +609,7 @@ class SpeakerWebbster3385 : public SpeakerWebbster { class SpeakerWebbster3395 : public SpeakerWebbster { public: - SpeakerWebbster3395() : SpeakerWebbster(60) {}; + SpeakerWebbster3395() : SpeakerWebbster(60) {} virtual Common::String getClassName() { return "SpeakerWebbster3395"; } virtual void proc15(); @@ -617,7 +617,7 @@ class SpeakerWebbster3395 : public SpeakerWebbster { class SpeakerWebbster3400 : public SpeakerWebbster { public: - SpeakerWebbster3400() : SpeakerWebbster(27) {}; + SpeakerWebbster3400() : SpeakerWebbster(27) {} virtual Common::String getClassName() { return "SpeakerWebbster3400"; } virtual void proc15(); diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index 10cb6961dc54..4bd9e49875b2 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -112,7 +112,7 @@ void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) { imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); // Save the area behind where the image will be displayed - GfxSurface *savedArea = Surface_getArea(GLOBALS.gfxManager().getSurface(), imgRect); + GfxSurface *savedArea = surfaceGetArea(GLOBALS.gfxManager().getSurface(), imgRect); // Draw the image GLOBALS.gfxManager().copyFrom(objImage, imgRect); diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 775fd6f1a05d..16c4f4f6f00a 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -28,6 +28,7 @@ #include "audio/decoders/wave.h" #include "graphics/palette.h" +#include "graphics/surface.h" #include "tucker/tucker.h" #include "tucker/graphics.h" @@ -749,6 +750,7 @@ void AnimationSequencePlayer::openAnimation(int index, const char *fileName) { _seqNum = 1; return; } + _flicPlayer[index].start(); _flicPlayer[index].decodeNextFrame(); if (index == 0) { getRGBPalette(index); @@ -801,7 +803,7 @@ void AnimationSequencePlayer::playIntroSeq19_20() { if (_flicPlayer[0].getCurFrame() >= 115) { surface = _flicPlayer[1].decodeNextFrame(); if (_flicPlayer[1].endOfVideo()) - _flicPlayer[1].reset(); + _flicPlayer[1].rewind(); } bool framesLeft = decodeNextAnimationFrame(0, false); diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp index 5f764e1bd37a..f15d4e251982 100644 --- a/graphics/decoders/bmp.cpp +++ b/graphics/decoders/bmp.cpp @@ -82,7 +82,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { /* uint16 planes = */ stream.readUint16LE(); uint16 bitsPerPixel = stream.readUint16LE(); - if (bitsPerPixel != 8 && bitsPerPixel != 24) { + if (bitsPerPixel != 8 && bitsPerPixel != 24 && bitsPerPixel != 32) { warning("%dbpp bitmaps not supported", bitsPerPixel); return false; } @@ -119,8 +119,8 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); - // BGRA for 24bpp - if (bitsPerPixel == 24) + // BGRA for 24bpp and 32 bpp + if (bitsPerPixel == 24 || bitsPerPixel == 32) format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0); _surface = new Graphics::Surface(); @@ -136,7 +136,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { stream.read(dst + (height - i - 1) * width, width); stream.skip(extraDataLength); } - } else { + } else if (bitsPerPixel == 24) { byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch; for (int32 i = 0; i < height; i++) { @@ -150,6 +150,27 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { dst += format.bytesPerPixel; } + stream.skip(extraDataLength); + dst -= _surface->pitch * 2; + } + } else { // 32 bpp + byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch; + + for (int32 i = 0; i < height; i++) { + for (uint32 j = 0; j < width; j++) { + byte b = stream.readByte(); + byte g = stream.readByte(); + byte r = stream.readByte(); + // Ignore the last byte, as in v3 it is unused + // and should thus NOT be used as alpha. + // ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx + stream.readByte(); + uint32 color = format.RGBToColor(r, g, b); + + *((uint32 *)dst) = color; + dst += format.bytesPerPixel; + } + stream.skip(extraDataLength); dst -= _surface->pitch * 2; } diff --git a/graphics/decoders/image_decoder.h b/graphics/decoders/image_decoder.h index 7fa00749ffe7..830645d36144 100644 --- a/graphics/decoders/image_decoder.h +++ b/graphics/decoders/image_decoder.h @@ -75,6 +75,9 @@ class ImageDecoder { * until destroy() or loadStream() is called, or until this ImageDecoder's * destructor is called. * + * The palette's format is the same as PaletteManager's palette + * (interleaved RGB values). + * * @return the decoded palette, or 0 if no palette is present */ virtual const byte *getPalette() const { return 0; } diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp index 492c69779f3a..bfaab6dc3558 100644 --- a/graphics/decoders/png.cpp +++ b/graphics/decoders/png.cpp @@ -20,86 +20,25 @@ * */ +// Since we need to work with libpng here, we need to allow all symbols +// to avoid compilation issues. +#define FORBIDDEN_SYMBOL_ALLOW_ALL +#include "common/scummsys.h" + +#ifdef USE_PNG +#include +#endif + #include "graphics/decoders/png.h" #include "graphics/pixelformat.h" #include "graphics/surface.h" -#include "common/endian.h" -#include "common/memstream.h" #include "common/stream.h" -#include "common/types.h" -#include "common/util.h" -#include "common/zlib.h" - -// PNG decoder, based on the W3C specs: -// http://www.w3.org/TR/PNG/ -// Parts of the code have been adapted from LodePNG, by Lode Vandevenne: -// http://members.gamedev.net/lode/projects/LodePNG/ - -/* -LodePNG version 20101211 - -Copyright (c) 2005-2010 Lode Vandevenne - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*/ namespace Graphics { -enum PNGChunks { - // == Critical chunks ===================================================== - kChunkIHDR = MKTAG('I','H','D','R'), // Image header - kChunkIDAT = MKTAG('I','D','A','T'), // Image data - kChunkPLTE = MKTAG('P','L','T','E'), // Palette - kChunkIEND = MKTAG('I','E','N','D'), // Image trailer - // == Ancillary chunks ==================================================== - kChunktRNS = MKTAG('t','R','N','S') // Transparency - // All of the other ancillary chunks are ignored. They're added here for - // reference only. - // cHRM - Primary chromacities and white point - // gAMA - Image gamma - // iCCP - Embedded ICC profile - // sBIT - Significant bits - // sRGB - Standard RGB color space - // tEXT - Textual data - // sTXt - Compressed textual data - // iTXt - International textual data - // bKGD - Background color - // hIST - Image histogram - // pHYs - Physical pixel dimensions - // sPLT - Suggested palette - // tIME - Image last-modification time -}; - -// Refer to http://www.w3.org/TR/PNG/#9Filters -enum PNGFilters { - kFilterNone = 0, - kFilterSub = 1, - kFilterUp = 2, - kFilterAverage = 3, - kFilterPaeth = 4 -}; - -PNGDecoder::PNGDecoder() : _compressedBuffer(0), _compressedBufferSize(0), - _transparentColorSpecified(false), _outputSurface(0), _paletteEntries(0) { +PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0) { } PNGDecoder::~PNGDecoder() { @@ -112,14 +51,41 @@ void PNGDecoder::destroy() { delete _outputSurface; _outputSurface = 0; } + delete[] _palette; + _palette = NULL; +} + +#ifdef USE_PNG +// libpng-error-handling: +void pngError(png_structp pngptr, png_const_charp errorMsg) { + error("%s", errorMsg); +} - _paletteEntries = 0; +void pngWarning(png_structp pngptr, png_const_charp warningMsg) { + warning("%s", warningMsg); } +// libpng-I/O-helper: +void pngReadFromStream(png_structp pngPtr, png_bytep data, png_size_t length) { + void *readIOptr = png_get_io_ptr(pngPtr); + Common::SeekableReadStream *stream = (Common::SeekableReadStream *)readIOptr; + stream->read(data, length); +} +#endif + +/* + * This code is based on Broken Sword 2.5 engine + * + * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer + * + * Licensed under GNU GPL v2 + * + */ + bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { +#ifdef USE_PNG destroy(); - uint32 chunkLength = 0, chunkType = 0; _stream = &stream; // First, check the PNG signature @@ -132,374 +98,143 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { return false; } - // Start reading chunks till we reach an IEND chunk - while (chunkType != kChunkIEND) { - // The chunk length does not include the type or CRC bytes - chunkLength = _stream->readUint32BE(); - chunkType = _stream->readUint32BE(); - - switch (chunkType) { - case kChunkIHDR: - readHeaderChunk(); - break; - case kChunkIDAT: - if (_compressedBufferSize == 0) { - _compressedBufferSize += chunkLength; - _compressedBuffer = (byte *)malloc(_compressedBufferSize); - _stream->read(_compressedBuffer, chunkLength); - } else { - // Expand the buffer - uint32 prevSize = _compressedBufferSize; - _compressedBufferSize += chunkLength; - byte *tmp = new byte[prevSize]; - memcpy(tmp, _compressedBuffer, prevSize); - free(_compressedBuffer); - _compressedBuffer = (byte *)malloc(_compressedBufferSize); - memcpy(_compressedBuffer, tmp, prevSize); - delete[] tmp; - _stream->read(_compressedBuffer + prevSize, chunkLength); - } - break; - case kChunkPLTE: // only available in indexed PNGs - if (_header.colorType != kIndexed) - error("A palette chunk has been found in a non-indexed PNG file"); - if (chunkLength % 3 != 0) - error("Palette chunk not divisible by 3"); - - _paletteEntries = chunkLength / 3; - _stream->read(_palette, _paletteEntries * 3); - memset(_paletteTransparency, 0xff, sizeof(_paletteTransparency)); - break; - case kChunkIEND: - // End of stream - break; - case kChunktRNS: - readTransparencyChunk(chunkLength); - break; - default: - // Skip the chunk content - _stream->skip(chunkLength); - break; - } - - if (chunkType != kChunkIEND) - _stream->skip(4); // skip the chunk CRC checksum + // The following is based on the guide provided in: + //http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-3 + //http://www.libpng.org/pub/png/libpng-1.4.0-manual.pdf + // along with the png-loading code used in the sword25-engine. + png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!pngPtr) { + delete _stream; + return false; + } + png_infop infoPtr = png_create_info_struct(pngPtr); + if (!infoPtr) { + png_destroy_read_struct(&pngPtr, NULL, NULL); + delete _stream; + return false; + } + png_infop endInfo = png_create_info_struct(pngPtr); + if (!endInfo) { + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + delete _stream; + return false; } - // We no longer need the file stream, thus close it here - _stream = 0; + png_set_error_fn(pngPtr, NULL, pngError, pngWarning); + // TODO: The manual says errors should be handled via setjmp - // Unpack the compressed buffer - Common::MemoryReadStream *compData = new Common::MemoryReadStream(_compressedBuffer, _compressedBufferSize, DisposeAfterUse::YES); - _imageData = Common::wrapCompressedReadStream(compData); + png_set_read_fn(pngPtr, _stream, pngReadFromStream); + png_set_crc_action(pngPtr, PNG_CRC_DEFAULT, PNG_CRC_WARN_USE); + // We already verified the PNG-header + png_set_sig_bytes(pngPtr, 8); - // Construct the final image - constructImage(); + // Read PNG header + png_read_info(pngPtr, infoPtr); - // Close the uncompressed stream, which will also delete the memory stream, - // and thus the original compressed buffer - delete _imageData; + // No handling for unknown chunks yet. + int bitDepth, colorType, width, height, interlaceType; + png_uint_32 w, h; + png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, &interlaceType, NULL, NULL); + width = w; + height = h; - return true; -} - -/** - * Paeth predictor, used by PNG filter type 4 - * The parameters are of signed 16-bit integers, but should come - * from unsigned chars. The integers are only needed to make - * the paeth calculation correct. - * - * Taken from lodePNG, with a slight patch: - * http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/02/23/libpng-you-re-doing-it-wrong.aspx - */ -byte PNGDecoder::paethPredictor(int16 a, int16 b, int16 c) { - int16 pa = ABS(b - c); - int16 pb = ABS(a - c); - int16 pc = ABS(a + b - c - c); - - if (pa <= MIN(pb, pc)) - return (byte)a; - else if (pb <= pc) - return (byte)b; - else - return (byte)c; -} + // Allocate memory for the final image data. + // To keep memory framentation low this happens before allocating memory for temporary image data. + _outputSurface = new Graphics::Surface(); -/** - * Unfilters a filtered PNG scan line. - * PNG filters are defined in: http://www.w3.org/TR/PNG/#9Filters - * Note that filters are always applied to bytes - * - * Taken from lodePNG - */ -void PNGDecoder::unfilterScanLine(byte *dest, const byte *scanLine, const byte *prevLine, uint16 byteWidth, byte filterType, uint16 length) { - uint16 i; - - switch (filterType) { - case kFilterNone: // no change - for (i = 0; i < length; i++) - dest[i] = scanLine[i]; - break; - case kFilterSub: // add the bytes to the left - for (i = 0; i < byteWidth; i++) - dest[i] = scanLine[i]; - for (i = byteWidth; i < length; i++) - dest[i] = scanLine[i] + dest[i - byteWidth]; - break; - case kFilterUp: // add the bytes of the above scanline - if (prevLine) { - for (i = 0; i < length; i++) - dest[i] = scanLine[i] + prevLine[i]; - } else { - for (i = 0; i < length; i++) - dest[i] = scanLine[i]; + // Images of all color formats except PNG_COLOR_TYPE_PALETTE + // will be transformed into ARGB images + if (colorType == PNG_COLOR_TYPE_PALETTE && !png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) { + int numPalette = 0; + png_colorp palette = NULL; + uint32 success = png_get_PLTE(pngPtr, infoPtr, &palette, &numPalette); + if (success != PNG_INFO_PLTE) { + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + return false; } - break; - case kFilterAverage: // average value of the left and top left - if (prevLine) { - for (i = 0; i < byteWidth; i++) - dest[i] = scanLine[i] + prevLine[i] / 2; - for (i = byteWidth; i < length; i++) - dest[i] = scanLine[i] + ((dest[i - byteWidth] + prevLine[i]) / 2); - } else { - for (i = 0; i < byteWidth; i++) - dest[i] = scanLine[i]; - for (i = byteWidth; i < length; i++) - dest[i] = scanLine[i] + dest[i - byteWidth] / 2; + _paletteColorCount = numPalette; + _palette = new byte[_paletteColorCount * 3]; + for (int i = 0; i < _paletteColorCount; i++) { + _palette[(i * 3)] = palette[i].red; + _palette[(i * 3) + 1] = palette[i].green; + _palette[(i * 3) + 2] = palette[i].blue; + } - break; - case kFilterPaeth: // Paeth filter: http://www.w3.org/TR/PNG/#9Filter-type-4-Paeth - if (prevLine) { - for(i = 0; i < byteWidth; i++) - dest[i] = (scanLine[i] + prevLine[i]); // paethPredictor(0, prevLine[i], 0) is always prevLine[i] - for(i = byteWidth; i < length; i++) - dest[i] = (scanLine[i] + paethPredictor(dest[i - byteWidth], prevLine[i], prevLine[i - byteWidth])); - } else { - for(i = 0; i < byteWidth; i++) - dest[i] = scanLine[i]; - for(i = byteWidth; i < length; i++) - dest[i] = (scanLine[i] + dest[i - byteWidth]); // paethPredictor(dest[i - byteWidth], 0, 0) is always dest[i - byteWidth] + _outputSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + png_set_packing(pngPtr); + } else { + _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); + if (!_outputSurface->pixels) { + error("Could not allocate memory for output image."); } - break; - default: - error("Unknown line filter"); + if (bitDepth == 16) + png_set_strip_16(pngPtr); + if (bitDepth < 8) + png_set_expand(pngPtr); + if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) + png_set_expand(pngPtr); + if (colorType == PNG_COLOR_TYPE_GRAY || + colorType == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb(pngPtr); + + // PNGs are Big-Endian: +#ifdef SCUMM_LITTLE_ENDIAN + png_set_bgr(pngPtr); + png_set_swap_alpha(pngPtr); + if (colorType != PNG_COLOR_TYPE_RGB_ALPHA) + png_set_filler(pngPtr, 0xff, PNG_FILLER_BEFORE); +#else + if (colorType != PNG_COLOR_TYPE_RGB_ALPHA) + png_set_filler(pngPtr, 0xff, PNG_FILLER_AFTER); +#endif + } -} + // After the transformations have been registered, the image data is read again. + png_read_update_info(pngPtr, infoPtr); + png_get_IHDR(pngPtr, infoPtr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL); + width = w; + height = h; -int PNGDecoder::getBytesPerPixel() const { - return (getNumColorChannels() * _header.bitDepth + 7) / 8; -} + if (interlaceType == PNG_INTERLACE_NONE) { + // PNGs without interlacing can simply be read row by row. + for (int i = 0; i < height; i++) { + png_read_row(pngPtr, (png_bytep)_outputSurface->getBasePtr(0, i), NULL); + } + } else { + // PNGs with interlacing require us to allocate an auxillary + // buffer with pointers to all row starts. -void PNGDecoder::constructImage() { - assert (_header.bitDepth != 0); - - int bytesPerPixel = getBytesPerPixel(); - int pitch = bytesPerPixel * _header.width; - byte *unfilteredSurface = new byte[pitch * _header.height]; - byte *dest = unfilteredSurface; - uint16 scanLineWidth = (_header.width * getNumColorChannels() * _header.bitDepth + 7) / 8; - byte *scanLine = new byte[scanLineWidth]; - byte *prevLine = 0; - - switch(_header.interlaceType) { - case kNonInterlaced: - for (uint16 y = 0; y < _header.height; y++) { - byte filterType = _imageData->readByte(); - _imageData->read(scanLine, scanLineWidth); - unfilterScanLine(dest, scanLine, prevLine, bytesPerPixel, filterType, scanLineWidth); - prevLine = dest; - dest += pitch; + // Allocate row pointer buffer + png_bytep *rowPtr = new png_bytep[height]; + if (!rowPtr) { + error("Could not allocate memory for row pointers."); } - break; - case kInterlaced: - // Theoretically, this shouldn't be needed, as interlacing is only - // useful for web images. Interlaced PNG images require more complex - // handling, so unless having support for such images is needed, there - // is no reason to add support for them. - error("TODO: Support for interlaced PNG images"); - break; - } - delete[] scanLine; + // Initialize row pointers + for (int i = 0; i < height; i++) + rowPtr[i] = (png_bytep)_outputSurface->getBasePtr(0, i); - constructOutput(unfilteredSurface); - delete[] unfilteredSurface; -} + // Read image data + png_read_image(pngPtr, rowPtr); -Graphics::PixelFormat PNGDecoder::findPixelFormat() const { - // Try to find the best pixel format based on what we have here - // Which is basically 8bpp for paletted non-transparent - // and 32bpp for everything else - - switch (_header.colorType) { - case kIndexed: - if (!_transparentColorSpecified) - return Graphics::PixelFormat::createFormatCLUT8(); - // fall through - case kGrayScale: - case kTrueColor: - case kGrayScaleWithAlpha: - case kTrueColorWithAlpha: - // We'll go with standard RGBA 32-bit - return Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); + // Free row pointer buffer + delete[] rowPtr; } - error("Unknown PNG color type"); - return Graphics::PixelFormat(); -} + // Read additional data at the end. + png_read_end(pngPtr, NULL); -void PNGDecoder::constructOutput(const byte *surface) { - _outputSurface = new Graphics::Surface(); - _outputSurface->create(_header.width, _header.height, findPixelFormat()); - - const byte *src = surface; - byte a = 0xFF; - int bytesPerPixel = getBytesPerPixel(); - - if (_header.colorType != kIndexed) { - if (_header.colorType == kTrueColor || - _header.colorType == kTrueColorWithAlpha) { - if (bytesPerPixel != 3 && bytesPerPixel != 4) - error("Unsupported truecolor PNG format"); - } else if (_header.colorType == kGrayScale || - _header.colorType == kGrayScaleWithAlpha) { - if (bytesPerPixel != 1 && bytesPerPixel != 2) - error("Unsupported grayscale PNG format"); - } - - for (uint16 i = 0; i < _outputSurface->h; i++) { - for (uint16 j = 0; j < _outputSurface->w; j++) { - uint32 result = 0; - - switch (bytesPerPixel) { - case 1: // Grayscale - if (_transparentColorSpecified) - a = (src[0] == _transparentColor[0]) ? 0 : 0xFF; - result = _outputSurface->format.ARGBToColor(a, src[0], src[0], src[0]); - break; - case 2: // Grayscale + alpha - result = _outputSurface->format.ARGBToColor(src[1], src[0], src[0], src[0]); - break; - case 3: // RGB - if (_transparentColorSpecified) { - bool isTransparentColor = (src[0] == _transparentColor[0] && - src[1] == _transparentColor[1] && - src[2] == _transparentColor[2]); - a = isTransparentColor ? 0 : 0xFF; - } - - result = _outputSurface->format.ARGBToColor(a, src[0], src[1], src[2]); - break; - case 4: // RGBA - result = _outputSurface->format.ARGBToColor(src[3], src[0], src[1], src[2]); - break; - } - - *((uint32 *)_outputSurface->getBasePtr(j, i)) = result; - src += bytesPerPixel; - } - } - } else { - uint32 mask = (0xff >> (8 - _header.bitDepth)) << (8 - _header.bitDepth); - - // Convert the indexed surface to the target pixel format - for (uint16 i = 0; i < _outputSurface->h; i++) { - int data = 0; - int bitCount = 8; - const byte *src1 = src; - - for (uint16 j = 0; j < _outputSurface->w; j++) { - if (bitCount == 8) { - data = *src; - src++; - } - - byte index = (data & mask) >> (8 - _header.bitDepth); - data = (data << _header.bitDepth) & 0xff; - bitCount -= _header.bitDepth; - - if (bitCount == 0) - bitCount = 8; - - if (_transparentColorSpecified) { - byte r = _palette[index * 3 + 0]; - byte g = _palette[index * 3 + 1]; - byte b = _palette[index * 3 + 2]; - a = _paletteTransparency[index]; - *((uint32 *)_outputSurface->getBasePtr(j, i)) = _outputSurface->format.ARGBToColor(a, r, g, b); - } else { - *((byte *)_outputSurface->getBasePtr(j, i)) = index; - } - } - - src = src1 + _outputSurface->w; - } - } -} + // Destroy libpng structures + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); -void PNGDecoder::readHeaderChunk() { - _header.width = _stream->readUint32BE(); - _header.height = _stream->readUint32BE(); - _header.bitDepth = _stream->readByte(); - if (_header.bitDepth > 8) - error("Only PNGs with a bit depth of 1-8 bits are supported (i.e. PNG24)"); - _header.colorType = (PNGColorType)_stream->readByte(); - _header.compressionMethod = _stream->readByte(); - // Compression methods: http://www.w3.org/TR/PNG/#10Compression - // Only compression method 0 (deflate) is documented and supported - if (_header.compressionMethod != 0) - error("Unknown PNG compression method: %d", _header.compressionMethod); - _header.filterMethod = _stream->readByte(); - // Filter methods: http://www.w3.org/TR/PNG/#9Filters - // Only filter method 0 is documented and supported - if (_header.filterMethod != 0) - error("Unknown PNG filter method: %d", _header.filterMethod); - _header.interlaceType = (PNGInterlaceType)_stream->readByte(); -} - -byte PNGDecoder::getNumColorChannels() const { - switch (_header.colorType) { - case kGrayScale: - return 1; // Gray - case kTrueColor: - return 3; // RGB - case kIndexed: - return 1; // Indexed - case kGrayScaleWithAlpha: - return 2; // Gray + Alpha - case kTrueColorWithAlpha: - return 4; // RGBA - default: - error("Unknown color type"); - } -} + // We no longer need the file stream, thus close it here + _stream = 0; -void PNGDecoder::readTransparencyChunk(uint32 chunkLength) { - _transparentColorSpecified = true; - - switch(_header.colorType) { - case kGrayScale: - _transparentColor[0] = _stream->readUint16BE(); - _transparentColor[1] = _transparentColor[0]; - _transparentColor[2] = _transparentColor[0]; - break; - case kTrueColor: - _transparentColor[0] = _stream->readUint16BE(); - _transparentColor[1] = _stream->readUint16BE(); - _transparentColor[2] = _stream->readUint16BE(); - break; - case kIndexed: - _stream->read(_paletteTransparency, chunkLength); - - // A transparency chunk may have less entries - // than the palette entries. The remaining ones - // are unmodified (set to 255). Check here: - // http://www.w3.org/TR/PNG/#11tRNS - break; - default: - error("Transparency chunk found in a PNG that has a separate transparency channel"); - } + return true; +#else + return false; +#endif } } // End of Graphics namespace diff --git a/graphics/decoders/png.h b/graphics/decoders/png.h index ca204f6dd3e0..e52ddabd7de7 100644 --- a/graphics/decoders/png.h +++ b/graphics/decoders/png.h @@ -24,33 +24,12 @@ * PNG decoder used in engines: * - sword25 * Dependencies: - * - zlib + * - libpng */ #ifndef GRAPHICS_PNG_H #define GRAPHICS_PNG_H -// PNG decoder, based on the W3C specs: -// http://www.w3.org/TR/PNG/ -// Parts of the code have been adapted from LodePNG, by Lode Vandevenne: -// http://members.gamedev.net/lode/projects/LodePNG/ - -// All the numbers are BE: http://www.w3.org/TR/PNG/#7Integers-and-byte-order - -// Note: At the moment, this decoder only supports non-interlaced images, and -// does not support truecolor/grayscale images with 16bit depth. -// -// Theoretically, interlaced images shouldn't be needed for games, as -// interlacing is only useful for images in websites. -// -// PNG images with 16bit depth (i.e. 48bit images) are quite rare, and can -// theoretically contain more than 16.7 millions of colors (the so-called "deep -// color" representation). In essence, each of the R, G, B and A components in -// them is specified with 2 bytes, instead of 1. However, the PNG specification -// always refers to color components with 1 byte each, so this part of the spec -// is a bit unclear. For now, these won't be supported, until a suitable sample -// is found. - #include "common/scummsys.h" #include "common/textconsole.h" #include "graphics/decoders/image_decoder.h" @@ -73,62 +52,13 @@ class PNGDecoder : public ImageDecoder { void destroy(); const Graphics::Surface *getSurface() const { return _outputSurface; } const byte *getPalette() const { return _palette; } - uint16 getPaletteColorCount() const { return _paletteEntries; } - + uint16 getPaletteColorCount() const { return _paletteColorCount; } private: - enum PNGColorType { - kGrayScale = 0, // bit depths: 1, 2, 4, 8, 16 - kTrueColor = 2, // bit depths: 8, 16 - kIndexed = 3, // bit depths: 1, 2, 4, 8 - kGrayScaleWithAlpha = 4, // bit depths: 8, 16 - kTrueColorWithAlpha = 6 // bit depths: 8, 16 - }; - - enum PNGInterlaceType { - kNonInterlaced = 0, - kInterlaced = 1 - }; - - struct PNGHeader { - uint32 width; - uint32 height; - byte bitDepth; - PNGColorType colorType; - byte compressionMethod; - byte filterMethod; - PNGInterlaceType interlaceType; - }; - - void readHeaderChunk(); - byte getNumColorChannels() const; - - void readPaletteChunk(); - void readTransparencyChunk(uint32 chunkLength); - - void constructImage(); - void unfilterScanLine(byte *dest, const byte *scanLine, const byte *prevLine, uint16 byteWidth, byte filterType, uint16 length); - byte paethPredictor(int16 a, int16 b, int16 c); - - // The original file stream Common::SeekableReadStream *_stream; - // The unzipped image data stream - Common::SeekableReadStream *_imageData; - - PNGHeader _header; - - byte _palette[256 * 3]; // RGB - byte _paletteTransparency[256]; - uint16 _paletteEntries; - uint16 _transparentColor[3]; - bool _transparentColorSpecified; - - byte *_compressedBuffer; - uint32 _compressedBufferSize; + byte *_palette; + uint16 _paletteColorCount; Graphics::Surface *_outputSurface; - Graphics::PixelFormat findPixelFormat() const; - int getBytesPerPixel() const; - void constructOutput(const byte *surface); }; } // End of namespace Graphics diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index 96241e923cb5..2b1dca1eaeef 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -101,7 +101,7 @@ class TTFFont : public Font { TTFFont(); virtual ~TTFFont(); - bool load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping); + bool load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping); virtual int getFontHeight() const; @@ -157,7 +157,7 @@ TTFFont::~TTFFont() { } } -bool TTFFont::load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) { +bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) { if (!g_ttf.isInitialized()) return false; @@ -195,7 +195,7 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, bool monochrome // Check whether we have kerning support _hasKerning = (FT_HAS_KERNING(_face) != 0); - if (FT_Set_Char_Size(_face, 0, size * 64, 0, 0)) { + if (FT_Set_Char_Size(_face, 0, size * 64, dpi, dpi)) { delete[] _ttfFile; _ttfFile = 0; @@ -462,10 +462,10 @@ bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) { return true; } -Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) { +Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) { TTFFont *font = new TTFFont(); - if (!font->load(stream, size, monochrome, mapping)) { + if (!font->load(stream, size, dpi, monochrome, mapping)) { delete font; return 0; } diff --git a/graphics/fonts/ttf.h b/graphics/fonts/ttf.h index ec7dbe04ef18..e1464b1f45bf 100644 --- a/graphics/fonts/ttf.h +++ b/graphics/fonts/ttf.h @@ -32,7 +32,7 @@ namespace Graphics { class Font; -Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome = false, const uint32 *mapping = 0); +Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, bool monochrome = false, const uint32 *mapping = 0); void shutdownTTF(); diff --git a/graphics/iff.cpp b/graphics/iff.cpp index 7434a6bebc2c..4011126bd3fd 100644 --- a/graphics/iff.cpp +++ b/graphics/iff.cpp @@ -68,7 +68,7 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre Graphics::PackBitsReadStream packStream(*stream); // setup a buffer to hold enough data to build a line in the output - uint32 scanlineWidth = ((_header.width + 15)/16) << 1; + uint32 scanlineWidth = ((_header.width + 15) / 16) << 1; byte *scanline = new byte[scanlineWidth * _header.depth]; for (uint i = 0; i < _header.height; ++i) { @@ -82,7 +82,7 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre out += outPitch; } - delete []scanline; + delete[] scanline; break; } @@ -121,15 +121,12 @@ void ILBMDecoder::planarToChunky(byte *out, uint32 outPitch, byte *in, uint32 in // then output the pixel according to the requested packing if (!packPlanes) { out[x] = pix; - } else - if (nPlanes == 1) { - out[x/8] |= (pix << (x & 7)); - } else - if (nPlanes == 2) { - out[x/4] |= (pix << ((x & 3) << 1)); - } else - if (nPlanes == 4) { - out[x/2] |= (pix << ((x & 1) << 2)); + } else if (nPlanes == 1) { + out[x / 8] |= (pix << (x & 7)); + } else if (nPlanes == 2) { + out[x / 4] |= (pix << ((x & 3) << 1)); + } else if (nPlanes == 4) { + out[x / 2] |= (pix << ((x & 1) << 2)); } } @@ -187,7 +184,7 @@ struct PBMLoader { _surface = &surface; _colors = colors; Common::IFFParser parser(&input); - Common::Functor1Mem< Common::IFFChunk&, bool, PBMLoader > c(this, &PBMLoader::callback); + Common::Functor1Mem c(this, &PBMLoader::callback); parser.parse(c); } @@ -251,7 +248,7 @@ uint32 PackBitsReadStream::read(void *dataPtr, uint32 dataSize) { for (uint32 j = 0; j < lenW; j++) { *out++ = _input->readByte(); } - for ( ; lenR > lenW; lenR--) { + for (; lenR > lenW; lenR--) { _input->readByte(); } } else { // len > 128 diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index e37022f5f111..e2fa2580f533 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -48,6 +48,8 @@ const char * const ThemeEngine::kImageLogoSmall = "logo_small.bmp"; const char * const ThemeEngine::kImageSearch = "search.bmp"; const char * const ThemeEngine::kImageEraser = "eraser.bmp"; const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp"; +const char * const ThemeEngine::kImageList = "list.bmp"; +const char * const ThemeEngine::kImageGrid = "grid.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; @@ -1422,7 +1424,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) { Common::SeekableReadStream *stream = (*i)->createReadStream(); if (stream) { - font = Graphics::loadTTFFont(*stream, pointsize, false, + font = Graphics::loadTTFFont(*stream, pointsize, 0, false, #ifdef USE_TRANSLATION TransMan.getCharsetMapping() #else diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 21711e295573..6fb93d3b462f 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -35,7 +35,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.13" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.16" class OSystem; @@ -232,6 +232,8 @@ class ThemeEngine { static const char *const kImageSearch; ///< Search tool image used in the launcher static const char *const kImageEraser; ///< Clear input image used in the launcher static const char *const kImageDelbtn; ///< Delete characters in the predictive dialog + static const char *const kImageList; ///< List image used in save/load chooser selection + static const char *const kImageGrid; ///< Grid image used in save/load chooser selection /** * Graphics mode enumeration. diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp index 85e5856cffce..88124e782b44 100644 --- a/gui/Tooltip.cpp +++ b/gui/Tooltip.cpp @@ -37,7 +37,7 @@ Tooltip::Tooltip() : } void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) { - assert(widget->getTooltip()); + assert(widget->hasTooltip()); _maxWidth = g_gui.xmlEval()->getVar("Globals.Tooltip.MaxWidth", 100); _xdelta = g_gui.xmlEval()->getVar("Globals.Tooltip.XDelta", 0); diff --git a/gui/credits.h b/gui/credits.h index 928799efd775..f19002a2d81d 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -106,8 +106,10 @@ static const char *credits[] = { "C1""DreamWeb", "C0""Torbj\366rn Andersson", "C0""Bertrand Augereau", +"C0""Filippos Karapetis", "C0""Vladimir Menshakov", "C2""(retired)", +"C0""Willem Jan Palenstijn", "", "C1""Gob", "C0""Torbj\366rn Andersson", @@ -489,10 +491,10 @@ static const char *credits[] = { "C0""Matteo Angelino", "", "C1""Norwegian (Bokm\345l)", -"C0""Einar Johan T. S\370m\345en", +"C0""Einar Johan S\370m\345en", "", "C1""Norwegian (Nynorsk)", -"C0""Einar Johan T. S\370m\345en", +"C0""Einar Johan S\370m\345en", "", "C1""Polish", "C0""GrajPoPolsku.pl Team", @@ -713,6 +715,10 @@ static const char *credits[] = { "C0""", "C0""Broken Sword 2.5 team for providing sources of their engine and their great support.", "C0""", +"C0""Neil Dodwell and David Dew from Creative Reality for providing the source of Dreamweb and for their tremendous support.", +"C0""", +"C0""Janusz Wisniewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon for providing full source code for Soltys and letting us to redistribute the game.", +"C0""", "C0""Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for providing the source code of The Journeyman Project: Pegasus Prime.", "C0""", "", diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index abd781e1a38a..a0ef4216aa07 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -381,7 +381,7 @@ void GuiManager::runLoop() { if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) { Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y); - if (wdg && wdg->getTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { + if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { Tooltip *tooltip = new Tooltip(); tooltip->setup(activeDialog, wdg, _lastMousePosition.x, _lastMousePosition.y); tooltip->runModal(); diff --git a/gui/module.mk b/gui/module.mk index d272bb031319..a435d8cca7b6 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := \ options.o \ predictivedialog.o \ saveload.o \ + saveload-dialog.o \ themebrowser.o \ ThemeEngine.o \ ThemeEval.o \ diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp new file mode 100644 index 000000000000..850dfcc78f14 --- /dev/null +++ b/gui/saveload-dialog.cpp @@ -0,0 +1,882 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "gui/saveload-dialog.h" +#include "common/translation.h" +#include "common/config-manager.h" + +#include "gui/message.h" +#include "gui/gui-manager.h" +#include "gui/ThemeEval.h" +#include "gui/widgets/edittext.h" + +#include "graphics/scaler.h" + +namespace GUI { + +#ifndef DISABLE_SAVELOADCHOOSER_GRID +SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) { + const Common::String &userConfig = ConfMan.get("gui_saveload_chooser", Common::ConfigManager::kApplicationDomain); + if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400 + && metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo) + && metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail) + && userConfig.equalsIgnoreCase("grid")) { + // In case we are 640x400 or higher, this dialog is not in save mode, + // the user requested the grid dialog and the engines supports it we + // try to set it up. + return kSaveLoadDialogGrid; + } else { + // In all other cases we want to use the list dialog. + return kSaveLoadDialogList; + } +} + +enum { + kListSwitchCmd = 'LIST', + kGridSwitchCmd = 'GRID' +}; +#endif // !DISABLE_SAVELOADCHOOSER_GRID + +SaveLoadChooserDialog::SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode) + : Dialog(dialogName), _metaEngine(0), _delSupport(false), _metaInfoSupport(false), + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode) +#ifndef DISABLE_SAVELOADCHOOSER_GRID + , _listButton(0), _gridButton(0) +#endif // !DISABLE_SAVELOADCHOOSER_GRID + { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + addChooserButtons(); +#endif // !DISABLE_SAVELOADCHOOSER_GRID +} + +SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode) + : Dialog(x, y, w, h), _metaEngine(0), _delSupport(false), _metaInfoSupport(false), + _thumbnailSupport(false), _saveDateSupport(false), _playTimeSupport(false), _saveMode(saveMode) +#ifndef DISABLE_SAVELOADCHOOSER_GRID + , _listButton(0), _gridButton(0) +#endif // !DISABLE_SAVELOADCHOOSER_GRID + { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + addChooserButtons(); +#endif // !DISABLE_SAVELOADCHOOSER_GRID +} + +void SaveLoadChooserDialog::open() { + Dialog::open(); + + // So that quitting ScummVM will not cause the dialog result to say a + // savegame was selected. + setResult(-1); +} + +int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngine *metaEngine) { + _metaEngine = metaEngine; + _target = target; + _delSupport = _metaEngine->hasFeature(MetaEngine::kSupportsDeleteSave); + _metaInfoSupport = _metaEngine->hasFeature(MetaEngine::kSavesSupportMetaInfo); + _thumbnailSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportThumbnail); + _saveDateSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportCreationDate); + _playTimeSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportPlayTime); + + return runIntern(); +} + +void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + switch (cmd) { + case kListSwitchCmd: + setResult(kSwitchSaveLoadDialog); + // We save the requested dialog type here to avoid the setting to be + // overwritten when our reflowLayout logic selects a different dialog + // type. + ConfMan.set("gui_saveload_chooser", "list", Common::ConfigManager::kApplicationDomain); + close(); + break; + + case kGridSwitchCmd: + setResult(kSwitchSaveLoadDialog); + // See above. + ConfMan.set("gui_saveload_chooser", "grid", Common::ConfigManager::kApplicationDomain); + close(); + break; + + default: + break; + } +#endif // !DISABLE_SAVELOADCHOOSER_GRID + + return Dialog::handleCommand(sender, cmd, data); +} + +void SaveLoadChooserDialog::reflowLayout() { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + addChooserButtons(); + + const SaveLoadChooserType currentType = getType(); + const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine); + + // Change the dialog type if there is any need for it. + if (requestedType != currentType) { + setResult(kSwitchSaveLoadDialog); + close(); + } +#endif // !DISABLE_SAVELOADCHOOSER_GRID + + Dialog::reflowLayout(); +} + +#ifndef DISABLE_SAVELOADCHOOSER_GRID +void SaveLoadChooserDialog::addChooserButtons() { + if (_listButton) { + removeWidget(_listButton); + delete _listButton; + } + + if (_gridButton) { + removeWidget(_gridButton); + delete _gridButton; + } + + _listButton = createSwitchButton("SaveLoadChooser.ListSwitch", "L", _("List view"), ThemeEngine::kImageList, kListSwitchCmd); + _gridButton = createSwitchButton("SaveLoadChooser.GridSwitch", "G", _("Grid view"), ThemeEngine::kImageGrid, kGridSwitchCmd); + if (!_metaInfoSupport || !_thumbnailSupport || !(g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400)) { + _gridButton->setEnabled(false); + _listButton->setEnabled(false); + } +} + +ButtonWidget *SaveLoadChooserDialog::createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd) { + ButtonWidget *button; + +#ifndef DISABLE_FANCY_THEMES + if (g_gui.xmlEval()->getVar("Globals.ShowChooserPics") == 1 && g_gui.theme()->supportsImages()) { + button = new PicButtonWidget(this, name, tooltip, cmd); + ((PicButtonWidget *)button)->useThemeTransparency(true); + ((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(image)); + } else +#endif + button = new ButtonWidget(this, name, desc, tooltip, cmd); + + return button; +} +#endif // !DISABLE_SAVELOADCHOOSER_GRID + +// SaveLoadChooserSimple implementation + +enum { + kChooseCmd = 'CHOS', + kDelCmd = 'DEL ' +}; + +SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode) + : SaveLoadChooserDialog("SaveLoadChooser", saveMode), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { + _backgroundType = ThemeEngine::kDialogBackgroundSpecial; + + new StaticTextWidget(this, "SaveLoadChooser.Title", title); + + // Add choice list + _list = new ListWidget(this, "SaveLoadChooser.List"); + _list->setNumberingMode(kListNumberingZero); + _list->setEditable(saveMode); + + _gfxWidget = new GraphicsWidget(this, 0, 0, 10, 10); + + _date = new StaticTextWidget(this, 0, 0, 10, 10, _("No date saved"), Graphics::kTextAlignCenter); + _time = new StaticTextWidget(this, 0, 0, 10, 10, _("No time saved"), Graphics::kTextAlignCenter); + _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter); + + // Buttons + new ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), 0, kCloseCmd); + _chooseButton = new ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, 0, kChooseCmd); + _chooseButton->setEnabled(false); + + _deleteButton = new ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), 0, kDelCmd); + _deleteButton->setEnabled(false); + + _delSupport = _metaInfoSupport = _thumbnailSupport = false; + + _container = new ContainerWidget(this, 0, 0, 10, 10); +// _container->setHints(THEME_HINT_USE_SHADOW); +} + +int SaveLoadChooserSimple::runIntern() { + if (_gfxWidget) + _gfxWidget->setGfx(0); + + _resultString.clear(); + reflowLayout(); + updateSaveList(); + + return Dialog::runModal(); +} + +const Common::String &SaveLoadChooserSimple::getResultString() const { + int selItem = _list->getSelected(); + return (selItem >= 0) ? _list->getSelectedString() : _resultString; +} + +void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + int selItem = _list->getSelected(); + + switch (cmd) { + case kListItemActivatedCmd: + case kListItemDoubleClickedCmd: + if (selItem >= 0 && _chooseButton->isEnabled()) { + if (_list->isEditable() || !_list->getSelectedString().empty()) { + _list->endEditMode(); + if (!_saveList.empty()) { + setResult(_saveList[selItem].getSaveSlot()); + _resultString = _list->getSelectedString(); + } + close(); + } + } + break; + case kChooseCmd: + _list->endEditMode(); + if (!_saveList.empty()) { + setResult(_saveList[selItem].getSaveSlot()); + _resultString = _list->getSelectedString(); + } + close(); + break; + case kListSelectionChangedCmd: + updateSelection(true); + break; + case kDelCmd: + if (selItem >= 0 && _delSupport) { + MessageDialog alert(_("Do you really want to delete this savegame?"), + _("Delete"), _("Cancel")); + if (alert.runModal() == kMessageOK) { + _metaEngine->removeSaveState(_target.c_str(), _saveList[selItem].getSaveSlot()); + + setResult(-1); + _list->setSelected(-1); + + updateSaveList(); + updateSelection(true); + } + } + break; + case kCloseCmd: + setResult(-1); + default: + SaveLoadChooserDialog::handleCommand(sender, cmd, data); + } +} + +void SaveLoadChooserSimple::reflowLayout() { + if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) { + int16 x, y; + uint16 w, h; + + if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h)) + error("Error when loading position data for Save/Load Thumbnails"); + + int thumbW = kThumbnailWidth; + int thumbH = kThumbnailHeight2; + int thumbX = x + (w >> 1) - (thumbW >> 1); + int thumbY = y + kLineHeight; + + int textLines = 0; + if (!_saveDateSupport) + textLines++; + if (!_playTimeSupport) + textLines++; + + _container->resize(x, y, w, h - (kLineHeight * textLines)); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + + int height = thumbY + thumbH + kLineHeight; + + if (_saveDateSupport) { + _date->resize(thumbX, height, kThumbnailWidth, kLineHeight); + height += kLineHeight; + _time->resize(thumbX, height, kThumbnailWidth, kLineHeight); + height += kLineHeight; + } + + if (_playTimeSupport) + _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight); + + _container->setVisible(true); + _gfxWidget->setVisible(true); + + _date->setVisible(_saveDateSupport); + _time->setVisible(_saveDateSupport); + + _playtime->setVisible(_playTimeSupport); + + updateSelection(false); + } else { + _container->setVisible(false); + _gfxWidget->setVisible(false); + _date->setVisible(false); + _time->setVisible(false); + _playtime->setVisible(false); + } + + SaveLoadChooserDialog::reflowLayout(); +} + +void SaveLoadChooserSimple::updateSelection(bool redraw) { + int selItem = _list->getSelected(); + + bool isDeletable = _delSupport; + bool isWriteProtected = false; + bool startEditMode = _list->isEditable(); + + // We used to support letting the themes specify the fill color with our + // initial theme based GUI. But this support was dropped. + _gfxWidget->setGfx(-1, -1, 0, 0, 0); + _date->setLabel(_("No date saved")); + _time->setLabel(_("No time saved")); + _playtime->setLabel(_("No playtime saved")); + + if (selItem >= 0 && _metaInfoSupport) { + SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), _saveList[selItem].getSaveSlot()); + + isDeletable = desc.getDeletableFlag() && _delSupport; + isWriteProtected = desc.getWriteProtectedFlag(); + + // Don't allow the user to change the description of write protected games + if (isWriteProtected) + startEditMode = false; + + if (_thumbnailSupport) { + const Graphics::Surface *thumb = desc.getThumbnail(); + if (thumb) { + _gfxWidget->setGfx(thumb); + _gfxWidget->useAlpha(256); + } + } + + if (_saveDateSupport) { + const Common::String &saveDate = desc.getSaveDate(); + if (!saveDate.empty()) + _date->setLabel(_("Date: ") + saveDate); + + const Common::String &saveTime = desc.getSaveTime(); + if (!saveTime.empty()) + _time->setLabel(_("Time: ") + saveTime); + } + + if (_playTimeSupport) { + const Common::String &playTime = desc.getPlayTime(); + if (!playTime.empty()) + _playtime->setLabel(_("Playtime: ") + playTime); + } + } + + + if (_list->isEditable()) { + // Disable the save button if nothing is selected, or if the selected + // game is write protected + _chooseButton->setEnabled(selItem >= 0 && !isWriteProtected); + + if (startEditMode) { + _list->startEditMode(); + + if (_chooseButton->isEnabled() && _list->getSelectedString() == _("Untitled savestate") && + _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) { + _list->setEditString(""); + _list->setEditColor(ThemeEngine::kFontColorNormal); + } + } + } else { + // Disable the load button if nothing is selected, or if an empty + // list item is selected. + _chooseButton->setEnabled(selItem >= 0 && !_list->getSelectedString().empty()); + } + + // Delete will always be disabled if the engine doesn't support it. + _deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty())); + + if (redraw) { + _gfxWidget->draw(); + _date->draw(); + _time->draw(); + _playtime->draw(); + _chooseButton->draw(); + _deleteButton->draw(); + + draw(); + } +} + +void SaveLoadChooserSimple::close() { + _metaEngine = 0; + _target.clear(); + _saveList.clear(); + _list->setList(StringArray()); + + SaveLoadChooserDialog::close(); +} + +void SaveLoadChooserSimple::updateSaveList() { + _saveList = _metaEngine->listSaves(_target.c_str()); + + int curSlot = 0; + int saveSlot = 0; + StringArray saveNames; + ListWidget::ColorList colors; + for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { + // Handle gaps in the list of save games + saveSlot = x->getSaveSlot(); + if (curSlot < saveSlot) { + while (curSlot < saveSlot) { + SaveStateDescriptor dummySave(curSlot, ""); + _saveList.insert_at(curSlot, dummySave); + saveNames.push_back(dummySave.getDescription()); + colors.push_back(ThemeEngine::kFontColorNormal); + curSlot++; + } + + // Sync the save list iterator + for (x = _saveList.begin(); x != _saveList.end(); ++x) { + if (x->getSaveSlot() == saveSlot) + break; + } + } + + // Show "Untitled savestate" for empty/whitespace savegame descriptions + Common::String description = x->getDescription(); + Common::String trimmedDescription = description; + trimmedDescription.trim(); + if (trimmedDescription.empty()) { + description = _("Untitled savestate"); + colors.push_back(ThemeEngine::kFontColorAlternate); + } else { + colors.push_back(ThemeEngine::kFontColorNormal); + } + + saveNames.push_back(description); + curSlot++; + } + + // Fill the rest of the save slots with empty saves + + int maximumSaveSlots = _metaEngine->getMaximumSaveSlot(); + +#ifdef __DS__ + // Low memory on the DS means too many save slots are impractical, so limit + // the maximum here. + if (maximumSaveSlots > 99) { + maximumSaveSlots = 99; + } +#endif + + Common::String emptyDesc; + for (int i = curSlot; i <= maximumSaveSlots; i++) { + saveNames.push_back(emptyDesc); + SaveStateDescriptor dummySave(i, ""); + _saveList.push_back(dummySave); + colors.push_back(ThemeEngine::kFontColorNormal); + } + + _list->setList(saveNames, &colors); +} + +// SaveLoadChooserGrid implementation + +#ifndef DISABLE_SAVELOADCHOOSER_GRID + +enum { + kNextCmd = 'NEXT', + kPrevCmd = 'PREV', + kNewSaveCmd = 'SAVE' +}; + +SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveMode) + : SaveLoadChooserDialog("SaveLoadChooser", saveMode), _lines(0), _columns(0), _entriesPerPage(0), + _curPage(0), _newSaveContainer(0), _nextFreeSaveSlot(0), _buttons() { + _backgroundType = ThemeEngine::kDialogBackgroundSpecial; + + new StaticTextWidget(this, "SaveLoadChooser.Title", title); + + // Buttons + new ButtonWidget(this, "SaveLoadChooser.Delete", _("Cancel"), 0, kCloseCmd); + _nextButton = new ButtonWidget(this, "SaveLoadChooser.Choose", _("Next"), 0, kNextCmd); + _nextButton->setEnabled(false); + + _prevButton = new ButtonWidget(this, "SaveLoadChooser.Cancel", _("Prev"), 0, kPrevCmd); + _prevButton->setEnabled(false); + + // Page display + _pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String()); + _pageDisplay->setAlign(Graphics::kTextAlignRight); +} + +SaveLoadChooserGrid::~SaveLoadChooserGrid() { + removeWidget(_pageDisplay); + delete _pageDisplay; +} + +const Common::String &SaveLoadChooserGrid::getResultString() const { + return _resultString; +} + +void SaveLoadChooserGrid::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + if (cmd <= _entriesPerPage && cmd + _curPage * _entriesPerPage <= _saveList.size()) { + const SaveStateDescriptor &desc = _saveList[cmd - 1 + _curPage * _entriesPerPage]; + + if (_saveMode) { + _resultString = desc.getDescription(); + } + + setResult(desc.getSaveSlot()); + close(); + } + + switch (cmd) { + case kNextCmd: + ++_curPage; + updateSaves(); + draw(); + break; + + case kPrevCmd: + --_curPage; + updateSaves(); + draw(); + break; + + case kNewSaveCmd: + setResult(_nextFreeSaveSlot); + close(); + break; + + case kCloseCmd: + setResult(-1); + default: + SaveLoadChooserDialog::handleCommand(sender, cmd, data); + } +} + +void SaveLoadChooserGrid::handleMouseWheel(int x, int y, int direction) { + if (direction > 0) { + if (_nextButton->isEnabled()) { + ++_curPage; + updateSaves(); + draw(); + } + } else { + if (_prevButton->isEnabled()) { + --_curPage; + updateSaves(); + draw(); + } + } +} + +void SaveLoadChooserGrid::open() { + SaveLoadChooserDialog::open(); + + _curPage = 0; + _saveList = _metaEngine->listSaves(_target.c_str()); + _resultString.clear(); + + // Determine the next free save slot for save mode + if (_saveMode) { + int lastSlot = -1; + _nextFreeSaveSlot = -1; + for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { + const int curSlot = x->getSaveSlot(); + + // In case there was a gap found use the slot. + if (lastSlot + 1 < curSlot) { + _nextFreeSaveSlot = lastSlot + 1; + break; + } + + lastSlot = curSlot; + } + + // Use the next available slot otherwise. + if (_nextFreeSaveSlot == -1 && lastSlot + 1 < _metaEngine->getMaximumSaveSlot()) { + _nextFreeSaveSlot = lastSlot + 1; + } + } + + updateSaves(); +} + +void SaveLoadChooserGrid::reflowLayout() { + // HACK: The page display is not available in low resolution layout. We + // remove and readd the widget here to avoid our GUI from erroring out. + removeWidget(_pageDisplay); + if (g_gui.xmlEval()->getVar("Globals.ShowChooserPageDisplay") == 1) { + _pageDisplay->init(); + } + + SaveLoadChooserDialog::reflowLayout(); + destroyButtons(); + + // HACK: The whole code below really works around the fact, that we have + // no easy way to dynamically layout widgets. + const uint16 availableWidth = getWidth() - 20; + uint16 availableHeight; + + int16 x, y; + uint16 w; + g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight); + + const int16 buttonWidth = kThumbnailWidth + 6; + const int16 buttonHeight = kThumbnailHeight2 + 6; + + const int16 containerFrameWidthAdd = 10; + const int16 containerFrameHeightAdd = 0; + const int16 containerWidth = buttonWidth + containerFrameWidthAdd; + const int16 containerHeight = buttonHeight + kLineHeight + containerFrameHeightAdd; + + const int16 defaultSpacingHorizontal = 4; + const int16 defaultSpacingVertical = 8; + const int16 slotAreaWidth = containerWidth + defaultSpacingHorizontal; + const int16 slotAreaHeight = containerHeight + defaultSpacingVertical; + + const uint oldEntriesPerPage = _entriesPerPage; + _columns = MAX(1, availableWidth / slotAreaWidth); + _lines = MAX(1, availableHeight / slotAreaHeight); + _entriesPerPage = _columns * _lines; + + // In save mode the first button is always "New Save", thus we need to + // adjust the entries per page here. + if (_saveMode) { + --_entriesPerPage; + } + + // Recalculate the page number + if (!_saveList.empty() && oldEntriesPerPage != 0) { + if (_entriesPerPage != 0) { + _curPage = (_curPage * oldEntriesPerPage) / _entriesPerPage; + } else { + _curPage = 0; + } + } + + const uint addX = _columns > 1 ? (availableWidth % slotAreaWidth) / (_columns - 1) : 0; + //const uint addY = _lines > 1 ? (availableHeight % slotAreaHeight) / (_lines - 1) : 0; + + _buttons.reserve(_lines * _columns); + y += defaultSpacingVertical / 2; + for (uint curLine = 0; curLine < _lines; ++curLine, y += slotAreaHeight/* + addY*/) { + for (uint curColumn = 0, curX = x + defaultSpacingHorizontal / 2; curColumn < _columns; ++curColumn, curX += slotAreaWidth + addX) { + int dstY = containerFrameHeightAdd / 2; + int dstX = containerFrameWidthAdd / 2; + + // In the save mode we will always create a new save button as the first button. + if (_saveMode && curLine == 0 && curColumn == 0) { + _newSaveContainer = new ContainerWidget(this, curX, y, containerWidth, containerHeight); + ButtonWidget *newSave = new ButtonWidget(_newSaveContainer, dstX, dstY, buttonWidth, buttonHeight, _("New Save"), _("Create a new save game"), kNewSaveCmd); + // In case no more slots are free, we will disable the new save button + if (_nextFreeSaveSlot == -1) { + newSave->setEnabled(false); + } + continue; + } + + ContainerWidget *container = new ContainerWidget(this, curX, y, containerWidth, containerHeight); + container->setVisible(false); + + // Command 0 cannot be used, since it won't be send. Thus we will adjust + // command number here, if required. This is only the case for load mode + // since for save mode, the first button used is index 1 anyway. + uint buttonCmd = curLine * _columns + curColumn; + if (!_saveMode) { + buttonCmd += 1; + } + + PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, 0, buttonCmd); + dstY += buttonHeight; + + StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), Graphics::kTextAlignLeft); + + _buttons.push_back(SlotButton(container, button, description)); + } + } + + if (!_target.empty()) + updateSaves(); +} + +void SaveLoadChooserGrid::close() { + SaveLoadChooserDialog::close(); + hideButtons(); +} + +int SaveLoadChooserGrid::runIntern() { + int slot; + do { + const SaveLoadChooserType currentType = getType(); + const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(*_metaEngine); + + // Catch resolution changes when the save name dialog was open. + if (currentType != requestedType) { + setResult(kSwitchSaveLoadDialog); + return kSwitchSaveLoadDialog; + } + + slot = runModal(); + } while (_saveMode && slot >= 0 && !selectDescription()); + + return slot; +} + +bool SaveLoadChooserGrid::selectDescription() { + _savenameDialog.setDescription(_resultString); + _savenameDialog.setTargetSlot(getResult()); + if (_savenameDialog.runModal() == 0) { + _resultString = _savenameDialog.getDescription(); + return true; + } else { + return false; + } +} + +void SaveLoadChooserGrid::destroyButtons() { + if (_newSaveContainer) { + removeWidget(_newSaveContainer); + delete _newSaveContainer; + _newSaveContainer = 0; + } + + for (ButtonArray::iterator i = _buttons.begin(), end = _buttons.end(); i != end; ++i) { + removeWidget(i->container); + delete i->container; + } + + _buttons.clear(); +} + +void SaveLoadChooserGrid::hideButtons() { + for (ButtonArray::iterator i = _buttons.begin(), end = _buttons.end(); i != end; ++i) { + i->button->setGfx(0); + i->setVisible(false); + } +} + +void SaveLoadChooserGrid::updateSaves() { + hideButtons(); + + for (uint i = _curPage * _entriesPerPage, curNum = 0; i < _saveList.size() && curNum < _entriesPerPage; ++i, ++curNum) { + const uint saveSlot = _saveList[i].getSaveSlot(); + + SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), saveSlot); + SlotButton &curButton = _buttons[curNum]; + curButton.setVisible(true); + const Graphics::Surface *thumbnail = desc.getThumbnail(); + if (thumbnail) { + curButton.button->setGfx(desc.getThumbnail()); + } else { + curButton.button->setGfx(kThumbnailWidth, kThumbnailHeight2, 0, 0, 0); + } + curButton.description->setLabel(Common::String::format("%d. %s", saveSlot, desc.getDescription().c_str())); + + Common::String tooltip(_("Name: ")); + tooltip += desc.getDescription(); + + if (_saveDateSupport) { + const Common::String &saveDate = desc.getSaveDate(); + if (!saveDate.empty()) { + tooltip += "\n"; + tooltip += _("Date: ") + saveDate; + } + + const Common::String &saveTime = desc.getSaveTime(); + if (!saveTime.empty()) { + tooltip += "\n"; + tooltip += _("Time: ") + saveTime; + } + } + + if (_playTimeSupport) { + const Common::String &playTime = desc.getPlayTime(); + if (!playTime.empty()) { + tooltip += "\n"; + tooltip += _("Playtime: ") + playTime; + } + } + + curButton.button->setTooltip(tooltip); + + // In save mode we disable the button, when it's write protected. + // TODO: Maybe we should not display it at all then? + if (_saveMode && desc.getWriteProtectedFlag()) { + curButton.button->setEnabled(false); + } else { + curButton.button->setEnabled(true); + } + } + + const uint numPages = (_entriesPerPage != 0) ? (_saveList.size() / _entriesPerPage + 1) : 1; + _pageDisplay->setLabel(Common::String::format("%u/%u", _curPage + 1, numPages)); + + if (_curPage > 0) + _prevButton->setEnabled(true); + else + _prevButton->setEnabled(false); + + if ((_curPage + 1) * _entriesPerPage < _saveList.size()) + _nextButton->setEnabled(true); + else + _nextButton->setEnabled(false); +} + +SavenameDialog::SavenameDialog() + : Dialog("SavenameDialog") { + _title = new StaticTextWidget(this, "SavenameDialog.DescriptionText", Common::String()); + + new ButtonWidget(this, "SavenameDialog.Cancel", _("Cancel"), 0, kCloseCmd); + new ButtonWidget(this, "SavenameDialog.Ok", _("OK"), 0, kOKCmd); + + _description = new EditTextWidget(this, "SavenameDialog.Description", Common::String(), 0, 0, kOKCmd); +} + +void SavenameDialog::setDescription(const Common::String &desc) { + _description->setEditString(desc); +} + +const Common::String &SavenameDialog::getDescription() { + return _description->getEditString(); +} + +void SavenameDialog::open() { + Dialog::open(); + setResult(-1); + + _title->setLabel(Common::String::format(_("Enter a description for slot %d:"), _targetSlot)); +} + +void SavenameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kOKCmd: + setResult(0); + close(); + break; + + default: + Dialog::handleCommand(sender, cmd, data); + } +} + +#endif // !DISABLE_SAVELOADCHOOSER_GRID + +} // End of namespace GUI diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h new file mode 100644 index 000000000000..9d0350d69d5e --- /dev/null +++ b/gui/saveload-dialog.h @@ -0,0 +1,208 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef GUI_SAVELOAD_DIALOG_H +#define GUI_SAVELOAD_DIALOG_H + +#include "gui/dialog.h" +#include "gui/widgets/list.h" + +#include "engines/metaengine.h" + +namespace GUI { + +#define kSwitchSaveLoadDialog -2 + +// TODO: We might want to disable the grid based save/load chooser for more +// platforms, than those which define DISABLE_FANCY_THEMES. But those are +// probably not able to handle the grid chooser anyway, so disabling it +// for them is a good start. +#ifdef DISABLE_FANCY_THEMES +#define DISABLE_SAVELOADCHOOSER_GRID +#endif // DISABLE_FANCY_THEMES + +#ifndef DISABLE_SAVELOADCHOOSER_GRID +enum SaveLoadChooserType { + kSaveLoadDialogList = 0, + kSaveLoadDialogGrid = 1 +}; + +SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine); +#endif // !DISABLE_SAVELOADCHOOSER_GRID + +class SaveLoadChooserDialog : protected Dialog { +public: + SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode); + SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode); + + virtual void open(); + + virtual void reflowLayout(); + + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + +#ifndef DISABLE_SAVELOADCHOOSER_GRID + virtual SaveLoadChooserType getType() const = 0; +#endif // !DISABLE_SAVELOADCHOOSER_GRID + + int run(const Common::String &target, const MetaEngine *metaEngine); + virtual const Common::String &getResultString() const = 0; + +protected: + virtual int runIntern() = 0; + + const bool _saveMode; + const MetaEngine *_metaEngine; + bool _delSupport; + bool _metaInfoSupport; + bool _thumbnailSupport; + bool _saveDateSupport; + bool _playTimeSupport; + Common::String _target; + +#ifndef DISABLE_SAVELOADCHOOSER_GRID + ButtonWidget *_listButton; + ButtonWidget *_gridButton; + + void addChooserButtons(); + ButtonWidget *createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd = 0); +#endif // !DISABLE_SAVELOADCHOOSER_GRID +}; + +class SaveLoadChooserSimple : public SaveLoadChooserDialog { + typedef Common::String String; + typedef Common::Array StringArray; +public: + SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode); + + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + + virtual const Common::String &getResultString() const; + + virtual void reflowLayout(); + +#ifndef DISABLE_SAVELOADCHOOSER_GRID + virtual SaveLoadChooserType getType() const { return kSaveLoadDialogList; } +#endif // !DISABLE_SAVELOADCHOOSER_GRID + + virtual void close(); +private: + virtual int runIntern(); + + ListWidget *_list; + ButtonWidget *_chooseButton; + ButtonWidget *_deleteButton; + GraphicsWidget *_gfxWidget; + ContainerWidget *_container; + StaticTextWidget *_date; + StaticTextWidget *_time; + StaticTextWidget *_playtime; + + SaveStateList _saveList; + String _resultString; + + void updateSaveList(); + void updateSelection(bool redraw); +}; + +#ifndef DISABLE_SAVELOADCHOOSER_GRID + +class EditTextWidget; + +class SavenameDialog : public Dialog { +public: + SavenameDialog(); + + void setDescription(const Common::String &desc); + const Common::String &getDescription(); + + void setTargetSlot(int slot) { _targetSlot = slot; } + + virtual void open(); +protected: + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); +private: + int _targetSlot; + StaticTextWidget *_title; + EditTextWidget *_description; +}; + +class SaveLoadChooserGrid : public SaveLoadChooserDialog { +public: + SaveLoadChooserGrid(const Common::String &title, bool saveMode); + ~SaveLoadChooserGrid(); + + virtual const Common::String &getResultString() const; + + virtual void open(); + + virtual void reflowLayout(); + + virtual SaveLoadChooserType getType() const { return kSaveLoadDialogGrid; } + + virtual void close(); +protected: + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + virtual void handleMouseWheel(int x, int y, int direction); +private: + virtual int runIntern(); + + uint _columns, _lines; + uint _entriesPerPage; + uint _curPage; + SaveStateList _saveList; + + ButtonWidget *_nextButton; + ButtonWidget *_prevButton; + + StaticTextWidget *_pageDisplay; + + ContainerWidget *_newSaveContainer; + int _nextFreeSaveSlot; + Common::String _resultString; + + SavenameDialog _savenameDialog; + bool selectDescription(); + + struct SlotButton { + SlotButton() : container(0), button(0), description(0) {} + SlotButton(ContainerWidget *c, PicButtonWidget *b, StaticTextWidget *d) : container(c), button(b), description(d) {} + + ContainerWidget *container; + PicButtonWidget *button; + StaticTextWidget *description; + + void setVisible(bool state) { + container->setVisible(state); + } + }; + typedef Common::Array ButtonArray; + ButtonArray _buttons; + void destroyButtons(); + void hideButtons(); + void updateSaves(); +}; + +#endif // !DISABLE_SAVELOADCHOOSER_GRID + +} // End of namespace GUI + +#endif diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 67d871e13323..c2bbcd9bec36 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -20,111 +20,45 @@ */ #include "common/config-manager.h" -#include "common/translation.h" #include "common/system.h" -#include "gui/widgets/list.h" -#include "gui/message.h" #include "gui/saveload.h" -#include "gui/ThemeEval.h" +#include "gui/saveload-dialog.h" #include "gui/gui-manager.h" -#include "graphics/scaler.h" - #include "engines/metaengine.h" namespace GUI { -enum { - kChooseCmd = 'CHOS', - kDelCmd = 'DEL ' - -}; - SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode) - : Dialog("SaveLoadChooser"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { - _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false; - - _backgroundType = ThemeEngine::kDialogBackgroundSpecial; - - new StaticTextWidget(this, "SaveLoadChooser.Title", title); - - // Add choice list - _list = new GUI::ListWidget(this, "SaveLoadChooser.List"); - _list->setNumberingMode(GUI::kListNumberingZero); - _list->setEditable(saveMode); - - _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); - - _date = new StaticTextWidget(this, 0, 0, 10, 10, _("No date saved"), Graphics::kTextAlignCenter); - _time = new StaticTextWidget(this, 0, 0, 10, 10, _("No time saved"), Graphics::kTextAlignCenter); - _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter); - - // Buttons - new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), 0, kCloseCmd); - _chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, 0, kChooseCmd); - _chooseButton->setEnabled(false); - - _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), 0, kDelCmd); - _deleteButton->setEnabled(false); - - _delSupport = _metaInfoSupport = _thumbnailSupport = false; - - _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); -// _container->setHints(GUI::THEME_HINT_USE_SHADOW); + : _impl(0), _title(title), _buttonLabel(buttonLabel), _saveMode(saveMode) { } SaveLoadChooser::~SaveLoadChooser() { + delete _impl; + _impl = 0; } -int SaveLoadChooser::runModalWithCurrentTarget() { - const Common::String gameId = ConfMan.get("gameid"); - - const EnginePlugin *plugin = 0; - EngineMan.findGame(gameId, &plugin); - - return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); -} - -int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) { - if (_gfxWidget) - _gfxWidget->setGfx(0); - - // Set up the game domain as newly active domain, so - // target specific savepath will be checked - String oldDomain = ConfMan.getActiveDomainName(); - ConfMan.setActiveDomain(target); - - _plugin = plugin; - _target = target; - _delSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsDeleteSave); - _metaInfoSupport = (*_plugin)->hasFeature(MetaEngine::kSavesSupportMetaInfo); - _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportThumbnail); - _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportCreationDate); - _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportPlayTime); - _resultString.clear(); - reflowLayout(); - updateSaveList(); - - int ret = Dialog::runModal(); - - // Revert to the old active domain - ConfMan.setActiveDomain(oldDomain); - - return ret; -} - -void SaveLoadChooser::open() { - Dialog::open(); - - // So that quitting ScummVM will not cause the dialog result to say a - // savegame was selected. - setResult(-1); -} - -const Common::String &SaveLoadChooser::getResultString() const { - int selItem = _list->getSelected(); - return (selItem >= 0) ? _list->getSelectedString() : _resultString; +void SaveLoadChooser::selectChooser(const MetaEngine &engine) { +#ifndef DISABLE_SAVELOADCHOOSER_GRID + const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(engine); + if (!_impl || _impl->getType() != requestedType) { + delete _impl; + _impl = 0; + + switch (requestedType) { + case kSaveLoadDialogGrid: + _impl = new SaveLoadChooserGrid(_title, _saveMode); + break; + + case kSaveLoadDialogList: +#endif // !DISABLE_SAVELOADCHOOSER_GRID + _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode); +#ifndef DISABLE_SAVELOADCHOOSER_GRID + break; + } + } +#endif // !DISABLE_SAVELOADCHOOSER_GRID } Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) const { @@ -139,267 +73,44 @@ Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) con #endif } -void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { - int selItem = _list->getSelected(); - - switch (cmd) { - case GUI::kListItemActivatedCmd: - case GUI::kListItemDoubleClickedCmd: - if (selItem >= 0 && _chooseButton->isEnabled()) { - if (_list->isEditable() || !_list->getSelectedString().empty()) { - _list->endEditMode(); - if (!_saveList.empty()) { - setResult(_saveList[selItem].getSaveSlot()); - _resultString = _list->getSelectedString(); - } - close(); - } - } - break; - case kChooseCmd: - _list->endEditMode(); - if (!_saveList.empty()) { - setResult(_saveList[selItem].getSaveSlot()); - _resultString = _list->getSelectedString(); - } - close(); - break; - case GUI::kListSelectionChangedCmd: - updateSelection(true); - break; - case kDelCmd: - if (selItem >= 0 && _delSupport) { - MessageDialog alert(_("Do you really want to delete this savegame?"), - _("Delete"), _("Cancel")); - if (alert.runModal() == GUI::kMessageOK) { - (*_plugin)->removeSaveState(_target.c_str(), _saveList[selItem].getSaveSlot()); - - setResult(-1); - _list->setSelected(-1); - - updateSaveList(); - updateSelection(true); - } - } - break; - case kCloseCmd: - setResult(-1); - default: - Dialog::handleCommand(sender, cmd, data); - } -} - -void SaveLoadChooser::reflowLayout() { - if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) { - int16 x, y; - uint16 w, h; - - if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h)) - error("Error when loading position data for Save/Load Thumbnails"); - - int thumbW = kThumbnailWidth; - int thumbH = kThumbnailHeight2; - int thumbX = x + (w >> 1) - (thumbW >> 1); - int thumbY = y + kLineHeight; - - int textLines = 0; - if (!_saveDateSupport) - textLines++; - if (!_playTimeSupport) - textLines++; - - _container->resize(x, y, w, h - (kLineHeight * textLines)); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); - - int height = thumbY + thumbH + kLineHeight; - - if (_saveDateSupport) { - _date->resize(thumbX, height, kThumbnailWidth, kLineHeight); - height += kLineHeight; - _time->resize(thumbX, height, kThumbnailWidth, kLineHeight); - height += kLineHeight; - } - - if (_playTimeSupport) - _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight); - - _container->setVisible(true); - _gfxWidget->setVisible(true); - - _date->setVisible(_saveDateSupport); - _time->setVisible(_saveDateSupport); - - _playtime->setVisible(_playTimeSupport); +int SaveLoadChooser::runModalWithCurrentTarget() { + const Common::String gameId = ConfMan.get("gameid"); - _fillR = 0; - _fillG = 0; - _fillB = 0; - updateSelection(false); - } else { - _container->setVisible(false); - _gfxWidget->setVisible(false); - _date->setVisible(false); - _time->setVisible(false); - _playtime->setVisible(false); - } + const EnginePlugin *plugin = 0; + EngineMan.findGame(gameId, &plugin); - Dialog::reflowLayout(); + return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); } -void SaveLoadChooser::updateSelection(bool redraw) { - int selItem = _list->getSelected(); - - bool isDeletable = _delSupport; - bool isWriteProtected = false; - bool startEditMode = _list->isEditable(); - - _gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB); - _date->setLabel(_("No date saved")); - _time->setLabel(_("No time saved")); - _playtime->setLabel(_("No playtime saved")); - - if (selItem >= 0 && _metaInfoSupport) { - SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), _saveList[selItem].getSaveSlot()); - - isDeletable = desc.getDeletableFlag() && _delSupport; - isWriteProtected = desc.getWriteProtectedFlag(); - - // Don't allow the user to change the description of write protected games - if (isWriteProtected) - startEditMode = false; - - if (_thumbnailSupport) { - const Graphics::Surface *thumb = desc.getThumbnail(); - if (thumb) { - _gfxWidget->setGfx(thumb); - _gfxWidget->useAlpha(256); - } - } - - if (_saveDateSupport) { - const Common::String &saveDate = desc.getSaveDate(); - if (!saveDate.empty()) - _date->setLabel(_("Date: ") + saveDate); - - const Common::String &saveTime = desc.getSaveTime(); - if (!saveTime.empty()) - _time->setLabel(_("Time: ") + saveTime); - } - - if (_playTimeSupport) { - const Common::String &playTime = desc.getPlayTime(); - if (!playTime.empty()) - _playtime->setLabel(_("Playtime: ") + playTime); - } - } - - - if (_list->isEditable()) { - // Disable the save button if nothing is selected, or if the selected - // game is write protected - _chooseButton->setEnabled(selItem >= 0 && !isWriteProtected); +int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) { + selectChooser(**plugin); + if (!_impl) + return -1; - if (startEditMode) { - _list->startEditMode(); + // Set up the game domain as newly active domain, so + // target specific savepath will be checked + String oldDomain = ConfMan.getActiveDomainName(); + ConfMan.setActiveDomain(target); - if (_chooseButton->isEnabled() && _list->getSelectedString() == _("Untitled savestate") && - _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) { - _list->setEditString(""); - _list->setEditColor(ThemeEngine::kFontColorNormal); - } + int ret; + do { + ret = _impl->run(target, &(**plugin)); +#ifndef DISABLE_SAVELOADCHOOSER_GRID + if (ret == kSwitchSaveLoadDialog) { + selectChooser(**plugin); } - } else { - // Disable the load button if nothing is selected, or if an empty - // list item is selected. - _chooseButton->setEnabled(selItem >= 0 && !_list->getSelectedString().empty()); - } - - // Delete will always be disabled if the engine doesn't support it. - _deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty())); - - if (redraw) { - _gfxWidget->draw(); - _date->draw(); - _time->draw(); - _playtime->draw(); - _chooseButton->draw(); - _deleteButton->draw(); - - draw(); - } -} +#endif // !DISABLE_SAVELOADCHOOSER_GRID + } while (ret < -1); -void SaveLoadChooser::close() { - _plugin = 0; - _target.clear(); - _saveList.clear(); - _list->setList(StringArray()); + // Revert to the old active domain + ConfMan.setActiveDomain(oldDomain); - Dialog::close(); + return ret; } -void SaveLoadChooser::updateSaveList() { - _saveList = (*_plugin)->listSaves(_target.c_str()); - - int curSlot = 0; - int saveSlot = 0; - StringArray saveNames; - ListWidget::ColorList colors; - for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { - // Handle gaps in the list of save games - saveSlot = x->getSaveSlot(); - if (curSlot < saveSlot) { - while (curSlot < saveSlot) { - SaveStateDescriptor dummySave(curSlot, ""); - _saveList.insert_at(curSlot, dummySave); - saveNames.push_back(dummySave.getDescription()); - colors.push_back(ThemeEngine::kFontColorNormal); - curSlot++; - } - - // Sync the save list iterator - for (x = _saveList.begin(); x != _saveList.end(); ++x) { - if (x->getSaveSlot() == saveSlot) - break; - } - } - - // Show "Untitled savestate" for empty/whitespace savegame descriptions - Common::String description = x->getDescription(); - Common::String trimmedDescription = description; - trimmedDescription.trim(); - if (trimmedDescription.empty()) { - description = _("Untitled savestate"); - colors.push_back(ThemeEngine::kFontColorAlternate); - } else { - colors.push_back(ThemeEngine::kFontColorNormal); - } - - saveNames.push_back(description); - curSlot++; - } - - // Fill the rest of the save slots with empty saves - - int maximumSaveSlots = (*_plugin)->getMaximumSaveSlot(); - -#ifdef __DS__ - // Low memory on the DS means too many save slots are impractical, so limit - // the maximum here. - if (maximumSaveSlots > 99) { - maximumSaveSlots = 99; - } -#endif - - Common::String emptyDesc; - for (int i = curSlot; i <= maximumSaveSlots; i++) { - saveNames.push_back(emptyDesc); - SaveStateDescriptor dummySave(i, ""); - _saveList.push_back(dummySave); - colors.push_back(ThemeEngine::kFontColorNormal); - } - - _list->setList(saveNames, &colors); +const Common::String &SaveLoadChooser::getResultString() const { + assert(_impl); + return _impl->getResultString(); } } // End of namespace GUI diff --git a/gui/saveload.h b/gui/saveload.h index a19f5ab0839c..17fd99a31d11 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -19,54 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef GUI_SAVELOAD_DIALOG_H -#define GUI_SAVELOAD_DIALOG_H +#ifndef GUI_SAVELOAD_H +#define GUI_SAVELOAD_H #include "gui/dialog.h" #include "engines/metaengine.h" namespace GUI { -class ListWidget; -class GraphicsWidget; -class ButtonWidget; -class CommandSender; -class ContainerWidget; -class StaticTextWidget; +class SaveLoadChooserDialog; -class SaveLoadChooser : GUI::Dialog { +class SaveLoadChooser { typedef Common::String String; - typedef Common::Array StringArray; protected: - GUI::ListWidget *_list; - GUI::ButtonWidget *_chooseButton; - GUI::ButtonWidget *_deleteButton; - GUI::GraphicsWidget *_gfxWidget; - GUI::ContainerWidget *_container; - GUI::StaticTextWidget *_date; - GUI::StaticTextWidget *_time; - GUI::StaticTextWidget *_playtime; + SaveLoadChooserDialog *_impl; - const EnginePlugin *_plugin; - bool _delSupport; - bool _metaInfoSupport; - bool _thumbnailSupport; - bool _saveDateSupport; - bool _playTimeSupport; - String _target; - SaveStateList _saveList; - String _resultString; + const String _title; + const String _buttonLabel; + const bool _saveMode; - uint8 _fillR, _fillG, _fillB; - - void updateSaveList(); - void updateSelection(bool redraw); + void selectChooser(const MetaEngine &engine); public: SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode); ~SaveLoadChooser(); - virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); - /** * Runs the save/load chooser with the currently active config manager * domain as target. @@ -75,7 +51,6 @@ class SaveLoadChooser : GUI::Dialog { */ int runModalWithCurrentTarget(); int runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target); - void open(); const Common::String &getResultString() const; @@ -93,10 +68,6 @@ class SaveLoadChooser : GUI::Dialog { * @return The slot description. */ Common::String createDefaultSaveDescription(const int slot) const; - - virtual void reflowLayout(); - - virtual void close(); }; } // End of namespace GUI diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 86d0061e1b62..7f565eb05d28 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -619,6 +619,8 @@ " " " " " " +" " +" " " " " " " " @@ -1362,6 +1364,14 @@ " " " " " " +" " +" " " " " " " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " " " " " " " +" " +" " " " " " " " @@ -2294,9 +2325,16 @@ " " " " " " +" " " " +" " +" " +" " " " " " " " " " " " +" " +" " " " " " " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " " + + + @@ -793,9 +796,16 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -807,6 +810,14 @@ + + + + + + + + + + + + + + + @@ -153,7 +155,7 @@ /> + + + @@ -807,9 +810,16 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -806,6 +809,14 @@ + + + + + + + + + + + + + = 0 && x < _w && y >= 0 && y < _h) { - sendCommand(_cmd, 0); startAnimatePressedState(); + sendCommand(_cmd, 0); } } @@ -414,6 +414,19 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx->copyFrom(*gfx); } +void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { + if (w == -1) + w = _w; + if (h == -1) + h = _h; + + const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); + + _gfx->free(); + _gfx->create(w, h, requiredFormat); + _gfx->fillRect(Common::Rect(0, 0, w, h), _gfx->format.RGBToColor(r, g, b)); +} + void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); @@ -698,6 +711,26 @@ ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) : _type = kContainerWidget; } +ContainerWidget::~ContainerWidget() { + // We also remove the widget from the boss to avoid segfaults, when the + // deleted widget is an active widget in the boss. + for (Widget *w = _firstWidget; w; w = w->next()) { + _boss->removeWidget(w); + } +} + +Widget *ContainerWidget::findWidget(int x, int y) { + return findWidgetInChain(_firstWidget, x, y); +} + +void ContainerWidget::removeWidget(Widget *widget) { + // We also remove the widget from the boss to avoid a reference to a + // widget not in the widget chain anymore. + _boss->removeWidget(widget); + + Widget::removeWidget(widget); +} + void ContainerWidget::drawWidget() { g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder); } diff --git a/gui/widget.h b/gui/widget.h index 6de56862c3d9..6f710f302f63 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -88,7 +88,7 @@ class Widget : public GuiObject { uint16 _id; bool _hasFocus; ThemeEngine::WidgetStateInfo _state; - const char *_tooltip; + Common::String _tooltip; private: uint16 _flags; @@ -142,7 +142,9 @@ class Widget : public GuiObject { uint8 parseHotkey(const Common::String &label); Common::String cleanupHotkey(const Common::String &label); - const char *getTooltip() const { return _tooltip; } + bool hasTooltip() const { return !_tooltip.empty(); } + const Common::String &getTooltip() const { return _tooltip; } + void setTooltip(const Common::String &tooltip) { _tooltip = tooltip; } protected: void updateState(int oldFlags, int newFlags); @@ -220,6 +222,7 @@ class PicButtonWidget : public ButtonWidget { ~PicButtonWidget(); void setGfx(const Graphics::Surface *gfx); + void setGfx(int w, int h, int r, int g, int b); void useAlpha(int alpha) { _alpha = alpha; } void useThemeTransparency(bool enable) { _transparency = enable; } @@ -365,7 +368,10 @@ class ContainerWidget : public Widget { public: ContainerWidget(GuiObject *boss, int x, int y, int w, int h); ContainerWidget(GuiObject *boss, const Common::String &name); + ~ContainerWidget(); + virtual Widget *findWidget(int x, int y); + virtual void removeWidget(Widget *widget); protected: void drawWidget(); }; diff --git a/po/POTFILES b/po/POTFILES index 8b74115939e0..72c6fb1d18ab 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -10,7 +10,7 @@ gui/KeysDialog.cpp gui/launcher.cpp gui/massadd.cpp gui/options.cpp -gui/saveload.cpp +gui/saveload-dialog.cpp gui/themebrowser.cpp gui/ThemeEngine.cpp gui/widget.cpp @@ -53,6 +53,7 @@ engines/sword1/logic.cpp engines/sword1/sword1.cpp engines/sword2/animation.cpp engines/sword2/sword2.cpp +engines/teenagent/resources.cpp engines/tinsel/saveload.cpp engines/parallaction/saveload.cpp diff --git a/po/ca_ES.po b/po/ca_ES.po index 35d5810ed6ec..3e8ade392311 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" "PO-Revision-Date: 2011-10-04 20:51+0100\n" "Last-Translator: Jordi Vilalta Prat \n" "Language-Team: Catalan \n" +"Language: Catalan\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Catalan\n" #: gui/about.cpp:91 #, c-format @@ -44,10 +44,11 @@ msgstr "Amunt" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -91,16 +92,16 @@ msgstr "Assigna" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "D'acord" @@ -442,14 +443,14 @@ msgstr "Cerca a la llista de jocs" msgid "Search:" msgstr "Cerca:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Carrega partida:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Carrega" @@ -611,7 +612,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modes de tramat especials suportats per alguns jocs" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Mode pantalla completa" @@ -931,68 +932,104 @@ msgstr "" "El tema que heu seleccionat no suporta l'idioma actual. Si voleu utilitzar " "aquest tema primer haureu de canviar a un altre idioma." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "No hi ha data desada" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "No hi ha hora desada" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "No hi ha temps de joc desat" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Suprimeix" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Realment voleu suprimir aquesta partida?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Data: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Hora: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Temps de joc: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Partida sense títol" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Desa" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "No s'ha pogut desar l'estat del joc" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nom:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Seleccioneu un Tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX desactivats" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX desactivats" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Pintat estàndard (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Estàndard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Pintat amb antialias (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Amb antialias (16bpp)" @@ -1096,17 +1133,17 @@ msgstr "Cancel msgid "Unknown error" msgstr "Error desconegut" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "El joc a '%s' sembla ser desconegut." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "Informeu de la següent informació a l'equip de ScummVM juntament amb el" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "nom del joc que heu provat d'afegir i la seva versió/llengua/etc.:" @@ -1134,23 +1171,23 @@ msgstr "~A~juda" msgid "~A~bout" msgstr "~Q~uant a" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~R~etorna al Llançador" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~R~etorna al Llançador" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Desa la partida:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1159,7 +1196,7 @@ msgstr "Desa la partida:" msgid "Save" msgstr "Desa" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1168,7 +1205,7 @@ msgstr "" "Aquest motor no ofereix ajuda dins el joc. Consulteu el fitxer README per a " "la informació bàsica i les instruccions sobre com obtenir més assistència." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, fuzzy, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " @@ -1177,17 +1214,17 @@ msgstr "" "Aquest motor no ofereix ajuda dins el joc. Consulteu el fitxer README per a " "la informació bàsica i les instruccions sobre com obtenir més assistència." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~D~'acord" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~C~ancel·la" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~ecles" @@ -1268,11 +1305,11 @@ msgstr "" msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Recupera la partida:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Restaura" @@ -1304,12 +1341,12 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" +msgid "Use IMF/Yamaha FB-01 for MIDI output" msgstr "" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" @@ -1997,7 +2034,7 @@ msgstr "" "El suport de MIDI natiu requereix l'actualització Roland de LucasArts,\n" "però no s'ha trobat %s. S'utilitzarà AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2008,7 +2045,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2019,7 +2056,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2030,7 +2067,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2066,17 +2103,17 @@ msgstr "~M~en msgid "~W~ater Effect Enabled" msgstr "~E~fecte de l'aigua activat" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "No s'ha trobat el fitxer d'escena '%s'!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "No s'ha pogut carregar l'estat del joc del fitxer." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "No s'ha pogut desar l'estat del joc al fitxer." @@ -2203,12 +2240,13 @@ msgid "Choose Spell" msgstr "Escull" #: engines/kyra/sound_midi.cpp:475 +#, fuzzy msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Sembla que esteu utilitzant un dispositiu General\n" "MIDI, però el joc només suporta MIDI de Roland\n" @@ -2216,12 +2254,12 @@ msgstr "" "Roland MT32 als de General MIDI. És possible\n" "que algunes pistes no es reprodueixin correctament." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" msgstr "" #: engines/sky/compact.cpp:130 @@ -2240,6 +2278,14 @@ msgstr "" "El fitxer \"sky.cpt\" té una mida incorrecta.\n" "Torneu a baixar-lo de www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2315,6 +2361,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2324,15 +2381,15 @@ msgstr "" "No s'ha pogut desar a l'espai %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Carregant la partida..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Desant la partida..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2349,11 +2406,11 @@ msgstr "" "Premeu D'Acord per convertir-les ara, en cas contrari se us tornarà a " "demanar la propera vegada.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM ha convertit satisfactòriament totes les partides desades." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2567,11 +2624,11 @@ msgstr "Mode Touchpad activat." msgid "Touchpad mode disabled." msgstr "Mode Touchpad desactivat." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2579,12 +2636,12 @@ msgstr "" msgid "Left Click" msgstr "Clic esquerre" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 #, fuzzy msgid "Middle Click" msgstr "Element mig esquerre" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2621,21 +2678,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (no escalat)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "S'ha activat la correcció de la relació d'aspecte" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "S'ha desactivat la correcció de la relació d'aspecte" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Filtre de gràfics actiu:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Mode de finestra" @@ -2988,37 +3045,37 @@ msgstr "Llan msgid "Do you really want to quit?" msgstr "Estàs segur de voler sortir?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "'Mode Toc' de pantalla tàctil - Clic esquerre" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "'Mode Toc' de pantalla tàctil - Clic dret" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "'Mode Toc' de pantalla tàctil - Flotant (sense clic)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Volum màxim" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Pujant el volum" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Volum mínim" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Baixant el volum" diff --git a/po/cs_CZ.po b/po/cs_CZ.po index dd13e78f1b65..107be4539814 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.4.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2012-05-22 21:02+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-08 18:03+0100\n" "Last-Translator: Zbynìk Schwarz \n" "Language-Team: \n" +"Language: Cesky\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-2\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Cesky\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n" "X-Poedit-Language: Czech\n" "X-Poedit-Country: CZECH REPUBLIC\n" @@ -27,7 +27,7 @@ msgstr "(sestaveno %s)" #: gui/about.cpp:98 msgid "Features compiled in:" -msgstr "Zakompilované Funkce:" +msgstr "Zakompilované funkce:" #: gui/about.cpp:107 msgid "Available engines:" @@ -48,10 +48,11 @@ msgstr "J #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -94,16 +95,16 @@ msgstr "Mapovat" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -309,7 +310,7 @@ msgstr "Cesta pro ulo #: gui/launcher.cpp:333 gui/launcher.cpp:335 gui/launcher.cpp:336 #: gui/options.cpp:1123 gui/options.cpp:1125 gui/options.cpp:1126 msgid "Specifies where your savegames are put" -msgstr "Stanovuje, kam jsou umístìny Va¹e ulo¾ené hry" +msgstr "Stanovuje, kam jsou umístìny va¹e ulo¾ené hry" #: gui/launcher.cpp:335 gui/options.cpp:1125 msgctxt "lowres" @@ -439,14 +440,14 @@ msgstr "Hledat v seznamu her" msgid "Search:" msgstr "Hledat:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Nahrát hru:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Nahrát" @@ -606,7 +607,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciální re¾imy chvìní podporované nìkterými hrami" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Re¾im celé obrazovky" @@ -726,7 +727,7 @@ msgid "" "connected to your computer" msgstr "" "Za¹krtnìte, pokud chcete pou¾ít pravé hardwarové zaøízení kompatibilní s " -"Roland, pøipojené k Va¹emu poèítaèi" +"Roland, pøipojené k va¹emu poèítaèi" #: gui/options.cpp:877 msgctxt "lowres" @@ -919,68 +920,104 @@ msgstr "" "Vzhled, který jste zvolili, nepodporuje Vá¹ souèasný jazyk. Pokud chcete " "tento vzhled pou¾ít, musíte nejdøíve pøepnout na jiný jazyk." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Neulo¾ena ¾ádná data" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "®ádný ulo¾ený èas" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "®ádná ulo¾ená doba hraní" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Smazat" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Opravdu chcete tuto ulo¾enou hru vymazat" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Datum:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Èas:" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Doba hraní:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Bezejmenný ulo¾ený stav" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Ulo¾it" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Nelze ulo¾it hru." + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Jméno" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Vyberte Vzhled" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX zakázáno" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX zakázáno" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standardní Vykreslovaè (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standardní (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Vykreslovaè s vyhlazenými hranami (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "S vyhlazenými hranami (16bpp)" @@ -1084,16 +1121,16 @@ msgstr "Zru msgid "Unknown error" msgstr "Neznámá chyba" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Hra v '%s' se zdá být neznámá." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Prosím nahlaste následující data týmu ScummVM spolu se jménem" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "hry, kterou jste se pokusili pøidat a její verzi/jazyk/atd.:" @@ -1121,23 +1158,23 @@ msgstr "~N~ msgid "~A~bout" msgstr "~O~ programu" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~N~ávrat do Spou¹tìèe" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~N~ávrat do Spou¹tìèe" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Ulo¾it hru:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1146,7 +1183,7 @@ msgstr "Ulo msgid "Save" msgstr "Ulo¾it" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1156,7 +1193,7 @@ msgstr "" "prohlédnìte si README pro základní informace a pro instrukce jak získat " "dal¹í pomoc." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " @@ -1165,17 +1202,17 @@ msgstr "" "Ulo¾ení stavu hry selhalo (%s)! Prosím pøeètìte si dokumentaci pro základní " "informace a pokyny k získání dal¹í podpory." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~Z~ru¹it" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~K~lávesy" @@ -1256,11 +1293,11 @@ msgstr "Pou msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "Pou¾ít pùvodní obrazovky naètení/ulo¾ení místo ze ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Obnovit hru" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Obnovit" @@ -1289,15 +1326,15 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "Upøednostòovat digitální zvukové efekty pøed syntetizovanými" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "Pou¾ít IMF/Yahama FB-01 pro výstup MIDI" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Pou¾ít IMF/Yamaha FB-01 pro výstup MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" -"Pou¾ít kartu IBM Music Feature nebo modul syntetizátoru Yahama FB-01 FM pro " +"Pou¾ít kartu IBM Music Feature nebo modul syntetizátoru Yamaha FB-01 FM pro " "výstup MIDI" #: engines/sci/detection.cpp:411 @@ -1982,7 +2019,7 @@ msgstr "" "Pøirozená podpora MIDI vy¾aduje Aktualizaci Roland od LucasArts,\n" "ale %s chybí. Místo toho je pou¾it AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1993,7 +2030,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2004,7 +2041,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2015,7 +2052,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2051,17 +2088,17 @@ msgstr "~H~lavn msgid "~W~ater Effect Enabled" msgstr "~E~fekt Vody Zapnut" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Soubor videa '%s' nenalezen'" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Nelze naèíst stav hry ze souboru." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Nelze ulo¾it stav hry do souboru." @@ -2184,21 +2221,22 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Zdá se, ¾e pou¾íváte zaøízení General MIDI,\n" -"ale Va¹e hra podporuje pouze Roland MT32 MIDI.\n" +"ale va¹e hra podporuje pouze Roland MT32 MIDI.\n" "Sna¾íme se mapovat nástroje Roland MT32 na\n" -"ty od General MIDI. Po tomto se mù¾e stát,\n" -"¾e pár stop nebude správnì pøehráno." +"ty od General MIDI. Je stále mo¾né, ¾e\n" +"nìkteré stopy nebudou znít správnì." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" -msgstr "Úvod z diskety" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" +msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" msgstr "Pou¾ít verzi úvodu z diskety (Pouze verze CD)" #: engines/sky/compact.cpp:130 @@ -2217,6 +2255,14 @@ msgstr "" "Soubor \"sky.cpt\" má nesprávnou velikost.\n" "Stáhnìte si ho, prosím, (znovu) z www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Úvod z diskety" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Pou¾ít verzi úvodu z diskety (Pouze verze CD)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2248,7 +2294,7 @@ msgstr "" "ScummVM zjistil, ¾e máte staré ulo¾ené pozice pro Broken Sword 1, které by " "mìly být pøevedeny.\n" "Starý formát ulo¾ených her ji¾ není podporován, tak¾e pokud je nepøevedete, " -"nebudete moci Va¹e hry naèíst.\n" +"nebudete moci va¹e hry naèíst.\n" "\n" "Stisknìte OK, abyste je pøevedli teï, jinak budete po¾ádáni znovu, pøi " "spu¹tìní této hry.\n" @@ -2287,6 +2333,17 @@ msgstr "Zobrazit jmenovky objekt msgid "Show labels for objects on mouse hover" msgstr "Zobrazit jmenovky objektù pøi najetí my¹i" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2296,15 +2353,15 @@ msgstr "" "Nelze ulo¾it hru do pozice %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Nahrávání hry..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Ukládání hry..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2316,23 +2373,23 @@ msgstr "" "ScummVM zjistil, ¾e máte staré ulo¾ené pozice pro Nippon Safes, které by " "mìly být pøejmenovány.\n" "Staré názvy ji¾ nejsou podporovány, tak¾e pokud je nepøevedete, nebudete " -"moci Va¹e hry naèíst.\n" +"moci va¹e hry naèíst.\n" "\n" "Stisknìte OK, abyste je pøevedli teï, jinak budete po¾ádáni pøí¹tì.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." -msgstr "ScummVM úspì¹nì pøevedl v¹echny Va¹e ulo¾ené pozice. " +msgstr "ScummVM úspì¹nì pøevedl v¹echny va¹e ulo¾ené pozice. " -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" "\n" "Please report to the team." msgstr "" -"ScummVM vytiskl nìkterá varování ve Va¹em oknì konzole a nemù¾e zaruèit, ¾e " -"v¹echny Va¹e soubory byly pøevedeny.\n" +"ScummVM vytiskl nìkterá varování ve va¹em oknì konzole a nemù¾e zaruèit, ¾e " +"v¹echny va¹e soubory byly pøevedeny.\n" "\n" "Prosím nahlaste to týmu" @@ -2537,11 +2594,11 @@ msgstr "Touchpad re msgid "Touchpad mode disabled." msgstr "Touchpad re¾im vypnut" -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "Re¾im kliknutí" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2549,11 +2606,11 @@ msgstr "Re msgid "Left Click" msgstr "Levé Kliknutí" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "Kliknutí prostøedním tlaèítkem" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2590,21 +2647,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normální (bez zmìny velikosti)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Povolena korekce pomìru stran" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Zakázána korekce pomìru stran" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Aktivní grafický filtr:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Re¾im do okna" @@ -2959,37 +3016,37 @@ msgstr "Spou msgid "Do you really want to quit?" msgstr "Opravdu chcete skonèit?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Levé Kliknutí" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Pravé Kliknutí" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "'Re¾im «uknutí' Dotykové Obrazovky - Najetí (Bez Kliknutí)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Maximální Hlasitost" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Zvy¹uji Hlasitost" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Minimální Hlasitost" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Sni¾uji Hlasitost" diff --git a/po/da_DA.po b/po/da_DA.po index 76374027baa4..b30ef1bf029e 100644 --- a/po/da_DA.po +++ b/po/da_DA.po @@ -6,15 +6,17 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-01-08 22:53+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-09 20:27+0100\n" "Last-Translator: Steffen Nyeland \n" "Language-Team: Steffen Nyeland \n" +"Language: Dansk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Dansk\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-Language: Danish\n" +"X-Poedit-Country: DENMARK\n" #: gui/about.cpp:91 #, c-format @@ -44,10 +46,11 @@ msgstr "G #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -77,7 +80,6 @@ msgid "Remap keys" msgstr "Kortlæg taster" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "Skift fuldskærm" @@ -91,16 +93,16 @@ msgstr "Kortl #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -193,9 +195,8 @@ msgid "Platform:" msgstr "Platform:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Undersøg" +msgstr "Motor" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -386,11 +387,11 @@ msgstr "Start det valgte spil" #: gui/launcher.cpp:628 msgid "~L~oad..." -msgstr "~H~ent..." +msgstr "Ind~l~æs..." #: gui/launcher.cpp:628 msgid "Load savegame for selected game" -msgstr "Hent gemmer for det valgte spil" +msgstr "Indlæs gemmer for det valgte spil" #: gui/launcher.cpp:633 gui/launcher.cpp:1120 msgid "~A~dd Game..." @@ -439,14 +440,14 @@ msgstr "S msgid "Search:" msgstr "Søg:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Indlæs spil:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Indlæs" @@ -493,7 +494,7 @@ msgstr "Vil du virkelig fjerne denne spil konfiguration?" #: gui/launcher.cpp:1001 msgid "This game does not support loading games from the launcher." -msgstr "Dette spil understøtter ikke hentning af spil fra spiloversigten." +msgstr "Dette spil understøtter ikke indlæsning af spil fra spiloversigten." #: gui/launcher.cpp:1005 msgid "ScummVM could not find any engine capable of running the selected game!" @@ -520,7 +521,7 @@ msgstr "Skan gennemf #: gui/massadd.cpp:261 #, c-format msgid "Discovered %d new games, ignored %d previously added games." -msgstr "" +msgstr "Opdaget %d nye spil, ignorerede %d tidligere tilføjede spil." #: gui/massadd.cpp:265 #, c-format @@ -528,9 +529,9 @@ msgid "Scanned %d directories ..." msgstr "Gennemset %d biblioteker ..." #: gui/massadd.cpp:268 -#, fuzzy, c-format +#, c-format msgid "Discovered %d new games, ignored %d previously added games ..." -msgstr "Fundet %d nye spil ..." +msgstr "Fundet %d nye spil, ignorer %d tidligere tilføjede spil ..." #: gui/options.cpp:78 msgid "Never" @@ -580,19 +581,19 @@ msgstr "Ingen" #: gui/options.cpp:382 msgid "Failed to apply some of the graphic options changes:" -msgstr "" +msgstr "Anvendelse af ændringer for grafiske indstillinger fejlede:" #: gui/options.cpp:394 msgid "the video mode could not be changed." -msgstr "" +msgstr "videotilstanden kunne ikke ændres." #: gui/options.cpp:400 msgid "the fullscreen setting could not be changed" -msgstr "" +msgstr "fuld skærm indstillingen kunne ikke ændres" #: gui/options.cpp:406 msgid "the aspect ratio setting could not be changed" -msgstr "" +msgstr "billedformat indstillingen ikke kunne ændres" #: gui/options.cpp:727 msgid "Graphics mode:" @@ -607,7 +608,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciel farvereduceringstilstand understøttet a nogle spil" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Fuldskærms tilstand" @@ -672,11 +673,11 @@ msgstr "GM enhed:" #: gui/options.cpp:815 msgid "Specifies default sound device for General MIDI output" -msgstr "Angiver standard lyd enhed for General MIDI udgang" +msgstr "Angiver standard lyd enhed for Generel MIDI-udgang" #: gui/options.cpp:826 msgid "Don't use General MIDI music" -msgstr "Brug ikke General MIDI musik" +msgstr "Brug ikke Generel MIDI musik" #: gui/options.cpp:837 gui/options.cpp:899 msgid "Use first available device" @@ -738,7 +739,7 @@ msgstr "Aktiv #: gui/options.cpp:880 msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack" -msgstr "Sluk for General MIDI kortlægning for spil med Roland MT-32 lydspor" +msgstr "Sluk for Generel MIDI kortlægning for spil med Roland MT-32 lydspor" #: gui/options.cpp:889 msgid "Don't use Roland MT-32 music" @@ -887,9 +888,8 @@ msgid "Language of ScummVM GUI" msgstr "Sprog for brugerfladen i ScummVM" #: gui/options.cpp:1347 -#, fuzzy msgid "You have to restart ScummVM before your changes will take effect." -msgstr "Du skal genstarte ScummVM for at ændringer vises." +msgstr "Du skal genstarte ScummVM før dine ændringer har effekt." #: gui/options.cpp:1360 msgid "Select directory for savegames" @@ -919,68 +919,104 @@ msgstr "" "Temaet du valgte understøtter ikke dit aktuelle sprog. Hvis du ønsker at " "bruge dette tema, skal du skifte til et andet sprog først." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Ingen dato gemt" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Intet tidspunkt gemt" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Ingen spilletid gemt" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Slet" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Vil du virkelig slette denne gemmer?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Dato:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Tid:" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Spilletid:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Unavngivet gemmetilstand" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Gem" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Mislykkedes at gemme spil" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Navn:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Vælg et tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Deaktiveret GFX" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Deaktiveret GFX" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard renderer (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Antialias renderer (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Antialias (16bpp)" @@ -1022,20 +1058,17 @@ msgstr "Kunne ikke finde nogen motor istand til at afvikle det valgte spil" #: common/error.cpp:38 msgid "No error" -msgstr "" +msgstr "Ingen fejl" #: common/error.cpp:40 -#, fuzzy msgid "Game data not found" msgstr "Spil data ikke fundet" #: common/error.cpp:42 -#, fuzzy msgid "Game id not supported" msgstr "Spil id ikke understøttet" #: common/error.cpp:44 -#, fuzzy msgid "Unsupported color mode" msgstr "Ikke understøttet farve tilstand" @@ -1048,7 +1081,6 @@ msgid "Write permission denied" msgstr "Skrive rettighed nægtet" #: common/error.cpp:52 -#, fuzzy msgid "Path does not exist" msgstr "Sti eksistere ikke" @@ -1065,9 +1097,8 @@ msgid "Cannot create file" msgstr "Kan ikke oprette fil" #: common/error.cpp:61 -#, fuzzy msgid "Reading data failed" -msgstr "Læsning fejlet" +msgstr "Læsning af data fejlet" #: common/error.cpp:63 msgid "Writing data failed" @@ -1075,34 +1106,33 @@ msgstr "Skrivning af data fejlet" #: common/error.cpp:66 msgid "Could not find suitable engine plugin" -msgstr "" +msgstr "Kunne ikke finde passende motor udvidelse" #: common/error.cpp:68 -#, fuzzy msgid "Engine plugin does not support save states" -msgstr "Motor understøtter ikke fejlfindingsniveau '%s'" +msgstr "Motor udvidelse understøtter ikke gemmetilstande" #: common/error.cpp:71 msgid "User canceled" -msgstr "" +msgstr "Bruger annullerede" #: common/error.cpp:75 -#, fuzzy msgid "Unknown error" msgstr "Ukendt fejl" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." -msgstr "" +msgstr "Spillet i '%s' ser ud til at være ukendt." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" +"Venligst, rapportere følgende data til ScummVM holdet sammen med navnet" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" -msgstr "" +msgstr "på det spil, du forsøgte at tilføje og dets version/sprog/ etc.:" #: engines/dialogs.cpp:84 msgid "~R~esume" @@ -1128,23 +1158,23 @@ msgstr "H~j~ msgid "~A~bout" msgstr "~O~m" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~R~etur til spiloversigt" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~R~etur til oversigt" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Gemmer:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1153,51 +1183,54 @@ msgstr "Gemmer:" msgid "Save" msgstr "Gem" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" +"Beklager, denne motor leverer i øjeblikket ikke spil hjælp. Se venligst " +"README for grundlæggende oplysninger, og for at få instruktioner om, hvordan " +"man får yderligere hjælp." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" +"Gem af spiltilstand fejlede (%s)! Se venligst README for grundlæggende " +"oplysninger, og for at få instruktioner om, hvordan man får yderligere hjælp." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~F~ortryd" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~aster" #: engines/engine.cpp:235 msgid "Could not initialize color format." -msgstr "" +msgstr "Kunne ikke initialisere farveformat." #: engines/engine.cpp:243 -#, fuzzy msgid "Could not switch to video mode: '" -msgstr "Aktuel videotilstand:" +msgstr "Kunne ikke skifte til videotilstand: '" #: engines/engine.cpp:252 -#, fuzzy msgid "Could not apply aspect ratio setting." -msgstr "Skift billedformat korrektion" +msgstr "Kunne ikke anvende billedformat korrektion indstilling." #: engines/engine.cpp:257 msgid "Could not apply fullscreen setting." -msgstr "" +msgstr "Kunne ikke anvende fuldskærm indstilling." #: engines/engine.cpp:357 msgid "" @@ -1207,6 +1240,11 @@ msgid "" "the data files to your hard disk instead.\n" "See the README file for details." msgstr "" +"Det lader til at du spiller dette spil direkte\n" +"fra cd'en. Dette er kendt for at forårsage problemer,\n" +"og det anbefales derfor, at du kopierer\n" +"datafiler til din harddisk i stedet.\n" +"Se README fil for detaljer." #: engines/engine.cpp:368 msgid "" @@ -1216,6 +1254,11 @@ msgid "" "order to listen to the game's music.\n" "See the README file for details." msgstr "" +"Dette spil har lydspor på sin disk. Disse\n" +"spor skal rippes fra disken ved hjælp af\n" +"en passende CD audio udvindingsværktøj\n" +"for at lytte til spillets musik.\n" +"Se README fil for detaljer." #: engines/engine.cpp:426 #, c-format @@ -1223,6 +1266,9 @@ msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" +"Indlæsning af spiltilstand fejlede (%s)! Se venligst README for " +"grundlæggende oplysninger, og for at få instruktioner om, hvordan man får " +"yderligere hjælp." #: engines/engine.cpp:439 msgid "" @@ -1230,129 +1276,129 @@ msgid "" "ScummVM. As such, it is likely to be unstable, and any saves you make might " "not work in future versions of ScummVM." msgstr "" +"ADVARSEL: Spillet du er ved at starte endnu ikke er fuldt understøttet af " +"ScummVM. Således, er det sandsynligt, at det er ustabilt, og alle gemmer du " +"foretager fungerer muligvis ikke i fremtidige versioner af ScummVM." #: engines/engine.cpp:442 msgid "Start anyway" -msgstr "" +msgstr "Start alligevel" #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Brug original gem/indlæs skærme" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "" +msgstr "Brug de originale gem/indlæs skærme, istedet for dem fra ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Gendan spil:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Gendan" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Øverste højre punkt" +msgstr "Brug lys palet tilstand" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Vis grafik ved hjælp af spillets lyse palette" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA farveforøgelse" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Aktiver farveforøgelse i EGA spil der understøtter det" +msgstr "Aktiver farveforøgelse i EGA spil" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Lydstyrke for specielle lydeffekter" +msgstr "Foretræk digitale lydeffekter" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Foretræk digitale lydeffekter i stedet for syntetiserede" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Brug IMF/Yamaha FB-01 til MIDI-udgang" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Bruge et IBM Musik Feature-kort eller et Yamaha FB-01 FM synth modul til " +"MIDI-udgang" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Brug CD lyd" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "Brug cd-lyd i stedet for lyd fra spillet, hvis tilgængelige" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Brug Windows markør" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" -msgstr "" +msgstr "Brug Windows-markører (mindre og monokrome) i stedet for dem fra DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Normal markør" +msgstr "Brug sølv markør" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Brug det alternative sæt af sølv markører, i stedet for de normale gyldne" #: engines/scumm/dialogs.cpp:175 #, c-format msgid "Insert Disk %c and Press Button to Continue." -msgstr "" +msgstr "Indsæt Disk %c og Tryk på knappen for at fortsætte." #: engines/scumm/dialogs.cpp:176 #, c-format msgid "Unable to Find %s, (%c%d) Press Button." -msgstr "" +msgstr "Kunne ikke finde %s, (%c%d) Tryk på knappen." #: engines/scumm/dialogs.cpp:177 #, c-format msgid "Error reading disk %c, (%c%d) Press Button." -msgstr "" +msgstr "Fejl ved læsning af disk %c, (%c%d) Tryk på knappen." #: engines/scumm/dialogs.cpp:178 msgid "Game Paused. Press SPACE to Continue." -msgstr "" +msgstr "Spil sat på pause. Tryk MELLEMRUM for at fortsætte." #. I18N: You may specify 'Yes' symbol at the end of the line, like this: #. "Moechten Sie wirklich neu starten? (J/N)J" #. Will react to J as 'Yes' #: engines/scumm/dialogs.cpp:182 -#, fuzzy msgid "Are you sure you want to restart? (Y/N)" -msgstr " Er du sikker på at du vil afslutte ? " +msgstr "Er du sikker på at du vil genstarte? (J/N) " #. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment #: engines/scumm/dialogs.cpp:184 -#, fuzzy msgid "Are you sure you want to quit? (Y/N)" -msgstr " Er du sikker på at du vil afslutte ? " +msgstr "Er du sikker på at du vil afslutte? (J/N) " #: engines/scumm/dialogs.cpp:189 msgid "Play" -msgstr "" +msgstr "Spil" #: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82 #: engines/scumm/help.cpp:84 @@ -1365,42 +1411,41 @@ msgstr "Afslut" #: engines/scumm/dialogs.cpp:193 msgid "Insert save/load game disk" -msgstr "" +msgstr "Indsæt gem/indlæs spil disk" #: engines/scumm/dialogs.cpp:194 msgid "You must enter a name" -msgstr "" +msgstr "Du skal indtaste et name" #: engines/scumm/dialogs.cpp:195 msgid "The game was NOT saved (disk full?)" -msgstr "" +msgstr "Spillet blev ikke gemt (disk fuld?)" #: engines/scumm/dialogs.cpp:196 msgid "The game was NOT loaded" -msgstr "" +msgstr "Spillet blev IKKE indlæst" #: engines/scumm/dialogs.cpp:197 #, c-format msgid "Saving '%s'" -msgstr "" +msgstr "Gemmer '%s'" #: engines/scumm/dialogs.cpp:198 #, c-format msgid "Loading '%s'" -msgstr "" +msgstr "Indlæser '%s'" #: engines/scumm/dialogs.cpp:199 msgid "Name your SAVE game" -msgstr "" +msgstr "Navngiv din GEMMER" #: engines/scumm/dialogs.cpp:200 -#, fuzzy msgid "Select a game to LOAD" -msgstr "Vælg et tema" +msgstr "Vælg et spil at indlæse" #: engines/scumm/dialogs.cpp:201 msgid "Game title)" -msgstr "" +msgstr "Spil titel)" #. I18N: Previous page button #: engines/scumm/dialogs.cpp:287 @@ -1418,46 +1463,41 @@ msgid "~C~lose" msgstr "~L~uk" #: engines/scumm/dialogs.cpp:597 -#, fuzzy msgid "Speech Only" -msgstr "Tale" +msgstr "Kun tale" #: engines/scumm/dialogs.cpp:598 -#, fuzzy msgid "Speech and Subtitles" -msgstr "Undertekster" +msgstr "Tale og Undertekster" #: engines/scumm/dialogs.cpp:599 -#, fuzzy msgid "Subtitles Only" -msgstr "Undertekster" +msgstr "Kun undertekster" #: engines/scumm/dialogs.cpp:607 -#, fuzzy msgctxt "lowres" msgid "Speech & Subs" -msgstr "Tale" +msgstr "Tale & Tekst" #: engines/scumm/dialogs.cpp:653 msgid "Select a Proficiency Level." -msgstr "" +msgstr "Vælg et Færdighedsniveau." #: engines/scumm/dialogs.cpp:655 msgid "Refer to your Loom(TM) manual for help." -msgstr "" +msgstr "Se din Loom(TM) manual for hjælp." #: engines/scumm/dialogs.cpp:658 -#, fuzzy msgid "Standard" -msgstr "Standard (16bpp)" +msgstr "Standard" #: engines/scumm/dialogs.cpp:659 msgid "Practice" -msgstr "" +msgstr "Træning" #: engines/scumm/dialogs.cpp:660 msgid "Expert" -msgstr "" +msgstr "Ekspert" #: engines/scumm/help.cpp:73 msgid "Common keyboard commands:" @@ -1465,7 +1505,7 @@ msgstr "Almindelige tastatur kommandoer:" #: engines/scumm/help.cpp:74 msgid "Save / Load dialog" -msgstr "Gem / Hent dialog" +msgstr "Gem / Indlæs dialog" #: engines/scumm/help.cpp:76 msgid "Skip line of text" @@ -1497,7 +1537,7 @@ msgstr "Ctrl" #: engines/scumm/help.cpp:79 msgid "Load game state 1-10" -msgstr "Hent spil tilstand 1-10" +msgstr "Indlæs spil tilstand 1-10" #: engines/scumm/help.cpp:80 engines/scumm/help.cpp:84 #: engines/scumm/help.cpp:86 engines/scumm/help.cpp:100 @@ -1590,7 +1630,6 @@ msgid " since they may cause crashes" msgstr " siden de kan skabe nedbrud" #: engines/scumm/help.cpp:110 -#, fuzzy msgid " or incorrect game behavior." msgstr " eller ukorrekt opførsel af spil." @@ -1830,7 +1869,7 @@ msgstr "Komm" #: engines/scumm/help.cpp:246 msgid "Save / Load / Options" -msgstr "Gem / Hent / Indstillinger" +msgstr "Gem / Indlæs / Indstillinger" #: engines/scumm/help.cpp:255 msgid "Other game controls:" @@ -1979,8 +2018,10 @@ msgid "" "Native MIDI support requires the Roland Upgrade from LucasArts,\n" "but %s is missing. Using AdLib instead." msgstr "" +"Indbygget MIDI understøttelse kræver Roland opgradering fra LucasArts,\n" +"men %s mangler. Bruger AdLib i stedet." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1991,18 +2032,18 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" "\n" "%s" msgstr "" -"Mislykkedes at hente spil tilstand fra fil:\n" +"Mislykkedes at indlæse spil tilstand fra fil:\n" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2013,12 +2054,15 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " "directory inside the Tentacle game directory." msgstr "" +"Normalt ville Maniac Mansion begynde nu. Men ScummVM kan ikke gøre det " +"endnu. For at spille det, gå til 'Tilføj spil' i ScummVM start-menuen og " +"vælg 'Maniac' mappen inde i Tentacle spillets mappe." #. I18N: Option for fast scene switching #: engines/mohawk/dialogs.cpp:92 engines/mohawk/dialogs.cpp:171 @@ -2032,219 +2076,213 @@ msgstr "~O~vergange aktiveret" #. I18N: Drop book page #: engines/mohawk/dialogs.cpp:95 msgid "~D~rop Page" -msgstr "" +msgstr "Smi~d~ side" #: engines/mohawk/dialogs.cpp:99 msgid "~S~how Map" -msgstr "" +msgstr "Vi~s~ kort" #: engines/mohawk/dialogs.cpp:105 -#, fuzzy msgid "~M~ain Menu" -msgstr "ScummVM Hovedmenu" +msgstr "Hoved~m~enu" #: engines/mohawk/dialogs.cpp:172 msgid "~W~ater Effect Enabled" msgstr "~V~andeffekter aktiveret" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" -msgstr "" +msgstr "Filmsekvens fil '%s' ikke fundet!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 -#, fuzzy +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." -msgstr "" -"Mislykkedes at hente spil tilstand fra fil:\n" -"\n" -"%s" +msgstr "Mislykkedes at indlæse spil tilstand fra fil." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 -#, fuzzy +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." -msgstr "" -"Mislykkedes at gemme spil tilstand til fil:\n" -"\n" -"%s" +msgstr "Mislykkedes at gemme spil tilstand til fil." #: engines/gob/inter_v5.cpp:107 -#, fuzzy msgid "Failed to delete file." -msgstr "" -"Mislykkedes at gemme spil tilstand til fil:\n" -"\n" -"%s" +msgstr "Mislykkedes at slette fil." #: engines/groovie/script.cpp:420 -#, fuzzy msgid "Failed to save game" -msgstr "" -"Mislykkedes at gemme spil tilstand til fil:\n" -"\n" -"%s" +msgstr "Mislykkedes at gemme spil" #. I18N: Studio audience adds an applause and cheering sounds whenever #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Studio publikum" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Aktivér studio publikum" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Spring over støtte" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Tillad at tekst og filmsekvenser kan springes over" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Helium tilstand" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Aktivér Roland GS tilstand" +msgstr "Aktivér helium tilstand" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Jævn bevægelse" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Aktivér jævn bevægelse når du går" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Normal markør" +msgstr "Flydende markør" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Aktivér flydende markør" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "HP søjlegrafer" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Aktivér træfpoint (HP) søjlediagrammer" #: engines/kyra/lol.cpp:478 msgid "Attack 1" -msgstr "" +msgstr "Angreb 1" #: engines/kyra/lol.cpp:479 msgid "Attack 2" -msgstr "" +msgstr "Angreb 2" #: engines/kyra/lol.cpp:480 msgid "Attack 3" -msgstr "" +msgstr "Angreb 3" #: engines/kyra/lol.cpp:481 msgid "Move Forward" -msgstr "" +msgstr "Flyt fremad" #: engines/kyra/lol.cpp:482 msgid "Move Back" -msgstr "" +msgstr "Flyt bagud" #: engines/kyra/lol.cpp:483 msgid "Slide Left" -msgstr "" +msgstr "Flyt til venstre" #: engines/kyra/lol.cpp:484 -#, fuzzy msgid "Slide Right" -msgstr "Højre" +msgstr "Flyt til højre" #: engines/kyra/lol.cpp:485 -#, fuzzy msgid "Turn Left" -msgstr "Sluk" +msgstr "Drej til venstre" #: engines/kyra/lol.cpp:486 -#, fuzzy msgid "Turn Right" -msgstr "Pil til højre" +msgstr "Drej til højre" #: engines/kyra/lol.cpp:487 -#, fuzzy msgid "Rest" -msgstr "Gendan" +msgstr "Hvil" #: engines/kyra/lol.cpp:488 -#, fuzzy msgid "Options" -msgstr "~I~ndstillinger" +msgstr "Indstillinger" #: engines/kyra/lol.cpp:489 -#, fuzzy msgid "Choose Spell" -msgstr "Vælg" +msgstr "Vælg magi" #: engines/kyra/sound_midi.cpp:475 msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" +"Det lader til at du bruger en Generel MIDI-enhed,\n" +"men dit spil kun understøtter Roland MT32 MIDI.\n" +"Vi forsøger at kortlægge Roland MT32 instrumenterne til\n" +"dem i Generel MIDI. Trods det kan det ske\n" +"at nogle stykker ikke lyder korrekt." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Brug diskette versionens intro (kun CD version)" #: engines/sky/compact.cpp:130 msgid "" "Unable to find \"sky.cpt\" file!\n" "Please download it from www.scummvm.org" msgstr "" +"Kunne ikke finde \"sky.cpt\" filen!\n" +"Venligst download den fra www.scummvm.org" #: engines/sky/compact.cpp:141 msgid "" "The \"sky.cpt\" file has an incorrect size.\n" "Please (re)download it from www.scummvm.org" msgstr "" +"\"sky.cpt\" filen har en forkert størrelse.\n" +"Venligst (gen)hent den fra www.scummvm.org" + +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Diskette intro" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Brug diskette versionens intro (kun CD version)" #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" -msgstr "" +msgstr "PSX stream filmsekvens '%s' kan ikke afspilles i palette tilstand" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" msgstr "" +"DXA filmsekvenser fundet, men ScummVM er bygget uden zlib understøttelse" #: engines/sword1/animation.cpp:570 engines/sword2/animation.cpp:465 msgid "MPEG2 cutscenes are no longer supported" -msgstr "" +msgstr "MPEG2 filmsekvenser understøttes ikke længere" #: engines/sword1/animation.cpp:576 engines/sword2/animation.cpp:473 #, c-format msgid "Cutscene '%s' not found" -msgstr "" +msgstr "Filmsekvens '%s' ikke fundet" #: engines/sword1/control.cpp:863 msgid "" @@ -2256,6 +2294,13 @@ msgid "" "Press OK to convert them now, otherwise you will be asked again the next " "time you start the game.\n" msgstr "" +"ScummVM har konstateret, at du har gamle gemmer for Broken Sword 1, der skal " +"konverteres.\n" +"Det gamle gemte spil format understøttes ikke længere, så vil du ikke være i " +"stand til at indlæse dine spil, hvis du ikke konvertere dem.\n" +"\n" +"Tryk på OK for at konvertere dem nu, ellers vil du blive spurgt igen, næste " +"gang du starter spillet.\n" #: engines/sword1/control.cpp:1232 #, c-format @@ -2263,30 +2308,44 @@ msgid "" "Target new save game already exists!\n" "Would you like to keep the old save game (%s) or the new one (%s)?\n" msgstr "" +"Nyt gemt spil findes allerede!\n" +"Vil du gerne beholde det gamle gemte spil (%s) eller det nye (%s)?\n" #: engines/sword1/control.cpp:1235 msgid "Keep the old one" -msgstr "" +msgstr "Behold den gamle" #: engines/sword1/control.cpp:1235 msgid "Keep the new one" -msgstr "" +msgstr "Behold den nye" #: engines/sword1/logic.cpp:1633 msgid "This is the end of the Broken Sword 1 Demo" -msgstr "" +msgstr "Dette er slutningen af Broken Sword 1 demoen" #: engines/sword2/animation.cpp:435 msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" +"PSX filmsekvenser fundet, men ScummVM er bygget uden RGB farve understøttelse" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Vis labels på genstande" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Vis labels for genstande musen er henover" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2295,18 +2354,18 @@ msgid "" "Can't save game in slot %i\n" "\n" msgstr "" +"Kan ikke gemme spil på plads %i\n" +"\n" -#: engines/parallaction/saveload.cpp:211 -#, fuzzy +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." -msgstr "Indlæs spil:" +msgstr "Indlæser spil..." -#: engines/parallaction/saveload.cpp:226 -#, fuzzy +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." -msgstr "Gemmer:" +msgstr "Gemmer spil..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2315,18 +2374,28 @@ msgid "" "\n" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" +"ScummVM har konstateret, at du har gamle gemmer for Nippon Safes, der skal " +"omdøbes.\n" +"De gamle navne er ikke længere understøttet, så du vil ikke være i stand til " +"at indlæse dine spil, hvis du ikke konvertere dem.\n" +"\n" +"Tryk på OK for at konvertere dem nu, ellers vil du blive spurgt næste gang.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." -msgstr "" +msgstr "ScummVM konverterede med succes alle dine gemmer." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" "\n" "Please report to the team." msgstr "" +"ScummVM udskrev nogle advarsler i dit konsol vindue, og kan ikke garantere " +"at alle dine filer er blevet konverteret.\n" +"\n" +"Venligst rapportér til holdet." #: audio/fmopl.cpp:49 msgid "MAME OPL emulator" @@ -2342,11 +2411,13 @@ msgid "" "The selected audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" +"Den valgte lydenhed '%s' blev ikke fundet (kan f.eks være slukket eller " +"afbrudt)." #: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257 #: audio/mididrv.cpp:272 msgid "Attempting to fall back to the next available device..." -msgstr "" +msgstr "Forsøger at falde tilbage til den næste tilgængelig enhed..." #: audio/mididrv.cpp:221 #, c-format @@ -2354,6 +2425,7 @@ msgid "" "The selected audio device '%s' cannot be used. See log file for more " "information." msgstr "" +"Den valgte lydenhed '%s' kan ikke bruges. Se log filen for mere information." #: audio/mididrv.cpp:257 #, c-format @@ -2361,6 +2433,8 @@ msgid "" "The preferred audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" +"Den foretrukne lydenhed '%s' blev ikke fundet (kan f.eks være slukket eller " +"afbrudt)." #: audio/mididrv.cpp:272 #, c-format @@ -2368,6 +2442,8 @@ msgid "" "The preferred audio device '%s' cannot be used. See log file for more " "information." msgstr "" +"Den foretrukne lydenhed '%s' kan ikke bruges. Se log filen for mere " +"information." #: audio/null.h:43 msgid "No music" @@ -2390,7 +2466,6 @@ msgid "C64 Audio Emulator" msgstr "C64 lyd emulator" #: audio/softsynth/mt32.cpp:293 -#, fuzzy msgid "Initializing MT-32 Emulator" msgstr "Initialisere MT-32 emulator" @@ -2411,7 +2486,6 @@ msgid "Keymap:" msgstr "Tasteoversigt:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" msgstr " (Aktiv)" @@ -2421,7 +2495,7 @@ msgstr " (Aktiv)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr "(Blokeret)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2508,14 +2582,12 @@ msgid "Disable power off" msgstr "Deaktiver slukning" #: backends/platform/iphone/osys_events.cpp:300 -#, fuzzy msgid "Mouse-click-and-drag mode enabled." -msgstr "Pegeplade tilstand aktiveret." +msgstr "Muse-klik-og-træk tilstand aktiveret." #: backends/platform/iphone/osys_events.cpp:302 -#, fuzzy msgid "Mouse-click-and-drag mode disabled." -msgstr "Pegeplade tilstand deaktiveret." +msgstr "Muse-klik-og-træk tilstand deaktiveret." #: backends/platform/iphone/osys_events.cpp:313 msgid "Touchpad mode enabled." @@ -2525,11 +2597,11 @@ msgstr "Pegeplade tilstand aktiveret." msgid "Touchpad mode disabled." msgstr "Pegeplade tilstand deaktiveret." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Klik tilstand" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2537,12 +2609,11 @@ msgstr "" msgid "Left Click" msgstr "Venstre klik" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Midterste højre punkt" +msgstr "Miderste klik" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2550,7 +2621,6 @@ msgid "Right Click" msgstr "Højre klik" #: backends/platform/sdl/macosx/appmenu_osx.mm:78 -#, fuzzy msgid "Hide ScummVM" msgstr "Skjul ScummVM" @@ -2580,28 +2650,24 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 -#, fuzzy msgid "Enabled aspect ratio correction" -msgstr "Skift billedformat korrektion" +msgstr "Aktivér billedformat korrektion" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 -#, fuzzy msgid "Disabled aspect ratio correction" -msgstr "Skift billedformat korrektion" +msgstr "Deaktivér billedformat korrektion" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 -#, fuzzy +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" -msgstr "Skift mellem grafik filtre" +msgstr "Aktive grafik filtre:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 -#, fuzzy msgid "Windowed mode" -msgstr "Rendere tilstand:" +msgstr "Vindue tilstand" #: backends/graphics/opengl/opengl-graphics.cpp:135 msgid "OpenGL Normal" @@ -2616,21 +2682,20 @@ msgid "OpenGL Original" msgstr "OpenGL Original" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:415 -#, fuzzy msgid "Current display mode" -msgstr "Aktuel videotilstand:" +msgstr "Aktuel videotilstand" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:428 msgid "Current scale" -msgstr "" +msgstr "Aktuel skalering" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:558 msgid "Active filter mode: Linear" -msgstr "" +msgstr "Aktiv filter tilstand: Linær" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:560 msgid "Active filter mode: Nearest" -msgstr "" +msgstr "Aktiv filter tilstand: Nærmest" #: backends/platform/symbian/src/SymbianActions.cpp:38 #: backends/platform/wince/CEActionsSmartphone.cpp:39 @@ -2812,17 +2877,15 @@ msgid "Network down" msgstr "Netværk nede" #: backends/platform/wii/options.cpp:178 -#, fuzzy msgid "Initializing network" msgstr "Initialisere netværk" #: backends/platform/wii/options.cpp:182 -#, fuzzy msgid "Timeout while initializing network" msgstr "Tidsgrænse nået ved initialisering af netværk" #: backends/platform/wii/options.cpp:186 -#, fuzzy, c-format +#, c-format msgid "Network not initialized (%d)" msgstr "Netværk ikke initialiseret (%d)" @@ -2882,12 +2945,12 @@ msgstr "Pil til h #: backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Do you want to load or save the game?" -msgstr "Vil du hente eller gemme spillet?" +msgstr "Vil du indlæse eller gemme spillet?" #: backends/platform/wince/CEActionsPocket.cpp:326 #: backends/platform/wince/CEActionsSmartphone.cpp:287 msgid " Are you sure you want to quit ? " -msgstr " Er du sikker på at du vil afslutte ? " +msgstr " Er du sikker på at du vil afslutte? " #: backends/platform/wince/CEActionsSmartphone.cpp:50 msgid "Keyboard" @@ -2944,95 +3007,86 @@ msgstr "" "hele oversigten" #: backends/events/default/default-events.cpp:191 -#, fuzzy msgid "Do you really want to return to the Launcher?" -msgstr "Vil du virkelig slette denne gemmer?" +msgstr "Vil du virkelig gå tilbage til oversigten?" #: backends/events/default/default-events.cpp:191 -#, fuzzy msgid "Launcher" -msgstr "Slag" +msgstr "Oversigt" #: backends/events/default/default-events.cpp:213 -#, fuzzy msgid "Do you really want to quit?" -msgstr "Vil du afslutte?" +msgstr "Vil du virkelig afslutte?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" -msgstr "" +msgstr "Touchscreen 'Tap Mode' - Venstre Klik" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" -msgstr "" +msgstr "Touchscreen 'Tap Mode' - Højre Klik" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" -msgstr "" +msgstr "Touchscreen 'Tap Mode' - Henover (Ingen Klik)" -#: backends/events/gph/gph-events.cpp:362 -#, fuzzy +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" -msgstr "Lydstyrke" +msgstr "Maximal lydstyrke" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" -msgstr "" +msgstr "Hæver lydstyrke" -#: backends/events/gph/gph-events.cpp:370 -#, fuzzy +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" -msgstr "Lydstyrke" +msgstr "Minimal lydstyrke" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" -msgstr "" +msgstr "Sænker lydstyrke" #: backends/updates/macosx/macosx-updates.mm:65 msgid "Check for Updates..." -msgstr "" +msgstr "Søg efter opdateringer..." #: backends/platform/bada/form.cpp:269 -#, fuzzy msgid "Right Click Once" -msgstr "Højre klik" +msgstr "Enkelt højre klik" #: backends/platform/bada/form.cpp:277 -#, fuzzy msgid "Move Only" -msgstr "Tale" +msgstr "Flyt kun" #: backends/platform/bada/form.cpp:291 msgid "Escape Key" -msgstr "" +msgstr "Escape tast" #: backends/platform/bada/form.cpp:296 -#, fuzzy msgid "Game Menu" -msgstr "Spil" +msgstr "Spil menu" #: backends/platform/bada/form.cpp:301 -#, fuzzy msgid "Show Keypad" msgstr "Vis tastatur" #: backends/platform/bada/form.cpp:309 msgid "Control Mouse" -msgstr "" +msgstr "Kontrollér mus" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Enabled" -msgstr "" +msgstr "Klik aktiveret" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Disabled" -msgstr "" +msgstr "Klik deaktiveret" #~ msgid "Hercules Green" #~ msgstr "Hercules grøn" diff --git a/po/de_DE.po b/po/de_DE.po index e11a3d4fc7e7..a18bfb7ca6cd 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -5,17 +5,17 @@ # msgid "" msgstr "" -"Project-Id-Version: ScummVM 1.4.0git\n" +"Project-Id-Version: ScummVM 1.5.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2012-01-29 21:11+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-14 22:49+0100\n" "Last-Translator: Simon Sawatzki \n" "Language-Team: Simon Sawatzki (Lead), Lothar Serra Mari " -" (Contributor)\n" +"(Contributor)\n" +"Language: Deutsch\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Deutsch\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: gui/about.cpp:91 @@ -46,10 +46,11 @@ msgstr "Pfad hoch" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -79,9 +80,8 @@ msgid "Remap keys" msgstr "Tasten neu zuweisen" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" -msgstr "Vollbild-/Fenster-Modus" +msgstr "Vollbild EIN/AUS" #: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145 msgid "Choose an action to map" @@ -93,16 +93,16 @@ msgstr "Zuweisen" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -195,9 +195,8 @@ msgid "Platform:" msgstr "Plattform:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Betrachte" +msgstr "Engine" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -443,14 +442,14 @@ msgstr "In Spieleliste suchen" msgid "Search:" msgstr "Suchen:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Spiel laden:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Laden" @@ -613,7 +612,7 @@ msgstr "" "Spezielle Farbmischungsmethoden werden von manchen Spielen unterstützt." #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Vollbildmodus" @@ -788,7 +787,7 @@ msgstr "Spr." #: gui/options.cpp:931 msgid "Subs" -msgstr "TXT" +msgstr "Text" #: gui/options.cpp:932 msgctxt "lowres" @@ -933,69 +932,108 @@ msgid "" "The theme you selected does not support your current language. If you want " "to use this theme you need to switch to another language first." msgstr "" +"Das ausgewählte Thema unterstützt nicht die aktuelle Sprache. Wenn Sie " +"dieses Thema benutzen wollen, müssen Sie erst zu einer anderen Sprache " +"wechseln." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Kein Datum gespeichert" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Keine Zeit gespeichert" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Keine Spielzeit gespeichert" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Löschen" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Diesen Spielstand wirklich löschen?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Datum: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Zeit: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Spieldauer: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Unbenannt" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Speichern" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Konnte Spielstand nicht speichern." + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Name:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Thema auswählen" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX ausgeschaltet" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX ausgeschaltet" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard-Renderer (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Kantenglättung (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Kantenglättung (16bpp)" @@ -1099,18 +1137,18 @@ msgstr "Abbruch durch Benutzer" msgid "Unknown error" msgstr "Unbekannter Fehler" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Das Spiel im Verzeichnis \"%s\" scheint nicht bekannt zu sein." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "Bitte geben Sie die folgenden Daten auf Englisch an das ScummVM-Team weiter " "sowie" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "" "den Namen des Spiels, das Sie hinzufügen wollten, als auch die Version/" @@ -1140,23 +1178,23 @@ msgstr "~H~ilfe" msgid "~A~bout" msgstr "Übe~r~" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "Zur Spiele~l~iste zurück" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "Zur Spiele~l~iste" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Speichern:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1165,37 +1203,35 @@ msgstr "Speichern:" msgid "Save" msgstr "Speichern" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" "Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-" -"Datei für grundlegende Informationen und Anweisungen dazu, wie man an " -"weitere Hilfe gelangt." +"Datei für grundlegende Informationen und Anweisungen zu weiterer Hilfe." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-" -"Datei für grundlegende Informationen und Anweisungen dazu, wie man an " -"weitere Hilfe gelangt." +"Speichern des Spielstands %s fehlgeschlagen! Bitte lesen Sie die Liesmich-" +"Datei für grundlegende Informationen und Anweisungen zu weiterer Hilfe." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~bbrechen" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~asten" @@ -1247,14 +1283,13 @@ msgstr "" "Liesmich-Datei für weitere Informationen." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Leider bietet diese Engine keine Spielhilfe. Bitte lesen Sie die Liesmich-" -"Datei für grundlegende Informationen und Anweisungen dazu, wie man an " -"weitere Hilfe gelangt." +"Laden des Spielstands %s fehlgeschlagen! Bitte lesen Sie die Liesmich-Datei " +"für grundlegende Informationen und Anweisungen zu weiterer Hilfe." #: engines/engine.cpp:439 msgid "" @@ -1274,86 +1309,87 @@ msgstr "Trotzdem starten" #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Originale Spielstand-Menüs" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"Verwendet die originalen Menüs zum Speichern und Laden statt der von ScummVM." -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Spiel laden:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Laden" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Oberer rechter Gegenstand" +msgstr "Modus für helle Palette verwenden" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Zeigt Grafiken über helle Spielpalette an." #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "Antifehlerdiffusion für EGA" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "" -"Aktiviert die Aufhebung der Fehlerdiffusion in EGA-Spielen, die dies " -"unterstützen." +msgstr "Aktiviert die Aufhebung der Fehlerdiffusion in EGA-Spielen." #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Lautstärke spezieller Soundeffekte" +msgstr "Digitale Sound-Effekte bevorzugen" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Bevorzugt digitale Sound-Effekte statt synthethisierter." #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "IMF/Yamaha FB-01 für MIDI-Ausgabe verwenden" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Verwendet eine Music-Feature-Karte von IBM oder ein Yamaha-FB-01-FM-" +"Synthetisierungsmodul für die MIDI-Ausgabe." #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "CD-Ton verwenden" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "Verwendet CD-Ton anstatt des Tons im Spiel, sofern verfügbar." #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Windows-Mauszeiger verwenden" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"Verwendet die Windows-Mauszeiger (kleiner und schwarz-weiß) anstatt der von " +"DOS." #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Normaler Mauszeiger" +msgstr "Silberne Mauszeiger verwenden" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Verwendet alternativen Satz silberner Mauszeiger anstatt der normalen " +"goldenen." #: engines/scumm/dialogs.cpp:175 #, c-format @@ -2008,10 +2044,11 @@ msgid "" "Native MIDI support requires the Roland Upgrade from LucasArts,\n" "but %s is missing. Using AdLib instead." msgstr "" -"Systemeigene MIDI-Ünterstützung erfordert das Roland-Upgrade von LucasArts,\n" -"aber %s fehlt. Stattdessen wird AdLib verwendet." +"Systemeigene MIDI-Ünterstützung erfordert das\n" +"Roland-Upgrade von LucasArts, aber %s\n" +"fehlt. Stattdessen wird AdLib verwendet." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2022,7 +2059,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2033,7 +2070,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2044,7 +2081,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2081,17 +2118,17 @@ msgstr "Haupt~m~en msgid "~W~ater Effect Enabled" msgstr "~W~assereffekt aktiviert" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Zwischensequenz \"%s\" nicht gefunden!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Konnte Spielstand aus Datei nicht laden." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Konnte Spielstand nicht in Datei speichern." @@ -2107,61 +2144,59 @@ msgstr "Konnte Spielstand nicht speichern." #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Studio-Publikum" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Aktiviert Studio-Publikum." #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Überspring-Unterstützung" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Erlaubt das Überspringen von Textteilen und Zwischensequenzen." #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Helium-Modus" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Roland-GS-Modus" +msgstr "Aktiviert Helium-Modus." #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Gleichmäßiges Scrollen" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Aktiviert gleichmäßiges Scrollen beim Gehen." #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Normaler Mauszeiger" +msgstr "Richtungspfeil-Mauszeiger" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Aktiviert Richtungspfeil-Mauszeiger." #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Trefferpunkte-Balken" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Aktiviert grafische Trefferpunkte-Balken." #: engines/kyra/lol.cpp:478 msgid "Attack 1" @@ -2216,23 +2251,25 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Sie scheinen ein General-MIDI-Gerät zu\n" "verwenden, aber das Spiel unterstützt nur\n" -"Roland MT-32 MIDI. Es wird versucht, die\n" -"Roland-MT-32-Instrumente denen von General MIDI\n" -"zuzuordnen. Es kann jedoch vorkommen, dass ein\n" -"paar Musikstücke nicht richtig abgespielt werden." +"Roland MT32 MIDI. Es wird versucht, die\n" +"Roland-MT32-Instrumente denen von\n" +"General MIDI zuzuordnen. Es ist dennoch\n" +"möglich, dass ein paar Musikstücke nicht\n" +"richtig abgespielt werden." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Verwendet den Vorspann der Diskettenversion (nur bei CD-Version)." #: engines/sky/compact.cpp:130 msgid "" @@ -2252,10 +2289,19 @@ msgstr "" "Bitte laden Sie diese Datei (erneut) von\n" "www.scummvm.org herunter." +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Disketten-Vorspann" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Verwendet den Vorspann der Diskettenversion (nur bei CD-Version)." + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" msgstr "" +"PSX-Zwischensequenz \"%s\" kann in Palettenmodus nicht wiedergegeben werden." #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2282,13 +2328,13 @@ msgid "" "Press OK to convert them now, otherwise you will be asked again the next " "time you start the game.\n" msgstr "" -"ScummVM hat erkannt, dass Sie alte Speicherstände von Baphomets Fluch 1 " -"haben, die umgewandelt werden sollten.\n" -"Das alte Spielstandsformat wird nicht mehr unterstützt, also können Sie " -"diese Speicherstände nicht laden, wenn Sie diese nicht konvertieren.\n" +"ScummVM hat erkannt, dass Sie alte Spielstände von Baphomets Fluch 1 haben, " +"die umgewandelt werden sollten.\n" +"Das alte Speicherformat wird nicht mehr unterstützt, also können Sie diese " +"Spielstände unkonvertiert nicht laden.\n" "\n" -"Klicken Sie auf OK, um diese jetzt umzuwandeln, ansonsten werden Sie erneut " -"gefragt, wenn Sie das nächste Mal dieses Spiel starten.\n" +"Klicken Sie auf OK, um diese jetzt umzuwandeln, sonst werden Sie erneut " +"gefragt, wenn Sie nächstes Mal dieses Spiel starten.\n" #: engines/sword1/control.cpp:1232 #, c-format @@ -2312,19 +2358,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "Das ist das Ende der Demo von Broken Sword 1 (Baphomets Fluch 1)." #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"DXA-Zwischensequenzen gefunden, aber ScummVM wurde ohne Zlib-Unterstützung " -"erstellt." +"PSX-Zwischensequenzen gefunden, aber ScummVM wurde ohne Unterstützung für " +"RGB-Farben erstellt." #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Objektnamen zeigen" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Zeigt Objektbeschriftungen bei Mausberührung an." + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2336,15 +2392,15 @@ msgstr "" "Kann Spiel nicht speichern auf Speicherplatz %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Spiel wird geladen..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Spiel wird gespeichert..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2353,19 +2409,19 @@ msgid "" "\n" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" -"ScummVM hat erkannt, dass Sie alte Speicherstände von Nippon Safes haben, " -"die umbenannt werden sollten.\n" +"ScummVM hat erkannt, dass Sie alte Spielstände von Nippon Safes haben, die " +"umbenannt werden sollten.\n" "Die alten Dateinamen werden nicht mehr unterstützt, also können Sie diese " -"Speicherstände nicht laden, wenn Sie diese nicht konvertieren.\n" +"Spielstände unkonvertiert nicht laden.\n" "\n" -"Klicken Sie auf OK, um diese jetzt umzuwandeln, ansonsten werden Sie erneut " -"gefragt, wenn Sie das nächste Mal dieses Spiel starten.\n" +"Klicken Sie auf OK, um diese jetzt umzuwandeln, sonst werden Sie erneut " +"gefragt, wenn Sie nächstes Mal dieses Spiel starten.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM hat alle Speicherstände erfolgreich umgewandelt." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2467,9 +2523,8 @@ msgid "Keymap:" msgstr "Tasten-Layout:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" -msgstr " (Aktiv)" +msgstr " (Aktuell)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Active)" @@ -2477,7 +2532,7 @@ msgstr " (Aktiv)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (Blockiert)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2579,11 +2634,11 @@ msgstr "Touchpad-Modus aktiviert." msgid "Touchpad mode disabled." msgstr "Touchpad-Modus ausgeschaltet." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Klickmodus" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2591,12 +2646,11 @@ msgstr "" msgid "Left Click" msgstr "Linksklick" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Mittlerer linker Gegenstand" +msgstr "Mittelklick" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2633,21 +2687,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal ohn.Skalieren" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Seitenverhältniskorrektur an" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Seitenverhältniskorrektur aus" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Aktiver Grafikfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Fenstermodus" @@ -3002,37 +3056,37 @@ msgstr "Spieleliste" msgid "Do you really want to quit?" msgstr "Möchten Sie wirklich beenden?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Berührungsbildschirm-Tipp-Modus - Linksklick" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Berührungsbildschirm-Tipp-Modus - Rechtsklick" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Berührungsbildschirm-Tipp-Modus - schweben (kein Klick)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Höchste Lautstärke" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Lautstärke höher" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Niedrigste Lautstärke" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Lautstärke niedriger" diff --git a/po/es_ES.po b/po/es_ES.po index 366dcf490549..9f767dacfa62 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.4.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-10-23 21:53+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-08 18:19+0100\n" "Last-Translator: Tomás Maidagan\n" "Language-Team: \n" +"Language: Espanol\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Espanol\n" #: gui/about.cpp:91 #, c-format @@ -44,10 +44,11 @@ msgstr "Arriba" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -77,7 +78,6 @@ msgid "Remap keys" msgstr "Asignar teclas" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "Activar pantalla completa" @@ -91,16 +91,16 @@ msgstr "Asignar" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "Aceptar" @@ -193,9 +193,8 @@ msgid "Platform:" msgstr "Plat.:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Examinar" +msgstr "Motor" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -439,14 +438,14 @@ msgstr "Buscar en la lista de juegos" msgid "Search:" msgstr "Buscar:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Cargar juego:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Cargar" @@ -604,10 +603,10 @@ msgstr "Renderizado:" #: gui/options.cpp:741 gui/options.cpp:742 msgid "Special dithering modes supported by some games" -msgstr "Modos especiales de expansión soportados por algunos juegos" +msgstr "Modos especiales de expansión compatibles con algunos juegos" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Pantalla completa" @@ -692,8 +691,8 @@ msgstr "SoundFont:" #: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852 msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity" msgstr "" -"SoundFont está soportado por algunas tarjetas de sonido, además de " -"Fluidsynth y Timidity" +"SoundFont es compatible con algunas tarjetas de sonido, con Fluidsynth y con " +"Timidity" #: gui/options.cpp:851 msgctxt "lowres" @@ -895,7 +894,7 @@ msgstr "Idioma de la interfaz de ScummVM" #: gui/options.cpp:1347 msgid "You have to restart ScummVM before your changes will take effect." -msgstr "Tienes que reiniciar ScummVM para que los cambios surjan efecto." +msgstr "Tienes que reiniciar ScummVM para aplicar los cambios." #: gui/options.cpp:1360 msgid "Select directory for savegames" @@ -926,68 +925,104 @@ msgstr "" "El tema seleccionado no es compatible con el idioma actual. Si quieres usar " "este tema debes cambiar a otro idioma primero." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "No hay fecha guardada" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "No hay hora guardada" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "No hay tiempo guardado" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Borrar" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "¿Seguro que quieres borrar esta partida?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Fecha: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Hora: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Tiempo: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Partida sin nombre" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Guardar" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Fallo al guardar la partida" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nombre:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Selecciona un tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX desactivados" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX desactivados" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Estándar (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Estándar (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Suavizado (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Suavizado (16bpp)" @@ -998,7 +1033,7 @@ msgstr "Eliminar valor" #: base/main.cpp:209 #, c-format msgid "Engine does not support debug level '%s'" -msgstr "El motor no soporta el nivel de debug '%s'" +msgstr "El motor no es compatible con el nivel de debug '%s'" #: base/main.cpp:287 msgid "Menu" @@ -1037,11 +1072,11 @@ msgstr "No se han encontrado datos de juego" #: common/error.cpp:42 msgid "Game id not supported" -msgstr "ID del juego no soportada" +msgstr "ID del juego no compatible" #: common/error.cpp:44 msgid "Unsupported color mode" -msgstr "Modo de color no soportado" +msgstr "Modo de color no compatible" #: common/error.cpp:47 msgid "Read permission denied" @@ -1091,16 +1126,16 @@ msgstr "Cancel msgid "Unknown error" msgstr "Error desconocido" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "El juego en '%s' parece ser desconocido." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Por favor, envía al equipo de ScummVM esta información junto al nombre" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "del juego que has intentado añadir y su versión/idioma/etc.:" @@ -1128,23 +1163,23 @@ msgstr "~A~yuda" msgid "~A~bout" msgstr "Acerca ~d~e" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~V~olver al lanzador" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~V~olver al lanzador" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Guardar partida" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1153,7 +1188,7 @@ msgstr "Guardar partida" msgid "Save" msgstr "Guardar" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1163,27 +1198,27 @@ msgstr "" "consulta el archivo README para encontrar información básica e instrucciones " "para obtener más ayuda." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Lo sentimos, aún no hay ayuda disponible para este juego. Por favor, " -"consulta el archivo README para encontrar información básica e instrucciones " -"para obtener más ayuda." +"Ha habido un fallo al guardar la partida (%s). Por favor, consulta el " +"archivo README para encontrar información básica e instrucciones sobre cómo " +"obtener más ayuda." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~S~í" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~C~ancelar" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~eclas" @@ -1232,14 +1267,14 @@ msgstr "" "Consulta el archivo README para más detalles." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Lo sentimos, aún no hay ayuda disponible para este juego. Por favor, " -"consulta el archivo README para encontrar información básica e instrucciones " -"para obtener más ayuda." +"Ha habido un fallo al cargar la partida (%s). Por favor, consulta el archivo " +"README para encontrar información básica e instrucciones sobre cómo obtener " +"más ayuda." #: engines/engine.cpp:439 msgid "" @@ -1253,89 +1288,90 @@ msgstr "" #: engines/engine.cpp:442 msgid "Start anyway" -msgstr "Jugar de todos modos" +msgstr "Jugar aun así" #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Usar pantallas de guardar/cargar originales" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"Utilizar las pantallas de guardar/cargar originales, en vez de las de ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Cargar partida:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Cargar" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Objeto superior derecho" +msgstr "Usar paleta original" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Utilizar los niveles de brillo originales del juego" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "Difuminado EGA" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Activar difuminado en los juegos EGA compatibles" +msgstr "Activar difuminado en los juegos EGA" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Volumen de los efectos de sonido" +msgstr "Preferir efectos de sonido digitales" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Preferir efectos de sonido digitales en vez de los sintetizados" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Usar IMF/Yamaha FB-01 para la salida MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Usa una tarjeta IBM Music o un módulo sintetizador Yamaha FB-01 FM para la " +"salida MIDI" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Usar CD audio" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "Usa CD audio en vez del sonido interno del juego, si está disponible" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Usar cursores de Windows" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"Usar los cursores de Windows (más pequeños y monocromos) en vez de los de DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Cursor normal" +msgstr "Usar cursores plateados" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Usar los cursores plateados alternativos, en vez de los dorados normales" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1457,7 +1493,7 @@ msgstr "Selecciona un nivel de dificultad." #: engines/scumm/dialogs.cpp:655 msgid "Refer to your Loom(TM) manual for help." -msgstr "Mira en el Manual para mayor información." +msgstr "Consulta el manual para obtener más información." #: engines/scumm/dialogs.cpp:658 msgid "Standard" @@ -1993,7 +2029,7 @@ msgstr "" "El soporte MIDI nativo requiere la actualización Roland de LucasArts,\n" "pero %s no está disponible. Se usará AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2004,7 +2040,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2015,7 +2051,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2026,7 +2062,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2062,17 +2098,17 @@ msgstr "~M~en msgid "~W~ater Effect Enabled" msgstr "Efecto ag~u~a activado" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "No se ha encontrado el vídeo '%s'" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Fallo al cargar el estado del juego desde el archivo." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Fallo al guardar el estado del juego en el archivo." @@ -2088,137 +2124,131 @@ msgstr "Fallo al guardar la partida" #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Risas del público" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Activa las risas del público" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Permitir omisiones" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Permite saltarse frases y vídeos" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Modo helio" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Activar modo Roland GS" +msgstr "Activa el modo helio" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Desplazamiento suave" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Activa el desplazamiento de pantalla suave al caminar" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Cursor normal" +msgstr "Cursores flotantes" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Activar cursores flotantes" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Barras de energía" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Activa las barras de energía" #: engines/kyra/lol.cpp:478 msgid "Attack 1" -msgstr "" +msgstr "Ataque 1" #: engines/kyra/lol.cpp:479 msgid "Attack 2" -msgstr "" +msgstr "Ataque 2" #: engines/kyra/lol.cpp:480 msgid "Attack 3" -msgstr "" +msgstr "Ataque 3" #: engines/kyra/lol.cpp:481 msgid "Move Forward" -msgstr "" +msgstr "Avanzar" #: engines/kyra/lol.cpp:482 msgid "Move Back" -msgstr "" +msgstr "Retroceder" #: engines/kyra/lol.cpp:483 msgid "Slide Left" -msgstr "" +msgstr "Deslizarse a la izquierda" #: engines/kyra/lol.cpp:484 -#, fuzzy msgid "Slide Right" -msgstr "Derecha" +msgstr "Deslizarse a la derecha" #: engines/kyra/lol.cpp:485 -#, fuzzy msgid "Turn Left" -msgstr "Apagar" +msgstr "Girar a la izquierda" #: engines/kyra/lol.cpp:486 -#, fuzzy msgid "Turn Right" -msgstr "Derecha" +msgstr "Girar a la derecha" #: engines/kyra/lol.cpp:487 -#, fuzzy msgid "Rest" -msgstr "Cargar" +msgstr "Descansar" #: engines/kyra/lol.cpp:488 -#, fuzzy msgid "Options" -msgstr "~O~pciones" +msgstr "Opciones" #: engines/kyra/lol.cpp:489 -#, fuzzy msgid "Choose Spell" -msgstr "Aceptar" +msgstr "Elegir hechizo" #: engines/kyra/sound_midi.cpp:475 msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" -"Estás usando un dispositivo General Midi,\n" -"pero el juego solo soporta MIDI Roland MT32.\n" +"Estás usando un dispositivo General MIDI, pero el\n" +"juego solo es compatible con MIDI Roland MT32.\n" "Intentamos adaptar los instrumentos Roland MT32\n" "a los de General MIDI, pero es posible que algunas\n" -"de las pistas no se reproduzcan correctamente." +"de las pistas no suenen correctamente." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" msgstr "" +"Usa la introducción de la versión en disquete (solo para la versión CD)" #: engines/sky/compact.cpp:130 msgid "" @@ -2236,10 +2266,19 @@ msgstr "" "El archivo \"sky.cpt\" tiene un tamaño incorrecto.\n" "Por favor, vuelve a bajarlo de www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Intro de disquete" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" +"Usa la introducción de la versión en disquete (solo para la versión CD)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" -msgstr "" +msgstr "El vídeo de PSX '%s' no se puede reproducir en modo paleta" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2295,18 +2334,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "Este es el final de la demo de Broken Sword 1" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"Se han encontrado vídeos DXA, pero se ha compilado ScummVM sin soporte zlib" +"Se han encontrado vídeos PSX, pero se ha compilado ScummVM sin soporte de " +"color RGB" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Mostrar etiquetas de objetos" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Muestra las etiquetas de los objetos al pasar el ratón" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2318,15 +2368,15 @@ msgstr "" "No se puede guardar en la ranura %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Cargando partida..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Guardando partida..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2343,11 +2393,11 @@ msgstr "" "Pulsa Aceptar para actualizarlos, si no lo haces este mensaje volverá a " "aparecer la próxima vez.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM ha convertido todas las partidas guardadas correctamente." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2449,7 +2499,6 @@ msgid "Keymap:" msgstr "Asignación de teclas:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" msgstr "(Activa)" @@ -2459,7 +2508,7 @@ msgstr "(Activa)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr "(Bloqueado)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2561,11 +2610,11 @@ msgstr "Modo Touchpad activado." msgid "Touchpad mode disabled." msgstr "Modo Touchpad desactivado." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Modo clic" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2573,12 +2622,11 @@ msgstr "" msgid "Left Click" msgstr "Clic izquierdo" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Objeto izquierdo del medio" +msgstr "Clic central" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2615,21 +2663,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Activar la corrección de aspecto" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Desactivar la corrección de aspecto" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Filtro de gráficos activo:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Modo ventana" @@ -2983,43 +3031,43 @@ msgstr "Lanzador" msgid "Do you really want to quit?" msgstr "¿Realmente quieres salir?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "'Modo toque' de pantalla táctil - Clic izquierdo" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "'Modo toque' de pantalla táctil - Clic derecho" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "'Modo toque' de pantalla táctil - Flotante (sin clic)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Volumen máximo" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Aumentando el volumen" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Volumen mínimo" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Bajando el volumen" #: backends/updates/macosx/macosx-updates.mm:65 msgid "Check for Updates..." -msgstr "Comprobando las actualizaciones..." +msgstr "Buscar actualizaciones..." #: backends/platform/bada/form.cpp:269 msgid "Right Click Once" diff --git a/po/eu.po b/po/eu.po index 7df042dc14a0..b0fd177575d9 100644 --- a/po/eu.po +++ b/po/eu.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.5.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" "PO-Revision-Date: 2011-12-15 14:53+0100\n" "Last-Translator: Mikel Iturbe Urretxa \n" "Language-Team: Librezale \n" +"Language: Euskara\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Euskara\n" #: gui/about.cpp:91 #, c-format @@ -44,10 +44,11 @@ msgstr "Joan gora" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -90,16 +91,16 @@ msgstr "Esleitu" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "Ados" @@ -437,14 +438,14 @@ msgstr "Bilatu joko-zerrendan" msgid "Search:" msgstr "Bilatu:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Jokoa kargatu:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Kargatu" @@ -608,7 +609,7 @@ msgid "Special dithering modes supported by some games" msgstr "Joko batzuk onarturiko lausotze-modu bereziak" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Pantaila osoa" @@ -925,68 +926,104 @@ msgstr "" "Aukeraturiko gaia ez da zure hizkuntzarekin bateragarria. Gai hau erabili " "nahi baduzu, aurretik beste hizkuntza batera pasa behar duzu." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Ez dago datarik gordeta" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Ez dago ordurik gordeta" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Ez dago denborarik gordeta" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Ezabatu" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Ezabatu partida gorde hau?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Data:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Ordua" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Denbora:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Titulurik gabeko partida" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Gorde" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Ezin izan da jokoa gorde" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Izena:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Gaia aukeratu" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX desgaituta" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX desgaituta" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Estandarra (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Estandarra (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Lausotua (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Lausotua (16bpp)" @@ -1090,16 +1127,16 @@ msgstr "Erabiltzaileak utzia" msgid "Unknown error" msgstr "Errore ezezaguna" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "'%s'-(e)ko jokoa ezezaguna dela dirudi" -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Mesedez, bidali hurrengo datuak ScummVM taldeari gehitzen saiatu zaren" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "jokoaren izen, bertsio/hizkuntza/e.a.-ekin batera:" @@ -1127,23 +1164,23 @@ msgstr "~L~aguntza" msgid "~A~bout" msgstr "Ho~n~i buruz" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "It~z~uli abiarazlera" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "It~z~uli abiarazlera" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Gorde jokoa:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1152,7 +1189,7 @@ msgstr "Gorde jokoa:" msgid "Save" msgstr "Gorde" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1161,7 +1198,7 @@ msgstr "" "Barkatu, motore honek ez du joko barruan laguntzarik eskaintzen. Jo ezazu " "README-ra oinarrizko informaziorako eta laguntza gehiago nola jaso jakiteko." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " @@ -1170,17 +1207,17 @@ msgstr "" "Jokoaren egoera gordetzeak huts egin du (%s)! Jo ezazu README-ra oinarrizko " "informaziorako eta laguntza gehiago nola jaso jakiteko." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~A~dos" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~U~tzi" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~eklak" @@ -1261,11 +1298,11 @@ msgstr "" msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Jokoa kargatu:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Kargatu" @@ -1297,12 +1334,12 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" +msgid "Use IMF/Yamaha FB-01 for MIDI output" msgstr "" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" @@ -1989,7 +2026,7 @@ msgstr "" "MIDI euskarri natiboak LucasArts-en Roland eguneraketa behar du,\n" "baina %s ez dago eskuragarri. AdLib erabiliko da." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2000,7 +2037,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2011,7 +2048,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2022,7 +2059,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2058,17 +2095,17 @@ msgstr "Menu ~n~agusia" msgid "~W~ater Effect Enabled" msgstr "~U~r-efektua gaituta" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "'%s' bideo fitxategia ez da aurkitu!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Ezin izan da fitxategitik jokoa kargatu." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Ezin izan da jokoa fitxategira gorde." @@ -2189,12 +2226,13 @@ msgid "Choose Spell" msgstr "Sorginkeria aukeratu" #: engines/kyra/sound_midi.cpp:475 +#, fuzzy msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "General MIDI gailua erabiltzen zaudela dirudi,\n" "baina zure jokoak Roland MT32 MIDI bakarrik\n" @@ -2202,12 +2240,12 @@ msgstr "" "General MIDIkoetara egokitzen saiatuko gara,\n" "baina posible da pista batzuk egoki ez entzutea." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" msgstr "" #: engines/sky/compact.cpp:130 @@ -2226,6 +2264,14 @@ msgstr "" "\"sky.cpt\" fitxategiak tamaina desegokia du.\n" "Mesdez, jaitsi ezazu (berriz) www.scummvm.org-etik" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2299,6 +2345,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2308,15 +2365,15 @@ msgstr "" "Ezin da partida gorde %i zirrikituan\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Jokoa kargatzen..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Jokoa gordetzen..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2333,11 +2390,11 @@ msgstr "" "Sakatu Ados orain konbertitzeko, bestela berriz galdetuko dizut jokoa berriz " "martxan jartzen duzunean.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM-k ondo konbertitu ditu zure gordetako partida guztiak." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2550,11 +2607,11 @@ msgstr "Touchpad modua gaituta." msgid "Touchpad mode disabled." msgstr "Touchpad modua desgaituta." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "Klikatzeko modua" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2562,11 +2619,11 @@ msgstr "Klikatzeko modua" msgid "Left Click" msgstr "Ezker-klika" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "Erdiko klika" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2603,21 +2660,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normala" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Formatu-ratio zuzenketa gaituta" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Formatu-ratio zuzenketa desgaituta" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Filtro grafiko aktiboa:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Leiho modua" @@ -2971,37 +3028,37 @@ msgstr "Abiarazlea" msgid "Do you really want to quit?" msgstr "Benetan irten?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Ukimen-pantailako 'kolpetxo modua' - Ezker klika" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Ukimen-pantailako 'kolpetxo modua' - Eskuin klika" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Ukimen-pantailako 'kolpetxo modua' - Flotatu (klikik ez)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Bolumen maximoa" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Bolumena igotzen" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Bolumen minimoa" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Bolumena jaisten" diff --git a/po/fr_FR.po b/po/fr_FR.po index 6270ab3f73e3..cd98af1bb7f9 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-10-23 14:52+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-08 12:24+0100\n" "Last-Translator: Thierry Crozat \n" "Language-Team: French \n" +"Language: Francais\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Francais\n" "Plural-Forms: nplurals=2; plural=n>1;\n" #: gui/about.cpp:91 @@ -45,10 +45,11 @@ msgstr "Remonter" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -91,16 +92,16 @@ msgstr "Affecter" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -193,9 +194,8 @@ msgid "Platform:" msgstr "Système:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Examiner" +msgstr "Moteur" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -440,14 +440,14 @@ msgstr "Recherche dans la liste de jeux" msgid "Search:" msgstr "Filtre:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Charger le jeu:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Charger" @@ -609,7 +609,7 @@ msgid "Special dithering modes supported by some games" msgstr "Mode spécial de tramage supporté par certains jeux" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Plein écran" @@ -931,68 +931,104 @@ msgstr "" "Le thème que vous avez sélectioné ne support pas la langue française. Si " "vous voulez l'utiliser vous devez d'abord changer de langue." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Date inconnue" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Heure inconnue" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Durée de jeu inconnue" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Supprimer" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Voulez-vous vraiment supprimer cette sauvegarde?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Date: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Heure: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Durée de jeu: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Sauvegarde sans nom" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Sauver" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Échec de la sauvegarde." + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nom:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Sélectionnez un Thème" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX désactivé" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX désactivé" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Rendu Standard (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Rendu Anti-crénelé (16 bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Anti-crénelé (16 bpp)" @@ -1096,18 +1132,18 @@ msgstr "Annuler par l'utilisateur" msgid "Unknown error" msgstr "Erreur inconnue" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Le jeu dans '%s' n'est pas reconnu." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "Veuillez reporter les informations suivantes à l'équipe ScummVM ainsi que le " "nom" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "du jeu que vous avez essayé d'ajouter, sa version, le langage, etc..." @@ -1135,23 +1171,23 @@ msgstr "~A~ide" msgid "~A~bout" msgstr "À ~P~ropos" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "Retour au ~L~anceur" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "Retour au ~L~anceur" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Sauvegarde:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1160,7 +1196,7 @@ msgstr "Sauvegarde:" msgid "Save" msgstr "Sauver" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1170,27 +1206,26 @@ msgstr "" "fichier README pour les informations de base et les instructions pour " "obtenir de l'aide supplémentaire." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Désolé, il n'y a pas d'aide disponible dans ce jeu actuellement. Lisez le " -"fichier README pour les informations de base et les instructions pour " -"obtenir de l'aide supplémentaire." +"Echec de la sauvegarde (%s)! Lisez le fichier README pour les informations " +"de base et les instructions pour obtenir de l'aide supplémentaire." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~nnuler" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~ouches" @@ -1239,14 +1274,13 @@ msgstr "" "Lisez le fichier README pour plus de détails." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Désolé, il n'y a pas d'aide disponible dans ce jeu actuellement. Lisez le " -"fichier README pour les informations de base et les instructions pour " -"obtenir de l'aide supplémentaire." +"Echec du chargement (%s)! . Lisez le fichier README pour les informations de " +"base et les instructions pour obtenir de l'aide supplémentaire." #: engines/engine.cpp:439 msgid "" @@ -1265,84 +1299,88 @@ msgstr "Jouer quand m #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Dialogues sauvegarde/chargement d'origine" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"Utiliser les dialogues sauvegarde/chargement d'origine plutôt que ceux de " +"ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Charger le jeu:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Charger" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Élément en haut à droite" +msgstr "Utiliser le mode palette lumineuse" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Utiliser la palette lumineuse du jeu pour l'affichage" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "Détramage EGA" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Active le détramage dans les jeux EGA qui le supporte" +msgstr "Activer le détramage dans les jeux EGA" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Volume des effets spéciaux sonores" +msgstr "Préférer les effets sonors digitals" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Préférer les effets sonores digitaux plutôt que ceux synthétisés" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Utiliser IMF/Yamaha FB-01 pour la sortie MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Utiliser une carte IBM Music Feature ou un module Yamaha FB-01 FM pour la " +"sortie MIDI" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Utiliser la musique du CD" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" msgstr "" +"Utiliser la musique du CD quand elle est disponible au lieu de la musique du " +"jeu" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Utiliser les curseurs Windows" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"Utiliser les curseurs Windows (plus petits et monochromes) au lieu des " +"curseurs DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Curseur normal" +msgstr "Utiliser les curseurs argentés" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" -msgstr "" +msgstr "Utiliser les curseurs argentés au lieu des curseurs normaux dorés" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -2000,7 +2038,7 @@ msgstr "" "Support MIDI natif requière la mise à jour Roland de LucasArt,\n" "mais %s manque. Utilise AdLib à la place." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2011,7 +2049,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2022,7 +2060,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2033,7 +2071,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2070,17 +2108,17 @@ msgstr "~M~enu Principal" msgid "~W~ater Effect Enabled" msgstr "~E~ffets de l'Eau Activés" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Fichier de séquence '%s' non trouvé!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Échec du chargement de l'état du jeu depuis le disque." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Échec de l'enregistrement de l'état du jeu sur le disque." @@ -2096,61 +2134,59 @@ msgstr " #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Public en studio" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Activer le public en studio" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Support des interruptions" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Permet de sauter les textes et scènes cinématiques" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Mode Helium" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Activer le mode Roland GS" +msgstr "Activer le mode helium" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Défilement régulier" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Activer le défilement régulier en marchant" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Curseur normal" +msgstr "Curseurs flotants" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Activer les curseurs flotants" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Bar HP" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Activer les bars de santé (Hit Point)" #: engines/kyra/lol.cpp:478 msgid "Attack 1" @@ -2205,22 +2241,23 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Il semble que vous utilisiez un périphérique General MIDI,\n" -"mais ce jeu ne support que le MIDI Roland MT32.\n" -"Nous essayons d'associer les instruments Roland MT32 auxinstruments General " -"MIDI. Mais il est possible que quelquespistes ne soient pas jouées " -"correctement." +"mais ce jeu ne support que le MIDI Roland MT32. Nous essayons\n" +"d'associer les instruments Roland MT32 aux instruments General\n" +"MIDI. Cependant il est possible que quelques pistes ne soient\n" +" pas jouées correctement." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Utiliser l'intro de la version disquette (version CD uniquement)" #: engines/sky/compact.cpp:130 msgid "" @@ -2238,10 +2275,19 @@ msgstr "" "Le fichier \"sky.cpt\" a une taille incorrecte.\n" "Vous pouvez le (re)télécharger sur www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Intro disquette" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Utiliser l'intro de la version disquette (version CD uniquement)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" msgstr "" +"La scène cinématique PSX '%s' ne peut pas être lu avec 256 couleurs ou moins" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2298,19 +2344,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "C'est la fin de la démo des Chevaliers de Baphomet" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"Les séquences DXA sont présente mais ScummVM a été compilé sans le support " -"zlib." +"Scènes cinématique PSX détectées mais ScummVM a été compilé sans le support " +"des couleurs RGB" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Afficher la description des objets" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Afficher la description des objets lors de passage du pointeur" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2322,15 +2378,15 @@ msgstr "" "Erreur lors de la sauvegarde dans l'emplacement %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Chargement en cours..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Sauvegarde en cours..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2347,11 +2403,11 @@ msgstr "" "Appuyer sur OK pour les convertir maintenant, sinon le même message " "s'affichera la prochaine fois que vous démarrerez le jeu.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM a converti avec succès vos anciennes sauvegardes." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2451,9 +2507,8 @@ msgid "Keymap:" msgstr "Affectation des touches:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" -msgstr "(Actif)" +msgstr "(Effectif)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Active)" @@ -2461,7 +2516,7 @@ msgstr "(Actif)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr "(Bloqué)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2563,11 +2618,11 @@ msgstr "Mode touchpad activ msgid "Touchpad mode disabled." msgstr "Mode touchpad désactivé" -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "Mode Clic" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2575,11 +2630,11 @@ msgstr "Mode Clic" msgid "Left Click" msgstr "Clic Gauche" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "Clic Milieu" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2616,21 +2671,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Activer la correction du rapport d'aspect" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Désactiver la correction du rapport d'aspect" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Mode graphique actif:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Mode Fenêtre" @@ -2985,37 +3040,37 @@ msgstr "Lanceur" msgid "Do you really want to quit?" msgstr "Voulez-vous vraiment quitter?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Touchscreen 'Tap Mode' - Clic Gauche" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Touchscreen 'Tap Mode' - Clic Droit" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Touchscreen 'Tap Mode' - Déplacer sans cliquer" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Volume Maximum" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Augmentation Volume" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Volume Minimum" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Diminution Volume" diff --git a/po/hu_HU.po b/po/hu_HU.po index 321e5b7e70b1..b263d2c539e9 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2012-04-18 08:20+0100\n" -"Last-Translator: Gruby \n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-08-14 07:29+0100\n" +"Last-Translator: George Kormendi \n" "Language-Team: Hungarian\n" +"Language: Magyar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-2\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Magyar\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "X-Poedit-Language: Hungarian\n" "X-Poedit-Country: HUNGARY\n" @@ -48,10 +48,11 @@ msgstr "Feljebb" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -94,16 +95,16 @@ msgstr "Kioszt #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -194,9 +195,8 @@ msgid "Platform:" msgstr "Platform:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Vizsgál" +msgstr "Motor" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -440,14 +440,14 @@ msgstr "Keres msgid "Search:" msgstr "Keresés:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Játék betöltése:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Betöltés" @@ -608,7 +608,7 @@ msgid "Special dithering modes supported by some games" msgstr "Néhány játék támogatja a speciális árnyalási módokat" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Teljesképernyõs mód:" @@ -919,68 +919,101 @@ msgstr "" "A kiválasztott téma nem támogatja a nyelvedet. Ha használni akarod ezt a " "témát, elõszõr válts át egy másik nyelvre." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "Lista nézet" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "Rács nézet" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Dátum nincs mentve" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Idõ nincs mentve" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Játékidõ nincs mentve" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Töröl" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Biztos hogy törölni akarod ezt a játékállást?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Dátum:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Idõ:" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Játékidõ:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Névtelen játékállás" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "Következõ" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "Elõzõ" + +#: gui/saveload-dialog.cpp:684 +msgid "New Save" +msgstr "Új Mentés" + +#: gui/saveload-dialog.cpp:684 +msgid "Create a new save game" +msgstr "Új játékmentés készítése" + +#: gui/saveload-dialog.cpp:789 +msgid "Name: " +msgstr "Név:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "Adj meg egy leírást a %d slothoz:" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Válassz témát" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX letiltva" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX letiltva" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard leképezõ (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Élsimításos leképezõ (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Élsimított (16bpp)" @@ -1084,16 +1117,16 @@ msgstr "Felhaszn msgid "Unknown error" msgstr "Ismeretlen hiba" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "A '%s' játék ismeretlennek tûnik." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Kérlek jelezd a ScummVM csapatnak a következõ adatokat, együtt a játék" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "címével és megbízható adataival játékverzió/nyelv(ek)/stb.:" @@ -1121,23 +1154,23 @@ msgstr "S msgid "~A~bout" msgstr "Névjegy" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "Visszatérés az indítóba" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "Visszatérés az indítóba" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Játék mentése:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1146,7 +1179,7 @@ msgstr "J msgid "Save" msgstr "Mentés" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1155,7 +1188,7 @@ msgstr "" "Sajnálom, a motor jelenleg nem tartalmaz játék közbeni súgót. Olvassd el a " "README-t az alap információkról, és hogy hogyan segíthetsz a késõbbiekben." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " @@ -1164,17 +1197,17 @@ msgstr "" "(%s) játékmentés nem sikerült!. Olvassd el a README-t az alap " "információkról, és hogy hogyan segíthetsz a késõbbiekben." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "Mégse" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "Billentyük" @@ -1248,84 +1281,82 @@ msgstr "Ind #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Eredeti ment/tölt képernyõk használata" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "" +msgstr "Az eredeti mentés/betöltés képernyõ használata a ScummVM képek helyett" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Játékmenet visszaállítása:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Visszaállítás" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Jobb felsõ tárgy" +msgstr "Fényes paletta mód használata" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Grafikus megjelenítésre használja a játék fényes palettáját" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA szinjavítás" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "EGA színjavítás támogatott EGA játékokban" +msgstr "Undithering engedélyezése EGA játékokban" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Speciális hangeffektusok hangereje" +msgstr "Digitális hangeffektusok elõnyben" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Digitális hanghatások elõnyben a szintetizáltakkal szemben" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "IMF/Yamaha FB-01 használata MIDI kimentre" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"IBM Music Feature kártya vagy Yamaha FB-01 FM szintetizátor modul használata " +"MIDI kimenetre" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "CD audió használata" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "CD audió használata a játékban lévõvel szemben, ha elérhetõ" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Windows kurzorok használata" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" -msgstr "" +msgstr "Windows kurzorok használata (kisebb és monokróm) a DOS-osok helyett " #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Szabvány kurzor" +msgstr "Ezüst kurzor használata" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" -msgstr "" +msgstr "Alternatív ezüst kurzorszett használata, a normál arany helyett" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1983,7 +2014,7 @@ msgstr "" "Native MIDI támogatáshoz kell a Roland Upgrade a LucasArts-tól,\n" "a %s hiányzik. AdLib-ot használok helyette." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1994,7 +2025,7 @@ msgstr "" "\n" "%s fájlba nem sikerült" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2005,7 +2036,7 @@ msgstr "" "\n" "%s fájlból nem sikerült" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2016,7 +2047,7 @@ msgstr "" "\n" "%s fájlba elkészült" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2052,17 +2083,17 @@ msgstr "F msgid "~W~ater Effect Enabled" msgstr "Vízeffektus engedélyezve" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "'%s' átvezetõ fájl nem található" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Játékállás betöltése fájlból nem sikerült." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Játékállás mentése fájlba nem sikerült." @@ -2078,61 +2109,59 @@ msgstr "J #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Stúdió közönség" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Stúdió közönség engedélyezése" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Átugrás támogatás" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Szöveg és átvezetõk átugrásának támogatása" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Helium mód" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Roland GS Mód engedélyezve" +msgstr "Helium mód engedélyezve" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Finom görgetés" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Finom görgetés engedélyezése járás közben" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Szabvány kurzor" +msgstr "Lebegõ kurzor" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Lebegõ kurzor engedélyezése" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "HP sáv grafika" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Hit point sáv grafika engedélyezése" #: engines/kyra/lol.cpp:478 msgid "Attack 1" @@ -2187,22 +2216,22 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" -"Úgy néz ki egy General MIDI eszközt használsz,\n" -"a játék csak Roland MT32 MIDI eszközt támogat.\n" -"Cseréld ki Roland MT32 hangszerekre\n" -"a General MIDI-t. Különben néhány\n" -"sávot nem lehet rendesen lejátszani." +"Úgy tûnik, egy General MIDI eszközt használsz,\n" +"de a játék csak Roland MT32 MIDI eszközt támogat.\n" +"Megpróbáljuk lecserélni a Roland MT32 hangszereket\n" +"General MIDIre. Továbbra is lehetséges hogy\n" +"néhány hangsáv helytelenül hangzik." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" -msgstr "" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" +msgstr "Alternatív intro" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" +msgstr "Alternatív játékintro használata (csak CD verziónál)" #: engines/sky/compact.cpp:130 msgid "" @@ -2220,6 +2249,14 @@ msgstr "" "A \"sky.cpt\" fájl mérete nem megfelelõ.\n" "Töltsd le a www.scummvm.org oldaláról" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Floppy intro" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "A floppy verzió intro használata (csak CD verziónál)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2286,11 +2323,24 @@ msgstr "" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Tárgycimke látható" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Tárgycimke látható ha az egér felette van" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "Hiányzik a 'teenagent.dat' fájl. Szerezd be a ScummVM website-ról" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" +"A teenagent.dat fájl tömörített és a zlib nem része ennek a futtatható " +"állománynak. Kérlek tömörítsd ki" #: engines/parallaction/saveload.cpp:133 #, c-format @@ -2301,15 +2351,15 @@ msgstr "" "Játékállás nem menthetõ %i slotba\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Játék betöltés..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Játék mentés..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2325,11 +2375,11 @@ msgstr "" "Nyomj OK-t az átalakításhoz, vagy rákérdezzek ha legközelebb elindítod a " "játékot.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM konvertálta az összes játékállásodat." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2540,11 +2590,11 @@ msgstr "Touchpad m msgid "Touchpad mode disabled." msgstr "Touchpad mód letiltva." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "Kattintás Mód" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2552,11 +2602,11 @@ msgstr "Kattint msgid "Left Click" msgstr "Bal katt" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "Középsõ katt" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2593,21 +2643,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normál (nincs átméretezés)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Méretarány korrekció engedélyezve" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Méretarány korrekció letiltva" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Aktív grafikus szûrõk:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Ablakos mód" @@ -2958,37 +3008,37 @@ msgstr "Ind msgid "Do you really want to quit?" msgstr "Biztos hogy ki akarsz lépni ?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Érintõképernyõ 'Tap Mód' - Bal katt" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Érintõképernyõ 'Tap Mód' - Jobb katt" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Érintõképernyõ 'Tap Mód' - Lebegõ (Nincs katt)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Maximum Hangerõ" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Hangerõ növelése" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Minimum Hangerõ" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Hangerõ csökkentése" diff --git a/po/it_IT.po b/po/it_IT.po index bee74f5a683b..7d4c11319d54 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-10-08 17:29+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-09 09:30+0100\n" "Last-Translator: Matteo 'Maff' Angelino \n" "Language-Team: Italian\n" +"Language: Italiano\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Italiano\n" #: gui/about.cpp:91 #, c-format @@ -44,10 +44,11 @@ msgstr "Su" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -77,7 +78,6 @@ msgid "Remap keys" msgstr "Riprogramma tasti" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "Attiva / disattiva schermo intero" @@ -91,16 +91,16 @@ msgstr "Mappa" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -192,9 +192,8 @@ msgid "Platform:" msgstr "Piattaf.:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Esamina" +msgstr "Motore" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -438,14 +437,14 @@ msgstr "Cerca nella lista dei giochi" msgid "Search:" msgstr "Cerca:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Carica gioco:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Carica" @@ -609,7 +608,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modalità di resa grafica speciali supportate da alcuni giochi" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Modalità a schermo intero" @@ -926,68 +925,104 @@ msgstr "" "Il tema che hai selezionato non supporta la lingua attuale. Se vuoi " "utilizzare questo tema devi prima cambiare la lingua." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Nessuna data salvata" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Nessun orario salvato" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Nessun tempo salvato" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Elimina" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Sei sicuro di voler eliminare questo salvataggio?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Data: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Ora: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Tempo di gioco: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Salvataggio senza titolo" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Salva" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Impossibile salvare il gioco" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nome:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Seleziona un tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Grafica disattivata" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Grafica disattivata" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Renderer standard (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Renderer con antialiasing (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Con antialiasing (16bpp)" @@ -1092,16 +1127,16 @@ msgstr "Utente cancellato" msgid "Unknown error" msgstr "Errore sconosciuto" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Il gioco in '%s' sembra essere sconosciuto." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Per favore, riporta i seguenti dati al team di ScummVM con il nome" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "del gioco che hai provato ad aggiungere e la sua versione/lingua/ecc.:" @@ -1129,23 +1164,23 @@ msgstr "~A~iuto" msgid "~A~bout" msgstr "~I~nfo" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~T~orna a elenco giochi" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~V~ai a elenco giochi" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Salva gioco:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1154,7 +1189,7 @@ msgstr "Salva gioco:" msgid "Save" msgstr "Salva" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1164,27 +1199,27 @@ msgstr "" "gioco. Si prega di consultare il file README per le informazioni di base e " "per le istruzioni su come ottenere ulteriore assistenza." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Siamo spiacenti, ma l'attuale motore non prevede aiuto all'interno del " -"gioco. Si prega di consultare il file README per le informazioni di base e " -"per le istruzioni su come ottenere ulteriore assistenza." +"Salvataggio fallito (%s)! Si prega di consultare il file README per le " +"informazioni di base e per le istruzioni su come ottenere ulteriore " +"assistenza." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~nnulla" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~asti" @@ -1233,14 +1268,14 @@ msgstr "" "Vedi il file README per i dettagli." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Siamo spiacenti, ma l'attuale motore non prevede aiuto all'interno del " -"gioco. Si prega di consultare il file README per le informazioni di base e " -"per le istruzioni su come ottenere ulteriore assistenza." +"Caricamento salvataggio fallito (%s)! Si prega di consultare il file README " +"per le informazioni di base e per le istruzioni su come ottenere ulteriore " +"assistenza." #: engines/engine.cpp:439 msgid "" @@ -1259,84 +1294,87 @@ msgstr "Avvia comunque" #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Usa schermate di salvataggio originali" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"Usa le schermate originali di salvataggio e caricamento, al posto di quelle " +"di ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Ripristina gioco:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Ripristina" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Oggetto in alto a destra" +msgstr "Usa modalità colori brillanti" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Visualizza la grafica con i colori brillanti del gioco" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "Undithering EGA" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Attiva undithering nei giochi EGA che lo supportano" +msgstr "Attiva undithering nei giochi EGA" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Volume degli effetti sonori" +msgstr "Scegli effetti sonori digitali" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Scegli gli effetti sonori digitali al posto di quelli sintetizzati" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Usa IMF/Yamaha FB-01 per output MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Usa una scheda IBM Music Feature o un modulo synth Yamaha FB-01 FM per " +"l'output MIDI" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Usa audio da CD" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" msgstr "" +"Usa l'audio da CD al posto di quello incorporato nel gioco, se disponibile" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Usa cursori di Windows" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"Usa i cursori di Windows (più piccoli e monocromatici) al posto di quelli DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Cursore normale" +msgstr "Usa cursori d'argento" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Usa il set alternativo di cursori d'argento al posto di quelli normali d'oro" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1362,12 +1400,12 @@ msgstr "Gioco in pausa. Premere SPAZIO per continuare." #. Will react to J as 'Yes' #: engines/scumm/dialogs.cpp:182 msgid "Are you sure you want to restart? (Y/N)" -msgstr "Sei sicuro di voler riavviare? (Y/N)" +msgstr "Sei sicuro di voler riavviare? (S/N)S" #. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment #: engines/scumm/dialogs.cpp:184 msgid "Are you sure you want to quit? (Y/N)" -msgstr "Sei sicuro di voler uscire? (Y/N)" +msgstr "Sei sicuro di voler uscire? (S/N)S" #: engines/scumm/dialogs.cpp:189 msgid "Play" @@ -1994,7 +2032,7 @@ msgstr "" "Il supporto nativo MIDI richiede il Roland Upgrade della LucasArts,\n" "ma %s non è presente. Verrà usato AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2005,7 +2043,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2016,7 +2054,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2027,7 +2065,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2064,17 +2102,17 @@ msgstr "~M~enu principale" msgid "~W~ater Effect Enabled" msgstr "~E~ffetto acqua attivo" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "File della scena di intermezzo '%s' non trovato!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Impossibile caricare il gioco dal file." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Impossibile salvare il gioco nel file." @@ -2090,137 +2128,130 @@ msgstr "Impossibile salvare il gioco" #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Reazioni del pubblico" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Attiva le reazioni del pubblico" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Interruzione del parlato" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Permette di saltare i dialoghi e le scene di intermezzo" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Modalità elio" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Attiva la modalità Roland GS" +msgstr "Attiva la modalità elio" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Scorrimento morbido" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Attiva lo scorrimento morbido durante gli spostamenti" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Cursore normale" +msgstr "Cursori fluttuanti" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Attiva cursori fluttuanti" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Barre HP" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Attiva le barre di Hit Point" #: engines/kyra/lol.cpp:478 msgid "Attack 1" -msgstr "" +msgstr "Attacco 1" #: engines/kyra/lol.cpp:479 msgid "Attack 2" -msgstr "" +msgstr "Attacco 2" #: engines/kyra/lol.cpp:480 msgid "Attack 3" -msgstr "" +msgstr "Attacco 3" #: engines/kyra/lol.cpp:481 msgid "Move Forward" -msgstr "" +msgstr "Vai avanti" #: engines/kyra/lol.cpp:482 msgid "Move Back" -msgstr "" +msgstr "Vai indietro" #: engines/kyra/lol.cpp:483 msgid "Slide Left" -msgstr "" +msgstr "Scorri a sinistra" #: engines/kyra/lol.cpp:484 -#, fuzzy msgid "Slide Right" -msgstr "Destra" +msgstr "Scorri a destra" #: engines/kyra/lol.cpp:485 -#, fuzzy msgid "Turn Left" -msgstr "Spegni" +msgstr "Gira a sinistra" #: engines/kyra/lol.cpp:486 -#, fuzzy msgid "Turn Right" -msgstr "Cursore a destra" +msgstr "Gira a destra" #: engines/kyra/lol.cpp:487 -#, fuzzy msgid "Rest" -msgstr "Ripristina" +msgstr "Riposa" #: engines/kyra/lol.cpp:488 -#, fuzzy msgid "Options" -msgstr "~O~pzioni" +msgstr "Opzioni" #: engines/kyra/lol.cpp:489 -#, fuzzy msgid "Choose Spell" -msgstr "Scegli" +msgstr "Scegli incantesimo" #: engines/kyra/sound_midi.cpp:475 msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Sembra che tu stia utilizzanto un dispositivo\n" "General MIDI, ma il gioco supporta solo Roland\n" "MT32 MIDI. Tenteremo di mappare gli strumenti\n" "Roland MT32 in quelli General MIDI. Alcune tracce\n" -"potrebbero non essere riprodotte correttamente." +"potrebbero avere un suono non corretto." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Usa la versione floppy dell'intro (solo versione CD)" #: engines/sky/compact.cpp:130 msgid "" @@ -2238,10 +2269,19 @@ msgstr "" "Il file \"sky.cpt\" non ha una dimensione corretta.\n" "Si prega di (ri)scaricarlo da www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Intro floppy" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Usa la versione floppy dell'intro (solo versione CD)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" msgstr "" +"La scena PSX di intermezzo '%s' non può essere eseguita in modalità tavolozza" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2298,19 +2338,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "Questa è la fine della demo di Broken Sword 1" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"Sono state trovare scene di intermezzo DXA ma ScummVM è stato compilato " -"senza il supporto zlib" +"Sono state trovare scene di intermezzo PSX ma ScummVM è stato compilato " +"senza il supporto colori RGB" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Mostra etichette oggetti" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Mostra etichette per gli oggetti al passaggio del mouse" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2322,15 +2372,15 @@ msgstr "" "Impossibile salvare nella posizione %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Caricamento..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Salvataggio..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2347,11 +2397,11 @@ msgstr "" "Premi OK per convertirli adesso, altrimenti ti verrà richiesto la prossima " "volta.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM ha convertito con successo tutti i tuoi salvataggi." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2453,9 +2503,8 @@ msgid "Keymap:" msgstr "Mappa tasti:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" -msgstr " (Attivo)" +msgstr " (Efficace)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Active)" @@ -2463,7 +2512,7 @@ msgstr " (Attivo)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (Bloccato)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2565,11 +2614,11 @@ msgstr "Modalit msgid "Touchpad mode disabled." msgstr "Modalità touchpad disattivata." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Modalità clic" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2577,12 +2626,11 @@ msgstr "" msgid "Left Click" msgstr "Clic sinistro" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Oggetto al centro a sinistra" +msgstr "Clic centrale" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2619,21 +2667,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normale (no ridim.)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Correzione proporzioni attivata" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Correzione proporzioni disattivata" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Filtro grafico attivo:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Modalità finestra" @@ -2986,37 +3034,37 @@ msgstr "Elenco giochi" msgid "Do you really want to quit?" msgstr "Sei sicuro di voler uscire?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Touchscreen 'Tap Mode' - Clic sinistro" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Touchscreen 'Tap Mode' - Clic destro" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Touchscreen 'Tap Mode' - Passaggio del cursore (nessun clic)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Volume massimo" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Aumento volume" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Volume minimo" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Diminuzione volume" @@ -3025,40 +3073,36 @@ msgid "Check for Updates..." msgstr "Cerca aggiornamenti..." #: backends/platform/bada/form.cpp:269 -#, fuzzy msgid "Right Click Once" -msgstr "Clic destro" +msgstr "Un clic destro" #: backends/platform/bada/form.cpp:277 -#, fuzzy msgid "Move Only" -msgstr "Solo voci" +msgstr "Muovi soltanto" #: backends/platform/bada/form.cpp:291 msgid "Escape Key" -msgstr "" +msgstr "Tasto Esc" #: backends/platform/bada/form.cpp:296 -#, fuzzy msgid "Game Menu" -msgstr "Gioco" +msgstr "Menu di gioco" #: backends/platform/bada/form.cpp:301 -#, fuzzy msgid "Show Keypad" -msgstr "Mostra tastiera" +msgstr "Mostra tastierino numerico" #: backends/platform/bada/form.cpp:309 msgid "Control Mouse" -msgstr "" +msgstr "Controllo mouse" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Enabled" -msgstr "" +msgstr "Clic attivato" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Disabled" -msgstr "" +msgstr "Clic disattivato" #~ msgid "Hercules Green" #~ msgstr "Hercules verde" diff --git a/po/nb_NO.po b/po/nb_NO.po index cdc102f394fb..b775d11dd261 100644 --- a/po/nb_NO.po +++ b/po/nb_NO.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-04-25 22:56+0100\n" -"Last-Translator: Einar Johan T. Sømåen \n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-04 02:19+0100\n" +"Last-Translator: Einar Johan Sømåen \n" "Language-Team: somaen \n" +"Language: Norsk (bokmaal)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Norsk (bokmaal)\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "X-Poedit-Language: Norsk Bokmål\n" "X-Poedit-Country: NORWAY\n" @@ -48,10 +48,11 @@ msgstr "G #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -81,7 +82,6 @@ msgid "Remap keys" msgstr "Omkoble taster" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "Veksle fullskjerm" @@ -95,16 +95,16 @@ msgstr "Koble" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -197,9 +197,8 @@ msgid "Platform:" msgstr "Plattform:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Undersøk" +msgstr "Motor" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -443,14 +442,14 @@ msgstr "S msgid "Search:" msgstr "Søk:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Åpne spill:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Åpne" @@ -525,6 +524,7 @@ msgstr "S #, c-format msgid "Discovered %d new games, ignored %d previously added games." msgstr "" +"Fant %d nye spill, ignorerte %d spill som har blitt lagt til tidligere." #: gui/massadd.cpp:265 #, c-format @@ -532,9 +532,10 @@ msgid "Scanned %d directories ..." msgstr "Sjekket %d mapper ..." #: gui/massadd.cpp:268 -#, fuzzy, c-format +#, c-format msgid "Discovered %d new games, ignored %d previously added games ..." -msgstr "Fant %d nye spill ..." +msgstr "" +"Fant %d nye spill, ignorerte %d spill som har blitt lagt til tidligere..." #: gui/options.cpp:78 msgid "Never" @@ -584,19 +585,19 @@ msgstr "Ingen" #: gui/options.cpp:382 msgid "Failed to apply some of the graphic options changes:" -msgstr "" +msgstr "Klarte ikke å aktivere enkelte av endringene i grafikkinstillinger:" #: gui/options.cpp:394 msgid "the video mode could not be changed." -msgstr "" +msgstr "videomodusen kunne ikke endres." #: gui/options.cpp:400 msgid "the fullscreen setting could not be changed" -msgstr "" +msgstr "fullskjermsinnstillingen kunne ikke endres" #: gui/options.cpp:406 msgid "the aspect ratio setting could not be changed" -msgstr "" +msgstr "aspektrate-innstillingen kunne ikke endres" #: gui/options.cpp:727 msgid "Graphics mode:" @@ -611,7 +612,7 @@ msgid "Special dithering modes supported by some games" msgstr "Spesiel dithering-modus støttet av enkelte spill" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Fullskjermsmodus" @@ -891,9 +892,8 @@ msgid "Language of ScummVM GUI" msgstr "Språk i ScummVM-GUIet" #: gui/options.cpp:1347 -#, fuzzy msgid "You have to restart ScummVM before your changes will take effect." -msgstr "Du må omstarte ScummVM for at endringene skal skje. " +msgstr "Du må starte ScummVM på nytt for at endringene skal tre i kraft. " #: gui/options.cpp:1360 msgid "Select directory for savegames" @@ -923,68 +923,104 @@ msgstr "" "Temaet du valgte støtter ikke det aktive språket. Hvis du vil bruke dette " "temaet, må du bytte til et annet språk først." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Ingen dato lagret" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Ingen tid lagret" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Ingen spilltid lagret" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Slett" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Vil du virkelig slette dette lagrede spillet?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Dato: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Tid: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Spilltid: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Ikke navngitt spilltilstand" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Lagre" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Klarte ikke å lagre spill." + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Navn:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Velg et tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Deaktivert GFX" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Deaktivert GFX" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard Tegner (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Antialiased Tegner (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Antialiased (16bpp)" @@ -1082,24 +1118,25 @@ msgstr "Spillmotor-plugin st #: common/error.cpp:71 msgid "User canceled" -msgstr "" +msgstr "Brukeren avbrøt" #: common/error.cpp:75 msgid "Unknown error" msgstr "Ukjent feil" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." -msgstr "" +msgstr "Spillet i '%s' ser ut til å være ukjent." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" +"Vennligst rapporter de følgende dataene til ScummVM-teamet sammen med navnet" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" -msgstr "" +msgstr "på spillet du forsøkte å legge til, og dets versjon/språk/etc.:" #: engines/dialogs.cpp:84 msgid "~R~esume" @@ -1125,23 +1162,23 @@ msgstr "~H~jelp" msgid "~A~bout" msgstr "~O~m" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~T~ilbake til oppstarter" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~T~ilbake til oppstarter" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Lagret spill:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1150,51 +1187,54 @@ msgstr "Lagret spill:" msgid "Save" msgstr "Lagre" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" +"Beklager, men denne motoren støtter for øyeblikket ikke hjelp i spillet. " +"Vennligst se i README-filen for grunnleggende informasjon, og for " +"instruksjoner om hvordan du kan få ytterligere hjelp." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" +"Lagring av spilltilstand feilet (%s)! Vennligst konsulter README-filen for " +"grunnleggende informasjon og instruksjon om hvordan du får ytterligere hjelp." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~vbryt" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~aster" #: engines/engine.cpp:235 msgid "Could not initialize color format." -msgstr "" +msgstr "Kunne ikke initalisere fargeformat." #: engines/engine.cpp:243 -#, fuzzy msgid "Could not switch to video mode: '" -msgstr "Nåværende videomodus:" +msgstr "Kunne ikke veksle til videomodus: '" #: engines/engine.cpp:252 -#, fuzzy msgid "Could not apply aspect ratio setting." -msgstr "Veksle aspekt-rate korrigering" +msgstr "Kunne ikke aktivere aspektrate-innstilling." #: engines/engine.cpp:257 msgid "Could not apply fullscreen setting." -msgstr "" +msgstr "Kunne ikke aktivere fullskjermsinnstilling." #: engines/engine.cpp:357 msgid "" @@ -1204,6 +1244,11 @@ msgid "" "the data files to your hard disk instead.\n" "See the README file for details." msgstr "" +"Du ser ut til å spille dette spillet direkte fra\n" +"CDen. Dette er kjent for å skape problemer,\n" +"og det er derfor anbefalt at du kopierer\n" +"datafilene til harddisken din istedet.\n" +"Se README-filen for detaljer." #: engines/engine.cpp:368 msgid "" @@ -1227,97 +1272,97 @@ msgid "" "ScummVM. As such, it is likely to be unstable, and any saves you make might " "not work in future versions of ScummVM." msgstr "" +"ADVARSEL: Spillet du prøver å starte er ikke fullstendig støttet av ScummVM. " +"Derfor er det sannsynlig at det vil være ustabilt, og det er ikke sikkert at " +"lagrede spill vil fortsette å fungere i fremtidige versjoner av ScummVM." #: engines/engine.cpp:442 msgid "Start anyway" -msgstr "" +msgstr "Start allikevel" #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Bruk originale lagre/laste-skjermer" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "" +msgstr "Bruk de originale lagre/laste-skjermene, istedenfor ScummVM-variantene" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Gjennopprett spill:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Gjenopprett" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Øvre høyre gjenstand" +msgstr "Bruk lys palettmodus" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Vis grafikk med spillets lyse palett" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA av-dithering" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Slår av dithering i EGA-spill som støtter det." +msgstr "Aktiver av-dithering i EGA-spill" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Volum for spesielle lydeffekter" +msgstr "Foretrekk digitale lydeffekter" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Foretrekk digitale lydeffekter fremfor syntetiske" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Bruk IMF/Yamaha-FB-01 for MIDI-output" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Bruk CD-lyd" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "Bruk CD-lyd istedenfor spillets lyd, hvis tilgjengelig" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Bruk Windows-muspekere" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" -msgstr "" +msgstr "Bruk Windows-muspekerene (mindre, og monokrome) isteden" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Vanlig muspeker" +msgstr "Bruk sølvmuspekere" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Bruk det alternative settet med sølvmuspekere, istedenfor de normale gylne." #: engines/scumm/dialogs.cpp:175 #, c-format msgid "Insert Disk %c and Press Button to Continue." -msgstr "" +msgstr "Sett inn disk %c, og trykk Tast for å fortsette." #: engines/scumm/dialogs.cpp:176 #, c-format @@ -1331,25 +1376,23 @@ msgstr "" #: engines/scumm/dialogs.cpp:178 msgid "Game Paused. Press SPACE to Continue." -msgstr "" +msgstr "Spill pauset. Trykk på MELLOMROMstasten for å fortsette." #. I18N: You may specify 'Yes' symbol at the end of the line, like this: #. "Moechten Sie wirklich neu starten? (J/N)J" #. Will react to J as 'Yes' #: engines/scumm/dialogs.cpp:182 -#, fuzzy msgid "Are you sure you want to restart? (Y/N)" -msgstr " Er du sikker på at du vil avslutte ?" +msgstr "Er du sikker på at du vil avslutte? (Y/N)" #. I18N: you may specify 'Yes' symbol at the end of the line. See previous comment #: engines/scumm/dialogs.cpp:184 -#, fuzzy msgid "Are you sure you want to quit? (Y/N)" -msgstr " Er du sikker på at du vil avslutte ?" +msgstr "Er du sikker på at du vil avslutte? (Y/N)" #: engines/scumm/dialogs.cpp:189 msgid "Play" -msgstr "" +msgstr "Spill" #: engines/scumm/dialogs.cpp:191 engines/scumm/help.cpp:82 #: engines/scumm/help.cpp:84 @@ -1366,38 +1409,37 @@ msgstr "" #: engines/scumm/dialogs.cpp:194 msgid "You must enter a name" -msgstr "" +msgstr "Du må skrive inn et navn" #: engines/scumm/dialogs.cpp:195 msgid "The game was NOT saved (disk full?)" -msgstr "" +msgstr "Spillet ble IKKE lagret (full disk?)" #: engines/scumm/dialogs.cpp:196 msgid "The game was NOT loaded" -msgstr "" +msgstr "Spillet ble IKKE lastet" #: engines/scumm/dialogs.cpp:197 #, c-format msgid "Saving '%s'" -msgstr "" +msgstr "Lagrer '%s'" #: engines/scumm/dialogs.cpp:198 #, c-format msgid "Loading '%s'" -msgstr "" +msgstr "Laster '%s'" #: engines/scumm/dialogs.cpp:199 msgid "Name your SAVE game" -msgstr "" +msgstr "Gi det LAGREDE spillet ditt et navn" #: engines/scumm/dialogs.cpp:200 -#, fuzzy msgid "Select a game to LOAD" -msgstr "Velg et tema" +msgstr "Velg et spill for LASTING" #: engines/scumm/dialogs.cpp:201 msgid "Game title)" -msgstr "" +msgstr "Spilltittel)" #. I18N: Previous page button #: engines/scumm/dialogs.cpp:287 @@ -1415,25 +1457,21 @@ msgid "~C~lose" msgstr "~L~ukk" #: engines/scumm/dialogs.cpp:597 -#, fuzzy msgid "Speech Only" -msgstr "Tale" +msgstr "Kun tale" #: engines/scumm/dialogs.cpp:598 -#, fuzzy msgid "Speech and Subtitles" -msgstr "Undertekster" +msgstr "Tale og undertekster" #: engines/scumm/dialogs.cpp:599 -#, fuzzy msgid "Subtitles Only" -msgstr "Undertekster" +msgstr "Kun undertekster" #: engines/scumm/dialogs.cpp:607 -#, fuzzy msgctxt "lowres" msgid "Speech & Subs" -msgstr "Tale" +msgstr "Tekst & Tale" #: engines/scumm/dialogs.cpp:653 msgid "Select a Proficiency Level." @@ -1441,20 +1479,19 @@ msgstr "" #: engines/scumm/dialogs.cpp:655 msgid "Refer to your Loom(TM) manual for help." -msgstr "" +msgstr "Referer til Loom(TM)-håndboka di for hjelp." #: engines/scumm/dialogs.cpp:658 -#, fuzzy msgid "Standard" -msgstr "Standard (16bpp)" +msgstr "Standard" #: engines/scumm/dialogs.cpp:659 msgid "Practice" -msgstr "" +msgstr "Trening" #: engines/scumm/dialogs.cpp:660 msgid "Expert" -msgstr "" +msgstr "Ekspert" #: engines/scumm/help.cpp:73 msgid "Common keyboard commands:" @@ -1587,9 +1624,8 @@ msgid " since they may cause crashes" msgstr " de kan forårsake kræsj, eller" #: engines/scumm/help.cpp:110 -#, fuzzy msgid " or incorrect game behavior." -msgstr " feilaktig spilloppførsel." +msgstr " eller feilaktig spilloppførsel." #: engines/scumm/help.cpp:114 msgid "Spinning drafts on the keyboard:" @@ -1977,7 +2013,7 @@ msgid "" "but %s is missing. Using AdLib instead." msgstr "" -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1988,7 +2024,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -1999,7 +2035,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2010,7 +2046,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2032,68 +2068,51 @@ msgstr "~O~verganger aktivert" #. I18N: Drop book page #: engines/mohawk/dialogs.cpp:95 msgid "~D~rop Page" -msgstr "" +msgstr "~D~ropp Side" #: engines/mohawk/dialogs.cpp:99 msgid "~S~how Map" -msgstr "" +msgstr "Vi~s~ Kart" #: engines/mohawk/dialogs.cpp:105 -#, fuzzy msgid "~M~ain Menu" -msgstr "ScummVM Hovedmeny" +msgstr "Hoved~m~eny" #: engines/mohawk/dialogs.cpp:172 msgid "~W~ater Effect Enabled" msgstr "~V~anneffekt aktivert" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 -#, fuzzy +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." -msgstr "" -"Klarte ikke åpne spilltilstand fra fil:\n" -"\n" -"%s" +msgstr "Klarte ikke åpne spilltilstand fra fil." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 -#, fuzzy +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." -msgstr "" -"Klarte ikke lagre spilltilstand til fil:\n" -"\n" -"%s" +msgstr "Klarte ikke lagre spilltilstand fra fil." #: engines/gob/inter_v5.cpp:107 -#, fuzzy msgid "Failed to delete file." -msgstr "" -"Klarte ikke lagre spilltilstand til fil:\n" -"\n" -"%s" +msgstr "Klarte ikke å slette fil." #: engines/groovie/script.cpp:420 -#, fuzzy msgid "Failed to save game" -msgstr "" -"Klarte ikke lagre spilltilstand til fil:\n" -"\n" -"%s" +msgstr "Klarte ikke å lagre spill." #. I18N: Studio audience adds an applause and cheering sounds whenever #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Studiopublikum" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Aktiver studiopublikum" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 @@ -2102,39 +2121,37 @@ msgstr "" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Tillat å hoppe over tekst og kutt-scener" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Helium-modus" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Aktiver Roland GS-modus" +msgstr "Aktiver helium-modus" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Myk scrolling" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Aktiver myk scrolling når man går" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Vanlig muspeker" +msgstr "Flytende muspekere" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Aktiver flytende muspekere" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 @@ -2147,52 +2164,47 @@ msgstr "" #: engines/kyra/lol.cpp:478 msgid "Attack 1" -msgstr "" +msgstr "Angrep 1" #: engines/kyra/lol.cpp:479 msgid "Attack 2" -msgstr "" +msgstr "Angrep 2" #: engines/kyra/lol.cpp:480 msgid "Attack 3" -msgstr "" +msgstr "Angrep 3" #: engines/kyra/lol.cpp:481 msgid "Move Forward" -msgstr "" +msgstr "Beveg Fremover" #: engines/kyra/lol.cpp:482 msgid "Move Back" -msgstr "" +msgstr "Beveg Bakover" #: engines/kyra/lol.cpp:483 msgid "Slide Left" -msgstr "" +msgstr "Skli mot Venstre" #: engines/kyra/lol.cpp:484 -#, fuzzy msgid "Slide Right" -msgstr "Høyre" +msgstr "Skli mot Høyre" #: engines/kyra/lol.cpp:485 -#, fuzzy msgid "Turn Left" -msgstr "Slå av" +msgstr "Svin til Venstre" #: engines/kyra/lol.cpp:486 -#, fuzzy msgid "Turn Right" -msgstr "Peker høyre" +msgstr "Sving til Høyre" #: engines/kyra/lol.cpp:487 -#, fuzzy msgid "Rest" -msgstr "Gjenopprett" +msgstr "Hvil" #: engines/kyra/lol.cpp:488 -#, fuzzy msgid "Options" -msgstr "~V~alg" +msgstr "Valg" #: engines/kyra/lol.cpp:489 #, fuzzy @@ -2200,27 +2212,36 @@ msgid "Choose Spell" msgstr "Velg" #: engines/kyra/sound_midi.cpp:475 +#, fuzzy msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" +"Du ser ut til å bruke en General MIDI-enhet,\n" +"men spillet ditt støtter bare Roland MT32-MIDI.\n" +"Vi forsøker å koble Roland MT32-instrumentene til\n" +"General MIDI-instrumentene. Allikevel, kan det\n" +"skje at enkelte spor ikke vil spilles riktig." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Bruk diskettversjonens intro (Kun for CD-versjon)" #: engines/sky/compact.cpp:130 msgid "" "Unable to find \"sky.cpt\" file!\n" "Please download it from www.scummvm.org" msgstr "" +"Fant ikke filen \"sky.cpt\"!\n" +"Vennligst last den ned fra www.scummvm.org" #: engines/sky/compact.cpp:141 msgid "" @@ -2228,6 +2249,14 @@ msgid "" "Please (re)download it from www.scummvm.org" msgstr "" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Diskett-intro" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Bruk diskettversjonens intro (Kun for CD-versjon)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2256,6 +2285,13 @@ msgid "" "Press OK to convert them now, otherwise you will be asked again the next " "time you start the game.\n" msgstr "" +"ScummVM oppdaget at du har gamle lagrede spill for Broken Sword 1 som bør " +"konverteres.\n" +"Det gamle formatet for lagrede spill støttes ikke lengre, så du vil ikke " +"være i stand til å laste de lagrede spillene,\n" +"med mindre du konverterer dem.\n" +"Trykk OK for å konvertere dem nå, ellers vil du bli spurt igjen neste gang " +"du starter spillet." #: engines/sword1/control.cpp:1232 #, c-format @@ -2266,15 +2302,15 @@ msgstr "" #: engines/sword1/control.cpp:1235 msgid "Keep the old one" -msgstr "" +msgstr "Behold den gamle" #: engines/sword1/control.cpp:1235 msgid "Keep the new one" -msgstr "" +msgstr "Behold den nye" #: engines/sword1/logic.cpp:1633 msgid "This is the end of the Broken Sword 1 Demo" -msgstr "" +msgstr "Dette er slutten på Broken Sword 1-demoen" #: engines/sword2/animation.cpp:435 msgid "" @@ -2289,6 +2325,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2296,17 +2343,15 @@ msgid "" "\n" msgstr "" -#: engines/parallaction/saveload.cpp:211 -#, fuzzy +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." -msgstr "Åpne spill:" +msgstr "Laster spill..." -#: engines/parallaction/saveload.cpp:226 -#, fuzzy +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." -msgstr "Lagret spill:" +msgstr "Lagrer spill..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2315,18 +2360,29 @@ msgid "" "\n" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" +"ScummVM oppdaget at du har gamle lagrede spill for Nippon Safes som bør " +"omdøpes.\n" +"De gamle navnene støttes ikke lengre, så du vil ikke være i stand til å " +"laste de lagrede spillene,\n" +"med mindre du konverterer dem.\n" +"Trykk OK for å konvertere dem nå, ellers vil du bli spurt igjen neste gang " +"du starter spillet." -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." -msgstr "" +msgstr "ScummVM konverterte alle de lagrede spillene dine uten problemer." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" "\n" "Please report to the team." msgstr "" +"ScummVM skrev ut noen advarsler i konsollvinduet ditt og kan ikke garantere " +"at alle filene dine har blitt konvertert.\n" +"\n" +"Vennligst rapporter dette til teamet." #: audio/fmopl.cpp:49 msgid "MAME OPL emulator" @@ -2342,11 +2398,13 @@ msgid "" "The selected audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" +"Den valgte lydenheten '%s' ble ikke funnet (den kan f.eks. være avslått " +"eller frakoblet)." #: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257 #: audio/mididrv.cpp:272 msgid "Attempting to fall back to the next available device..." -msgstr "" +msgstr "Forsøker å falle tilbake på den neste tilgjengelige enheten..." #: audio/mididrv.cpp:221 #, c-format @@ -2354,6 +2412,8 @@ msgid "" "The selected audio device '%s' cannot be used. See log file for more " "information." msgstr "" +"Den valgte lydenheten '%s' kan ikke brukes. Se logg-filen for mer " +"informasjon." #: audio/mididrv.cpp:257 #, c-format @@ -2361,6 +2421,8 @@ msgid "" "The preferred audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" +"Den foretrukne lydenheten '%s' ble ikke funnet (den kan f.eks. være avslått " +"eller frakoblet)." #: audio/mididrv.cpp:272 #, c-format @@ -2368,6 +2430,8 @@ msgid "" "The preferred audio device '%s' cannot be used. See log file for more " "information." msgstr "" +"Den foretrukne lydenheten '%s' kan ikke brukes. Se i logg-filen for mer " +"informasjon." #: audio/null.h:43 msgid "No music" @@ -2390,7 +2454,6 @@ msgid "C64 Audio Emulator" msgstr "C64 Lydemulator" #: audio/softsynth/mt32.cpp:293 -#, fuzzy msgid "Initializing MT-32 Emulator" msgstr "Initialiserer MT-32-Emulator" @@ -2421,7 +2484,7 @@ msgstr " (Aktiv)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (Blokkert)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2508,14 +2571,12 @@ msgid "Disable power off" msgstr "Deaktiver strømsparing" #: backends/platform/iphone/osys_events.cpp:300 -#, fuzzy msgid "Mouse-click-and-drag mode enabled." -msgstr "Touchpad-modus aktivert." +msgstr "Mus-klikk-og-dra-modus aktivert." #: backends/platform/iphone/osys_events.cpp:302 -#, fuzzy msgid "Mouse-click-and-drag mode disabled." -msgstr "Touchpad-modus deaktivert." +msgstr "Mus-klikk-og-dra-modus-deaktivert." #: backends/platform/iphone/osys_events.cpp:313 msgid "Touchpad mode enabled." @@ -2525,11 +2586,11 @@ msgstr "Touchpad-modus aktivert." msgid "Touchpad mode disabled." msgstr "Touchpad-modus deaktivert." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Klikkmodus" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2537,12 +2598,11 @@ msgstr "" msgid "Left Click" msgstr "Venstreklikk" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Midtre venstre gjenstand" +msgstr "Midtklikk" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2550,7 +2610,6 @@ msgid "Right Click" msgstr "Høyreklikk" #: backends/platform/sdl/macosx/appmenu_osx.mm:78 -#, fuzzy msgid "Hide ScummVM" msgstr "Skjul ScummVM" @@ -2580,28 +2639,24 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 -#, fuzzy msgid "Enabled aspect ratio correction" -msgstr "Veksle aspekt-rate korrigering" +msgstr "Aspekt-rate korrigering aktivert" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 -#, fuzzy msgid "Disabled aspect ratio correction" -msgstr "Veksle aspekt-rate korrigering" +msgstr "Aspekt-rate korrigering deaktivert" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 -#, fuzzy +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" -msgstr "Bytt grafikkfiltre" +msgstr "Aktivt grafikkfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 -#, fuzzy msgid "Windowed mode" -msgstr "Tegnemodus:" +msgstr "Vindusmodus" #: backends/graphics/opengl/opengl-graphics.cpp:135 msgid "OpenGL Normal" @@ -2616,21 +2671,20 @@ msgid "OpenGL Original" msgstr "OpenGL Original" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:415 -#, fuzzy msgid "Current display mode" -msgstr "Nåværende videomodus:" +msgstr "Nåværende videomodus" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:428 msgid "Current scale" -msgstr "" +msgstr "Nåværende skala" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:558 msgid "Active filter mode: Linear" -msgstr "" +msgstr "Aktiv filtermodus: Linjær" #: backends/graphics/openglsdl/openglsdl-graphics.cpp:560 msgid "Active filter mode: Nearest" -msgstr "" +msgstr "Aktiv filtermodus: Nærmeste" #: backends/platform/symbian/src/SymbianActions.cpp:38 #: backends/platform/wince/CEActionsSmartphone.cpp:39 @@ -2714,7 +2768,7 @@ msgstr "Horisontal underscan:" #: backends/platform/wii/options.cpp:66 msgid "Vertical underscan:" -msgstr "Vertikal underscan" +msgstr "Vertikal underscan:" #: backends/platform/wii/options.cpp:71 msgid "Input" @@ -2813,17 +2867,15 @@ msgid "Network down" msgstr "Nettverket er nede" #: backends/platform/wii/options.cpp:178 -#, fuzzy msgid "Initializing network" msgstr "Initialiserer nettverk" #: backends/platform/wii/options.cpp:182 -#, fuzzy msgid "Timeout while initializing network" msgstr "Timeout under initialisering av nettverk" #: backends/platform/wii/options.cpp:186 -#, fuzzy, c-format +#, c-format msgid "Network not initialized (%d)" msgstr "Nettverk ikke initialisert (%d)" @@ -2945,83 +2997,74 @@ msgstr "" "inventaret" #: backends/events/default/default-events.cpp:191 -#, fuzzy msgid "Do you really want to return to the Launcher?" -msgstr "Vil du virkelig slette dette lagrede spillet?" +msgstr "Vil du virkelig returnere til oppstarteren?" #: backends/events/default/default-events.cpp:191 -#, fuzzy msgid "Launcher" -msgstr "Slå" +msgstr "Oppstarter" #: backends/events/default/default-events.cpp:213 -#, fuzzy msgid "Do you really want to quit?" -msgstr "Vil du avslutte?" +msgstr "Vil du virkelig avslutte?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" -msgstr "" +msgstr "Touchskjerm 'Tapmodus' - Venstreklikk" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" -msgstr "" +msgstr "Touchskjerm 'Tapmodus' - Høyreklikk" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" -msgstr "" +msgstr "Touchskjerm 'Tapmodus' - Sveve (Ingen Klikk)" -#: backends/events/gph/gph-events.cpp:362 -#, fuzzy +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" -msgstr "Volum" +msgstr "Maksimalt Volum" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" -msgstr "" +msgstr "Øker volum" -#: backends/events/gph/gph-events.cpp:370 -#, fuzzy +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" -msgstr "Volum" +msgstr "Minimalt Volum" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" -msgstr "" +msgstr "Senker volum" #: backends/updates/macosx/macosx-updates.mm:65 msgid "Check for Updates..." -msgstr "" +msgstr "Sjekk for oppdateringer..." #: backends/platform/bada/form.cpp:269 -#, fuzzy msgid "Right Click Once" -msgstr "Høyreklikk" +msgstr "Høyreklikk én gang" #: backends/platform/bada/form.cpp:277 -#, fuzzy msgid "Move Only" -msgstr "Tale" +msgstr "Kun Beveg" #: backends/platform/bada/form.cpp:291 msgid "Escape Key" -msgstr "" +msgstr "ESC-tast" #: backends/platform/bada/form.cpp:296 -#, fuzzy msgid "Game Menu" -msgstr "Spill" +msgstr "Spillmeny" #: backends/platform/bada/form.cpp:301 -#, fuzzy msgid "Show Keypad" -msgstr "Vis tastatur" +msgstr "Vis talltastatur" #: backends/platform/bada/form.cpp:309 msgid "Control Mouse" @@ -3029,11 +3072,11 @@ msgstr "" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Enabled" -msgstr "" +msgstr "Klikking aktivert" #: backends/events/maemosdl/maemosdl-events.cpp:192 msgid "Clicking Disabled" -msgstr "" +msgstr "Klikking deaktivert" #~ msgid "Hercules Green" #~ msgstr "Hercules Grønn" @@ -3049,7 +3092,6 @@ msgstr "" #~ msgid "Hercules Amber" #~ msgstr "Hercules Oransje" -#, fuzzy #~ msgid "Save game failed!" #~ msgstr "Lagret spill:" diff --git a/po/nn_NO.po b/po/nn_NO.po index a5b01a7c5262..1b78932a4654 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" "PO-Revision-Date: 2011-04-25 23:07+0100\n" "Last-Translator: Einar Johan T. Sømåen \n" "Language-Team: somaen \n" +"Language: Norsk (nynorsk)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Norsk (nynorsk)\n" "X-Poedit-Language: Norwegian Nynorsk\n" "X-Poedit-SourceCharset: iso-8859-1\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -48,10 +48,11 @@ msgstr "G #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -95,16 +96,16 @@ msgstr "Kople" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -443,14 +444,14 @@ msgstr "S msgid "Search:" msgstr "Søk:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Åpne spel:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Åpne" @@ -610,7 +611,7 @@ msgid "Special dithering modes supported by some games" msgstr "Spesielle dithering-modus som støttast av nokre spel" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Fullskjermsmodus" @@ -920,68 +921,104 @@ msgstr "" "Temaet du har valt støttar ikkje det aktive språket. Om du vil nytte dette " "temaet må du bytte til eit anna språk først." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Ingen dato lagra" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Inga tid lagra" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Inga speletid lagra" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Slett" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Vil du verkeleg slette det lagra spelet?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Dato: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Tid: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Speletid: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Ikkje navngjeven speltilstand" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Lagre" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Full speltittel:" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Namn:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Vel eit tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Deaktivert GFX" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Deaktivert GFX" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard Teiknar (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Antialiased Teiknar (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Antialiased (16bpp)" @@ -1086,16 +1123,16 @@ msgstr "" msgid "Unknown error" msgstr "Ukjend feil" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "" -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "" @@ -1123,25 +1160,25 @@ msgstr "~H~jelp" msgid "~A~bout" msgstr "~O~m" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 #, fuzzy msgid "~R~eturn to Launcher" msgstr "~T~ilbake til oppstarter" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 #, fuzzy msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~T~ilbake til oppstarter" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Lagra spel:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1150,31 +1187,31 @@ msgstr "Lagra spel:" msgid "Save" msgstr "Lagre" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~vbryt" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~astar" @@ -1242,11 +1279,11 @@ msgstr "" msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Gjenopprett spel:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Gjenopprett" @@ -1276,12 +1313,12 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" +msgid "Use IMF/Yamaha FB-01 for MIDI output" msgstr "" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" @@ -1975,7 +2012,7 @@ msgid "" "but %s is missing. Using AdLib instead." msgstr "" -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1983,7 +2020,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -1991,7 +2028,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -1999,7 +2036,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2036,17 +2073,17 @@ msgstr "ScummVM Hovudmeny" msgid "~W~ater Effect Enabled" msgstr "~V~anneffekt aktivert" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "" -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "" @@ -2178,16 +2215,16 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" msgstr "" #: engines/sky/compact.cpp:130 @@ -2202,6 +2239,14 @@ msgid "" "Please (re)download it from www.scummvm.org" msgstr "" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2263,6 +2308,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2270,17 +2326,17 @@ msgid "" "\n" msgstr "" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 #, fuzzy msgid "Loading game..." msgstr "Åpne spel:" -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 #, fuzzy msgid "Saving game..." msgstr "Lagra spel:" -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2290,11 +2346,11 @@ msgid "" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "" -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2497,11 +2553,11 @@ msgstr "" msgid "Touchpad mode disabled." msgstr "" -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2509,12 +2565,12 @@ msgstr "" msgid "Left Click" msgstr "Venstreklikk" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 #, fuzzy msgid "Middle Click" msgstr "Midtre venstre gjenstand" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2552,24 +2608,24 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (inga skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 #, fuzzy msgid "Enabled aspect ratio correction" msgstr "Veksle aspekt-korrigering" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 #, fuzzy msgid "Disabled aspect ratio correction" msgstr "Veksle aspekt-korrigering" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 #, fuzzy msgid "Active graphics filter:" msgstr "Veksle grafikkfiltre" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 #, fuzzy msgid "Windowed mode" @@ -2928,39 +2984,39 @@ msgstr "Sl msgid "Do you really want to quit?" msgstr "Vil du avslutte?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 #, fuzzy msgid "Maximum Volume" msgstr "Volum" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 #, fuzzy msgid "Minimal Volume" msgstr "Volum" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "" diff --git a/po/pl_PL.po b/po/pl_PL.po index 94929760ccaa..1bf44d1a66c5 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -1,20 +1,20 @@ # Polish translation for ScummVM. # Copyright (C) 2010-2012 ScummVM Team # This file is distributed under the same license as the ScummVM package. -# Grajpopolsku.pl , 2011. +# Grajpopolsku.pl , 2011-2012. # msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-10-24 21:14+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-29 15:49+0100\n" "Last-Translator: Micha³ Zi±bkowski \n" "Language-Team: Grajpopolsku.pl \n" +"Language: Polski\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-2\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Polski\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" "X-Poedit-Basepath: .\n" "X-Poedit-Language: Polish\n" @@ -48,10 +48,11 @@ msgstr "W g #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -81,7 +82,6 @@ msgid "Remap keys" msgstr "Dostosuj klawisze" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "W³±cz/wy³±cz pe³ny ekran" @@ -95,16 +95,16 @@ msgstr "Przypisz" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -195,9 +195,8 @@ msgid "Platform:" msgstr "Platforma:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Zbadaj" +msgstr "Silnik" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -441,14 +440,14 @@ msgstr "Wyszukaj gr msgid "Search:" msgstr "Szukaj" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Wczytaj grê:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Wczytaj" @@ -607,7 +606,7 @@ msgid "Special dithering modes supported by some games" msgstr "Specjalne tryby ditheringu wspierane przez niektóre gry" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Pe³ny ekran" @@ -922,68 +921,104 @@ msgstr "" "Wybrany styl nie obs³uguje obecnego jêzyka. Je¶li chcesz go u¿ywaæ, zmieñ " "najpierw swój jêzyk." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Brak daty" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Brak godziny" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Brak czasu gry" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Skasuj" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Na pewno chcesz skasowaæ ten zapis?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Data: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Czas: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Czas gry: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Zapis bez nazwy" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Zapisz" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Nie uda³o siê zapisaæ stanu gry" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nazwa:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Wybierz styl" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Wy³±czona grafika" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Wy³±czona grafika" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standardowy renderer (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standardowy (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Wyg³adzany renderer (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Wyg³adzany (16bpp)" @@ -1087,16 +1122,16 @@ msgstr "Przerwane przez u msgid "Unknown error" msgstr "Nieznany b³±d" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Gra w '%s' wygl±da na nieznan±." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "Przeka¿ poni¿sze dane zespo³owi ScummVM razem z nazw±" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "gry, któr± próbowa³e¶ dodaæ oraz jej wersj±, jêzykiem itd.:" @@ -1124,23 +1159,23 @@ msgstr "~P~omoc" msgid "~A~bout" msgstr "~I~nformacje" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~P~owrót do launchera" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~P~owrót do launchera" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Zapis:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1149,7 +1184,7 @@ msgstr "Zapis:" msgid "Save" msgstr "Zapisz" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1159,27 +1194,26 @@ msgstr "" "uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, " "sprawd¼ plik README." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Przepraszamy, ten silnik obecnie nie oferuje pomocy wewn±trz gry. Aby " -"uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, " -"sprawd¼ plik README." +"Zapis stanu gry nie powiód³ siê (%s)! Aby uzyskaæ podstawowe informacje oraz " +"dowiedzieæ jak szukaæ dalszej pomocy, sprawd¼ plik README." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" -msgstr "~O~K" +msgstr "" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~A~nuluj" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~K~lawisze" @@ -1224,14 +1258,13 @@ msgstr "" "Dalsze informacje s± dostêpne w pliku README." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Przepraszamy, ten silnik obecnie nie oferuje pomocy wewn±trz gry. Aby " -"uzyskaæ podstawowe informacje oraz dowiedzieæ jak szukaæ dalszej pomocy, " -"sprawd¼ plik README." +"Odczyt stanu gry nie powiód³ siê (%s)! Aby uzyskaæ podstawowe informacje " +"oraz dowiedzieæ jak szukaæ dalszej pomocy, sprawd¼ plik README." #: engines/engine.cpp:439 msgid "" @@ -1250,84 +1283,84 @@ msgstr "W #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "U¿yj oryginalnych ekranów odczytu/zapisu" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "" +msgstr "U¿yj oryginalnych ekranów odczytu/zapisu zamiast tych ze ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Wznów grê:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Wznów" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Przedmiot u góry, z prawej" +msgstr "U¿yj trybu jasnej palety" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Wy¶wietlaj grafikê za pomoc± jasnej palety gry" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "Anty-dithering EGA" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" msgstr "W³±cz anty-dithering we wspieranych grach EGA" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "G³o¶no¶æ efektów d¼w." +msgstr "Preferuj cyfrowe efekty d¼wiêkowe" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Preferuj cyfrowe efekty d¼wiêkowe zamiast syntezowanych" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "U¿yj IMF/Yamaha FB-01 dla wyj¶cia MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"U¿yj karty IBM Music Feature lub modu³u syntezy FM Yamaha FB-01 dla wyj¶cia " +"MIDI" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "U¿yj CD audio" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "U¿yj CD audio zamiast muzyki w grze, je¶li jest dostêpne" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "U¿yj windowsowych kursorów" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"U¿yj windowsowych kursorów (mniejsze i monochromatyczne) zamiast DOS-owych" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Zwyk³y kursor" +msgstr "U¿yj srebrnych kursorów" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"U¿yj alternatywnego zestawu srebrnych kursorów zamiast zwyk³ych z³otych" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1445,24 +1478,23 @@ msgstr "Mowa i napisy" #: engines/scumm/dialogs.cpp:653 msgid "Select a Proficiency Level." -msgstr "" +msgstr "Wybierz poziom umiejêtno¶ci." #: engines/scumm/dialogs.cpp:655 msgid "Refer to your Loom(TM) manual for help." -msgstr "" +msgstr "Pomocy szukaj w instrukcji do³±czonej do Loom(TM)." #: engines/scumm/dialogs.cpp:658 -#, fuzzy msgid "Standard" -msgstr "Standardowy (16bpp)" +msgstr "Standardowy" #: engines/scumm/dialogs.cpp:659 msgid "Practice" -msgstr "" +msgstr "Trening" #: engines/scumm/dialogs.cpp:660 msgid "Expert" -msgstr "" +msgstr "Ekspert" #: engines/scumm/help.cpp:73 msgid "Common keyboard commands:" @@ -1986,7 +2018,7 @@ msgstr "" "Natywne wsparcie MIDI wymaga aktualizacji Rolanda od LucasArts,\n" "ale brakuje %s. Prze³±czam na tryb AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1997,7 +2029,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2008,7 +2040,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2019,7 +2051,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2055,17 +2087,17 @@ msgstr "~M~enu g msgid "~W~ater Effect Enabled" msgstr "~E~fekty wody w³±czone" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Nie znaleziono pliku przerywnika '%s'!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Nie uda³o siê wczytaæ stanu gry z pliku." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Nie uda³o siê zapisaæ stanu gry do pliku." @@ -2081,136 +2113,129 @@ msgstr "Nie uda #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Publiczno¶æ studyjna" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "W³±cz publiczno¶æ studyjn±" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Obs³uga pomijania" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Pozwól pomijaæ tekst i przerywniki" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Tryb helowy" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "W³±cz tryb Roland GS" +msgstr "W³±cz tryb helowy" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "P³ynne przewijanie" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "W³±cz p³ynne przewijanie przy chodzeniu" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Zwyk³y kursor" +msgstr "P³ywaj±ce kursory" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "W³±cz p³ywaj±ce kursory" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Histogramy HP" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "W³±cz histogramy punktów ¿ycia" #: engines/kyra/lol.cpp:478 msgid "Attack 1" -msgstr "" +msgstr "Atak 1" #: engines/kyra/lol.cpp:479 msgid "Attack 2" -msgstr "" +msgstr "Atak 2" #: engines/kyra/lol.cpp:480 msgid "Attack 3" -msgstr "" +msgstr "Atak 3" #: engines/kyra/lol.cpp:481 msgid "Move Forward" -msgstr "" +msgstr "Ruch naprzód" #: engines/kyra/lol.cpp:482 msgid "Move Back" -msgstr "" +msgstr "Ruch wstecz" #: engines/kyra/lol.cpp:483 msgid "Slide Left" -msgstr "" +msgstr "¦lizg w lewo" #: engines/kyra/lol.cpp:484 -#, fuzzy msgid "Slide Right" -msgstr "W prawo" +msgstr "¦lizg w prawo" #: engines/kyra/lol.cpp:485 -#, fuzzy msgid "Turn Left" -msgstr "Wy³±cz" +msgstr "Obrót w lewo" #: engines/kyra/lol.cpp:486 -#, fuzzy msgid "Turn Right" -msgstr "Kursor w prawo" +msgstr "Obrót w prawo" #: engines/kyra/lol.cpp:487 -#, fuzzy msgid "Rest" -msgstr "Wznów" +msgstr "Odpoczynek" #: engines/kyra/lol.cpp:488 -#, fuzzy msgid "Options" -msgstr "~O~pcje" +msgstr "Opcje" #: engines/kyra/lol.cpp:489 -#, fuzzy msgid "Choose Spell" -msgstr "Wybierz" +msgstr "Wybierz zaklêcie" #: engines/kyra/sound_midi.cpp:475 msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Wygl±da na to, ¿e u¿ywasz urz±dzenia General MIDI, ale gra obs³uguje tylko " "MIDI Roland MT32.\n" "Próbujemy przypisaæ instrumenty Rolanda MT32 do instrumentów General MIDI. " "Niektóre utwory mog± byæ ¼le odtwarzane." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "U¿yj intra z wersji dyskietkowej (tylko dla wersji CD)" #: engines/sky/compact.cpp:130 msgid "" @@ -2228,10 +2253,20 @@ msgstr "" "Plik \"sky.cpt\" ma nieprawid³owy rozmiar.\n" "Pobierz go (ponownie) ze strony www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Intro z wersji dyskietkowej" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "U¿yj intra z wersji dyskietkowej (tylko dla wersji CD)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" msgstr "" +"Przerywnik w formacie strumieniowym PSX '%s' nie mo¿e zostaæ odtworzony w " +"trybie indeksowanym" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2288,19 +2323,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "To koniec dema Broken Sword 1" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"Znaleziono przerywniki w formacie DXA, ale ScummVM jest skompilowany bez " -"obs³ugi zlib" +"Znaleziono przerywniki PSX, ale ScummVM jest skompilowany bez obs³ugi trybu " +"RGB" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Poka¿ etykiety obiektów" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Poka¿ etykiety obiektów przy najechaniu myszk±" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2312,15 +2357,15 @@ msgstr "" "Nie mo¿na zapisaæ w slocie %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Wczytywanie stanu gry..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Zapisywanie stanu gry..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2336,11 +2381,11 @@ msgstr "" "Naci¶nij OK, ¿eby je teraz przekonwertowaæ. W przeciwnym wypadku zostaniesz " "zapytany ponownie przy nastêpnym w³±czeniu gry.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM pomy¶lnie przekonwertowa³ wszystkie twoje zapisy." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2442,9 +2487,8 @@ msgid "Keymap:" msgstr "Klawisze:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" -msgstr " (Aktywny)" +msgstr " (Dzia³a)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Active)" @@ -2452,7 +2496,7 @@ msgstr " (Aktywny)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (Zablokowany)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2554,11 +2598,11 @@ msgstr "Tryb touchpada w msgid "Touchpad mode disabled." msgstr "Tryb touchpada wy³±czony." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Tryb klikania" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2566,12 +2610,11 @@ msgstr "" msgid "Left Click" msgstr "Klikniêcie LPM" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Przedmiot na ¶rodku, z lewej" +msgstr "¦rodkowy przycisk" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2608,21 +2651,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Zwyk³y (bez skalowania)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "W³±czono korekcjê formatu obrazu" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Wy³±czono korekcjê formatu obrazu" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Aktywny filtr graficzny:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Okno" @@ -2973,37 +3016,37 @@ msgstr "" msgid "Do you really want to quit?" msgstr "Na pewno chcesz wyj¶æ?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Dotkniêcie ekranu - klikniêcie LPM" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Dotkniêcie ekranu - klikniêcie PPM" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Dotkniêcie ekranu - brak klikniêcia" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Maksymalna g³o¶no¶æ" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Zwiêkszenie g³o¶no¶ci" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Minimalna g³o¶no¶æ" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Zmniejszenie g³o¶no¶ci" diff --git a/po/pt_BR.po b/po/pt_BR.po index 2c3a530b3012..f41aa7d59f06 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" "PO-Revision-Date: 2011-10-21 21:30-0300\n" "Last-Translator: Saulo Benigno \n" "Language-Team: ScummBR (www.scummbr.com) \n" +"Language: Portugues (Brasil)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Portugues (Brasil)\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "X-Poedit-Language: Portuguese\n" "X-Poedit-Country: BRAZIL\n" @@ -48,10 +48,11 @@ msgstr "Acima" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -95,16 +96,16 @@ msgstr "Mapear" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -442,14 +443,14 @@ msgstr "Pesquisar na lista de jogos" msgid "Search:" msgstr "Pesquisar:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Carregar jogo:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Carregar" @@ -615,7 +616,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modos especiais de dithering suportados por alguns jogos" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Modo Tela Cheia" @@ -931,68 +932,104 @@ msgstr "" "O tema que você selecionou não suporta seu idioma atual. Se você quiser usar " "este tema você precisa mudar para outro idioma." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Sem data salva" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Sem hora salva" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Sem tempo de jogo salvo" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Excluir" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Você realmente quer excluir este jogo salvo?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Data:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Hora:" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Tempo de jogo:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Não-titulado arquivo de save" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Salvar" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Falha ao salvar o jogo" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Nome:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Selecione um Tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "GFX desabilitado" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "GFX desabilitado" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Renderizador padrão (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Padrão (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Renderizador Anti-Serrilhamento (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Anti-Serrilhamento (16bpp)" @@ -1098,17 +1135,17 @@ msgstr "Usu msgid "Unknown error" msgstr "Erro desconhecido" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "O jogo em '% s' parece ser desconhecido." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "Por favor, informe os seguintes dados para a equipe ScummVM junto com o nome" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "do jogo que você tentou adicionar e sua versão/idioma/etc.:" @@ -1136,23 +1173,23 @@ msgstr "~A~juda" msgid "~A~bout" msgstr "So~b~re" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~V~oltar ao menu" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~V~oltar ao menu" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Salvar jogo:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1161,7 +1198,7 @@ msgstr "Salvar jogo:" msgid "Save" msgstr "Salvar" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1171,7 +1208,7 @@ msgstr "" "Por favor, consulte o README para obter informações básicas, e para obter " "instruções sobre como obter assistência adicional." -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, fuzzy, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " @@ -1181,17 +1218,17 @@ msgstr "" "Por favor, consulte o README para obter informações básicas, e para obter " "instruções sobre como obter assistência adicional." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "~C~ancelar" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~eclas" @@ -1273,11 +1310,11 @@ msgstr "" msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Restaurar jogo:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Restaurar" @@ -1309,12 +1346,12 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" +msgid "Use IMF/Yamaha FB-01 for MIDI output" msgstr "" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" @@ -2003,7 +2040,7 @@ msgstr "" "LucasArts,\n" "mas %s está faltando. Utilizando AdLib ao invés." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2014,7 +2051,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2025,7 +2062,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2036,7 +2073,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2073,20 +2110,20 @@ msgstr "~M~enu Principal ScummVM" msgid "~W~ater Effect Enabled" msgstr "Modo ~E~feitos de água ativado" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Arquivo de vídeo '%s' não encontrado!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "" "Falha ao carregar o estado do jogo a partir do arquivo:\n" "\n" "%s" -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "" "Falha ao salvar o estado do jogo para o arquivo:\n" @@ -2216,12 +2253,13 @@ msgid "Choose Spell" msgstr "Escolher" #: engines/kyra/sound_midi.cpp:475 +#, fuzzy msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "Você parece estar usando um dispositivo General MIDI,\n" "mas, o jogo só suporta Roland MT32 MIDI.\n" @@ -2229,12 +2267,12 @@ msgstr "" "o modelo General MIDI. Talvez possa acontecer\n" "que algumas faixas não sejam corretamente tocadas." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" msgstr "" #: engines/sky/compact.cpp:130 @@ -2253,6 +2291,14 @@ msgstr "" "O arquivo \"sky.cpt\" possui um tamanho incorreto.\n" "Por favor, refaça o download em www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2328,6 +2374,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2337,15 +2394,15 @@ msgstr "" "Não é possível salvar o jogo na posição %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Carregando jogo..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Salvando jogo..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2362,11 +2419,11 @@ msgstr "" "Pressione OK para convertê-los agora, caso contrário você será solicitado na " "próxima vez.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM converteu com êxito todos os seus jogos salvos." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2580,11 +2637,11 @@ msgstr "Modo Touchpad ligado." msgid "Touchpad mode disabled." msgstr "Modo Touchpad desligado." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2592,12 +2649,12 @@ msgstr "" msgid "Left Click" msgstr "Clique com o botão esquerdo" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 #, fuzzy msgid "Middle Click" msgstr "Item do meio na esquerda" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2634,21 +2691,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (sem escala)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Correção de proporção habilitada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Correção de proporção desabilitada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Ativa os filtros gráficos" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Modo janela" @@ -3002,37 +3059,37 @@ msgstr "Menu principal" msgid "Do you really want to quit?" msgstr "Você realmente deseja sair?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Touchscreen 'Modo Toque' - Clique Esquerdo" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Touchscreen 'Modo Toque' - Clique Direito" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Touchscreen 'Modo Toque' - Acima (Sem Clicar)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Volume máximo" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Aumentando Volume" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Volume mínimo" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Diminuindo Volume" diff --git a/po/ru_RU.po b/po/ru_RU.po index dbeb07298e16..3a80d9fd7bf5 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2012-02-16 13:09+0200+0200\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-08 22:00+0200+0200\n" "Last-Translator: Eugene Sandulenko \n" "Language-Team: Russian\n" +"Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-5\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Russian\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%" -"10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n" +"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #: gui/about.cpp:91 #, c-format @@ -46,10 +46,11 @@ msgstr " #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -92,16 +93,16 @@ msgstr " #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -193,9 +194,8 @@ msgid "Platform:" msgstr "¿ÛÐâäÞàÜÐ:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "¿àÞÒÕàØâì" +msgstr "´ÒØÖÞÚ" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -439,14 +439,14 @@ msgstr " msgid "Search:" msgstr "¿ÞØáÚ:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "·ÐÓàã×Øâì ØÓàã:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "·ÐÓàã×Øâì" @@ -606,7 +606,7 @@ msgid "Special dithering modes supported by some games" msgstr "ÁßÕæØÐÛìÝëÕ àÕÖØÜë àÕÝÔÕàØÝÓÐ, ßÞÔÔÕàÖØÒÐÕÜëÕ ÝÕÚÞâÞàëÜØ ØÓàÐÜØ" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "¿ÞÛÝÞíÚàÐÝÝëÙ àÕÖØÜ" @@ -689,8 +689,7 @@ msgstr "SoundFont:" #: gui/options.cpp:849 gui/options.cpp:851 gui/options.cpp:852 msgid "SoundFont is supported by some audio cards, Fluidsynth and Timidity" msgstr "" -"SoundFontë ßÞÔÔÕàÔÖØÒÐîâáï ÝÕÚÞâÞàëÜØ ×ÒãÚÞÒëÜØ ÚÐàâÐÜØ, Fluidsynth Ø " -"Timidity" +"SoundFontë ßÞÔÔÕàÖØÒÐîâáï ÝÕÚÞâÞàëÜØ ×ÒãÚÞÒëÜØ ÚÐàâÐÜØ, Fluidsynth Ø Timidity" #: gui/options.cpp:851 msgctxt "lowres" @@ -716,7 +715,7 @@ msgstr " #: gui/options.cpp:870 msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output" msgstr "" -"ÃÚÐ×ëÒÐÕâ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ßÞ ãÜÞÛçÐÝØï ÔÛï ÒëÒÞÔÐ ÝÐ Roland MT-32/LAPC1/" +"ÃÚÐ×ëÒÐÕâ ×ÒãÚÞÒÞÕ ãáâàÞÙáâÒÞ ßÞ ãÜÞÛçÐÝØî ÔÛï ÒëÒÞÔÐ ÝÐ Roland MT-32/LAPC1/" "CM32l/CM64" #: gui/options.cpp:875 @@ -743,7 +742,8 @@ msgstr " #: gui/options.cpp:880 msgid "Turns off General MIDI mapping for games with Roland MT-32 soundtrack" msgstr "" -"²ëÚÛîçÐÕâ ÜÐßßØÝÓ General MIDI ÔÛï ØÓà á ×ÒãÚÞÒÞÙ ÔÞàÞÖÚÞÙ ÔÛï Roland MT-32" +"²ëÚÛîçÐÕâ áÞßÞáâÐÒÛÕÝØÕ General MIDI ÔÛï ØÓà á ×ÒãÚÞÒÞÙ ÔÞàÞÖÚÞÙ ÔÛï Roland " +"MT-32" #: gui/options.cpp:889 msgid "Don't use Roland MT-32 music" @@ -922,71 +922,107 @@ msgid "" "The theme you selected does not support your current language. If you want " "to use this theme you need to switch to another language first." msgstr "" -"ÂÕÜÐ, ÒëÑàÐÝÝÐï ÒÐÜØ, ÝÕ ßÞÔÔÕàÖØÒÐÕâ ÒëÑàÐÝÝëÙ ï×ëÚ. µáÛØ Òë åÞâØâÕ " +"ÂÕÜÐ, ÒëÑàÐÝÝÐï ÒÐÜØ, ÝÕ ßÞÔÔÕàÖØÒÐÕâ âÕÚãéØÙ ï×ëÚ. µáÛØ Òë åÞâØâÕ " "ØáßÞÛì×ÞÒÐâì íâã âÕÜã, ÒÐÜ ÝÕÞÑåÞÔØÜÞ áÝÐçÐÛÐ ßÕàÕÚÛîçØâìáï ÝÐ ÔàãÓÞÙ ï×ëÚ." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "´ÐâÐ ÝÕ ×ÐßØáÐÝÐ" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "²àÕÜï ÝÕ ×ÐßØáÐÝÞ" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "²àÕÜï ØÓàë ÝÕ ×ÐßØáÐÝÞ" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "ÃÔÐÛØâì" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ãÔÐÛØâì íâÞ áÞåàÐÝÕÝØÕ?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "´ÐâÐ: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "²àÕÜï: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "²àÕÜï ØÓàë: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "ÁÞåàÐÝÕÝØÕ ÑÕ× ØÜÕÝØ" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "ÁÞåàÐÝØâì" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "½Ð×ÒÐÝØÕ:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "²ëÑÕàØâÕ âÕÜã" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "±Õ× ÓàÐäØÚØ" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "±Õ× ÓàÐäØÚØ" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "ÁâÐÝÔÐàâÝëÙ àÐáâÕàØ×ÐâÞà (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "ÁâÐÝÔÐàâÝëÙ àÐáâÕàØ×ÐâÞà (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "ÀÐáâÕàØ×ÐâÞà áÞ áÓÛÐÖØÒÐÝØÕÜ (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "ÀÐáâÕàØ×ÐâÞà áÞ áÓÛÐÖØÒÐÝØÕÜ (16bpp)" @@ -1090,17 +1126,17 @@ msgstr " msgid "Unknown error" msgstr "½ÕØ×ÒÕáâÝÐï ÞèØÑÚÐ" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "ºÐÖÕâáï, çâÞ ØÓàÐ '%s' Õéñ ÝÕØ×ÒÕáâÝÐ." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "¿ÞÖÐÛãÙáâÐ, ßÕàÕÔÐÙâÕ áÛÕÔãîéØÕ ÔÐÝÝëÕ ÚÞÜÐÝÔÕ ScummVM ÒÜÕáâÕ á ÝÐ×ÒÐÝØÕÜ" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "ØÓàë, ÚÞâÞàãî Òë ßëâÐÕâÕáì ÔÞÑÐÒØâì, Ø ãÚÐÖØâÕ Õñ ÒÕàáØî, ï×ëÚ Ø â.Ô." @@ -1128,23 +1164,23 @@ msgstr "~ msgid "~A~bout" msgstr "¾ ßàÞ~Ó~àÐÜÜÕ" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~²~ëÙâØ Ò ÓÛÐÒÝÞÕ ÜÕÝî" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~²~ ÓÛÐÒÝÞÕ ÜÕÝî" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "ÁÞåàÐÝØâì ØÓàã:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1153,37 +1189,37 @@ msgstr " msgid "Save" msgstr "ÁÞåàÐÝØâì" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" -"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. " +"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÚ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. " "¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ " "ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. " -"¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ " -"ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì." +"½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã (%s)! ¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð " +"ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî " +"ßÞÜÞéì." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "¾~â~ÜÕÝÐ" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~º~ÛÐÒØèØ" @@ -1233,14 +1269,14 @@ msgstr "" "äÐÙÛÕ README." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"¿àÞáØÜ ßàÞéÕÝØï, ÝÞ íâÞâ ÔÒØÖÞÕ ßÞÚÐ ÝÕ ßàÕÔÞáâÐÒÛïÕâ ßÞÜÞéØ ÒÝãâàØ ØÓàë. " -"¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ " -"ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì ÔÐÛìÝÕÙèãî ßÞÜÞéì." +"½Õ ãÔÐÛÞáì ßàÞçØâÐâì áÞåàÐÝÕÝØÕ ØÓàë (%s)! ¿ÞÖÐÛãÙáâÐ, ÞÑàÐâØâÕáì Ò äÐÙÛ " +"README ×Ð ÑÐ×ÞÒÞÙ ØÝäÞàÜÐæØÕÙ, Ð âÐÚÖÕ ØÝáâàãÚæØïÜØ Þ âÞÜ, ÚÐÚ ßÞÛãçØâì " +"ÔÐÛìÝÕÙèãî ßÞÜÞéì." #: engines/engine.cpp:439 msgid "" @@ -1259,86 +1295,90 @@ msgstr " #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "¸áßÞÛì×ÞÒÐâì ÞàØÓØÝÐÛìÝëÕ íÚàÐÝë ×ÐßØáØ/çâÕÝØï ØÓàë" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"¸áßÞÛì×ÞÒÐâì ÞàØÓØÝÐÛìÝëÕ íÚàÐÝë ×ÐßØáØ Ø áÞåàÐÝÕÝØï ØÓàë ÒÜÕáâÞ áÔÕÛÐÝÝëå Ò " +"ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "²ÞááâÐÝÞÒØâì ØÓàã:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" -msgstr "²ÞááâÒÝÞÒØâì" +msgstr "²ÞááâÐÝÞÒØâì" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "²ÕàåÝØÙ ßàÐÒëÙ ßàÕÔÜÕâ" +msgstr "¸áßÞÛì×ÞÒÐâì àÕÖØÜ ïàÚÞÙ ßÐÛØâàë" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "ÀØáãÕâ ÓàÐäØÚã á ØáßÞÛì×ÞÒÐÝØÕÜ ïàÚÞÙ ßÐÛØâàë ØÓàë" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA ÑÕ× àÐáâàÐ" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "" -"²ÚÛîçÐÕâ àÕÖØÜ ÑÕ× àÐáâàØàÞÒÐÝØï Ò EGA ØÓàÐå, ÚÞâÞàëÕ ßÞÔÔÕàÖØÒÐîâ âÐÚÞÙ " -"àÕÖØÜ" +msgstr "²ÚÛîçÐÕâ àÕÖØÜ ÑÕ× àÐáâàØàÞÒÐÝØï Ò EGA ØÓàÐå" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "³àÞÜÚÞáâì áßÕæØÐÛìÝëå ×ÒãÚÞÒëå íääÕÚâÞÒ" +msgstr "¿àÕÔßÞçØâÐâì æØäàÞÒëÕ ×ÒãÚÞÒëÕ íääÕÚâë" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" +"¾âÔÐÒÐâì ßàÕÔßÞçâÕÝØÕ æØäàÞÒëÜ ×ÒãÚÞÒëÜ íääÕÚâÐÜ ÒÜÕáâÞ áØÝâÕ×ØàÞÒÐÝÝëå" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "¸áßÞÛì×ÞÒÐâì IMF/Yamaha FB-01 ÔÛï ÒëÒÞÔÐ MIDI" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"¸áßÞÛì×ÒÞÒÐâì ×ÒãÚÞÒãî ÚÐàâÚã IBM Music Feature ØÛØ ÜÞÔãÛì áØÝâÕ×Ð Yamaha " +"FB-01 FM ÔÛï MIDI" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "¸áßÞÛì×ÞÒÐâì CD ÐãÔØÞ" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" msgstr "" +"¸áßÞÛì×ÞÒÐâì ×ÒãÚÞÒëÕ ÔÞàÞÖÚØ á CD ÒÜÕáâÞ Üã×ëÚØ Ø× äÐÙÛÞÒ ØÓàë (ÕáÛØ " +"ÔÞáâãßÝÞ)" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "¸áßÞÛì×ÞÒÐâì ÚãàáÞàë Windows" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"¸áßÞÛì×ÞÒÐâì ÚãàáÞàë Windows (ÜÕÝìèØÕ ßÞ àÐ×ÜÕàã Ø ÞÔÝÞæÒÕâÝëÕ) ÒÜÕáâÞ " +"ÚãàáÞàÞÒ DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "¾ÑëçÝëÙ ÚãàáÞà" +msgstr "¸áßÞÛì×ÞÒÐâì áÕàÕÑàïÝÝëÕ ÚãàáÞàë" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"¸áßÞÛì×ÞÒÐâì ÐÛìâÕàÝÐâØÒÝëÙ ÝÐÑÞà áÕàÕÑàïÝÝëå ÚãàáÞàÞÒ ÒÜÕáâÞ ÞÑëçÝëå ×ÞÛÞâëå" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1996,7 +2036,7 @@ msgstr "" "ÀÕÖØÜ \"àÞÔÝÞÓÞ\" MIDI âàÕÑãÕâ ÞÑÝÞÒÛÕÝØÕ Roland Upgrade Þâ\n" "LucasArts, ÝÞ ÝÕ åÒÐâÐÕâ %s. ¿ÕàÕÚÛîçÐîáì ÝÐ AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2007,7 +2047,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2018,7 +2058,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2029,7 +2069,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2065,17 +2105,17 @@ msgstr " msgid "~W~ater Effect Enabled" msgstr "ÍääÕÚâë ÒÞÔë ÒÚÛîçÕÝë" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "ÄÐÙÛ ×ÐáâÐÒÚØ '%s' ÝÕ ÝÐÙÔÕÝ!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "½Õ ãÔÐÛÞáì ×ÐÓàã×Øâì áÞåàÐÝñÝÝãî ØÓàã Ø× äÐÙÛÐ." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "½Õ ãÔÐÛÞáì áÞåàÐÝØâì ØÓàã Ò äÐÙÛ." @@ -2091,61 +2131,59 @@ msgstr " #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "ÁâãÔØÙÝÐï ÐãÔØâÞàØï" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "²ÚÛîçØâì ×ÒãÚØ ÐãÔØâÞàØØ Ò áâãÔØØ" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "¿ÞÔÔàÕÖÚÐ ßàÞßãáÚÞÒ" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "²ÚÛîçÐÕâ ÒÞ×ÜÞÖÝÞáâì ßàÞßãáÚÐâì âÕÚáâë Ø ×ÐáâÐÒÚØ" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "ÀÕÖØÜ ÓÕÛØï" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "²ÚÛîçØâì àÕÖØÜ Roland GS" +msgstr "²ÚÛîçØâì àÕÖØÜ ÓÕÛØï" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "¿ÛÐÒÝÐï ßàÞÚàãâÚÐ" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "²ÚÛîçØâì ßÛÐÒÝãî ßàÞÚàãâÚã ÒÞ ÒàÕÜï åÞÔìÑë" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "¾ÑëçÝëÙ ÚãàáÞà" +msgstr "¿ÛÐÒÐîéØÕ ÚãàáÞàë" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "²ÚÛîçØâì ßÛÐÒÐîéØÕ ÚãàáÞàë" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "¿ÞÛÞáÚØ ×ÔÞàÞÒìï" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "²ÚÛîçØâì ÞâÞÑàÐÖÕÝØÕ ßÞÛÞáÞÚ ×ÔÞàÞÒìï" #: engines/kyra/lol.cpp:478 msgid "Attack 1" @@ -2200,8 +2238,8 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "ºÐÖÕâáï, Òë ßëâÐÕâÕáì ØáßÞÛì×ÞÒÐâì ãáâàÞÙáâÒÞ\n" "General MIDI, ÝÞ íâÐ ØÓàÐ ßÞÔÔÕàÖØÒÐÕâ âÞÛìÚÞ\n" @@ -2210,13 +2248,14 @@ msgstr "" "ÜÞÖÕâ âÐÚ ßÞÛãçØâìáï, çâÞ ÝÕÚÞâÞàëÕ âàÕÚØ ÑãÔãâ\n" "áëÓàÐÝë ÝÕÒÕàÝÞ." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "¸áßÞÛì×ÞÒÐâì ÒáâãßÛÕÝØÕ á ÓØÑÚØå ÔØáÚÞÒ (âÞÛìÚÞ ÔÛï CD ÒÕàáØØ ØÓàë)" #: engines/sky/compact.cpp:130 msgid "" @@ -2234,10 +2273,18 @@ msgstr "" "ÄÐÙÛ sky.cpt ØÜÕÕâ ÝÕÒÕàÝëÙ àÐ×ÜÕà.\n" "¿ÞÖÐÛãÙáâÐ, áÚÐçÐÙâÕ ÕÓÞ ×ÐÝÞÒÞ á www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "²áâãßÛÕÝØÕ á äÛÞßßØÚÞÒ" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "¸áßÞÛì×ÞÒÐâì ÒáâãßÛÕÝØÕ á ÓØÑÚØå ÔØáÚÞÒ (âÞÛìÚÞ ÔÛï CD ÒÕàáØØ ØÓàë)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" -msgstr "" +msgstr "·ÐáâÐÒÚÐ PSX '%s' ÝÕ ÜÞÖÕâ Ñëâì ßàÞØÓàÐÝÐ Ò àÕÖØÜÕ á ßÐÛØâàÞÙ" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2292,18 +2339,29 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "ÍâÞ ×ÐÒÕàèÕÝØÕ ÔÕÜÞ ÁÛÞÜÐÝÝÞÓÞ ¼ÕçÐ 1" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"½ÐÙÔÕÝë ×ÐáâÐÒÚØ Ò äÞàÜÐâÕ DXA, ÝÞ ScummVM ÑëÛ áÞÑàÐÝ ÑÕ× ßÞÔÔÕàÖÚØ zlib" +"½ÐÙÔÕÝë ×ÐáâÐÒÚØ Ò äÞàÜÐâÕ PSX, ÝÞ ScummVM ÑëÛ áÞÑàÐÝ ÑÕ× ßÞÔÔÕàÖÚØ RGB " +"æÒÕâÞÒ" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "¿ÞÚÐ×ëÒÐâì ÝÐ×ÒÐÝØï ÞÑêÕÚâÞÒ" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "¿ÞÚÐ×ëÒÐÕâ ÝÐ×ÒÐÝØï ÞÑêÕÚâÞÒ ßà ØÝÐÒÕÔÕÝØØ ÚãàáÞàÐ ÜëèØ" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2315,15 +2373,15 @@ msgstr "" "½Õ ÜÞÓã áÞåàÐÝØâì ØÓàã Ò ßÞ×ØæØî %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "·ÐÓàãÖÐî ØÓàã..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "ÁÞåàÐÝïî ØÓàã..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2333,24 +2391,24 @@ msgid "" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" "ScummVM ÞÑÝÐàãÖØÛ ã ÒÐá áâÐàëÕ áÞåàÐÝÕÝØï ØÓàë Nippon Safes, ÚÞâÞàëÕ " -"ÝÕÞÑåÞÔØÜÞ ßÕàÕØÜÕÝÞÒÐâì.ÁâÐàëÕ ÝÐ×ÒÐÝØï ÑÞÛìèÕ ÝÕ ßÞÔÔÕàÖØÒÐîâáï, Ø ßÞíâÞÜã " -"Òë ÝÕ áÜÞÖÕâÕ ×ÐÓàã×Øâì áÞåàÐÝÕÝØï, ÕáÛØ ÝÕ ßÕàÕØÜÕÝãÕâÕ Øå.\n" +"ÝÕÞÑåÞÔØÜÞ ßÕàÕØÜÕÝÞÒÐâì. ÁâÐàëÕ ÝÐ×ÒÐÝØï ÑÞÛìèÕ ÝÕ ßÞÔÔÕàÖØÒÐîâáï, Ø " +"ßÞíâÞÜã Òë ÝÕ áÜÞÖÕâÕ ×ÐÓàã×Øâì áÞåàÐÝÕÝØï, ÕáÛØ ÝÕ ßÕàÕØÜÕÝãÕâÕ Øå.\n" "\n" "½ÐÖÜØâÕ ¾º, çâÞÑë ßÕàÕØÜÕÝÞÒÐâì Øå áÕÙçÐá, Ò ßàÞâØÒÝÞÜ áÛãçÐÕ íâÞ ÖÕ " "áÞÞÑéÕÝØÕ ßÞïÒØâáï ßàØ áÛÕÔãîéÕÜ ×ÐßãáÚÕ ØÓàë.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM ãáßÕèÝÞ ßàÕÞÑàÐ×ÞÒÐÛ ÒáÕ ÒÐèØ áÞåàÐÝÕÝØï ØÓà." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" "\n" "Please report to the team." msgstr "" -"ScummVM ÝÐßØáÐÛ ÝÕáÚÞÛìÚÞ ßàÕÔãßàÕÖÔÕÝØÙ Ò ÞÚÝÞ ÚÞÝáÞÛØ, Ø ÝÕ áÜÞÓ " +"ScummVM ÝÐßØáÐÛ ÝÕáÚÞÛìÚÞ ßàÕÔãßàÕÖÔÕÝØÙ Ò ÞÚÝÞ ÚÞÝáÞÛØ Ø ÝÕ áÜÞÓ " "ßàÕÞÑàÐ×ÞÒÐâì ÒáÕ äÐÙÛë.\n" "\n" "¿ÞÖÐÛãÙáâÐ, áÞÞÑéØâÕ ÞÑ íâÞÜ ÚÞÜÐÝÔÕ ScummVM." @@ -2454,7 +2512,7 @@ msgstr " ( #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (·ÐÑÛÞÚØàÞÒÐÝÐ)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2556,11 +2614,11 @@ msgstr " msgid "Touchpad mode disabled." msgstr "ÀÕÖØÜ âÐçßÐÔÐ ÒëÚÛîçÕÝ." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "ÀÕÖØÜ éÕÛçÚÐ" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2568,11 +2626,11 @@ msgstr " msgid "Left Click" msgstr "»ÕÒëÙ éÕÛçÞÚ" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "ÁàÕÔÝØÙ éÕÛçÞÚ" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2609,21 +2667,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "±Õ× ãÒÕÛØçÕÝØï" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "ºÞààÕÚæØï áÞÞâÝÞèÕÝØï áâÞàÞÝ ÒÚÛîçÕÝÐ" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "ºÞààÕÚæØï áÞÞâÝÞèÕÝØï áâÞàÞÝ ÒëÚÛîçÕÝÐ" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "°ÚâØÒÝëÙ ÓàÐäØçÕáÚØÙ äØÛìâà:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "¾ÚÞÝÝëÙ àÕÖØÜ" @@ -2974,37 +3032,37 @@ msgstr " msgid "Do you really want to quit?" msgstr "²ë ÔÕÙáâÒØâÕÛìÝÞ åÞâØâÕ ÒëÙâØ?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - »ÕÒëÙ ÚÛØÚ" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - ¿àÐÒëÙ ÚÛØÚ" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "ÀÕÖØÜ 'ÚÐáÐÝØÙ' âÐçáÚàØÝÐ - ¿àÞÛñâ (ÑÕ× ÚÛØÚÐ)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "¼ÐÚáØÜÐÛìÝÐï ÓàÞÜÚÞáâì" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "ÃÒÕÛØçÕÝØÕ ÓàÞÜÚÞáâØ" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "¼ØÝØÜÐÛìÝÐï ÓàÞÜÚÞáâì" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "ÃÜÕÝìèÕÝØÕ ÓàÞÜÚÞáâØ" diff --git a/po/scummvm.pot b/po/scummvm.pot index 33ab8552db37..de270cef27d3 100644 --- a/po/scummvm.pot +++ b/po/scummvm.pot @@ -6,12 +6,13 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: ScummVM 1.5.0git\n" +"Project-Id-Version: ScummVM 1.6.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" @@ -44,10 +45,11 @@ msgstr "" #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -90,16 +92,16 @@ msgstr "" #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "" @@ -433,14 +435,14 @@ msgstr "" msgid "Search:" msgstr "" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "" @@ -598,7 +600,7 @@ msgid "Special dithering modes supported by some games" msgstr "" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "" @@ -903,68 +905,101 @@ msgid "" "to use this theme you need to switch to another language first." msgstr "" -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +msgid "New Save" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +msgid "Create a new save game" +msgstr "" + +#: gui/saveload-dialog.cpp:789 +msgid "Name: " +msgstr "" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "" @@ -1068,16 +1103,16 @@ msgstr "" msgid "Unknown error" msgstr "" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "" -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "" @@ -1105,23 +1140,23 @@ msgstr "" msgid "~A~bout" msgstr "" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1130,31 +1165,31 @@ msgstr "" msgid "Save" msgstr "" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" -#: engines/dialogs.cpp:243 +#: engines/dialogs.cpp:228 #, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "" @@ -1220,11 +1255,11 @@ msgstr "" msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "" @@ -1253,12 +1288,12 @@ msgid "Prefer digital sound effects instead of synthesized ones" msgstr "" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" +msgid "Use IMF/Yamaha FB-01 for MIDI output" msgstr "" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" @@ -1942,7 +1977,7 @@ msgid "" "but %s is missing. Using AdLib instead." msgstr "" -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -1950,7 +1985,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -1958,7 +1993,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -1966,7 +2001,7 @@ msgid "" "%s" msgstr "" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -1999,17 +2034,17 @@ msgstr "" msgid "~W~ater Effect Enabled" msgstr "" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "" -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "" @@ -2132,16 +2167,16 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" +#: engines/queen/queen.cpp:60 +msgid "Use an alternative game intro (CD version only)" msgstr "" #: engines/sky/compact.cpp:130 @@ -2156,6 +2191,14 @@ msgid "" "Please (re)download it from www.scummvm.org" msgstr "" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" @@ -2217,6 +2260,17 @@ msgstr "" msgid "Show labels for objects on mouse hover" msgstr "" +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" +msgstr "" + #: engines/parallaction/saveload.cpp:133 #, c-format msgid "" @@ -2224,15 +2278,15 @@ msgid "" "\n" msgstr "" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "" -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "" -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2242,11 +2296,11 @@ msgid "" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "" -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2447,11 +2501,11 @@ msgstr "" msgid "Touchpad mode disabled." msgstr "" -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2459,11 +2513,11 @@ msgstr "" msgid "Left Click" msgstr "" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2500,21 +2554,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "" @@ -2863,37 +2917,37 @@ msgstr "" msgid "Do you really want to quit?" msgstr "" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "" diff --git a/po/se_SE.po b/po/se_SE.po index 592fbcdd5861..02f2ab44f421 100644 --- a/po/se_SE.po +++ b/po/se_SE.po @@ -5,16 +5,16 @@ # msgid "" msgstr "" -"Project-Id-Version: ScummVM 1.3.0svn\n" +"Project-Id-Version: ScummVM 1.5.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2011-11-27 19:00+0100\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-07-08 18:03+0100\n" "Last-Translator: Hampus Flink \n" "Language-Team: \n" +"Language: Svenska\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Svenska\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "X-Poedit-Language: Swedish\n" "X-Poedit-Country: SWEDEN\n" @@ -48,10 +48,11 @@ msgstr "Upp #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -81,7 +82,6 @@ msgid "Remap keys" msgstr "Ställ in tangenter" #: gui/gui-manager.cpp:129 base/main.cpp:307 -#, fuzzy msgid "Toggle FullScreen" msgstr "Fullskärmsläge" @@ -95,16 +95,16 @@ msgstr "St #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -197,9 +197,8 @@ msgid "Platform:" msgstr "Plattform:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "Undersök" +msgstr "Motor" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -443,14 +442,14 @@ msgstr "S msgid "Search:" msgstr "Sök:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "Ladda spel:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "Ladda" @@ -611,7 +610,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciella gitterlägen stödda av vissa spel" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "Fullskärmsläge" @@ -926,68 +925,104 @@ msgstr "" "Temat du valde stöder inte ditt språk. Om du vill använda det här temat " "måste först byta till ett annat språk." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "Inget datum sparat" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "Ingen tid sparad" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "Ingen speltid sparad" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "Radera" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "Vill du verkligen radera den här spardatan?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "Datum:" -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "Tid:" -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "Speltid:" -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "Namnlös spardata" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "Spara" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "Kunde inte spara spelet." + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "Namn:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "Välj ett tema" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "Inaktiverad GFX" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "Inaktiverad GFX" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "Standard rendering (16 bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "Standard (16 bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "Antialiserad rendering (16 bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "Antialiserad (16 bpp)" @@ -1091,17 +1126,17 @@ msgstr "Avbrutit av anv msgid "Unknown error" msgstr "Okänt fel" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "Spelet i '%s' verkar vara okänt." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "" "Var god rapportera följande data till ScummVM-teamet tillsammans med namnet" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "på spelet du försökte lägga till och dess version/språk/etc.:" @@ -1129,23 +1164,23 @@ msgstr "~H~j msgid "~A~bout" msgstr "O~m~..." -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "Åte~r~vänd till launcher" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "Åte~r~vänd till launcher" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "Spara spelet:" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1154,7 +1189,7 @@ msgstr "Spara spelet:" msgid "Save" msgstr "Spara" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1164,27 +1199,24 @@ msgstr "" "hänvisa till README-filen för information och instruktioner för att få " "ytterligare assistens." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." -msgstr "" -"Tyvärr stöder för tillfället inte den här motorn hjälp-funktionen. Var god " -"hänvisa till README-filen för information och instruktioner för att få " -"ytterligare assistens." +msgstr "Spar" -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "A~v~bryt" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~T~angenter" @@ -1233,14 +1265,13 @@ msgstr "" "Se README-filen för detaljer." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"Tyvärr stöder för tillfället inte den här motorn hjälp-funktionen. Var god " -"hänvisa till README-filen för information och instruktioner för att få " -"ytterligare assistens." +"Kunde inte ladda spardata (%s)! Hänvisa till README-filen för grundläggande " +"information och instruktioner för ytterligare assistans." #: engines/engine.cpp:439 msgid "" @@ -1259,84 +1290,84 @@ msgstr "Starta #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "Använd originalskärmar för spara/ladda" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "" +msgstr "Använder originalskärmarna för spara/ladda istället för ScummVM:s" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "Återställ spel:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "Återställ" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "Övre högra föremålet" +msgstr "Använd ljus palett-läge" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "Visa grafik med spelets ljusa palett" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA anti-gitter" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "Aktiverar anti-gitter i EGA spel som stöder det" +msgstr "Aktivera anti-gitter i EGA-spel" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "Volym för specialeffekter" +msgstr "Föredra digitala ljudeffekter" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "Föredra digitala ljudeffekter istället för syntetiserade" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "Använd IMF/Yamaha FB-01 för MIDI-uppspelning" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" +"Använd ett IMB Music Feature-kort eller en Yamaha FB-01 FM synthmodul för " +"MIDI-uppspelning" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "Använd CD-ljud" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "Använd CD-ljud istället för spelets ljud, om tillgängligt" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "Använd Windows muspekare" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" msgstr "" +"Använd Windows muspekare (mindre och svartvit) istället för DOS-pekaren" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "Vanlig pekare" +msgstr "Använd silverpekare" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"Använd de alternativa silverpekarna istället för de normala guldpekarna" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1454,24 +1485,23 @@ msgstr "Tal & text" #: engines/scumm/dialogs.cpp:653 msgid "Select a Proficiency Level." -msgstr "" +msgstr "Välj en skicklighetsnivå." #: engines/scumm/dialogs.cpp:655 msgid "Refer to your Loom(TM) manual for help." -msgstr "" +msgstr "Hänvisa till din Loom(TM)-manual för hjälp." #: engines/scumm/dialogs.cpp:658 -#, fuzzy msgid "Standard" -msgstr "Standard (16 bpp)" +msgstr "Standard" #: engines/scumm/dialogs.cpp:659 msgid "Practice" -msgstr "" +msgstr "Övning" #: engines/scumm/dialogs.cpp:660 msgid "Expert" -msgstr "" +msgstr "Expert" #: engines/scumm/help.cpp:73 msgid "Common keyboard commands:" @@ -1995,40 +2025,40 @@ msgstr "" "Stöd för Native MIDI kräver Roland-uppdateringen från LucasArts,\n" "men %s saknas. Använder AdLib istället." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" "\n" "%s" msgstr "" -"Kunde inte skriva spardata till file:\n" +"Kunde inte skriva spardata till filen:\n" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" "\n" "%s" msgstr "" -"Kunde inte läsa spardata från file:\n" +"Kunde inte läsa spardata från filen:\n" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" "\n" "%s" msgstr "" -"Sparade framgångsrikt spardata i file\n" +"Sparade framgångsrikt spardata i filen:\n" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2064,17 +2094,17 @@ msgstr "Huvud~m~eny" msgid "~W~ater Effect Enabled" msgstr "~V~atteneffekt aktiverad" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "Filmscensfilen '%s' hittades ej!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "Kunde inte läsa spardata från filen" -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "Kunde inte skriva spardata till filen." @@ -2090,61 +2120,59 @@ msgstr "Kunde inte spara spelet." #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "Studiopublik" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "Aktivera studiopublik" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "Skipp-stöd" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "Tillåter skippning av text och filmscener" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "Helium-läge" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "Aktivera Roland GS-läge" +msgstr "Aktivera heliumläge" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "Mjuk rullning" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "Aktivera mjuk skärmrullning vid gångfart" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "Vanlig pekare" +msgstr "Flytande pekare" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "Aktivera flytande pekare" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 msgid "HP bar graphs" -msgstr "" +msgstr "Livmätare" #: engines/kyra/detection.cpp:128 msgid "Enable hit point bar graphs" -msgstr "" +msgstr "Aktivera livmätare" #: engines/kyra/lol.cpp:478 msgid "Attack 1" @@ -2199,22 +2227,23 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" -"Du verkar använda en General MIDI enhet\n" +"Du verkar använda en General MIDI-enhet,\n" "men ditt spel stöder endast Roland MT32 MIDI.\n" -"Vi försöker kartlägga Roland MT32 instrument för\n" -"General MIDI instrument. Det kan trots allt hända\n" +"Vi försöker kartlägga Roland MT32-instrumenten till\n" +"General MIDI-instrument. Det kan trots allt hända\n" "att ett fåtal ljudspår inte spelas korrekt." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "Använd diskettversionens intro (endast CD-version)" #: engines/sky/compact.cpp:130 msgid "" @@ -2232,10 +2261,18 @@ msgstr "" "Filen \"sky.cpt\" har inkorrekt filstorlek.\n" "Var god ladda hem den igen från www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "Diskettintro" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "Använd diskettversionens intro (endast CD-version)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" -msgstr "" +msgstr "PSX-filmscenen '%s' kan inte visas i palettläget" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2290,17 +2327,27 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "Här slutar Broken Sword 1 demon" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" -msgstr "DXA filmscener hittades men ScummVM har byggts utan stöd för zlib" +msgstr "PSX-filmscener hittades men ScummVM har byggts utan stöd för RGB-färg" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "Visa etiketter" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "Visar etiketter för objekten som musen pekar på" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2312,15 +2359,15 @@ msgstr "" "Kan inte spara data i position %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "Laddar speldata..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "Sparar speldata..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2337,11 +2384,11 @@ msgstr "" "Tryck \"OK\" för att konvertera dem nu, annars kommer du tillfrågas igen " "nästa gång du startar spelet.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM lyckades konvertera alla dina spardata." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2443,9 +2490,8 @@ msgid "Keymap:" msgstr "Tangenter:" #: backends/keymapper/remap-dialog.cpp:66 -#, fuzzy msgid " (Effective)" -msgstr "(Aktiv)" +msgstr "(Effektiv)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Active)" @@ -2453,7 +2499,7 @@ msgstr "(Aktiv)" #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr "(Blockerad)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2555,11 +2601,11 @@ msgstr "Touchpad-l msgid "Touchpad mode disabled." msgstr "Touchpad-läge inaktiverat." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" -msgstr "" +msgstr "Klickläge" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2567,12 +2613,11 @@ msgstr "" msgid "Left Click" msgstr "Vänsterklick" -#: backends/platform/maemo/maemo.cpp:214 -#, fuzzy +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" -msgstr "Mellersta vänstra föremålet" +msgstr "Mittenklick" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2609,21 +2654,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normalt (ingen skalning)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "Korrektion av bildförhållande på" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "Korrektion av bildförhållande av" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "Aktivt grafikfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "Fönsterläge" @@ -2977,37 +3022,37 @@ msgstr "Launcher" msgid "Do you really want to quit?" msgstr "Vill du verkligen avsluta?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "Touchscreen \"Tap-läge\" - Vänsterklick" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "Touchscren \"Tap-läge\" - Högerklick" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "Touchscreen \"Tap-läge\" - Hover (utan klick)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "Max. volym" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "Höja volymen" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "Min. volym" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "Sänka volymen" diff --git a/po/uk_UA.po b/po/uk_UA.po index 3d8ec456a6c5..be7935518b77 100644 --- a/po/uk_UA.po +++ b/po/uk_UA.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2012-05-20 22:39+0100\n" -"PO-Revision-Date: 2012-02-16 13:09+0200\n" -"Last-Translator: Eugene Sandulenko\n" +"POT-Creation-Date: 2012-08-12 14:57+0200\n" +"PO-Revision-Date: 2012-06-29 20:19+0200\n" +"Last-Translator: lubomyr \n" "Language-Team: Ukrainian\n" +"Language: Ukrainian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-5\n" "Content-Transfer-Encoding: 8bit\n" -"Language: Ukrainian\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%" -"10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n" +"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #: gui/about.cpp:91 #, c-format @@ -46,10 +46,11 @@ msgstr " #: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43 #: gui/launcher.cpp:345 gui/massadd.cpp:94 gui/options.cpp:1228 -#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54 -#: engines/engine.cpp:442 engines/scumm/dialogs.cpp:190 -#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:48 +#: gui/saveload-dialog.cpp:207 gui/saveload-dialog.cpp:267 +#: gui/saveload-dialog.cpp:516 gui/saveload-dialog.cpp:843 +#: gui/themebrowser.cpp:54 engines/engine.cpp:442 +#: engines/scumm/dialogs.cpp:190 engines/sword1/control.cpp:865 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:191 #: backends/events/default/default-events.cpp:213 msgid "Cancel" @@ -92,16 +93,16 @@ msgstr " #: gui/KeysDialog.cpp:42 gui/launcher.cpp:346 gui/launcher.cpp:1001 #: gui/launcher.cpp:1005 gui/massadd.cpp:91 gui/options.cpp:1229 -#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192 -#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551 -#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131 -#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:539 -#: engines/sword1/animation.cpp:560 engines/sword1/animation.cpp:570 -#: engines/sword1/animation.cpp:577 engines/sword1/control.cpp:865 -#: engines/sword1/logic.cpp:1633 engines/sword2/animation.cpp:435 -#: engines/sword2/animation.cpp:455 engines/sword2/animation.cpp:465 -#: engines/sword2/animation.cpp:474 engines/parallaction/saveload.cpp:281 -#: backends/platform/wii/options.cpp:47 +#: gui/saveload-dialog.cpp:844 engines/engine.cpp:361 engines/engine.cpp:372 +#: engines/scumm/dialogs.cpp:192 engines/scumm/scumm.cpp:1775 +#: engines/agos/animation.cpp:561 engines/groovie/script.cpp:420 +#: engines/sky/compact.cpp:131 engines/sky/compact.cpp:141 +#: engines/sword1/animation.cpp:539 engines/sword1/animation.cpp:560 +#: engines/sword1/animation.cpp:570 engines/sword1/animation.cpp:577 +#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633 +#: engines/sword2/animation.cpp:435 engines/sword2/animation.cpp:455 +#: engines/sword2/animation.cpp:465 engines/sword2/animation.cpp:474 +#: engines/parallaction/saveload.cpp:274 backends/platform/wii/options.cpp:47 #: backends/platform/wince/CELauncherDialog.cpp:54 msgid "OK" msgstr "OK" @@ -194,9 +195,8 @@ msgid "Platform:" msgstr "¿ÛÐâäÞàÜÐ:" #: gui/launcher.cpp:231 -#, fuzzy msgid "Engine" -msgstr "ÀÞ×ÓÛïÝãâØ" +msgstr "´ÒØÖÞÚ" #: gui/launcher.cpp:239 gui/options.cpp:1062 gui/options.cpp:1079 msgid "Graphics" @@ -440,14 +440,14 @@ msgstr " msgid "Search:" msgstr "¿ÞèãÚ:" -#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:255 -#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:216 +#: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/mohawk/myst.cpp:245 +#: engines/mohawk/riven.cpp:716 engines/cruise/menu.cpp:214 msgid "Load game:" msgstr "·ÐÒÐÝâÐÖØâØ Óàã:" #: gui/launcher.cpp:680 engines/dialogs.cpp:114 engines/scumm/dialogs.cpp:188 -#: engines/mohawk/myst.cpp:255 engines/mohawk/riven.cpp:716 -#: engines/cruise/menu.cpp:216 backends/platform/wince/CEActionsPocket.cpp:267 +#: engines/mohawk/myst.cpp:245 engines/mohawk/riven.cpp:716 +#: engines/cruise/menu.cpp:214 backends/platform/wince/CEActionsPocket.cpp:267 #: backends/platform/wince/CEActionsSmartphone.cpp:231 msgid "Load" msgstr "·ÐÒÐÝâÐÖØâØ" @@ -607,7 +607,7 @@ msgid "Special dithering modes supported by some games" msgstr "ÁßÕæöÐÛìÝö àÕÖØÜØ àÐáâàãÒÐÝÝï, ïÚö ßöÔâàØÜãîâì ÔÕïÚö öÓàØ" #: gui/options.cpp:753 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2236 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:472 msgid "Fullscreen mode" msgstr "¿ÞÒÝÞÕÚàÐÝÝØÙ àÕÖØÜ" @@ -924,68 +924,104 @@ msgstr "" "²ØÑàÐÝÐ âÕÜÐ ÝÕ ßöÔâàØÜãô ßÞâÞçÝã ÜÞÒã. ÏÚéÞ ÒØ åÞçÕâÕ ÒØÚÞàØáâÞÒãÒÐâØ æî " "âÕÜã, ßÞâàöÑÝÞ Ò ßÕàèã çÕàÓã ×ÜöÝØâØ ÜÞÒã." -#: gui/saveload.cpp:58 gui/saveload.cpp:239 +#: gui/saveload-dialog.cpp:158 +msgid "List view" +msgstr "" + +#: gui/saveload-dialog.cpp:159 +msgid "Grid view" +msgstr "" + +#: gui/saveload-dialog.cpp:202 gui/saveload-dialog.cpp:350 msgid "No date saved" msgstr "´Ðâã ÝÕ ×ÐßØáÐÝÞ" -#: gui/saveload.cpp:59 gui/saveload.cpp:240 +#: gui/saveload-dialog.cpp:203 gui/saveload-dialog.cpp:351 msgid "No time saved" msgstr "ÇÐá ÝÕ ×ÐßØáÐÝÞ" -#: gui/saveload.cpp:60 gui/saveload.cpp:241 +#: gui/saveload-dialog.cpp:204 gui/saveload-dialog.cpp:352 msgid "No playtime saved" msgstr "ÇÐá ÓàØ ÝÕ ×ÐßØáÐÝÞ" -#: gui/saveload.cpp:67 gui/saveload.cpp:155 +#: gui/saveload-dialog.cpp:211 gui/saveload-dialog.cpp:267 msgid "Delete" msgstr "²ØÔÐÛØâØ" -#: gui/saveload.cpp:154 +#: gui/saveload-dialog.cpp:266 msgid "Do you really want to delete this savegame?" msgstr "²Ø ÔöÙáÝÞ åÞçÕâÕ ÒØÔÐÛØâØ æÕ ×ÑÕàÕÖÕÝÝï?" -#: gui/saveload.cpp:264 +#: gui/saveload-dialog.cpp:375 gui/saveload-dialog.cpp:796 msgid "Date: " msgstr "´ÐâÐ: " -#: gui/saveload.cpp:268 +#: gui/saveload-dialog.cpp:379 gui/saveload-dialog.cpp:802 msgid "Time: " msgstr "ÇÐá: " -#: gui/saveload.cpp:274 +#: gui/saveload-dialog.cpp:385 gui/saveload-dialog.cpp:810 msgid "Playtime: " msgstr "ÇÐá ÓàØ: " -#: gui/saveload.cpp:287 gui/saveload.cpp:354 +#: gui/saveload-dialog.cpp:398 gui/saveload-dialog.cpp:465 msgid "Untitled savestate" msgstr "·ÑÕàÕÖÕÝÝï ÑÕ× öÜÕÝö" +#: gui/saveload-dialog.cpp:517 +msgid "Next" +msgstr "" + +#: gui/saveload-dialog.cpp:520 +msgid "Prev" +msgstr "" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "New Save" +msgstr "·ÐßØáÐâØ" + +#: gui/saveload-dialog.cpp:684 +#, fuzzy +msgid "Create a new save game" +msgstr "½Õ ÒÔÐÛÞáï ×ÐßØáÐâØ Óàã" + +#: gui/saveload-dialog.cpp:789 +#, fuzzy +msgid "Name: " +msgstr "½Ð×ÒÐ:" + +#: gui/saveload-dialog.cpp:861 +#, c-format +msgid "Enter a description for slot %d:" +msgstr "" + #: gui/themebrowser.cpp:44 msgid "Select a Theme" msgstr "²ØÑÕàöâì âÕÜã" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgid "Disabled GFX" msgstr "±Õ× ÓàÐäöÚØ" -#: gui/ThemeEngine.cpp:335 +#: gui/ThemeEngine.cpp:337 msgctxt "lowres" msgid "Disabled GFX" msgstr "±Õ× ÓàÐäöÚØ" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard Renderer (16bpp)" msgstr "ÁâÐÝÔÐàâÝØÙ àÐáâÕàØ×ÐâÞà (16bpp)" -#: gui/ThemeEngine.cpp:336 +#: gui/ThemeEngine.cpp:338 msgid "Standard (16bpp)" msgstr "ÁâÐÝÔÐàâÝØÙ àÐáâÕàØ×ÐâÞà (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased Renderer (16bpp)" msgstr "ÀÐáâÕàØ×ÐâÞà ×ö ×ÓÛÐÔÖãÒÐÝÝïÜ (16bpp)" -#: gui/ThemeEngine.cpp:338 +#: gui/ThemeEngine.cpp:340 msgid "Antialiased (16bpp)" msgstr "ÀÐáâÕàØ×ÐâÞà ×ö ×ÓÛÐÔÖãÒÐÝÝïÜ (16bpp)" @@ -1089,16 +1125,16 @@ msgstr " msgid "Unknown error" msgstr "½ÕÒöÔÞÜÐ ßÞÜØÛÚÐ" -#: engines/advancedDetector.cpp:324 +#: engines/advancedDetector.cpp:316 #, c-format msgid "The game in '%s' seems to be unknown." msgstr "³àÐ ã '%s' ÝÕÒöÔÞÜÐ." -#: engines/advancedDetector.cpp:325 +#: engines/advancedDetector.cpp:317 msgid "Please, report the following data to the ScummVM team along with name" msgstr "±ãÔì ÛÐáÚÐ, ßÕàÕÔÐÙâÕ ÝØÖçÕÝÐÒÕÔÕÝã öÝäÞàÜÐæöî ÚÞÜÐÝÔö ScummVM àÐ×ÞÜ ×" -#: engines/advancedDetector.cpp:327 +#: engines/advancedDetector.cpp:319 msgid "of the game you tried to add and its version/language/etc.:" msgstr "ÝÐ×ÒÞî ÓàØ, ïÚã ÒØ ÝÐÜÐÓÐôâÕáì ÔÞÔÐâØ, Ð âÐÚÞÖ ÷÷ ÒÕàáöî/ÜÞÒã/âÐ öÝèÕ:" @@ -1126,23 +1162,23 @@ msgstr "~ msgid "~A~bout" msgstr "¿àÞ ßàÞ~Ó~àÐÜã" -#: engines/dialogs.cpp:104 engines/dialogs.cpp:182 +#: engines/dialogs.cpp:104 engines/dialogs.cpp:180 msgid "~R~eturn to Launcher" msgstr "~¿~ÞÒÕà. Ò ÓÞÛÞÒÝÕ ÜÕÝî" -#: engines/dialogs.cpp:106 engines/dialogs.cpp:184 +#: engines/dialogs.cpp:106 engines/dialogs.cpp:182 msgctxt "lowres" msgid "~R~eturn to Launcher" msgstr "~¿~ÞÒÕà.Ò ÓÞÛÞÒÝÕ ÜÕÝî" -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/cruise/menu.cpp:214 engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/cruise/menu.cpp:212 engines/sci/engine/kfile.cpp:742 msgid "Save game:" msgstr "·ÑÕàÕÓâØ Óàã: " -#: engines/dialogs.cpp:116 engines/agi/saveload.cpp:805 -#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:214 -#: engines/sci/engine/kfile.cpp:567 +#: engines/dialogs.cpp:115 engines/agi/saveload.cpp:803 +#: engines/scumm/dialogs.cpp:187 engines/cruise/menu.cpp:212 +#: engines/sci/engine/kfile.cpp:742 #: backends/platform/symbian/src/SymbianActions.cpp:44 #: backends/platform/wince/CEActionsPocket.cpp:43 #: backends/platform/wince/CEActionsPocket.cpp:267 @@ -1151,7 +1187,7 @@ msgstr " msgid "Save" msgstr "·ÐßØáÐâØ" -#: engines/dialogs.cpp:146 +#: engines/dialogs.cpp:144 msgid "" "Sorry, this engine does not currently provide in-game help. Please consult " "the README for basic information, and for instructions on how to obtain " @@ -1161,27 +1197,26 @@ msgstr "" "README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã " "ÔÞßÞÜÞÓã." -#: engines/dialogs.cpp:243 -#, fuzzy, c-format +#: engines/dialogs.cpp:228 +#, c-format msgid "" "Gamestate save failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"²ØÑÐçâÕ, æÕÙ ÔÒØÖÞÚ ÝÕ ßöÔâàØÜãô ÔÞÒöÔÚã ßÞ öÓàÐÜ. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ " -"README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã " -"ÔÞßÞÜÞÓã." +"·ÑÕàÕÖÕÝÝï áâÐÝã ÓàØ ÝÕ ÒÔÐÛÞáï (%s)!. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ README ÔÛï " +"ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã ÔÞßÞÜÞÓã." -#: engines/dialogs.cpp:321 engines/mohawk/dialogs.cpp:109 +#: engines/dialogs.cpp:301 engines/mohawk/dialogs.cpp:109 #: engines/mohawk/dialogs.cpp:174 msgid "~O~K" msgstr "~O~K" -#: engines/dialogs.cpp:322 engines/mohawk/dialogs.cpp:110 +#: engines/dialogs.cpp:302 engines/mohawk/dialogs.cpp:110 #: engines/mohawk/dialogs.cpp:175 msgid "~C~ancel" msgstr "²ö~Ô~ÜöÝÐ" -#: engines/dialogs.cpp:325 +#: engines/dialogs.cpp:305 msgid "~K~eys" msgstr "~º~ÛÐÒöèö" @@ -1230,14 +1265,13 @@ msgstr "" "´ØÒöâìáï äÐÙÛ README ÔÛï ßÞÔÐÛìèØå öÝáâàãÚæöÙ." #: engines/engine.cpp:426 -#, fuzzy, c-format +#, c-format msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"²ØÑÐçâÕ, æÕÙ ÔÒØÖÞÚ ÝÕ ßöÔâàØÜãô ÔÞÒöÔÚã ßÞ öÓàÐÜ. ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ " -"README ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã " -"ÔÞßÞÜÞÓã." +"·ÐÒÐÝâÐÖÕÝÝï áâÐÝã ÓàØ ÝÕ ÒÔÐÛÞáï (%s)! . ±ãÔì-ÛÐáÚÐ, ÔØÒöâìáï äÐÙÛ README " +"ÔÛï ÞáÝÞÒÝÞ÷ öÝÞàÜÐæö÷, Ð âÐÚÞÖ öÝáâàãÚæöÙ, ïÚ ÞâàØÜÐâØ ßÞÔÐÛìèã ÔÞßÞÜÞÓã." #: engines/engine.cpp:439 msgid "" @@ -1256,84 +1290,83 @@ msgstr " #: engines/agi/detection.cpp:145 engines/dreamweb/detection.cpp:47 #: engines/sci/detection.cpp:390 msgid "Use original save/load screens" -msgstr "" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÞàØÓ. ×ÑÕàÕÖÕÝÝï/×ÐÒÐÝâÐÖÕÝÝï ÕÚàÐÝØ" #: engines/agi/detection.cpp:146 engines/dreamweb/detection.cpp:48 #: engines/sci/detection.cpp:391 msgid "Use the original save/load screens, instead of the ScummVM ones" msgstr "" +"²ØÚÞàØáâÞÒãÒÐâØ ÞàØÓöÝÐÛìÝö ×ÑÕàÕÖÕÝÝï/×ÐÒÐÝâÐÖÕÝÝï ÕÚàÐÝØ, ×ÐÜöáâì ScummVM" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore game:" msgstr "²öÔÝÞÒØâØ Óàã:" -#: engines/agi/saveload.cpp:827 engines/sci/engine/kfile.cpp:674 +#: engines/agi/saveload.cpp:816 engines/sci/engine/kfile.cpp:838 msgid "Restore" msgstr "²öÔÝÞÒØâØ" #: engines/dreamweb/detection.cpp:57 -#, fuzzy msgid "Use bright palette mode" -msgstr "²ÕàåÝï áßàÐÒÐ àöç" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ ïáÚàÐÒØÙ àÕÖØÜ ßÐÛöâàØ" #: engines/dreamweb/detection.cpp:58 msgid "Display graphics using the game's bright palette" -msgstr "" +msgstr "²öÔÞÑàÐÖÕÝÝï ÓàÐäöÚØ × ÒØÚÞàØáâÐÝÝïÜ ïáÚàÐÒÞ÷ ßÐÛöâàØ öÓà" #: engines/sci/detection.cpp:370 msgid "EGA undithering" msgstr "EGA ÑÕ× àÐáâàãÒÐÝÝï" #: engines/sci/detection.cpp:371 -#, fuzzy msgid "Enable undithering in EGA games" -msgstr "²öÜÚÝãâØ àÐáâàãÒÐÝÝï Ò EGA öÓàÐå ïÚö æÕ ßöÔâàØÜãîâì" +msgstr "ÃÒöÜÚÝãâØ ÐÝâØ-×ÓÛÐÔÖãÒÐÝÝï Ò EGA öÓàÐå" #: engines/sci/detection.cpp:380 -#, fuzzy msgid "Prefer digital sound effects" -msgstr "³ãçÝöáâì áßÕæöÐÛìÝØå ×ÒãÚÞÒØå ÕäÕÚâöÒ" +msgstr "½ÐÔÐÒÐâØ ßÕàÕÒÐÓã æØäàÞÒØÜ ×ÒãÚÞÒØÜ ÕäÕÚâÐÜ" #: engines/sci/detection.cpp:381 msgid "Prefer digital sound effects instead of synthesized ones" -msgstr "" +msgstr "²öÔÔÐÒÐâØ ßÕàÕÒÐÓã æØäàÞÒØÜ ×ÒãÚÞÒØÜ ÕäÕÚâÐÜ, Ð ÝÕ áØÝâÕ×ÞÒÐÝØÜ" #: engines/sci/detection.cpp:400 -msgid "Use IMF/Yahama FB-01 for MIDI output" -msgstr "" +msgid "Use IMF/Yamaha FB-01 for MIDI output" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ IMF/Yahama FB-01 ÔÛï MIDI ÒØåÞÔã" #: engines/sci/detection.cpp:401 msgid "" -"Use an IBM Music Feature card or a Yahama FB-01 FM synth module for MIDI " +"Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" #: engines/sci/detection.cpp:411 msgid "Use CD audio" -msgstr "" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ CD ÐãÔöÞ" #: engines/sci/detection.cpp:412 msgid "Use CD audio instead of in-game audio, if available" -msgstr "" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ CD ÐãÔöÞ ×ÐÜöáâì ã-Óàö ÐãÔöÞ, ïÚéÞ âÐÚö ô" #: engines/sci/detection.cpp:422 msgid "Use Windows cursors" -msgstr "" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ Windows ÚãàáÞàØ" #: engines/sci/detection.cpp:423 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" -msgstr "" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ Windows ÚãàáÞàØ (ÜÕÝèØå ö ÜÞÝÞåàÞÜÝØå), ×ÐÜöáâì DOS" #: engines/sci/detection.cpp:433 -#, fuzzy msgid "Use silver cursors" -msgstr "·ÒØçÐÙÝØÙ ÚãàáÞà" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ áàöÑÝö ÚãàáÞàØ" #: engines/sci/detection.cpp:434 msgid "" "Use the alternate set of silver cursors, instead of the normal golden ones" msgstr "" +"²ØÚÞàØáâÞÒãÒÐâØ ÐÛìâÕàÝÐâØÒÝØÙ ÝÐÑöà áàöÑÝØå ÚãàáÞàöÒ, ×ÐÜöáâì ×ÒØçÐÙÝØå " +"×ÞÛÞâØå" #: engines/scumm/dialogs.cpp:175 #, c-format @@ -1991,7 +2024,7 @@ msgstr "" "ÀÕÖØÜ \"àöÔÝÞÓÞ\" MIDI ßÞâàÕÑãô ßÞÝÞÒÛÕÝÝï Roland Upgrade ÒöÔ\n" "LucasArts, ßàÞâÕ %s ÒöÔáãâÝöÙ. ¿ÕàÕÜØÚÐîáì ÝÐ AdLib." -#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:202 +#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:220 #, c-format msgid "" "Failed to save game state to file:\n" @@ -2002,7 +2035,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:167 +#: engines/scumm/scumm.cpp:2285 engines/agos/saveload.cpp:185 #, c-format msgid "" "Failed to load game state from file:\n" @@ -2013,7 +2046,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:210 +#: engines/scumm/scumm.cpp:2297 engines/agos/saveload.cpp:228 #, c-format msgid "" "Successfully saved game state in file:\n" @@ -2024,7 +2057,7 @@ msgstr "" "\n" "%s" -#: engines/scumm/scumm.cpp:2505 +#: engines/scumm/scumm.cpp:2512 msgid "" "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To " "play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' " @@ -2060,17 +2093,17 @@ msgstr " msgid "~W~ater Effect Enabled" msgstr "µäÕÚâØ ÒÞÔØ ãÒöÜÚÝÕÝÞ" -#: engines/agos/animation.cpp:550 +#: engines/agos/animation.cpp:560 #, c-format msgid "Cutscene file '%s' not found!" msgstr "ÄÐÙÛ ×ÐáâÐÒÚØ '%s' ÝÕ ×ÝÐÙÔÕÝÞ!" -#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283 -#: engines/tinsel/saveload.cpp:502 +#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1287 +#: engines/tinsel/saveload.cpp:532 msgid "Failed to load game state from file." msgstr "½Õ ÒÔÐÛÞáï ×ÐÒÐÝâÐÖØâØ áâÐÝ ÓàØ × äÐÙÛã." -#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:515 +#: engines/gob/inter_v2.cpp:1357 engines/tinsel/saveload.cpp:545 msgid "Failed to save game state to file." msgstr "½Õ ÒÔÐÛÞáï ×ÑÕàÕÓâØ áâÐÝ ÓàØ ã äÐÙÛ." @@ -2086,52 +2119,50 @@ msgstr " #. Malcolm makes a joke. #: engines/kyra/detection.cpp:62 msgid "Studio audience" -msgstr "" +msgstr "ÁâãÔöï ÐãÔØâÞàö÷" #: engines/kyra/detection.cpp:63 msgid "Enable studio audience" -msgstr "" +msgstr "ÃÒöÜÚÝãâØ áâãÔöî ÐãÔØâÞàö÷" #. I18N: This option allows the user to skip text and cutscenes. #: engines/kyra/detection.cpp:73 msgid "Skip support" -msgstr "" +msgstr "¿öÔâàØÜãÒÐâØ ¿àÞßãáâØâØ" #: engines/kyra/detection.cpp:74 msgid "Allow text and cutscenes to be skipped" -msgstr "" +msgstr "´Þ×ÒÞÛØâØ ßàÞßãáÚÐâØ âÕÚáâ ö àÞÛØÚØ" #. I18N: Helium mode makes people sound like they've inhaled Helium. #: engines/kyra/detection.cpp:84 msgid "Helium mode" -msgstr "" +msgstr "ÀÕÖØÜ ³ÕÛöãÜ" #: engines/kyra/detection.cpp:85 -#, fuzzy msgid "Enable helium mode" -msgstr "ÃÒöÜÚÝãâØ àÕÖØÜ Roland GS" +msgstr "ÃÒöÜÚÝãâØ àÕÖØÜ ³ÕÛöãÜ" #. I18N: When enabled, this option makes scrolling smoother when #. changing from one screen to another. #: engines/kyra/detection.cpp:99 msgid "Smooth scrolling" -msgstr "" +msgstr "¿ÛÐÒÝÐ ßàÞÚàãâÚÐ" #: engines/kyra/detection.cpp:100 msgid "Enable smooth scrolling when walking" -msgstr "" +msgstr "ÃÒöÜÚÝãâØ ßÛÐÒÝã ßàÞÚàãâÚã ßàØ åÞÔìÑö" #. I18N: When enabled, this option changes the cursor when it floats to the #. edge of the screen to a directional arrow. The player can then click to #. walk towards that direction. #: engines/kyra/detection.cpp:112 -#, fuzzy msgid "Floating cursors" -msgstr "·ÒØçÐÙÝØÙ ÚãàáÞà" +msgstr "¿ÛÐÒÐîçö ÚãàáÞàØ" #: engines/kyra/detection.cpp:113 msgid "Enable floating cursors" -msgstr "" +msgstr "ÃÒöÜÚÝãâØ ßÛÐÒÐîçö ÚãàáÞàØ" #. I18N: HP stands for Hit Points #: engines/kyra/detection.cpp:127 @@ -2195,8 +2226,8 @@ msgid "" "You appear to be using a General MIDI device,\n" "but your game only supports Roland MT32 MIDI.\n" "We try to map the Roland MT32 instruments to\n" -"General MIDI ones. After all it might happen\n" -"that a few tracks will not be correctly played." +"General MIDI ones. It is still possible that\n" +"some tracks sound incorrect." msgstr "" "·ÔÐôâìáï, éÞ ²Ø ÒØÚÞàØáâÞÒãôâÕ ßàØáâàöÙ General\n" "MIDI, ÐÛÕ ²ÐèÐ ÓàÐ ßöÔâàØÜãô âöÛìÚØ Roland MT32\n" @@ -2204,13 +2235,14 @@ msgstr "" "MT32 ÝÐ General MIDI. °ÛÕ Ò àÕ×ãÛìâÐâö ÜÞÖÕ\n" "áâÐâØáï, éÞ ÔÕïÚö âàÕÚØ ÑãÔãâì ÓàÐâØ ÝÕßàÐÒØÛìÝÞ." -#: engines/queen/queen.cpp:59 engines/sky/detection.cpp:44 -msgid "Floppy intro" +#: engines/queen/queen.cpp:59 +msgid "Alternative intro" msgstr "" -#: engines/queen/queen.cpp:60 engines/sky/detection.cpp:45 -msgid "Use the floppy version's intro (CD version only)" -msgstr "" +#: engines/queen/queen.cpp:60 +#, fuzzy +msgid "Use an alternative game intro (CD version only)" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÔØáÚÕâÝö ÒÕàáö÷ ÒÒÕÔÕÝÝï (âöÛìÚØ CD ÒÕàáöï)" #: engines/sky/compact.cpp:130 msgid "" @@ -2228,10 +2260,18 @@ msgstr "" "ÄÐÙÛ sky.cpt ÜÐô ÝÕÒöàÝØÙ àÞ×Üöà.\n" "±ãÔì ÛÐáÚÐ, (ßÕàÕ)×ÐÒÐÝâÐÖâÕ ÙÞÓÞ × www.scummvm.org" +#: engines/sky/detection.cpp:44 +msgid "Floppy intro" +msgstr "´ØáÚÕâÝÕ ÒÒÕÔÕÝÝï" + +#: engines/sky/detection.cpp:45 +msgid "Use the floppy version's intro (CD version only)" +msgstr "²ØÚÞàØáâÞÒãÒÐâØ ÔØáÚÕâÝö ÒÕàáö÷ ÒÒÕÔÕÝÝï (âöÛìÚØ CD ÒÕàáöï)" + #: engines/sword1/animation.cpp:539 #, c-format msgid "PSX stream cutscene '%s' cannot be played in paletted mode" -msgstr "" +msgstr " àÞÛØÚ PSX ßÞâÞÚã '%s' ÝÕ ÜÞÖãâì ÑãâØ ÒöÔâÒÞàÕÝö ã àÕÖØÜö ßÐÛöâàØ" #: engines/sword1/animation.cpp:560 engines/sword2/animation.cpp:455 msgid "DXA cutscenes found but ScummVM has been built without zlib support" @@ -2285,17 +2325,27 @@ msgid "This is the end of the Broken Sword 1 Demo" msgstr "½Ð æìÞÜã ×ÐÚöÝçãôâìáï ÔÕÜÞ Broken Sword 1" #: engines/sword2/animation.cpp:435 -#, fuzzy msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" -msgstr "·ÝÐÙÔÕÝÞ ×ÐáâÐÒÚØ DXA, ÐÛÕ ScummVM ÑãÒ ßÞÑãÔÞÒÐÝØÙ ÑÕ× ßöÔâàØÜÚØ zlib" +msgstr "·ÝÐÙÔÕÝö PSX àÞÛØÚØ, ÐÛÕ ScummVM ÑãÒ ×öÑàÐÝØÙ ÑÕ× ßöÔâàØÜÚØ RGB ÚÞÛöàã" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" -msgstr "" +msgstr "¿ÞÚÐ×ãÒÐâØ ÜöâÚØ ÞÑ'ôÚâöÒ" #: engines/sword2/sword2.cpp:80 msgid "Show labels for objects on mouse hover" +msgstr "¿ÞÚÐ×ãÒÐâØ ÜöâÚØ ÔÛï ÞÑ'ôÚâöÒ ßàØ ÝÐÒÕÔÕÝÝö ÜØèö" + +#: engines/teenagent/resources.cpp:68 +msgid "" +"You're missing the 'teenagent.dat' file. Get it from the ScummVM website" +msgstr "" + +#: engines/teenagent/resources.cpp:89 +msgid "" +"The teenagent.dat file is compressed and zlib hasn't been included in this " +"executable. Please decompress it" msgstr "" #: engines/parallaction/saveload.cpp:133 @@ -2307,15 +2357,15 @@ msgstr "" "½Õ ÜÞÖã ×ÑÕàÕÓâØ Óàã ã áÛÞâ %i\n" "\n" -#: engines/parallaction/saveload.cpp:211 +#: engines/parallaction/saveload.cpp:204 msgid "Loading game..." msgstr "·ÐÒÐÝâÐÖãî Óàã..." -#: engines/parallaction/saveload.cpp:226 +#: engines/parallaction/saveload.cpp:219 msgid "Saving game..." msgstr "·ÑÕàÕÖãî Óàã..." -#: engines/parallaction/saveload.cpp:279 +#: engines/parallaction/saveload.cpp:272 msgid "" "ScummVM found that you have old savefiles for Nippon Safes that should be " "renamed.\n" @@ -2331,11 +2381,11 @@ msgstr "" "½ÐâØáÝöâì ¾º, éÞÑ ßÕàÕÒÕáâØ ÷å ×ÐàÐ×, öÝÐÚèÕ ãÕ ßÞÒöÔÞÜÛÕÝÝï ×'ïÒØâìáï ßàØ " "ÝÐáâãßÝÞÜã ×ÐßãáÚã ÓàØ.\n" -#: engines/parallaction/saveload.cpp:326 +#: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." msgstr "ScummVM ãáßöèÝÞ ßÕàÕÒöÒ ãáö ²Ðèö ×ÑÕàÕÖÕÝÝï." -#: engines/parallaction/saveload.cpp:328 +#: engines/parallaction/saveload.cpp:321 msgid "" "ScummVM printed some warnings in your console window and can't guarantee all " "your files have been converted.\n" @@ -2361,7 +2411,7 @@ msgid "" "The selected audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" -"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ " +"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ " "ÒØÜÚÝÕÝÞ ÐÑÞ ÝÕ ßöÔÚÛîçÕÝÞ)." #: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257 @@ -2375,8 +2425,8 @@ msgid "" "The selected audio device '%s' cannot be used. See log file for more " "information." msgstr "" -"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ ÛÞÓã " -"ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷." +"²ØÑàÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ " +"ÛÞÓã ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷." #: audio/mididrv.cpp:257 #, c-format @@ -2384,7 +2434,7 @@ msgid "" "The preferred audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" -"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ " +"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÑãÛÞ ×ÝÐÙÔÕÝÞ (âÞÑâÞ, ÙÞÓÞ ÜÞÖÕ ÑãâØ " "ÒØÜÚÝÕÝÞ ÐÑÞ ÝÕ ßöÔÚÛîçÕÝÞ)." #: audio/mididrv.cpp:272 @@ -2393,7 +2443,7 @@ msgid "" "The preferred audio device '%s' cannot be used. See log file for more " "information." msgstr "" -"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ %s ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ " +"ÃßÞÔÞÑÐÝØÙ ×ÒãÚÞÒØÙ ßàØáâàöÙ '%s' ÝÕ ÜÞÖÕ ÑãâØ ÒØÚÞàØáâÐÝØÙ. ´ØÒöâìáï äÐÙÛ " "ÛÞÓã ÔÛï ÔÞÔÐâÚÞÒÞ÷ öÝäÞàÜÐæö÷." #: audio/null.h:43 @@ -2446,7 +2496,7 @@ msgstr " ( #: backends/keymapper/remap-dialog.cpp:106 msgid " (Blocked)" -msgstr "" +msgstr " (·ÐÑÛÞÚÞÒÐÝØÙ)" #: backends/keymapper/remap-dialog.cpp:119 msgid " (Global)" @@ -2548,11 +2598,11 @@ msgstr " msgid "Touchpad mode disabled." msgstr "ÀÕÖØÜ âÐçßÐÔã ÒØÜÚÝÕÝÞ." -#: backends/platform/maemo/maemo.cpp:205 +#: backends/platform/maemo/maemo.cpp:209 msgid "Click Mode" msgstr "ÀÕÖØÜ ÚÛöÚöÒ" -#: backends/platform/maemo/maemo.cpp:211 +#: backends/platform/maemo/maemo.cpp:215 #: backends/platform/symbian/src/SymbianActions.cpp:42 #: backends/platform/wince/CEActionsPocket.cpp:60 #: backends/platform/wince/CEActionsSmartphone.cpp:43 @@ -2560,11 +2610,11 @@ msgstr " msgid "Left Click" msgstr "»öÒØÙ ÚÛöÚ" -#: backends/platform/maemo/maemo.cpp:214 +#: backends/platform/maemo/maemo.cpp:218 msgid "Middle Click" msgstr "ÁÕàÕÔÝöÙ ÚÛöÚ" -#: backends/platform/maemo/maemo.cpp:217 +#: backends/platform/maemo/maemo.cpp:221 #: backends/platform/symbian/src/SymbianActions.cpp:43 #: backends/platform/wince/CEActionsSmartphone.cpp:44 #: backends/platform/bada/form.cpp:273 @@ -2601,21 +2651,21 @@ msgctxt "lowres" msgid "Normal (no scaling)" msgstr "±Õ× ×ÑöÛìèÕÝÝï" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2135 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:533 msgid "Enabled aspect ratio correction" msgstr "ºÞàÕÚæöî áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ ãÒöÜÚÝÕÝÞ" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2141 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:538 msgid "Disabled aspect ratio correction" msgstr "ºÞàÕÚæöî áßöÒÒöÔÝÞèÕÝÝï áâÞàöÝ ÒØÜÚÝÕÝÞ" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2208 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2196 msgid "Active graphics filter:" msgstr "¿ÞâÞçÝØÙ ÓàÐäöçÝØÙ äöÛìâà:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2238 #: backends/graphics/openglsdl/openglsdl-graphics.cpp:477 msgid "Windowed mode" msgstr "²öÚÞÝÝØÙ àÕÖØÜ" @@ -2866,11 +2916,11 @@ msgstr " #: backends/platform/wince/CEActionsPocket.cpp:52 msgid "Zoom up" -msgstr "·ÑöÛ. ÜÐèâÐÑ" +msgstr "·ÑöÛ. ÜÐáèâÐÑ" #: backends/platform/wince/CEActionsPocket.cpp:53 msgid "Zoom down" -msgstr "·ÜÝè. ÜÐèâÐÑ" +msgstr "·ÜÝè. ÜÐáèâÐÑ" #: backends/platform/wince/CEActionsPocket.cpp:55 #: backends/platform/wince/CEActionsSmartphone.cpp:49 @@ -2939,7 +2989,7 @@ msgstr " msgid "You must map a key to the 'Hide toolbar' action to play this game" msgstr "" "²Ø ßÞÒØÝÝö ßÕàÕßàØ×ÝÐçØâØ ÚÝÞßÚã ÔÛï Ôö÷ 'ÁåÞÒÐâØ ¿ÐÝÕÛì öÝáâà.', éÞÑ ÓàÐâØ " -"Ò æî Óàã" +"ã æî Óàã" #: backends/platform/wince/wince-sdl.cpp:541 msgid "Map Zoom Up action (optional)" @@ -2968,37 +3018,37 @@ msgstr " msgid "Do you really want to quit?" msgstr "²Ø ÔöÙáÝÞ åÞçÕâÕ ÒØÙâØ?" -#: backends/events/gph/gph-events.cpp:338 -#: backends/events/gph/gph-events.cpp:381 +#: backends/events/gph/gph-events.cpp:386 +#: backends/events/gph/gph-events.cpp:429 #: backends/events/openpandora/op-events.cpp:139 msgid "Touchscreen 'Tap Mode' - Left Click" msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - »öÒØÙ ÚÛöÚ" -#: backends/events/gph/gph-events.cpp:340 -#: backends/events/gph/gph-events.cpp:383 +#: backends/events/gph/gph-events.cpp:388 +#: backends/events/gph/gph-events.cpp:431 #: backends/events/openpandora/op-events.cpp:141 msgid "Touchscreen 'Tap Mode' - Right Click" msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - ¿àÐÒØÙ ÚÛöÚ" -#: backends/events/gph/gph-events.cpp:342 -#: backends/events/gph/gph-events.cpp:385 +#: backends/events/gph/gph-events.cpp:390 +#: backends/events/gph/gph-events.cpp:433 #: backends/events/openpandora/op-events.cpp:143 msgid "Touchscreen 'Tap Mode' - Hover (No Click)" msgstr "ÀÕÖØÜ ÔÞâØÚã ã âÐçáÚàöÝö - ¿àÞÛöâ (ÑÕ× ÚÛöÚã)" -#: backends/events/gph/gph-events.cpp:362 +#: backends/events/gph/gph-events.cpp:410 msgid "Maximum Volume" msgstr "¼ÐÚáØÜÐÛìÝÐ ³ãçÝöáâì" -#: backends/events/gph/gph-events.cpp:364 +#: backends/events/gph/gph-events.cpp:412 msgid "Increasing Volume" msgstr "¿öÔÒØéÕÝÝï ÓãçÝÞáâö" -#: backends/events/gph/gph-events.cpp:370 +#: backends/events/gph/gph-events.cpp:418 msgid "Minimal Volume" msgstr "¼öÝöÜÐÛìÝÐ ³ãçÝöáâì" -#: backends/events/gph/gph-events.cpp:372 +#: backends/events/gph/gph-events.cpp:420 msgid "Decreasing Volume" msgstr "¿ÞÝØÖÕÝÝï ÓãçÝÞáâö" diff --git a/ports.mk b/ports.mk index 271a3525964a..ed6781a1a99b 100644 --- a/ports.mk +++ b/ports.mk @@ -96,6 +96,12 @@ ifdef USE_FLAC OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libFLAC.a endif +ifdef USE_FLUIDSYNTH +OSX_STATIC_LIBS += \ + -framework CoreAudio \ + $(STATICLIBPATH)/lib/libfluidsynth.a +endif + ifdef USE_MAD OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmad.a endif @@ -160,6 +166,8 @@ osxsnap: bundle cp $(srcdir)/doc/QuickStart ./ScummVM-snapshot/doc/QuickStart mkdir ScummVM-snapshot/doc/cz cp $(srcdir)/doc/cz/PrectiMe ./ScummVM-snapshot/doc/cz/PrectiMe + mkdir ScummVM-snapshot/doc/da + cp $(srcdir)/doc/da/HurtigStart ./ScummVM-snapshot/doc/da/HurtigStart mkdir ScummVM-snapshot/doc/de cp $(srcdir)/doc/de/Liesmich ./ScummVM-snapshot/doc/de/Liesmich cp $(srcdir)/doc/de/Schnellstart ./ScummVM-snapshot/doc/de/Schnellstart @@ -176,6 +184,7 @@ osxsnap: bundle cp $(srcdir)/doc/se/Snabbstart ./ScummVM-snapshot/doc/se/Snabbstart /Developer/Tools/SetFile -t ttro -c ttxt ./ScummVM-snapshot/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/cz/* + xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/da/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/de/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/es/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/fr/* @@ -206,6 +215,7 @@ win32dist: $(EXECUTABLE) mkdir -p $(WIN32PATH)/graphics mkdir -p $(WIN32PATH)/doc mkdir -p $(WIN32PATH)/doc/cz + mkdir -p $(WIN32PATH)/doc/da mkdir -p $(WIN32PATH)/doc/de mkdir -p $(WIN32PATH)/doc/es mkdir -p $(WIN32PATH)/doc/fr @@ -231,6 +241,7 @@ endif cp $(srcdir)/doc/fr/DemarrageRapide $(WIN32PATH)/doc/fr/DemarrageRapide.txt cp $(srcdir)/doc/it/GuidaRapida $(WIN32PATH)/doc/it/GuidaRapida.txt cp $(srcdir)/doc/no-nb/HurtigStart $(WIN32PATH)/doc/no-nb/HurtigStart.txt + cp $(srcdir)/doc/da/HurtigStart $(WIN32PATH)/doc/da/HurtigStart.txt cp $(srcdir)/doc/de/Schnellstart $(WIN32PATH)/doc/de/Schnellstart.txt cp $(srcdir)/doc/se/Snabbstart $(WIN32PATH)/doc/se/Snabbstart.txt cp $(srcdir)/README $(WIN32PATH)/README.txt @@ -246,6 +257,7 @@ endif unix2dos $(WIN32PATH)/*.txt unix2dos $(WIN32PATH)/doc/*.txt unix2dos $(WIN32PATH)/doc/cz/*.txt + unix2dos $(WIN32PATH)/doc/da/*.txt unix2dos $(WIN32PATH)/doc/de/*.txt unix2dos $(WIN32PATH)/doc/es/*.txt unix2dos $(WIN32PATH)/doc/fr/*.txt @@ -287,6 +299,8 @@ endif @cd $(srcdir)/dists/msvc9 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 9 >/dev/null && git add -f *.sln *.vcproj *.vsprops @echo Creating MSVC10 project files... @cd $(srcdir)/dists/msvc10 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 10 >/dev/null && git add -f *.sln *.vcxproj *.vcxproj.filters *.props + @echo Creating MSVC11 project files... + @cd $(srcdir)/dists/msvc11 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 11 >/dev/null && git add -f *.sln *.vcxproj *.vcxproj.filters *.props @echo @echo All is done. @echo Now run diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 2ea7e8d90e5c..09b95d38ad67 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -42,106 +42,128 @@ namespace Video { -/* +#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a)) + +// IDs used throughout the AVI files +// that will be handled by this player +#define ID_RIFF MKTAG('R','I','F','F') +#define ID_AVI MKTAG('A','V','I',' ') +#define ID_LIST MKTAG('L','I','S','T') +#define ID_HDRL MKTAG('h','d','r','l') +#define ID_AVIH MKTAG('a','v','i','h') +#define ID_STRL MKTAG('s','t','r','l') +#define ID_STRH MKTAG('s','t','r','h') +#define ID_VIDS MKTAG('v','i','d','s') +#define ID_AUDS MKTAG('a','u','d','s') +#define ID_MIDS MKTAG('m','i','d','s') +#define ID_TXTS MKTAG('t','x','t','s') +#define ID_JUNK MKTAG('J','U','N','K') +#define ID_STRF MKTAG('s','t','r','f') +#define ID_MOVI MKTAG('m','o','v','i') +#define ID_REC MKTAG('r','e','c',' ') +#define ID_VEDT MKTAG('v','e','d','t') +#define ID_IDX1 MKTAG('i','d','x','1') +#define ID_STRD MKTAG('s','t','r','d') +#define ID_00AM MKTAG('0','0','A','M') +//#define ID_INFO MKTAG('I','N','F','O') + +// Codec tags +#define ID_RLE MKTAG('R','L','E',' ') +#define ID_CRAM MKTAG('C','R','A','M') +#define ID_MSVC MKTAG('m','s','v','c') +#define ID_WHAM MKTAG('W','H','A','M') +#define ID_CVID MKTAG('c','v','i','d') +#define ID_IV32 MKTAG('i','v','3','2') +#define ID_DUCK MKTAG('D','U','C','K') + static byte char2num(char c) { - return (c >= 48 && c <= 57) ? c - 48 : 0; + c = tolower((byte)c); + return (c >= 'a' && c <= 'f') ? c - 'a' + 10 : c - '0'; } -static byte getStreamNum(uint32 tag) { - return char2num((char)(tag >> 24)) * 16 + char2num((char)(tag >> 16)); +static byte getStreamIndex(uint32 tag) { + return char2num((tag >> 24) & 0xFF) << 4 | char2num((tag >> 16) & 0xFF); } -*/ static uint16 getStreamType(uint32 tag) { return tag & 0xffff; } -AviDecoder::AviDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : _mixer(mixer) { - _soundType = soundType; - - _videoCodec = NULL; +AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { _decodedHeader = false; - _audStream = NULL; - _fileStream = NULL; - _audHandle = new Audio::SoundHandle(); - _dirtyPalette = false; - memset(_palette, 0, sizeof(_palette)); - memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT)); - memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER)); - memset(&_vidsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_audsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_ixInfo, 0, sizeof(AVIOLDINDEX)); + _fileStream = 0; + memset(&_ixInfo, 0, sizeof(_ixInfo)); + memset(&_header, 0, sizeof(_header)); } -AviDecoder::~AviDecoder() { +AVIDecoder::~AVIDecoder() { close(); - delete _audHandle; } -void AviDecoder::runHandle(uint32 tag) { - assert (_fileStream); +void AVIDecoder::runHandle(uint32 tag) { + assert(_fileStream); if (_fileStream->eos()) return; - debug (3, "Decoding tag %s", tag2str(tag)); + debug(3, "Decoding tag %s", tag2str(tag)); switch (tag) { - case ID_RIFF: - /*_filesize = */_fileStream->readUint32LE(); - if (_fileStream->readUint32BE() != ID_AVI) - error("RIFF file is not an AVI video"); - break; - case ID_LIST: - handleList(); - break; - case ID_AVIH: - _header.size = _fileStream->readUint32LE(); - _header.microSecondsPerFrame = _fileStream->readUint32LE(); - _header.maxBytesPerSecond = _fileStream->readUint32LE(); - _header.padding = _fileStream->readUint32LE(); - _header.flags = _fileStream->readUint32LE(); - _header.totalFrames = _fileStream->readUint32LE(); - _header.initialFrames = _fileStream->readUint32LE(); - _header.streams = _fileStream->readUint32LE(); - _header.bufferSize = _fileStream->readUint32LE(); - _header.width = _fileStream->readUint32LE(); - _header.height = _fileStream->readUint32LE(); - //Ignore 16 bytes of reserved data - _fileStream->skip(16); - break; - case ID_STRH: - handleStreamHeader(); - break; - case ID_STRD: // Extra stream info, safe to ignore - case ID_VEDT: // Unknown, safe to ignore - case ID_JUNK: // Alignment bytes, should be ignored - { - uint32 junkSize = _fileStream->readUint32LE(); - _fileStream->skip(junkSize + (junkSize & 1)); // Alignment - } break; - case ID_IDX1: - _ixInfo.size = _fileStream->readUint32LE(); - _ixInfo.indices = new AVIOLDINDEX::Index[_ixInfo.size / 16]; - debug (0, "%d Indices", (_ixInfo.size / 16)); - for (uint32 i = 0; i < (_ixInfo.size / 16); i++) { - _ixInfo.indices[i].id = _fileStream->readUint32BE(); - _ixInfo.indices[i].flags = _fileStream->readUint32LE(); - _ixInfo.indices[i].offset = _fileStream->readUint32LE(); - _ixInfo.indices[i].size = _fileStream->readUint32LE(); - debug (0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size); - } - break; - default: - error ("Unknown tag \'%s\' found", tag2str(tag)); + case ID_RIFF: + /*_filesize = */_fileStream->readUint32LE(); + if (_fileStream->readUint32BE() != ID_AVI) + error("RIFF file is not an AVI video"); + break; + case ID_LIST: + handleList(); + break; + case ID_AVIH: + _header.size = _fileStream->readUint32LE(); + _header.microSecondsPerFrame = _fileStream->readUint32LE(); + _header.maxBytesPerSecond = _fileStream->readUint32LE(); + _header.padding = _fileStream->readUint32LE(); + _header.flags = _fileStream->readUint32LE(); + _header.totalFrames = _fileStream->readUint32LE(); + _header.initialFrames = _fileStream->readUint32LE(); + _header.streams = _fileStream->readUint32LE(); + _header.bufferSize = _fileStream->readUint32LE(); + _header.width = _fileStream->readUint32LE(); + _header.height = _fileStream->readUint32LE(); + // Ignore 16 bytes of reserved data + _fileStream->skip(16); + break; + case ID_STRH: + handleStreamHeader(); + break; + case ID_STRD: // Extra stream info, safe to ignore + case ID_VEDT: // Unknown, safe to ignore + case ID_JUNK: // Alignment bytes, should be ignored + { + uint32 junkSize = _fileStream->readUint32LE(); + _fileStream->skip(junkSize + (junkSize & 1)); // Alignment + } break; + case ID_IDX1: + _ixInfo.size = _fileStream->readUint32LE(); + _ixInfo.indices = new OldIndex::Index[_ixInfo.size / 16]; + debug(0, "%d Indices", (_ixInfo.size / 16)); + for (uint32 i = 0; i < (_ixInfo.size / 16); i++) { + _ixInfo.indices[i].id = _fileStream->readUint32BE(); + _ixInfo.indices[i].flags = _fileStream->readUint32LE(); + _ixInfo.indices[i].offset = _fileStream->readUint32LE(); + _ixInfo.indices[i].size = _fileStream->readUint32LE(); + debug(0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size); + } + break; + default: + error("Unknown tag \'%s\' found", tag2str(tag)); } } -void AviDecoder::handleList() { +void AVIDecoder::handleList() { uint32 listSize = _fileStream->readUint32LE() - 4; // Subtract away listType's 4 bytes uint32 listType = _fileStream->readUint32BE(); uint32 curPos = _fileStream->pos(); - debug (0, "Found LIST of type %s", tag2str(listType)); + debug(0, "Found LIST of type %s", tag2str(listType)); while ((_fileStream->pos() - curPos) < listSize) runHandle(_fileStream->readUint32BE()); @@ -151,12 +173,14 @@ void AviDecoder::handleList() { _decodedHeader = true; } -void AviDecoder::handleStreamHeader() { +void AVIDecoder::handleStreamHeader() { AVIStreamHeader sHeader; sHeader.size = _fileStream->readUint32LE(); sHeader.streamType = _fileStream->readUint32BE(); + if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) - error ("Unhandled MIDI/Text stream"); + error("Unhandled MIDI/Text stream"); + sHeader.streamHandler = _fileStream->readUint32BE(); sHeader.flags = _fileStream->readUint32LE(); sHeader.priority = _fileStream->readUint16LE(); @@ -174,63 +198,67 @@ void AviDecoder::handleStreamHeader() { if (_fileStream->readUint32BE() != ID_STRF) error("Could not find STRF tag"); + uint32 strfSize = _fileStream->readUint32LE(); uint32 startPos = _fileStream->pos(); if (sHeader.streamType == ID_VIDS) { - _vidsHeader = sHeader; - - _bmInfo.size = _fileStream->readUint32LE(); - _bmInfo.width = _fileStream->readUint32LE(); - assert (_header.width == _bmInfo.width); - _bmInfo.height = _fileStream->readUint32LE(); - assert (_header.height == _bmInfo.height); - _bmInfo.planes = _fileStream->readUint16LE(); - _bmInfo.bitCount = _fileStream->readUint16LE(); - _bmInfo.compression = _fileStream->readUint32BE(); - _bmInfo.sizeImage = _fileStream->readUint32LE(); - _bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); - _bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); - _bmInfo.clrUsed = _fileStream->readUint32LE(); - _bmInfo.clrImportant = _fileStream->readUint32LE(); - - if (_bmInfo.bitCount == 8) { - if (_bmInfo.clrUsed == 0) - _bmInfo.clrUsed = 256; - - for (uint32 i = 0; i < _bmInfo.clrUsed; i++) { - _palette[i * 3 + 2] = _fileStream->readByte(); - _palette[i * 3 + 1] = _fileStream->readByte(); - _palette[i * 3] = _fileStream->readByte(); + BitmapInfoHeader bmInfo; + bmInfo.size = _fileStream->readUint32LE(); + bmInfo.width = _fileStream->readUint32LE(); + bmInfo.height = _fileStream->readUint32LE(); + bmInfo.planes = _fileStream->readUint16LE(); + bmInfo.bitCount = _fileStream->readUint16LE(); + bmInfo.compression = _fileStream->readUint32BE(); + bmInfo.sizeImage = _fileStream->readUint32LE(); + bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.clrUsed = _fileStream->readUint32LE(); + bmInfo.clrImportant = _fileStream->readUint32LE(); + + if (bmInfo.clrUsed == 0) + bmInfo.clrUsed = 256; + + if (sHeader.streamHandler == 0) + sHeader.streamHandler = bmInfo.compression; + + AVIVideoTrack *track = new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo); + + if (bmInfo.bitCount == 8) { + byte *palette = const_cast(track->getPalette()); + for (uint32 i = 0; i < bmInfo.clrUsed; i++) { + palette[i * 3 + 2] = _fileStream->readByte(); + palette[i * 3 + 1] = _fileStream->readByte(); + palette[i * 3] = _fileStream->readByte(); _fileStream->readByte(); } - _dirtyPalette = true; + track->markPaletteDirty(); } - if (!_vidsHeader.streamHandler) - _vidsHeader.streamHandler = _bmInfo.compression; + addTrack(track); } else if (sHeader.streamType == ID_AUDS) { - _audsHeader = sHeader; - - _wvInfo.tag = _fileStream->readUint16LE(); - _wvInfo.channels = _fileStream->readUint16LE(); - _wvInfo.samplesPerSec = _fileStream->readUint32LE(); - _wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); - _wvInfo.blockAlign = _fileStream->readUint16LE(); - _wvInfo.size = _fileStream->readUint16LE(); + PCMWaveFormat wvInfo; + wvInfo.tag = _fileStream->readUint16LE(); + wvInfo.channels = _fileStream->readUint16LE(); + wvInfo.samplesPerSec = _fileStream->readUint32LE(); + wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); + wvInfo.blockAlign = _fileStream->readUint16LE(); + wvInfo.size = _fileStream->readUint16LE(); // AVI seems to treat the sampleSize as including the second // channel as well, so divide for our sake. - if (_wvInfo.channels == 2) - _audsHeader.sampleSize /= 2; + if (wvInfo.channels == 2) + sHeader.sampleSize /= 2; + + addTrack(new AVIAudioTrack(sHeader, wvInfo, _soundType)); } // Ensure that we're at the end of the chunk _fileStream->seek(startPos + strfSize); } -bool AviDecoder::loadStream(Common::SeekableReadStream *stream) { +bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); _fileStream = stream; @@ -252,74 +280,31 @@ bool AviDecoder::loadStream(Common::SeekableReadStream *stream) { if (nextTag == ID_LIST) { _fileStream->readUint32BE(); // Skip size if (_fileStream->readUint32BE() != ID_MOVI) - error ("Expected 'movi' LIST"); - } else - error ("Expected 'movi' LIST"); - - // Now, create the codec - _videoCodec = createCodec(); - - // Initialize the video stuff too - _audStream = createAudioStream(); - if (_audStream) - _mixer->playStream(_soundType, _audHandle, _audStream, -1, getVolume(), getBalance()); - - debug (0, "Frames = %d, Dimensions = %d x %d", _header.totalFrames, _header.width, _header.height); - debug (0, "Frame Rate = %d", _vidsHeader.rate / _vidsHeader.scale); - if (_wvInfo.samplesPerSec != 0) - debug (0, "Sound Rate = %d", _wvInfo.samplesPerSec); - debug (0, "Video Codec = \'%s\'", tag2str(_vidsHeader.streamHandler)); - - if (!_videoCodec) - return false; + error("Expected 'movi' LIST"); + } else { + error("Expected 'movi' LIST"); + } return true; } -void AviDecoder::close() { - if (!_fileStream) - return; +void AVIDecoder::close() { + VideoDecoder::close(); delete _fileStream; _fileStream = 0; - - // Deinitialize sound - _mixer->stopHandle(*_audHandle); - _audStream = 0; - _decodedHeader = false; - delete _videoCodec; - _videoCodec = 0; - delete[] _ixInfo.indices; - _ixInfo.indices = 0; - - memset(_palette, 0, sizeof(_palette)); - memset(&_wvInfo, 0, sizeof(PCMWAVEFORMAT)); - memset(&_bmInfo, 0, sizeof(BITMAPINFOHEADER)); - memset(&_vidsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_audsHeader, 0, sizeof(AVIStreamHeader)); - memset(&_ixInfo, 0, sizeof(AVIOLDINDEX)); - - reset(); -} - -uint32 AviDecoder::getTime() const { - if (_audStream) - return _mixer->getSoundElapsedTime(*_audHandle); - - return FixedRateVideoDecoder::getTime(); + memset(&_ixInfo, 0, sizeof(_ixInfo)); + memset(&_header, 0, sizeof(_header)); } -const Graphics::Surface *AviDecoder::decodeNextFrame() { +void AVIDecoder::readNextPacket() { uint32 nextTag = _fileStream->readUint32BE(); if (_fileStream->eos()) - return NULL; - - if (_curFrame == -1) - _startTime = g_system->getMillis(); + return; if (nextTag == ID_LIST) { // A list of audio/video chunks @@ -327,138 +312,159 @@ const Graphics::Surface *AviDecoder::decodeNextFrame() { int32 startPos = _fileStream->pos(); if (_fileStream->readUint32BE() != ID_REC) - error ("Expected 'rec ' LIST"); - - // Decode chunks in the list and see if we get a frame - const Graphics::Surface *frame = NULL; - while (_fileStream->pos() < startPos + (int32)listSize) { - const Graphics::Surface *temp = decodeNextFrame(); - if (temp) - frame = temp; - } + error("Expected 'rec ' LIST"); - return frame; - } else if (getStreamType(nextTag) == 'wb') { - // Audio Chunk - uint32 chunkSize = _fileStream->readUint32LE(); - queueAudioBuffer(chunkSize); - _fileStream->skip(chunkSize & 1); // Alignment - } else if (getStreamType(nextTag) == 'dc' || getStreamType(nextTag) == 'id' || - getStreamType(nextTag) == 'AM' || getStreamType(nextTag) == '32' || - getStreamType(nextTag) == 'iv') { - // Compressed Frame - _curFrame++; - uint32 chunkSize = _fileStream->readUint32LE(); - - if (chunkSize == 0) // Keep last frame on screen - return NULL; - - Common::SeekableReadStream *frameData = _fileStream->readStream(chunkSize); - const Graphics::Surface *surface = _videoCodec->decodeImage(frameData); - delete frameData; - _fileStream->skip(chunkSize & 1); // Alignment - return surface; - } else if (getStreamType(nextTag) == 'pc') { - // Palette Change - _fileStream->readUint32LE(); // Chunk size, not needed here - byte firstEntry = _fileStream->readByte(); - uint16 numEntries = _fileStream->readByte(); - _fileStream->readUint16LE(); // Reserved - - // 0 entries means all colors are going to be changed - if (numEntries == 0) - numEntries = 256; - - for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) { - _palette[i * 3] = _fileStream->readByte(); - _palette[i * 3 + 1] = _fileStream->readByte(); - _palette[i * 3 + 2] = _fileStream->readByte(); - _fileStream->readByte(); // Flags that don't serve us any purpose - } + // Decode chunks in the list + while (_fileStream->pos() < startPos + (int32)listSize) + readNextPacket(); - _dirtyPalette = true; + return; + } else if (nextTag == ID_JUNK || nextTag == ID_IDX1) { + runHandle(nextTag); + return; + } - // No alignment necessary. It's always even. - } else if (nextTag == ID_JUNK) { - runHandle(ID_JUNK); - } else if (nextTag == ID_IDX1) { - runHandle(ID_IDX1); - } else - error("Tag = \'%s\', %d", tag2str(nextTag), _fileStream->pos()); + Track *track = getTrack(getStreamIndex(nextTag)); - return NULL; -} + if (!track) + error("Cannot get track from tag '%s'", tag2str(nextTag)); -Codec *AviDecoder::createCodec() { - switch (_vidsHeader.streamHandler) { - case ID_CRAM: - case ID_MSVC: - case ID_WHAM: - return new MSVideo1Decoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); - case ID_RLE: - return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); - case ID_CVID: - return new CinepakDecoder(_bmInfo.bitCount); - case ID_IV32: - return new Indeo3Decoder(_bmInfo.width, _bmInfo.height); -#ifdef VIDEO_CODECS_TRUEMOTION1_H - case ID_DUCK: - return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height); -#endif - default: - warning ("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler)); + uint32 chunkSize = _fileStream->readUint32LE(); + Common::SeekableReadStream *chunk = _fileStream->readStream(chunkSize); + _fileStream->skip(chunkSize & 1); + + if (track->getTrackType() == Track::kTrackTypeAudio) { + if (getStreamType(nextTag) != MKTAG16('w', 'b')) + error("Invalid audio track tag '%s'", tag2str(nextTag)); + + ((AVIAudioTrack *)track)->queueSound(chunk); + } else { + AVIVideoTrack *videoTrack = (AVIVideoTrack *)track; + + if (getStreamType(nextTag) == MKTAG16('p', 'c')) { + // Palette Change + byte firstEntry = chunk->readByte(); + uint16 numEntries = chunk->readByte(); + chunk->readUint16LE(); // Reserved + + // 0 entries means all colors are going to be changed + if (numEntries == 0) + numEntries = 256; + + byte *palette = const_cast(videoTrack->getPalette()); + + for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) { + palette[i * 3] = chunk->readByte(); + palette[i * 3 + 1] = chunk->readByte(); + palette[i * 3 + 2] = chunk->readByte(); + chunk->readByte(); // Flags that don't serve us any purpose + } + + delete chunk; + videoTrack->markPaletteDirty(); + } else if (getStreamType(nextTag) == MKTAG16('d', 'b')) { + // TODO: Check if this really is uncompressed. Many videos + // falsely put compressed data in here. + error("Uncompressed AVI frame found"); + } else { + // Otherwise, assume it's a compressed frame + videoTrack->decodeFrame(chunk); + } } +} - return NULL; +AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader) + : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader) { + memset(_palette, 0, sizeof(_palette)); + _videoCodec = createCodec(); + _dirtyPalette = false; + _lastFrame = 0; + _curFrame = -1; } -Graphics::PixelFormat AviDecoder::getPixelFormat() const { - assert(_videoCodec); - return _videoCodec->getPixelFormat(); +AVIDecoder::AVIVideoTrack::~AVIVideoTrack() { + delete _videoCodec; } -Audio::QueuingAudioStream *AviDecoder::createAudioStream() { - if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3) - return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2); - else if (_wvInfo.tag != kWaveFormatNone) // No sound - warning("Unsupported AVI audio format %d", _wvInfo.tag); +void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream *stream) { + if (_videoCodec) + _lastFrame = _videoCodec->decodeImage(stream); - return NULL; + delete stream; + _curFrame++; } -void AviDecoder::queueAudioBuffer(uint32 chunkSize) { - // Return if we haven't created the queue (unsupported audio format) - if (!_audStream) { - _fileStream->skip(chunkSize); - return; +Graphics::PixelFormat AVIDecoder::AVIVideoTrack::getPixelFormat() const { + if (_videoCodec) + return _videoCodec->getPixelFormat(); + + return Graphics::PixelFormat(); +} + +Codec *AVIDecoder::AVIVideoTrack::createCodec() { + switch (_vidsHeader.streamHandler) { + case ID_CRAM: + case ID_MSVC: + case ID_WHAM: + return new MSVideo1Decoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); + case ID_RLE: + return new MSRLEDecoder(_bmInfo.width, _bmInfo.height, _bmInfo.bitCount); + case ID_CVID: + return new CinepakDecoder(_bmInfo.bitCount); + case ID_IV32: + return new Indeo3Decoder(_bmInfo.width, _bmInfo.height); +#ifdef VIDEO_CODECS_TRUEMOTION1_H + case ID_DUCK: + return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height); +#endif + default: + warning("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler)); } - Common::SeekableReadStream *stream = _fileStream->readStream(chunkSize); + return 0; +} - if (_wvInfo.tag == kWaveFormatPCM) { - byte flags = 0; - if (_audsHeader.sampleSize == 2) - flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; - else - flags |= Audio::FLAG_UNSIGNED; +AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) + : _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType) { + _audStream = createAudioStream(); +} - if (_wvInfo.channels == 2) - flags |= Audio::FLAG_STEREO; +AVIDecoder::AVIAudioTrack::~AVIAudioTrack() { + delete _audStream; +} - _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES); - } else if (_wvInfo.tag == kWaveFormatDK3) { - _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, chunkSize, Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES); +void AVIDecoder::AVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { + if (_audStream) { + if (_wvInfo.tag == kWaveFormatPCM) { + byte flags = 0; + if (_audsHeader.sampleSize == 2) + flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; + else + flags |= Audio::FLAG_UNSIGNED; + + if (_wvInfo.channels == 2) + flags |= Audio::FLAG_STEREO; + + _audStream->queueAudioStream(Audio::makeRawStream(stream, _wvInfo.samplesPerSec, flags, DisposeAfterUse::YES), DisposeAfterUse::YES); + } else if (_wvInfo.tag == kWaveFormatDK3) { + _audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES); + } + } else { + delete stream; } } -void AviDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(*_audHandle)) - g_system->getMixer()->setChannelVolume(*_audHandle, getVolume()); +Audio::AudioStream *AVIDecoder::AVIAudioTrack::getAudioStream() const { + return _audStream; } -void AviDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(*_audHandle)) - g_system->getMixer()->setChannelBalance(*_audHandle, getBalance()); +Audio::QueuingAudioStream *AVIDecoder::AVIAudioTrack::createAudioStream() { + if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatDK3) + return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2); + else if (_wvInfo.tag != kWaveFormatNone) // No sound + warning("Unsupported AVI audio format %d", _wvInfo.tag); + + return 0; } } // End of namespace Video diff --git a/video/avi_decoder.h b/video/avi_decoder.h index fb4dae671104..a3a262db3608 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -47,196 +47,183 @@ namespace Video { class Codec; -#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a)) - -// IDs used throughout the AVI files -// that will be handled by this player -#define ID_RIFF MKTAG('R','I','F','F') -#define ID_AVI MKTAG('A','V','I',' ') -#define ID_LIST MKTAG('L','I','S','T') -#define ID_HDRL MKTAG('h','d','r','l') -#define ID_AVIH MKTAG('a','v','i','h') -#define ID_STRL MKTAG('s','t','r','l') -#define ID_STRH MKTAG('s','t','r','h') -#define ID_VIDS MKTAG('v','i','d','s') -#define ID_AUDS MKTAG('a','u','d','s') -#define ID_MIDS MKTAG('m','i','d','s') -#define ID_TXTS MKTAG('t','x','t','s') -#define ID_JUNK MKTAG('J','U','N','K') -#define ID_STRF MKTAG('s','t','r','f') -#define ID_MOVI MKTAG('m','o','v','i') -#define ID_REC MKTAG('r','e','c',' ') -#define ID_VEDT MKTAG('v','e','d','t') -#define ID_IDX1 MKTAG('i','d','x','1') -#define ID_STRD MKTAG('s','t','r','d') -#define ID_00AM MKTAG('0','0','A','M') -//#define ID_INFO MKTAG('I','N','F','O') - -// Codec tags -#define ID_RLE MKTAG('R','L','E',' ') -#define ID_CRAM MKTAG('C','R','A','M') -#define ID_MSVC MKTAG('m','s','v','c') -#define ID_WHAM MKTAG('W','H','A','M') -#define ID_CVID MKTAG('c','v','i','d') -#define ID_IV32 MKTAG('i','v','3','2') -#define ID_DUCK MKTAG('D','U','C','K') - -struct BITMAPINFOHEADER { - uint32 size; - uint32 width; - uint32 height; - uint16 planes; - uint16 bitCount; - uint32 compression; - uint32 sizeImage; - uint32 xPelsPerMeter; - uint32 yPelsPerMeter; - uint32 clrUsed; - uint32 clrImportant; -}; - -struct WAVEFORMAT { - uint16 tag; - uint16 channels; - uint32 samplesPerSec; - uint32 avgBytesPerSec; - uint16 blockAlign; -}; - -struct PCMWAVEFORMAT : public WAVEFORMAT { - uint16 size; -}; - -struct WAVEFORMATEX : public WAVEFORMAT { - uint16 bitsPerSample; - uint16 size; -}; - -struct AVIOLDINDEX { - uint32 size; - struct Index { - uint32 id; - uint32 flags; - uint32 offset; - uint32 size; - } *indices; -}; - -// Index Flags -enum IndexFlags { - AVIIF_INDEX = 0x10 -}; - -// Audio Codecs -enum { - kWaveFormatNone = 0, - kWaveFormatPCM = 1, - kWaveFormatDK3 = 98 -}; - -struct AVIHeader { - uint32 size; - uint32 microSecondsPerFrame; - uint32 maxBytesPerSecond; - uint32 padding; - uint32 flags; - uint32 totalFrames; - uint32 initialFrames; - uint32 streams; - uint32 bufferSize; - uint32 width; - uint32 height; -}; - -// Flags from the AVIHeader -enum AviFlags { - AVIF_HASINDEX = 0x00000010, - AVIF_MUSTUSEINDEX = 0x00000020, - AVIF_ISINTERLEAVED = 0x00000100, - AVIF_TRUSTCKTYPE = 0x00000800, - AVIF_WASCAPTUREFILE = 0x00010000, - AVIF_WASCOPYRIGHTED = 0x00020000 -}; - -struct AVIStreamHeader { - uint32 size; - uint32 streamType; - uint32 streamHandler; - uint32 flags; - uint16 priority; - uint16 language; - uint32 initialFrames; - uint32 scale; - uint32 rate; - uint32 start; - uint32 length; - uint32 bufferSize; - uint32 quality; - uint32 sampleSize; - Common::Rect frame; -}; - /** * Decoder for AVI videos. * * Video decoder used in engines: * - sci */ -class AviDecoder : public FixedRateVideoDecoder { +class AVIDecoder : public VideoDecoder { public: - AviDecoder(Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - virtual ~AviDecoder(); + AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + virtual ~AVIDecoder(); bool loadStream(Common::SeekableReadStream *stream); void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } uint16 getWidth() const { return _header.width; } uint16 getHeight() const { return _header.height; } - uint32 getFrameCount() const { return _header.totalFrames; } - uint32 getTime() const; - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const; - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); - - // FixedRateVideoDecoder API - Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } + void readNextPacket(); private: - Audio::Mixer *_mixer; - BITMAPINFOHEADER _bmInfo; - PCMWAVEFORMAT _wvInfo; - AVIOLDINDEX _ixInfo; - AVIHeader _header; - AVIStreamHeader _vidsHeader; - AVIStreamHeader _audsHeader; - byte _palette[3 * 256]; - bool _dirtyPalette; + struct BitmapInfoHeader { + uint32 size; + uint32 width; + uint32 height; + uint16 planes; + uint16 bitCount; + uint32 compression; + uint32 sizeImage; + uint32 xPelsPerMeter; + uint32 yPelsPerMeter; + uint32 clrUsed; + uint32 clrImportant; + }; + + struct WaveFormat { + uint16 tag; + uint16 channels; + uint32 samplesPerSec; + uint32 avgBytesPerSec; + uint16 blockAlign; + }; + + struct PCMWaveFormat : public WaveFormat { + uint16 size; + }; + + struct WaveFormatEX : public WaveFormat { + uint16 bitsPerSample; + uint16 size; + }; + + struct OldIndex { + uint32 size; + struct Index { + uint32 id; + uint32 flags; + uint32 offset; + uint32 size; + } *indices; + }; + + // Index Flags + enum IndexFlags { + AVIIF_INDEX = 0x10 + }; + + struct AVIHeader { + uint32 size; + uint32 microSecondsPerFrame; + uint32 maxBytesPerSecond; + uint32 padding; + uint32 flags; + uint32 totalFrames; + uint32 initialFrames; + uint32 streams; + uint32 bufferSize; + uint32 width; + uint32 height; + }; + + // Flags from the AVIHeader + enum AVIFlags { + AVIF_HASINDEX = 0x00000010, + AVIF_MUSTUSEINDEX = 0x00000020, + AVIF_ISINTERLEAVED = 0x00000100, + AVIF_TRUSTCKTYPE = 0x00000800, + AVIF_WASCAPTUREFILE = 0x00010000, + AVIF_WASCOPYRIGHTED = 0x00020000 + }; + + struct AVIStreamHeader { + uint32 size; + uint32 streamType; + uint32 streamHandler; + uint32 flags; + uint16 priority; + uint16 language; + uint32 initialFrames; + uint32 scale; + uint32 rate; + uint32 start; + uint32 length; + uint32 bufferSize; + uint32 quality; + uint32 sampleSize; + Common::Rect frame; + }; + + class AVIVideoTrack : public FixedRateVideoTrack { + public: + AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader); + ~AVIVideoTrack(); + + void decodeFrame(Common::SeekableReadStream *stream); + + uint16 getWidth() const { return _bmInfo.width; } + uint16 getHeight() const { return _bmInfo.height; } + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame() { return _lastFrame; } + const byte *getPalette() const { _dirtyPalette = false; return _palette; } + bool hasDirtyPalette() const { return _dirtyPalette; } + void markPaletteDirty() { _dirtyPalette = true; } + + protected: + Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } + + private: + AVIStreamHeader _vidsHeader; + BitmapInfoHeader _bmInfo; + byte _palette[3 * 256]; + mutable bool _dirtyPalette; + int _frameCount, _curFrame; + + Codec *_videoCodec; + const Graphics::Surface *_lastFrame; + Codec *createCodec(); + }; + + class AVIAudioTrack : public AudioTrack { + public: + AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType); + ~AVIAudioTrack(); + + void queueSound(Common::SeekableReadStream *stream); + Audio::Mixer::SoundType getSoundType() const { return _soundType; } + + protected: + Audio::AudioStream *getAudioStream() const; + + private: + // Audio Codecs + enum { + kWaveFormatNone = 0, + kWaveFormatPCM = 1, + kWaveFormatDK3 = 98 + }; + + AVIStreamHeader _audsHeader; + PCMWaveFormat _wvInfo; + Audio::Mixer::SoundType _soundType; + Audio::QueuingAudioStream *_audStream; + Audio::QueuingAudioStream *createAudioStream(); + }; + + OldIndex _ixInfo; + AVIHeader _header; Common::SeekableReadStream *_fileStream; bool _decodedHeader; - Codec *_videoCodec; - Codec *createCodec(); - Audio::Mixer::SoundType _soundType; void runHandle(uint32 tag); void handleList(); void handleStreamHeader(); - void handlePalChange(); - - Audio::SoundHandle *_audHandle; - Audio::QueuingAudioStream *_audStream; - Audio::QueuingAudioStream *createAudioStream(); - void queueAudioBuffer(uint32 chunkSize); }; } // End of namespace Video diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp index 538487f06772..620316806f5b 100644 --- a/video/bink_decoder.cpp +++ b/video/bink_decoder.cpp @@ -24,6 +24,7 @@ // based quite heavily on the Bink decoder found in FFmpeg. // Many thanks to Kostya Shishkov for doing the hard work. +#include "audio/audiostream.h" #include "audio/decoders/raw.h" #include "common/util.h" @@ -60,139 +61,108 @@ static const uint32 kDCStartBits = 11; namespace Video { -BinkDecoder::VideoFrame::VideoFrame() : bits(0) { -} - -BinkDecoder::VideoFrame::~VideoFrame() { - delete bits; +BinkDecoder::BinkDecoder() { + _bink = 0; } - -BinkDecoder::AudioTrack::AudioTrack() : bits(0), bands(0), rdft(0), dct(0) { +BinkDecoder::~BinkDecoder() { + close(); } -BinkDecoder::AudioTrack::~AudioTrack() { - delete bits; - - delete[] bands; - - delete rdft; - delete dct; -} +bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) { + close(); + uint32 id = stream->readUint32BE(); + if ((id != kBIKfID) && (id != kBIKgID) && (id != kBIKhID) && (id != kBIKiID)) + return false; -BinkDecoder::BinkDecoder() { - _bink = 0; - _audioTrack = 0; + uint32 fileSize = stream->readUint32LE() + 8; + uint32 frameCount = stream->readUint32LE(); + uint32 largestFrameSize = stream->readUint32LE(); - for (int i = 0; i < 16; i++) - _huffman[i] = 0; + if (largestFrameSize > fileSize) { + warning("Largest frame size greater than file size"); + return false; + } - for (int i = 0; i < kSourceMAX; i++) { - _bundles[i].countLength = 0; + stream->skip(4); - _bundles[i].huffman.index = 0; - for (int j = 0; j < 16; j++) - _bundles[i].huffman.symbols[j] = j; + uint32 width = stream->readUint32LE(); + uint32 height = stream->readUint32LE(); - _bundles[i].data = 0; - _bundles[i].dataEnd = 0; - _bundles[i].curDec = 0; - _bundles[i].curPtr = 0; + uint32 frameRateNum = stream->readUint32LE(); + uint32 frameRateDen = stream->readUint32LE(); + if (frameRateNum == 0 || frameRateDen == 0) { + warning("Invalid frame rate (%d/%d)", frameRateNum, frameRateDen); + return false; } - for (int i = 0; i < 16; i++) { - _colHighHuffman[i].index = 0; - for (int j = 0; j < 16; j++) - _colHighHuffman[i].symbols[j] = j; - } + _bink = stream; - for (int i = 0; i < 4; i++) { - _curPlanes[i] = 0; - _oldPlanes[i] = 0; - } + uint32 videoFlags = _bink->readUint32LE(); - _audioStream = 0; -} + // BIKh and BIKi swap the chroma planes + addTrack(new BinkVideoTrack(width, height, getDefaultHighColorFormat(), frameCount, + Common::Rational(frameRateNum, frameRateDen), (id == kBIKhID || id == kBIKiID), videoFlags & kVideoFlagAlpha, id)); -void BinkDecoder::startAudio() { - if (_audioTrack < _audioTracks.size()) { - const AudioTrack &audio = _audioTracks[_audioTrack]; + uint32 audioTrackCount = _bink->readUint32LE(); - _audioStream = Audio::makeQueuingAudioStream(audio.outSampleRate, audio.outChannels == 2); - g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance()); - } // else no audio -} + if (audioTrackCount > 0) { + _audioTracks.reserve(audioTrackCount); -void BinkDecoder::stopAudio() { - if (_audioStream) { - g_system->getMixer()->stopHandle(_audioHandle); - _audioStream = 0; - } -} + _bink->skip(4 * audioTrackCount); -BinkDecoder::~BinkDecoder() { - close(); -} + // Reading audio track properties + for (uint32 i = 0; i < audioTrackCount; i++) { + AudioInfo track; -void BinkDecoder::close() { - reset(); + track.sampleRate = _bink->readUint16LE(); + track.flags = _bink->readUint16LE(); - // Stop audio - stopAudio(); + _audioTracks.push_back(track); - for (int i = 0; i < 4; i++) { - delete[] _curPlanes[i]; _curPlanes[i] = 0; - delete[] _oldPlanes[i]; _oldPlanes[i] = 0; + initAudioTrack(_audioTracks[i]); + } + + _bink->skip(4 * audioTrackCount); } - deinitBundles(); + // Reading video frame properties + _frames.resize(frameCount); + for (uint32 i = 0; i < frameCount; i++) { + _frames[i].offset = _bink->readUint32LE(); + _frames[i].keyFrame = _frames[i].offset & 1; - for (int i = 0; i < 16; i++) { - delete _huffman[i]; - _huffman[i] = 0; - } + _frames[i].offset &= ~1; - delete _bink; _bink = 0; - _surface.free(); + if (i != 0) + _frames[i - 1].size = _frames[i].offset - _frames[i - 1].offset; - _audioTrack = 0; + _frames[i].bits = 0; + } - for (int i = 0; i < kSourceMAX; i++) { - _bundles[i].countLength = 0; + _frames[frameCount - 1].size = _bink->size() - _frames[frameCount - 1].offset; - _bundles[i].huffman.index = 0; - for (int j = 0; j < 16; j++) - _bundles[i].huffman.symbols[j] = j; + return true; +} - _bundles[i].data = 0; - _bundles[i].dataEnd = 0; - _bundles[i].curDec = 0; - _bundles[i].curPtr = 0; - } +void BinkDecoder::close() { + VideoDecoder::close(); - for (int i = 0; i < 16; i++) { - _colHighHuffman[i].index = 0; - for (int j = 0; j < 16; j++) - _colHighHuffman[i].symbols[j] = j; - } + delete _bink; + _bink = 0; _audioTracks.clear(); _frames.clear(); } -uint32 BinkDecoder::getTime() const { - if (_audioStream && g_system->getMixer()->isSoundHandleActive(_audioHandle)) - return g_system->getMixer()->getSoundElapsedTime(_audioHandle) + _audioStartOffset; - - return g_system->getMillis() - _startTime; -} +void BinkDecoder::readNextPacket() { + BinkVideoTrack *videoTrack = (BinkVideoTrack *)getTrack(0); -const Graphics::Surface *BinkDecoder::decodeNextFrame() { - if (endOfVideo()) - return 0; + if (videoTrack->endOfTrack()) + return; - VideoFrame &frame = _frames[_curFrame + 1]; + VideoFrame &frame = _frames[videoTrack->getCurFrame() + 1]; if (!_bink->seek(frame.offset)) error("Bad bink seek"); @@ -200,7 +170,7 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() { uint32 frameSize = frame.size; for (uint32 i = 0; i < _audioTracks.size(); i++) { - AudioTrack &audio = _audioTracks[i]; + AudioInfo &audio = _audioTracks[i]; uint32 audioPacketLength = _bink->readUint32LE(); @@ -210,24 +180,21 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() { error("Audio packet too big for the frame"); if (audioPacketLength >= 4) { + // Get our track - audio index plus one as the first track is video + BinkAudioTrack *audioTrack = (BinkAudioTrack *)getTrack(i + 1); uint32 audioPacketStart = _bink->pos(); uint32 audioPacketEnd = _bink->pos() + audioPacketLength; - if (i == _audioTrack) { - // Only play one audio track + // Number of samples in bytes + audio.sampleCount = _bink->readUint32LE() / (2 * audio.channels); - // Number of samples in bytes - audio.sampleCount = _bink->readUint32LE() / (2 * audio.channels); + audio.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink, + audioPacketStart + 4, audioPacketEnd), true); - audio.bits = - new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink, - audioPacketStart + 4, audioPacketEnd), true); + audioTrack->decodePacket(); - audioPacket(audio); - - delete audio.bits; - audio.bits = 0; - } + delete audio.bits; + audio.bits = 0; _bink->seek(audioPacketEnd); @@ -238,67 +205,125 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() { uint32 videoPacketStart = _bink->pos(); uint32 videoPacketEnd = _bink->pos() + frameSize; - frame.bits = - new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink, - videoPacketStart, videoPacketEnd), true); + frame.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink, + videoPacketStart, videoPacketEnd), true); - videoPacket(frame); + videoTrack->decodePacket(frame); delete frame.bits; frame.bits = 0; +} - _curFrame++; - if (_curFrame == 0) - _startTime = g_system->getMillis(); +BinkDecoder::VideoFrame::VideoFrame() : bits(0) { +} - return &_surface; +BinkDecoder::VideoFrame::~VideoFrame() { + delete bits; } -void BinkDecoder::audioPacket(AudioTrack &audio) { - if (!_audioStream) - return; - int outSize = audio.frameLen * audio.channels; - while (audio.bits->pos() < audio.bits->size()) { - int16 *out = (int16 *)malloc(outSize * 2); - memset(out, 0, outSize * 2); +BinkDecoder::AudioInfo::AudioInfo() : bits(0), bands(0), rdft(0), dct(0) { +} - audioBlock(audio, out); +BinkDecoder::AudioInfo::~AudioInfo() { + delete bits; - byte flags = Audio::FLAG_16BITS; - if (audio.outChannels == 2) - flags |= Audio::FLAG_STEREO; + delete[] bands; -#ifdef SCUMM_LITTLE_ENDIAN - flags |= Audio::FLAG_LITTLE_ENDIAN; -#endif + delete rdft; + delete dct; +} + +BinkDecoder::BinkVideoTrack::BinkVideoTrack(uint32 width, uint32 height, const Graphics::PixelFormat &format, uint32 frameCount, const Common::Rational &frameRate, bool swapPlanes, bool hasAlpha, uint32 id) : + _frameCount(frameCount), _frameRate(frameRate), _swapPlanes(swapPlanes), _hasAlpha(hasAlpha), _id(id) { + _curFrame = -1; + + for (int i = 0; i < 16; i++) + _huffman[i] = 0; - _audioStream->queueBuffer((byte *)out, audio.blockSize * 2, DisposeAfterUse::YES, flags); + for (int i = 0; i < kSourceMAX; i++) { + _bundles[i].countLength = 0; + + _bundles[i].huffman.index = 0; + for (int j = 0; j < 16; j++) + _bundles[i].huffman.symbols[j] = j; - if (audio.bits->pos() & 0x1F) // next data block starts at a 32-byte boundary - audio.bits->skip(32 - (audio.bits->pos() & 0x1F)); + _bundles[i].data = 0; + _bundles[i].dataEnd = 0; + _bundles[i].curDec = 0; + _bundles[i].curPtr = 0; + } + + for (int i = 0; i < 16; i++) { + _colHighHuffman[i].index = 0; + for (int j = 0; j < 16; j++) + _colHighHuffman[i].symbols[j] = j; + } + + _surface.create(width, height, format); + + // Give the planes a bit extra space + width = _surface.w + 32; + height = _surface.h + 32; + + _curPlanes[0] = new byte[ width * height ]; // Y + _curPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution + _curPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution + _curPlanes[3] = new byte[ width * height ]; // A + _oldPlanes[0] = new byte[ width * height ]; // Y + _oldPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution + _oldPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution + _oldPlanes[3] = new byte[ width * height ]; // A + + // Initialize the video with solid black + memset(_curPlanes[0], 0, width * height ); + memset(_curPlanes[1], 0, (width >> 1) * (height >> 1)); + memset(_curPlanes[2], 0, (width >> 1) * (height >> 1)); + memset(_curPlanes[3], 255, width * height ); + memset(_oldPlanes[0], 0, width * height ); + memset(_oldPlanes[1], 0, (width >> 1) * (height >> 1)); + memset(_oldPlanes[2], 0, (width >> 1) * (height >> 1)); + memset(_oldPlanes[3], 255, width * height ); + + initBundles(); + initHuffman(); +} + +BinkDecoder::BinkVideoTrack::~BinkVideoTrack() { + for (int i = 0; i < 4; i++) { + delete[] _curPlanes[i]; _curPlanes[i] = 0; + delete[] _oldPlanes[i]; _oldPlanes[i] = 0; + } + + deinitBundles(); + + for (int i = 0; i < 16; i++) { + delete _huffman[i]; + _huffman[i] = 0; } + + _surface.free(); } -void BinkDecoder::videoPacket(VideoFrame &video) { - assert(video.bits); +void BinkDecoder::BinkVideoTrack::decodePacket(VideoFrame &frame) { + assert(frame.bits); if (_hasAlpha) { if (_id == kBIKiID) - video.bits->skip(32); + frame.bits->skip(32); - decodePlane(video, 3, false); + decodePlane(frame, 3, false); } if (_id == kBIKiID) - video.bits->skip(32); + frame.bits->skip(32); for (int i = 0; i < 3; i++) { int planeIdx = ((i == 0) || !_swapPlanes) ? i : (i ^ 3); - decodePlane(video, planeIdx, i != 0); + decodePlane(frame, planeIdx, i != 0); - if (video.bits->pos() >= video.bits->size()) + if (frame.bits->pos() >= frame.bits->size()) break; } @@ -311,10 +336,11 @@ void BinkDecoder::videoPacket(VideoFrame &video) { // And swap the planes with the reference planes for (int i = 0; i < 4; i++) SWAP(_curPlanes[i], _oldPlanes[i]); -} -void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) { + _curFrame++; +} +void BinkDecoder::BinkVideoTrack::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) { uint32 blockWidth = isChroma ? ((_surface.w + 15) >> 4) : ((_surface.w + 7) >> 3); uint32 blockHeight = isChroma ? ((_surface.h + 15) >> 4) : ((_surface.h + 7) >> 3); uint32 width = isChroma ? (_surface.w >> 1) : _surface.w; @@ -371,48 +397,38 @@ void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) { } switch (blockType) { - case kBlockSkip: - blockSkip(ctx); - break; - - case kBlockScaled: - blockScaled(ctx); - break; - - case kBlockMotion: - blockMotion(ctx); - break; - - case kBlockRun: - blockRun(ctx); - break; - - case kBlockResidue: - blockResidue(ctx); - break; - - case kBlockIntra: - blockIntra(ctx); - break; - - case kBlockFill: - blockFill(ctx); - break; - - case kBlockInter: - blockInter(ctx); - break; - - case kBlockPattern: - blockPattern(ctx); - break; - - case kBlockRaw: - blockRaw(ctx); - break; - - default: - error("Unknown block type: %d", blockType); + case kBlockSkip: + blockSkip(ctx); + break; + case kBlockScaled: + blockScaled(ctx); + break; + case kBlockMotion: + blockMotion(ctx); + break; + case kBlockRun: + blockRun(ctx); + break; + case kBlockResidue: + blockResidue(ctx); + break; + case kBlockIntra: + blockIntra(ctx); + break; + case kBlockFill: + blockFill(ctx); + break; + case kBlockInter: + blockInter(ctx); + break; + case kBlockPattern: + blockPattern(ctx); + break; + case kBlockRaw: + blockRaw(ctx); + break; + default: + error("Unknown block type: %d", blockType); } } @@ -424,7 +440,7 @@ void BinkDecoder::decodePlane(VideoFrame &video, int planeIdx, bool isChroma) { } -void BinkDecoder::readBundle(VideoFrame &video, Source source) { +void BinkDecoder::BinkVideoTrack::readBundle(VideoFrame &video, Source source) { if (source == kSourceColors) { for (int i = 0; i < 16; i++) readHuffman(video, _colHighHuffman[i]); @@ -439,12 +455,11 @@ void BinkDecoder::readBundle(VideoFrame &video, Source source) { _bundles[source].curPtr = _bundles[source].data; } -void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) { +void BinkDecoder::BinkVideoTrack::readHuffman(VideoFrame &video, Huffman &huffman) { huffman.index = video.bits->getBits(4); if (huffman.index == 0) { // The first tree always gives raw nibbles - for (int i = 0; i < 16; i++) huffman.symbols[i] = i; @@ -455,7 +470,6 @@ void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) { if (video.bits->getBit()) { // Symbol selection - memset(hasSymbol, 0, 16); uint8 length = video.bits->getBits(3); @@ -493,214 +507,29 @@ void BinkDecoder::readHuffman(VideoFrame &video, Huffman &huffman) { memcpy(huffman.symbols, in, 16); } -void BinkDecoder::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size) { - const byte *src2 = src + size; - int size2 = size; - - do { - if (!video.bits->getBit()) { - *dst++ = *src++; - size--; - } else { - *dst++ = *src2++; - size2--; - } - - } while (size && size2); - - while (size--) - *dst++ = *src++; - while (size2--) - *dst++ = *src2++; -} - -bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) { - Graphics::PixelFormat format = g_system->getScreenFormat(); - return loadStream(stream, format); -} - -bool BinkDecoder::loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format) { - close(); - - _id = stream->readUint32BE(); - if ((_id != kBIKfID) && (_id != kBIKgID) && (_id != kBIKhID) && (_id != kBIKiID)) - return false; - - uint32 fileSize = stream->readUint32LE() + 8; - uint32 frameCount = stream->readUint32LE(); - uint32 largestFrameSize = stream->readUint32LE(); - - if (largestFrameSize > fileSize) { - warning("Largest frame size greater than file size"); - return false; - } - - stream->skip(4); - - uint32 width = stream->readUint32LE(); - uint32 height = stream->readUint32LE(); - - uint32 frameRateNum = stream->readUint32LE(); - uint32 frameRateDen = stream->readUint32LE(); - if (frameRateNum == 0 || frameRateDen == 0) { - warning("Invalid frame rate (%d/%d)", frameRateNum, frameRateDen); - return false; - } - - _frameRate = Common::Rational(frameRateNum, frameRateDen); - _bink = stream; - - _videoFlags = _bink->readUint32LE(); - - uint32 audioTrackCount = _bink->readUint32LE(); - - if (audioTrackCount > 1) { - warning("More than one audio track found. Using the first one"); - - _audioTrack = 0; - } - - if (audioTrackCount > 0) { - _audioTracks.reserve(audioTrackCount); - - _bink->skip(4 * audioTrackCount); - - // Reading audio track properties - for (uint32 i = 0; i < audioTrackCount; i++) { - AudioTrack track; - - track.sampleRate = _bink->readUint16LE(); - track.flags = _bink->readUint16LE(); - - _audioTracks.push_back(track); - - initAudioTrack(_audioTracks[i]); - } - - _bink->skip(4 * audioTrackCount); - } - - // Reading video frame properties - _frames.resize(frameCount); - for (uint32 i = 0; i < frameCount; i++) { - _frames[i].offset = _bink->readUint32LE(); - _frames[i].keyFrame = _frames[i].offset & 1; - - _frames[i].offset &= ~1; - - if (i != 0) - _frames[i - 1].size = _frames[i].offset - _frames[i - 1].offset; - - _frames[i].bits = 0; - } - - _frames[frameCount - 1].size = _bink->size() - _frames[frameCount - 1].offset; - - _hasAlpha = _videoFlags & kVideoFlagAlpha; - _swapPlanes = (_id == kBIKhID) || (_id == kBIKiID); // BIKh and BIKi swap the chroma planes - - _surface.create(width, height, format); - - // Give the planes a bit extra space - width = _surface.w + 32; - height = _surface.h + 32; - - _curPlanes[0] = new byte[ width * height ]; // Y - _curPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution - _curPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution - _curPlanes[3] = new byte[ width * height ]; // A - _oldPlanes[0] = new byte[ width * height ]; // Y - _oldPlanes[1] = new byte[(width >> 1) * (height >> 1)]; // U, 1/4 resolution - _oldPlanes[2] = new byte[(width >> 1) * (height >> 1)]; // V, 1/4 resolution - _oldPlanes[3] = new byte[ width * height ]; // A - - // Initialize the video with solid black - memset(_curPlanes[0], 0, width * height ); - memset(_curPlanes[1], 0, (width >> 1) * (height >> 1)); - memset(_curPlanes[2], 0, (width >> 1) * (height >> 1)); - memset(_curPlanes[3], 255, width * height ); - memset(_oldPlanes[0], 0, width * height ); - memset(_oldPlanes[1], 0, (width >> 1) * (height >> 1)); - memset(_oldPlanes[2], 0, (width >> 1) * (height >> 1)); - memset(_oldPlanes[3], 255, width * height ); - - initBundles(); - initHuffman(); - - startAudio(); - _audioStartOffset = 0; - - return true; -} - -void BinkDecoder::initAudioTrack(AudioTrack &audio) { - audio.sampleCount = 0; - audio.bits = 0; - - audio.channels = ((audio.flags & kAudioFlagStereo) != 0) ? 2 : 1; - audio.codec = ((audio.flags & kAudioFlagDCT ) != 0) ? kAudioCodecDCT : kAudioCodecRDFT; - - if (audio.channels > kAudioChannelsMax) - error("Too many audio channels: %d", audio.channels); - - uint32 frameLenBits; - // Calculate frame length - if (audio.sampleRate < 22050) - frameLenBits = 9; - else if(audio.sampleRate < 44100) - frameLenBits = 10; - else - frameLenBits = 11; - - audio.frameLen = 1 << frameLenBits; - - audio.outSampleRate = audio.sampleRate; - audio.outChannels = audio.channels; - - if (audio.codec == kAudioCodecRDFT) { - // RDFT audio already interleaves the samples correctly - - if (audio.channels == 2) - frameLenBits++; - - audio.sampleRate *= audio.channels; - audio.frameLen *= audio.channels; - audio.channels = 1; - } - - audio.overlapLen = audio.frameLen / 16; - audio.blockSize = (audio.frameLen - audio.overlapLen) * audio.channels; - audio.root = 2.0 / sqrt((double)audio.frameLen); - - uint32 sampleRateHalf = (audio.sampleRate + 1) / 2; - - // Calculate number of bands - for (audio.bandCount = 1; audio.bandCount < 25; audio.bandCount++) - if (sampleRateHalf <= binkCriticalFreqs[audio.bandCount - 1]) - break; - - audio.bands = new uint32[audio.bandCount + 1]; - - // Populate bands - audio.bands[0] = 1; - for (uint32 i = 1; i < audio.bandCount; i++) - audio.bands[i] = binkCriticalFreqs[i - 1] * (audio.frameLen / 2) / sampleRateHalf; - audio.bands[audio.bandCount] = audio.frameLen / 2; - - audio.first = true; +void BinkDecoder::BinkVideoTrack::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size) { + const byte *src2 = src + size; + int size2 = size; - for (uint8 i = 0; i < audio.channels; i++) - audio.coeffsPtr[i] = audio.coeffs + i * audio.frameLen; + do { + if (!video.bits->getBit()) { + *dst++ = *src++; + size--; + } else { + *dst++ = *src2++; + size2--; + } - audio.codec = ((audio.flags & kAudioFlagDCT) != 0) ? kAudioCodecDCT : kAudioCodecRDFT; + } while (size && size2); - if (audio.codec == kAudioCodecRDFT) - audio.rdft = new Common::RDFT(frameLenBits, Common::RDFT::DFT_C2R); - else if (audio.codec == kAudioCodecDCT) - audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III); + while (size--) + *dst++ = *src++; + + while (size2--) + *dst++ = *src2++; } -void BinkDecoder::initBundles() { +void BinkDecoder::BinkVideoTrack::initBundles() { uint32 bw = (_surface.w + 7) >> 3; uint32 bh = (_surface.h + 7) >> 3; uint32 blocks = bw * bh; @@ -729,21 +558,21 @@ void BinkDecoder::initBundles() { } } -void BinkDecoder::deinitBundles() { +void BinkDecoder::BinkVideoTrack::deinitBundles() { for (int i = 0; i < kSourceMAX; i++) delete[] _bundles[i].data; } -void BinkDecoder::initHuffman() { +void BinkDecoder::BinkVideoTrack::initHuffman() { for (int i = 0; i < 16; i++) _huffman[i] = new Common::Huffman(binkHuffmanLengths[i][15], 16, binkHuffmanCodes[i], binkHuffmanLengths[i]); } -byte BinkDecoder::getHuffmanSymbol(VideoFrame &video, Huffman &huffman) { +byte BinkDecoder::BinkVideoTrack::getHuffmanSymbol(VideoFrame &video, Huffman &huffman) { return huffman.symbols[_huffman[huffman.index]->getSymbol(*video.bits)]; } -int32 BinkDecoder::getBundleValue(Source source) { +int32 BinkDecoder::BinkVideoTrack::getBundleValue(Source source) { if ((source < kSourceXOff) || (source == kSourceRun)) return *_bundles[source].curPtr++; @@ -757,7 +586,7 @@ int32 BinkDecoder::getBundleValue(Source source) { return ret; } -uint32 BinkDecoder::readBundleCount(VideoFrame &video, Bundle &bundle) { +uint32 BinkDecoder::BinkVideoTrack::readBundleCount(VideoFrame &video, Bundle &bundle) { if (!bundle.curDec || (bundle.curDec > bundle.curPtr)) return 0; @@ -768,7 +597,7 @@ uint32 BinkDecoder::readBundleCount(VideoFrame &video, Bundle &bundle) { return n; } -void BinkDecoder::blockSkip(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockSkip(DecodeContext &ctx) { byte *dest = ctx.dest; byte *prev = ctx.prev; @@ -776,7 +605,7 @@ void BinkDecoder::blockSkip(DecodeContext &ctx) { memcpy(dest, prev, 8); } -void BinkDecoder::blockScaledSkip(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledSkip(DecodeContext &ctx) { byte *dest = ctx.dest; byte *prev = ctx.prev; @@ -784,7 +613,7 @@ void BinkDecoder::blockScaledSkip(DecodeContext &ctx) { memcpy(dest, prev, 16); } -void BinkDecoder::blockScaledRun(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledRun(DecodeContext &ctx) { const uint8 *scan = binkPatterns[ctx.video->bits->getBits(4)]; int i = 0; @@ -820,7 +649,7 @@ void BinkDecoder::blockScaledRun(DecodeContext &ctx) { ctx.dest[ctx.coordScaledMap4[*scan]] = getBundleValue(kSourceColors); } -void BinkDecoder::blockScaledIntra(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledIntra(DecodeContext &ctx) { int16 block[64]; memset(block, 0, 64 * sizeof(int16)); @@ -841,7 +670,7 @@ void BinkDecoder::blockScaledIntra(DecodeContext &ctx) { } } -void BinkDecoder::blockScaledFill(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledFill(DecodeContext &ctx) { byte v = getBundleValue(kSourceColors); byte *dest = ctx.dest; @@ -849,7 +678,7 @@ void BinkDecoder::blockScaledFill(DecodeContext &ctx) { memset(dest, v, 16); } -void BinkDecoder::blockScaledPattern(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledPattern(DecodeContext &ctx) { byte col[2]; for (int i = 0; i < 2; i++) @@ -865,7 +694,7 @@ void BinkDecoder::blockScaledPattern(DecodeContext &ctx) { } } -void BinkDecoder::blockScaledRaw(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaledRaw(DecodeContext &ctx) { byte row[8]; byte *dest1 = ctx.dest; @@ -880,32 +709,27 @@ void BinkDecoder::blockScaledRaw(DecodeContext &ctx) { } } -void BinkDecoder::blockScaled(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockScaled(DecodeContext &ctx) { BlockType blockType = (BlockType) getBundleValue(kSourceSubBlockTypes); switch (blockType) { - case kBlockRun: - blockScaledRun(ctx); - break; - - case kBlockIntra: - blockScaledIntra(ctx); - break; - - case kBlockFill: - blockScaledFill(ctx); - break; - - case kBlockPattern: - blockScaledPattern(ctx); - break; - - case kBlockRaw: - blockScaledRaw(ctx); - break; - - default: - error("Invalid 16x16 block type: %d", blockType); + case kBlockRun: + blockScaledRun(ctx); + break; + case kBlockIntra: + blockScaledIntra(ctx); + break; + case kBlockFill: + blockScaledFill(ctx); + break; + case kBlockPattern: + blockScaledPattern(ctx); + break; + case kBlockRaw: + blockScaledRaw(ctx); + break; + default: + error("Invalid 16x16 block type: %d", blockType); } ctx.blockX += 1; @@ -913,7 +737,7 @@ void BinkDecoder::blockScaled(DecodeContext &ctx) { ctx.prev += 8; } -void BinkDecoder::blockMotion(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockMotion(DecodeContext &ctx) { int8 xOff = getBundleValue(kSourceXOff); int8 yOff = getBundleValue(kSourceYOff); @@ -926,7 +750,7 @@ void BinkDecoder::blockMotion(DecodeContext &ctx) { memcpy(dest, prev, 8); } -void BinkDecoder::blockRun(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockRun(DecodeContext &ctx) { const uint8 *scan = binkPatterns[ctx.video->bits->getBits(4)]; int i = 0; @@ -953,7 +777,7 @@ void BinkDecoder::blockRun(DecodeContext &ctx) { ctx.dest[ctx.coordMap[*scan++]] = getBundleValue(kSourceColors); } -void BinkDecoder::blockResidue(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockResidue(DecodeContext &ctx) { blockMotion(ctx); byte v = ctx.video->bits->getBits(7); @@ -970,7 +794,7 @@ void BinkDecoder::blockResidue(DecodeContext &ctx) { dst[j] += src[j]; } -void BinkDecoder::blockIntra(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockIntra(DecodeContext &ctx) { int16 block[64]; memset(block, 0, 64 * sizeof(int16)); @@ -981,7 +805,7 @@ void BinkDecoder::blockIntra(DecodeContext &ctx) { IDCTPut(ctx, block); } -void BinkDecoder::blockFill(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockFill(DecodeContext &ctx) { byte v = getBundleValue(kSourceColors); byte *dest = ctx.dest; @@ -989,7 +813,7 @@ void BinkDecoder::blockFill(DecodeContext &ctx) { memset(dest, v, 8); } -void BinkDecoder::blockInter(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockInter(DecodeContext &ctx) { blockMotion(ctx); int16 block[64]; @@ -1002,7 +826,7 @@ void BinkDecoder::blockInter(DecodeContext &ctx) { IDCTAdd(ctx, block); } -void BinkDecoder::blockPattern(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockPattern(DecodeContext &ctx) { byte col[2]; for (int i = 0; i < 2; i++) @@ -1017,7 +841,7 @@ void BinkDecoder::blockPattern(DecodeContext &ctx) { } } -void BinkDecoder::blockRaw(DecodeContext &ctx) { +void BinkDecoder::BinkVideoTrack::blockRaw(DecodeContext &ctx) { byte *dest = ctx.dest; byte *data = _bundles[kSourceColors].curPtr; for (int i = 0; i < 8; i++, dest += ctx.pitch, data += 8) @@ -1026,7 +850,7 @@ void BinkDecoder::blockRaw(DecodeContext &ctx) { _bundles[kSourceColors].curPtr += 64; } -void BinkDecoder::readRuns(VideoFrame &video, Bundle &bundle) { +void BinkDecoder::BinkVideoTrack::readRuns(VideoFrame &video, Bundle &bundle) { uint32 n = readBundleCount(video, bundle); if (n == 0) return; @@ -1046,7 +870,7 @@ void BinkDecoder::readRuns(VideoFrame &video, Bundle &bundle) { *bundle.curDec++ = getHuffmanSymbol(video, bundle.huffman); } -void BinkDecoder::readMotionValues(VideoFrame &video, Bundle &bundle) { +void BinkDecoder::BinkVideoTrack::readMotionValues(VideoFrame &video, Bundle &bundle) { uint32 n = readBundleCount(video, bundle); if (n == 0) return; @@ -1083,7 +907,7 @@ void BinkDecoder::readMotionValues(VideoFrame &video, Bundle &bundle) { } const uint8 rleLens[4] = { 4, 8, 12, 32 }; -void BinkDecoder::readBlockTypes(VideoFrame &video, Bundle &bundle) { +void BinkDecoder::BinkVideoTrack::readBlockTypes(VideoFrame &video, Bundle &bundle) { uint32 n = readBundleCount(video, bundle); if (n == 0) return; @@ -1120,7 +944,7 @@ void BinkDecoder::readBlockTypes(VideoFrame &video, Bundle &bundle) { } while (bundle.curDec < decEnd); } -void BinkDecoder::readPatterns(VideoFrame &video, Bundle &bundle) { +void BinkDecoder::BinkVideoTrack::readPatterns(VideoFrame &video, Bundle &bundle) { uint32 n = readBundleCount(video, bundle); if (n == 0) return; @@ -1138,7 +962,7 @@ void BinkDecoder::readPatterns(VideoFrame &video, Bundle &bundle) { } -void BinkDecoder::readColors(VideoFrame &video, Bundle &bundle) { +void BinkDecoder::BinkVideoTrack::readColors(VideoFrame &video, Bundle &bundle) { uint32 n = readBundleCount(video, bundle); if (n == 0) return; @@ -1182,7 +1006,7 @@ void BinkDecoder::readColors(VideoFrame &video, Bundle &bundle) { } } -void BinkDecoder::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool hasSign) { +void BinkDecoder::BinkVideoTrack::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool hasSign) { uint32 length = readBundleCount(video, bundle); if (length == 0) return; @@ -1228,7 +1052,7 @@ void BinkDecoder::readDCS(VideoFrame &video, Bundle &bundle, int startBits, bool } /** Reads 8x8 block of DCT coefficients. */ -void BinkDecoder::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) { +void BinkDecoder::BinkVideoTrack::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) { int coefCount = 0; int coefIdx[64]; @@ -1326,7 +1150,7 @@ void BinkDecoder::readDCTCoeffs(VideoFrame &video, int16 *block, bool isIntra) { } /** Reads 8x8 block with residue after motion compensation. */ -void BinkDecoder::readResidue(VideoFrame &video, int16 *block, int masksCount) { +void BinkDecoder::BinkVideoTrack::readResidue(VideoFrame &video, int16 *block, int masksCount) { int nzCoeff[64]; int nzCoeffCount = 0; @@ -1417,63 +1241,170 @@ void BinkDecoder::readResidue(VideoFrame &video, int16 *block, int masksCount) { } } -float BinkDecoder::getFloat(AudioTrack &audio) { - int power = audio.bits->getBits(5); +#define A1 2896 /* (1/sqrt(2))<<12 */ +#define A2 2217 +#define A3 3784 +#define A4 -5352 - float f = ldexp((float)audio.bits->getBits(23), power - 23); +#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\ + const int a0 = (src)[s0] + (src)[s4]; \ + const int a1 = (src)[s0] - (src)[s4]; \ + const int a2 = (src)[s2] + (src)[s6]; \ + const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \ + const int a4 = (src)[s5] + (src)[s3]; \ + const int a5 = (src)[s5] - (src)[s3]; \ + const int a6 = (src)[s1] + (src)[s7]; \ + const int a7 = (src)[s1] - (src)[s7]; \ + const int b0 = a4 + a6; \ + const int b1 = (A3*(a5 + a7)) >> 11; \ + const int b2 = ((A4*a5) >> 11) - b0 + b1; \ + const int b3 = (A1*(a6 - a4) >> 11) - b2; \ + const int b4 = ((A2*a7) >> 11) + b3 - b1; \ + (dest)[d0] = munge(a0+a2 +b0); \ + (dest)[d1] = munge(a1+a3-a2+b2); \ + (dest)[d2] = munge(a1-a3+a2+b3); \ + (dest)[d3] = munge(a0-a2 -b4); \ + (dest)[d4] = munge(a0-a2 +b4); \ + (dest)[d5] = munge(a1-a3+a2-b3); \ + (dest)[d6] = munge(a1+a3-a2-b2); \ + (dest)[d7] = munge(a0+a2 -b0); \ +} +/* end IDCT_TRANSFORM macro */ - if (audio.bits->getBit()) - f = -f; +#define MUNGE_NONE(x) (x) +#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src) - return f; +#define MUNGE_ROW(x) (((x) + 0x7F)>>8) +#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src) + +static inline void IDCTCol(int16 *dest, const int16 *src) { + if ((src[8] | src[16] | src[24] | src[32] | src[40] | src[48] | src[56]) == 0) { + dest[ 0] = + dest[ 8] = + dest[16] = + dest[24] = + dest[32] = + dest[40] = + dest[48] = + dest[56] = src[0]; + } else { + IDCT_COL(dest, src); + } +} + +void BinkDecoder::BinkVideoTrack::IDCT(int16 *block) { + int i; + int16 temp[64]; + + for (i = 0; i < 8; i++) + IDCTCol(&temp[i], &block[i]); + for (i = 0; i < 8; i++) { + IDCT_ROW( (&block[8*i]), (&temp[8*i]) ); + } +} + +void BinkDecoder::BinkVideoTrack::IDCTAdd(DecodeContext &ctx, int16 *block) { + int i, j; + + IDCT(block); + byte *dest = ctx.dest; + for (i = 0; i < 8; i++, dest += ctx.pitch, block += 8) + for (j = 0; j < 8; j++) + dest[j] += block[j]; +} + +void BinkDecoder::BinkVideoTrack::IDCTPut(DecodeContext &ctx, int16 *block) { + int i; + int16 temp[64]; + for (i = 0; i < 8; i++) + IDCTCol(&temp[i], &block[i]); + for (i = 0; i < 8; i++) { + IDCT_ROW( (&ctx.dest[i*ctx.pitch]), (&temp[8*i]) ); + } +} + +BinkDecoder::BinkAudioTrack::BinkAudioTrack(BinkDecoder::AudioInfo &audio) : _audioInfo(&audio) { + _audioStream = Audio::makeQueuingAudioStream(_audioInfo->outSampleRate, _audioInfo->outChannels == 2); +} + +BinkDecoder::BinkAudioTrack::~BinkAudioTrack() { + delete _audioStream; +} + +Audio::AudioStream *BinkDecoder::BinkAudioTrack::getAudioStream() const { + return _audioStream; +} + +void BinkDecoder::BinkAudioTrack::decodePacket() { + int outSize = _audioInfo->frameLen * _audioInfo->channels; + + while (_audioInfo->bits->pos() < _audioInfo->bits->size()) { + int16 *out = (int16 *)malloc(outSize * 2); + memset(out, 0, outSize * 2); + + audioBlock(out); + + byte flags = Audio::FLAG_16BITS; + if (_audioInfo->outChannels == 2) + flags |= Audio::FLAG_STEREO; + +#ifdef SCUMM_LITTLE_ENDIAN + flags |= Audio::FLAG_LITTLE_ENDIAN; +#endif + + _audioStream->queueBuffer((byte *)out, _audioInfo->blockSize * 2, DisposeAfterUse::YES, flags); + + if (_audioInfo->bits->pos() & 0x1F) // next data block starts at a 32-byte boundary + _audioInfo->bits->skip(32 - (_audioInfo->bits->pos() & 0x1F)); + } } -void BinkDecoder::audioBlock(AudioTrack &audio, int16 *out) { - if (audio.codec == kAudioCodecDCT) - audioBlockDCT (audio); - else if (audio.codec == kAudioCodecRDFT) - audioBlockRDFT(audio); +void BinkDecoder::BinkAudioTrack::audioBlock(int16 *out) { + if (_audioInfo->codec == kAudioCodecDCT) + audioBlockDCT (); + else if (_audioInfo->codec == kAudioCodecRDFT) + audioBlockRDFT(); - floatToInt16Interleave(out, const_cast(audio.coeffsPtr), audio.frameLen, audio.channels); + floatToInt16Interleave(out, const_cast(_audioInfo->coeffsPtr), _audioInfo->frameLen, _audioInfo->channels); - if (!audio.first) { - int count = audio.overlapLen * audio.channels; + if (!_audioInfo->first) { + int count = _audioInfo->overlapLen * _audioInfo->channels; int shift = Common::intLog2(count); for (int i = 0; i < count; i++) { - out[i] = (audio.prevCoeffs[i] * (count - i) + out[i] * i) >> shift; + out[i] = (_audioInfo->prevCoeffs[i] * (count - i) + out[i] * i) >> shift; } } - memcpy(audio.prevCoeffs, out + audio.blockSize, audio.overlapLen * audio.channels * sizeof(*out)); + memcpy(_audioInfo->prevCoeffs, out + _audioInfo->blockSize, _audioInfo->overlapLen * _audioInfo->channels * sizeof(*out)); - audio.first = false; + _audioInfo->first = false; } -void BinkDecoder::audioBlockDCT(AudioTrack &audio) { - audio.bits->skip(2); +void BinkDecoder::BinkAudioTrack::audioBlockDCT() { + _audioInfo->bits->skip(2); - for (uint8 i = 0; i < audio.channels; i++) { - float *coeffs = audio.coeffsPtr[i]; + for (uint8 i = 0; i < _audioInfo->channels; i++) { + float *coeffs = _audioInfo->coeffsPtr[i]; - readAudioCoeffs(audio, coeffs); + readAudioCoeffs(coeffs); coeffs[0] /= 0.5; - audio.dct->calc(coeffs); + _audioInfo->dct->calc(coeffs); - for (uint32 j = 0; j < audio.frameLen; j++) - coeffs[j] *= (audio.frameLen / 2.0); + for (uint32 j = 0; j < _audioInfo->frameLen; j++) + coeffs[j] *= (_audioInfo->frameLen / 2.0); } } -void BinkDecoder::audioBlockRDFT(AudioTrack &audio) { - for (uint8 i = 0; i < audio.channels; i++) { - float *coeffs = audio.coeffsPtr[i]; +void BinkDecoder::BinkAudioTrack::audioBlockRDFT() { + for (uint8 i = 0; i < _audioInfo->channels; i++) { + float *coeffs = _audioInfo->coeffsPtr[i]; - readAudioCoeffs(audio, coeffs); + readAudioCoeffs(coeffs); - audio.rdft->calc(coeffs); + _audioInfo->rdft->calc(coeffs); } } @@ -1481,56 +1412,56 @@ static const uint8 rleLengthTab[16] = { 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64 }; -void BinkDecoder::readAudioCoeffs(AudioTrack &audio, float *coeffs) { - coeffs[0] = getFloat(audio) * audio.root; - coeffs[1] = getFloat(audio) * audio.root; +void BinkDecoder::BinkAudioTrack::readAudioCoeffs(float *coeffs) { + coeffs[0] = getFloat() * _audioInfo->root; + coeffs[1] = getFloat() * _audioInfo->root; float quant[25]; - for (uint32 i = 0; i < audio.bandCount; i++) { - int value = audio.bits->getBits(8); + for (uint32 i = 0; i < _audioInfo->bandCount; i++) { + int value = _audioInfo->bits->getBits(8); // 0.066399999 / log10(M_E) - quant[i] = exp(MIN(value, 95) * 0.15289164787221953823f) * audio.root; + quant[i] = exp(MIN(value, 95) * 0.15289164787221953823f) * _audioInfo->root; } float q = 0.0; // Find band (k) int k; - for (k = 0; audio.bands[k] < 1; k++) + for (k = 0; _audioInfo->bands[k] < 1; k++) q = quant[k]; // Parse coefficients uint32 i = 2; - while (i < audio.frameLen) { + while (i < _audioInfo->frameLen) { uint32 j = 0; - if (audio.bits->getBit()) - j = i + rleLengthTab[audio.bits->getBits(4)] * 8; + if (_audioInfo->bits->getBit()) + j = i + rleLengthTab[_audioInfo->bits->getBits(4)] * 8; else j = i + 8; - j = MIN(j, audio.frameLen); + j = MIN(j, _audioInfo->frameLen); - int width = audio.bits->getBits(4); + int width = _audioInfo->bits->getBits(4); if (width == 0) { memset(coeffs + i, 0, (j - i) * sizeof(*coeffs)); i = j; - while (audio.bands[k] * 2 < i) + while (_audioInfo->bands[k] * 2 < i) q = quant[k++]; } else { while (i < j) { - if (audio.bands[k] * 2 == i) + if (_audioInfo->bands[k] * 2 == i) q = quant[k++]; - int coeff = audio.bits->getBits(width); + int coeff = _audioInfo->bits->getBits(width); if (coeff) { - if (audio.bits->getBit()) + if (_audioInfo->bits->getBit()) coeffs[i] = -q * coeff; else coeffs[i] = q * coeff; @@ -1548,10 +1479,10 @@ void BinkDecoder::readAudioCoeffs(AudioTrack &audio, float *coeffs) { } static inline int floatToInt16One(float src) { - return (int16) CLIP((int) floor(src + 0.5), -32768, 32767); + return (int16)CLIP((int)floor(src + 0.5), -32768, 32767); } -void BinkDecoder::floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels) { +void BinkDecoder::BinkAudioTrack::floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels) { if (channels == 2) { for (uint32 i = 0; i < length; i++) { dst[2 * i ] = floatToInt16One(src[0][i]); @@ -1564,97 +1495,84 @@ void BinkDecoder::floatToInt16Interleave(int16 *dst, const float **src, uint32 l } } -#define A1 2896 /* (1/sqrt(2))<<12 */ -#define A2 2217 -#define A3 3784 -#define A4 -5352 +float BinkDecoder::BinkAudioTrack::getFloat() { + int power = _audioInfo->bits->getBits(5); -#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\ - const int a0 = (src)[s0] + (src)[s4]; \ - const int a1 = (src)[s0] - (src)[s4]; \ - const int a2 = (src)[s2] + (src)[s6]; \ - const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \ - const int a4 = (src)[s5] + (src)[s3]; \ - const int a5 = (src)[s5] - (src)[s3]; \ - const int a6 = (src)[s1] + (src)[s7]; \ - const int a7 = (src)[s1] - (src)[s7]; \ - const int b0 = a4 + a6; \ - const int b1 = (A3*(a5 + a7)) >> 11; \ - const int b2 = ((A4*a5) >> 11) - b0 + b1; \ - const int b3 = (A1*(a6 - a4) >> 11) - b2; \ - const int b4 = ((A2*a7) >> 11) + b3 - b1; \ - (dest)[d0] = munge(a0+a2 +b0); \ - (dest)[d1] = munge(a1+a3-a2+b2); \ - (dest)[d2] = munge(a1-a3+a2+b3); \ - (dest)[d3] = munge(a0-a2 -b4); \ - (dest)[d4] = munge(a0-a2 +b4); \ - (dest)[d5] = munge(a1-a3+a2-b3); \ - (dest)[d6] = munge(a1+a3-a2-b2); \ - (dest)[d7] = munge(a0+a2 -b0); \ + float f = ldexp((float)_audioInfo->bits->getBits(23), power - 23); + + if (_audioInfo->bits->getBit()) + f = -f; + + return f; } -/* end IDCT_TRANSFORM macro */ -#define MUNGE_NONE(x) (x) -#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src) +void BinkDecoder::initAudioTrack(AudioInfo &audio) { + audio.sampleCount = 0; + audio.bits = 0; -#define MUNGE_ROW(x) (((x) + 0x7F)>>8) -#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src) + audio.channels = ((audio.flags & kAudioFlagStereo) != 0) ? 2 : 1; + audio.codec = ((audio.flags & kAudioFlagDCT ) != 0) ? kAudioCodecDCT : kAudioCodecRDFT; -static inline void IDCTCol(int16 *dest, const int16 *src) -{ - if ((src[8] | src[16] | src[24] | src[32] | src[40] | src[48] | src[56]) == 0) { - dest[ 0] = - dest[ 8] = - dest[16] = - dest[24] = - dest[32] = - dest[40] = - dest[48] = - dest[56] = src[0]; - } else { - IDCT_COL(dest, src); - } -} + if (audio.channels > kAudioChannelsMax) + error("Too many audio channels: %d", audio.channels); -void BinkDecoder::IDCT(int16 *block) { - int i; - int16 temp[64]; + uint32 frameLenBits; + // Calculate frame length + if (audio.sampleRate < 22050) + frameLenBits = 9; + else if(audio.sampleRate < 44100) + frameLenBits = 10; + else + frameLenBits = 11; - for (i = 0; i < 8; i++) - IDCTCol(&temp[i], &block[i]); - for (i = 0; i < 8; i++) { - IDCT_ROW( (&block[8*i]), (&temp[8*i]) ); - } -} + audio.frameLen = 1 << frameLenBits; -void BinkDecoder::IDCTAdd(DecodeContext &ctx, int16 *block) { - int i, j; + audio.outSampleRate = audio.sampleRate; + audio.outChannels = audio.channels; - IDCT(block); - byte *dest = ctx.dest; - for (i = 0; i < 8; i++, dest += ctx.pitch, block += 8) - for (j = 0; j < 8; j++) - dest[j] += block[j]; -} + if (audio.codec == kAudioCodecRDFT) { + // RDFT audio already interleaves the samples correctly -void BinkDecoder::IDCTPut(DecodeContext &ctx, int16 *block) { - int i; - int16 temp[64]; - for (i = 0; i < 8; i++) - IDCTCol(&temp[i], &block[i]); - for (i = 0; i < 8; i++) { - IDCT_ROW( (&ctx.dest[i*ctx.pitch]), (&temp[8*i]) ); + if (audio.channels == 2) + frameLenBits++; + + audio.sampleRate *= audio.channels; + audio.frameLen *= audio.channels; + audio.channels = 1; } -} -void BinkDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); -} + audio.overlapLen = audio.frameLen / 16; + audio.blockSize = (audio.frameLen - audio.overlapLen) * audio.channels; + audio.root = 2.0 / sqrt((double)audio.frameLen); + + uint32 sampleRateHalf = (audio.sampleRate + 1) / 2; + + // Calculate number of bands + for (audio.bandCount = 1; audio.bandCount < 25; audio.bandCount++) + if (sampleRateHalf <= binkCriticalFreqs[audio.bandCount - 1]) + break; + + audio.bands = new uint32[audio.bandCount + 1]; + + // Populate bands + audio.bands[0] = 1; + for (uint32 i = 1; i < audio.bandCount; i++) + audio.bands[i] = binkCriticalFreqs[i - 1] * (audio.frameLen / 2) / sampleRateHalf; + audio.bands[audio.bandCount] = audio.frameLen / 2; + + audio.first = true; + + for (uint8 i = 0; i < audio.channels; i++) + audio.coeffsPtr[i] = audio.coeffs + i * audio.frameLen; + + audio.codec = ((audio.flags & kAudioFlagDCT) != 0) ? kAudioCodecDCT : kAudioCodecRDFT; + + if (audio.codec == kAudioCodecRDFT) + audio.rdft = new Common::RDFT(frameLenBits, Common::RDFT::DFT_C2R); + else if (audio.codec == kAudioCodecDCT) + audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III); -void BinkDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); + addTrack(new BinkAudioTrack(audio)); } } // End of namespace Video diff --git a/video/bink_decoder.h b/video/bink_decoder.h index a5e1b1027094..150e91aab7e6 100644 --- a/video/bink_decoder.h +++ b/video/bink_decoder.h @@ -31,22 +31,27 @@ #ifndef VIDEO_BINK_DECODER_H #define VIDEO_BINK_DECODER_H -#include "audio/audiostream.h" -#include "audio/mixer.h" #include "common/array.h" #include "common/rational.h" -#include "graphics/surface.h" - #include "video/video_decoder.h" +namespace Audio { +class AudioStream; +class QueuingAudioStream; +} + namespace Common { - class SeekableReadStream; - class BitStream; - class Huffman; +class SeekableReadStream; +class BitStream; +class Huffman; - class RDFT; - class DCT; +class RDFT; +class DCT; +} + +namespace Graphics { +struct Surface; } namespace Video { @@ -57,92 +62,28 @@ namespace Video { * Video decoder used in engines: * - scumm (he) */ -class BinkDecoder : public FixedRateVideoDecoder { +class BinkDecoder : public VideoDecoder { public: BinkDecoder(); ~BinkDecoder(); - // VideoDecoder API bool loadStream(Common::SeekableReadStream *stream); void close(); - bool isVideoLoaded() const { return _bink != 0; } - uint16 getWidth() const { return _surface.w; } - uint16 getHeight() const { return _surface.h; } - Graphics::PixelFormat getPixelFormat() const { return _surface.format; } - uint32 getFrameCount() const { return _frames.size(); } - uint32 getTime() const; - const Graphics::Surface *decodeNextFrame(); - - // FixedRateVideoDecoder - Common::Rational getFrameRate() const { return _frameRate; } - - // Bink specific - bool loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format); protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); + void readNextPacket(); +private: static const int kAudioChannelsMax = 2; static const int kAudioBlockSizeMax = (kAudioChannelsMax << 11); - /** IDs for different data types used in Bink video codec. */ - enum Source { - kSourceBlockTypes = 0, ///< 8x8 block types. - kSourceSubBlockTypes , ///< 16x16 block types (a subset of 8x8 block types). - kSourceColors , ///< Pixel values used for different block types. - kSourcePattern , ///< 8-bit values for 2-color pattern fill. - kSourceXOff , ///< X components of motion value. - kSourceYOff , ///< Y components of motion value. - kSourceIntraDC , ///< DC values for intrablocks with DCT. - kSourceInterDC , ///< DC values for interblocks with DCT. - kSourceRun , ///< Run lengths for special fill block. - - kSourceMAX - }; - - /** Bink video block types. */ - enum BlockType { - kBlockSkip = 0, ///< Skipped block. - kBlockScaled , ///< Block has size 16x16. - kBlockMotion , ///< Block is copied from previous frame with some offset. - kBlockRun , ///< Block is composed from runs of colors with custom scan order. - kBlockResidue , ///< Motion block with some difference added. - kBlockIntra , ///< Intra DCT block. - kBlockFill , ///< Block is filled with single color. - kBlockInter , ///< Motion block with DCT applied to the difference. - kBlockPattern , ///< Block is filled with two colors following custom pattern. - kBlockRaw ///< Uncoded 8x8 block. - }; - - /** Data structure for decoding and tranlating Huffman'd data. */ - struct Huffman { - int index; ///< Index of the Huffman codebook to use. - byte symbols[16]; ///< Huffman symbol => Bink symbol tranlation list. - }; - - /** Data structure used for decoding a single Bink data type. */ - struct Bundle { - int countLengths[2]; ///< Lengths of number of entries to decode (in bits). - int countLength; ///< Length of number of entries to decode (in bits) for the current plane. - - Huffman huffman; ///< Huffman codebook. - - byte *data; ///< Buffer for decoded symbols. - byte *dataEnd; ///< Buffer end. - - byte *curDec; ///< Pointer to the data that wasn't yet decoded. - byte *curPtr; ///< Pointer to the data that wasn't yet read. - }; - enum AudioCodec { kAudioCodecDCT, kAudioCodecRDFT }; /** An audio track. */ - struct AudioTrack { + struct AudioInfo { uint16 flags; uint32 sampleRate; @@ -177,8 +118,8 @@ class BinkDecoder : public FixedRateVideoDecoder { Common::RDFT *rdft; Common::DCT *dct; - AudioTrack(); - ~AudioTrack(); + AudioInfo(); + ~AudioInfo(); }; /** A video frame. */ @@ -194,149 +135,218 @@ class BinkDecoder : public FixedRateVideoDecoder { ~VideoFrame(); }; - /** A decoder state. */ - struct DecodeContext { - VideoFrame *video; + class BinkVideoTrack : public FixedRateVideoTrack { + public: + BinkVideoTrack(uint32 width, uint32 height, const Graphics::PixelFormat &format, uint32 frameCount, const Common::Rational &frameRate, bool swapPlanes, bool hasAlpha, uint32 id); + ~BinkVideoTrack(); + + uint16 getWidth() const { return _surface.w; } + uint16 getHeight() const { return _surface.h; } + Graphics::PixelFormat getPixelFormat() const { return _surface.format; } + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame() { return &_surface; } + + /** Decode a video packet. */ + void decodePacket(VideoFrame &frame); + + protected: + Common::Rational getFrameRate() const { return _frameRate; } - uint32 planeIdx; + private: + /** A decoder state. */ + struct DecodeContext { + VideoFrame *video; + + uint32 planeIdx; - uint32 blockX; - uint32 blockY; + uint32 blockX; + uint32 blockY; - byte *dest; - byte *prev; + byte *dest; + byte *prev; - byte *destStart, *destEnd; - byte *prevStart, *prevEnd; + byte *destStart, *destEnd; + byte *prevStart, *prevEnd; - uint32 pitch; + uint32 pitch; - int coordMap[64]; - int coordScaledMap1[64]; - int coordScaledMap2[64]; - int coordScaledMap3[64]; - int coordScaledMap4[64]; + int coordMap[64]; + int coordScaledMap1[64]; + int coordScaledMap2[64]; + int coordScaledMap3[64]; + int coordScaledMap4[64]; + }; + + /** IDs for different data types used in Bink video codec. */ + enum Source { + kSourceBlockTypes = 0, ///< 8x8 block types. + kSourceSubBlockTypes , ///< 16x16 block types (a subset of 8x8 block types). + kSourceColors , ///< Pixel values used for different block types. + kSourcePattern , ///< 8-bit values for 2-color pattern fill. + kSourceXOff , ///< X components of motion value. + kSourceYOff , ///< Y components of motion value. + kSourceIntraDC , ///< DC values for intrablocks with DCT. + kSourceInterDC , ///< DC values for interblocks with DCT. + kSourceRun , ///< Run lengths for special fill block. + + kSourceMAX + }; + + /** Bink video block types. */ + enum BlockType { + kBlockSkip = 0, ///< Skipped block. + kBlockScaled , ///< Block has size 16x16. + kBlockMotion , ///< Block is copied from previous frame with some offset. + kBlockRun , ///< Block is composed from runs of colors with custom scan order. + kBlockResidue , ///< Motion block with some difference added. + kBlockIntra , ///< Intra DCT block. + kBlockFill , ///< Block is filled with single color. + kBlockInter , ///< Motion block with DCT applied to the difference. + kBlockPattern , ///< Block is filled with two colors following custom pattern. + kBlockRaw ///< Uncoded 8x8 block. + }; + + /** Data structure for decoding and tranlating Huffman'd data. */ + struct Huffman { + int index; ///< Index of the Huffman codebook to use. + byte symbols[16]; ///< Huffman symbol => Bink symbol tranlation list. + }; + + /** Data structure used for decoding a single Bink data type. */ + struct Bundle { + int countLengths[2]; ///< Lengths of number of entries to decode (in bits). + int countLength; ///< Length of number of entries to decode (in bits) for the current plane. + + Huffman huffman; ///< Huffman codebook. + + byte *data; ///< Buffer for decoded symbols. + byte *dataEnd; ///< Buffer end. + + byte *curDec; ///< Pointer to the data that wasn't yet decoded. + byte *curPtr; ///< Pointer to the data that wasn't yet read. + }; + + int _curFrame; + int _frameCount; + + Graphics::Surface _surface; + + uint32 _id; ///< The BIK FourCC. + + bool _hasAlpha; ///< Do video frames have alpha? + bool _swapPlanes; ///< Are the planes ordered (A)YVU instead of (A)YUV? + + Common::Rational _frameRate; + + Bundle _bundles[kSourceMAX]; ///< Bundles for decoding all data types. + + Common::Huffman *_huffman[16]; ///< The 16 Huffman codebooks used in Bink decoding. + + /** Huffman codebooks to use for decoding high nibbles in color data types. */ + Huffman _colHighHuffman[16]; + /** Value of the last decoded high nibble in color data types. */ + int _colLastVal; + + byte *_curPlanes[4]; ///< The 4 color planes, YUVA, current frame. + byte *_oldPlanes[4]; ///< The 4 color planes, YUVA, last frame. + + /** Initialize the bundles. */ + void initBundles(); + /** Deinitialize the bundles. */ + void deinitBundles(); + + /** Initialize the Huffman decoders. */ + void initHuffman(); + + /** Decode a plane. */ + void decodePlane(VideoFrame &video, int planeIdx, bool isChroma); + + /** Read/Initialize a bundle for decoding a plane. */ + void readBundle(VideoFrame &video, Source source); + + /** Read the symbols for a Huffman code. */ + void readHuffman(VideoFrame &video, Huffman &huffman); + /** Merge two Huffman symbol lists. */ + void mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size); + + /** Read and translate a symbol out of a Huffman code. */ + byte getHuffmanSymbol(VideoFrame &video, Huffman &huffman); + + /** Get a direct value out of a bundle. */ + int32 getBundleValue(Source source); + /** Read a count value out of a bundle. */ + uint32 readBundleCount(VideoFrame &video, Bundle &bundle); + + // Handle the block types + void blockSkip (DecodeContext &ctx); + void blockScaledSkip (DecodeContext &ctx); + void blockScaledRun (DecodeContext &ctx); + void blockScaledIntra (DecodeContext &ctx); + void blockScaledFill (DecodeContext &ctx); + void blockScaledPattern(DecodeContext &ctx); + void blockScaledRaw (DecodeContext &ctx); + void blockScaled (DecodeContext &ctx); + void blockMotion (DecodeContext &ctx); + void blockRun (DecodeContext &ctx); + void blockResidue (DecodeContext &ctx); + void blockIntra (DecodeContext &ctx); + void blockFill (DecodeContext &ctx); + void blockInter (DecodeContext &ctx); + void blockPattern (DecodeContext &ctx); + void blockRaw (DecodeContext &ctx); + + // Read the bundles + void readRuns (VideoFrame &video, Bundle &bundle); + void readMotionValues(VideoFrame &video, Bundle &bundle); + void readBlockTypes (VideoFrame &video, Bundle &bundle); + void readPatterns (VideoFrame &video, Bundle &bundle); + void readColors (VideoFrame &video, Bundle &bundle); + void readDCS (VideoFrame &video, Bundle &bundle, int startBits, bool hasSign); + void readDCTCoeffs (VideoFrame &video, int16 *block, bool isIntra); + void readResidue (VideoFrame &video, int16 *block, int masksCount); + + // Bink video IDCT + void IDCT(int16 *block); + void IDCTPut(DecodeContext &ctx, int16 *block); + void IDCTAdd(DecodeContext &ctx, int16 *block); }; - Common::SeekableReadStream *_bink; + class BinkAudioTrack : public AudioTrack { + public: + BinkAudioTrack(AudioInfo &audio); + ~BinkAudioTrack(); + + /** Decode an audio packet. */ + void decodePacket(); - uint32 _id; ///< The BIK FourCC. + protected: + Audio::AudioStream *getAudioStream() const; - Common::Rational _frameRate; + private: + AudioInfo *_audioInfo; + Audio::QueuingAudioStream *_audioStream; - Graphics::Surface _surface; + float getFloat(); - Audio::SoundHandle _audioHandle; - Audio::QueuingAudioStream *_audioStream; - int32 _audioStartOffset; + /** Decode an audio block. */ + void audioBlock(int16 *out); + /** Decode a DCT'd audio block. */ + void audioBlockDCT(); + /** Decode a RDFT'd audio block. */ + void audioBlockRDFT(); - uint32 _videoFlags; ///< Video frame features. + void readAudioCoeffs(float *coeffs); - bool _hasAlpha; ///< Do video frames have alpha? - bool _swapPlanes; ///< Are the planes ordered (A)YVU instead of (A)YUV? + static void floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels); + }; + + Common::SeekableReadStream *_bink; - Common::Array _audioTracks; ///< All audio tracks. + Common::Array _audioTracks; ///< All audio tracks. Common::Array _frames; ///< All video frames. - uint32 _audioTrack; ///< Audio track to use. - - Common::Huffman *_huffman[16]; ///< The 16 Huffman codebooks used in Bink decoding. - - Bundle _bundles[kSourceMAX]; ///< Bundles for decoding all data types. - - /** Huffman codebooks to use for decoding high nibbles in color data types. */ - Huffman _colHighHuffman[16]; - /** Value of the last decoded high nibble in color data types. */ - int _colLastVal; - - byte *_curPlanes[4]; ///< The 4 color planes, YUVA, current frame. - byte *_oldPlanes[4]; ///< The 4 color planes, YUVA, last frame. - - - /** Initialize the bundles. */ - void initBundles(); - /** Deinitialize the bundles. */ - void deinitBundles(); - - /** Initialize the Huffman decoders. */ - void initHuffman(); - - /** Decode an audio packet. */ - void audioPacket(AudioTrack &audio); - /** Decode a video packet. */ - virtual void videoPacket(VideoFrame &video); - - /** Decode a plane. */ - void decodePlane(VideoFrame &video, int planeIdx, bool isChroma); - - /** Read/Initialize a bundle for decoding a plane. */ - void readBundle(VideoFrame &video, Source source); - - /** Read the symbols for a Huffman code. */ - void readHuffman(VideoFrame &video, Huffman &huffman); - /** Merge two Huffman symbol lists. */ - void mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *src, int size); - - /** Read and translate a symbol out of a Huffman code. */ - byte getHuffmanSymbol(VideoFrame &video, Huffman &huffman); - - /** Get a direct value out of a bundle. */ - int32 getBundleValue(Source source); - /** Read a count value out of a bundle. */ - uint32 readBundleCount(VideoFrame &video, Bundle &bundle); - - // Handle the block types - void blockSkip (DecodeContext &ctx); - void blockScaledSkip (DecodeContext &ctx); - void blockScaledRun (DecodeContext &ctx); - void blockScaledIntra (DecodeContext &ctx); - void blockScaledFill (DecodeContext &ctx); - void blockScaledPattern(DecodeContext &ctx); - void blockScaledRaw (DecodeContext &ctx); - void blockScaled (DecodeContext &ctx); - void blockMotion (DecodeContext &ctx); - void blockRun (DecodeContext &ctx); - void blockResidue (DecodeContext &ctx); - void blockIntra (DecodeContext &ctx); - void blockFill (DecodeContext &ctx); - void blockInter (DecodeContext &ctx); - void blockPattern (DecodeContext &ctx); - void blockRaw (DecodeContext &ctx); - - // Read the bundles - void readRuns (VideoFrame &video, Bundle &bundle); - void readMotionValues(VideoFrame &video, Bundle &bundle); - void readBlockTypes (VideoFrame &video, Bundle &bundle); - void readPatterns (VideoFrame &video, Bundle &bundle); - void readColors (VideoFrame &video, Bundle &bundle); - void readDCS (VideoFrame &video, Bundle &bundle, int startBits, bool hasSign); - void readDCTCoeffs (VideoFrame &video, int16 *block, bool isIntra); - void readResidue (VideoFrame &video, int16 *block, int masksCount); - - void initAudioTrack(AudioTrack &audio); - - float getFloat(AudioTrack &audio); - - /** Decode an audio block. */ - void audioBlock (AudioTrack &audio, int16 *out); - /** Decode a DCT'd audio block. */ - void audioBlockDCT (AudioTrack &audio); - /** Decode a RDFT'd audio block. */ - void audioBlockRDFT(AudioTrack &audio); - - void readAudioCoeffs(AudioTrack &audio, float *coeffs); - - void floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels); - - // Bink video IDCT - void IDCT(int16 *block); - void IDCTPut(DecodeContext &ctx, int16 *block); - void IDCTAdd(DecodeContext &ctx, int16 *block); - - /** Start playing the audio track */ - void startAudio(); - /** Stop playing the audio track */ - void stopAudio(); + void initAudioTrack(AudioInfo &audio); }; } // End of namespace Video diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 0c7ade1b8a26..6a60b0e7d7e4 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -53,7 +53,8 @@ CoktelDecoder::CoktelDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundT _mixer(mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0), _defaultX(0), _defaultY(0), _features(0), _frameCount(0), _paletteDirty(false), _ownSurface(true), _frameRate(12), _hasSound(false), _soundEnabled(false), - _soundStage(kSoundNone), _audioStream(0) { + _soundStage(kSoundNone), _audioStream(0), _startTime(0), _pauseStartTime(0), + _isPaused(false) { assert(_mixer); @@ -261,6 +262,10 @@ bool CoktelDecoder::isPaletted() const { return true; } +int CoktelDecoder::getCurFrame() const { + return _curFrame; +} + void CoktelDecoder::close() { disableSound(); freeSurface(); @@ -273,9 +278,14 @@ void CoktelDecoder::close() { _features = 0; - _frameCount = 0; + _curFrame = -1; + _frameCount = 0; + + _startTime = 0; _hasSound = false; + + _isPaused = false; } uint16 CoktelDecoder::getWidth() const { @@ -291,6 +301,7 @@ uint32 CoktelDecoder::getFrameCount() const { } const byte *CoktelDecoder::getPalette() { + _paletteDirty = false; return _palette; } @@ -625,14 +636,45 @@ Common::Rational CoktelDecoder::getFrameRate() const { return _frameRate; } +uint32 CoktelDecoder::getTimeToNextFrame() const { + if (endOfVideo() || _curFrame < 0) + return 0; + + uint32 elapsedTime = g_system->getMillis() - _startTime; + uint32 nextFrameStartTime = (Common::Rational((_curFrame + 1) * 1000) / getFrameRate()).toInt(); + + if (nextFrameStartTime <= elapsedTime) + return 0; + + return nextFrameStartTime - elapsedTime; +} + uint32 CoktelDecoder::getStaticTimeToNextFrame() const { return (1000 / _frameRate).toInt(); } +void CoktelDecoder::pauseVideo(bool pause) { + if (_isPaused != pause) { + if (_isPaused) { + // Add the time we were paused to the initial starting time + _startTime += g_system->getMillis() - _pauseStartTime; + } else { + // Store the time we paused for use later + _pauseStartTime = g_system->getMillis(); + } + + _isPaused = pause; + } +} + inline void CoktelDecoder::unsignedToSigned(byte *buffer, int length) { while (length-- > 0) *buffer++ ^= 0x80; } +bool CoktelDecoder::endOfVideo() const { + return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1); +} + PreIMDDecoder::PreIMDDecoder(uint16 width, uint16 height, Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType), @@ -705,8 +747,6 @@ bool PreIMDDecoder::loadStream(Common::SeekableReadStream *stream) { } void PreIMDDecoder::close() { - reset(); - CoktelDecoder::close(); delete _stream; @@ -1159,8 +1199,6 @@ bool IMDDecoder::loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos) { } void IMDDecoder::close() { - reset(); - CoktelDecoder::close(); delete _stream; @@ -1225,8 +1263,6 @@ void IMDDecoder::processFrame() { _dirtyRects.clear(); - _paletteDirty = false; - uint32 cmd = 0; bool hasNextCmd = false; bool startSound = false; @@ -1273,7 +1309,7 @@ void IMDDecoder::processFrame() { // Set palette if (cmd == kCommandPalette) { _stream->skip(2); - + _paletteDirty = true; for (int i = 0; i < 768; i++) @@ -1322,7 +1358,7 @@ void IMDDecoder::processFrame() { // Start the audio stream if necessary if (startSound && _soundEnabled) { _mixer->playStream(_soundType, &_audioHandle, _audioStream, - -1, getVolume(), getBalance(), DisposeAfterUse::NO); + -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); _soundStage = kSoundPlaying; } @@ -1504,16 +1540,6 @@ Graphics::PixelFormat IMDDecoder::getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } -void IMDDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); -} - -void IMDDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); -} - VMDDecoder::File::File() { offset = 0; @@ -1552,7 +1578,7 @@ VMDDecoder::VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : _soundLastFilledFrame(0), _audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0), _blitMode(0), _bytesPerPixel(0), _firstFramePos(0), _videoBufferSize(0), _externalCodec(false), _codec(0), - _subtitle(-1), _isPaletted(true) { + _subtitle(-1), _isPaletted(true), _autoStartSound(true) { _videoBuffer [0] = 0; _videoBuffer [1] = 0; @@ -2014,8 +2040,6 @@ bool VMDDecoder::readFiles() { } void VMDDecoder::close() { - reset(); - CoktelDecoder::close(); delete _stream; @@ -2095,7 +2119,6 @@ void VMDDecoder::processFrame() { _dirtyRects.clear(); - _paletteDirty = false; _subtitle = -1; bool startSound = false; @@ -2215,8 +2238,9 @@ void VMDDecoder::processFrame() { if (startSound && _soundEnabled) { if (_hasSound && _audioStream) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream, - -1, getVolume(), getBalance(), DisposeAfterUse::NO); + if (_autoStartSound) + _mixer->playStream(_soundType, &_audioHandle, _audioStream, + -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); _soundStage = kSoundPlaying; } else _soundStage = kSoundNone; @@ -2742,14 +2766,92 @@ bool VMDDecoder::isPaletted() const { return _isPaletted; } -void VMDDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); +void VMDDecoder::setAutoStartSound(bool autoStartSound) { + _autoStartSound = autoStartSound; +} + +AdvancedVMDDecoder::AdvancedVMDDecoder(Audio::Mixer::SoundType soundType) { + _decoder = new VMDDecoder(g_system->getMixer(), soundType); + _decoder->setAutoStartSound(false); +} + +AdvancedVMDDecoder::~AdvancedVMDDecoder() { + close(); + delete _decoder; +} + +bool AdvancedVMDDecoder::loadStream(Common::SeekableReadStream *stream) { + close(); + + if (!_decoder->loadStream(stream)) + return false; + + if (_decoder->hasVideo()) { + _videoTrack = new VMDVideoTrack(_decoder); + addTrack(_videoTrack); + } + + if (_decoder->hasSound()) { + _audioTrack = new VMDAudioTrack(_decoder); + addTrack(_audioTrack); + } + + return true; +} + +void AdvancedVMDDecoder::close() { + VideoDecoder::close(); + _decoder->close(); +} + +AdvancedVMDDecoder::VMDVideoTrack::VMDVideoTrack(VMDDecoder *decoder) : _decoder(decoder) { +} + +uint16 AdvancedVMDDecoder::VMDVideoTrack::getWidth() const { + return _decoder->getWidth(); +} + +uint16 AdvancedVMDDecoder::VMDVideoTrack::getHeight() const { + return _decoder->getHeight(); +} + +Graphics::PixelFormat AdvancedVMDDecoder::VMDVideoTrack::getPixelFormat() const { + return _decoder->getPixelFormat(); +} + +int AdvancedVMDDecoder::VMDVideoTrack::getCurFrame() const { + return _decoder->getCurFrame(); +} + +int AdvancedVMDDecoder::VMDVideoTrack::getFrameCount() const { + return _decoder->getFrameCount(); +} + +const Graphics::Surface *AdvancedVMDDecoder::VMDVideoTrack::decodeNextFrame() { + return _decoder->decodeNextFrame(); +} + +const byte *AdvancedVMDDecoder::VMDVideoTrack::getPalette() const { + return _decoder->getPalette(); +} + +bool AdvancedVMDDecoder::VMDVideoTrack::hasDirtyPalette() const { + return _decoder->hasDirtyPalette(); +} + +Common::Rational AdvancedVMDDecoder::VMDVideoTrack::getFrameRate() const { + return _decoder->getFrameRate(); +} + +AdvancedVMDDecoder::VMDAudioTrack::VMDAudioTrack(VMDDecoder *decoder) : _decoder(decoder) { +} + +Audio::Mixer::SoundType AdvancedVMDDecoder::VMDAudioTrack::getSoundType() const { + return _decoder->_soundType; } -void VMDDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); +Audio::AudioStream *AdvancedVMDDecoder::VMDAudioTrack::getAudioStream() const { + return _decoder->_audioStream; } } // End of namespace Video diff --git a/video/coktel_decoder.h b/video/coktel_decoder.h index c88d98219163..2a97eadf0002 100644 --- a/video/coktel_decoder.h +++ b/video/coktel_decoder.h @@ -64,7 +64,7 @@ class Codec; * - gob * - sci */ -class CoktelDecoder : public FixedRateVideoDecoder { +class CoktelDecoder { public: struct State { /** Set accordingly to what was done. */ @@ -77,7 +77,7 @@ class CoktelDecoder : public FixedRateVideoDecoder { CoktelDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - ~CoktelDecoder(); + virtual ~CoktelDecoder(); /** Replace the current video stream with this identical one. */ virtual bool reloadStream(Common::SeekableReadStream *stream) = 0; @@ -138,21 +138,47 @@ class CoktelDecoder : public FixedRateVideoDecoder { /** Is the video paletted or true color? */ virtual bool isPaletted() const; + /** + * Get the current frame + * @see VideoDecoder::getCurFrame() + */ + int getCurFrame() const; - // VideoDecoder interface + /** + * Decode the next frame + * @see VideoDecoder::decodeNextFrame() + */ + virtual const Graphics::Surface *decodeNextFrame() = 0; + /** + * Load a video from a stream + * @see VideoDecoder::loadStream() + */ + virtual bool loadStream(Common::SeekableReadStream *stream) = 0; + + /** Has a video been loaded? */ + virtual bool isVideoLoaded() const = 0; + + /** Has the end of the video been reached? */ + bool endOfVideo() const; + + /** Close the video. */ void close(); uint16 getWidth() const; uint16 getHeight() const; + virtual Graphics::PixelFormat getPixelFormat() const = 0; uint32 getFrameCount() const; const byte *getPalette(); bool hasDirtyPalette() const; + uint32 getTimeToNextFrame() const; uint32 getStaticTimeToNextFrame() const; + void pauseVideo(bool pause); + protected: enum SoundStage { kSoundNone = 0, ///< No sound. @@ -186,8 +212,11 @@ class CoktelDecoder : public FixedRateVideoDecoder { uint32 _features; + int32 _curFrame; uint32 _frameCount; + uint32 _startTime; + byte _palette[768]; bool _paletteDirty; @@ -208,6 +237,8 @@ class CoktelDecoder : public FixedRateVideoDecoder { bool evaluateSeekFrame(int32 &frame, int whence) const; + Common::Rational getFrameRate() const; + // Surface management bool hasSurface(); void createSurface(); @@ -228,10 +259,9 @@ class CoktelDecoder : public FixedRateVideoDecoder { // Sound helper functions inline void unsignedToSigned(byte *buffer, int length); - - // FixedRateVideoDecoder interface - - Common::Rational getFrameRate() const; +private: + uint32 _pauseStartTime; + bool _isPaused; }; class PreIMDDecoder : public CoktelDecoder { @@ -244,9 +274,6 @@ class PreIMDDecoder : public CoktelDecoder { bool seek(int32 frame, int whence = SEEK_SET, bool restart = false); - - // VideoDecoder interface - bool loadStream(Common::SeekableReadStream *stream); void close(); @@ -279,9 +306,6 @@ class IMDDecoder : public CoktelDecoder { void setXY(uint16 x, uint16 y); - - // VideoDecoder interface - bool loadStream(Common::SeekableReadStream *stream); void close(); @@ -291,11 +315,6 @@ class IMDDecoder : public CoktelDecoder { Graphics::PixelFormat getPixelFormat() const; -protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); - private: enum Command { kCommandNextSound = 0xFF00, @@ -367,6 +386,8 @@ class IMDDecoder : public CoktelDecoder { }; class VMDDecoder : public CoktelDecoder { +friend class AdvancedVMDDecoder; + public: VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); ~VMDDecoder(); @@ -390,9 +411,6 @@ class VMDDecoder : public CoktelDecoder { bool hasVideo() const; bool isPaletted() const; - - // VideoDecoder interface - bool loadStream(Common::SeekableReadStream *stream); void close(); @@ -403,9 +421,7 @@ class VMDDecoder : public CoktelDecoder { Graphics::PixelFormat getPixelFormat() const; protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); + void setAutoStartSound(bool autoStartSound); private: enum PartType { @@ -478,6 +494,7 @@ class VMDDecoder : public CoktelDecoder { uint32 _soundDataSize; uint32 _soundLastFilledFrame; AudioFormat _audioFormat; + bool _autoStartSound; // Video properties bool _hasVideo; @@ -532,6 +549,57 @@ class VMDDecoder : public CoktelDecoder { bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height); }; +/** + * A wrapper around the VMD code that implements the VideoDecoder + * API. + */ +class AdvancedVMDDecoder : public VideoDecoder { +public: + AdvancedVMDDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + ~AdvancedVMDDecoder(); + + bool loadStream(Common::SeekableReadStream *stream); + void close(); + +private: + class VMDVideoTrack : public FixedRateVideoTrack { + public: + VMDVideoTrack(VMDDecoder *decoder); + + uint16 getWidth() const; + uint16 getHeight() const; + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const; + int getFrameCount() const; + const Graphics::Surface *decodeNextFrame(); + const byte *getPalette() const; + bool hasDirtyPalette() const; + + protected: + Common::Rational getFrameRate() const; + + private: + VMDDecoder *_decoder; + }; + + class VMDAudioTrack : public AudioTrack { + public: + VMDAudioTrack(VMDDecoder *decoder); + + Audio::Mixer::SoundType getSoundType() const; + + protected: + virtual Audio::AudioStream *getAudioStream() const; + + private: + VMDDecoder *_decoder; + }; + + VMDDecoder *_decoder; + VMDVideoTrack *_videoTrack; + VMDAudioTrack *_audioTrack; +}; + } // End of namespace Video #endif // VIDEO_COKTELDECODER_H diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp index 7d1112a59cd4..5ac9bd20882f 100644 --- a/video/dxa_decoder.cpp +++ b/video/dxa_decoder.cpp @@ -37,41 +37,43 @@ namespace Video { DXADecoder::DXADecoder() { - _fileStream = 0; - _surface = 0; - _dirtyPalette = false; +} - _frameBuffer1 = 0; - _frameBuffer2 = 0; - _scaledBuffer = 0; +DXADecoder::~DXADecoder() { + close(); +} - _inBuffer = 0; - _inBufferSize = 0; +bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { + close(); - _decompBuffer = 0; - _decompBufferSize = 0; + uint32 tag = stream->readUint32BE(); - _width = 0; - _height = 0; + if (tag != MKTAG('D','E','X','A')) { + close(); + return false; + } - _frameSize = 0; - _frameCount = 0; - _frameRate = 0; + DXAVideoTrack *track = new DXAVideoTrack(stream); + addTrack(track); - _scaleMode = S_NONE; -} + readSoundData(stream); -DXADecoder::~DXADecoder() { - close(); + track->setFrameStartPos(); + return true; } -bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { - close(); +void DXADecoder::readSoundData(Common::SeekableReadStream *stream) { + // Skip over the tag by default + stream->readUint32BE(); +} +DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) { _fileStream = stream; - - uint32 tag = _fileStream->readUint32BE(); - assert(tag == MKTAG('D','E','X','A')); + _curFrame = -1; + _frameStartOffset = 0; + _decompBuffer = 0; + _inBuffer = 0; + memset(_palette, 0, 256 * 3); uint8 flags = _fileStream->readByte(); _frameCount = _fileStream->readUint16BE(); @@ -105,18 +107,14 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { _frameSize = _width * _height; _decompBufferSize = _frameSize; - _frameBuffer1 = (uint8 *)malloc(_frameSize); + _frameBuffer1 = new byte[_frameSize]; memset(_frameBuffer1, 0, _frameSize); - _frameBuffer2 = (uint8 *)malloc(_frameSize); + _frameBuffer2 = new byte[_frameSize]; memset(_frameBuffer2, 0, _frameSize); - if (!_frameBuffer1 || !_frameBuffer2) - error("DXADecoder: Error allocating frame buffers (size %u)", _frameSize); _scaledBuffer = 0; if (_scaleMode != S_NONE) { - _scaledBuffer = (uint8 *)malloc(_frameSize); - if (!_scaledBuffer) - error("Error allocating scale buffer (size %u)", _frameSize); + _scaledBuffer = new byte[_frameSize]; memset(_scaledBuffer, 0, _frameSize); } @@ -148,36 +146,33 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { } while (tag != 0); } #endif - - // Read the sound header - _soundTag = _fileStream->readUint32BE(); - - return true; } -void DXADecoder::close() { - if (!_fileStream) - return; - +DXADecoder::DXAVideoTrack::~DXAVideoTrack() { delete _fileStream; - _fileStream = 0; - delete _surface; - _surface = 0; + delete[] _frameBuffer1; + delete[] _frameBuffer2; + delete[] _scaledBuffer; + delete[] _inBuffer; + delete[] _decompBuffer; +} - free(_frameBuffer1); - free(_frameBuffer2); - free(_scaledBuffer); - free(_inBuffer); - free(_decompBuffer); +bool DXADecoder::DXAVideoTrack::rewind() { + _curFrame = -1; + _fileStream->seek(_frameStartOffset); + return true; +} - _inBuffer = 0; - _decompBuffer = 0; +Graphics::PixelFormat DXADecoder::DXAVideoTrack::getPixelFormat() const { + return _surface->format; +} - reset(); +void DXADecoder::DXAVideoTrack::setFrameStartPos() { + _frameStartOffset = _fileStream->pos(); } -void DXADecoder::decodeZlib(byte *data, int size, int totalSize) { +void DXADecoder::DXAVideoTrack::decodeZlib(byte *data, int size, int totalSize) { #ifdef USE_ZLIB unsigned long dstLen = totalSize; Common::uncompress(data, &dstLen, _inBuffer, size); @@ -187,14 +182,13 @@ void DXADecoder::decodeZlib(byte *data, int size, int totalSize) { #define BLOCKW 4 #define BLOCKH 4 -void DXADecoder::decode12(int size) { +void DXADecoder::DXAVideoTrack::decode12(int size) { #ifdef USE_ZLIB - if (_decompBuffer == NULL) { - _decompBuffer = (byte *)malloc(_decompBufferSize); + if (!_decompBuffer) { + _decompBuffer = new byte[_decompBufferSize]; memset(_decompBuffer, 0, _decompBufferSize); - if (_decompBuffer == NULL) - error("Error allocating decomp buffer (size %u)", _decompBufferSize); } + /* decompress the input data */ decodeZlib(_decompBuffer, size, _decompBufferSize); @@ -287,15 +281,13 @@ void DXADecoder::decode12(int size) { #endif } -void DXADecoder::decode13(int size) { +void DXADecoder::DXAVideoTrack::decode13(int size) { #ifdef USE_ZLIB uint8 *codeBuf, *dataBuf, *motBuf, *maskBuf; - if (_decompBuffer == NULL) { - _decompBuffer = (byte *)malloc(_decompBufferSize); + if (!_decompBuffer) { + _decompBuffer = new byte[_decompBufferSize]; memset(_decompBuffer, 0, _decompBufferSize); - if (_decompBuffer == NULL) - error("Error allocating decomp buffer (size %u)", _decompBufferSize); } /* decompress the input data */ @@ -475,7 +467,7 @@ void DXADecoder::decode13(int size) { #endif } -const Graphics::Surface *DXADecoder::decodeNextFrame() { +const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() { uint32 tag = _fileStream->readUint32BE(); if (tag == MKTAG('C','M','A','P')) { _fileStream->read(_palette, 256 * 3); @@ -486,11 +478,10 @@ const Graphics::Surface *DXADecoder::decodeNextFrame() { if (tag == MKTAG('F','R','A','M')) { byte type = _fileStream->readByte(); uint32 size = _fileStream->readUint32BE(); - if ((_inBuffer == NULL) || (_inBufferSize < size)) { - free(_inBuffer); - _inBuffer = (byte *)malloc(size); - if (_inBuffer == NULL) - error("Error allocating input buffer (size %u)", size); + + if (!_inBuffer || _inBufferSize < size) { + delete[] _inBuffer; + _inBuffer = new byte[size]; memset(_inBuffer, 0, size); _inBufferSize = size; } @@ -551,9 +542,6 @@ const Graphics::Surface *DXADecoder::decodeNextFrame() { _curFrame++; - if (_curFrame == 0) - _startTime = g_system->getMillis(); - return _surface; } diff --git a/video/dxa_decoder.h b/video/dxa_decoder.h index d13cd3076c4b..b3f2eca5e298 100644 --- a/video/dxa_decoder.h +++ b/video/dxa_decoder.h @@ -41,62 +41,74 @@ namespace Video { * - sword1 * - sword2 */ -class DXADecoder : public FixedRateVideoDecoder { +class DXADecoder : public VideoDecoder { public: DXADecoder(); virtual ~DXADecoder(); bool loadStream(Common::SeekableReadStream *stream); - void close(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _width; } - uint16 getHeight() const { return _height; } - uint32 getFrameCount() const { return _frameCount; } - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } +protected: /** - * Get the sound chunk tag of the loaded DXA file + * Read the sound data out of the given DXA stream */ - uint32 getSoundTag() { return _soundTag; } - -protected: - Common::Rational getFrameRate() const { return _frameRate; } - - Common::SeekableReadStream *_fileStream; + virtual void readSoundData(Common::SeekableReadStream *stream); private: - void decodeZlib(byte *data, int size, int totalSize); - void decode12(int size); - void decode13(int size); - - enum ScaleMode { - S_NONE, - S_INTERLACED, - S_DOUBLE + class DXAVideoTrack : public FixedRateVideoTrack { + public: + DXAVideoTrack(Common::SeekableReadStream *stream); + ~DXAVideoTrack(); + + bool isRewindable() const { return true; } + bool rewind(); + + uint16 getWidth() const { return _width; } + uint16 getHeight() const { return _height; } + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame(); + const byte *getPalette() const { _dirtyPalette = false; return _palette; } + bool hasDirtyPalette() const { return _dirtyPalette; } + + void setFrameStartPos(); + + protected: + Common::Rational getFrameRate() const { return _frameRate; } + + private: + void decodeZlib(byte *data, int size, int totalSize); + void decode12(int size); + void decode13(int size); + + enum ScaleMode { + S_NONE, + S_INTERLACED, + S_DOUBLE + }; + + Common::SeekableReadStream *_fileStream; + Graphics::Surface *_surface; + + byte *_frameBuffer1; + byte *_frameBuffer2; + byte *_scaledBuffer; + byte *_inBuffer; + uint32 _inBufferSize; + byte *_decompBuffer; + uint32 _decompBufferSize; + uint16 _curHeight; + uint32 _frameSize; + ScaleMode _scaleMode; + uint16 _width, _height; + uint32 _frameRate; + uint32 _frameCount; + byte _palette[256 * 3]; + mutable bool _dirtyPalette; + int _curFrame; + uint32 _frameStartOffset; }; - - Graphics::Surface *_surface; - byte _palette[256 * 3]; - bool _dirtyPalette; - - byte *_frameBuffer1; - byte *_frameBuffer2; - byte *_scaledBuffer; - byte *_inBuffer; - uint32 _inBufferSize; - byte *_decompBuffer; - uint32 _decompBufferSize; - uint16 _curHeight; - uint32 _frameSize; - ScaleMode _scaleMode; - uint32 _soundTag; - uint16 _width, _height; - uint32 _frameRate; - uint32 _frameCount; }; } // End of namespace Video diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp index bdcdedc14207..1a0627615b4f 100644 --- a/video/flic_decoder.cpp +++ b/video/flic_decoder.cpp @@ -26,13 +26,11 @@ #include "common/stream.h" #include "common/system.h" #include "common/textconsole.h" +#include "graphics/surface.h" namespace Video { FlicDecoder::FlicDecoder() { - _paletteChanged = false; - _fileStream = 0; - _surface = 0; } FlicDecoder::~FlicDecoder() { @@ -42,35 +40,59 @@ FlicDecoder::~FlicDecoder() { bool FlicDecoder::loadStream(Common::SeekableReadStream *stream) { close(); - _fileStream = stream; - - /* uint32 frameSize = */ _fileStream->readUint32LE(); - uint16 frameType = _fileStream->readUint16LE(); + /* uint32 frameSize = */ stream->readUint32LE(); + uint16 frameType = stream->readUint16LE(); // Check FLC magic number if (frameType != 0xAF12) { - warning("FlicDecoder::FlicDecoder(): attempted to load non-FLC data (type = 0x%04X)", frameType); - delete _fileStream; - _fileStream = 0; + warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType); return false; } - - _frameCount = _fileStream->readUint16LE(); - uint16 width = _fileStream->readUint16LE(); - uint16 height = _fileStream->readUint16LE(); - uint16 colorDepth = _fileStream->readUint16LE(); + uint16 frameCount = stream->readUint16LE(); + uint16 width = stream->readUint16LE(); + uint16 height = stream->readUint16LE(); + uint16 colorDepth = stream->readUint16LE(); if (colorDepth != 8) { - warning("FlicDecoder::FlicDecoder(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", frameType); - delete _fileStream; - _fileStream = 0; + warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth); return false; } + addTrack(new FlicVideoTrack(stream, frameCount, width, height)); + return true; +} + +const Common::List *FlicDecoder::getDirtyRects() const { + const Track *track = getTrack(0); + + if (track) + return ((const FlicVideoTrack *)track)->getDirtyRects(); + + return 0; +} + +void FlicDecoder::clearDirtyRects() { + Track *track = getTrack(0); + + if (track) + ((FlicVideoTrack *)track)->clearDirtyRects(); +} + +void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) { + Track *track = getTrack(0); + + if (track) + ((FlicVideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch); +} + +FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height) { + _fileStream = stream; + _frameCount = frameCount; + _fileStream->readUint16LE(); // flags // Note: The normal delay is a 32-bit integer (dword), whereas the overridden delay is a 16-bit integer (word) // the frame delay is the FLIC "speed", in milliseconds. - _frameRate = Common::Rational(1000, _fileStream->readUint32LE()); + _frameDelay = _startFrameDelay = _fileStream->readUint32LE(); _fileStream->seek(80); _offsetFrame1 = _fileStream->readUint32LE(); @@ -78,112 +100,53 @@ bool FlicDecoder::loadStream(Common::SeekableReadStream *stream) { _surface = new Graphics::Surface(); _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - _palette = (byte *)malloc(3 * 256); + _palette = new byte[3 * 256]; memset(_palette, 0, 3 * 256); - _paletteChanged = false; + _dirtyPalette = false; + + _curFrame = -1; + _nextFrameStartTime = 0; + _atRingFrame = false; // Seek to the first frame _fileStream->seek(_offsetFrame1); - return true; } -void FlicDecoder::close() { - if (!_fileStream) - return; - +FlicDecoder::FlicVideoTrack::~FlicVideoTrack() { delete _fileStream; - _fileStream = 0; + delete[] _palette; _surface->free(); delete _surface; - _surface = 0; - - free(_palette); - _dirtyRects.clear(); - - reset(); } -void FlicDecoder::decodeByteRun(uint8 *data) { - byte *ptr = (byte *)_surface->pixels; - while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) { - int chunks = *data++; - while (chunks--) { - int count = (int8)*data++; - if (count > 0) { - memset(ptr, *data++, count); - } else { - count = -count; - memcpy(ptr, data, count); - data += count; - } - ptr += count; - } - } - - // Redraw - _dirtyRects.clear(); - _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight())); +bool FlicDecoder::FlicVideoTrack::endOfTrack() const { + return getCurFrame() >= getFrameCount() - 1; } -#define OP_PACKETCOUNT 0 -#define OP_UNDEFINED 1 -#define OP_LASTPIXEL 2 -#define OP_LINESKIPCOUNT 3 - -void FlicDecoder::decodeDeltaFLC(uint8 *data) { - uint16 linesInChunk = READ_LE_UINT16(data); data += 2; - uint16 currentLine = 0; - uint16 packetCount = 0; - - while (linesInChunk--) { - uint16 opcode; +bool FlicDecoder::FlicVideoTrack::rewind() { + _curFrame = -1; + _nextFrameStartTime = 0; - // First process all the opcodes. - do { - opcode = READ_LE_UINT16(data); data += 2; + if (endOfTrack() && _fileStream->pos() < _fileStream->size()) + _atRingFrame = true; + else + _fileStream->seek(_offsetFrame1); - switch ((opcode >> 14) & 3) { - case OP_PACKETCOUNT: - packetCount = opcode; - break; - case OP_UNDEFINED: - break; - case OP_LASTPIXEL: - *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF); - _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1)); - break; - case OP_LINESKIPCOUNT: - currentLine += -(int16)opcode; - break; - } - } while (((opcode >> 14) & 3) != OP_PACKETCOUNT); + _frameDelay = _startFrameDelay; + return true; +} - uint16 column = 0; +uint16 FlicDecoder::FlicVideoTrack::getWidth() const { + return _surface->w; +} - // Now interpret the RLE data - while (packetCount--) { - column += *data++; - int rleCount = (int8)*data++; - if (rleCount > 0) { - memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2); - data += rleCount * 2; - _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); - } else if (rleCount < 0) { - rleCount = -rleCount; - uint16 dataWord = READ_UINT16(data); data += 2; - for (int i = 0; i < rleCount; ++i) { - WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord); - } - _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); - } else { // End of cutscene ? - return; - } - column += rleCount * 2; - } +uint16 FlicDecoder::FlicVideoTrack::getHeight() const { + return _surface->h; +} - currentLine++; - } +Graphics::PixelFormat FlicDecoder::FlicVideoTrack::getPixelFormat() const { + return _surface->format; } #define FLI_SETPAL 4 @@ -192,7 +155,7 @@ void FlicDecoder::decodeDeltaFLC(uint8 *data) { #define PSTAMP 18 #define FRAME_TYPE 0xF1FA -const Graphics::Surface *FlicDecoder::decodeNextFrame() { +const Graphics::Surface *FlicDecoder::FlicVideoTrack::decodeNextFrame() { // Read chunk uint32 frameSize = _fileStream->readUint32LE(); uint16 frameType = _fileStream->readUint16LE(); @@ -201,15 +164,12 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() { switch (frameType) { case FRAME_TYPE: { - // FIXME: FLIC should be switched over to a variable frame rate VideoDecoder to handle - // this properly. - chunkCount = _fileStream->readUint16LE(); // Note: The overridden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword) // the frame delay is the FLIC "speed", in milliseconds. uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds if (newFrameDelay > 0) - _frameRate = Common::Rational(1000, newFrameDelay); + _frameDelay = newFrameDelay; _fileStream->readUint16LE(); // reserved, always 0 uint16 newWidth = _fileStream->readUint16LE(); @@ -240,10 +200,11 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() { frameType = _fileStream->readUint16LE(); uint8 *data = new uint8[frameSize - 6]; _fileStream->read(data, frameSize - 6); + switch (frameType) { case FLI_SETPAL: unpackPalette(data); - _paletteChanged = true; + _dirtyPalette = true; break; case FLI_SS2: decodeDeltaFLC(data); @@ -264,26 +225,111 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() { } _curFrame++; + _nextFrameStartTime += _frameDelay; - // If we just processed the ring frame, set the next frame - if (_curFrame == (int32)_frameCount) { - _curFrame = 0; + if (_atRingFrame) { + // If we decoded the ring frame, seek to the second frame + _atRingFrame = false; _fileStream->seek(_offsetFrame2); } - if (_curFrame == 0) - _startTime = g_system->getMillis(); - return _surface; } -void FlicDecoder::reset() { - FixedRateVideoDecoder::reset(); - if (_fileStream) - _fileStream->seek(_offsetFrame1); +void FlicDecoder::FlicVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) { + for (Common::List::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { + for (int y = (*it).top; y < (*it).bottom; ++y) { + const int x = (*it).left; + memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x); + } + } + + clearDirtyRects(); } -void FlicDecoder::unpackPalette(uint8 *data) { +void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) { + byte *ptr = (byte *)_surface->pixels; + while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) { + int chunks = *data++; + while (chunks--) { + int count = (int8)*data++; + if (count > 0) { + memset(ptr, *data++, count); + } else { + count = -count; + memcpy(ptr, data, count); + data += count; + } + ptr += count; + } + } + + // Redraw + _dirtyRects.clear(); + _dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight())); +} + +#define OP_PACKETCOUNT 0 +#define OP_UNDEFINED 1 +#define OP_LASTPIXEL 2 +#define OP_LINESKIPCOUNT 3 + +void FlicDecoder::FlicVideoTrack::decodeDeltaFLC(uint8 *data) { + uint16 linesInChunk = READ_LE_UINT16(data); data += 2; + uint16 currentLine = 0; + uint16 packetCount = 0; + + while (linesInChunk--) { + uint16 opcode; + + // First process all the opcodes. + do { + opcode = READ_LE_UINT16(data); data += 2; + + switch ((opcode >> 14) & 3) { + case OP_PACKETCOUNT: + packetCount = opcode; + break; + case OP_UNDEFINED: + break; + case OP_LASTPIXEL: + *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF); + _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1)); + break; + case OP_LINESKIPCOUNT: + currentLine += -(int16)opcode; + break; + } + } while (((opcode >> 14) & 3) != OP_PACKETCOUNT); + + uint16 column = 0; + + // Now interpret the RLE data + while (packetCount--) { + column += *data++; + int rleCount = (int8)*data++; + if (rleCount > 0) { + memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2); + data += rleCount * 2; + _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); + } else if (rleCount < 0) { + rleCount = -rleCount; + uint16 dataWord = READ_UINT16(data); data += 2; + for (int i = 0; i < rleCount; ++i) { + WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord); + } + _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); + } else { // End of cutscene ? + return; + } + column += rleCount * 2; + } + + currentLine++; + } +} + +void FlicDecoder::FlicVideoTrack::unpackPalette(uint8 *data) { uint16 numPackets = READ_LE_UINT16(data); data += 2; if (0 == READ_LE_UINT16(data)) { //special case @@ -308,14 +354,4 @@ void FlicDecoder::unpackPalette(uint8 *data) { } } -void FlicDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) { - for (Common::List::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { - for (int y = (*it).top; y < (*it).bottom; ++y) { - const int x = (*it).left; - memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x); - } - } - _dirtyRects.clear(); -} - } // End of namespace Video diff --git a/video/flic_decoder.h b/video/flic_decoder.h index 9badc3da2e25..9037af05d6b9 100644 --- a/video/flic_decoder.h +++ b/video/flic_decoder.h @@ -25,15 +25,17 @@ #include "video/video_decoder.h" #include "common/list.h" -#include "common/rational.h" #include "common/rect.h" -#include "graphics/pixelformat.h" -#include "graphics/surface.h" namespace Common { class SeekableReadStream; } +namespace Graphics { +struct PixelFormat; +struct Surface; +} + namespace Video { /** @@ -42,58 +44,63 @@ namespace Video { * Video decoder used in engines: * - tucker */ -class FlicDecoder : public FixedRateVideoDecoder { +class FlicDecoder : public VideoDecoder { public: FlicDecoder(); virtual ~FlicDecoder(); - /** - * Load a video file - * @param stream the stream to load - */ bool loadStream(Common::SeekableReadStream *stream); - void close(); - - /** - * Decode the next frame and return the frame's surface - * @note the return surface should *not* be freed - * @note this may return 0, in which case the last frame should be kept on screen - */ - const Graphics::Surface *decodeNextFrame(); - - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _surface->w; } - uint16 getHeight() const { return _surface->h; } - uint32 getFrameCount() const { return _frameCount; } - Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } - - const Common::List *getDirtyRects() const { return &_dirtyRects; } - void clearDirtyRects() { _dirtyRects.clear(); } - void copyDirtyRectsToBuffer(uint8 *dst, uint pitch); - - const byte *getPalette() { _paletteChanged = false; return _palette; } - bool hasDirtyPalette() const { return _paletteChanged; } - void reset(); -protected: - Common::Rational getFrameRate() const { return _frameRate; } + const Common::List *getDirtyRects() const; + void clearDirtyRects(); + void copyDirtyRectsToBuffer(uint8 *dst, uint pitch); private: - uint16 _offsetFrame1; - uint16 _offsetFrame2; - byte *_palette; - bool _paletteChanged; - - void decodeByteRun(uint8 *data); - void decodeDeltaFLC(uint8 *data); - void unpackPalette(uint8 *mem); - - Common::SeekableReadStream *_fileStream; - Graphics::Surface *_surface; - uint32 _frameCount; - Common::Rational _frameRate; - - Common::List _dirtyRects; + class FlicVideoTrack : public VideoTrack { + public: + FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height); + ~FlicVideoTrack(); + + bool endOfTrack() const; + bool isRewindable() const { return true; } + bool rewind(); + + uint16 getWidth() const; + uint16 getHeight() const; + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + uint32 getNextFrameStartTime() const { return _nextFrameStartTime; } + const Graphics::Surface *decodeNextFrame(); + const byte *getPalette() const { _dirtyPalette = false; return _palette; } + bool hasDirtyPalette() const { return _dirtyPalette; } + + const Common::List *getDirtyRects() const { return &_dirtyRects; } + void clearDirtyRects() { _dirtyRects.clear(); } + void copyDirtyRectsToBuffer(uint8 *dst, uint pitch); + + private: + Common::SeekableReadStream *_fileStream; + Graphics::Surface *_surface; + + int _curFrame; + bool _atRingFrame; + + uint16 _offsetFrame1; + uint16 _offsetFrame2; + byte *_palette; + mutable bool _dirtyPalette; + + uint32 _frameCount; + uint32 _frameDelay, _startFrameDelay; + uint32 _nextFrameStartTime; + + Common::List _dirtyRects; + + void decodeByteRun(uint8 *data); + void decodeDeltaFLC(uint8 *data); + void unpackPalette(uint8 *mem); + }; }; } // End of namespace Video diff --git a/video/module.mk b/video/module.mk index cebd403ca268..287e14ce1859 100644 --- a/video/module.mk +++ b/video/module.mk @@ -26,5 +26,10 @@ MODULE_OBJS += \ bink_decoder.o endif +ifdef USE_THEORADEC +MODULE_OBJS += \ + theora_decoder.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/video/psx_decoder.cpp b/video/psx_decoder.cpp index df91a2baddf8..fa7f1e8cfe87 100644 --- a/video/psx_decoder.cpp +++ b/video/psx_decoder.cpp @@ -149,22 +149,12 @@ static const uint32 s_huffmanACSymbols[AC_CODE_COUNT] = { END_OF_BLOCK }; -PSXStreamDecoder::PSXStreamDecoder(CDSpeed speed, uint32 frameCount) : _nextFrameStartTime(0, speed), _frameCount(frameCount) { +PSXStreamDecoder::PSXStreamDecoder(CDSpeed speed, uint32 frameCount) : _speed(speed), _frameCount(frameCount) { _stream = 0; - _audStream = 0; - _surface = new Graphics::Surface(); - _yBuffer = _cbBuffer = _crBuffer = 0; - _acHuffman = new Common::Huffman(0, AC_CODE_COUNT, s_huffmanACCodes, s_huffmanACLengths, s_huffmanACSymbols); - _dcHuffmanChroma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCChromaCodes, s_huffmanDCChromaLengths, s_huffmanDCSymbols); - _dcHuffmanLuma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCLumaCodes, s_huffmanDCLumaLengths, s_huffmanDCSymbols); } PSXStreamDecoder::~PSXStreamDecoder() { close(); - delete _surface; - delete _acHuffman; - delete _dcHuffmanLuma; - delete _dcHuffmanChroma; } #define RAW_CD_SECTOR_SIZE 2352 @@ -178,95 +168,30 @@ bool PSXStreamDecoder::loadStream(Common::SeekableReadStream *stream) { close(); _stream = stream; - - Common::SeekableReadStream *sector = readSector(); - - if (!sector) { - close(); - return false; - } - - // Rip out video info from the first frame - sector->seek(18); - byte sectorType = sector->readByte() & CDXA_TYPE_MASK; - - if (sectorType != CDXA_TYPE_VIDEO && sectorType != CDXA_TYPE_DATA) { - close(); - return false; - } - - sector->seek(40); - - uint16 width = sector->readUint16LE(); - uint16 height = sector->readUint16LE(); - _surface->create(width, height, g_system->getScreenFormat()); - - _macroBlocksW = (width + 15) / 16; - _macroBlocksH = (height + 15) / 16; - _yBuffer = new byte[_macroBlocksW * _macroBlocksH * 16 * 16]; - _cbBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8]; - _crBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8]; - - delete sector; - _stream->seek(0); + readNextPacket(); return true; } void PSXStreamDecoder::close() { - if (!_stream) - return; + VideoDecoder::close(); + _audioTrack = 0; + _videoTrack = 0; + _frameCount = 0; delete _stream; _stream = 0; - - // Deinitialize sound - g_system->getMixer()->stopHandle(_audHandle); - _audStream = 0; - - _surface->free(); - - memset(&_adpcmStatus, 0, sizeof(_adpcmStatus)); - - _macroBlocksW = _macroBlocksH = 0; - delete[] _yBuffer; _yBuffer = 0; - delete[] _cbBuffer; _cbBuffer = 0; - delete[] _crBuffer; _crBuffer = 0; - - reset(); -} - -uint32 PSXStreamDecoder::getTime() const { - // TODO: Currently, the audio is always after the video so using this - // can often lead to gaps in the audio... - //if (_audStream) - // return _mixer->getSoundElapsedTime(_audHandle); - - return VideoDecoder::getTime(); -} - -uint32 PSXStreamDecoder::getTimeToNextFrame() const { - if (!isVideoLoaded() || endOfVideo()) - return 0; - - uint32 nextTimeMillis = _nextFrameStartTime.msecs(); - uint32 elapsedTime = getTime(); - - if (elapsedTime > nextTimeMillis) - return 0; - - return nextTimeMillis - elapsedTime; } #define VIDEO_DATA_CHUNK_SIZE 2016 #define VIDEO_DATA_HEADER_SIZE 56 -const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() { +void PSXStreamDecoder::readNextPacket() { Common::SeekableReadStream *sector = 0; byte *partialFrame = 0; int sectorsRead = 0; - while (!endOfVideo()) { + while (_stream->pos() < _stream->size()) { sector = readSector(); sectorsRead++; @@ -284,6 +209,11 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() { case CDXA_TYPE_DATA: case CDXA_TYPE_VIDEO: if (track == 1) { + if (!_videoTrack) { + _videoTrack = new PSXVideoTrack(sector, _speed, _frameCount); + addTrack(_videoTrack); + } + sector->seek(28); uint16 curSector = sector->readUint16LE(); uint16 sectorCount = sector->readUint16LE(); @@ -303,35 +233,27 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() { // Done assembling the frame Common::SeekableReadStream *frame = new Common::MemoryReadStream(partialFrame, frameSize, DisposeAfterUse::YES); - decodeFrame(frame); + _videoTrack->decodeFrame(frame, sectorsRead); delete frame; delete sector; - - _curFrame++; - if (_curFrame == 0) - _startTime = g_system->getMillis(); - - // Increase the time by the amount of sectors we read - // One may notice that this is still not the most precise - // method since a frame takes up the time its sectors took - // up instead of the amount of time it takes the next frame - // to be read from the sectors. The actual frame rate should - // be constant instead of variable, so the slight difference - // in a frame's showing time is negligible (1/150 of a second). - _nextFrameStartTime = _nextFrameStartTime.addFrames(sectorsRead); - - return _surface; + return; } } else error("Unhandled multi-track video"); break; case CDXA_TYPE_AUDIO: // We only handle one audio channel so far - if (track == 1) - queueAudioFromSector(sector); - else + if (track == 1) { + if (!_audioTrack) { + _audioTrack = new PSXAudioTrack(sector); + addTrack(_audioTrack); + } + + _audioTrack->queueAudioFromSector(sector); + } else { warning("Unhandled multi-track audio"); + } break; default: // This shows up way too often, but the other sectors @@ -343,7 +265,19 @@ const Graphics::Surface *PSXStreamDecoder::decodeNextFrame() { delete sector; } - return 0; + if (_stream->pos() >= _stream->size()) { + if (_videoTrack) + _videoTrack->setEndOfTrack(); + + if (_audioTrack) + _audioTrack->setEndOfTrack(); + } +} + +bool PSXStreamDecoder::useAudioSync() const { + // Audio sync is disabled since most audio data comes after video + // data. + return false; } static const byte s_syncHeader[12] = { 0x00, 0xff ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; @@ -373,20 +307,29 @@ static const int s_xaTable[5][2] = { { 122, -60 } }; -void PSXStreamDecoder::queueAudioFromSector(Common::SeekableReadStream *sector) { +PSXStreamDecoder::PSXAudioTrack::PSXAudioTrack(Common::SeekableReadStream *sector) { assert(sector); + _endOfTrack = false; - if (!_audStream) { - // Initialize audio stream - sector->seek(19); - byte format = sector->readByte(); + sector->seek(19); + byte format = sector->readByte(); + bool stereo = (format & (1 << 0)) != 0; + uint rate = (format & (1 << 2)) ? 18900 : 37800; + _audStream = Audio::makeQueuingAudioStream(rate, stereo); - bool stereo = (format & (1 << 0)) != 0; - uint rate = (format & (1 << 2)) ? 18900 : 37800; + memset(&_adpcmStatus, 0, sizeof(_adpcmStatus)); +} - _audStream = Audio::makeQueuingAudioStream(rate, stereo); - g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream, -1, getVolume(), getBalance()); - } +PSXStreamDecoder::PSXAudioTrack::~PSXAudioTrack() { + delete _audStream; +} + +bool PSXStreamDecoder::PSXAudioTrack::endOfTrack() const { + return AudioTrack::endOfTrack() && _endOfTrack; +} + +void PSXStreamDecoder::PSXAudioTrack::queueAudioFromSector(Common::SeekableReadStream *sector) { + assert(sector); sector->seek(24); @@ -472,7 +415,54 @@ void PSXStreamDecoder::queueAudioFromSector(Common::SeekableReadStream *sector) delete[] buf; } -void PSXStreamDecoder::decodeFrame(Common::SeekableReadStream *frame) { +Audio::AudioStream *PSXStreamDecoder::PSXAudioTrack::getAudioStream() const { + return _audStream; +} + + +PSXStreamDecoder::PSXVideoTrack::PSXVideoTrack(Common::SeekableReadStream *firstSector, CDSpeed speed, int frameCount) : _nextFrameStartTime(0, speed), _frameCount(frameCount) { + assert(firstSector); + + firstSector->seek(40); + uint16 width = firstSector->readUint16LE(); + uint16 height = firstSector->readUint16LE(); + _surface = new Graphics::Surface(); + _surface->create(width, height, g_system->getScreenFormat()); + + _macroBlocksW = (width + 15) / 16; + _macroBlocksH = (height + 15) / 16; + _yBuffer = new byte[_macroBlocksW * _macroBlocksH * 16 * 16]; + _cbBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8]; + _crBuffer = new byte[_macroBlocksW * _macroBlocksH * 8 * 8]; + + _endOfTrack = false; + _curFrame = -1; + _acHuffman = new Common::Huffman(0, AC_CODE_COUNT, s_huffmanACCodes, s_huffmanACLengths, s_huffmanACSymbols); + _dcHuffmanChroma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCChromaCodes, s_huffmanDCChromaLengths, s_huffmanDCSymbols); + _dcHuffmanLuma = new Common::Huffman(0, DC_CODE_COUNT, s_huffmanDCLumaCodes, s_huffmanDCLumaLengths, s_huffmanDCSymbols); +} + +PSXStreamDecoder::PSXVideoTrack::~PSXVideoTrack() { + _surface->free(); + delete _surface; + + delete[] _yBuffer; + delete[] _cbBuffer; + delete[] _crBuffer; + delete _acHuffman; + delete _dcHuffmanChroma; + delete _dcHuffmanLuma; +} + +uint32 PSXStreamDecoder::PSXVideoTrack::getNextFrameStartTime() const { + return _nextFrameStartTime.msecs(); +} + +const Graphics::Surface *PSXStreamDecoder::PSXVideoTrack::decodeNextFrame() { + return _surface; +} + +void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::SeekableReadStream *frame, uint sectorCount) { // A frame is essentially an MPEG-1 intra frame Common::BitStream16LEMSB bits(frame); @@ -494,9 +484,20 @@ void PSXStreamDecoder::decodeFrame(Common::SeekableReadStream *frame) { // Output data onto the frame Graphics::convertYUV420ToRGB(_surface, _yBuffer, _cbBuffer, _crBuffer, _surface->w, _surface->h, _macroBlocksW * 16, _macroBlocksW * 8); + + _curFrame++; + + // Increase the time by the amount of sectors we read + // One may notice that this is still not the most precise + // method since a frame takes up the time its sectors took + // up instead of the amount of time it takes the next frame + // to be read from the sectors. The actual frame rate should + // be constant instead of variable, so the slight difference + // in a frame's showing time is negligible (1/150 of a second). + _nextFrameStartTime = _nextFrameStartTime.addFrames(sectorCount); } -void PSXStreamDecoder::decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version) { +void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version) { int pitchY = _macroBlocksW * 16; int pitchC = _macroBlocksW * 8; @@ -533,7 +534,7 @@ static const byte s_quantizationTable[8 * 8] = { 27, 29, 35, 38, 46, 56, 69, 83 }; -void PSXStreamDecoder::dequantizeBlock(int *coefficients, float *block, uint16 scale) { +void PSXStreamDecoder::PSXVideoTrack::dequantizeBlock(int *coefficients, float *block, uint16 scale) { // Dequantize the data, un-zig-zagging as we go along for (int i = 0; i < 8 * 8; i++) { if (i == 0) // Special case for the DC coefficient @@ -543,7 +544,7 @@ void PSXStreamDecoder::dequantizeBlock(int *coefficients, float *block, uint16 s } } -int PSXStreamDecoder::readDC(Common::BitStream *bits, uint16 version, PlaneType plane) { +int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream *bits, uint16 version, PlaneType plane) { // Version 2 just has its coefficient as 10-bits if (version == 2) return readSignedCoefficient(bits); @@ -573,7 +574,7 @@ int PSXStreamDecoder::readDC(Common::BitStream *bits, uint16 version, PlaneType if (count > 63) \ error("PSXStreamDecoder::readAC(): Too many coefficients") -void PSXStreamDecoder::readAC(Common::BitStream *bits, int *block) { +void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream *bits, int *block) { // Clear the block first for (int i = 0; i < 63; i++) block[i] = 0; @@ -608,7 +609,7 @@ void PSXStreamDecoder::readAC(Common::BitStream *bits, int *block) { } } -int PSXStreamDecoder::readSignedCoefficient(Common::BitStream *bits) { +int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStream *bits) { uint val = bits->getBits(10); // extend the sign @@ -630,7 +631,7 @@ static const double s_idct8x8[8][8] = { { 0.353553390593274, -0.490392640201615, 0.461939766255643, -0.415734806151273, 0.353553390593273, -0.277785116509801, 0.191341716182545, -0.097545161008064 } }; -void PSXStreamDecoder::idct(float *dequantData, float *result) { +void PSXStreamDecoder::PSXVideoTrack::idct(float *dequantData, float *result) { // IDCT code based on JPEG's IDCT code // TODO: Switch to the integer-based one mentioned in the docs // This is by far the costliest operation here @@ -669,7 +670,7 @@ void PSXStreamDecoder::idct(float *dequantData, float *result) { } } -void PSXStreamDecoder::decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) { +void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) { // Version 2 just has signed 10 bits for DC // Version 3 has them huffman coded int coefficients[8 * 8]; @@ -686,22 +687,13 @@ void PSXStreamDecoder::decodeBlock(Common::BitStream *bits, byte *block, int pit // Now output the data for (int y = 0; y < 8; y++) { - byte *start = block + pitch * y; + byte *dst = block + pitch * y; // Convert the result to be in the range [0, 255] for (int x = 0; x < 8; x++) - *start++ = (int)CLIP(idctData[y * 8 + x], -128.0f, 127.0f) + 128; + *dst++ = (int)CLIP(idctData[y * 8 + x], -128.0f, 127.0f) + 128; } } -void PSXStreamDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audHandle)) - g_system->getMixer()->setChannelVolume(_audHandle, getVolume()); -} - -void PSXStreamDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audHandle)) - g_system->getMixer()->setChannelBalance(_audHandle, getBalance()); -} } // End of namespace Video diff --git a/video/psx_decoder.h b/video/psx_decoder.h index 4364ec4bbbf6..11f311594dd6 100644 --- a/video/psx_decoder.h +++ b/video/psx_decoder.h @@ -71,59 +71,85 @@ class PSXStreamDecoder : public VideoDecoder { bool loadStream(Common::SeekableReadStream *stream); void close(); - bool isVideoLoaded() const { return _stream != 0; } - uint16 getWidth() const { return _surface->w; } - uint16 getHeight() const { return _surface->h; } - uint32 getFrameCount() const { return _frameCount; } - uint32 getTime() const; - uint32 getTimeToNextFrame() const; - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const { return _surface->format; } - bool endOfVideo() const { return _stream->pos() >= _stream->size(); } - protected: - // VideoDecoder API - void updateVolume(); - void updateBalance(); + void readNextPacket(); + bool useAudioSync() const; private: - void initCommon(); - Common::SeekableReadStream *_stream; - Graphics::Surface *_surface; + class PSXVideoTrack : public VideoTrack { + public: + PSXVideoTrack(Common::SeekableReadStream *firstSector, CDSpeed speed, int frameCount); + ~PSXVideoTrack(); + + uint16 getWidth() const { return _surface->w; } + uint16 getHeight() const { return _surface->h; } + Graphics::PixelFormat getPixelFormat() const { return _surface->format; } + bool endOfTrack() const { return _endOfTrack; } + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + uint32 getNextFrameStartTime() const; + const Graphics::Surface *decodeNextFrame(); + + void setEndOfTrack() { _endOfTrack = true; } + void decodeFrame(Common::SeekableReadStream *frame, uint sectorCount); + + private: + Graphics::Surface *_surface; + uint32 _frameCount; + Audio::Timestamp _nextFrameStartTime; + bool _endOfTrack; + int _curFrame; + + enum PlaneType { + kPlaneY = 0, + kPlaneU = 1, + kPlaneV = 2 + }; + + uint16 _macroBlocksW, _macroBlocksH; + byte *_yBuffer, *_cbBuffer, *_crBuffer; + void decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version); + void decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane); + + void readAC(Common::BitStream *bits, int *block); + Common::Huffman *_acHuffman; + + int readDC(Common::BitStream *bits, uint16 version, PlaneType plane); + Common::Huffman *_dcHuffmanLuma, *_dcHuffmanChroma; + int _lastDC[3]; + + void dequantizeBlock(int *coefficients, float *block, uint16 scale); + void idct(float *dequantData, float *result); + int readSignedCoefficient(Common::BitStream *bits); + }; - uint32 _frameCount; - Audio::Timestamp _nextFrameStartTime; + class PSXAudioTrack : public AudioTrack { + public: + PSXAudioTrack(Common::SeekableReadStream *sector); + ~PSXAudioTrack(); - Audio::SoundHandle _audHandle; - Audio::QueuingAudioStream *_audStream; - void queueAudioFromSector(Common::SeekableReadStream *sector); + bool endOfTrack() const; - enum PlaneType { - kPlaneY = 0, - kPlaneU = 1, - kPlaneV = 2 - }; + void setEndOfTrack() { _endOfTrack = true; } + void queueAudioFromSector(Common::SeekableReadStream *sector); - uint16 _macroBlocksW, _macroBlocksH; - byte *_yBuffer, *_cbBuffer, *_crBuffer; - void decodeFrame(Common::SeekableReadStream *frame); - void decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version); - void decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane); + private: + Audio::AudioStream *getAudioStream() const; - void readAC(Common::BitStream *bits, int *block); - Common::Huffman *_acHuffman; + Audio::QueuingAudioStream *_audStream; - int readDC(Common::BitStream *bits, uint16 version, PlaneType plane); - Common::Huffman *_dcHuffmanLuma, *_dcHuffmanChroma; - int _lastDC[3]; + struct ADPCMStatus { + int16 sample[2]; + } _adpcmStatus[2]; - void dequantizeBlock(int *coefficients, float *block, uint16 scale); - void idct(float *dequantData, float *result); - int readSignedCoefficient(Common::BitStream *bits); + bool _endOfTrack; + }; - struct ADPCMStatus { - int16 sample[2]; - } _adpcmStatus[2]; + CDSpeed _speed; + uint32 _frameCount; + Common::SeekableReadStream *_stream; + PSXVideoTrack *_videoTrack; + PSXAudioTrack *_audioTrack; Common::SeekableReadStream *readSector(); }; diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp index aba545abc021..87c530dba04f 100644 --- a/video/qt_decoder.cpp +++ b/video/qt_decoder.cpp @@ -33,14 +33,12 @@ #include "audio/audiostream.h" #include "common/debug.h" -#include "common/endian.h" #include "common/memstream.h" #include "common/system.h" #include "common/textconsole.h" #include "common/util.h" // Video codecs -#include "video/codecs/codec.h" #include "video/codecs/cinepak.h" #include "video/codecs/mjpeg.h" #include "video/codecs/qtrle.h" @@ -56,97 +54,43 @@ namespace Video { //////////////////////////////////////////// QuickTimeDecoder::QuickTimeDecoder() { - _setStartTime = false; _scaledSurface = 0; - _dirtyPalette = false; - _palette = 0; _width = _height = 0; - _needUpdate = false; } QuickTimeDecoder::~QuickTimeDecoder() { close(); } -int32 QuickTimeDecoder::getCurFrame() const { - // TODO: This is rather simplistic and doesn't take edits that - // repeat sections of the media into account. Doing that - // over-complicates things and shouldn't be necessary, but - // it would be nice to have in the future. - - int32 frame = -1; - - for (uint32 i = 0; i < _handlers.size(); i++) - if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo) - frame += ((VideoTrackHandler *)_handlers[i])->getCurFrame() + 1; - - return frame; -} - -uint32 QuickTimeDecoder::getFrameCount() const { - uint32 count = 0; - - for (uint32 i = 0; i < _handlers.size(); i++) - if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo) - count += ((VideoTrackHandler *)_handlers[i])->getFrameCount(); - - return count; -} - -void QuickTimeDecoder::startAudio() { - updateAudioBuffer(); - - for (uint32 i = 0; i < _audioTracks.size(); i++) { - g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandles[i], _audioTracks[i], -1, getVolume(), getBalance(), DisposeAfterUse::NO); +bool QuickTimeDecoder::loadFile(const Common::String &filename) { + if (!Common::QuickTimeParser::parseFile(filename)) + return false; - // Pause the audio again if we're still paused - if (isPaused()) - g_system->getMixer()->pauseHandle(_audioHandles[i], true); - } + init(); + return true; } -void QuickTimeDecoder::stopAudio() { - for (uint32 i = 0; i < _audioHandles.size(); i++) - g_system->getMixer()->stopHandle(_audioHandles[i]); -} +bool QuickTimeDecoder::loadStream(Common::SeekableReadStream *stream) { + if (!Common::QuickTimeParser::parseStream(stream)) + return false; -void QuickTimeDecoder::pauseVideoIntern(bool pause) { - for (uint32 i = 0; i < _audioHandles.size(); i++) - g_system->getMixer()->pauseHandle(_audioHandles[i], pause); + init(); + return true; } -QuickTimeDecoder::VideoTrackHandler *QuickTimeDecoder::findNextVideoTrack() const { - VideoTrackHandler *bestTrack = 0; - uint32 bestTime = 0xffffffff; - - for (uint32 i = 0; i < _handlers.size(); i++) { - if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo && !_handlers[i]->endOfTrack()) { - VideoTrackHandler *track = (VideoTrackHandler *)_handlers[i]; - uint32 time = track->getNextFrameStartTime(); +void QuickTimeDecoder::close() { + VideoDecoder::close(); + Common::QuickTimeParser::close(); - if (time < bestTime) { - bestTime = time; - bestTrack = track; - } - } + if (_scaledSurface) { + _scaledSurface->free(); + delete _scaledSurface; + _scaledSurface = 0; } - - return bestTrack; } const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() { - if (!_nextVideoTrack) - return 0; - - const Graphics::Surface *frame = _nextVideoTrack->decodeNextFrame(); - - if (!_setStartTime) { - _startTime = g_system->getMillis(); - _setStartTime = true; - } - - _nextVideoTrack = findNextVideoTrack(); - _needUpdate = false; + const Graphics::Surface *frame = VideoDecoder::decodeNextFrame(); // Update audio buffers too // (needs to be done after we find the next track) @@ -166,138 +110,7 @@ const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() { return frame; } -void QuickTimeDecoder::scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, Common::Rational scaleFactorX, Common::Rational scaleFactorY) { - assert(src && dst); - - for (int32 j = 0; j < dst->h; j++) - for (int32 k = 0; k < dst->w; k++) - memcpy(dst->getBasePtr(k, j), src->getBasePtr((k * scaleFactorX).toInt() , (j * scaleFactorY).toInt()), src->format.bytesPerPixel); -} - -bool QuickTimeDecoder::endOfVideo() const { - if (!isVideoLoaded()) - return true; - - for (uint32 i = 0; i < _handlers.size(); i++) - if (!_handlers[i]->endOfTrack()) - return false; - - return true; -} - -uint32 QuickTimeDecoder::getTime() const { - // Try to base sync off an active audio track - for (uint32 i = 0; i < _audioHandles.size(); i++) { - if (g_system->getMixer()->isSoundHandleActive(_audioHandles[i])) { - uint32 time = g_system->getMixer()->getSoundElapsedTime(_audioHandles[i]) + _audioStartOffset.msecs(); - if (Audio::Timestamp(time, 1000) < _audioTracks[i]->getLength()) - return time; - } - } - - // Just use time elapsed since the beginning - return SeekableVideoDecoder::getTime(); -} - -uint32 QuickTimeDecoder::getTimeToNextFrame() const { - if (_needUpdate) - return 0; - - if (_nextVideoTrack) { - uint32 nextFrameStartTime = _nextVideoTrack->getNextFrameStartTime(); - - if (nextFrameStartTime == 0) - return 0; - - // TODO: Add support for rate modification - - uint32 elapsedTime = getTime(); - - if (elapsedTime < nextFrameStartTime) - return nextFrameStartTime - elapsedTime; - } - - return 0; -} - -bool QuickTimeDecoder::loadFile(const Common::String &filename) { - if (!Common::QuickTimeParser::parseFile(filename)) - return false; - - init(); - return true; -} - -bool QuickTimeDecoder::loadStream(Common::SeekableReadStream *stream) { - if (!Common::QuickTimeParser::parseStream(stream)) - return false; - - init(); - return true; -} - -void QuickTimeDecoder::updateVolume() { - for (uint32 i = 0; i < _audioHandles.size(); i++) - if (g_system->getMixer()->isSoundHandleActive(_audioHandles[i])) - g_system->getMixer()->setChannelVolume(_audioHandles[i], getVolume()); -} - -void QuickTimeDecoder::updateBalance() { - for (uint32 i = 0; i < _audioHandles.size(); i++) - if (g_system->getMixer()->isSoundHandleActive(_audioHandles[i])) - g_system->getMixer()->setChannelBalance(_audioHandles[i], getBalance()); -} - -void QuickTimeDecoder::init() { - Audio::QuickTimeAudioDecoder::init(); - - _startTime = 0; - _setStartTime = false; - - // Initialize all the audio tracks - if (!_audioTracks.empty()) { - _audioHandles.resize(_audioTracks.size()); - - for (uint32 i = 0; i < _audioTracks.size(); i++) - _handlers.push_back(new AudioTrackHandler(this, _audioTracks[i])); - } - - // Initialize all the video tracks - for (uint32 i = 0; i < _tracks.size(); i++) { - if (_tracks[i]->codecType == CODEC_TYPE_VIDEO) { - for (uint32 j = 0; j < _tracks[i]->sampleDescs.size(); j++) - ((VideoSampleDesc *)_tracks[i]->sampleDescs[j])->initCodec(); - - _handlers.push_back(new VideoTrackHandler(this, _tracks[i])); - } - } - - // Prepare the first video track - _nextVideoTrack = findNextVideoTrack(); - - if (_nextVideoTrack) { - if (_scaleFactorX != 1 || _scaleFactorY != 1) { - // We have to take the scale into consideration when setting width/height - _width = (_nextVideoTrack->getWidth() / _scaleFactorX).toInt(); - _height = (_nextVideoTrack->getHeight() / _scaleFactorY).toInt(); - } else { - _width = _nextVideoTrack->getWidth().toInt(); - _height = _nextVideoTrack->getHeight().toInt(); - } - - _needUpdate = true; - } else { - _needUpdate = false; - } - - // Now start any audio - if (!_audioTracks.empty()) { - startAudio(); - _audioStartOffset = Audio::Timestamp(0); - } -} - -Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Track *track, uint32 format) { +Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Common::QuickTimeParser::Track *track, uint32 format) { if (track->codecType == CODEC_TYPE_VIDEO) { debug(0, "Video Codec FourCC: \'%s\'", tag2str(format)); @@ -395,61 +208,52 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Track *tra return Audio::QuickTimeAudioDecoder::readSampleDesc(track, format); } -void QuickTimeDecoder::close() { - stopAudio(); - freeAllTrackHandlers(); - - if (_scaledSurface) { - _scaledSurface->free(); - delete _scaledSurface; - _scaledSurface = 0; - } - - _width = _height = 0; - - Common::QuickTimeParser::close(); - SeekableVideoDecoder::reset(); -} - -void QuickTimeDecoder::freeAllTrackHandlers() { - for (uint32 i = 0; i < _handlers.size(); i++) - delete _handlers[i]; - - _handlers.clear(); -} +void QuickTimeDecoder::init() { + Audio::QuickTimeAudioDecoder::init(); -void QuickTimeDecoder::seekToTime(const Audio::Timestamp &time) { - stopAudio(); - _audioStartOffset = time; + // Initialize all the audio tracks + for (uint32 i = 0; i < _audioTracks.size(); i++) + addTrack(new AudioTrackHandler(this, _audioTracks[i])); - // Sets all tracks to this time - for (uint32 i = 0; i < _handlers.size(); i++) - _handlers[i]->seekToTime(time); + // Initialize all the video tracks + Common::Array &tracks = Common::QuickTimeParser::_tracks; + for (uint32 i = 0; i < tracks.size(); i++) { + if (tracks[i]->codecType == CODEC_TYPE_VIDEO) { + for (uint32 j = 0; j < tracks[i]->sampleDescs.size(); j++) + ((VideoSampleDesc *)tracks[i]->sampleDescs[j])->initCodec(); - startAudio(); + addTrack(new VideoTrackHandler(this, tracks[i])); + } + } - // Reset our start time - _startTime = g_system->getMillis() - time.msecs(); - _setStartTime = true; - resetPauseStartTime(); + // Prepare the first video track + VideoTrackHandler *nextVideoTrack = (VideoTrackHandler *)findNextVideoTrack(); - // Reset the next video track too - _nextVideoTrack = findNextVideoTrack(); - _needUpdate = _nextVideoTrack != 0; + if (nextVideoTrack) { + if (_scaleFactorX != 1 || _scaleFactorY != 1) { + // We have to take the scale into consideration when setting width/height + _width = (nextVideoTrack->getScaledWidth() / _scaleFactorX).toInt(); + _height = (nextVideoTrack->getScaledHeight() / _scaleFactorY).toInt(); + } else { + _width = nextVideoTrack->getWidth(); + _height = nextVideoTrack->getHeight(); + } + } } void QuickTimeDecoder::updateAudioBuffer() { // Updates the audio buffers for all audio tracks - for (uint32 i = 0; i < _handlers.size(); i++) - if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeAudio) - ((AudioTrackHandler *)_handlers[i])->updateBuffer(); + for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) + if ((*it)->getTrackType() == VideoDecoder::Track::kTrackTypeAudio) + ((AudioTrackHandler *)*it)->updateBuffer(); } -Graphics::PixelFormat QuickTimeDecoder::getPixelFormat() const { - if (_nextVideoTrack) - return _nextVideoTrack->getPixelFormat(); +void QuickTimeDecoder::scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, const Common::Rational &scaleFactorX, const Common::Rational &scaleFactorY) { + assert(src && dst); - return Graphics::PixelFormat(); + for (int32 j = 0; j < dst->h; j++) + for (int32 k = 0; k < dst->w; k++) + memcpy(dst->getBasePtr(k, j), src->getBasePtr((k * scaleFactorX).toInt() , (j * scaleFactorY).toInt()), src->format.bytesPerPixel); } QuickTimeDecoder::VideoSampleDesc::VideoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag) : Common::QuickTimeParser::SampleDesc(parentTrack, codecTag) { @@ -504,25 +308,8 @@ void QuickTimeDecoder::VideoSampleDesc::initCodec() { } } -bool QuickTimeDecoder::endOfVideoTracks() const { - for (uint32 i = 0; i < _handlers.size(); i++) - if (_handlers[i]->getTrackType() == TrackHandler::kTrackTypeVideo && !_handlers[i]->endOfTrack()) - return false; - - return true; -} - -QuickTimeDecoder::TrackHandler::TrackHandler(QuickTimeDecoder *decoder, Track *parent) : _decoder(decoder), _parent(parent), _fd(_decoder->_fd) { - _curEdit = 0; -} - -bool QuickTimeDecoder::TrackHandler::endOfTrack() { - // A track is over when we've finished going through all edits - return _curEdit == _parent->editCount; -} - QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack) - : TrackHandler(decoder, audioTrack->getParent()), _audioTrack(audioTrack) { + : _decoder(decoder), _audioTrack(audioTrack) { } void QuickTimeDecoder::AudioTrackHandler::updateBuffer() { @@ -532,21 +319,20 @@ void QuickTimeDecoder::AudioTrackHandler::updateBuffer() { _audioTrack->queueAudio(Audio::Timestamp(_decoder->getTimeToNextFrame() + 500, 1000)); } -bool QuickTimeDecoder::AudioTrackHandler::endOfTrack() { - return _audioTrack->endOfData(); -} - -void QuickTimeDecoder::AudioTrackHandler::seekToTime(Audio::Timestamp time) { - _audioTrack->seek(time); +Audio::SeekableAudioStream *QuickTimeDecoder::AudioTrackHandler::getSeekableAudioStream() const { + return _audioTrack; } -QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : TrackHandler(decoder, parent) { +QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : _decoder(decoder), _parent(parent) { + _curEdit = 0; enterNewEditList(false); _holdNextFrameStartTime = false; _curFrame = -1; _durationOverride = -1; _scaledSurface = 0; + _curPalette = 0; + _dirtyPalette = false; } QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() { @@ -556,6 +342,88 @@ QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() { } } +bool QuickTimeDecoder::VideoTrackHandler::endOfTrack() const { + // A track is over when we've finished going through all edits + return _curEdit == _parent->editCount; +} + +bool QuickTimeDecoder::VideoTrackHandler::seek(const Audio::Timestamp &requestedTime) { + // First, figure out what edit we're in + Audio::Timestamp time = requestedTime.convertToFramerate(_parent->timeScale); + + // Continue until we get to where we need to be + for (_curEdit = 0; !endOfTrack(); _curEdit++) + if ((uint32)time.totalNumberOfFrames() >= getCurEditTimeOffset() && (uint32)time.totalNumberOfFrames() < getCurEditTimeOffset() + getCurEditTrackDuration()) + break; + + // This track is done + if (endOfTrack()) + return true; + + enterNewEditList(false); + + // One extra check for the end of a track + if (endOfTrack()) + return true; + + // Now we're in the edit and need to figure out what frame we need + while (getRateAdjustedFrameTime() < (uint32)time.totalNumberOfFrames()) { + _curFrame++; + if (_durationOverride >= 0) { + _nextFrameStartTime += _durationOverride; + _durationOverride = -1; + } else { + _nextFrameStartTime += getFrameDuration(); + } + } + + // All that's left is to figure out what our starting time is going to be + // Compare the starting point for the frame to where we need to be + _holdNextFrameStartTime = getRateAdjustedFrameTime() != (uint32)time.totalNumberOfFrames(); + + // If we went past the time, go back a frame + if (_holdNextFrameStartTime) + _curFrame--; + + // Handle the keyframe here + int32 destinationFrame = _curFrame + 1; + + assert(destinationFrame < (int32)_parent->frameCount); + _curFrame = findKeyFrame(destinationFrame) - 1; + while (_curFrame < destinationFrame - 1) + bufferNextFrame(); + + return true; +} + +Audio::Timestamp QuickTimeDecoder::VideoTrackHandler::getDuration() const { + return Audio::Timestamp(0, _parent->duration, _decoder->_timeScale); +} + +uint16 QuickTimeDecoder::VideoTrackHandler::getWidth() const { + return getScaledWidth().toInt(); +} + +uint16 QuickTimeDecoder::VideoTrackHandler::getHeight() const { + return getScaledHeight().toInt(); +} + +Graphics::PixelFormat QuickTimeDecoder::VideoTrackHandler::getPixelFormat() const { + return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat(); +} + +int QuickTimeDecoder::VideoTrackHandler::getFrameCount() const { + return _parent->frameCount; +} + +uint32 QuickTimeDecoder::VideoTrackHandler::getNextFrameStartTime() const { + if (endOfTrack()) + return 0; + + // Convert to milliseconds so the tracks can be compared + return getRateAdjustedFrameTime() * 1000 / _parent->timeScale; +} + const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame() { if (endOfTrack()) return 0; @@ -586,7 +454,7 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame() if (frame && (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1)) { if (!_scaledSurface) { _scaledSurface = new Graphics::Surface(); - _scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat()); + _scaledSurface->create(getScaledWidth().toInt(), getScaledHeight().toInt(), getPixelFormat()); } _decoder->scaleSurface(frame, _scaledSurface, _parent->scaleFactorX, _parent->scaleFactorY); @@ -596,6 +464,85 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame() return frame; } +Common::Rational QuickTimeDecoder::VideoTrackHandler::getScaledWidth() const { + return Common::Rational(_parent->width) / _parent->scaleFactorX; +} + +Common::Rational QuickTimeDecoder::VideoTrackHandler::getScaledHeight() const { + return Common::Rational(_parent->height) / _parent->scaleFactorY; +} + +Common::SeekableReadStream *QuickTimeDecoder::VideoTrackHandler::getNextFramePacket(uint32 &descId) { + // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for. + int32 totalSampleCount = 0; + int32 sampleInChunk = 0; + int32 actualChunk = -1; + uint32 sampleToChunkIndex = 0; + + for (uint32 i = 0; i < _parent->chunkCount; i++) { + if (sampleToChunkIndex < _parent->sampleToChunkCount && i >= _parent->sampleToChunk[sampleToChunkIndex].first) + sampleToChunkIndex++; + + totalSampleCount += _parent->sampleToChunk[sampleToChunkIndex - 1].count; + + if (totalSampleCount > _curFrame) { + actualChunk = i; + descId = _parent->sampleToChunk[sampleToChunkIndex - 1].id; + sampleInChunk = _parent->sampleToChunk[sampleToChunkIndex - 1].count - totalSampleCount + _curFrame; + break; + } + } + + if (actualChunk < 0) { + warning("Could not find data for frame %d", _curFrame); + return 0; + } + + // Next seek to that frame + Common::SeekableReadStream *stream = _decoder->_fd; + stream->seek(_parent->chunkOffsets[actualChunk]); + + // Then, if the chunk holds more than one frame, seek to where the frame we want is located + for (int32 i = _curFrame - sampleInChunk; i < _curFrame; i++) { + if (_parent->sampleSize != 0) + stream->skip(_parent->sampleSize); + else + stream->skip(_parent->sampleSizes[i]); + } + + // Finally, read in the raw data for the frame + //debug("Frame Data[%d]: Offset = %d, Size = %d", _curFrame, stream->pos(), _parent->sampleSizes[_curFrame]); + + if (_parent->sampleSize != 0) + return stream->readStream(_parent->sampleSize); + + return stream->readStream(_parent->sampleSizes[_curFrame]); +} + +uint32 QuickTimeDecoder::VideoTrackHandler::getFrameDuration() { + uint32 curFrameIndex = 0; + for (int32 i = 0; i < _parent->timeToSampleCount; i++) { + curFrameIndex += _parent->timeToSample[i].count; + if ((uint32)_curFrame < curFrameIndex) { + // Ok, now we have what duration this frame has. + return _parent->timeToSample[i].duration; + } + } + + // This should never occur + error("Cannot find duration for frame %d", _curFrame); + return 0; +} + +uint32 QuickTimeDecoder::VideoTrackHandler::findKeyFrame(uint32 frame) const { + for (int i = _parent->keyframeCount - 1; i >= 0; i--) + if (_parent->keyframes[i] <= frame) + return _parent->keyframes[i]; + + // If none found, we'll assume the requested frame is a key frame + return frame; +} + void QuickTimeDecoder::VideoTrackHandler::enterNewEditList(bool bufferFrames) { // Bypass all empty edit lists first while (!endOfTrack() && _parent->editList[_curEdit].mediaTime == -1) @@ -667,166 +614,25 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::bufferNextFrame() if (entry->_videoCodec->containsPalette()) { // The codec itself contains a palette if (entry->_videoCodec->hasDirtyPalette()) { - _decoder->_palette = entry->_videoCodec->getPalette(); - _decoder->_dirtyPalette = true; + _curPalette = entry->_videoCodec->getPalette(); + _dirtyPalette = true; } } else { // Check if the video description has been updated byte *palette = entry->_palette; - if (palette !=_decoder-> _palette) { - _decoder->_palette = palette; - _decoder->_dirtyPalette = true; - } - } - - return frame; -} - -uint32 QuickTimeDecoder::VideoTrackHandler::getNextFrameStartTime() { - if (endOfTrack()) - return 0; - - // Convert to milliseconds so the tracks can be compared - return getRateAdjustedFrameTime() * 1000 / _parent->timeScale; -} - -uint32 QuickTimeDecoder::VideoTrackHandler::getFrameCount() { - return _parent->frameCount; -} - -uint32 QuickTimeDecoder::VideoTrackHandler::getFrameDuration() { - uint32 curFrameIndex = 0; - for (int32 i = 0; i < _parent->timeToSampleCount; i++) { - curFrameIndex += _parent->timeToSample[i].count; - if ((uint32)_curFrame < curFrameIndex) { - // Ok, now we have what duration this frame has. - return _parent->timeToSample[i].duration; - } - } - - // This should never occur - error("Cannot find duration for frame %d", _curFrame); - return 0; -} - -Common::SeekableReadStream *QuickTimeDecoder::VideoTrackHandler::getNextFramePacket(uint32 &descId) { - // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for. - int32 totalSampleCount = 0; - int32 sampleInChunk = 0; - int32 actualChunk = -1; - uint32 sampleToChunkIndex = 0; - - for (uint32 i = 0; i < _parent->chunkCount; i++) { - if (sampleToChunkIndex < _parent->sampleToChunkCount && i >= _parent->sampleToChunk[sampleToChunkIndex].first) - sampleToChunkIndex++; - - totalSampleCount += _parent->sampleToChunk[sampleToChunkIndex - 1].count; - - if (totalSampleCount > _curFrame) { - actualChunk = i; - descId = _parent->sampleToChunk[sampleToChunkIndex - 1].id; - sampleInChunk = _parent->sampleToChunk[sampleToChunkIndex - 1].count - totalSampleCount + _curFrame; - break; + if (palette != _curPalette) { + _curPalette = palette; + _dirtyPalette = true; } } - if (actualChunk < 0) { - warning("Could not find data for frame %d", _curFrame); - return 0; - } - - // Next seek to that frame - _fd->seek(_parent->chunkOffsets[actualChunk]); - - // Then, if the chunk holds more than one frame, seek to where the frame we want is located - for (int32 i = _curFrame - sampleInChunk; i < _curFrame; i++) { - if (_parent->sampleSize != 0) - _fd->skip(_parent->sampleSize); - else - _fd->skip(_parent->sampleSizes[i]); - } - - // Finally, read in the raw data for the frame - //debug("Frame Data[%d]: Offset = %d, Size = %d", _curFrame, _fd->pos(), _parent->sampleSizes[_curFrame]); - - if (_parent->sampleSize != 0) - return _fd->readStream(_parent->sampleSize); - - return _fd->readStream(_parent->sampleSizes[_curFrame]); -} - -uint32 QuickTimeDecoder::VideoTrackHandler::findKeyFrame(uint32 frame) const { - for (int i = _parent->keyframeCount - 1; i >= 0; i--) - if (_parent->keyframes[i] <= frame) - return _parent->keyframes[i]; - - // If none found, we'll assume the requested frame is a key frame return frame; } -void QuickTimeDecoder::VideoTrackHandler::seekToTime(Audio::Timestamp time) { - // First, figure out what edit we're in - time = time.convertToFramerate(_parent->timeScale); - - // Continue until we get to where we need to be - for (_curEdit = 0; !endOfTrack(); _curEdit++) - if ((uint32)time.totalNumberOfFrames() >= getCurEditTimeOffset() && (uint32)time.totalNumberOfFrames() < getCurEditTimeOffset() + getCurEditTrackDuration()) - break; - - // This track is done - if (endOfTrack()) - return; - - enterNewEditList(false); - - // One extra check for the end of a track - if (endOfTrack()) - return; - - // Now we're in the edit and need to figure out what frame we need - while (getRateAdjustedFrameTime() < (uint32)time.totalNumberOfFrames()) { - _curFrame++; - if (_durationOverride >= 0) { - _nextFrameStartTime += _durationOverride; - _durationOverride = -1; - } else { - _nextFrameStartTime += getFrameDuration(); - } - } - - // All that's left is to figure out what our starting time is going to be - // Compare the starting point for the frame to where we need to be - _holdNextFrameStartTime = getRateAdjustedFrameTime() != (uint32)time.totalNumberOfFrames(); - - // If we went past the time, go back a frame - if (_holdNextFrameStartTime) - _curFrame--; - - // Handle the keyframe here - int32 destinationFrame = _curFrame + 1; - - assert(destinationFrame < (int32)_parent->frameCount); - _curFrame = findKeyFrame(destinationFrame) - 1; - while (_curFrame < destinationFrame - 1) - bufferNextFrame(); -} - -Common::Rational QuickTimeDecoder::VideoTrackHandler::getWidth() const { - return Common::Rational(_parent->width) / _parent->scaleFactorX; -} - -Common::Rational QuickTimeDecoder::VideoTrackHandler::getHeight() const { - return Common::Rational(_parent->height) / _parent->scaleFactorY; -} - -Graphics::PixelFormat QuickTimeDecoder::VideoTrackHandler::getPixelFormat() const { - return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat(); -} - uint32 QuickTimeDecoder::VideoTrackHandler::getRateAdjustedFrameTime() const { // Figure out what time the next frame is at taking the edit list rate into account - uint32 convertedTime = (Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate).toInt(); + uint32 convertedTime = (Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate).toInt(); return convertedTime + getCurEditTimeOffset(); } diff --git a/video/qt_decoder.h b/video/qt_decoder.h index ce32562d64cc..71d33711a681 100644 --- a/video/qt_decoder.h +++ b/video/qt_decoder.h @@ -31,16 +31,17 @@ #ifndef VIDEO_QT_DECODER_H #define VIDEO_QT_DECODER_H -#include "audio/mixer.h" #include "audio/decoders/quicktime_intern.h" #include "common/scummsys.h" -#include "common/rational.h" -#include "graphics/pixelformat.h" #include "video/video_decoder.h" namespace Common { - class Rational; +class Rational; +} + +namespace Graphics { +struct PixelFormat; } namespace Video { @@ -54,68 +55,33 @@ class Codec; * - mohawk * - sci */ -class QuickTimeDecoder : public SeekableVideoDecoder, public Audio::QuickTimeAudioDecoder { +class QuickTimeDecoder : public VideoDecoder, public Audio::QuickTimeAudioDecoder { public: QuickTimeDecoder(); virtual ~QuickTimeDecoder(); - /** - * Returns the width of the video - * @return the width of the video - */ - uint16 getWidth() const { return _width; } - - /** - * Returns the height of the video - * @return the height of the video - */ - uint16 getHeight() const { return _height; } - - /** - * Returns the amount of frames in the video - * @return the amount of frames in the video - */ - uint32 getFrameCount() const; - - /** - * Load a video file - * @param filename the filename to load - */ bool loadFile(const Common::String &filename); - - /** - * Load a QuickTime video file from a SeekableReadStream - * @param stream the stream to load - */ bool loadStream(Common::SeekableReadStream *stream); - - /** - * Close a QuickTime encoded video file - */ void close(); + uint16 getWidth() const { return _width; } + uint16 getHeight() const { return _height; } + const Graphics::Surface *decodeNextFrame(); + Audio::Timestamp getDuration() const { return Audio::Timestamp(0, _duration, _timeScale); } - /** - * Returns the palette of the video - * @return the palette of the video - */ - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } +protected: + Common::QuickTimeParser::SampleDesc *readSampleDesc(Common::QuickTimeParser::Track *track, uint32 format); - int32 getCurFrame() const; +private: + void init(); - bool isVideoLoaded() const { return isOpen(); } - const Graphics::Surface *decodeNextFrame(); - bool endOfVideo() const; - uint32 getTime() const; - uint32 getTimeToNextFrame() const; - Graphics::PixelFormat getPixelFormat() const; + void updateAudioBuffer(); - // SeekableVideoDecoder API - void seekToFrame(uint32 frame); - void seekToTime(const Audio::Timestamp &time); - uint32 getDuration() const { return _duration * 1000 / _timeScale; } + uint16 _width, _height; + + Graphics::Surface *_scaledSurface; + void scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, + const Common::Rational &scaleFactorX, const Common::Rational &scaleFactorY); -protected: class VideoSampleDesc : public Common::QuickTimeParser::SampleDesc { public: VideoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag); @@ -131,110 +97,59 @@ class QuickTimeDecoder : public SeekableVideoDecoder, public Audio::QuickTimeAud Codec *_videoCodec; }; - Common::QuickTimeParser::SampleDesc *readSampleDesc(Track *track, uint32 format); - - // VideoDecoder API - void updateVolume(); - void updateBalance(); - -private: - void init(); - - void startAudio(); - void stopAudio(); - void updateAudioBuffer(); - void readNextAudioChunk(); - Common::Array _audioHandles; - Audio::Timestamp _audioStartOffset; - - Codec *createCodec(uint32 codecTag, byte bitsPerPixel); - uint32 findKeyFrame(uint32 frame) const; - - bool _dirtyPalette; - const byte *_palette; - bool _setStartTime; - bool _needUpdate; - - uint16 _width, _height; - - Graphics::Surface *_scaledSurface; - void scaleSurface(const Graphics::Surface *src, Graphics::Surface *dst, - Common::Rational scaleFactorX, Common::Rational scaleFactorY); - - void pauseVideoIntern(bool pause); - bool endOfVideoTracks() const; - - // The TrackHandler is a class that wraps around a QuickTime Track - // and handles playback in this decoder class. - class TrackHandler { - public: - TrackHandler(QuickTimeDecoder *decoder, Track *parent); - virtual ~TrackHandler() {} - - enum TrackType { - kTrackTypeAudio, - kTrackTypeVideo - }; - - virtual TrackType getTrackType() const = 0; - - virtual void seekToTime(Audio::Timestamp time) = 0; - - virtual bool endOfTrack(); - - protected: - uint32 _curEdit; - QuickTimeDecoder *_decoder; - Common::SeekableReadStream *_fd; - Track *_parent; - }; - // The AudioTrackHandler is currently just a wrapper around some // QuickTimeDecoder functions. - class AudioTrackHandler : public TrackHandler { + class AudioTrackHandler : public SeekableAudioTrack { public: AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack); - TrackType getTrackType() const { return kTrackTypeAudio; } void updateBuffer(); - void seekToTime(Audio::Timestamp time); - bool endOfTrack(); + + protected: + Audio::SeekableAudioStream *getSeekableAudioStream() const; private: + QuickTimeDecoder *_decoder; QuickTimeAudioTrack *_audioTrack; }; // The VideoTrackHandler is the bridge between the time of playback // and the media for the given track. It calculates when to start // tracks and at what rate to play the media using the edit list. - class VideoTrackHandler : public TrackHandler { + class VideoTrackHandler : public VideoTrack { public: - VideoTrackHandler(QuickTimeDecoder *decoder, Track *parent); + VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent); ~VideoTrackHandler(); - TrackType getTrackType() const { return kTrackTypeVideo; } - - const Graphics::Surface *decodeNextFrame(); - - uint32 getNextFrameStartTime(); - - uint32 getFrameCount(); - - int32 getCurFrame() { return _curFrame; } + bool endOfTrack() const; + bool isSeekable() const { return true; } + bool seek(const Audio::Timestamp &time); + Audio::Timestamp getDuration() const; + uint16 getWidth() const; + uint16 getHeight() const; Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const; + uint32 getNextFrameStartTime() const; + const Graphics::Surface *decodeNextFrame(); + const byte *getPalette() const { _dirtyPalette = false; return _curPalette; } + bool hasDirtyPalette() const { return _curPalette; } - void seekToTime(Audio::Timestamp time); - - Common::Rational getWidth() const; - Common::Rational getHeight() const; + Common::Rational getScaledWidth() const; + Common::Rational getScaledHeight() const; private: + QuickTimeDecoder *_decoder; + Common::QuickTimeParser::Track *_parent; + uint32 _curEdit; int32 _curFrame; uint32 _nextFrameStartTime; Graphics::Surface *_scaledSurface; bool _holdNextFrameStartTime; int32 _durationOverride; + const byte *_curPalette; + mutable bool _dirtyPalette; Common::SeekableReadStream *getNextFramePacket(uint32 &descId); uint32 getFrameDuration(); @@ -245,12 +160,6 @@ class QuickTimeDecoder : public SeekableVideoDecoder, public Audio::QuickTimeAud uint32 getCurEditTimeOffset() const; uint32 getCurEditTrackDuration() const; }; - - Common::Array _handlers; - VideoTrackHandler *_nextVideoTrack; - VideoTrackHandler *findNextVideoTrack() const; - - void freeAllTrackHandlers(); }; } // End of namespace Video diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index 359f4cb9bd8a..bea65142a120 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -204,8 +204,7 @@ BigHuffmanTree::BigHuffmanTree(Common::BitStream &bs, int allocSize) delete _hiBytes; } -BigHuffmanTree::~BigHuffmanTree() -{ +BigHuffmanTree::~BigHuffmanTree() { delete[] _tree; } @@ -278,24 +277,17 @@ uint32 BigHuffmanTree::getCode(Common::BitStream &bs) { return v; } -SmackerDecoder::SmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) - : _audioStarted(false), _audioStream(0), _mixer(mixer), _soundType(soundType) { - _surface = 0; +SmackerDecoder::SmackerDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { _fileStream = 0; - _dirtyPalette = false; + _firstFrameStart = 0; + _frameTypes = 0; + _frameSizes = 0; } SmackerDecoder::~SmackerDecoder() { close(); } -uint32 SmackerDecoder::getTime() const { - if (_audioStream && _audioStarted) - return _mixer->getSoundElapsedTime(_audioHandle); - - return FixedRateVideoDecoder::getTime(); -} - bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) { close(); @@ -309,16 +301,17 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) { uint32 width = _fileStream->readUint32LE(); uint32 height = _fileStream->readUint32LE(); - _frameCount = _fileStream->readUint32LE(); - int32 frameRate = _fileStream->readSint32LE(); - - // framerate contains 2 digits after the comma, so 1497 is actually 14.97 fps - if (frameRate > 0) - _frameRate = Common::Rational(1000, frameRate); - else if (frameRate < 0) - _frameRate = Common::Rational(100000, -frameRate); + uint32 frameCount = _fileStream->readUint32LE(); + int32 frameDelay = _fileStream->readSint32LE(); + + // frame rate contains 2 digits after the comma, so 1497 is actually 14.97 fps + Common::Rational frameRate; + if (frameDelay > 0) + frameRate = Common::Rational(1000, frameDelay); + else if (frameDelay < 0) + frameRate = Common::Rational(100000, -frameDelay); else - _frameRate = 1000; + frameRate = 1000; // Flags are determined by which bit is set, which can be one of the following: // 0 - set to 1 if file contains a ring frame. @@ -328,6 +321,9 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) { // before it is displayed. _header.flags = _fileStream->readUint32LE(); + SmackerVideoTrack *videoTrack = createVideoTrack(width, height, frameCount, frameRate, _header.flags, _header.signature); + addTrack(videoTrack); + // TODO: should we do any extra processing for Smacker files with ring frames? // TODO: should we do any extra processing for Y-doubled videos? Are they the @@ -374,92 +370,77 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) { warning("Unhandled Smacker v2 audio compression"); if (i == 0) - _audioStream = Audio::makeQueuingAudioStream(_header.audioInfo[0].sampleRate, _header.audioInfo[0].isStereo); + addTrack(new SmackerAudioTrack(_header.audioInfo[i], _soundType)); } } _header.dummy = _fileStream->readUint32LE(); - _frameSizes = new uint32[_frameCount]; - for (i = 0; i < _frameCount; ++i) + _frameSizes = new uint32[frameCount]; + for (i = 0; i < frameCount; ++i) _frameSizes[i] = _fileStream->readUint32LE(); - _frameTypes = new byte[_frameCount]; - for (i = 0; i < _frameCount; ++i) + _frameTypes = new byte[frameCount]; + for (i = 0; i < frameCount; ++i) _frameTypes[i] = _fileStream->readByte(); byte *huffmanTrees = (byte *) malloc(_header.treesSize); _fileStream->read(huffmanTrees, _header.treesSize); Common::BitStream8LSB bs(new Common::MemoryReadStream(huffmanTrees, _header.treesSize, DisposeAfterUse::YES), true); + videoTrack->readTrees(bs, _header.mMapSize, _header.mClrSize, _header.fullSize, _header.typeSize); - _MMapTree = new BigHuffmanTree(bs, _header.mMapSize); - _MClrTree = new BigHuffmanTree(bs, _header.mClrSize); - _FullTree = new BigHuffmanTree(bs, _header.fullSize); - _TypeTree = new BigHuffmanTree(bs, _header.typeSize); - - _surface = new Graphics::Surface(); + _firstFrameStart = _fileStream->pos(); - // Height needs to be doubled if we have flags (Y-interlaced or Y-doubled) - _surface->create(width, height * (_header.flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8()); - - memset(_palette, 0, 3 * 256); return true; } void SmackerDecoder::close() { - if (!_fileStream) - return; - - if (_audioStream) { - if (_audioStarted) { - // The mixer will delete the stream. - _mixer->stopHandle(_audioHandle); - _audioStarted = false; - } else { - delete _audioStream; - } - _audioStream = 0; - } + VideoDecoder::close(); delete _fileStream; _fileStream = 0; - _surface->free(); - delete _surface; - _surface = 0; - - delete _MMapTree; - delete _MClrTree; - delete _FullTree; - delete _TypeTree; + delete[] _frameTypes; + _frameTypes = 0; delete[] _frameSizes; - delete[] _frameTypes; + _frameSizes = 0; +} + +bool SmackerDecoder::rewind() { + // Call the parent method to rewind the tracks first + if (!VideoDecoder::rewind()) + return false; - reset(); + // And seek back to where the first frame begins + _fileStream->seek(_firstFrameStart); + return true; } -const Graphics::Surface *SmackerDecoder::decodeNextFrame() { +void SmackerDecoder::readNextPacket() { + SmackerVideoTrack *videoTrack = (SmackerVideoTrack *)getTrack(0); + + if (videoTrack->endOfTrack()) + return; + + videoTrack->increaseCurFrame(); + uint i; uint32 chunkSize = 0; uint32 dataSizeUnpacked = 0; uint32 startPos = _fileStream->pos(); - _curFrame++; - // Check if we got a frame with palette data, and // call back the virtual setPalette function to set // the current palette - if (_frameTypes[_curFrame] & 1) { - unpackPalette(); - _dirtyPalette = true; - } + if (_frameTypes[videoTrack->getCurFrame()] & 1) + videoTrack->unpackPalette(_fileStream); // Load audio tracks for (i = 0; i < 7; ++i) { - if (!(_frameTypes[_curFrame] & (2 << i))) + if (!(_frameTypes[videoTrack->getCurFrame()] & (2 << i))) continue; chunkSize = _fileStream->readUint32LE(); @@ -475,29 +456,109 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() { handleAudioTrack(i, chunkSize, dataSizeUnpacked); } - uint32 frameSize = _frameSizes[_curFrame] & ~3; -// uint32 remainder = _frameSizes[_curFrame] & 3; + uint32 frameSize = _frameSizes[videoTrack->getCurFrame()] & ~3; +// uint32 remainder = _frameSizes[videoTrack->getCurFrame()] & 3; if (_fileStream->pos() - startPos > frameSize) error("Smacker actual frame size exceeds recorded frame size"); uint32 frameDataSize = frameSize - (_fileStream->pos() - startPos); - _frameData = (byte *)malloc(frameDataSize + 1); + byte *frameData = (byte *)malloc(frameDataSize + 1); // Padding to keep the BigHuffmanTrees from reading past the data end - _frameData[frameDataSize] = 0x00; + frameData[frameDataSize] = 0x00; + + _fileStream->read(frameData, frameDataSize); + + Common::BitStream8LSB bs(new Common::MemoryReadStream(frameData, frameDataSize + 1, DisposeAfterUse::YES), true); + videoTrack->decodeFrame(bs); + + _fileStream->seek(startPos + frameSize); +} - _fileStream->read(_frameData, frameDataSize); +void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) { + if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) { + // Get the audio track, which start at offset 1 (first track is video) + SmackerAudioTrack *audioTrack = (SmackerAudioTrack *)getTrack(track + 1); - Common::BitStream8LSB bs(new Common::MemoryReadStream(_frameData, frameDataSize + 1, DisposeAfterUse::YES), true); + // If it's track 0, play the audio data + byte *soundBuffer = (byte *)malloc(chunkSize + 1); + // Padding to keep the SmallHuffmanTrees from reading past the data end + soundBuffer[chunkSize] = 0x00; + _fileStream->read(soundBuffer, chunkSize); + + if (_header.audioInfo[track].compression == kCompressionRDFT || _header.audioInfo[track].compression == kCompressionDCT) { + // TODO: Compressed audio (Bink RDFT/DCT encoded) + free(soundBuffer); + return; + } else if (_header.audioInfo[track].compression == kCompressionDPCM) { + // Compressed audio (Huffman DPCM encoded) + audioTrack->queueCompressedBuffer(soundBuffer, chunkSize + 1, unpackedSize); + free(soundBuffer); + } else { + // Uncompressed audio (PCM) + audioTrack->queuePCM(soundBuffer, chunkSize); + } + } else { + // Ignore the rest of the audio tracks, if they exist + // TODO: Are there any Smacker videos with more than one audio stream? + // If yes, we should play the rest of the audio streams as well + if (chunkSize > 0) + _fileStream->skip(chunkSize); + } +} + +SmackerDecoder::SmackerVideoTrack::SmackerVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) { + _surface = new Graphics::Surface(); + _surface->create(width, height * (flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8()); + _frameCount = frameCount; + _frameRate = frameRate; + _flags = flags; + _signature = signature; + _curFrame = -1; + _dirtyPalette = false; + _MMapTree = _MClrTree = _FullTree = _TypeTree = 0; + memset(_palette, 0, 3 * 256); +} + +SmackerDecoder::SmackerVideoTrack::~SmackerVideoTrack() { + _surface->free(); + delete _surface; + + delete _MMapTree; + delete _MClrTree; + delete _FullTree; + delete _TypeTree; +} + +uint16 SmackerDecoder::SmackerVideoTrack::getWidth() const { + return _surface->w; +} + +uint16 SmackerDecoder::SmackerVideoTrack::getHeight() const { + return _surface->h; +} + +Graphics::PixelFormat SmackerDecoder::SmackerVideoTrack::getPixelFormat() const { + return _surface->format; +} + +void SmackerDecoder::SmackerVideoTrack::readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize) { + _MMapTree = new BigHuffmanTree(bs, mMapSize); + _MClrTree = new BigHuffmanTree(bs, mClrSize); + _FullTree = new BigHuffmanTree(bs, fullSize); + _TypeTree = new BigHuffmanTree(bs, typeSize); +} + +void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { _MMapTree->reset(); _MClrTree->reset(); _FullTree->reset(); _TypeTree->reset(); // Height needs to be doubled if we have flags (Y-interlaced or Y-doubled) - uint doubleY = _header.flags ? 2 : 1; + uint doubleY = _flags ? 2 : 1; uint bw = getWidth() / 4; uint bh = getHeight() / doubleY / 4; @@ -508,6 +569,7 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() { uint type, run, j, mode; uint32 p1, p2, clr, map; byte hi, lo; + uint i; while (block < blocks) { type = _TypeTree->getCode(bs); @@ -536,7 +598,7 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() { break; case SMK_BLOCK_FULL: // Smacker v2 has one mode, Smacker v4 has three - if (_header.signature == MKTAG('S','M','K','2')) { + if (_signature == MKTAG('S','M','K','2')) { mode = 0; } else { // 00 - mode 0 @@ -628,60 +690,81 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() { break; } } +} - _fileStream->seek(startPos + frameSize); +void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream *stream) { + uint startPos = stream->pos(); + uint32 len = 4 * stream->readByte(); - if (_curFrame == 0) - _startTime = g_system->getMillis(); + byte *chunk = (byte *)malloc(len); + stream->read(chunk, len); + byte *p = chunk; - return _surface; -} + byte oldPalette[3 * 256]; + memcpy(oldPalette, _palette, 3 * 256); -void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) { - if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) { - // If it's track 0, play the audio data - byte *soundBuffer = (byte *)malloc(chunkSize + 1); - // Padding to keep the SmallHuffmanTrees from reading past the data end - soundBuffer[chunkSize] = 0x00; + byte *pal = _palette; - _fileStream->read(soundBuffer, chunkSize); + int sz = 0; + byte b0; + while (sz < 256) { + b0 = *p++; + if (b0 & 0x80) { // if top bit is 1 (0x80 = 10000000) + sz += (b0 & 0x7f) + 1; // get lower 7 bits + 1 (0x7f = 01111111) + pal += 3 * ((b0 & 0x7f) + 1); + } else if (b0 & 0x40) { // if top 2 bits are 01 (0x40 = 01000000) + byte c = (b0 & 0x3f) + 1; // get lower 6 bits + 1 (0x3f = 00111111) + uint s = 3 * *p++; + sz += c; - if (_header.audioInfo[track].compression == kCompressionRDFT || _header.audioInfo[track].compression == kCompressionDCT) { - // TODO: Compressed audio (Bink RDFT/DCT encoded) - free(soundBuffer); - return; - } else if (_header.audioInfo[track].compression == kCompressionDPCM) { - // Compressed audio (Huffman DPCM encoded) - queueCompressedBuffer(soundBuffer, chunkSize + 1, unpackedSize, track); - free(soundBuffer); - } else { - // Uncompressed audio (PCM) - byte flags = 0; - if (_header.audioInfo[track].is16Bits) - flags = flags | Audio::FLAG_16BITS; - if (_header.audioInfo[track].isStereo) - flags = flags | Audio::FLAG_STEREO; - - _audioStream->queueBuffer(soundBuffer, chunkSize, DisposeAfterUse::YES, flags); - // The sound buffer will be deleted by QueuingAudioStream - } + while (c--) { + *pal++ = oldPalette[s + 0]; + *pal++ = oldPalette[s + 1]; + *pal++ = oldPalette[s + 2]; + s += 3; + } + } else { // top 2 bits are 00 + sz++; + // get the lower 6 bits for each component (0x3f = 00111111) + byte b = b0 & 0x3f; + byte g = (*p++) & 0x3f; + byte r = (*p++) & 0x3f; - if (!_audioStarted) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance()); - _audioStarted = true; + assert(g < 0xc0 && b < 0xc0); + + // upscale to full 8-bit color values by multiplying by 4 + *pal++ = b * 4; + *pal++ = g * 4; + *pal++ = r * 4; } - } else { - // Ignore the rest of the audio tracks, if they exist - // TODO: Are there any Smacker videos with more than one audio stream? - // If yes, we should play the rest of the audio streams as well - if (chunkSize > 0) - _fileStream->skip(chunkSize); } + + stream->seek(startPos + len); + free(chunk); + + _dirtyPalette = true; +} + +SmackerDecoder::SmackerAudioTrack::SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType) : + _audioInfo(audioInfo), _soundType(soundType) { + _audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo); +} + +SmackerDecoder::SmackerAudioTrack::~SmackerAudioTrack() { + delete _audioStream; } -void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize, - uint32 unpackedSize, int streamNum) { +bool SmackerDecoder::SmackerAudioTrack::rewind() { + delete _audioStream; + _audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo); + return true; +} +Audio::AudioStream *SmackerDecoder::SmackerAudioTrack::getAudioStream() const { + return _audioStream; +} + +void SmackerDecoder::SmackerAudioTrack::queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize) { Common::BitStream8LSB audioBS(new Common::MemoryReadStream(buffer, bufferSize), true); bool dataPresent = audioBS.getBit(); @@ -689,9 +772,9 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize, return; bool isStereo = audioBS.getBit(); - assert(isStereo == _header.audioInfo[streamNum].isStereo); + assert(isStereo == _audioInfo.isStereo); bool is16Bits = audioBS.getBit(); - assert(is16Bits == _header.audioInfo[streamNum].is16Bits); + assert(is16Bits == _audioInfo.is16Bits); int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1); @@ -759,74 +842,21 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize, for (int k = 0; k < numBytes; k++) delete audioTrees[k]; - byte flags = 0; - if (_header.audioInfo[0].is16Bits) - flags = flags | Audio::FLAG_16BITS; - if (_header.audioInfo[0].isStereo) - flags = flags | Audio::FLAG_STEREO; - _audioStream->queueBuffer(unpackedBuffer, unpackedSize, DisposeAfterUse::YES, flags); - // unpackedBuffer will be deleted by QueuingAudioStream + queuePCM(unpackedBuffer, unpackedSize); } -void SmackerDecoder::unpackPalette() { - uint startPos = _fileStream->pos(); - uint32 len = 4 * _fileStream->readByte(); - - byte *chunk = (byte *)malloc(len); - _fileStream->read(chunk, len); - byte *p = chunk; - - byte oldPalette[3*256]; - memcpy(oldPalette, _palette, 3 * 256); - - byte *pal = _palette; - - int sz = 0; - byte b0; - while (sz < 256) { - b0 = *p++; - if (b0 & 0x80) { // if top bit is 1 (0x80 = 10000000) - sz += (b0 & 0x7f) + 1; // get lower 7 bits + 1 (0x7f = 01111111) - pal += 3 * ((b0 & 0x7f) + 1); - } else if (b0 & 0x40) { // if top 2 bits are 01 (0x40 = 01000000) - byte c = (b0 & 0x3f) + 1; // get lower 6 bits + 1 (0x3f = 00111111) - uint s = 3 * *p++; - sz += c; - - while (c--) { - *pal++ = oldPalette[s + 0]; - *pal++ = oldPalette[s + 1]; - *pal++ = oldPalette[s + 2]; - s += 3; - } - } else { // top 2 bits are 00 - sz++; - // get the lower 6 bits for each component (0x3f = 00111111) - byte b = b0 & 0x3f; - byte g = (*p++) & 0x3f; - byte r = (*p++) & 0x3f; - - assert(g < 0xc0 && b < 0xc0); - - // upscale to full 8-bit color values by multiplying by 4 - *pal++ = b * 4; - *pal++ = g * 4; - *pal++ = r * 4; - } - } - - _fileStream->seek(startPos + len); - free(chunk); -} +void SmackerDecoder::SmackerAudioTrack::queuePCM(byte *buffer, uint32 bufferSize) { + byte flags = 0; + if (_audioInfo.is16Bits) + flags |= Audio::FLAG_16BITS; + if (_audioInfo.isStereo) + flags |= Audio::FLAG_STEREO; -void SmackerDecoder::updateVolume() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); + _audioStream->queueBuffer(buffer, bufferSize, DisposeAfterUse::YES, flags); } -void SmackerDecoder::updateBalance() { - if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) - g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); +SmackerDecoder::SmackerVideoTrack *SmackerDecoder::createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const { + return new SmackerVideoTrack(width, height, frameCount, frameRate, flags, signature); } } // End of namespace Video diff --git a/video/smk_decoder.h b/video/smk_decoder.h index 516882e7c805..722723837367 100644 --- a/video/smk_decoder.h +++ b/video/smk_decoder.h @@ -34,6 +34,7 @@ class QueuingAudioStream; } namespace Common { +class BitStream; class SeekableReadStream; } @@ -56,42 +57,72 @@ class BigHuffmanTree; * - sword2 * - toon */ -class SmackerDecoder : public FixedRateVideoDecoder { +class SmackerDecoder : public VideoDecoder { public: - SmackerDecoder(Audio::Mixer *mixer, - Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType); + SmackerDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType); virtual ~SmackerDecoder(); - bool loadStream(Common::SeekableReadStream *stream); + virtual bool loadStream(Common::SeekableReadStream *stream); void close(); - bool isVideoLoaded() const { return _fileStream != 0; } - uint16 getWidth() const { return _surface->w; } - uint16 getHeight() const { return _surface->h; } - uint32 getFrameCount() const { return _frameCount; } - uint32 getTime() const; - const Graphics::Surface *decodeNextFrame(); - Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } - const byte *getPalette() { _dirtyPalette = false; return _palette; } - bool hasDirtyPalette() const { return _dirtyPalette; } - virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize); + bool rewind(); protected: - Common::SeekableReadStream *_fileStream; + void readNextPacket(); + + virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize); - // VideoDecoder API - void updateVolume(); - void updateBalance(); + class SmackerVideoTrack : public FixedRateVideoTrack { + public: + SmackerVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature); + ~SmackerVideoTrack(); - // FixedRateVideoDecoder API - Common::Rational getFrameRate() const { return _frameRate; } + bool isRewindable() const { return true; } + bool rewind() { _curFrame = -1; return true; } -protected: - void unpackPalette(); - // Possible runs of blocks - uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); } - void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize, int streamNum); + uint16 getWidth() const; + uint16 getHeight() const; + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame() { return _surface; } + const byte *getPalette() const { _dirtyPalette = false; return _palette; } + bool hasDirtyPalette() const { return _dirtyPalette; } + + void readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize); + void increaseCurFrame() { _curFrame++; } + void decodeFrame(Common::BitStream &bs); + void unpackPalette(Common::SeekableReadStream *stream); + + protected: + Common::Rational getFrameRate() const { return _frameRate; } + + Graphics::Surface *_surface; + + private: + Common::Rational _frameRate; + uint32 _flags, _signature; + + byte _palette[3 * 256]; + mutable bool _dirtyPalette; + + int _curFrame; + uint32 _frameCount; + + BigHuffmanTree *_MMapTree; + BigHuffmanTree *_MClrTree; + BigHuffmanTree *_FullTree; + BigHuffmanTree *_TypeTree; + // Possible runs of blocks + static uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); } + }; + + virtual SmackerVideoTrack *createVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) const; + + Common::SeekableReadStream *_fileStream; + +private: enum AudioCompression { kCompressionNone, kCompressionDPCM, @@ -120,6 +151,28 @@ class SmackerDecoder : public FixedRateVideoDecoder { uint32 dummy; } _header; + class SmackerAudioTrack : public AudioTrack { + public: + SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType); + ~SmackerAudioTrack(); + + bool isRewindable() const { return true; } + bool rewind(); + + Audio::Mixer::SoundType getSoundType() const { return _soundType; } + + void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize); + void queuePCM(byte *buffer, uint32 bufferSize); + + protected: + Audio::AudioStream *getAudioStream() const; + + private: + Audio::Mixer::SoundType _soundType; + Audio::QueuingAudioStream *_audioStream; + AudioInfo _audioInfo; + }; + uint32 *_frameSizes; // The FrameTypes section of a Smacker file contains an array of bytes, where // the 8 bits of each byte describe the contents of the corresponding frame. @@ -127,25 +180,10 @@ class SmackerDecoder : public FixedRateVideoDecoder { // and so on), so there can be up to 7 different audio tracks. When the lowest bit // (bit 0) is set, it denotes a frame that contains a palette record byte *_frameTypes; - byte *_frameData; - // The RGB palette - byte _palette[3 * 256]; - bool _dirtyPalette; - Common::Rational _frameRate; - uint32 _frameCount; - Graphics::Surface *_surface; + uint32 _firstFrameStart; Audio::Mixer::SoundType _soundType; - Audio::Mixer *_mixer; - bool _audioStarted; - Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _audioHandle; - - BigHuffmanTree *_MMapTree; - BigHuffmanTree *_MClrTree; - BigHuffmanTree *_FullTree; - BigHuffmanTree *_TypeTree; }; } // End of namespace Video diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp new file mode 100644 index 000000000000..d7260469e695 --- /dev/null +++ b/video/theora_decoder.cpp @@ -0,0 +1,487 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * Source is based on the player example from libvorbis package, + * available at: http://svn.xiph.org/trunk/theora/examples/player_example.c + * + * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. + * + * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 + * by the Xiph.Org Foundation and contributors http://www.xiph.org/ + * + */ + +#include "video/theora_decoder.h" + +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "common/stream.h" +#include "common/system.h" +#include "common/textconsole.h" +#include "common/util.h" +#include "graphics/pixelformat.h" +#include "graphics/yuv_to_rgb.h" + +namespace Video { + +TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { + _fileStream = 0; + + _videoTrack = 0; + _audioTrack = 0; + _hasVideo = _hasAudio = false; +} + +TheoraDecoder::~TheoraDecoder() { + close(); +} + +bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) { + close(); + + _fileStream = stream; + + // start up Ogg stream synchronization layer + ogg_sync_init(&_oggSync); + + // init supporting Vorbis structures needed in header parsing + vorbis_info_init(&_vorbisInfo); + vorbis_comment vorbisComment; + vorbis_comment_init(&vorbisComment); + + // init supporting Theora structures needed in header parsing + th_info theoraInfo; + th_info_init(&theoraInfo); + th_comment theoraComment; + th_comment_init(&theoraComment); + th_setup_info *theoraSetup = 0; + + uint theoraPackets = 0, vorbisPackets = 0; + + // Ogg file open; parse the headers + // Only interested in Vorbis/Theora streams + bool foundHeader = false; + while (!foundHeader) { + int ret = bufferData(); + + if (ret == 0) + break; // FIXME: Shouldn't this error out? + + while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) { + ogg_stream_state test; + + // is this a mandated initial header? If not, stop parsing + if (!ogg_page_bos(&_oggPage)) { + // don't leak the page; get it into the appropriate stream + queuePage(&_oggPage); + foundHeader = true; + break; + } + + ogg_stream_init(&test, ogg_page_serialno(&_oggPage)); + ogg_stream_pagein(&test, &_oggPage); + ogg_stream_packetout(&test, &_oggPacket); + + // identify the codec: try theora + if (theoraPackets == 0 && th_decode_headerin(&theoraInfo, &theoraComment, &theoraSetup, &_oggPacket) >= 0) { + // it is theora + memcpy(&_theoraOut, &test, sizeof(test)); + theoraPackets = 1; + _hasVideo = true; + } else if (vorbisPackets == 0 && vorbis_synthesis_headerin(&_vorbisInfo, &vorbisComment, &_oggPacket) >= 0) { + // it is vorbis + memcpy(&_vorbisOut, &test, sizeof(test)); + vorbisPackets = 1; + _hasAudio = true; + } else { + // whatever it is, we don't care about it + ogg_stream_clear(&test); + } + } + // fall through to non-bos page parsing + } + + // we're expecting more header packets. + while ((theoraPackets && theoraPackets < 3) || (vorbisPackets && vorbisPackets < 3)) { + int ret; + + // look for further theora headers + while (theoraPackets && (theoraPackets < 3) && (ret = ogg_stream_packetout(&_theoraOut, &_oggPacket))) { + if (ret < 0) + error("Error parsing Theora stream headers; corrupt stream?"); + + if (!th_decode_headerin(&theoraInfo, &theoraComment, &theoraSetup, &_oggPacket)) + error("Error parsing Theora stream headers; corrupt stream?"); + + theoraPackets++; + } + + // look for more vorbis header packets + while (vorbisPackets && (vorbisPackets < 3) && (ret = ogg_stream_packetout(&_vorbisOut, &_oggPacket))) { + if (ret < 0) + error("Error parsing Vorbis stream headers; corrupt stream?"); + + if (vorbis_synthesis_headerin(&_vorbisInfo, &vorbisComment, &_oggPacket)) + error("Error parsing Vorbis stream headers; corrupt stream?"); + + vorbisPackets++; + + if (vorbisPackets == 3) + break; + } + + // The header pages/packets will arrive before anything else we + // care about, or the stream is not obeying spec + + if (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) { + queuePage(&_oggPage); // demux into the appropriate stream + } else { + ret = bufferData(); // someone needs more data + + if (ret == 0) + error("End of file while searching for codec headers."); + } + } + + // And now we have it all. Initialize decoders next + if (_hasVideo) { + _videoTrack = new TheoraVideoTrack(getDefaultHighColorFormat(), theoraInfo, theoraSetup); + addTrack(_videoTrack); + } + + th_info_clear(&theoraInfo); + th_comment_clear(&theoraComment); + th_setup_free(theoraSetup); + + if (_hasAudio) { + _audioTrack = new VorbisAudioTrack(_soundType, _vorbisInfo); + + // Get enough audio data to start us off + while (!_audioTrack->hasAudio()) { + // Queue more data + bufferData(); + while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) + queuePage(&_oggPage); + + queueAudio(); + } + + addTrack(_audioTrack); + } + + vorbis_comment_clear(&vorbisComment); + + return true; +} + +void TheoraDecoder::close() { + VideoDecoder::close(); + + if (!_fileStream) + return; + + if (_videoTrack) { + ogg_stream_clear(&_theoraOut); + _videoTrack = 0; + } + + if (_audioTrack) { + ogg_stream_clear(&_vorbisOut); + _audioTrack = 0; + } + + ogg_sync_clear(&_oggSync); + vorbis_info_clear(&_vorbisInfo); + + delete _fileStream; + _fileStream = 0; + + _hasVideo = _hasAudio = false; +} + +void TheoraDecoder::readNextPacket() { + // First, let's get our frame + if (_hasVideo) { + while (!_videoTrack->endOfTrack()) { + // theora is one in, one out... + if (ogg_stream_packetout(&_theoraOut, &_oggPacket) > 0) { + if (_videoTrack->decodePacket(_oggPacket)) + break; + } else if (_theoraOut.e_o_s || _fileStream->eos()) { + // If we can't get any more frames, we're done. + _videoTrack->setEndOfVideo(); + } else { + // Queue more data + bufferData(); + while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) + queuePage(&_oggPage); + } + + // Update audio if we can + queueAudio(); + } + } + + // Then make sure we have enough audio buffered + ensureAudioBufferSize(); +} + +TheoraDecoder::TheoraVideoTrack::TheoraVideoTrack(const Graphics::PixelFormat &format, th_info &theoraInfo, th_setup_info *theoraSetup) { + _theoraDecode = th_decode_alloc(&theoraInfo, theoraSetup); + + if (theoraInfo.pixel_fmt != TH_PF_420) + error("Only theora YUV420 is supported"); + + int postProcessingMax; + th_decode_ctl(_theoraDecode, TH_DECCTL_GET_PPLEVEL_MAX, &postProcessingMax, sizeof(postProcessingMax)); + th_decode_ctl(_theoraDecode, TH_DECCTL_SET_PPLEVEL, &postProcessingMax, sizeof(postProcessingMax)); + + _surface.create(theoraInfo.frame_width, theoraInfo.frame_height, format); + + // Set up a display surface + _displaySurface.pixels = _surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y); + _displaySurface.w = theoraInfo.pic_width; + _displaySurface.h = theoraInfo.pic_height; + _displaySurface.format = format; + _displaySurface.pitch = _surface.pitch; + + // Set the frame rate + _frameRate = Common::Rational(theoraInfo.fps_numerator, theoraInfo.fps_denominator); + + _endOfVideo = false; + _nextFrameStartTime = 0.0; + _curFrame = -1; +} + +TheoraDecoder::TheoraVideoTrack::~TheoraVideoTrack() { + th_decode_free(_theoraDecode); + + _surface.free(); + _displaySurface.pixels = 0; +} + +bool TheoraDecoder::TheoraVideoTrack::decodePacket(ogg_packet &oggPacket) { + if (th_decode_packetin(_theoraDecode, &oggPacket, 0) == 0) { + _curFrame++; + + // Convert YUV data to RGB data + th_ycbcr_buffer yuv; + th_decode_ycbcr_out(_theoraDecode, yuv); + translateYUVtoRGBA(yuv); + + double time = th_granule_time(_theoraDecode, oggPacket.granulepos); + + // We need to calculate when the next frame should be shown + // This is all in floating point because that's what the Ogg code gives us + // Ogg is a lossy container format, so it doesn't always list the time to the + // next frame. In such cases, we need to calculate it ourselves. + if (time == -1.0) + _nextFrameStartTime += _frameRate.getInverse().toDouble(); + else + _nextFrameStartTime = time; + + return true; + } + + return false; +} + +enum TheoraYUVBuffers { + kBufferY = 0, + kBufferU = 1, + kBufferV = 2 +}; + +void TheoraDecoder::TheoraVideoTrack::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) { + // Width and height of all buffers have to be divisible by 2. + assert((YUVBuffer[kBufferY].width & 1) == 0); + assert((YUVBuffer[kBufferY].height & 1) == 0); + assert((YUVBuffer[kBufferU].width & 1) == 0); + assert((YUVBuffer[kBufferV].width & 1) == 0); + + // UV images have to have a quarter of the Y image resolution + assert(YUVBuffer[kBufferU].width == YUVBuffer[kBufferY].width >> 1); + assert(YUVBuffer[kBufferV].width == YUVBuffer[kBufferY].width >> 1); + assert(YUVBuffer[kBufferU].height == YUVBuffer[kBufferY].height >> 1); + assert(YUVBuffer[kBufferV].height == YUVBuffer[kBufferY].height >> 1); + + Graphics::convertYUV420ToRGB(&_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride); +} + +static vorbis_info *info = 0; + +TheoraDecoder::VorbisAudioTrack::VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo) : _soundType(soundType) { + vorbis_synthesis_init(&_vorbisDSP, &vorbisInfo); + vorbis_block_init(&_vorbisDSP, &_vorbisBlock); + info = &vorbisInfo; + + _audStream = Audio::makeQueuingAudioStream(vorbisInfo.rate, vorbisInfo.channels); + + _audioBufferFill = 0; + _audioBuffer = 0; + _endOfAudio = false; +} + +TheoraDecoder::VorbisAudioTrack::~VorbisAudioTrack() { + vorbis_dsp_clear(&_vorbisDSP); + vorbis_block_clear(&_vorbisBlock); + delete _audStream; + free(_audioBuffer); +} + +Audio::AudioStream *TheoraDecoder::VorbisAudioTrack::getAudioStream() const { + return _audStream; +} + +#define AUDIOFD_FRAGSIZE 10240 + +static double rint(double v) { + return floor(v + 0.5); +} + +bool TheoraDecoder::VorbisAudioTrack::decodeSamples() { + float **pcm; + + // if there's pending, decoded audio, grab it + int ret = vorbis_synthesis_pcmout(&_vorbisDSP, &pcm); + + if (ret > 0) { + if (!_audioBuffer) { + _audioBuffer = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t)); + assert(_audioBuffer); + } + + int channels = _audStream->isStereo() ? 2 : 1; + int count = _audioBufferFill / 2; + int maxsamples = ((AUDIOFD_FRAGSIZE - _audioBufferFill) / channels) >> 1; + int i; + + for (i = 0; i < ret && i < maxsamples; i++) { + for (int j = 0; j < channels; j++) { + int val = CLIP((int)rint(pcm[j][i] * 32767.f), -32768, 32767); + _audioBuffer[count++] = val; + } + } + + vorbis_synthesis_read(&_vorbisDSP, i); + _audioBufferFill += (i * channels) << 1; + + if (_audioBufferFill == AUDIOFD_FRAGSIZE) { + byte flags = Audio::FLAG_16BITS; + + if (_audStream->isStereo()) + flags |= Audio::FLAG_STEREO; + +#ifdef SCUMM_LITTLE_ENDIAN + flags |= Audio::FLAG_LITTLE_ENDIAN; +#endif + + _audStream->queueBuffer((byte *)_audioBuffer, AUDIOFD_FRAGSIZE, DisposeAfterUse::YES, flags); + + // The audio mixer is now responsible for the old audio buffer. + // We need to create a new one. + _audioBuffer = 0; + _audioBufferFill = 0; + } + + return true; + } + + return false; +} + +bool TheoraDecoder::VorbisAudioTrack::hasAudio() const { + return _audStream->numQueuedStreams() > 0; +} + +bool TheoraDecoder::VorbisAudioTrack::needsAudio() const { + // TODO: 5 is very arbitrary. We probably should do something like QuickTime does. + return !_endOfAudio && _audStream->numQueuedStreams() < 5; +} + +void TheoraDecoder::VorbisAudioTrack::synthesizePacket(ogg_packet &oggPacket) { + if (vorbis_synthesis(&_vorbisBlock, &oggPacket) == 0) // test for success + vorbis_synthesis_blockin(&_vorbisDSP, &_vorbisBlock); +} + +void TheoraDecoder::queuePage(ogg_page *page) { + if (_hasVideo) + ogg_stream_pagein(&_theoraOut, page); + + if (_hasAudio) + ogg_stream_pagein(&_vorbisOut, page); +} + +int TheoraDecoder::bufferData() { + char *buffer = ogg_sync_buffer(&_oggSync, 4096); + int bytes = _fileStream->read(buffer, 4096); + + ogg_sync_wrote(&_oggSync, bytes); + + return bytes; +} + +bool TheoraDecoder::queueAudio() { + if (!_hasAudio) + return false; + + bool queuedAudio = false; + + for (;;) { + if (_audioTrack->decodeSamples()) { + // we queued some pending audio + queuedAudio = true; + } else if (ogg_stream_packetout(&_vorbisOut, &_oggPacket) > 0) { + // no pending audio; is there a pending packet to decode? + _audioTrack->synthesizePacket(_oggPacket); + } else { + // we've buffered all we have, break out for now + break; + } + } + + return queuedAudio; +} + +void TheoraDecoder::ensureAudioBufferSize() { + if (!_hasAudio) + return; + + // Force at least some audio to be buffered + while (_audioTrack->needsAudio()) { + bufferData(); + while (ogg_sync_pageout(&_oggSync, &_oggPage) > 0) + queuePage(&_oggPage); + + bool queuedAudio = queueAudio(); + if ((_vorbisOut.e_o_s || _fileStream->eos()) && !queuedAudio) { + _audioTrack->setEndOfAudio(); + break; + } + } +} + +} // End of namespace Video diff --git a/video/theora_decoder.h b/video/theora_decoder.h new file mode 100644 index 000000000000..7e36d829e7aa --- /dev/null +++ b/video/theora_decoder.h @@ -0,0 +1,157 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" // for USE_THEORADEC + +#ifdef USE_THEORADEC + +#ifndef VIDEO_THEORA_DECODER_H +#define VIDEO_THEORA_DECODER_H + +#include "common/rational.h" +#include "video/video_decoder.h" +#include "audio/mixer.h" +#include "graphics/surface.h" + +#include +#include + +namespace Common { +class SeekableReadStream; +} + +namespace Audio { +class AudioStream; +class QueuingAudioStream; +} + +namespace Video { + +/** + * + * Decoder for Theora videos. + * Video decoder used in engines: + * - sword25 + */ +class TheoraDecoder : public VideoDecoder { +public: + TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType); + virtual ~TheoraDecoder(); + + /** + * Load a video file + * @param stream the stream to load + */ + bool loadStream(Common::SeekableReadStream *stream); + void close(); + +protected: + void readNextPacket(); + +private: + class TheoraVideoTrack : public VideoTrack { + public: + TheoraVideoTrack(const Graphics::PixelFormat &format, th_info &theoraInfo, th_setup_info *theoraSetup); + ~TheoraVideoTrack(); + + bool endOfTrack() const { return _endOfVideo; } + uint16 getWidth() const { return _displaySurface.w; } + uint16 getHeight() const { return _displaySurface.h; } + Graphics::PixelFormat getPixelFormat() const { return _displaySurface.format; } + int getCurFrame() const { return _curFrame; } + uint32 getNextFrameStartTime() const { return (uint32)(_nextFrameStartTime * 1000); } + const Graphics::Surface *decodeNextFrame() { return &_displaySurface; } + + bool decodePacket(ogg_packet &oggPacket); + void setEndOfVideo() { _endOfVideo = true; } + + private: + int _curFrame; + bool _endOfVideo; + Common::Rational _frameRate; + double _nextFrameStartTime; + + Graphics::Surface _surface; + Graphics::Surface _displaySurface; + + th_dec_ctx *_theoraDecode; + + void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer); + }; + + class VorbisAudioTrack : public AudioTrack { + public: + VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo); + ~VorbisAudioTrack(); + + Audio::Mixer::SoundType getSoundType() const { return _soundType; } + + bool decodeSamples(); + bool hasAudio() const; + bool needsAudio() const; + void synthesizePacket(ogg_packet &oggPacket); + void setEndOfAudio() { _endOfAudio = true; } + + protected: + Audio::AudioStream *getAudioStream() const; + + private: + // single audio fragment audio buffering + int _audioBufferFill; + ogg_int16_t *_audioBuffer; + + Audio::Mixer::SoundType _soundType; + Audio::QueuingAudioStream *_audStream; + + vorbis_block _vorbisBlock; + vorbis_dsp_state _vorbisDSP; + + bool _endOfAudio; + }; + + void queuePage(ogg_page *page); + int bufferData(); + bool queueAudio(); + void ensureAudioBufferSize(); + + Common::SeekableReadStream *_fileStream; + + Audio::Mixer::SoundType _soundType; + + ogg_sync_state _oggSync; + ogg_page _oggPage; + ogg_packet _oggPacket; + + ogg_stream_state _theoraOut, _vorbisOut; + bool _hasVideo, _hasAudio; + + vorbis_info _vorbisInfo; + + TheoraVideoTrack *_videoTrack; + VorbisAudioTrack *_audioTrack; +}; + +} // End of namespace Video + +#endif + +#endif diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index 44d791765246..559880acee07 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -22,6 +22,7 @@ #include "video/video_decoder.h" +#include "audio/audiostream.h" #include "audio/mixer.h" // for kMaxChannelVolume #include "common/rational.h" @@ -33,7 +34,45 @@ namespace Video { VideoDecoder::VideoDecoder() { - reset(); + _startTime = 0; + _needsRewind = false; + _dirtyPalette = false; + _palette = 0; + _isPlaying = false; + _audioVolume = Audio::Mixer::kMaxChannelVolume; + _audioBalance = 0; + _pauseLevel = 0; + _needsUpdate = false; + _lastTimeChange = 0; + _endTime = 0; + _endTimeSet = false; + + // Find the best format for output + _defaultHighColorFormat = g_system->getScreenFormat(); + + if (_defaultHighColorFormat.bytesPerPixel == 1) + _defaultHighColorFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0); +} + +void VideoDecoder::close() { + if (isPlaying()) + stop(); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + delete *it; + + _tracks.clear(); + _needsRewind = false; + _dirtyPalette = false; + _palette = 0; + _startTime = 0; + _audioVolume = Audio::Mixer::kMaxChannelVolume; + _audioBalance = 0; + _pauseLevel = 0; + _needsUpdate = false; + _lastTimeChange = 0; + _endTime = 0; + _endTimeSet = false; } bool VideoDecoder::loadFile(const Common::String &filename) { @@ -47,30 +86,10 @@ bool VideoDecoder::loadFile(const Common::String &filename) { return loadStream(file); } -uint32 VideoDecoder::getTime() const { - return g_system->getMillis() - _startTime; -} - -void VideoDecoder::setSystemPalette() { - g_system->getPaletteManager()->setPalette(getPalette(), 0, 256); -} - bool VideoDecoder::needsUpdate() const { return !endOfVideo() && getTimeToNextFrame() == 0; } -void VideoDecoder::reset() { - _curFrame = -1; - _startTime = 0; - _pauseLevel = 0; - _audioVolume = Audio::Mixer::kMaxChannelVolume; - _audioBalance = 0; -} - -bool VideoDecoder::endOfVideo() const { - return !isVideoLoaded() || (getCurFrame() >= (int32)getFrameCount() - 1); -} - void VideoDecoder::pauseVideo(bool pause) { if (pause) { _pauseLevel++; @@ -86,10 +105,14 @@ void VideoDecoder::pauseVideo(bool pause) { if (_pauseLevel == 1 && pause) { _pauseStartTime = g_system->getMillis(); // Store the starting time from pausing to keep it for later - pauseVideoIntern(true); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + (*it)->pause(true); } else if (_pauseLevel == 0) { - pauseVideoIntern(false); - addPauseTime(g_system->getMillis() - _pauseStartTime); + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + (*it)->pause(false); + + _startTime += (g_system->getMillis() - _pauseStartTime); } } @@ -100,33 +123,560 @@ void VideoDecoder::resetPauseStartTime() { void VideoDecoder::setVolume(byte volume) { _audioVolume = volume; - updateVolume(); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)*it)->setVolume(_audioVolume); } void VideoDecoder::setBalance(int8 balance) { _audioBalance = balance; - updateBalance(); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)*it)->setBalance(_audioBalance); +} + +bool VideoDecoder::isVideoLoaded() const { + return !_tracks.empty(); +} + +uint16 VideoDecoder::getWidth() const { + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + return ((VideoTrack *)*it)->getWidth(); + + return 0; +} + +uint16 VideoDecoder::getHeight() const { + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + return ((VideoTrack *)*it)->getHeight(); + + return 0; +} + +Graphics::PixelFormat VideoDecoder::getPixelFormat() const { + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + return ((VideoTrack *)*it)->getPixelFormat(); + + return Graphics::PixelFormat(); } -uint32 FixedRateVideoDecoder::getTimeToNextFrame() const { - if (endOfVideo() || _curFrame < 0) +const Graphics::Surface *VideoDecoder::decodeNextFrame() { + _needsUpdate = false; + + readNextPacket(); + VideoTrack *track = findNextVideoTrack(); + + if (!track) + return 0; + + const Graphics::Surface *frame = track->decodeNextFrame(); + + if (track->hasDirtyPalette()) { + _palette = track->getPalette(); + _dirtyPalette = true; + } + + return frame; +} + +const byte *VideoDecoder::getPalette() { + _dirtyPalette = false; + return _palette; +} + +int VideoDecoder::getCurFrame() const { + int32 frame = -1; + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + frame += ((VideoTrack *)*it)->getCurFrame() + 1; + + return frame; +} + +uint32 VideoDecoder::getFrameCount() const { + int count = 0; + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + count += ((VideoTrack *)*it)->getFrameCount(); + + return count; +} + +uint32 VideoDecoder::getTime() const { + if (!isPlaying()) + return _lastTimeChange.msecs(); + + if (isPaused()) + return _pauseStartTime - _startTime; + + if (useAudioSync()) { + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) { + if ((*it)->getTrackType() == Track::kTrackTypeAudio && !(*it)->endOfTrack()) { + uint32 time = ((const AudioTrack *)*it)->getRunningTime(); + + if (time != 0) + return time + _lastTimeChange.msecs(); + } + } + } + + return g_system->getMillis() - _startTime; +} + +uint32 VideoDecoder::getTimeToNextFrame() const { + if (endOfVideo() || _needsUpdate) + return 0; + + const VideoTrack *track = findNextVideoTrack(); + + if (!track) return 0; uint32 elapsedTime = getTime(); - uint32 nextFrameStartTime = getFrameBeginTime(_curFrame + 1); + uint32 nextFrameStartTime = track->getNextFrameStartTime(); - // If the time that the next frame should be shown has past - // the frame should be shown ASAP. if (nextFrameStartTime <= elapsedTime) return 0; return nextFrameStartTime - elapsedTime; } -uint32 FixedRateVideoDecoder::getFrameBeginTime(uint32 frame) const { - Common::Rational beginTime = frame * 1000; - beginTime /= getFrameRate(); - return beginTime.toInt(); +bool VideoDecoder::endOfVideo() const { + if (!isVideoLoaded()) + return true; + + if (_endTimeSet) { + const VideoTrack *track = findNextVideoTrack(); + + if (track && track->getNextFrameStartTime() >= (uint)_endTime.msecs()) + return true; + } + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->endOfTrack()) + return false; + + return true; +} + +bool VideoDecoder::isRewindable() const { + if (!isVideoLoaded()) + return false; + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->isRewindable()) + return false; + + return true; +} + +bool VideoDecoder::rewind() { + if (!isRewindable()) + return false; + + _needsRewind = false; + + // Stop all tracks so they can be rewound + if (isPlaying()) + stopAudio(); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->rewind()) + return false; + + // Now that we've rewound, start all tracks again + if (isPlaying()) + startAudio(); + + _lastTimeChange = 0; + _startTime = g_system->getMillis(); + resetPauseStartTime(); + return true; +} + +bool VideoDecoder::isSeekable() const { + if (!isVideoLoaded()) + return false; + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->isSeekable()) + return false; + + return true; +} + +bool VideoDecoder::seek(const Audio::Timestamp &time) { + if (!isSeekable()) + return false; + + _needsRewind = false; + + // Stop all tracks so they can be seeked + if (isPlaying()) + stopAudio(); + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->seek(time)) + return false; + + _lastTimeChange = time; + + // Now that we've seeked, start all tracks again + // Also reset our start time + if (isPlaying()) { + startAudio(); + _startTime = g_system->getMillis() - time.msecs(); + } + + resetPauseStartTime(); + _needsUpdate = true; + return true; +} + +void VideoDecoder::start() { + if (isPlaying() || !isVideoLoaded()) + return; + + _isPlaying = true; + _startTime = g_system->getMillis(); + + // If someone previously called stop(), we'll rewind it. + if (_needsRewind) + rewind(); + + // Adjust start time if we've seeked to something besides zero time + if (_lastTimeChange.totalNumberOfFrames() != 0) + _startTime -= _lastTimeChange.msecs(); + + startAudio(); +} + +void VideoDecoder::stop() { + if (!isPlaying()) + return; + + _isPlaying = false; + _startTime = 0; + _palette = 0; + _dirtyPalette = false; + _needsUpdate = false; + + stopAudio(); + + // Also reset the pause state. + _pauseLevel = 0; + + // If this is a rewindable video, don't close it too. We'll just rewind() the video + // the next time someone calls start(). Otherwise, since it can't be rewound, we + // just close it. + if (isRewindable()) { + _lastTimeChange = getTime(); + _needsRewind = true; + } else { + close(); + } +} + +Audio::Timestamp VideoDecoder::getDuration() const { + Audio::Timestamp maxDuration(0, 1000); + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) { + Audio::Timestamp duration = (*it)->getDuration(); + + if (duration > maxDuration) + maxDuration = duration; + } + + return maxDuration; +} + +VideoDecoder::Track::Track() { + _paused = false; +} + +bool VideoDecoder::Track::isRewindable() const { + return isSeekable(); +} + +bool VideoDecoder::Track::rewind() { + return seek(Audio::Timestamp(0, 1000)); +} + +Audio::Timestamp VideoDecoder::Track::getDuration() const { + return Audio::Timestamp(0, 1000); +} + +bool VideoDecoder::VideoTrack::endOfTrack() const { + return getCurFrame() >= (getFrameCount() - 1); +} + +uint32 VideoDecoder::FixedRateVideoTrack::getNextFrameStartTime() const { + if (endOfTrack() || getCurFrame() < 0) + return 0; + + Common::Rational time = (getCurFrame() + 1) * 1000; + time /= getFrameRate(); + return time.toInt(); +} + +Audio::Timestamp VideoDecoder::FixedRateVideoTrack::getDuration() const { + // Since Audio::Timestamp doesn't support a fractional frame rate, we're currently + // just converting to milliseconds. + Common::Rational time = getFrameCount() * 1000; + time /= getFrameRate(); + return time.toInt(); +} + +bool VideoDecoder::AudioTrack::endOfTrack() const { + Audio::AudioStream *stream = getAudioStream(); + return !stream || !g_system->getMixer()->isSoundHandleActive(_handle) || stream->endOfData(); +} + +void VideoDecoder::AudioTrack::setVolume(byte volume) { + _volume = volume; + + if (g_system->getMixer()->isSoundHandleActive(_handle)) + g_system->getMixer()->setChannelVolume(_handle, _volume); +} + +void VideoDecoder::AudioTrack::setBalance(int8 balance) { + _balance = balance; + + if (g_system->getMixer()->isSoundHandleActive(_handle)) + g_system->getMixer()->setChannelBalance(_handle, _balance); +} + +void VideoDecoder::AudioTrack::start() { + stop(); + + Audio::AudioStream *stream = getAudioStream(); + assert(stream); + + g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::NO); + + // Pause the audio again if we're still paused + if (isPaused()) + g_system->getMixer()->pauseHandle(_handle, true); +} + +void VideoDecoder::AudioTrack::stop() { + g_system->getMixer()->stopHandle(_handle); +} + +void VideoDecoder::AudioTrack::start(const Audio::Timestamp &limit) { + stop(); + + Audio::AudioStream *stream = getAudioStream(); + assert(stream); + + stream = Audio::makeLimitingAudioStream(stream, limit, DisposeAfterUse::NO); + + g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::YES); + + // Pause the audio again if we're still paused + if (isPaused()) + g_system->getMixer()->pauseHandle(_handle, true); +} + +uint32 VideoDecoder::AudioTrack::getRunningTime() const { + if (g_system->getMixer()->isSoundHandleActive(_handle)) + return g_system->getMixer()->getSoundElapsedTime(_handle); + + return 0; +} + +void VideoDecoder::AudioTrack::pauseIntern(bool shouldPause) { + if (g_system->getMixer()->isSoundHandleActive(_handle)) + g_system->getMixer()->pauseHandle(_handle, shouldPause); +} + +Audio::AudioStream *VideoDecoder::RewindableAudioTrack::getAudioStream() const { + return getRewindableAudioStream(); +} + +bool VideoDecoder::RewindableAudioTrack::rewind() { + Audio::RewindableAudioStream *stream = getRewindableAudioStream(); + assert(stream); + return stream->rewind(); +} + +Audio::Timestamp VideoDecoder::SeekableAudioTrack::getDuration() const { + Audio::SeekableAudioStream *stream = getSeekableAudioStream(); + assert(stream); + return stream->getLength(); +} + +Audio::AudioStream *VideoDecoder::SeekableAudioTrack::getAudioStream() const { + return getSeekableAudioStream(); +} + +bool VideoDecoder::SeekableAudioTrack::seek(const Audio::Timestamp &time) { + Audio::SeekableAudioStream *stream = getSeekableAudioStream(); + assert(stream); + return stream->seek(time); +} + +VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack() { + _stream = 0; +} + +VideoDecoder::StreamFileAudioTrack::~StreamFileAudioTrack() { + delete _stream; +} + +bool VideoDecoder::StreamFileAudioTrack::loadFromFile(const Common::String &baseName) { + // TODO: Make sure the stream isn't being played + delete _stream; + _stream = Audio::SeekableAudioStream::openStreamFile(baseName); + return _stream != 0; +} + +void VideoDecoder::addTrack(Track *track) { + _tracks.push_back(track); + + // Update volume settings if it's an audio track + if (track->getTrackType() == Track::kTrackTypeAudio) { + ((AudioTrack *)track)->setVolume(_audioVolume); + ((AudioTrack *)track)->setBalance(_audioBalance); + } + + // Keep the track paused if we're paused + if (isPaused()) + track->pause(true); + + // Start the track if we're playing + if (isPlaying() && track->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)track)->start(); +} + +bool VideoDecoder::addStreamFileTrack(const Common::String &baseName) { + // Only allow adding external tracks if a video is already loaded + if (!isVideoLoaded()) + return false; + + StreamFileAudioTrack *track = new StreamFileAudioTrack(); + + bool result = track->loadFromFile(baseName); + + if (result) + addTrack(track); + + return result; +} + +void VideoDecoder::setEndTime(const Audio::Timestamp &endTime) { + Audio::Timestamp startTime = 0; + + if (isPlaying()) { + startTime = getTime(); + stopAudio(); + } + + _endTime = endTime; + _endTimeSet = true; + + if (startTime > endTime) + return; + + if (isPlaying()) { + // We'll assume the audio track is going to start up at the same time it just was + // and therefore not do any seeking. + // Might want to set it anyway if we're seekable. + startAudioLimit(_endTime.msecs() - startTime.msecs()); + _lastTimeChange = startTime; + } +} + +VideoDecoder::Track *VideoDecoder::getTrack(uint track) { + if (track > _tracks.size()) + return 0; + + return _tracks[track]; +} + +const VideoDecoder::Track *VideoDecoder::getTrack(uint track) const { + if (track > _tracks.size()) + return 0; + + return _tracks[track]; +} + +bool VideoDecoder::endOfVideoTracks() const { + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack()) + return false; + + return true; +} + +VideoDecoder::VideoTrack *VideoDecoder::findNextVideoTrack() { + VideoTrack *bestTrack = 0; + uint32 bestTime = 0xFFFFFFFF; + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) { + if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack()) { + VideoTrack *track = (VideoTrack *)*it; + uint32 time = track->getNextFrameStartTime(); + + if (time < bestTime) { + bestTime = time; + bestTrack = track; + } + } + } + + return bestTrack; +} + +const VideoDecoder::VideoTrack *VideoDecoder::findNextVideoTrack() const { + const VideoTrack *bestTrack = 0; + uint32 bestTime = 0xFFFFFFFF; + + for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++) { + if ((*it)->getTrackType() == Track::kTrackTypeVideo && !(*it)->endOfTrack()) { + const VideoTrack *track = (const VideoTrack *)*it; + uint32 time = track->getNextFrameStartTime(); + + if (time < bestTime) { + bestTime = time; + bestTrack = track; + } + } + } + + return bestTrack; +} + +void VideoDecoder::startAudio() { + if (_endTimeSet) { + // HACK: Timestamp's subtraction asserts out when subtracting two times + // with different rates. + startAudioLimit(_endTime - _lastTimeChange.convertToFramerate(_endTime.framerate())); + return; + } + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)*it)->start(); +} + +void VideoDecoder::stopAudio() { + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)*it)->stop(); +} + +void VideoDecoder::startAudioLimit(const Audio::Timestamp &limit) { + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AudioTrack *)*it)->start(limit); } } // End of namespace Video diff --git a/video/video_decoder.h b/video/video_decoder.h index 3bb75ade09d8..5abe1d917c2c 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -23,10 +23,17 @@ #ifndef VIDEO_DECODER_H #define VIDEO_DECODER_H -#include "common/str.h" - +#include "audio/mixer.h" #include "audio/timestamp.h" // TODO: Move this to common/ ? +#include "common/array.h" +#include "common/str.h" +#include "graphics/pixelformat.h" +namespace Audio { +class AudioStream; +class RewindableAudioStream; +class SeekableAudioStream; +} namespace Common { class Rational; @@ -34,7 +41,6 @@ class SeekableReadStream; } namespace Graphics { -struct PixelFormat; struct Surface; } @@ -48,10 +54,14 @@ class VideoDecoder { VideoDecoder(); virtual ~VideoDecoder() {} + ///////////////////////////////////////// + // Opening/Closing a Video + ///////////////////////////////////////// + /** * Load a video from a file with the given name. * - * A default implementation using loadStream is provided. + * A default implementation using Common::File and loadStream is provided. * * @param filename the filename to load * @return whether loading the file succeeded @@ -62,6 +72,10 @@ class VideoDecoder { * Load a video from a generic read stream. The ownership of the * stream object transfers to this VideoDecoder instance, which is * hence also responsible for eventually deleting it. + * + * Implementations of this function are required to call addTrack() + * for each track in the video upon success. + * * @param stream the stream to load * @return whether loading the stream succeeded */ @@ -69,60 +83,133 @@ class VideoDecoder { /** * Close the active video stream and free any associated resources. + * + * All subclasses that need to close their own resources should still + * call the base class' close() function at the start of their function. */ - virtual void close() = 0; + virtual void close(); /** * Returns if a video stream is currently loaded or not. */ - virtual bool isVideoLoaded() const = 0; + bool isVideoLoaded() const; + ///////////////////////////////////////// + // Playback Control + ///////////////////////////////////////// /** - * Returns the width of the video's frames. - * @return the width of the video's frames + * Begin playback of the video. + * + * @note This has no effect is the video is already playing. */ - virtual uint16 getWidth() const = 0; + void start(); /** - * Returns the height of the video's frames. - * @return the height of the video's frames + * Stop playback of the video. + * + * @note This will close() the video if it is not rewindable. + * @note If the video is rewindable, the video will be rewound on the + * next start() call unless rewind() or seek() is called before then. */ - virtual uint16 getHeight() const = 0; + void stop(); /** - * Get the pixel format of the currently loaded video. + * Returns if the video is currently playing or not. + * + * This is not equivalent to the inverse of endOfVideo(). A video keeps + * its playing status even after reaching the end of the video. This will + * return true after calling start() and will continue to return true + * until stop() (or close()) is called. */ - virtual Graphics::PixelFormat getPixelFormat() const = 0; + bool isPlaying() const { return _isPlaying; } /** - * Get the palette for the video in RGB format (if 8bpp or less). + * Returns if a video is rewindable or not. The default implementation + * polls each track for rewindability. */ - virtual const byte *getPalette() { return 0; } + virtual bool isRewindable() const; /** - * Returns if the palette is dirty or not. + * Rewind a video to its beginning. + * + * If the video is playing, it will continue to play. The default + * implementation will rewind each track. + * + * @return true on success, false otherwise + */ + virtual bool rewind(); + + /** + * Returns if a video is seekable or not. The default implementation + * polls each track for seekability. + */ + virtual bool isSeekable() const; + + /** + * Seek to a given time in the video. + * + * If the video is playing, it will continue to play. The default + * implementation will seek each track and must still be called + * from any other implementation. + * + * @param time The time to seek to + * @return true on success, false otherwise */ - virtual bool hasDirtyPalette() const { return false; } + virtual bool seek(const Audio::Timestamp &time); /** - * Set the system palette to the palette returned by getPalette. - * @see getPalette + * Pause or resume the video. This should stop/resume any audio playback + * and other stuff. The initial pause time is kept so that any timing + * variables can be updated appropriately. + * + * This is a convenience method which automatically keeps track on how + * often the video has been paused, ensuring that after pausing an video + * e.g. twice, it has to be unpaused twice before actuallying resuming. + * + * @param pause true to pause the video, false to resume it */ - void setSystemPalette(); + void pauseVideo(bool pause); + + /** + * Return whether the video is currently paused or not. + */ + bool isPaused() const { return _pauseLevel != 0; } + + /** + * Set the time for this video to end at. At this time in the video, + * all audio will stop and endOfVideo() will return true. + */ + void setEndTime(const Audio::Timestamp &endTime); + + /** + * Get the stop time of the video (if not set, zero) + */ + Audio::Timestamp getEndTime() const { return _endTime; } + + + ///////////////////////////////////////// + // Playback Status + ///////////////////////////////////////// + + /** + * Returns if the video has reached the end or not. + * @return true if the video has finished playing or if none is loaded, false otherwise + */ + bool endOfVideo() const; /** * Returns the current frame number of the video. * @return the last frame decoded by the video */ - virtual int32 getCurFrame() const { return _curFrame; } + int32 getCurFrame() const; /** * Returns the number of frames in the video. * @return the number of frames in the video */ - virtual uint32 getFrameCount() const = 0; + uint32 getFrameCount() const; /** * Returns the time position (in ms) of the current video. @@ -138,103 +225,456 @@ class VideoDecoder { * completely accurate (since our mixer does not have precise * timing). */ - virtual uint32 getTime() const; + uint32 getTime() const; + + + ///////////////////////////////////////// + // Video Info + ///////////////////////////////////////// + + /** + * Returns the width of the video's frames. + * + * By default, this finds the largest width between all of the loaded + * tracks. However, a subclass may override this if it does any kind + * of post-processing on it. + * + * @return the width of the video's frames + */ + virtual uint16 getWidth() const; + + /** + * Returns the height of the video's frames. + * + * By default, this finds the largest height between all of the loaded + * tracks. However, a subclass may override this if it does any kind + * of post-processing on it. + * + * @return the height of the video's frames + */ + virtual uint16 getHeight() const; + + /** + * Get the pixel format of the currently loaded video. + */ + Graphics::PixelFormat getPixelFormat() const; + + /** + * Get the duration of the video. + * + * If the duration is unknown, this will return 0. If this is not + * overriden, it will take the length of the longest track. + */ + virtual Audio::Timestamp getDuration() const; + + + ///////////////////////////////////////// + // Frame Decoding + ///////////////////////////////////////// + + /** + * Get the palette for the video in RGB format (if 8bpp or less). + * + * The palette's format is the same as PaletteManager's palette + * (interleaved RGB values). + */ + const byte *getPalette(); + + /** + * Returns if the palette is dirty or not. + */ + bool hasDirtyPalette() const { return _dirtyPalette; } /** * Return the time (in ms) until the next frame should be displayed. */ - virtual uint32 getTimeToNextFrame() const = 0; + uint32 getTimeToNextFrame() const; /** * Check whether a new frame should be decoded, i.e. because enough * time has elapsed since the last frame was decoded. * @return whether a new frame should be decoded or not */ - virtual bool needsUpdate() const; + bool needsUpdate() const; /** * Decode the next frame into a surface and return the latter. + * + * A subclass may override this, but must still call this function. As an + * example, a subclass may do this to apply some global video scale to + * individual track's frame. + * + * Note that this will call readNextPacket() internally first before calling + * the next video track's decodeNextFrame() function. + * * @return a surface containing the decoded frame, or 0 * @note Ownership of the returned surface stays with the VideoDecoder, * hence the caller must *not* free it. * @note this may return 0, in which case the last frame should be kept on screen */ - virtual const Graphics::Surface *decodeNextFrame() = 0; - - /** - * Returns if the video has finished playing or not. - * @return true if the video has finished playing or if none is loaded, false otherwise - */ - virtual bool endOfVideo() const; + virtual const Graphics::Surface *decodeNextFrame(); /** - * Pause or resume the video. This should stop/resume any audio playback - * and other stuff. The initial pause time is kept so that any timing - * variables can be updated appropriately. + * Set the default high color format for videos that convert from YUV. * - * This is a convenience method which automatically keeps track on how - * often the video has been paused, ensuring that after pausing an video - * e.g. twice, it has to be unpaused twice before actuallying resuming. + * By default, VideoDecoder will attempt to use the screen format + * if it's >8bpp and use a 32bpp format when not. * - * @param pause true to pause the video, false to resume it + * This must be set before calling loadStream(). */ - void pauseVideo(bool pause); + void setDefaultHighColorFormat(const Graphics::PixelFormat &format) { _defaultHighColorFormat = format; } - /** - * Return whether the video is currently paused or not. - */ - bool isPaused() const { return _pauseLevel != 0; } + + ///////////////////////////////////////// + // Audio Control + ///////////////////////////////////////// /** * Get the current volume at which the audio in the video is being played * @return the current volume at which the audio in the video is being played */ - virtual byte getVolume() const { return _audioVolume; } + byte getVolume() const { return _audioVolume; } /** * Set the volume at which the audio in the video should be played. - * This setting remains until reset() is called (which may be called - * from loadStream() or close()). The default volume is the maximum. - * - * @note This function calls updateVolume() by default. + * This setting remains until close() is called (which may be called + * from loadStream()). The default volume is the maximum. * * @param volume The volume at which to play the audio in the video */ - virtual void setVolume(byte volume); + void setVolume(byte volume); /** * Get the current balance at which the audio in the video is being played * @return the current balance at which the audio in the video is being played */ - virtual int8 getBalance() const { return _audioBalance; } + int8 getBalance() const { return _audioBalance; } /** * Set the balance at which the audio in the video should be played. - * This setting remains until reset() is called (which may be called - * from loadStream() or close()). The default balance is 0. - * - * @note This function calls updateBalance() by default. + * This setting remains until close() is called (which may be called + * from loadStream()). The default balance is 0. * * @param balance The balance at which to play the audio in the video */ - virtual void setBalance(int8 balance); + void setBalance(int8 balance); + + /** + * Add an audio track from a stream file. + * + * This calls SeekableAudioStream::openStreamFile() internally + */ + bool addStreamFileTrack(const Common::String &baseName); + + + // Future API + //void setRate(const Common::Rational &rate); + //Common::Rational getRate() const; protected: /** - * Resets _curFrame and _startTime. Should be called from every close() function. + * An abstract representation of a track in a movie. + */ + class Track { + public: + Track(); + virtual ~Track() {} + + /** + * The types of tracks this class can be. + */ + enum TrackType { + kTrackTypeNone, + kTrackTypeVideo, + kTrackTypeAudio + }; + + /** + * Get the type of track. + */ + virtual TrackType getTrackType() const = 0; + + /** + * Return if the track has finished. + */ + virtual bool endOfTrack() const = 0; + + /** + * Return if the track is rewindable. + * + * If a video is seekable, it does not need to implement this + * for it to also be rewindable. + */ + virtual bool isRewindable() const; + + /** + * Rewind the video to the beginning. + * + * If a video is seekable, it does not need to implement this + * for it to also be rewindable. + * + * @return true on success, false otherwise. + */ + virtual bool rewind(); + + /** + * Return if the track is seekable. + */ + virtual bool isSeekable() const { return false; } + + /** + * Seek to the given time. + * @param time The time to seek to, from the beginning of the video. + * @return true on success, false otherwise. + */ + virtual bool seek(const Audio::Timestamp &time) { return false; } + + /** + * Set the pause status of the track. + */ + void pause(bool shouldPause) {} + + /** + * Return if the track is paused. + */ + bool isPaused() const { return _paused; } + + /** + * Get the duration of the track (starting from this track's start time). + * + * By default, this returns 0 for unknown. + */ + virtual Audio::Timestamp getDuration() const; + + protected: + /** + * Function called by pause() for subclasses to implement. + */ + void pauseIntern(bool pause); + + private: + bool _paused; + }; + + /** + * An abstract representation of a video track. + */ + class VideoTrack : public Track { + public: + VideoTrack() {} + virtual ~VideoTrack() {} + + TrackType getTrackType() const { return kTrackTypeVideo; } + virtual bool endOfTrack() const; + + /** + * Get the width of this track + */ + virtual uint16 getWidth() const = 0; + + /** + * Get the height of this track + */ + virtual uint16 getHeight() const = 0; + + /** + * Get the pixel format of this track + */ + virtual Graphics::PixelFormat getPixelFormat() const = 0; + + /** + * Get the current frame of this track + * + * @see VideoDecoder::getCurFrame() + */ + virtual int getCurFrame() const = 0; + + /** + * Get the frame count of this track + * + * @note If the frame count is unknown, return 0 (which is also + * the default implementation of the function). However, one must + * also implement endOfTrack() in that case. + */ + virtual int getFrameCount() const { return 0; } + + /** + * Get the start time of the next frame in milliseconds since + * the start of the video + */ + virtual uint32 getNextFrameStartTime() const = 0; + + /** + * Decode the next frame + */ + virtual const Graphics::Surface *decodeNextFrame() = 0; + + /** + * Get the palette currently in use by this track + */ + virtual const byte *getPalette() const { return 0; } + + /** + * Does the palette currently in use by this track need to be updated? + */ + virtual bool hasDirtyPalette() const { return false; } + }; + + /** + * A VideoTrack that is played at a constant rate. + * + * If the frame count is unknown, you must override endOfTrack(). + */ + class FixedRateVideoTrack : public VideoTrack { + public: + FixedRateVideoTrack() {} + virtual ~FixedRateVideoTrack() {} + + uint32 getNextFrameStartTime() const; + virtual Audio::Timestamp getDuration() const; + + protected: + /** + * Get the rate at which this track is played. + */ + virtual Common::Rational getFrameRate() const = 0; + }; + + /** + * An abstract representation of an audio track. */ - void reset(); + class AudioTrack : public Track { + public: + AudioTrack() {} + virtual ~AudioTrack() {} + + TrackType getTrackType() const { return kTrackTypeAudio; } + + virtual bool endOfTrack() const; + + /** + * Start playing this track + */ + void start(); + + /** + * Stop playing this track + */ + void stop(); + + void start(const Audio::Timestamp &limit); + + /** + * Get the volume for this track + */ + byte getVolume() const { return _volume; } + + /** + * Set the volume for this track + */ + void setVolume(byte volume); + + /** + * Get the balance for this track + */ + int8 getBalance() const { return _balance; } + + /** + * Set the balance for this track + */ + void setBalance(int8 balance); + + /** + * Get the time the AudioStream behind this track has been + * running + */ + uint32 getRunningTime() const; + + /** + * Get the sound type to be used when playing this audio track + */ + virtual Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kPlainSoundType; } + + protected: + void pauseIntern(bool pause); + + /** + * Get the AudioStream that is the representation of this AudioTrack + */ + virtual Audio::AudioStream *getAudioStream() const = 0; + + private: + Audio::SoundHandle _handle; + byte _volume; + int8 _balance; + }; /** - * Actual implementation of pause by subclasses. See pause() - * for details. + * An AudioTrack that implements isRewindable() and rewind() using + * RewindableAudioStream. */ - virtual void pauseVideoIntern(bool pause) {} + class RewindableAudioTrack : public AudioTrack { + public: + RewindableAudioTrack() {} + virtual ~RewindableAudioTrack() {} + + bool isRewindable() const { return true; } + bool rewind(); + + protected: + Audio::AudioStream *getAudioStream() const; + + /** + * Get the RewindableAudioStream pointer to be used by this class + * for rewind() and getAudioStream() + */ + virtual Audio::RewindableAudioStream *getRewindableAudioStream() const = 0; + }; /** - * Add the time the video has been paused to maintain sync + * An AudioTrack that implements isSeekable() and seek() using + * SeekableAudioStream. */ - virtual void addPauseTime(uint32 ms) { _startTime += ms; } + class SeekableAudioTrack : public AudioTrack { + public: + SeekableAudioTrack() {} + virtual ~SeekableAudioTrack() {} + + bool isSeekable() const { return true; } + bool seek(const Audio::Timestamp &time); + + Audio::Timestamp getDuration() const; + + protected: + Audio::AudioStream *getAudioStream() const; + + /** + * Get the SeekableAudioStream pointer to be used by this class + * for seek(), getDuration(), and getAudioStream() + */ + virtual Audio::SeekableAudioStream *getSeekableAudioStream() const = 0; + }; + + /** + * A SeekableAudioTrack that constructs its SeekableAudioStream using + * SeekableAudioStream::openStreamFile() + */ + class StreamFileAudioTrack : public SeekableAudioTrack { + public: + StreamFileAudioTrack(); + ~StreamFileAudioTrack(); + + /** + * Load the track from a file with the given base name. + * + * @return true on success, false otherwise + */ + bool loadFromFile(const Common::String &baseName); + + protected: + Audio::SeekableAudioStream *_stream; + Audio::SeekableAudioStream *getSeekableAudioStream() const { return _stream; } + }; /** * Reset the pause start time (which should be called when seeking) @@ -242,79 +682,107 @@ class VideoDecoder { void resetPauseStartTime(); /** - * Update currently playing audio tracks with the new volume setting + * Decode enough data for the next frame and enough audio to last that long. + * + * This function is used by the decodeNextFrame() function. A subclass + * of a Track may decide to just have its decodeNextFrame() function read + * and decode the frame. */ - virtual void updateVolume() {} + virtual void readNextPacket() {} /** - * Update currently playing audio tracks with the new balance setting + * Define a track to be used by this class. + * + * The pointer is then owned by this base class. */ - virtual void updateBalance() {} + void addTrack(Track *track); - int32 _curFrame; - int32 _startTime; + /** + * Whether or not getTime() will sync with a playing audio track. + * + * A subclass can override this to disable this feature. + */ + virtual bool useAudioSync() const { return true; } -private: - uint32 _pauseLevel; - uint32 _pauseStartTime; - byte _audioVolume; - int8 _audioBalance; -}; + /** + * Get the given track based on its index. + * + * @return A valid track pointer on success, 0 otherwise + */ + Track *getTrack(uint track); -/** - * A VideoDecoder wrapper that implements getTimeToNextFrame() based on getFrameRate(). - */ -class FixedRateVideoDecoder : public virtual VideoDecoder { -public: - uint32 getTimeToNextFrame() const; + /** + * Get the given track based on its index + * + * @return A valid track pointer on success, 0 otherwise + */ + const Track *getTrack(uint track) const; -protected: /** - * Return the frame rate in frames per second. - * This returns a Rational because videos can have rates that are not integers and - * there are some videos with frame rates < 1. + * Find out if all video tracks have finished + * + * This is useful if one wants to figure out if they need to buffer all + * remaining audio in a file. */ - virtual Common::Rational getFrameRate() const = 0; + bool endOfVideoTracks() const; -private: - uint32 getFrameBeginTime(uint32 frame) const; -}; + /** + * Get the default high color format + */ + Graphics::PixelFormat getDefaultHighColorFormat() const { return _defaultHighColorFormat; } -/** - * A VideoDecoder that can be rewound back to the beginning. - */ -class RewindableVideoDecoder : public virtual VideoDecoder { -public: /** - * Rewind to the beginning of the video. + * Find the video track with the lowest start time for the next frame */ - virtual void rewind() = 0; -}; + VideoTrack *findNextVideoTrack(); -/** - * A VideoDecoder that can seek to a frame or point in time. - */ -class SeekableVideoDecoder : public virtual RewindableVideoDecoder { -public: /** - * Seek to the specified time. + * Find the video track with the lowest start time for the next frame */ - virtual void seekToTime(const Audio::Timestamp &time) = 0; + const VideoTrack *findNextVideoTrack() const; /** - * Seek to the specified time (in ms). + * Typedef helpers for accessing tracks */ - void seekToTime(uint32 msecs) { seekToTime(Audio::Timestamp(msecs, 1000)); } + typedef Common::Array TrackList; + typedef TrackList::iterator TrackListIterator; /** - * Implementation of RewindableVideoDecoder::rewind(). + * Get the begin iterator of the tracks */ - virtual void rewind() { seekToTime(0); } + TrackListIterator getTrackListBegin() { return _tracks.begin(); } /** - * Get the total duration of the video (in ms). + * Get the end iterator of the tracks */ - virtual uint32 getDuration() const = 0; + TrackListIterator getTrackListEnd() { return _tracks.end(); } + +private: + // Tracks owned by this VideoDecoder + TrackList _tracks; + + // Current playback status + bool _isPlaying, _needsRewind, _needsUpdate; + Audio::Timestamp _lastTimeChange, _endTime; + bool _endTimeSet; + + // Palette settings from individual tracks + mutable bool _dirtyPalette; + const byte *_palette; + + // Default PixelFormat settings + Graphics::PixelFormat _defaultHighColorFormat; + + // Internal helper functions + void stopAudio(); + void startAudio(); + void startAudioLimit(const Audio::Timestamp &limit); + + int32 _startTime; + uint32 _pauseLevel; + uint32 _pauseStartTime; + byte _audioVolume; + int8 _audioBalance; }; } // End of namespace Video