63 Commits
Author SHA1 Message Date
obligaron 95205294e8 Fix MSVC x86 warnings 2023-12-22 17:03:01 +01:00
Gleb Mazovetskiy 124d113b57 Extract spell data to a TSV 2023-12-05 21:33:23 +01:00
Gleb Mazovetskiy f566359e4f Migrate item data to txtdata/ 2023-11-14 00:20:17 +00:00
ephphatha 6a8f4b12da Get base block bonus from data struct instead of storing a copy 2023-09-20 05:49:54 +02:00
ephphathaandGleb Mazovetskiy 32c3316743 Load experience data from file
Also added an iterator based API, though it's not useful for this use-case. Might be nice in the future?

The field/record iterators is single-pass input iterators with shared state.
To avoid rescanning fields unnecessarily parseInt currently can only be called once, it would be possible to make these iterators bidirectional with a bit of extra state (holding onto the start pointer)

Co-authored-by: Gleb Mazovetskiy <[email protected]>
2023-08-24 05:46:44 +02:00
ephphatha 996841e82e Restore level 50 experience cap from Diablo 2023-08-24 05:46:44 +02:00
ephphatha 14639cd096 Replace _pNextExper with getter method
No real need to persist this value
2023-08-24 05:46:44 +02:00
ephphatha da76e131e4 Add getter/setter for character levels to ensure _pNextExper stays synced 2023-08-24 05:46:44 +02:00
Anders Jenbo 8e7c29ecd3 Remove unused player property _pISplDur 2023-06-28 23:50:50 +02:00
Anders Jenbo 63277a842d Clean up player packing 2023-06-24 04:18:14 +02:00
Anders Jenbo efa51993e3 Split network player sync and hero save file 2023-06-24 04:18:14 +02:00
obligaron 7985a9211d Change Player::_pSplLvl to uint8_t 2023-04-24 18:19:27 +02:00
DakkJaniels 24bb409086 Remove extra entry in experience level table and cap experience at level 50 requirement (#5782) 2023-04-18 03:10:14 +02:00
obligaron b87711bc08 Reintroduce Player::spellFrom to seperate teleport cursor from queued spell 2023-04-17 03:22:50 +02:00
Gleb Mazovetskiy 1a1a282d9a Use C FILE instead of C++ streams throughout
Reduces binary size by ~2 KiB and may improve compatibility with oddball
systems (e.g. PS2).
2023-02-15 18:15:07 +00:00
KPhoenix d813f13700 enum spell_id -> enum class SpellID 2023-02-05 10:24:58 +00:00
Eric Robinson ef3a57b7d9 enum spell_type -> enum class SpellType (#5674) 2023-01-28 22:25:37 +01:00
Gleb Mazovetskiy eb45753c4d Fix writehero_test on big-endian
`PlayerPack` struct should be little-endian even on big-endian systems.
2022-12-09 11:12:25 +00:00
Gleb Mazovetskiy 188dc79f6e Make Players a vector 2022-08-26 13:22:04 +09:00
obligaron 1cfd1ca99d Fix double casting bug - use separated info for casted and queued spells 2022-08-02 03:05:46 +02:00
Mikołaj Piróg dda0b96ea5 Remove #defines in player.h and add constexpr where applicable (#4896)
* Change defines to constexpr int in player.h

* Add const or constexpr to player.h/cpp where applicable

* Update tests with changed names of player constatns

* remove unecessary variable
2022-07-05 17:25:23 +02:00
k-bar 26de74f4a2 AnimationInfo class correct style (#4870)
* AnimationInfo class correct case-style for private members

clang-tidy warnings:
readability-identifier-naming    invalid case style for private member

* AnimationInfo class correct case-style for members

clang-tidy warnings:
readability-identifier-naming    invalid case style for member

* AnimationInfo class correct case-style for methods

clang-tidy warnings:
readability-identifier-naming    invalid case style for method

* AnimationInfo class use nodiscard

clang-tidy warnings:
modernize-use-nodiscard    function  should be marked [[nodiscard]]
2022-07-03 16:55:37 +02:00
Gleb Mazovetskiy 01ad1814ea Make path finding index-based
Reduces the size of the `PathNodes` array from 28 KiB to just 8 KiB.

Also reduces the size of `pnode_tblptr` from `300 * sizeof(void *)` to
`300 * 2` bytes.
2022-06-20 10:49:16 +01:00
qndel d5744ba421 fix multiplayer 2022-06-01 18:41:27 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
DakkJaniels dad46e1905 Item special effect enum (#4129) 2022-04-19 15:44:46 +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
ephphatha caf60daa00 Fix tests expecting unclean HoldItem uses.
These test cases were asserting side-effects of the call to CreatePlayer leaving an initialised gold item in the held item slot.
2022-03-06 05:52:40 +01:00
DakkJaniels 7bc19ee91a add enum for the spell flags. Adjust code to use them. 2022-03-06 02:09:19 +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
Anders Jenbo b77686213a 🐛 Correctly wipe temp data from saves
Fixes #3167
2021-10-26 16:51:56 +02:00
Anders Jenbo eb3012cc0d Reset player object before unpacking hero data 2021-10-12 04:56:30 +02:00
Anders Jenbo b4f699f0a3 Validate item network messages 2021-10-12 04:56:30 +02:00
Anders Jenbo 2d47c12515 Fix charpanel always showing player 0 stats 2021-09-12 01:37:28 +02:00
Juliano Leal Goncalves 7841c4731e 🚚 Rename 'PkItemStruct' to 'ItemPack' 2021-08-30 13:40:08 +02:00
Juliano Leal Goncalves 28134d099c 🚚 Rename 'PkPlayerStruct' to 'PlayerPack' 2021-08-30 08:01:53 +02:00
Juliano Leal Goncalves bbf529c65a 🚚 Rename 'PlayerStruct' to 'Player' 2021-08-30 06:44:18 +02:00
Anders Jenbo 4044fadeb5 Clean up some players references 2021-08-30 03:26:17 +02:00
qndel 3dbc120320 optimized packing/unpacking inventory items (#2610) 2021-08-18 20:56:07 +02:00
Anders Jenbo 9217e8c7f0 Test CreatePlayer 2021-08-12 21:15:48 +02:00
obligaron 70db8456ba Remove _pwtype and replace it with UsesRangedWeapon 2021-07-17 17:38:28 +02:00
Anders Jenbo 96bf75b502 Rename player globals 2021-07-08 02:01:14 -07:00
Anders Jenbo ee2e7518c4 Clang-tidy: FunctionCase part 2 2021-07-03 12:36:04 -07:00
obligaron 3a9cc631c7 Rename DelayLen -> TicksPerFrame
Rename DelayCounter -> TickCounterOfCurrentFrame
2021-06-27 01:26:49 -07:00
obligaron 3ba4bac5e2 Harmonize DelayLen for Player and Monster (was 1-based on monseter (>= DelayLen) and 0-based on player (> DelayLen). Now both are 1-based (>= DelayLen) 2021-06-27 01:26:49 -07:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
obligaron 61ba5009ac Convert to CelSprite 2021-05-24 20:12:43 +02:00
obligaron 3067aeacb8 Remove PlayerStruct._pXYZWidth and replace it with calls to GetAnimationWidth 2021-05-24 20:12:43 +02:00
obligaron 16b3b38908 Move NewPlrAnim logic to AnimationInfo
Adjust SetNewAnimation-Parameter Names to Class Member

Adjust NewPlrAnim-Parameter Names to SetNewAnimation-Parameter Names
2021-04-29 04:33:51 +02:00
obligaron 1de46a8495 Rename member variables 2021-04-29 04:33:51 +02:00