mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
toggleFullHelp
This commit is contained in:
parent
d1e298c2e1
commit
f5ab127a39
6 changed files with 128 additions and 22 deletions
|
@ -10,6 +10,7 @@ ToolTips::ToolTips(WindowManager* windowManager) :
|
|||
Layout("openmw_tooltips.xml")
|
||||
, mGameMode(true)
|
||||
, mWindowManager(windowManager)
|
||||
, mFullHelp(false)
|
||||
{
|
||||
getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
|
||||
|
||||
|
@ -67,7 +68,9 @@ void ToolTips::onFrame(float frameDuration)
|
|||
{
|
||||
std::string caption = focus->getUserString("ToolTipCaption");
|
||||
std::string image = focus->getUserString("ToolTipImage");
|
||||
tooltipSize = createImageToolTip(caption, image, text);
|
||||
std::string sizeString = focus->getUserString("ToolTipImageSize");
|
||||
int size = (sizeString != "" ? boost::lexical_cast<int>(sizeString) : 32);
|
||||
tooltipSize = createImageToolTip(caption, image, size, text);
|
||||
}
|
||||
|
||||
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||
|
@ -179,6 +182,11 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
if (ref->ref.trap != "")
|
||||
text += "\n" + mWindowManager->getGameSettingString("sTrapped", "Trapped!");
|
||||
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createToolTip(ref->base->name, text);
|
||||
}
|
||||
|
||||
|
@ -192,7 +200,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Apparatus -------------------------------
|
||||
|
@ -205,7 +218,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Armor -------------------------------
|
||||
|
@ -222,7 +240,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Book -------------------------------
|
||||
|
@ -234,7 +257,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Clothing -------------------------------
|
||||
|
@ -247,7 +275,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Ingredient -------------------------------
|
||||
|
@ -260,7 +293,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Light -------------------------------
|
||||
|
@ -272,7 +310,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Tool -------------------------------
|
||||
|
@ -286,7 +329,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Miscellaneous -------------------------------
|
||||
|
@ -298,7 +346,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Probe -------------------------------
|
||||
|
@ -312,7 +365,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Repair -------------------------------
|
||||
|
@ -326,7 +384,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Weapon -------------------------------
|
||||
|
@ -340,7 +403,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
text += "\n" + mWindowManager->getGameSettingString("sWeight", "Weight") + ": " + toString(ref->base->data.weight);
|
||||
text += getValueString(ref->base->data.value);
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, text);
|
||||
if (mFullHelp) {
|
||||
text += "\n Owner: " + ref->ref.owner;
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createImageToolTip(ref->base->name, ref->base->icon, 32, text);
|
||||
}
|
||||
|
||||
// -------------------- Activator -------------------------------
|
||||
|
@ -348,7 +416,12 @@ IntSize ToolTips::getToolTipViaPtr ()
|
|||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData>* ref = mFocusObject.get<ESM::Activator>();
|
||||
|
||||
tooltipSize = createToolTip(ref->base->name, "");
|
||||
std::string text;
|
||||
if (mFullHelp) {
|
||||
text += "\n Script: " + ref->base->script;
|
||||
}
|
||||
|
||||
tooltipSize = createToolTip(ref->base->name, text);
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -374,7 +447,7 @@ void ToolTips::findImageExtension(std::string& image)
|
|||
}
|
||||
}
|
||||
|
||||
IntSize ToolTips::createImageToolTip(const std::string& caption, const std::string& image, const std::string& text)
|
||||
IntSize ToolTips::createImageToolTip(const std::string& caption, const std::string& image, const int imageSize, const std::string& text)
|
||||
{
|
||||
// remove the first newline (easier this way)
|
||||
std::string realText = text;
|
||||
|
@ -384,12 +457,10 @@ IntSize ToolTips::createImageToolTip(const std::string& caption, const std::stri
|
|||
std::string realImage = "icons\\" + image;
|
||||
findImageExtension(realImage);
|
||||
|
||||
const int imageSize = 32;
|
||||
|
||||
EditBox* captionWidget = mDynamicToolTipBox->createWidget<EditBox>("NormalText", IntCoord(0, 0, 300, 300), Align::Left | Align::Top, "ToolTipCaption");
|
||||
captionWidget->setProperty("Static", "true");
|
||||
captionWidget->setCaption(caption);
|
||||
EditBox* textWidget = mDynamicToolTipBox->createWidget<EditBox>("SandText", IntCoord(0, imageSize, 300, 262), Align::Stretch, "ToolTipText");
|
||||
EditBox* textWidget = mDynamicToolTipBox->createWidget<EditBox>("SandText", IntCoord(0, imageSize, 300, 300-imageSize), Align::Stretch, "ToolTipText");
|
||||
textWidget->setProperty("Static", "true");
|
||||
textWidget->setProperty("MultiLine", "true");
|
||||
textWidget->setProperty("WordWrap", "true");
|
||||
|
@ -407,7 +478,7 @@ IntSize ToolTips::createImageToolTip(const std::string& caption, const std::stri
|
|||
Align::Left | Align::Top, "ToolTipImage");
|
||||
imageWidget->setImageTexture(realImage);
|
||||
|
||||
captionWidget->setCoord( (totalSize.width - captionSize.width)/2 + imageSize, (32-captionSize.height)/2, captionSize.width-imageSize, captionSize.height);
|
||||
captionWidget->setCoord( (totalSize.width - captionSize.width)/2 + imageSize, (imageSize-captionSize.height)/2, captionSize.width-imageSize, captionSize.height);
|
||||
|
||||
mDynamicToolTipBox->setVisible(caption != "");
|
||||
|
||||
|
@ -468,3 +539,8 @@ std::string ToolTips::getValueString(const int value)
|
|||
else
|
||||
return "\n" + mWindowManager->getGameSettingString("sValue", "Value") + ": " + toString(value);
|
||||
}
|
||||
|
||||
void ToolTips::toggleFullHelp()
|
||||
{
|
||||
mFullHelp = !mFullHelp;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ namespace MWGui
|
|||
void enterGameMode();
|
||||
void enterGuiMode();
|
||||
|
||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||
|
||||
void setFocusObject(const MWWorld::Ptr& focus);
|
||||
|
||||
private:
|
||||
|
@ -33,7 +35,7 @@ namespace MWGui
|
|||
MyGUI::IntSize getToolTipViaPtr ();
|
||||
///< @return requested tooltip size
|
||||
|
||||
MyGUI::IntSize createImageToolTip(const std::string& caption, const std::string& image, const std::string& text);
|
||||
MyGUI::IntSize createImageToolTip(const std::string& caption, const std::string& image, const int imageSize, const std::string& text);
|
||||
///< @return requested tooltip size
|
||||
|
||||
MyGUI::IntSize createToolTip(const std::string& caption, const std::string& text);
|
||||
|
@ -49,6 +51,8 @@ namespace MWGui
|
|||
std::string toString(const int value);
|
||||
|
||||
bool mGameMode;
|
||||
|
||||
bool mFullHelp;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -497,3 +497,8 @@ void WindowManager::setFocusObject(const MWWorld::Ptr& focus)
|
|||
{
|
||||
mToolTips->setFocusObject(focus);
|
||||
}
|
||||
|
||||
void WindowManager::toggleFullHelp()
|
||||
{
|
||||
mToolTips->toggleFullHelp();
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ namespace MWGui
|
|||
void setFocusObject(const MWWorld::Ptr& focus);
|
||||
|
||||
void toggleFogOfWar();
|
||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||
|
||||
int toggleFps();
|
||||
///< toggle fps display @return resulting fps level
|
||||
|
|
|
@ -144,4 +144,5 @@ op 0x200014d: ModDisposition
|
|||
op 0x200014e: ModDisposition, explicit reference
|
||||
op 0x200014f: ForceGreeting
|
||||
op 0x2000150: ForceGreeting, explicit reference
|
||||
opcodes 0x2000151-0x3ffffff unused
|
||||
op 0x2000151: ToggleFullHelp
|
||||
opcodes 0x2000152-0x3ffffff unused
|
||||
|
|
|
@ -80,6 +80,19 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
class OpToggleFullHelp : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
context.getEnvironment().mWindowManager->toggleFullHelp();
|
||||
}
|
||||
};
|
||||
|
||||
const int opcodeEnableBirthMenu = 0x200000e;
|
||||
const int opcodeEnableClassMenu = 0x200000f;
|
||||
const int opcodeEnableNameMenu = 0x2000010;
|
||||
|
@ -93,6 +106,7 @@ namespace MWScript
|
|||
const int opcodeShowRestMenu = 0x2000018;
|
||||
const int opcodeGetButtonPressed = 0x2000137;
|
||||
const int opcodeToggleFogOfWar = 0x2000145;
|
||||
const int opcodeToggleFullHelp = 0x2000151;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
|
@ -101,7 +115,7 @@ namespace MWScript
|
|||
extensions.registerInstruction ("enablenamemenu", "", opcodeEnableNameMenu);
|
||||
extensions.registerInstruction ("enableracemenu", "", opcodeEnableRaceMenu);
|
||||
extensions.registerInstruction ("enablestatsreviewmenu", "",
|
||||
opcodeEnableStatsReviewMenu);
|
||||
opcodeEnableStatsReviewMenu);
|
||||
|
||||
extensions.registerInstruction ("enableinventorymenu", "", opcodeEnableInventoryMenu);
|
||||
extensions.registerInstruction ("enablemagicmenu", "", opcodeEnableMagicMenu);
|
||||
|
@ -117,6 +131,9 @@ namespace MWScript
|
|||
|
||||
extensions.registerInstruction ("togglefogofwar", "", opcodeToggleFogOfWar);
|
||||
extensions.registerInstruction ("tfow", "", opcodeToggleFogOfWar);
|
||||
|
||||
extensions.registerInstruction ("togglefullhelp", "", opcodeToggleFullHelp);
|
||||
extensions.registerInstruction ("tfh", "", opcodeToggleFullHelp);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -154,6 +171,8 @@ namespace MWScript
|
|||
interpreter.installSegment5 (opcodeGetButtonPressed, new OpGetButtonPressed);
|
||||
|
||||
interpreter.installSegment5 (opcodeToggleFogOfWar, new OpToggleFogOfWar);
|
||||
|
||||
interpreter.installSegment5 (opcodeToggleFullHelp, new OpToggleFullHelp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue