Comparing changes
Open a pull request
- 4 commits
- 6 files changed
- 3 commit comments
- 1 contributor
- +0 −21 engines/zvision/graphics/render_table.cpp
- +3 −4 engines/zvision/scripting/actions.cpp
- +5 −13 engines/zvision/scripting/sidefx/animation_node.cpp
- +0 −1 engines/zvision/scripting/sidefx/animation_node.h
- +1 −1 engines/zvision/scripting/sidefx/music_node.cpp
- +13 −9 engines/zvision/video/rlf_decoder.cpp
| @@ -81,27 +81,6 @@ const Common::Point RenderTable::convertWarpedCoordToFlatCoord(const Common::Poi | ||
| return newPoint; | ||
| } | ||
|
|
||
| uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { | ||
| assert(percentColorOne < 1.0f); | ||
|
|
||
| float rOne = float((colorOne & Graphics::ColorMasks<555>::kRedMask) >> Graphics::ColorMasks<555>::kRedShift); | ||
| float rTwo = float((colorTwo & Graphics::ColorMasks<555>::kRedMask) >> Graphics::ColorMasks<555>::kRedShift); | ||
| float gOne = float((colorOne & Graphics::ColorMasks<555>::kGreenMask) >> Graphics::ColorMasks<555>::kGreenShift); | ||
| float gTwo = float((colorTwo & Graphics::ColorMasks<555>::kGreenMask) >> Graphics::ColorMasks<555>::kGreenShift); | ||
| float bOne = float((colorOne & Graphics::ColorMasks<555>::kBlueMask) >> Graphics::ColorMasks<555>::kBlueShift); | ||
| float bTwo = float((colorTwo & Graphics::ColorMasks<555>::kBlueMask) >> Graphics::ColorMasks<555>::kBlueShift); | ||
|
|
||
| float rFinal = rOne * percentColorOne + rTwo * (1.0f - percentColorOne); | ||
| float gFinal = gOne * percentColorOne + gTwo * (1.0f - percentColorOne); | ||
| float bFinal = bOne * percentColorOne + bTwo * (1.0f - percentColorOne); | ||
|
|
||
| uint16 returnColor = (byte(rFinal + 0.5f) << Graphics::ColorMasks<555>::kRedShift) | | ||
| (byte(gFinal + 0.5f) << Graphics::ColorMasks<555>::kGreenShift) | | ||
| (byte(bFinal + 0.5f) << Graphics::ColorMasks<555>::kBlueShift); | ||
|
|
||
| return returnColor; | ||
| } | ||
|
|
||
| void RenderTable::mutateImage(uint16 *sourceBuffer, uint16 *destBuffer, uint32 destWidth, const Common::Rect &subRect) { | ||
| uint32 destOffset = 0; | ||
|
|
||
| @@ -577,7 +577,7 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c | ||
|
|
||
| char fileName[25]; | ||
|
|
||
| // The two %*u are always 0 and dont seem to have a use | ||
| // The two %*u are usually 0 and dont seem to have a use | ||
| sscanf(line.c_str(), "%25s %*u %*u %d %d", fileName, &_mask, &_framerate); | ||
|
|
||
| if (_mask > 0) { | ||
| @@ -1030,9 +1030,8 @@ bool ActionSyncSound::execute() { | ||
| if (!(fx->getType() & SideFX::SIDEFX_ANIM)) | ||
| return true; | ||
|
|
||
| AnimationNode *animnode = (AnimationNode *)fx; | ||
| if (animnode->getFrameDelay() > 200) // Hack for fix incorrect framedelay in some animpreload | ||
| animnode->setNewFrameDelay(66); // ~15fps | ||
| if (((AnimationNode *)fx)->getFrameDelay() > 200) | ||
| warning("ActionSyncSound: animation frame delay is higher than 200"); | ||
|
|
||
| _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); | ||
| return true; | ||
| @@ -42,6 +42,11 @@ AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::S | ||
| _animation = engine->loadAnimation(fileName); | ||
| _frmDelay = 1000.0 / _animation->getDuration().framerate(); | ||
|
|
||
| // WORKAROUND: We do not allow the engine to delay more than 66 msec | ||
| // per frame (15fps max) | ||
| if (_frmDelay > 66) | ||
| _frmDelay = 66; | ||
|
|
||
| if (frate > 0) | ||
| _frmDelay = 1000.0 / frate; | ||
| } | ||
| @@ -190,19 +195,6 @@ bool AnimationNode::stop() { | ||
| return false; | ||
| } | ||
|
|
||
| void AnimationNode::setNewFrameDelay(int32 newDelay) { | ||
| if (newDelay > 0) { | ||
| PlayNodes::iterator it = _playList.begin(); | ||
| if (it != _playList.end()) { | ||
| playnode *nod = &(*it); | ||
| float percent = (float)nod->_delay / (float)_frmDelay; | ||
| nod->_delay = percent * newDelay; // Scale to new max | ||
| } | ||
|
|
||
| _frmDelay = newDelay; | ||
| } | ||
| } | ||
|
|
||
| int32 AnimationNode::getFrameDelay() { | ||
| return _frmDelay; | ||
| } | ||
| @@ -73,7 +73,6 @@ class AnimationNode : public SideFX { | ||
|
|
||
| bool stop(); | ||
|
|
||
| void setNewFrameDelay(int32 newDelay); | ||
| int32 getFrameDelay(); | ||
| }; | ||
|
|
||
| @@ -88,7 +88,7 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool | ||
| } | ||
|
|
||
| MusicNode::~MusicNode() { | ||
| if (!_loaded) | ||
| if (_loaded) | ||
| _engine->_mixer->stopHandle(_handle); | ||
| if (_key != StateKey_NotSet) | ||
| _engine->getScriptManager()->setStateValue(_key, 2); | ||
| @@ -30,8 +30,6 @@ | ||
| #include "common/debug.h" | ||
| #include "common/endian.h" | ||
|
|
||
| #include "graphics/colormasks.h" | ||
|
|
||
| namespace ZVision { | ||
|
|
||
| RLFDecoder::~RLFDecoder() { | ||
| @@ -62,7 +60,7 @@ RLFDecoder::RLFVideoTrack::RLFVideoTrack(Common::SeekableReadStream *stream) | ||
| return; | ||
| } | ||
|
|
||
| _currentFrameBuffer.create(_width, _height, Graphics::createPixelFormat<565>()); | ||
| _currentFrameBuffer.create(_width, _height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); | ||
| _frameBufferByteSize = _width * _height * sizeof(uint16); | ||
|
|
||
| _frames = new Frame[_frameCount]; | ||
| @@ -243,8 +241,10 @@ void RLFDecoder::RLFVideoTrack::decodeMaskedRunLengthEncoding(int8 *source, int8 | ||
| } | ||
|
|
||
| byte r, g, b; | ||
| Graphics::colorToRGB<Graphics::ColorMasks<555> >(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); | ||
| // NOTE: Color masks can't be used here, since accurate colors | ||
| // are required to handle transparency correctly | ||
| Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 destColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b); | ||
| WRITE_UINT16(dest + destOffset, destColor); | ||
|
|
||
| sourceOffset += 2; | ||
| @@ -290,8 +290,10 @@ void RLFDecoder::RLFVideoTrack::decodeSimpleRunLengthEncoding(int8 *source, int8 | ||
| } | ||
|
|
||
| byte r, g, b; | ||
| Graphics::colorToRGB<Graphics::ColorMasks<555> >(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 destColor = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); | ||
| // NOTE: Color masks can't be used here, since accurate colors | ||
| // are required to handle transparency correctly | ||
| Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 destColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b); | ||
| WRITE_UINT16(dest + destOffset, destColor); | ||
|
|
||
| sourceOffset += 2; | ||
| @@ -307,8 +309,10 @@ void RLFDecoder::RLFVideoTrack::decodeSimpleRunLengthEncoding(int8 *source, int8 | ||
| } | ||
|
|
||
| byte r, g, b; | ||
| Graphics::colorToRGB<Graphics::ColorMasks<555> >(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 sampleColor = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); | ||
| // NOTE: Color masks can't be used here, since accurate colors | ||
| // are required to handle transparency correctly | ||
| Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b); | ||
| uint16 sampleColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b); | ||
| sourceOffset += 2; | ||
|
|
||
| numberOfCopy = numberOfSamples + 2; | ||
Showing you all comments on commits in this comparison.
This comment has been minimized.
This comment has been minimized.
|
This will override _frmDelay, please move above workaround because it will cause slow speed of "pillar" rotation in "te3e" scene in ZGI |
This comment has been minimized.
This comment has been minimized.
|
You are right. Done as asked |
This comment has been minimized.
This comment has been minimized.
|
Sometimes scripts may set fps less than 15: ./te3e.scr: action:animpreload:11532(te3ea011.avi 0 0 0 2) # te3e_top_movie_avi but for te3e animations fps resets to 15 by syncsound(if comment syncsound and try it in originall game it must be slow): |