diff options
-rw-r--r-- | engines/sci/graphics/gui.cpp | 8 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.h | 4 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 2 |
5 files changed, 21 insertions, 8 deletions
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index eaf1fd4ac1..a5e9442478 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -44,11 +44,12 @@ #include "sci/graphics/text.h" #include "sci/graphics/transitions.h" #include "sci/graphics/view.h" +#include "sci/sound/audio.h" namespace Sci { -SciGui::SciGui(EngineState *state, Screen *screen, SciPalette *palette, Cursor *cursor) - : _s(state), _screen(screen), _palette(palette), _cursor(cursor) { +SciGui::SciGui(EngineState *state, Screen *screen, SciPalette *palette, Cursor *cursor, AudioPlayer *audio) + : _s(state), _screen(screen), _palette(palette), _cursor(cursor), _audio(audio) { _gfx = new Gfx(_s->resMan, _s->_segMan, _s->_kernel, _screen, _palette); _transitions = new Transitions(this, _screen, _palette, _s->resMan->isVGA()); @@ -850,12 +851,13 @@ reg_t SciGui::portraitLoad(Common::String resourceName) { } void SciGui::portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq) { - Portrait *myPortrait = new Portrait(_s->resMan, _screen, _palette, resourceName); + Portrait *myPortrait = new Portrait(_s->resMan, _screen, _palette, _audio, resourceName); // TODO: cache portraits // adjust given coordinates to curPort (but dont adjust coordinates on upscaledHires_Save_Box and give us hires coordinates // on kDrawCel, yeah this whole stuff makes sense) position.x += _gfx->GetPort()->left; position.y += _gfx->GetPort()->top; position.x *= 2; position.y *= 2; + myPortrait->setupAudio(resourceNum, noun, verb, cond, seq); myPortrait->draw(position); delete myPortrait; } diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index a42ae2fee5..d456b2cf0b 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -54,7 +54,7 @@ class Transitions; class SciGui { public: - SciGui(EngineState *s, Screen *screen, SciPalette *palette, Cursor *cursor); + SciGui(EngineState *s, Screen *screen, SciPalette *palette, Cursor *cursor, AudioPlayer *audio); SciGui(); virtual ~SciGui(); @@ -185,6 +185,7 @@ private: virtual int getControlPicNotValid(); WindowMgr *_windowMgr; + AudioPlayer *_audio; SciGuiAnimate *_animate; Controls *_controls; Menu *_menu; diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index ec445b3b89..6cea167e4c 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -32,11 +32,12 @@ #include "sci/graphics/screen.h" #include "sci/graphics/palette.h" #include "sci/graphics/portrait.h" +#include "sci/sound/audio.h" namespace Sci { -Portrait::Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, Common::String resourceName) - : _resMan(resMan), _screen(screen), _palette(palette), _resourceName(resourceName) { +Portrait::Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName) + : _resMan(resMan), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) { init(); } @@ -107,6 +108,13 @@ void Portrait::init() { // TODO: Read animation bitmaps } +void Portrait::setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) { + uint32 number = ((noun & 0xff) << 24) | ((verb & 0xff) << 16) | ((cond & 0xff) << 8) | (seq & 0xff); + + _audio->stopAudio(); + _audio->startAudio(resourceId, number); +} + void Portrait::draw(Common::Point position) { byte *data = _mainBitmapData; _palette->set(&_portraitPalette, 1); diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h index 41c4bfef72..847ed9f2dc 100644 --- a/engines/sci/graphics/portrait.h +++ b/engines/sci/graphics/portrait.h @@ -30,9 +30,10 @@ namespace Sci { class Portrait { public: - Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, Common::String resourceName); + Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName); ~Portrait(); + void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq); void draw(Common::Point position); private: @@ -41,6 +42,7 @@ private: ResourceManager *_resMan; Screen *_screen; SciPalette *_palette; + AudioPlayer *_audio; Common::String _resourceName; Common::String _fileName; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 4205f9bdf1..17fb5962bb 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -149,7 +149,7 @@ Common::Error SciEngine::run() { if (script_init_engine(_gamestate)) return Common::kUnknownError; - _gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor); + _gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor, _audio); if (game_init(_gamestate)) { /* Initialize */ warning("Game initialization failed: Aborting..."); |