CRYOMNI3D: Add clipping support for videos

This will be used to avoid drawing subtitles at every frame
This commit is contained in:
Le Philousophe 2020-02-09 15:37:37 +01:00
parent 09f2bcf7e8
commit 90d1c764c3
2 changed files with 17 additions and 2 deletions

View File

@ -44,7 +44,7 @@ namespace CryOmni3D {
CryOmni3DEngine::CryOmni3DEngine(OSystem *syst,
const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc),
_canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), _lastMouseButton(0),
_autoRepeatNextEvent(uint(-1)) {
_autoRepeatNextEvent(uint(-1)), _hnmHasClip(false) {
if (!_mixer->isReady()) {
error("Sound initialization failed");
}
@ -172,7 +172,16 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun
if (beforeDraw) {
(this->*beforeDraw)(frameNum);
}
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, width, height);
if (_hnmHasClip) {
Common::Rect rct(width, height);
rct.clip(_hnmClipping);
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, rct.left, rct.top, rct.width(),
rct.height());
} else {
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, width, height);
}
if (afterDraw) {
(this->*afterDraw)(frameNum);
}

View File

@ -176,6 +176,9 @@ protected:
void fadeInPalette(const byte *colors);
void setBlackPalette();
void setHNMClipping(const Common::Rect &clip) { _hnmClipping = clip; _hnmHasClip = true; }
void unsetHNMClipping() { _hnmHasClip = false; }
protected:
bool _canLoadSave;
@ -194,6 +197,9 @@ protected:
private:
uint _lockPaletteStartRW;
uint _lockPaletteEndRW;
Common::Rect _hnmClipping;
bool _hnmHasClip;
};
} // End of namespace CryOmni3D