mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 06:53:52 +00:00
Merge pull request #52 from OpenMW/master
Add OpenMW commits up to 2 Sep
This commit is contained in:
commit
9764dbb8d2
7 changed files with 47 additions and 10 deletions
|
@ -37,11 +37,16 @@ std::string CSMWorld::CellCoordinates::getId (const std::string& worldspace) con
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSMWorld::CellCoordinates::isExteriorCell (const std::string& id)
|
||||||
|
{
|
||||||
|
return (!id.empty() && id[0]=='#');
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<CSMWorld::CellCoordinates, bool> CSMWorld::CellCoordinates::fromId (
|
std::pair<CSMWorld::CellCoordinates, bool> CSMWorld::CellCoordinates::fromId (
|
||||||
const std::string& id)
|
const std::string& id)
|
||||||
{
|
{
|
||||||
// no worldspace for now, needs to be changed for 1.1
|
// no worldspace for now, needs to be changed for 1.1
|
||||||
if (!id.empty() && id[0]=='#')
|
if (isExteriorCell(id))
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
char ignore;
|
char ignore;
|
||||||
|
|
|
@ -32,6 +32,8 @@ namespace CSMWorld
|
||||||
std::string getId (const std::string& worldspace) const;
|
std::string getId (const std::string& worldspace) const;
|
||||||
///< Return the ID for the cell at these coordinates.
|
///< Return the ID for the cell at these coordinates.
|
||||||
|
|
||||||
|
static bool isExteriorCell (const std::string& id);
|
||||||
|
|
||||||
/// \return first: CellCoordinates (or 0, 0 if cell does not have coordinates),
|
/// \return first: CellCoordinates (or 0, 0 if cell does not have coordinates),
|
||||||
/// second: is cell paged?
|
/// second: is cell paged?
|
||||||
///
|
///
|
||||||
|
|
|
@ -644,6 +644,8 @@ void CSVRender::Object::apply (CSMWorld::CommandMacro& commands)
|
||||||
int column = collection.findColumnIndex (static_cast<CSMWorld::Columns::ColumnId> (
|
int column = collection.findColumnIndex (static_cast<CSMWorld::Columns::ColumnId> (
|
||||||
CSMWorld::Columns::ColumnId_Cell));
|
CSMWorld::Columns::ColumnId_Cell));
|
||||||
|
|
||||||
|
if (CSMWorld::CellCoordinates::isExteriorCell(collection.getRecord (recordIndex).get().mCell))
|
||||||
|
{
|
||||||
std::pair<int, int> cellIndex = collection.getRecord (recordIndex).get().getCellIndex();
|
std::pair<int, int> cellIndex = collection.getRecord (recordIndex).get().getCellIndex();
|
||||||
|
|
||||||
/// \todo figure out worldspace (not important until multiple worldspaces are supported)
|
/// \todo figure out worldspace (not important until multiple worldspaces are supported)
|
||||||
|
@ -652,6 +654,7 @@ void CSVRender::Object::apply (CSMWorld::CommandMacro& commands)
|
||||||
commands.push (new CSMWorld::ModifyCommand (*model,
|
commands.push (new CSMWorld::ModifyCommand (*model,
|
||||||
model->index (recordIndex, column), QString::fromUtf8 (cellId.c_str())));
|
model->index (recordIndex, column), QString::fromUtf8 (cellId.c_str())));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mOverrideFlags & Override_Rotation)
|
if (mOverrideFlags & Override_Rotation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -385,6 +385,7 @@ namespace MWBase
|
||||||
///Is the head of the creature underwater?
|
///Is the head of the creature underwater?
|
||||||
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
||||||
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||||
|
|
||||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
||||||
|
|
|
@ -261,7 +261,7 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the given affect can be applied to the target. If \a castByPlayer, emits a message box on failure.
|
/// Check if the given affect can be applied to the target. If \a castByPlayer, emits a message box on failure.
|
||||||
bool checkEffectTarget (int effectId, const MWWorld::Ptr& target, bool castByPlayer)
|
bool checkEffectTarget (int effectId, const MWWorld::Ptr& target, const MWWorld::Ptr& caster, bool castByPlayer)
|
||||||
{
|
{
|
||||||
switch (effectId)
|
switch (effectId)
|
||||||
{
|
{
|
||||||
|
@ -293,8 +293,20 @@ namespace MWMechanics
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case ESM::MagicEffect::WaterWalking:
|
||||||
|
if (target.getClass().isPureWaterCreature(target) && MWBase::Environment::get().getWorld()->isSwimming(target))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
if (!world->isWaterWalkingCastableOnTarget(target))
|
||||||
|
{
|
||||||
|
if (castByPlayer && caster == target)
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sMagicInvalidEffect}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +398,7 @@ namespace MWMechanics
|
||||||
else
|
else
|
||||||
canCastAnEffect = true;
|
canCastAnEffect = true;
|
||||||
|
|
||||||
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
if (!checkEffectTarget(effectIt->mEffectID, target, caster, castByPlayer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// caster needs to be an actor for linked effects (e.g. Absorb)
|
// caster needs to be an actor for linked effects (e.g. Absorb)
|
||||||
|
|
|
@ -2098,6 +2098,19 @@ namespace MWWorld
|
||||||
return pos.z() < cell->getWaterLevel();
|
return pos.z() < cell->getWaterLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool World::isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const
|
||||||
|
{
|
||||||
|
const MWWorld::CellStore* cell = target.getCell();
|
||||||
|
if (!cell->getCell()->hasWater())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Based on observations from the original engine, the depth
|
||||||
|
// limit at which water walking can still be cast on a target
|
||||||
|
// in water appears to be the same as what the highest swimmable
|
||||||
|
// z position would be with SwimHeightScale + 1.
|
||||||
|
return !isUnderwater(target, mSwimHeightScale + 1);
|
||||||
|
}
|
||||||
|
|
||||||
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
||||||
{
|
{
|
||||||
return mPhysics->isOnGround(ptr);
|
return mPhysics->isOnGround(ptr);
|
||||||
|
|
|
@ -481,6 +481,7 @@ namespace MWWorld
|
||||||
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
||||||
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
||||||
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
|
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
|
||||||
|
|
Loading…
Reference in a new issue