toggleCollisionBoxes actually does something useful now

actorid
scrawl 12 years ago
parent 4517613063
commit c8562d8442

@ -65,7 +65,8 @@ namespace MWBase
Render_CollisionDebug,
Render_Wireframe,
Render_Pathgrid,
Render_Compositors
Render_Compositors,
Render_BoundingBoxes
};
struct DoorMarker

@ -473,7 +473,13 @@ bool RenderingManager::toggleRenderMode(int mode)
return false;
}
}
else //if (mode == MWWorld::World::Render_Compositors)
else if (mode == MWBase::World::Render_BoundingBoxes)
{
bool show = !mRendering.getScene()->getShowBoundingBoxes();
mRendering.getScene()->showBoundingBoxes(show);
return show;
}
else //if (mode == MWBase::World::Render_Compositors)
{
return mCompositors->toggle();
}

@ -221,5 +221,6 @@ op 0x20001a8: CommonDisease
op 0x20001a9: CommonDisease, explicit reference
op 0x20001aa: BlightDisease
op 0x20001ab: BlightDisease, explicit reference
op 0x20001ac: ToggleCollisionBoxes
opcodes 0x20001ac-0x3ffffff unused

@ -132,6 +132,24 @@ namespace MWScript
}
};
class OpToggleCollisionBoxes : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
bool enabled =
MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_BoundingBoxes);
context.report (enabled ?
"Bounding Box Rendering -> On" : "Bounding Box Rendering -> Off");
}
};
class OpToggleWireframe : public Interpreter::Opcode0
{
public:
@ -262,6 +280,7 @@ namespace MWScript
const int opcodeUnlock = 0x200008c;
const int opcodeUnlockExplicit = 0x200008d;
const int opcodeToggleCollisionDebug = 0x2000132;
const int opcodeToggleCollisionBoxes = 0x20001ac;
const int opcodeToggleWireframe = 0x200013b;
const int opcodeFadeIn = 0x200013c;
const int opcodeFadeOut = 0x200013d;
@ -280,9 +299,9 @@ namespace MWScript
extensions.registerInstruction ("activate", "", opcodeActivate);
extensions.registerInstruction ("lock", "/l", opcodeLock, opcodeLockExplicit);
extensions.registerInstruction ("unlock", "", opcodeUnlock, opcodeUnlockExplicit);
extensions.registerInstruction ("togglecollisionboxes", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("togglecollisionboxes", "", opcodeToggleCollisionBoxes);
extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("tcb", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("tcb", "", opcodeToggleCollisionBoxes);
extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
extensions.registerInstruction ("togglewireframe", "", opcodeToggleWireframe);
@ -310,6 +329,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug);
interpreter.installSegment5 (opcodeToggleCollisionBoxes, new OpToggleCollisionBoxes);
interpreter.installSegment5 (opcodeToggleWireframe, new OpToggleWireframe);
interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);

Loading…
Cancel
Save