summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-10-08Small cleanup in OutfitWindow::loadThorbjørn Lindeijer2-19/+7
Based on MV commit db452921bafb2dd322b52c1e5d03e5e713849dd0.
2024-10-08Simplified "drawnWhenBehind" logicThorbjørn Lindeijer8-37/+8
* Removed `Actor::getNumberOfLayers`, since we really only cared about whether they should be visible when behind other stuff. * Removed `CompoundSprite::drawnWhenBehind`, since this property was only relevant for actors.
2024-10-08Restore the screen shake effectThorbjørn Lindeijer2-30/+32
Now the experience mightes better with what it was before the logic update change (59a7d5c58f8b3af21b3e19d4e78f5653bf011bfb). The per-frame effect is reduced and less constant, based on a sine wave. The effect is no longer applied directly to the mPixelViewX/Y values, but is rather only taken into account when rendering the view.
2024-10-08Use Timer for duration of blinking nameThorbjørn Lindeijer3-23/+18
This fixes the duration on 1500 ms, whereas before it was dependent on the framerate, blinking for 200 frames.
2024-10-08Smoother keyboard movementThorbjørn Lindeijer4-26/+39
This change addresses the slight stutter and broken animation playback when walking with the keyboard. Once the end of the path has been reached but a movement key is still held, the LocalPlayer now immediately calculates a new path rather than waiting on the next logic update.
2024-10-08Smoother being movementThorbjørn Lindeijer7-67/+71
There was a slight stutter in being movement, since each time a being reached the next position along its path, it would only continue to the following position with the next logic tick. Now the logic has been adjusted to keep moving until all the time for the current frame was used up, or the path was exhausted. A slight stutter remains for keyboard movement, as well as broken walk animation playback, since it will only set a new path once the current one is finished (see e554d9b2be1ec2fcb15065ae70151302adeef602). Also simplified some logic in Viewport::draw and removed some obsolete code in LocalPlayer::startWalking.
2024-10-08Do a single logic update each frameThorbjørn Lindeijer26-113/+92
The logic update now uses Time::deltaTimeMs() where needed to make it framerate-independent. This means there will no longer be multiple logic calls per frame (as was usually the case with logic ticking at 100 fps whereas the game would generally run at 60 fps). At the same time, the game can be more precise at higher framerates and should now run smoother at 144 Hz, for example. Previously the game would sometimes skip logic ticks at that rate. This change affects: * Updating of animations * Being movement speed * More moving of manual time variables to Timer Notoriously, the particle system still does 100 ticks/second.
2024-10-08Added convenient and efficient Timer classThorbjørn Lindeijer26-293/+388
The Timer is efficient because it does not depend on incrementing a counter to keep track of time, nor does it call SDL_GetTicks every time its state is checked (this happens once per frame instead). Along with global functions Time::absoluteTimeMs() and Time::deltaTimeMs(), this replaces previous globals tick_time, cur_time and get_elapsed_time(). For now, there is still a fixed 100 times per second logic call rate, but the new Time::deltaTimeMs() function should allow getting rid of this.
2024-10-04Removed useless LocalPlayer::mUpdateNameThorbjørn Lindeijer6-39/+3
Maybe it once had a use, but a change in the "Show own name" setting is already handled by LocalPlayer::event.
2024-10-02Fixed potential crash in character selectionThorbjørn Lindeijer1-0/+2
When items with particle effects are equipped.
2024-10-02Removed getter/setter cruft from BeingInfoThorbjørn Lindeijer6-143/+86
Made the class and the code in general more readable by removing all the needless getters and setters. Also used "enum class" for SoundEvent.
2024-09-30Reduce number of rand() calls in Particle::updateAndrei Karas1-3/+4
(cherry picked from M+ commit cc6b5ebf94ad24180a4db69aa87cae07e3c876d2)
2024-09-30Added support for particle effects on equipmentThorbjørn Lindeijer6-37/+104
The effect is also there when the equipment is dropped, because it uses the same field as the floor item. Removed unused ItemInfo::particle. Based roughly on M+ commit 44e5d8bcb7fea443ca9ed3844454b11ac6e4dbed. Closes #85
2024-09-28Replaced all "xmlChildrenNode" with "children"Thorbjørn Lindeijer8-17/+16
Because "xmlChildrenNode" is a macro defined for compatibility with libxml1, which we don't support.
2024-09-28Removed getter/setter cruft from ItemInfoThorbjørn Lindeijer20-365/+213
Made the class and the code in general more readable by removing all the needless getters and setters.
2024-09-27Replaced for_each_xml_child_node macro with helper classThorbjørn Lindeijer21-48/+73
The new XML::Children class enables using a C++11 range-based for loop to iterate over the children of an xmlNodePtr.
2024-09-02Added a hand mouse cursor, used when hovering linksThorbjørn Lindeijer4-14/+24
InputEvent::mIsConsumed is used to tell the Window it should not change the mouse cursor as well. This change also adds a closed hand mouse cursor, though this is unused for now (might be useful when dragging stuff around). The new cursors are by meway.
2024-08-31Apply a margin to the text in the help windowThorbjørn Lindeijer1-7/+3
And removed the manual space character at the start of each line...
2024-08-31Display "Mana" as part of the version in Setup windowThorbjørn Lindeijer4-5/+5
This was already done in the log, when responding to the --version parameter and for the label on the Desktop widget, but not in the Setup window. Now it is consistently part of the FULL_VERSION define.
2024-08-31BrowserBox: Make sure to start each line with the default colorThorbjørn Lindeijer1-1/+4
This was already the case for each newly added line, but when the entire layout was redone previous selected colors would spill over to the next line.
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.