summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actions/actions.cpp26
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/dyetool/actions/actions.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp37
-rw-r--r--src/gui/popups/popupmenu.h2
-rw-r--r--src/gui/shortcut/emoteshortcut.cpp44
-rw-r--r--src/gui/shortcut/emoteshortcut.h2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp12
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/settings.h4
13 files changed, 135 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8ac757636..8c8abfb2a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -969,6 +969,7 @@ SET(SRCS
enums/commandtarget.h
enums/cutin.h
enums/dragdropsource.h
+ enums/emotetype.h
enums/equipslot.h
enums/guildpositionflags.h
enums/inventorytype.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 1e30fd8af..c1a7910f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -786,6 +786,7 @@ manaplus_SOURCES += main.cpp \
itemsoundmanager.h \
enums/commandtarget.h \
enums/dragdropsource.h \
+ enums/emotetype.h \
enums/equipslot.h \
enums/guildpositionflags.h \
enums/inventorytype.h \
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 5a461f522..9c9cfa092 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -320,7 +320,7 @@ impHandler(emote)
if (emotion > 0)
{
if (emoteShortcut)
- emoteShortcut->useEmote(emotion);
+ emoteShortcut->useEmotePlayer(emotion);
if (Game::instance())
Game::instance()->setValidSpeed();
return true;
@@ -1792,4 +1792,28 @@ impHandler(dumpMemoryUsage)
return true;
}
+impHandler(setEmoteType)
+{
+ const std::string &args = event.args;
+ if (args == "player" || args.empty())
+ {
+ settings.emoteType = EmoteType::Player;
+ }
+ else if (args == "pet")
+ {
+ settings.emoteType = EmoteType::Pet;
+ }
+#ifdef EATHENA_SUPPORT
+ else if (args == "homun" || args == "homunculus")
+ {
+ settings.emoteType = EmoteType::Homunculus;
+ }
+ else if (args == "merc" || args == "mercenary")
+ {
+ settings.emoteType = EmoteType::Mercenary;
+ }
+#endif
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index a09022ce7..034661282 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -114,6 +114,7 @@ namespace Actions
decHandler(barToChat);
decHandler(seen);
decHandler(dumpMemoryUsage);
+ decHandler(setEmoteType);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/actions.cpp b/src/dyetool/actions/actions.cpp
index e226464a6..e7558097a 100644
--- a/src/dyetool/actions/actions.cpp
+++ b/src/dyetool/actions/actions.cpp
@@ -111,5 +111,6 @@ impHandlerVoid(resetGameModifiers)
impHandlerVoid(barToChat)
impHandlerVoid(seen)
impHandlerVoid(dumpMemoryUsage)
+impHandlerVoid(setEmoteType)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index f0da06745..3a2186f47 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -670,6 +670,7 @@ enumStart(InputAction)
MAIL_TO,
ADOPT_CHILD,
DUMP_MEMORY_USAGE,
+ SET_EMOTE_TYPE,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 18f034e67..9a3f7f753 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1097,6 +1097,43 @@ void PopupMenu::addWindowMenu(const Window *const window)
}
}
+void PopupMenu::showEmoteType()
+{
+ setMousePos();
+
+ mBrowserBox->clearRows();
+ // TRANSLATORS: popup menu header
+ mBrowserBox->addRow(_("Show emotes for:"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for player
+ mBrowserBox->addRow("/setemotetype player", _("Player"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for pet
+ mBrowserBox->addRow("/setemotetype pet", _("Pet"));
+
+#ifdef EATHENA_SUPPORT
+ if (serverFeatures->haveServerPets())
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for homuncules
+ mBrowserBox->addRow("/setemotetype homun", _("Homunculus"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for mercenary
+ mBrowserBox->addRow("/setemotetype merc", _("Mercenary"));
+ }
+#endif
+ mBrowserBox->addRow("##3---");
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close menu
+ mBrowserBox->addRow("cancel", _("Cancel"));
+
+ showPopup(mX, mY);
+}
+
void PopupMenu::handleLink(const std::string &link,
MouseEvent *event A_UNUSED)
{
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index b69a0f588..dc53312f4 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -167,6 +167,8 @@ class PopupMenu final : public Popup, public LinkHandler
void showCraftPopup();
#endif
+ void showEmoteType();
+
/**
* Handles link action.
*/
diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp
index b5a2428af..05a7b64c1 100644
--- a/src/gui/shortcut/emoteshortcut.cpp
+++ b/src/gui/shortcut/emoteshortcut.cpp
@@ -22,9 +22,16 @@
#include "gui/shortcut/emoteshortcut.h"
#include "configuration.h"
+#include "settings.h"
#include "being/localplayer.h"
+#ifdef EATHENA_SUPPORT
+#include "net/homunculushandler.h"
+#include "net/mercenaryhandler.h"
+#endif
+#include "net/pethandler.h"
+
#include "resources/db/emotedb.h"
#include "debug.h"
@@ -70,6 +77,19 @@ void EmoteShortcut::save() const
}
}
+void EmoteShortcut::useEmotePlayer(const int index) const
+{
+ if (!localPlayer)
+ return;
+
+ if (index > 0 &&
+ index <= SHORTCUT_EMOTES)
+ {
+ if (mEmotes[index - 1] > 0)
+ localPlayer->emote(mEmotes[index - 1]);
+ }
+}
+
void EmoteShortcut::useEmote(const int index) const
{
if (!localPlayer)
@@ -78,7 +98,27 @@ void EmoteShortcut::useEmote(const int index) const
if (index > 0 &&
index <= SHORTCUT_EMOTES)
{
- if (mEmotes[index - 1] > 0)
- localPlayer->emote(mEmotes[index - 1]);
+ if (mEmotes[index - 1] > 0)
+ {
+ const uint8_t emote = mEmotes[index - 1];
+ switch (settings.emoteType)
+ {
+ case EmoteType::Player:
+ default:
+ localPlayer->emote(emote);
+ break;
+ case EmoteType::Pet:
+ petHandler->emote(emote, 0);
+ break;
+#ifdef EATHENA_SUPPORT
+ case EmoteType::Homunculus:
+ homunculusHandler->emote(emote);
+ break;
+ case EmoteType::Mercenary:
+ mercenaryHandler->emote(emote);
+ break;
+#endif
+ }
+ }
}
}
diff --git a/src/gui/shortcut/emoteshortcut.h b/src/gui/shortcut/emoteshortcut.h
index 40044d16d..6951ac9b3 100644
--- a/src/gui/shortcut/emoteshortcut.h
+++ b/src/gui/shortcut/emoteshortcut.h
@@ -113,6 +113,8 @@ class EmoteShortcut final
*/
void useEmote(const int index) const;
+ void useEmotePlayer(const int index) const;
+
private:
/**
* Save the configuration information.
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 7d15ba4a2..0b004cdad 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -31,6 +31,7 @@
#include "gui/shortcut/emoteshortcut.h"
+#include "gui/popups/popupmenu.h"
#include "gui/popups/textpopup.h"
#include "input/inputactionoperators.h"
@@ -192,6 +193,9 @@ void EmoteShortcutContainer::mouseDragged(MouseEvent &restrict event A_UNUSED)
void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
{
+ if (event.isConsumed())
+ return;
+
if (event.getButton() == MouseButton::LEFT)
{
if (!emoteShortcut)
@@ -214,6 +218,14 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
mEmoteClicked = true;
}
}
+ else if (event.getButton() == MouseButton::RIGHT)
+ {
+ if (popupMenu)
+ {
+ event.consume();
+ popupMenu->showEmoteType();
+ }
+ }
}
void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event)
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 6d3c957e3..ad2517acc 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5509,6 +5509,12 @@ static const InputActionData inputActionData
"dumpmemoryusage|memoryusage",
UseArgs_false,
Protected_true},
+ {"keySetEmoteType",
+ defaultAction(&Actions::setEmoteType),
+ InputCondition::INGAME,
+ "setemotetype",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction
diff --git a/src/settings.h b/src/settings.h
index 8fc826ed0..0bc167564 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -23,6 +23,8 @@
#include "options.h"
+#include "enums/emotetype.h"
+
#include "enums/resources/map/maptype.h"
#include <vector>
@@ -73,6 +75,7 @@ class Settings final
crazyMoveState(0U),
targetingType(0U),
mapDrawType(MapType::NORMAL),
+ emoteType(EmoteType::Player),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -126,6 +129,7 @@ class Settings final
unsigned int crazyMoveState;
unsigned int targetingType;
MapTypeT mapDrawType;
+ EmoteTypeT emoteType;
bool persistentIp;
bool limitFps;
bool inputFocused;