[Scummvm-cvs-logs] SF.net SVN: scummvm:[47202] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Jan 9 19:18:52 CET 2010
Revision: 47202
http://scummvm.svn.sourceforge.net/scummvm/?rev=47202&view=rev
Author: m_kiewitz
Date: 2010-01-09 18:18:52 +0000 (Sat, 09 Jan 2010)
Log Message:
-----------
SCI: adding audio support to kPortrait, audio is now playing when portraits are shown
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/gui.cpp
scummvm/trunk/engines/sci/graphics/gui.h
scummvm/trunk/engines/sci/graphics/portrait.cpp
scummvm/trunk/engines/sci/graphics/portrait.h
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp 2010-01-09 14:09:45 UTC (rev 47201)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp 2010-01-09 18:18:52 UTC (rev 47202)
@@ -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 @@
}
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;
}
Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h 2010-01-09 14:09:45 UTC (rev 47201)
+++ scummvm/trunk/engines/sci/graphics/gui.h 2010-01-09 18:18:52 UTC (rev 47202)
@@ -54,7 +54,7 @@
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 @@
virtual int getControlPicNotValid();
WindowMgr *_windowMgr;
+ AudioPlayer *_audio;
SciGuiAnimate *_animate;
Controls *_controls;
Menu *_menu;
Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-01-09 14:09:45 UTC (rev 47201)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-01-09 18:18:52 UTC (rev 47202)
@@ -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 @@
// 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);
Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h 2010-01-09 14:09:45 UTC (rev 47201)
+++ scummvm/trunk/engines/sci/graphics/portrait.h 2010-01-09 18:18:52 UTC (rev 47202)
@@ -30,9 +30,10 @@
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 @@
ResourceManager *_resMan;
Screen *_screen;
SciPalette *_palette;
+ AudioPlayer *_audio;
Common::String _resourceName;
Common::String _fileName;
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-01-09 14:09:45 UTC (rev 47201)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-01-09 18:18:52 UTC (rev 47202)
@@ -149,7 +149,7 @@
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...");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list