1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Implement mark/recall magic effects

This commit is contained in:
scrawl 2014-01-01 17:06:21 +01:00
parent 69ba8a40bf
commit 8e5cae1081
3 changed files with 35 additions and 4 deletions

View file

@ -8,6 +8,7 @@
#include "../mwworld/containerstore.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/actionteleport.hpp"
#include "../mwrender/animation.hpp"
@ -259,13 +260,21 @@ namespace MWMechanics
else if (effectId == ESM::MagicEffect::Mark)
{
// TODO
MWBase::Environment::get().getWorld()->getPlayer().markPosition(
target.getCell(), target.getRefData().getPosition());
}
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);
}
}
}
}

View file

@ -21,7 +21,8 @@ namespace MWWorld
mLastKnownExteriorPosition(0,0,0),
mAutoMove(false),
mForwardBackward (0),
mTeleported(false)
mTeleported(false),
mMarkedCell(NULL)
{
mPlayer.mBase = player;
mPlayer.mRef.mRefID = "player";
@ -157,4 +158,17 @@ namespace MWWorld
{
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;
}
}

View file

@ -32,6 +32,10 @@ namespace MWWorld
Ogre::Vector3 mLastKnownExteriorPosition;
ESM::Position mMarkedPosition;
// If no position was marked, this is NULL
CellStore* mMarkedCell;
bool mAutoMove;
int mForwardBackward;
bool mTeleported;
@ -39,6 +43,10 @@ namespace MWWorld
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
/// world position is still required for divine / almsivi magic effects
/// and the player arrow on the global map.