forceGreeting script instruction

actorid
gugus 13 years ago
parent f68248e0d0
commit c24a85848f

@ -11,6 +11,7 @@
#include "../mwdialogue/dialoguemanager.hpp" #include "../mwdialogue/dialoguemanager.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"
#include "ref.hpp"
namespace MWScript namespace MWScript
{ {
@ -115,12 +116,26 @@ namespace MWScript
} }
}; };
template<class R>
class OpForceGreeting : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
context.getEnvironment().mDialogueManager->startDialogue (ptr);
}
};
const int opcodeJournal = 0x2000133; const int opcodeJournal = 0x2000133;
const int opcodeSetJournalIndex = 0x2000134; const int opcodeSetJournalIndex = 0x2000134;
const int opcodeGetJournalIndex = 0x2000135; const int opcodeGetJournalIndex = 0x2000135;
const int opcodeAddTopic = 0x200013a; const int opcodeAddTopic = 0x200013a;
const int opcodeChoice = 0x2000a; const int opcodeChoice = 0x2000a;
const int opcodeForceGreeting = 0x200014f;
void registerExtensions (Compiler::Extensions& extensions) void registerExtensions (Compiler::Extensions& extensions)
{ {
@ -129,6 +144,7 @@ namespace MWScript
extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex); extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex);
extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic); extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic);
extensions.registerInstruction ("choice", "/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice); extensions.registerInstruction ("choice", "/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice);
extensions.registerInstruction("forcegreeting","",-1,opcodeForceGreeting);
} }
void installOpcodes (Interpreter::Interpreter& interpreter) void installOpcodes (Interpreter::Interpreter& interpreter)
@ -138,6 +154,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex); interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex);
interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic); interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic);
interpreter.installSegment3 (opcodeChoice,new OpChoice); interpreter.installSegment3 (opcodeChoice,new OpChoice);
interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting<ExplicitRef>);
} }
} }

@ -142,4 +142,5 @@ op 0x200014b: GetSpell
op 0x200014c: GetSpell, explicit reference op 0x200014c: GetSpell, explicit reference
op 0x200014d: ModDisposition op 0x200014d: ModDisposition
op 0x200014e: ModDisposition, explicit reference op 0x200014e: ModDisposition, explicit reference
opcodes 0x200014f-0x3ffffff unused op 0x200014f: ForceGreeting
opcodes 0x200015-0x3ffffff unused

Loading…
Cancel
Save