summaryrefslogtreecommitdiff
path: root/src/resources
AgeCommit message (Collapse)AuthorFilesLines
2024-04-02General code cleanupsThorbjørn Lindeijer5-8/+6
* 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-03-26Use SDL2 support for color and system mouse cursorsThorbjørn Lindeijer3-20/+33
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-21Removed unused ResourceManager methodsThorbjørn Lindeijer2-43/+0
* ResourceManager::addResource * ResourceManager::get(const std::string &) These were once added in 32996cee607c52ecef9be4638df554dd89b39c24, but they are no longer necessary after the port to SDL2 (2c51c98625b225cecfb9628c30d62d4e30f7e3e1).
2024-03-21Removed the unused Image::mLoaded memberThorbjørn Lindeijer2-41/+19
2024-03-21Use std::function in ResourceManagerThorbjørn Lindeijer4-85/+35
Simplifies the code a little. Also use ResourceRef in SubImage to avoid manual reference counting.
2024-03-13Use snprintf instead of sprintfThorbjørn Lindeijer1-2/+2
Amendment of dd1db3753ecf8a4d782aee1f518759763d8caf87.
2024-03-12General code cleanupsThorbjørn Lindeijer10-34/+13
* Use default member initializers * Use range-based for loops * Avoid needless pointer references for ShopItem::mDuplicates * Removed type aliases that are only used once or twice * Removed more unused includes * Removed some unused functions * Removed superfluous .c_str() * Rely on default copy and assignment operators for Vector class * Use std::unique_ptr in some places * Removed duplicated mPlayerMoney updating in SellDialog * Removed duplicated Game::handleInput call * Removed unused SDLInput::mMouseInWindow * Removed remnant of manual widget positioning in HelpWindow * Removed superfluous initialization of static pointers
2024-03-07Some code simplifications in ResourceManager::loadFileThorbjørn Lindeijer1-16/+9
2024-03-07Fixed ambient layers "keepratio" optionThorbjørn Lindeijer3-10/+21
I had broken this in 264be2108c51837fa92085f6c839e66aebbcfc9e by no longer reading out the property. Made some further simplifications and two more fixes: * When the original image's size was not 800x600, it wouldn't get scaled as expected due to the integer division being performed before the multiplication. * I had changed the default resolution to 1280x720, while mKeepRatio expects to scale the original image as if it was displayed on an 800x600 screen. So now it's hardcoded on 800x600 rather than using the defaultScreenWidth/Height variables. * Removed the confusing x/y parameters from AmbientLayer::draw, which were actually set to the graphics width/height. * Changed SDLGraphics::drawRescaledImagePattern to not repeatedly set the source origin.
2024-03-07Use the native TMX tile animation formatThorbjørn Lindeijer4-105/+113
Rewrote the tile animation loading code based on XML tags, replacing the code that loaded tile animations from tile properties. Also made a number of code simplifications and optimizations: * Replaced a number of pointer members with value members. * Pass around Animation and TileAnimation by value, using std::move to avoid allocating copies. * push -> emplace * push_front -> emplace_front * push_back -> emplace_back * Use range-based for loops * Use std::vector instead of std::list for storing affected tiles (less fragmentation) * Avoid string copies and allocations while parsing CSV layer data. * Replaced xmlNodeGetContent with directly accessing 'content'.
2024-03-07Fixed tile animations for CSV mapsThorbjørn Lindeijer1-6/+3
The affected tiles were only tracked for base64-encoded layer data.
2024-03-06General code cleanupsThorbjørn Lindeijer7-54/+35
* Use final for all message handlers, Client, LocalPlayer, Being::getType, Being::setPosition and Being::setMap. (avoids some warnings about virtual dispatch in constructors) * Use auto in more places * Use emplace_back instead of push_back in some places * Use default member initializers * Less else after return * Removed superfluous .c_str() * Removed type aliases that are only used once * Removed more unused includes
2024-03-04Fixed character displayThorbjørn Lindeijer6-30/+47
This change fixes hair style to take into account "race", which makes the faces visible again. Hair colors should also be fixed now, with partial support for itemcolors.xml added. The Mana client now also supports per-character gender, and it now hides the hair style and color buttons on character creation, when there are none to choose from. Closes #43
2024-03-02Changed server type to "enum class"Thorbjørn Lindeijer2-2/+2
2024-03-02Added support for customizing NPC and Monster hover cursorThorbjørn Lindeijer4-16/+61
To match support for this in M+, since TMW uses this functionality on two of its NPCs.
2024-03-02Updated mouse cursors to latest versionThorbjørn Lindeijer2-4/+3
The new cursor types are not used yet for now.
2024-03-02General code cleanupsThorbjørn Lindeijer11-123/+71
* Don't needlessly store or return raw pointers in BeingInfo * Less copying, more moving * Less else after return * Make AddDEF a template instead of a macro * Removed some unused includes * Use range-based for loops
2024-02-27Added VSync and windowed fullscreen optionsThorbjørn Lindeijer2-1/+2
The configuration and setup UI were adjusted to the new options. This also fixes issues in applying new video settings. Default resolution was changed from 800x600 to 1280x720. VSync is enabled by default while FPS limit was disabled. Display aspect ratio for the resolution options. I had to work around some macOS issues: * Don't change window size when it appears to be "maximized", since it just changes the rendering area while leaving the window maximized. * Unset fullscreen display mode temporarily to allow changing resolutions, otherwise the rendering area no longer matches the screen and mouse input is also off. * Removed SDL_WINDOW_ALLOW_HIGHDPI for now because it causes issues on macOS, since we're not actually handling the scaling factor. A Video class and an SDLGraphics subclass were split off from Graphics. This setup has Less duplication and leaves the OpenGLGraphics and SDLGraphics better separated. Fixes #57 Fixes #58
2024-02-22General code cleanupsThorbjørn Lindeijer4-13/+7
* Use default member initializers * Use range-based loops * Don't use 'else' after 'return' * Removed some unused includes * Construct empty strings with std::string() instead of "" * Clear strings with .clear() instead of assigning "" * Check whether strings are empty with .empty() instead of comparing to "" * Removed redundant initializations
2024-02-19Updated PhysicsFS API usageThorbjørn Lindeijer1-9/+14
Unfortunately, since we're making a difference between config and data, and also want to know where to write screenshots, we can't get rid of PHYSFS_getUserDir entirely. We'd need a replacement to get rid of the deprecation warnings. Also removed copying of old config file at "/.tmw/config.xml".
2024-02-15Fix handling of non-consecutive emote IDsThorbjørn Lindeijer2-47/+37
Previous code was assuming there would be no gaps in the emote IDs. Also cleaned up some confusion where the "emote ID" being passed around in the code was often offset by 1. Now it is only offset in communication with tmwAthena and when saving the shortcuts.
2024-02-13Fixed music playbackThorbjørn Lindeijer2-21/+7
A faulty version check was disabling music loading entirely.
2024-02-13General code cleanupsThorbjørn Lindeijer7-40/+24
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
2024-02-09C++11: Use default member initializersThorbjørn Lindeijer6-39/+24
This patch is not exhaustive.
2024-02-02Restored support for setting monster ID offset on monsters tagThorbjørn Lindeijer3-2/+16
Apparently this was supported before, but support for that was lost in bd1fdd87eed48ba3ffcc413936d6a6a60a429a97. Fixes #46
2024-01-29Removed unused includes in various filesThorbjørn Lindeijer5-13/+3
2024-01-29Removed remnants of alpha cache in ResourceManagerThorbjørn Lindeijer2-35/+0
Continuation of 2c51c98625b225cecfb9628c30d62d4e30f7e3e1, which had already removed most of the alpha cache in Image.
2024-01-29Apply C++11 fixitsThorbjørn Lindeijer11-80/+65
modernize-loop-convert modernize-deprecated-headers
2024-01-28Added support for map/layer maskThorbjørn Lindeijer4-27/+104
A custom "Mask" property on a layer or a "foregroundXmask" property on a map can now be used in combination with the SMSG_MAP_MASK to dynamically disable certain map layers from the server. Feature previously seen on ManaPlus and implemented for Mana client for compatibility. Also added a ResourceRef class for automating the Resource reference counting. Closes #44
2024-01-26Added fallback for XML data files and support absolute pathsThorbjørn Lindeijer1-14/+34
For compatibility with TMW, which has not yet adopted a central "settings.xml" that includes all the other files. Also, a "name" attribute with an absolute path is now supported in addition to the relative "file" attribute, since that is what ManaPlus supported. This resolves most of issue #43.
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer36-155/+155
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2024-01-25Ported to SDL2Thorbjørn Lindeijer3-334/+37
2024-01-24Fixed potential crash on exitThorbjørn Lindeijer1-2/+2
2024-01-24Fixed compilation issues and use of deprecated C++ featuresThorbjørn Lindeijer1-2/+2
* Fixed compiler errors due to dynamic exception specifications * Replace std::auto_ptr with std::unique_ptr * Replace std::mem_fun with std::mem_fn * Prefix for_each with std:: (apparently not needed before) * Just use lambda instead of std::bind2nd * Removed usages of std::unary_function
2013-05-22paths.xml content is now read from settings.xmlPrzemysław Grzywacz2-8/+21
2013-05-07items.xml can be used from settings.xmlPrzemysław Grzywacz3-171/+157
2013-05-04Client-side settings are now available from settings.xmlPrzemysław Grzywacz14-408/+595
2013-04-29Single xml solution - compatibility with skill-set and special-setPrzemysław Grzywacz1-1/+2
Mana-mantis: #506.
2013-04-27Small cleanupThorbjørn Lindeijer1-1/+1
2013-04-27Added support for charcreation.xml settingsThorbjørn Lindeijer2-0/+180
This file was introduced by ManaPlus as a way of configuring the character creation process. It defines the number of hair styles and colors, how stat points should be divided and what the starting equipment of the player is. The minimum and maximum hair color/style IDs are not supported at the moment. This is mostly a backport of ManaPlus commits 10cf52b5 and dcc18eba, with some style changes. Mantis-issue: 501 Reviewed-by: Ablu
2013-04-27Always read the attributes.xml fileThorbjørn Lindeijer2-0/+473
This way it can also be used when connecting to a tmwAthena server for customizing the min/max of attributes and the amount of starting points. Mantis-issue: 501 Reviewed-by: Ablu
2012-08-14Can now build using cmake on OSXSocapex2-8/+0
Tested-by: Frost.
2012-08-12Removed ImageLoader and ProxyImage classesThorbjørn Lindeijer2-167/+0
They allowed using gcn::Image, which in turns allows using gcn::Icon and gcn::ImageFont, but none of this is actually used anymore. Reviewed-by: Erik Schilling
2012-08-05Removed 'virtual' from methods of ImageThorbjørn Lindeijer2-20/+13
Maybe it used to be necessary for these methods to be virtual, but this is no longer the case. Hence we can avoid wasting CPU ticks searching through virtual function tables, especially for frequently used methods like getWidth, getHeight and setAlpha. MapLayer::getTile was inlined. Reviewed-by: Erik Schilling
2012-08-05Avoid copying surfaces unnecessarily for upload to textureThorbjørn Lindeijer2-26/+36
When uploading an SDL surface to an OpenGL texture, it was always making a copy that had the desired size and pixel format. Now this copy is no longer being made when the existing surface already has the target size and pixel format. In fact most images are already in 32-bit RGBA format after loading them. Reviewed-by: Erik Schilling
2012-08-05Specify a more specific image format when uploading texturesThorbjørn Lindeijer1-1/+1
While simply specifying "4 components" works, it is preferred to specify the actual image format like GL_RGBA8 in our case. http://www.opengl.org/wiki/Common_Mistakes#Image_precision Reviewed-by: Erik Schilling
2012-08-05Added support for ARB_texture_non_power_of_two extensionThorbjørn Lindeijer2-1/+3
If the graphics driver supports this, there is no need to create textures with power-of-two dimensions. It is then also preferred to use regular textures than relying on the older GL_ARB_texture_rectangle extension. Reviewed-by: Erik Schilling
2012-08-05Fixed indentation of Image::_GLloadThorbjørn Lindeijer1-75/+75
Reviewed-by: Stefan Beller
2012-07-25Revert "Leave the default values for OpenGL texture filters"Thorbjørn Lindeijer1-0/+2
This reverts commit 137ade7226af37d073a5755b90181275664dd65c. Turns out that when leaving the default values, the textures won't actually work since they are incomplete unless the mipmaps are generated (since GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR by default). For now we don't want to generate mipmaps anyway since we're going for a pixely look, so revert the filters back to GL_NEAREST. The reason this had worked for me is because on my system the texture type GL_TEXTURE_RECTANGLE_ARB is used instead of GL_TEXTURE_2D and this texture type does not support mipmaps.
2012-06-08Made error on imageset loading a bit more informativeErik Schilling1-1/+2
Reviewed-by: bjorn.