summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-07Fixed handling of equipmentThorbjørn Lindeijer4-18/+37
* Fixed ManaServ::EquipBackend removing all slots in response to GPMSG_INVENTORY_FULL, rather than resetting them to empty. * Fixed updating of buttons in InventoryWindow as relevant from the ManaServ::InventoryHandler. * Updated handling of equipment sprites in messages related to character appearance (Manaserv now always sends all relevant equipment and as such does not send removals).
2025-03-07Support triggering attacks and play use ability animationsThorbjørn Lindeijer7-50/+96
For now, PlayerHandler::attack just tries to trigger the "Strike" ability. Adjusted the AbilityDB to the removal of ability categories and the addition of the useaction attribute (mana/manaserv@81f126ae001b1446dc0be37341f133dca5ab2923)
2025-03-07Updated manaserv protocol to version 9Thorbjørn Lindeijer20-425/+373
This extends the messages regarding abilities, replacing the specific "attack" messages. It also unifies attribute handling, with a generic system replacing specific variables for attributes like level, xp and skills. The inventory and equipment handling was adjusted such that equipped items stay in the inventory. Support for quest states was added. Added: * GPMSG_ABILITY_REMOVED (mana/manaserv@e3fcc1a47db312933a0f5b7e725c5779a1a45722) * GPMSG_ABILITY_COOLDOWN (mana/manaserv@c2f00b2f3ba920cb25333d19a1d37d251342caf8) * GPMSG_BEING_ABILITY_POINT * GPMSG_BEING_ABILITY_BEING (mana/manaserv@2f2393b6d190deb8958fcb806b58418508d25e28) * GPMSG_ATTRIBUTE_POINTS_STATUS (mana/manaserv@1e5a15c0a5e24fb4b358fff75a7082d65496e1f9) * PGMSG_USE_ABILITY_ON_DIRECTION (mana/manaserv@05fc955a3f8a03539088fa7569395434e29d90e8) * GPMSG_BEING_ABILITY_DIRECTION (mana/manaserv@54389afd7ba9fecf0761333185145e968e2453ae) * GPMSG_QUESTLOG_STATUS (mana/manaserv@66a98a3a0df795761328d62ef2ad07f81e383f9e) Removed: * PGMSG_ATTACK * GPMSG_BEING_ATTACK (mana/manaserv@f31277b327df701361391b1d4b8bd6f89f4e3109) * GPMSG_PLAYER_EXP_CHANGE * GPMSG_LEVELUP * GPMSG_LEVEL_PROGRESS (mana/manaserv@44ee071d7ece5a2023f79307f36e8a244c9e7b3a) Changed: * GPMSG_ABILITY_STATUS (mana/manaserv@ba573fcc38580a01985172b9bc864c97ce855af3) * GPMSG_BEING_LOOKS_CHANGE (mana/manaserv@8ddda85d923a528c7497a628d2fe10fc40b80a1f) * APMSG_CHAR_INFO (mana/manaserv@4f5053f463fd8da0de1615ca6b0f212f02f3d653) * APMSG_CHAR_CREATE_RESPONSE (mana/manaserv@1263c729d85df649c7ab59726bddad7c8cd7ae81) * GPMSG_NPC_BUYSELL_RESPONSE (mana/manaserv@336ce321a9b996e56a61a5364bb32124efa84dd9) Equipment changes (mana/manaserv@f712d68495dd8e040c32da3b1c85bcb7845543ec): * Changed GPMSG_INVENTORY_FULL, GPMSG_EQUIP * Removed PGMSG_MOVE_ITEM * Added GPMSG_EQUIP_RESPONSE, GPMSG_UNEQUIP_RESPONSE, GPMSG_UNEQUIP While this change deals with some of the protocol changes, there's still many changes required in the UI regarding using of abilities (including attacking), showing of certain attributes and quest log.
2025-03-07Ability related network message adjustmentsThorbjørn Lindeijer4-7/+14
* Handle GPMSG_ABILITY_REMOVED for removal of abilities (mana/manaserv@e3fcc1a47db312933a0f5b7e725c5779a1a45722) * Adjust GPMSG_ABILITY_STATUS now that it only sends abilities that have changed state, so it should no longer clear all abilities. (mana/manaserv@3598685c0fcbb9b5fdbcdbbaee258e2b55d5c98a)
2025-03-07Renamed ability set to ability categoryThorbjørn Lindeijer3-20/+9
To match mana/manaserv@9c4b8e24487843f0b52108ba99c8c01f03bfae81.
2025-03-07Renamed specials to abilitiesThorbjørn Lindeijer25-205/+195
To match mana/manaserv@9ff69160ea1c3c64ea7012cd70a3b50ff4373264.
2025-03-01Further Download related cleanupsThorbjørn Lindeijer8-532/+422
* Moved the memory buffer and mutex handling into the Download class to simplify the code updating the UI in ServerDialog and UpdaterWindow. * Replaced the "DownloadUpdate" callback function with simply polling Download::getState, since in the end polling was happening anyway. This changes also fixes handling of the Enter key while downloading updates, which no longer cancels the update process. Also, when pressing Escape while things are being downloaded, the first press cancels and only the second press goes back to login. Introduced a ThreadSafe template class, which wraps any type and makes it only accessible by calling lock(). This ensures the data is never accessed without locking the relevant mutex.
2025-03-01Fixed leaking of resources referenced by resourcesThorbjørn Lindeijer1-6/+8
While cleaning up resources on shutdown, the resources they in turn referenced (like an Image referenced by an ImageSet) ended up in mOrphanedResources. Since the orphaned resources were only taken into account once, a lot of remaining orphans never got deleted. Technically a non-issue because it leaked on shutdown only, but it resulted in many faulty log entries about resources still being referenced as well as much noise from memory leak detectors.
2025-02-28Fixed unresponsive UI when switching server/char with Away dialog openThorbjørn Lindeijer5-49/+84
The UI became unresponsive as a result of not actually deleting the OkDialog. The dialog is now managed by the AwayListener, which now schedules Away dialog for deletion when necessary, using a DeathListener to clear the reference to the dialog. The WindowContainer now uses an std::set instead of std::list to keep track of widgets scheduled for deletion, to avoid crashing when a widget is scheduled for deletion multiple times.
2025-02-28Replaced buffered SDL_RWops wrapper with PHYSFS_setBufferThorbjørn Lindeijer4-225/+13
This removes the buffered SDL_RWops functionality that was just added in 51b0c3239265ddee2d1bf445f873299cc8193ab9. We just call PHYSFS_setBuffer instead. Using the PhysicsFS buffer is a little bit slower, likely because it operates at a lower level, but it is fast enough for our purposes. Uncompressed music files loaded from ZIP files can start playing in about 1-2 ms. I've also landed a fix for the problem in SDL_mixer, which works even better in any case: https://github.com/libsdl-org/SDL_mixer/pull/671
2025-02-26Plugged a few more memory leaksThorbjørn Lindeijer8-50/+50
* DebugWindow and SkillDialog were not deleting their tabs nor their tab widgets. * TabbedArea was not deleting its arrow buttons. * Button was deleting its TextPopup on deletion of the last Button instance, which was wrong because it was also being deleted by the WindowContainer. Also removed some misplaced event forwarding to the TextPopup. TabbedArea is tricky because it does not automatically delete added tabs or their widgets. Tab instances are only deleted when they were added by name. Issues found by Valgrind memory analyzer.
2025-02-26Plugged various memory leaksThorbjørn Lindeijer12-87/+85
* ActorSpriteManager failed to delete its AutoCompleteLister instances. * CharCreateDialog was relying on ~Window to delete its child widgets, but it wasn't always adding all its widgets, so some failed to get deleted. Now it only creates the widgets it needs. * SkillDialog didn't delete its SkillModels. * PlayerList didn't delete its player Avatar instances. * Fixed deletion of the EffectManager. Leaks located using AddressSanitizer.
2025-02-26Use ResourceRef for all resource typesThorbjørn Lindeijer69-726/+450
All ResourceManager functions that load resources now return respective ResourceRef values, which helps to make sure resources are properly cleaned up. The Sound class was cleaned up and now also allows SoundEffect resources to be unloaded. The Animation class now keeps its ImageSet loaded only as long as necessary. Previously, SimpleAnimation and ParticleEmitter would keep the ImageSet loaded indefinitely by never decreasing its reference count. Reduced duplicated animation loading code between SimpleAnimation and ParticleEmitter.
2025-02-26Avoid %z type character in string formatThorbjørn Lindeijer1-2/+4
It triggers the following warning on MinGW: warning: unknown conversion type character 'z' in format [-Wformat=] Since we don't expect the number of online players to go beyond UINT_MAX, we can simply do a cast and use %u instead of %zu.
2025-02-26CMake: Remove rav1e.dll from the Windows installerThorbjørn Lindeijer1-1/+0
It no longer exists among the dependencies.
2025-02-26Cleanup Download code, fixing SDL_Thread leakingThorbjørn Lindeijer6-245/+179
The download thread was setting itself to nullptr (d->mThread = nullptr) in a number of locations. This caused a later call to SDL_WaitThread to be unable to perform cleanup. This reverts most of 1eb02f83a5d3895e4e18db30ea10d88da94ba4c0 (including making Download::cancel no longer blocking), but keeps the necessary waiting for the thread to finish before freeing the memory buffer in ~UpdaterWindow(), which might have been the bug fixed by that change. Fixed removal of downloaded .part file when its checksum failed. It trying to remove the file without .part appended instead. Fixed download progress indication in ServerDialog to not be reversed, though this is rarely visible due to the server list being so small. Fixed reporting of curl error.
2025-02-26Fix unable to switch to another character after -D (chooseDefault) is used.Fedja Beader1-0/+1
Addendum to !108. Cherry-picked from M+ commit 78430c4bd86412a4b011632135c4eca71a435a1d.
2025-02-25Added tooltips to status effect iconsThorbjørn Lindeijer5-101/+118
Based on the name attributes in the status-effect XML elements. Also cleanup the code a little. Since the MiniStatusWindow now adjust its size to respect the status icons, those icons no longer have to be drawn from the Viewport.
2025-02-25Some code cleanups in EffectManagerThorbjørn Lindeijer2-43/+43
Use a std::map to ease the lookup of triggered effects.
2025-02-25Fixed status effect icon positionsThorbjørn Lindeijer1-4/+14
The status effect icons are implemented as sprites. Traditionally, since sprites were rendered on the map, they were by default centered horizontally on a tile and aligned to the bottom of the tile. The necessary offsets were part of the animation frames. This was changed in ae4aea451d6e2c44b273c963026c4fd697568f79 and 0248b2f58c783f21b7e68a20deadc0a3f942c869, which moved this offset to be applied at a later stage. At that point, client data was changed to remove this offset from the status effect icons, where it wasn't meaningful. Unfortunately, those client data changes were later reverted because the M+ fork of the client still applies the above offsets to the animation frames. Hence, to fix the status icon sprite positions, Mana client now applies the same offsets when rendering the status icons. Closes https://git.themanaworld.org/mana/mana/-/issues/95
2025-02-25Added support for disabled "follow-parent" propertyThorbjørn Lindeijer1-1/+1
Normally one was expected to just leave out this property to disable it, but on TMW some of the particle effects have a value="0" attribute.
2025-02-25Replaced ParticleContainer with a ParticleHandleThorbjørn Lindeijer10-360/+96
The main feature of the ParticleContainer seemed to be to provide persistent access to particles, even though they are generally owned by their parent particle. This allowed particles to be moved along with the ActorSprite and to be killed explicitly when they were no longer wanted. The ParticleHandle now takes care of disabling automatic deletion and of killing the particle along with the handle. It allows the particle references to be stored in whatever container is suitable, like a vector for general ActorSprite particle effects, separate vectors for equipment based particles and finally a map for status effect particles. Moving the particles along with the ActorSprite does need to happen more explicitly now, but overall it's a nice cleanup.
2025-02-25Added support for option, opt1, opt2, opt3 status effect fieldsThorbjørn Lindeijer13-343/+320
Supporting these fields is necessary to correctly identify status effects sent by tmwAthena. This is a manual port of ac4e40a1408ad4d6fbcfce9d2bc6a0bc187ea5a4, 542d2ba78d84e0fa051e0620ccab5fb3a0c711e3 and 8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f from M+.
2025-02-25Some code cleanups related to status iconsThorbjørn Lindeijer6-33/+23
Fixed leaking of Sprite instances.
2025-02-22Fix incorrect reset animation.Andrei Karas1-3/+4
Cherry-picked from M+ commit 6b92b52308211bc61320e3c8062c59e7b4e81f65.
2025-02-21Merged AnimatedSprite into SpriteThorbjørn Lindeijer11-147/+85
With AnimatedSprite being the only implementation of the Sprite interface, there was no longer a point in separating these.
2025-02-21Removed ImageSpriteThorbjørn Lindeijer7-136/+44
The only use of ImageSprite was for FloorItem instances, which now just draw the item icon in FloorItem::draw. This leaves only one Sprite subclass, AnimatedSprite, which means we can remove the entire virtual Sprite interface.
2025-02-21Made ActorSprite aggregate instead of subclass CompoundSpriteThorbjørn Lindeijer5-72/+49
Also, CompoundSprite itself no longer derives from Sprite. This simplifies the class hierarchies and avoids the compiler warning about Being::setDirection shadowing Sprite::setDirection.
2025-02-21Replaced ImageSprite in Emote by plain ImageThorbjørn Lindeijer5-32/+29
Emotes just need an image to be represented in the UI, so we don't need to use ImageSprite.
2025-02-21Moved stun and status effect handling from ActorSprite to BeingThorbjørn Lindeijer8-186/+160
Since this stuff is only relevant for Being instances and not for FloorItem instances. Also removed the virtual getWidth/getHeight from Actor, since they were not actually used.
2025-02-21Fixed too fast animations for MiniStatusWindow iconsThorbjørn Lindeijer3-6/+6
AnimatedSprite works with delta time since 7de0b165f196cb0c1f983b6d2a. Adjusted some parameter names for clarity. Closes https://git.themanaworld.org/mana/mana/-/issues/94
2025-02-20Simplified filling of the BufferedRWops bufferThorbjørn Lindeijer1-23/+5
In fact filling the buffer only happens when the buffer was exhausted or empty, so we always want to fill it entirely and don't need to bother with moving remaining contents. This is what happens when you let AI write your code.
2025-02-20Fixed stutter when new music starts playingThorbjørn Lindeijer6-1/+254
This is a workaround for a performance issue when SDL_mixer is using stb_vorbis. Since stb_vorbis will request the file one byte at a time, the overhead of using SDL_RWops to call PHYSFS_readBytes is too high. Solved by introducing a buffered SDL_RWops wrapper with a fixed 2048 byte buffer. This is a more optimal solution than loading the entire OGG file in memory. Now starting a new song takes less than 1ms, when the OGG file isn't compressed (almost down to 0.2ms when SDL_mixer uses libvorbisfile). See https://github.com/libsdl-org/SDL_mixer/issues/670 Closes https://git.themanaworld.org/mana/mana/-/issues/93
2025-02-17Further ResourceManager and PhysFS cleanupsThorbjørn Lindeijer15-308/+117
* Wrapped remaining PhysFS API calls and set PHYSFS_DEPRECATED to suppress deprecation warnings for PHYSFS_getUserDir, since no alternative is available for now. * Removed support for decompressing .gz files, since it has been unused for years and doesn't seem useful when updates are anyway served in an archive. * Use SDL_LoadFile and SDL_LoadFile_RW convenience functions (raises minimum SDL version to 2.0.10). * Removed ResourceManager::copyFile, since it was unused and will likely stay unused. * Removed ResourceManager::loadTextFile. Instead, split up the string in BrowserBox::addRows without making additional copies.
2025-02-17Wrapped PhysFS usage in a convenience APIThorbjørn Lindeijer10-138/+331
* Most direct PhysFS calls now contained within a single header file. * File class that automatically closes. * Files class allows iterating files with range-based for. * Use std::optional to force error handling where applicable.
2025-02-15Fixed handling of connection failureThorbjørn Lindeijer1-21/+12
After failure to connect it would immediately try to connect to the chosen server, only to fail again. Now it goes back to the server choice dialog instead. Closes https://git.themanaworld.org/mana/mana/-/issues/86
2025-02-14Fixed handling of update URLs which mention a portThorbjørn Lindeijer7-91/+66
This appears to have been a regression in f405849b49614254f42eb3ee6147434458978623, which for some reason erased the port (and any trailing parts) from not just the update directory but also from the update URL. Unfortunately we can't access Mana-Mantis #381 at the moment, but presumably the port was removed due to the colon being a problematic character. Instead, now the colon (and other special characters) are replaced by _ when determining the update directory. Closes https://git.themanaworld.org/mana/mana/-/issues/80
2025-02-14Fixed issue in ParticleContainer destructorThorbjørn Lindeijer3-8/+9
It was trying to call a virtual method for cleanup with the intention of doing cleanup in its subclasses, but that doesn't work in a destructor. Could simplify ActorSprite destructor as a result.
2025-02-13TMWA: Reduce magic numbers when converting directionThorbjørn Lindeijer2-29/+28
2025-02-13Support changing being base typeThorbjørn Lindeijer11-111/+160
The GM command @class (alias @charclass) can be used by GMs to change their character class (also referred to as job, race, base or species). Changes of the class are now supported, even supporting switching between appearing as player, monster or NPC. Part of https://git.themanaworld.org/mana/mana/-/issues/92
2025-02-13Implemented support for item replacementsThorbjørn Lindeijer9-39/+267
Specifying an unknown sprite or direction is reported as error and will not cause any replacements. Specific item replacements are supported also when not specifying the sprite. Replacements do not affect particle effects. Part of https://git.themanaworld.org/mana/mana/-/issues/92
2025-01-25snap: Updated to core24Thorbjørn Lindeijer4-2/+10
2025-01-21Replaced include guards with #pragma onceThorbjørn Lindeijer275-1093/+280
Thanks to https://github.com/cgmb/guardonce and a follow-up replace to remove duplicated newlines at end of file: find src -type f -name '*.h' -exec \ sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \; Source: https://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof Fixes compile on macOS, which appears to have been due to the EVENT_H include guard.
2025-01-21Updated NEWS fileThorbjørn Lindeijer1-0/+3
2025-01-21Update names as soon as the "Show gender" option is changedThorbjørn Lindeijer4-10/+31
No need to wait for Apply for this option. Using `ConfigOptionChanged` event rather than direct call into `ActorSpriteManager::updatePlayerNames`.
2025-01-21Fixed ConfigOptionChanged eventsThorbjørn Lindeijer10-20/+71
With the statically typed config we no longer get an event for each changed config value. Where relevant, this is now done through `setConfigValue`. The `Event` now uses a `std::any`, which for `ConfigOptionChanged` events is set to the changed `Config` member. This allows for a type-safe check on which config value was changed.
2025-01-20Made client config statically typedThorbjørn Lindeijer79-1184/+1184
This makes accessing the config values much faster, since it no longer needs to do a lookup nor string conversion, which means we could remove some needless copying of the values. Overall it makes it easier to find out where settings are used and it puts the defaults along with the declaration. Options with default values are no longer saved to the config file. This does not include unrecognized options, which are kept around to provide some compatibility with older clients. While most basic options have kept the same name, more complicated settings like window geometry, shortcuts, outfits, etc. now have their own XML elements. Older clients will ignore these and erase them when saving the configuration.
2025-01-20Cleaned up path handling a bitThorbjørn Lindeijer3-47/+37
2025-01-20Wrapped xmlNodePtr access with a Node classThorbjørn Lindeijer46-705/+668
Slightly more ergonomic and this eliminates direct libxml2 usage from many places.
2025-01-18Introduced small convenience wrapper to write XMLThorbjørn Lindeijer6-42/+140
Might not seem worth it right now, but it will be if we write out more XML structures.