summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-08-31Some margin and indentation tweaks in news and NPC dialogsThorbjørn Lindeijer6-40/+41
* Apply indentation after wrapping only in NPC dialogs and chat window, since we don't want this in the updater window / news. * Added some margin around the text in the updater window and NPC dialogs, using gcn::Widget::setFrameSize. * Cosmetic changes to BrowserBox implementation.
2024-08-28Fixed handling of consecutive text formatting markersThorbjørn Lindeijer1-11/+7
If a text contained for example "##3##B", expected behavior was to switch to blue color and bold font. Instead, due to there being no actual text in between the markers, the layouting code was aborting prematurely here: if (mMode == AUTO_WRAP && partWidth == 0) break; As far as I could judge, this check is actually not necessary anyway, but I've kept it for now since the wrapping code looks so problematic. Instead, a while loop now makes sure we process all consecutive formatting markers. Closes #75
2024-08-28Fixed choosing default world when using -D command-line parametercuoco1-6/+1
- Updated STATE_WORLD_SELECT case to automatically select the first world and proceed to update state when mOptions.chooseDefault is true. - This change ensures that the world selection window is bypassed for a smoother user experience when the default selection option is enabled. - Improved logic to handle cases with only one available world and directly proceed without showing the dialog.
2024-08-26Limit shop's Max button to available carry weightFedja Beader1-1/+13
(cherry picked from M+ commit 13b9ff5baf1f6d31cc6bfa5bd30bacd45b80539c)
2024-08-25Fixed initialization of equipment backendThorbjørn Lindeijer9-144/+109
For new characters (and in general, when logging in with a character that had nothing equipped), the equipment backend wasn't being initialized. This resulted in the equipment not being visible in the Equipment window. Fixes #83
2024-08-15Fixed resize border width on bottom and right sidesThorbjørn Lindeijer1-4/+4
2024-08-04Removed a bunch of unused NPC related eventsThorbjørn Lindeijer6-103/+13
Nobody cared for the events that were emitted when NPC related network messages had been sent.
2024-08-04Small code simplification in Button::initThorbjørn Lindeijer1-10/+7
2024-08-04Reuse Window::ensureOnScreenThorbjørn Lindeijer1-17/+7
Less code duplication.
2024-08-04Removed unused Skin::mName and Skin::mFilePathThorbjørn Lindeijer2-29/+8
2024-08-04Add to npc option targetSelection to allow/disallow npc selection.Thorbjørn Lindeijer6-6/+37
The targetSelection attribute is supported on monsters and NPCs. Also changed return value of Being::getInfo to indicate it can't return nullptr. (cherry picked from M+ commit dbc3b324a0c5dcb1a0ee29b289e71423a06e85fd)
2024-06-25Added online player list to Social windowDavid Athay9-24/+146
The online list refreshes every 18 seconds, which matches ManaVerse behavior. It's not ideal, but to improve this would mean diving into TMWA. The client version was bumped to 8 to get a SMSG_ONLINE_LIST reply. Further changes needed related to the client version are tracked by #71. This also changes the TabbedArea to take into account the frame size for its tab widgets, to make sure those frames are not clipped by the TabbedArea widget (as happened in the Social window). The horizontal scroll bar is now disabled in all social tabs, with the vertical one appearing only when necessary. Closes #61
2024-06-25Fixed spaces getting added to chat every 50 charactersThorbjørn Lindeijer2-25/+2
This reverts part of 087babc2525ddb89e5b31f240a08739d9a3029a9. It's unclear to me why big words should be split (chat window force-wraps when necessary anyway) and it's causing issues by adding spaces in the middle of links, for example.
2024-06-25Show item links with empty item name.npc-text-formattingAndrei Karas1-0/+11
(cherry picked from commit 0192d44d46dcf948ab26371862753f4baf5aae4e)
2024-06-23Added support for text formatting and links to NPC dialogThorbjørn Lindeijer2-36/+27
Use BrowserBox in NpcDialog to enable the use of text formatting and links in NPC texts. This change is roughly based on ManaPlus commit 94f11a223e03c6845e7ce6e9fe67c0e9fa7061f4.
2024-06-22Added support for bold font markup to BrowserBoxThorbjørn Lindeijer2-39/+64
##B switches font to bold, ##b switches font to normal. Each line starts with the normal font. This change is roughly based on ManaPlus commit 6c4c6ca877c336e17c0378131a0a139792012a99.
2024-06-19Fixed cURL linker issues on MSYS2Thorbjørn Lindeijer1-2/+1
MSYS2 builds cURL 8.8 with CMake, which installs a CURLConfig.cmake file. Since CMake 3.17, the FindCURL module will prefer to return the values from the config file. However, CURLConfig.cmake does not set CURL_LIBRARIES. While a fix for this is pending release (see https://github.com/curl/curl/commit/1dec702c8676fef3a7b5850e5350102876067680), we can rather update to modern CMake by relying on the IMPORTED target CURL::libcurl, which is set since CMake 3.12 (our current minimum required version).
2024-06-09Enable resizing windows from all sidesThorbjørn Lindeijer3-8/+25
Previously, the top edge of windows could not be dragged. Now you can also resize windows by their top edge, as well as the top-left and top-right corners.
2024-06-03Added handling of SMSG_SCRIPT_MESSAGEThorbjørn Lindeijer1-0/+13
These are server chat messages triggered from scripts. In TMW this appears to be used only by the magic system. Added in client protocol version 5 (see issue #71).
2024-05-07Replaced ENet with submoduleThorbjørn Lindeijer1-8/+11
This also updates ENet from 1.3.2 to 1.3.18. The previously supported WITH_BUNDLEDHEADERS option that affected which ENet was being used has now been reversed and renamed to USE_SYSTEM_ENET, which defaults to OFF for now.
2024-04-20CMake: Use FindIntlThorbjørn Lindeijer1-19/+8
FindIntl was added with CMake 3.2 and can be used to find the Gettext libintl headers and libraries. I've removed special handling of Solaris, which explicitly added linking to 'intl' and added '/usr/local/lib' include path. It can be easily restored if necessary, once somebody tries to compile Mana on Solaris.
2024-04-20CMake: Use add_compile_definitions instead of setting COMPILE_FLAGSThorbjørn Lindeijer1-21/+12
This is supported since CMake 3.12 (current minimum) and simplifies the whole quoting business. Also used a generator expression to set the DEBUG define conditionally. At the same time, DEBUG is no longer defined in RelWithDebInfo builds, but it shouldn't be.
2024-04-20CMake: Use cmake-format to make the files more pleasant to readThorbjørn Lindeijer1-129/+134
More consistent formatting and no longer everything in uppercase, yay!
2024-04-20CMake: Removed unused PROGRAMS variableThorbjørn Lindeijer1-2/+0
A leftover from 86522166e082b2defaea541747ecdce0f1149fe5.
2024-04-18Fixed being popup getting stuck under the mouseThorbjørn Lindeijer1-0/+2
Normally the popup follows the mouse, but when the mouse is moved down such that it is on top of the popup, the popup would seem to get stuck. When the BeingPopup is a mouse listener, the default behavior of Popup hiding the BeingPopup when the mouse moves over them kicks in. Hiding of the BeingPopup by Popup and Window when they are hovered in general is a workaround which might be necessary because there is currently no way for the Viewport to determine whether the mouse is above the map view or over a piece of UI.
2024-04-18Fixed mouse path debug when graphics are scaledThorbjørn Lindeijer1-3/+0
This SDL_GetMouseState call did not adjust the result to the graphics scale. Fortunately it could just be removed, since mMouseX and mMouseY are anyway updated each Viewport::logic.
2024-04-18Simplify TmwAthena::MessageOutThorbjørn Lindeijer5-84/+27
Since for tmwAthena we're writing messages directly into the output buffer, the MessageOut implementation does not need any members. Also used SDL_SwapLE16 and SDL_SwapLE32 for convenience.
2024-04-17macOS: Create an app bundleThorbjørn Lindeijer5-33/+74
Also enable using `cpack -G DragNDrop` to create a DMG to easily drag Mana into the Applications folder. The DMG is also available as a CI artifact. The minimum deployment target has been set to 10.15, as required due to usage of std::filesystem::create_directories.
2024-04-12CMake: Use GNUInstallDirsThorbjørn Lindeijer2-4/+9
This should make CMake options a little more standardized. The Windows part could potentially still be unified further. Absolute paths are now only used for the defines and not for values going to install() commands.
2024-04-10Fixed the scaling of the custom cursorThorbjørn Lindeijer1-5/+6
It appears that either SDL or the system is already taking care of scaling the cursor to the display scale (observed on both macOS and Wayland). Hence, we should only scale the cursor by the user scale and not by both. Follow-up to 6eca1b485dba7355d827745284ed2f0072f9e370.
2024-04-09Removed unused duplicate parsing of effects.xmlThorbjørn Lindeijer2-108/+0
The loading of effects.xml has ended up being duplicated, with an implementation in getEffectDescription in actorsprite.cpp as well as in EffectManager. But the one in actorsprite.cpp was actually never used.
2024-04-08Fixed assertion failure on exitThorbjørn Lindeijer1-0/+4
Regression introduced in 14dc8218eeebd1583e6bd3c49013b3e501f47228.
2024-04-08Added UI debug drawingThorbjørn Lindeijer7-4/+104
Shows outlines of visible widgets as well as highlighting modal focus, modal mouse focus and regular focus. Can currently only be toggled in the Debug window, so needs source code modification to be used during login sequence for now.
2024-04-08Use ResourceRef<Image> in more placesThorbjørn Lindeijer25-136/+127
Automatic reference counting of images is now used by Item, Icon, AnimatedSprite, ImageSprite, ParticleEmitter, Minimap, Desktop and Emote. Since ResourceManager::get automatically adds a reference, it needs to be explicitly subtracted when the resource is managed by ResourceRef. This is taken care of by the new ResourceManager::getImageRef. Also removed the apprently unused and duplicate "mDrawImage" from Item (which also didn't get decRef called on it). Fixes cleanup of emote ImageSet and ImageSprite instances, as well as particle images.
2024-04-08Fixed choosing preferred language on WindowsThorbjørn Lindeijer1-11/+32
The linker could not find _nl_locale_name_default. Maybe it could be fixed by linking to another library, but it would likely not yield the preferred behavior. Instead, we now use GetUserPreferredUILanguages to set the LANG environment variable with one or more languages and let gettext choose the best fitting available translation. Also fixed the directory from which the translations are loaded to match the installation directory,
2024-04-08CMake: Removed manual RC-compiler setup for MinGWThorbjørn Lindeijer1-16/+0
Works without in MSYS2, at least.
2024-04-08Set Windows-related DPI hints to per-monitor aware v2Thorbjørn Lindeijer1-0/+4
Set SDL_HINT_WINDOWS_DPI_AWARENESS to "permonitorv2", which tells Windows the application will handle all scaling. We don't currently adjust the window size when it changes monitors, but mainly use this hint to disable scaling by the system, since that blurs fonts and pixel art. Once we can properly handle fractional scaling (which is common on Windows), we can set SDL_HINT_WINDOWS_DPI_SCALING to "1" instead.
2024-04-08Resolved issues with winver.hThorbjørn Lindeijer5-46/+6
The configured file wasn't actually being used, because it was not in the include path. Instead, a checked in version was used. In addition, winver.h is an existing Windows header, which was conflicting with the generated file. Instead, now mana.rc itself is configured. We didn't actually need winver.h anywhere else, anyway.
2024-04-08Enable UTF-8 support on WindowsThorbjørn Lindeijer1-0/+3
This relies on Windows 10 version 1803 (10.0.17134.0), which is hopefully an acceptable minimum. It fixes handling of paths with special characters.
2024-04-08Use C++17 to implement mkdir_rThorbjørn Lindeijer2-68/+9
Should be a lot less fragile and might also help to resolve encoding issues.
2024-04-08CMake: Allow using CPack to generate an NSIS installerThorbjørn Lindeijer1-5/+4
* Set the version, description and homepage URL using modern CMake style (minimum supported version increased to CMake 3.12). * Fixed the reference to the MUI_WELCOMEFINISHPAGE_BITMAP file, which needed "\\" instead of "/" to work for me in MSYS2, and with CPACK_VERBATIM_VARIABLES enabled (otherwise "\\\\" was needed). * Fixed the icon used for the uninstall entry by setting CPACK_NSIS_INSTALLED_ICON_NAME. * Fixed missing start menu entry by setting CPACK_PACKAGE_EXECUTABLES. * Fixed running Mana when finishing the install by setting CPACK_NSIS_EXECUTABLES_DIRECTORY. * Mark the NSIS installer as DPI-aware using CPACK_NSIS_MANIFEST_DPI_AWARE. * Enabled uninstall before install using CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL.
2024-04-08Windows: Modernize getSpecialFolderLocationThorbjørn Lindeijer3-33/+32
Ported from CSIDL to newer FOLDERID API and used wcstombs_s to convert the returned path to a multi-byte string. Fixes issues when the Windows username contains special characters.
2024-04-08Compile fixes for MSYS2 UCRT64Thorbjørn Lindeijer4-10/+7
Also added instructions for installing the dependencies on MSYS2. The selection of the default language is commented out for now. It will be fixed in another change.
2024-04-02General code cleanupsThorbjørn Lindeijer45-176/+117
* Removed some unused includes * Removed unused ListBox::mFont * Removed wrong cast to SDL_Scancode * Removed superfluous .c_str() * Removed superfluous explicit std::string construction * Removed unused variable * Use more emplace_back * Turned FindBeingFunctor into a lambda * Avoid needless pointer references for ambient layers and use a vector
2024-04-02Fixed padding on mini-status windowThorbjørn Lindeijer1-0/+2
Broke in 474442f1a49d29d85de769c4fbb3aa8636877b49 due to changing the default padding on the Popup class.
2024-03-28Fixed size and child positions for various popupsThorbjørn Lindeijer10-91/+66
Most prominently, fixes the tooltips on the window buttons being clipped due to their position being slightly outside of the clipping children area. And fixes NPC tooltips from having a lot of empty space below the NPC name. Also reduced the space between texts in the item tooltip to match the padding rather than being an entire empty line.
2024-03-28Fixed compile against libxml2 2.12ewew ukek2-23/+22
Quote from Fedora mailing lists: The latest released versions of libxml2 have a couple of important changes in header files that have unintentionally caused some packages to fail to build without modification, including: * several functions now accept or return a const xmlError struct * cyclic dependencies in header files were fixed (by dropping some includes)
2024-03-26CMake: Added USE_SYSTEM_GUICHAN optionThorbjørn Lindeijer1-16/+14
So that one can choose to build with the Guichan submodule also on other systems than macOS.
2024-03-26Use SDL2 support for color and system mouse cursorsThorbjørn Lindeijer5-121/+194
This way the cursor is not limited by the framerate nor affected by input lag. Also, when custom cursor is disabled, a few different system cursors are now used instead. It also avoids an issue on Wayland, where hiding the cursor (as done to render our own one) would cause the cursor to get locked within the window. On macOS it fixes two cursors being visible when hovering the window while it is in the background. The cursor can unfortunately no longer gently fade away.
2024-03-26Added support for HiDPI fontsThorbjørn Lindeijer9-81/+120
* TrueTypeFont class now takes into account the graphics scale, in order to render an appropriate higher-resolution texture. * Removed TrueTypeFont::fontCounter, since TTF_Init/TTF_Quit already keep a counter. * Avoid copying the rendered string needlessly, when it already exists in the cache. Avoid another copy, when inserting a new chunk into the cache.