forked from mirror/openmw-tes3mp
support the allowSkipping extra parameter for playBink command.
This commit is contained in:
parent
35f4d09288
commit
282601d6e9
8 changed files with 27 additions and 12 deletions
|
@ -305,7 +305,7 @@ namespace MWBase
|
||||||
|
|
||||||
|
|
||||||
/// \todo this does not belong here
|
/// \todo this does not belong here
|
||||||
virtual void playVideo(const std::string& name) = 0;
|
virtual void playVideo(const std::string& name, bool allowSkipping) = 0;
|
||||||
virtual void stopVideo() = 0;
|
virtual void stopVideo() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -929,14 +929,14 @@ void RenderingManager::setupExternalRendering (MWRender::ExternalRendering& rend
|
||||||
rendering.setup (mRendering.getScene());
|
rendering.setup (mRendering.getScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::playVideo(const std::string& name)
|
void RenderingManager::playVideo(const std::string& name, bool allowSkipping)
|
||||||
{
|
{
|
||||||
mVideoPlayer->playVideo ("video/" + name);
|
mVideoPlayer->playVideo ("video/" + name, allowSkipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::stopVideo()
|
void RenderingManager::stopVideo()
|
||||||
{
|
{
|
||||||
mVideoPlayer->close ();
|
mVideoPlayer->stopVideo ();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -196,7 +196,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
||||||
|
|
||||||
void setupExternalRendering (MWRender::ExternalRendering& rendering);
|
void setupExternalRendering (MWRender::ExternalRendering& rendering);
|
||||||
|
|
||||||
void playVideo(const std::string& name);
|
void playVideo(const std::string& name, bool allowSkipping);
|
||||||
void stopVideo();
|
void stopVideo();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -1010,6 +1010,7 @@ VideoPlayer::VideoPlayer(Ogre::SceneManager* sceneMgr)
|
||||||
, mVideoMaterial(NULL)
|
, mVideoMaterial(NULL)
|
||||||
, mRectangle(NULL)
|
, mRectangle(NULL)
|
||||||
, mNode(NULL)
|
, mNode(NULL)
|
||||||
|
, mAllowSkipping(false)
|
||||||
{
|
{
|
||||||
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
|
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
|
||||||
if (mVideoMaterial.isNull ())
|
if (mVideoMaterial.isNull ())
|
||||||
|
@ -1071,8 +1072,10 @@ VideoPlayer::~VideoPlayer()
|
||||||
delete mBackgroundRectangle;
|
delete mBackgroundRectangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoPlayer::playVideo(const std::string &resourceName)
|
void VideoPlayer::playVideo(const std::string &resourceName, bool allowSkipping)
|
||||||
{
|
{
|
||||||
|
mAllowSkipping = allowSkipping;
|
||||||
|
|
||||||
if(mState)
|
if(mState)
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
@ -1113,6 +1116,12 @@ void VideoPlayer::update ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoPlayer::stopVideo ()
|
||||||
|
{
|
||||||
|
if (mAllowSkipping)
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
void VideoPlayer::close()
|
void VideoPlayer::close()
|
||||||
{
|
{
|
||||||
if(mState)
|
if(mState)
|
||||||
|
|
|
@ -20,11 +20,12 @@ namespace MWRender
|
||||||
VideoPlayer(Ogre::SceneManager* sceneMgr);
|
VideoPlayer(Ogre::SceneManager* sceneMgr);
|
||||||
~VideoPlayer();
|
~VideoPlayer();
|
||||||
|
|
||||||
void playVideo (const std::string& resourceName);
|
void playVideo (const std::string& resourceName, bool allowSkipping);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
void stopVideo();
|
||||||
|
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
|
|
||||||
|
@ -34,6 +35,8 @@ namespace MWRender
|
||||||
private:
|
private:
|
||||||
VideoState* mState;
|
VideoState* mState;
|
||||||
|
|
||||||
|
bool mAllowSkipping;
|
||||||
|
|
||||||
Ogre::SceneManager* mSceneMgr;
|
Ogre::SceneManager* mSceneMgr;
|
||||||
Ogre::MaterialPtr mVideoMaterial;
|
Ogre::MaterialPtr mVideoMaterial;
|
||||||
Ogre::Rectangle2D* mRectangle;
|
Ogre::Rectangle2D* mRectangle;
|
||||||
|
|
|
@ -34,7 +34,10 @@ namespace MWScript
|
||||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld ()->playVideo (name);
|
bool allowSkipping = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWorld ()->playVideo (name, allowSkipping);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -465,7 +468,7 @@ namespace MWScript
|
||||||
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
|
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
|
||||||
extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep);
|
extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep);
|
||||||
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
|
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
|
||||||
extensions.registerInstruction ("playbink", "S", opcodePlayBink);
|
extensions.registerInstruction ("playbink", "Sl", opcodePlayBink);
|
||||||
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
|
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
|
||||||
extensions.registerFunction ("geteffect", 'l', "l", opcodeGetEffect, opcodeGetEffectExplicit);
|
extensions.registerFunction ("geteffect", 'l', "l", opcodeGetEffect, opcodeGetEffectExplicit);
|
||||||
extensions.registerFunction ("getattacked", 'l', "", opcodeGetAttacked, opcodeGetAttackedExplicit);
|
extensions.registerFunction ("getattacked", 'l', "", opcodeGetAttacked, opcodeGetAttackedExplicit);
|
||||||
|
|
|
@ -1287,9 +1287,9 @@ namespace MWWorld
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::playVideo (const std::string &name)
|
void World::playVideo (const std::string &name, bool allowSkipping)
|
||||||
{
|
{
|
||||||
mRendering->playVideo(name);
|
mRendering->playVideo(name, allowSkipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::stopVideo ()
|
void World::stopVideo ()
|
||||||
|
|
|
@ -334,7 +334,7 @@ namespace MWWorld
|
||||||
/// 3 - enemies are nearby (not implemented)
|
/// 3 - enemies are nearby (not implemented)
|
||||||
|
|
||||||
/// \todo this does not belong here
|
/// \todo this does not belong here
|
||||||
virtual void playVideo(const std::string& name);
|
virtual void playVideo(const std::string& name, bool allowSkipping);
|
||||||
virtual void stopVideo();
|
virtual void stopVideo();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue