mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-24 18:39:59 +00:00
Implement mark/recall magic effects
This commit is contained in:
parent
69ba8a40bf
commit
8e5cae1081
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/actionteleport.hpp"
|
||||||
|
|
||||||
#include "../mwrender/animation.hpp"
|
#include "../mwrender/animation.hpp"
|
||||||
|
|
||||||
@ -259,13 +260,21 @@ namespace MWMechanics
|
|||||||
|
|
||||||
else if (effectId == ESM::MagicEffect::Mark)
|
else if (effectId == ESM::MagicEffect::Mark)
|
||||||
{
|
{
|
||||||
// TODO
|
MWBase::Environment::get().getWorld()->getPlayer().markPosition(
|
||||||
|
target.getCell(), target.getRefData().getPosition());
|
||||||
}
|
}
|
||||||
else if (effectId == ESM::MagicEffect::Recall)
|
else if (effectId == ESM::MagicEffect::Recall)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
MWWorld::CellStore* markedCell = NULL;
|
||||||
|
ESM::Position markedPosition;
|
||||||
|
|
||||||
// TODO
|
MWBase::Environment::get().getWorld()->getPlayer().getMarkedPosition(markedCell, markedPosition);
|
||||||
|
if (markedCell)
|
||||||
|
{
|
||||||
|
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->mCell->mName,
|
||||||
|
markedPosition);
|
||||||
|
action.execute(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ namespace MWWorld
|
|||||||
mLastKnownExteriorPosition(0,0,0),
|
mLastKnownExteriorPosition(0,0,0),
|
||||||
mAutoMove(false),
|
mAutoMove(false),
|
||||||
mForwardBackward (0),
|
mForwardBackward (0),
|
||||||
mTeleported(false)
|
mTeleported(false),
|
||||||
|
mMarkedCell(NULL)
|
||||||
{
|
{
|
||||||
mPlayer.mBase = player;
|
mPlayer.mBase = player;
|
||||||
mPlayer.mRef.mRefID = "player";
|
mPlayer.mRef.mRefID = "player";
|
||||||
@ -157,4 +158,17 @@ namespace MWWorld
|
|||||||
{
|
{
|
||||||
mTeleported = teleported;
|
mTeleported = teleported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::markPosition(CellStore *markedCell, ESM::Position markedPosition)
|
||||||
|
{
|
||||||
|
mMarkedCell = markedCell;
|
||||||
|
mMarkedPosition = markedPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::getMarkedPosition(CellStore*& markedCell, ESM::Position &markedPosition) const
|
||||||
|
{
|
||||||
|
markedCell = mMarkedCell;
|
||||||
|
if (mMarkedCell)
|
||||||
|
markedPosition = mMarkedPosition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@ namespace MWWorld
|
|||||||
|
|
||||||
Ogre::Vector3 mLastKnownExteriorPosition;
|
Ogre::Vector3 mLastKnownExteriorPosition;
|
||||||
|
|
||||||
|
ESM::Position mMarkedPosition;
|
||||||
|
// If no position was marked, this is NULL
|
||||||
|
CellStore* mMarkedCell;
|
||||||
|
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
int mForwardBackward;
|
int mForwardBackward;
|
||||||
bool mTeleported;
|
bool mTeleported;
|
||||||
@ -39,6 +43,10 @@ namespace MWWorld
|
|||||||
|
|
||||||
Player(const ESM::NPC *player, const MWBase::World& world);
|
Player(const ESM::NPC *player, const MWBase::World& world);
|
||||||
|
|
||||||
|
// For mark/recall magic effects
|
||||||
|
void markPosition (CellStore* markedCell, ESM::Position markedPosition);
|
||||||
|
void getMarkedPosition (CellStore*& markedCell, ESM::Position& markedPosition) const;
|
||||||
|
|
||||||
/// Interiors can not always be mapped to a world position. However
|
/// Interiors can not always be mapped to a world position. However
|
||||||
/// world position is still required for divine / almsivi magic effects
|
/// world position is still required for divine / almsivi magic effects
|
||||||
/// and the player arrow on the global map.
|
/// and the player arrow on the global map.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user