mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:23:51 +00:00
choice function. Do not work.
This commit is contained in:
parent
6f7752633a
commit
82c6b0f92a
2 changed files with 36 additions and 3 deletions
|
@ -89,10 +89,40 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
class OpChoice : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
std::cout << "CHOICECHOICEHOCQSCHQSHD";
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWDialogue::DialogueManager* dialogue = context.getEnvironment().mDialogueManager;
|
||||
//int choice = 1;
|
||||
while(arg0>0)
|
||||
{
|
||||
std::string question = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
arg0 = arg0 -1;
|
||||
Interpreter::Type_Integer choice = 1;
|
||||
if(arg0>0)
|
||||
{
|
||||
choice = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
arg0 = arg0 -1;
|
||||
}
|
||||
dialogue->askQuestion(question,choice);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const int opcodeJournal = 0x2000133;
|
||||
const int opcodeSetJournalIndex = 0x2000134;
|
||||
const int opcodeGetJournalIndex = 0x2000135;
|
||||
const int opcodeAddTopic = 0x200013a;
|
||||
const int opcodeChoice = 0x2000a;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
|
@ -100,6 +130,7 @@ namespace MWScript
|
|||
extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex);
|
||||
extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex);
|
||||
extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic);
|
||||
extensions.registerInstruction ("choice", "clcl", opcodeChoice);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -108,6 +139,7 @@ namespace MWScript
|
|||
interpreter.installSegment5 (opcodeSetJournalIndex, new OpSetJournalIndex);
|
||||
interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex);
|
||||
interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic);
|
||||
interpreter.installSegment3 (opcodeChoice,new OpChoice);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ op 0x20006: PlayAnim
|
|||
op 0x20007: PlayAnim, explicit reference
|
||||
op 0x20008: LoopAnim
|
||||
op 0x20009: LoopAnim, explicit reference
|
||||
opcodes 0x2000a-0x3ffff unused
|
||||
op 0x2000a: Choice
|
||||
opcodes 0x2000b-0x3ffff unused
|
||||
|
||||
Segment 4:
|
||||
(not implemented yet)
|
||||
|
|
Loading…
Reference in a new issue