scummvm/engines/icb/movie_pc.h
2020-06-28 08:54:42 +02:00

173 lines
4.3 KiB
C++

/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1999-2000 Revolution Software Ltd.
* This code is based on source code created by Revolution Software,
* used with permission.
*
* 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.
*
*/
#ifndef __MOVIE_PC_H__
#define __MOVIE_PC_H__
#ifdef _PSX
#error "Movie_pc.h only for pc builds"
#endif
#include "engines/icb/common/px_rccommon.h"
#ifdef _MSC_VER
// NOTE: The second of these warnings does not get re-enabled due to it's nature
#pragma warning(disable : 4201) // Warning C4201: nonstandard extension used : nameless struct/union
#pragma warning(disable : 4514) // Warning C4514: unreferenced inline function has been removed
#endif
// The main Bink include for handling bink sequence files (extension 'bik')
#if defined(_WIN32) && defined(ENABLE_BINK)
#include "../BinkSDK/bink.h"
#else
#include "bink_stub.h"
#endif
#ifdef _MSC_VER
// Turn this warning back on now that Bink is included and happy
#pragma warning(default : 4201)
#endif
// For access to surface_manager
#include "global_objects_pc.h"
// For access to DirectSound includes
#include "engines/icb/sound/direct_sound.h"
// So we can control the game sound state
#include "sound.h"
#include "video/bink_decoder.h"
namespace ICB {
// Return codes for SequenceManager::DrawFrame()
#define JUSTFINE 0x0000
#define WAITING 0x0010
#define FINISHED 0x0020
#define NOMOVIE 0x0030
#define FADING 0x0040
// Our global bink handler for movies
class MovieManager;
extern MovieManager *g_theSequenceManager;
class SequenceManager {
private:
HBINK m_binkObject;
uint32 m_x; // X offset in screen
uint32 m_y; // Y offset in screen
uint32 m_flags; // Surface type
uint32 m_fadeCounter;
uint32 m_fadeRate;
bool8 m_loop;
bool8 m_haveFaded;
bool8 m_haveClearedScreen;
bool8 m_rater;
bool8 m_mission1intro;
uint32 m_endAtFrame;
public:
SequenceManager();
~SequenceManager();
bool8 Register(const char *fileName, bool8 fade, bool8 loop, uint32 flags = 0);
uint32 GetMovieHeight();
uint32 GetMovieWidth();
uint32 GetMovieFrames();
bool8 Busy();
uint32 DrawFrame(uint32 surface_id = working_buffer_id);
int GetFrameNumber();
void SetRate();
void SetEndFrame(uint32 f) { m_endAtFrame = f; }
void SetVolume(int32 vol);
void Kill();
private:
void FadeScreen(uint32 surface_id);
};
class MovieManager {
Video::BinkDecoder *_binkDecoder;
int _x;
int _y;
public:
MovieManager() : _x(0), _y(0) {
_binkDecoder = new Video::BinkDecoder();
_binkDecoder->setDefaultHighColorFormat(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
};
~MovieManager() { delete _binkDecoder; };
bool registerMovie(const char *fileName, bool8 fade, bool8 loop);
uint32 getMovieHeight() {
if (!busy())
return 0;
return _binkDecoder->getHeight();
};
uint32 getMovieWidth() {
if (!busy())
return 0;
return _binkDecoder->getWidth();
};
uint32 getMovieFrames() {
if (!busy())
return 0;
return _binkDecoder->getFrameCount();
};
bool busy() { return _binkDecoder->isPlaying(); }
uint32 drawFrame(uint32 surface_id = working_buffer_id);
int getFrameNumber() {
if (!busy())
return 0;
return _binkDecoder->getCurFrame();
};
void setRate() { warning("TODO: setRate"); }
void setEndFrame(uint32 f) { warning("TODO: setEndFrame"); }
void setVolume(int32 vol) { warning("TODO: setVolume"); }
void kill() { _binkDecoder->close(); }
private:
void fadeScreen(uint32 surface_id) {}
};
} // End of namespace ICB
#endif