diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index 1576bf0af..ab69bc4b4 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -396,5 +396,7 @@ op 0x2000243: GetFactionReaction op 0x2000244: Activate, explicit op 0x2000245: ClearInfoActor op 0x2000246: ClearInfoActor, explicit +op 0x2000247: BetaComment +op 0x2000248: BetaComment, explicit -opcodes 0x2000247-0x3ffffff unused +opcodes 0x2000249-0x3ffffff unused diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index cd76f3b9c..17824fe49 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -859,6 +859,47 @@ namespace MWScript } }; + template + class OpBetaComment : public Interpreter::Opcode0 + { + public: + virtual void execute(Interpreter::Runtime &runtime) + { + MWWorld::Ptr ptr = R()(runtime); + + std::stringstream msg; + + msg << "Content file: "; + + if (ptr.getCellRef().getRefNum().mContentFile == -1) + msg << "[None]" << std::endl; + else + { + std::vector contentFiles = MWBase::Environment::get().getWorld()->getContentFiles(); + assert (contentFiles.size() > ptr.getCellRef().getRefNum().mContentFile); + msg << contentFiles[ptr.getCellRef().getRefNum().mContentFile] << std::endl; + } + + msg << "RefID: " << ptr.getCellRef().getRefId() << std::endl; + + if (ptr.isInCell()) + { + MWWorld::CellStore* cell = ptr.getCell(); + msg << "Cell: " << MWBase::Environment::get().getWorld()->getCellName(cell) << std::endl; + + Ogre::Vector3 pos (ptr.getRefData().getPosition().pos); + msg << "Coordinates: " << pos << std::endl; + } + + std::string notes = runtime.getStringLiteral (runtime[0].mInteger); + runtime.pop(); + if (!notes.empty()) + msg << "Notes: " << notes << std::endl; + + runtime.getContext().report(msg.str()); + } + }; + void installOpcodes (Interpreter::Interpreter& interpreter) { interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox); @@ -932,6 +973,8 @@ namespace MWScript interpreter.installSegment5 (Compiler::Misc::opcodeExplodeSpellExplicit, new OpExplodeSpell); interpreter.installSegment5 (Compiler::Misc::opcodeGetPcInJail, new OpGetPcInJail); interpreter.installSegment5 (Compiler::Misc::opcodeGetPcTraveling, new OpGetPcTraveling); + interpreter.installSegment5 (Compiler::Misc::opcodeBetaComment, new OpBetaComment); + interpreter.installSegment5 (Compiler::Misc::opcodeBetaCommentExplicit, new OpBetaComment); } } } diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index b9e36db80..c4b078ae8 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -282,6 +282,8 @@ namespace Compiler extensions.registerInstruction ("enablelevitation", "", opcodeEnableLevitation); extensions.registerFunction ("getpcinjail", 'l', "", opcodeGetPcInJail); extensions.registerFunction ("getpctraveling", 'l', "", opcodeGetPcTraveling); + extensions.registerInstruction ("betacomment", "S", opcodeBetaComment, opcodeBetaCommentExplicit); + extensions.registerInstruction ("bc", "S", opcodeBetaComment, opcodeBetaCommentExplicit); } } diff --git a/components/compiler/opcodes.hpp b/components/compiler/opcodes.hpp index 14f4db060..8716cdd18 100644 --- a/components/compiler/opcodes.hpp +++ b/components/compiler/opcodes.hpp @@ -207,6 +207,8 @@ namespace Compiler const int opcodeGetLockedExplicit = 0x20001c8; const int opcodeGetEffect = 0x20001cf; const int opcodeGetEffectExplicit = 0x20001d0; + const int opcodeBetaComment = 0x2000247; + const int opcodeBetaCommentExplicit = 0x2000248; const int opcodeAddSoulGem = 0x20001f3; const int opcodeAddSoulGemExplicit = 0x20001f4; const int opcodeRemoveSoulGem = 0x20027;