summaryrefslogtreecommitdiff
path: root/src/resources
AgeCommit message (Collapse)AuthorFilesLines
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.
2012-05-05Merge branch '0.6'Thorbjørn Lindeijer1-1/+1
2012-05-05Fixed compilation errors and warnings with GCC 4.7Thorbjørn Lindeijer1-1/+1
Also, since GCC 4.7 there is a binary compatibility issue when linking with a Guichan that was not compiled in C++11 mode. This commit also allows compiling with GCC 4.7 with C++11 mode turned off. Reviewed-by: Erik Schilling
2012-04-04Synced specials to latest manaserv changesErik Schilling2-19/+5
Reviewed-by: bjorn.
2012-04-02Merge branch '0.6'Thorbjørn Lindeijer2-5/+5
2012-04-02Fixed problems with using the last emotev0.6.1Thorbjørn Lindeijer2-5/+5
The tmwa/BeingHandler was adjusting the effect id rather than the emote id, causing it to not find the last emote (and the rest of the emotes only worked correctly because the effect ids were consecutive in the same order as the emote ids). Furthermore, the EmoteShortcutContainer refused to draw the icon for the last emote due to an off-by-one error in dealing with the 1-adjusted emote ids used by the EmoteShortcut class. Also cleaned up some old remains of a player ignore strategy that used to use the two balloon emotes (this had been their original purpose). Reviewed-by: Erik Schilling
2012-03-18Merge branch '0.6'Thorbjørn Lindeijer1-0/+7
2012-03-18Removed some 'const' keywords from value returnsThorbjørn Lindeijer3-3/+3
It makes no sense to mark a return value as const when it is returned by value. This only makes sense if the return value is passed by reference, in order to prevent the receiver from modifying the value. Also made some other small adjustments. A std::string does not need to be initialized to "" explicitly and getSafeUtf8String could take its parameter by reference. Reviewed-by: Yohann Ferreira
2012-02-25Fixed compiling against SDL_mixer versions before 1.2.9Thorbjørn Lindeijer1-0/+7
Mix_LoadMUS_RW was added with SDL_mixer 1.2.9. Reviewed-by: Erik Schilling
2012-02-18Added notification sound on receiving whisperThorbjørn Lindeijer2-3/+4
One of the sound channels is reserved for notification sounds, of which the volume can be configured separately. Currently, the only notification sound that is played is for receiving whispers. That can be extended later. The newmessage.ogg sound used currently is the one for receiving a message with the Psi instant messenger. Parts of this patch are based on the new message notification in ManaPlus. Reviewed-by: Erik Schilling
2012-02-12Leave the default values for OpenGL texture filtersThorbjørn Lindeijer1-2/+0
The scaled wallpaper looks quite a bit better when linear texture smoothing is applied, and I could not measure a significant difference in framerate from setting the texture filter to GL_NEAREST. Hence it seems not necessary to me to introduce the smoothing as an option. The default value for GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR and the default for GL_TEXTURE_MAG_FILTER is GL_LINEAR. These make sure that the texture is reasonably smoothed by using the weighted average of the nearest four pixels. Reviewed-by: Erik Schilling
2012-02-12Improved the wallpaper choosing algorithmThorbjørn Lindeijer1-24/+22
Now it searches for the smallest wallpaper that is at least as large as the screen, since downscaling is preferred to upscaling. When not found, it will go with the largest available wallpaper. Previously, the algorithm preferred upscaling, but didn't bother searching for the largest available one, but would pick a random image. It would also revert to the default Mana wallpaper when no image was small enough to fit on the screen. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
2012-02-11Made items equippable by double click in inventoryErik Schilling1-0/+1
+ Fixed disabling of use button when possible Reviewed-by: bjorn.
2012-02-09Fixed wallpaper prescaling issuesThorbjørn Lindeijer7-56/+115
Image::SDLgetScaledImage was changed so that it tries to find an existing scaled version of the image first, and generates it when none exists. When it needs to generate one, this resource is added to the resource manager, partly to avoid duplicating the work later but mainly to keep memory management straightforward. This function also used to leak the scaled SDL_Surface since it wrongly assumed that Image::load would free it. To avoid filling up the memory with scaled wallpapers that are waiting 30 seconds until they will be deleted, the Resource::decRef function was extended with a parameter that allows telling it what to do with orphans. Calling decRef with Resource::DeleteImmediately will delete the resource immediately in case the resource is orphaned. Reviewed-by: Yohann Ferreira
2012-02-06Some cleanups in the initialization of wallpaper pathsThorbjørn Lindeijer1-26/+31
The 'paths' configuration in client-data now overrides any configuration in 'branding', so that it will apply after the updates for a certain server have been downloaded. Also, some isDirectory checks have been removed. When the configuration is wrong, it's probably better to see that there is a problem. Reviewed-by: Yohann Ferreira
2012-02-06Fixed searching for wallpapers on 64-bit machinesThorbjørn Lindeijer1-4/+2
The check whether a filename contains any '%' character was failing because the 'unsigned int separator' was too small to hold std::string::npos. Reviewed-by: Yohann Ferreira
2012-02-03Clear tile flags from the gid before further processingThorbjørn Lindeijer1-5/+16
Better to show non-rotated/flipped tiles than no tile at all. This also fixes interpretation of collision tiles that happen to be flipped. Also interpret the gid as an unsigned number, since that's how they are written in the TMX file since the introduction of these flags. Reviewed-by: Yohann Ferreira
2012-02-02Fix to the hair colors and styles handling.Yohann Ferreira3-56/+167
- I made the charCreatedialog handle a possible max permitted color Id and a minimum hair style id for tA. - Added a foundation to later load the styles and colors from the same file, to handle the Mana-issue #224 for manaserv. - Support for non-contiguous hair color and style ids has also been added. - I also replaced the < and > arrow signs with images. Reviewed-by: Ben Longbons, Thorbjørn Lindeijer