summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
6 daysGUI: Added Desktop skinHEADmasterThorbjørn Lindeijer4-10/+9
Replaces the default login wallpaper. The wallpaper can still be set either through branding or in the client data. This also fixes the scaling of the Manasource logo when using the Mana theme. Closes #99
6 daysFixed clipping issue when using legacy OpenGL rendererThorbjørn Lindeijer1-2/+0
Fixes regression in 80f76c3aae438f7b9a7c1359c3f37aac460f934b. The scissor is no longer always enabled, but since it was enabled on startup there was visible clipping when resizing the window right after startup.
6 daysWork around issue with minimizing maximized windowsThorbjørn Lindeijer5-3/+19
Only call `SDL_ShowWindow` once, since it seems old SDL versions (like 2.30.0, shipping with Ubuntu 24.04) do not allow a maximized window to be minimized when `SDL_ShowWindow` is called each frame.
6 daysWork around player invisibility caused by "unspecified" genderThorbjørn Lindeijer8-55/+30
The "Unspecified" gender was causing some older players to be invisible since no sprites were displayed at all. I think this is a bug in TMWA, which should never send SEX::UNSPECIFIED for player characters, but while this bug exists we can make sure to map this to Gender::Neutral (renamed from "Hidden"). The Gender::Unspecified value was removed entirely because it never makes sense for beings. One "neutral" value should be enough.
7 daysFix gradient type text display being updated before slider value is read.Fedja Beader1-1/+1
This resulted in gradient type text lagging one step behind the actual type. This.. this bug was here for 14 years?! **** mana/verse!234
14 daysFixed issues related to wrong alpha mod set on texturesThorbjørn Lindeijer5-59/+29
Due to the use of SubImage, there can be multiple images pointing to the same SDL_Texture with different alpha values. However, since the alpha mod set on the texture was only set from Image::setAlpha, images were not always rendered with the correct alpha value. Now the alpha mod is always set right before rendering each image. Most of the time the alpha will remain the same, but I don't expect this to become a performance issue so I've not added extra variables and checks to suppress such calls when they aren't needed. On the upside, this simplifies the "use color" option, which previously had to restore the previously set alpha mod. Closes #117
14 daysAdded support for the hidden/neutral genderThorbjørn Lindeijer11-32/+56
TMWA supports a "neutral" gender, which in Mana client maps to "hidden". In The Mana World, it means a player character is not displayed as clearly male or female, using a dedicated base sprite with more underwear. It is not possible to choose the neutral gender on account registration or character creation. In TMW, these choices are not actually relevant anyway and could probably be removed. Fixes #114
2025-07-17Use layout system for Confirm and Ok dialogsThorbjørn Lindeijer4-72/+25
Fixes some issues with the manual layout.
2025-07-15Render font outlines using TTF_SetFontOutlineThorbjørn Lindeijer17-290/+300
Rather than rendering the same texture 4 additional times, render a specific outline version of the text. While reducing the number of times the text is drawn, it does increase font texture use. Result is a generally prettier outline due to rendering it properly at sharp corners of the characters. The shadow for outlined text is now also thicker, as appropriate. As part of this change, the `TextRenderer` class was merged into the `Graphics` and `TrueTypeFont` classes. There seemed to be little point in having a separate function for this, apart from needing more static casts to `Graphics*`. Also fixed an issue where the font style was not being restored after adjusting the font scale, when using an older SDL_ttf than 2.0.18. Closes #87
2025-07-15Theme: Introduced HIGHLIGHT_TEXT colorThorbjørn Lindeijer8-8/+32
For customizing the text color used with HIGHLIGHT color as background.
2025-07-15Theme: Use TEXT color when rendering item amountsThorbjørn Lindeijer1-1/+1
Rather than hardcoded black.
2025-07-14Simplified cursor code using SDL_CreateRGBSurfaceWithFormatThorbjørn Lindeijer1-14/+2
2025-07-14Various small cleanupsThorbjørn Lindeijer3-5/+4
* Fixed doxygen comment on KeyFunction struct * Use SDL_BUTTON_LMASK instead of SDL_BUTTON(1) * Removed unused include
2025-07-14Reduced scope of static ChatLogger functionsThorbjørn Lindeijer2-67/+57
No need for them to be part of the header.
2025-07-14Fix quests window destruction and add QuestDB::initThorbjørn Lindeijer7-4/+14
The init call makes sure there are no quests loaded, which is necessary because `SettingsManager::unload` is only called on exit and not when switching servers. Closes #112
2025-07-12Typo fixes (based on reports by meway)Thorbjørn Lindeijer4-5/+5
2025-07-11Make the screenshot file name a clickable linkThorbjørn Lindeijer3-3/+39
Some security checks are done because players might also write "screenshot:" in the chat to create file:// URLs and `SDL_OpenURL` can be used to open many things. So we disallow ".." and require a ".png" extension.
2025-07-11Cleaned up ImageRect a littleThorbjørn Lindeijer18-135/+59
* Use `std::unique_ptr`, so we can get rid of the custom move constructor and destructor. * Move and rename the `ImagePosition` enum to `WindowAlignment`, which fits better with what this enum is actually used for.
2025-07-08Jewelry: Adjusted color of highlighted tabThorbjørn Lindeijer1-3/+12
Seems this color just wasn't copied over correctly due to being on a different palette originally. Also made Tab::draw use the correct outline color. Addresses part of #98.
2025-07-06Add support for custom text colors for progress bars in GUI themeAndrew Hall3-14/+38
Since there was already specific support for theming different progress bars with a custom color gradient, it was relatively straight-forward to extend this to support custom text formats. Thanks to @Meway for having an initial go at this feature! Closes #111
2025-07-04Added logging priorities and use SDLs logging facilitiesThorbjørn Lindeijer86-593/+615
By using SDL logging, we can rely on SDL to filter the log messages by their priority before they get sent to our custom output function. For example, we now no longer get entries for created and destroyed Window instances by default, since these have only "debug" priority whereas the default priority for the "app" category is "info". We can also get log messages raised by SDL itself in our log now. Log levels can be controlled per category through the "SDL_LOGGING" environment variable. Many existing log messages have been assigned a category based on their existing prefix.
2025-07-04Allow the window to keep updating during move/resize on Windows and macOSThorbjørn Lindeijer4-377/+406
On Windows, the SDL event loop would get blocked during move/resize, which made the game stop updating. Since version 2.30, SDL will send its SDL_WINDOWEVENT_EXPOSED event on an internal timer during window move/resize so the application can keep redrawing. Since no window size changed events can be received either, the size of the window and the renderer is now updated at the start of each frame. On macOS the SDL event loop was similarly blocked during resize. The event watcher is only used on Windows and macOS because on X11 the processing of all the queued up expose events can cause a delayed response to resizing. Besides, the issues fixed by this watcher don't exist on X11 and Wayland.
2025-07-03Avoid warning on WindowsThorbjørn Lindeijer1-0/+2
A compatible definition of MAKEWORD may already get pulled in from the Windows include minwindef.h.
2025-07-02Delay showing of the window to avoid startup flickerThorbjørn Lindeijer4-4/+16
Otherwise, at least on X11, the window is (visibly) re-created once the SDL renderer is created. Also the window icon can be seen changing on startup. Showing the window only after all related setup has been completed avoids this. On X11 this appears to have the added benefit of putting a "windowed fullscreen" window on the active screen (in terms of where the mouse is) rather than always using the primary screen. On Windows, showing the window only after the initial paint avoids the window initially appearing with its contents entirely black. The window is still immediately shown in the following cases: * In exclusive fullscreen mode, because on Windows this caused the initial show of a fullscreen window to take much longer and on X11 it could cause the resolution of the primary screen to be changed while maximizing the Mana window on the active screen. * In "windowed fullscreen" mode when the legacy OpenGL renderer is used, where it was causing an additional flicker on Windows.
2025-07-02Implemented effects for new and completed questsThorbjørn Lindeijer3-0/+69
2025-07-02Added Quests windowThorbjørn Lindeijer18-33/+495
This window gives an overview over completed and currently active quests. A persistent checkbox toggles whether completed quests are shown. Item links are supported in quest texts. New window icon by meway. Completed quest icon for Mana theme copied from ManaPlus. The Quests window has no shortcut for now.
2025-06-23Apply quest effects to NPCsThorbjørn Lindeijer5-7/+177
The `TmwAthena::PlayerHandler` now handles the quest variables and applies the active quest effects to NPCs. They are updated when variables change or the map changes.
2025-06-17Add quest database support and parsing utilitiesThorbjørn Lindeijer6-0/+224
- Introduce QuestDB with quest/effect structures and XML parsing - Register questdb in CMake and settings manager - Add fromString overload for std::vector<int> parsing
2025-06-11Fixed the maximum size of the ShortcutWindowThorbjørn Lindeijer1-2/+5
It should be at least the minimum size. This was not the case when there were no emotes provided by the server (as for Source of Tales currently). Issue manifested itself as `std::clamp` assert in debug builds, and probably undefined but harmless behavior in release builds.
2025-06-11Cleaned up game input handling a littleThorbjørn Lindeijer3-486/+444
This avoids some duplicated code between `Client` and `Game` and reduces code indentation. Now only the `Client` calls `SDL_PollEvent` and handles `SDL_WINDOWEVENT_SIZE_CHANGED`. This also fixes the Keyboard setup tab to allow assigning keys before starting the game.
2025-05-25Fixed tooltip visibility logic for shortcut and inventory windowsThorbjørn Lindeijer6-31/+44
* When hovering an empty box in the shortcut window, the tooltip of a previously hovered non-empty box would stay visible. * When hovering to the right of a row of inventory items, the tooltip for the left-most item on the next row would be displayed. Also added some padding to shift the text and item icon a little in the shortcut window when using the Jewelry theme.
2025-05-21macOS: Use system Guichan by defaultThorbjørn Lindeijer1-1/+1
Guichan 0.8.3 was released and can now be installed through Homebrew, we don't need to rely on the Guichan submodule on macOS anymore.
2025-05-12TMWA: Added debug logging of sent messagesThorbjørn Lindeijer3-2/+16
2025-05-12Fixed handling of "close2" script commandThorbjørn Lindeijer3-30/+11
When adding support for SMSG_NPC_COMMAND in d5ebad4e74da011777f9ba1a13f, I mistakenly assumed the "close dialog" (5) command should just close the NPC dialog. However, the client is expected to send CMSG_NPC_CLOSE as well. Closes #91 Closes #107 Closes #108
2025-05-01Fixed loading of servers saved in client configThorbjørn Lindeijer2-7/+3
This was broken by 79e4325192f3260ed4ded264e43da8429650bf72 due to there being a case difference between the serverTypeToString and parseType functions, causing loaded servers to be invalid due to unknown server type. Closes #105
2025-05-01Fixed crash on Windows related to choosing wrong log overloadThorbjørn Lindeijer3-4/+4
When compiled with MinGW, the va_list overload of Logger::log was chosen where a char* was passed, causing a crash at runtime. Resolved by renaming the va_list version to Logger::vlog.
2025-04-29Made the Setup window key work during login sequenceThorbjørn Lindeijer2-2/+14
Closes #100
2025-04-29Changed removeColors to work in-placeThorbjørn Lindeijer6-44/+28
Can avoid some memory allocations. Also simplified its implementation a little. Also made ChatLogger::getDateString use the full year.
2025-04-29Reduced excessive use of getters in LocalPlayer::getNextWalkPositionThorbjørn Lindeijer2-60/+63
getWalkMask() and getCollisionRadius() are not going to return different values each time, so assign them to a local variable. Also marked LocalPlayer::getNextWalkPosition const.
2025-04-29Some Inventory and TradeWindow cleanupsThorbjørn Lindeijer5-81/+56
Mainly using std::vector<std::unique_ptr<Item>> to automate memory management.
2025-04-29Dye: Cast to SDL_Color rather than shifting bits aroundThorbjørn Lindeijer3-32/+35
When we use SDL_PIXELFORMAT_RGBA32, which is actually the same as SDL_PIXELFORMAT_ABGR8888 on little-endian systems, we can cast the pixel data directly to SDL_Color* for easy access to the components. This may also make applying dye more efficient on big-endian systems, though I have no such system to test with. Follow-up to d8b871727c363892b14f2eadfad8f6058ec6ab72.
2025-04-29Fixed compile with ENABLE_MANASERV=OFFThorbjørn Lindeijer2-3/+3
2025-04-28GUI: Removed fixed width for ItemAmountWindowThorbjørn Lindeijer1-1/+1
The window needs to be slightly larger on Jewelry theme. By not specifying a width, the layout will take care of this.
2025-04-28GUI: Added skin for the emote slots in the EmotePopupThorbjørn Lindeijer4-29/+28
Allows more flexible customization as needed by Jewelry theme.
2025-04-28GUI: Use theme icons for offline/online player indicatorsThorbjørn Lindeijer2-34/+24
Instead of loading images directly, which is less flexible. In Jewelry theme, these icons are embedded in the window.png image.
2025-04-26GUI: Added support for explicit outline color per palette entryThorbjørn Lindeijer14-81/+180
This enables customized outlines for each text color as well as adding outlines for specific palettes, as done by the Jewelry theme. Merged PARTY_CHAT_TAB and PARTY_SOCIAL_TAB into just PARTY_TAB since we should probably be using the same color there anyway. Split off WHISPER_TAB as separate color from WHISPER.
2025-04-25GUI: Added support for multiple color palettes to ThemeThorbjørn Lindeijer33-384/+432
Each Skin can point to a different palette, which can be used to tweak text colors where necessary. For now there is no generic solution for this, instead a number of locations have been adjusted to take the palette into account: * ChatWindow sets its palette on the BrowserBox used in its tabs. * Popup sets its palette on child widgets when they are added (covering BrowserBox, Label and TextBox). * ItemPopup now uses its palette when looking up colors. The BrowserBox now retrieves its numbered text colors from the theme. Also added OLDCHAT, AWAYCHAT and GLOBAL theme colors, with ##g, ##o and ##a to choose these colors respectively. Fixed ImageRect move constructor. TextPreview class was cleaned up from unused functionality. Being name colors are no longer different between the name shown on the being and the name shown in the SpeechDialog.
2025-04-25Introduced theme dropdown in interface setupThorbjørn Lindeijer14-121/+257
* Added Theme dropdown to Interface setup * Added CARET theme color * Fixed issue with logging errors in `check` function in `theme.cpp` * Fixed XML::Children::Iterator to iterate only element nodes * Changed default theme to "jewelry" Changing the theme (or font size) shows a dialog that points out a restart is required to apply these changes. This is necessary at the moment because many things, like default or minimum window sizes, are only calculated once.
2025-04-25GUI: Added support for hiding the scroll area buttonsThorbjørn Lindeijer4-9/+140
And made the Jewelry theme hide those buttons.
2025-04-25GUI: Added support for fixed-size scrollarea markersThorbjørn Lindeijer2-7/+338
Due to getVerticalMarkerDimension and getHorizontalMarkerDimension not being virtual, this unfortunately required copying a lot of code from Guichan to make sure it calls our versions of these functions. Also addressed a small issue where gcn::ScrollArea::checkPolicies was not taking the frame size of the content into account.