~ubuntu-branches/ubuntu/raring/scummvm/raring

« back to all changes in this revision

Viewing changes to engines/sword1/animation.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Moritz Muehlenhoff
  • Date: 2011-05-25 19:02:23 UTC
  • mto: (21.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20110525190223-fiqm0oaec714xk31
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * along with this program; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 *
21
 
 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-2-1/engines/sword1/animation.cpp $
22
 
 * $Id: animation.cpp 49154 2010-05-23 11:16:10Z eriktorbjorn $
 
21
 * $URL$
 
22
 * $Id$
23
23
 *
24
24
 */
25
25
 
26
26
#include "common/file.h"
 
27
#include "common/events.h"
 
28
#include "common/keyboard.h"
 
29
#include "common/textconsole.h"
27
30
#include "sword1/sword1.h"
28
31
#include "sword1/animation.h"
29
32
#include "sword1/text.h"
30
 
#include "sound/decoders/vorbis.h"
31
33
 
32
 
#include "common/config-manager.h"
33
 
#include "common/endian.h"
34
34
#include "common/str.h"
35
35
#include "common/system.h"
 
36
#include "graphics/palette.h"
36
37
#include "graphics/surface.h"
37
38
 
38
39
#include "gui/message.h"
66
67
// Basic movie player
67
68
///////////////////////////////////////////////////////////////////////////////
68
69
 
69
 
MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Graphics::VideoDecoder *decoder, DecoderType decoderType)
 
70
MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType)
70
71
        : _vm(vm), _textMan(textMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) {
71
72
        _bgSoundStream = NULL;
72
73
        _decoderType = decoderType;
77
78
}
78
79
 
79
80
MoviePlayer::~MoviePlayer() {
 
81
        delete _bgSoundHandle;
80
82
        delete _decoder;
81
 
        delete _bgSoundHandle;
82
83
}
83
84
 
84
85
/**
174
175
        // previous location would be momentarily drawn, before switching to
175
176
        // the new one. Work around this by setting the palette to black.
176
177
 
177
 
        byte pal[4 * 256];
 
178
        byte pal[3 * 256];
178
179
        memset(pal, 0, sizeof(pal));
179
 
        _system->setPalette(pal, 0, 256);
 
180
        _system->getPaletteManager()->setPalette(pal, 0, 256);
180
181
}
181
182
 
182
183
void MoviePlayer::performPostProcessing(byte *screen) {
252
253
 
253
254
        while (!_vm->shouldQuit() && !_decoder->endOfVideo()) {
254
255
                if (_decoder->needsUpdate()) {
255
 
                        Graphics::Surface *frame = _decoder->decodeNextFrame();
 
256
                        const Graphics::Surface *frame = _decoder->decodeNextFrame();
256
257
                        if (frame)
257
258
                                _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
258
259
 
264
265
                                uint32 weight;
265
266
                                byte r, g, b;
266
267
                                
267
 
                                byte *palette = _decoder->getPalette();
 
268
                                const byte *palette = _decoder->getPalette();
268
269
 
269
270
                                for (int i = 0; i < 256; i++) {
270
271
                                        r = *palette++;
318
319
        if (_mixer->isSoundHandleActive(*_bgSoundHandle))
319
320
                return _mixer->getSoundElapsedTime(*_bgSoundHandle);
320
321
 
321
 
        return VideoDecoder::getElapsedTime();
 
322
        return DXADecoder::getElapsedTime();
322
323
}
323
324
 
324
325
///////////////////////////////////////////////////////////////////////////////
333
334
        snprintf(filename, sizeof(filename), "%s.smk", sequenceList[id]);
334
335
 
335
336
        if (Common::File::exists(filename)) {
336
 
                Graphics::SmackerDecoder *smkDecoder = new Graphics::SmackerDecoder(snd);
 
337
                Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd);
337
338
                return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
338
339
        }
339
340