Commit Graph
63 Commits
Author SHA1 Message Date
obligaron b87711bc08 Reintroduce Player::spellFrom to seperate teleport cursor from queued spell 2023-04-17 03:22:50 +02:00
obligaron 1522dc7031 Multiplayer: Add arena potions 2023-04-13 21:20:53 +02:00
obligaron 590c990c80 Introduce Item::getName 2023-04-13 00:07:00 +02:00
obligaron 2296bf5625 Use StashStruct::EmptyCell instead for empty stash item check 2023-03-21 14:15:00 -04:00
staphen 58b48e17ea Fix OOB access when accessing stash 2023-02-17 04:58:44 +01:00
ikonomov 49894785b5 Update stash.cpp 2023-02-17 04:47:11 +01:00
obligaron 715e689ecb Introduce Item::isUsable() 2023-02-10 22:28:52 +01:00
KPhoenix a1fbf5253f enum talk_id -> enum class TalkID 2023-02-09 13:04:01 +01:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
Gleb Mazovetskiy ba56673d55 Only load stash graphics in town
Saves 69 KiB in the dungeon
2022-11-17 14:26:03 +01:00
KPhoenix 069ba7f1d4 [QOL] Colored slot backs (#5266) 2022-10-31 11:11:52 +01:00
Gleb Mazovetskiy 759ca7f055 WorldTileRectangle/Size
Adds a custom sized type for the world tile rectagle.

This allows us to better express intent.
It also allows us to make certain globals smaller, e.g. `THEME_LOC`.
2022-10-16 03:53:26 +01:00
staphen 8b6db3a678 Get rid of panelstr, pnumlines, and ClearPanel() 2022-10-02 08:51:24 +02:00
Gleb Mazovetskiy c351acbf7e Remove redundant devilutionx.mpq check
We now check it only once in `CheckArchivesUpToDate`.
We then use `LoadClx` instead of `LoadOptionalClx` throughout.
2022-08-04 15:16:00 +02:00
Gleb Mazovetskiy 17a97450bc Convert assets to CLX
Converted using the following commands:

```
cd Packaging/resources/assets
pcx2clx --transparent-color 1 --num-sprites 256 fonts/*.pcx && rm fonts/*.pcx
pcx2clx --num-sprites 2 ui_art/dvl_but_sml.pcx && rm ui_art/dvl_but_sml.pcx
pcx2clx --transparent-color 1 data/hintbox.pcx data/hintboxbackground.pcx && rm data/hintbox.pcx data/hintboxbackground.pcx
pcx2clx --transparent-color 1 --num-sprites 6 data/hinticons.pcx && rm data/hinticons.pcx
pcx2clx --num-sprites 2 data/panel8buc.pcx data/dirtybuc.pcx data/dirtybucp.pcx && rm data/panel8buc.pcx data/dirtybuc.pcx data/dirtybucp.pcx
pcx2clx --transparent-color 1 data/healthbox.pcx && rm data/healthbox.pcx
pcx2clx --transparent-color 1 --num-sprites 6 data/resistance.pcx && rm data/resistance.pcx
pcx2clx --transparent-color 1 --num-sprites 5 data/monstertags.pcx && rm data/monstertags.pcx
pcx2clx --transparent-color 1 data/stash.pcx && rm data/stash.pcx
pcx2clx --transparent-color 1 --num-sprites 5 data/stashnavbtns.pcx && rm data/stashnavbtns.pcx
pcx2clx **/*.pcx && rm **/*.pcx
git checkout master -- ui_art/black_diablo.pcx ui_art/black_hellfire.pcx data/charbg.pcx data/talkbutton.pcx data/panel8bucp.pcx
rm ui_art/black_diablo.clx ui_art/black_hellfire.clx data/charbg.clx data/talkbutton.clx data/panel8bucp.clx
```
2022-08-03 16:37:04 +02:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
Gleb Mazovetskiy 8ca71272b8 Load all CEL as CL2
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render.

CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97

Memory:

* Peak memory (while loading): -300 KiB
* Memory in-game (dLvl5): -700 KiB
* RG99 binary size: -15 KiB (1333096 -> 1317192)

Performance on rg99:

* On average, -1 FPS in town.
* Same FPS in dungeon (20 FPS on dLvl 1).
2022-07-19 10:59:35 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01: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
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
Anders Jenbo d82f2ebc9e Pass players by reference instead of an index 2022-06-28 00:30:00 +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
Gleb Mazovetskiy 8e9c9e0238 Reduced the size of OwnedCelSprite* by 8 bytes
`OwnedCelSpriteWithFrameHeight`: 40 -> 32
2022-06-20 01:11:22 +02: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
Vladimir Olteanu 2cc9d70fa6 Use decimal separators for gold and XP (#4722) 2022-06-18 09:13:59 +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
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
ephphatha ca48efc185 Update spell book requirements when refreshing stash items 2022-04-21 05:44: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
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 ad7ad46ce9 Explicitly clear HoldItem when putting an item into the Inventory/Stash
Previously this also relied on NewCursor modifying MyPlayer->HoldItem when setting the cursor to a non-item cursor to avoid item duplication, seems more appropriate to make this explicit in the caller.
2022-04-18 19:25:55 +02:00
ephphatha 7e7798fd2b Add function to mark an item as empty 2022-04-18 19:25:55 +02:00
ephphatha 56138ecf25 Invalidate held item when pasting into the stash
Makes use of that Item::isEmpty check in NewCursor to set the hand cursor when empty handed.
2022-04-18 16:59:34 +02:00
ephphatha 026b428c7d Add NewCursor(Item&) for setting the cursor based on a held item
The case for empty items should never be hit in the current code, but I've got a related PR that'll make use of that so adding it now.
2022-04-18 16:59:34 +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
Andrew James 538e3de309 Play sound after withdrawing gold from the stash
All gold related interactions a player can make with the stash now have audio feedback
2022-04-17 16:50:11 +02:00
Andrew James 08052fdf74 Play gold sound effect when depositing in stash
This adds a bit of audible feedback to help the player know that the action had an impact (along with the cursor changing and the count increasing).
2022-04-17 16:50:11 +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 cef42d47a8 Add function to get current grid 2022-04-16 00:35:28 +02:00
Andrew James 6dca3b50c1 Remove use of SetICursor and related globals from CheckStashPaste (#4429) 2022-04-14 23:36:17 +02:00
ephphatha 6a04d441c1 Expand hot area of stash cell to include bottom-right border
This matches the behaviour of inventory cell hit logic. Previously it was possible to click exactly on a border and be unable to put an item in the stash.
2022-04-14 18:02:56 +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
qndel 6e4542f444 increase max stash pages from 50 to 100 2022-04-04 14:12:37 +02:00
Andrew James 028c5945b8 Add helpers to change stash pages (#4287) 2022-04-02 10:54:25 +02:00
obligaron 7b7cee52db AddItemToStashGrid: Use PointsInRectangleRange with a starting position (#4297) 2022-04-02 09:07:34 +02:00
ephphatha e8e20c1159 Min, not max, when clamping stash page... 2022-03-31 13:50:04 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00