1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 20:09:40 +00:00

Implement the help command

This commit is contained in:
Evil Eye 2021-07-07 18:48:25 +02:00
parent 126cf40848
commit eced6f2126
12 changed files with 43 additions and 1 deletions

View file

@ -17,6 +17,7 @@
Bug #6129: Player avatar not displayed correctly for large window sizes when GUI scaling active 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 #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 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 #5489: MCP: Telekinesis fix for activators
Feature #6017: Separate persistent and temporary cell references when saving Feature #6017: Separate persistent and temporary cell references when saving

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,6 +3,7 @@
#include <cstdlib> #include <cstdlib>
#include <iomanip> #include <iomanip>
#include <components/compiler/extensions.hpp>
#include <components/compiler/opcodes.hpp> #include <components/compiler/opcodes.hpp>
#include <components/compiler/locals.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) void installOpcodes (Interpreter::Interpreter& interpreter)
{ {
interpreter.installSegment5 (Compiler::Misc::opcodeMenuMode, new OpMenuMode); 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::opcodeRepairedOnMe, new OpRepairedOnMe<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeRepairedOnMeExplicit, new OpRepairedOnMe<ExplicitRef>); interpreter.installSegment5 (Compiler::Misc::opcodeRepairedOnMeExplicit, new OpRepairedOnMe<ExplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeToggleRecastMesh, new OpToggleRecastMesh); interpreter.installSegment5 (Compiler::Misc::opcodeToggleRecastMesh, new OpToggleRecastMesh);
interpreter.installSegment5 (Compiler::Misc::opcodeHelp, new OpHelp);
} }
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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