mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 23:36:42 +00:00
Handle playgroup and skipanim through mwmechanics
This commit is contained in:
parent
46fc61a4c1
commit
d2f5a886c7
15 changed files with 61 additions and 86 deletions
|
@ -95,6 +95,17 @@ namespace MWBase
|
||||||
virtual void getPersuasionDispositionChange (const MWWorld::Ptr& npc, PersuasionType type,
|
virtual void getPersuasionDispositionChange (const MWWorld::Ptr& npc, PersuasionType type,
|
||||||
float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange) = 0;
|
float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange) = 0;
|
||||||
///< Perform a persuasion action on NPC
|
///< Perform a persuasion action on NPC
|
||||||
|
|
||||||
|
virtual void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number=1) = 0;
|
||||||
|
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
||||||
|
/// in the scene should be ignored.
|
||||||
|
///
|
||||||
|
/// \param mode 0 normal, 1 immediate start, 2 immediate loop
|
||||||
|
/// \param count How many times the animation should be run
|
||||||
|
|
||||||
|
virtual void skipAnimation(const MWWorld::Ptr& ptr) = 0;
|
||||||
|
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
||||||
|
/// references that are currently not in the scene should be ignored.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,18 +260,6 @@ namespace MWBase
|
||||||
///< Create a new recrod (of type npc) in the ESM store.
|
///< Create a new recrod (of type npc) in the ESM store.
|
||||||
/// \return pointer to created record
|
/// \return pointer to created record
|
||||||
|
|
||||||
virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
|
|
||||||
int mode, int number = 1) = 0;
|
|
||||||
///< Run animation for a MW-reference. Calls to this function for references that are
|
|
||||||
/// currently not in the rendered scene should be ignored.
|
|
||||||
///
|
|
||||||
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
|
|
||||||
/// \param number How offen the animation should be run
|
|
||||||
|
|
||||||
virtual void skipAnimation (const MWWorld::Ptr& ptr) = 0;
|
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
|
||||||
|
|
||||||
virtual void update (float duration, bool paused) = 0;
|
virtual void update (float duration, bool paused) = 0;
|
||||||
|
|
||||||
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
|
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
|
||||||
|
|
|
@ -288,4 +288,17 @@ namespace MWMechanics
|
||||||
return iter->second;
|
return iter->second;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actors::playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number)
|
||||||
|
{
|
||||||
|
PtrControllerMap::iterator iter = mActors.find(ptr);
|
||||||
|
if(iter != mActors.end())
|
||||||
|
iter->second.playGroup(groupName, mode, number);
|
||||||
|
}
|
||||||
|
void Actors::skipAnimation(const MWWorld::Ptr& ptr)
|
||||||
|
{
|
||||||
|
PtrControllerMap::iterator iter = mActors.find(ptr);
|
||||||
|
if(iter != mActors.end())
|
||||||
|
iter->second.skipAnim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
int countDeaths (const std::string& id) const;
|
int countDeaths (const std::string& id) const;
|
||||||
///< Return the number of deaths for actors with the given ID.
|
///< Return the number of deaths for actors with the given ID.
|
||||||
|
|
||||||
|
void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number);
|
||||||
|
void skipAnimation(const MWWorld::Ptr& ptr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,20 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CharacterController::playGroup(const std::string &groupname, int mode, int count)
|
||||||
|
{
|
||||||
|
// set mState = CharState_Idle?
|
||||||
|
if(mAnimation)
|
||||||
|
mAnimation->playGroup(groupname, mode, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterController::skipAnim()
|
||||||
|
{
|
||||||
|
if(mAnimation)
|
||||||
|
mAnimation->skipAnim();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CharacterController::setState(CharacterState state)
|
void CharacterController::setState(CharacterState state)
|
||||||
{
|
{
|
||||||
mState = state;
|
mState = state;
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
|
|
||||||
void update(float duration);
|
void update(float duration);
|
||||||
|
|
||||||
|
void playGroup(const std::string &groupname, int mode, int count);
|
||||||
|
void skipAnim();
|
||||||
|
|
||||||
void setState(CharacterState state);
|
void setState(CharacterState state);
|
||||||
CharacterState getState() const
|
CharacterState getState() const
|
||||||
{ return mState; }
|
{ return mState; }
|
||||||
|
|
|
@ -628,4 +628,14 @@ namespace MWMechanics
|
||||||
permChange = success ? -int(cappedDispositionChange/ fPerTempMult) : y;
|
permChange = success ? -int(cappedDispositionChange/ fPerTempMult) : y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MechanicsManager::playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number)
|
||||||
|
{
|
||||||
|
mActors.playAnimationGroup(ptr, groupName, mode, number);
|
||||||
|
}
|
||||||
|
void MechanicsManager::skipAnimation(const MWWorld::Ptr& ptr)
|
||||||
|
{
|
||||||
|
mActors.skipAnimation(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,9 @@ namespace MWMechanics
|
||||||
float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange);
|
float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange);
|
||||||
void toLower(std::string npcFaction);
|
void toLower(std::string npcFaction);
|
||||||
///< Perform a persuasion action on NPC
|
///< Perform a persuasion action on NPC
|
||||||
|
|
||||||
|
virtual void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number);
|
||||||
|
virtual void skipAnimation(const MWWorld::Ptr& ptr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,18 +135,6 @@ void Actors::removeCell(MWWorld::Ptr::CellStore* store)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number)
|
|
||||||
{
|
|
||||||
PtrAnimationMap::const_iterator iter = mAllActors.find(ptr);
|
|
||||||
if(iter != mAllActors.end())
|
|
||||||
iter->second->playGroup(groupName, mode, number);
|
|
||||||
}
|
|
||||||
void Actors::skipAnimation (const MWWorld::Ptr& ptr)
|
|
||||||
{
|
|
||||||
PtrAnimationMap::const_iterator iter = mAllActors.find(ptr);
|
|
||||||
if(iter != mAllActors.end())
|
|
||||||
iter->second->skipAnim();
|
|
||||||
}
|
|
||||||
void Actors::update (float duration)
|
void Actors::update (float duration)
|
||||||
{
|
{
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
|
|
|
@ -39,18 +39,6 @@ namespace MWRender
|
||||||
|
|
||||||
void removeCell(MWWorld::CellStore* store);
|
void removeCell(MWWorld::CellStore* store);
|
||||||
|
|
||||||
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
|
|
||||||
int number = 1);
|
|
||||||
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
|
||||||
/// in the rendered scene should be ignored.
|
|
||||||
///
|
|
||||||
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
|
|
||||||
/// \param number How offen the animation should be run
|
|
||||||
|
|
||||||
void skipAnimation (const MWWorld::Ptr& ptr);
|
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
|
||||||
|
|
||||||
void update (float duration);
|
void update (float duration);
|
||||||
|
|
||||||
/// Updates containing cell for object rendering data
|
/// Updates containing cell for object rendering data
|
||||||
|
|
|
@ -580,17 +580,6 @@ void RenderingManager::toggleLight()
|
||||||
setAmbientMode();
|
setAmbientMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
|
|
||||||
int mode, int number)
|
|
||||||
{
|
|
||||||
mActors.playAnimationGroup(ptr, groupName, mode, number);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingManager::skipAnimation (const MWWorld::Ptr& ptr)
|
|
||||||
{
|
|
||||||
mActors.skipAnimation(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingManager::setSunColour(const Ogre::ColourValue& colour)
|
void RenderingManager::setSunColour(const Ogre::ColourValue& colour)
|
||||||
{
|
{
|
||||||
if (!mSunEnabled) return;
|
if (!mSunEnabled) return;
|
||||||
|
|
|
@ -167,18 +167,6 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
||||||
/// configure fog manually
|
/// configure fog manually
|
||||||
void configureFog(const float density, const Ogre::ColourValue& colour);
|
void configureFog(const float density, const Ogre::ColourValue& colour);
|
||||||
|
|
||||||
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
|
|
||||||
int number = 1);
|
|
||||||
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
|
||||||
/// in the rendered scene should be ignored.
|
|
||||||
///
|
|
||||||
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
|
|
||||||
/// \param number How offen the animation should be run
|
|
||||||
|
|
||||||
void skipAnimation (const MWWorld::Ptr& ptr);
|
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
|
||||||
|
|
||||||
Ogre::Vector4 boundingBoxToScreen(Ogre::AxisAlignedBox bounds);
|
Ogre::Vector4 boundingBoxToScreen(Ogre::AxisAlignedBox bounds);
|
||||||
///< transform the specified bounding box (in world coordinates) into screen coordinates.
|
///< transform the specified bounding box (in world coordinates) into screen coordinates.
|
||||||
/// @return packed vector4 (min_x, min_y, max_x, max_y)
|
/// @return packed vector4 (min_x, min_y, max_x, max_y)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
@ -27,7 +27,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->skipAnimation (ptr);
|
MWBase::Environment::get().getMechanicsManager()->skipAnimation (ptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace MWScript
|
||||||
throw std::runtime_error ("animation mode out of range");
|
throw std::runtime_error ("animation mode out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->playAnimationGroup (ptr, group, mode, 1);
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace MWScript
|
||||||
throw std::runtime_error ("animation mode out of range");
|
throw std::runtime_error ("animation mode out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->playAnimationGroup (ptr, group, mode, loops);
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, loops);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -903,17 +903,6 @@ namespace MWWorld
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
|
|
||||||
int number)
|
|
||||||
{
|
|
||||||
mRendering->playAnimationGroup (ptr, groupName, mode, number);
|
|
||||||
}
|
|
||||||
|
|
||||||
void World::skipAnimation (const MWWorld::Ptr& ptr)
|
|
||||||
{
|
|
||||||
mRendering->skipAnimation (ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void World::update (float duration, bool paused)
|
void World::update (float duration, bool paused)
|
||||||
{
|
{
|
||||||
mWorldScene->update (duration, paused);
|
mWorldScene->update (duration, paused);
|
||||||
|
|
|
@ -291,18 +291,6 @@ namespace MWWorld
|
||||||
/// \return pointer to created record
|
/// \return pointer to created record
|
||||||
|
|
||||||
|
|
||||||
virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
|
|
||||||
int mode, int number = 1);
|
|
||||||
///< Run animation for a MW-reference. Calls to this function for references that are
|
|
||||||
/// currently not in the rendered scene should be ignored.
|
|
||||||
///
|
|
||||||
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
|
|
||||||
/// \param number How offen the animation should be run
|
|
||||||
|
|
||||||
virtual void skipAnimation (const MWWorld::Ptr& ptr);
|
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
|
||||||
|
|
||||||
virtual void update (float duration, bool paused);
|
virtual void update (float duration, bool paused);
|
||||||
|
|
||||||
virtual bool placeObject (const Ptr& object, float cursorX, float cursorY);
|
virtual bool placeObject (const Ptr& object, float cursorX, float cursorY);
|
||||||
|
|
Loading…
Reference in a new issue