mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
GetWerewolfKills, ModScale, SetDelete, GetSquareRoot
This commit is contained in:
parent
1ccad32877
commit
d6dd212ce8
4 changed files with 79 additions and 2 deletions
|
@ -275,7 +275,13 @@ op 0x20001de: HasSoulGem
|
||||||
op 0x20001df: HasSoulGem, explicit
|
op 0x20001df: HasSoulGem, explicit
|
||||||
op 0x20001e0: GetWeaponType
|
op 0x20001e0: GetWeaponType
|
||||||
op 0x20001e1: GetWeaponType, explicit
|
op 0x20001e1: GetWeaponType, explicit
|
||||||
opcodes 0x20001e2-0x3ffffff unused
|
op 0x20001e2: GetWerewolfKills
|
||||||
|
op 0x20001e3: ModScale
|
||||||
|
op 0x20001e4: ModScale, explicit
|
||||||
|
op 0x20001e5: SetDelete
|
||||||
|
op 0x20001e6: SetDelete, explicit
|
||||||
|
op 0x20001e7: GetSquareRoot
|
||||||
|
opcodes 0x20001e3-0x3ffffff unused
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -357,6 +357,31 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class R>
|
||||||
|
class OpSetDelete : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
MWBase::Environment::get().getWorld()->deleteObject (ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpGetSquareRoot : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
float param = runtime[0].mFloat;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
runtime.push(std::sqrt (param));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
const int opcodeActivate = 0x2000075;
|
const int opcodeActivate = 0x2000075;
|
||||||
|
@ -387,6 +412,9 @@ namespace MWScript
|
||||||
const int opcodeGetSpellEffects = 0x20001db;
|
const int opcodeGetSpellEffects = 0x20001db;
|
||||||
const int opcodeGetSpellEffectsExplicit = 0x20001dc;
|
const int opcodeGetSpellEffectsExplicit = 0x20001dc;
|
||||||
const int opcodeGetCurrentTime = 0x20001dd;
|
const int opcodeGetCurrentTime = 0x20001dd;
|
||||||
|
const int opcodeSetDelete = 0x20001e5;
|
||||||
|
const int opcodeSetDeleteExplicit = 0x20001e6;
|
||||||
|
const int opcodeGetSquareRoot = 0x20001e7;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -419,6 +447,8 @@ namespace MWScript
|
||||||
extensions.registerFunction ("getweapondrawn", 'l', "", opcodeGetWeaponDrawn, opcodeGetWeaponDrawnExplicit);
|
extensions.registerFunction ("getweapondrawn", 'l', "", opcodeGetWeaponDrawn, opcodeGetWeaponDrawnExplicit);
|
||||||
extensions.registerFunction ("getspelleffects", 'l', "c", opcodeGetSpellEffects, opcodeGetSpellEffectsExplicit);
|
extensions.registerFunction ("getspelleffects", 'l', "c", opcodeGetSpellEffects, opcodeGetSpellEffectsExplicit);
|
||||||
extensions.registerFunction ("getcurrenttime", 'f', "", opcodeGetCurrentTime);
|
extensions.registerFunction ("getcurrenttime", 'f', "", opcodeGetCurrentTime);
|
||||||
|
extensions.registerInstruction ("setdelete", "", opcodeSetDelete, opcodeSetDeleteExplicit);
|
||||||
|
extensions.registerFunction ("getsquareroot", 'f', "f", opcodeGetSquareRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -453,6 +483,9 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeGetSpellEffects, new OpGetSpellEffects<ImplicitRef>);
|
interpreter.installSegment5 (opcodeGetSpellEffects, new OpGetSpellEffects<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetSpellEffectsExplicit, new OpGetSpellEffects<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetSpellEffectsExplicit, new OpGetSpellEffects<ExplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetCurrentTime, new OpGetCurrentTime);
|
interpreter.installSegment5 (opcodeGetCurrentTime, new OpGetCurrentTime);
|
||||||
|
interpreter.installSegment5 (opcodeSetDelete, new OpSetDelete<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeSetDeleteExplicit, new OpSetDelete<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetSquareRoot, new OpGetSquareRoot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,6 +800,18 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpGetWerewolfKills : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||||
|
|
||||||
|
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int numberOfAttributes = 8;
|
const int numberOfAttributes = 8;
|
||||||
|
|
||||||
const int opcodeGetAttribute = 0x2000027;
|
const int opcodeGetAttribute = 0x2000027;
|
||||||
|
@ -872,6 +884,8 @@ namespace MWScript
|
||||||
const int opcodeGetRace = 0x20001d9;
|
const int opcodeGetRace = 0x20001d9;
|
||||||
const int opcodeGetRaceExplicit = 0x20001da;
|
const int opcodeGetRaceExplicit = 0x20001da;
|
||||||
|
|
||||||
|
const int opcodeGetWerewolfKills = 0x20001e2;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
static const char *attributes[numberOfAttributes] =
|
static const char *attributes[numberOfAttributes] =
|
||||||
|
@ -975,6 +989,7 @@ namespace MWScript
|
||||||
|
|
||||||
extensions.registerFunction ("getrace", 'l', "c", opcodeGetRace,
|
extensions.registerFunction ("getrace", 'l', "c", opcodeGetRace,
|
||||||
opcodeGetRaceExplicit);
|
opcodeGetRaceExplicit);
|
||||||
|
extensions.registerFunction ("getwerewolfkills", 'f', "", opcodeGetWerewolfKills);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -1073,6 +1088,7 @@ namespace MWScript
|
||||||
|
|
||||||
interpreter.installSegment5 (opcodeGetRace, new OpGetRace<ImplicitRef>);
|
interpreter.installSegment5 (opcodeGetRace, new OpGetRace<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetRaceExplicit, new OpGetRace<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetRaceExplicit, new OpGetRace<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetWerewolfKills, new OpGetWerewolfKills);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,23 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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.
|
||||||
|
MWBase::Environment::get().getWorld()->scaleObject(ptr,ptr.getCellRef().mScale + scale);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
class OpSetAngle : public Interpreter::Opcode0
|
class OpSetAngle : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
|
@ -532,6 +549,8 @@ namespace MWScript
|
||||||
const int opcodePlaceAtPc = 0x200019c;
|
const int opcodePlaceAtPc = 0x200019c;
|
||||||
const int opcodePlaceAtMe = 0x200019d;
|
const int opcodePlaceAtMe = 0x200019d;
|
||||||
const int opcodePlaceAtMeExplicit = 0x200019e;
|
const int opcodePlaceAtMeExplicit = 0x200019e;
|
||||||
|
const int opcodeModScale = 0x20001e3;
|
||||||
|
const int opcodeModScaleExplicit = 0x20001e4;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -548,6 +567,7 @@ namespace MWScript
|
||||||
extensions.registerInstruction("placeitem","cffff",opcodePlaceItem);
|
extensions.registerInstruction("placeitem","cffff",opcodePlaceItem);
|
||||||
extensions.registerInstruction("placeatpc","clfl",opcodePlaceAtPc);
|
extensions.registerInstruction("placeatpc","clfl",opcodePlaceAtPc);
|
||||||
extensions.registerInstruction("placeatme","clfl",opcodePlaceAtMe,opcodePlaceAtMeExplicit);
|
extensions.registerInstruction("placeatme","clfl",opcodePlaceAtMe,opcodePlaceAtMeExplicit);
|
||||||
|
extensions.registerInstruction("modscale","f",opcodeModScale,opcodeModScaleExplicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -574,7 +594,9 @@ namespace MWScript
|
||||||
interpreter.installSegment5(opcodePlaceItem,new OpPlaceItem<ImplicitRef>);
|
interpreter.installSegment5(opcodePlaceItem,new OpPlaceItem<ImplicitRef>);
|
||||||
interpreter.installSegment5(opcodePlaceAtPc,new OpPlaceAtPc<ImplicitRef>);
|
interpreter.installSegment5(opcodePlaceAtPc,new OpPlaceAtPc<ImplicitRef>);
|
||||||
interpreter.installSegment5(opcodePlaceAtMe,new OpPlaceAtMe<ImplicitRef>);
|
interpreter.installSegment5(opcodePlaceAtMe,new OpPlaceAtMe<ImplicitRef>);
|
||||||
interpreter.installSegment5(opcodePlaceAtMeExplicit,new OpPlaceAtMe<ExplicitRef>);
|
interpreter.installSegment5(opcodePlaceAtMeExplicit,new OpPlaceAtMe<ExplicitRef>);
|
||||||
|
interpreter.installSegment5(opcodeModScale,new OpModScale<ImplicitRef>);
|
||||||
|
interpreter.installSegment5(opcodeModScaleExplicit,new OpModScale<ExplicitRef>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue