Implement the help command

dont-compose-content
Evil Eye 3 years ago
parent 126cf40848
commit eced6f2126

@ -17,6 +17,7 @@
Bug #6129: Player avatar not displayed correctly for large window sizes when GUI scaling active
Bug #6131: Item selection in the avatar window not working correctly for large window sizes
Bug #6133: Cannot reliably sneak or steal in the sight of the NPCs siding with player
Feature #2780: A way to see current OpenMW version in the console
Feature #5489: MCP: Telekinesis fix for activators
Feature #6017: Separate persistent and temporary cell references when saving

@ -10,6 +10,7 @@ namespace Interpreter
namespace Compiler
{
class Extensions;
class Locals;
}
@ -52,6 +53,8 @@ namespace MWBase
///< Return locals for script \a name.
virtual MWScript::GlobalScripts& getGlobalScripts() = 0;
virtual const Compiler::Extensions& getExtensions() const = 0;
};
}

@ -349,6 +349,8 @@ namespace MWBase
virtual void watchActor(const MWWorld::Ptr& ptr) = 0;
virtual MWWorld::Ptr getWatchedActor() const = 0;
virtual const std::string& getVersionDescription() const = 0;
};
}

@ -2199,4 +2199,9 @@ namespace MWGui
{
return mStatsWatcher->getWatchedActor();
}
const std::string& WindowManager::getVersionDescription() const
{
return mVersionDescription;
}
}

@ -383,6 +383,8 @@ namespace MWGui
bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat=false) override;
bool injectKeyRelease(MyGUI::KeyCode key) override;
const std::string& getVersionDescription() const override;
private:
unsigned int mOldUpdateMask; unsigned int mOldCullMask;

@ -479,5 +479,6 @@ op 0x200031c: GetDisabled, explicit
op 0x200031d: StartScript, explicit
op 0x200031e: GetDistance
op 0x200031f: GetDistance, explicit
op 0x2000320: Help
opcodes 0x2000320-0x3ffffff unused
opcodes 0x2000321-0x3ffffff unused

@ -3,6 +3,7 @@
#include <cstdlib>
#include <iomanip>
#include <components/compiler/extensions.hpp>
#include <components/compiler/opcodes.hpp>
#include <components/compiler/locals.hpp>
@ -1582,6 +1583,22 @@ namespace MWScript
}
};
class OpHelp : public Interpreter::Opcode0
{
public:
void execute(Interpreter::Runtime& runtime) override
{
std::stringstream message;
message << MWBase::Environment::get().getWindowManager()->getVersionDescription() << "\n\n";
std::vector<std::string> commands;
MWBase::Environment::get().getScriptManager()->getExtensions().listKeywords(commands);
for(const auto& command : commands)
message << command << "\n";
runtime.getContext().report(message.str());
}
};
void installOpcodes (Interpreter::Interpreter& interpreter)
{
interpreter.installSegment5 (Compiler::Misc::opcodeMenuMode, new OpMenuMode);
@ -1701,6 +1718,7 @@ namespace MWScript
interpreter.installSegment5 (Compiler::Misc::opcodeRepairedOnMe, new OpRepairedOnMe<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeRepairedOnMeExplicit, new OpRepairedOnMe<ExplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeToggleRecastMesh, new OpToggleRecastMesh);
interpreter.installSegment5 (Compiler::Misc::opcodeHelp, new OpHelp);
}
}
}

@ -207,4 +207,9 @@ namespace MWScript
{
return mGlobalScripts;
}
const Compiler::Extensions& ScriptManager::getExtensions() const
{
return *mCompilerContext.getExtensions();
}
}

@ -83,6 +83,8 @@ namespace MWScript
///< Return locals for script \a name.
GlobalScripts& getGlobalScripts() override;
const Compiler::Extensions& getExtensions() const override;
};
}

@ -337,6 +337,7 @@ namespace Compiler
extensions.registerInstruction ("setnavmeshnumber", "l", opcodeSetNavMeshNumberToRender);
extensions.registerFunction ("repairedonme", 'l', "S", opcodeRepairedOnMe, opcodeRepairedOnMeExplicit);
extensions.registerInstruction ("togglerecastmesh", "", opcodeToggleRecastMesh);
extensions.registerInstruction ("help", "", opcodeHelp);
}
}

@ -318,6 +318,7 @@ namespace Compiler
const int opcodeDisableExplicit = 0x200031b;
const int opcodeGetDisabledExplicit = 0x200031c;
const int opcodeStartScriptExplicit = 0x200031d;
const int opcodeHelp = 0x2000320;
}
namespace Sky

@ -14,6 +14,7 @@
<Property key="TextColour" value="1 1 1"/>
<Property key="InvertSelected" value="false"/>
<Property key="WordWrap" value="true"/>
<Property key="MaxTextLength" value="10000"/>
</Widget>
<!-- Command line -->

Loading…
Cancel
Save