Commit Graph
785 Commits
Author SHA1 Message Date
obligaron daf299940e ADL: Fix PreviewFrame for some spells 2022-04-22 23:23:43 +02:00
ephphatha 64a2c41b2c Set clang-tidy config for MethodCase option
Previously this was falling back to FunctionCase, leading to inconsistent casing of class methods throughout the codebase. Applied to Item as an example.
2022-04-20 13:50:57 +02:00
ephphatha 7a3722d63b Add helper for clearing an item and using it's old value
Used when moving from one persistent variable to another where we want the source variable to be marked empty. Defining as a function instead of move constructor/assignment operator as we only really need to mark the source for xvalues. Detecting that in the constructor/assignment would be needlessly complicated.
2022-04-20 13:35:55 +02:00
DakkJaniels dad46e1905 Item special effect enum (#4129) 2022-04-19 15:44:46 +02:00
ephphatha 7e7798fd2b Add function to mark an item as empty 2022-04-18 19:25:55 +02:00
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
obligaron 92baf04096 Use unarmed Animations when casting in town if weapon is not hold 2022-04-16 00:32:09 +02:00
obligaron ee1a17e9e5 Enable Spell Animation in Town 2022-04-16 00:32:09 +02:00
Gleb Mazovetskiy a66ca44695 Zero-based frame indexing
Index frames starting at 0 instead of 1.
2022-04-14 04:39:26 +01:00
staphen cf41911417 Use appropriate spell ID when quick casting from scroll or staff 2022-04-10 17:32:16 +02:00
Drakker 3039b760e1 Added more Quickspell hotkeys for a total of 16. Saving will write the number of configured quickspell slots at the beginning of the hotkeys file. The loader will check the size, if its bigger than older saves should be it will load the header and read the hotkeys, otherwise it will load 4 quickspells for compatibility. 2022-04-02 20:19:46 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00
staphen 822a0cd22a Fix auto-equip network messages 2022-03-27 18:26:43 +02:00
Anders Jenbo ef669d3469 Invalidate removed inventory items 2022-03-25 20:54:37 +01:00
Anders Jenbo 1ba817ca53 Unify gold handling (withdraw any amount from stash) 2022-03-22 21:38:51 +01:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
ephphatha 2a09d7f561 Dedupe network call when dropping items on death 2022-03-06 07:06:32 +01:00
ephphatha f5da32a21c Don't assume holdItem when auto-placing gold 2022-03-06 06:33:11 +01:00
Andrew James f64d17bfa9 Initial clean up of code related to creating items (#2943)
* Move declaration of dItems to items.cpp

This array is never used in dungeon generation, it's closely related to Items so should be kept together. Ideally managing dItems can become responsibility of a container for Items, which will handle adding/removing items from the list and keeping the positions in sync.

* Rename SetPlrHandItem to match purpose/use

* Give more descriptive name to GetPlrHandSeed

This function sets a new seed on a given item struct, not just the held item.

* Don't use HoldItem as a temporary for the players initial inventory

* Take Item by reference in RespawnItem

* Don't use holdItem as a temporary when dropping gold on death

* Update DeadItem to take item by reference, and refer to it consistently

Move code which invalidates the source of dropped items to the caller

Most call sites use a temporary item instance or remove the item from the container, so there's no real point invalidating the item after it's been copied to the drop list.

Update DeadItem to take position instead of player references
2022-03-06 14:53:29 +11:00
Gleb Mazovetskiy 7fede6c4cb Clean up owned/unowned CelSprite ambiguity
Makes `CelSprite` unowned and adds a new `OwnedCelSprite` class for
owned sprites.

This clarifies ownership and makes the code cleaner in a number of
places.

Additionally, because the `CelSprite` class is now tiny (1 less
pointer), we can pass it by-value instead of by-reference, removing a
pointer indirection in the rendering functions.
2022-03-06 04:49:13 +01:00
DakkJaniels 7bc19ee91a add enum for the spell flags. Adjust code to use them. 2022-03-06 02:09:19 +01:00
qndel 81800e64bb MAXCHARLEVEL cleanup 2022-03-01 21:45:47 +01:00
KPhoenix 32d39c6524 Fix Stat Adjustment (#3898)
This fixes a problem related to shrines. When a player with a base Magic or Vitality stat of 0 has their respective stat reduced below 0, they lose Mana/Life, and their stat is corrected to 0 without refunding them the lost Mana/Life. This will prevent stats from being modified to a value less than 0 in the first place.
2022-02-07 10:14:54 +01:00
obligaron c6abd7401b Preview Frame: Disable for towncast 2022-01-28 21:42:31 +01:00
ephphatha db1d776539 Deduplicate PItem and DItem 2022-01-24 21:12:13 +01:00
obligaron 234a053863 Change Missiles Array to std::list 2022-01-20 23:12:48 +01:00
KPhoenix 707d8a1379 Mana Shield 1.07 bugfix revision
This is a bugfix for the vanilla 1.06 and earlier Mana Shield logic. In 1.07 Blizzard North "fixed" the Mana Shield logic since the damage reduction would decrease in effectiveness with increased spell level instead of increase. As a fix, they set the damage reduction to a flat value regardless of spell level. Originally, damage reduction started at 1/3 and capped at 1/21 at spell level 7. This fix reverses the order and gives 1/21 damage reduction at spell level 1, and caps at 1/3 damage reduction at spell level 7.
2022-01-20 11:37:54 +01:00
obligaron 6d7334886d Fix preview frame when player can't walk to desired location 2022-01-16 21:12:50 +01:00
KPhoenix e0cd19c011 Fix death animation frames for Warrior/Barbarian (#3954) 2022-01-15 22:36:09 +01:00
KPhoenix 34266ff4c7 Show correct death animation (#3953)
Shows death animation based on what armor you are wearing while dying. Dropping items on death results in showing light armor animation.
2022-01-15 20:24:19 +01:00
obligaron 2843d99485 Fix walk stuttering with Preview Frame 2022-01-15 14:40:35 +01:00
obligaron 75760382ef Regard preview frame in AnimationInfo 2022-01-12 12:26:39 +01:00
obligaron 35dc64312e Show preview CelSprite for player actions (Introduce PlayerStruct.pPreviewCelSprite and UpdatePreviewFrame) 2022-01-12 12:26:39 +01:00
obligaron 7b535d886e Make LoadPlrGFX check if graphics are already loaded 2022-01-12 12:26:39 +01:00
obligaron 5b9f0f4aaa Introduce GetPlayerGraphicForSpell 2022-01-12 12:26:39 +01:00
ephphatha 8bf05571a1 Dedupe code which determines how much life/mana to restore for potions
This is very similar to the code used when casting heal other, except for how the amount to heal is chosen. Could potentially reuse it there as well with a bit of work.
2022-01-08 09:29:26 +01:00
KPhoenix 8e6433f400 Enable Dungeon Messages in Multiplayer (#3872)
* Enable Dungeon Messages in Multiplayer
2022-01-06 11:09:52 +11:00
Anders Jenbo b0252b3339 Make Gamepad cursor independant of hardware mouse
The gamepad cursor (inventory, spells etc) no longer relies on warping a
real mouse cursor. This should make things work better on platforms that
do not support this, like Wayland.
2022-01-02 11:37:38 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
KPhoenix 2881f13b6d Bugfix: Level 16 Dungeon Message (#3871)
* Bugfix: Level 16 Dungeon Message

Applies the commented bugfix to allow the game to play the level 16 audio message when the player enters the level for the first time.
2021-12-31 17:53:20 +11:00
ephphatha abe4075a5a Deduplicate code checking if the player is next to a two-tile object
Used to activate sarcophagi from the top/right tile, probably other objects too.
2021-12-29 04:57:57 +01:00
ephphatha e65959e6fc Use helper when checking if a player hit an object on attack 2021-12-29 04:57:57 +01:00
staphen 25d3b36c96 Do not send CMD_REMSHIELD when another player runs out of mana 2021-12-19 22:11:03 +01:00
Gleb Mazovetskiy 076b0c0c05 Overhaul tests
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.

Also:

* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare
2021-12-16 20:26:51 +00:00
Adam Heinermann 1484b4d8cf Implement Discord rich presence (#3711) 2021-12-15 17:14:17 +01:00
Joerg Wissen f9bc40e8e0 Optional functionality to auto-pickup potions 2021-12-09 22:45:26 +00:00
qndel be0b79f9f5 Add IsWallSpell helper 2021-12-07 12:00:52 +01:00
Vladimir Olteanu 861fb99e9d Quick cast 2021-12-04 15:38:58 +01:00
Gleb Mazovetskiy 0e63b3ee0b Update clang-format-check GitHub Workflow
Taking this opportunity as we've just done a global reformat and it's
quite small.
2021-11-24 23:44:12 +01:00