From 6b98c4c4e7a23089a6cccba573a1c3afd909f52d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 18:24:20 +0000 Subject: Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code) svn-id: r42488 --- engines/kyra/saveload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index a1aaf77d51..83230d6e3b 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -126,7 +126,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab } } - return (in->ioFailed() ? kRSHEIoError : kRSHENoError); + return ((in->err() || in->eos()) ? kRSHEIoError : kRSHENoError); } Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) { -- cgit v1.2.3 From 59b35ff5fbb00b47b473c8d0c5ff670bd500e347 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Jul 2009 22:47:33 +0000 Subject: Fix graphics glitch in LoL PC98 intro. svn-id: r42493 --- engines/kyra/script_lol.cpp | 4 ++-- engines/kyra/script_tim.cpp | 10 ++++++++-- engines/kyra/sequences_lol.cpp | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 611ad8f9ef..e4b77f6a07 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2345,8 +2345,8 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { int h2 = (h1 * factor) / 100; anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0); - _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo ? 0 : 8, 0); - if (!_flags.isDemo) + _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo && _flags.platform != Common::kPlatformPC98 ? 0 : 8, 0); + if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98) _screen->checkedPageUpdate(8, 4); _screen->updateScreen(); diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index bc62e5bd6a..731b8d206f 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -98,7 +98,10 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys _textDisplayed = false; _textAreaBuffer = new uint8[320*40]; assert(_textAreaBuffer); - _drawPage2 = (_vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL) ? 0 : 8; + if ((_vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().isDemo) && _vm->gameFlags().gameID == GI_LOL) + _drawPage2 = 0; + else + _drawPage2 = 8; _palDelayInc = _palDiff = _palDelayAcc = 0; _abortFlag = 0; @@ -461,7 +464,10 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char anim->wsaCopyParams = wsaFlags; const bool isLoLDemo = _vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL; - _drawPage2 = (isLoLDemo || _currentTim->isLoLOutro) ? 0 : 8; + if (isLoLDemo || _vm->gameFlags().platform == Common::kPlatformPC98 || _currentTim->isLoLOutro) + _drawPage2 = 0; + else + _drawPage2 = 8; uint16 wsaOpenFlags = 0; if (isLoLDemo) { diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index beea129f66..5826b2b09e 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -224,7 +224,7 @@ void LoLEngine::showIntro() { while (!_tim->finished() && !shouldQuit() && !skipFlag()) { updateInput(); _tim->exec(intro, false); - if (!_flags.isDemo) + if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98) _screen->checkedPageUpdate(8, 4); if (_tim->_palDiff) { -- cgit v1.2.3 From 6b3c3a8a12d9ef7caa316f63d62f92c0ed606881 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 15:51:47 +0000 Subject: Bugfix: Disallow GMM Save/Load while in kyragem scene. svn-id: r42507 --- engines/kyra/kyra_lok.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index e5ca52abcc..a3a249de18 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -434,7 +434,7 @@ void KyraEngine_LoK::mainLoop() { // FIXME: Why is this here? _screen->showMouse(); - int inputFlag = checkInput(_buttonList, true); + int inputFlag = checkInput(_buttonList, _currentCharacter->sceneId != 210); removeInputTop(); updateMousePointer(); -- cgit v1.2.3 From 572b0e6c03ba17f91cb2e0d257939ecf7cbc0eaf Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 21:47:57 +0000 Subject: Fix bug in "KyraEngine_v2::runSceneScript6", fixes text line Zanthia says, when picking up the spellbook page in the town. svn-id: r42543 --- engines/kyra/scene_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index 9ffaf5515d..3def71a076 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -73,7 +73,7 @@ void KyraEngine_v2::runSceneScript6() { _sceneScriptState.regs[0] = _mainCharacter.sceneId; _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; - _sceneScriptState.regs[3] = _itemInHand; + _sceneScriptState.regs[4] = _itemInHand; _emc->start(&_sceneScriptState, 6); while (_emc->isValid(&_sceneScriptState)) -- cgit v1.2.3 From 799af694f0945cce3cebd729dd10e12f2a9c4510 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 13:35:56 +0000 Subject: Replace LGPL header by GPL header. svn-id: r42563 --- engines/kyra/sound_pcspk.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/sound_pcspk.cpp b/engines/kyra/sound_pcspk.cpp index 22c24bf56c..2afed22a80 100644 --- a/engines/kyra/sound_pcspk.cpp +++ b/engines/kyra/sound_pcspk.cpp @@ -1,25 +1,22 @@ -/* - * 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. +/* ScummVM - Graphic Adventure Engine * - * LGPL License + * 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 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * 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 library is distributed in the hope that it will be useful, + * 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 - * Lesser General Public License for more details. + * 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 Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * 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. * * $URL$ * $Id$ -- cgit v1.2.3 From c353e5389b98cc3d7753aa7bcb5b07d7efc4de0b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 13:50:59 +0000 Subject: - Moved SoundAdlibPC definition to new header file sound_adlib.h - Made the future versions of sound.h GPL only - sound_adlib.h is dual licensed under GPL and LGPL (so AdPlug can still benefit from future changes) svn-id: r42564 --- engines/kyra/sound.h | 20 +------- engines/kyra/sound_adlib.h | 113 ++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/sound_intern.h | 65 ++----------------------- 3 files changed, 118 insertions(+), 80 deletions(-) create mode 100644 engines/kyra/sound_adlib.h (limited to 'engines/kyra') diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index f393ae15ba..263cd586f7 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -8,32 +8,16 @@ * 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. * - * LGPL License - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - - * This library 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * * $URL$ * $Id$ * diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h new file mode 100644 index 0000000000..f384113af7 --- /dev/null +++ b/engines/kyra/sound_adlib.h @@ -0,0 +1,113 @@ +/* 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. + * + * LGPL License + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * $URL$ + * $Id$ + * + */ + +#ifndef KYRA_SOUND_ADLIB_H +#define KYRA_SOUND_ADLIB_H + +#include "kyra/sound.h" + +#include "common/mutex.h" + +namespace Kyra { +class AdlibDriver; + +/** + * AdLib implementation of the sound output device. + * + * It uses a special sound file format special to + * Dune II, Kyrandia 1 and 2. While Dune II and + * Kyrandia 1 are using exact the same format, the + * one of Kyrandia 2 slightly differs. + * + * See AdlibDriver for more information. + * @see AdlibDriver + */ +class SoundAdlibPC : public Sound { +public: + SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer); + ~SoundAdlibPC(); + + kType getMusicType() const { return kAdlib; } + + bool init(); + void process(); + + void loadSoundFile(uint file); + void loadSoundFile(Common::String file); + + void playTrack(uint8 track); + void haltTrack(); + bool isPlaying(); + + void playSoundEffect(uint8 track); + + void beginFadeOut(); +private: + void internalLoadFile(Common::String file); + + void play(uint8 track); + + void unk1(); + void unk2(); + + AdlibDriver *_driver; + + bool _v2; + uint8 _trackEntries[500]; + uint8 *_soundDataPtr; + int _sfxPlayingSound; + + Common::String _soundFileLoaded; + + uint8 _sfxPriority; + uint8 _sfxFourthByteOfSong; + + int _numSoundTriggers; + const int *_soundTriggers; + + static const int _kyra1NumSoundTriggers; + static const int _kyra1SoundTriggers[]; +}; + +} // end of namespace Kyra + +#endif + diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index 8792c14815..975672b76a 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -8,12 +8,12 @@ * 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. @@ -27,6 +27,7 @@ #define KYRA_SOUND_INTERN_H #include "kyra/sound.h" +#include "kyra/sound_adlib.h" #include "common/mutex.h" @@ -39,66 +40,6 @@ class PCSpeaker; } // end of namespace Audio namespace Kyra { -class AdlibDriver; - -/** - * AdLib implementation of the sound output device. - * - * It uses a special sound file format special to - * Dune II, Kyrandia 1 and 2. While Dune II and - * Kyrandia 1 are using exact the same format, the - * one of Kyrandia 2 slightly differs. - * - * See AdlibDriver for more information. - * @see AdlibDriver - */ -class SoundAdlibPC : public Sound { -public: - SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer); - ~SoundAdlibPC(); - - kType getMusicType() const { return kAdlib; } - - bool init(); - void process(); - - void loadSoundFile(uint file); - void loadSoundFile(Common::String file); - - void playTrack(uint8 track); - void haltTrack(); - bool isPlaying(); - - void playSoundEffect(uint8 track); - - void beginFadeOut(); -private: - void internalLoadFile(Common::String file); - - void play(uint8 track); - - void unk1(); - void unk2(); - - AdlibDriver *_driver; - - bool _v2; - uint8 _trackEntries[500]; - uint8 *_soundDataPtr; - int _sfxPlayingSound; - - Common::String _soundFileLoaded; - - uint8 _sfxPriority; - uint8 _sfxFourthByteOfSong; - - int _numSoundTriggers; - const int *_soundTriggers; - - static const int _kyra1NumSoundTriggers; - static const int _kyra1SoundTriggers[]; -}; - class MidiOutput; /** -- cgit v1.2.3 From 53756ef1d022a959b24c041e18f55eef34e60dd3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 14:05:22 +0000 Subject: Cleanup. svn-id: r42565 --- engines/kyra/kyra_v1.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 80872877d5..258d0c402f 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -115,7 +115,6 @@ Common::Error KyraEngine_v1::init() { _sound = new SoundTownsPC98_v2(this, _mixer); } else if (midiDriver == MD_ADLIB) { _sound = new SoundAdlibPC(this, _mixer); - assert(_sound); } else { Sound::kType type; @@ -126,7 +125,6 @@ Common::Error KyraEngine_v1::init() { else type = Sound::kMidiGM; - MidiDriver *driver = 0; if (midiDriver == MD_PCSPK) { @@ -151,9 +149,10 @@ Common::Error KyraEngine_v1::init() { assert(adlib); _sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib); - assert(_sound); } } + + assert(_sound); } if (_sound) -- cgit v1.2.3