Commit Graph
799 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 2386fd12a9 Fix a few warnings 2022-06-15 13:01:20 +02:00
Gleb Mazovetskiy 1fc8ecb6f6 Add fmt::runtime annotations for C++20 support
`fmt` requires non-contexpr format string arguments to be wrapped in
`fmt::runtime` in C++20.
2022-06-14 12:46:36 +01:00
Anders Jenbo 1203514383 Clean up use of currlevel 2022-06-07 21:35:01 +02:00
staphen a2fe3a981e Fix issues with ears due to translation 2022-06-06 07:26:43 +02:00
Gleb Mazovetskiy 628406a44c Refactor inventory/belt item presence and removal
Introduces new functions to check for presence of and remove player items.
These functions do not rely on or expose item indices.

They're implemented as free functions instead of Player methods due to
complicated include dependencies between `player.h`, `inv.h`, and
`inv_iterators.h`. We should probably look into cleaning this up at some
point.
2022-06-05 13:30:26 +02:00
qndel f84c35d2dc fix typos 2022-06-01 17:12:22 +02:00
Andrew James 1047e408bd Simplify logic of UpdateMissilePos using helpers from 4620 (#4621) 2022-05-31 06:58:47 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
k-bar 4a4e3a5404 Unwindle If-Elses around petrify monster 2022-05-21 19:57:02 +02:00
k-bar 5b29eda518 Remove of CheckMonsterHit (aka LiftGargoylesAndIgnoreMages) 2022-05-21 19:57:02 +02:00
k-bar 417c4c9ce2 Extract duplicated code to functions related to monster 2022-05-21 19:57:02 +02:00
obligaron 2b0b944afb Manage friendly mode per player and sync state between clients 2022-05-20 22:46:48 +02:00
obligaron 70c5cf6cad Fix item label text with open stash (#4595)
* Item labels: check if stash is open in IsMouseOverGameArea

* Add IsLeft/RightPanelOpen
2022-05-20 09:12:54 +02:00
Anders Jenbo 0645d9b2a1 Correct missing hellfire level mapping in leveltype
Hellfire never added the 2 new dungion types, instead it makes
additional checks on currlevel. This is confusing and mess, so cleaned
it up.
2022-05-10 15:16:38 +02:00
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