Implement BetaComment instruction (dumps reference info)

deque
scrawl 11 years ago
parent 326c747508
commit 77388fe2ce

@ -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

@ -859,6 +859,47 @@ namespace MWScript
}
};
template <class R>
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<std::string> 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<ExplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcInJail, new OpGetPcInJail);
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcTraveling, new OpGetPcTraveling);
interpreter.installSegment5 (Compiler::Misc::opcodeBetaComment, new OpBetaComment<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeBetaCommentExplicit, new OpBetaComment<ExplicitRef>);
}
}
}

@ -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);
}
}

@ -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;

Loading…
Cancel
Save