mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
SetAngle and SetScale script instruction
This commit is contained in:
parent
d8051095d6
commit
f83ffecae5
2 changed files with 41 additions and 1 deletions
|
@ -146,4 +146,6 @@ op 0x200014f: ForceGreeting
|
||||||
op 0x2000150: ForceGreeting, explicit reference
|
op 0x2000150: ForceGreeting, explicit reference
|
||||||
op 0x2000151: ToggleFullHelp
|
op 0x2000151: ToggleFullHelp
|
||||||
op 0x2000152: Goodbye
|
op 0x2000152: Goodbye
|
||||||
opcodes 0x2000153-0x3ffffff unused
|
op 0x2000153: SetScale
|
||||||
|
op 0x2000154: SetAngle
|
||||||
|
opcodes 0x2000155-0x3ffffff unused
|
||||||
|
|
|
@ -516,6 +516,35 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
Interpreter::Type_Float angle = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
if(axis == "X")
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->setObjectRotation(ptr,angle,0,0);
|
||||||
|
}
|
||||||
|
if(axis == "Y")
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->setObjectRotation(ptr,0,angle,0);
|
||||||
|
}
|
||||||
|
if(axis == "Z")
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->setObjectRotation(ptr,0,0,angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int numberOfAttributes = 8;
|
const int numberOfAttributes = 8;
|
||||||
|
|
||||||
const int opcodeGetAttribute = 0x2000027;
|
const int opcodeGetAttribute = 0x2000027;
|
||||||
|
@ -562,6 +591,9 @@ namespace MWScript
|
||||||
const int opcodeModDisposition = 0x200014d;
|
const int opcodeModDisposition = 0x200014d;
|
||||||
const int opcodeModDispositionExplicit = 0x200014e;
|
const int opcodeModDispositionExplicit = 0x200014e;
|
||||||
|
|
||||||
|
const int opcodeSetScale = 0x2000153;
|
||||||
|
const int opcodeSetAngle = 0x2000154;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
static const char *attributes[numberOfAttributes] =
|
static const char *attributes[numberOfAttributes] =
|
||||||
|
@ -644,6 +676,9 @@ namespace MWScript
|
||||||
extensions.registerInstruction("moddisposition","l",opcodeModDisposition,
|
extensions.registerInstruction("moddisposition","l",opcodeModDisposition,
|
||||||
opcodeModDispositionExplicit);
|
opcodeModDispositionExplicit);
|
||||||
extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit);
|
extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit);
|
||||||
|
|
||||||
|
extensions.registerInstruction("setscale","/l",opcodeSetScale);
|
||||||
|
extensions.registerInstruction("setangle","/Sl",opcodeSetAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -715,6 +750,9 @@ namespace MWScript
|
||||||
interpreter.installSegment5(opcodeModDispositionExplicit,new OpModDisposition<ExplicitRef>);
|
interpreter.installSegment5(opcodeModDispositionExplicit,new OpModDisposition<ExplicitRef>);
|
||||||
interpreter.installSegment3(opcodeGetPCRank,new OpGetPCRank<ImplicitRef>);
|
interpreter.installSegment3(opcodeGetPCRank,new OpGetPCRank<ImplicitRef>);
|
||||||
interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);
|
interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);
|
||||||
|
|
||||||
|
interpreter.installSegment5(opcodeSetScale,new OpSetScale<ImplicitRef>);
|
||||||
|
interpreter.installSegment5(opcodeSetAngle,new OpSetAngle<ImplicitRef>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue