summaryrefslogtreecommitdiff
path: root/src/actorsprite.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-03-07Use the native TMX tile animation formatThorbjørn Lindeijer1-3/+3
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-02Changed server type to "enum class"Thorbjørn Lindeijer1-2/+1
2024-02-22General code cleanupsThorbjørn Lindeijer1-10/+5
* 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-13General code cleanupsThorbjørn Lindeijer1-4/+1
* 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-01-30Apply readability-delete-null-pointer fixitsThorbjørn Lindeijer1-3/+1
These checks are unnecessary as deleting a null pointer has no effect.
2024-01-29Apply C++11 fixitsThorbjørn Lindeijer1-4/+3
modernize-loop-convert modernize-deprecated-headers
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer1-9/+9
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2012-02-12Fixes to actor drawing orderThorbjørn Lindeijer1-11/+19
On the fringe layer, actors are drawn 'sorted' together with the tiles. When the sorting order was separated from the actual Y position of the actor, the tile drawing loop was not adapted to take this drawOrder into account rather than the plain Y position. Also, ActorSprite::draw was applying a half-tile offset to position the sprite at the bottom while the logical position of the actor is at the center of the tile. However, it failed to override getDrawOrder to account for this offset, causing actors to get drawn earlier than they should (and thus being overlapped by fringe layer tiles when they actually shouldn't). This fixes drawing glitches with the paths around Hurnscald and reduces the glitches when walking up/down through grass. Reviewed-by: Erik Schilling
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-24Fixed the crash in setupSpriteDisplayThorbjørn Lindeijer1-2/+2
This happened when an NPC, monster or item couldn't be found and it had to fall back on Being::Unknown. This instance was bugged since it had a 0 pointer in its sprites list, because when the Being::Unknown was created, the SpriteDef::Empty was not initialized yet (since both were global static variables, the initialization order was not well defined). Fixed it by removing SpriteDef::Empty and instead creating it in the BeingInfo constructor. I've also changed the SpriteReference instances to be inline values rather than instances on the heap, since they're quite small. That also fixed a leak since those instances were never getting deleted. Reviewed-by: Yohann Ferreira
2012-01-14Avoid compiler warnings when using MinGWThorbjørn Lindeijer1-37/+16
Replaced the switch statements with static lookup arrays. Reviewed-by: Yohann Ferreira
2012-01-10player_node -> local_playerYohann Ferreira1-3/+3
Reviewed-by: Ablu
2012-01-09Spotted some more hard-coded files and paths definitions.Yohann Ferreira1-4/+10
Conflicts: src/actorsprite.cpp
2011-09-02The draw order of particles is now Y - 16 pixels.unknown1-1/+1
This means that the order point of the sprites relative to the particles is no longer the lowest point of the image but instead a point which is approximately between the feet of the characters. The intent of the latest commits to treat sprites as perpendicular to the ground instead of perpendicular to the view line is retained by this approach. I tested this with various particle effects and it results in exactly the expected behavior. Note that this does NOT fix the current problems on TMW with the snail slime effect, because the TMW content team accidently placed this one 10px in the air. Sorry, garbage in, garbage out. getDrawPixelY was re-renamed to getPixelY to be consistent with getPixelX, while getPixelY was renamed to getDrawOrder, to make its purpose clear. Further, particles are no longer drawn when behind other objects. This is implemented by adding a drawnWhenBehind member function to Actor, which currently returns true for everything except particles and compound- sprites with more than one sub-sprites (the later case is consistent with the previous behavior of them). An exception are text particles which are excempt from this exception and whose drawing order is also biased by 16 pixels south instead of north to make them more visible. Plus some minor changes from Bertram. Reviewed-by: Bertram. Resolves: Mana-Mantis #362.
2011-06-23Made the being death sequence better handled.Yohann Ferreira1-1/+1
Now the death animation is set to the minimum of 1.5 seconds just as in the older versions, but permit longer sequences as well. I didn't put a maximum hard cap on it as it may be a burden for the maintainers whatever the hard cap would be, and as it isn't vital to set one anyway. Resolves: Mana-Mantis #364. Reviewed-by: bjorn, Jaxad0127.
2011-06-07Fix particle positionsJared Adams1-1/+1
Particles were being drawn with wrong positions due to their Z coordinate being taken into account when sorting actors. Z is now only taken into account when drawing them. Reviewed-by: Bertram
2011-06-03Replace SDL_types.h with cstdintJared Adams1-1/+1
This required moving to C++0x, so it does that too, and fixes a few errors with that. Reviewed-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
2011-06-03Hopefully fixed the particle offset when controlled by beings.Yohann Ferreira1-1/+8
Reviewed-by: Jaxad0127. Resolves issue: #345.
2011-05-30Remove some uneeded offsettingJared Adams1-7/+11
Also fix position of being names. Reviewed-by: Bertram
2011-05-01Look for <effects> tags in the effects.xml file.Yohann Ferreira1-1/+1
This, instead, of <being-effects>, which is irrelevant, as effects aren't only used for beings.
2011-04-26Made the client use a unique kind of movement code.Yohann Ferreira1-3/+1
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-09Removed the Mana namespaceThorbjørn Lindeijer1-6/+6
It's just an annoyance when it's only applied to a few classes. Either we place everything in this namespace or nothing, and at the moment I don't see any rationale for placing everything in a Mana namespace. Acked-by: Jared Adams
2011-04-09Moved Channels to Mana::Event::ChannelThorbjørn Lindeijer1-3/+3
Acked-by: Jared Adams
2011-04-09Moved Events to Mana::Event::TypeThorbjørn Lindeijer1-3/+3
Acked-by: Jared Adams
2011-03-28Random code cleanups requested righteously by Thorbjorn - part 1.Yohann Ferreira1-1/+0
- Fixed bogus documentation. - Fixed Vector parameters to const Vector& where releavant. - Removed a false comment. - Removed superfluous headers in src/net/tmwa/beinghandler.h. - Optimize a bit the tmwa::beingHandler::getPixelsPerTickMoveSpeed() function.
2011-03-17Fix actor and floor items offsets on tA.Yohann Ferreira1-2/+1
The code was simplified a bit, too.
2010-12-06Removed superfluous #includes taken from checkheaders list.Yohann Ferreira1-1/+0
Resolves: Mana-Mantis #265. Trivial fix.
2010-11-11Replace Event names with enums instead of stringsChuck Miller1-3/+3
2010-11-11Have the event system channels use enums instead of stringsChuck Miller1-3/+3
Reviewed-by: Freeyorp
2010-08-16Move more to the event systemJared Adams1-17/+3
Most of Net::InventoryHandler is now done through events. The ActorSpriteManager was also replaced by events. A few odds and ends were taken care of too. Reviewed-by: Bertram
2010-08-12Simplify working with the event systemJared Adams1-3/+3
EventManager has been merged into Event, with some new convinience methods added. Reviewed-by: Chuck Miller
2010-08-03Move Theme and UserPalette to the resources folderJared Adams1-2/+1
Reviewed-by: Yohann Ferreira
2010-08-02Remove non-GUI references to MiniStatusWindowJared Adams1-3/+18
Reviewed-by: Freeyorp
2010-07-08Fix crash in picking up an item that no longer existsremoitnane1-0/+16
Adds ActorSpriteListener to manage ActorSprite destruction as recommended by Jaxad0127. This likewise includes the changes made by Bertram. Reviewed-by: Jaxad0127, Bertram. Resolves: Manasource Mantis #160
2010-06-19This fixes the animation for target cursorsChuck Miller1-10/+5
Also it should optimize it a bit since it only updates used target cursors instead of all target cursors. Reviewed-by: Freeyorp
2010-06-13Merge remote branch '1.0/1.0'Jared Adams1-0/+10
Conflicts: data/graphics/CMakeLists.txt data/graphics/Makefile.am src/client.cpp
2010-06-08Handle not loading target files more gracyfullyChuck Miller1-2/+10
It no longer crashes, but will write to the log file instead Also added checks so it does not crash elsewhere when the target cursors are unloaded The game is still playable without the target cursor because the display name of a being changes when it gets targetted... so no need to be a fatel error. Reviewed-by: Thorbjørn Lindeijer
2010-05-20Buffer layered sprites under SDLJared Adams1-3/+3
This improves framerate and allows transparent overlay for complex sprites. Two copies of the buffer are kept, one at full opacity, one with variable opactiy, to reduce calls to setAlpha. Reviewed-by: Bertram
2010-05-09Move target cursor management into ActorSpriteJared Adams1-6/+115
This simplifies handling of target cursors, centralizing their logic into a single class, instead of two. Also make them more flexible and move the image files outside of the theme so servers can can control them and give them better names. Reviewed-by: Thorbjørn Lindeijer
2010-05-06Add support for floor item spritesJared Adams1-0/+326
This commit adds a sprite hierarchy (Sprite->ImageSprite,AnimatedSprite,CompundSprite; CompoundSprite,Actor->ActorSprite;ActorSprite->Being,FloorItem) to collect common functionailty into new base classes which will make other Mantis tickets easier to do. Also allows monsters to use particle effects. Reviewed-by: Bertram