Esempio n. 1
0
AVISurface::AVISurface(const CResourceKey &key) {
	_videoSurface = nullptr;
	_streamCount = 0;
	_movieFrameSurface[0] = _movieFrameSurface[1] = nullptr;

	// Reset current frame. We need to keep track of frames separately from the decoders,
	// since it needs to be able to go beyond the frame count or to negative to allow
	// correct detection of when range playbacks have finished
	_currentFrame = -1;
	_isReversed = false;

	// Create a decoder for the audio (if any) and primary video track
	_decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect);
	if (!_decoders[0]->loadFile(key.getString()))
		error("Could not open video - %s", key.getString().c_str());

	_streamCount = 1;

	// Create a decoder for any secondary video track
	AVIDecoder *decoder2 = new AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect);
	if (decoder2->loadFile(key.getString())) {
		_decoders[1] = decoder2;
		++_streamCount;
	} else {
		delete decoder2;
		_decoders[1] = nullptr;
	}
}
Esempio n. 2
0
AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) {
	_videoSurface = nullptr;
	_streamCount = 0;
	_movieFrameSurface[0] = _movieFrameSurface[1] = nullptr;
	_framePixels = nullptr;
	_priorFrameTime = 0;

	// Reset current frame. We need to keep track of frames separately from the decoder,
	// since it needs to be able to go beyond the frame count or to negative to allow
	// correct detection of when range playbacks have finished
	_currentFrame = -1;
	_priorFrame = -1;
	_isReversed = false;

	// Create a decoder
	_decoder = new AVIDecoder(Audio::Mixer::kPlainSoundType);
	if (!_decoder->loadFile(_movieName))
		error("Could not open video - %s", key.getString().c_str());

	_streamCount = _decoder->videoTrackCount();

	_soundManager = nullptr;
	_hasAudio = false;
	_frameRate = 0.0;
}
Esempio n. 3
0
void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) {
	delete _movie;
	_movie = nullptr;

	CResourceKey movieKey = (oldRoom == newRoom) ? oldRoom->getTransitionMovieKey() :
		oldRoom->getExitMovieKey();
	CString filename = movieKey.exists();
	if (g_vm->_filesManager->fileExists(filename)) {
		_movieSurface->freeSurface();
		_movie = g_vm->_movieManager.createMovie(filename, _movieSurface);
	}
}
Esempio n. 4
0
void CMouseCursor::loadCursorImages() {
	const CResourceKey key("ycursors.avi");
	g_vm->_filesManager->fn4(key.getString());

	// Iterate through getting each cursor
	for (int idx = 0; idx < NUM_CURSORS; ++idx) {
		assert(CURSOR_DATA[idx][0] == (idx + 1));
		_cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2],
			CURSOR_DATA[idx][3]);

		// Create the surface
		CVideoSurface *surface = _screenManager->createSurface(64, 64);
		_cursors[idx]._videoSurface = surface;

		// Open the cursors video and move to the given frame
		OSMovie movie(key, surface);
		movie.setFrame(idx);
		
		Graphics::ManagedSurface *frameSurface = movie.duplicateFrame();
		_cursors[idx]._frameSurface = frameSurface;
		surface->setMovieFrameSurface(frameSurface);
	}
}