summaryrefslogtreecommitdiff
path: root/src/map.h
AgeCommit message (Collapse)AuthorFilesLines
2024-10-08Do a single logic update each frameThorbjørn Lindeijer1-2/+2
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-02Removed getter/setter cruft from BeingInfoThorbjørn Lindeijer1-1/+2
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-04-02General code cleanupsThorbjørn Lindeijer1-2/+2
* 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-07Use the native TMX tile animation formatThorbjørn Lindeijer1-18/+15
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-0/+2
The affected tiles were only tracked for base64-encoded layer data.
2024-03-06General code cleanupsThorbjørn Lindeijer1-1/+1
* 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-02-09C++11: Use default member initializersThorbjørn Lindeijer1-4/+2
This patch is not exhaustive.
2024-01-28Added support for map/layer maskThorbjørn Lindeijer1-0/+7
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-26Apply C++11 fixitsThorbjørn Lindeijer1-3/+3
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2012-08-05Fixed drawing issues with tiles that don't match the gridThorbjørn Lindeijer1-1/+1
An optimization in the tile layer rendering code meant for drawing repeated tiles faster was not taking into account the case where the tile width does not match the width of the tile grid. Reviewed-by: Stefan Beller
2012-08-05Removed 'virtual' from methods of ImageThorbjørn Lindeijer1-1/+2
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-02Add a checkbox to the debugging window to show being ids.Stefan Beller1-3/+4
Reviewed-by: Ablu
2012-03-18Removed some 'const' keywords from value returnsThorbjørn Lindeijer1-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-05Revert "Checking being positions send by the server"Thorbjørn Lindeijer1-5/+0
This reverts commit 92fd074aa85e2357bfe1ab642209dd5a0d87e4d5. Reverting because these checks should be done server-side and because having them in the client would currently require wrapping them up in checks if there is even a current map due to the reliance on tile size (we need to handle the case where the current map didn't load properly without crashing). Conflicts: src/map.cpp src/net/manaserv/beinghandler.cpp Reviewed-by: Erik Schilling
2012-02-03Clear tile flags from the gid before further processingThorbjørn Lindeijer1-1/+1
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-03Simplified and made generic the way the pickup is handled.Yohann Ferreira1-1/+1
I also made the range be taken from the server type as for the pickup and npc talk ranges. Last but no least, I fixed the parameters sent with PGMSG_PICKUP to send the (item) position where to pickup at as described in the manaserv protocol. The pickup is still not 100% functional due certainly to two problems: 1. The client item coordinates might not be the exact same as in the server. 2. The client seems to try to pick up the item a bit too soon, probably for the reason given in 1. I'll investigate this in another patch. Reviewed-by: Thorbjørn Lindeijer, Erik Schilling.
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2011-09-16Renamed Map::DebugFlags enumeratorsThorbjørn Lindeijer1-13/+13
Their name is a bit more clear with DEBUG prefix rather than MAP prefix. They're already scoped in the Map class anyway. MAP_NORMAL was changed to DEBUG_NONE to represent no debug flags. Acked-by: Bertram
2011-09-13Fix compilation by readding a missing enum value.Yohann Ferreira1-0/+1
Trivial.
2011-09-11Merge branch '0.5'Thorbjørn Lindeijer1-1/+1
Conflicts: CMakeLists.txt src/map.cpp src/winver.h
2011-09-11Fixed drawing glitch with overwide tilesThorbjørn Lindeijer1-1/+1
The layer rendering code was not prepared to handle tiles that were wider than the tile width of the map. This commit also fixes the initialization of the maximum tile height, which was based on the map height rather than the tile height. This could slightly reduce overdraw for some maps. Reviewed-by: Stefan Beller <stefanbeller@googlemail.com>
2011-06-17Removed dehardcoded values from the Map and MapLayer classes.Yohann Ferreira1-1/+3
2011-06-17First pass on removing tile hard coded values.Yohann Ferreira1-0/+2
Every files has been checked against the hard coded 32 values except the map.cpp file. I also added convenience functions in the Game class, centralized the default item icon size, and removed two unused defines in being.cpp.
2011-05-25Refining switches in the debug viewStefan Dombrowski1-6/+10
Reviewed-by: Bjorn
2011-05-01Checking being positions send by the serverStefan Dombrowski1-0/+5
Reviewed-by: Bertram
2011-04-26Made the client use a unique kind of movement code.Yohann Ferreira1-7/+22
This is fixng many issues and (hopefully) will make the movement rendering much smoother. Merge branch 'master' of gitorious.org:~bertram/mana/mana-movement-code-merge Conflicts: src/being.cpp src/net/manaserv/beinghandler.cpp Resolves: TMW-Mantis #946. Reviewed-by: Thorbjorn.
2011-04-16Post-review fixes.Yohann Ferreira1-1/+1
- Removed unnecessary comments - Removed a useless contains() check in getTileCenter() - Fix the above function documentation - Don't permit FloorItem to be created without a map object. Reviewed-by: Thorbjorn Lindeijer.
2011-04-09Removed a lot of useless "documentation"Thorbjørn Lindeijer1-9/+0
I have to admit I contributed a large part of these. Sorry for that. Less empty space, more attention to the code. Acked-by: Jared Adams
2011-03-29Made the Map::findPath() private as it should be used internally.Yohann Ferreira1-9/+8
I also precised the find/Pixel/Tile/Path() documentation.
2011-03-29Added the Map::getTileCenter() convenience function.Yohann Ferreira1-0/+8
and made use of it through the tA code. I also remove the obsolete TODO in the flooritem class.
2011-03-17Now the client centers the pixel positions when using tA.Yohann Ferreira1-0/+8
I made it so that the behaviour can be changed with only a boolean setting in the playerhandler.
2011-03-10Wrap the open and closed list members in path finding.Yohann Ferreira1-3/+3
This prevent some weird things happening in path finding when playing for a very long time. Reviewed-by: Thorbjorn.
2010-07-22Add two debug map modes and improve slightly map drawing.Andrei Karas1-1/+8
Reviewed-by: Bertram
2010-06-13Merge remote branch '1.0/1.0'Jared Adams1-1/+1
Conflicts: data/graphics/CMakeLists.txt data/graphics/Makefile.am src/client.cpp
2010-06-05Fix memory leak in minimapAndrei Karas1-1/+1
Reviewed-by: Thorbjørn Lindeijer
2010-04-23Add an Actor class to replace the Sprite classJared Adams1-20/+20
The Actor class manages the Map reference, position vector, and alpha float. These are the common parts from it's children.
2010-04-12Move path finding related code to the Map class and small fixes.Bertram1-0/+17
It permits two things: 1. It simplifies and demystifies Being::SetDestination() code. 2. It will permit to show the *real* calulated path when using the drawDebugPath feature for ManaServ.
2010-03-08Fix properties bug.Andrei Karas1-2/+2
Fix Random crushes and valgrind memory errors. Reviewed-by: thorbjorn
2010-03-04Implemented markers for warp portals defined in map files in form of ↵Philipp Sehmisch1-1/+3
particle effects. Reviewed-by: Jared Adams <jaxad0127@gmail.com>
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-09Got successfully rid of tile width/height fallback values as asked by Jaxad.Bertram1-6/+2
But I added some logs when speed and other actions where refused due to game/map uninitialized. This could help.
2010-02-09Separated fallback defaults for tile width and height.Bertram1-3/+5
2010-02-09Made the Beings' logic be able to handle any tile height/width.Bertram1-2/+4
This is the First step to get rid of most hardcoded 32 values.
2010-02-07Updated Copyright year to 2010!Bertram1-1/+1
Also added the update copyright tool from the Wormux Team. ( And not forgetting credit's due. :P )
2010-01-23Chaning the method name Map::getMapId() to map::getFilename()Blue Sans Douze1-1/+1
2010-01-23Autoload a minimap is no minimap info is givenBlue Sans Douze1-0/+5
Looks for "graphics/minimap/MAPID.png"
2010-01-12Standardize header orderJared Adams1-3/+3
Also remove some extra new lines and fix eAthena's PartyTab define guards.
2010-01-10Change code styleAndrei Karas1-1/+1
2010-01-09Add special map mode.Andrei Karas1-2/+18
This mode hide big map objects and show collisions.