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

Added SetAtStart

This commit is contained in:
scrawl 2013-04-26 02:02:51 +02:00
parent 4e45222a63
commit a373f53988
2 changed files with 26 additions and 1 deletions

View file

@ -322,5 +322,7 @@ op 0x20001ff: Rotate
op 0x2000200: Rotate, explicit reference
op 0x2000201: RotateWorld
op 0x2000202: RotateWorld, explicit reference
op 0x2000203: SetAtStart
op 0x2000204: SetAtStart, explicit
opcodes 0x2000203-0x3ffffff unused
opcodes 0x2000205-0x3ffffff unused

View file

@ -620,6 +620,24 @@ namespace MWScript
}
};
template<class R>
class OpSetAtStart : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
ptr.getRefData().getLocalRotation().rot[0] = 0;
ptr.getRefData().getLocalRotation().rot[1] = 0;
ptr.getRefData().getLocalRotation().rot[2] = 0;
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0,0,0,true);
MWBase::Environment::get().getWorld()->moveObject(ptr, ptr.getCellRef().mPos.pos[0],
ptr.getCellRef().mPos.pos[1], ptr.getCellRef().mPos.pos[2]);
}
};
const int opcodeSetScale = 0x2000164;
const int opcodeSetScaleExplicit = 0x2000165;
const int opcodeSetAngle = 0x2000166;
@ -650,6 +668,8 @@ namespace MWScript
const int opcodeRotateExplicit = 0x2000200;
const int opcodeRotateWorld = 0x2000201;
const int opcodeRotateWorldExplicit = 0x2000202;
const int opcodeSetAtStart = 0x2000203;
const int opcodeSetAtStartExplicit = 0x2000204;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -669,6 +689,7 @@ namespace MWScript
extensions.registerInstruction("modscale","f",opcodeModScale,opcodeModScaleExplicit);
extensions.registerInstruction("rotate","cf",opcodeRotate,opcodeRotateExplicit);
extensions.registerInstruction("rotateworld","cf",opcodeRotateWorld,opcodeRotateWorldExplicit);
extensions.registerInstruction("setatstart","",opcodeSetAtStart,opcodeSetAtStartExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -702,6 +723,8 @@ namespace MWScript
interpreter.installSegment5(opcodeRotateExplicit,new OpRotate<ExplicitRef>);
interpreter.installSegment5(opcodeRotateWorld,new OpRotateWorld<ImplicitRef>);
interpreter.installSegment5(opcodeRotateWorldExplicit,new OpRotateWorld<ExplicitRef>);
interpreter.installSegment5(opcodeSetAtStart,new OpSetAtStart<ImplicitRef>);
interpreter.installSegment5(opcodeSetAtStartExplicit,new OpSetAtStart<ExplicitRef>);
}
}
}