Commit Graph
316 Commits
Author SHA1 Message Date
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
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
ephphatha 9a2002e200 Get rid of RemoveEmptyLevelItems
This was a cleanup function to handle converting saves between Hellfire <-> Diablo, mainly when a hellfire specific item was dropped and should be removed from a Diablo game. This had an off by one with the way it iterated backwards over the active items list which meant it always called DeleteItem at least once (since it uses an invalid item past the end of the active items range). DeleteItem then always decremented the ActiveItems count. When saving the game after converting the items we then end up with a dropped items array containing an index to an item that is no longer considered active.

However the code in LoadDroppedItems already checks that the conversion was successful before considering it active, so this function doesn't need to be called. Instead we can just save if we converted game mode.
2022-02-08 12:10:42 +01:00
Gleb Mazovetskiy 7c07e9a3e1 loadsave.cpp: Fix -Wsign-compare and -Wnarrowing 2022-01-30 14:56:04 +01:00
Anders Jenbo a19d3ad6a2 Fix typo of availableMissiles 2022-01-27 05:08:32 +01:00
ephphatha 32d397eb2a Add max_size checks when adding missiles to allow for limited size containers
This doesn't handle failed allocations (e.g. if the platform runs out of memory) but makes it easier to use a fixed size container on limited memory devices.
2022-01-23 05:02:57 +01:00
ephphatha d3c42544a6 Address warnings/dead code 2022-01-23 05:02:57 +01:00
obligaron c68eeb25cc Add additional missiles to save game 2022-01-20 23:12:48 +01:00
obligaron 234a053863 Change Missiles Array to std::list 2022-01-20 23:12:48 +01:00
ephphatha 14aeeaa24d Don't count invalid items as active items 2022-01-03 11:59:43 +01:00
ephphatha 5fa0dfbc28 Skip loading item locations from file
It's safer and easier to rebuild this as we load each item.
2022-01-03 11:59:43 +01:00
obligaron 419fe7b7ec Change Keymapper to OptionCategory/OptionEntry 2021-12-23 00:26:12 +01:00
obligaron b2750c99e7 Call SyncPortals() only once for a level load 2021-12-13 01:19:14 +01:00
Gleb MazovetskiyandAnders Jenbo 7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <[email protected]>
2021-11-24 23:44:12 +01:00
ephphatha b8b220311a Remove AvailableItems, no longer required 2021-11-23 19:08:41 +01:00
ephphatha 18658f6a42 Remove duplicate argument to DeleteItem 2021-11-23 19:08:41 +01:00
ephphatha f60cc3bfd9 Update calls to DeleteItem to use ActiveItems inline
This highlights how all (except one) call sites duplicate the i argument. With the exception of the use in msg.cpp this can be treated as a offset into activeItems and doesn't care about the real index.
2021-11-23 19:08:41 +01:00
ephphatha 55a52b82c2 Use unsigned types for Items array indexes consistently
Actual type used varied based on context, this addresses some type conversion warnings.
2021-11-23 19:08:41 +01:00
ephphatha 84302c45f3 Extract common logic for saving items to a save file
This was duplicated for saving from the menu and transitioning to a new level
2021-11-23 19:08:41 +01:00
ephphatha 71e39dda6f Extract common logic for loading items from a save
This was duplicated for loading a save from the menu and transitioning to a new level
2021-11-23 19:08:41 +01:00
Gleb Mazovetskiy 720d210d95 utils/mpq* -> mpq/* 2021-11-17 11:49:57 +01:00
Gleb Mazovetskiy 23406b6fc5 Replace mpqapi.h with the MpqWriter class
This is a cleanup, heading in the direction of allowing us to reuse
some of the code between reading and writing MPQs.
2021-11-10 01:41:11 +00:00
Gleb Mazovetskiy b8affd5fe5 Fix a few build warnings 2021-11-08 23:33:08 +01:00
Andrew James 796e2813cf Use scoped enums for DungeonFlags/BFLAG (#3135) 2021-11-07 03:11:16 +01:00
qndel bee45d61d6 make monster lights compatible with vanilla 2021-10-29 00:02:22 +02:00
Anders Jenbo b77686213a 🐛 Correctly wipe temp data from saves
Fixes #3167
2021-10-26 16:51:56 +02:00
Anders Jenbo 96e1d5caba Fix spell properties incorrectly being capped at 8
Fixes  #3187
Revert #3021

destParam3 had been typed ad Direction, but is also sometimes used for
other values.
2021-10-25 20:52:56 +02:00
qndel e567953bc9 Sharing automap exploration in multiplayer 2021-10-25 02:58:41 +02:00
Anders Jenbo 0e3c1321fb 🐛 Fix scavenger groups getting stuck 2021-10-21 23:55:02 +02:00
Thomas Christlieb 7013ee8349 rename variable in new code 2021-10-16 03:04:18 +02:00
ThomasChr d72e590183 add light source for berserk monster 2021-10-16 03:04:18 +02:00
Anders Jenbo 3be7ffbc48 🐛 Adjust save buffer to a safe value 2021-10-13 01:58:27 +02:00
Anders Jenbo b4f699f0a3 Validate item network messages 2021-10-12 04:56:30 +02:00
Anders Jenbo a0009b0ff8 Correct name of IPL_LASTDIABLO 2021-09-23 10:20:54 +02:00
Anders Jenbo 0c5bdf5dbf 🐛 Reject items that would cause an OOB to 2021-09-23 10:20:54 +02:00
obligaron 74a1810576 Remove most uses of BFLAG_MONSTLR 2021-09-17 21:03:41 +02:00
obligaron c7dec38b96 Player: rename _pVar4 to spellLevel 2021-09-17 21:03:41 +02:00
obligaron c3c91f6e28 Remove _pVar5 and most uses of BFLAG_PLAYERLR 2021-09-17 21:03:41 +02:00
Siddharth singh chouhan bcb332b7b0 Move documentation from implementations to declarations 2021-09-14 09:55:55 +02:00