mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 01:26:39 +00:00 
			
		
		
		
	toggleCollisionBoxes actually does something useful now
This commit is contained in:
		
							parent
							
								
									4517613063
								
							
						
					
					
						commit
						c8562d8442
					
				
					 4 changed files with 32 additions and 4 deletions
				
			
		| 
						 | 
					@ -65,7 +65,8 @@ namespace MWBase
 | 
				
			||||||
                Render_CollisionDebug,
 | 
					                Render_CollisionDebug,
 | 
				
			||||||
                Render_Wireframe,
 | 
					                Render_Wireframe,
 | 
				
			||||||
                Render_Pathgrid,
 | 
					                Render_Pathgrid,
 | 
				
			||||||
                Render_Compositors
 | 
					                Render_Compositors,
 | 
				
			||||||
 | 
					                Render_BoundingBoxes
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            struct DoorMarker
 | 
					            struct DoorMarker
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -473,7 +473,13 @@ bool RenderingManager::toggleRenderMode(int mode)
 | 
				
			||||||
            return false;
 | 
					            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();
 | 
					        return mCompositors->toggle();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,5 +221,6 @@ op 0x20001a8: CommonDisease
 | 
				
			||||||
op 0x20001a9: CommonDisease, explicit reference
 | 
					op 0x20001a9: CommonDisease, explicit reference
 | 
				
			||||||
op 0x20001aa: BlightDisease
 | 
					op 0x20001aa: BlightDisease
 | 
				
			||||||
op 0x20001ab: BlightDisease, explicit reference
 | 
					op 0x20001ab: BlightDisease, explicit reference
 | 
				
			||||||
 | 
					op 0x20001ac: ToggleCollisionBoxes
 | 
				
			||||||
opcodes 0x20001ac-0x3ffffff unused
 | 
					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
 | 
					        class OpToggleWireframe : public Interpreter::Opcode0
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            public:
 | 
					            public:
 | 
				
			||||||
| 
						 | 
					@ -262,6 +280,7 @@ namespace MWScript
 | 
				
			||||||
        const int opcodeUnlock = 0x200008c;
 | 
					        const int opcodeUnlock = 0x200008c;
 | 
				
			||||||
        const int opcodeUnlockExplicit = 0x200008d;
 | 
					        const int opcodeUnlockExplicit = 0x200008d;
 | 
				
			||||||
        const int opcodeToggleCollisionDebug = 0x2000132;
 | 
					        const int opcodeToggleCollisionDebug = 0x2000132;
 | 
				
			||||||
 | 
					        const int opcodeToggleCollisionBoxes = 0x20001ac;
 | 
				
			||||||
        const int opcodeToggleWireframe = 0x200013b;
 | 
					        const int opcodeToggleWireframe = 0x200013b;
 | 
				
			||||||
        const int opcodeFadeIn = 0x200013c;
 | 
					        const int opcodeFadeIn = 0x200013c;
 | 
				
			||||||
        const int opcodeFadeOut = 0x200013d;
 | 
					        const int opcodeFadeOut = 0x200013d;
 | 
				
			||||||
| 
						 | 
					@ -280,9 +299,9 @@ namespace MWScript
 | 
				
			||||||
            extensions.registerInstruction ("activate", "", opcodeActivate);
 | 
					            extensions.registerInstruction ("activate", "", opcodeActivate);
 | 
				
			||||||
            extensions.registerInstruction ("lock", "/l", opcodeLock, opcodeLockExplicit);
 | 
					            extensions.registerInstruction ("lock", "/l", opcodeLock, opcodeLockExplicit);
 | 
				
			||||||
            extensions.registerInstruction ("unlock", "", opcodeUnlock, opcodeUnlockExplicit);
 | 
					            extensions.registerInstruction ("unlock", "", opcodeUnlock, opcodeUnlockExplicit);
 | 
				
			||||||
            extensions.registerInstruction ("togglecollisionboxes", "", opcodeToggleCollisionDebug);
 | 
					            extensions.registerInstruction ("togglecollisionboxes", "", opcodeToggleCollisionBoxes);
 | 
				
			||||||
            extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug);
 | 
					            extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug);
 | 
				
			||||||
            extensions.registerInstruction ("tcb", "", opcodeToggleCollisionDebug);
 | 
					            extensions.registerInstruction ("tcb", "", opcodeToggleCollisionBoxes);
 | 
				
			||||||
            extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
 | 
					            extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
 | 
				
			||||||
            extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
 | 
					            extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
 | 
				
			||||||
            extensions.registerInstruction ("togglewireframe", "", opcodeToggleWireframe);
 | 
					            extensions.registerInstruction ("togglewireframe", "", opcodeToggleWireframe);
 | 
				
			||||||
| 
						 | 
					@ -310,6 +329,7 @@ namespace MWScript
 | 
				
			||||||
            interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
 | 
					            interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
 | 
				
			||||||
            interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
 | 
					            interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
 | 
				
			||||||
            interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug);
 | 
					            interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug);
 | 
				
			||||||
 | 
					            interpreter.installSegment5 (opcodeToggleCollisionBoxes, new OpToggleCollisionBoxes);
 | 
				
			||||||
            interpreter.installSegment5 (opcodeToggleWireframe, new OpToggleWireframe);
 | 
					            interpreter.installSegment5 (opcodeToggleWireframe, new OpToggleWireframe);
 | 
				
			||||||
            interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
 | 
					            interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
 | 
				
			||||||
            interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);
 | 
					            interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue