Commit Graph
355 Commits
Author SHA1 Message Date
Gleb Mazovetskiy b21ebffaf2 Clean up player graphic loading 2022-07-24 18:25:12 +02:00
ephphathaandAnders Jenbo 975eb3674b Add helper to check if a monster belongs to a player
Co-authored-by: Anders Jenbo <[email protected]>
2022-07-24 16:08:09 +02:00
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Gleb Mazovetskiy 04c3d85179 Remove MAX_PATH
Rather than using the Windows-like `MAX_PATH`, what we really want is 2
things:

1. Maximum path of a file in an MPQ. This is now `MaxMpqPathSize`.
2. Max size for the known monster paths. This is now 64 for sounds and
   TRNs, which is more than enough (picked arbitrarily).
2022-07-16 11:14:16 +01:00
Gleb Mazovetskiy 7ad0ec925f Reduce sizes of Monster (goal)Vars
sizeof(Monster): 168 -> 144
2022-07-15 17:15:50 +01:00
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00
ephphatha 1337ff6ea2 Add check if a monster potentially has leashed minions 2022-07-13 07:13:34 +02:00
ephphathaandAnders Jenbo 4fef842b0b Remove use of ID/index from PlaceGroup
use getId helper for leader id

Co-authored-by: Anders Jenbo <[email protected]>
2022-07-13 07:13:34 +02:00
ephphatha 1e0f2c149c Add getLeader helper for monsters in a pack 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 38113c0ad8 Convert monster_goal in to a scoped enum 2022-07-11 01:46:24 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02: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
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
obligaron 3c571bf64b Avoid overflow of tickCounterOfCurrentFrame (#4893)
* When MFLAG_ALLOW_SPECIAL is set, don't call processAnimation (avoid overflow of tickCounterOfCurrentFrame)
2022-07-05 19:23:32 +02:00
aetn23 bf568fe480 Remove assert to check if value is in bounds 2022-07-05 17:38:39 +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 6949a6f418 Monster: Remove MType/MData pointers
These pointers are redundant, replaces them with methods.
2022-07-03 13:21:11 +01:00
obligaron a6132a1aa8 Ensure that no overflow happens when loading (invalid) data 2022-07-03 10:20:42 +01:00
Andrew James ace09d5f45 Address int-arithmetic-overflow in loadsave.cpp (#4853) 2022-07-02 02:48:18 +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
k-bar c2432d23e8 Berserk light fix 2022-06-30 21:01:29 +02:00
Anders Jenbo d82f2ebc9e Pass players by reference instead of an index 2022-06-28 00:30:00 +02:00
Anders Jenbo 0d27761ac2 Make _oAnimFlag a boolean 2022-06-27 20:21:10 +02:00
obligaron ceb08d783f Introduce Player::plrIsOnSetLevel 2022-06-18 17:05:30 +02:00
obligaron d0c14fe92f Introduce Player::setlevel 2022-06-18 17:05:30 +02:00
obligaron 19749420b5 Introduce Player::isOnActiveLevel 2022-06-18 17:05:30 +02:00
obligaron 7afe7d2a70 Save Methods in loadsave gets MpqWriter passed 2022-06-16 09:43:34 +02:00
Gleb Mazovetskiy 779ccaca17 Overhaul translation fetching
1. Do not modify the map after loading. Instead, return string views
   (guaranteed to be null-terminated) from look up functions and return
   the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
   Saves a bit of RAM (~50 KiB) and improves lookup performance.
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
Anders Jenbo 54cd839cf6 Clean up drlg tests 2022-06-05 16:43:06 +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
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
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
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
Gleb Mazovetskiy a66ca44695 Zero-based frame indexing
Index frames starting at 0 instead of 1.
2022-04-14 04:39:26 +01:00
ephphatha eb45b3708b Only save stash pages containing items
Viewing a stash page results in an entry being created in the stashGrids map. If the player flicks through the entire stash without actually storing an item they end up with ~20kb of unnecessary data in the stash file when they next save.
2022-04-04 18:58:35 +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
Andrew James 028c5945b8 Add helpers to change stash pages (#4287) 2022-04-02 10:54:25 +02:00
ephphatha 2b47f3abcc Address type conversion warnings in loadsave.cpp
Most of this was centred around stash pages being saved/loaded as unsigned values but stored as signed values. Consistently used unsigned since it matches the intended usage.
2022-03-30 13:16:32 +02: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
Gleb Mazovetskiy f4bce38875 Use uint16_t for sprite widths 2022-03-06 04:49:13 +01:00