mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Register Player in the PhysicsSystem
This commit is contained in:
parent
56ff280230
commit
ccab8cc9a1
7 changed files with 29 additions and 14 deletions
|
@ -89,7 +89,6 @@ add_executable(openmw-launcher
|
||||||
|
|
||||||
target_link_libraries(openmw-launcher
|
target_link_libraries(openmw-launcher
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
${OGRE_LIBRARIES}
|
|
||||||
${SDL2_LIBRARY_ONLY}
|
${SDL2_LIBRARY_ONLY}
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
components
|
components
|
||||||
|
|
|
@ -199,7 +199,7 @@ bool Launcher::MainDialog::setup()
|
||||||
// Now create the pages as they need the settings
|
// Now create the pages as they need the settings
|
||||||
createPages();
|
createPages();
|
||||||
|
|
||||||
// Call this so we can exit on Ogre/SDL errors before mainwindow is shown
|
// Call this so we can exit on SDL errors before mainwindow is shown
|
||||||
if (!mGraphicsPage->loadSettings())
|
if (!mGraphicsPage->loadSettings())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
//#include "../mwrender/animation.hpp"
|
#include "../mwrender/animation.hpp"
|
||||||
|
|
||||||
|
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
#include "steering.hpp"
|
#include "steering.hpp"
|
||||||
#include "movement.hpp"
|
#include "movement.hpp"
|
||||||
//#include "character.hpp" // fixme: for getActiveWeapon
|
#include "character.hpp" // fixme: for getActiveWeapon
|
||||||
|
|
||||||
#include "aicombataction.hpp"
|
#include "aicombataction.hpp"
|
||||||
#include "combat.hpp"
|
#include "combat.hpp"
|
||||||
|
@ -188,7 +188,6 @@ namespace MWMechanics
|
||||||
*/
|
*/
|
||||||
bool AiCombat::execute (const MWWorld::Ptr& actor, AiState& state, float duration)
|
bool AiCombat::execute (const MWWorld::Ptr& actor, AiState& state, float duration)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// get or create temporary storage
|
// get or create temporary storage
|
||||||
AiCombatStorage& storage = state.get<AiCombatStorage>();
|
AiCombatStorage& storage = state.get<AiCombatStorage>();
|
||||||
|
|
||||||
|
@ -257,9 +256,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
if(readyToAttack)
|
if(readyToAttack)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!minMaxAttackDurationInitialised)
|
if (!minMaxAttackDurationInitialised)
|
||||||
{
|
{
|
||||||
// TODO: this must be updated when a different weapon is equipped
|
// TODO: this must be updated when a different weapon is equipped
|
||||||
|
// FIXME: attack durations would be easier to control if we interact more closely with the CharacterController
|
||||||
getMinMaxAttackDuration(actor, minMaxAttackDuration);
|
getMinMaxAttackDuration(actor, minMaxAttackDuration);
|
||||||
minMaxAttackDurationInitialised = true;
|
minMaxAttackDurationInitialised = true;
|
||||||
}
|
}
|
||||||
|
@ -674,7 +675,6 @@ namespace MWMechanics
|
||||||
// FIXME: can fool actors to stay behind doors, etc.
|
// FIXME: can fool actors to stay behind doors, etc.
|
||||||
// Related to Bug#1102 and to some degree #1155 as well
|
// Related to Bug#1102 and to some degree #1155 as well
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,6 @@ ESM::Weapon::AttackType chooseBestAttack(const ESM::Weapon* weapon, MWMechanics:
|
||||||
return attackType;
|
return attackType;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void getMinMaxAttackDuration(const MWWorld::Ptr& actor, float (*fMinMaxDurations)[2])
|
void getMinMaxAttackDuration(const MWWorld::Ptr& actor, float (*fMinMaxDurations)[2])
|
||||||
{
|
{
|
||||||
if (!actor.getClass().hasInventoryStore(actor)) // creatures
|
if (!actor.getClass().hasInventoryStore(actor)) // creatures
|
||||||
|
@ -876,7 +875,6 @@ void getMinMaxAttackDuration(const MWWorld::Ptr& actor, float (*fMinMaxDurations
|
||||||
fMinMaxDurations[i][1] = fMinMaxDurations[i][0] + (start1 - start2) / weapSpeed;
|
fMinMaxDurations[i][1] = fMinMaxDurations[i][0] + (start1 - start2) / weapSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Ogre::Vector3 AimDirToMovingTarget(const MWWorld::Ptr& actor, const MWWorld::Ptr& target, const Ogre::Vector3& vLastTargetPos,
|
Ogre::Vector3 AimDirToMovingTarget(const MWWorld::Ptr& actor, const MWWorld::Ptr& target, const Ogre::Vector3& vLastTargetPos,
|
||||||
float duration, int weapType, float strength)
|
float duration, int weapType, float strength)
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/character.hpp" // FIXME: for MWMechanics::Priority
|
||||||
|
|
||||||
#include "vismask.hpp"
|
#include "vismask.hpp"
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
|
|
||||||
|
@ -1068,6 +1070,18 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Animation::upperBodyReady() const
|
||||||
|
{
|
||||||
|
for (AnimStateMap::const_iterator stateiter = mStates.begin(); stateiter != mStates.end(); ++stateiter)
|
||||||
|
{
|
||||||
|
if((stateiter->second.mPriority > MWMechanics::Priority_Movement
|
||||||
|
&& stateiter->second.mPriority < MWMechanics::Priority_Torch)
|
||||||
|
|| stateiter->second.mPriority == MWMechanics::Priority_Death)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Animation::hasNode(const std::string &name)
|
bool Animation::hasNode(const std::string &name)
|
||||||
{
|
{
|
||||||
std::string lowerName = Misc::StringUtils::lowerCase(name);
|
std::string lowerName = Misc::StringUtils::lowerCase(name);
|
||||||
|
|
|
@ -309,7 +309,7 @@ public:
|
||||||
bool isPlaying(const std::string &groupname) const;
|
bool isPlaying(const std::string &groupname) const;
|
||||||
|
|
||||||
/// Returns true if no important animations are currently playing on the upper body.
|
/// Returns true if no important animations are currently playing on the upper body.
|
||||||
//bool upperBodyReady() const;
|
bool upperBodyReady() const;
|
||||||
|
|
||||||
/** Gets info about the given animation group.
|
/** Gets info about the given animation group.
|
||||||
* \param groupname Animation group to check.
|
* \param groupname Animation group to check.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <components/compiler/locals.hpp>
|
#include <components/compiler/locals.hpp>
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
||||||
#include <boost/math/special_functions/sign.hpp>
|
#include <boost/math/special_functions/sign.hpp>
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ namespace MWWorld
|
||||||
const std::vector<std::string>& contentFiles,
|
const std::vector<std::string>& contentFiles,
|
||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap,
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap,
|
||||||
int activationDistanceOverride, const std::string& startCell, const std::string& startupScript)
|
int activationDistanceOverride, const std::string& startCell, const std::string& startupScript)
|
||||||
: mPlayer (0), mLocalScripts (mStore),
|
: mResourceSystem(resourceSystem), mPlayer (0), mLocalScripts (mStore),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm),
|
||||||
mActivationDistanceOverride (activationDistanceOverride),
|
mActivationDistanceOverride (activationDistanceOverride),
|
||||||
mFallback(fallbackMap), mTeleportEnabled(true), mLevitationEnabled(true),
|
mFallback(fallbackMap), mTeleportEnabled(true), mLevitationEnabled(true),
|
||||||
|
@ -1170,7 +1171,7 @@ namespace MWWorld
|
||||||
|
|
||||||
MWWorld::Ptr newPtr = ptr.getClass()
|
MWWorld::Ptr newPtr = ptr.getClass()
|
||||||
.copyToCell(ptr, *newCell);
|
.copyToCell(ptr, *newCell);
|
||||||
newPtr.getRefData().setBaseNodeOld(0);
|
newPtr.getRefData().setBaseNode(0);
|
||||||
}
|
}
|
||||||
else if (!currCellActive && !newCellActive)
|
else if (!currCellActive && !newCellActive)
|
||||||
ptr.getClass().copyToCell(ptr, *newCell);
|
ptr.getClass().copyToCell(ptr, *newCell);
|
||||||
|
@ -1180,8 +1181,9 @@ namespace MWWorld
|
||||||
ptr.getClass().copyToCell(ptr, *newCell, pos);
|
ptr.getClass().copyToCell(ptr, *newCell, pos);
|
||||||
|
|
||||||
//mRendering->updateObjectCell(ptr, copy);
|
//mRendering->updateObjectCell(ptr, copy);
|
||||||
ptr.getRefData().setBaseNodeOld(NULL);
|
ptr.getRefData().setBaseNode(NULL);
|
||||||
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
|
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
|
||||||
|
mPhysics->updatePtr(ptr, copy);
|
||||||
|
|
||||||
MWBase::MechanicsManager *mechMgr = MWBase::Environment::get().getMechanicsManager();
|
MWBase::MechanicsManager *mechMgr = MWBase::Environment::get().getMechanicsManager();
|
||||||
mechMgr->updateCell(ptr, copy);
|
mechMgr->updateCell(ptr, copy);
|
||||||
|
@ -2123,8 +2125,8 @@ namespace MWWorld
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(getPlayerPtr());
|
MWBase::Environment::get().getMechanicsManager()->add(getPlayerPtr());
|
||||||
|
|
||||||
std::string model = getPlayerPtr().getClass().getModel(getPlayerPtr());
|
std::string model = getPlayerPtr().getClass().getModel(getPlayerPtr());
|
||||||
//model = Misc::ResourceHelpers::correctActorModelPath(model);
|
model = Misc::ResourceHelpers::correctActorModelPath(model, mResourceSystem->getVFS());
|
||||||
//mPhysics->addActor(mPlayer->getPlayer(), model);
|
mPhysics->addActor(getPlayerPtr(), model);
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::canRest ()
|
int World::canRest ()
|
||||||
|
|
|
@ -70,6 +70,8 @@ namespace MWWorld
|
||||||
|
|
||||||
class World : public MWBase::World
|
class World : public MWBase::World
|
||||||
{
|
{
|
||||||
|
Resource::ResourceSystem* mResourceSystem;
|
||||||
|
|
||||||
MWWorld::Fallback mFallback;
|
MWWorld::Fallback mFallback;
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue