mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
tvm script instruction
This commit is contained in:
parent
d1656b2f5d
commit
5b2b378f25
6 changed files with 45 additions and 4 deletions
|
@ -254,6 +254,7 @@ namespace MWBase
|
||||||
virtual bool toggleVanityMode(bool enable, bool force) = 0;
|
virtual bool toggleVanityMode(bool enable, bool force) = 0;
|
||||||
virtual void allowVanityMode(bool allow) = 0;
|
virtual void allowVanityMode(bool allow) = 0;
|
||||||
virtual void togglePlayerLooking(bool enable) = 0;
|
virtual void togglePlayerLooking(bool enable) = 0;
|
||||||
|
virtual bool isVanityEnabled() = 0;
|
||||||
|
|
||||||
virtual void renderPlayer() = 0;
|
virtual void renderPlayer() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,6 +107,10 @@ namespace MWRender
|
||||||
void getSightAngles(float &pitch, float &yaw);
|
void getSightAngles(float &pitch, float &yaw);
|
||||||
|
|
||||||
void togglePlayerLooking(bool enable);
|
void togglePlayerLooking(bool enable);
|
||||||
|
|
||||||
|
bool isVanityEnabled() {
|
||||||
|
return mVanity.enabled;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,19 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
||||||
mPlayer->togglePreviewMode(enable);
|
mPlayer->togglePreviewMode(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool toggleVanityMode(bool enable, bool force) {
|
bool toggleVanityMode(bool enable, bool force) {
|
||||||
return mPlayer->toggleVanityMode(enable, force);
|
return mPlayer->toggleVanityMode(enable, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void allowVanityMode(bool allow) {
|
bool isVanityEnabled() {
|
||||||
|
return mPlayer->isVanityEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void allowVanityMode(bool allow) {
|
||||||
mPlayer->allowVanityMode(allow);
|
mPlayer->allowVanityMode(allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void togglePlayerLooking(bool enable) {
|
void togglePlayerLooking(bool enable) {
|
||||||
mPlayer->togglePlayerLooking(enable);
|
mPlayer->togglePlayerLooking(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,4 +181,5 @@ op 0x2000170: user4, explicit reference (console only, requires --script-console
|
||||||
op 0x2000171: user4 (implicit reference, console only, requires --script-console switch)
|
op 0x2000171: user4 (implicit reference, console only, requires --script-console switch)
|
||||||
op 0x2000172: GetStartingAngle
|
op 0x2000172: GetStartingAngle
|
||||||
op 0x2000173: GetStartingAngle, explicit reference
|
op 0x2000173: GetStartingAngle, explicit reference
|
||||||
opcodes 0x2000174-0x3ffffff unused
|
op 0x2000174: ToggleVanityMode
|
||||||
|
opcodes 0x2000175-0x3ffffff unused
|
||||||
|
|
|
@ -207,6 +207,29 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpToggleVanityMode : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute(Interpreter::Runtime &runtime)
|
||||||
|
{
|
||||||
|
InterpreterContext& context =
|
||||||
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
|
MWBase::World *world =
|
||||||
|
MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
bool value = !world->isVanityEnabled();
|
||||||
|
if (world->toggleVanityMode(value, true)) {
|
||||||
|
context.report(
|
||||||
|
(value) ? "Vanity Mode -> On" : "Vanity Mode -> Off"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
context.report("Vanity Mode -> No");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
const int opcodeActivate = 0x2000075;
|
const int opcodeActivate = 0x2000075;
|
||||||
|
@ -222,6 +245,7 @@ namespace MWScript
|
||||||
const int opcodeToggleWater = 0x2000144;
|
const int opcodeToggleWater = 0x2000144;
|
||||||
const int opcodeTogglePathgrid = 0x2000146;
|
const int opcodeTogglePathgrid = 0x2000146;
|
||||||
const int opcodeDontSaveObject = 0x2000153;
|
const int opcodeDontSaveObject = 0x2000153;
|
||||||
|
const int opcodeToggleVanityMode = 0x2000174;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -244,6 +268,8 @@ namespace MWScript
|
||||||
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
|
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
|
||||||
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
|
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
|
||||||
extensions.registerInstruction ("dontsaveobject", "", opcodeDontSaveObject);
|
extensions.registerInstruction ("dontsaveobject", "", opcodeDontSaveObject);
|
||||||
|
extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode);
|
||||||
|
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -263,6 +289,7 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
|
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
|
||||||
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
|
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
|
||||||
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
|
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
|
||||||
|
interpreter.installSegment5 (opcodeToggleVanityMode, new OpToggleVanityMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,6 +298,10 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void renderPlayer();
|
virtual void renderPlayer();
|
||||||
|
|
||||||
|
virtual bool isVanityEnabled() {
|
||||||
|
return mRendering->isVanityEnabled();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue