mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-11 06:06:42 +00:00
added GetButtonPressed function
This commit is contained in:
parent
058822b676
commit
aded4608c0
2 changed files with 39 additions and 18 deletions
|
@ -108,4 +108,5 @@ op 0x2000133: Journal
|
||||||
op 0x2000134: SetJournalIndex
|
op 0x2000134: SetJournalIndex
|
||||||
op 0x2000135: GetJournalIndex
|
op 0x2000135: GetJournalIndex
|
||||||
op 0x2000136: GetPCCell
|
op 0x2000136: GetPCCell
|
||||||
opcodes 0x2000137-0x3ffffff unused
|
op 0x2000137: GetButtonPressed
|
||||||
|
opcodes 0x2000138-0x3ffffff unused
|
||||||
|
|
|
@ -15,42 +15,57 @@
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
namespace Gui
|
namespace Gui
|
||||||
{
|
{
|
||||||
class OpEnableWindow : public Interpreter::Opcode0
|
class OpEnableWindow : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
MWGui::GuiWindow mWindow;
|
MWGui::GuiWindow mWindow;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
OpEnableWindow (MWGui::GuiWindow window) : mWindow (window) {}
|
OpEnableWindow (MWGui::GuiWindow window) : mWindow (window) {}
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
InterpreterContext& context =
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
context.getWindowManager().allow (mWindow);
|
context.getWindowManager().allow (mWindow);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpShowDialogue : public Interpreter::Opcode0
|
class OpShowDialogue : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
MWGui::GuiMode mDialogue;
|
MWGui::GuiMode mDialogue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
OpShowDialogue (MWGui::GuiMode dialogue)
|
OpShowDialogue (MWGui::GuiMode dialogue)
|
||||||
: mDialogue (dialogue)
|
: mDialogue (dialogue)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
InterpreterContext& context =
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
context.getInputManager().setGuiMode(mDialogue);
|
context.getInputManager().setGuiMode(mDialogue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpGetButtonPressed : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
InterpreterContext& context =
|
||||||
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
|
MWWorld::Ptr ptr = context.getReference();
|
||||||
|
|
||||||
|
runtime.push (context.getWindowManager().readPressedButton());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeEnableBirthMenu = 0x200000e;
|
const int opcodeEnableBirthMenu = 0x200000e;
|
||||||
const int opcodeEnableClassMenu = 0x200000f;
|
const int opcodeEnableClassMenu = 0x200000f;
|
||||||
|
@ -63,7 +78,8 @@ namespace MWScript
|
||||||
const int opcodeEnableStatsMenu = 0x2000016;
|
const int opcodeEnableStatsMenu = 0x2000016;
|
||||||
const int opcodeEnableRest = 0x2000017;
|
const int opcodeEnableRest = 0x2000017;
|
||||||
const int opcodeShowRestMenu = 0x2000018;
|
const int opcodeShowRestMenu = 0x2000018;
|
||||||
|
const int opcodeGetButtonPressed = 0x2000137;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
extensions.registerInstruction ("enablebirthmenu", "", opcodeEnableBirthMenu);
|
extensions.registerInstruction ("enablebirthmenu", "", opcodeEnableBirthMenu);
|
||||||
|
@ -80,10 +96,12 @@ namespace MWScript
|
||||||
|
|
||||||
extensions.registerInstruction ("enablerestmenu", "", opcodeEnableRest);
|
extensions.registerInstruction ("enablerestmenu", "", opcodeEnableRest);
|
||||||
extensions.registerInstruction ("enablelevelupmenu", "", opcodeEnableRest);
|
extensions.registerInstruction ("enablelevelupmenu", "", opcodeEnableRest);
|
||||||
|
|
||||||
extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu);
|
extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu);
|
||||||
|
|
||||||
|
extensions.registerFunction ("getbuttonpressed", 'l', "", opcodeGetButtonPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
{
|
{
|
||||||
interpreter.installSegment5 (opcodeEnableBirthMenu,
|
interpreter.installSegment5 (opcodeEnableBirthMenu,
|
||||||
|
@ -115,6 +133,8 @@ namespace MWScript
|
||||||
|
|
||||||
interpreter.installSegment5 (opcodeShowRestMenu,
|
interpreter.installSegment5 (opcodeShowRestMenu,
|
||||||
new OpShowDialogue (MWGui::GM_Rest));
|
new OpShowDialogue (MWGui::GM_Rest));
|
||||||
|
|
||||||
|
interpreter.installSegment5 (opcodeGetButtonPressed, new OpGetButtonPressed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue