Commit Graph
303 Commits
Author SHA1 Message Date
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
Juliano Leal Goncalves 379a27b64a ♻️ Convert 'ItemType' enum to enum class
🎨 Rename 'ItemType' elements to enum class standards
2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves 6323539fcc 🚚 Rename 'item_type' enum to 'ItemType' 2021-09-13 00:25:49 +02:00
ephphathaandAnders Jenbo b12de6fe12 Use scoped enum for Direction
Identified and removed an instance of Direction being used as an argument for a bool parameter

Removed a single-use temporary variable being cast from sprite frame to direction to size_t

Co-authored-by: Anders Jenbo <[email protected]>

Fix alignment of WalkSettings array
2021-09-12 02:27:47 +02:00
obligaron 836bb92e8e MoveMissileAndCheckMissileCol: Call CheckMissileCol only once for a tile and target 2021-09-11 22:21:37 +02:00
ephphatha af61b21a23 Add whitespace around loops for readability 2021-09-07 01:09:51 +02:00
ephphatha cdf2db1d94 SaveItem by reference 2021-09-07 01:09:51 +02:00
ephphatha 8ab229e7e8 LoadItemData by reference 2021-09-07 01:09:51 +02:00
ephphatha 78fa540ec9 Save/LoadObject by reference 2021-09-07 01:09:51 +02:00
Juliano Leal Goncalves 4ea9cd539e 🚚 Rename 'PortalStruct' struct to 'Portal' 2021-09-06 17:47:34 +02:00
Juliano Leal Goncalves a91074d470 🚚 Rename 'LightStruct' struct to 'Light' 2021-09-06 12:49:48 +02:00
Juliano Leal Goncalves 0d3d4c14f6 🚚 Rename 'Dead' concept to 'Corpse' everywhere (#2808) 2021-09-06 12:49:00 +02:00
Juliano Leal Goncalves 1f7cfcf945 ♻️ Replace 'ReturnLvlX' and 'ReturnLvlY' globals with single 'ReturnLvlPosition' 2021-09-06 00:31:25 +02:00
Juliano Leal Goncalves 940a120bf9 ♻️ Replace 'ViewX' and 'ViewY' globals with single 'ViewPosition' 2021-09-04 18:06:28 -04:00