Commit graph

673 commits

Author SHA1 Message Date
ephphatha
4eec1bd40c Refactor trap target loop to use range iterator 2022-01-19 03:05:27 +01:00
staphen
597cde8ff2 Fix item cursor graphic used when generating Rogue's reward from the Slain Hero quest 2022-01-13 10:20:28 +01:00
ephphatha
13c54102e0 Combine Add*Door functions
There's a bit of common code, but most of the initialisation logic relies on globals or other functions defined in objects.cpp so it's not really appropriate to move these wholesale into a member of the Object class.
2021-12-30 10:26:46 +01:00
ephphatha
939df1b9c3 Remove duplicate arguments to Add*Door functions 2021-12-30 10:26:46 +01:00
ephphatha
eebea35280 Pass object by reference 2021-12-30 10:26:46 +01:00
ephphatha
099fad5cb9 Use ObjectAtPosition helper for remaining references in objects.cpp
There are a bunch of direct references to dObject related to testing if an area contains the interactable part of an object, this needs further cleanup.
2021-12-28 16:01:37 +01:00
ephphatha
77a783098d Use ObjectAtPosition when checking if an item can be dropped
This extracts some of the common object logic from ItemSpaceOk and CanPut, these functions are almost identical except for the way players and monsters are checked...
2021-12-28 16:01:37 +01:00
ephphatha
a0019d289d Use Point based object lookups in themes.cpp
Move bookstand lookup inside coinflip if statement, minimises the scope of that pointer.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-12-28 16:01:37 +01:00
ephphatha
903b661307 Use ObjectAtPosition for debug object type display
The other use of dObject is displaying the contents of that array so makes sense to leave as is. We're also able to remove the map since we can reference the current object type value directly on the returned object.
2021-12-28 16:01:37 +01:00
ephphatha
379d6e87b3 Move ObjectAtPosition to objects.cpp and make it return a pointer
All set maps initialise objects as expected so dObject has the correct ID already, no need to iterate over all active objects. Also by returning a pointer we can use this function to test if an object exists at the target position.

While on msvc int8_t is typedefed to signed char we might as well match the expected data type for the dObject array
2021-12-28 16:01:37 +01:00
obligaron
ff5de056fa
Add all (boolean) Game Settings to Settingsmenu (#3616) 2021-11-26 23:43:46 +01:00
Gleb Mazovetskiy
c57644970f Move UiFlags and UiPanels into their own files
The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
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 <anders@jenbo.dk>
2021-11-24 23:44:12 +01:00
obligaron
635f378722 Add OptionEntry Experience Bar 2021-11-24 09:31:39 +01:00
Andrew James
8104432db4
Use object reference (and self-id lookup) for BreakBarrel 2021-11-08 00:51:16 +01:00
Andrew James
796e2813cf
Use scoped enums for DungeonFlags/BFLAG (#3135) 2021-11-07 03:11:16 +01:00
staphen
d669f8ce19 Remove call to SetRndSeed() from OperateFountains() 2021-11-06 18:34:07 +01:00
Andrew James
021c7a652f
Add helpers for checking object type (#3357)
* Add helper to test if an object is a trap source
* Add helper to test if an object is a barrel
* Add helper to test if an object is a crucifix
* Add helpers to check if an object is a chest (and statuses)
* Add helpers to check if an object is a (basic) shrine
2021-11-06 18:32:52 +01:00
Andrew James
e87b67aa8a
Remove no-op assignment (#3362) 2021-11-02 08:50:01 +01:00
Andrew James
7dcc6d15f7
Update some quest object activation functions to use references (#3356)
- rename with a hopefully more descriptive name
2021-11-01 15:48:54 +01:00
ephphatha
d2940e8f7f Update GetObjectStr to take a const Object&
Brings it in line with GetItemStr
2021-11-01 12:44:46 +01:00
Gleb Mazovetskiy
64a88343e8 Refactor: Use item iterators in 7 more places 2021-10-31 13:28:08 +00:00
ephphatha
6d545868d2 Move objectIsDisabled to a member function
While it does reference a global configuration option it's mainly concerned with the properties of the object itself, so makes sense to be a member of the object class.
2021-10-31 14:21:57 +01:00
ephphatha
e98b80c992 Remove declaration of private/anonymous function
Never used outside objects.cpp so it was rightly moved into the anonymous namespace, but the header was not updated at the time.
2021-10-29 14:16:17 +02:00
Andrew James
76ef0e8128
Dedupe SyncNakrulRoom code (#3325) 2021-10-29 08:34:30 +02:00
obligaron
98ecd0ecc5 Introduce CloseGoldDrop 2021-10-27 00:06:30 +02:00
qndel
e567953bc9 Sharing automap exploration in multiplayer 2021-10-25 02:58:41 +02:00
qndel
d81de165d4
code cleanup (#3235) 2021-10-24 16:05:44 +02:00
qndel
5193abebcb add objectindex to tiledata 2021-10-20 22:30:18 +02:00
obligaron
c6b214ecd3 Fix opening Diablos chamber with only one lever 2021-09-19 20:19:10 +02:00
obligaron
9e788d8134 Introduce AreAllLeversActivated 2021-09-19 20:19:10 +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
5607c58daa 🏷️ Add 'PickRandomlyAmong' function that picks one value from a set of values randomly
This will be used in a few places where we previously used a raw integer random to index into a local array for selection, simplifying that type of logic to a single statement.
2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves
5a69380074 ♻️ Leverage 'ItemType' enum 2021-09-13 00:25:49 +02:00
ephphatha
dda9a5dda0 Remove redundant else statements in L1*OperateDoor functions 2021-09-12 02:27:47 +02:00
ephphatha
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 <anders@jenbo.dk>

Fix alignment of WalkSettings array
2021-09-12 02:27:47 +02:00
Juliano Leal Goncalves
0d3d4c14f6
🚚 Rename 'Dead' concept to 'Corpse' everywhere (#2808) 2021-09-06 12:49:00 +02:00
Juliano Leal Goncalves
ef74b6f92d 🚚 Rename 'ObjectStruct' to 'Object' 2021-09-02 05:45:44 +02:00
Juliano Leal Goncalves
20db8d1a11 🚚 Rename 'MonsterStruct' to 'Monster' 2021-09-01 22:26:37 +02:00
Juliano Leal Goncalves
1cd62bbc64 🚚 Rename 'MonsterMode' members for semantic and consistency 2021-09-01 19:15:08 +02:00
Juliano Leal Goncalves
69a7cb66d4 ♻️ Convert 'MON_MODE' enum to 'MonsterMode' enum class 2021-09-01 19:15:08 +02:00
Juliano Leal Goncalves
bb2dfdfb73 🚚 Rename 'ItemStruct' to 'Item' 2021-08-30 13:40:08 +02:00
Anders Jenbo
4044fadeb5 Clean up some players references 2021-08-30 03:26:17 +02:00
Gleb Mazovetskiy
032eaf7491 External iterators for player items
Implements external iterators for player items.
2021-08-29 07:28:21 +02:00
Anders Jenbo
bf706f2fbb 🐛 Fix Phasing not working in Lazarus' camber
Previously an improper check was being done to see if the player was
located on the 3 teleporting pads in the level. Even if fixng this the
spell would not work correctly if the layer was standing on the pads
when casting the spell.

Simply use TARGET_BOTH to indicate that it should not be random and send
the player to the given destination
2021-08-28 03:43:59 +02:00
Anders Jenbo
4fd2e2dc97 🐛 Fix Phasing teleporting to invalid locations
Phasing could end up attempting to teleport to hunreds of random
location and still fail to find a valid target and send the player in to
a wall or outside the map.

This is fixed by first finding all valid locations within range and then
picking one of them at random.

Valid targets is a 13x13 area around the player minus the inner 7x7

In total there can be no more then 120 valid tiles and on average there
should be 75 avalible.
2021-08-28 03:43:59 +02:00
Robin
62a33c61d9
objects: deduplicate logic in OperateShrineGloomy using ForEachItem function 2021-08-27 11:41:45 +02:00
BC Ko
4df798808e
2435 refactor global variable Items part 2 (#2673) 2021-08-26 08:06:48 +02:00
Anders Jenbo
96b19ca8d5 Set _micaster type to mienemy_type
Rino never made use of the player id, so no reason to abuse _micaster
2021-08-23 10:51:06 +02:00
Anders Jenbo
3df8af0e9d Apply missile_id to _mitype 2021-08-21 09:10:53 +02:00