From c24a85848f0d162b76c320465e524883e8124d07 Mon Sep 17 00:00:00 2001 From: gugus Date: Sun, 15 Apr 2012 15:56:36 +0200 Subject: [PATCH] forceGreeting script instruction --- apps/openmw/mwscript/dialogueextensions.cpp | 17 +++++++++++++++++ apps/openmw/mwscript/docs/vmformat.txt | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/dialogueextensions.cpp b/apps/openmw/mwscript/dialogueextensions.cpp index 0cca028e2..178485f78 100644 --- a/apps/openmw/mwscript/dialogueextensions.cpp +++ b/apps/openmw/mwscript/dialogueextensions.cpp @@ -11,6 +11,7 @@ #include "../mwdialogue/dialoguemanager.hpp" #include "interpretercontext.hpp" +#include "ref.hpp" namespace MWScript { @@ -115,12 +116,26 @@ namespace MWScript } }; + template + class OpForceGreeting : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context + = static_cast (runtime.getContext()); + context.getEnvironment().mDialogueManager->startDialogue (ptr); + } + }; const int opcodeJournal = 0x2000133; const int opcodeSetJournalIndex = 0x2000134; const int opcodeGetJournalIndex = 0x2000135; const int opcodeAddTopic = 0x200013a; const int opcodeChoice = 0x2000a; + const int opcodeForceGreeting = 0x200014f; void registerExtensions (Compiler::Extensions& extensions) { @@ -129,6 +144,7 @@ namespace MWScript extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex); extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic); extensions.registerInstruction ("choice", "/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice); + extensions.registerInstruction("forcegreeting","",-1,opcodeForceGreeting); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -138,6 +154,7 @@ namespace MWScript interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex); interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic); interpreter.installSegment3 (opcodeChoice,new OpChoice); + interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting); } } diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index c38ff611c..9155746ed 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -142,4 +142,5 @@ op 0x200014b: GetSpell op 0x200014c: GetSpell, explicit reference op 0x200014d: ModDisposition op 0x200014e: ModDisposition, explicit reference -opcodes 0x200014f-0x3ffffff unused +op 0x200014f: ForceGreeting +opcodes 0x200015-0x3ffffff unused