summaryrefslogtreecommitdiff
path: root/src/being.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-03-06General code cleanupsThorbjørn Lindeijer1-7/+11
* 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 Lindeijer1-3/+3
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 Lindeijer1-1/+1
2024-03-02Added support for customizing NPC and Monster hover cursorThorbjørn Lindeijer1-11/+12
To match support for this in M+, since TMW uses this functionality on two of its NPCs.
2024-03-02General code cleanupsThorbjørn Lindeijer1-6/+6
* 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-13General code cleanupsThorbjørn Lindeijer1-34/+3
* 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-11/+4
These checks are unnecessary as deleting a null pointer has no effect.
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer1-19/+19
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2013-05-02Fixed network layer doing delayed actor deletionThorbjørn Lindeijer1-1/+1
The delayed actor deletion was meant to be used during the logic calls, to avoid modifying the container while it is being iterated. The deletions happening from the network layer are not done while iterating the set of actors, so it can delete immediately. This fixes an issue where an NPC would disappear when changing appearance on tmwAthena, because this was implemented as a remove + add, which broke due to the delayed deletion. Mantis-issue: 507 Reviewed-by: Jared Adams
2012-02-02Fix to the hair colors and styles handling.Yohann Ferreira1-15/+0
- 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
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-20Fixed a bug with hurt sounds volume and simplified codeThorbjørn Lindeijer1-1/+1
The hurt sound volume was being played based on the distance in tiles, even though Sound::playSfx was expecting pixels. This would cause hurt sounds of other players to play too loud. There were also several conversions between pixel and tile coordinates that could be simplified. Reviewed-by: Yohann Ferreira
2012-01-18ColorDB -> HairDB.Yohann Ferreira1-1/+1
This will ease the reading of the next patch about hair handling at character creation time in tAthena. As requested by bjorn. Reviewed-by: bjorn
2012-01-14Fixed the chat bubbles position.Yohann Ferreira1-5/+9
This issue was much nastier than it first sounded. The issue was happening when using a long weapon (like the scythe) with the SDL backend. The algorithm computing the sprite compound frames into one would then update the sprite height to a high value (127 in my case), leading to put the bubble too far away from the player. The algorithm not being in cause about the needed height, I noticed that the simplest way to set a good Y position of the text bubbles was to simply set a maximum. A config option can be added later. I also unified the way the position is computed in the being class. + Function description sentence removal requested by bjorn. Resolves: Mana-Mantis #447. Reviewed-by: bjorn.
2012-01-10player_node -> local_playerYohann Ferreira1-17/+17
Reviewed-by: Ablu
2012-01-10Hopefully fixed the butterfly direction updates.Yohann Ferreira1-25/+17
In fact, the bug was nastier and could also concern many other beings, such as squirels, and some players. The bug came from the distance odd check I added a while ago. This (ugly) hack wasn't needed anymore since I made beings finish their path before starting the new one also a while ago. This also fixes some movement glitches I've seen in manaserv at login time (Hurray). Thanks for Ali-G for spotting this one. Reviewed-by: Ablu
2012-01-09Spotted some more hard-coded files and paths definitions.Yohann Ferreira1-2/+0
Conflicts: src/actorsprite.cpp
2011-09-02The draw order of particles is now Y - 16 pixels.unknown1-7/+7
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-08-19Fixed visible equipment updates, and made it based on equip.xml.Yohann Ferreira1-2/+0
2011-06-23Made the being death sequence better handled.Yohann Ferreira1-2/+4
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-22Applied fixes requested by cody.Yohann Ferreira1-2/+2
- Made the map teleport distance fixed for manaserv. - Small cleanups. The branch is considered reviewed by: Cody. Resolves Mana-Mantis: #74.
2011-06-17First pass on removing tile hard coded values.Yohann Ferreira1-3/+3
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-06-07Added hit effects on victims from monsters attacks.Yohann Ferreira1-1/+11
Resolves: Mana-Mantis #336. Reviewed-by: Jaxad0127.
2011-06-07Fix particle positionsJared Adams1-7/+7
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-02Arbitrary code cleanupsThorbjørn Lindeijer1-4/+4
Just some stuff that piles up while "looking" at the code, which eventually gets annoying to ignore while staging real changes. * Replaced a few NULL occurrences with 0 * Rely on default parameter for std::vector::resize. * Replaced a few "" with std::string() * Prefer .empty() to == "" * Removed a few comparisons with NULL * Don't check pointers before deleting them * Removed a bunch of redundant semicolons * Made some global variables static (local to their compilation unit) * Prefer prefix ++/-- operators to postfix versions when possible * Corrected location of a comment
2011-05-30Fix changing maps with persistant particle effects activeJared Adams1-1/+1
2011-05-30Remove some uneeded offsettingJared Adams1-4/+2
Also fix position of being names. Reviewed-by: Bertram
2011-05-30Fix monsters name display.Yohann Ferreira1-1/+2
The monster offset wasn't counted anymore so I had to readd it in the display coordinates. Part of issue: #345.
2011-05-26Added effects support in monsters attacks.Yohann Ferreira1-18/+21
This is provided through the use of the 'effect-id' property of the <attack> tag. Note that the 'particle-effect' support has been removed as it was redundant, but can be kept for backward compatibility. Now, on both Manaserv and tA, only the attack id 1 is supported, i.e: <monster> ... <attack id="1" effect-id="11" action="attack" /> </monster> More to come with re-enabling of the attack type support. I had to fix a crash in the Being::takeDamage() function when there were no attacker (in Manaserv), and add rotation support to the effectManager to achieve this. Reviwed-by: Jaxad0127.
2011-05-17Fix sprite buffering size issuesJared Adams1-10/+0
Reviewed-by: Yohann Ferreira
2011-05-15Starting to fix party inviteStefan Dombrowski1-5/+0
2011-04-30Added customizable on-hit effects for characters.Yohann Ferreira1-4/+18
This patch adds support for the following two parameters in weapon items: hit-effect-id: Effect triggered on the victim on normal hit. critical-hit-effect-id: Triggered on the victim on critical hit. (Specified in effects.xml) The patch also permits the use of custom defaults set in paths.xml by setting the following keys: (Paths are relative to the 'particles' key value, here.) hitEffectId: defaulted to effect id 26. criticalHitEffectId: defaulted to effect id 28. Resolves: Mana-mantis #337. Reviewed-by: bcs86
2011-04-26Made the client use a unique kind of movement code.Yohann Ferreira1-206/+162
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-16Made the attackers look at their victims when possible.Yohann Ferreira1-0/+3
That simply make the game a bit more realistic as I saw many archers back fire arrows lately ;) Plus, that's what the servers should expect.
2011-04-16Introduced the Being::lookAt() function.Yohann Ferreira1-0/+80
We're now using it when picking up items. Also, de-overnested the Game::handleInput() function when handling pickups.
2011-04-09Removed the Mana namespaceThorbjørn Lindeijer1-9/+9
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-5/+5
Acked-by: Jared Adams
2011-04-09Moved Events to Mana::Event::TypeThorbjørn Lindeijer1-2/+3
Acked-by: Jared Adams
2011-03-28Random cleanups - Part 2Yohann Ferreira1-1/+1
- Removed another bogus comment. - Made functions used only in the tA::beinghandler static. - Don't init the destination to an irrelevant value in being::setDestination()
2011-03-28Random code cleanups requested righteously by Thorbjorn - part 1.Yohann Ferreira1-1/+1
- 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-17Fixed the Being::logic() once again as pointed out by Thorbjorn.Yohann Ferreira1-3/+3
Luckily or not, the code did the intended without even being right. :)
2011-03-17Now the client centers the pixel positions when using tA.Yohann Ferreira1-8/+24
I made it so that the behaviour can be changed with only a boolean setting in the playerhandler.
2011-03-16Fixed the bug with remote player movement animation,Yohann Ferreira1-1/+1
by removing a now useless reset in the beinghandler. Also added checks for flawed directions.
2011-03-15Adapted the Being::logic() to handle very slow beings.Yohann Ferreira1-4/+6
This fixes the bug about monsters direction not being updated. The good news is that the bug was also present for Manaserv and is now corrected. I also moved back the ActorSprite::logic() call at its initial place.
2011-03-15Made the tA Beinghandler avoid dealing with flawed coordinates.Yohann Ferreira1-3/+3
Also fixed again a condition in Being::logic(). I'll beautify the code in tmwAthena:Beinghandler once everything will be working better. Note: I also suspect current clients to flood the server with keyboard messages, hence blocking the animation when they are remote. I'll need to test that with someone having the same client than here..
2011-03-15Fixed a small condition.Yohann Ferreira1-1/+1
Should be invisible on behaviour change.
2011-03-15Add a tolerance check on current position to limit desyncs.Yohann Ferreira1-4/+0
Also removed dead code.
2011-03-15Basically merged the two movement algorithms into one.Yohann Ferreira1-195/+54
This was made in favour of the manaserv way of doing things. I also added a way to keep the original server speed value so the pixel value can be recomputed at each map change, as this was necessary since the speed is given before the first map is loaded. The code is much more simpler now about movement handling, and we can already see improvements on other characters movements in The Mana World with this. Everything can't be perfect the first time; here are bugs identified so far: - Monsters direction isn't updated on TmwAthena for obscure reasons. - Remote players walking animation is sometimes reset on each steps. - When changing map, the local player sometimes walks randomly until the player reacts. Stay tuned!
2011-01-11Added a distance based positional sfx sound system. Thanks to 4144.Yohann Ferreira1-3/+14
Based on: http://gitorious.org/manaplus/manaplus/commit/ef7f53e43ce4306080efae3b86443a6016a3e66a Resolves: TMW-Mantis #536 Reviewed-by: 4144.
2011-01-06Made the beings avoid changing direction at their path's end.Yohann Ferreira1-21/+40
I had to let the keyboard path not be resend when the player released the movement keys and work on conditions used to update the beings direction to avoid conflicts. Resolves: Mana-mantis #154. Reviewed-by: Thorbjorn.