tvm script instruction

actorid
greye 13 years ago
parent d1656b2f5d
commit 5b2b378f25

@ -254,6 +254,7 @@ namespace MWBase
virtual bool toggleVanityMode(bool enable, bool force) = 0;
virtual void allowVanityMode(bool allow) = 0;
virtual void togglePlayerLooking(bool enable) = 0;
virtual bool isVanityEnabled() = 0;
virtual void renderPlayer() = 0;
};

@ -107,6 +107,10 @@ namespace MWRender
void getSightAngles(float &pitch, float &yaw);
void togglePlayerLooking(bool enable);
bool isVanityEnabled() {
return mVanity.enabled;
}
};
}

@ -64,15 +64,19 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
mPlayer->togglePreviewMode(enable);
}
virtual bool toggleVanityMode(bool enable, bool force) {
bool toggleVanityMode(bool enable, bool force) {
return mPlayer->toggleVanityMode(enable, force);
}
virtual void allowVanityMode(bool allow) {
bool isVanityEnabled() {
return mPlayer->isVanityEnabled();
}
void allowVanityMode(bool allow) {
mPlayer->allowVanityMode(allow);
}
virtual void togglePlayerLooking(bool enable) {
void togglePlayerLooking(bool 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 0x2000172: GetStartingAngle
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 opcodeOnActivate = 0x200000d;
const int opcodeActivate = 0x2000075;
@ -222,6 +245,7 @@ namespace MWScript
const int opcodeToggleWater = 0x2000144;
const int opcodeTogglePathgrid = 0x2000146;
const int opcodeDontSaveObject = 0x2000153;
const int opcodeToggleVanityMode = 0x2000174;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -244,6 +268,8 @@ namespace MWScript
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
extensions.registerInstruction ("dontsaveobject", "", opcodeDontSaveObject);
extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode);
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -263,6 +289,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
interpreter.installSegment5 (opcodeToggleVanityMode, new OpToggleVanityMode);
}
}
}

@ -298,6 +298,10 @@ namespace MWWorld
}
virtual void renderPlayer();
virtual bool isVanityEnabled() {
return mRendering->isVanityEnabled();
}
};
}

Loading…
Cancel
Save