forked from teamnwah/openmw-tes3coop
Merge pull request #161 from OpenMW/master
Add OpenMW commits up to 21 Feb 2017
This commit is contained in:
commit
a1988ac6ef
31 changed files with 149 additions and 83 deletions
|
@ -209,7 +209,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
: mWindow(NULL)
|
||||
, mEncoding(ToUTF8::WINDOWS_1252)
|
||||
, mEncoder(NULL)
|
||||
, mVerboseScripts (false)
|
||||
, mSkipMenu (false)
|
||||
, mUseSound (true)
|
||||
, mCompileAll (false)
|
||||
|
@ -305,11 +304,6 @@ void OMW::Engine::addContentFile(const std::string& file)
|
|||
mContentFiles.push_back(file);
|
||||
}
|
||||
|
||||
void OMW::Engine::setScriptsVerbosity(bool scriptsVerbosity)
|
||||
{
|
||||
mVerboseScripts = scriptsVerbosity;
|
||||
}
|
||||
|
||||
void OMW::Engine::setSkipMenu (bool skipMenu, bool newGame)
|
||||
{
|
||||
mSkipMenu = skipMenu;
|
||||
|
@ -555,8 +549,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||
mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full);
|
||||
mScriptContext->setExtensions (&mExtensions);
|
||||
|
||||
mEnvironment.setScriptManager (new MWScript::ScriptManager (mEnvironment.getWorld()->getStore(),
|
||||
mVerboseScripts, *mScriptContext, mWarningsMode,
|
||||
mEnvironment.setScriptManager (new MWScript::ScriptManager (mEnvironment.getWorld()->getStore(), *mScriptContext, mWarningsMode,
|
||||
mScriptBlacklistUse ? mScriptBlacklist : std::vector<std::string>()));
|
||||
|
||||
// Create game mechanics system
|
||||
|
@ -565,7 +558,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||
|
||||
// Create dialog system
|
||||
mEnvironment.setJournal (new MWDialogue::Journal);
|
||||
mEnvironment.setDialogueManager (new MWDialogue::DialogueManager (mExtensions, mVerboseScripts, mTranslationDataStorage));
|
||||
mEnvironment.setDialogueManager (new MWDialogue::DialogueManager (mExtensions, mTranslationDataStorage));
|
||||
|
||||
// scripts
|
||||
if (mCompileAll)
|
||||
|
|
|
@ -84,7 +84,6 @@ namespace OMW
|
|||
osg::ref_ptr<osgViewer::ScreenCaptureHandler> mScreenCaptureHandler;
|
||||
std::string mCellName;
|
||||
std::vector<std::string> mContentFiles;
|
||||
bool mVerboseScripts;
|
||||
bool mSkipMenu;
|
||||
bool mUseSound;
|
||||
bool mCompileAll;
|
||||
|
@ -158,9 +157,6 @@ namespace OMW
|
|||
*/
|
||||
void addContentFile(const std::string& file);
|
||||
|
||||
/// Enable or disable verbose script output
|
||||
void setScriptsVerbosity(bool scriptsVerbosity);
|
||||
|
||||
/// Disable or enable all sounds
|
||||
void setSoundUsage(bool soundUsage);
|
||||
|
||||
|
|
|
@ -100,9 +100,6 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("no-sound", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "disable all sounds")
|
||||
|
||||
("script-verbose", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "verbose script output")
|
||||
|
||||
("script-all", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "compile all scripts (excluding dialogue scripts) at startup")
|
||||
|
||||
|
@ -242,7 +239,6 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
// scripts
|
||||
engine.setCompileAll(variables["script-all"].as<bool>());
|
||||
engine.setCompileAllDialogue(variables["script-all-dialogue"].as<bool>());
|
||||
engine.setScriptsVerbosity(variables["script-verbose"].as<bool>());
|
||||
engine.setScriptConsoleMode (variables["script-console"].as<bool>());
|
||||
engine.setStartupScript (variables["script-run"].as<Files::EscapeHashString>().toStdString());
|
||||
engine.setWarningsMode (variables["script-warn"].as<int>());
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace MWClass
|
|||
{
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr, model);
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
}
|
||||
|
||||
std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const
|
||||
|
@ -52,6 +51,11 @@ namespace MWClass
|
|||
return "";
|
||||
}
|
||||
|
||||
bool Activator::useAnim() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Activator::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
|
||||
|
|
|
@ -39,6 +39,9 @@ namespace MWClass
|
|||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
///< Whether or not to use animated variant of model (default false)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,11 @@ namespace MWClass
|
|||
if (getCreatureStats(ptr).isDead())
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||
}
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
}
|
||||
|
||||
bool Actor::useAnim() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Actor::block(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace MWClass
|
|||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
|
||||
virtual void block(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual osg::Vec3f getRotationVector(const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -100,7 +100,6 @@ namespace MWClass
|
|||
{
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr, model);
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
}
|
||||
|
||||
std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
|
||||
|
@ -114,6 +113,11 @@ namespace MWClass
|
|||
return "";
|
||||
}
|
||||
|
||||
bool Container::useAnim() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
|
|
|
@ -70,6 +70,8 @@ namespace MWClass
|
|||
virtual void restock (const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,11 @@ namespace MWClass
|
|||
MWBase::Environment::get().getWorld()->activateDoor(ptr, customData.mDoorState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
bool Door::useAnim() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Door::getModel(const MWWorld::ConstPtr &ptr) const
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace MWClass
|
|||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
|
|
@ -51,8 +51,11 @@ namespace MWClass
|
|||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||
MWBase::SoundManager::Play_TypeSfx,
|
||||
MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
bool Light::useAnim() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Light::getModel(const MWWorld::ConstPtr &ptr) const
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace MWClass
|
|||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
namespace MWDialogue
|
||||
{
|
||||
DialogueManager::DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage) :
|
||||
DialogueManager::DialogueManager (const Compiler::Extensions& extensions, Translation::Storage& translationDataStorage) :
|
||||
mTranslationDataStorage(translationDataStorage)
|
||||
, mCompilerContext (MWScript::CompilerContext::Type_Dialogue)
|
||||
, mErrorStream(std::cout.rdbuf())
|
||||
|
@ -198,6 +198,8 @@ namespace MWDialogue
|
|||
{
|
||||
mErrorHandler.reset();
|
||||
|
||||
mErrorHandler.setContext("[dialogue script]");
|
||||
|
||||
std::istringstream input (cmd + "\n");
|
||||
|
||||
Compiler::Scanner scanner (mErrorHandler, input, mCompilerContext.getExtensions());
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace MWDialogue
|
|||
|
||||
public:
|
||||
|
||||
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
|
||||
DialogueManager (const Compiler::Extensions& extensions, Translation::Storage& translationDataStorage);
|
||||
|
||||
virtual void clear();
|
||||
|
||||
|
|
|
@ -1189,4 +1189,40 @@ namespace MWMechanics
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string getSummonedCreature(int effectId)
|
||||
{
|
||||
static std::map<int, std::string> summonMap;
|
||||
if (summonMap.empty())
|
||||
{
|
||||
summonMap[ESM::MagicEffect::SummonAncestralGhost] = "sMagicAncestralGhostID";
|
||||
summonMap[ESM::MagicEffect::SummonBonelord] = "sMagicBonelordID";
|
||||
summonMap[ESM::MagicEffect::SummonBonewalker] = "sMagicLeastBonewalkerID";
|
||||
summonMap[ESM::MagicEffect::SummonCenturionSphere] = "sMagicCenturionSphereID";
|
||||
summonMap[ESM::MagicEffect::SummonClannfear] = "sMagicClannfearID";
|
||||
summonMap[ESM::MagicEffect::SummonDaedroth] = "sMagicDaedrothID";
|
||||
summonMap[ESM::MagicEffect::SummonDremora] = "sMagicDremoraID";
|
||||
summonMap[ESM::MagicEffect::SummonFabricant] = "sMagicFabricantID";
|
||||
summonMap[ESM::MagicEffect::SummonFlameAtronach] = "sMagicFlameAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonFrostAtronach] = "sMagicFrostAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonGoldenSaint] = "sMagicGoldenSaintID";
|
||||
summonMap[ESM::MagicEffect::SummonGreaterBonewalker] = "sMagicGreaterBonewalkerID";
|
||||
summonMap[ESM::MagicEffect::SummonHunger] = "sMagicHungerID";
|
||||
summonMap[ESM::MagicEffect::SummonScamp] = "sMagicScampID";
|
||||
summonMap[ESM::MagicEffect::SummonSkeletalMinion] = "sMagicSkeletalMinionID";
|
||||
summonMap[ESM::MagicEffect::SummonStormAtronach] = "sMagicStormAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonWingedTwilight] = "sMagicWingedTwilightID";
|
||||
summonMap[ESM::MagicEffect::SummonWolf] = "sMagicCreature01ID";
|
||||
summonMap[ESM::MagicEffect::SummonBear] = "sMagicCreature02ID";
|
||||
summonMap[ESM::MagicEffect::SummonBonewolf] = "sMagicCreature03ID";
|
||||
summonMap[ESM::MagicEffect::SummonCreature04] = "sMagicCreature04ID";
|
||||
summonMap[ESM::MagicEffect::SummonCreature05] = "sMagicCreature05ID";
|
||||
}
|
||||
|
||||
std::map<int, std::string>::const_iterator it = summonMap.find(effectId);
|
||||
if (it == summonMap.end())
|
||||
return std::string();
|
||||
else
|
||||
return MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(it->second)->getString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace MWMechanics
|
|||
/// @return Was the effect a tickable effect with a magnitude?
|
||||
bool effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const MWMechanics::EffectKey& effectKey, float magnitude);
|
||||
|
||||
std::string getSummonedCreature(int effectId);
|
||||
|
||||
class CastSpell
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -40,32 +40,7 @@ namespace MWMechanics
|
|||
|
||||
void UpdateSummonedCreatures::process()
|
||||
{
|
||||
static std::map<int, std::string> summonMap;
|
||||
if (summonMap.empty())
|
||||
{
|
||||
summonMap[ESM::MagicEffect::SummonAncestralGhost] = "sMagicAncestralGhostID";
|
||||
summonMap[ESM::MagicEffect::SummonBonelord] = "sMagicBonelordID";
|
||||
summonMap[ESM::MagicEffect::SummonBonewalker] = "sMagicLeastBonewalkerID";
|
||||
summonMap[ESM::MagicEffect::SummonCenturionSphere] = "sMagicCenturionSphereID";
|
||||
summonMap[ESM::MagicEffect::SummonClannfear] = "sMagicClannfearID";
|
||||
summonMap[ESM::MagicEffect::SummonDaedroth] = "sMagicDaedrothID";
|
||||
summonMap[ESM::MagicEffect::SummonDremora] = "sMagicDremoraID";
|
||||
summonMap[ESM::MagicEffect::SummonFabricant] = "sMagicFabricantID";
|
||||
summonMap[ESM::MagicEffect::SummonFlameAtronach] = "sMagicFlameAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonFrostAtronach] = "sMagicFrostAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonGoldenSaint] = "sMagicGoldenSaintID";
|
||||
summonMap[ESM::MagicEffect::SummonGreaterBonewalker] = "sMagicGreaterBonewalkerID";
|
||||
summonMap[ESM::MagicEffect::SummonHunger] = "sMagicHungerID";
|
||||
summonMap[ESM::MagicEffect::SummonScamp] = "sMagicScampID";
|
||||
summonMap[ESM::MagicEffect::SummonSkeletalMinion] = "sMagicSkeletalMinionID";
|
||||
summonMap[ESM::MagicEffect::SummonStormAtronach] = "sMagicStormAtronachID";
|
||||
summonMap[ESM::MagicEffect::SummonWingedTwilight] = "sMagicWingedTwilightID";
|
||||
summonMap[ESM::MagicEffect::SummonWolf] = "sMagicCreature01ID";
|
||||
summonMap[ESM::MagicEffect::SummonBear] = "sMagicCreature02ID";
|
||||
summonMap[ESM::MagicEffect::SummonBonewolf] = "sMagicCreature03ID";
|
||||
summonMap[ESM::MagicEffect::SummonCreature04] = "sMagicCreature04ID";
|
||||
summonMap[ESM::MagicEffect::SummonCreature05] = "sMagicCreature05ID";
|
||||
}
|
||||
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor);
|
||||
|
||||
|
@ -89,10 +64,7 @@ namespace MWMechanics
|
|||
bool found = creatureMap.find(std::make_pair(it->first, it->second)) != creatureMap.end();
|
||||
if (!found)
|
||||
{
|
||||
const std::string& creatureGmst = summonMap[it->first];
|
||||
std::string creatureID =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(creatureGmst)->getString();
|
||||
|
||||
std::string creatureID = getSummonedCreature(it->first);
|
||||
if (!creatureID.empty())
|
||||
{
|
||||
int creatureActorId = -1;
|
||||
|
|
|
@ -531,7 +531,7 @@ namespace MWPhysics
|
|||
mShape = new btHeightfieldTerrainShape(
|
||||
sqrtVerts, sqrtVerts, heights, 1,
|
||||
minh, maxh, 2,
|
||||
PHY_FLOAT, true
|
||||
PHY_FLOAT, false
|
||||
);
|
||||
mShape->setUseDiamondSubdivision(true);
|
||||
mShape->setLocalScaling(btVector3(triSize, triSize, 1));
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/actionteleport.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
|
@ -46,10 +47,9 @@ namespace MWScript
|
|||
ESM::Position pos;
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
world->getPlayer().setTeleported(true);
|
||||
if (world->findExteriorPosition(cell, pos))
|
||||
{
|
||||
world->changeToExteriorCell(pos, true);
|
||||
MWWorld::ActionTeleport("", pos, false).execute(world->getPlayerPtr());
|
||||
world->fixPosition(world->getPlayerPtr());
|
||||
}
|
||||
else
|
||||
|
@ -57,7 +57,7 @@ namespace MWScript
|
|||
// Change to interior even if findInteriorPosition()
|
||||
// yields false. In this case position will be zero-point.
|
||||
world->findInteriorPosition(cell, pos);
|
||||
world->changeToInteriorCell(cell, pos, true);
|
||||
MWWorld::ActionTeleport(cell, pos, false).execute(world->getPlayerPtr());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -76,13 +76,13 @@ namespace MWScript
|
|||
|
||||
ESM::Position pos;
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
world->getPlayer().setTeleported(true);
|
||||
|
||||
world->indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
|
||||
pos.pos[2] = 0;
|
||||
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
|
||||
world->changeToExteriorCell (pos, true);
|
||||
MWWorld::ActionTeleport("", pos, false).execute(world->getPlayerPtr());
|
||||
world->fixPosition(world->getPlayerPtr());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
namespace MWScript
|
||||
{
|
||||
ScriptManager::ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
||||
ScriptManager::ScriptManager (const MWWorld::ESMStore& store,
|
||||
Compiler::Context& compilerContext, int warningsMode,
|
||||
const std::vector<std::string>& scriptBlacklist)
|
||||
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
|
||||
: mErrorHandler (std::cerr), mStore (store),
|
||||
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
|
||||
mOpcodesInstalled (false), mGlobalScripts (store)
|
||||
{
|
||||
|
@ -44,8 +44,7 @@ namespace MWScript
|
|||
|
||||
if (const ESM::Script *script = mStore.get<ESM::Script>().find (name))
|
||||
{
|
||||
if (mVerbose)
|
||||
std::cout << "compiling script: " << name << std::endl;
|
||||
mErrorHandler.setContext(name);
|
||||
|
||||
bool Success = true;
|
||||
try
|
||||
|
@ -74,8 +73,6 @@ namespace MWScript
|
|||
{
|
||||
std::cerr
|
||||
<< "compiling failed: " << name << std::endl;
|
||||
if (mVerbose)
|
||||
std::cerr << script->mScriptText << std::endl << std::endl;
|
||||
}
|
||||
|
||||
if (Success)
|
||||
|
@ -172,13 +169,10 @@ namespace MWScript
|
|||
|
||||
if (const ESM::Script *script = mStore.get<ESM::Script>().search (name2))
|
||||
{
|
||||
if (mVerbose)
|
||||
std::cout
|
||||
<< "scanning script for local variable declarations: " << name2
|
||||
<< std::endl;
|
||||
|
||||
Compiler::Locals locals;
|
||||
|
||||
mErrorHandler.setContext(name2 + "[local variables]");
|
||||
|
||||
std::istringstream stream (script->mScriptText);
|
||||
Compiler::QuickFileParser parser (mErrorHandler, mCompilerContext, locals);
|
||||
Compiler::Scanner scanner (mErrorHandler, stream, mCompilerContext.getExtensions());
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace MWScript
|
|||
{
|
||||
Compiler::StreamErrorHandler mErrorHandler;
|
||||
const MWWorld::ESMStore& mStore;
|
||||
bool mVerbose;
|
||||
Compiler::Context& mCompilerContext;
|
||||
Compiler::FileParser mParser;
|
||||
Interpreter::Interpreter mInterpreter;
|
||||
|
@ -52,7 +51,7 @@ namespace MWScript
|
|||
|
||||
public:
|
||||
|
||||
ScriptManager (const MWWorld::ESMStore& store, bool verbose,
|
||||
ScriptManager (const MWWorld::ESMStore& store,
|
||||
Compiler::Context& compilerContext, int warningsMode,
|
||||
const std::vector<std::string>& scriptBlacklist);
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "player.hpp"
|
||||
|
@ -34,6 +36,7 @@ namespace MWWorld
|
|||
void ActionTeleport::teleport(const Ptr &actor)
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
actor.getClass().getCreatureStats(actor).land();
|
||||
if(actor == world->getPlayerPtr())
|
||||
{
|
||||
world->getPlayer().setTeleported(true);
|
||||
|
|
|
@ -304,6 +304,11 @@ namespace MWWorld
|
|||
return "";
|
||||
}
|
||||
|
||||
bool Class::useAnim() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Class::getModelsToPreload(const Ptr &ptr, std::vector<std::string> &models) const
|
||||
{
|
||||
std::string model = getModel(ptr);
|
||||
|
|
|
@ -271,6 +271,9 @@ namespace MWWorld
|
|||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual bool useAnim() const;
|
||||
///< Whether or not to use animated variant of model (default false)
|
||||
|
||||
virtual void getModelsToPreload(const MWWorld::Ptr& ptr, std::vector<std::string>& models) const;
|
||||
///< Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel().
|
||||
|
||||
|
|
|
@ -56,15 +56,23 @@ namespace
|
|||
void addObject(const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics,
|
||||
MWRender::RenderingManager& rendering)
|
||||
{
|
||||
std::string model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr), rendering.getResourceSystem()->getVFS());
|
||||
bool useAnim = ptr.getClass().useAnim();
|
||||
std::string model = ptr.getClass().getModel(ptr);
|
||||
if (useAnim)
|
||||
model = Misc::ResourceHelpers::correctActorModelPath(model, rendering.getResourceSystem()->getVFS());
|
||||
|
||||
std::string id = ptr.getCellRef().getRefId();
|
||||
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
|
||||
model = ""; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
|
||||
|
||||
ptr.getClass().insertObjectRendering(ptr, model, rendering);
|
||||
setNodeRotation(ptr, rendering, false);
|
||||
|
||||
ptr.getClass().insertObject (ptr, model, physics);
|
||||
|
||||
if (useAnim)
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
|
||||
if (ptr.getClass().isActor())
|
||||
rendering.addWaterRippleEmitter(ptr);
|
||||
}
|
||||
|
@ -703,10 +711,14 @@ namespace MWWorld
|
|||
Resource::SceneManager* mSceneManager;
|
||||
};
|
||||
|
||||
void Scene::preload(const std::string &mesh)
|
||||
void Scene::preload(const std::string &mesh, bool useAnim)
|
||||
{
|
||||
if (!mRendering.getResourceSystem()->getSceneManager()->checkLoaded(mesh, mRendering.getReferenceTime()))
|
||||
mRendering.getWorkQueue()->addWorkItem(new PreloadMeshItem(mesh, mRendering.getResourceSystem()->getSceneManager()));
|
||||
std::string mesh_ = mesh;
|
||||
if (useAnim)
|
||||
mesh_ = Misc::ResourceHelpers::correctActorModelPath(mesh_, mRendering.getResourceSystem()->getVFS());
|
||||
|
||||
if (!mRendering.getResourceSystem()->getSceneManager()->checkLoaded(mesh_, mRendering.getReferenceTime()))
|
||||
mRendering.getWorkQueue()->addWorkItem(new PreloadMeshItem(mesh_, mRendering.getResourceSystem()->getSceneManager()));
|
||||
}
|
||||
|
||||
void Scene::preloadCells(float dt)
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MWWorld
|
|||
|
||||
Ptr searchPtrViaActorId (int actorId);
|
||||
|
||||
void preload(const std::string& mesh);
|
||||
void preload(const std::string& mesh, bool useAnim=false);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3481,10 +3481,16 @@ namespace MWWorld
|
|||
{
|
||||
if (obj.empty())
|
||||
return;
|
||||
MWWorld::ManualRef ref(store, obj);
|
||||
std::string model = ref.getPtr().getClass().getModel(ref.getPtr());
|
||||
if (!model.empty())
|
||||
scene->preload(model);
|
||||
try
|
||||
{
|
||||
MWWorld::ManualRef ref(store, obj);
|
||||
std::string model = ref.getPtr().getClass().getModel(ref.getPtr());
|
||||
if (!model.empty())
|
||||
scene->preload(model, ref.getPtr().getClass().useAnim());
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void World::preloadEffects(const ESM::EffectList *effectList)
|
||||
|
@ -3493,6 +3499,12 @@ namespace MWWorld
|
|||
{
|
||||
const ESM::MagicEffect *effect = mStore.get<ESM::MagicEffect>().find(it->mEffectID);
|
||||
|
||||
if (MWMechanics::isSummoningEffect(it->mEffectID))
|
||||
{
|
||||
preload(mWorldScene, mStore, "VFX_Summon_Start");
|
||||
preload(mWorldScene, mStore, MWMechanics::getSummonedCreature(it->mEffectID));
|
||||
}
|
||||
|
||||
preload(mWorldScene, mStore, effect->mCasting);
|
||||
preload(mWorldScene, mStore, effect->mHit);
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace Compiler
|
|||
else
|
||||
mStream << "warning ";
|
||||
|
||||
if (!mContext.empty())
|
||||
mStream << mContext << " ";
|
||||
|
||||
mStream
|
||||
<< "line " << loc.mLine+1 << ", column " << loc.mColumn+1
|
||||
<< " (" << loc.mLiteral << ")" << std::endl
|
||||
|
@ -34,5 +37,10 @@ namespace Compiler
|
|||
<< " " << message << std::endl;
|
||||
}
|
||||
|
||||
void StreamErrorHandler::setContext(const std::string &context)
|
||||
{
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
StreamErrorHandler::StreamErrorHandler (std::ostream& ErrorStream) : mStream (ErrorStream) {}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Compiler
|
|||
{
|
||||
std::ostream& mStream;
|
||||
|
||||
std::string mContext;
|
||||
|
||||
// not implemented
|
||||
|
||||
StreamErrorHandler (const StreamErrorHandler&);
|
||||
|
@ -26,6 +28,8 @@ namespace Compiler
|
|||
|
||||
public:
|
||||
|
||||
void setContext(const std::string& context);
|
||||
|
||||
// constructors
|
||||
|
||||
StreamErrorHandler (std::ostream& ErrorStream);
|
||||
|
|
|
@ -374,7 +374,7 @@ namespace SceneUtil
|
|||
|
||||
bool sortLights (const LightManager::LightSourceViewBound* left, const LightManager::LightSourceViewBound* right)
|
||||
{
|
||||
return left->mViewBound.center().length2() - left->mViewBound.radius2()/4.f < right->mViewBound.center().length2() - right->mViewBound.radius2()/4.f;
|
||||
return left->mViewBound.center().length2() - left->mViewBound.radius2()*81 < right->mViewBound.center().length2() - right->mViewBound.radius2()*81;
|
||||
}
|
||||
|
||||
void LightListCallback::operator()(osg::Node *node, osg::NodeVisitor *nv)
|
||||
|
|
Loading…
Reference in a new issue