Initial commit
This commit is contained in:
347
engines/chewy/video/cfo_decoder.cpp
Normal file
347
engines/chewy/video/cfo_decoder.cpp
Normal file
@@ -0,0 +1,347 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/system.h"
|
||||
#include "engines/engine.h"
|
||||
#include "graphics/paletteman.h"
|
||||
#include "video/flic_decoder.h"
|
||||
#include "chewy/globals.h"
|
||||
#include "chewy/sound.h"
|
||||
#include "chewy/video/cfo_decoder.h"
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
enum CustomSubChunk {
|
||||
kChunkFadeIn = 0, // unused
|
||||
kChunkFadeOut = 1,
|
||||
kChunkLoadMusic = 2,
|
||||
kChunkLoadRaw = 3, // unused
|
||||
kChunkLoadVoc = 4,
|
||||
kChunkPlayMusic = 5,
|
||||
kChunkPlaySeq = 6, // unused
|
||||
kChunkPlayPattern = 7, // unused
|
||||
kChunkStopMusic = 8,
|
||||
kChunkWaitMusicEnd = 9,
|
||||
kChunkSetMusicVolume = 10,
|
||||
kChunkSetLoopMode = 11, // unused
|
||||
kChunkPlayRaw = 12, // unused
|
||||
kChunkPlayVoc = 13,
|
||||
kChunkSetSoundVolume = 14,
|
||||
kChunkSetChannelVolume = 15,
|
||||
kChunkFreeSoundEffect = 16,
|
||||
kChunkMusicFadeIn = 17, // unused
|
||||
kChunkMusicFadeOut = 18,
|
||||
kChunkSetBalance = 19,
|
||||
kChunkSetSpeed = 20, // unused
|
||||
kChunkClearScreen = 21
|
||||
};
|
||||
|
||||
bool CfoDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||
close();
|
||||
|
||||
if (stream->readUint32BE() != MKTAG('C', 'F', 'O', '\0'))
|
||||
error("Corrupt video resource");
|
||||
|
||||
stream->readUint32LE(); // always 0
|
||||
|
||||
uint16 frameCount = stream->readUint16LE();
|
||||
uint16 width = stream->readUint16LE();
|
||||
uint16 height = stream->readUint16LE();
|
||||
|
||||
addTrack(new CfoVideoTrack(stream, frameCount, width, height, _sound, _disposeMusic));
|
||||
return true;
|
||||
}
|
||||
|
||||
CfoDecoder::CfoVideoTrack::CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound, bool disposeMusic) :
|
||||
Video::FlicDecoder::FlicVideoTrack(stream, frameCount, width, height, true), _sound(sound), _disposeMusic(disposeMusic) {
|
||||
readHeader();
|
||||
|
||||
for (int i = 0; i < MAX_SOUND_EFFECTS; i++) {
|
||||
_soundEffects[i] = nullptr;
|
||||
_soundEffectSize[i] = 0;
|
||||
}
|
||||
|
||||
_musicData = nullptr;
|
||||
_musicSize = 0;
|
||||
|
||||
Common::fill(_sfxBalances, _sfxBalances + ARRAYSIZE(_sfxBalances), 63);
|
||||
_sfxGlobalVolume = 63;
|
||||
_musicVolume = 63;
|
||||
}
|
||||
|
||||
CfoDecoder::CfoVideoTrack::~CfoVideoTrack() {
|
||||
// Stop all sound effects.
|
||||
_sound->stopAllSounds();
|
||||
|
||||
for (int i = 0; i < MAX_SOUND_EFFECTS; i++) {
|
||||
delete[] _soundEffects[i];
|
||||
}
|
||||
|
||||
// Only stop music if it is included in the video data.
|
||||
if (_musicData) {
|
||||
if (_disposeMusic)
|
||||
_sound->stopMusic();
|
||||
delete[] _musicData;
|
||||
_musicData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CfoDecoder::CfoVideoTrack::readHeader() {
|
||||
_frameDelay = _startFrameDelay = _fileStream->readUint32LE();
|
||||
_offsetFrame1 = _fileStream->readUint32LE();
|
||||
_offsetFrame2 = 0; // doesn't exist, as CFO videos aren't rewindable
|
||||
|
||||
_fileStream->seek(_offsetFrame1);
|
||||
}
|
||||
|
||||
#define FRAME_TYPE 0xF1FA
|
||||
#define CUSTOM_FRAME_TYPE 0xFAF1
|
||||
|
||||
const Graphics::Surface *CfoDecoder::CfoVideoTrack::decodeNextFrame() {
|
||||
uint16 frameType;
|
||||
|
||||
// Read chunk
|
||||
/*uint32 frameSize =*/ _fileStream->readUint32LE();
|
||||
frameType = _fileStream->readUint16LE();
|
||||
|
||||
switch (frameType) {
|
||||
case FRAME_TYPE:
|
||||
handleFrame();
|
||||
break;
|
||||
case CUSTOM_FRAME_TYPE:
|
||||
handleCustomFrame();
|
||||
break;
|
||||
default:
|
||||
error("CfoDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
|
||||
break;
|
||||
}
|
||||
|
||||
_curFrame++;
|
||||
_nextFrameStartTime += _frameDelay;
|
||||
|
||||
return _surface;
|
||||
}
|
||||
|
||||
#define FLI_SETPAL 4
|
||||
#define FLI_SS2 7
|
||||
#define FLI_BRUN 15
|
||||
#define FLI_COPY 16
|
||||
#define PSTAMP 18
|
||||
|
||||
void CfoDecoder::CfoVideoTrack::handleFrame() {
|
||||
uint16 chunkCount = _fileStream->readUint16LE();
|
||||
|
||||
// Read subchunks
|
||||
for (uint32 i = 0; i < chunkCount; ++i) {
|
||||
uint32 frameSize = _fileStream->readUint32LE();
|
||||
uint16 frameType = _fileStream->readUint16LE();
|
||||
uint8 *data = new uint8[frameSize - 6];
|
||||
_fileStream->read(data, frameSize - 6);
|
||||
|
||||
switch (frameType) {
|
||||
case FLI_SETPAL:
|
||||
unpackPalette(data);
|
||||
_dirtyPalette = true;
|
||||
break;
|
||||
case FLI_SS2:
|
||||
decodeDeltaFLC(data);
|
||||
break;
|
||||
case FLI_BRUN:
|
||||
decodeByteRun(data);
|
||||
break;
|
||||
case FLI_COPY:
|
||||
copyFrame(data);
|
||||
break;
|
||||
case PSTAMP:
|
||||
/* PSTAMP - skip for now */
|
||||
break;
|
||||
default:
|
||||
error("CfoDecoder::decodeNextFrame(): unknown subchunk type (type = 0x%02X)", frameType);
|
||||
break;
|
||||
}
|
||||
|
||||
delete[] data;
|
||||
}
|
||||
}
|
||||
|
||||
void CfoDecoder::CfoVideoTrack::handleCustomFrame() {
|
||||
uint16 chunkCount = _fileStream->readUint16LE();
|
||||
|
||||
uint16 number, channel, volume, repeat, balance;
|
||||
|
||||
// Read subchunks
|
||||
for (uint32 i = 0; i < chunkCount; ++i) {
|
||||
uint32 frameSize = _fileStream->readUint32LE();
|
||||
uint16 frameType = _fileStream->readUint16LE();
|
||||
uint16 musicLoops = 0;
|
||||
|
||||
switch (frameType) {
|
||||
case kChunkFadeIn:
|
||||
error("Unused chunk kChunkFadeIn found");
|
||||
break;
|
||||
case kChunkFadeOut:
|
||||
// Used in video 0
|
||||
_fileStream->skip(2); // delay, unused
|
||||
fadeOut();
|
||||
break;
|
||||
case kChunkLoadMusic:
|
||||
// Used in videos 0, 18, 34, 71
|
||||
_musicSize = frameSize;
|
||||
_musicData = new uint8[frameSize];
|
||||
_fileStream->read(_musicData, frameSize);
|
||||
break;
|
||||
case kChunkLoadRaw:
|
||||
error("Unused chunk kChunkLoadRaw found");
|
||||
break;
|
||||
case kChunkLoadVoc:
|
||||
number = _fileStream->readUint16LE();
|
||||
assert(number < MAX_SOUND_EFFECTS);
|
||||
delete[] _soundEffects[number];
|
||||
|
||||
_soundEffectSize[number] = frameSize - 2;
|
||||
_soundEffects[number] = new uint8[frameSize - 2];
|
||||
_fileStream->read(_soundEffects[number], frameSize - 2);
|
||||
break;
|
||||
case kChunkPlayMusic:
|
||||
// Used in videos 0, 18, 34, 71
|
||||
_sound->playMusic(_musicData, _musicSize, _musicVolume);
|
||||
break;
|
||||
case kChunkPlaySeq:
|
||||
error("Unused chunk kChunkPlaySeq found");
|
||||
break;
|
||||
case kChunkPlayPattern:
|
||||
error("Unused chunk kChunkPlayPattern found");
|
||||
break;
|
||||
case kChunkStopMusic:
|
||||
_sound->stopMusic();
|
||||
|
||||
// Game videos do not restart music after stopping it
|
||||
delete[] _musicData;
|
||||
_musicData = nullptr;
|
||||
_musicSize = 0;
|
||||
break;
|
||||
case kChunkWaitMusicEnd:
|
||||
do {
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {} // ignore events
|
||||
g_system->updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
// Await 100 loops (about 1 sec)
|
||||
musicLoops++;
|
||||
} while (_sound->isMusicActive() && musicLoops < 100);
|
||||
break;
|
||||
case kChunkSetMusicVolume:
|
||||
volume = _fileStream->readUint16LE();
|
||||
|
||||
_musicVolume = volume;
|
||||
_sound->setActiveMusicVolume(volume);
|
||||
break;
|
||||
case kChunkSetLoopMode:
|
||||
error("Unused chunk kChunkSetLoopMode found");
|
||||
break;
|
||||
case kChunkPlayRaw:
|
||||
error("Unused chunk kChunkPlayRaw found");
|
||||
break;
|
||||
case kChunkPlayVoc:
|
||||
number = _fileStream->readUint16LE();
|
||||
channel = _fileStream->readUint16LE();
|
||||
volume = _fileStream->readUint16LE();
|
||||
repeat = _fileStream->readUint16LE();
|
||||
assert(number < MAX_SOUND_EFFECTS);
|
||||
|
||||
// Repeat is the number of times the sound should be repeated, so
|
||||
// 0 means play once, 1 twice etc. 255 means repeat until stopped.
|
||||
_sound->playSound(_soundEffects[number], _soundEffectSize[number], channel, repeat == 255 ? 0 : repeat + 1,
|
||||
volume * _sfxGlobalVolume / 63, _sfxBalances[channel], DisposeAfterUse::NO);
|
||||
break;
|
||||
case kChunkSetSoundVolume:
|
||||
volume = _fileStream->readUint16LE();
|
||||
assert(volume >= 0 && volume < 64);
|
||||
_sfxGlobalVolume = volume;
|
||||
// This is only used once in the credits video, before any sounds
|
||||
// are played, so no need to update volume of active sounds.
|
||||
break;
|
||||
case kChunkSetChannelVolume:
|
||||
channel = _fileStream->readUint16LE();
|
||||
volume = _fileStream->readUint16LE();
|
||||
|
||||
_sound->setSoundChannelVolume(channel, volume * _sfxGlobalVolume / 63);
|
||||
break;
|
||||
case kChunkFreeSoundEffect:
|
||||
number = _fileStream->readUint16LE();
|
||||
assert(number < MAX_SOUND_EFFECTS);
|
||||
|
||||
delete[] _soundEffects[number];
|
||||
_soundEffects[number] = nullptr;
|
||||
break;
|
||||
case kChunkMusicFadeIn:
|
||||
error("Unused chunk kChunkMusicFadeIn found");
|
||||
break;
|
||||
case kChunkMusicFadeOut:
|
||||
// Used in videos 0, 71
|
||||
channel = _fileStream->readUint16LE();
|
||||
// TODO: Reimplement
|
||||
//_G(sndPlayer)->fadeOut(channel);
|
||||
break;
|
||||
case kChunkSetBalance:
|
||||
channel = _fileStream->readUint16LE();
|
||||
balance = _fileStream->readUint16LE();
|
||||
|
||||
_sfxBalances[channel] = balance;
|
||||
_sound->setSoundChannelBalance(channel, balance);
|
||||
break;
|
||||
case kChunkSetSpeed:
|
||||
error("Unused chunk kChunkSetSpeed found");
|
||||
break;
|
||||
case kChunkClearScreen:
|
||||
g_system->fillScreen(0);
|
||||
break;
|
||||
default:
|
||||
error("Unknown subchunk: %d", frameType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CfoDecoder::CfoVideoTrack::fadeOut() {
|
||||
for (int j = 0; j < 64; j++) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
byte r, g, b;
|
||||
_palette.get(i, r, g, b);
|
||||
if (r > 0)
|
||||
--r;
|
||||
if (g > 0)
|
||||
--g;
|
||||
if (b > 0)
|
||||
--b;
|
||||
_palette.set(i, r, g, b);
|
||||
}
|
||||
|
||||
//setScummVMPalette(_palette, 0, 256);
|
||||
g_system->getPaletteManager()->setPalette(_palette, 0);
|
||||
g_system->updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Chewy
|
||||
76
engines/chewy/video/cfo_decoder.h
Normal file
76
engines/chewy/video/cfo_decoder.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHEWY_VIDEO_CFO_DECODER_H
|
||||
#define CHEWY_VIDEO_CFO_DECODER_H
|
||||
|
||||
#include "graphics/surface.h"
|
||||
#include "video/flic_decoder.h"
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
#define MAX_SOUND_EFFECTS 14
|
||||
|
||||
class Sound;
|
||||
|
||||
// A FLIC decoder, with a modified header and additional custom frames
|
||||
class CfoDecoder : public Video::FlicDecoder {
|
||||
public:
|
||||
CfoDecoder(Sound *sound, bool disposeMusic) : Video::FlicDecoder(), _sound(sound), _disposeMusic(disposeMusic) {}
|
||||
~CfoDecoder() override {}
|
||||
|
||||
bool loadStream(Common::SeekableReadStream *stream) override;
|
||||
|
||||
private:
|
||||
Sound *_sound;
|
||||
bool _disposeMusic;
|
||||
|
||||
class CfoVideoTrack : public Video::FlicDecoder::FlicVideoTrack {
|
||||
public:
|
||||
CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound, bool disposeMusic);
|
||||
~CfoVideoTrack() override;
|
||||
|
||||
void readHeader() override;
|
||||
|
||||
const Graphics::Surface *decodeNextFrame() override;
|
||||
|
||||
private:
|
||||
void handleFrame() override;
|
||||
void handleCustomFrame();
|
||||
void fadeOut();
|
||||
|
||||
Sound *_sound;
|
||||
bool _disposeMusic;
|
||||
|
||||
uint8 *_soundEffects[MAX_SOUND_EFFECTS];
|
||||
uint32 _soundEffectSize[MAX_SOUND_EFFECTS];
|
||||
uint8 *_musicData;
|
||||
uint32 _musicSize;
|
||||
|
||||
uint8 _sfxBalances[MAX_SOUND_EFFECTS];
|
||||
uint8 _sfxGlobalVolume;
|
||||
uint8 _musicVolume;
|
||||
};
|
||||
};
|
||||
|
||||
} // End of namespace Chewy
|
||||
|
||||
#endif
|
||||
351
engines/chewy/video/video_player.cpp
Normal file
351
engines/chewy/video/video_player.cpp
Normal file
@@ -0,0 +1,351 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "chewy/video/cfo_decoder.h"
|
||||
#include "chewy/video/video_player.h"
|
||||
#include "chewy/cursor.h"
|
||||
#include "chewy/events.h"
|
||||
#include "chewy/globals.h"
|
||||
#include "chewy/resource.h"
|
||||
#include "chewy/sound.h"
|
||||
#include "common/events.h"
|
||||
#include "graphics/paletteman.h"
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
bool VideoPlayer::playVideo(uint num, bool stopMusic, bool disposeMusic) {
|
||||
CfoDecoder *cfoDecoder = new CfoDecoder(g_engine->_sound, disposeMusic);
|
||||
VideoResource *videoResource = new VideoResource("cut.tap");
|
||||
Common::SeekableReadStream *videoStream = videoResource->getVideoStream(num);
|
||||
_playCount = 0;
|
||||
|
||||
if (stopMusic) {
|
||||
g_engine->_sound->stopMusic();
|
||||
}
|
||||
|
||||
if (!cfoDecoder->loadStream(videoStream)) {
|
||||
delete videoResource;
|
||||
delete cfoDecoder;
|
||||
return false;
|
||||
}
|
||||
|
||||
// uint16 x = (g_system->getWidth() - cfoDecoder->getWidth()) / 2;
|
||||
// uint16 y = (g_system->getHeight() - cfoDecoder->getHeight()) / 2;
|
||||
bool skipVideo = false;
|
||||
byte curPalette[256 * 3];
|
||||
uint32 curFrame = 0;
|
||||
bool keepPlaying = true;
|
||||
|
||||
g_system->getPaletteManager()->grabPalette(curPalette, 0, 256);
|
||||
_G(cur)->hideCursor();
|
||||
|
||||
// Clear events
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
}
|
||||
|
||||
cfoDecoder->start();
|
||||
|
||||
while (!g_engine->shouldQuit() && !cfoDecoder->endOfVideo() && !skipVideo && keepPlaying) {
|
||||
if (cfoDecoder->needsUpdate()) {
|
||||
const Graphics::Surface *frame = cfoDecoder->decodeNextFrame();
|
||||
if (frame) {
|
||||
const byte *srcP = (const byte *)frame->getPixels();
|
||||
byte *destP = (byte *)g_screen->getPixels();
|
||||
Common::copy(srcP, srcP + (SCREEN_WIDTH * SCREEN_HEIGHT), destP);
|
||||
g_screen->markAllDirty();
|
||||
|
||||
if (cfoDecoder->hasDirtyPalette())
|
||||
g_system->getPaletteManager()->setPalette(cfoDecoder->getPalette(), 0, 256);
|
||||
|
||||
keepPlaying = handleCustom(num, curFrame, cfoDecoder);
|
||||
curFrame = cfoDecoder->getCurFrame();
|
||||
|
||||
g_screen->update();
|
||||
}
|
||||
}
|
||||
|
||||
g_events->update();
|
||||
|
||||
// FIXME: We ignore mouse events because the game checks
|
||||
// for left mouse down, instead of up, so releasing the
|
||||
// mouse button results in video skipping
|
||||
if (g_events->getSwitchCode() == Common::KEYCODE_ESCAPE)
|
||||
skipVideo = true;
|
||||
|
||||
// Clear any pending keys
|
||||
g_events->_kbInfo._keyCode = '\0';
|
||||
g_events->_kbInfo._scanCode = Common::KEYCODE_INVALID;
|
||||
}
|
||||
|
||||
cfoDecoder->close();
|
||||
|
||||
g_system->getPaletteManager()->setPalette(curPalette, 0, 256);
|
||||
_G(cur)->showCursor();
|
||||
|
||||
delete videoResource;
|
||||
delete cfoDecoder;
|
||||
|
||||
return !skipVideo;
|
||||
}
|
||||
|
||||
bool VideoPlayer::handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder) {
|
||||
const int16 scrollx = _G(gameState).scrollx;
|
||||
const int16 scrolly = _G(gameState).scrolly;
|
||||
|
||||
switch (num) {
|
||||
case FCUT_004:
|
||||
// Room6::cut_serv1
|
||||
return (frame == 40) ? false : true;
|
||||
case FCUT_005:
|
||||
// Room10::cut_serv
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
if (frame == 31)
|
||||
start_aad(107, 0, true);
|
||||
break;
|
||||
case FCUT_009:
|
||||
case FCUT_010:
|
||||
// Room11::cut_serv and Room11::cut_serv_2
|
||||
if (_G(gameState).R11DoorRightF)
|
||||
_G(det)->plot_static_details(0, 0, 0, 0);
|
||||
|
||||
if (_G(gameState).R11DoorRightB)
|
||||
_G(det)->plot_static_details(0, 0, 6, 6);
|
||||
|
||||
if (_G(gameState).R6DoorRightB)
|
||||
_G(det)->plot_static_details(0, 0, 7, 7);
|
||||
|
||||
if (num == FCUT_010) {
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
if (frame == 43)
|
||||
start_aad(106, 0, true);
|
||||
}
|
||||
break;
|
||||
case FCUT_032:
|
||||
case FCUT_035:
|
||||
case FCUT_036:
|
||||
case FCUT_037:
|
||||
case FCUT_038:
|
||||
case FCUT_039:
|
||||
case FCUT_040:
|
||||
// Room39::setup_func
|
||||
if (!_G(gameState).R39TranslatorUsed)
|
||||
return false;
|
||||
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
|
||||
if (cfoDecoder->endOfVideo() && _G(atds)->aadGetStatus() != -1)
|
||||
cfoDecoder->rewind();
|
||||
break;
|
||||
case FCUT_034:
|
||||
// Room39::setup_func
|
||||
if (!_G(gameState).R39TranslatorUsed)
|
||||
return false;
|
||||
|
||||
switch (frame) {
|
||||
case 121:
|
||||
start_aad(599, -1, true);
|
||||
break;
|
||||
case 247:
|
||||
start_aad(600, -1, true);
|
||||
break;
|
||||
case 267:
|
||||
start_aad(601, 0, true);
|
||||
break;
|
||||
case 297:
|
||||
//_G(in)->_hotkey = 1;
|
||||
break;
|
||||
case 171:
|
||||
case 266:
|
||||
case 370:
|
||||
_G(atds)->stopAad();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
break;
|
||||
case FCUT_047:
|
||||
// Room37::cut_serv1
|
||||
if (!_G(gameState).R37RoosterFoughtWithDog) {
|
||||
if (!_G(gameState).R37TakenDenturesFromGlass) {
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 9, 9);
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 11, 11);
|
||||
_G(det)->showStaticSpr(11);
|
||||
} else {
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 8, 8);
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 7, 7);
|
||||
_G(det)->plot_static_details(scrollx, scrolly, 14, 14);
|
||||
break;
|
||||
case FCUT_048: {
|
||||
// Room37::cut_serv2
|
||||
const int16 STATIC_NR[] = {7, 14, 12, 10};
|
||||
|
||||
_G(det)->showStaticSpr(12);
|
||||
_G(det)->showStaticSpr(10);
|
||||
for (short i = 0; i < 4; i++)
|
||||
_G(det)->plot_static_details(scrollx, scrolly, STATIC_NR[i], STATIC_NR[i]);
|
||||
}
|
||||
break;
|
||||
case FCUT_053:
|
||||
if (cfoDecoder->endOfVideo() && _playCount < 3) {
|
||||
cfoDecoder->rewind();
|
||||
_playCount++;
|
||||
}
|
||||
break;
|
||||
case FCUT_054:
|
||||
if (cfoDecoder->endOfVideo() && _playCount < 2) {
|
||||
cfoDecoder->rewind();
|
||||
_playCount++;
|
||||
}
|
||||
break;
|
||||
case FCUT_055:
|
||||
case FCUT_056:
|
||||
case FCUT_064:
|
||||
// Room28::cut_serv2 (FCUT_055)
|
||||
if (num != FCUT_055 || frame < 23) {
|
||||
// Room28::cut_serv1 (FCUT_056 / FCUT_064)
|
||||
if (_G(gameState).R28LetterBox)
|
||||
_G(det)->plot_static_details(0, 0, 8, 9);
|
||||
else
|
||||
_G(det)->plot_static_details(0, 0, 7, 7);
|
||||
}
|
||||
break;
|
||||
case FCUT_061:
|
||||
// Room43::setup_func
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
break;
|
||||
case FCUT_068:
|
||||
// Room51::cut_serv
|
||||
_G(det)->plot_static_details(0, 0, 16, 16);
|
||||
break;
|
||||
case FCUT_069:
|
||||
// Room54::cut_serv
|
||||
_G(det)->plot_static_details(176, 0, 9, 9);
|
||||
break;
|
||||
case FCUT_070:
|
||||
// Room55::cut_serv
|
||||
if (frame < 29)
|
||||
_G(det)->plot_static_details(136, 0, 10, 10);
|
||||
break;
|
||||
case FCUT_078: {
|
||||
// Room64::cut_sev
|
||||
const int16 spr_nr = _G(chewy_ph)[_G(moveState)[P_CHEWY].Phase * 8 + _G(moveState)[P_CHEWY].PhNr];
|
||||
const int16 x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy)->correction[spr_nr * 2] - scrollx;
|
||||
const int16 y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy)->correction[spr_nr * 2 + 1] - scrolly;
|
||||
|
||||
calc_zoom(_G(spieler_mi)[P_CHEWY].XyzStart[1], (int16)_G(room)->_roomInfo->_zoomFactor, (int16)_G(room)->_roomInfo->_zoomFactor, &_G(moveState)[P_CHEWY]);
|
||||
_G(out)->scale_set(_G(chewy)->image[spr_nr], x, y, _G(moveState)[P_CHEWY].Xzoom, _G(moveState)[P_CHEWY].Yzoom, _G(scr_width));
|
||||
}
|
||||
break;
|
||||
case FCUT_083:
|
||||
if (cfoDecoder->endOfVideo() && _playCount < 2) {
|
||||
cfoDecoder->rewind();
|
||||
_playCount++;
|
||||
}
|
||||
break;
|
||||
case FCUT_089:
|
||||
// Room87::proc5
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
break;
|
||||
case FCUT_094:
|
||||
// Room87::proc3
|
||||
return (frame >= 12) ? false : true;
|
||||
case FCUT_095:
|
||||
// Room87::proc5
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
|
||||
if (cfoDecoder->endOfVideo() && _G(atds)->aadGetStatus() != -1)
|
||||
cfoDecoder->rewind();
|
||||
break;
|
||||
case FCUT_107:
|
||||
// Room90::proc5
|
||||
_G(det)->plot_static_details(scrollx, 0, 3, 3);
|
||||
break;
|
||||
case FCUT_112:
|
||||
// Room56::proc1
|
||||
if (cfoDecoder->endOfVideo() && _playCount < 2) {
|
||||
cfoDecoder->rewind();
|
||||
_playCount++;
|
||||
}
|
||||
return (g_events->getSwitchCode() == Common::KEYCODE_ESCAPE) ? false : true;
|
||||
case FCUT_116:
|
||||
if (cfoDecoder->endOfVideo() && _playCount < 6) {
|
||||
cfoDecoder->rewind();
|
||||
_playCount++;
|
||||
}
|
||||
break;
|
||||
case FCUT_135:
|
||||
case FCUT_145:
|
||||
case FCUT_142:
|
||||
case FCUT_140:
|
||||
case FCUT_144:
|
||||
case FCUT_134:
|
||||
case FCUT_148:
|
||||
case FCUT_138:
|
||||
case FCUT_143:
|
||||
case FCUT_146:
|
||||
case FCUT_154:
|
||||
case FCUT_139:
|
||||
case FCUT_156:
|
||||
case FCUT_157:
|
||||
case FCUT_147:
|
||||
case FCUT_153:
|
||||
case FCUT_152:
|
||||
case FCUT_141:
|
||||
case FCUT_137:
|
||||
case FCUT_136:
|
||||
case FCUT_151:
|
||||
case FCUT_149:
|
||||
case FCUT_150:
|
||||
// Intro
|
||||
_G(atds)->print_aad(scrollx, scrolly);
|
||||
if (num == FCUT_135 || num == FCUT_134 || num == FCUT_154 || num == FCUT_156)
|
||||
if (_G(atds)->aadGetStatus() != -1)
|
||||
_G(out)->raster_col(254, 63, 12, 46);
|
||||
if (num == FCUT_137 && frame == 35)
|
||||
_G(atds)->stopAad();
|
||||
if (num == FCUT_136 && frame == 18)
|
||||
_G(atds)->stopAad();
|
||||
if (num == FCUT_140 && frame == 15)
|
||||
return false;
|
||||
if (num == FCUT_144 && frame == 7)
|
||||
return false;
|
||||
|
||||
if (num == FCUT_141 || num == FCUT_142 || num == FCUT_143 ||
|
||||
num == FCUT_145 || num == FCUT_146 || num == FCUT_152) {
|
||||
if (cfoDecoder->endOfVideo() && _G(atds)->aadGetStatus() != -1)
|
||||
cfoDecoder->rewind();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Chewy
|
||||
49
engines/chewy/video/video_player.h
Normal file
49
engines/chewy/video/video_player.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHEWY_VIDEO_VIDEO_PLAYER_H
|
||||
#define CHEWY_VIDEO_VIDEO_PLAYER_H
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
class CfoDecoder;
|
||||
|
||||
class VideoPlayer {
|
||||
public:
|
||||
VideoPlayer() { _playCount = 0; }
|
||||
|
||||
/**
|
||||
* @Plays a video file
|
||||
* @param num - the video file number
|
||||
* @param stopMusic - stop music before starting the video
|
||||
* @param disposeMusic - dispose music after stopping the video
|
||||
* @return - true if played, false if skipped
|
||||
*/
|
||||
bool playVideo(uint num, bool stopMusic = true, bool disposeMusic = true);
|
||||
|
||||
private:
|
||||
bool handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder);
|
||||
int _playCount;
|
||||
};
|
||||
|
||||
} // End of namespace Chewy
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user