mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:59:54 +00:00
Implement MenuTest script instruction (Fixes #1454)
This commit is contained in:
parent
6ba112619a
commit
3788fb042e
9 changed files with 80 additions and 1 deletions
|
@ -328,6 +328,8 @@ namespace MWBase
|
|||
/** Used when one Modal adds another Modal
|
||||
\param input Pointer to the current modal, to ensure proper modal is removed **/
|
||||
virtual void removeCurrentModal(MWGui::WindowModal* input) = 0;
|
||||
|
||||
virtual void pinWindow (MWGui::GuiWindow window) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1646,4 +1646,27 @@ namespace MWGui
|
|||
if (_key == MyGUI::KeyCode::Escape)
|
||||
mVideoWidget->stop();
|
||||
}
|
||||
|
||||
void WindowManager::pinWindow(GuiWindow window)
|
||||
{
|
||||
switch (window)
|
||||
{
|
||||
case GW_Inventory:
|
||||
mInventoryWindow->setPinned(true);
|
||||
break;
|
||||
case GW_Map:
|
||||
mMap->setPinned(true);
|
||||
break;
|
||||
case GW_Magic:
|
||||
mSpellWindow->setPinned(true);
|
||||
break;
|
||||
case GW_Stats:
|
||||
mStatsWindow->setPinned(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
updateVisible();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,6 +319,8 @@ namespace MWGui
|
|||
\param input Pointer to the current modal, to ensure proper modal is removed **/
|
||||
virtual void removeCurrentModal(WindowModal* input);
|
||||
|
||||
virtual void pinWindow (MWGui::GuiWindow window);
|
||||
|
||||
private:
|
||||
bool mConsoleOnlyScripts;
|
||||
|
||||
|
|
|
@ -25,6 +25,12 @@ namespace MWGui
|
|||
onPinToggled();
|
||||
}
|
||||
|
||||
void WindowPinnableBase::setPinned(bool pinned)
|
||||
{
|
||||
if (pinned != mPinned)
|
||||
onPinButtonClicked(mPinButton);
|
||||
}
|
||||
|
||||
void WindowPinnableBase::setPinButtonVisible(bool visible)
|
||||
{
|
||||
mPinButton->setVisible(visible);
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace MWGui
|
|||
public:
|
||||
WindowPinnableBase(const std::string& parLayout);
|
||||
bool pinned() { return mPinned; }
|
||||
void setPinned (bool pinned);
|
||||
void setPinButtonVisible(bool visible);
|
||||
|
||||
private:
|
||||
|
|
|
@ -57,7 +57,8 @@ op 0x20028: RemoveSoulGem, explicit reference
|
|||
op 0x20029: PCRaiseRank, explicit reference
|
||||
op 0x2002a: PCLowerRank, explicit reference
|
||||
op 0x2002b: PCJoinFaction, explicit reference
|
||||
opcodes 0x2002c-0x3ffff unused
|
||||
op 0x2002c: MenuTest
|
||||
opcodes 0x2002d-0x3ffff unused
|
||||
|
||||
Segment 4:
|
||||
(not implemented yet)
|
||||
|
|
|
@ -162,6 +162,47 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
class OpMenuTest : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
int arg=0;
|
||||
if(arg0>0)
|
||||
{
|
||||
arg = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
}
|
||||
|
||||
|
||||
if (arg == 0)
|
||||
{
|
||||
MWGui::GuiMode modes[] = { MWGui::GM_Inventory, MWGui::GM_Container };
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->containsMode(modes[i]))
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(modes[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MWGui::GuiWindow gw = MWGui::GW_None;
|
||||
if (arg == 3)
|
||||
gw = MWGui::GW_Stats;
|
||||
if (arg == 4)
|
||||
gw = MWGui::GW_Inventory;
|
||||
if (arg == 5)
|
||||
gw = MWGui::GW_Magic;
|
||||
if (arg == 6)
|
||||
gw = MWGui::GW_Map;
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->pinWindow(gw);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
|
@ -200,6 +241,7 @@ namespace MWScript
|
|||
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeShowMap, new OpShowMap);
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeFillMap, new OpFillMap);
|
||||
interpreter.installSegment3 (Compiler::Gui::opcodeMenuTest, new OpMenuTest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ namespace Compiler
|
|||
|
||||
extensions.registerInstruction ("showmap", "S", opcodeShowMap);
|
||||
extensions.registerInstruction ("fillmap", "", opcodeFillMap);
|
||||
extensions.registerInstruction ("menutest", "/l", opcodeMenuTest);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ namespace Compiler
|
|||
const int opcodeToggleFullHelp = 0x2000151;
|
||||
const int opcodeShowMap = 0x20001a0;
|
||||
const int opcodeFillMap = 0x20001a1;
|
||||
const int opcodeMenuTest = 0x2002c;
|
||||
}
|
||||
|
||||
namespace Misc
|
||||
|
|
Loading…
Reference in a new issue