mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:23:53 +00:00
added twf console command
This commit is contained in:
parent
00ac2deefb
commit
40e23fe26f
4 changed files with 43 additions and 5 deletions
|
@ -157,8 +157,24 @@ void RenderingManager::skySetMoonColour (bool red)
|
|||
{
|
||||
mSkyManager->setMoonColour(red);
|
||||
}
|
||||
bool RenderingManager::toggleRenderMode(int mode){
|
||||
return mDebugging.toggleRenderMode(mode);
|
||||
|
||||
bool RenderingManager::toggleRenderMode(int mode)
|
||||
{
|
||||
if (mode == MWWorld::World::Render_CollisionDebug)
|
||||
return mDebugging.toggleRenderMode(mode);
|
||||
else // if (mode == MWWorld::World::Render_Wireframe)
|
||||
{
|
||||
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
|
||||
{
|
||||
mRendering.getCamera()->setPolygonMode(PM_WIREFRAME);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mRendering.getCamera()->setPolygonMode(PM_SOLID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
|
||||
|
|
|
@ -115,4 +115,5 @@ op 0x2000136: GetPCCell
|
|||
op 0x2000137: GetButtonPressed
|
||||
op 0x2000138: SkipAnim
|
||||
op 0x2000139: SkipAnim, expplicit reference
|
||||
opcodes 0x200013a-0x3ffffff unused
|
||||
op 0x200013b: twf
|
||||
opcodes 0x200013c-0x3ffffff unused
|
||||
|
|
|
@ -103,7 +103,24 @@ namespace MWScript
|
|||
context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug);
|
||||
|
||||
context.report (enabled ?
|
||||
"Collsion Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
|
||||
"Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
class OpToggleWireframe : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
bool enabled =
|
||||
context.getWorld().toggleRenderMode (MWWorld::World::Render_Wireframe);
|
||||
|
||||
context.report (enabled ?
|
||||
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -115,6 +132,7 @@ namespace MWScript
|
|||
const int opcodeUnlock = 0x200008c;
|
||||
const int opcodeUnlockExplicit = 0x200008d;
|
||||
const int opcodeToggleCollisionDebug = 0x2000132;
|
||||
const int opcodeToggleWireframe = 0x200013b;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
|
@ -127,6 +145,7 @@ namespace MWScript
|
|||
extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug);
|
||||
extensions.registerInstruction ("tcb", "", opcodeToggleCollisionDebug);
|
||||
extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
|
||||
extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -139,6 +158,7 @@ namespace MWScript
|
|||
interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug);
|
||||
interpreter.installSegment5 (opcodeToggleWireframe, new OpToggleWireframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ namespace MWWorld
|
|||
|
||||
enum RenderMode
|
||||
{
|
||||
Render_CollisionDebug
|
||||
Render_CollisionDebug,
|
||||
Render_Wireframe
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue