Commit Graph
186 Commits
Author SHA1 Message Date
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 046f826931 [gamepad/touch] Fix targeting berserked 2022-07-24 03:02:15 +02:00
ephphatha 9e76cd4ab7 Use object pointer for pcursobj 2022-07-19 13:20:24 +02:00
ephphathaandAnders Jenbo 3a7fd8da2d Only send and consume object location for location based messages
Co-authored-by: Anders Jenbo <[email protected]>
2022-07-19 12:50:00 +02:00
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Nicholas Calaway 67aaced610 Fix bad interaction between hold to attack and quick cast (#4965) 2022-07-11 21:26:29 +00: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
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +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
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
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
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
Anders Jenbo 6d56058708 Move level generation to subfolder 2022-06-23 09:21:58 +02:00
ephphatha 3af11ad355 Use the same function when checking and actually dropping an item 2022-06-21 18:53:19 +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
Andrew James 0add7a8af6 Define sizes using Size type in control.cpp/stash.cpp (#4737)
* Use appropriate types for size constants in control.cpp

* Declare constexpr value for iterating over the cells in a stash grid

* Use appropriate type for UIRectangle dimensions
2022-06-18 15:25:52 +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
staphen 128f5098e0 Check player hitpoints in InGameMenu() 2022-06-09 11:13:07 +02:00
Anders Jenbo 1203514383 Clean up use of currlevel 2022-06-07 21:35:01 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron 2b0b944afb Manage friendly mode per player and sync state between clients 2022-05-20 22:46:48 +02:00
Anders Jenbo 3aca1a50c3 Fix build error 2022-04-25 07:04:29 +02:00
ephphatha 0cfd0e194a Refactor TryDropItem to reduce use of globals
The way TryInvPut and DropItemBeforeTrig interacted was fragile, don't think this would've worked as expected at the best of times. Looks like it was added as part of controller support so guessing this isn't vanilla behaviour anyway.
2022-04-25 06:38:27 +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
ephphatha 7a3722d63b Add helper for clearing an item and using it's old value
Used when moving from one persistent variable to another where we want the source variable to be marked empty. Defining as a function instead of move constructor/assignment operator as we only really need to mark the source for xvalues. Detecting that in the constructor/assignment would be needlessly complicated.
2022-04-20 13:35:55 +02:00
ephphatha 8d3f39d2e5 Clear the held item if it is used to open a quest entrance 2022-04-18 19:25:55 +02:00
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
ephphatha 0595593f6f Move the adjustment for large items out of InvGetEquipSlotCoord 2022-04-16 05:54:03 +02:00
ephphatha c0a7f35bb9 Only attempt to lookup mouse position if the slot changes 2022-04-16 05:54:03 +02:00
ephphatha b2127d07dc Change InventoryMoveToBody side-effect to return value
This makes the call sites use the same pattern as every other inventory movement. See the next commit for why :D
2022-04-16 05:54:03 +02:00
ephphatha 40a0d6dda3 Replace uses of icursSize28 with local itemSize variable
Re-ordered the last couple of if conditions to make it clearer what the impact of the adjustments to mouse position are.
2022-04-16 05:54:03 +02:00
ephphatha 0adf0fb1f3 Use GetInventorySize in GetItemSizeOnSlot 2022-04-16 05:54:03 +02:00
ephphathaandqndel 907e1376b0 Add function to get item id at grid coords
Also introduced a few helper types and values to hopefully help document behaviour

correct spelling in comment

Co-authored-by: qndel <[email protected]>
2022-04-16 00:35:28 +02:00
ephphatha 5f788a6e04 Be explicit about the cursor overlap checks when acting on inventory cells 2022-04-15 09:41:37 +02:00
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00
Anders Jenbo 66d7a3c222 [gamepad] Reuse repeat logic from mouse 2022-04-13 02:13:31 +02:00
Gleb Mazovetskiy 235451ae5a Reduce debug log output of Control 2022-04-11 23:35:03 +02:00
staphen 2759eb130b Update player's spell target when using quick cast on gamepad 2022-04-10 17:32:16 +02:00
Gleb Mazovetskiy 4c2fa76e49 Controller mouse emulation fixes
1. Do not interrupt mouse mode on virtual clicks.
2. Handle virtual clicks directly instead of sending an SDL event.
3. Fix D-Pad mouse emulation state handling.
4. Hides the modifier hints during D-Pad mouse emulation.
2022-04-09 04:17:39 +02:00
Felipe Wannmacher 889cc04f95 Enhanced attack using controllers (#4019) 2022-04-04 14:19:16 +02:00
Gleb Mazovetskiy 79c7eee10a Mouse/Gamepad fixes
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.

This allows us to avoid a number of edge cases related to mode changes.

Fixes #4242
2022-04-03 23:06:36 +01:00
staphen e6182709d1 Allow casting Town Portal, Teleport, and Guardian scrolls from inventory 2022-04-03 23:37:00 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00
Anders Jenbo 8235380ef9 [gamepad] Avoid OOB on empty belt 2022-03-27 18:22:45 +02:00
Anders Jenbo 9d65580294 [gamepad] Fix managing belt 2022-03-27 10:01:29 +02:00
obligaron 481f15ded5 Introduce StashStruct.GetPage/SetPage 2022-03-20 23:42:55 +01:00
Anders Jenbo 6d28810dc7 Change infostr from char[128] to std::string 2022-03-20 14:23:30 +01:00