Commit Graph
853 Commits
Author SHA1 Message Date
Gleb Mazovetskiy b21ebffaf2 Clean up player graphic loading 2022-07-24 18:25:12 +02:00
Anders Jenbo 56915974d6 Minimize passing of player indexes 2022-07-18 11:15:50 +02:00
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00
Anders Jenbo ac2bf9aaac Limit what gets called in headless mode 2022-07-13 18:54:36 +02:00
obligaron ebfb519ee0 Rename gbQuietMode to HeadlessMode 2022-07-13 18:54:36 +02:00
Cesar Canassa ce349789cf ♻️ Refactor M_StartKill to receive a Monster reference (#4943) 2022-07-13 15:57:58 +02:00
ephphatha 1337ff6ea2 Add check if a monster potentially has leashed minions 2022-07-13 07:13:34 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Anders Jenbo 3d08f951d6 Clean up use of miniwin 2022-07-10 21:13:39 +02:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Trihedraf 5ee6e5dd3a Make zoom a setting in the menu (#4931) 2022-07-10 19:59:32 +02:00
qndel 7ca9c8ba3c fix compiling in VS2019 2022-07-10 18:14:07 +01:00
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +02:00
Stephen C. Wills 4398c1e06a Use absolute coordinates for temp position when north-walking (#4937) 2022-07-10 07:25:53 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
ephphatha 1fb45a7f25 Take Player reference in FixPlrWalkTags 2022-07-10 06:03:10 +02:00
ephphatha 7a8fa64e69 Include leftover coinflips following conflict resolution 2022-07-10 03:12:03 +02:00
ephphatha 420a248e0c Use FlipCoin for most uses of GenerateRnd with variable frequency 2022-07-10 02:37:33 +02:00
staphen 17a12e273a Restore vanilla Diablo behavior for elemental damage on weapons 2022-07-09 19:34:34 +02:00
staphen cab75ded6b Check both SPL_NULL and SPL_INVALID to determine spell validity 2022-07-09 04:04:22 +02:00
Cesar Canassa e538acb248 📝 Fixes Doxygen warnings (#4904) 2022-07-07 12:51:24 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +02:00
Cesar Canassa 0d106beaf3 ♻️ Refactor M_StartHit to receive a Monster reference 2022-07-05 17:37:53 +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
Cesar Canassa 76da2d14c9 Remove monsterId from M_GetKnockback (#4882) 2022-07-04 11:54:53 +02:00
obligaron 4db1c6f315 Make DirectionSettings::offset match ActorPosition::offset2 (#4883) 2022-07-03 23:47:25 +02:00
Anders Jenbo 0b7ad34c9d Take player by reference in StartWalkStand and RemovePlrMissiles (#4874) 2022-07-03 21:17:07 +02:00
Cesar Canassa 6579aa53c5 Normalise the player and monster walking function naming (#4877)
Both player and monster walking functions are not named WalkNorthwards, WalkSouthwards and WalkSideways.

Also renames the PLT_MODE enum to follow the same pattern and removes the comments that are now unnecessary
2022-07-03 20:28:06 +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 17f8cdddc4 Clean up GetSpellLevel
Remove the buggy `GetSpellLevel` implementation and use
`Player#GetSpellLevel` throughout instead.
2022-07-03 13:40:53 +01:00
Gleb Mazovetskiy 6949a6f418 Monster: Remove MType/MData pointers
These pointers are redundant, replaces them with methods.
2022-07-03 13:21:11 +01:00
Gleb Mazovetskiy 21dc7f553d Add OptionalCelSprite: smaller than std::optional
`CelSprite` data pointer can never be `nullptr`.

We implement a smaller `optional` for it by taking advantage of that.
2022-07-03 12:26:39 +01:00
obligaron e87aca38bb Change animation frames and tick per frame to int8_t 2022-07-03 10:20:42 +01:00
obligaron d4638f290c Don't call player.AnimInfo.ProcessAnimation if player death animation is finished 2022-07-03 10:20:42 +01:00
Anders Jenbo b00ae287b8 Minimize propegation of global Players index 2022-07-03 06:10:42 +02:00
Gleb Mazovetskiy 72660d9189 Migrate snprintf to fmt (#4845)
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
2022-07-02 02:36:17 +02:00
Gleb Mazovetskiy 3b2e560fa0 Non-int versions of Point and Displacement (#4824)
* Non-int versions of `Point` and `Displacement`

This will allow us to make some structs, such as `ActorPosition`, much
smaller.

* ActorPosition: Use smaller types

`Monsters`: 56K -> 46K

* player.cpp: Reduce size of `DirectionSettings`

* CrawlTable: Displacement -> DisplacementOf<int8_t>

* CrawlTable: vector<vector> -> array<vector>

Also only allocate one vector during construction instead of two.
A bit less indirection.

* Monster#enemyPosition: Point -> WorldTilePosition

sizeof(Monster): 240 -> 232

* Monster: Further optimize field layout and sizes

sizeof(Monster): 232 -> 208

`Monsters` is down to 40,000 bytes

* DMonsterStr: _mx/_my -> position
2022-07-02 01:49:17 +02:00
Mikołaj Piróg 7cab074aa5 Correct members' names in monster.h (#4850)
* Fix case in AnimStruct
* Rename CMonster members
2022-07-01 23:34:32 +02:00
Gleb Mazovetskiy 3178dd5158 Replace most uses of sprintf with fmt (#4837) 2022-07-01 17:02:56 +02:00
Mikołaj Piróg 2e7ff45fbf Monster global constants cleanup (#4827)
* Change #defines to constexpr const, add constexpr where applicable, fix typos
2022-07-01 00:43:03 +02:00
Anders Jenbo 0cc5ee4344 Clean up variable definitions 2022-06-30 02:59:23 +02:00
Anders Jenbo 54598e2a8f CreatePlayer by reference 2022-06-28 16:51:45 +02:00
Anders Jenbo d82f2ebc9e Pass players by reference instead of an index 2022-06-28 00:30:00 +02:00
Vladimir Olteanu 84687fec42 Remove spurious "I can't cast that here" 2022-06-26 17:03:13 +02:00
ephphatha c68fcf3cb1 Apply MethodCase config to Rectangle::Contains
Also included Circle and VirtualButton classes due to the shared use.
2022-06-24 00:39:55 +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
Anders Jenbo 4cc3a5264c Make dPiece zero-indexed 2022-06-19 09:57:30 +02:00
obligaron 184290a977 Support setlevel in multiplayer 2022-06-18 17:05:30 +02:00