2018-08-14 19:05:43 +00:00
|
|
|
#include <components/debug/debuglog.hpp>
|
2015-06-03 21:04:35 +00:00
|
|
|
|
2015-11-20 20:57:04 +00:00
|
|
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
2012-09-18 08:49:51 +00:00
|
|
|
|
|
|
|
#include <components/esm/loadcell.hpp>
|
2012-07-09 16:47:59 +00:00
|
|
|
|
2013-08-07 00:38:41 +00:00
|
|
|
#include <components/compiler/opcodes.hpp>
|
2012-07-09 16:47:59 +00:00
|
|
|
|
|
|
|
#include <components/interpreter/interpreter.hpp>
|
|
|
|
#include <components/interpreter/runtime.hpp>
|
|
|
|
#include <components/interpreter/opcodes.hpp>
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
2015-02-09 16:45:48 +00:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-07-09 16:47:59 +00:00
|
|
|
|
2015-02-09 14:01:49 +00:00
|
|
|
#include "../mwworld/cellstore.hpp"
|
2012-07-09 16:47:59 +00:00
|
|
|
#include "../mwworld/class.hpp"
|
2012-09-18 08:49:51 +00:00
|
|
|
#include "../mwworld/manualref.hpp"
|
2014-01-08 17:39:44 +00:00
|
|
|
#include "../mwworld/player.hpp"
|
2012-07-09 16:47:59 +00:00
|
|
|
|
2015-08-21 09:12:39 +00:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
2012-07-09 16:47:59 +00:00
|
|
|
#include "interpretercontext.hpp"
|
|
|
|
#include "ref.hpp"
|
|
|
|
|
|
|
|
namespace MWScript
|
|
|
|
{
|
|
|
|
namespace Transformation
|
|
|
|
{
|
2018-08-25 06:34:33 +00:00
|
|
|
void moveStandingActors(const MWWorld::Ptr &ptr, const osg::Vec3f& diff)
|
|
|
|
{
|
|
|
|
std::vector<MWWorld::Ptr> actors;
|
|
|
|
MWBase::Environment::get().getWorld()->getActorsStandingOn (ptr, actors);
|
|
|
|
for (auto& actor : actors)
|
|
|
|
{
|
|
|
|
osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3());
|
|
|
|
actorPos += diff;
|
|
|
|
MWBase::Environment::get().getWorld()->moveObject(actor, actorPos.x(), actorPos.y(), actorPos.z());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-09 16:47:59 +00:00
|
|
|
template<class R>
|
|
|
|
class OpSetScale : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2012-07-09 17:28:44 +00:00
|
|
|
Interpreter::Type_Float scale = runtime[0].mFloat;
|
2012-07-09 16:47:59 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-09 17:28:44 +00:00
|
|
|
template<class R>
|
|
|
|
class OpGetScale : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-05-25 12:13:07 +00:00
|
|
|
runtime.push(ptr.getCellRef().getScale());
|
2012-07-09 17:28:44 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-11-27 05:54:13 +00:00
|
|
|
template<class R>
|
|
|
|
class OpModScale : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Float scale = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
// add the parameter to the object's scale.
|
2014-05-25 12:13:07 +00:00
|
|
|
MWBase::Environment::get().getWorld()->scaleObject(ptr,ptr.getCellRef().getScale() + scale);
|
2012-11-27 05:54:13 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-09 16:47:59 +00:00
|
|
|
template<class R>
|
|
|
|
class OpSetAngle : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
2015-11-12 00:08:31 +00:00
|
|
|
Interpreter::Type_Float angle = osg::DegreesToRadians(runtime[0].mFloat);
|
2012-07-09 16:47:59 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
2015-11-12 00:08:31 +00:00
|
|
|
float ax = ptr.getRefData().getPosition().rot[0];
|
|
|
|
float ay = ptr.getRefData().getPosition().rot[1];
|
|
|
|
float az = ptr.getRefData().getPosition().rot[2];
|
2012-07-10 09:15:46 +00:00
|
|
|
|
2012-08-04 07:18:20 +00:00
|
|
|
if (axis == "x")
|
2014-03-07 05:11:00 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,angle,ay,az);
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis == "y")
|
2014-03-07 05:11:00 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,angle,az);
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis == "z")
|
2014-03-07 05:11:00 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,angle);
|
2012-08-04 07:18:20 +00:00
|
|
|
else
|
2014-03-13 20:04:39 +00:00
|
|
|
throw std::runtime_error ("invalid rotation axis: " + axis);
|
2012-07-09 16:47:59 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-09 17:28:44 +00:00
|
|
|
template<class R>
|
2012-08-01 10:21:42 +00:00
|
|
|
class OpGetStartingAngle : public Interpreter::Opcode0
|
2012-07-09 17:28:44 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
2012-08-04 07:18:20 +00:00
|
|
|
if (axis == "x")
|
2012-07-09 17:28:44 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getCellRef().getPosition().rot[0]));
|
2012-07-09 17:28:44 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis == "y")
|
2012-07-09 17:28:44 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getCellRef().getPosition().rot[1]));
|
2012-07-09 17:28:44 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis == "z")
|
2012-07-09 17:28:44 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getCellRef().getPosition().rot[2]));
|
2012-07-09 17:28:44 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else
|
2014-03-13 20:04:39 +00:00
|
|
|
throw std::runtime_error ("invalid rotation axis: " + axis);
|
2012-07-09 17:28:44 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-01 10:21:42 +00:00
|
|
|
template<class R>
|
|
|
|
class OpGetAngle : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
2012-08-02 12:57:35 +00:00
|
|
|
|
2012-08-04 07:18:20 +00:00
|
|
|
if (axis=="x")
|
2012-08-01 10:21:42 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[0]));
|
2012-08-01 10:21:42 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis=="y")
|
2012-08-01 10:21:42 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[1]));
|
2012-08-01 10:21:42 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else if (axis=="z")
|
2012-08-01 10:21:42 +00:00
|
|
|
{
|
2015-06-03 19:37:21 +00:00
|
|
|
runtime.push(osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[2]));
|
2012-08-01 10:21:42 +00:00
|
|
|
}
|
2012-08-04 07:18:20 +00:00
|
|
|
else
|
2014-03-13 20:04:39 +00:00
|
|
|
throw std::runtime_error ("invalid rotation axis: " + axis);
|
2012-08-01 10:21:42 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-03 16:14:05 +00:00
|
|
|
template<class R>
|
|
|
|
class OpGetPos : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
2012-08-05 14:21:53 +00:00
|
|
|
if(axis == "x")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
|
|
|
runtime.push(ptr.getRefData().getPosition().pos[0]);
|
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "y")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
|
|
|
runtime.push(ptr.getRefData().getPosition().pos[1]);
|
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "z")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
|
|
|
runtime.push(ptr.getRefData().getPosition().pos[2]);
|
|
|
|
}
|
2012-09-18 08:49:51 +00:00
|
|
|
else
|
2015-09-30 08:30:50 +00:00
|
|
|
throw std::runtime_error ("invalid axis: " + axis);
|
2012-08-03 16:14:05 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class R>
|
|
|
|
class OpSetPos : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-01-02 02:06:48 +00:00
|
|
|
|
|
|
|
if (!ptr.isInCell())
|
|
|
|
return;
|
|
|
|
|
2012-08-03 16:14:05 +00:00
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float pos = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
float ax = ptr.getRefData().getPosition().pos[0];
|
|
|
|
float ay = ptr.getRefData().getPosition().pos[1];
|
|
|
|
float az = ptr.getRefData().getPosition().pos[2];
|
|
|
|
|
2017-12-13 06:53:23 +00:00
|
|
|
// Note: SetPos does not skip weather transitions in vanilla engine, so we do not call setTeleported(true) here.
|
|
|
|
|
2014-12-11 18:27:13 +00:00
|
|
|
MWWorld::Ptr updated = ptr;
|
2012-08-05 14:21:53 +00:00
|
|
|
if(axis == "x")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
2014-12-11 18:27:13 +00:00
|
|
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,pos,ay,az);
|
2012-08-03 16:14:05 +00:00
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "y")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
2014-12-11 18:27:13 +00:00
|
|
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,pos,az);
|
2012-08-03 16:14:05 +00:00
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "z")
|
2012-08-03 16:14:05 +00:00
|
|
|
{
|
2017-12-10 10:38:02 +00:00
|
|
|
// We should not place actors under ground
|
|
|
|
if (ptr.getClass().isActor())
|
|
|
|
{
|
|
|
|
float terrainHeight = -std::numeric_limits<float>::max();
|
|
|
|
if (ptr.getCell()->isExterior())
|
|
|
|
terrainHeight = MWBase::Environment::get().getWorld()->getTerrainHeightAt(osg::Vec3f(ax, ay, az));
|
|
|
|
|
|
|
|
if (pos < terrainHeight)
|
|
|
|
pos = terrainHeight;
|
|
|
|
}
|
|
|
|
|
2014-12-11 18:27:13 +00:00
|
|
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos);
|
2012-08-03 16:14:05 +00:00
|
|
|
}
|
2012-09-18 08:49:51 +00:00
|
|
|
else
|
|
|
|
throw std::runtime_error ("invalid axis: " + axis);
|
2014-12-11 18:27:13 +00:00
|
|
|
|
2015-09-30 08:30:50 +00:00
|
|
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(ptr,updated);
|
2012-08-03 16:14:05 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-03 16:20:51 +00:00
|
|
|
template<class R>
|
|
|
|
class OpGetStartingPos : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
2012-08-05 14:21:53 +00:00
|
|
|
if(axis == "x")
|
2012-08-03 16:20:51 +00:00
|
|
|
{
|
2014-05-25 12:13:07 +00:00
|
|
|
runtime.push(ptr.getCellRef().getPosition().pos[0]);
|
2012-08-03 16:20:51 +00:00
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "y")
|
2012-08-03 16:20:51 +00:00
|
|
|
{
|
2014-05-25 12:13:07 +00:00
|
|
|
runtime.push(ptr.getCellRef().getPosition().pos[1]);
|
2012-08-03 16:20:51 +00:00
|
|
|
}
|
2012-08-09 21:50:44 +00:00
|
|
|
else if(axis == "z")
|
2012-08-03 16:20:51 +00:00
|
|
|
{
|
2014-05-25 12:13:07 +00:00
|
|
|
runtime.push(ptr.getCellRef().getPosition().pos[2]);
|
2012-08-03 16:20:51 +00:00
|
|
|
}
|
2012-09-18 08:49:51 +00:00
|
|
|
else
|
|
|
|
throw std::runtime_error ("invalid axis: " + axis);
|
2012-08-03 16:20:51 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-09 21:45:06 +00:00
|
|
|
template<class R>
|
|
|
|
class OpPositionCell : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-01-02 02:06:48 +00:00
|
|
|
|
2014-05-19 12:09:16 +00:00
|
|
|
if (ptr.getContainerStore())
|
2014-01-02 02:06:48 +00:00
|
|
|
return;
|
|
|
|
|
2015-08-21 09:12:39 +00:00
|
|
|
if (ptr == MWMechanics::getPlayer())
|
2013-12-31 19:40:23 +00:00
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
|
|
|
}
|
2012-08-09 21:45:06 +00:00
|
|
|
|
|
|
|
Interpreter::Type_Float x = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float y = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float z = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
std::string cellID = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
2012-08-11 20:08:04 +00:00
|
|
|
MWWorld::CellStore* store = 0;
|
2012-08-11 17:16:00 +00:00
|
|
|
try
|
|
|
|
{
|
2012-08-18 08:50:58 +00:00
|
|
|
store = MWBase::Environment::get().getWorld()->getInterior(cellID);
|
2012-08-11 17:16:00 +00:00
|
|
|
}
|
2014-05-15 01:12:52 +00:00
|
|
|
catch(std::exception&)
|
2012-08-11 07:52:49 +00:00
|
|
|
{
|
2015-12-06 21:37:04 +00:00
|
|
|
// cell not found, move to exterior instead (vanilla PositionCell compatibility)
|
2015-09-30 08:30:50 +00:00
|
|
|
const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getExterior(cellID);
|
2015-03-02 16:53:59 +00:00
|
|
|
int cx,cy;
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
|
|
|
store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
|
|
|
if(!cell)
|
2012-08-11 07:52:49 +00:00
|
|
|
{
|
2017-03-02 21:07:43 +00:00
|
|
|
std::string error = "Warning: PositionCell: unknown interior cell (" + cellID + "), moving to exterior instead";
|
2015-12-06 21:37:04 +00:00
|
|
|
runtime.getContext().report (error);
|
2018-08-14 19:05:43 +00:00
|
|
|
Log(Debug::Warning) << error;
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
2012-08-11 07:52:49 +00:00
|
|
|
}
|
|
|
|
if(store)
|
2012-08-09 21:45:06 +00:00
|
|
|
{
|
2015-09-30 08:30:50 +00:00
|
|
|
MWWorld::Ptr base = ptr;
|
2015-11-12 13:32:39 +00:00
|
|
|
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
|
2015-09-30 08:30:50 +00:00
|
|
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(base,ptr);
|
2014-12-11 18:27:13 +00:00
|
|
|
|
2016-02-22 18:13:56 +00:00
|
|
|
float ax = ptr.getRefData().getPosition().rot[0];
|
|
|
|
float ay = ptr.getRefData().getPosition().rot[1];
|
2014-12-01 15:43:55 +00:00
|
|
|
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
|
|
|
// except for when you position the player, then degrees must be used.
|
|
|
|
// See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
|
2015-08-21 09:12:39 +00:00
|
|
|
if(ptr != MWMechanics::getPlayer())
|
2015-03-08 00:07:29 +00:00
|
|
|
zRot = zRot/60.0f;
|
2015-11-12 00:08:31 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,osg::DegreesToRadians(zRot));
|
2013-04-03 21:55:57 +00:00
|
|
|
|
2014-07-31 02:24:45 +00:00
|
|
|
ptr.getClass().adjustPosition(ptr, false);
|
2012-08-18 08:50:58 +00:00
|
|
|
}
|
2012-08-09 21:45:06 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-05 14:44:56 +00:00
|
|
|
template<class R>
|
|
|
|
class OpPosition : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-01-02 02:06:48 +00:00
|
|
|
|
|
|
|
if (!ptr.isInCell())
|
|
|
|
return;
|
|
|
|
|
2015-08-21 09:12:39 +00:00
|
|
|
if (ptr == MWMechanics::getPlayer())
|
2013-12-31 19:40:23 +00:00
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
|
|
|
}
|
2012-08-05 14:44:56 +00:00
|
|
|
|
|
|
|
Interpreter::Type_Float x = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float y = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float z = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
2012-08-11 16:07:20 +00:00
|
|
|
int cx,cy;
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
2014-08-11 00:01:20 +00:00
|
|
|
|
|
|
|
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
|
|
|
// non-player actors will move within the cell they are in.
|
2015-09-30 08:30:50 +00:00
|
|
|
MWWorld::Ptr base = ptr;
|
2015-08-21 09:12:39 +00:00
|
|
|
if (ptr == MWMechanics::getPlayer())
|
2014-08-11 00:01:20 +00:00
|
|
|
{
|
2014-12-11 18:27:13 +00:00
|
|
|
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
2015-11-12 13:32:39 +00:00
|
|
|
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
|
2014-08-11 00:01:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-05-17 14:25:13 +00:00
|
|
|
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z);
|
2014-08-11 00:01:20 +00:00
|
|
|
}
|
2015-09-30 08:30:50 +00:00
|
|
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(base,ptr);
|
2014-08-11 00:01:20 +00:00
|
|
|
|
2016-02-22 18:13:56 +00:00
|
|
|
float ax = ptr.getRefData().getPosition().rot[0];
|
|
|
|
float ay = ptr.getRefData().getPosition().rot[1];
|
2014-12-01 15:43:55 +00:00
|
|
|
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
|
|
|
// except for when you position the player, then degrees must be used.
|
|
|
|
// See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
|
2015-08-21 09:12:39 +00:00
|
|
|
if(ptr != MWMechanics::getPlayer())
|
2015-03-08 00:07:29 +00:00
|
|
|
zRot = zRot/60.0f;
|
2016-02-22 18:13:56 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,osg::DegreesToRadians(zRot));
|
2014-07-31 02:24:45 +00:00
|
|
|
ptr.getClass().adjustPosition(ptr, false);
|
2012-08-05 14:44:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-09-02 15:57:03 +00:00
|
|
|
template<class R>
|
|
|
|
class OpPlaceItemCell : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
std::string itemID = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
std::string cellID = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
Interpreter::Type_Float x = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float y = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float z = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
2015-11-11 20:19:50 +00:00
|
|
|
Interpreter::Type_Float zRotDegrees = runtime[0].mFloat;
|
2012-09-02 15:57:03 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
MWWorld::CellStore* store = 0;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
store = MWBase::Environment::get().getWorld()->getInterior(cellID);
|
|
|
|
}
|
2014-05-15 01:12:52 +00:00
|
|
|
catch(std::exception&)
|
2012-09-02 15:57:03 +00:00
|
|
|
{
|
|
|
|
const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getExterior(cellID);
|
2015-03-02 16:53:59 +00:00
|
|
|
int cx,cy;
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
|
|
|
store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
|
|
|
if(!cell)
|
2012-09-02 15:57:03 +00:00
|
|
|
{
|
2015-03-03 22:36:22 +00:00
|
|
|
runtime.getContext().report ("unknown cell (" + cellID + ")");
|
2018-08-14 19:05:43 +00:00
|
|
|
Log(Debug::Error) << "Error: unknown cell (" << cellID << ")";
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(store)
|
|
|
|
{
|
|
|
|
ESM::Position pos;
|
|
|
|
pos.pos[0] = x;
|
|
|
|
pos.pos[1] = y;
|
|
|
|
pos.pos[2] = z;
|
|
|
|
pos.rot[0] = pos.rot[1] = 0;
|
2015-11-11 20:19:50 +00:00
|
|
|
pos.rot[2] = osg::DegreesToRadians(zRotDegrees);
|
2012-09-17 12:12:27 +00:00
|
|
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
|
2014-05-25 12:13:07 +00:00
|
|
|
ref.getPtr().getCellRef().setPosition(pos);
|
2016-02-29 16:05:18 +00:00
|
|
|
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(ref.getPtr(),store,pos);
|
2014-12-11 21:25:53 +00:00
|
|
|
placed.getClass().adjustPosition(placed, true);
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class R>
|
|
|
|
class OpPlaceItem : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
std::string itemID = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
Interpreter::Type_Float x = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float y = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float z = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
2015-11-11 20:19:50 +00:00
|
|
|
Interpreter::Type_Float zRotDegrees = runtime[0].mFloat;
|
2012-09-02 15:57:03 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
2015-08-21 09:12:39 +00:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2015-12-08 23:48:51 +00:00
|
|
|
|
|
|
|
if (!player.isInCell())
|
|
|
|
throw std::runtime_error("player not in a cell");
|
|
|
|
|
2018-10-09 06:21:12 +00:00
|
|
|
MWWorld::CellStore* store = nullptr;
|
2014-09-08 21:57:16 +00:00
|
|
|
if (player.getCell()->isExterior())
|
2012-09-02 15:57:03 +00:00
|
|
|
{
|
2014-09-08 21:57:16 +00:00
|
|
|
int cx,cy;
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
|
|
|
store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
|
|
|
else
|
2014-09-08 21:57:16 +00:00
|
|
|
store = player.getCell();
|
|
|
|
|
|
|
|
ESM::Position pos;
|
|
|
|
pos.pos[0] = x;
|
|
|
|
pos.pos[1] = y;
|
|
|
|
pos.pos[2] = z;
|
|
|
|
pos.rot[0] = pos.rot[1] = 0;
|
2015-11-11 20:19:50 +00:00
|
|
|
pos.rot[2] = osg::DegreesToRadians(zRotDegrees);
|
2014-09-08 21:57:16 +00:00
|
|
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
|
|
|
|
ref.getPtr().getCellRef().setPosition(pos);
|
2016-02-29 16:05:18 +00:00
|
|
|
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(ref.getPtr(),store,pos);
|
2014-12-11 21:25:53 +00:00
|
|
|
placed.getClass().adjustPosition(placed, true);
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-10-14 19:49:21 +00:00
|
|
|
template<class R, bool pc>
|
|
|
|
class OpPlaceAt : public Interpreter::Opcode0
|
2012-09-02 15:57:03 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
2013-10-14 19:49:21 +00:00
|
|
|
MWWorld::Ptr actor = pc
|
2015-08-21 09:12:39 +00:00
|
|
|
? MWMechanics::getPlayer()
|
2013-10-14 19:49:21 +00:00
|
|
|
: R()(runtime);
|
2012-09-02 15:57:03 +00:00
|
|
|
|
|
|
|
std::string itemID = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
Interpreter::Type_Integer count = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float distance = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Integer direction = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
2016-06-02 19:19:02 +00:00
|
|
|
if (direction < 0 || direction > 3)
|
|
|
|
throw std::runtime_error ("invalid direction");
|
|
|
|
|
2013-04-06 17:25:29 +00:00
|
|
|
if (count<0)
|
|
|
|
throw std::runtime_error ("count must be non-negative");
|
|
|
|
|
2015-12-08 23:48:51 +00:00
|
|
|
if (!actor.isInCell())
|
|
|
|
throw std::runtime_error ("actor is not in a cell");
|
|
|
|
|
2016-02-29 15:54:00 +00:00
|
|
|
for (int i=0; i<count; ++i)
|
|
|
|
{
|
2015-01-31 16:58:10 +00:00
|
|
|
// create item
|
|
|
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), itemID, 1);
|
2012-09-17 11:36:48 +00:00
|
|
|
|
2018-04-19 20:43:13 +00:00
|
|
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(), actor, actor.getCell(), direction, distance);
|
|
|
|
MWBase::Environment::get().getWorld()->scaleObject(ptr, actor.getCellRef().getScale());
|
2013-11-30 07:29:22 +00:00
|
|
|
}
|
2012-09-02 15:57:03 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-10 20:53:03 +00:00
|
|
|
template<class R>
|
|
|
|
class OpRotate : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
2013-04-15 14:45:53 +00:00
|
|
|
const MWWorld::Ptr& ptr = R()(runtime);
|
2013-04-10 20:53:03 +00:00
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
2015-11-12 00:16:37 +00:00
|
|
|
Interpreter::Type_Float rotation = osg::DegreesToRadians(runtime[0].mFloat*MWBase::Environment::get().getFrameDuration());
|
2013-04-10 20:53:03 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
2015-11-12 00:16:37 +00:00
|
|
|
float ax = ptr.getRefData().getPosition().rot[0];
|
|
|
|
float ay = ptr.getRefData().getPosition().rot[1];
|
|
|
|
float az = ptr.getRefData().getPosition().rot[2];
|
2013-04-25 17:14:10 +00:00
|
|
|
|
2013-04-14 19:42:37 +00:00
|
|
|
if (axis == "x")
|
2015-11-12 00:16:37 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax+rotation,ay,az);
|
2013-04-14 19:42:37 +00:00
|
|
|
else if (axis == "y")
|
2015-11-12 00:16:37 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay+rotation,az);
|
2013-04-10 20:53:03 +00:00
|
|
|
else if (axis == "z")
|
2015-11-12 00:16:37 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,az+rotation);
|
2013-04-10 20:53:03 +00:00
|
|
|
else
|
2013-04-26 15:28:19 +00:00
|
|
|
throw std::runtime_error ("invalid rotation axis: " + axis);
|
2013-04-10 20:53:03 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-15 14:45:53 +00:00
|
|
|
template<class R>
|
|
|
|
class OpRotateWorld : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
2015-11-12 00:08:31 +00:00
|
|
|
Interpreter::Type_Float rotation = osg::DegreesToRadians(runtime[0].mFloat*MWBase::Environment::get().getFrameDuration());
|
2013-04-15 14:45:53 +00:00
|
|
|
runtime.pop();
|
|
|
|
|
2018-05-30 10:43:07 +00:00
|
|
|
if (!ptr.getRefData().getBaseNode())
|
|
|
|
return;
|
2013-04-15 14:45:53 +00:00
|
|
|
|
2018-05-30 10:43:07 +00:00
|
|
|
// We can rotate actors only around Z axis
|
|
|
|
if (ptr.getClass().isActor() && (axis == "x" || axis == "y"))
|
|
|
|
return;
|
2013-04-15 14:45:53 +00:00
|
|
|
|
2018-05-30 10:43:07 +00:00
|
|
|
osg::Quat rot;
|
2013-04-15 14:45:53 +00:00
|
|
|
if (axis == "x")
|
2018-05-30 10:43:07 +00:00
|
|
|
rot = osg::Quat(rotation, -osg::X_AXIS);
|
2013-04-15 14:45:53 +00:00
|
|
|
else if (axis == "y")
|
2018-05-30 10:43:07 +00:00
|
|
|
rot = osg::Quat(rotation, -osg::Y_AXIS);
|
2013-04-15 14:45:53 +00:00
|
|
|
else if (axis == "z")
|
2018-05-30 10:43:07 +00:00
|
|
|
rot = osg::Quat(rotation, -osg::Z_AXIS);
|
2013-04-15 14:45:53 +00:00
|
|
|
else
|
|
|
|
throw std::runtime_error ("invalid rotation axis: " + axis);
|
2018-05-30 10:43:07 +00:00
|
|
|
|
|
|
|
osg::Quat attitude = ptr.getRefData().getBaseNode()->getAttitude();
|
|
|
|
MWBase::Environment::get().getWorld()->rotateWorldObject(ptr, attitude * rot);
|
2013-04-15 14:45:53 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-26 00:02:51 +00:00
|
|
|
template<class R>
|
|
|
|
class OpSetAtStart : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-01-02 02:06:48 +00:00
|
|
|
|
|
|
|
if (!ptr.isInCell())
|
|
|
|
return;
|
|
|
|
|
2015-11-12 00:16:37 +00:00
|
|
|
float xr = ptr.getCellRef().getPosition().rot[0];
|
|
|
|
float yr = ptr.getCellRef().getPosition().rot[1];
|
|
|
|
float zr = ptr.getCellRef().getPosition().rot[2];
|
2014-06-14 15:56:41 +00:00
|
|
|
|
2015-11-12 00:16:37 +00:00
|
|
|
MWBase::Environment::get().getWorld()->rotateObject(ptr, xr, yr, zr);
|
2014-12-11 18:27:13 +00:00
|
|
|
|
2015-09-30 08:30:50 +00:00
|
|
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(ptr,
|
2014-12-11 18:27:13 +00:00
|
|
|
MWBase::Environment::get().getWorld()->moveObject(ptr, ptr.getCellRef().getPosition().pos[0],
|
|
|
|
ptr.getCellRef().getPosition().pos[1], ptr.getCellRef().getPosition().pos[2]));
|
2013-04-26 00:02:51 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-26 15:28:19 +00:00
|
|
|
template<class R>
|
|
|
|
class OpMove : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
const MWWorld::Ptr& ptr = R()(runtime);
|
|
|
|
|
2014-01-02 02:06:48 +00:00
|
|
|
if (!ptr.isInCell())
|
|
|
|
return;
|
|
|
|
|
2013-04-26 15:28:19 +00:00
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float movement = (runtime[0].mFloat*MWBase::Environment::get().getFrameDuration());
|
|
|
|
runtime.pop();
|
|
|
|
|
2015-05-12 17:02:56 +00:00
|
|
|
osg::Vec3f posChange;
|
2013-04-26 15:28:19 +00:00
|
|
|
if (axis == "x")
|
|
|
|
{
|
2015-05-12 17:02:56 +00:00
|
|
|
posChange=osg::Vec3f(movement, 0, 0);
|
2013-04-26 15:28:19 +00:00
|
|
|
}
|
|
|
|
else if (axis == "y")
|
|
|
|
{
|
2015-05-12 17:02:56 +00:00
|
|
|
posChange=osg::Vec3f(0, movement, 0);
|
2013-04-26 15:28:19 +00:00
|
|
|
}
|
|
|
|
else if (axis == "z")
|
|
|
|
{
|
2015-05-12 17:02:56 +00:00
|
|
|
posChange=osg::Vec3f(0, 0, movement);
|
2013-04-26 15:28:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
throw std::runtime_error ("invalid movement axis: " + axis);
|
|
|
|
|
2015-05-12 17:02:56 +00:00
|
|
|
// is it correct that disabled objects can't be Move-d?
|
|
|
|
if (!ptr.getRefData().getBaseNode())
|
2014-12-27 16:20:37 +00:00
|
|
|
return;
|
|
|
|
|
2015-05-12 17:02:56 +00:00
|
|
|
osg::Vec3f diff = ptr.getRefData().getBaseNode()->getAttitude() * posChange;
|
|
|
|
osg::Vec3f worldPos(ptr.getRefData().getPosition().asVec3());
|
2015-02-02 03:20:33 +00:00
|
|
|
worldPos += diff;
|
2018-08-25 06:34:33 +00:00
|
|
|
|
|
|
|
// We should move actors, standing on moving object, too.
|
|
|
|
// This approach can be used to create elevators.
|
|
|
|
moveStandingActors(ptr, diff);
|
2015-05-12 17:02:56 +00:00
|
|
|
MWBase::Environment::get().getWorld()->moveObject(ptr, worldPos.x(), worldPos.y(), worldPos.z());
|
2013-04-26 15:28:19 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class R>
|
|
|
|
class OpMoveWorld : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-01-02 02:06:48 +00:00
|
|
|
if (!ptr.isInCell())
|
|
|
|
return;
|
|
|
|
|
2013-04-26 15:28:19 +00:00
|
|
|
std::string axis = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
Interpreter::Type_Float movement = (runtime[0].mFloat*MWBase::Environment::get().getFrameDuration());
|
|
|
|
runtime.pop();
|
|
|
|
|
2014-06-14 15:56:41 +00:00
|
|
|
const float *objPos = ptr.getRefData().getPosition().pos;
|
2018-08-25 06:34:33 +00:00
|
|
|
osg::Vec3f diff;
|
2013-04-26 15:28:19 +00:00
|
|
|
|
|
|
|
if (axis == "x")
|
2018-08-25 06:34:33 +00:00
|
|
|
diff.x() += movement;
|
2013-04-26 15:28:19 +00:00
|
|
|
else if (axis == "y")
|
2018-08-25 06:34:33 +00:00
|
|
|
diff.y() += movement;
|
2013-04-26 15:28:19 +00:00
|
|
|
else if (axis == "z")
|
2018-08-25 06:34:33 +00:00
|
|
|
diff.z() += movement;
|
2013-04-26 15:28:19 +00:00
|
|
|
else
|
|
|
|
throw std::runtime_error ("invalid movement axis: " + axis);
|
2018-08-25 06:34:33 +00:00
|
|
|
|
|
|
|
// We should move actors, standing on moving object, too.
|
|
|
|
// This approach can be used to create elevators.
|
|
|
|
moveStandingActors(ptr, diff);
|
|
|
|
MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0]+diff.x(), objPos[1]+diff.y(), objPos[2]+diff.z());
|
2013-04-26 15:28:19 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-30 15:55:35 +00:00
|
|
|
class OpResetActors : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->resetActors();
|
|
|
|
}
|
|
|
|
};
|
2013-04-26 15:28:19 +00:00
|
|
|
|
2016-01-20 03:07:07 +00:00
|
|
|
class OpFixme : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
{
|
2018-10-23 22:40:57 +00:00
|
|
|
MWBase::Environment::get().getWorld()->fixPosition();
|
2016-01-20 03:07:07 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-09 16:47:59 +00:00
|
|
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
|
|
|
{
|
2013-08-07 00:38:41 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetScale,new OpSetScale<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetScaleExplicit,new OpSetScale<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetAngle,new OpSetAngle<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetAngleExplicit,new OpSetAngle<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetScale,new OpGetScale<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetScaleExplicit,new OpGetScale<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetAngle,new OpGetAngle<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetAngleExplicit,new OpGetAngle<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetPos,new OpGetPos<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetPosExplicit,new OpGetPos<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetPos,new OpSetPos<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetPosExplicit,new OpSetPos<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetStartingPos,new OpGetStartingPos<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetStartingPosExplicit,new OpGetStartingPos<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePosition,new OpPosition<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePositionExplicit,new OpPosition<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePositionCell,new OpPositionCell<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePositionCellExplicit,new OpPositionCell<ExplicitRef>);
|
2015-09-30 08:30:50 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePlaceItemCell,new OpPlaceItemCell<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePlaceItem,new OpPlaceItem<ImplicitRef>);
|
2013-10-14 19:49:21 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePlaceAtPc,new OpPlaceAt<ImplicitRef, true>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePlaceAtMe,new OpPlaceAt<ImplicitRef, false>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodePlaceAtMeExplicit,new OpPlaceAt<ExplicitRef, false>);
|
2013-08-07 00:38:41 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeModScale,new OpModScale<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeModScaleExplicit,new OpModScale<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeRotate,new OpRotate<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeRotateExplicit,new OpRotate<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeRotateWorld,new OpRotateWorld<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeRotateWorldExplicit,new OpRotateWorld<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetAtStart,new OpSetAtStart<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeSetAtStartExplicit,new OpSetAtStart<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeMove,new OpMove<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeMoveExplicit,new OpMove<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeMoveWorld,new OpMoveWorld<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeMoveWorldExplicit,new OpMoveWorld<ExplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetStartingAngle, new OpGetStartingAngle<ImplicitRef>);
|
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeGetStartingAngleExplicit, new OpGetStartingAngle<ExplicitRef>);
|
2014-08-30 15:55:35 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeResetActors, new OpResetActors);
|
2018-09-13 09:21:38 +00:00
|
|
|
interpreter.installSegment5(Compiler::Transformation::opcodeFixme, new OpFixme);
|
2012-07-09 16:47:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|