From 4819468d9ad8218d04a2e4563ef71d7d00964515 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 28 Jun 2012 00:07:29 +0200 Subject: GOB: Add PreGob stubs for the Once Upon A Time games --- engines/gob/pregob/pregob.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 engines/gob/pregob/pregob.cpp (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp new file mode 100644 index 0000000000..ab47adaac6 --- /dev/null +++ b/engines/gob/pregob/pregob.cpp @@ -0,0 +1,35 @@ +/* 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/pregob/pregob.h" + +namespace Gob { + +PreGob::PreGob(GobEngine *vm) : _vm(vm) { +} + +PreGob::~PreGob() { +} + +} // End of namespace Gob -- cgit v1.2.3 From 8b19e10104a98a95963ad2ee97b255d6804e7fdd Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 28 Jun 2012 03:38:27 +0200 Subject: GOB: Add some generic PreGob graphics functions --- engines/gob/pregob/pregob.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index ab47adaac6..aea290214c 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -21,15 +21,73 @@ */ #include "gob/gob.h" +#include "gob/global.h" +#include "gob/util.h" +#include "gob/palanim.h" +#include "gob/draw.h" +#include "gob/video.h" #include "gob/pregob/pregob.h" namespace Gob { -PreGob::PreGob(GobEngine *vm) : _vm(vm) { +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); +} + } // End of namespace Gob -- cgit v1.2.3 From 27782700a5631a25129b12779abb540a906f6a96 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 28 Jun 2012 17:45:02 +0200 Subject: GOB: Add some PreGob and Once Upon A Time cursor functions --- engines/gob/pregob/pregob.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index aea290214c..18aac50352 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -20,9 +20,12 @@ * */ +#include "graphics/cursorman.h" + #include "gob/gob.h" #include "gob/global.h" #include "gob/util.h" +#include "gob/surface.h" #include "gob/palanim.h" #include "gob/draw.h" #include "gob/video.h" @@ -90,4 +93,48 @@ void PreGob::setPalette(const byte *palette, uint16 size) { _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(); +} + } // End of namespace Gob -- cgit v1.2.3 From 83896dea3edc3bcfb1e414b61644c7ca266e1cce Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 28 Jun 2012 21:25:54 +0200 Subject: GOB: Add PreGob input/event utility functions --- engines/gob/pregob/pregob.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 18aac50352..1c3fb8221c 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -137,4 +137,48 @@ bool PreGob::isCursorVisible() const { return CursorMan.isVisible(); } +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); +} + } // End of namespace Gob -- cgit v1.2.3 From 412ae53854dc2ef352a3f3e990f0d2b56d97ad7e Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 29 Jun 2012 19:34:14 +0200 Subject: GOB: Add PreGob animation utility functions --- engines/gob/pregob/pregob.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 1c3fb8221c..b9c36d7cf8 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -29,6 +29,7 @@ #include "gob/palanim.h" #include "gob/draw.h" #include "gob/video.h" +#include "gob/aniobject.h" #include "gob/pregob/pregob.h" @@ -181,4 +182,24 @@ bool PreGob::hasInput() { return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone); } +void PreGob::clearAnim(ANIObject &ani) { + int16 left, top, right, bottom; + + if (ani.clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); +} + +void PreGob::drawAnim(ANIObject &ani) { + int16 left, top, right, bottom; + + if (ani.draw(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + ani.advance(); +} + +void PreGob::redrawAnim(ANIObject &ani) { + clearAnim(ani); + drawAnim(ani); +} + } // End of namespace Gob -- cgit v1.2.3 From 4b3aa88c8aaaec4f13435c46a7a3cf4ef00a08df Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 30 Jun 2012 00:41:55 +0200 Subject: GOB: Add a simple class for PreGob TXT files --- engines/gob/pregob/pregob.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index b9c36d7cf8..98b1a2e6b8 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -26,6 +26,7 @@ #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" @@ -202,4 +203,16 @@ void PreGob::redrawAnim(ANIObject &ani) { drawAnim(ani); } +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; + + return txt; +} + } // End of namespace Gob -- cgit v1.2.3 From 139b03c4bcafea260e79e3e83db897c71db41907 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 30 Jun 2012 01:23:21 +0200 Subject: GOB: Add a PreGob method to get a localized file name --- engines/gob/pregob/pregob.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 98b1a2e6b8..582ebc6677 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -34,6 +34,8 @@ #include "gob/pregob/pregob.h" +static char kLanguageSuffix[5] = { 't', 'g', 'a', 'e', 'i' }; + namespace Gob { PreGob::PreGob(GobEngine *vm) : _vm(vm), _fadedOut(false) { @@ -203,6 +205,13 @@ void PreGob::redrawAnim(ANIObject &ani) { drawAnim(ani); } +Common::String PreGob::getLocFile(const Common::String &file) const { + if (_vm->_global->_language >= ARRAYSIZE(kLanguageSuffix)) + return file; + + return file + kLanguageSuffix[_vm->_global->_language]; +} + TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) const { Common::SeekableReadStream *txtStream = _vm->_dataIO->getFile(txtFile); if (!txtStream) -- cgit v1.2.3 From 34cf81a4b614dee5f2657bf24d9f867165e6ced9 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 1 Jul 2012 03:45:09 +0200 Subject: GOB: Add some PreGob sound utility functions --- engines/gob/pregob/pregob.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 582ebc6677..9c6cfb717a 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -32,6 +32,8 @@ #include "gob/video.h" #include "gob/aniobject.h" +#include "gob/sound/sound.h" + #include "gob/pregob/pregob.h" static char kLanguageSuffix[5] = { 't', 'g', 'a', 'e', 'i' }; @@ -141,6 +143,39 @@ 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++) { + int32 size; + byte *data = _vm->_dataIO->getFile(sounds[i], size); + + if (!data || !_sounds[i].load(SOUND_SND, data, size)) { + delete data; + + warning("PreGob::loadSounds(): Failed to load sound \"%s\"", sounds[i]); + continue; + } + } +} + +void PreGob::freeSounds() { + _sounds.clear(); +} + +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::endFrame(bool doInput) { _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); -- cgit v1.2.3 From 4663ab2373ac3230ccb95cc2accee87ddd1682b8 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 1 Jul 2012 15:55:02 +0200 Subject: GOB: Fix some broken German text in Once Upon A Time --- engines/gob/pregob/pregob.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 9c6cfb717a..f94f990f76 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -256,7 +256,12 @@ TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) delete txtStream; + fixTXTStrings(*txt); + return txt; } +void PreGob::fixTXTStrings(TXTFile &txt) const { +} + } // End of namespace Gob -- cgit v1.2.3 From 9e997fea1be0c3f7cd8af7ee0f145879d5c49882 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 2 Jul 2012 00:09:43 +0200 Subject: GOB: Add "long" PreGob language suffixes --- engines/gob/pregob/pregob.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index f94f990f76..f39a7a112e 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -36,10 +36,13 @@ #include "gob/pregob/pregob.h" -static char kLanguageSuffix[5] = { 't', 'g', 'a', 'e', 'i' }; 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) { } @@ -241,10 +244,10 @@ void PreGob::redrawAnim(ANIObject &ani) { } Common::String PreGob::getLocFile(const Common::String &file) const { - if (_vm->_global->_language >= ARRAYSIZE(kLanguageSuffix)) + if (_vm->_global->_language >= ARRAYSIZE(kLanguageSuffixShort)) return file; - return file + kLanguageSuffix[_vm->_global->_language]; + return file + kLanguageSuffixShort[_vm->_global->_language]; } TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) const { -- cgit v1.2.3 From 9d564ecd268781d8b92ca7a5895aa10aea6b4e52 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 2 Jul 2012 00:10:23 +0200 Subject: GOB: Implement the animal names bit Once Upon A Time --- engines/gob/pregob/pregob.cpp | 50 +++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index f39a7a112e..675958035d 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -151,23 +151,28 @@ void PreGob::loadSounds(const char * const *sounds, uint soundCount) { _sounds.resize(soundCount); - for (uint i = 0; i < soundCount; i++) { - int32 size; - byte *data = _vm->_dataIO->getFile(sounds[i], size); - - if (!data || !_sounds[i].load(SOUND_SND, data, size)) { - delete data; - - warning("PreGob::loadSounds(): Failed to load sound \"%s\"", sounds[i]); - continue; - } - } + 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 { + int32 size; + byte *data = _vm->_dataIO->getFile(file, size); + + if (!data || !sound.load(SOUND_SND, data, size)) { + delete data; + + warning("PreGob::loadSound(): Failed to load sound \"%s\"", file.c_str()); + return false; + } + + return true; +} + void PreGob::playSound(uint sound, int16 frequency, int16 repCount) { if (sound >= _sounds.size()) return; @@ -179,6 +184,29 @@ 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::endFrame(bool doInput) { _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); -- cgit v1.2.3 From df18bc95834837f1f905bfe5613ffd43dfc908f9 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 2 Jul 2012 21:31:23 +0200 Subject: GOB: Implement parts of the Once Upon A Time end sequence We don't yet support GCT files, so texts are still missing. --- engines/gob/pregob/pregob.cpp | 62 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 675958035d..4ee5430de7 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -251,24 +251,70 @@ bool PreGob::hasInput() { return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone); } -void PreGob::clearAnim(ANIObject &ani) { +void PreGob::clearAnim(ANIObject &anim) { int16 left, top, right, bottom; - if (ani.clear(*_vm->_draw->_backSurface, 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 &ani) { +void PreGob::drawAnim(ANIObject &anim) { int16 left, top, right, bottom; - if (ani.draw(*_vm->_draw->_backSurface, left, top, right, bottom)) + if (anim.draw(*_vm->_draw->_backSurface, left, top, right, bottom)) _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); - ani.advance(); + anim.advance(); } -void PreGob::redrawAnim(ANIObject &ani) { - clearAnim(ani); - drawAnim(ani); +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 { -- cgit v1.2.3 From e17d4a5c0c66b890014efa62d207406fd5b887ef Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 7 Jul 2012 13:21:07 +0200 Subject: GOB: Implement GCT drawing --- engines/gob/pregob/pregob.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 4ee5430de7..033eea89f2 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -35,6 +35,7 @@ #include "gob/sound/sound.h" #include "gob/pregob/pregob.h" +#include "gob/pregob/gctfile.h" namespace Gob { @@ -341,4 +342,16 @@ TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) 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 -- cgit v1.2.3 From 9c32fd2360d9fa18ceac6fefc571c6610965d361 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 8 Jul 2012 00:46:24 +0200 Subject: GOB: Add PreGob::beep() --- engines/gob/pregob/pregob.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 033eea89f2..42b5a8fb9c 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -208,6 +208,10 @@ void PreGob::playSoundFile(const Common::String &file, int16 frequency, int16 re stopSound(); } +void PreGob::beep(int16 frequency, int32 length) { + _vm->_sound->speakerOn(frequency, length); +} + void PreGob::endFrame(bool doInput) { _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); -- cgit v1.2.3 From 25bc7467b444d78c64300af9786f08842de81313 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 8 Jul 2012 22:25:51 +0200 Subject: GOB: Use Sound::sampleLoad in PreGob --- engines/gob/pregob/pregob.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'engines/gob/pregob/pregob.cpp') diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 42b5a8fb9c..54eb3c6795 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -161,17 +161,7 @@ void PreGob::freeSounds() { } bool PreGob::loadSound(SoundDesc &sound, const Common::String &file) const { - int32 size; - byte *data = _vm->_dataIO->getFile(file, size); - - if (!data || !sound.load(SOUND_SND, data, size)) { - delete data; - - warning("PreGob::loadSound(): Failed to load sound \"%s\"", file.c_str()); - return false; - } - - return true; + return _vm->_sound->sampleLoad(&sound, SOUND_SND, file.c_str()); } void PreGob::playSound(uint sound, int16 frequency, int16 repCount) { -- cgit v1.2.3