|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
#include <components/interpreter/opcodes.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../mwdialogue/journal.hpp"
|
|
|
|
|
#include "../mwdialogue/dialoguemanager.hpp"
|
|
|
|
|
|
|
|
|
|
#include "interpretercontext.hpp"
|
|
|
|
|
|
|
|
|
@ -72,15 +73,33 @@ namespace MWScript
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OpAddTopic : public Interpreter::Opcode0
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
|
{
|
|
|
|
|
MWScript::InterpreterContext& context
|
|
|
|
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
|
|
|
|
|
|
|
|
std::string topic = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
context.getEnvironment().mDialogueManager->addTopic(topic);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const int opcodeJournal = 0x2000133;
|
|
|
|
|
const int opcodeSetJournalIndex = 0x2000134;
|
|
|
|
|
const int opcodeGetJournalIndex = 0x2000135;
|
|
|
|
|
const int opcodeAddTopic = 0x200013a;
|
|
|
|
|
|
|
|
|
|
void registerExtensions (Compiler::Extensions& extensions)
|
|
|
|
|
{
|
|
|
|
|
extensions.registerInstruction ("journal", "cl", opcodeJournal);
|
|
|
|
|
extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex);
|
|
|
|
|
extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex);
|
|
|
|
|
extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
|
|
|
@ -88,6 +107,7 @@ namespace MWScript
|
|
|
|
|
interpreter.installSegment5 (opcodeJournal, new OpJournal);
|
|
|
|
|
interpreter.installSegment5 (opcodeSetJournalIndex, new OpSetJournalIndex);
|
|
|
|
|
interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex);
|
|
|
|
|
interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|